summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2014-03-18 22:36:27 +0000
committermiod <miod@openbsd.org>2014-03-18 22:36:27 +0000
commitfbe7d4c033ce635420b2c13710eea55df02e4009 (patch)
treec4a7e9952fd10b8bab25ad2f7306fb43eba193a0 /sys
parentTo prevent lock ordering problems with the kernel lock, we need to make sure (diff)
downloadwireguard-openbsd-fbe7d4c033ce635420b2c13710eea55df02e4009.tar.xz
wireguard-openbsd-fbe7d4c033ce635420b2c13710eea55df02e4009.zip
Retire hp300, mvme68k and mvme88k ports. These ports have no users, keeping
this hardware alive is becoming increasingly difficult, and I should heed the message sent by the three disks which have died on me over the last few days. Noone sane will mourn these ports anyway. So long, and thanks for the fish.
Diffstat (limited to 'sys')
-rw-r--r--sys/Makefile12
-rw-r--r--sys/arch/hp300/Makefile45
-rw-r--r--sys/arch/hp300/compile/.cvsignore2
-rw-r--r--sys/arch/hp300/conf/GENERIC144
-rw-r--r--sys/arch/hp300/conf/Makefile.hp300195
-rw-r--r--sys/arch/hp300/conf/RAMDISK144
-rw-r--r--sys/arch/hp300/conf/files.hp300227
-rw-r--r--sys/arch/hp300/dev/Makefile8
-rw-r--r--sys/arch/hp300/dev/apci.c978
-rw-r--r--sys/arch/hp300/dev/apci_subr.c119
-rw-r--r--sys/arch/hp300/dev/apcireg.h60
-rw-r--r--sys/arch/hp300/dev/apcivar.h65
-rw-r--r--sys/arch/hp300/dev/arcofi_dio.c105
-rw-r--r--sys/arch/hp300/dev/ct.c959
-rw-r--r--sys/arch/hp300/dev/ctreg.h152
-rw-r--r--sys/arch/hp300/dev/dca.c1114
-rw-r--r--sys/arch/hp300/dev/dcareg.h150
-rw-r--r--sys/arch/hp300/dev/dcm.c1672
-rw-r--r--sys/arch/hp300/dev/dcmreg.h253
-rw-r--r--sys/arch/hp300/dev/devlist2h.awk167
-rw-r--r--sys/arch/hp300/dev/dio.c366
-rw-r--r--sys/arch/hp300/dev/diodevs101
-rw-r--r--sys/arch/hp300/dev/diodevs.h198
-rw-r--r--sys/arch/hp300/dev/diodevs_data.h144
-rw-r--r--sys/arch/hp300/dev/diofb.c546
-rw-r--r--sys/arch/hp300/dev/diofb_mono.c245
-rw-r--r--sys/arch/hp300/dev/diofbreg.h94
-rw-r--r--sys/arch/hp300/dev/diofbvar.h148
-rw-r--r--sys/arch/hp300/dev/dioreg.h138
-rw-r--r--sys/arch/hp300/dev/diovar.h81
-rw-r--r--sys/arch/hp300/dev/dma.c572
-rw-r--r--sys/arch/hp300/dev/dmareg.h136
-rw-r--r--sys/arch/hp300/dev/dmavar.h75
-rw-r--r--sys/arch/hp300/dev/dnkbd.c1063
-rw-r--r--sys/arch/hp300/dev/dnkbdmap.c508
-rw-r--r--sys/arch/hp300/dev/dnkbdmap.h28
-rw-r--r--sys/arch/hp300/dev/dvbox.c431
-rw-r--r--sys/arch/hp300/dev/dvboxreg.h164
-rw-r--r--sys/arch/hp300/dev/fhpib.c673
-rw-r--r--sys/arch/hp300/dev/fhpibreg.h86
-rw-r--r--sys/arch/hp300/dev/frodo.c484
-rw-r--r--sys/arch/hp300/dev/frodoreg.h123
-rw-r--r--sys/arch/hp300/dev/frodovar.h49
-rw-r--r--sys/arch/hp300/dev/gbox.c452
-rw-r--r--sys/arch/hp300/dev/gboxreg.h105
-rw-r--r--sys/arch/hp300/dev/hd.c1330
-rw-r--r--sys/arch/hp300/dev/hdreg.h251
-rw-r--r--sys/arch/hp300/dev/hdvar.h90
-rw-r--r--sys/arch/hp300/dev/hil_intio.c105
-rw-r--r--sys/arch/hp300/dev/hp98265reg.h71
-rw-r--r--sys/arch/hp300/dev/hpib.c412
-rw-r--r--sys/arch/hp300/dev/hpibvar.h212
-rw-r--r--sys/arch/hp300/dev/hyper.c256
-rw-r--r--sys/arch/hp300/dev/hyperreg.h51
-rw-r--r--sys/arch/hp300/dev/if_le.c227
-rw-r--r--sys/arch/hp300/dev/if_lereg.h63
-rw-r--r--sys/arch/hp300/dev/if_levar.h52
-rw-r--r--sys/arch/hp300/dev/intio.c113
-rw-r--r--sys/arch/hp300/dev/intiovar.h44
-rw-r--r--sys/arch/hp300/dev/iotypes.h54
-rw-r--r--sys/arch/hp300/dev/isa_machdep.h40
-rw-r--r--sys/arch/hp300/dev/isabr.c1003
-rw-r--r--sys/arch/hp300/dev/isabrreg.h40
-rw-r--r--sys/arch/hp300/dev/maskbits.h90
-rw-r--r--sys/arch/hp300/dev/mb89352.c2010
-rw-r--r--sys/arch/hp300/dev/mb89352reg.h231
-rw-r--r--sys/arch/hp300/dev/mb89352var.h222
-rw-r--r--sys/arch/hp300/dev/mt.c981
-rw-r--r--sys/arch/hp300/dev/mtreg.h297
-rw-r--r--sys/arch/hp300/dev/nhpib.c555
-rw-r--r--sys/arch/hp300/dev/nhpibreg.h118
-rw-r--r--sys/arch/hp300/dev/ppi.c466
-rw-r--r--sys/arch/hp300/dev/ppiioctl.h61
-rw-r--r--sys/arch/hp300/dev/rbox.c394
-rw-r--r--sys/arch/hp300/dev/rboxreg.h120
-rw-r--r--sys/arch/hp300/dev/sgc.c147
-rw-r--r--sys/arch/hp300/dev/sgcreg.h41
-rw-r--r--sys/arch/hp300/dev/sgcvar.h45
-rw-r--r--sys/arch/hp300/dev/spc.c330
-rw-r--r--sys/arch/hp300/dev/sti_dio.c176
-rw-r--r--sys/arch/hp300/dev/sti_machdep.c85
-rw-r--r--sys/arch/hp300/dev/sti_machdep.h43
-rw-r--r--sys/arch/hp300/dev/sti_sgc.c149
-rw-r--r--sys/arch/hp300/dev/topcat.c522
-rw-r--r--sys/arch/hp300/dev/topcatreg.h117
-rw-r--r--sys/arch/hp300/dev/tvrx.c393
-rw-r--r--sys/arch/hp300/hp300/autoconf.c871
-rw-r--r--sys/arch/hp300/hp300/bus_space.c714
-rw-r--r--sys/arch/hp300/hp300/clock.c628
-rw-r--r--sys/arch/hp300/hp300/clockreg.h129
-rw-r--r--sys/arch/hp300/hp300/conf.c294
-rw-r--r--sys/arch/hp300/hp300/db_memrw.c207
-rw-r--r--sys/arch/hp300/hp300/disksubr.c141
-rw-r--r--sys/arch/hp300/hp300/genassym.cf171
-rw-r--r--sys/arch/hp300/hp300/intr.c304
-rw-r--r--sys/arch/hp300/hp300/kgdb_machdep.c80
-rw-r--r--sys/arch/hp300/hp300/leds.c95
-rw-r--r--sys/arch/hp300/hp300/leds.h52
-rw-r--r--sys/arch/hp300/hp300/locore.s1861
-rw-r--r--sys/arch/hp300/hp300/machdep.c1038
-rw-r--r--sys/arch/hp300/hp300/mem.c268
-rw-r--r--sys/arch/hp300/hp300/pmap_bootstrap.c123
-rw-r--r--sys/arch/hp300/hp300/sys_machdep.c64
-rw-r--r--sys/arch/hp300/hp300/trap.c1002
-rw-r--r--sys/arch/hp300/hp300/vectors.s147
-rw-r--r--sys/arch/hp300/hp300/vm_machdep.c258
-rw-r--r--sys/arch/hp300/hp300/wscons_machdep.c359
-rw-r--r--sys/arch/hp300/include/_float.h3
-rw-r--r--sys/arch/hp300/include/_types.h10
-rw-r--r--sys/arch/hp300/include/asm.h4
-rw-r--r--sys/arch/hp300/include/atomic.h10
-rw-r--r--sys/arch/hp300/include/autoconf.h45
-rw-r--r--sys/arch/hp300/include/bus.h281
-rw-r--r--sys/arch/hp300/include/cdefs.h8
-rw-r--r--sys/arch/hp300/include/cpu.h200
-rw-r--r--sys/arch/hp300/include/db_machdep.h5
-rw-r--r--sys/arch/hp300/include/disklabel.h40
-rw-r--r--sys/arch/hp300/include/endian.h5
-rw-r--r--sys/arch/hp300/include/exec.h31
-rw-r--r--sys/arch/hp300/include/fenv.h3
-rw-r--r--sys/arch/hp300/include/frame.h4
-rw-r--r--sys/arch/hp300/include/hil_machdep.h57
-rw-r--r--sys/arch/hp300/include/hp300spu.h77
-rw-r--r--sys/arch/hp300/include/ieee.h3
-rw-r--r--sys/arch/hp300/include/ieeefp.h5
-rw-r--r--sys/arch/hp300/include/intr.h111
-rw-r--r--sys/arch/hp300/include/kcore.h9
-rw-r--r--sys/arch/hp300/include/limits.h10
-rw-r--r--sys/arch/hp300/include/loadfile_machdep.h47
-rw-r--r--sys/arch/hp300/include/lock.h3
-rw-r--r--sys/arch/hp300/include/mutex.h3
-rw-r--r--sys/arch/hp300/include/param.h58
-rw-r--r--sys/arch/hp300/include/pcb.h42
-rw-r--r--sys/arch/hp300/include/pmap.h20
-rw-r--r--sys/arch/hp300/include/proc.h35
-rw-r--r--sys/arch/hp300/include/profile.h4
-rw-r--r--sys/arch/hp300/include/psl.h4
-rw-r--r--sys/arch/hp300/include/pte.h14
-rw-r--r--sys/arch/hp300/include/ptrace.h5
-rw-r--r--sys/arch/hp300/include/reg.h9
-rw-r--r--sys/arch/hp300/include/reloc.h3
-rw-r--r--sys/arch/hp300/include/setjmp.h4
-rw-r--r--sys/arch/hp300/include/signal.h5
-rw-r--r--sys/arch/hp300/include/spinlock.h3
-rw-r--r--sys/arch/hp300/include/stdarg.h5
-rw-r--r--sys/arch/hp300/include/tcb.h3
-rw-r--r--sys/arch/hp300/include/trap.h4
-rw-r--r--sys/arch/hp300/include/varargs.h5
-rw-r--r--sys/arch/hp300/include/vmparam.h64
-rw-r--r--sys/arch/hp300/stand/Makefile8
-rw-r--r--sys/arch/hp300/stand/Makefile.inc94
-rw-r--r--sys/arch/hp300/stand/cdboot/Makefile43
-rw-r--r--sys/arch/hp300/stand/cdboot/cdboot.c103
-rw-r--r--sys/arch/hp300/stand/cdboot/conf.c100
-rw-r--r--sys/arch/hp300/stand/cdboot/cons.c81
-rw-r--r--sys/arch/hp300/stand/cdboot/devopen.c260
-rw-r--r--sys/arch/hp300/stand/common/Makefile22
-rw-r--r--sys/arch/hp300/stand/common/apci.c159
-rw-r--r--sys/arch/hp300/stand/common/autoconf.c272
-rw-r--r--sys/arch/hp300/stand/common/cons.c104
-rw-r--r--sys/arch/hp300/stand/common/ct.c316
-rw-r--r--sys/arch/hp300/stand/common/dca.c129
-rw-r--r--sys/arch/hp300/stand/common/dcm.c156
-rw-r--r--sys/arch/hp300/stand/common/dnkbd.c179
-rw-r--r--sys/arch/hp300/stand/common/fhpib.c194
-rw-r--r--sys/arch/hp300/stand/common/hd.c362
-rw-r--r--sys/arch/hp300/stand/common/hil.c186
-rw-r--r--sys/arch/hp300/stand/common/hpib.c152
-rw-r--r--sys/arch/hp300/stand/common/if_le.c601
-rw-r--r--sys/arch/hp300/stand/common/ite.c344
-rw-r--r--sys/arch/hp300/stand/common/ite_dv.c202
-rw-r--r--sys/arch/hp300/stand/common/ite_gb.c145
-rw-r--r--sys/arch/hp300/stand/common/ite_hy.c80
-rw-r--r--sys/arch/hp300/stand/common/ite_rb.c145
-rw-r--r--sys/arch/hp300/stand/common/ite_sti.c358
-rw-r--r--sys/arch/hp300/stand/common/ite_subr.c404
-rw-r--r--sys/arch/hp300/stand/common/ite_tc.c133
-rw-r--r--sys/arch/hp300/stand/common/ite_tvrx.c74
-rw-r--r--sys/arch/hp300/stand/common/kbd.c95
-rw-r--r--sys/arch/hp300/stand/common/kbdconf.c62
-rw-r--r--sys/arch/hp300/stand/common/machdep.c208
-rw-r--r--sys/arch/hp300/stand/common/nhpib.c208
-rw-r--r--sys/arch/hp300/stand/common/scsi.c414
-rw-r--r--sys/arch/hp300/stand/common/sd.c260
-rw-r--r--sys/arch/hp300/stand/common/version.c33
-rw-r--r--sys/arch/hp300/stand/include/consdefs.h71
-rw-r--r--sys/arch/hp300/stand/include/device.h56
-rw-r--r--sys/arch/hp300/stand/include/grf_dvreg.h190
-rw-r--r--sys/arch/hp300/stand/include/grf_gbreg.h123
-rw-r--r--sys/arch/hp300/stand/include/grf_hyreg.h79
-rw-r--r--sys/arch/hp300/stand/include/grf_rbreg.h142
-rw-r--r--sys/arch/hp300/stand/include/grf_tcreg.h142
-rw-r--r--sys/arch/hp300/stand/include/hilreg.h150
-rw-r--r--sys/arch/hp300/stand/include/hpibvar.h102
-rw-r--r--sys/arch/hp300/stand/include/if_lereg.h159
-rw-r--r--sys/arch/hp300/stand/include/itereg.h52
-rw-r--r--sys/arch/hp300/stand/include/itevar.h136
-rw-r--r--sys/arch/hp300/stand/include/kbdvar.h63
-rw-r--r--sys/arch/hp300/stand/include/maskbits.h115
-rw-r--r--sys/arch/hp300/stand/include/rominfo.h65
-rw-r--r--sys/arch/hp300/stand/include/samachdep.h86
-rw-r--r--sys/arch/hp300/stand/include/scsireg.h483
-rw-r--r--sys/arch/hp300/stand/include/scsivar.h48
-rw-r--r--sys/arch/hp300/stand/include/volhdr.h78
-rw-r--r--sys/arch/hp300/stand/installboot/Makefile11
-rw-r--r--sys/arch/hp300/stand/installboot/installboot.sh27
-rw-r--r--sys/arch/hp300/stand/libsa/Makefile41
-rw-r--r--sys/arch/hp300/stand/libsa/devopen.c288
-rw-r--r--sys/arch/hp300/stand/libsa/exec_hp300.c60
-rw-r--r--sys/arch/hp300/stand/libsa/rawfs.c206
-rw-r--r--sys/arch/hp300/stand/libsa/rawfs.h16
-rw-r--r--sys/arch/hp300/stand/libsaz/Makefile13
-rw-r--r--sys/arch/hp300/stand/libz/Makefile14
-rw-r--r--sys/arch/hp300/stand/mkboot/Makefile13
-rw-r--r--sys/arch/hp300/stand/mkboot/mkboot.c277
-rw-r--r--sys/arch/hp300/stand/uboot/Makefile56
-rw-r--r--sys/arch/hp300/stand/uboot/clock.c156
-rw-r--r--sys/arch/hp300/stand/uboot/conf.c153
-rw-r--r--sys/arch/hp300/stand/uboot/netio.c179
-rw-r--r--sys/arch/hp300/stand/uboot/prf.c63
-rw-r--r--sys/arch/hp300/stand/uboot/srt0.S328
-rw-r--r--sys/arch/hp300/stand/uboot/tgets.c111
-rw-r--r--sys/arch/hp300/stand/uboot/uboot.c217
-rw-r--r--sys/arch/m68k/060sp/Makefile38
-rw-r--r--sys/arch/m68k/060sp/Makefile.inc26
-rw-r--r--sys/arch/m68k/060sp/ReadMe.NetBSD102
-rw-r--r--sys/arch/m68k/060sp/asm2gas240
-rw-r--r--sys/arch/m68k/060sp/changes129
-rw-r--r--sys/arch/m68k/060sp/copyright.S45
-rw-r--r--sys/arch/m68k/060sp/errata42
-rw-r--r--sys/arch/m68k/060sp/fnetbsd.S337
-rw-r--r--sys/arch/m68k/060sp/fplsp.doc240
-rw-r--r--sys/arch/m68k/060sp/fplsp.s10990
-rw-r--r--sys/arch/m68k/060sp/fplsp.sa1984
-rw-r--r--sys/arch/m68k/060sp/fpsp.doc300
-rw-r--r--sys/arch/m68k/060sp/fpsp.s24795
-rw-r--r--sys/arch/m68k/060sp/fpsp.sa3439
-rw-r--r--sys/arch/m68k/060sp/fskeletn.s351
-rw-r--r--sys/arch/m68k/060sp/ftest.s1466
-rw-r--r--sys/arch/m68k/060sp/ftest.sa409
-rw-r--r--sys/arch/m68k/060sp/ilsp.doc160
-rw-r--r--sys/arch/m68k/060sp/ilsp.s943
-rw-r--r--sys/arch/m68k/060sp/ilsp.sa139
-rw-r--r--sys/arch/m68k/060sp/inetbsd.S280
-rw-r--r--sys/arch/m68k/060sp/iskeletn.s292
-rw-r--r--sys/arch/m68k/060sp/isp.doc228
-rw-r--r--sys/arch/m68k/060sp/isp.s4310
-rw-r--r--sys/arch/m68k/060sp/isp.sa430
-rw-r--r--sys/arch/m68k/060sp/itest.s6396
-rw-r--r--sys/arch/m68k/060sp/itest.sa1315
-rw-r--r--sys/arch/m68k/060sp/misc211
-rw-r--r--sys/arch/m68k/060sp/netbsd.S365
-rw-r--r--sys/arch/m68k/060sp/os.s443
-rw-r--r--sys/arch/m68k/060sp/pfpsp.s14756
-rw-r--r--sys/arch/m68k/060sp/pfpsp.sa1768
-rw-r--r--sys/arch/m68k/060sp/readme81
-rw-r--r--sys/arch/m68k/060sp/test.doc218
-rw-r--r--sys/arch/m68k/Makefile7
-rw-r--r--sys/arch/m68k/conf/files.m68k40
-rw-r--r--sys/arch/m68k/fpsp/DYADIC.CI578
-rw-r--r--sys/arch/m68k/fpsp/DYADIC.GCC161
-rw-r--r--sys/arch/m68k/fpsp/DYADIC.GEN180
-rw-r--r--sys/arch/m68k/fpsp/DYADIC.R3V673
-rw-r--r--sys/arch/m68k/fpsp/FPSP.sa80
-rw-r--r--sys/arch/m68k/fpsp/L_ENTRY.AWK85
-rw-r--r--sys/arch/m68k/fpsp/L_LIST82
-rw-r--r--sys/arch/m68k/fpsp/MONADIC.CI594
-rw-r--r--sys/arch/m68k/fpsp/MONADIC.GCC204
-rw-r--r--sys/arch/m68k/fpsp/MONADIC.GEN231
-rw-r--r--sys/arch/m68k/fpsp/MONADIC.R3V692
-rw-r--r--sys/arch/m68k/fpsp/Makefile357
-rw-r--r--sys/arch/m68k/fpsp/Makefile.inc26
-rw-r--r--sys/arch/m68k/fpsp/asm2gas243
-rw-r--r--sys/arch/m68k/fpsp/bindec.sa948
-rw-r--r--sys/arch/m68k/fpsp/binstr.sa166
-rw-r--r--sys/arch/m68k/fpsp/bugfix.sa521
-rw-r--r--sys/arch/m68k/fpsp/copyright.s33
-rw-r--r--sys/arch/m68k/fpsp/decbin.sa535
-rw-r--r--sys/arch/m68k/fpsp/do_func.sa586
-rw-r--r--sys/arch/m68k/fpsp/fpsp.h374
-rw-r--r--sys/arch/m68k/fpsp/gen_except.sa494
-rw-r--r--sys/arch/m68k/fpsp/get_op.sa703
-rw-r--r--sys/arch/m68k/fpsp/kernel_ex.sa520
-rw-r--r--sys/arch/m68k/fpsp/l_fpsp.h281
-rw-r--r--sys/arch/m68k/fpsp/l_support.sa389
-rw-r--r--sys/arch/m68k/fpsp/netbsd.sa399
-rw-r--r--sys/arch/m68k/fpsp/res_func.sa2066
-rw-r--r--sys/arch/m68k/fpsp/round.sa674
-rw-r--r--sys/arch/m68k/fpsp/sacos.sa141
-rw-r--r--sys/arch/m68k/fpsp/sasin.sa130
-rw-r--r--sys/arch/m68k/fpsp/satan.sa504
-rw-r--r--sys/arch/m68k/fpsp/satanh.sa130
-rw-r--r--sys/arch/m68k/fpsp/scale.sa398
-rw-r--r--sys/arch/m68k/fpsp/scosh.sa157
-rw-r--r--sys/arch/m68k/fpsp/setox.sa890
-rw-r--r--sys/arch/m68k/fpsp/sgetem.sa167
-rw-r--r--sys/arch/m68k/fpsp/sint.sa273
-rw-r--r--sys/arch/m68k/fpsp/skeleton.sa483
-rw-r--r--sys/arch/m68k/fpsp/slog2.sa214
-rw-r--r--sys/arch/m68k/fpsp/slogn.sa618
-rw-r--r--sys/arch/m68k/fpsp/smovecr.sa188
-rw-r--r--sys/arch/m68k/fpsp/srem_mod.sa447
-rw-r--r--sys/arch/m68k/fpsp/ssin.sa772
-rw-r--r--sys/arch/m68k/fpsp/ssinh.sa161
-rw-r--r--sys/arch/m68k/fpsp/stan.sa481
-rw-r--r--sys/arch/m68k/fpsp/stanh.sa211
-rw-r--r--sys/arch/m68k/fpsp/sto_res.sa124
-rw-r--r--sys/arch/m68k/fpsp/stwotox.sa453
-rw-r--r--sys/arch/m68k/fpsp/tbldo.sa580
-rw-r--r--sys/arch/m68k/fpsp/util.sa775
-rw-r--r--sys/arch/m68k/fpsp/x_bsun.sa73
-rw-r--r--sys/arch/m68k/fpsp/x_fline.sa130
-rw-r--r--sys/arch/m68k/fpsp/x_operr.sa382
-rw-r--r--sys/arch/m68k/fpsp/x_ovfl.sa211
-rw-r--r--sys/arch/m68k/fpsp/x_snan.sa303
-rw-r--r--sys/arch/m68k/fpsp/x_store.sa283
-rw-r--r--sys/arch/m68k/fpsp/x_unfl.sa295
-rw-r--r--sys/arch/m68k/fpsp/x_unimp.sa103
-rw-r--r--sys/arch/m68k/fpsp/x_unsupp.sa108
-rw-r--r--sys/arch/m68k/include/_float.h71
-rw-r--r--sys/arch/m68k/include/_types.h141
-rw-r--r--sys/arch/m68k/include/asm.h161
-rw-r--r--sys/arch/m68k/include/atomic.h37
-rw-r--r--sys/arch/m68k/include/cdefs.h21
-rw-r--r--sys/arch/m68k/include/cpu.h266
-rw-r--r--sys/arch/m68k/include/db_machdep.h105
-rw-r--r--sys/arch/m68k/include/endian.h58
-rw-r--r--sys/arch/m68k/include/exec.h45
-rw-r--r--sys/arch/m68k/include/fenv.h97
-rw-r--r--sys/arch/m68k/include/frame.h309
-rw-r--r--sys/arch/m68k/include/ieee.h141
-rw-r--r--sys/arch/m68k/include/ieeefp.h24
-rw-r--r--sys/arch/m68k/include/intr.h107
-rw-r--r--sys/arch/m68k/include/kcore.h46
-rw-r--r--sys/arch/m68k/include/limits.h52
-rw-r--r--sys/arch/m68k/include/lock.h10
-rw-r--r--sys/arch/m68k/include/mutex.h61
-rw-r--r--sys/arch/m68k/include/param.h73
-rw-r--r--sys/arch/m68k/include/pcb.h66
-rw-r--r--sys/arch/m68k/include/pmap_motorola.h158
-rw-r--r--sys/arch/m68k/include/proc.h53
-rw-r--r--sys/arch/m68k/include/profile.h58
-rw-r--r--sys/arch/m68k/include/psl.h117
-rw-r--r--sys/arch/m68k/include/pte_motorola.h132
-rw-r--r--sys/arch/m68k/include/ptrace.h45
-rw-r--r--sys/arch/m68k/include/reg.h91
-rw-r--r--sys/arch/m68k/include/reloc.h47
-rw-r--r--sys/arch/m68k/include/setjmp.h8
-rw-r--r--sys/arch/m68k/include/signal.h67
-rw-r--r--sys/arch/m68k/include/spinlock.h14
-rw-r--r--sys/arch/m68k/include/stdarg.h62
-rw-r--r--sys/arch/m68k/include/tcb.h33
-rw-r--r--sys/arch/m68k/include/trap.h66
-rw-r--r--sys/arch/m68k/include/varargs.h58
-rw-r--r--sys/arch/m68k/include/vmparam.h117
-rw-r--r--sys/arch/m68k/m68k/bcopy.s0
-rw-r--r--sys/arch/m68k/m68k/cachectl.c169
-rw-r--r--sys/arch/m68k/m68k/copy.s339
-rw-r--r--sys/arch/m68k/m68k/copypage.s112
-rw-r--r--sys/arch/m68k/m68k/db_disasm.c3229
-rw-r--r--sys/arch/m68k/m68k/db_disasm.h432
-rw-r--r--sys/arch/m68k/m68k/db_interface.c160
-rw-r--r--sys/arch/m68k/m68k/db_memrw.c103
-rw-r--r--sys/arch/m68k/m68k/db_trace.c619
-rw-r--r--sys/arch/m68k/m68k/genassym.cf151
-rw-r--r--sys/arch/m68k/m68k/in_cksum.c100
-rw-r--r--sys/arch/m68k/m68k/kgdb_m68k.c150
-rw-r--r--sys/arch/m68k/m68k/m68k_machdep.c89
-rw-r--r--sys/arch/m68k/m68k/mutex.c88
-rw-r--r--sys/arch/m68k/m68k/oc_cksum.s184
-rw-r--r--sys/arch/m68k/m68k/pmap_bootstrap.c561
-rw-r--r--sys/arch/m68k/m68k/pmap_motorola.c2483
-rw-r--r--sys/arch/m68k/m68k/process_machdep.c184
-rw-r--r--sys/arch/m68k/m68k/regdump.c145
-rw-r--r--sys/arch/m68k/m68k/sig_machdep.c397
-rw-r--r--sys/arch/m68k/m68k/sigcode.s77
-rw-r--r--sys/arch/m68k/m68k/sigreturn.s84
-rw-r--r--sys/arch/m68k/m68k/softintr.c168
-rw-r--r--sys/arch/m68k/m68k/support.s68
-rw-r--r--sys/arch/m68k/m68k/trap_subr.s155
-rw-r--r--sys/arch/m88k/include/proc.h4
-rw-r--r--sys/arch/m88k/include/vmparam.h4
-rw-r--r--sys/arch/mvme68k/Makefile45
-rw-r--r--sys/arch/mvme68k/compile/.cvsignore7
-rw-r--r--sys/arch/mvme68k/conf/GENERIC121
-rw-r--r--sys/arch/mvme68k/conf/MVME14755
-rw-r--r--sys/arch/mvme68k/conf/MVME16264
-rw-r--r--sys/arch/mvme68k/conf/MVME16759
-rw-r--r--sys/arch/mvme68k/conf/MVME17758
-rw-r--r--sys/arch/mvme68k/conf/Makefile.mvme68k172
-rw-r--r--sys/arch/mvme68k/conf/RAMDISK127
-rw-r--r--sys/arch/mvme68k/conf/files.mvme68k162
-rw-r--r--sys/arch/mvme68k/dev/bpp.c368
-rw-r--r--sys/arch/mvme68k/dev/bppvar.h187
-rw-r--r--sys/arch/mvme68k/dev/cl.c2038
-rw-r--r--sys/arch/mvme68k/dev/clock.c762
-rw-r--r--sys/arch/mvme68k/dev/clreg.h158
-rw-r--r--sys/arch/mvme68k/dev/dart.c1039
-rw-r--r--sys/arch/mvme68k/dev/dart_lrc.c101
-rw-r--r--sys/arch/mvme68k/dev/dart_ofobio.c100
-rw-r--r--sys/arch/mvme68k/dev/dartreg.h146
-rw-r--r--sys/arch/mvme68k/dev/dartvar.h64
-rw-r--r--sys/arch/mvme68k/dev/flash.c503
-rw-r--r--sys/arch/mvme68k/dev/flashreg.h59
-rw-r--r--sys/arch/mvme68k/dev/fooip.c119
-rw-r--r--sys/arch/mvme68k/dev/i82596.h307
-rw-r--r--sys/arch/mvme68k/dev/if_ie.c1914
-rw-r--r--sys/arch/mvme68k/dev/if_ie.h148
-rw-r--r--sys/arch/mvme68k/dev/if_le.c371
-rw-r--r--sys/arch/mvme68k/dev/if_lereg.h90
-rw-r--r--sys/arch/mvme68k/dev/if_levar.h54
-rw-r--r--sys/arch/mvme68k/dev/ipic.c196
-rw-r--r--sys/arch/mvme68k/dev/ipicreg.h111
-rw-r--r--sys/arch/mvme68k/dev/lp.c142
-rw-r--r--sys/arch/mvme68k/dev/lrc.c232
-rw-r--r--sys/arch/mvme68k/dev/lrcreg.h175
-rw-r--r--sys/arch/mvme68k/dev/mainbus.c180
-rw-r--r--sys/arch/mvme68k/dev/mc.c235
-rw-r--r--sys/arch/mvme68k/dev/mcreg.h172
-rw-r--r--sys/arch/mvme68k/dev/memc.c125
-rw-r--r--sys/arch/mvme68k/dev/memcreg.h101
-rw-r--r--sys/arch/mvme68k/dev/memdevs.c73
-rw-r--r--sys/arch/mvme68k/dev/memdevs.h30
-rw-r--r--sys/arch/mvme68k/dev/nvram.c465
-rw-r--r--sys/arch/mvme68k/dev/nvramreg.h87
-rw-r--r--sys/arch/mvme68k/dev/ofobio.c214
-rw-r--r--sys/arch/mvme68k/dev/ofobioreg.h88
-rw-r--r--sys/arch/mvme68k/dev/osiop_mvme68k.c196
-rw-r--r--sys/arch/mvme68k/dev/pcc.c240
-rw-r--r--sys/arch/mvme68k/dev/pccreg.h156
-rw-r--r--sys/arch/mvme68k/dev/pcctwo.c183
-rw-r--r--sys/arch/mvme68k/dev/pcctworeg.h148
-rw-r--r--sys/arch/mvme68k/dev/sram.c223
-rw-r--r--sys/arch/mvme68k/dev/vme.c659
-rw-r--r--sys/arch/mvme68k/dev/vme.h337
-rw-r--r--sys/arch/mvme68k/dev/vmel.c175
-rw-r--r--sys/arch/mvme68k/dev/vmes.c172
-rw-r--r--sys/arch/mvme68k/dev/vs.c1364
-rw-r--r--sys/arch/mvme68k/dev/vsbic.c1627
-rw-r--r--sys/arch/mvme68k/dev/vsreg.h439
-rw-r--r--sys/arch/mvme68k/dev/vsvar.h151
-rw-r--r--sys/arch/mvme68k/dev/wdsc.c481
-rw-r--r--sys/arch/mvme68k/dev/wdscreg.h49
-rw-r--r--sys/arch/mvme68k/dev/wl.c1518
-rw-r--r--sys/arch/mvme68k/dev/wlreg.h222
-rw-r--r--sys/arch/mvme68k/dev/zs.c756
-rw-r--r--sys/arch/mvme68k/include/_float.h3
-rw-r--r--sys/arch/mvme68k/include/_types.h4
-rw-r--r--sys/arch/mvme68k/include/asm.h3
-rw-r--r--sys/arch/mvme68k/include/atomic.h10
-rw-r--r--sys/arch/mvme68k/include/autoconf.h65
-rw-r--r--sys/arch/mvme68k/include/bus.h802
-rw-r--r--sys/arch/mvme68k/include/cdefs.h3
-rw-r--r--sys/arch/mvme68k/include/conf.h54
-rw-r--r--sys/arch/mvme68k/include/cpu.h218
-rw-r--r--sys/arch/mvme68k/include/db_machdep.h6
-rw-r--r--sys/arch/mvme68k/include/disklabel.h135
-rw-r--r--sys/arch/mvme68k/include/endian.h4
-rw-r--r--sys/arch/mvme68k/include/exec.h30
-rw-r--r--sys/arch/mvme68k/include/fenv.h3
-rw-r--r--sys/arch/mvme68k/include/frame.h3
-rw-r--r--sys/arch/mvme68k/include/ieee.h3
-rw-r--r--sys/arch/mvme68k/include/ieeefp.h4
-rw-r--r--sys/arch/mvme68k/include/intr.h80
-rw-r--r--sys/arch/mvme68k/include/kcore.h3
-rw-r--r--sys/arch/mvme68k/include/limits.h9
-rw-r--r--sys/arch/mvme68k/include/loadfile_machdep.h47
-rw-r--r--sys/arch/mvme68k/include/lock.h3
-rw-r--r--sys/arch/mvme68k/include/mioctl.h28
-rw-r--r--sys/arch/mvme68k/include/mutex.h3
-rw-r--r--sys/arch/mvme68k/include/nvram.h78
-rw-r--r--sys/arch/mvme68k/include/param.h57
-rw-r--r--sys/arch/mvme68k/include/pcb.h41
-rw-r--r--sys/arch/mvme68k/include/pmap.h13
-rw-r--r--sys/arch/mvme68k/include/proc.h34
-rw-r--r--sys/arch/mvme68k/include/profile.h3
-rw-r--r--sys/arch/mvme68k/include/prom.h189
-rw-r--r--sys/arch/mvme68k/include/psl.h3
-rw-r--r--sys/arch/mvme68k/include/pte.h14
-rw-r--r--sys/arch/mvme68k/include/ptrace.h4
-rw-r--r--sys/arch/mvme68k/include/reg.h3
-rw-r--r--sys/arch/mvme68k/include/reloc.h3
-rw-r--r--sys/arch/mvme68k/include/setjmp.h3
-rw-r--r--sys/arch/mvme68k/include/signal.h4
-rw-r--r--sys/arch/mvme68k/include/spinlock.h3
-rw-r--r--sys/arch/mvme68k/include/stdarg.h4
-rw-r--r--sys/arch/mvme68k/include/tcb.h3
-rw-r--r--sys/arch/mvme68k/include/trap.h3
-rw-r--r--sys/arch/mvme68k/include/varargs.h4
-rw-r--r--sys/arch/mvme68k/include/vmparam.h64
-rw-r--r--sys/arch/mvme68k/include/z8530var.h68
-rw-r--r--sys/arch/mvme68k/mvme68k/autoconf.c298
-rw-r--r--sys/arch/mvme68k/mvme68k/bus_dma.c751
-rw-r--r--sys/arch/mvme68k/mvme68k/conf.c316
-rw-r--r--sys/arch/mvme68k/mvme68k/disksubr.c254
-rw-r--r--sys/arch/mvme68k/mvme68k/genassym.cf144
-rw-r--r--sys/arch/mvme68k/mvme68k/locore.s1904
-rw-r--r--sys/arch/mvme68k/mvme68k/machdep.c939
-rw-r--r--sys/arch/mvme68k/mvme68k/mem.c263
-rw-r--r--sys/arch/mvme68k/mvme68k/pmap_bootstrap.c147
-rw-r--r--sys/arch/mvme68k/mvme68k/sys_machdep.c67
-rw-r--r--sys/arch/mvme68k/mvme68k/trap.c1079
-rw-r--r--sys/arch/mvme68k/mvme68k/vectors.s171
-rw-r--r--sys/arch/mvme68k/mvme68k/vm_machdep.c269
-rw-r--r--sys/arch/mvme68k/stand/Makefile10
-rw-r--r--sys/arch/mvme68k/stand/Makefile.inc13
-rw-r--r--sys/arch/mvme68k/stand/bootsd/Makefile39
-rw-r--r--sys/arch/mvme68k/stand/bootsd/README7
-rw-r--r--sys/arch/mvme68k/stand/bootsd/boot.c117
-rw-r--r--sys/arch/mvme68k/stand/bootsd/conf.c21
-rw-r--r--sys/arch/mvme68k/stand/bootsd/version.c9
-rw-r--r--sys/arch/mvme68k/stand/bootst/Makefile43
-rw-r--r--sys/arch/mvme68k/stand/bootst/boot.c69
-rw-r--r--sys/arch/mvme68k/stand/bootst/conf.c19
-rw-r--r--sys/arch/mvme68k/stand/bootst/dev_tape.c160
-rw-r--r--sys/arch/mvme68k/stand/bootst/dev_tape.h8
-rw-r--r--sys/arch/mvme68k/stand/bootst/rawfs.c230
-rw-r--r--sys/arch/mvme68k/stand/bootst/rawfs.h16
-rw-r--r--sys/arch/mvme68k/stand/bootst/version.c9
-rw-r--r--sys/arch/mvme68k/stand/bootxx/Makefile37
-rw-r--r--sys/arch/mvme68k/stand/bootxx/bootxx.c142
-rw-r--r--sys/arch/mvme68k/stand/bootxx/conf.c15
-rw-r--r--sys/arch/mvme68k/stand/bugcrt/Makefile16
-rw-r--r--sys/arch/mvme68k/stand/bugcrt/Makefile.inc14
-rw-r--r--sys/arch/mvme68k/stand/bugcrt/bugcrt.c82
-rw-r--r--sys/arch/mvme68k/stand/bugcrt/bugcrtS.S95
-rw-r--r--sys/arch/mvme68k/stand/installboot/Makefile17
-rw-r--r--sys/arch/mvme68k/stand/installboot/installboot.882
-rw-r--r--sys/arch/mvme68k/stand/installboot/installboot.c464
-rw-r--r--sys/arch/mvme68k/stand/installboot/nlist.c157
-rw-r--r--sys/arch/mvme68k/stand/ld.script45
-rw-r--r--sys/arch/mvme68k/stand/libbug/Makefile19
-rw-r--r--sys/arch/mvme68k/stand/libbug/Makefile.inc14
-rw-r--r--sys/arch/mvme68k/stand/libbug/delay.c19
-rw-r--r--sys/arch/mvme68k/stand/libbug/diskrd.c22
-rw-r--r--sys/arch/mvme68k/stand/libbug/diskwr.c22
-rw-r--r--sys/arch/mvme68k/stand/libbug/getbrdid.c21
-rw-r--r--sys/arch/mvme68k/stand/libbug/inchr.c22
-rw-r--r--sys/arch/mvme68k/stand/libbug/instat.c21
-rw-r--r--sys/arch/mvme68k/stand/libbug/libbug.h23
-rw-r--r--sys/arch/mvme68k/stand/libbug/outln.c19
-rw-r--r--sys/arch/mvme68k/stand/libbug/outstr.c19
-rw-r--r--sys/arch/mvme68k/stand/libbug/putchar.c25
-rw-r--r--sys/arch/mvme68k/stand/libbug/return.c21
-rw-r--r--sys/arch/mvme68k/stand/libbug/rtc_rd.c18
-rw-r--r--sys/arch/mvme68k/stand/libsa/Makefile43
-rw-r--r--sys/arch/mvme68k/stand/libsa/Makefile.inc15
-rw-r--r--sys/arch/mvme68k/stand/libsa/SRT0.S77
-rw-r--r--sys/arch/mvme68k/stand/libsa/bugdev.c194
-rw-r--r--sys/arch/mvme68k/stand/libsa/clock.c56
-rw-r--r--sys/arch/mvme68k/stand/libsa/exec_mvme.c79
-rw-r--r--sys/arch/mvme68k/stand/libsa/libsa.h20
-rw-r--r--sys/arch/mvme68k/stand/libsa/parse_args.c91
-rw-r--r--sys/arch/mvme68k/stand/libz/Makefile9
-rw-r--r--sys/arch/mvme68k/stand/libz/Makefile.inc14
-rw-r--r--sys/arch/mvme68k/stand/netboot/Makefile40
-rw-r--r--sys/arch/mvme68k/stand/netboot/boot.c106
-rw-r--r--sys/arch/mvme68k/stand/netboot/conf.c34
-rw-r--r--sys/arch/mvme68k/stand/netboot/config.h61
-rw-r--r--sys/arch/mvme68k/stand/netboot/dev_net.c212
-rw-r--r--sys/arch/mvme68k/stand/netboot/dev_net.h8
-rw-r--r--sys/arch/mvme68k/stand/netboot/devopen.c31
-rw-r--r--sys/arch/mvme68k/stand/netboot/i82586.h306
-rw-r--r--sys/arch/mvme68k/stand/netboot/if_ie.c471
-rw-r--r--sys/arch/mvme68k/stand/netboot/if_iereg.h163
-rw-r--r--sys/arch/mvme68k/stand/netboot/if_le.c456
-rw-r--r--sys/arch/mvme68k/stand/netboot/if_lereg.h171
-rw-r--r--sys/arch/mvme68k/stand/netboot/version.c8
-rw-r--r--sys/arch/mvme68k/stand/prtvid/Makefile9
-rw-r--r--sys/arch/mvme68k/stand/prtvid/prtvid.c148
-rw-r--r--sys/arch/mvme68k/stand/sboot/Makefile48
-rw-r--r--sys/arch/mvme68k/stand/sboot/XBUG.S71
-rw-r--r--sys/arch/mvme68k/stand/sboot/XSRT0.S85
-rw-r--r--sys/arch/mvme68k/stand/sboot/clock.c110
-rw-r--r--sys/arch/mvme68k/stand/sboot/clockreg.h65
-rw-r--r--sys/arch/mvme68k/stand/sboot/etherfun.c217
-rw-r--r--sys/arch/mvme68k/stand/sboot/etherfun.h126
-rw-r--r--sys/arch/mvme68k/stand/sboot/if_le.c340
-rw-r--r--sys/arch/mvme68k/stand/sboot/if_lereg.h172
-rw-r--r--sys/arch/mvme68k/stand/sboot/oc_cksum.S183
-rw-r--r--sys/arch/mvme68k/stand/sboot/sboot.c180
-rw-r--r--sys/arch/mvme68k/stand/sboot/sboot.h81
-rw-r--r--sys/arch/mvme68k/stand/sboot/srec.c170
-rw-r--r--sys/arch/mvme68k/stand/wrtvid/Makefile9
-rw-r--r--sys/arch/mvme68k/stand/wrtvid/Makefile.inc14
-rw-r--r--sys/arch/mvme68k/stand/wrtvid/wrtvid.c158
-rw-r--r--sys/arch/mvme88k/Makefile45
-rw-r--r--sys/arch/mvme88k/compile/.cvsignore7
-rw-r--r--sys/arch/mvme88k/conf/GENERIC98
-rw-r--r--sys/arch/mvme88k/conf/GENERIC.MP15
-rw-r--r--sys/arch/mvme88k/conf/M18172
-rw-r--r--sys/arch/mvme88k/conf/M18780
-rw-r--r--sys/arch/mvme88k/conf/M18874
-rw-r--r--sys/arch/mvme88k/conf/M19776
-rw-r--r--sys/arch/mvme88k/conf/Makefile.mvme88k170
-rw-r--r--sys/arch/mvme88k/conf/RAMDISK100
-rw-r--r--sys/arch/mvme88k/conf/files.mvme88k126
-rw-r--r--sys/arch/mvme88k/conf/ld.script50
-rw-r--r--sys/arch/mvme88k/dev/angelfire.c168
-rw-r--r--sys/arch/mvme88k/dev/bpp.c375
-rw-r--r--sys/arch/mvme88k/dev/bppvar.h187
-rw-r--r--sys/arch/mvme88k/dev/bugio.c186
-rw-r--r--sys/arch/mvme88k/dev/bussw.c166
-rw-r--r--sys/arch/mvme88k/dev/busswreg.h207
-rw-r--r--sys/arch/mvme88k/dev/cl.c1780
-rw-r--r--sys/arch/mvme88k/dev/clreg.h125
-rw-r--r--sys/arch/mvme88k/dev/dart.c410
-rw-r--r--sys/arch/mvme88k/dev/ds1216.c298
-rw-r--r--sys/arch/mvme88k/dev/i82596.h307
-rw-r--r--sys/arch/mvme88k/dev/if_ie.c1902
-rw-r--r--sys/arch/mvme88k/dev/if_ie.h148
-rw-r--r--sys/arch/mvme88k/dev/if_le.c309
-rw-r--r--sys/arch/mvme88k/dev/if_lereg.h84
-rw-r--r--sys/arch/mvme88k/dev/if_levar.h52
-rw-r--r--sys/arch/mvme88k/dev/mainbus.c334
-rw-r--r--sys/arch/mvme88k/dev/memc.c127
-rw-r--r--sys/arch/mvme88k/dev/memcreg.h101
-rw-r--r--sys/arch/mvme88k/dev/memdevs.c73
-rw-r--r--sys/arch/mvme88k/dev/memdevs.h8
-rw-r--r--sys/arch/mvme88k/dev/nvram.c494
-rw-r--r--sys/arch/mvme88k/dev/nvramreg.h89
-rw-r--r--sys/arch/mvme88k/dev/osiop_pcctwo.c194
-rw-r--r--sys/arch/mvme88k/dev/pcctwo.c194
-rw-r--r--sys/arch/mvme88k/dev/pcctworeg.h130
-rw-r--r--sys/arch/mvme88k/dev/pcctwovar.h41
-rw-r--r--sys/arch/mvme88k/dev/sram.c177
-rw-r--r--sys/arch/mvme88k/dev/syscon.c172
-rw-r--r--sys/arch/mvme88k/dev/vme.c426
-rw-r--r--sys/arch/mvme88k/dev/vme.h301
-rw-r--r--sys/arch/mvme88k/dev/vmel.c170
-rw-r--r--sys/arch/mvme88k/dev/vmes.c175
-rw-r--r--sys/arch/mvme88k/dev/vs.c1353
-rw-r--r--sys/arch/mvme88k/dev/vsbic.c1626
-rw-r--r--sys/arch/mvme88k/dev/vsreg.h439
-rw-r--r--sys/arch/mvme88k/dev/vsvar.h151
-rw-r--r--sys/arch/mvme88k/dev/vx.c1523
-rw-r--r--sys/arch/mvme88k/dev/vxreg.h414
-rw-r--r--sys/arch/mvme88k/include/_float.h3
-rw-r--r--sys/arch/mvme88k/include/_types.h4
-rw-r--r--sys/arch/mvme88k/include/asm.h3
-rw-r--r--sys/arch/mvme88k/include/asm_macro.h3
-rw-r--r--sys/arch/mvme88k/include/atomic.h10
-rw-r--r--sys/arch/mvme88k/include/autoconf.h69
-rw-r--r--sys/arch/mvme88k/include/board.h115
-rw-r--r--sys/arch/mvme88k/include/bug.h17
-rw-r--r--sys/arch/mvme88k/include/bugio.h16
-rw-r--r--sys/arch/mvme88k/include/bus.h811
-rw-r--r--sys/arch/mvme88k/include/cdefs.h4
-rw-r--r--sys/arch/mvme88k/include/cmmu.h3
-rw-r--r--sys/arch/mvme88k/include/conf.h48
-rw-r--r--sys/arch/mvme88k/include/cpu.h60
-rw-r--r--sys/arch/mvme88k/include/db_machdep.h12
-rw-r--r--sys/arch/mvme88k/include/disklabel.h120
-rw-r--r--sys/arch/mvme88k/include/endian.h3
-rw-r--r--sys/arch/mvme88k/include/exec.h3
-rw-r--r--sys/arch/mvme88k/include/fenv.h3
-rw-r--r--sys/arch/mvme88k/include/fpu.h3
-rw-r--r--sys/arch/mvme88k/include/frame.h3
-rw-r--r--sys/arch/mvme88k/include/ieee.h3
-rw-r--r--sys/arch/mvme88k/include/ieeefp.h3
-rw-r--r--sys/arch/mvme88k/include/intr.h151
-rw-r--r--sys/arch/mvme88k/include/kcore.h3
-rw-r--r--sys/arch/mvme88k/include/limits.h3
-rw-r--r--sys/arch/mvme88k/include/loadfile_machdep.h47
-rw-r--r--sys/arch/mvme88k/include/lock.h3
-rw-r--r--sys/arch/mvme88k/include/m88100.h3
-rw-r--r--sys/arch/mvme88k/include/m88110.h216
-rw-r--r--sys/arch/mvme88k/include/m8820x.h73
-rw-r--r--sys/arch/mvme88k/include/m88410.h58
-rw-r--r--sys/arch/mvme88k/include/mioctl.h28
-rw-r--r--sys/arch/mvme88k/include/mmu.h3
-rw-r--r--sys/arch/mvme88k/include/mplock.h3
-rw-r--r--sys/arch/mvme88k/include/mutex.h3
-rw-r--r--sys/arch/mvme88k/include/mvme181.h59
-rw-r--r--sys/arch/mvme88k/include/mvme187.h66
-rw-r--r--sys/arch/mvme88k/include/mvme188.h218
-rw-r--r--sys/arch/mvme88k/include/mvme197.h69
-rw-r--r--sys/arch/mvme88k/include/param.h70
-rw-r--r--sys/arch/mvme88k/include/pcb.h3
-rw-r--r--sys/arch/mvme88k/include/pmap.h3
-rw-r--r--sys/arch/mvme88k/include/pmap_table.h3
-rw-r--r--sys/arch/mvme88k/include/proc.h3
-rw-r--r--sys/arch/mvme88k/include/profile.h3
-rw-r--r--sys/arch/mvme88k/include/prom.h218
-rw-r--r--sys/arch/mvme88k/include/psl.h3
-rw-r--r--sys/arch/mvme88k/include/ptrace.h3
-rw-r--r--sys/arch/mvme88k/include/reg.h3
-rw-r--r--sys/arch/mvme88k/include/reloc.h3
-rw-r--r--sys/arch/mvme88k/include/setjmp.h3
-rw-r--r--sys/arch/mvme88k/include/signal.h3
-rw-r--r--sys/arch/mvme88k/include/spinlock.h3
-rw-r--r--sys/arch/mvme88k/include/stdarg.h3
-rw-r--r--sys/arch/mvme88k/include/tcb.h3
-rw-r--r--sys/arch/mvme88k/include/trap.h4
-rw-r--r--sys/arch/mvme88k/include/varargs.h3
-rw-r--r--sys/arch/mvme88k/include/vmparam.h12
-rw-r--r--sys/arch/mvme88k/mvme88k/autoconf.c210
-rw-r--r--sys/arch/mvme88k/mvme88k/bus_dma.c684
-rw-r--r--sys/arch/mvme88k/mvme88k/clock.c104
-rw-r--r--sys/arch/mvme88k/mvme88k/clockvar.h81
-rw-r--r--sys/arch/mvme88k/mvme88k/conf.c295
-rw-r--r--sys/arch/mvme88k/mvme88k/db_machdep.c48
-rw-r--r--sys/arch/mvme88k/mvme88k/disksubr.c254
-rw-r--r--sys/arch/mvme88k/mvme88k/eh.S172
-rw-r--r--sys/arch/mvme88k/mvme88k/genassym.cf1
-rw-r--r--sys/arch/mvme88k/mvme88k/locore.S330
-rw-r--r--sys/arch/mvme88k/mvme88k/m181_machdep.c756
-rw-r--r--sys/arch/mvme88k/mvme88k/m187_machdep.c271
-rw-r--r--sys/arch/mvme88k/mvme88k/m188_machdep.c1257
-rw-r--r--sys/arch/mvme88k/mvme88k/m197_machdep.c809
-rw-r--r--sys/arch/mvme88k/mvme88k/m1x7_machdep.c488
-rw-r--r--sys/arch/mvme88k/mvme88k/m88110.c1206
-rw-r--r--sys/arch/mvme88k/mvme88k/m8820x.c326
-rw-r--r--sys/arch/mvme88k/mvme88k/m88410.c202
-rw-r--r--sys/arch/mvme88k/mvme88k/machdep.c1080
-rw-r--r--sys/arch/mvme88k/mvme88k/pmap_table.c41
-rw-r--r--sys/arch/mvme88k/stand/Makefile11
-rw-r--r--sys/arch/mvme88k/stand/Makefile.inc13
-rw-r--r--sys/arch/mvme88k/stand/bootsd/Makefile37
-rw-r--r--sys/arch/mvme88k/stand/bootsd/boot.c117
-rw-r--r--sys/arch/mvme88k/stand/bootsd/conf.c20
-rw-r--r--sys/arch/mvme88k/stand/bootsd/version.c12
-rw-r--r--sys/arch/mvme88k/stand/bootst/Makefile41
-rw-r--r--sys/arch/mvme88k/stand/bootst/boot.c66
-rw-r--r--sys/arch/mvme88k/stand/bootst/conf.c19
-rw-r--r--sys/arch/mvme88k/stand/bootst/dev_tape.c164
-rw-r--r--sys/arch/mvme88k/stand/bootst/dev_tape.h7
-rw-r--r--sys/arch/mvme88k/stand/bootst/rawfs.c230
-rw-r--r--sys/arch/mvme88k/stand/bootst/rawfs.h15
-rw-r--r--sys/arch/mvme88k/stand/bootst/version.c12
-rw-r--r--sys/arch/mvme88k/stand/bootxx/Makefile36
-rw-r--r--sys/arch/mvme88k/stand/bootxx/bootxx.c155
-rw-r--r--sys/arch/mvme88k/stand/bootxx/conf.c14
-rw-r--r--sys/arch/mvme88k/stand/bugcrt/Makefile32
-rw-r--r--sys/arch/mvme88k/stand/bugcrt/Makefile.inc29
-rw-r--r--sys/arch/mvme88k/stand/bugcrt/crt0.S214
-rw-r--r--sys/arch/mvme88k/stand/installboot/Makefile19
-rw-r--r--sys/arch/mvme88k/stand/installboot/installboot.882
-rw-r--r--sys/arch/mvme88k/stand/installboot/installboot.c476
-rw-r--r--sys/arch/mvme88k/stand/installboot/nlist.c157
-rw-r--r--sys/arch/mvme88k/stand/ld.script46
-rw-r--r--sys/arch/mvme88k/stand/libbug/Makefile20
-rw-r--r--sys/arch/mvme88k/stand/libbug/Makefile.inc14
-rw-r--r--sys/arch/mvme88k/stand/libbug/delay.c18
-rw-r--r--sys/arch/mvme88k/stand/libbug/diskrd.c22
-rw-r--r--sys/arch/mvme88k/stand/libbug/diskwr.c22
-rw-r--r--sys/arch/mvme88k/stand/libbug/getbrdid.c20
-rw-r--r--sys/arch/mvme88k/stand/libbug/inchr.c22
-rw-r--r--sys/arch/mvme88k/stand/libbug/instat.c20
-rw-r--r--sys/arch/mvme88k/stand/libbug/libbug.h34
-rw-r--r--sys/arch/mvme88k/stand/libbug/netcfig.c15
-rw-r--r--sys/arch/mvme88k/stand/libbug/netctrl.c15
-rw-r--r--sys/arch/mvme88k/stand/libbug/netfopen.c20
-rw-r--r--sys/arch/mvme88k/stand/libbug/netfread.c20
-rw-r--r--sys/arch/mvme88k/stand/libbug/outstr.c18
-rw-r--r--sys/arch/mvme88k/stand/libbug/prom.h31
-rw-r--r--sys/arch/mvme88k/stand/libbug/putchar.c24
-rw-r--r--sys/arch/mvme88k/stand/libbug/return.c20
-rw-r--r--sys/arch/mvme88k/stand/libbug/rtc_rd.c17
-rw-r--r--sys/arch/mvme88k/stand/libsa/Makefile50
-rw-r--r--sys/arch/mvme88k/stand/libsa/Makefile.inc14
-rw-r--r--sys/arch/mvme88k/stand/libsa/board.c60
-rw-r--r--sys/arch/mvme88k/stand/libsa/bugdev.c206
-rw-r--r--sys/arch/mvme88k/stand/libsa/clock.c56
-rw-r--r--sys/arch/mvme88k/stand/libsa/exec_mvme.c81
-rw-r--r--sys/arch/mvme88k/stand/libsa/fault.c152
-rw-r--r--sys/arch/mvme88k/stand/libsa/libsa.h26
-rw-r--r--sys/arch/mvme88k/stand/libsa/parse_args.c89
-rw-r--r--sys/arch/mvme88k/stand/libsa/setjmp.S79
-rw-r--r--sys/arch/mvme88k/stand/libz/Makefile9
-rw-r--r--sys/arch/mvme88k/stand/libz/Makefile.inc14
-rw-r--r--sys/arch/mvme88k/stand/netboot/Makefile42
-rw-r--r--sys/arch/mvme88k/stand/netboot/boot.c112
-rw-r--r--sys/arch/mvme88k/stand/netboot/conf.c25
-rw-r--r--sys/arch/mvme88k/stand/netboot/config.h46
-rw-r--r--sys/arch/mvme88k/stand/netboot/dev_net.c182
-rw-r--r--sys/arch/mvme88k/stand/netboot/dev_net.h7
-rw-r--r--sys/arch/mvme88k/stand/netboot/devices.c99
-rw-r--r--sys/arch/mvme88k/stand/netboot/devopen.c31
-rw-r--r--sys/arch/mvme88k/stand/netboot/i82586.h306
-rw-r--r--sys/arch/mvme88k/stand/netboot/if_ie.c433
-rw-r--r--sys/arch/mvme88k/stand/netboot/if_le.c533
-rw-r--r--sys/arch/mvme88k/stand/netboot/if_lereg.h206
-rw-r--r--sys/arch/mvme88k/stand/netboot/netif.c299
-rw-r--r--sys/arch/mvme88k/stand/netboot/version.c13
-rw-r--r--sys/arch/mvme88k/stand/prtvid/Makefile8
-rw-r--r--sys/arch/mvme88k/stand/prtvid/prtvid.c158
-rw-r--r--sys/arch/mvme88k/stand/prtvid/vid.h62
-rw-r--r--sys/arch/mvme88k/stand/sboot/Makefile43
-rw-r--r--sys/arch/mvme88k/stand/sboot/devices.c160
-rw-r--r--sys/arch/mvme88k/stand/sboot/devopen.c69
-rw-r--r--sys/arch/mvme88k/stand/sboot/sboot.c111
-rw-r--r--sys/arch/mvme88k/stand/sboot/version.c6
-rw-r--r--sys/arch/mvme88k/stand/tftpboot/Makefile39
-rw-r--r--sys/arch/mvme88k/stand/tftpboot/boot.c80
-rw-r--r--sys/arch/mvme88k/stand/tftpboot/conf.c22
-rw-r--r--sys/arch/mvme88k/stand/tftpboot/netdev.c201
-rw-r--r--sys/arch/mvme88k/stand/tftpboot/netdev.h6
-rw-r--r--sys/arch/mvme88k/stand/tftpboot/tftpfs.c289
-rw-r--r--sys/arch/mvme88k/stand/tftpboot/tftpfs.h43
-rw-r--r--sys/arch/mvme88k/stand/tftpboot/version.c16
-rw-r--r--sys/arch/mvme88k/stand/wrtvid/Makefile8
-rw-r--r--sys/arch/mvme88k/stand/wrtvid/Makefile.inc13
-rw-r--r--sys/arch/mvme88k/stand/wrtvid/wrtvid.c169
-rw-r--r--sys/conf/files6
-rw-r--r--sys/dev/ic/sti.c45
-rw-r--r--sys/dev/isa/isavar.h4
-rw-r--r--sys/kern/Makefile6
-rw-r--r--sys/lib/libkern/arch/m68k/DEFS.h4
-rw-r--r--sys/lib/libkern/arch/m68k/SYS.h76
-rw-r--r--sys/lib/libkern/arch/m68k/bcmp.S83
-rw-r--r--sys/lib/libkern/arch/m68k/bcopy.S1
-rw-r--r--sys/lib/libkern/arch/m68k/bzero.S72
-rw-r--r--sys/lib/libkern/arch/m68k/ffs.S48
-rw-r--r--sys/lib/libkern/arch/m68k/htonl.S45
-rw-r--r--sys/lib/libkern/arch/m68k/htons.S46
-rw-r--r--sys/lib/libkern/arch/m68k/memcmp.S92
-rw-r--r--sys/lib/libkern/arch/m68k/memcpy.S1
-rw-r--r--sys/lib/libkern/arch/m68k/memmove.S132
-rw-r--r--sys/lib/libkern/arch/m68k/memset.S103
-rw-r--r--sys/lib/libkern/arch/m68k/scanc.S64
-rw-r--r--sys/lib/libkern/arch/m68k/skpc.S58
-rw-r--r--sys/lib/libkern/arch/m68k/strcmp.S58
-rw-r--r--sys/lib/libkern/arch/m68k/strlen.S45
-rw-r--r--sys/lib/libkern/arch/m68k/strncmp.S63
-rw-r--r--sys/lib/libkern/arch/m68k/strncpy.S55
826 files changed, 18 insertions, 231048 deletions
diff --git a/sys/Makefile b/sys/Makefile
index 4f3391c6a83..3f86c9674fa 100644
--- a/sys/Makefile
+++ b/sys/Makefile
@@ -1,13 +1,13 @@
-# $OpenBSD: Makefile,v 1.40 2013/09/04 19:43:20 patrick Exp $
+# $OpenBSD: Makefile,v 1.41 2014/03/18 22:36:31 miod Exp $
# $NetBSD: Makefile,v 1.5 1995/09/15 21:05:21 pk Exp $
SUBDIR= dev/microcode \
arch/alpha arch/amd64 arch/armish arch/armv7 arch/aviion \
- arch/hp300 arch/hppa arch/hppa64 arch/i386 arch/landisk \
- arch/loongson arch/luna88k arch/m68k arch/macppc \
- arch/mvme68k arch/mvme88k arch/octeon arch/sgi \
- arch/socppc arch/solbourne arch/sparc arch/sparc64 arch/vax \
- arch/zaurus
+ arch/hppa arch/hppa64 arch/i386 \
+ arch/landisk arch/loongson arch/luna88k \
+ arch/macppc arch/octeon \
+ arch/sgi arch/socppc arch/solbourne arch/sparc arch/sparc64 \
+ arch/vax arch/zaurus
tags:
cd ${.CURDIR}/kern; make tags
diff --git a/sys/arch/hp300/Makefile b/sys/arch/hp300/Makefile
deleted file mode 100644
index 353fc02b06d..00000000000
--- a/sys/arch/hp300/Makefile
+++ /dev/null
@@ -1,45 +0,0 @@
-# $OpenBSD: Makefile,v 1.13 2013/12/08 14:46:39 espie Exp $
-
-S= ${.CURDIR}/../..
-KFILE= GENERIC
-.if exists(conf/GENERIC.MP)
-KFILE= GENERIC.MP
-.endif
-TDIRS= ${_arch} include
-TAGS= ${.CURDIR}/tags
-
-NOPROG=
-NOMAN=
-NOOBJ=
-SUBDIR= stand
-
-# config the fattest kernel we can find into a temporary dir
-# to create a Makefile. Then use make to pull some variables
-# out and push them into the sub-shell to expand the paths,
-# and finally run ctags.
-tags::
- TDIR=`mktemp -d /tmp/_tagXXXXXXXXXX` || exit 1; \
- eval "S=${S}" && \
- config -s ${S} -b $${TDIR} ${.CURDIR}/conf/${KFILE} && \
- eval "_arch=\"`make -V _arch -f $${TDIR}/Makefile`\"" && \
- eval "_mach=\"`make -V _mach -f $${TDIR}/Makefile`\"" && \
- eval "_machdir=\$S/arch/$${_mach}" && \
- eval "_archdir=\$S/arch/$${_arch}" && \
- eval "HFILES=\"`find $S \( -path $S/'arch' -o -path $S/stand -o -path $S/lib/libsa -o -path $S'/lib/libkern/arch' \) -prune -o -name '*.h'; find $${_machdir} $${_archdir} $S/lib/libkern/arch/$${_mach} \( -name boot -o -name stand \) -prune -o -name '*.h'`\"" && \
- eval "SFILES=\"`make -V SFILES -f $${TDIR}/Makefile`\"" && \
- eval "CFILES=\"`make -V CFILES -f $${TDIR}/Makefile`\"" && \
- eval "AFILES=\"`make -V AFILES -f $${TDIR}/Makefile`\"" && \
- ctags -wd -f ${TAGS} $${CFILES} $${HFILES} && \
- egrep "^[_A-Z]*ENTRY[_A-Z]*\(.*\)" $${SFILES} $${AFILES} | \
- sed "s;\\([^:]*\\):\\([^(]*\\)(\\([^, )]*\\)\\(.*\\);\\3 \\1 /^\\2(\\3\\4$$/;" \
- >> ${TAGS} && \
- sort -o ${TAGS} ${TAGS} && \
- rm -rf $${TDIR}
-
-links:
- -for i in conf ${TDIRS}; do \
- (cd $$i && rm -f tags; ln -s tags tags); done
-
-obj: _SUBDIRUSE
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/hp300/compile/.cvsignore b/sys/arch/hp300/compile/.cvsignore
deleted file mode 100644
index b72af3039e6..00000000000
--- a/sys/arch/hp300/compile/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-GENERIC
-RAMDISK
diff --git a/sys/arch/hp300/conf/GENERIC b/sys/arch/hp300/conf/GENERIC
deleted file mode 100644
index 2457542053a..00000000000
--- a/sys/arch/hp300/conf/GENERIC
+++ /dev/null
@@ -1,144 +0,0 @@
-# $OpenBSD: GENERIC,v 1.55 2011/12/21 23:12:03 miod Exp $
-#
-# For further information on compiling OpenBSD kernels, see the config(8)
-# man page.
-#
-# For further information on hardware support for this architecture, see
-# the intro(4) man page. For further information about kernel options
-# for this architecture, see the options(4) man page. For an explanation
-# of each device driver in this file see the section 4 man page for the
-# device.
-
-machine hp300 m68k
-include "../../../conf/GENERIC"
-maxusers 32 # estimated number of users
-
-# Support for various CPU types
-option HP340
-option HP345
-option HP360
-option HP362
-option HP370
-option HP375
-option HP380
-option HP382
-option HP385
-option HP400
-option HP425
-option HP433
-
-# Options for HP hardware
-option USELEDS # make the lights twinkle
-#option CONSCODE="9" # force console at this select code for DIO
- # or DIO-II devices, or 256 + slot number
- # for SGC devices
-
-option WSDISPLAY_COMPAT_RAWKBD # provide raw scancodes; needed for X11
-
-# Verbose descriptions of unconfigured DIO devices
-# (Warning: this compiles in a large string table)
-option DIOVERBOSE # recognize "unknown" DIO devices
-
-config bsd swap generic
-
-mainbus0 at root # root "bus"
-
-intio0 at mainbus0 # internal i/o space
-dio0 at mainbus0 # DIO/DIO-II bus
-sgc0 at mainbus0 # SGC bus on some 4xx models
-
-# Human Interface Loop devices
-hil0 at intio? # HIL controller
-hilkbd* at hil? # keyboards
-wskbd* at hilkbd? mux 1
-hilms* at hil? # mice, buttons and tablets
-wsmouse* at hilms? mux 0
-hilid* at hil? # ID module
-
-# Frodo utility chip found on 382 and 4xx's
-frodo0 at intio?
-#isabr0 at frodo0 # ISA slot on some 4xx models
-
-# 8250-like serial ports found on Frodo ASIC
-dnkbd0 at frodo? # Domain keyboard flavor
-wskbd* at dnkbd? mux 1
-wsmouse* at dnkbd? mux 0
-apci* at frodo? # tty flavor
-
-# Davinci framebuffer
-dvbox* at intio?
-dvbox* at dio?
-wsdisplay* at dvbox?
-
-# Gatorbox framebuffer
-gbox* at intio?
-gbox* at dio?
-wsdisplay* at gbox?
-
-# Hyperion framebuffer
-hyper* at dio?
-wsdisplay* at hyper?
-
-# Renaissance framebuffer
-rbox* at intio?
-rbox* at dio?
-wsdisplay* at rbox?
-
-# Topcat/catseye framebuffers
-topcat* at intio?
-topcat* at dio?
-wsdisplay* at topcat?
-
-# TurboVRX framebuffer
-tvrx* at dio?
-wsdisplay* at tvrx?
-
-# 362/382 built-in framebuffer
-sti* at dio?
-wsdisplay* at sti?
-
-# SGC framebuffers
-sti* at sgc?
-#wsdisplay* at sti? # already done above
-
-dca0 at dio? scode 9 flags 1 # DCA serial interfaces
-dca* at dio?
-
-dcm* at dio? flags 0xe # DCM 4- or 8-port serial interfaces
-
-le* at dio? # LANCE ethernet interfaces
-
-nhpib0 at dio? scode 7 # slow internal HP-IB
-nhpib* at dio?
-
-fhpib* at dio? # `fast' HP-IB
-
-hpibbus0 at nhpib0
-hpibbus* at nhpib?
-hpibbus* at fhpib?
-
-hd* at hpibbus? # HP-IB disks
-ct* at hpibbus? # HP-IB cartridge tapes
-mt* at hpibbus? # HP-IB 9-track tape
-ppi0 at hpibbus0 slave 5 punit 0 # HP-IB plotter
-
-spc* at dio? flags 0x00 # SCSI controller
-
-scsibus* at scsi?
-sd* at scsibus? # SCSI disks
-st* at scsibus? # SCSI tapes
-cd* at scsibus? # SCSI CD-ROMs
-ch* at scsibus? # SCSI changer devices
-safte* at scsibus? # SCSI AF-TE
-ses* at scsibus? # SCSI enclosure services
-uk* at scsibus? # unknown SCSI devices
-
-# 425e digital audio
-arcofi* at dio?
-audio* at arcofi?
-
-# ISA devices
-#isa* at isabr?
-
-pseudo-device hotplug 1 # devices hot plugging
-pseudo-device wsmux 2 # mouse and keyboard multiplexor
diff --git a/sys/arch/hp300/conf/Makefile.hp300 b/sys/arch/hp300/conf/Makefile.hp300
deleted file mode 100644
index 7a5c51bfead..00000000000
--- a/sys/arch/hp300/conf/Makefile.hp300
+++ /dev/null
@@ -1,195 +0,0 @@
-# $OpenBSD: Makefile.hp300,v 1.83 2013/10/15 19:23:26 guenther Exp $
-
-# For instructions on building kernels consult the config(8) and options(4)
-# manual pages.
-#
-# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
-# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
-# DEBUG is set to -g by config if debugging is requested (config -g).
-# PROF is set to -pg by config if profiling is requested (config -p).
-
-.include <bsd.own.mk>
-
-SIZE?= size
-STRIP?= strip
-
-# source tree is located via $S relative to the compilation directory
-.ifndef S
-S!= cd ../../../..; pwd
-.endif
-
-_machdir?= $S/arch/${_mach}
-_archdir?= $S/arch/${_arch}
-
-INCLUDES= -nostdinc -I$S -I. -I$S/arch
-CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D__${_mach}__ -MD -MP
-CWARNFLAGS= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
- -Wno-main -Wno-uninitialized -Wno-format \
- -Wstack-larger-than-2047
-
-CMACHFLAGS= -msoft-float
-CMACHFLAGS+= -fno-builtin-printf -fno-builtin-snprintf \
- -fno-builtin-vsnprintf -fno-builtin-log \
- -fno-builtin-log2 -fno-builtin-malloc ${NOPIE_FLAGS}
-.if ${IDENT:M-DNO_PROPOLICE}
-CMACHFLAGS+= -fno-stack-protector
-.endif
-
-COPTS?= -O2
-CFLAGS= ${DEBUG} ${CWARNFLAGS} ${CMACHFLAGS} ${COPTS} ${PIPE}
-AFLAGS= -D_LOCORE -x assembler-with-cpp ${CWARNFLAGS} ${CMACHFLAGS}
-LINKFLAGS= -Ttext 0 -e start --warn-common -nopie
-
-.if ${IDENT:M-DDDB_STRUCT}
-DB_STRUCTINFO= db_structinfo.h
-.else
-DB_STRUCTINFO=
-.endif
-
-.if (${IDENT:M-DHP330} != "")
-_OPTIONS+= -DM68020
-.endif
-.if (${IDENT:M-DHP340} != "" || ${IDENT:M-DHP360} != "" || \
- ${IDENT:M-DHP362} != "")
-_OPTIONS+= -DM68030
-.endif
-.if (${IDENT:M-DHP345} != "" || ${IDENT:M-DHP370} != "" || \
- ${IDENT:M-DHP375} != "" || ${IDENT:M-DHP400} != "")
-_OPTIONS+= -DM68030
-CPPFLAGS+= -DCACHE_HAVE_PAC
-.endif
-.if (${IDENT:M-DHP380} != "" || ${IDENT:M-DHP382} != "" || \
- ${IDENT:M-DHP385} != "" || ${IDENT:M-DHP425} != "" || \
- ${IDENT:M-DHP433} != "")
-CPPFLAGS+= -DM68040 -DFPSP
-.endif
-.if ${_OPTIONS:M-DM68020} != ""
-CPPFLAGS+= -DM68020
-.endif
-.if ${_OPTIONS:M-DM68030} != ""
-CPPFLAGS+= -DM68030
-.endif
-
-.include "${_archdir}/fpsp/Makefile.inc"
-
-HOSTCC?= ${CC}
-HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
-HOSTED_CFLAGS= ${CFLAGS}
-HOSTED_C= ${HOSTCC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
-
-NORMAL_C_NOP= ${CC} ${CFLAGS} ${CPPFLAGS} -c $<
-NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
-NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $<
-
-%OBJS
-
-%CFILES
-
-%SFILES
-
-# load lines for config "xxx" will be emitted as:
-# xxx: ${SYSTEM_DEP} swapxxx.o
-# ${SYSTEM_LD_HEAD}
-# ${SYSTEM_LD} swapxxx.o
-# ${SYSTEM_LD_TAIL}
-SYSTEM_HEAD= locore.o param.o ioconf.o ${FPSP}
-SYSTEM_OBJ= ${SYSTEM_HEAD} ${OBJS}
-SYSTEM_DEP= Makefile ${SYSTEM_OBJ}
-SYSTEM_LD_HEAD= @rm -f $@
-SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_HEAD} vers.o $${OBJS}'; \
- ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_HEAD} vers.o ${OBJS}
-SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@
-
-DEBUG?=
-.if ${DEBUG} == "-g"
-LINKFLAGS+= -X
-STRIPFLAGS= -g
-SYSTEM_LD_TAIL+=; \
- echo mv $@ $@.gdb; rm -f $@.gdb; mv $@ $@.gdb; \
- echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
- ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
-.else
-LINKFLAGS+= -S
-.endif
-
-%LOAD
-
-# cc's -MD puts the source and output paths in the dependency file;
-# since those are temp files here we need to fix it up. It also
-# puts the file in /tmp, so we use -MF to put it in the current
-# directory as assym.P and then generate assym.d from it with a
-# good target name
-assym.h: $S/kern/genassym.sh Makefile \
- ${_archdir}/${_arch}/genassym.cf ${_machdir}/${_mach}/genassym.cf
- cat ${_archdir}/${_arch}/genassym.cf ${_machdir}/${_mach}/genassym.cf | \
- sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} -MF assym.P > assym.h.tmp
- sed '1s/.*/assym.h: \\/' assym.P > assym.d
- sort -u assym.h.tmp > assym.h
-
-param.c: $S/conf/param.c
- rm -f param.c
- cp $S/conf/param.c .
-
-param.o: param.c Makefile
- ${NORMAL_C}
-
-mcount.o: $S/lib/libkern/mcount.c Makefile
- ${NORMAL_C_NOP}
-
-ioconf.o: ioconf.c
- ${NORMAL_C}
-
-vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
- sh $S/conf/newvers.sh
- ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
-
-clean::
- rm -f eddep *bsd *bsd.gdb tags *.[dio] [a-z]*.s \
- [Ee]rrs linterrs assym.h ${DB_STRUCTINFO}
-
-lint:
- @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
- ${CFILES} ioconf.c param.c | \
- grep -v 'static function .* unused'
-
-depend:
- @touch $@
-
-tags:
- @echo "see $S/kern/Makefile for tags"
-
-db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.pl
- ${CC} ${CFLAGS} ${CPPFLAGS} -MT $@ -gstabs -c $S/ddb/db_structinfo.c
- objdump -g db_structinfo.o | perl $S/ddb/parse_structinfo.pl > $@
- rm -f db_structinfo.o
-
-locore.o: ${_machdir}/${_mach}/locore.s assym.h
-copy.o copypage.o: assym.h
-
-# The install target can be redefined by putting a
-# install-kernel-${MACHINE_NAME} target into /etc/mk.conf
-MACHINE_NAME!= uname -n
-install: install-kernel-${MACHINE_NAME}
-.if !target(install-kernel-${MACHINE_NAME}})
-install-kernel-${MACHINE_NAME}:
- rm -f /obsd
- ln /bsd /obsd
- cp bsd /nbsd
- mv /nbsd /bsd
-.endif
-
-# pull in the dependency information
-.if !empty(DB_STRUCTINFO) && !exists(${DB_STRUCTINFO})
- ${SYSTEM_OBJ}: ${DB_STRUCTINFO}
-.endif
-.ifnmake clean
-. for o in ${SYSTEM_OBJ} assym.h ${DB_STRUCTINFO}
-. if exists(${o:R}.d)
-. include "${o:R}.d"
-. elif exists($o)
- .PHONY: $o
-. endif
-. endfor
-.endif
-
-%RULES
diff --git a/sys/arch/hp300/conf/RAMDISK b/sys/arch/hp300/conf/RAMDISK
deleted file mode 100644
index 25cc529b7ae..00000000000
--- a/sys/arch/hp300/conf/RAMDISK
+++ /dev/null
@@ -1,144 +0,0 @@
-# $OpenBSD: RAMDISK,v 1.34 2011/11/08 19:22:13 deraadt Exp $
-#
-# Ram disk kernel.
-#
-
-machine hp300 m68k
-
-# Support for various CPU types
-option HP340
-option HP345
-option HP360
-option HP362
-option HP370
-option HP375
-option HP380
-option HP382
-option HP385
-option HP400
-option HP425
-option HP433
-
-maxusers 32
-
-option TIMEZONE=0 # time zone to adjust RTC time by
-option DST=0 # daylight saving time used by RTC
-
-option FFS # UFS
-#option EXT2FS # Linux ext2fs
-
-option NFSCLIENT # Network File System client
-
-option CD9660 # ISO 9660 + Rock Ridge file system
-#option MSDOSFS # MS-DOS file system
-
-option INET # IP + ICMP + TCP + UDP
-
-option BOOT_CONFIG # add support for boot -c
-
-# Options for HP hardware
-option USELEDS # make the lights twinkle
-#option CONSCODE="9" # force console at this select code for DIO
- # or DIO-II devices, or 256 + slot number
- # for SGC devices
-
-# Verbose descriptions of unconfigured DIO devices
-# (Warning: this compiles in a large string table)
-option DIOVERBOSE # recognize "unknown" DIO devices
-
-# Options for the ramdisk.
-option MINIROOTSIZE=4096
-option RAMDISK_HOOKS
-
-config bsd root on rd0a swap on rd0b and hd0b and sd0b
-
-mainbus0 at root # root "bus"
-
-intio0 at mainbus0 # internal i/o space
-dio0 at mainbus0 # DIO/DIO-II bus
-sgc0 at mainbus0 # SGC bus on some 4xx models
-
-# Human Interface Loop devices
-hil0 at intio? # HIL controller
-hilkbd* at hil? # keyboards
-wskbd* at hilkbd? mux 1
-#hilms* at hil? # mice, buttons and tablets
-#wsmouse* at hilms? mux 0
-#hilid* at hil? # ID module
-
-# Frodo utility chip found on 382 and 4xx's
-frodo0 at intio?
-
-# 8250-like serial ports found on Frodo ASIC
-dnkbd0 at frodo? # Domain keyboard flavor
-wskbd* at dnkbd? mux 1
-#wsmouse* at dnkbd? mux 0
-apci* at frodo? # tty flavor
-
-# Davinci framebuffer
-dvbox* at intio?
-dvbox* at dio?
-wsdisplay* at dvbox?
-
-# Gatorbox framebuffer
-gbox* at intio?
-gbox* at dio?
-wsdisplay* at gbox?
-
-# Hyperion framebuffer
-hyper* at dio?
-wsdisplay* at hyper?
-
-# Renaissance framebuffer
-rbox* at intio?
-rbox* at dio?
-wsdisplay* at rbox?
-
-# Topcat/catseye framebuffers
-topcat* at intio?
-topcat* at dio?
-wsdisplay* at topcat?
-
-# TurboVRX framebuffer
-tvrx* at dio?
-wsdisplay* at tvrx?
-
-# 362/382 built-in framebuffer
-sti* at dio?
-wsdisplay* at sti?
-
-# SGC framebuffers
-sti* at sgc?
-#wsdisplay* at sti? # already done above
-
-dca0 at dio? scode 9 flags 1 # DCA serial interfaces
-dca* at dio?
-
-dcm* at dio? flags 0xe # DCM 4- or 8-port serial interfaces
-
-le* at dio? # LANCE ethernet interfaces
-
-nhpib0 at dio? scode 7 # slow internal HP-IB
-nhpib* at dio?
-
-fhpib* at dio? # `fast' HP-IB
-
-hpibbus0 at nhpib0
-hpibbus* at nhpib?
-hpibbus* at fhpib?
-
-hd* at hpibbus? # HP-IB disks
-ct* at hpibbus? # HP-IB cartridge tapes
-mt* at hpibbus? # HP-IB 9-track tape
-
-spc* at dio? flags 0x00 # SCSI controller
-
-scsibus* at scsi?
-sd* at scsibus? # SCSI disks
-st* at scsibus? # SCSI tapes
-cd* at scsibus? # SCSI CD-ROMs
-
-pseudo-device loop 1 # network loopback
-pseudo-device pty 16 # pseudo-terminals
-pseudo-device bpfilter 1 # packet filter
-pseudo-device rd 1 # ramdisk
diff --git a/sys/arch/hp300/conf/files.hp300 b/sys/arch/hp300/conf/files.hp300
deleted file mode 100644
index 99c49a44621..00000000000
--- a/sys/arch/hp300/conf/files.hp300
+++ /dev/null
@@ -1,227 +0,0 @@
-# $OpenBSD: files.hp300,v 1.36 2013/09/24 20:10:42 miod Exp $
-# $NetBSD: files.hp300,v 1.28 1997/05/12 08:23:28 thorpej Exp $
-#
-# hp300-specific configuration info
-
-# maxpartitions must be the first item in files.${ARCH}
-maxpartitions 16
-
-maxusers 2 8 64
-
-#
-# Mainbus
-#
-
-device mainbus {}
-attach mainbus at root
-
-#
-# Internal i/o space
-#
-
-device intio {}
-attach intio at mainbus
-file arch/hp300/dev/intio.c intio
-
-#
-# DIO bus
-#
-
-device dio {[scode = -1]}
-attach dio at mainbus
-file arch/hp300/dev/dio.c dio
-
-#
-# SGC bus
-#
-
-device sgc {[slot = -1]}
-attach sgc at mainbus
-file arch/hp300/dev/sgc.c sgc needs-flag
-
-#
-# Devices in Internal i/o space
-#
-
-# Apollo Utilility Chip (a.k.a. "Frodo") found on 4xx workstations
-device frodo {[offset = -1]}
-attach frodo at intio
-file arch/hp300/dev/frodo.c frodo
-
-# Apollo Keyboard and mouse
-device dnkbd: wskbddev, wsmousedev
-attach dnkbd at frodo
-file arch/hp300/dev/dnkbd.c dnkbd needs-flag
-file arch/hp300/dev/dnkbdmap.c dnkbd
-
-# Apollo APCI 8250-like UARTs
-device apci
-attach apci at frodo
-file arch/hp300/dev/apci.c apci needs-flag
-file arch/hp300/dev/apci_subr.c apci | dnkbd
-
-# "workstation console" routines
-include "dev/rasops/files.rasops"
-include "dev/wscons/files.wscons"
-include "dev/wsfont/files.wsfont"
-file arch/hp300/hp300/wscons_machdep.c wsdisplay
-
-#
-# Frame buffer devices
-#
-file arch/hp300/dev/sti_machdep.c sti
-
-define diofb
-define diofb_mono
-file arch/hp300/dev/diofb.c diofb | diofb_mono
-file arch/hp300/dev/diofb_mono.c diofb_mono
-
-device dvbox: wsemuldisplaydev, diofb, rasops8
-attach dvbox at intio with dvbox_intio
-attach dvbox at dio with dvbox_dio
-file arch/hp300/dev/dvbox.c dvbox needs-flag
-
-device gbox: wsemuldisplaydev, diofb, rasops8
-attach gbox at intio with gbox_intio
-attach gbox at dio with gbox_dio
-file arch/hp300/dev/gbox.c gbox needs-flag
-
-device hyper: wsemuldisplaydev, diofb_mono, rasops1
-attach hyper at dio
-file arch/hp300/dev/hyper.c hyper needs-flag
-
-device rbox: wsemuldisplaydev, diofb, rasops8
-attach rbox at intio with rbox_intio
-attach rbox at dio with rbox_dio
-file arch/hp300/dev/rbox.c rbox needs-flag
-
-attach sti at dio with sti_dio
-file arch/hp300/dev/sti_dio.c sti_dio
-
-device topcat: wsemuldisplaydev, diofb, rasops8
-attach topcat at intio with topcat_intio
-attach topcat at dio with topcat_dio
-file arch/hp300/dev/topcat.c topcat needs-flag
-
-device tvrx: wsemuldisplaydev, diofb_mono, rasops1
-attach tvrx at dio
-file arch/hp300/dev/tvrx.c tvrx needs-flag
-
-#
-# Other devices on the DIO bus
-#
-
-# DCA serial interface
-device dca: tty
-attach dca at dio
-file arch/hp300/dev/dca.c dca needs-flag
-
-# DCM serial interface
-device dcm: tty
-attach dcm at dio
-file arch/hp300/dev/dcm.c dcm needs-flag
-
-# LANCE ethernet
-attach le at dio: le24
-file arch/hp300/dev/if_le.c le
-
-# 425e digital audio
-attach arcofi at dio with arcofi_dio
-file arch/hp300/dev/arcofi_dio.c arcofi_dio
-
-# HP-IB interfaces
-define hpibdev {}
-
-device nhpib: hpibdev
-attach nhpib at dio
-file arch/hp300/dev/nhpib.c nhpib
-
-device fhpib: hpibdev
-attach fhpib at dio
-file arch/hp300/dev/fhpib.c fhpib
-
-# HP-IB bus layer
-device hpibbus {[slave = -1], [punit = -1]}
-attach hpibbus at hpibdev
-file arch/hp300/dev/hpib.c hpibbus
-
-# HP-IB devices
-device ct: tape
-attach ct at hpibbus
-file arch/hp300/dev/ct.c ct needs-flag
-
-device mt: tape
-attach mt at hpibbus
-file arch/hp300/dev/mt.c mt needs-flag
-
-device hd: disk
-attach hd at hpibbus
-file arch/hp300/dev/hd.c hd needs-flag
-major {hd = 2}
-
-device ppi
-attach ppi at hpibbus
-file arch/hp300/dev/ppi.c ppi needs-flag
-
-# RAM disk
-major {rd = 8}
-
-# SCSI devices
-include "scsi/files.scsi"
-
-device spc: scsi
-attach spc at dio
-file arch/hp300/dev/spc.c spc needs-flag
-file arch/hp300/dev/mb89352.c spc
-
-major {sd = 4}
-major {cd = 9}
-
-#
-# Devices on the SGC bus
-#
-
-attach sti at sgc with sti_sgc
-file arch/hp300/dev/sti_sgc.c sti_sgc
-
-# ISA devices
-include "dev/isa/files.isa"
-include "dev/isa/files.isapnp"
-
-#
-# ISA bridge
-#
-
-device isabr: isabus
-attach isabr at frodo
-file arch/hp300/dev/isabr.c isabr needs-flag
-
-#
-# HIL Human Interface Loop devices
-#
-include "dev/hil/files.hil"
-
-attach hil at intio with hil_intio
-file arch/hp300/dev/hil_intio.c hil_intio
-
-#
-# Non-device files
-#
-
-file arch/hp300/hp300/autoconf.c
-file arch/hp300/hp300/bus_space.c
-file arch/hp300/hp300/clock.c
-file arch/hp300/hp300/conf.c
-file arch/hp300/hp300/db_memrw.c ddb | kgdb
-file arch/hp300/hp300/disksubr.c
-file arch/hp300/hp300/kgdb_machdep.c kgdb
-file arch/hp300/hp300/machdep.c
-file arch/hp300/hp300/intr.c
-file arch/hp300/hp300/leds.c useleds
-file arch/hp300/hp300/mem.c
-file arch/m68k/m68k/pmap_motorola.c
-file arch/hp300/hp300/pmap_bootstrap.c
-file arch/hp300/hp300/sys_machdep.c
-file arch/hp300/hp300/trap.c
-file arch/hp300/hp300/vm_machdep.c
-file arch/hp300/dev/dma.c
diff --git a/sys/arch/hp300/dev/Makefile b/sys/arch/hp300/dev/Makefile
deleted file mode 100644
index 683bed14833..00000000000
--- a/sys/arch/hp300/dev/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 1997/02/03 04:47:10 downsj Exp $
-# $NetBSD: Makefile,v 1.2 1997/01/30 09:18:33 thorpej Exp $
-
-AWK= awk
-
-diodevs.h diodevs_data.h: diodevs devlist2h.awk
- /bin/rm -f diodevs.h diodevs_data.h
- ${AWK} -f devlist2h.awk diodevs
diff --git a/sys/arch/hp300/dev/apci.c b/sys/arch/hp300/dev/apci.c
deleted file mode 100644
index 6bc333b4f4d..00000000000
--- a/sys/arch/hp300/dev/apci.c
+++ /dev/null
@@ -1,978 +0,0 @@
-/* $OpenBSD: apci.c,v 1.41 2010/07/02 17:27:01 nicm Exp $ */
-/* $NetBSD: apci.c,v 1.9 2000/11/02 00:35:05 eeh Exp $ */
-
-/*-
- * Copyright (c) 1996, 1997, 1999 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 1997 Michael Smith. All rights reserved.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)dca.c 8.2 (Berkeley) 1/12/94
- */
-
-/*
- * Device driver for the APCI 8250-like UARTs found on the Apollo
- * Utility Chip on HP 9000/400-series workstations.
- *
- * There are 4 APCI UARTs on the Frodo ASIC. The first one
- * is used to communicate with the Domain keyboard. The second
- * one is the serial console port when the firmware is in Domain/OS
- * mode, and is mapped to select code 9 by the HP-UX firmware (except
- * on 425e models).
- *
- * We don't bother attaching a tty to the first UART; it lacks modem/flow
- * control, and is directly connected to the keyboard connector anyhow.
- */
-
-/*
- * XXX This driver is very similar to the dca driver, and much
- * XXX more code could be shared. (Currently, no code is shared.)
- * XXX FIXME!
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/uio.h>
-#include <sys/kernel.h>
-#include <sys/syslog.h>
-#include <sys/device.h>
-#include <sys/timeout.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-#include <machine/hp300spu.h>
-
-#include <dev/cons.h>
-
-#include <hp300/dev/dioreg.h> /* to check for dca at 9 */
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-
-#include <hp300/dev/frodoreg.h>
-#include <hp300/dev/frodovar.h>
-#include <hp300/dev/apcireg.h>
-#include <hp300/dev/apcivar.h>
-#include <hp300/dev/dcareg.h> /* register bit definitions */
-
-#ifdef DDB
-#include <ddb/db_var.h>
-#endif
-
-struct apci_softc {
- struct device sc_dev; /* generic device glue */
- struct isr sc_isr;
- struct apciregs *sc_apci; /* device registers */
- struct tty *sc_tty; /* tty glue */
- struct timeout sc_timeout; /* timeout */
- int sc_ferr,
- sc_perr,
- sc_oflow,
- sc_toterr; /* stats */
- int sc_flags;
- u_char sc_cua; /* callout mode */
-};
-
-/* sc_flags */
-#define APCI_HASFIFO 0x01 /* unit has a fifo */
-#define APCI_ISCONSOLE 0x02 /* unit is console */
-#define APCI_SOFTCAR 0x04 /* soft carrier */
-
-int apcimatch(struct device *, void *, void *);
-void apciattach(struct device *, struct device *, void *);
-
-struct cfattach apci_ca = {
- sizeof(struct apci_softc), apcimatch, apciattach
-};
-
-struct cfdriver apci_cd = {
- NULL, "apci", DV_TTY
-};
-
-int apciintr(void *);
-void apcieint(struct apci_softc *, int);
-void apcimint(struct apci_softc *, u_char);
-int apciparam(struct tty *, struct termios *);
-void apcistart(struct tty *);
-int apcimctl(struct apci_softc *, int, int);
-void apcitimeout(void *);
-
-cdev_decl(apci);
-
-#define APCIUNIT(x) (minor(x) & 0x7f)
-#define APCICUA(x) (minor(x) & 0x80)
-
-int apcidefaultrate = TTYDEF_SPEED;
-
-/*
- * Console support.
- */
-struct apciregs *apci_cn = NULL; /* console hardware */
-int apciconsinit; /* has been initialized */
-int apcimajor; /* our major number */
-
-cons_decl(apci);
-
-int
-apcimatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct frodo_attach_args *fa = aux;
-
- /* Looking for an apci? */
- if (strcmp(fa->fa_name, apci_cd.cd_name) != 0)
- return (0);
-
- /* Are we checking a valid APCI offset? */
- switch (fa->fa_offset) {
- case FRODO_APCI_OFFSET(1):
- case FRODO_APCI_OFFSET(2):
- case FRODO_APCI_OFFSET(3):
- /* Yup, we exist! */
- return (1);
- }
-
- return (0);
-}
-
-void
-apciattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct apci_softc *sc = (struct apci_softc *)self;
- struct apciregs *apci;
- struct frodo_attach_args *fa = aux;
-
- sc->sc_apci = apci =
- (struct apciregs *)IIOV(FRODO_BASE + fa->fa_offset);
- sc->sc_flags = 0;
-
- /* Initialize timeout structure */
- timeout_set(&sc->sc_timeout, apcitimeout, sc);
-
- /* Are we the console? */
- if (apci == apci_cn) {
- sc->sc_flags |= APCI_ISCONSOLE;
- delay(100000);
-
- /*
- * We didn't know which unit this would be during
- * the console probe, so we have to fixup cn_dev here.
- */
- cn_tab->cn_dev = makedev(apcimajor, self->dv_unit);
- }
-
- /* Look for a FIFO. */
- apci->ap_fifo = FIFO_ENABLE|FIFO_RCV_RST|FIFO_XMT_RST|FIFO_TRIGGER_14;
- delay(100);
- if ((apci->ap_iir & IIR_FIFO_MASK) == IIR_FIFO_MASK)
- sc->sc_flags |= APCI_HASFIFO;
-
- /* Establish our interrupt handler. */
- sc->sc_isr.isr_func = apciintr;
- sc->sc_isr.isr_arg = sc;
- sc->sc_isr.isr_priority = IPL_TTY;
- frodo_intr_establish(parent, fa->fa_line, &sc->sc_isr, self->dv_xname);
-
- /* Set soft carrier if requested by operator. */
- if (self->dv_cfdata->cf_flags)
- sc->sc_flags |= APCI_SOFTCAR;
-
- /*
- * Need to reset baud rate, etc. of next print, so reset apciconsinit.
- * Also make sure console is always "hardwired".
- */
- if (sc->sc_flags & APCI_ISCONSOLE) {
- apciconsinit = 0;
- sc->sc_flags |= APCI_SOFTCAR;
- printf(": console, ");
- } else
- printf(": ");
-
- if (sc->sc_flags & APCI_HASFIFO)
- printf("working fifo\n");
- else
- printf("no fifo\n");
-}
-
-/* ARGSUSED */
-int
-apciopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- int unit = APCIUNIT(dev);
- struct apci_softc *sc;
- struct tty *tp;
- struct apciregs *apci;
- u_char code;
- int s, error = 0;
-
- if (unit >= apci_cd.cd_ndevs ||
- (sc = apci_cd.cd_devs[unit]) == NULL)
- return (ENXIO);
-
- apci = sc->sc_apci;
-
- s = spltty();
- if (sc->sc_tty == NULL) {
- tp = sc->sc_tty = ttymalloc(0);
- } else
- tp = sc->sc_tty;
- splx(s);
-
- tp->t_oproc = apcistart;
- tp->t_param = apciparam;
- tp->t_dev = dev;
-
- if ((tp->t_state & TS_ISOPEN) == 0) {
- /*
- * Sanity clause: reset the chip on first open.
- * The chip might be left in an inconsistent state
- * if it is read inadventently.
- */
- apciinit(apci, apcidefaultrate, CFCR_8BITS);
-
- tp->t_state |= TS_WOPEN;
- ttychars(tp);
- tp->t_iflag = TTYDEF_IFLAG;
- tp->t_oflag = TTYDEF_OFLAG;
- tp->t_cflag = TTYDEF_CFLAG;
- tp->t_lflag = TTYDEF_LFLAG;
- tp->t_ispeed = tp->t_ospeed = apcidefaultrate;
-
- s = spltty();
-
- apciparam(tp, &tp->t_termios);
- ttsetwater(tp);
-
- /* Set the FIFO threshold based on the receive speed. */
- if (sc->sc_flags & APCI_HASFIFO)
- apci->ap_fifo = FIFO_ENABLE | FIFO_RCV_RST |
- FIFO_XMT_RST |
- (tp->t_ispeed <= 1200 ? FIFO_TRIGGER_1 :
- FIFO_TRIGGER_14);
-
- /* Flush any pending I/O. */
- while ((apci->ap_iir & IIR_IMASK) == IIR_RXRDY)
- code = apci->ap_data;
- } else if (tp->t_state & TS_XCLUDE && suser(p, 0) != 0)
- return (EBUSY);
- else
- s = spltty();
-
- /* Set the modem control state. */
- (void) apcimctl(sc, MCR_DTR | MCR_RTS, DMSET);
-
- /* Set soft-carrier if so configured. */
- if ((sc->sc_flags & APCI_SOFTCAR) || APCICUA(dev) ||
- (apcimctl(sc, 0, DMGET) & MSR_DCD))
- tp->t_state |= TS_CARR_ON;
-
- if (APCICUA(dev)) {
- if (tp->t_state & TS_ISOPEN) {
- /* Ah, but someone already is dialed in... */
- splx(s);
- return (EBUSY);
- }
- sc->sc_cua = 1; /* We go into CUA mode */
- }
-
- /* Wait for carrier if necessary. */
- if (flag & O_NONBLOCK) {
- if (!APCICUA(dev) && sc->sc_cua) {
- /* Opening TTY non-blocking... but the CUA is busy */
- splx(s);
- return (EBUSY);
- }
- } else {
- while (sc->sc_cua ||
- ((tp->t_cflag & CLOCAL) == 0 &&
- (tp->t_state & TS_CARR_ON) == 0)) {
- tp->t_state |= TS_WOPEN;
- error = ttysleep(tp, (caddr_t)&tp->t_rawq,
- TTIPRI | PCATCH, ttopen, 0);
- if (!APCICUA(dev) && sc->sc_cua && error == EINTR)
- continue;
- if (error) {
- if (APCICUA(dev))
- sc->sc_cua = 0;
- splx(s);
- return (error);
- }
- if (!APCICUA(dev) && sc->sc_cua)
- continue;
- }
- }
-
- splx(s);
-
- if (error == 0)
- error = (*linesw[tp->t_line].l_open)(dev, tp, p);
-
- if (error == 0) {
- /* clear errors, start timeout */
- sc->sc_ferr = sc->sc_perr = sc->sc_oflow = sc->sc_toterr = 0;
- timeout_add_sec(&sc->sc_timeout, 1);
- }
-
- return (error);
-}
-
-/* ARGSUSED */
-int
-apciclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- struct apci_softc *sc;
- struct tty *tp;
- struct apciregs *apci;
- int unit = APCIUNIT(dev);
- int s;
-
- sc = apci_cd.cd_devs[unit];
- apci = sc->sc_apci;
- tp = sc->sc_tty;
-
- (*linesw[tp->t_line].l_close)(tp, flag, p);
-
- s = spltty();
-
- apci->ap_cfcr &= ~CFCR_SBREAK;
- apci->ap_ier = 0;
- if (tp->t_cflag & HUPCL && (sc->sc_flags & APCI_SOFTCAR) == 0) {
- /* XXX perhaps only clear DTR */
- (void) apcimctl(sc, 0, DMSET);
- }
- tp->t_state &= ~(TS_BUSY | TS_FLUSH);
- sc->sc_cua = 0;
- splx(s);
- ttyclose(tp);
-#if 0
- ttyfree(tp);
- sc->sc_tty = NULL;
-#endif
- return (0);
-}
-
-int
-apciread(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- struct apci_softc *sc = apci_cd.cd_devs[APCIUNIT(dev)];
- struct tty *tp = sc->sc_tty;
-
- return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
-}
-
-int
-apciwrite(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- struct apci_softc *sc = apci_cd.cd_devs[APCIUNIT(dev)];
- struct tty *tp = sc->sc_tty;
-
- return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
-}
-
-struct tty *
-apcitty(dev)
- dev_t dev;
-{
- struct apci_softc *sc = apci_cd.cd_devs[APCIUNIT(dev)];
-
- return (sc->sc_tty);
-}
-
-int
-apciintr(arg)
- void *arg;
-{
- struct apci_softc *sc = arg;
- struct apciregs *apci = sc->sc_apci;
- struct tty *tp = sc->sc_tty;
- u_char iir, lsr, c;
- int iflowdone = 0, claimed = 0;
-
-#define RCVBYTE() \
- c = apci->ap_data; \
- if (tp != NULL && (tp->t_state & TS_ISOPEN) != 0) \
- (*linesw[tp->t_line].l_rint)(c, tp)
-
- for (;;) {
- iir = apci->ap_iir; /* get UART status */
-
- switch (iir & IIR_IMASK) {
- case IIR_RLS:
- apcieint(sc, apci->ap_lsr);
- break;
-
- case IIR_RXRDY:
- case IIR_RXTOUT:
- RCVBYTE();
- if (sc->sc_flags & APCI_HASFIFO) {
- while ((lsr = apci->ap_lsr) & LSR_RCV_MASK) {
- if (lsr == LSR_RXRDY) {
- RCVBYTE();
- } else
- apcieint(sc, lsr);
- }
- }
- if (iflowdone == 0 && tp != NULL &&
- (tp->t_cflag & CRTS_IFLOW) &&
- tp->t_rawq.c_cc > (TTYHOG(tp) / 2)) {
- apci->ap_mcr &= ~MCR_RTS;
- iflowdone = 1;
- }
- break;
-
- case IIR_TXRDY:
- if (tp != NULL) {
- tp->t_state &=~ (TS_BUSY|TS_FLUSH);
- if (tp->t_line)
- (*linesw[tp->t_line].l_start)(tp);
- else
- apcistart(tp);
- }
- break;
-
- default:
- if (iir & IIR_NOPEND)
- return (claimed);
- log(LOG_WARNING, "%s: weird interrupt: 0x%x\n",
- sc->sc_dev.dv_xname, iir);
- /* FALLTHROUGH */
-
- case IIR_MLSC:
- apcimint(sc, apci->ap_msr);
- break;
- }
-
- claimed = 1;
- }
-}
-
-void
-apcieint(sc, stat)
- struct apci_softc *sc;
- int stat;
-{
- struct tty *tp = sc->sc_tty;
- struct apciregs *apci = sc->sc_apci;
- int c;
-
- c = apci->ap_data;
-
-#ifdef DDB
- if ((sc->sc_flags & APCI_ISCONSOLE) && db_console && (stat & LSR_BI)) {
- Debugger();
- return;
- }
-#endif
-
- if (tp == NULL || (tp->t_state & TS_ISOPEN) == 0)
- return;
-
- if (stat & (LSR_BI | LSR_FE)) {
- c |= TTY_FE;
- sc->sc_ferr++;
- } else if (stat & LSR_PE) {
- c |= TTY_PE;
- sc->sc_perr++;
- } else if (stat & LSR_OE)
- sc->sc_oflow++;
- (*linesw[tp->t_line].l_rint)(c, tp);
-}
-
-void
-apcimint(sc, stat)
- struct apci_softc *sc;
- u_char stat;
-{
- struct tty *tp = sc->sc_tty;
- struct apciregs *apci = sc->sc_apci;
-
- if (tp == NULL)
- return;
-
- if ((stat & MSR_DDCD) &&
- (sc->sc_flags & APCI_SOFTCAR) == 0) {
- if (stat & MSR_DCD)
- (void)(*linesw[tp->t_line].l_modem)(tp, 1);
- else if ((*linesw[tp->t_line].l_modem)(tp, 0) == 0)
- apci->ap_mcr &= ~(MCR_DTR | MCR_RTS);
- }
-
- /*
- * CTS change.
- * If doing HW output flow control, start/stop output as appropriate.
- */
- if ((stat & MSR_DCTS) &&
- (tp->t_state & TS_ISOPEN) && (tp->t_cflag & CCTS_OFLOW)) {
- if (stat & MSR_CTS) {
- tp->t_state &=~ TS_TTSTOP;
- apcistart(tp);
- } else
- tp->t_state |= TS_TTSTOP;
- }
-}
-
-int
-apciioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- struct apci_softc *sc = apci_cd.cd_devs[APCIUNIT(dev)];
- struct tty *tp = sc->sc_tty;
- struct apciregs *apci = sc->sc_apci;
- int error;
-
- error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
- if (error >= 0)
- return (error);
- error = ttioctl(tp, cmd, data, flag, p);
- if (error >= 0)
- return (error);
-
- switch (cmd) {
- case TIOCSBRK:
- apci->ap_cfcr |= CFCR_SBREAK;
- break;
-
- case TIOCCBRK:
- apci->ap_cfcr &= ~CFCR_SBREAK;
- break;
-
- case TIOCSDTR:
- (void) apcimctl(sc, MCR_DTR | MCR_RTS, DMBIS);
- break;
-
- case TIOCCDTR:
- (void) apcimctl(sc, MCR_DTR | MCR_RTS, DMBIC);
- break;
-
- case TIOCMSET:
- (void) apcimctl(sc, *(int *)data, DMSET);
- break;
-
- case TIOCMBIS:
- (void) apcimctl(sc, *(int *)data, DMBIS);
- break;
-
- case TIOCMBIC:
- (void) apcimctl(sc, *(int *)data, DMBIC);
- break;
-
- case TIOCMGET:
- *(int *)data = apcimctl(sc, 0, DMGET);
- break;
-
- case TIOCGFLAGS: {
- int bits = 0;
-
- if (sc->sc_flags & APCI_SOFTCAR)
- bits |= TIOCFLAG_SOFTCAR;
-
- if (tp->t_cflag & CLOCAL)
- bits |= TIOCFLAG_CLOCAL;
-
- *(int *)data = bits;
- break;
- }
-
- case TIOCSFLAGS: {
- int userbits;
-
- error = suser(p, 0);
- if (error)
- return (EPERM);
-
- userbits = *(int *)data;
-
- if ((userbits & TIOCFLAG_SOFTCAR) ||
- (sc->sc_flags & APCI_ISCONSOLE))
- sc->sc_flags |= APCI_SOFTCAR;
-
- if (userbits & TIOCFLAG_CLOCAL)
- tp->t_cflag |= CLOCAL;
-
- break;
- }
-
- default:
- return (ENOTTY);
- }
- return (0);
-}
-
-int
-apciparam(tp, t)
- struct tty *tp;
- struct termios *t;
-{
- struct apci_softc *sc = apci_cd.cd_devs[APCIUNIT(tp->t_dev)];
- struct apciregs *apci = sc->sc_apci;
- int cfcr, cflag = t->c_cflag;
- int ospeed = ttspeedtab(t->c_ospeed, apcispeedtab);
- int s;
-
- /* check requested parameters */
- if (ospeed < 0 || (t->c_ispeed && t->c_ispeed != t->c_ospeed))
- return (EINVAL);
-
- switch (cflag & CSIZE) {
- case CS5:
- cfcr = CFCR_5BITS;
- break;
-
- case CS6:
- cfcr = CFCR_6BITS;
- break;
-
- case CS7:
- cfcr = CFCR_7BITS;
- break;
-
- case CS8:
- default: /* XXX gcc whines about cfcr being uninitialized... */
- cfcr = CFCR_8BITS;
- break;
- }
- if (cflag & PARENB) {
- cfcr |= CFCR_PENAB;
- if ((cflag & PARODD) == 0)
- cfcr |= CFCR_PEVEN;
- }
- if (cflag & CSTOPB)
- cfcr |= CFCR_STOPB;
-
- s = spltty();
-
- if (ospeed == 0)
- (void) apcimctl(sc, 0, DMSET); /* hang up line */
-
- /*
- * Set the FIFO threshold based on the receive speed, if we
- * are changing it.
- */
- if (tp->t_ispeed != t->c_ispeed) {
- if (sc->sc_flags & APCI_HASFIFO)
- apci->ap_fifo = FIFO_ENABLE |
- (t->c_ispeed <= 1200 ? FIFO_TRIGGER_1 :
- FIFO_TRIGGER_14);
- }
-
- if (ospeed != 0) {
- apci->ap_cfcr |= CFCR_DLAB;
- apci->ap_data = ospeed & 0xff;
- apci->ap_ier = (ospeed >> 8) & 0xff;
- apci->ap_cfcr = cfcr;
- } else
- apci->ap_cfcr = cfcr;
-
- /* and copy to tty */
- tp->t_ispeed = t->c_ispeed;
- tp->t_ospeed = t->c_ospeed;
- tp->t_cflag = cflag;
-
- apci->ap_ier = IER_ERXRDY | IER_ETXRDY | IER_ERLS | IER_EMSC;
-
- splx(s);
- return (0);
-}
-
-void
-apcistart(tp)
- struct tty *tp;
-{
- struct apci_softc *sc = apci_cd.cd_devs[APCIUNIT(tp->t_dev)];
- struct apciregs *apci = sc->sc_apci;
- int s, c;
-
- s = spltty();
-
- if (tp->t_state & (TS_TIMEOUT|TS_TTSTOP))
- goto out;
- ttwakeupwr(tp);
- if (tp->t_outq.c_cc == 0)
- goto out;
- if (apci->ap_lsr & LSR_TXRDY) {
- tp->t_state |= TS_BUSY;
- if (sc->sc_flags & APCI_HASFIFO) {
- for (c = 0; c < 16 && tp->t_outq.c_cc; ++c)
- apci->ap_data = getc(&tp->t_outq);
- } else
- apci->ap_data = getc(&tp->t_outq);
- }
-
- out:
- splx(s);
-}
-
-/*
- * Stop output on a line.
- */
-/* ARGSUSED */
-int
-apcistop(tp, flag)
- struct tty *tp;
- int flag;
-{
- int s;
-
- s = spltty();
- if (tp->t_state & TS_BUSY)
- if ((tp->t_state & TS_TTSTOP) == 0)
- tp->t_state |= TS_FLUSH;
- splx(s);
- return (0);
-}
-
-int
-apcimctl(sc, bits, how)
- struct apci_softc *sc;
- int bits, how;
-{
- struct apciregs *apci = sc->sc_apci;
- int s;
-
- s = spltty();
-
- switch (how) {
- case DMSET:
- apci->ap_mcr = bits;
- break;
-
- case DMBIS:
- apci->ap_mcr |= bits;
- break;
-
- case DMBIC:
- apci->ap_mcr &= ~bits;
- break;
-
- case DMGET:
- bits = apci->ap_msr;
- break;
- }
-
- splx(s);
- return (bits);
-}
-
-void
-apcitimeout(arg)
- void *arg;
-{
- struct apci_softc *sc = arg;
- int ferr, perr, oflow, s;
-
- if (sc->sc_tty == NULL ||
- (sc->sc_tty->t_state & TS_ISOPEN) == 0)
- return;
-
- /* Log any errors. */
- if (sc->sc_ferr || sc->sc_perr || sc->sc_oflow) {
- s = spltty(); /* XXX necessary? */
- ferr = sc->sc_ferr;
- perr = sc->sc_perr;
- oflow = sc->sc_oflow;
- sc->sc_ferr = sc->sc_perr = sc->sc_oflow = 0;
- splx(s);
- sc->sc_toterr += ferr + perr + oflow;
- log(LOG_WARNING,
- "%s: %d frame, %d parity, %d overflow, %d total errors\n",
- sc->sc_dev.dv_xname, ferr, perr, oflow, sc->sc_toterr);
- }
-
- timeout_add_sec(&sc->sc_timeout, 1);
-}
-
-/*
- * The following routines are required for the APCI to act as the console.
- */
-
-void
-apcicnprobe(cp)
- struct consdev *cp;
-{
- volatile u_int8_t *frodoregs;
-
- /* locate the major number */
- for (apcimajor = 0; apcimajor < nchrdev; apcimajor++)
- if (cdevsw[apcimajor].d_open == apciopen)
- break;
-
- /* initialize the required fields */
- cp->cn_dev = makedev(apcimajor, 0); /* XXX */
-
- /*
- * The APCI can only be a console on a 425e; on other 4xx
- * models, the "first" serial port is mapped to the DCA
- * at select code 9. See frodo.c for the autoconfiguration
- * version of this check.
- */
- if (machineid != HP_425 || mmuid != MMUID_425_E)
- return;
-
- /*
- * Check the service switch. On the 425e, this is a physical
- * switch, unlike other frodo-based machines, so we can use it
- * as a serial vs internal video selector, since the PROM can not
- * be configured for serial console.
- */
- frodoregs = (volatile u_int8_t *)IIOV(FRODO_BASE);
- if (badaddr((caddr_t)frodoregs) == 0 &&
- !ISSET(frodoregs[FRODO_IISR], FRODO_IISR_SERVICE))
- cp->cn_pri = CN_HIGHPRI;
- else
- cp->cn_pri = CN_LOWPRI;
-
- /*
- * If our priority is higher than the currently-remembered
- * console, install ourselves.
- */
- if (cn_tab == NULL || cp->cn_pri > cn_tab->cn_pri) {
- cn_tab = cp;
- conscode = CONSCODE_INVALID;
- }
-}
-
-/* ARGSUSED */
-void
-apcicninit(cp)
- struct consdev *cp;
-{
-
- /*
- * We are not interested by the second console pass.
- */
- if (consolepass != 0)
- return;
-
- apci_cn = (struct apciregs *)IIOV(FRODO_BASE + FRODO_APCI_OFFSET(1));
- apciinit(apci_cn, apcidefaultrate, CFCR_8BITS);
- apciconsinit = 1;
-}
-
-/* ARGSUSED */
-int
-apcicngetc(dev)
- dev_t dev;
-{
- u_char stat;
- int c, s;
-
- s = splhigh();
- while (((stat = apci_cn->ap_lsr) & LSR_RXRDY) == 0)
- ;
- c = apci_cn->ap_data;
-
- /* clear any interrupts generated by this transmission */
- stat = apci_cn->ap_iir;
- splx(s);
- return (c);
-}
-
-/* ARGSUSED */
-void
-apcicnputc(dev, c)
- dev_t dev;
- int c;
-{
- int timo;
- u_char stat;
- int s;
-
- s = splhigh();
-
- if (apciconsinit == 0) {
- apciinit(apci_cn, apcidefaultrate, CFCR_8BITS);
- apciconsinit = 1;
- }
-
- /* wait for any pending transmission to finish */
- timo = 50000;
- while (((stat = apci_cn->ap_lsr) & LSR_TXRDY) == 0 && --timo)
- ;
-
- apci_cn->ap_data = c & 0xff;
-
- /* wait for this transmission to complete */
- timo = 1500000;
- while (((stat = apci_cn->ap_lsr) & LSR_TXRDY) == 0 && --timo)
- ;
-
- /* clear any interrupts generated by this transmission */
- stat = apci_cn->ap_iir;
- splx(s);
-}
diff --git a/sys/arch/hp300/dev/apci_subr.c b/sys/arch/hp300/dev/apci_subr.c
deleted file mode 100644
index 76f86490172..00000000000
--- a/sys/arch/hp300/dev/apci_subr.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/* $OpenBSD: apci_subr.c,v 1.2 2008/06/26 05:42:10 ray Exp $ */
-
-/*-
- * Copyright (c) 1996, 1997, 1999 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 1997 Michael Smith. All rights reserved.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)dca.c 8.2 (Berkeley) 1/12/94
- */
-
-/*
- * Routines shared by the apci and dnkbd drivers.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/tty.h>
-#include <sys/kernel.h>
-
-#include <hp300/dev/apcireg.h>
-#include <hp300/dev/apcivar.h>
-#include <hp300/dev/dcareg.h>
-
-const struct speedtab apcispeedtab[] = {
- { 0, 0 },
- { 50, APCIBRD(50) },
- { 75, APCIBRD(75) },
- { 110, APCIBRD(110) },
- { 134, APCIBRD(134) },
- { 150, APCIBRD(150) },
- { 200, APCIBRD(200) },
- { 300, APCIBRD(300) },
- { 600, APCIBRD(600) },
- { 1200, APCIBRD(1200) },
- { 1800, APCIBRD(1800) },
- { 2400, APCIBRD(2400) },
- { 4800, APCIBRD(4800) },
- { 9600, APCIBRD(9600) },
- { 19200, APCIBRD(19200) },
- { 38400, APCIBRD(38400) },
- { -1, -1 },
-};
-
-int
-apciinit(struct apciregs *apci, u_int16_t rate, u_int16_t cfcr)
-{
- int s, stat;
-
- s = splhigh();
-
- rate = ttspeedtab(rate, apcispeedtab);
-
- apci->ap_cfcr = CFCR_DLAB;
- apci->ap_data = rate & 0xff;
- apci->ap_ier = (rate >> 8) & 0xff;
- apci->ap_cfcr = cfcr;
- apci->ap_ier = IER_ERXRDY | IER_ETXRDY;
- apci->ap_fifo =
- FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST | FIFO_TRIGGER_1;
- apci->ap_mcr = MCR_DTR | MCR_RTS;
- delay(100);
- stat = apci->ap_iir;
- splx(s);
-
- return (stat);
-}
diff --git a/sys/arch/hp300/dev/apcireg.h b/sys/arch/hp300/dev/apcireg.h
deleted file mode 100644
index aab1b8e22ca..00000000000
--- a/sys/arch/hp300/dev/apcireg.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* $OpenBSD: apcireg.h,v 1.2 1997/07/06 08:01:45 downsj Exp $ */
-/* $NetBSD: apcireg.h,v 1.2 1997/05/12 08:14:01 thorpej Exp $ */
-
-/*
- * Copyright (c) 1997 Michael Smith. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <hp300/dev/iotypes.h>
-
-struct apciregs {
- vu_char ap_data;
- u_char pad0[3];
- vu_char ap_ier;
- u_char pad1[3];
- vu_char ap_iir;
-#define ap_fifo ap_iir
- u_char pad2[3];
- vu_char ap_cfcr;
- u_char pad3[3];
- vu_char ap_mcr;
- u_char pad4[3];
- vu_char ap_lsr;
- u_char pad5[3];
- vu_char ap_msr;
- u_char pad6[3];
- vu_char ap_scratch;
-};
-
-/* max number of apci ports */
-#define APCI_MAXPORT 4
-
-/*
- * baudrate divisor calculations.
- *
- * The input clock frequency appears to be 8.0064MHz, giving a scale
- * factor of 500400. (Using exactly 8MHz gives framing errors with
- * the Apollo keyboard.)
- */
-#define APCIBRD(x) (500000 / (x))
diff --git a/sys/arch/hp300/dev/apcivar.h b/sys/arch/hp300/dev/apcivar.h
deleted file mode 100644
index 84e44978f61..00000000000
--- a/sys/arch/hp300/dev/apcivar.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* $OpenBSD: apcivar.h,v 1.2 2008/06/26 05:42:10 ray Exp $ */
-
-/*-
- * Copyright (c) 1996, 1997, 1999 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 1997 Michael Smith. All rights reserved.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)dca.c 8.2 (Berkeley) 1/12/94
- */
-
-int apciinit(struct apciregs *, u_int16_t, u_int16_t);
-extern const struct speedtab apcispeedtab[];
diff --git a/sys/arch/hp300/dev/arcofi_dio.c b/sys/arch/hp300/dev/arcofi_dio.c
deleted file mode 100644
index 56b07af0137..00000000000
--- a/sys/arch/hp300/dev/arcofi_dio.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/* $OpenBSD: arcofi_dio.c,v 1.1 2011/12/21 23:12:03 miod Exp $ */
-
-/*
- * Copyright (c) 2011 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/intr.h>
-
-#include <sys/audioio.h>
-#include <dev/audio_if.h>
-#include <dev/ic/arcofivar.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-
-#include <hp300/dev/diodevs.h>
-
-void arcofi_dio_attach(struct device *, struct device *, void *);
-int arcofi_dio_match(struct device *, void *, void *);
-
-struct arcofi_dio_softc {
- struct arcofi_softc sc_arcofi;
-
- struct isr sc_isr;
-};
-
-const struct cfattach arcofi_dio_ca = {
- sizeof(struct arcofi_dio_softc),
- arcofi_dio_match,
- arcofi_dio_attach
-};
-
-extern struct hp300_bus_space_tag hp300_mem_tag; /* XXX */
-
-int
-arcofi_dio_match(struct device *parent, void *match, void *vaa)
-{
- struct dio_attach_args *da = vaa;
-
- if (da->da_id != DIO_DEVICE_ID_AUDIO)
- return 0;
-
- return 1;
-}
-
-void
-arcofi_dio_attach(struct device *parent, struct device *self, void *vaa)
-{
- struct arcofi_dio_softc *adsc = (struct arcofi_dio_softc *)self;
- struct arcofi_softc *sc = &adsc->sc_arcofi;
- struct dio_attach_args *da = vaa;
- bus_addr_t base;
- unsigned int u;
- int ipl;
-
- for (u = 0; u < ARCOFI_NREGS; u++)
- sc->sc_reg[u] = (u << 1) | 0x01;
-
- base = (bus_addr_t)dio_scodetopa(da->da_scode);
- sc->sc_iot = &hp300_mem_tag;
- /*
- * XXX We request BUS_SPACE_MAP_LINEAR only to be able to use DIO_IPL
- * XXX below; this ought to be provided in the attach_args
- */
- if (bus_space_map(sc->sc_iot, base, DIOII_SIZEOFF, BUS_SPACE_MAP_LINEAR,
- &sc->sc_ioh) != 0) {
- printf(": can't map registers\n");
- return;
- }
- ipl = DIO_IPL(bus_space_vaddr(sc->sc_iot, sc->sc_ioh));
-
- sc->sc_sih = softintr_establish(IPL_SOFT, &arcofi_swintr, sc);
- if (sc->sc_sih == NULL) {
- printf(": can't register soft interrupt\n");
- return;
- }
- adsc->sc_isr.isr_func = arcofi_hwintr;
- adsc->sc_isr.isr_arg = sc;
- adsc->sc_isr.isr_ipl = ipl;
- adsc->sc_isr.isr_priority = IPL_AUDIO;
- dio_intr_establish(&adsc->sc_isr, self->dv_xname);
-
- printf(" ipl %d\n", ipl);
-
- arcofi_attach(sc, "dio");
-}
diff --git a/sys/arch/hp300/dev/ct.c b/sys/arch/hp300/dev/ct.c
deleted file mode 100644
index 39d33097809..00000000000
--- a/sys/arch/hp300/dev/ct.c
+++ /dev/null
@@ -1,959 +0,0 @@
-/* $OpenBSD: ct.c,v 1.23 2013/06/11 16:42:07 deraadt Exp $ */
-/* $NetBSD: ct.c,v 1.21 1997/04/02 22:37:23 scottr Exp $ */
-
-/*
- * Copyright (c) 1996, 1997 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ct.c 8.2 (Berkeley) 1/12/94
- */
-
-/*
- * CS80 cartridge tape driver (9144, 88140, 9145)
- *
- * Reminder:
- * C_CC bit (character count option) when used in the CS/80 command
- * 'set options' will cause the tape not to stream.
- *
- * TODO:
- * make filesystem compatible
- * make block mode work according to mtio(4) spec. (if possible)
- * merge with cs80 disk driver
- * finish support of 9145
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/ioctl.h>
-#include <sys/mtio.h>
-#include <sys/proc.h>
-
-#include <hp300/dev/hpibvar.h>
-
-#include <hp300/dev/ctreg.h>
-
-/* number of eof marks to remember */
-#define EOFS 128
-
-struct ct_softc {
- struct device sc_dev;
- int sc_slave; /* HP-IB slave ID */
- int sc_punit; /* physical unit */
- struct ct_iocmd sc_ioc;
- struct ct_rscmd sc_rsc;
- struct ct_stat sc_stat;
- struct ct_ssmcmd sc_ssmc;
- struct ct_srcmd sc_src;
- struct ct_soptcmd sc_soptc;
- struct ct_ulcmd sc_ul;
- struct ct_wfmcmd sc_wfm;
- struct ct_clearcmd sc_clear;
- struct buf sc_tab;
- struct buf *sc_bp;
- struct buf sc_bufstore; /* XXX */
- int sc_blkno;
- int sc_cmd;
- int sc_resid;
- char *sc_addr;
- int sc_flags;
- short sc_type;
- struct hpibqueue sc_hq; /* entry on hpib job queue */
- int sc_eofp;
- int sc_eofs[EOFS];
-};
-
-/* flags */
-#define CTF_OPEN 0x01
-#define CTF_ALIVE 0x02
-#define CTF_WRT 0x04
-#define CTF_CMD 0x08
-#define CTF_IO 0x10
-#define CTF_BEOF 0x20
-#define CTF_AEOF 0x40
-#define CTF_EOT 0x80
-#define CTF_STATWAIT 0x100
-#define CTF_CANSTREAM 0x200
-#define CTF_WRTTN 0x400
-
-int ctmatch(struct device *, void *, void *);
-void ctattach(struct device *, struct device *, void *);
-
-struct cfattach ct_ca = {
- sizeof(struct ct_softc), ctmatch, ctattach
-};
-
-struct cfdriver ct_cd = {
- NULL, "ct", DV_TAPE
-};
-
-int ctident(struct device *, struct ct_softc *,
- struct hpibbus_attach_args *);
-
-void ctreset(struct ct_softc *);
-void ctaddeof(struct ct_softc *);
-void ctustart(struct ct_softc *);
-void cteof(struct ct_softc *, struct buf *);
-void ctdone(struct ct_softc *, struct buf *);
-
-void ctstart(void *);
-void ctgo(void *);
-void ctintr(void *);
-
-void ctcommand(dev_t, int, int);
-
-cdev_decl(ct);
-bdev_decl(ct);
-
-const struct ctinfo {
- short hwid;
- short punit;
- char *desc;
-} ctinfo[] = {
- { CT7946ID, 1, "7946A" },
- { CT7912PID, 1, "7912P" },
- { CT7914PID, 1, "7914P" },
- { CT9144ID, 0, "9144" },
- { CT9145ID, 0, "9145" },
-};
-int nctinfo = sizeof(ctinfo) / sizeof(ctinfo[0]);
-
-#define CT_NOREW 4
-#define CT_STREAM 8
-#define UNIT(x) (minor(x) & 3)
-#define ctpunit(x) ((x) & 7)
-
-#ifdef DEBUG
-int ctdebug = 0;
-#define CDB_FILES 0x01
-#define CT_BSF 0x02
-#endif
-
-int
-ctmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct hpibbus_attach_args *ha = aux;
-
- return (ctident(parent, NULL, ha));
-}
-
-void
-ctattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct ct_softc *sc = (struct ct_softc *)self;
- struct hpibbus_attach_args *ha = aux;
-
- if (ctident(parent, sc, ha) == 0) {
- /* can't happen */
- printf("\n%s: didn't respond to describe command!\n",
- sc->sc_dev.dv_xname);
- return;
- }
-
- sc->sc_slave = ha->ha_slave;
- sc->sc_punit = ha->ha_punit;
-
- sc->sc_tab.b_actb = &sc->sc_tab.b_actf;
-
- /* Initialize hpib job queue entry. */
- sc->sc_hq.hq_softc = sc;
- sc->sc_hq.hq_slave = sc->sc_slave;
- sc->sc_hq.hq_start = ctstart;
- sc->sc_hq.hq_go = ctgo;
- sc->sc_hq.hq_intr = ctintr;
-
- ctreset(sc);
- sc->sc_flags |= CTF_ALIVE;
-}
-
-int
-ctident(parent, sc, ha)
- struct device *parent;
- struct ct_softc *sc;
- struct hpibbus_attach_args *ha;
-{
- struct cs80_describe desc;
- u_char stat, cmd[3];
- char name[7];
- int i, id, n, type, canstream;
-
- type = canstream = 0;
-
- /* Verify that we have a CS80 device. */
- if ((ha->ha_id & 0x200) == 0)
- return (0);
-
- /* Is it one of the tapes we support? */
- for (id = 0; id < nctinfo; id++)
- if (ha->ha_id == ctinfo[id].hwid &&
- ha->ha_punit == ctinfo[id].punit)
- break;
- if (id == nctinfo)
- return (0);
-
- /*
- * So far, so good. Get drive parameters. Note command
- * is always issued to unit 0.
- */
- bzero(&desc, sizeof(desc));
- stat = 0;
- cmd[0] = C_SUNIT(0);
- cmd[1] = C_SVOL(0);
- cmd[2] = C_DESC;
- hpibsend(parent->dv_unit, ha->ha_slave, C_CMD, cmd, sizeof(cmd));
- hpibrecv(parent->dv_unit, ha->ha_slave, C_EXEC, &desc, sizeof(desc));
- hpibrecv(parent->dv_unit, ha->ha_slave, C_QSTAT, &stat, sizeof(stat));
-
- if (desc.d_name == 0 && stat != 0)
- return (0);
-
- bzero(name, sizeof(name));
- n = desc.d_name;
- for (i = 5; i >= 0; i--) {
- name[i] = (n & 0xf) + '0';
- n >>= 4;
- }
-
- switch (ha->ha_id) {
- case CT7946ID:
- if (bcmp(name, "079450", 6) == 0)
- return (0); /* not really a 7946 */
- /* FALLTHROUGH */
- case CT9144ID:
- case CT9145ID:
- type = CT9144;
- canstream = 1;
- break;
-
- case CT7912PID:
- case CT7914PID:
- type = CT88140;
- break;
- }
-
- if (sc != NULL) {
- sc->sc_type = type;
- sc->sc_flags = canstream ? CTF_CANSTREAM : 0;
- printf(": %s %stape\n", ctinfo[id].desc,
- canstream ? "streaming " : "");
- }
-
- return (1);
-}
-
-void
-ctreset(sc)
- struct ct_softc *sc;
-{
- int ctlr, slave;
- u_char stat;
-
- ctlr = sc->sc_dev.dv_parent->dv_unit;
- slave = sc->sc_slave;
-
- sc->sc_clear.unit = C_SUNIT(sc->sc_punit);
- sc->sc_clear.cmd = C_CLEAR;
- hpibsend(ctlr, slave, C_TCMD, &sc->sc_clear, sizeof(sc->sc_clear));
- hpibswait(ctlr, slave);
- hpibrecv(ctlr, slave, C_QSTAT, &stat, sizeof(stat));
-
- sc->sc_src.unit = C_SUNIT(CTCTLR);
- sc->sc_src.nop = C_NOP;
- sc->sc_src.cmd = C_SREL;
- sc->sc_src.param = C_REL;
- hpibsend(ctlr, slave, C_CMD, &sc->sc_src, sizeof(sc->sc_src));
- hpibswait(ctlr, slave);
- hpibrecv(ctlr, slave, C_QSTAT, &stat, sizeof(stat));
-
- sc->sc_ssmc.unit = C_SUNIT(sc->sc_punit);
- sc->sc_ssmc.cmd = C_SSM;
- sc->sc_ssmc.refm = REF_MASK;
- sc->sc_ssmc.fefm = FEF_MASK;
- sc->sc_ssmc.aefm = AEF_MASK;
- sc->sc_ssmc.iefm = IEF_MASK;
- hpibsend(ctlr, slave, C_CMD, &sc->sc_ssmc, sizeof(sc->sc_ssmc));
- hpibswait(ctlr, slave);
- hpibrecv(ctlr, slave, C_QSTAT, &stat, sizeof(stat));
-
- sc->sc_soptc.unit = C_SUNIT(sc->sc_punit);
- sc->sc_soptc.nop = C_NOP;
- sc->sc_soptc.cmd = C_SOPT;
- sc->sc_soptc.opt = C_SPAR;
- hpibsend(ctlr, slave, C_CMD, &sc->sc_soptc, sizeof(sc->sc_soptc));
- hpibswait(ctlr, slave);
- hpibrecv(ctlr, slave, C_QSTAT, &stat, sizeof(stat));
-}
-
-/*ARGSUSED*/
-int
-ctopen(dev, flag, type, p)
- dev_t dev;
- int flag, type;
- struct proc *p;
-{
- struct ct_softc *sc;
- u_char stat;
- int cc, ctlr, slave;
-
- if (UNIT(dev) >= ct_cd.cd_ndevs ||
- (sc = ct_cd.cd_devs[UNIT(dev)]) == NULL ||
- (sc->sc_flags & CTF_ALIVE) == 0)
- return (ENXIO);
-
- if (sc->sc_flags & CTF_OPEN)
- return (EBUSY);
-
- ctlr = sc->sc_dev.dv_parent->dv_unit;
- slave = sc->sc_slave;
-
- sc->sc_soptc.unit = C_SUNIT(sc->sc_punit);
- sc->sc_soptc.nop = C_NOP;
- sc->sc_soptc.cmd = C_SOPT;
- if ((dev & CT_STREAM) && (sc->sc_flags & CTF_CANSTREAM))
- sc->sc_soptc.opt = C_SPAR | C_IMRPT;
- else
- sc->sc_soptc.opt = C_SPAR;
-
- /*
- * Check the return of hpibsend() and hpibswait().
- * Drive could be loading/unloading a tape. If not checked,
- * driver hangs.
- */
- cc = hpibsend(ctlr, slave, C_CMD, &sc->sc_soptc, sizeof(sc->sc_soptc));
- if (cc != sizeof(sc->sc_soptc))
- return (EBUSY);
-
- hpibswait(ctlr, slave);
- cc = hpibrecv(ctlr, slave, C_QSTAT, &stat, sizeof(stat));
- if (cc != sizeof(stat))
- return(EBUSY);
-
- sc->sc_flags |= CTF_OPEN;
- return(0);
-}
-
-/*ARGSUSED*/
-int
-ctclose(dev, flag, fmt, p)
- dev_t dev;
- int flag, fmt;
- struct proc *p;
-{
- struct ct_softc *sc = ct_cd.cd_devs[UNIT(dev)];
-
- if ((sc->sc_flags & (CTF_WRT|CTF_WRTTN)) == (CTF_WRT|CTF_WRTTN) &&
- (sc->sc_flags & CTF_EOT) == 0 ) { /* XXX return error if EOT ?? */
- ctcommand(dev, MTWEOF, 2);
- ctcommand(dev, MTBSR, 1);
- if (sc->sc_eofp == EOFS - 1)
- sc->sc_eofs[EOFS - 1]--;
- else
- sc->sc_eofp--;
-#ifdef DEBUG
- if(ctdebug & CT_BSF)
- printf("%s: ctclose backup eofs prt %d blk %d\n",
- sc->sc_dev.dv_xname, sc->sc_eofp,
- sc->sc_eofs[sc->sc_eofp]);
-#endif
- }
- if ((minor(dev) & CT_NOREW) == 0)
- ctcommand(dev, MTREW, 1);
- sc->sc_flags &= ~(CTF_OPEN | CTF_WRT | CTF_WRTTN);
-#ifdef DEBUG
- if (ctdebug & CDB_FILES)
- printf("ctclose: flags %x\n", sc->sc_flags);
-#endif
- return(0); /* XXX */
-}
-
-void
-ctcommand(dev, cmd, cnt)
- dev_t dev;
- int cmd;
- int cnt;
-{
- struct ct_softc *sc = ct_cd.cd_devs[UNIT(dev)];
- struct buf *bp = &sc->sc_bufstore;
- struct buf *nbp = 0;
-
- if (cmd == MTBSF && sc->sc_eofp == EOFS - 1) {
- cnt = sc->sc_eofs[EOFS - 1] - cnt;
- ctcommand(dev, MTREW, 1);
- ctcommand(dev, MTFSF, cnt);
- cnt = 2;
- cmd = MTBSR;
- }
-
- if (cmd == MTBSF && sc->sc_eofp - cnt < 0) {
- cnt = 1;
- cmd = MTREW;
- }
-
- sc->sc_flags |= CTF_CMD;
- sc->sc_bp = bp;
- sc->sc_cmd = cmd;
- bp->b_dev = dev;
- if (cmd == MTFSF) {
- nbp = (struct buf *)geteblk(MAXBSIZE);
- bp->b_data = nbp->b_data;
- bp->b_bcount = MAXBSIZE;
- }
-
- while (cnt-- > 0) {
- bp->b_flags = B_BUSY | B_RAW;
- if (cmd == MTBSF) {
- sc->sc_blkno = sc->sc_eofs[sc->sc_eofp];
- sc->sc_eofp--;
-#ifdef DEBUG
- if (ctdebug & CT_BSF)
- printf("%s: backup eof pos %d blk %d\n",
- sc->sc_dev.dv_xname, sc->sc_eofp,
- sc->sc_eofs[sc->sc_eofp]);
-#endif
- }
- ctstrategy(bp);
- biowait(bp);
- }
- bp->b_flags = 0;
- sc->sc_flags &= ~CTF_CMD;
- if (nbp)
- brelse(nbp);
-}
-
-void
-ctstrategy(bp)
- struct buf *bp;
-{
- struct buf *dp;
- int s, unit;
- struct ct_softc *sc;
-
- unit = UNIT(bp->b_dev);
- sc = ct_cd.cd_devs[unit];
-
- dp = &sc->sc_tab;
- bp->b_actf = NULL;
- s = splbio();
- bp->b_actb = dp->b_actb;
- *(dp->b_actb) = bp;
- dp->b_actb = &bp->b_actf;
- if (dp->b_active == 0) {
- dp->b_active = 1;
- ctustart(sc);
- }
- splx(s);
-}
-
-void
-ctustart(sc)
- struct ct_softc *sc;
-{
- struct buf *bp;
-
- bp = sc->sc_tab.b_actf;
- sc->sc_addr = bp->b_data;
- sc->sc_resid = bp->b_bcount;
- if (hpibreq(sc->sc_dev.dv_parent, &sc->sc_hq))
- ctstart(sc);
-}
-
-void
-ctstart(arg)
- void *arg;
-{
- struct ct_softc *sc = arg;
- struct buf *bp;
- int i, ctlr, slave;
-
- ctlr = sc->sc_dev.dv_parent->dv_unit;
- slave = sc->sc_slave;
-
- bp = sc->sc_tab.b_actf;
- if ((sc->sc_flags & CTF_CMD) && sc->sc_bp == bp) {
- switch(sc->sc_cmd) {
- case MTFSF:
- bp->b_flags |= B_READ;
- goto mustio;
-
- case MTBSF:
- goto gotaddr;
-
- case MTOFFL:
- sc->sc_blkno = 0;
- sc->sc_ul.unit = C_SUNIT(sc->sc_punit);
- sc->sc_ul.cmd = C_UNLOAD;
- hpibsend(ctlr, slave, C_CMD, &sc->sc_ul,
- sizeof(sc->sc_ul));
- break;
-
- case MTWEOF:
- sc->sc_blkno++;
- sc->sc_flags |= CTF_WRT;
- sc->sc_wfm.unit = C_SUNIT(sc->sc_punit);
- sc->sc_wfm.cmd = C_WFM;
- hpibsend(ctlr, slave, C_CMD, &sc->sc_wfm,
- sizeof(sc->sc_wfm));
- ctaddeof(sc);
- break;
-
- case MTBSR:
- sc->sc_blkno--;
- goto gotaddr;
-
- case MTFSR:
- sc->sc_blkno++;
- goto gotaddr;
-
- case MTREW:
- sc->sc_blkno = 0;
-#ifdef DEBUG
- if(ctdebug & CT_BSF)
- printf("%s: clearing eofs\n",
- sc->sc_dev.dv_xname);
-#endif
- for (i=0; i<EOFS; i++)
- sc->sc_eofs[i] = 0;
- sc->sc_eofp = 0;
-
-gotaddr:
- sc->sc_ioc.saddr = C_SADDR;
- sc->sc_ioc.addr0 = 0;
- sc->sc_ioc.addr = sc->sc_blkno;
- sc->sc_ioc.unit = C_SUNIT(sc->sc_punit);
- sc->sc_ioc.nop2 = C_NOP;
- sc->sc_ioc.slen = C_SLEN;
- sc->sc_ioc.len = 0;
- sc->sc_ioc.nop3 = C_NOP;
- sc->sc_ioc.cmd = C_READ;
- hpibsend(ctlr, slave, C_CMD, &sc->sc_ioc,
- sizeof(sc->sc_ioc));
- break;
- }
- } else {
-mustio:
- if ((bp->b_flags & B_READ) &&
- sc->sc_flags & (CTF_BEOF|CTF_EOT)) {
-#ifdef DEBUG
- if (ctdebug & CDB_FILES)
- printf("ctstart: before flags %x\n",
- sc->sc_flags);
-#endif
- if (sc->sc_flags & CTF_BEOF) {
- sc->sc_flags &= ~CTF_BEOF;
- sc->sc_flags |= CTF_AEOF;
-#ifdef DEBUG
- if (ctdebug & CDB_FILES)
- printf("ctstart: after flags %x\n",
- sc->sc_flags);
-#endif
- }
- bp->b_resid = bp->b_bcount;
- ctdone(sc, bp);
- return;
- }
- sc->sc_flags |= CTF_IO;
- sc->sc_ioc.unit = C_SUNIT(sc->sc_punit);
- sc->sc_ioc.saddr = C_SADDR;
- sc->sc_ioc.addr0 = 0;
- sc->sc_ioc.addr = sc->sc_blkno;
- sc->sc_ioc.nop2 = C_NOP;
- sc->sc_ioc.slen = C_SLEN;
- sc->sc_ioc.len = sc->sc_resid;
- sc->sc_ioc.nop3 = C_NOP;
- if (bp->b_flags & B_READ)
- sc->sc_ioc.cmd = C_READ;
- else {
- sc->sc_ioc.cmd = C_WRITE;
- sc->sc_flags |= (CTF_WRT | CTF_WRTTN);
- }
- hpibsend(ctlr, slave, C_CMD, &sc->sc_ioc, sizeof(sc->sc_ioc));
- }
- hpibawait(ctlr);
-}
-
-void
-ctgo(arg)
- void *arg;
-{
- struct ct_softc *sc = arg;
- struct buf *bp;
- int rw;
-
- bp = sc->sc_tab.b_actf;
- rw = bp->b_flags & B_READ;
- hpibgo(sc->sc_dev.dv_parent->dv_unit, sc->sc_slave, C_EXEC,
- sc->sc_addr, sc->sc_resid, rw, rw != 0);
-}
-
-/*
- * Hideous grue to handle EOF/EOT (mostly for reads)
- */
-void
-cteof(sc, bp)
- struct ct_softc *sc;
- struct buf *bp;
-{
- long blks;
-
- /*
- * EOT on a write is an error.
- */
- if ((bp->b_flags & B_READ) == 0) {
- bp->b_resid = bp->b_bcount;
- bp->b_flags |= B_ERROR;
- bp->b_error = ENOSPC;
- sc->sc_flags |= CTF_EOT;
- return;
- }
- /*
- * Use returned block position to determine how many blocks
- * we really read and update b_resid.
- */
- blks = sc->sc_stat.c_blk - sc->sc_blkno - 1;
-#ifdef DEBUG
- if (ctdebug & CDB_FILES)
- printf("cteof: bc %ld oblk %d nblk %ld read %ld, resid %ld\n",
- bp->b_bcount, sc->sc_blkno, sc->sc_stat.c_blk,
- blks, bp->b_bcount - CTKTOB(blks));
-#endif
- if (blks == -1) { /* 9145 on EOF does not change sc_stat.c_blk */
- blks = 0;
- sc->sc_blkno++;
- }
- else {
- sc->sc_blkno = sc->sc_stat.c_blk;
- }
- bp->b_resid = bp->b_bcount - CTKTOB(blks);
- /*
- * If we are at physical EOV or were after an EOF,
- * we are now at logical EOT.
- */
- if ((sc->sc_stat.c_aef & AEF_EOV) ||
- (sc->sc_flags & CTF_AEOF)) {
- sc->sc_flags |= CTF_EOT;
- sc->sc_flags &= ~(CTF_AEOF|CTF_BEOF);
- }
- /*
- * If we were before an EOF or we have just completed a FSF,
- * we are now after EOF.
- */
- else if ((sc->sc_flags & CTF_BEOF) ||
- ((sc->sc_flags & CTF_CMD) && sc->sc_cmd == MTFSF)) {
- sc->sc_flags |= CTF_AEOF;
- sc->sc_flags &= ~CTF_BEOF;
- }
- /*
- * Otherwise if we read something we are now before EOF
- * (and no longer after EOF).
- */
- else if (blks) {
- sc->sc_flags |= CTF_BEOF;
- sc->sc_flags &= ~CTF_AEOF;
- }
- /*
- * Finally, if we didn't read anything we just passed an EOF
- */
- else
- sc->sc_flags |= CTF_AEOF;
-#ifdef DEBUG
- if (ctdebug & CDB_FILES)
- printf("cteof: leaving flags %x\n", sc->sc_flags);
-#endif
-}
-
-/* ARGSUSED */
-void
-ctintr(arg)
- void *arg;
-{
- struct ct_softc *sc = arg;
- struct buf *bp;
- u_char stat;
- int ctlr, slave, unit;
-
- ctlr = sc->sc_dev.dv_parent->dv_unit;
- slave = sc->sc_slave;
- unit = sc->sc_dev.dv_unit;
-
- bp = sc->sc_tab.b_actf;
- if (bp == NULL) {
- printf("%s: bp == NULL\n", sc->sc_dev.dv_xname);
- return;
- }
- if (sc->sc_flags & CTF_IO) {
- sc->sc_flags &= ~CTF_IO;
- if (hpibustart(ctlr))
- ctgo(sc);
- return;
- }
- if ((sc->sc_flags & CTF_STATWAIT) == 0) {
- if (hpibpptest(ctlr, slave) == 0) {
- sc->sc_flags |= CTF_STATWAIT;
- hpibawait(ctlr);
- return;
- }
- } else
- sc->sc_flags &= ~CTF_STATWAIT;
- hpibrecv(ctlr, slave, C_QSTAT, &stat, 1);
-#ifdef DEBUG
- if (ctdebug & CDB_FILES)
- printf("ctintr: before flags %x\n", sc->sc_flags);
-#endif
- if (stat) {
- sc->sc_rsc.unit = C_SUNIT(sc->sc_punit);
- sc->sc_rsc.cmd = C_STATUS;
- hpibsend(ctlr, slave, C_CMD, &sc->sc_rsc, sizeof(sc->sc_rsc));
- hpibrecv(ctlr, slave, C_EXEC, &sc->sc_stat,
- sizeof(sc->sc_stat));
- hpibrecv(ctlr, slave, C_QSTAT, &stat, 1);
-#ifdef DEBUG
- if (ctdebug & CDB_FILES)
- printf("ctintr: return stat 0x%x, A%x F%x blk %ld\n",
- stat, sc->sc_stat.c_aef,
- sc->sc_stat.c_fef, sc->sc_stat.c_blk);
-#endif
- if (stat == 0) {
- if (sc->sc_stat.c_aef & (AEF_EOF | AEF_EOV)) {
- cteof(sc, bp);
- ctaddeof(sc);
- goto done;
- }
- if (sc->sc_stat.c_fef & FEF_PF) {
- ctreset(sc);
- ctstart(sc);
- return;
- }
- if (sc->sc_stat.c_fef & FEF_REXMT) {
- ctstart(sc);
- return;
- }
- if (sc->sc_stat.c_aef & 0x5800) {
- if (sc->sc_stat.c_aef & 0x4000)
- printf("%s: uninitialized media\n",
- sc->sc_dev.dv_xname);
- if (sc->sc_stat.c_aef & 0x1000)
- printf("%s: not ready\n",
- sc->sc_dev.dv_xname);
- if (sc->sc_stat.c_aef & 0x0800)
- printf("%s: write protect\n",
- sc->sc_dev.dv_xname);
- } else {
- printf("%s err: v%d u%d ru%d bn%ld, ",
- sc->sc_dev.dv_xname,
- (sc->sc_stat.c_vu>>4)&0xF,
- sc->sc_stat.c_vu&0xF,
- sc->sc_stat.c_pend,
- sc->sc_stat.c_blk);
- printf("R0x%x F0x%x A0x%x I0x%x\n",
- sc->sc_stat.c_ref,
- sc->sc_stat.c_fef,
- sc->sc_stat.c_aef,
- sc->sc_stat.c_ief);
- }
- } else
- printf("%s: request status failed\n",
- sc->sc_dev.dv_xname);
- bp->b_flags |= B_ERROR;
- bp->b_error = EIO;
- goto done;
- } else
- bp->b_resid = 0;
- if (sc->sc_flags & CTF_CMD) {
- switch (sc->sc_cmd) {
- case MTFSF:
- sc->sc_flags &= ~(CTF_BEOF|CTF_AEOF);
- sc->sc_blkno += CTBTOK(sc->sc_resid);
- ctstart(sc);
- return;
- case MTBSF:
- sc->sc_flags &= ~(CTF_AEOF|CTF_BEOF|CTF_EOT);
- break;
- case MTBSR:
- sc->sc_flags &= ~CTF_BEOF;
- if (sc->sc_flags & CTF_EOT) {
- sc->sc_flags |= CTF_AEOF;
- sc->sc_flags &= ~CTF_EOT;
- } else if (sc->sc_flags & CTF_AEOF) {
- sc->sc_flags |= CTF_BEOF;
- sc->sc_flags &= ~CTF_AEOF;
- }
- break;
- case MTWEOF:
- sc->sc_flags &= ~CTF_BEOF;
- if (sc->sc_flags & (CTF_AEOF|CTF_EOT)) {
- sc->sc_flags |= CTF_EOT;
- sc->sc_flags &= ~CTF_AEOF;
- } else
- sc->sc_flags |= CTF_AEOF;
- break;
- case MTREW:
- case MTOFFL:
- sc->sc_flags &= ~(CTF_BEOF|CTF_AEOF|CTF_EOT);
- break;
- }
- } else {
- sc->sc_flags &= ~CTF_AEOF;
- sc->sc_blkno += CTBTOK(sc->sc_resid);
- }
-done:
-#ifdef DEBUG
- if (ctdebug & CDB_FILES)
- printf("ctintr: after flags %x\n", sc->sc_flags);
-#endif
- ctdone(sc, bp);
-}
-
-void
-ctdone(sc, bp)
- struct ct_softc *sc;
- struct buf *bp;
-{
- struct buf *dp;
- int s;
-
- if ((dp = bp->b_actf) != NULL)
- dp->b_actb = bp->b_actb;
- else
- sc->sc_tab.b_actb = bp->b_actb;
- *bp->b_actb = dp;
- s = splbio();
- biodone(bp);
- splx(s);
- hpibfree(sc->sc_dev.dv_parent, &sc->sc_hq);
- if (sc->sc_tab.b_actf == NULL) {
- sc->sc_tab.b_active = 0;
- return;
- }
- ctustart(sc);
-}
-
-int
-ctread(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- return (physio(ctstrategy, dev, B_READ, minphys, uio));
-}
-
-int
-ctwrite(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- /* XXX: check for hardware write-protect? */
- return (physio(ctstrategy, dev, B_WRITE, minphys, uio));
-}
-
-/*ARGSUSED*/
-int
-ctioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- int flag;
- caddr_t data;
- struct proc *p;
-{
- struct mtop *op;
- int cnt;
-
- switch (cmd) {
-
- case MTIOCTOP:
- op = (struct mtop *)data;
- switch(op->mt_op) {
-
- case MTWEOF:
- case MTFSF:
- case MTBSR:
- case MTBSF:
- case MTFSR:
- cnt = op->mt_count;
- break;
-
- case MTREW:
- case MTOFFL:
- cnt = 1;
- break;
-
- default:
- return(EINVAL);
- }
- ctcommand(dev, op->mt_op, cnt);
- break;
-
- case MTIOCGET:
- break;
-
- default:
- return(EINVAL);
- }
- return(0);
-}
-
-/* ARGSUSED */
-int
-ctdump(dev, blkno, va, size)
- dev_t dev;
- daddr_t blkno;
- caddr_t va;
- size_t size;
-{
-
- return (ENODEV);
-}
-
-void
-ctaddeof(sc)
- struct ct_softc *sc;
-{
-
- if (sc->sc_eofp == EOFS - 1)
- sc->sc_eofs[EOFS - 1]++;
- else {
- sc->sc_eofp++;
- if (sc->sc_eofp == EOFS - 1)
- sc->sc_eofs[EOFS - 1] = EOFS;
- else
- /* save blkno */
- sc->sc_eofs[sc->sc_eofp] = sc->sc_blkno - 1;
- }
-#ifdef DEBUG
- if (ctdebug & CT_BSF)
- printf("%s: add eof pos %d blk %d\n",
- sc->sc_dev.dv_xname, sc->sc_eofp,
- sc->sc_eofs[sc->sc_eofp]);
-#endif
-}
diff --git a/sys/arch/hp300/dev/ctreg.h b/sys/arch/hp300/dev/ctreg.h
deleted file mode 100644
index 880818900d3..00000000000
--- a/sys/arch/hp300/dev/ctreg.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/* $OpenBSD: ctreg.h,v 1.8 2013/02/02 13:34:29 miod Exp $ */
-/* $NetBSD: ctreg.h,v 1.6 1996/02/09 18:00:35 scottr Exp $ */
-
-/*
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ctreg.h 8.1 (Berkeley) 6/10/93
- */
-
-struct ct_iocmd {
- char unit;
- char saddr;
- short addr0;
- long addr;
- char nop2;
- char slen;
- long len;
- char nop3;
- char cmd;
-} __packed;
-
-struct ct_rscmd {
- char unit;
- char cmd;
-} __packed;
-
-struct ct_stat {
- char c_vu;
- char c_pend;
- short c_ref;
- short c_fef;
- short c_aef;
- short c_ief;
- short c_blk0;
- long c_blk;
- char c_pad[4];
-} __packed;
-
-struct ct_ssmcmd {
- char unit;
- char cmd;
- short refm;
- short fefm;
- short aefm;
- short iefm;
-} __packed;
-
-struct ct_srcmd {
- char unit;
- char nop;
- char cmd;
- char param;
-} __packed;
-
-struct ct_soptcmd {
- char unit;
- char nop;
- char cmd;
- char opt;
-} __packed;
-
-struct ct_ulcmd {
- char unit;
- char cmd;
-} __packed;
-
-struct ct_wfmcmd {
- char unit;
- char cmd;
-} __packed;
-
-struct ct_clearcmd {
- char unit;
- char cmd;
-} __packed;
-
-#define CT7946ID 0x220
-#define CT9145ID 0x268
-#define CT9144ID 0x260
-#define CT9144 0
-#define CT7912PID 0x209
-#define CT7914PID 0x20B
-#define CT88140 1
-
-/* convert bytes to 1k tape block and back */
-#define CTBTOK(x) ((x) >> 10)
-#define CTKTOB(x) ((x) << 10)
-
-#define CTCTLR 15
-
-#define REF_MASK 0x0
-#define FEF_MASK 0x0
-#define AEF_MASK 0x0
-#define IEF_MASK 0xF970
-
-#define FEF_PF 0x0002
-#define FEF_REXMT 0x0001
-#define AEF_EOF 0x0010
-#define AEF_EOV 0x0008
-
-#define C_READ 0x00
-#define C_WRITE 0x02
-#define C_CLEAR 0x08
-#define C_STATUS 0x0d
-#define C_SADDR 0x10
-#define C_SLEN 0x18
-#define C_SUNIT(x) (0x20 | (x))
-#define C_SVOL(x) (0x40 | (x))
-#define C_NOP 0x34
-#define C_DESC 0x35
-#define C_SOPT 0x38
-#define C_SREL 0x3b
-#define C_SSM 0x3e
-#define C_WFM 0x49
-#define C_UNLOAD 0x4a
-#define C_REL 0xc0
-
-#define C_CMD 0x05
-#define C_EXEC 0x0e
-#define C_QSTAT 0x10
-#define C_TCMD 0x12
-
-#define C_CC 1
-#define C_SKSPAR 2
-#define C_OPT 4
-#define C_SPAR 4
-#define C_IMRPT 8
diff --git a/sys/arch/hp300/dev/dca.c b/sys/arch/hp300/dev/dca.c
deleted file mode 100644
index 7653fa6a7a8..00000000000
--- a/sys/arch/hp300/dev/dca.c
+++ /dev/null
@@ -1,1114 +0,0 @@
-/* $OpenBSD: dca.c,v 1.44 2014/03/11 19:45:27 guenther Exp $ */
-/* $NetBSD: dca.c,v 1.35 1997/05/05 20:58:18 thorpej Exp $ */
-
-/*
- * Copyright (c) 1995, 1996, 1997 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)dca.c 8.2 (Berkeley) 1/12/94
- */
-
-/*
- * Driver for the 98626/98644/internal serial interface on hp300/hp400,
- * based on the National Semiconductor INS8250/NS16550AF/WD16C552 UARTs.
- *
- * N.B. On the hp700 and some hp300s, there is a "secret bit" with
- * undocumented behavior. The third bit of the Modem Control Register
- * (MCR_IEN == 0x08) must be set to enable interrupts. Failure to do
- * so can result in deadlock on those machines, whereas the don't seem to
- * be any harmful side-effects from setting this bit on non-affected
- * machines.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/uio.h>
-#include <sys/kernel.h>
-#include <sys/syslog.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-#include <machine/intr.h>
-
-#include <dev/cons.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-#include <hp300/dev/dcareg.h>
-
-#ifdef DDB
-#include <ddb/db_var.h>
-#endif
-
-struct dca_softc {
- struct device sc_dev; /* generic device glue */
- struct isr sc_isr;
- struct dcadevice *sc_dca; /* pointer to hardware */
- struct tty *sc_tty; /* our tty instance */
- int sc_oflows; /* overflow counter */
- short sc_flags; /* state flags */
- u_char sc_cua; /* callout mode */
-
- /*
- * Bits for sc_flags.
- */
-#define DCA_ACTIVE 0x0001 /* indicates live unit */
-#define DCA_SOFTCAR 0x0002 /* indicates soft-carrier */
-#define DCA_HASFIFO 0x0004 /* indicates unit has FIFO */
-#define DCA_ISCONSOLE 0x0008 /* indicates unit is console */
-
-};
-
-int dcamatch(struct device *, void *, void *);
-void dcaattach(struct device *, struct device *, void *);
-
-struct cfattach dca_ca = {
- sizeof(struct dca_softc), dcamatch, dcaattach
-};
-
-struct cfdriver dca_cd = {
- NULL, "dca", DV_TTY
-};
-
-int dcadefaultrate = TTYDEF_SPEED;
-int dcamajor;
-
-cdev_decl(dca);
-
-int dcaintr(void *);
-void dcaeint(struct dca_softc *, int);
-void dcamint(struct dca_softc *);
-
-int dcaparam(struct tty *, struct termios *);
-void dcastart(struct tty *);
-int dcastop(struct tty *, int);
-int dcamctl(struct dca_softc *, int, int);
-void dcainit(struct dcadevice *, int);
-
-int dca_console_scan(int, caddr_t, void *);
-cons_decl(dca);
-
-/*
- * Stuff for DCA console support.
- */
-static struct dcadevice *dca_cn = NULL; /* pointer to hardware */
-static int dcaconsinit; /* has been initialized */
-
-const struct speedtab dcaspeedtab[] = {
- { 0, 0 },
- { 50, DCABRD(50) },
- { 75, DCABRD(75) },
- { 110, DCABRD(110) },
- { 134, DCABRD(134) },
- { 150, DCABRD(150) },
- { 200, DCABRD(200) },
- { 300, DCABRD(300) },
- { 600, DCABRD(600) },
- { 1200, DCABRD(1200) },
- { 1800, DCABRD(1800) },
- { 2400, DCABRD(2400) },
- { 4800, DCABRD(4800) },
- { 9600, DCABRD(9600) },
- { 19200, DCABRD(19200) },
- { 38400, DCABRD(38400) },
- { -1, -1 },
-};
-
-#ifdef KGDB
-#include <machine/remote-sl.h>
-
-extern dev_t kgdb_dev;
-extern int kgdb_rate;
-extern int kgdb_debug_init;
-#endif
-
-#define DCAUNIT(x) (minor(x) & 0x7f)
-#define DCACUA(x) (minor(x) & 0x80)
-
-#ifdef DEBUG
-long fifoin[17];
-long fifoout[17];
-long dcaintrcount[16];
-long dcamintcount[16];
-#endif
-
-void dcainit(struct dcadevice *, int);
-
-int
-dcamatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct dio_attach_args *da = aux;
-
- switch (da->da_id) {
- case DIO_DEVICE_ID_DCA0:
- case DIO_DEVICE_ID_DCA0REM:
- case DIO_DEVICE_ID_DCA1:
- case DIO_DEVICE_ID_DCA1REM:
- return (1);
- }
-
- return (0);
-}
-
-void
-dcaattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct dca_softc *sc = (struct dca_softc *)self;
- struct dio_attach_args *da = aux;
- struct dcadevice *dca;
- int unit = self->dv_unit;
- int scode = da->da_scode;
- int ipl;
-
- if (scode == conscode) {
- dca = (struct dcadevice *)conaddr;
- sc->sc_flags |= DCA_ISCONSOLE;
- DELAY(100000);
-
- /*
- * We didn't know which unit this would be during
- * the console probe, so we have to fixup cn_dev here.
- */
- cn_tab->cn_dev = makedev(dcamajor, unit);
- } else {
- dca = (struct dcadevice *)iomap(dio_scodetopa(da->da_scode),
- da->da_size);
- if (dca == NULL) {
- printf("\n%s: can't map registers\n",
- sc->sc_dev.dv_xname);
- return;
- }
- }
-
- sc->sc_dca = dca;
-
- ipl = DIO_IPL(dca);
- printf(" ipl %d", ipl);
-
- dca->dca_reset = 0xFF;
- DELAY(100);
-
- /* look for a NS 16550AF UART with FIFOs */
- dca->dca_fifo = FIFO_ENABLE|FIFO_RCV_RST|FIFO_XMT_RST|FIFO_TRIGGER_14;
- DELAY(100);
- if ((dca->dca_iir & IIR_FIFO_MASK) == IIR_FIFO_MASK)
- sc->sc_flags |= DCA_HASFIFO;
-
- /* Establish interrupt handler. */
- sc->sc_isr.isr_func = dcaintr;
- sc->sc_isr.isr_arg = sc;
- sc->sc_isr.isr_ipl = ipl;
- sc->sc_isr.isr_priority = IPL_TTY;
- dio_intr_establish(&sc->sc_isr, self->dv_xname);
-
- sc->sc_flags |= DCA_ACTIVE;
- if (self->dv_cfdata->cf_flags)
- sc->sc_flags |= DCA_SOFTCAR;
-
- /* Enable interrupts. */
- dca->dca_ic = IC_IE;
-
- /*
- * Need to reset baud rate, etc. of next print so reset dcaconsinit.
- * Also make sure console is always "hardwired."
- */
- if (sc->sc_flags & DCA_ISCONSOLE) {
- dcaconsinit = 0;
- sc->sc_flags |= DCA_SOFTCAR;
- printf(": console, ");
- } else
- printf(": ");
-
- if (sc->sc_flags & DCA_HASFIFO)
- printf("working fifo\n");
- else
- printf("no fifo\n");
-
-#ifdef KGDB
- if (kgdb_dev == makedev(dcamajor, unit)) {
- if (sc->sc_flags & DCA_ISCONSOLE)
- kgdb_dev = NODEV; /* can't debug over console port */
- else {
- dcainit(dca, kgdb_rate);
- dcaconsinit = 1; /* don't re-init in dcaputc */
- if (kgdb_debug_init) {
- /*
- * Print prefix of device name,
- * let kgdb_connect print the rest.
- */
- printf("%s: ", sc->sc_dev.dv_xname);
- kgdb_connect(1);
- } else
- printf("%s: kgdb enabled\n",
- sc->sc_dev.dv_xname);
- }
- }
-#endif
-}
-
-/* ARGSUSED */
-int
-dcaopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- int unit = DCAUNIT(dev);
- struct dca_softc *sc;
- struct tty *tp;
- struct dcadevice *dca;
- u_char code;
- int s, error = 0;
-
- if (unit >= dca_cd.cd_ndevs ||
- (sc = dca_cd.cd_devs[unit]) == NULL)
- return (ENXIO);
-
- if ((sc->sc_flags & DCA_ACTIVE) == 0)
- return (ENXIO);
-
- dca = sc->sc_dca;
-
- s = spltty();
- if (sc->sc_tty == NULL) {
- tp = sc->sc_tty = ttymalloc(0);
- } else
- tp = sc->sc_tty;
- splx(s);
-
- tp->t_oproc = dcastart;
- tp->t_param = dcaparam;
- tp->t_dev = dev;
-
- if ((tp->t_state & TS_ISOPEN) == 0) {
- /*
- * Sanity clause: reset the card on first open.
- * The card might be left in an inconsistent state
- * if card memory is read inadvertently.
- */
- dcainit(dca, dcadefaultrate);
-
- tp->t_state |= TS_WOPEN;
- ttychars(tp);
- tp->t_iflag = TTYDEF_IFLAG;
- tp->t_oflag = TTYDEF_OFLAG;
- tp->t_cflag = TTYDEF_CFLAG;
- tp->t_lflag = TTYDEF_LFLAG;
- tp->t_ispeed = tp->t_ospeed = dcadefaultrate;
-
- s = spltty();
-
- dcaparam(tp, &tp->t_termios);
- ttsetwater(tp);
-
- /* Set the FIFO threshold based on the receive speed. */
- if (sc->sc_flags & DCA_HASFIFO)
- dca->dca_fifo = FIFO_ENABLE | FIFO_RCV_RST |
- FIFO_XMT_RST |
- (tp->t_ispeed <= 1200 ? FIFO_TRIGGER_1 :
- FIFO_TRIGGER_14);
-
- /* Flush any pending I/O */
- while ((dca->dca_iir & IIR_IMASK) == IIR_RXRDY)
- code = dca->dca_data;
-
- } else if (tp->t_state&TS_XCLUDE && suser(p, 0) != 0)
- return (EBUSY);
- else
- s = spltty();
-
- /* Set modem control state. */
- (void) dcamctl(sc, MCR_DTR | MCR_RTS, DMSET);
-
- /* Set soft-carrier if so configured. */
- if ((sc->sc_flags & DCA_SOFTCAR) || DCACUA(dev) ||
- (dcamctl(sc, 0, DMGET) & MSR_DCD))
- tp->t_state |= TS_CARR_ON;
-
- if (DCACUA(dev)) {
- if (tp->t_state & TS_ISOPEN) {
- /* Ah, but someone already is dialed in... */
- splx(s);
- return (EBUSY);
- }
- sc->sc_cua = 1; /* We go into CUA mode */
- }
-
- /* Wait for carrier if necessary. */
- if (flag & O_NONBLOCK) {
- if (!DCACUA(dev) && sc->sc_cua) {
- /* Opening TTY non-blocking... but the CUA is busy */
- splx(s);
- return (EBUSY);
- }
- } else {
- while (sc->sc_cua ||
- ((tp->t_cflag & CLOCAL) == 0 &&
- (tp->t_state & TS_CARR_ON) == 0)) {
- tp->t_state |= TS_WOPEN;
- error = ttysleep(tp, (caddr_t)&tp->t_rawq,
- TTIPRI | PCATCH, ttopen, 0);
- if (!DCACUA(dev) && sc->sc_cua && error == EINTR)
- continue;
- if (error) {
- if (DCACUA(dev))
- sc->sc_cua = 0;
- splx(s);
- return (error);
- }
- if (!DCACUA(dev) && sc->sc_cua)
- continue;
- }
- }
- splx(s);
-
- if (error == 0)
- error = (*linesw[tp->t_line].l_open)(dev, tp, p);
-
- return (error);
-}
-
-/*ARGSUSED*/
-int
-dcaclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- struct dca_softc *sc;
- struct tty *tp;
- struct dcadevice *dca;
- int unit;
- int s;
-
- unit = DCAUNIT(dev);
-
- sc = dca_cd.cd_devs[unit];
-
- dca = sc->sc_dca;
- tp = sc->sc_tty;
- (*linesw[tp->t_line].l_close)(tp, flag, p);
-
- s = spltty();
-
- dca->dca_cfcr &= ~CFCR_SBREAK;
-#ifdef KGDB
- /* do not disable interrupts if debugging */
- if (dev != kgdb_dev)
-#endif
- dca->dca_ier = 0;
- if (tp->t_cflag & HUPCL && (sc->sc_flags & DCA_SOFTCAR) == 0) {
- /* XXX perhaps only clear DTR */
- (void) dcamctl(sc, 0, DMSET);
- }
- tp->t_state &= ~(TS_BUSY | TS_FLUSH);
- sc->sc_cua = 0;
- splx(s);
- ttyclose(tp);
-#if 0
- ttyfree(tp);
- sc->sc_tty = NULL;
-#endif
- return (0);
-}
-
-int
-dcaread(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- int unit = DCAUNIT(dev);
- struct dca_softc *sc;
- struct tty *tp;
- int error, of;
-
- sc = dca_cd.cd_devs[unit];
-
- tp = sc->sc_tty;
- of = sc->sc_oflows;
- error = (*linesw[tp->t_line].l_read)(tp, uio, flag);
- /*
- * XXX hardly a reasonable thing to do, but reporting overflows
- * at interrupt time just exacerbates the problem.
- */
- if (sc->sc_oflows != of)
- log(LOG_WARNING, "%s: silo overflow\n", sc->sc_dev.dv_xname);
- return (error);
-}
-
-int
-dcawrite(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- struct dca_softc *sc = dca_cd.cd_devs[DCAUNIT(dev)];
- struct tty *tp = sc->sc_tty;
-
- return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
-}
-
-struct tty *
-dcatty(dev)
- dev_t dev;
-{
- struct dca_softc *sc = dca_cd.cd_devs[DCAUNIT(dev)];
-
- return (sc->sc_tty);
-}
-
-int
-dcaintr(arg)
- void *arg;
-{
- struct dca_softc *sc = arg;
-#ifdef KGDB
- int unit = sc->sc_dev.dv_unit;
-#endif
- struct dcadevice *dca = sc->sc_dca;
- struct tty *tp = sc->sc_tty;
- u_char code;
- int iflowdone = 0;
-
- /*
- * If interrupts aren't enabled, then the interrupt can't
- * be for us.
- */
- if ((dca->dca_ic & (IC_IR|IC_IE)) != (IC_IR|IC_IE))
- return (0);
-
- for (;;) {
- code = dca->dca_iir;
-#ifdef DEBUG
- dcaintrcount[code & IIR_IMASK]++;
-#endif
-
- switch (code & IIR_IMASK) {
- case IIR_NOPEND:
- return (1);
- case IIR_RXTOUT:
- case IIR_RXRDY:
- /* do time-critical read in-line */
-/*
- * Process a received byte. Inline for speed...
- */
-#ifdef KGDB
-#define RCVBYTE() \
- code = dca->dca_data; \
- if (tp != NULL) { \
- if ((tp->t_state & TS_ISOPEN) == 0) { \
- if (code == FRAME_END && \
- kgdb_dev == makedev(dcamajor, unit)) \
- kgdb_connect(0); /* trap into kgdb */ \
- } else \
- (*linesw[tp->t_line].l_rint)(code, tp) \
- }
-#else
-#define RCVBYTE() \
- code = dca->dca_data; \
- if (tp != NULL && (tp->t_state & TS_ISOPEN) != 0) \
- (*linesw[tp->t_line].l_rint)(code, tp)
-#endif
- RCVBYTE();
- if (sc->sc_flags & DCA_HASFIFO) {
-#ifdef DEBUG
- int fifocnt = 1;
-#endif
- while ((code = dca->dca_lsr) & LSR_RCV_MASK) {
- if (code == LSR_RXRDY) {
- RCVBYTE();
- } else
- dcaeint(sc, code);
-#ifdef DEBUG
- fifocnt++;
-#endif
- }
-#ifdef DEBUG
- if (fifocnt > 16)
- fifoin[0]++;
- else
- fifoin[fifocnt]++;
-#endif
- }
- if (iflowdone == 0 && tp != NULL &&
- (tp->t_cflag & CRTS_IFLOW) &&
- tp->t_rawq.c_cc > (TTYHOG(tp) / 2)) {
- dca->dca_mcr &= ~MCR_RTS;
- iflowdone = 1;
- }
- break;
- case IIR_TXRDY:
- if (tp != NULL) {
- tp->t_state &=~ (TS_BUSY|TS_FLUSH);
- if (tp->t_line)
- (*linesw[tp->t_line].l_start)(tp);
- else
- dcastart(tp);
- }
- break;
- case IIR_RLS:
- dcaeint(sc, dca->dca_lsr);
- break;
- default:
- if (code & IIR_NOPEND)
- return (1);
- log(LOG_WARNING, "%s: weird interrupt: 0x%x\n",
- sc->sc_dev.dv_xname, code);
- /* FALLTHROUGH */
- case IIR_MLSC:
- dcamint(sc);
- break;
- }
- }
-}
-
-void
-dcaeint(sc, stat)
- struct dca_softc *sc;
- int stat;
-{
- struct tty *tp = sc->sc_tty;
- struct dcadevice *dca = sc->sc_dca;
- int c;
-
- c = dca->dca_data;
-
-#if defined(DDB) && !defined(KGDB)
- if ((sc->sc_flags & DCA_ISCONSOLE) && db_console && (stat & LSR_BI)) {
- Debugger();
- return;
- }
-#endif
-
- if (tp == NULL)
- return;
-
- if ((tp->t_state & TS_ISOPEN) == 0) {
-#ifdef KGDB
- /* we don't care about parity errors */
- if (((stat & (LSR_BI|LSR_FE|LSR_PE)) == LSR_PE) &&
- kgdb_dev == makedev(dcamajor, sc->sc_hd->hp_unit) &&
- c == FRAME_END)
- kgdb_connect(0); /* trap into kgdb */
-#endif
- return;
- }
-
- if (stat & (LSR_BI | LSR_FE))
- c |= TTY_FE;
- else if (stat & LSR_PE)
- c |= TTY_PE;
- else if (stat & LSR_OE)
- sc->sc_oflows++;
- (*linesw[tp->t_line].l_rint)(c, tp);
-}
-
-void
-dcamint(sc)
- struct dca_softc *sc;
-{
- struct tty *tp = sc->sc_tty;
- struct dcadevice *dca = sc->sc_dca;
- u_char stat;
-
- stat = dca->dca_msr;
-#ifdef DEBUG
- dcamintcount[stat & 0xf]++;
-#endif
-
- if (tp == NULL)
- return;
-
- if ((stat & MSR_DDCD) &&
- (sc->sc_flags & DCA_SOFTCAR) == 0) {
- if (stat & MSR_DCD)
- (void)(*linesw[tp->t_line].l_modem)(tp, 1);
- else if ((*linesw[tp->t_line].l_modem)(tp, 0) == 0)
- dca->dca_mcr &= ~(MCR_DTR | MCR_RTS);
- }
- /*
- * CTS change.
- * If doing HW output flow control start/stop output as appropriate.
- */
- if ((stat & MSR_DCTS) &&
- (tp->t_state & TS_ISOPEN) && (tp->t_cflag & CCTS_OFLOW)) {
- if (stat & MSR_CTS) {
- tp->t_state &=~ TS_TTSTOP;
- dcastart(tp);
- } else {
- tp->t_state |= TS_TTSTOP;
- }
- }
-}
-
-int
-dcaioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- int unit = DCAUNIT(dev);
- struct dca_softc *sc = dca_cd.cd_devs[unit];
- struct tty *tp = sc->sc_tty;
- struct dcadevice *dca = sc->sc_dca;
- int error;
-
- error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
- if (error >= 0)
- return (error);
- error = ttioctl(tp, cmd, data, flag, p);
- if (error >= 0)
- return (error);
-
- switch (cmd) {
- case TIOCSBRK:
- dca->dca_cfcr |= CFCR_SBREAK;
- break;
-
- case TIOCCBRK:
- dca->dca_cfcr &= ~CFCR_SBREAK;
- break;
-
- case TIOCSDTR:
- (void) dcamctl(sc, MCR_DTR | MCR_RTS, DMBIS);
- break;
-
- case TIOCCDTR:
- (void) dcamctl(sc, MCR_DTR | MCR_RTS, DMBIC);
- break;
-
- case TIOCMSET:
- (void) dcamctl(sc, *(int *)data, DMSET);
- break;
-
- case TIOCMBIS:
- (void) dcamctl(sc, *(int *)data, DMBIS);
- break;
-
- case TIOCMBIC:
- (void) dcamctl(sc, *(int *)data, DMBIC);
- break;
-
- case TIOCMGET:
- *(int *)data = dcamctl(sc, 0, DMGET);
- break;
-
- case TIOCGFLAGS: {
- int bits = 0;
-
- if (sc->sc_flags & DCA_SOFTCAR)
- bits |= TIOCFLAG_SOFTCAR;
-
- if (tp->t_cflag & CLOCAL)
- bits |= TIOCFLAG_CLOCAL;
-
- *(int *)data = bits;
- break;
- }
-
- case TIOCSFLAGS: {
- int userbits;
-
- error = suser(p, 0);
- if (error)
- return (EPERM);
-
- userbits = *(int *)data;
-
- if ((userbits & TIOCFLAG_SOFTCAR) ||
- (sc->sc_flags & DCA_ISCONSOLE))
- sc->sc_flags |= DCA_SOFTCAR;
-
- if (userbits & TIOCFLAG_CLOCAL)
- tp->t_cflag |= CLOCAL;
-
- break;
- }
-
- default:
- return (ENOTTY);
- }
- return (0);
-}
-
-int
-dcaparam(tp, t)
- struct tty *tp;
- struct termios *t;
-{
- int unit = DCAUNIT(tp->t_dev);
- struct dca_softc *sc = dca_cd.cd_devs[unit];
- struct dcadevice *dca = sc->sc_dca;
- int cfcr, cflag = t->c_cflag;
- int ospeed = ttspeedtab(t->c_ospeed, dcaspeedtab);
- int s;
-
- /* check requested parameters */
- if (ospeed < 0 || (t->c_ispeed && t->c_ispeed != t->c_ospeed))
- return (EINVAL);
-
- switch (cflag & CSIZE) {
- case CS5:
- cfcr = CFCR_5BITS;
- break;
-
- case CS6:
- cfcr = CFCR_6BITS;
- break;
-
- case CS7:
- cfcr = CFCR_7BITS;
- break;
-
- case CS8:
- default: /* XXX gcc whines about cfcr being unitialized... */
- cfcr = CFCR_8BITS;
- break;
- }
- if (cflag & PARENB) {
- cfcr |= CFCR_PENAB;
- if ((cflag & PARODD) == 0)
- cfcr |= CFCR_PEVEN;
- }
- if (cflag & CSTOPB)
- cfcr |= CFCR_STOPB;
-
- s = spltty();
-
- if (ospeed == 0)
- (void) dcamctl(sc, 0, DMSET); /* hang up line */
-
- /*
- * Set the FIFO threshold based on the receive speed, if we
- * are changing it.
- */
- if (tp->t_ispeed != t->c_ispeed) {
- if (sc->sc_flags & DCA_HASFIFO)
- dca->dca_fifo = FIFO_ENABLE |
- (t->c_ispeed <= 1200 ? FIFO_TRIGGER_1 :
- FIFO_TRIGGER_14);
- }
-
- if (ospeed != 0) {
- dca->dca_cfcr |= CFCR_DLAB;
- dca->dca_data = ospeed & 0xFF;
- dca->dca_ier = ospeed >> 8;
- dca->dca_cfcr = cfcr;
- } else
- dca->dca_cfcr = cfcr;
-
- /* and copy to tty */
- tp->t_ispeed = t->c_ispeed;
- tp->t_ospeed = t->c_ospeed;
- tp->t_cflag = cflag;
-
- dca->dca_ier = IER_ERXRDY | IER_ETXRDY | IER_ERLS | IER_EMSC;
- dca->dca_mcr |= MCR_IEN;
-
- splx(s);
- return (0);
-}
-
-void
-dcastart(tp)
- struct tty *tp;
-{
- int s, c, unit = DCAUNIT(tp->t_dev);
- struct dca_softc *sc = dca_cd.cd_devs[unit];
- struct dcadevice *dca = sc->sc_dca;
-
- s = spltty();
-
- if (tp->t_state & (TS_TIMEOUT|TS_TTSTOP))
- goto out;
- ttwakeupwr(tp);
- if (tp->t_outq.c_cc == 0)
- goto out;
- if (dca->dca_lsr & LSR_TXRDY) {
- tp->t_state |= TS_BUSY;
- if (sc->sc_flags & DCA_HASFIFO) {
- for (c = 0; c < 16 && tp->t_outq.c_cc; ++c)
- dca->dca_data = getc(&tp->t_outq);
-#ifdef DEBUG
- if (c > 16)
- fifoout[0]++;
- else
- fifoout[c]++;
-#endif
- } else
- dca->dca_data = getc(&tp->t_outq);
- }
-
-out:
- splx(s);
-}
-
-/*
- * Stop output on a line.
- */
-/*ARGSUSED*/
-int
-dcastop(tp, flag)
- struct tty *tp;
- int flag;
-{
- int s;
-
- s = spltty();
- if (tp->t_state & TS_BUSY)
- if ((tp->t_state & TS_TTSTOP) == 0)
- tp->t_state |= TS_FLUSH;
- splx(s);
- return (0);
-}
-
-int
-dcamctl(sc, bits, how)
- struct dca_softc *sc;
- int bits, how;
-{
- struct dcadevice *dca = sc->sc_dca;
- int s;
-
- /*
- * Always make sure MCR_IEN is set (unless setting to 0)
- */
-#ifdef KGDB
- if (how == DMSET && kgdb_dev == makedev(dcamajor, sc->sc_hd->hp_unit))
- bits |= MCR_IEN;
- else
-#endif
- if (how == DMBIS || (how == DMSET && bits))
- bits |= MCR_IEN;
- else if (how == DMBIC)
- bits &= ~MCR_IEN;
- s = spltty();
-
- switch (how) {
- case DMSET:
- dca->dca_mcr = bits;
- break;
-
- case DMBIS:
- dca->dca_mcr |= bits;
- break;
-
- case DMBIC:
- dca->dca_mcr &= ~bits;
- break;
-
- case DMGET:
- bits = dca->dca_msr;
- break;
- }
- splx(s);
- return (bits);
-}
-
-void
-dcainit(dca, rate)
- struct dcadevice *dca;
- int rate;
-{
- int s;
- short stat;
-
- s = splhigh();
-
- dca->dca_reset = 0xFF;
- DELAY(100);
- dca->dca_ic = IC_IE;
-
- dca->dca_cfcr = CFCR_DLAB;
- rate = ttspeedtab(rate, dcaspeedtab);
- dca->dca_data = rate & 0xFF;
- dca->dca_ier = rate >> 8;
- dca->dca_cfcr = CFCR_8BITS;
- dca->dca_ier = IER_ERXRDY | IER_ETXRDY;
- dca->dca_fifo =
- FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST | FIFO_TRIGGER_1;
- dca->dca_mcr = MCR_DTR | MCR_RTS;
- DELAY(100);
- stat = dca->dca_iir;
- splx(s);
-}
-
-/*
- * Following are all routines needed for DCA to act as console
- */
-
-int
-dca_console_scan(scode, va, arg)
- int scode;
- caddr_t va;
- void *arg;
-{
- struct dcadevice *dca = (struct dcadevice *)va;
- struct consdev *cp = arg;
- u_int pri;
-
- switch (dca->dca_id) {
- case DCAID0:
- case DCAID1:
- pri = CN_LOWPRI;
- break;
-
- case DCAID0 | DCACON:
- case DCAID1 | DCACON:
- pri = CN_HIGHPRI;
- break;
-
- default:
- return (0);
- }
-
-#ifdef CONSCODE
- /*
- * Raise our priority, if appropriate.
- */
- if (scode == CONSCODE)
- pri = CN_FORCED;
-#endif
-
- /* Only raise priority. */
- if (pri > cp->cn_pri)
- cp->cn_pri = pri;
-
- /*
- * If our priority is higher than the currently-remembered
- * console, stash our priority, for the benefit of dcacninit().
- */
- if (cn_tab == NULL || cp->cn_pri > cn_tab->cn_pri) {
- cn_tab = cp;
- conscode = scode;
- return (DIO_SIZE(scode, va));
- }
- return (0);
-}
-
-void
-dcacnprobe(cp)
- struct consdev *cp;
-{
-
- /* locate the major number */
- for (dcamajor = 0; dcamajor < nchrdev; dcamajor++)
- if (cdevsw[dcamajor].d_open == dcaopen)
- break;
-
- /* initialize required fields */
- cp->cn_dev = makedev(dcamajor, 0); /* XXX */
-
- console_scan(dca_console_scan, cp);
-
-#ifdef KGDB
- /* XXX this needs to be fixed. */
- if (major(kgdb_dev) == 1) /* XXX */
- kgdb_dev = makedev(dcamajor, minor(kgdb_dev));
-#endif
-}
-
-/* ARGSUSED */
-void
-dcacninit(cp)
- struct consdev *cp;
-{
-
- /*
- * We are not interested by the second console pass.
- */
- if (consolepass != 0)
- return;
-
- dca_cn = (struct dcadevice *)conaddr;
- dcainit(dca_cn, dcadefaultrate);
- dcaconsinit = 1;
-}
-
-/* ARGSUSED */
-int
-dcacngetc(dev)
- dev_t dev;
-{
- u_char stat;
- int c, s;
-
- s = splhigh();
- while (((stat = dca_cn->dca_lsr) & LSR_RXRDY) == 0)
- ;
- c = dca_cn->dca_data;
- stat = dca_cn->dca_iir;
- splx(s);
- return (c);
-}
-
-/*
- * Console kernel output character routine.
- */
-/* ARGSUSED */
-void
-dcacnputc(dev, c)
- dev_t dev;
- int c;
-{
- int timo;
- u_char stat;
- int s = splhigh();
-
- if (dcaconsinit == 0) {
- dcainit(dca_cn, dcadefaultrate);
- dcaconsinit = 1;
- }
- /* wait for any pending transmission to finish */
- timo = 50000;
- while (((stat = dca_cn->dca_lsr) & LSR_TXRDY) == 0 && --timo)
- ;
- dca_cn->dca_data = c;
- /* wait for this transmission to complete */
- timo = 1500000;
- while (((stat = dca_cn->dca_lsr) & LSR_TXRDY) == 0 && --timo)
- ;
- /* clear any interrupts generated by this transmission */
- stat = dca_cn->dca_iir;
- splx(s);
-}
diff --git a/sys/arch/hp300/dev/dcareg.h b/sys/arch/hp300/dev/dcareg.h
deleted file mode 100644
index 66dcd3e4ea4..00000000000
--- a/sys/arch/hp300/dev/dcareg.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/* $OpenBSD: dcareg.h,v 1.8 2010/05/22 13:04:25 deraadt Exp $ */
-/* $NetBSD: dcareg.h,v 1.6 1996/02/24 00:55:02 thorpej Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)dcareg.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <hp300/dev/iotypes.h> /* XXX */
-
-struct dcadevice {
- /* card registers */
- u_char dca_pad0;
- vu_char dca_id; /* 0x01 (read) */
-#define dca_reset dca_id /* 0x01 (write) */
- u_char dca_pad1;
- vu_char dca_ic; /* 0x03 */
- u_char dca_pad2;
- vu_char dca_ocbrc; /* 0x05 */
- u_char dca_pad3;
- vu_char dca_lcsm; /* 0x07 */
- u_char dca_pad4[8];
- /* chip registers */
- u_char dca_pad5;
- vu_char dca_data; /* 0x11 */
- u_char dca_pad6;
- vu_char dca_ier; /* 0x13 */
- u_char dca_pad7;
- vu_char dca_iir; /* 0x15 (read) */
-#define dca_fifo dca_iir /* 0x15 (write) */
- u_char dca_pad8;
- vu_char dca_cfcr; /* 0x17 */
- u_char dca_pad9;
- vu_char dca_mcr; /* 0x19 */
- u_char dca_padA;
- vu_char dca_lsr; /* 0x1B */
- u_char dca_padB;
- vu_char dca_msr; /* 0x1D */
-};
-
-/* interface reset/id (300 only) */
-#define DCAID0 0x02
-#define DCAID1 0x42
-#define DCACON 0x80 /* REMOTE/LOCAL switch */
-
-/* interrupt control (300 only) */
-#define DCAIPL(x) ((((x) >> 4) & 3) + 3)
-#define IC_IR 0x40
-#define IC_IE 0x80
-
-/*
- * 16 bit baud rate divisor (lower byte in dca_data, upper in dca_ier)
- * NB: This constant is for a 7.3728 clock frequency. The 300 clock
- * frequency is 2.4576, giving a constant of 153600.
- */
-#define DCABRD(x) (153600 / (x))
-
-/* interrupt enable register */
-#define IER_ERXRDY 0x1 /* Enable receiver interrupt */
-#define IER_ETXRDY 0x2 /* Enable transmitter empty interrupt */
-#define IER_ERLS 0x4 /* Enable line status interrupt */
-#define IER_EMSC 0x8 /* Enable modem status interrupt */
-
-/* interrupt identification register */
-#define IIR_IMASK 0xf
-#define IIR_RXTOUT 0xc
-#define IIR_RLS 0x6 /* Line status change */
-#define IIR_RXRDY 0x4 /* Receiver ready */
-#define IIR_TXRDY 0x2 /* Transmitter ready */
-#define IIR_NOPEND 0x1 /* No pending interrupts */
-#define IIR_MLSC 0x0 /* Modem status */
-#define IIR_FIFO_MASK 0xc0 /* set if FIFOs are enabled */
-
-/* fifo control register */
-#define FIFO_ENABLE 0x01 /* Turn the FIFO on */
-#define FIFO_RCV_RST 0x02 /* Reset RX FIFO */
-#define FIFO_XMT_RST 0x04 /* Reset TX FIFO */
-#define FIFO_DMA_MODE 0x08
-#define FIFO_TRIGGER_1 0x00 /* Trigger RXRDY intr on 1 character */
-#define FIFO_TRIGGER_4 0x40 /* ibid 4 */
-#define FIFO_TRIGGER_8 0x80 /* ibid 8 */
-#define FIFO_TRIGGER_14 0xc0 /* ibid 14 */
-
-/* character format control register */
-#define CFCR_DLAB 0x80
-#define CFCR_SBREAK 0x40
-#define CFCR_PZERO 0x30
-#define CFCR_PONE 0x20
-#define CFCR_PEVEN 0x10
-#define CFCR_PODD 0x00
-#define CFCR_PENAB 0x08
-#define CFCR_STOPB 0x04
-#define CFCR_8BITS 0x03
-#define CFCR_7BITS 0x02
-#define CFCR_6BITS 0x01
-#define CFCR_5BITS 0x00
-
-/* modem control register */
-#define MCR_LOOPBACK 0x10 /* Loop test: echos from TX to RX */
-#define MCR_IEN 0x08 /* Out2: enables UART interrupts */
-#define MCR_DRS 0x04 /* Out1: resets some internal modems */
-#define MCR_RTS 0x02 /* Request To Send */
-#define MCR_DTR 0x01 /* Data Terminal Ready */
-
-/* line status register */
-#define LSR_RCV_FIFO 0x80
-#define LSR_TSRE 0x40 /* Transmitter empty: byte sent */
-#define LSR_TXRDY 0x20 /* Transmitter buffer empty */
-#define LSR_BI 0x10 /* Break detected */
-#define LSR_FE 0x08 /* Framing error: bad stop bit */
-#define LSR_PE 0x04 /* Parity error */
-#define LSR_OE 0x02 /* Overrun, lost incoming byte */
-#define LSR_RXRDY 0x01 /* Byte ready in Receive Buffer */
-#define LSR_RCV_MASK 0x1f /* Mask for incoming data or error */
-
-/* modem status register */
-#define MSR_DCD 0x80 /* Current Data Carrier Detect */
-#define MSR_RI 0x40 /* Current Ring Indicator */
-#define MSR_DSR 0x20 /* Current Data Set Ready */
-#define MSR_CTS 0x10 /* Current Clear to Send */
-#define MSR_DDCD 0x08 /* DCD has changed state */
-#define MSR_TERI 0x04 /* RI has toggled low to high */
-#define MSR_DDSR 0x02 /* DSR has changed state */
-#define MSR_DCTS 0x01 /* CTS has changed state */
diff --git a/sys/arch/hp300/dev/dcm.c b/sys/arch/hp300/dev/dcm.c
deleted file mode 100644
index 6346eeb1f38..00000000000
--- a/sys/arch/hp300/dev/dcm.c
+++ /dev/null
@@ -1,1672 +0,0 @@
-/* $OpenBSD: dcm.c,v 1.36 2012/09/08 19:24:28 miod Exp $ */
-/* $NetBSD: dcm.c,v 1.41 1997/05/05 20:59:16 thorpej Exp $ */
-
-/*
- * Copyright (c) 1995, 1996, 1997 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from Utah: $Hdr: dcm.c 1.29 92/01/21$
- *
- * @(#)dcm.c 8.4 (Berkeley) 1/12/94
- */
-
-/*
- * TODO:
- * Timeouts
- * Test console support.
- */
-
-/*
- * 98642/MUX
- */
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/uio.h>
-#include <sys/kernel.h>
-#include <sys/syslog.h>
-#include <sys/time.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-#include <machine/intr.h>
-
-#include <dev/cons.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-#include <hp300/dev/dcmreg.h>
-
-#ifndef DEFAULT_BAUD_RATE
-#define DEFAULT_BAUD_RATE 9600
-#endif
-
-const struct speedtab dcmspeedtab[] = {
- { 0, BR_0 },
- { 50, BR_50 },
- { 75, BR_75 },
- { 110, BR_110 },
- { 134, BR_134 },
- { 150, BR_150 },
- { 300, BR_300 },
- { 600, BR_600 },
- { 1200, BR_1200 },
- { 1800, BR_1800 },
- { 2400, BR_2400 },
- { 4800, BR_4800 },
- { 9600, BR_9600 },
- { 19200, BR_19200 },
- { 38400, BR_38400 },
- { -1, -1 },
-};
-
-/* u-sec per character based on baudrate (assumes 1 start/8 data/1 stop bit) */
-#define DCM_USPERCH(s) (10000000 / (s))
-
-/*
- * Per board interrupt scheme. 16.7ms is the polling interrupt rate
- * (16.7ms is about 550 baud, 38.4k is 72 chars in 16.7ms).
- */
-#define DIS_TIMER 0
-#define DIS_PERCHAR 1
-#define DIS_RESET 2
-
-int dcmistype = -1; /* -1 == dynamic, 0 == timer, 1 == perchar */
-int dcminterval = 5; /* interval (secs) between checks */
-struct dcmischeme {
- int dis_perchar; /* non-zero if interrupting per char */
- long dis_time; /* last time examined */
- int dis_intr; /* recv interrupts during last interval */
- int dis_char; /* characters read during last interval */
-};
-
-/*
- * Stuff for DCM console support. This could probably be done a little
- * better.
- */
-static struct dcmdevice *dcm_cn = NULL; /* pointer to hardware */
-static int dcmconsinit; /* has been initialized */
-
-int dcmdefaultrate = DEFAULT_BAUD_RATE;
-int dcmconbrdbusy = 0;
-int dcmmajor;
-
-#ifdef KGDB
-/*
- * Kernel GDB support
- */
-#include <machine/remote-sl.h>
-
-extern dev_t kgdb_dev;
-extern int kgdb_rate;
-extern int kgdb_debug_init;
-#endif
-
-/* #define DCMSTATS */
-
-#ifdef DEBUG
-int dcmdebug = 0x0;
-#define DDB_SIOERR 0x01
-#define DDB_PARAM 0x02
-#define DDB_INPUT 0x04
-#define DDB_OUTPUT 0x08
-#define DDB_INTR 0x10
-#define DDB_IOCTL 0x20
-#define DDB_INTSCHM 0x40
-#define DDB_MODEM 0x80
-#define DDB_OPENCLOSE 0x100
-#endif
-
-#ifdef DCMSTATS
-#define DCMRBSIZE 94
-#define DCMXBSIZE 24
-
-struct dcmstats {
- long xints; /* # of xmit ints */
- long xchars; /* # of xmit chars */
- long xempty; /* times outq is empty in dcmstart */
- long xrestarts; /* times completed while xmitting */
- long rints; /* # of recv ints */
- long rchars; /* # of recv chars */
- long xsilo[DCMXBSIZE+2]; /* times this many chars xmit on one int */
- long rsilo[DCMRBSIZE+2]; /* times this many chars read on one int */
-};
-#endif
-
-#define DCMUNIT(x) (minor(x) & 0x7f)
-#define DCMCUA(x) (minor(x) & 0x80)
-#define DCMBOARD(x) (((x) >> 2) & 0x3f)
-#define DCMPORT(x) ((x) & 3)
-
-/*
- * Conversion from "HP DCE" to almost-normal DCE: on the 638 8-port mux,
- * the distribution panel uses "HP DCE" conventions. If requested via
- * the device flags, we swap the inputs to something closer to normal DCE,
- * allowing a straight-through cable to a DTE or a reversed cable
- * to a DCE (reversing 2-3, 4-5, 8-20 and leaving 6 unconnected;
- * this gets "DCD" on pin 20 and "CTS" on 4, but doesn't connect
- * DSR or make RTS work, though). The following gives the full
- * details of a cable from this mux panel to a modem:
- *
- * HP modem
- * name pin pin name
- * HP inputs:
- * "Rx" 2 3 Tx
- * CTS 4 5 CTS (only needed for CCTS_OFLOW)
- * DCD 20 8 DCD
- * "DSR" 9 6 DSR (unneeded)
- * RI 22 22 RI (unneeded)
- *
- * HP outputs:
- * "Tx" 3 2 Rx
- * "DTR" 6 not connected
- * "RTS" 8 20 DTR
- * "SR" 23 4 RTS (often not needed)
- */
-#define hp2dce_in(ibits) (iconv[(ibits) & 0xf])
-static char iconv[16] = {
- 0, MI_DM, MI_CTS, MI_CTS|MI_DM,
- MI_CD, MI_CD|MI_DM, MI_CD|MI_CTS, MI_CD|MI_CTS|MI_DM,
- MI_RI, MI_RI|MI_DM, MI_RI|MI_CTS, MI_RI|MI_CTS|MI_DM,
- MI_RI|MI_CD, MI_RI|MI_CD|MI_DM, MI_RI|MI_CD|MI_CTS,
- MI_RI|MI_CD|MI_CTS|MI_DM
-};
-
-/*
- * Note that 8-port boards appear as 2 4-port boards at consecutive
- * select codes.
- */
-#define NDCMPORT 4
-
-struct dcm_softc {
- struct device sc_dev; /* generic device glue */
- struct isr sc_isr;
- struct dcmdevice *sc_dcm; /* pointer to hardware */
- struct tty *sc_tty[NDCMPORT]; /* our tty instances */
- struct modemreg *sc_modem[NDCMPORT]; /* modem control */
- char sc_mcndlast[NDCMPORT]; /* XXX last modem status for port */
- short sc_softCAR; /* mask of ports with soft-carrier */
- struct dcmischeme sc_scheme; /* interrupt scheme for board */
- u_char sc_cua; /* callout mode */
-
- /*
- * Mask of soft-carrier bits in config flags.
- */
-#define DCM_SOFTCAR 0x0000000f
-
- int sc_flags; /* misc. configuration info */
-
- /*
- * Bits for sc_flags
- */
-#define DCM_ACTIVE 0x00000001 /* indicates board is alive */
-#define DCM_ISCONSOLE 0x00000002 /* indicates board is console */
-#define DCM_STDDCE 0x00000010 /* re-map DCE to standard */
-#define DCM_FLAGMASK (DCM_STDDCE) /* mask of valid bits in config flags */
-
-#ifdef DCMSTATS
- struct dcmstats sc_stats; /* metrics gathering */
-#endif
-};
-
-cdev_decl(dcm);
-
-int dcmintr(void *);
-void dcmpint(struct dcm_softc *, int, int);
-void dcmrint(struct dcm_softc *);
-void dcmreadbuf(struct dcm_softc *, int);
-void dcmxint(struct dcm_softc *, int);
-void dcmmint(struct dcm_softc *, int, int);
-
-int dcmparam(struct tty *, struct termios *);
-void dcmstart(struct tty *);
-int dcmstop(struct tty *, int);
-int dcmmctl(dev_t, int, int);
-void dcmsetischeme(int, int);
-void dcminit(struct dcmdevice *, int, int);
-
-int dcmselftest(struct dcm_softc *);
-
-int dcm_console_scan(int, caddr_t, void *);
-cons_decl(dcm);
-
-int dcmmatch(struct device *, void *, void *);
-void dcmattach(struct device *, struct device *, void *);
-
-struct cfattach dcm_ca = {
- sizeof(struct dcm_softc), dcmmatch, dcmattach
-};
-
-struct cfdriver dcm_cd = {
- NULL, "dcm", DV_TTY
-};
-
-int
-dcmmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct dio_attach_args *da = aux;
-
- switch (da->da_id) {
- case DIO_DEVICE_ID_DCM:
- case DIO_DEVICE_ID_DCMREM:
- return (1);
- }
-
- return (0);
-}
-
-void
-dcmattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct dcm_softc *sc = (struct dcm_softc *)self;
- struct dio_attach_args *da = aux;
- struct dcmdevice *dcm;
- int brd = self->dv_unit;
- int scode = da->da_scode;
- int i, mbits, code, ipl;
-
- sc->sc_flags = 0;
-
- if (scode == conscode) {
- dcm = (struct dcmdevice *)conaddr;
- sc->sc_flags |= DCM_ISCONSOLE;
-
- /*
- * We didn't know which unit this would be during
- * the console probe, so we have to fixup cn_dev here.
- * Note that we always assume port 1 on the board.
- */
- cn_tab->cn_dev = makedev(dcmmajor, (brd << 2) | DCMCONSPORT);
- } else {
- dcm = (struct dcmdevice *)iomap(dio_scodetopa(da->da_scode),
- da->da_size);
- if (dcm == NULL) {
- printf("\n%s: can't map registers\n",
- sc->sc_dev.dv_xname);
- return;
- }
- }
-
- sc->sc_dcm = dcm;
-
- ipl = DIO_IPL(dcm);
- printf(" ipl %d", ipl);
-
- /*
- * XXX someone _should_ fix this; the self test screws
- * autoconfig messages.
- */
- if ((sc->sc_flags & DCM_ISCONSOLE) && dcmselftest(sc)) {
- printf("\n%s: self-test failed\n", sc->sc_dev.dv_xname);
- return;
- }
-
- /* Extract configuration info from flags. */
- sc->sc_softCAR = self->dv_cfdata->cf_flags & DCM_SOFTCAR;
- sc->sc_flags |= self->dv_cfdata->cf_flags & DCM_FLAGMASK;
-
- /* Mark our unit as configured. */
- sc->sc_flags |= DCM_ACTIVE;
-
- /* Establish the interrupt handler. */
- sc->sc_isr.isr_func = dcmintr;
- sc->sc_isr.isr_arg = sc;
- sc->sc_isr.isr_ipl = ipl;
- sc->sc_isr.isr_priority = IPL_TTY;
- dio_intr_establish(&sc->sc_isr, self->dv_xname);
-
- if (dcmistype == DIS_TIMER)
- dcmsetischeme(brd, DIS_RESET|DIS_TIMER);
- else
- dcmsetischeme(brd, DIS_RESET|DIS_PERCHAR);
-
- /* load pointers to modem control */
- sc->sc_modem[0] = &dcm->dcm_modem0;
- sc->sc_modem[1] = &dcm->dcm_modem1;
- sc->sc_modem[2] = &dcm->dcm_modem2;
- sc->sc_modem[3] = &dcm->dcm_modem3;
-
- /* set DCD (modem) and CTS (flow control) on all ports */
- if (sc->sc_flags & DCM_STDDCE)
- mbits = hp2dce_in(MI_CD|MI_CTS);
- else
- mbits = MI_CD|MI_CTS;
-
- for (i = 0; i < NDCMPORT; i++)
- sc->sc_modem[i]->mdmmsk = mbits;
-
- /*
- * Get current state of mdmin register on all ports, so that
- * deltas will work properly.
- */
- for (i = 0; i < NDCMPORT; i++) {
- code = sc->sc_modem[i]->mdmin;
- if (sc->sc_flags & DCM_STDDCE)
- code = hp2dce_in(code);
- sc->sc_mcndlast[i] = code;
- }
-
- dcm->dcm_ic = IC_IE; /* turn all interrupts on */
-
- /*
- * Need to reset baud rate, etc. of next print so reset dcmconsinit.
- * Also make sure console is always "hardwired"
- */
- if (sc->sc_flags & DCM_ISCONSOLE) {
- dcmconsinit = 0;
- sc->sc_softCAR |= (1 << DCMCONSPORT);
- printf(": console on port %d\n", DCMCONSPORT);
- } else
- printf("\n");
-
-#ifdef KGDB
- if (major(kgdb_dev) == dcmmajor &&
- DCMBOARD(DCMUNIT(kgdb_dev)) == brd) {
- if (dcmconsole == DCMUNIT(kgdb_dev)) /* XXX fixme */
- kgdb_dev = NODEV; /* can't debug over console port */
-#ifndef KGDB_CHEAT
- /*
- * The following could potentially be replaced
- * by the corresponding code in dcmcnprobe.
- */
- else {
- dcminit(dcm, DCMPORT(DCMUNIT(kgdb_dev)),
- kgdb_rate);
- if (kgdb_debug_init) {
- printf("%s port %d: ", sc->sc_dev.dv_xname,
- DCMPORT(DCMUNIT(kgdb_dev)));
- kgdb_connect(1);
- } else
- printf("%s port %d: kgdb enabled\n",
- sc->sc_dev.dv_xname,
- DCMPORT(DCMUNIT(kgdb_dev)));
- }
- /* end could be replaced */
-#endif /* KGDB_CHEAT */
- }
-#endif /* KGDB */
-}
-
-/* ARGSUSED */
-int
-dcmopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- struct dcm_softc *sc;
- struct tty *tp;
- int unit, brd, port;
- int error = 0, mbits, s;
-
- unit = DCMUNIT(dev);
- brd = DCMBOARD(unit);
- port = DCMPORT(unit);
-
- if (brd >= dcm_cd.cd_ndevs || port >= NDCMPORT ||
- (sc = dcm_cd.cd_devs[brd]) == NULL)
- return (ENXIO);
-
- if ((sc->sc_flags & DCM_ACTIVE) == 0)
- return (ENXIO);
-
- s = spltty();
- if (sc->sc_tty[port] == NULL) {
- tp = sc->sc_tty[port] = ttymalloc(0);
- } else
- tp = sc->sc_tty[port];
- splx(s);
-
- tp->t_oproc = dcmstart;
- tp->t_param = dcmparam;
- tp->t_dev = dev;
-
- if ((tp->t_state & TS_ISOPEN) == 0) {
- /*
- * Sanity clause: reset the card on first open.
- * The card might be left in an inconsistent state
- * if the card memory is read inadvertently.
- */
- dcminit(sc->sc_dcm, port, dcmdefaultrate);
-
- tp->t_state |= TS_WOPEN;
- ttychars(tp);
- tp->t_iflag = TTYDEF_IFLAG;
- tp->t_oflag = TTYDEF_OFLAG;
- tp->t_cflag = TTYDEF_CFLAG;
- tp->t_lflag = TTYDEF_LFLAG;
- tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
-
- s = spltty();
-
- (void) dcmparam(tp, &tp->t_termios);
- ttsetwater(tp);
- } else if (tp->t_state & TS_XCLUDE && suser(p, 0) != 0)
- return (EBUSY);
- else
- s = spltty();
-
- /* Set modem control state. */
- mbits = MO_ON;
- if (sc->sc_flags & DCM_STDDCE)
- mbits |= MO_SR; /* pin 23, could be used as RTS */
-
- (void) dcmmctl(dev, mbits, DMSET); /* enable port */
-
- /* Set soft-carrier if so configured. */
- if ((sc->sc_softCAR & (1 << port)) || DCMCUA(dev) ||
- (dcmmctl(dev, MO_OFF, DMGET) & MI_CD))
- tp->t_state |= TS_CARR_ON;
-
- if (DCMCUA(dev)) {
- if (tp->t_state & TS_ISOPEN) {
- /* Ah, but someone already is dialed in... */
- splx(s);
- return (EBUSY);
- }
- sc->sc_cua = 1; /* We go into CUA mode */
- }
-
-#ifdef DEBUG
- if (dcmdebug & DDB_MODEM)
- printf("%s: dcmopen port %d softcarr %c\n",
- sc->sc_dev.dv_xname, port,
- (tp->t_state & TS_CARR_ON) ? '1' : '0');
-#endif
-
- /* Wait for carrier if necessary. */
- if (flag & O_NONBLOCK) {
- if (!DCMCUA(dev) && sc->sc_cua) {
- /* Opening TTY non-blocking... but the CUA is busy */
- splx(s);
- return (EBUSY);
- }
- } else {
- while (sc->sc_cua ||
- ((tp->t_cflag & CLOCAL) == 0 &&
- (tp->t_state & TS_CARR_ON) == 0)) {
- tp->t_state |= TS_WOPEN;
- error = ttysleep(tp, (caddr_t)&tp->t_rawq,
- TTIPRI | PCATCH, ttopen, 0);
- if (!DCMCUA(dev) && sc->sc_cua && error == EINTR)
- continue;
- if (error) {
- if (DCMCUA(dev))
- sc->sc_cua = 0;
- splx(s);
- return (error);
- }
- if (!DCMCUA(dev) && sc->sc_cua)
- continue;
- }
- }
- splx(s);
-
-#ifdef DEBUG
- if (dcmdebug & DDB_OPENCLOSE)
- printf("%s port %d: dcmopen: st %x fl %x\n",
- sc->sc_dev.dv_xname, port, tp->t_state, tp->t_flags);
-#endif
- if (error == 0)
- error = (*linesw[tp->t_line].l_open)(dev, tp, p);
-
- return (error);
-}
-
-/*ARGSUSED*/
-int
-dcmclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- int s, unit, board, port;
- struct dcm_softc *sc;
- struct tty *tp;
-
- unit = DCMUNIT(dev);
- board = DCMBOARD(unit);
- port = DCMPORT(unit);
-
- sc = dcm_cd.cd_devs[board];
- tp = sc->sc_tty[port];
-
- (*linesw[tp->t_line].l_close)(tp, flag, p);
-
- s = spltty();
-
- if (tp->t_cflag & HUPCL || tp->t_state & TS_WOPEN ||
- (tp->t_state & TS_ISOPEN) == 0)
- (void) dcmmctl(dev, MO_OFF, DMSET);
-#ifdef DEBUG
- if (dcmdebug & DDB_OPENCLOSE)
- printf("%s port %d: dcmclose: st %x fl %x\n",
- sc->sc_dev.dv_xname, port, tp->t_state, tp->t_flags);
-#endif
- sc->sc_cua = 0;
- splx(s);
- ttyclose(tp);
-#if 0
- ttyfree(tp);
- sc->sc_tty[port] == NULL;
-#endif
- return (0);
-}
-
-int
-dcmread(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- int unit, board, port;
- struct dcm_softc *sc;
- struct tty *tp;
-
- unit = DCMUNIT(dev);
- board = DCMBOARD(unit);
- port = DCMPORT(unit);
-
- sc = dcm_cd.cd_devs[board];
- tp = sc->sc_tty[port];
-
- return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
-}
-
-int
-dcmwrite(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- int unit, board, port;
- struct dcm_softc *sc;
- struct tty *tp;
-
- unit = DCMUNIT(dev);
- board = DCMBOARD(unit);
- port = DCMPORT(unit);
-
- sc = dcm_cd.cd_devs[board];
- tp = sc->sc_tty[port];
-
- return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
-}
-
-struct tty *
-dcmtty(dev)
- dev_t dev;
-{
- int unit, board, port;
- struct dcm_softc *sc;
-
- unit = DCMUNIT(dev);
- board = DCMBOARD(unit);
- port = DCMPORT(unit);
-
- sc = dcm_cd.cd_devs[board];
-
- return (sc->sc_tty[port]);
-}
-
-int
-dcmintr(arg)
- void *arg;
-{
- struct dcm_softc *sc = arg;
- struct dcmdevice *dcm = sc->sc_dcm;
- struct dcmischeme *dis = &sc->sc_scheme;
- int brd = sc->sc_dev.dv_unit;
- int code, i;
- int pcnd[4], mcode, mcnd[4];
-
- /*
- * Do all guarded accesses right off to minimize
- * block out of hardware.
- */
- SEM_LOCK(dcm);
- if ((dcm->dcm_ic & IC_IR) == 0) {
- SEM_UNLOCK(dcm);
- return (0);
- }
-
- for (i = 0; i < 4; i++) {
- pcnd[i] = dcm->dcm_icrtab[i].dcm_data;
- dcm->dcm_icrtab[i].dcm_data = 0;
- code = sc->sc_modem[i]->mdmin;
- if (sc->sc_flags & DCM_STDDCE)
- code = hp2dce_in(code);
- mcnd[i] = code;
- }
- code = dcm->dcm_iir & IIR_MASK;
- dcm->dcm_iir = 0; /* XXX doc claims read clears interrupt?! */
- mcode = dcm->dcm_modemintr;
- dcm->dcm_modemintr = 0;
- SEM_UNLOCK(dcm);
-
-#ifdef DEBUG
- if (dcmdebug & DDB_INTR) {
- printf("%s: dcmintr: iir %x pc %x/%x/%x/%x ",
- sc->sc_dev.dv_xname, code, pcnd[0], pcnd[1],
- pcnd[2], pcnd[3]);
- printf("miir %x mc %x/%x/%x/%x\n",
- mcode, mcnd[0], mcnd[1], mcnd[2], mcnd[3]);
- }
-#endif
- if (code & IIR_TIMEO)
- dcmrint(sc);
- if (code & IIR_PORT0)
- dcmpint(sc, 0, pcnd[0]);
- if (code & IIR_PORT1)
- dcmpint(sc, 1, pcnd[1]);
- if (code & IIR_PORT2)
- dcmpint(sc, 2, pcnd[2]);
- if (code & IIR_PORT3)
- dcmpint(sc, 3, pcnd[3]);
- if (code & IIR_MODM) {
- if (mcode == 0 || mcode & 0x1) /* mcode==0 -> 98642 board */
- dcmmint(sc, 0, mcnd[0]);
- if (mcode & 0x2)
- dcmmint(sc, 1, mcnd[1]);
- if (mcode & 0x4)
- dcmmint(sc, 2, mcnd[2]);
- if (mcode & 0x8)
- dcmmint(sc, 3, mcnd[3]);
- }
-
- /*
- * Chalk up a receiver interrupt if the timer running or one of
- * the ports reports a special character interrupt.
- */
- if ((code & IIR_TIMEO) ||
- ((pcnd[0]|pcnd[1]|pcnd[2]|pcnd[3]) & IT_SPEC))
- dis->dis_intr++;
- /*
- * See if it is time to check/change the interrupt rate.
- */
- if (dcmistype < 0 &&
- (i = time_second - dis->dis_time) >= dcminterval) {
- /*
- * If currently per-character and averaged over 70 interrupts
- * per-second (66 is threshold of 600 baud) in last interval,
- * switch to timer mode.
- *
- * XXX decay counts ala load average to avoid spikes?
- */
- if (dis->dis_perchar && dis->dis_intr > 70 * i)
- dcmsetischeme(brd, DIS_TIMER);
- /*
- * If currently using timer and had more interrupts than
- * received characters in the last interval, switch back
- * to per-character. Note that after changing to per-char
- * we must process any characters already in the queue
- * since they may have arrived before the bitmap was setup.
- *
- * XXX decay counts?
- */
- else if (!dis->dis_perchar && dis->dis_intr > dis->dis_char) {
- dcmsetischeme(brd, DIS_PERCHAR);
- dcmrint(sc);
- }
- dis->dis_intr = dis->dis_char = 0;
- dis->dis_time = time_second;
- }
- return (1);
-}
-
-/*
- * Port interrupt. Can be two things:
- * First, it might be a special character (exception interrupt);
- * Second, it may be a buffer empty (transmit interrupt);
- */
-void
-dcmpint(sc, port, code)
- struct dcm_softc *sc;
- int port, code;
-{
-
- if (code & IT_SPEC)
- dcmreadbuf(sc, port);
- if (code & IT_TX)
- dcmxint(sc, port);
-}
-
-void
-dcmrint(sc)
- struct dcm_softc *sc;
-{
- int port;
-
- for (port = 0; port < NDCMPORT; port++)
- dcmreadbuf(sc, port);
-}
-
-void
-dcmreadbuf(sc, port)
- struct dcm_softc *sc;
- int port;
-{
- struct dcmdevice *dcm = sc->sc_dcm;
- struct dcmpreg *pp = dcm_preg(dcm, port);
- struct dcmrfifo *fifo;
- struct tty *tp;
- int c, stat;
- u_int head;
- int nch = 0;
-#ifdef DCMSTATS
- struct dcmstats *dsp = &sc->sc_stats;
-
- dsp->rints++;
-#endif
- tp = sc->sc_tty[port];
- if (tp == NULL)
- return;
-
- if ((tp->t_state & TS_ISOPEN) == 0) {
-#ifdef KGDB
- if ((makedev(dcmmajor, minor(tp->t_dev)) == kgdb_dev) &&
- (head = pp->r_head & RX_MASK) != (pp->r_tail & RX_MASK) &&
- dcm->dcm_rfifos[3-port][head>>1].data_char == FRAME_START) {
- pp->r_head = (head + 2) & RX_MASK;
- kgdb_connect(0); /* trap into kgdb */
- return;
- }
-#endif /* KGDB */
- pp->r_head = pp->r_tail & RX_MASK;
- return;
- }
-
- head = pp->r_head & RX_MASK;
- fifo = &dcm->dcm_rfifos[3-port][head>>1];
- /*
- * XXX upper bound on how many chars we will take in one swallow?
- */
- while (head != (pp->r_tail & RX_MASK)) {
- /*
- * Get character/status and update head pointer as fast
- * as possible to make room for more characters.
- */
- c = fifo->data_char;
- stat = fifo->data_stat;
- head = (head + 2) & RX_MASK;
- pp->r_head = head;
- fifo = head ? fifo+1 : &dcm->dcm_rfifos[3-port][0];
- nch++;
-
-#ifdef DEBUG
- if (dcmdebug & DDB_INPUT)
- printf("%s port %d: dcmreadbuf: c%x('%c') s%x f%x h%x t%x\n",
- sc->sc_dev.dv_xname, port,
- c&0xFF, c, stat&0xFF,
- tp->t_flags, head, pp->r_tail);
-#endif
- /*
- * Check for and handle errors
- */
- if (stat & RD_MASK) {
-#ifdef DEBUG
- if (dcmdebug & (DDB_INPUT|DDB_SIOERR))
- printf("%s port %d: dcmreadbuf: err: c%x('%c') s%x\n",
- sc->sc_dev.dv_xname, port,
- stat, c&0xFF, c);
-#endif
- if (stat & (RD_BD | RD_FE))
- c |= TTY_FE;
- else if (stat & RD_PE)
- c |= TTY_PE;
- else if (stat & RD_OVF)
- log(LOG_WARNING,
- "%s port %d: silo overflow\n",
- sc->sc_dev.dv_xname, port);
- else if (stat & RD_OE)
- log(LOG_WARNING,
- "%s port %d: uart overflow\n",
- sc->sc_dev.dv_xname, port);
- }
- (*linesw[tp->t_line].l_rint)(c, tp);
- }
- sc->sc_scheme.dis_char += nch;
-
-#ifdef DCMSTATS
- dsp->rchars += nch;
- if (nch <= DCMRBSIZE)
- dsp->rsilo[nch]++;
- else
- dsp->rsilo[DCMRBSIZE+1]++;
-#endif
-}
-
-void
-dcmxint(sc, port)
- struct dcm_softc *sc;
- int port;
-{
- struct tty *tp;
-
- tp = sc->sc_tty[port];
- if (tp == NULL || (tp->t_state & TS_ISOPEN) == 0)
- return;
-
- tp->t_state &= ~TS_BUSY;
- if (tp->t_state & TS_FLUSH)
- tp->t_state &= ~TS_FLUSH;
- (*linesw[tp->t_line].l_start)(tp);
-}
-
-void
-dcmmint(sc, port, mcnd)
- struct dcm_softc *sc;
- int port, mcnd;
-{
- int delta;
- struct tty *tp;
- struct dcmdevice *dcm = sc->sc_dcm;
-
- tp = sc->sc_tty[port];
- if (tp == NULL || (tp->t_state & TS_ISOPEN) == 0)
- return;
-
-#ifdef DEBUG
- if (dcmdebug & DDB_MODEM)
- printf("%s port %d: dcmmint: mcnd %x mcndlast %x\n",
- sc->sc_dev.dv_xname, port, mcnd, sc->sc_mcndlast[port]);
-#endif
- delta = mcnd ^ sc->sc_mcndlast[port];
- sc->sc_mcndlast[port] = mcnd;
- if ((delta & MI_CTS) && (tp->t_state & TS_ISOPEN) &&
- (tp->t_flags & CCTS_OFLOW)) {
- if (mcnd & MI_CTS) {
- tp->t_state &= ~TS_TTSTOP;
- ttstart(tp);
- } else
- tp->t_state |= TS_TTSTOP; /* inline dcmstop */
- }
- if (delta & MI_CD) {
- if (mcnd & MI_CD)
- (void)(*linesw[tp->t_line].l_modem)(tp, 1);
- else if ((sc->sc_softCAR & (1 << port)) == 0 &&
- (*linesw[tp->t_line].l_modem)(tp, 0) == 0) {
- sc->sc_modem[port]->mdmout = MO_OFF;
- SEM_LOCK(dcm);
- dcm->dcm_modemchng |= (1 << port);
- dcm->dcm_cr |= CR_MODM;
- SEM_UNLOCK(dcm);
- DELAY(10); /* time to change lines */
- }
- }
-}
-
-int
-dcmioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- struct dcm_softc *sc;
- struct tty *tp;
- struct dcmdevice *dcm;
- int board, port, unit = DCMUNIT(dev);
- int error, s;
-
- port = DCMPORT(unit);
- board = DCMBOARD(unit);
-
- sc = dcm_cd.cd_devs[board];
- dcm = sc->sc_dcm;
- tp = sc->sc_tty[port];
-
-#ifdef DEBUG
- if (dcmdebug & DDB_IOCTL)
- printf("%s port %d: dcmioctl: cmd %lx data %x flag %x\n",
- sc->sc_dev.dv_xname, port, cmd, *data, flag);
-#endif
- error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
- if (error >= 0)
- return (error);
- error = ttioctl(tp, cmd, data, flag, p);
- if (error >= 0)
- return (error);
-
- switch (cmd) {
- case TIOCSBRK:
- /*
- * Wait for transmitter buffer to empty
- */
- s = spltty();
- while (dcm->dcm_thead[port].ptr != dcm->dcm_ttail[port].ptr)
- DELAY(DCM_USPERCH(tp->t_ospeed));
- SEM_LOCK(dcm);
- dcm->dcm_cmdtab[port].dcm_data |= CT_BRK;
- dcm->dcm_cr |= (1 << port); /* start break */
- SEM_UNLOCK(dcm);
- splx(s);
- break;
-
- case TIOCCBRK:
- SEM_LOCK(dcm);
- dcm->dcm_cmdtab[port].dcm_data |= CT_BRK;
- dcm->dcm_cr |= (1 << port); /* end break */
- SEM_UNLOCK(dcm);
- break;
-
- case TIOCSDTR:
- (void) dcmmctl(dev, MO_ON, DMBIS);
- break;
-
- case TIOCCDTR:
- (void) dcmmctl(dev, MO_ON, DMBIC);
- break;
-
- case TIOCMSET:
- (void) dcmmctl(dev, *(int *)data, DMSET);
- break;
-
- case TIOCMBIS:
- (void) dcmmctl(dev, *(int *)data, DMBIS);
- break;
-
- case TIOCMBIC:
- (void) dcmmctl(dev, *(int *)data, DMBIC);
- break;
-
- case TIOCMGET:
- *(int *)data = dcmmctl(dev, 0, DMGET);
- break;
-
- case TIOCGFLAGS: {
- int bits = 0;
-
- if ((sc->sc_softCAR & (1 << port)))
- bits |= TIOCFLAG_SOFTCAR;
-
- if (tp->t_cflag & CLOCAL)
- bits |= TIOCFLAG_CLOCAL;
-
- *(int *)data = bits;
- break;
- }
-
- case TIOCSFLAGS: {
- int userbits;
-
- error = suser(p, 0);
- if (error)
- return (EPERM);
-
- userbits = *(int *)data;
-
- if ((userbits & TIOCFLAG_SOFTCAR) ||
- ((sc->sc_flags & DCM_ISCONSOLE) &&
- (port == DCMCONSPORT)))
- sc->sc_softCAR |= (1 << port);
-
- if (userbits & TIOCFLAG_CLOCAL)
- tp->t_cflag |= CLOCAL;
-
- break;
- }
-
- default:
- return (ENOTTY);
- }
- return (0);
-}
-
-int
-dcmparam(tp, t)
- struct tty *tp;
- struct termios *t;
-{
- struct dcm_softc *sc;
- struct dcmdevice *dcm;
- int unit, board, port, mode, cflag = t->c_cflag;
- int ospeed = ttspeedtab(t->c_ospeed, dcmspeedtab);
-
- unit = DCMUNIT(tp->t_dev);
- board = DCMBOARD(unit);
- port = DCMPORT(unit);
-
- sc = dcm_cd.cd_devs[board];
- dcm = sc->sc_dcm;
-
- /* check requested parameters */
- if (ospeed < 0 || (t->c_ispeed && t->c_ispeed != t->c_ospeed))
- return (EINVAL);
- /* and copy to tty */
- tp->t_ispeed = t->c_ispeed;
- tp->t_ospeed = t->c_ospeed;
- tp->t_cflag = cflag;
- if (ospeed == 0) {
- (void) dcmmctl(DCMUNIT(tp->t_dev), MO_OFF, DMSET);
- return (0);
- }
-
- mode = 0;
- switch (cflag&CSIZE) {
- case CS5:
- mode = LC_5BITS; break;
- case CS6:
- mode = LC_6BITS; break;
- case CS7:
- mode = LC_7BITS; break;
- case CS8:
- mode = LC_8BITS; break;
- }
- if (cflag&PARENB) {
- if (cflag&PARODD)
- mode |= LC_PODD;
- else
- mode |= LC_PEVEN;
- }
- if (cflag&CSTOPB)
- mode |= LC_2STOP;
- else
- mode |= LC_1STOP;
-#ifdef DEBUG
- if (dcmdebug & DDB_PARAM)
- printf("%s port %d: dcmparam: cflag %x mode %x speed %d uperch %d\n",
- sc->sc_dev.dv_xname, port, cflag, mode, tp->t_ospeed,
- DCM_USPERCH(tp->t_ospeed));
-#endif
-
- /*
- * Wait for transmitter buffer to empty.
- */
- while (dcm->dcm_thead[port].ptr != dcm->dcm_ttail[port].ptr)
- DELAY(DCM_USPERCH(tp->t_ospeed));
- /*
- * Make changes known to hardware.
- */
- dcm->dcm_data[port].dcm_baud = ospeed;
- dcm->dcm_data[port].dcm_conf = mode;
- SEM_LOCK(dcm);
- dcm->dcm_cmdtab[port].dcm_data |= CT_CON;
- dcm->dcm_cr |= (1 << port);
- SEM_UNLOCK(dcm);
- /*
- * Delay for config change to take place. Weighted by baud.
- * XXX why do we do this?
- */
- DELAY(16 * DCM_USPERCH(tp->t_ospeed));
- return (0);
-}
-
-void
-dcmstart(tp)
- struct tty *tp;
-{
- struct dcm_softc *sc;
- struct dcmdevice *dcm;
- struct dcmpreg *pp;
- struct dcmtfifo *fifo;
- char *bp;
- u_int head, tail, next;
- int unit, board, port, nch;
- char buf[16];
- int s;
-#ifdef DCMSTATS
- struct dcmstats *dsp = &sc->sc_stats;
- int tch = 0;
-#endif
-
- unit = DCMUNIT(tp->t_dev);
- board = DCMBOARD(unit);
- port = DCMPORT(unit);
-
- sc = dcm_cd.cd_devs[board];
- dcm = sc->sc_dcm;
-
- s = spltty();
-#ifdef DCMSTATS
- dsp->xints++;
-#endif
-#ifdef DEBUG
- if (dcmdebug & DDB_OUTPUT)
- printf("%s port %d: dcmstart: state %x flags %x outcc %d\n",
- sc->sc_dev.dv_xname, port, tp->t_state, tp->t_flags,
- tp->t_outq.c_cc);
-#endif
- if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP))
- goto out;
- ttwakeupwr(tp);
- if (tp->t_outq.c_cc == 0) {
-#ifdef DCMSTATS
- dsp->xempty++;
-#endif
- goto out;
- }
-
- pp = dcm_preg(dcm, port);
- tail = pp->t_tail & TX_MASK;
- next = (tail + 1) & TX_MASK;
- head = pp->t_head & TX_MASK;
- if (head == next)
- goto out;
- fifo = &dcm->dcm_tfifos[3-port][tail];
-again:
- nch = q_to_b(&tp->t_outq, buf, (head - next) & TX_MASK);
-#ifdef DCMSTATS
- tch += nch;
-#endif
-#ifdef DEBUG
- if (dcmdebug & DDB_OUTPUT)
- printf("\thead %x tail %x nch %d\n", head, tail, nch);
-#endif
- /*
- * Loop transmitting all the characters we can.
- */
- for (bp = buf; --nch >= 0; bp++) {
- fifo->data_char = *bp;
- pp->t_tail = next;
- /*
- * If this is the first character,
- * get the hardware moving right now.
- */
- if (bp == buf) {
- tp->t_state |= TS_BUSY;
- SEM_LOCK(dcm);
- dcm->dcm_cmdtab[port].dcm_data |= CT_TX;
- dcm->dcm_cr |= (1 << port);
- SEM_UNLOCK(dcm);
- }
- tail = next;
- fifo = tail ? fifo+1 : &dcm->dcm_tfifos[3-port][0];
- next = (next + 1) & TX_MASK;
- }
- /*
- * Head changed while we were loading the buffer,
- * go back and load some more if we can.
- */
- if (tp->t_outq.c_cc && head != (pp->t_head & TX_MASK)) {
-#ifdef DCMSTATS
- dsp->xrestarts++;
-#endif
- head = pp->t_head & TX_MASK;
- goto again;
- }
-
- /*
- * Kick it one last time in case it finished while we were
- * loading the last bunch.
- */
- if (bp > &buf[1]) {
- tp->t_state |= TS_BUSY;
- SEM_LOCK(dcm);
- dcm->dcm_cmdtab[port].dcm_data |= CT_TX;
- dcm->dcm_cr |= (1 << port);
- SEM_UNLOCK(dcm);
- }
-#ifdef DEBUG
- if (dcmdebug & DDB_INTR)
- printf("%s port %d: dcmstart: head %x tail %x outqcc %d\n",
- sc->sc_dev.dv_xname, port, head, tail, tp->t_outq.c_cc);
-#endif
-out:
-#ifdef DCMSTATS
- dsp->xchars += tch;
- if (tch <= DCMXBSIZE)
- dsp->xsilo[tch]++;
- else
- dsp->xsilo[DCMXBSIZE+1]++;
-#endif
- splx(s);
-}
-
-/*
- * Stop output on a line.
- */
-int
-dcmstop(tp, flag)
- struct tty *tp;
- int flag;
-{
- int s;
-
- s = spltty();
- if (tp->t_state & TS_BUSY) {
- /* XXX is there some way to safely stop transmission? */
- if ((tp->t_state&TS_TTSTOP) == 0)
- tp->t_state |= TS_FLUSH;
- }
- splx(s);
- return (0);
-}
-
-/*
- * Modem control
- */
-int
-dcmmctl(dev, bits, how)
- dev_t dev;
- int bits, how;
-{
- struct dcm_softc *sc;
- struct dcmdevice *dcm;
- int s, unit, brd, port, hit = 0;
-
- unit = DCMUNIT(dev);
- brd = DCMBOARD(unit);
- port = DCMPORT(unit);
-
- sc = dcm_cd.cd_devs[brd];
- dcm = sc->sc_dcm;
-
-#ifdef DEBUG
- if (dcmdebug & DDB_MODEM)
- printf("%s port %d: dcmmctl: bits 0x%x how %x\n",
- sc->sc_dev.dv_xname, port, bits, how);
-#endif
-
- s = spltty();
-
- switch (how) {
- case DMSET:
- sc->sc_modem[port]->mdmout = bits;
- hit++;
- break;
-
- case DMBIS:
- sc->sc_modem[port]->mdmout |= bits;
- hit++;
- break;
-
- case DMBIC:
- sc->sc_modem[port]->mdmout &= ~bits;
- hit++;
- break;
-
- case DMGET:
- bits = sc->sc_modem[port]->mdmin;
- if (sc->sc_flags & DCM_STDDCE)
- bits = hp2dce_in(bits);
- break;
- }
- if (hit) {
- SEM_LOCK(dcm);
- dcm->dcm_modemchng |= 1<<(unit & 3);
- dcm->dcm_cr |= CR_MODM;
- SEM_UNLOCK(dcm);
- DELAY(10); /* delay until done */
- splx(s);
- }
- return (bits);
-}
-
-/*
- * Set board to either interrupt per-character or at a fixed interval.
- */
-void
-dcmsetischeme(brd, flags)
- int brd, flags;
-{
- struct dcm_softc *sc = dcm_cd.cd_devs[brd];
- struct dcmdevice *dcm = sc->sc_dcm;
- struct dcmischeme *dis = &sc->sc_scheme;
- int i;
- u_char mask;
- int perchar = flags & DIS_PERCHAR;
-
-#ifdef DEBUG
- if (dcmdebug & DDB_INTSCHM)
- printf("%s: dcmsetischeme(%d): cur %d, ints %d, chars %d\n",
- sc->sc_dev.dv_xname, perchar, dis->dis_perchar,
- dis->dis_intr, dis->dis_char);
- if ((flags & DIS_RESET) == 0 && perchar == dis->dis_perchar) {
- printf("%s: dcmsetischeme: redundant request %d\n",
- sc->sc_dev.dv_xname, perchar);
- return;
- }
-#endif
- /*
- * If perchar is non-zero, we enable interrupts on all characters
- * otherwise we disable perchar interrupts and use periodic
- * polling interrupts.
- */
- dis->dis_perchar = perchar;
- mask = perchar ? 0xf : 0x0;
- for (i = 0; i < 256; i++)
- dcm->dcm_bmap[i].data_data = mask;
- /*
- * Don't slow down tandem mode, interrupt on flow control
- * chars for any port on the board.
- */
- if (!perchar) {
- struct tty *tp;
- int c;
-
- for (i = 0; i < NDCMPORT; i++) {
- tp = sc->sc_tty[i];
-
- if ((c = tp->t_cc[VSTART]) != _POSIX_VDISABLE)
- dcm->dcm_bmap[c].data_data |= (1 << i);
- if ((c = tp->t_cc[VSTOP]) != _POSIX_VDISABLE)
- dcm->dcm_bmap[c].data_data |= (1 << i);
- }
- }
- /*
- * Board starts with timer disabled so if first call is to
- * set perchar mode then we don't want to toggle the timer.
- */
- if (flags == (DIS_RESET|DIS_PERCHAR))
- return;
- /*
- * Toggle card 16.7ms interrupts (we first make sure that card
- * has cleared the bit so it will see the toggle).
- */
- while (dcm->dcm_cr & CR_TIMER)
- ;
- SEM_LOCK(dcm);
- dcm->dcm_cr |= CR_TIMER;
- SEM_UNLOCK(dcm);
-}
-
-void
-dcminit(dcm, port, rate)
- struct dcmdevice *dcm;
- int port, rate;
-{
- int s, mode;
-
- mode = LC_8BITS | LC_1STOP;
-
- s = splhigh();
-
- /*
- * Wait for transmitter buffer to empty.
- */
- while (dcm->dcm_thead[port].ptr != dcm->dcm_ttail[port].ptr)
- DELAY(DCM_USPERCH(rate));
-
- /*
- * Make changes known to hardware.
- */
- dcm->dcm_data[port].dcm_baud = ttspeedtab(rate, dcmspeedtab);
- dcm->dcm_data[port].dcm_conf = mode;
- SEM_LOCK(dcm);
- dcm->dcm_cmdtab[port].dcm_data |= CT_CON;
- dcm->dcm_cr |= (1 << port);
- SEM_UNLOCK(dcm);
-
- /*
- * Delay for config change to take place. Weighted by baud.
- * XXX why do we do this?
- */
- DELAY(16 * DCM_USPERCH(rate));
- splx(s);
-}
-
-/*
- * Empirically derived self-test magic
- */
-int
-dcmselftest(sc)
- struct dcm_softc *sc;
-{
- struct dcmdevice *dcm = sc->sc_dcm;
- int timo = 0;
- int s, rv;
-
- rv = 1;
-
- s = splhigh();
- dcm->dcm_rsid = DCMRS;
- DELAY(50000); /* 5000 is not long enough */
- dcm->dcm_rsid = 0;
- dcm->dcm_ic = IC_IE;
- dcm->dcm_cr = CR_SELFT;
- while ((dcm->dcm_ic & IC_IR) == 0) {
- if (++timo == 20000)
- goto out;
- DELAY(1);
- }
- DELAY(50000); /* XXX why is this needed ???? */
- while ((dcm->dcm_iir & IIR_SELFT) == 0) {
- if (++timo == 400000)
- goto out;
- DELAY(1);
- }
- DELAY(50000); /* XXX why is this needed ???? */
- if (dcm->dcm_stcon != ST_OK) {
-#if 0
- if (hd->hp_args->hw_sc != conscode)
- printf("dcm%d: self test failed: %x\n",
- brd, dcm->dcm_stcon);
-#endif
- goto out;
- }
- dcm->dcm_ic = IC_ID;
- rv = 0;
-
- out:
- splx(s);
- return (rv);
-}
-
-/*
- * Following are all routines needed for DCM to act as console
- */
-
-int
-dcm_console_scan(scode, va, arg)
- int scode;
- caddr_t va;
- void *arg;
-{
- struct dcmdevice *dcm = (struct dcmdevice *)va;
- struct consdev *cp = arg;
- u_int pri;
-
- switch (dcm->dcm_rsid) {
- case DCMID:
- pri = CN_LOWPRI;
- break;
-
- case DCMID|DCMCON:
- pri = CN_HIGHPRI;
- break;
-
- default:
- return (0);
- }
-
-#ifdef CONSCODE
- /*
- * Raise our priority, if appropriate.
- */
- if (scode == CONSCODE)
- pri = CN_FORCED;
-#endif
-
- /* Only raise priority. */
- if (pri > cp->cn_pri)
- cp->cn_pri = pri;
-
- /*
- * If our priority is higher than the currently-remembered
- * console, stash our priority, for the benefit of dcmcninit().
- */
- if (cn_tab == NULL || cp->cn_pri > cn_tab->cn_pri) {
- cn_tab = cp;
- conscode = scode;
- return (DIO_SIZE(scode, va));
- }
- return (0);
-}
-
-void
-dcmcnprobe(cp)
- struct consdev *cp;
-{
-
- /* locate the major number */
- for (dcmmajor = 0; dcmmajor < nchrdev; dcmmajor++)
- if (cdevsw[dcmmajor].d_open == dcmopen)
- break;
-
- /* initialize required fields */
- cp->cn_dev = makedev(dcmmajor, 0); /* XXX */
-
- console_scan(dcm_console_scan, cp);
-
-#ifdef KGDB_CHEAT
- /* XXX this needs to be fixed. */
- /*
- * This doesn't currently work, at least not with ite consoles;
- * the console hasn't been initialized yet.
- */
- if (major(kgdb_dev) == dcmmajor &&
- DCMBOARD(DCMUNIT(kgdb_dev)) == DCMBOARD(unit)) {
- dcminit(dcm_cn, DCMPORT(DCMUNIT(kgdb_dev)), kgdb_rate);
- if (kgdb_debug_init) {
- /*
- * We assume that console is ready for us...
- * this assumes that a dca or ite console
- * has been selected already and will init
- * on the first putc.
- */
- printf("dcm%d: ", DCMUNIT(kgdb_dev));
- kgdb_connect(1);
- }
- }
-#endif
-}
-
-/* ARGSUSED */
-void
-dcmcninit(cp)
- struct consdev *cp;
-{
-
- /*
- * We are not interested by the second console pass.
- */
- if (consolepass != 0)
- return;
-
- dcm_cn = (struct dcmdevice *)conaddr;
- dcminit(dcm_cn, DCMCONSPORT, dcmdefaultrate);
- dcmconsinit = 1;
-}
-
-/* ARGSUSED */
-int
-dcmcngetc(dev)
- dev_t dev;
-{
- struct dcmrfifo *fifo;
- struct dcmpreg *pp;
- u_int head;
- int s, c, stat;
-
- pp = dcm_preg(dcm_cn, DCMCONSPORT);
-
- s = splhigh();
- head = pp->r_head & RX_MASK;
- fifo = &dcm_cn->dcm_rfifos[3-DCMCONSPORT][head>>1];
- while (head == (pp->r_tail & RX_MASK))
- ;
- /*
- * If board interrupts are enabled, just let our received char
- * interrupt through in case some other port on the board was
- * busy. Otherwise we must clear the interrupt.
- */
- SEM_LOCK(dcm_cn);
- if ((dcm_cn->dcm_ic & IC_IE) == 0)
- stat = dcm_cn->dcm_iir;
- SEM_UNLOCK(dcm_cn);
- c = fifo->data_char;
- stat = fifo->data_stat;
- pp->r_head = (head + 2) & RX_MASK;
- splx(s);
- return (c);
-}
-
-/*
- * Console kernel output character routine.
- */
-/* ARGSUSED */
-void
-dcmcnputc(dev, c)
- dev_t dev;
- int c;
-{
- struct dcmpreg *pp;
- unsigned tail;
- int s, stat;
-
- pp = dcm_preg(dcm_cn, DCMCONSPORT);
-
- s = splhigh();
-#ifdef KGDB
- if (dev != kgdb_dev)
-#endif
- if (dcmconsinit == 0) {
- dcminit(dcm_cn, DCMCONSPORT, dcmdefaultrate);
- dcmconsinit = 1;
- }
- tail = pp->t_tail & TX_MASK;
- while (tail != (pp->t_head & TX_MASK))
- ;
- dcm_cn->dcm_tfifos[3-DCMCONSPORT][tail].data_char = c;
- pp->t_tail = tail = (tail + 1) & TX_MASK;
- SEM_LOCK(dcm_cn);
- dcm_cn->dcm_cmdtab[DCMCONSPORT].dcm_data |= CT_TX;
- dcm_cn->dcm_cr |= (1 << DCMCONSPORT);
- SEM_UNLOCK(dcm_cn);
- while (tail != (pp->t_head & TX_MASK))
- ;
- /*
- * If board interrupts are enabled, just let our completion
- * interrupt through in case some other port on the board
- * was busy. Otherwise we must clear the interrupt.
- */
- if ((dcm_cn->dcm_ic & IC_IE) == 0) {
- SEM_LOCK(dcm_cn);
- stat = dcm_cn->dcm_iir;
- SEM_UNLOCK(dcm_cn);
- }
- splx(s);
-}
diff --git a/sys/arch/hp300/dev/dcmreg.h b/sys/arch/hp300/dev/dcmreg.h
deleted file mode 100644
index 2b7e49deba1..00000000000
--- a/sys/arch/hp300/dev/dcmreg.h
+++ /dev/null
@@ -1,253 +0,0 @@
-/* $OpenBSD: dcmreg.h,v 1.5 2007/05/25 21:27:15 krw Exp $ */
-/* $NetBSD: dcmreg.h,v 1.5 1996/02/24 00:55:05 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: dcmreg.h 1.7 92/01/21$
- *
- * @(#)dcmreg.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <hp300/dev/iotypes.h> /* XXX */
-
-struct dcmdevice { /* host address, only odd bytes addressed */
- u_char dcm_pad0;
- vu_char dcm_rsid; /* Reset / ID 0001 */
- u_char dcm_pad1;
- vu_char dcm_ic; /* Interrupt control register 0003 */
- u_char dcm_pad2;
- vu_char dcm_sem; /* Semaphore register 0005 */
- u_char dcm_pad3[0x7ffa]; /* Unaddressable 0006-7fff */
- u_char dcm_pad4;
- vu_char dcm_iir; /* Interrupt ident register 8001 */
- u_char dcm_pad5;
- vu_char dcm_cr; /* Command register 8003 */
- u_char dcm_pad6[0x3fc]; /* Card scratch 8004-83ff */
- struct dcmrfifo {
- u_char ptr_pad1;
- vu_char data_char;
- u_char ptr_pad2;
- vu_char data_stat;
- } dcm_rfifos[4][0x80]; /* Receive queues 8400 */
- struct {
- u_char ptr_pad1;
- vu_char data_data;
- } dcm_bmap[0x100]; /* Bitmap table 8c00 */
- struct {
- u_char ptr_pad;
- vu_char ptr;
- } dcm_rhead[4]; /* Fifo head - receive 8e00 */
- struct {
- u_char ptr_pad;
- vu_char ptr;
- } dcm_rtail[4]; /* Fifo tail - receive 8e08 */
- struct {
- u_char ptr_pad;
- vu_char ptr;
- } dcm_thead[4]; /* Fifo head - transmit 8e10 */
- struct {
- u_char ptr_pad;
- vu_char ptr;
- } dcm_ttail[4]; /* Fifo tail - transmit 8e18 */
- struct {
- u_char pad1;
- vu_char dcm_conf;
- u_char pad2;
- vu_char dcm_baud;
- } dcm_data[4]; /* Configuration registers 8e20 */
- struct modemreg {
- u_char pad0;
- vu_char mdmin; /* Modem in 8e31 */
- u_char pad1;
- vu_char mdmout; /* Modem out 8e33 */
- u_char pad2;
- vu_char mdmmsk; /* Modem mask 8e35 */
- } dcm_modem0;
- struct {
- u_char pad1;
- vu_char dcm_data;
- } dcm_cmdtab[4]; /* Command tables 8e36 */
- struct {
- u_char pad1;
- vu_char dcm_data;
- } dcm_icrtab[4]; /* Interrupt data 8e3e */
- u_char dcm_pad10;
- vu_char dcm_stcon; /* Self test condition 8e47 */
- struct modemreg dcm_modem1; /* 638 Modem port1 8e48 */
- struct modemreg dcm_modem2; /* 638 Modem port2 8e4e */
- struct modemreg dcm_modem3; /* 638 Modem port3 8e54 */
- u_char dcm_pad11;
- vu_char dcm_modemchng; /* 638 Modem change mask 8e5b */
- u_char dcm_pad12;
- vu_char dcm_modemintr; /* 638 Modem interrupt mask 8e5d */
- u_char dcm_pad13[0x82]; /* Undef Shared Ram 8e5e-8edf */
- struct dcmtfifo {
- u_char ptr_pad1;
- vu_char data_char;
- } dcm_tfifos[4][0x10]; /* Transmit queues 8ee0 */
-};
-
-/*
- * Overlay structure for port specific queue "registers".
- * Starts at offset 0x8E00+(port*2).
- */
-struct dcmpreg {
- u_char pad0; /* +00 */
- vu_char r_head; /* +01 */
- u_char pad1[7]; /* +02 */
- vu_char r_tail; /* +09 */
- u_char pad2[7]; /* +0A */
- vu_char t_head; /* +11 */
- u_char pad3[7]; /* +12 */
- vu_char t_tail; /* +19 */
-};
-#define dcm_preg(d, p) ((struct dcmpreg *)((u_int)(d)+0x8e00+(p)*2))
-
-/* interface reset/id */
-#define DCMCON 0x80 /* REMOTE/LOCAL switch, read */
-#define DCMID 0x5 /* hardwired card id, read */
-#define DCMRS 0x80 /* software reset, write */
-
-/* interrupt control */
-#define DCMIPL(x) ((((x) >> 4) & 3) + 3) /* interrupt level, read */
-#define IC_IR 0x40 /* interrupt request, read */
-#define IC_IE 0x80 /* interrupt enable, write */
-#define IC_ID 0x00 /* interrupt disable, write */
-
-
-/* Semaphore control */
-#define SEM_BSY 0x80 /* read */
-#define SEM_CLR 0xFF /* write */
-#define SEM_LOCK(dcm) while ((dcm)->dcm_sem & SEM_BSY)
-#define SEM_UNLOCK(dcm) (dcm)->dcm_sem = SEM_CLR
-
-/* command register */
-#define CR_PORT0 0x1
-#define CR_PORT1 0x2
-#define CR_PORT2 0x4
-#define CR_PORT3 0x8
-#define CR_MODM 0x10 /* change modem output lines */
-#define CR_TIMER 0x20 /* 16ms interrupt timer toggle */
-#define CR_SELFT 0x40 /* run self test */
-#define CR_MASK 0x7f
-
-/* interrupt ident register */
-#define IIR_PORT0 0x1
-#define IIR_PORT1 0x2
-#define IIR_PORT2 0x4
-#define IIR_PORT3 0x8
-#define IIR_SELFT 0x10 /* self test completed */
-#define IIR_MODM 0x20 /* change in modem input lines */
-#define IIR_TIMEO 0x40 /* Time out */
-#define IIR_MASK 0x7f
-
-/* self test cond reg */
-#define ST_OK 0xe0
-
-/* Line configuration register */
-#define LC_PNO 0x00
-#define LC_PODD 0x01
-#define LC_PEVEN 0x02
-#define LC_PMSK 0x03
-
-#define LC_1STOP 0x00
-#define LC_1HSTOP 0x04
-#define LC_2STOP 0x08
-#define LC_STOPMSK 0x0b
-
-#define LC_8BITS 0x30
-#define LC_7BITS 0x20
-#define LC_6BITS 0x10
-#define LC_5BITS 0x00
-#define LC_BITMSK 0x30
-
-/* baud reg */
-#define BR_0 0x00
-#define BR_50 0x01
-#define BR_75 0x02
-#define BR_110 0x03
-#define BR_134 0x04
-#define BR_150 0x05
-#define BR_300 0x06
-#define BR_600 0x07
-#define BR_900 0x08
-#define BR_1200 0x09
-#define BR_1800 0x0a
-#define BR_2400 0x0b
-#define BR_3600 0x0c
-#define BR_4800 0x0d
-#define BR_7200 0x0e
-#define BR_9600 0x0f
-#define BR_19200 0x10
-#define BR_38400 0x11
-
-/* modem input register */
-#define MI_CTS 0x08
-#define MI_DM 0x04
-#define MI_CD 0x02
-#define MI_RI 0x01
-
-/* modem output register */
-#define MO_SR 0x04
-#define MO_DTR 0x02
-#define MO_RTS 0x01
-#define MO_ON ((MO_DTR) | (MO_RTS))
-#define MO_OFF 0x00
-
-/* cmd-tab values, write */
-#define CT_CON 0x1 /* configuration change */
-#define CT_TX 0x2 /* transmit buffer not empty */
-#define CT_BRK 0x4 /* toggle BREAK */
-
-/* icr-tab values, read */
-#define IT_TX 0x1 /* transmit buffer empty */
-#define IT_SPEC 0x2 /* special character received */
-
-/* data errors */
-#define RD_OVF 0x08
-#define RD_BD 0x10
-#define RD_PE 0x20
-#define RD_OE 0x40
-#define RD_FE 0x80
-#define RD_MASK 0xf8
-
-/* Transmit/Receive masks */
-#define TX_MASK 0x0f
-#define RX_MASK 0xff
-
-/*
- * DCM console caveat: only port 1 is affected by the remote switch, and
- * thus the only supported console port on a given DCM card.
- */
-#define DCMCONSPORT 1
diff --git a/sys/arch/hp300/dev/devlist2h.awk b/sys/arch/hp300/dev/devlist2h.awk
deleted file mode 100644
index 0354a5fe0d1..00000000000
--- a/sys/arch/hp300/dev/devlist2h.awk
+++ /dev/null
@@ -1,167 +0,0 @@
-#! /usr/bin/awk -f
-#
-# $OpenBSD: devlist2h.awk,v 1.2 1997/02/03 04:47:16 downsj Exp $
-# $NetBSD: devlist2h.awk,v 1.2 1997/01/30 09:18:36 thorpej Exp $
-#
-# Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
-# Copyright (c) 1995, 1996 Christopher G. Demetriou
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by Christopher G. Demetriou.
-# 4. The name of the author may not be used to endorse or promote products
-# derived from this software without specific prior written permission
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-BEGIN {
- ndevices = 0
- fbid = 0
- dfile="diodevs_data.h"
- hfile="diodevs.h"
-}
-NR == 1 {
- VERSION = $0
- gsub("\\$", "", VERSION)
-
- printf("/*\n") > dfile
- printf(" * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \
- > dfile
- printf(" *\n") > dfile
- printf(" * generated from:\n") > dfile
- printf(" *\t%s\n", VERSION) > dfile
- printf(" */\n") > dfile
-
- printf("/*\n") > hfile
- printf(" * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \
- > hfile
- printf(" *\n") > hfile
- printf(" * generated from:\n") > hfile
- printf(" *\t%s\n", VERSION) > hfile
- printf(" */\n") > hfile
-
- next
-}
-$1 == "device" {
- ndevices++
-
- devices[ndevices, 1] = $2 # nickname
- devices[ndevices, 2] = $3 # dio primary id
- devices[ndevices, 3] = "0" # dio secondary id
- devices[ndevices, 4] = $4 # number of select codes
- # used by device
-
- # if this is the framebuffer entry, save the primary id
- if ($2 == "FRAMEBUFFER") {
- fbid = $3;
- }
-
- # emit device primary id
- printf("\n#define\tDIO_DEVICE_ID_%s\t%s\n", devices[ndevices, 1], \
- devices[ndevices, 2]) > hfile
-
- # emit description
- printf("#define\tDIO_DEVICE_DESC_%s\t\"", devices[ndevices, 1]) \
- > hfile
-
- f = 5;
-
- while (f <= NF) {
- printf("%s", $f) > hfile
- if (f < NF)
- printf(" ") > hfile
- f++;
- }
- printf("\"\n") > hfile
-
- next
-}
-$1 == "framebuffer" {
- ndevices++
-
- devices[ndevices, 1] = $2 # nickname
- devices[ndevices, 2] = fbid # dio primary id
- devices[ndevices, 3] = $3 # dio secondary id
- devices[ndevices, 4] = $4 # number of select codes
- # used by device
-
- # emit device secondary id
- printf("\n#define\tDIO_DEVICE_SECID_%s\t%s\n", devices[ndevices, 1], \
- devices[ndevices, 3]) > hfile
-
- # emit description
- printf("#define\tDIO_DEVICE_DESC_%s\t\"", devices[ndevices, 1]) \
- > hfile
-
- f = 5;
-
- while (f <= NF) {
- printf("%s", $f) > hfile
- if (f < NF)
- printf(" ") > hfile
- f++;
- }
- printf("\"\n") > hfile
-
- next
-}
-{
- if ($0 == "")
- blanklines++
- if (blanklines != 2 && blanklines != 3)
- print $0 > hfile
- if (blanklines < 2)
- print $0 > dfile
-}
-END {
- # emit device count
-
- printf("\n") > dfile
- printf("#define DIO_NDEVICES\t%d\n", ndevices) > dfile
-
- # emit select code size table
-
- printf("\n") > dfile
-
- printf("struct dio_devdata dio_devdatas[] = {\n") > dfile
- for (i = 1; i <= ndevices; i++) {
- printf("\t{ %s,\t%s,\t%s },\n", devices[i, 2],
- devices[i, 3], devices[i, 4]) > dfile
- }
-
- printf("};\n") > dfile
-
- # emit description table
-
- printf("\n") > dfile
- printf("#ifdef DIOVERBOSE\n") > dfile
-
- printf("struct dio_devdesc dio_devdescs[] = {\n") > dfile
-
- for (i = 1; i <= ndevices; i++) {
- printf("\t{ %s,\t%s,\tDIO_DEVICE_DESC_%s },\n",
- devices[i, 2], devices[i, 3], devices[i, 1]) > dfile
- }
-
- printf("};\n") > dfile
-
- printf("#endif /* DIOVERBOSE */\n") > dfile
-}
diff --git a/sys/arch/hp300/dev/dio.c b/sys/arch/hp300/dev/dio.c
deleted file mode 100644
index b419537945f..00000000000
--- a/sys/arch/hp300/dev/dio.c
+++ /dev/null
@@ -1,366 +0,0 @@
-/* $OpenBSD: dio.c,v 1.16 2011/08/18 20:02:57 miod Exp $ */
-/* $NetBSD: dio.c,v 1.7 1997/05/05 21:00:32 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Autoconfiguration and mapping support for the DIO bus.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-#include <machine/hp300spu.h>
-
-#include <hp300/dev/dmavar.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-
-#include <hp300/dev/diodevs.h>
-#include <hp300/dev/diodevs_data.h>
-
-extern caddr_t internalhpib;
-
-int dio_scodesize(struct dio_attach_args *);
-char *dio_devinfo(struct dio_attach_args *, char *, size_t);
-
-int diomatch(struct device *, void *, void *);
-void dioattach(struct device *, struct device *, void *);
-int dioprint(void *, const char *);
-int diosubmatch(struct device *, void *, void *);
-
-struct cfattach dio_ca = {
- sizeof(struct device), diomatch, dioattach
-};
-
-struct cfdriver dio_cd = {
- NULL, "dio", DV_DULL
-};
-
-int
-diomatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- static int dio_matched = 0;
-
- /* Allow only one instance. */
- if (dio_matched)
- return (0);
-
- dio_matched = 1;
- return (1);
-}
-
-void
-dioattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct dio_attach_args da;
- caddr_t pa, va;
- int scode, sctmp, scmax, didmap, scodesize;
-
- scmax = DIO_SCMAX(machineid);
- printf(": ");
- dmainit();
-
- for (scode = 0; scode < scmax; ) {
- if ((sctmp = dio_inhole(scode)) != 0) {
- scode = sctmp;
- continue;
- }
-
- didmap = 0;
-
- /*
- * Temporarily map the space corresponding to
- * the current select code unless:
- * - this is the internal hpib select code,
- * - this is the console select code, and
- * the console driver actually has a mapping
- * of the beginning of the select code space
- * (sti@dio doesn't).
- */
- pa = dio_scodetopa(scode);
- if (scode == conscode && conaddr != 0)
- va = conaddr;
- else if ((scode == 7) && internalhpib)
- va = internalhpib = (caddr_t)IIOV(pa);
- else {
- va = iomap(pa, NBPG);
- if (va == NULL) {
- printf("%s: can't map scode %d\n",
- self->dv_xname, scode);
- scode++;
- continue;
- }
- didmap = 1;
- }
-
- /* Check for hardware. */
- if (badaddr(va)) {
- if (didmap)
- iounmap(va, NBPG);
- scode++;
- continue;
- }
-
- /* Fill out attach args. */
- bzero(&da, sizeof(da));
- da.da_scode = scode;
- if (scode == 7 && internalhpib)
- da.da_id = DIO_DEVICE_ID_IHPIB;
- else {
- da.da_id = DIO_ID(va);
- /*
- * If we probe an unknown device, we do not necessarily
- * know how many scodes it will span.
- * Extra scodes will usually report an id of zero,
- * which would match ihpib!
- * Check for this, warn the user, and skip that scode.
- */
- if (da.da_id == 0) {
- if (didmap)
- iounmap(va, NBPG);
- printf("%s: warning: select code %d is likely "
- "a span of a previous unsupported device\n",
- self->dv_xname, scode);
- scode++;
- continue;
- }
- }
-
- if (DIO_ISFRAMEBUFFER(da.da_id))
- da.da_secid = DIO_SECID(va);
-
- da.da_size = DIO_SIZE(scode, va);
- scodesize = dio_scodesize(&da);
- if (DIO_ISDIO(scode))
- da.da_size *= scodesize;
-
- /* No longer need the device to be mapped. */
- if (didmap)
- iounmap(va, NBPG);
-
- /* Attach matching device. */
- config_found_sm(self, &da, dioprint, diosubmatch);
- scode += scodesize;
- }
-}
-
-int
-diosubmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct cfdata *cf = match;
- struct dio_attach_args *da = aux;
-
- if (cf->diocf_scode != DIO_UNKNOWN_SCODE &&
- cf->diocf_scode != da->da_scode)
- return (0);
-
- return ((*cf->cf_attach->ca_match)(parent, cf, aux));
-}
-
-int
-dioprint(aux, pnp)
- void *aux;
- const char *pnp;
-{
- struct dio_attach_args *da = aux;
- char buf[128];
-
- if (pnp)
- printf("%s at %s", dio_devinfo(da, buf, sizeof(buf)), pnp);
- printf(" scode %d", da->da_scode);
- return (UNCONF);
-}
-
-/*
- * Convert a select code to a system physical address.
- */
-void *
-dio_scodetopa(scode)
- int scode;
-{
- u_long rval;
-
- if (scode == 7 && internalhpib)
- rval = DIO_IHPIBADDR;
- else if (DIO_ISDIO(scode))
- rval = DIO_BASE + (scode * DIO_DEVSIZE);
- else if (DIO_ISDIOII(scode))
- rval = DIOII_BASE + ((scode - DIOII_SCBASE) * DIOII_DEVSIZE);
- else
- rval = 0;
-
- return ((void *)rval);
-}
-
-/*
- * Return the select code size for this device, defaulting to 1
- * if we don't know what kind of device we have.
- */
-int
-dio_scodesize(da)
- struct dio_attach_args *da;
-{
- int i;
-
- /*
- * Deal with lame internal HP-IB controllers which don't have
- * consistent/reliable device ids.
- */
- if (da->da_scode == 7 && internalhpib)
- return (1);
-
- /*
- * Find the dio_devdata matching the primary id.
- * If we're a framebuffer, we also check the secondary id.
- */
- for (i = 0; i < DIO_NDEVICES; i++) {
- if (da->da_id == dio_devdatas[i].dd_id) {
- if (DIO_ISFRAMEBUFFER(da->da_id)) {
- if (da->da_secid == dio_devdatas[i].dd_secid) {
- goto foundit;
- }
- } else {
- foundit:
- return (dio_devdatas[i].dd_nscode);
- }
- }
- }
-
- /*
- * Device is unknown. Print a warning and assume a default.
- */
- printf("WARNING: select code size unknown for id = 0x%x secid = 0x%x\n",
- da->da_id, da->da_secid);
- return (1);
-}
-
-/*
- * Return a reasonable description of a DIO device.
- */
-char *
-dio_devinfo(da, buf, buflen)
- struct dio_attach_args *da;
- char *buf;
- size_t buflen;
-{
-#ifdef DIOVERBOSE
- int i;
-#endif
-
- bzero(buf, buflen);
-
- /*
- * Deal with lame internal HP-IB controllers which don't have
- * consistent/reliable device ids.
- */
- if (da->da_scode == 7 && internalhpib) {
- snprintf(buf, buflen, DIO_DEVICE_DESC_IHPIB);
- return (buf);
- }
-
-#ifdef DIOVERBOSE
- /*
- * Find the description matching our primary id.
- * If we're a framebuffer, we also check the secondary id.
- */
- for (i = 0; i < DIO_NDEVICES; i++) {
- if (da->da_id == dio_devdescs[i].dd_id) {
- if (DIO_ISFRAMEBUFFER(da->da_id)) {
- if (da->da_secid == dio_devdescs[i].dd_secid) {
- goto foundit;
- }
- } else {
- foundit:
- snprintf(buf, buflen, "%s",
- dio_devdescs[i].dd_desc);
- return (buf);
- }
- }
- }
-#endif /* DIOVERBOSE */
-
- /*
- * Device is unknown. Construct something reasonable.
- */
- snprintf(buf, buflen, "device id = 0x%x secid = 0x%x",
- da->da_id, da->da_secid);
- return (buf);
-}
-
-/*
- * Establish an interrupt handler for a DIO device.
- */
-void
-dio_intr_establish(struct isr *isr, const char *name)
-{
- intr_establish(isr, name);
-
- if (isr->isr_priority == IPL_BIO)
- dmacomputeipl();
-}
-
-/*
- * Remove an interrupt handler for a DIO device.
- */
-void
-dio_intr_disestablish(struct isr *isr)
-{
- intr_disestablish(isr);
-
- if (isr->isr_priority == IPL_BIO)
- dmacomputeipl();
-}
-
-/*
- * Return the next select code if the given select code lies within a hole,
- * zero otherwise.
- */
-int
-dio_inhole(int scode)
-{
- /* unconditionnaly skip the DIO-II hole */
- if (scode >= 32 && scode < DIOII_SCBASE)
- return DIOII_SCBASE;
-
- return 0;
-}
diff --git a/sys/arch/hp300/dev/diodevs b/sys/arch/hp300/dev/diodevs
deleted file mode 100644
index def0f9d106b..00000000000
--- a/sys/arch/hp300/dev/diodevs
+++ /dev/null
@@ -1,101 +0,0 @@
-$OpenBSD: diodevs,v 1.10 2011/08/18 20:02:57 miod Exp $
-/* $NetBSD: diodevs,v 1.7 2003/11/23 01:57:35 tsutsui Exp $ */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * List of known DIO devices
- */
-
-/* Devices we have drivers for. */
-
-device DCA0 0x02 1 98644A serial
-device DCA0REM 0x82 1 98644A serial
-device DCA1 0x42 1 98644A serial
-device DCA1REM 0xc2 1 98644A serial
-
-device DCM 0x05 1 98642A serial MUX
-device DCMREM 0x85 1 98642A serial MUX
-
-device LAN 0x15 1 98643A LAN
-device LANREM 0x95 1 98643A LAN
-
-device FHPIB 0x08 1 98625A/98625B HP-IB
-device NHPIB 0x01 1 98624A HP-IB
-device IHPIB 0x00 1 internal HP-IB
-
-device SCSI0 0x07 1 98265A SCSI
-device SCSI1 0x27 1 98265A SCSI
-device SCSI2 0x47 1 98265A SCSI
-device SCSI3 0x67 1 98265A SCSI
-
-/* Framebuffer devices; same primary ID, different secondary IDs. */
-
-device FRAMEBUFFER 0x39 1 bitmapped display
-
-framebuffer GATORBOX 0x01 1 98700/98710 (\"gatorbox\") display
-framebuffer TOPCAT 0x02 1 98544/98545/98547 (\"topcat\") display
-framebuffer RENAISSANCE 0x04 2 98720/98721 (\"renaissance\") display
-framebuffer LRCATSEYE 0x05 1 low-res catseye display
-framebuffer HRCCATSEYE 0x06 1 high-res color catseye display
-framebuffer HRMCATSEYE 0x07 1 high-res mono catseye display
-framebuffer DAVINCI 0x08 2 98730/98731 (\"davinci\") display
-framebuffer XXXCATSEYE 0x09 1 catseye display
-framebuffer TIGERSHARK 0x0c 3 TurboVRX (\"tigershark\") display
-framebuffer HYPERION 0x0e 1 A1096A (\"hyperion\") display
-framebuffer FB3X2_A 0x10 4 362/382 internal display #1
-framebuffer FB3X2_B 0x11 4 362/382 internal display #2
-
-/* Unsupported framebuffers. */
-
-framebuffer XGENESIS 0x0b 1 x-genesis display
-framebuffer YGENESIS 0x0d 1 y-genesis display
-
-/* Devices not yet supported. Descriptions are lacking. */
-
-device MISC0 0x03 1 98622A
-device MISC1 0x04 1 98623A
-device PARALLEL 0x06 1 internal parallel
-device MISC2 0x09 1 98287A keyboard
-device MISC3 0x0a 1 HP98635A floating point accelerator
-device MISC4 0x0b 1 timer
-device MISC5 0x12 1 98640A
-device AUDIO 0x13 1 digital audio
-device MISC6 0x16 1 98659A
-device MISC7 0x19 1 237 display
-device MISC8 0x1a 4 quad-wide card
-device MISC9 0x1b 1 98253A
-device MISC10 0x1c 1 98627A
-device MISC11 0x1d 1 98633A
-device MISC12 0x1e 1 98259A
-device MISC13 0x1f 1 8741
-device VME 0x31 2 98577A VME adapter
-device DCL 0x34 1 98628A serial
-device DCLREM 0xb4 1 98628A serial
diff --git a/sys/arch/hp300/dev/diodevs.h b/sys/arch/hp300/dev/diodevs.h
deleted file mode 100644
index b0a6a730ef1..00000000000
--- a/sys/arch/hp300/dev/diodevs.h
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
- *
- * generated from:
- * OpenBSD: diodevs,v 1.8 2008/05/01 14:29:01 miod Exp
- */
-/* $NetBSD: diodevs,v 1.7 2003/11/23 01:57:35 tsutsui Exp $ */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-#define DIO_DEVICE_ID_DCA0 0x02
-#define DIO_DEVICE_DESC_DCA0 "98644A serial"
-
-#define DIO_DEVICE_ID_DCA0REM 0x82
-#define DIO_DEVICE_DESC_DCA0REM "98644A serial"
-
-#define DIO_DEVICE_ID_DCA1 0x42
-#define DIO_DEVICE_DESC_DCA1 "98644A serial"
-
-#define DIO_DEVICE_ID_DCA1REM 0xc2
-#define DIO_DEVICE_DESC_DCA1REM "98644A serial"
-
-
-#define DIO_DEVICE_ID_DCM 0x05
-#define DIO_DEVICE_DESC_DCM "98642A serial MUX"
-
-#define DIO_DEVICE_ID_DCMREM 0x85
-#define DIO_DEVICE_DESC_DCMREM "98642A serial MUX"
-
-
-#define DIO_DEVICE_ID_LAN 0x15
-#define DIO_DEVICE_DESC_LAN "98643A LAN"
-
-#define DIO_DEVICE_ID_LANREM 0x95
-#define DIO_DEVICE_DESC_LANREM "98643A LAN"
-
-
-#define DIO_DEVICE_ID_FHPIB 0x08
-#define DIO_DEVICE_DESC_FHPIB "98625A/98625B HP-IB"
-
-#define DIO_DEVICE_ID_NHPIB 0x01
-#define DIO_DEVICE_DESC_NHPIB "98624A HP-IB"
-
-#define DIO_DEVICE_ID_IHPIB 0x00
-#define DIO_DEVICE_DESC_IHPIB "internal HP-IB"
-
-
-#define DIO_DEVICE_ID_SCSI0 0x07
-#define DIO_DEVICE_DESC_SCSI0 "98265A SCSI"
-
-#define DIO_DEVICE_ID_SCSI1 0x27
-#define DIO_DEVICE_DESC_SCSI1 "98265A SCSI"
-
-#define DIO_DEVICE_ID_SCSI2 0x47
-#define DIO_DEVICE_DESC_SCSI2 "98265A SCSI"
-
-#define DIO_DEVICE_ID_SCSI3 0x67
-#define DIO_DEVICE_DESC_SCSI3 "98265A SCSI"
-
-/* Framebuffer devices; same primary ID, different secondary IDs. */
-
-
-#define DIO_DEVICE_ID_FRAMEBUFFER 0x39
-#define DIO_DEVICE_DESC_FRAMEBUFFER "bitmapped display"
-
-
-#define DIO_DEVICE_SECID_GATORBOX 0x01
-#define DIO_DEVICE_DESC_GATORBOX "98700/98710 (\"gatorbox\") display"
-
-#define DIO_DEVICE_SECID_TOPCAT 0x02
-#define DIO_DEVICE_DESC_TOPCAT "98544/98545/98547 (\"topcat\") display"
-
-#define DIO_DEVICE_SECID_RENAISSANCE 0x04
-#define DIO_DEVICE_DESC_RENAISSANCE "98720/98721 (\"renaissance\") display"
-
-#define DIO_DEVICE_SECID_LRCATSEYE 0x05
-#define DIO_DEVICE_DESC_LRCATSEYE "low-res catseye display"
-
-#define DIO_DEVICE_SECID_HRCCATSEYE 0x06
-#define DIO_DEVICE_DESC_HRCCATSEYE "high-res color catseye display"
-
-#define DIO_DEVICE_SECID_HRMCATSEYE 0x07
-#define DIO_DEVICE_DESC_HRMCATSEYE "high-res mono catseye display"
-
-#define DIO_DEVICE_SECID_DAVINCI 0x08
-#define DIO_DEVICE_DESC_DAVINCI "98730/98731 (\"davinci\") display"
-
-#define DIO_DEVICE_SECID_XXXCATSEYE 0x09
-#define DIO_DEVICE_DESC_XXXCATSEYE "catseye display"
-
-#define DIO_DEVICE_SECID_HYPERION 0x0e
-#define DIO_DEVICE_DESC_HYPERION "A1096A (\"hyperion\") display"
-
-/* Unsupported framebuffers. */
-
-
-#define DIO_DEVICE_SECID_XGENESIS 0x0b
-#define DIO_DEVICE_DESC_XGENESIS "x-genesis display"
-
-#define DIO_DEVICE_SECID_TIGERSHARK 0x0c
-#define DIO_DEVICE_DESC_TIGERSHARK "TurboVRX (\"tigershark\") display"
-
-#define DIO_DEVICE_SECID_YGENESIS 0x0d
-#define DIO_DEVICE_DESC_YGENESIS "y-genesis display"
-
-#define DIO_DEVICE_SECID_FB3X2_A 0x10
-#define DIO_DEVICE_DESC_FB3X2_A "362/382 internal display #1"
-
-#define DIO_DEVICE_SECID_FB3X2_B 0x11
-#define DIO_DEVICE_DESC_FB3X2_B "362/382 internal display #2"
-
-/* Devices not yet supported. Descriptions are lacking. */
-
-
-#define DIO_DEVICE_ID_MISC0 0x03
-#define DIO_DEVICE_DESC_MISC0 "98622A"
-
-#define DIO_DEVICE_ID_MISC1 0x04
-#define DIO_DEVICE_DESC_MISC1 "98623A"
-
-#define DIO_DEVICE_ID_PARALLEL 0x06
-#define DIO_DEVICE_DESC_PARALLEL "internal parallel"
-
-#define DIO_DEVICE_ID_MISC2 0x09
-#define DIO_DEVICE_DESC_MISC2 "98287A keyboard"
-
-#define DIO_DEVICE_ID_MISC3 0x0a
-#define DIO_DEVICE_DESC_MISC3 "HP98635A floating point accelerator"
-
-#define DIO_DEVICE_ID_MISC4 0x0b
-#define DIO_DEVICE_DESC_MISC4 "timer"
-
-#define DIO_DEVICE_ID_MISC5 0x12
-#define DIO_DEVICE_DESC_MISC5 "98640A"
-
-#define DIO_DEVICE_ID_AUDIO 0x13
-#define DIO_DEVICE_DESC_AUDIO "digital audio"
-
-#define DIO_DEVICE_ID_MISC6 0x16
-#define DIO_DEVICE_DESC_MISC6 "98659A"
-
-#define DIO_DEVICE_ID_MISC7 0x19
-#define DIO_DEVICE_DESC_MISC7 "237 display"
-
-#define DIO_DEVICE_ID_MISC8 0x1a
-#define DIO_DEVICE_DESC_MISC8 "quad-wide card"
-
-#define DIO_DEVICE_ID_MISC9 0x1b
-#define DIO_DEVICE_DESC_MISC9 "98253A"
-
-#define DIO_DEVICE_ID_MISC10 0x1c
-#define DIO_DEVICE_DESC_MISC10 "98627A"
-
-#define DIO_DEVICE_ID_MISC11 0x1d
-#define DIO_DEVICE_DESC_MISC11 "98633A"
-
-#define DIO_DEVICE_ID_MISC12 0x1e
-#define DIO_DEVICE_DESC_MISC12 "98259A"
-
-#define DIO_DEVICE_ID_MISC13 0x1f
-#define DIO_DEVICE_DESC_MISC13 "8741"
-
-#define DIO_DEVICE_ID_VME 0x31
-#define DIO_DEVICE_DESC_VME "98577A VME adapter"
-
-#define DIO_DEVICE_ID_DCL 0x34
-#define DIO_DEVICE_DESC_DCL "98628A serial"
-
-#define DIO_DEVICE_ID_DCLREM 0xb4
-#define DIO_DEVICE_DESC_DCLREM "98628A serial"
diff --git a/sys/arch/hp300/dev/diodevs_data.h b/sys/arch/hp300/dev/diodevs_data.h
deleted file mode 100644
index fc1bae0bd2f..00000000000
--- a/sys/arch/hp300/dev/diodevs_data.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
- *
- * generated from:
- * OpenBSD: diodevs,v 1.8 2008/05/01 14:29:01 miod Exp
- */
-/* $NetBSD: diodevs,v 1.7 2003/11/23 01:57:35 tsutsui Exp $ */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define DIO_NDEVICES 49
-
-struct dio_devdata dio_devdatas[] = {
- { 0x02, 0, 1 },
- { 0x82, 0, 1 },
- { 0x42, 0, 1 },
- { 0xc2, 0, 1 },
- { 0x05, 0, 1 },
- { 0x85, 0, 1 },
- { 0x15, 0, 1 },
- { 0x95, 0, 1 },
- { 0x08, 0, 1 },
- { 0x01, 0, 1 },
- { 0x00, 0, 1 },
- { 0x07, 0, 1 },
- { 0x27, 0, 1 },
- { 0x47, 0, 1 },
- { 0x67, 0, 1 },
- { 0x39, 0, 1 },
- { 0x39, 0x01, 1 },
- { 0x39, 0x02, 1 },
- { 0x39, 0x04, 2 },
- { 0x39, 0x05, 1 },
- { 0x39, 0x06, 1 },
- { 0x39, 0x07, 1 },
- { 0x39, 0x08, 2 },
- { 0x39, 0x09, 1 },
- { 0x39, 0x0e, 1 },
- { 0x39, 0x0b, 1 },
- { 0x39, 0x0c, 3 },
- { 0x39, 0x0d, 1 },
- { 0x39, 0x10, 4 },
- { 0x39, 0x11, 4 },
- { 0x03, 0, 1 },
- { 0x04, 0, 1 },
- { 0x06, 0, 1 },
- { 0x09, 0, 1 },
- { 0x0a, 0, 1 },
- { 0x0b, 0, 1 },
- { 0x12, 0, 1 },
- { 0x13, 0, 1 },
- { 0x16, 0, 1 },
- { 0x19, 0, 1 },
- { 0x1a, 0, 4 },
- { 0x1b, 0, 1 },
- { 0x1c, 0, 1 },
- { 0x1d, 0, 1 },
- { 0x1e, 0, 1 },
- { 0x1f, 0, 1 },
- { 0x31, 0, 2 },
- { 0x34, 0, 1 },
- { 0xb4, 0, 1 },
-};
-
-#ifdef DIOVERBOSE
-struct dio_devdesc dio_devdescs[] = {
- { 0x02, 0, DIO_DEVICE_DESC_DCA0 },
- { 0x82, 0, DIO_DEVICE_DESC_DCA0REM },
- { 0x42, 0, DIO_DEVICE_DESC_DCA1 },
- { 0xc2, 0, DIO_DEVICE_DESC_DCA1REM },
- { 0x05, 0, DIO_DEVICE_DESC_DCM },
- { 0x85, 0, DIO_DEVICE_DESC_DCMREM },
- { 0x15, 0, DIO_DEVICE_DESC_LAN },
- { 0x95, 0, DIO_DEVICE_DESC_LANREM },
- { 0x08, 0, DIO_DEVICE_DESC_FHPIB },
- { 0x01, 0, DIO_DEVICE_DESC_NHPIB },
- { 0x00, 0, DIO_DEVICE_DESC_IHPIB },
- { 0x07, 0, DIO_DEVICE_DESC_SCSI0 },
- { 0x27, 0, DIO_DEVICE_DESC_SCSI1 },
- { 0x47, 0, DIO_DEVICE_DESC_SCSI2 },
- { 0x67, 0, DIO_DEVICE_DESC_SCSI3 },
- { 0x39, 0, DIO_DEVICE_DESC_FRAMEBUFFER },
- { 0x39, 0x01, DIO_DEVICE_DESC_GATORBOX },
- { 0x39, 0x02, DIO_DEVICE_DESC_TOPCAT },
- { 0x39, 0x04, DIO_DEVICE_DESC_RENAISSANCE },
- { 0x39, 0x05, DIO_DEVICE_DESC_LRCATSEYE },
- { 0x39, 0x06, DIO_DEVICE_DESC_HRCCATSEYE },
- { 0x39, 0x07, DIO_DEVICE_DESC_HRMCATSEYE },
- { 0x39, 0x08, DIO_DEVICE_DESC_DAVINCI },
- { 0x39, 0x09, DIO_DEVICE_DESC_XXXCATSEYE },
- { 0x39, 0x0e, DIO_DEVICE_DESC_HYPERION },
- { 0x39, 0x0b, DIO_DEVICE_DESC_XGENESIS },
- { 0x39, 0x0c, DIO_DEVICE_DESC_TIGERSHARK },
- { 0x39, 0x0d, DIO_DEVICE_DESC_YGENESIS },
- { 0x39, 0x10, DIO_DEVICE_DESC_FB3X2_A },
- { 0x39, 0x11, DIO_DEVICE_DESC_FB3X2_B },
- { 0x03, 0, DIO_DEVICE_DESC_MISC0 },
- { 0x04, 0, DIO_DEVICE_DESC_MISC1 },
- { 0x06, 0, DIO_DEVICE_DESC_PARALLEL },
- { 0x09, 0, DIO_DEVICE_DESC_MISC2 },
- { 0x0a, 0, DIO_DEVICE_DESC_MISC3 },
- { 0x0b, 0, DIO_DEVICE_DESC_MISC4 },
- { 0x12, 0, DIO_DEVICE_DESC_MISC5 },
- { 0x13, 0, DIO_DEVICE_DESC_AUDIO },
- { 0x16, 0, DIO_DEVICE_DESC_MISC6 },
- { 0x19, 0, DIO_DEVICE_DESC_MISC7 },
- { 0x1a, 0, DIO_DEVICE_DESC_MISC8 },
- { 0x1b, 0, DIO_DEVICE_DESC_MISC9 },
- { 0x1c, 0, DIO_DEVICE_DESC_MISC10 },
- { 0x1d, 0, DIO_DEVICE_DESC_MISC11 },
- { 0x1e, 0, DIO_DEVICE_DESC_MISC12 },
- { 0x1f, 0, DIO_DEVICE_DESC_MISC13 },
- { 0x31, 0, DIO_DEVICE_DESC_VME },
- { 0x34, 0, DIO_DEVICE_DESC_DCL },
- { 0xb4, 0, DIO_DEVICE_DESC_DCLREM },
-};
-#endif /* DIOVERBOSE */
diff --git a/sys/arch/hp300/dev/diofb.c b/sys/arch/hp300/dev/diofb.c
deleted file mode 100644
index f452fc6c6bc..00000000000
--- a/sys/arch/hp300/dev/diofb.c
+++ /dev/null
@@ -1,546 +0,0 @@
-/* $OpenBSD: diofb.c,v 1.20 2013/10/21 10:36:11 miod Exp $ */
-
-/*
- * Copyright (c) 2005, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/proc.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/rasops/rasops.h>
-
-#include <hp300/dev/diofbreg.h>
-#include <hp300/dev/diofbvar.h>
-
-extern int rasops_alloc_cattr(void *, int, int, int, long *);
-
-int diofb_alloc_attr(void *, int, int, int, long *);
-int diofb_copycols(void *, int, int, int, int);
-int diofb_erasecols(void *, int, int, int, long);
-int diofb_copyrows(void *, int, int, int);
-int diofb_eraserows(void *, int, int, long);
-int diofb_do_cursor(struct rasops_info *);
-
-/*
- * Frame buffer geometry initialization
- */
-
-int
-diofb_fbinquire(struct diofb *fb, int scode, struct diofbreg *fbr)
-{
- int fboff, regsize;
-
- if (ISIIOVA(fbr))
- fb->regaddr = (caddr_t)IIOP(fbr);
- else
- fb->regaddr = dio_scodetopa(scode);
-
- if (fb->fbwidth == 0 || fb->fbheight == 0) {
- fb->fbwidth = (fbr->fbwmsb << 8) | fbr->fbwlsb;
- fb->fbheight = (fbr->fbhmsb << 8) | fbr->fbhlsb;
- }
- fb->fbsize = fb->fbwidth * fb->fbheight;
-
- fb->regkva = (caddr_t)fbr;
- fboff = (fbr->fbomsb << 8) | fbr->fbolsb;
- fb->fbaddr = (caddr_t) (*((u_char *)fbr + fboff) << 16);
-
- if (fb->regaddr >= (caddr_t)DIOII_BASE) {
- /*
- * For DIO-II space the fbaddr just computed is
- * the offset from the select code base (regaddr)
- * of the framebuffer. Hence it is also implicitly
- * the size of the set.
- */
- regsize = (int)fb->fbaddr;
- fb->fbaddr += (int)fb->regaddr;
- fb->fbkva = (caddr_t)fbr + regsize;
- } else {
- /*
- * For internal or DIO-I space we need to map the separate
- * framebuffer.
- */
- fb->fbkva = iomap(fb->fbaddr, fb->fbsize);
- if (fb->fbkva == NULL)
- return (ENOMEM);
- }
- if (fb->dwidth == 0 || fb->dheight == 0) {
- fb->dwidth = (fbr->dwmsb << 8) | fbr->dwlsb;
- fb->dheight = (fbr->dhmsb << 8) | fbr->dhlsb;
- }
-
- /*
- * Some displays, such as the DaVinci, appear to return a display
- * height larger than the frame buffer height.
- */
- if (fb->dwidth > fb->fbwidth)
- fb->dwidth = fb->fbwidth;
- if (fb->dheight > fb->fbheight)
- fb->dheight = fb->fbheight;
-
- /*
- * Some monochrome displays, such as the HP332 internal video
- * appear to return a display width of 1024 instead of 512.
- */
- if (fbr->num_planes == 1 && fb->dheight == 400)
- if (fb->dwidth == 1024)
- fb->dwidth = 512;
-
- fb->planes = fbr->num_planes;
- if (fb->planes > 8)
- fb->planes = 8;
- fb->planemask = (1 << fb->planes) - 1;
-
- fb->mapmode = WSDISPLAYIO_MODE_DUMBFB;
-
- return (0);
-}
-
-/*
- * Frame buffer rasops and colormap setup
- */
-
-void
-diofb_fbsetup(struct diofb *fb)
-{
- struct rasops_info *ri = &fb->ri;
-
- /*
- * Pretend we are an 8bpp frame buffer, unless ri_depth is already
- * initialized, since this is how it is supposed to be addressed.
- * (Hyperion forces 1bpp because it is really 1bpp addressed).
- */
- if (ri->ri_depth == 0)
- ri->ri_depth = 8;
- ri->ri_stride = (fb->fbwidth * ri->ri_depth) / 8;
-
- ri->ri_flg = RI_CENTER | RI_FULLCLEAR;
- /* We don't really support colors on less than 4bpp frame buffers */
- if (fb->planes < 4)
- ri->ri_flg |= RI_FORCEMONO;
- ri->ri_bits = fb->fbkva;
- ri->ri_width = fb->dwidth;
- ri->ri_height = fb->dheight;
- ri->ri_hw = fb;
-
- /*
- * Ask for an unholy big display, rasops will trim this to more
- * reasonable values.
- */
- rasops_init(ri, 160, 160);
-
- diofb_resetcmap(fb);
-
- /*
- * For low depth frame buffers, since we have faked a 8bpp frame buffer
- * to rasops, we actually have to remove capabilities.
- */
- if (fb->planes == 4) {
- ri->ri_ops.alloc_attr = diofb_alloc_attr;
- ri->ri_caps &= ~WSSCREEN_HILIT;
- }
-
- ri->ri_ops.copycols = diofb_copycols;
- ri->ri_ops.erasecols = diofb_erasecols;
- if (ri->ri_depth != 1) {
- ri->ri_ops.copyrows = diofb_copyrows;
- ri->ri_ops.eraserows = diofb_eraserows;
- ri->ri_do_cursor = diofb_do_cursor;
- }
-
- /* Clear entire display, including non visible areas */
- (*fb->bmv)(fb, 0, 0, 0, 0, fb->fbwidth, fb->fbheight, RR_CLEAR, 0xff);
-
- strlcpy(fb->wsd.name, "std", sizeof(fb->wsd.name));
- fb->wsd.ncols = ri->ri_cols;
- fb->wsd.nrows = ri->ri_rows;
- fb->wsd.textops = &ri->ri_ops;
- fb->wsd.fontwidth = ri->ri_font->fontwidth;
- fb->wsd.fontheight = ri->ri_font->fontheight;
- fb->wsd.capabilities = ri->ri_caps;
-}
-
-/*
- * Setup default emulation mode colormap
- */
-void
-diofb_resetcmap(struct diofb *fb)
-{
- const u_char *color;
- u_int i;
-
- /* start with the rasops colormap */
- color = (const u_char *)rasops_cmap;
- for (i = 0; i < 256; i++) {
- fb->cmap.r[i] = *color++;
- fb->cmap.g[i] = *color++;
- fb->cmap.b[i] = *color++;
- }
-
- /*
- * Tweak colormap
- *
- * Due to the way rasops cursor work, we need to provide
- * copies of the 8 or 16 basic colors at extra locations
- * in 4bpp and 6bpp mode. This is because missing planes
- * accept writes but read back as zero.
- *
- * So, in 6bpp mode:
- * 00 gets inverted to ff, read back as 3f
- * 3f gets inverted to c0, read back as 00
- * and in 4bpp mode:
- * 00 gets inverted to ff, read back as 0f
- * 0f gets inverted to f0, read back as 00
- */
-
- switch (fb->planes) {
- case 6:
- /*
- * 00-0f normal colors
- * 30-3f inverted colors
- * c0-cf normal colors
- * f0-ff inverted colors
- */
- bcopy(fb->cmap.r + 0x00, fb->cmap.r + 0xc0, 0x10);
- bcopy(fb->cmap.g + 0x00, fb->cmap.g + 0xc0, 0x10);
- bcopy(fb->cmap.b + 0x00, fb->cmap.b + 0xc0, 0x10);
- bcopy(fb->cmap.r + 0xf0, fb->cmap.r + 0x30, 0x10);
- bcopy(fb->cmap.g + 0xf0, fb->cmap.g + 0x30, 0x10);
- bcopy(fb->cmap.b + 0xf0, fb->cmap.b + 0x30, 0x10);
- break;
- case 4:
- /*
- * 00-07 normal colors
- * 08-0f inverted colors
- * highlighted colors are not available.
- */
- bcopy(fb->cmap.r + 0xf8, fb->cmap.r + 0x08, 0x08);
- bcopy(fb->cmap.g + 0xf8, fb->cmap.g + 0x08, 0x08);
- bcopy(fb->cmap.b + 0xf8, fb->cmap.b + 0x08, 0x08);
- break;
- }
-}
-
-/*
- * Attachment helpers
- */
-
-void
-diofb_cnattach(struct diofb *fb)
-{
- long defattr;
- struct rasops_info *ri;
-
- ri = &fb->ri;
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr);
- wsdisplay_cnattach(&fb->wsd, ri, 0, 0, defattr);
-}
-
-void
-diofb_end_attach(void *sc, struct wsdisplay_accessops *accessops,
- struct diofb *fb, int console, const char *descr)
-{
- struct wsemuldisplaydev_attach_args waa;
-
- printf(": %dx%d", fb->dwidth, fb->dheight);
-
- if (fb->planes == 1)
- printf(" monochrome");
- else
- printf("x%d", fb->planes);
-
- if (descr != NULL)
- printf(" %s", descr);
- printf(" frame buffer\n");
-
- fb->scrlist[0] = &fb->wsd;
- fb->wsl.nscreens = 1;
- fb->wsl.screens = (const struct wsscreen_descr **)fb->scrlist;
-
- waa.console = console;
- waa.scrdata = &fb->wsl;
- waa.accessops = accessops;
- waa.accesscookie = fb;
- waa.defaultscreens = 0;
-
- config_found((struct device *)sc, &waa, wsemuldisplaydevprint);
-}
-
-/*
- * Common wsdisplay emulops for DIO frame buffers
- */
-
-int
-diofb_alloc_attr(void *cookie, int fg, int bg, int flg, long *attr)
-{
- if ((flg & (WSATTR_BLINK | WSATTR_HILIT)) != 0)
- return (EINVAL);
-
- return (rasops_alloc_cattr(cookie, fg, bg, flg, attr));
-}
-
-int
-diofb_copycols(void *cookie, int row, int src, int dst, int n)
-{
- struct rasops_info *ri = cookie;
- struct diofb *fb = ri->ri_hw;
-
- n *= ri->ri_font->fontwidth;
- src *= ri->ri_font->fontwidth;
- dst *= ri->ri_font->fontwidth;
- row *= ri->ri_font->fontheight;
-
- (*fb->bmv)(fb, ri->ri_xorigin + src, ri->ri_yorigin + row,
- ri->ri_xorigin + dst, ri->ri_yorigin + row,
- n, ri->ri_font->fontheight, RR_COPY, 0xff);
-
- return 0;
-}
-
-int
-diofb_copyrows(void *cookie, int src, int dst, int n)
-{
- struct rasops_info *ri = cookie;
- struct diofb *fb = ri->ri_hw;
-
- n *= ri->ri_font->fontheight;
- src *= ri->ri_font->fontheight;
- dst *= ri->ri_font->fontheight;
-
- (*fb->bmv)(fb, ri->ri_xorigin, ri->ri_yorigin + src,
- ri->ri_xorigin, ri->ri_yorigin + dst,
- ri->ri_emuwidth, n, RR_COPY, 0xff);
-
- return 0;
-}
-
-int
-diofb_erasecols(void *cookie, int row, int col, int num, long attr)
-{
- struct rasops_info *ri = cookie;
- struct diofb *fb = ri->ri_hw;
- int fg, bg;
- int snum, scol, srow;
-
- ri->ri_ops.unpack_attr(cookie, attr, &fg, &bg, NULL);
-
- snum = num * ri->ri_font->fontwidth;
- scol = col * ri->ri_font->fontwidth + ri->ri_xorigin;
- srow = row * ri->ri_font->fontheight + ri->ri_yorigin;
-
- /*
- * If this is too tricky for the simple raster ops engine,
- * pass the fun to rasops.
- */
- if ((*fb->bmv)(fb, scol, srow, scol, srow, snum,
- ri->ri_font->fontheight, RR_CLEAR, 0xff ^ bg) != 0)
- rasops_erasecols(cookie, row, col, num, attr);
-
- return 0;
-}
-
-int
-diofb_eraserows(void *cookie, int row, int num, long attr)
-{
- struct rasops_info *ri = cookie;
- struct diofb *fb = ri->ri_hw;
- int fg, bg;
- int srow, snum;
- int rc;
-
- ri->ri_ops.unpack_attr(cookie, attr, &fg, &bg, NULL);
- bg ^= 0xff;
-
- if (num == ri->ri_rows && (ri->ri_flg & RI_FULLCLEAR)) {
- rc = (*fb->bmv)(fb, 0, 0, 0, 0, ri->ri_width, ri->ri_height,
- RR_CLEAR, bg);
- } else {
- srow = row * ri->ri_font->fontheight + ri->ri_yorigin;
- snum = num * ri->ri_font->fontheight;
- rc = (*fb->bmv)(fb, ri->ri_xorigin, srow, ri->ri_xorigin,
- srow, ri->ri_emuwidth, snum, RR_CLEAR, bg);
- }
- if (rc != 0)
- rasops_eraserows(cookie, row, num, attr);
-
- return 0;
-}
-
-int
-diofb_do_cursor(struct rasops_info *ri)
-{
- struct diofb *fb = ri->ri_hw;
- int x, y;
-
- x = ri->ri_ccol * ri->ri_font->fontwidth + ri->ri_xorigin;
- y = ri->ri_crow * ri->ri_font->fontheight + ri->ri_yorigin;
- (*fb->bmv)(fb, x, y, x, y, ri->ri_font->fontwidth,
- ri->ri_font->fontheight, RR_INVERT, 0xff);
-
- return 0;
-}
-
-/*
- * Common wsdisplay accessops for DIO frame buffers
- */
-
-int
-diofb_alloc_screen(void *v, const struct wsscreen_descr *type,
- void **cookiep, int *curxp, int *curyp, long *attrp)
-{
- struct diofb *fb = v;
- struct rasops_info *ri = &fb->ri;
-
- if (fb->nscreens > 0)
- return (ENOMEM);
-
- *cookiep = ri;
- *curxp = *curyp = 0;
- ri->ri_ops.alloc_attr(ri, 0, 0, 0, attrp);
- fb->nscreens++;
-
- return (0);
-}
-
-void
-diofb_free_screen(void *v, void *cookie)
-{
- struct diofb *fb = v;
-
- fb->nscreens--;
-}
-
-int
-diofb_show_screen(void *v, void *cookie, int waitok,
- void (*cb)(void *, int, int), void *cbarg)
-{
- return (0);
-}
-
-paddr_t
-diofb_mmap(void *v, off_t offset, int prot)
-{
- struct diofb *fb = v;
-
- if ((offset & PAGE_MASK) != 0)
- return (-1);
-
- switch (fb->mapmode) {
- case WSDISPLAYIO_MODE_MAPPED:
- if (offset >= 0 && offset < DIOFB_REGSPACE)
- return ((paddr_t)fb->regaddr + offset);
- offset -= DIOFB_REGSPACE;
- /* FALLTHROUGH */
- case WSDISPLAYIO_MODE_DUMBFB:
- if (offset >= 0 && offset < fb->fbsize)
- return ((paddr_t)fb->fbaddr + offset);
- break;
- }
-
- return (-1);
-}
-
-int
-diofb_getcmap(struct diofb *fb, struct wsdisplay_cmap *cm)
-{
- u_int index = cm->index, count = cm->count;
- u_int colcount = 1 << fb->planes;
- int error;
-
- if (index >= colcount || count > colcount - index)
- return (EINVAL);
-
- if ((error = copyout(fb->cmap.r + index, cm->red, count)) != 0)
- return (error);
- if ((error = copyout(fb->cmap.g + index, cm->green, count)) != 0)
- return (error);
- if ((error = copyout(fb->cmap.b + index, cm->blue, count)) != 0)
- return (error);
-
- return (0);
-}
-
-int
-diofb_load_font(void *v, void *emulcookie, struct wsdisplay_font *font)
-{
- struct diofb *fb = v;
- struct rasops_info *ri = &fb->ri;
-
- return rasops_load_font(ri, emulcookie, font);
-}
-
-int
-diofb_list_font(void *v, struct wsdisplay_font *font)
-{
- struct diofb *fb = v;
- struct rasops_info *ri = &fb->ri;
-
- return rasops_list_font(ri, font);
-}
diff --git a/sys/arch/hp300/dev/diofb_mono.c b/sys/arch/hp300/dev/diofb_mono.c
deleted file mode 100644
index 7b7790e5e44..00000000000
--- a/sys/arch/hp300/dev/diofb_mono.c
+++ /dev/null
@@ -1,245 +0,0 @@
-/* $OpenBSD: diofb_mono.c,v 1.3 2006/08/11 18:33:13 miod Exp $ */
-
-/*
- * Copyright (c) 2005, Miodrag Vallat.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-/*
- * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1991 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Mark Davies of the Department of Computer
- * Science, Victoria University of Wellington, New Zealand.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_hy.c 1.2 93/08/13$
- *
- * @(#)grf_hy.c 8.4 (Berkeley) 1/12/94
- */
-
-/*
- * Graphics routines for real 1bpp frame buffers (i.e. pixels not being
- * byte-addressed)
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/rasops/rasops.h>
-
-#include <hp300/dev/diofbreg.h>
-#include <hp300/dev/diofbvar.h>
-
-#include <dev/rasops/rasops_masks.h>
-#include <hp300/dev/maskbits.h>
-
-int
-diofb_mono_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy,
- u_int16_t dx, u_int16_t dy, u_int16_t cx, u_int16_t cy, int16_t rop,
- int16_t planemask /* ignored */)
-{
- int width; /* add to get to same position in next line */
-
- unsigned int *psrcLine, *pdstLine;
- /* pointers to line with current src and dst */
- unsigned int *psrc; /* pointer to current src longword */
- unsigned int *pdst; /* pointer to current dst longword */
-
- /* following used for looping through a line */
- unsigned int startmask, endmask; /* masks for writing ends of dst */
- int nlMiddle; /* whole longwords in dst */
- int nl; /* temp copy of nlMiddle */
- int xoffSrc; /* offset (>= 0, < 32) from which to
- fetch whole longwords fetched in src */
- int nstart; /* number of ragged bits at start of dst */
- int nend; /* number of ragged bits at end of dst */
- int srcStartOver; /* pulling nstart bits from src
- overflows into the next word? */
-
- width = fb->fbwidth >> 5;
-
- if (sy < dy) { /* start at last scanline of rectangle */
- psrcLine = ((u_int *)fb->fbkva) + ((sy + cy - 1) * width);
- pdstLine = ((u_int *)fb->fbkva) + ((dy + cy - 1) * width);
- width = -width;
- } else { /* start at first scanline */
- psrcLine = ((u_int *)fb->fbkva) + (sy * width);
- pdstLine = ((u_int *)fb->fbkva) + (dy * width);
- }
-
- /* x direction doesn't matter for < 1 longword */
- if (cx <= 32) {
- int srcBit, dstBit; /* bit offset of src and dst */
-
- pdstLine += (dx >> 5);
- psrcLine += (sx >> 5);
- psrc = psrcLine;
- pdst = pdstLine;
-
- srcBit = sx & 0x1f;
- dstBit = dx & 0x1f;
-
- while (cy--) {
- getandputrop(psrc, srcBit, dstBit, cx, pdst, rop);
- pdst += width;
- psrc += width;
- }
- } else {
- maskbits(dx, cx, startmask, endmask, nlMiddle);
- if (startmask)
- nstart = 32 - (dx & 0x1f);
- else
- nstart = 0;
- if (endmask)
- nend = (dx + cx) & 0x1f;
- else
- nend = 0;
-
- xoffSrc = ((sx & 0x1f) + nstart) & 0x1f;
- srcStartOver = ((sx & 0x1f) + nstart) > 31;
-
- if (sx >= dx) { /* move left to right */
- pdstLine += (dx >> 5);
- psrcLine += (sx >> 5);
-
- while (cy--) {
- psrc = psrcLine;
- pdst = pdstLine;
-
- if (startmask) {
- getandputrop(psrc, (sx & 0x1f),
- (dx & 0x1f), nstart, pdst, rop);
- pdst++;
- if (srcStartOver)
- psrc++;
- }
-
- /* special case for aligned operations */
- if (xoffSrc == 0) {
- nl = nlMiddle;
- while (nl--) {
- if (rop == RR_CLEAR)
- *pdst = 0;
- else
- *pdst = *psrc;
- psrc++;
- pdst++;
- }
- } else {
- nl = nlMiddle + 1;
- while (--nl) {
- if (rop == RR_CLEAR)
- *pdst = 0;
- else
- getunalignedword(psrc,
- xoffSrc, *pdst);
- pdst++;
- psrc++;
- }
- }
-
- if (endmask) {
- getandputrop(psrc, xoffSrc, 0, nend,
- pdst, rop);
- }
-
- pdstLine += width;
- psrcLine += width;
- }
- } else { /* move right to left */
- pdstLine += ((dx + cx) >> 5);
- psrcLine += ((sx + cx) >> 5);
- /*
- * If fetch of last partial bits from source crosses
- * a longword boundary, start at the previous longword
- */
- if (xoffSrc + nend >= 32)
- --psrcLine;
-
- while (cy--) {
- psrc = psrcLine;
- pdst = pdstLine;
-
- if (endmask) {
- getandputrop(psrc, xoffSrc, 0, nend,
- pdst, rop);
- }
-
- nl = nlMiddle + 1;
- while (--nl) {
- --psrc;
- --pdst;
- if (rop == RR_CLEAR)
- *pdst = 0;
- else
- getunalignedword(psrc, xoffSrc,
- *pdst);
- }
-
- if (startmask) {
- if (srcStartOver)
- --psrc;
- --pdst;
- getandputrop(psrc, (sx & 0x1f),
- (dx & 0x1f), nstart, pdst, rop);
- }
-
- pdstLine += width;
- psrcLine += width;
- }
- }
- }
-
- return (0);
-}
diff --git a/sys/arch/hp300/dev/diofbreg.h b/sys/arch/hp300/dev/diofbreg.h
deleted file mode 100644
index 3df02c729e6..00000000000
--- a/sys/arch/hp300/dev/diofbreg.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* $OpenBSD: diofbreg.h,v 1.4 2011/08/18 20:02:57 miod Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grfreg.h 1.6 92/01/31$
- *
- * @(#)grfreg.h 8.1 (Berkeley) 6/10/93
- */
-
-/* 300 bitmapped display hardware primary id */
-#define GRFHWID 0x39
-
-/* 300 internal bitmapped display address */
-#define GRFIADDR 0x560000
-
-/* 300 hardware secondary ids - XXX duplicates some diodevs.h values */
-#define GID_GATORBOX 0x01
-#define GID_TOPCAT 0x02
-#define GID_RENAISSANCE 0x04
-#define GID_LRCATSEYE 0x05
-#define GID_HRCCATSEYE 0x06
-#define GID_HRMCATSEYE 0x07
-#define GID_DAVINCI 0x08
-#define GID_XXXCATSEYE 0x09
-#define GID_XGENESIS 0x0b
-#define GID_TIGER 0x0c
-#define GID_YGENESIS 0x0d
-#define GID_HYPERION 0x0e
-#define GID_FB3X2_A 0x10
-#define GID_FB3X2_B 0x11
-
-#ifndef _LOCORE
-struct diofbreg {
- u_int8_t :8;
- u_int8_t id; /* id and reset register 0x01 */
- u_int8_t sec_interrupt; /* secondary interrupt register 0x02 */
- u_int8_t interrupt; /* interrupt register 0x03 */
- u_int8_t :8;
- u_int8_t fbwmsb; /* frame buffer width MSB 0x05 */
- u_int8_t :8;
- u_int8_t fbwlsb; /* frame buffer height LSB 0x07 */
- u_int8_t :8;
- u_int8_t fbhmsb; /* frame buffer height MSB 0x09 */
- u_int8_t :8;
- u_int8_t fbhlsb; /* frame buffer height LSB 0x0b */
- u_int8_t :8;
- u_int8_t dwmsb; /* display width MSB 0x0d */
- u_int8_t :8;
- u_int8_t dwlsb; /* display width LSB 0x0f */
- u_int8_t :8;
- u_int8_t dhmsb; /* display height MSB 0x11 */
- u_int8_t :8;
- u_int8_t dhlsb; /* display height LSB 0x13 */
- u_int8_t :8;
- u_int8_t fbid; /* frame buffer id 0x15 */
- u_int8_t pad2[0x45];
- u_int8_t num_planes; /* number of color planes 0x5b */
- u_int8_t :8;
- u_int8_t fbomsb; /* frame buffer offset MSB 0x5d */
- u_int8_t :8;
- u_int8_t fbolsb; /* frame buffer offset LSB 0x5f */
-};
-#endif
diff --git a/sys/arch/hp300/dev/diofbvar.h b/sys/arch/hp300/dev/diofbvar.h
deleted file mode 100644
index 8f1471450b5..00000000000
--- a/sys/arch/hp300/dev/diofbvar.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/* $OpenBSD: diofbvar.h,v 1.11 2013/10/21 10:36:12 miod Exp $ */
-
-/*
- * Copyright (c) 2005, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifdef _KERNEL
-
-struct diocmap {
- u_int8_t r[256], g[256], b[256];
-};
-
-/*
- * Minimal frame buffer state structure.
- */
-struct diofb {
- caddr_t regkva; /* KVA of registers */
- caddr_t fbkva; /* KVA of framebuffer */
-
- caddr_t regaddr; /* control registers physaddr */
- caddr_t fbaddr; /* frame buffer physaddr */
-
- u_int fbsize; /* frame buffer size */
- u_int fbwidth; /* frame buffer width */
- u_int fbheight; /* frame buffer height */
- u_int dwidth; /* displayed part width */
- u_int dheight; /* displayed part height */
-
- u_int planes; /* number of planes */
- u_int planemask; /* and related mask */
-
- /* rasops information */
- struct rasops_info ri;
-
- /* color information */
- struct diocmap cmap;
-
- /* wsdisplay information */
- struct wsscreen_descr wsd;
- struct wsscreen_list wsl;
- struct wsscreen_descr *scrlist[1];
- int nscreens;
- u_int mapmode;
-
- /* blockmove routine */
- int (*bmv)(struct diofb *, u_int16_t, u_int16_t, u_int16_t,
- u_int16_t, u_int16_t, u_int16_t, int16_t, int16_t);
-};
-
-/* Replacement Rules (rops) */
-#define RR_CLEAR 0x0
-#define RR_COPY 0x3
-#define RR_XOR 0x6
-#define RR_INVERT 0xa
-#define RR_COPYINVERTED 0xc
-
-void diofb_cnattach(struct diofb *);
-void diofb_end_attach(void *, struct wsdisplay_accessops *, struct diofb *,
- int, const char *);
-int diofb_fbinquire(struct diofb *, int, struct diofbreg *);
-void diofb_fbsetup(struct diofb *);
-int diofb_getcmap(struct diofb *, struct wsdisplay_cmap *);
-void diofb_resetcmap(struct diofb *);
-
-int diofb_alloc_attr(void *, int, int, int, long *);
-int diofb_alloc_screen(void *, const struct wsscreen_descr *, void **,
- int *, int *, long *);
-void diofb_free_screen(void *, void *);
-paddr_t diofb_mmap(void *, off_t, int);
-int diofb_show_screen(void *, void *, int, void (*)(void *, int, int),
- void *);
-int diofb_load_font(void *, void *, struct wsdisplay_font *);
-int diofb_list_font(void *, struct wsdisplay_font *);
-
-int diofb_mono_windowmove(struct diofb *, u_int16_t, u_int16_t, u_int16_t,
- u_int16_t, u_int16_t, u_int16_t, int16_t, int16_t);
-
-/* Console support */
-void dvboxcninit(void);
-void gboxcninit(void);
-void hypercninit(void);
-void rboxcninit(void);
-void topcatcninit(void);
-void tvrxcninit(void);
-extern struct diofb diofb_cn; /* struct diofb for console device */
-
-#endif
-
-/*
- * In mapped mode, mmap() will provide the following layout:
- * 0 - (DIOFB_REGSPACE - 1) frame buffer registers
- * DIOFB_REGSPACE onwards frame buffer memory
- */
-#define DIOFB_REGSPACE 0x020000
diff --git a/sys/arch/hp300/dev/dioreg.h b/sys/arch/hp300/dev/dioreg.h
deleted file mode 100644
index f481593d169..00000000000
--- a/sys/arch/hp300/dev/dioreg.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/* $OpenBSD: dioreg.h,v 1.7 2011/08/18 19:55:43 miod Exp $ */
-/* $NetBSD: dioreg.h,v 1.3 1997/01/30 09:18:40 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Portions of this file are derived from software contributed to Berkeley
- * by the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Register definitions for the DIO and DIO-II bus.
- */
-
-/*
- * DIO/DIO-II device registers, offsets from base of device. All
- * registers are 8-bit.
- */
-#define DIO_IDOFF 0x01 /* primary device id */
-#define DIO_IPLOFF 0x03 /* interrupt level */
-#define DIO_SECIDOFF 0x15 /* secondary device id */
-#define DIOII_SIZEOFF 0x101 /* device size */
-
-/*
- * System physical addresses of some `special' DIO devices.
- */
-#define DIO_IHPIBADDR 0x478000 /* internal HP-IB; select code 7 */
-
-/*
- * DIO ranges from select codes 0-31 at physical addresses given by:
- * 0x600000 + sc * 0x10000
- * DIO cards are addressed in the range 0-31 [0x600000-0x800000) for
- * their control space and the remaining areas, [0x200000-0x400000) and
- * [0x800000-0x1000000), are for additional space required by a card;
- * e.g. a display framebuffer.
- *
- * DIO-II ranges from select codes 132-255 at physical addresses given by:
- * 0x1000000 + (sc - 132) * 0x400000
- * The address range of DIO-II space is thus [0x1000000-0x20000000).
- *
- * DIO/DIO-II space is too large to map in its entirety, instead devices
- * are mapped into kernel virtual address space allocated from a range
- * of EIOMAPSIZE pages (vmparam.h) starting at ``extiobase''.
- */
-#define DIO_BASE 0x00600000 /* start of DIO space */
-#define DIO_END 0x01000000 /* end of DIO space */
-#define DIO_DEVSIZE 0x00010000 /* size of a DIO device */
-
-#define DIOII_BASE 0x01000000 /* start of DIO-II space */
-#define DIOII_END 0x20000000 /* end of DIO-II space */
-#define DIOII_DEVSIZE 0x00400000 /* size of a DIO-II scode */
-#define DIOII_DEVSIZE_UNIT 0x00100000 /* unit of DIO-II size */
-
-/*
- * Find the highest select code for a given machine; HP320 doesn't
- * have DIO-II.
- */
-#if defined(HP320)
-#define DIO_SCMAX(machineid) ((machineid) == HP_320 ? 32 : 256)
-#else
-#define DIO_SCMAX(machineid) 256
-#endif
-
-/*
- * Base of DIO-II select codes.
- */
-#define DIOII_SCBASE 132
-
-/*
- * Macros to determine if device is DIO or DIO-II.
- */
-#define DIO_ISDIO(scode) ((scode) >= 0 && (scode) < 32)
-#define DIO_ISDIOII(scode) ((scode) >= DIOII_SCBASE && (scode) < 256)
-
-/*
- * Macro to determine if device is a framebuffer, given the
- * primary id of the device. We key off this to determine if
- * we should look at secondary id and ignore interrupt level.
- */
-#define DIO_ISFRAMEBUFFER(id) \
- ((id) == DIO_DEVICE_ID_FRAMEBUFFER)
-
-/*
- * Macro to extract primary and secondary device ids, given
- * the base address of the device.
- */
-#define DIO_ID(base) \
- (*((u_int8_t *)((u_long)(base) + DIO_IDOFF)))
-#define DIO_SECID(base) \
- (*((u_int8_t *)((u_long)(base) + DIO_SECIDOFF)))
-
-/*
- * Macro to extract the interrupt level, given the
- * base address of the device.
- */
-#define DIO_IPL(base) \
- ((((*((u_int8_t *)((u_long)(base) + DIO_IPLOFF))) >> 4) & 0x03) + 3)
-
-/*
- * Macro to compute the size of a DIO-II device's address
- * space, given the base address of the device.
- */
-#define DIOII_SIZE(base) \
- ((int)((*((u_int8_t *)((u_long)(base) + DIOII_SIZEOFF)) + 1) \
- * DIOII_DEVSIZE_UNIT))
-
-/*
- * Given a select code and device base address, compute
- * the size of the DIO/DIO-II device.
- */
-#define DIO_SIZE(scode, base) \
- (DIO_ISDIOII((scode)) ? DIOII_SIZE((base)) : DIO_DEVSIZE)
diff --git a/sys/arch/hp300/dev/diovar.h b/sys/arch/hp300/dev/diovar.h
deleted file mode 100644
index 05d8e0900ef..00000000000
--- a/sys/arch/hp300/dev/diovar.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* $OpenBSD: diovar.h,v 1.8 2010/04/15 20:38:09 miod Exp $ */
-/* $NetBSD: diovar.h,v 1.3 1997/05/05 21:01:33 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Autoconfiguration definitions and prototypes for the DIO bus.
- */
-
-/*
- * Arguments used to attach a device to the DIO bus.
- */
-struct dio_attach_args {
- int da_scode; /* select code */
- int da_size; /* size of address space */
- u_int8_t da_id; /* primary device id */
- u_int8_t da_secid; /* secondary device id */
-};
-
-/*
- * This structure is used by the autoconfiguration code to lookup
- * the size of a DIO device (not all use one select code).
- */
-struct dio_devdata {
- u_int8_t dd_id; /* primary device id */
- u_int8_t dd_secid; /* secondary device id */
- int dd_nscode; /* number of select codes */
-};
-
-/*
- * This structure is used by the autoconfiguration code to print
- * a textual description of a device.
- */
-struct dio_devdesc {
- u_int8_t dd_id; /* primary device id */
- u_int8_t dd_secid; /* secondary device id */
- const char *dd_desc; /* description */
-};
-
-#define diocf_scode cf_loc[0]
-
-#define DIO_UNKNOWN_SCODE -1
-
-#ifdef _KERNEL
-void *dio_scodetopa(int);
-void dio_intr_establish(struct isr *, const char *);
-void dio_intr_disestablish(struct isr *);
-
-/*
- * Return the next select code if the given select code lies within a hole,
- * zero otherwise.
- */
-int dio_inhole(int);
-#endif /* _KERNEL */
diff --git a/sys/arch/hp300/dev/dma.c b/sys/arch/hp300/dev/dma.c
deleted file mode 100644
index 33a9551ba68..00000000000
--- a/sys/arch/hp300/dev/dma.c
+++ /dev/null
@@ -1,572 +0,0 @@
-/* $OpenBSD: dma.c,v 1.20 2008/10/15 19:12:19 blambert Exp $ */
-/* $NetBSD: dma.c,v 1.19 1997/05/05 21:02:39 thorpej Exp $ */
-
-/*
- * Copyright (c) 1995, 1996, 1997
- * Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)dma.c 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * DMA driver
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/time.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/device.h>
-#include <sys/timeout.h>
-
-#include <machine/frame.h>
-#include <machine/cpu.h>
-#include <machine/intr.h>
-
-#include <hp300/dev/dmareg.h>
-#include <hp300/dev/dmavar.h>
-
-#include <uvm/uvm_extern.h>
-
-/*
- * The largest single request will be MAXPHYS bytes which will require
- * at most MAXPHYS/NBPG+1 chain elements to describe, i.e. if none of
- * the buffer pages are physically contiguous (MAXPHYS/NBPG) and the
- * buffer is not page aligned (+1).
- */
-#define DMAMAXIO (MAXPHYS/NBPG+1)
-
-struct dma_chain {
- u_int dc_count;
- paddr_t dc_addr;
-};
-
-struct dma_channel {
- struct dmaqueue *dm_job; /* current job */
- struct dmadevice *dm_hwaddr; /* registers if DMA_C */
- struct dmaBdevice *dm_Bhwaddr; /* registers if not DMA_C */
- char dm_flags; /* misc. flags */
- u_short dm_cmd; /* DMA controller command */
- u_int dm_cur; /* current segment */
- u_int dm_last; /* last segment */
- struct dma_chain dm_chain[DMAMAXIO]; /* all segments */
-};
-
-struct dma_softc {
- struct dmareg *sc_dmareg; /* pointer to our hardware */
- struct isr sc_isr;
- struct dma_channel sc_chan[NDMACHAN]; /* 2 channels */
-#ifdef DEBUG
- struct timeout sc_timeout; /* DMA timeout */
-#endif
- TAILQ_HEAD(, dmaqueue) sc_queue; /* job queue */
- char sc_type; /* A, B, or C */
-} dma_softc;
-
-/* types */
-#define DMA_B 0
-#define DMA_C 1
-
-/* flags */
-#define DMAF_PCFLUSH 0x01
-#define DMAF_VCFLUSH 0x02
-#define DMAF_NOINTR 0x04
-
-void dmacflush(struct dma_channel *);
-int dmaintr(void *);
-
-#ifdef DEBUG
-int dmadebug = 0;
-#define DDB_WORD 0x01 /* same as DMAGO_WORD */
-#define DDB_LWORD 0x02 /* same as DMAGO_LWORD */
-#define DDB_FOLLOW 0x04
-#define DDB_IO 0x08
-
-void dmatimeout(void *);
-int dmatimo[NDMACHAN];
-
-long dmahits[NDMACHAN];
-long dmamisses[NDMACHAN];
-long dmabyte[NDMACHAN];
-long dmaword[NDMACHAN];
-long dmalword[NDMACHAN];
-#endif
-
-/*
- * Initialize the DMA engine, called by dioattach()
- */
-void
-dmainit()
-{
- struct dma_softc *sc = &dma_softc;
- struct dmareg *dma;
- struct dma_channel *dc;
- int i;
- char rev;
-
- /* There's just one. */
- sc->sc_dmareg = (struct dmareg *)DMA_BASE;
- dma = sc->sc_dmareg;
-
- /*
- * Determine the DMA type. A DMA_A or DMA_B will fail the
- * following probe.
- *
- * XXX Don't know how to easily differentiate the A and B cards,
- * so we just hope nobody has an A card (A cards will work if
- * splbio works out to ipl 3).
- */
- if (badbaddr((char *)&dma->dma_id[2])) {
- rev = 'B';
-#if !defined(HP320)
- panic("dmainit: DMA card requires hp320 support");
-#endif
- } else
- rev = dma->dma_id[2];
-
- sc->sc_type = (rev == 'B') ? DMA_B : DMA_C;
-
- TAILQ_INIT(&sc->sc_queue);
-
- for (i = 0; i < NDMACHAN; i++) {
- dc = &sc->sc_chan[i];
- dc->dm_job = NULL;
- switch (i) {
- case 0:
- dc->dm_hwaddr = &dma->dma_chan0;
- dc->dm_Bhwaddr = &dma->dma_Bchan0;
- break;
-
- case 1:
- dc->dm_hwaddr = &dma->dma_chan1;
- dc->dm_Bhwaddr = &dma->dma_Bchan1;
- break;
-
- default:
- panic("dmainit: more than 2 channels?");
- /* NOTREACHED */
- }
- }
-
-#ifdef DEBUG
- /* make sure timeout is really not needed */
- timeout_set(&sc->sc_timeout, dmatimeout, sc);
- timeout_add_sec(&sc->sc_timeout, 30);
-#endif
-
- printf("98620%c, 2 channels, %d bit DMA\n",
- rev, (rev == 'B') ? 16 : 32);
-
- /*
- * Defer hooking up our interrupt until the first
- * DMA-using controller has hooked up theirs.
- */
- sc->sc_isr.isr_func = NULL;
- sc->sc_isr.isr_arg = sc;
- sc->sc_isr.isr_priority = IPL_BIO;
-}
-
-/*
- * Compute the ipl and (re)establish the interrupt handler
- * for the DMA controller.
- */
-void
-dmacomputeipl()
-{
- struct dma_softc *sc = &dma_softc;
-
- if (sc->sc_isr.isr_func != NULL)
- intr_disestablish(&sc->sc_isr);
-
- /*
- * Our interrupt level must be as high as the highest
- * device using DMA (i.e. splbio).
- */
- sc->sc_isr.isr_ipl = PSLTOIPL(hp300_varpsl[IPL_BIO]);
-
- sc->sc_isr.isr_func = dmaintr;
- intr_establish(&sc->sc_isr, "dma");
-}
-
-int
-dmareq(struct dmaqueue *dq)
-{
- struct dma_softc *sc = &dma_softc;
- int i, chan, s;
-
- s = splvm();
-
- chan = dq->dq_chan;
- for (i = NDMACHAN - 1; i >= 0; i--) {
- /*
- * Can we use this channel?
- */
- if ((chan & (1 << i)) == 0)
- continue;
-
- /*
- * We can use it; is it busy?
- */
- if (sc->sc_chan[i].dm_job != NULL)
- continue;
-
- /*
- * Not busy; give the caller this channel.
- */
- sc->sc_chan[i].dm_job = dq;
- dq->dq_chan = i;
- splx(s);
- return (1);
- }
-
- /*
- * Couldn't get a channel now; put this in the queue.
- */
- TAILQ_INSERT_TAIL(&sc->sc_queue, dq, dq_list);
- splx(s);
- return (0);
-}
-
-void
-dmacflush(struct dma_channel *dc)
-{
-#if defined(CACHE_HAVE_PAC) || defined(M68040)
- if (dc->dm_flags & DMAF_PCFLUSH) {
- PCIA();
- dc->dm_flags &= ~DMAF_PCFLUSH;
- }
-#endif
-
-#if defined(CACHE_HAVE_VAC)
- if (dc->dm_flags & DMAF_VCFLUSH) {
- /*
- * 320/350s have VACs that may also need flushing.
- * In our case we only flush the supervisor side
- * because we know that if we are DMAing to user
- * space, the physical pages will also be mapped
- * in kernel space (via vmapbuf) and hence cache-
- * inhibited by the pmap module due to the multiple
- * mapping.
- */
- DCIS();
- dc->dm_flags &= ~DMAF_VCFLUSH;
- }
-#endif
-}
-
-void
-dmafree(struct dmaqueue *dq)
-{
- int unit = dq->dq_chan;
- struct dma_softc *sc = &dma_softc;
- struct dma_channel *dc = &sc->sc_chan[unit];
- struct dmaqueue *dn;
- int chan, s;
-
- s = splvm();
-
-#ifdef DEBUG
- dmatimo[unit] = 0;
-#endif
-
- DMA_CLEAR(dc);
-
- /*
- * XXX we may not always go through the flush code in dmastop()
- */
- dmacflush(dc);
-
- /*
- * Channel is now free. Look for another job to run on this
- * channel.
- */
- dc->dm_job = NULL;
- chan = 1 << unit;
- TAILQ_FOREACH(dn, &sc->sc_queue, dq_list) {
- if (dn->dq_chan & chan) {
- /* Found one... */
- TAILQ_REMOVE(&sc->sc_queue, dn, dq_list);
- dc->dm_job = dn;
- dn->dq_chan = dq->dq_chan;
- splx(s);
-
- /* Start the initiator. */
- (*dn->dq_start)(dn->dq_softc);
- return;
- }
- }
- splx(s);
-}
-
-void
-dmago(int unit, char *addr, u_int count, int flags)
-{
- struct dma_softc *sc = &dma_softc;
- struct dma_channel *dc = &sc->sc_chan[unit];
- paddr_t dmaend = 0;
- u_int seg, tcount;
-
-#ifdef DIAGNOSTIC
- if (count > MAXPHYS)
- panic("dmago: count > MAXPHYS");
-#endif
-
-#if defined(HP320)
- if (sc->sc_type == DMA_B && (flags & DMAGO_LWORD))
- panic("dmago: no can do 32-bit DMA");
-#endif
-
-#ifdef DEBUG
- if (dmadebug & DDB_FOLLOW)
- printf("dmago(%d, %p, %x, %x)\n",
- unit, addr, count, flags);
- if (flags & DMAGO_LWORD)
- dmalword[unit]++;
- else if (flags & DMAGO_WORD)
- dmaword[unit]++;
- else
- dmabyte[unit]++;
-#endif
- /*
- * Build the DMA chain
- */
- for (seg = 0; count > 0; seg++) {
- if (pmap_extract(pmap_kernel(), (vaddr_t)addr,
- &dc->dm_chain[seg].dc_addr) == FALSE)
- panic("dmago: pmap_extract(%x) failed", addr);
-#if defined(M68040)
- /*
- * Push back dirty cache lines
- */
- if (mmutype == MMU_68040)
- DCFP(dc->dm_chain[seg].dc_addr);
-#endif
- if (count < (tcount = PAGE_SIZE - ((int)addr & PAGE_MASK)))
- tcount = count;
- dc->dm_chain[seg].dc_count = tcount;
- addr += tcount;
- count -= tcount;
- if (flags & DMAGO_LWORD)
- tcount >>= 2;
- else if (flags & DMAGO_WORD)
- tcount >>= 1;
-
- /*
- * Try to compact the DMA transfer if the pages are adjacent.
- * Note: this will never happen on the first iteration.
- */
- if (dc->dm_chain[seg].dc_addr == dmaend
-#if defined(HP320)
- /* only 16-bit count on 98620B */
- && (sc->sc_type != DMA_B ||
- dc->dm_chain[seg - 1].dc_count + tcount <= 65536)
-#endif
- ) {
-#ifdef DEBUG
- dmahits[unit]++;
-#endif
- dmaend += dc->dm_chain[seg].dc_count;
- dc->dm_chain[--seg].dc_count += tcount;
- } else {
-#ifdef DEBUG
- dmamisses[unit]++;
-#endif
- dmaend = dc->dm_chain[seg].dc_addr +
- dc->dm_chain[seg].dc_count;
- dc->dm_chain[seg].dc_count = tcount;
- }
- }
- dc->dm_cur = 0;
- dc->dm_last = --seg;
- dc->dm_flags = 0;
- /*
- * Set up the command word based on flags
- */
- dc->dm_cmd = DMA_ENAB | DMA_IPL(sc->sc_isr.isr_ipl) | DMA_START;
- if ((flags & DMAGO_READ) == 0)
- dc->dm_cmd |= DMA_WRT;
- if (flags & DMAGO_LWORD)
- dc->dm_cmd |= DMA_LWORD;
- else if (flags & DMAGO_WORD)
- dc->dm_cmd |= DMA_WORD;
- if (flags & DMAGO_PRI)
- dc->dm_cmd |= DMA_PRI;
-
- if (flags & DMAGO_READ) {
-#if defined(M68040)
- /*
- * On the 68040 we need to flush (push) the data cache before a
- * DMA (already done above) and flush again after DMA completes.
- * In theory we should only need to flush prior to a write DMA
- * and purge after a read DMA but if the entire page is not
- * involved in the DMA we might purge some valid data.
- */
- if (mmutype == MMU_68040)
- dc->dm_flags |= DMAF_PCFLUSH;
-#endif
-
-#if defined(CACHE_HAVE_PAC)
- /*
- * Remember if we need to flush external physical cache when
- * DMA is done. We only do this if we are reading
- * (writing memory).
- */
- if (ectype == EC_PHYS)
- dc->dm_flags |= DMAF_PCFLUSH;
-#endif
-
-#if defined(CACHE_HAVE_VAC)
- if (ectype == EC_VIRT)
- dc->dm_flags |= DMAF_VCFLUSH;
-#endif
- }
-
- /*
- * Remember if we can skip the dma completion interrupt on
- * the last segment in the chain.
- */
- if (flags & DMAGO_NOINT) {
- if (dc->dm_cur == dc->dm_last)
- dc->dm_cmd &= ~DMA_ENAB;
- else
- dc->dm_flags |= DMAF_NOINTR;
- }
-#ifdef DEBUG
- if (dmadebug & DDB_IO) {
- if (((dmadebug&DDB_WORD) && (dc->dm_cmd&DMA_WORD)) ||
- ((dmadebug&DDB_LWORD) && (dc->dm_cmd&DMA_LWORD))) {
- printf("dmago: cmd %x, flags %x\n",
- dc->dm_cmd, dc->dm_flags);
- for (seg = 0; seg <= dc->dm_last; seg++)
- printf(" %d: %d@%p\n", seg,
- dc->dm_chain[seg].dc_count,
- dc->dm_chain[seg].dc_addr);
- }
- }
- dmatimo[unit] = 1;
-#endif
- DMA_ARM(sc, dc);
-}
-
-void
-dmastop(int unit)
-{
- struct dma_softc *sc = &dma_softc;
- struct dma_channel *dc = &sc->sc_chan[unit];
-
-#ifdef DEBUG
- if (dmadebug & DDB_FOLLOW)
- printf("dmastop(%d)\n", unit);
- dmatimo[unit] = 0;
-#endif
- DMA_CLEAR(dc);
-
- dmacflush(dc);
-
- /*
- * We may get this interrupt after a device service routine
- * has freed the dma channel. So, ignore the intr if there's
- * nothing on the queue.
- */
- if (dc->dm_job != NULL)
- (*dc->dm_job->dq_done)(dc->dm_job->dq_softc);
-}
-
-int
-dmaintr(void *arg)
-{
- struct dma_softc *sc = arg;
- struct dma_channel *dc;
- int i, stat;
- int found = 0;
-
-#ifdef DEBUG
- if (dmadebug & DDB_FOLLOW)
- printf("dmaintr\n");
-#endif
- for (i = 0; i < NDMACHAN; i++) {
- dc = &sc->sc_chan[i];
- stat = DMA_STAT(dc);
- if ((stat & DMA_INTR) == 0)
- continue;
- found++;
-#ifdef DEBUG
- if (dmadebug & DDB_IO) {
- if (((dmadebug&DDB_WORD) && (dc->dm_cmd&DMA_WORD)) ||
- ((dmadebug&DDB_LWORD) && (dc->dm_cmd&DMA_LWORD)))
- printf("dmaintr: flags %x unit %d stat %x next %d\n",
- dc->dm_flags, i, stat, dc->dm_cur + 1);
- }
- if (stat & DMA_ARMED)
- printf("dma channel %d: intr when armed\n", i);
-#endif
- /*
- * Load the next segment, or finish up if we're done.
- */
- dc->dm_cur++;
- if (dc->dm_cur <= dc->dm_last) {
-#ifdef DEBUG
- dmatimo[i] = 1;
-#endif
- /*
- * If we're the last segment, disable the
- * completion interrupt, if necessary.
- */
- if (dc->dm_cur == dc->dm_last &&
- (dc->dm_flags & DMAF_NOINTR))
- dc->dm_cmd &= ~DMA_ENAB;
- DMA_CLEAR(dc);
- DMA_ARM(sc, dc);
- } else
- dmastop(i);
- }
- return(found);
-}
-
-#ifdef DEBUG
-void
-dmatimeout(void *arg)
-{
- int i, s;
- struct dma_softc *sc = arg;
-
- for (i = 0; i < NDMACHAN; i++) {
- s = splvm();
- if (dmatimo[i]) {
- if (dmatimo[i] > 1)
- printf("dma channel %d timeout #%d\n",
- i, dmatimo[i]-1);
- dmatimo[i]++;
- }
- splx(s);
- }
- timeout_add_sec(&sc->sc_timeout, 30);
-}
-#endif
diff --git a/sys/arch/hp300/dev/dmareg.h b/sys/arch/hp300/dev/dmareg.h
deleted file mode 100644
index 3a5d68b2a77..00000000000
--- a/sys/arch/hp300/dev/dmareg.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/* $OpenBSD: dmareg.h,v 1.10 2013/02/02 13:34:29 miod Exp $ */
-/* $NetBSD: dmareg.h,v 1.12 1997/05/05 21:02:40 thorpej Exp $ */
-
-/*
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)dmareg.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <hp300/dev/iotypes.h> /* XXX */
-
-/*
- * Hardware layout for the 98620[ABC]:
- * 98620A (old 320s?): byte/word DMA in up to 64K chunks
- * 98620B (320s only): 98620A with programmable IPL
- * 98620C (all others): byte/word/longword DMA in up to 4Gb chunks
- */
-
-struct dmaBdevice {
- v_char *dmaB_addr;
- vu_short dmaB_count;
- vu_short dmaB_cmd;
-#define dmaB_stat dmaB_cmd
-} __packed;
-
-struct dmadevice {
- v_char *dma_addr;
- vu_int dma_count;
- vu_short dma_cmd;
- vu_short dma_stat;
-} __packed;
-
-struct dmareg {
- struct dmaBdevice dma_Bchan0;
- struct dmaBdevice dma_Bchan1;
-/* the rest are 98620C specific */
- v_char dma_id[4];
- vu_char dma_cr;
- char dma_pad1[0xEB];
- struct dmadevice dma_chan0;
- char dma_pad2[0xF4];
- struct dmadevice dma_chan1;
-} __packed;
-
-/* The hp300 has 2 DMA channels. */
-#define NDMACHAN 2
-
-/* addresses */
-#define DMA_BASE IIOV(0x500000)
-
-/* command bits */
-#define DMA_ENAB 0x0001
-#define DMA_WORD 0x0002
-#define DMA_WRT 0x0004
-#define DMA_PRI 0x0008
-#define DMA_IPL(x) (((x) - 3) << 4)
-#define DMA_LWORD 0x0100
-#define DMA_START 0x8000
-
-/* status bits */
-#define DMA_ARMED 0x01
-#define DMA_INTR 0x02
-#define DMA_ACC 0x04
-#define DMA_HALT 0x08
-#define DMA_BERR 0x10
-#define DMA_ALIGN 0x20
-#define DMA_WRAP 0x40
-
-#ifdef _KERNEL
-/*
- * Macros to attempt to hide the HW differences between the 98620B DMA
- * board and the 1TQ4-0401 DMA chip (68020C "board"). The latter
- * includes emulation registers for the former but you need to access
- * the "native-mode" registers directly in order to do 32-bit DMA.
- *
- * DMA_CLEAR: Clear interrupt on DMA board. We just use the
- * emulation registers on the 98620C as that is easiest.
- * DMA_STAT: Read status register. Again, we always read the
- * emulation register. Someday we might want to
- * look at the 98620C status to get the extended bits.
- * DMA_ARM: Load address, count and kick-off DMA.
- */
-#define DMA_CLEAR(dc) do { \
- v_int dmaclr; \
- dmaclr = (int)dc->dm_Bhwaddr->dmaB_addr; \
- } while (0);
-#define DMA_STAT(dc) dc->dm_Bhwaddr->dmaB_stat
-
-#if defined(HP320)
-#define DMA_ARM(sc, dc) \
- if (sc->sc_type == DMA_B) { \
- struct dmaBdevice *dma = dc->dm_Bhwaddr; \
- dma->dmaB_addr = (v_char *)dc->dm_chain[dc->dm_cur].dc_addr; \
- dma->dmaB_count = dc->dm_chain[dc->dm_cur].dc_count - 1; \
- dma->dmaB_cmd = dc->dm_cmd; \
- } else { \
- struct dmadevice *dma = dc->dm_hwaddr; \
- dma->dma_addr = (v_char *)dc->dm_chain[dc->dm_cur].dc_addr; \
- dma->dma_count = dc->dm_chain[dc->dm_cur].dc_count - 1; \
- dma->dma_cmd = dc->dm_cmd; \
- }
-#else
-#define DMA_ARM(sc, dc) \
- { \
- struct dmadevice *dma = dc->dm_hwaddr; \
- dma->dma_addr = (v_char *)dc->dm_chain[dc->dm_cur].dc_addr; \
- dma->dma_count = dc->dm_chain[dc->dm_cur].dc_count - 1; \
- dma->dma_cmd = dc->dm_cmd; \
- }
-#endif
-#endif
diff --git a/sys/arch/hp300/dev/dmavar.h b/sys/arch/hp300/dev/dmavar.h
deleted file mode 100644
index 5c42d90ce4d..00000000000
--- a/sys/arch/hp300/dev/dmavar.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* $OpenBSD: dmavar.h,v 1.7 2005/11/17 23:56:02 miod Exp $ */
-/* $NetBSD: dmavar.h,v 1.9 1997/04/01 03:10:59 scottr Exp $ */
-
-/*
- * Copyright (c) 1997 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)dmavar.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/queue.h>
-
-/* dmago flags */
-#define DMAGO_BYTE 0x00 /* do byte (8 bit) transfers */
-#define DMAGO_WORD 0x01 /* do word (16 bit) transfers */
-#define DMAGO_LWORD 0x02 /* do longword (32 bit) transfers */
-#define DMAGO_PRI 0x04 /* do "priority" DMA */
-#define DMAGO_READ 0x08 /* transfer is a read */
-#define DMAGO_NOINT 0x80 /* don't interrupt on completion */
-
-/* dma "controllers" (channels) */
-#define DMA0 0x1
-#define DMA1 0x2
-
-/*
- * A DMA queue entry. Initiator drivers each have one of these,
- * used to queue access to the DMA controller.
- */
-struct dmaqueue {
- TAILQ_ENTRY(dmaqueue) dq_list; /* entry on the queue */
- int dq_chan; /* OR of channels initiator can use */
- void *dq_softc; /* initiator's softc */
-
- /*
- * These functions are called to start the initiator when
- * it has been given the DMA controller, and to stop the
- * initiator when the DMA controller has stopped.
- */
- void (*dq_start)(void *);
- void (*dq_done)(void *);
-};
-
-#ifdef _KERNEL
-void dmainit(void);
-void dmago(int, char *, u_int, int);
-void dmastop(int);
-void dmafree(struct dmaqueue *);
-int dmareq(struct dmaqueue *);
-void dmacomputeipl(void);
-#endif /* _KERNEL */
diff --git a/sys/arch/hp300/dev/dnkbd.c b/sys/arch/hp300/dev/dnkbd.c
deleted file mode 100644
index 5f28644d2e9..00000000000
--- a/sys/arch/hp300/dev/dnkbd.c
+++ /dev/null
@@ -1,1063 +0,0 @@
-/* $OpenBSD: dnkbd.c,v 1.19 2014/01/26 17:48:07 miod Exp $ */
-
-/*
- * Copyright (c) 2005, Miodrag Vallat
- * Copyright (c) 1997 Michael Smith. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Driver for the Apollo Domain keyboard and mouse.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/ioctl.h>
-#include <sys/kernel.h>
-#include <sys/timeout.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-
-#include <dev/cons.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wskbdvar.h>
-#include <dev/wscons/wsksymdef.h>
-#include <dev/wscons/wsksymvar.h>
-#ifdef WSDISPLAY_COMPAT_RAWKBD
-#include <dev/wscons/wskbdraw.h>
-#endif
-#include "wsmouse.h"
-#if NWSMOUSE > 0
-#include <dev/wscons/wsmousevar.h>
-#endif
-
-#include <hp300/dev/apcireg.h>
-#include <hp300/dev/apcivar.h>
-#include <hp300/dev/dcareg.h>
-#include <hp300/dev/dnkbdmap.h>
-#include <hp300/dev/frodoreg.h>
-#include <hp300/dev/frodovar.h>
-
-#include "hilkbd.h"
-
-/*
- * Keyboard key codes
- */
-
-#define DNKEY_CAPSLOCK 0x7e
-#define DNKEY_REPEAT 0x7f
-#define DNKEY_RELEASE 0x80
-#define DNKEY_CHANNEL 0xff
-
-/*
- * Channels
- */
-
-#define DNCHANNEL_RESET 0x00
-#define DNCHANNEL_KBD 0x01
-#define DNCHANNEL_MOUSE 0x02
-
-/*
- * Keyboard modes
- */
-
-#define DNMODE_COOKED 0x00
-#define DNMODE_RAW 0x01
-
-/*
- * Keyboard commands
- */
-
-#define DNCMD_PREFIX 0xff
-#define DNCMD_COOKED DNMODE_COOKED
-#define DNCMD_RAW DNMODE_RAW
-#define DNCMD_IDENT_1 0x12
-#define DNCMD_IDENT_2 0x21
-
-/*
- * Bell commands
- */
-
-#define DNCMD_BELL 0x21
-#define DNCMD_BELL_ON 0x81
-#define DNCMD_BELL_OFF 0x82
-
-/*
- * Mouse status
- */
-
-#define DNBUTTON_L 0x10
-#define DNBUTTON_R 0x20
-#define DNBUTTON_M 0x40
-
-struct dnkbd_softc {
- struct device sc_dev;
- struct isr sc_isr;
- struct apciregs *sc_regs;
-
- int sc_flags;
-#define SF_ENABLED 0x01 /* keyboard enabled */
-#define SF_CONSOLE 0x02 /* keyboard is console */
-#define SF_POLLING 0x04 /* polling mode */
-#define SF_PLUGGED 0x08 /* keyboard has been seen plugged */
-#define SF_ATTACHED 0x10 /* subdevices have been attached */
-#define SF_MOUSE 0x20 /* mouse enabled */
-#define SF_BELL 0x40 /* bell is active */
-#define SF_BELL_TMO 0x80 /* bell stop timeout is scheduled */
-
- u_int sc_identlen;
-#define MAX_IDENTLEN 32
- char sc_ident[MAX_IDENTLEN];
- kbd_t sc_layout;
-
- enum { STATE_KEYBOARD, STATE_MOUSE, STATE_CHANNEL, STATE_ECHO }
- sc_state, sc_prevstate;
- u_int sc_echolen;
-
- u_int8_t sc_mousepkt[3]; /* mouse packet being constructed */
- u_int sc_mousepos; /* index in above */
-
- struct timeout sc_bellstop_tmo;
-
- struct device *sc_wskbddev;
-#if NWSMOUSE > 0
- struct device *sc_wsmousedev;
-#endif
-
-#ifdef WSDISPLAY_COMPAT_RAWKBD
- int sc_rawkbd;
-#endif
-};
-
-int dnkbd_match(struct device *, void *, void *);
-void dnkbd_attach(struct device *, struct device *, void *);
-
-struct cfdriver dnkbd_cd = {
- NULL, "dnkbd", DV_DULL
-};
-
-struct cfattach dnkbd_ca = {
- sizeof(struct dnkbd_softc), dnkbd_match, dnkbd_attach
-};
-
-int dnkbd_enable(void *, int);
-void dnkbd_set_leds(void *, int);
-int dnkbd_ioctl(void *, u_long, caddr_t, int, struct proc *);
-
-const struct wskbd_accessops dnkbd_accessops = {
- dnkbd_enable,
- dnkbd_set_leds,
- dnkbd_ioctl
-};
-
-#if NWSMOUSE > 0
-int dnmouse_enable(void *);
-int dnmouse_ioctl(void *, u_long, caddr_t, int, struct proc *);
-void dnmouse_disable(void *);
-
-const struct wsmouse_accessops dnmouse_accessops = {
- dnmouse_enable,
- dnmouse_ioctl,
- dnmouse_disable
-};
-#endif
-
-void dnkbd_bell(void *, u_int, u_int, u_int);
-void dnkbd_cngetc(void *, u_int *, int *);
-void dnkbd_cnpollc(void *, int);
-
-const struct wskbd_consops dnkbd_consops = {
- dnkbd_cngetc,
- dnkbd_cnpollc,
- dnkbd_bell
-};
-
-struct wskbd_mapdata dnkbd_keymapdata = {
- dnkbd_keydesctab,
-#ifdef DNKBD_LAYOUT
- DNKBD_LAYOUT
-#else
- KB_US | KB_DEFAULT
-#endif
-};
-
-typedef enum { EVENT_NONE, EVENT_KEYBOARD, EVENT_MOUSE } dnevent;
-
-void dnevent_kbd(struct dnkbd_softc *, int);
-void dnevent_kbd_internal(struct dnkbd_softc *, int);
-void dnevent_mouse(struct dnkbd_softc *, u_int8_t *);
-void dnkbd_attach_subdevices(struct dnkbd_softc *);
-void dnkbd_bellstop(void *);
-void dnkbd_decode(int, u_int *, int *);
-int dnkbd_init(struct apciregs *);
-dnevent dnkbd_input(struct dnkbd_softc *, int);
-int dnkbd_intr(void *);
-int dnkbd_pollin(struct apciregs *, u_int);
-int dnkbd_pollout(struct apciregs *, int);
-int dnkbd_probe(struct dnkbd_softc *);
-int dnkbd_send(struct apciregs *, const u_int8_t *, size_t);
-int dnsubmatch_kbd(struct device *, void *, void *);
-int dnsubmatch_mouse(struct device *, void *, void *);
-
-int
-dnkbd_match(struct device *parent, void *match, void *aux)
-{
- struct frodo_attach_args *fa = aux;
-
- if (strcmp(fa->fa_name, dnkbd_cd.cd_name) != 0)
- return (0);
-
- /* only attach to the first frodo port */
- return (fa->fa_offset == FRODO_APCI_OFFSET(0));
-}
-
-void
-dnkbd_attach(struct device *parent, struct device *self, void *aux)
-{
- struct dnkbd_softc *sc = (struct dnkbd_softc *)self;
- struct frodo_attach_args *fa = aux;
-
- printf(": ");
-
- sc->sc_regs = (struct apciregs *)IIOV(FRODO_BASE + fa->fa_offset);
-
- timeout_set(&sc->sc_bellstop_tmo, dnkbd_bellstop, sc);
-
- /* reset the port */
- apciinit(sc->sc_regs, 1200, CFCR_8BITS | CFCR_PEVEN | CFCR_PENAB);
-
- sc->sc_isr.isr_func = dnkbd_intr;
- sc->sc_isr.isr_arg = sc;
- sc->sc_isr.isr_priority = IPL_TTY;
- frodo_intr_establish(parent, fa->fa_line, &sc->sc_isr, self->dv_xname);
-
- /* probe for keyboard */
- if (dnkbd_probe(sc) != 0) {
- printf("no keyboard\n");
- return;
- }
-
- dnkbd_attach_subdevices(sc);
-}
-
-void
-dnkbd_attach_subdevices(struct dnkbd_softc *sc)
-{
- struct wskbddev_attach_args ka;
-#if NWSMOUSE > 0
- struct wsmousedev_attach_args ma;
-#endif
-#if NHILKBD > 0
- extern int hil_is_console;
-#endif
- extern struct consdev wsdisplay_cons;
-
- /*
- * If both hilkbd and dnkbd are configured, prefer the Domain
- * keyboard as console (if we are here, we know the keyboard is
- * plugged), unless the console keyboard has been claimed already
- * (i.e. late hotplug with hil keyboard plugged first).
- */
- if (cn_tab == &wsdisplay_cons) {
-#if NHILKBD > 0
- if (hil_is_console == -1) {
- ka.console = 1;
- hil_is_console = 0;
- } else
- ka.console = 0;
-#else
- ka.console = 1;
-#endif
- } else
- ka.console = 0;
-
- ka.keymap = &dnkbd_keymapdata;
- ka.accessops = &dnkbd_accessops;
- ka.accesscookie = sc;
-#ifndef DKKBD_LAYOUT
- dnkbd_keymapdata.layout = sc->sc_layout;
-#endif
-
- if (ka.console) {
- sc->sc_flags = SF_PLUGGED | SF_CONSOLE | SF_ENABLED;
- wskbd_cnattach(&dnkbd_consops, sc, &dnkbd_keymapdata);
- } else {
- sc->sc_flags = SF_PLUGGED;
- }
-
- sc->sc_wskbddev = config_found_sm(&sc->sc_dev, &ka, wskbddevprint,
- dnsubmatch_kbd);
-
-#if NWSMOUSE > 0
- ma.accessops = &dnmouse_accessops;
- ma.accesscookie = sc;
-
- sc->sc_wsmousedev = config_found_sm(&sc->sc_dev, &ma, wsmousedevprint,
- dnsubmatch_mouse);
-#endif
-
- SET(sc->sc_flags, SF_ATTACHED);
-}
-
-int
-dnsubmatch_kbd(struct device *parent, void *match, void *aux)
-{
- struct cfdata *cf = match;
- extern struct cfdriver wskbd_cd;
-
- if (strcmp(cf->cf_driver->cd_name, wskbd_cd.cd_name) != 0)
- return (0);
-
- return ((*cf->cf_attach->ca_match)(parent, cf, aux));
-}
-
-#if NWSMOUSE > 0
-int
-dnsubmatch_mouse(struct device *parent, void *match, void *aux)
-{
- struct cfdata *cf = match;
- extern struct cfdriver wsmouse_cd;
-
- if (strcmp(cf->cf_driver->cd_name, wsmouse_cd.cd_name) != 0)
- return (0);
-
- return ((*cf->cf_attach->ca_match)(parent, cf, aux));
-}
-#endif
-
-int
-dnkbd_probe(struct dnkbd_softc *sc)
-{
- int dat, rc, flags;
- u_int8_t cmdbuf[2];
- char rspbuf[MAX_IDENTLEN], *word, *end;
- u_int i;
- int s;
-
- s = spltty();
- flags = sc->sc_flags;
- SET(sc->sc_flags, SF_POLLING);
- sc->sc_state = STATE_CHANNEL;
- splx(s);
-
- /*
- * Switch keyboard to raw mode.
- */
- cmdbuf[0] = DNCMD_RAW;
- rc = dnkbd_send(sc->sc_regs, cmdbuf, 1);
- if (rc != 0)
- goto out;
-
- /*
- * Send the identify command.
- */
- cmdbuf[0] = DNCMD_IDENT_1;
- cmdbuf[1] = DNCMD_IDENT_2;
- rc = dnkbd_send(sc->sc_regs, cmdbuf, 2);
- if (rc != 0)
- goto out;
-
- for (i = 0; ; i++) {
- dat = dnkbd_pollin(sc->sc_regs, 10000);
- if (dat == -1)
- break;
-
- if (i < sizeof(rspbuf))
- rspbuf[i] = dat;
- }
-
- if (i > sizeof(rspbuf) || i == 0) {
- printf("%s: unexpected identify string length %d\n",
- sc->sc_dev.dv_xname, i);
- rc = ENXIO;
- goto out;
- }
-
- /*
- * Make sure the identification string is NULL terminated
- * (overwriting the keyboard mode byte if necessary).
- */
- i--;
- if (rspbuf[i] != 0)
- rspbuf[i] = 0;
-
- /*
- * Now display the identification strings, if they changed.
- */
- if (i != sc->sc_identlen || bcmp(rspbuf, sc->sc_ident, i) != 0) {
- sc->sc_layout = KB_US;
- sc->sc_identlen = i;
- bcopy(rspbuf, sc->sc_ident, i);
-
- if (cold == 0)
- printf("%s: ", sc->sc_dev.dv_xname);
- printf("model ");
- word = rspbuf;
- for (i = 0; i < 3; i++) {
- end = strchr(word, '\r');
- if (end == NULL)
- break;
- *end++ = '\0';
- printf("<%s> ", word);
- /*
- * Parse the layout code if applicable
- */
- if (i == 1 && *word++ == '3') {
- if (*word == '-')
- word++;
- switch (*word) {
-#if 0
- default:
- case ' ':
- sc->sc_layout = KB_US;
- break;
-#endif
- case 'a':
- sc->sc_layout = KB_DE;
- break;
- case 'b':
- sc->sc_layout = KB_FR;
- break;
- case 'c':
- sc->sc_layout = KB_DK;
- break;
- case 'd':
- sc->sc_layout = KB_SV;
- break;
- case 'e':
- sc->sc_layout = KB_UK;
- break;
- case 'f':
- sc->sc_layout = KB_JP;
- break;
- case 'g':
- sc->sc_layout = KB_SG;
- break;
- }
- }
- word = end;
- }
- printf("\n");
- }
-
- /*
- * Ready to work, the default channel is the keyboard.
- */
- sc->sc_state = STATE_KEYBOARD;
-
-out:
- s = spltty();
- sc->sc_flags = flags;
- splx(s);
-
- return (rc);
-}
-
-/*
- * State machine.
- *
- * In raw mode, the keyboard may feed us the following sequences:
- * - on the keyboard channel:
- * + a raw key code, in the range 0x01-0x7e, or'ed with 0x80 if key release.
- * + the key repeat sequence 0x7f.
- * - on the mouse channel:
- * + a 3 byte mouse sequence (buttons state, dx move, dy move).
- * - at any time:
- * + a 2 byte channel sequence (0xff followed by the channel number) telling
- * us which device the following input will come from.
- * + if we get 0xff but an invalid channel number, this is a command echo.
- * Currently we only handle this for bell commands, which size are known.
- * Other commands are issued through dnkbd_send() which ``eats'' the echo.
- *
- * Older keyboards reset the channel to the keyboard (by sending ff 01) after
- * every mouse packet.
- */
-
-dnevent
-dnkbd_input(struct dnkbd_softc *sc, int dat)
-{
- dnevent event = EVENT_NONE;
-
- switch (sc->sc_state) {
- case STATE_KEYBOARD:
- switch (dat) {
- case DNKEY_REPEAT:
- /*
- * We ignore event repeats, as wskbd does its own
- * soft repeat processing.
- */
- break;
- case DNKEY_CHANNEL:
- sc->sc_prevstate = sc->sc_state;
- sc->sc_state = STATE_CHANNEL;
- break;
- default:
- event = EVENT_KEYBOARD;
- break;
- }
- break;
-
- case STATE_MOUSE:
- if (dat == DNKEY_CHANNEL && sc->sc_mousepos == 0) {
- sc->sc_prevstate = sc->sc_state;
- sc->sc_state = STATE_CHANNEL;
- } else {
- sc->sc_mousepkt[sc->sc_mousepos++] = dat;
- if (sc->sc_mousepos == sizeof(sc->sc_mousepkt)) {
- sc->sc_mousepos = 0;
- event = EVENT_MOUSE;
- }
- }
- break;
-
- case STATE_CHANNEL:
- switch (dat) {
- case DNKEY_CHANNEL:
- /*
- * During hotplug, we might get spurious 0xff bytes.
- * Ignore them.
- */
- break;
- case DNCHANNEL_RESET:
- /*
- * Identify the keyboard again. This will switch it to
- * raw mode again. If this fails, we'll consider the
- * keyboard as unplugged (to ignore further events until
- * a successful reset).
- */
- if (dnkbd_probe(sc) == 0) {
- /*
- * We need to attach wskbd and wsmouse children
- * if this is a live first plug.
- */
- if (!ISSET(sc->sc_flags, SF_ATTACHED))
- dnkbd_attach_subdevices(sc);
- SET(sc->sc_flags, SF_PLUGGED);
- } else {
- CLR(sc->sc_flags, SF_PLUGGED);
- }
-
- sc->sc_state = STATE_KEYBOARD;
- break;
- case DNCHANNEL_KBD:
- sc->sc_state = STATE_KEYBOARD;
- break;
- case DNCHANNEL_MOUSE:
- sc->sc_state = STATE_MOUSE;
- sc->sc_mousepos = 0; /* just in case */
- break;
- case DNCMD_BELL:
- /*
- * We are getting a bell command echoed to us.
- * Ignore it.
- */
- sc->sc_state = STATE_ECHO;
- sc->sc_echolen = 1; /* one byte to follow */
- break;
- default:
- printf("%s: unexpected channel byte %02x\n",
- sc->sc_dev.dv_xname, dat);
- break;
- }
- break;
-
- case STATE_ECHO:
- if (--sc->sc_echolen == 0) {
- /* get back to the state we were in before the echo */
- sc->sc_state = sc->sc_prevstate;
- }
- break;
- }
-
- return (event);
-}
-
-/*
- * Event breakers.
- */
-
-void
-dnkbd_decode(int keycode, u_int *type, int *key)
-{
- *type = (keycode & DNKEY_RELEASE) ?
- WSCONS_EVENT_KEY_UP : WSCONS_EVENT_KEY_DOWN;
- *key = (keycode & ~DNKEY_RELEASE);
-}
-
-void
-dnevent_kbd(struct dnkbd_softc *sc, int dat)
-{
- if (!ISSET(sc->sc_flags, SF_PLUGGED))
- return;
-
- if (sc->sc_wskbddev == NULL)
- return;
-
- if (!ISSET(sc->sc_flags, SF_ENABLED))
- return;
-
- /*
- * Even in raw mode, the caps lock key is treated specially:
- * first key press causes event 0x7e, release causes no event;
- * then a new key press causes nothing, and release causes
- * event 0xfe. Moreover, while kept down, it does not produce
- * repeat events.
- *
- * So the best we can do is fake the missed events, but this
- * will not allow the capslock key to be remapped as a control
- * key since it will not be possible to chord it with anything.
- */
- dnevent_kbd_internal(sc, dat);
- if ((dat & ~DNKEY_RELEASE) == DNKEY_CAPSLOCK)
- dnevent_kbd_internal(sc, dat ^ DNKEY_RELEASE);
-}
-
-void
-dnevent_kbd_internal(struct dnkbd_softc *sc, int dat)
-{
- u_int type;
- int key;
- int s;
-
- dnkbd_decode(dat, &type, &key);
-
-#ifdef WSDISPLAY_COMPAT_RAWKBD
- if (sc->sc_rawkbd) {
- u_char cbuf[2];
- int c, j = 0;
-
- c = dnkbd_raw[key];
- if (c != RAWKEY_Null) {
- /* fake extended scancode if necessary */
- if (c & 0x80)
- cbuf[j++] = 0xe0;
- cbuf[j] = c & 0x7f;
- if (type == WSCONS_EVENT_KEY_UP)
- cbuf[j] |= 0x80;
- j++;
-
- s = spltty();
- wskbd_rawinput(sc->sc_wskbddev, cbuf, j);
- splx(s);
- }
- } else
-#endif
- {
- s = spltty();
- wskbd_input(sc->sc_wskbddev, type, key);
- splx(s);
- }
-}
-
-#if NWSMOUSE > 0
-void
-dnevent_mouse(struct dnkbd_softc *sc, u_int8_t *dat)
-{
- if (!ISSET(sc->sc_flags, SF_PLUGGED))
- return;
-
- if (sc->sc_wsmousedev == NULL)
- return;
-
- if (!ISSET(sc->sc_flags, SF_MOUSE))
- return;
-
- /*
- * First byte is button status. It has the 0x80 bit always set, and
- * the next 3 bits are *cleared* when the mouse buttons are pressed.
- */
-#ifdef DEBUG
- if (!ISSET(*dat, 0x80)) {
- printf("%s: incorrect mouse packet %02x %02x %02x\n",
- sc->sc_dev.dv_xname, dat[0], dat[1], dat[2]);
- return;
- }
-#endif
-
- wsmouse_input(sc->sc_wsmousedev,
- (~dat[0] & (DNBUTTON_L | DNBUTTON_M | DNBUTTON_R)) >> 4,
- (int8_t)dat[1], (int8_t)dat[2], 0, 0, WSMOUSE_INPUT_DELTA);
-}
-#endif
-
-/*
- * Low-level communication routines.
- */
-
-int
-dnkbd_pollin(struct apciregs *apci, u_int tries)
-{
- u_int cnt;
-
- for (cnt = tries; cnt != 0; cnt--) {
- if (apci->ap_lsr & LSR_RXRDY)
- break;
- DELAY(10);
- }
-
- if (cnt == 0)
- return (-1);
- else
- return ((int)apci->ap_data);
-}
-
-int
-dnkbd_pollout(struct apciregs *apci, int dat)
-{
- u_int cnt;
-
- for (cnt = 10000; cnt != 0; cnt--) {
- if (apci->ap_lsr & LSR_TXRDY)
- break;
- DELAY(10);
- }
- if (cnt == 0)
- return (EBUSY);
- else {
- apci->ap_data = dat;
- return (0);
- }
-}
-
-int
-dnkbd_send(struct apciregs *apci, const u_int8_t *cmdbuf, size_t cmdlen)
-{
- int cnt, rc, dat;
- u_int cmdpos;
-
- /* drain rxfifo */
- for (cnt = 10; cnt != 0; cnt--) {
- if (dnkbd_pollin(apci, 10) == -1)
- break;
- }
- if (cnt == 0)
- return (EBUSY);
-
- /* send command escape */
- if ((rc = dnkbd_pollout(apci, DNCMD_PREFIX)) != 0)
- return (rc);
-
- /* send command buffer */
- for (cmdpos = 0; cmdpos < cmdlen; cmdpos++) {
- if ((rc = dnkbd_pollout(apci, cmdbuf[cmdpos])) != 0)
- return (rc);
- }
-
- /* wait for command echo */
- do {
- dat = dnkbd_pollin(apci, 10000);
- if (dat == -1)
- return (EIO);
- } while (dat != DNCMD_PREFIX);
-
- for (cmdpos = 0; cmdpos < cmdlen; cmdpos++) {
- dat = dnkbd_pollin(apci, 10000);
- if (dat != cmdbuf[cmdpos])
- return (EIO);
- }
-
- return (0);
-}
-
-int
-dnkbd_intr(void *v)
-{
- struct dnkbd_softc *sc = v;
- struct apciregs *apci = sc->sc_regs;
- u_int8_t iir, lsr, c;
- int claimed = 0;
-
- for (;;) {
- iir = apci->ap_iir;
-
- switch (iir & IIR_IMASK) {
- case IIR_RLS:
- /*
- * Line status change. This should never happen,
- * so silently ack the interrupt.
- */
- c = apci->ap_lsr;
- break;
-
- case IIR_RXRDY:
- case IIR_RXTOUT:
- /*
- * Data available. We process it byte by byte,
- * unless we are doing polling work...
- */
- if (ISSET(sc->sc_flags, SF_POLLING)) {
- return (1);
- }
-
- for (;;) {
- c = apci->ap_data;
- switch (dnkbd_input(sc, c)) {
- case EVENT_KEYBOARD:
- dnevent_kbd(sc, c);
- break;
-#if NWSMOUSE > 0
- case EVENT_MOUSE:
- dnevent_mouse(sc, sc->sc_mousepkt);
- break;
-#endif
- default: /* appease gcc */
- break;
- }
- lsr = apci->ap_lsr & LSR_RCV_MASK;
- if (lsr == 0)
- break;
- else if (lsr != LSR_RXRDY) {
- /* ignore error */
- break;
- }
- }
- break;
-
- case IIR_TXRDY:
- /*
- * Transmit available. Since we do all our commands
- * in polling mode, we do not need to do anything here.
- */
- break;
-
- default:
- if (iir & IIR_NOPEND)
- return (claimed);
- /* FALLTHROUGH */
-
- case IIR_MLSC:
- /*
- * Modem status change. This should never happen,
- * so silently ack the interrupt.
- */
- c = apci->ap_msr;
- break;
- }
-
- claimed = 1;
- }
-}
-
-/*
- * Wskbd callbacks
- */
-
-int
-dnkbd_enable(void *v, int on)
-{
- struct dnkbd_softc *sc = v;
-
- if (on) {
- if (ISSET(sc->sc_flags, SF_ENABLED))
- return (EBUSY);
- SET(sc->sc_flags, SF_ENABLED);
- } else {
- if (ISSET(sc->sc_flags, SF_CONSOLE))
- return (EBUSY);
- CLR(sc->sc_flags, SF_ENABLED);
- }
-
- return (0);
-}
-
-void
-dnkbd_set_leds(void *v, int leds)
-{
- /*
- * Not supported. There is only one LED on this keyboard, and
- * is hardware tied to the caps lock key.
- */
-}
-
-int
-dnkbd_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
-{
-#ifdef WSDISPLAY_COMPAT_RAWKBD
- struct dnkbd_softc *sc = v;
-#endif
-
- switch (cmd) {
- case WSKBDIO_GTYPE:
- *(int *)data = WSKBD_TYPE_DOMAIN;
- return (0);
- case WSKBDIO_SETLEDS:
- return (ENXIO);
- case WSKBDIO_GETLEDS:
- *(int *)data = 0;
- return (0);
- case WSKBDIO_COMPLEXBELL:
-#define d ((struct wskbd_bell_data *)data)
- dnkbd_bell(v, d->period, d->pitch, d->volume);
-#undef d
- return (0);
-#ifdef WSDISPLAY_COMPAT_RAWKBD
- case WSKBDIO_SETMODE:
- sc->sc_rawkbd = *(int *)data == WSKBD_RAW;
- return (0);
-#endif
- }
-
- return (-1);
-}
-
-#if NWSMOUSE > 0
-/*
- * Wsmouse callbacks
- */
-
-int
-dnmouse_enable(void *v)
-{
- struct dnkbd_softc *sc = v;
-
- if (ISSET(sc->sc_flags, SF_MOUSE))
- return (EBUSY);
- SET(sc->sc_flags, SF_MOUSE);
-
- return (0);
-}
-
-int
-dnmouse_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
-{
-#if 0
- struct dnkbd_softc *sc = v;
-#endif
-
- switch (cmd) {
- case WSMOUSEIO_GTYPE:
- *(int *)data = WSMOUSE_TYPE_DOMAIN;
- return (0);
- }
-
- return (-1);
-}
-
-void
-dnmouse_disable(void *v)
-{
- struct dnkbd_softc *sc = v;
-
- CLR(sc->sc_flags, SF_MOUSE);
-}
-#endif
-
-/*
- * Console support
- */
-
-void
-dnkbd_cngetc(void *v, u_int *type, int *data)
-{
- static int lastdat = 0;
- struct dnkbd_softc *sc = v;
- int s;
- int dat;
-
- /* Take care of caps lock */
- if ((lastdat & ~DNKEY_RELEASE) == DNKEY_CAPSLOCK) {
- dat = lastdat ^ DNKEY_RELEASE;
- lastdat = 0;
- } else {
- for (;;) {
- s = splhigh();
- dat = dnkbd_pollin(sc->sc_regs, 10000);
- if (dat != -1) {
- if (dnkbd_input(sc, dat) == EVENT_KEYBOARD) {
- splx(s);
- break;
- }
- }
- splx(s);
- }
- lastdat = dat;
- }
-
- dnkbd_decode(dat, type, data);
-}
-
-void
-dnkbd_cnpollc(void *v, int on)
-{
- struct dnkbd_softc *sc = v;
-
- if (on)
- SET(sc->sc_flags, SF_POLLING);
- else
- CLR(sc->sc_flags, SF_POLLING);
-}
-
-/*
- * Bell routines.
- */
-void
-dnkbd_bell(void *v, u_int period, u_int pitch, u_int volume)
-{
- struct dnkbd_softc *sc = v;
- int s;
-
- s = spltty();
-
- if (pitch == 0 || period == 0 || volume == 0) {
- if (ISSET(sc->sc_flags, SF_BELL_TMO)) {
- timeout_del(&sc->sc_bellstop_tmo);
- dnkbd_bellstop(v);
- }
- } else {
-
- if (!ISSET(sc->sc_flags, SF_BELL)) {
- dnkbd_pollout(sc->sc_regs, DNCMD_PREFIX);
- dnkbd_pollout(sc->sc_regs, DNCMD_BELL);
- dnkbd_pollout(sc->sc_regs, DNCMD_BELL_ON);
- SET(sc->sc_flags, SF_BELL);
- }
-
- if (ISSET(sc->sc_flags, SF_BELL_TMO))
- timeout_del(&sc->sc_bellstop_tmo);
- timeout_add_msec(&sc->sc_bellstop_tmo, period);
- SET(sc->sc_flags, SF_BELL_TMO);
- }
-
- splx(s);
-}
-
-void
-dnkbd_bellstop(void *v)
-{
- struct dnkbd_softc *sc = v;
- int s;
-
- s = spltty();
-
- dnkbd_pollout(sc->sc_regs, DNCMD_PREFIX);
- dnkbd_pollout(sc->sc_regs, DNCMD_BELL);
- dnkbd_pollout(sc->sc_regs, DNCMD_BELL_OFF);
- CLR(sc->sc_flags, SF_BELL);
- CLR(sc->sc_flags, SF_BELL_TMO);
-
- splx(s);
-}
diff --git a/sys/arch/hp300/dev/dnkbdmap.c b/sys/arch/hp300/dev/dnkbdmap.c
deleted file mode 100644
index 27409e57cc4..00000000000
--- a/sys/arch/hp300/dev/dnkbdmap.c
+++ /dev/null
@@ -1,508 +0,0 @@
-/* $OpenBSD: dnkbdmap.c,v 1.2 2005/05/06 22:22:53 miod Exp $ */
-/*
- * Copyright (c) 2005, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/types.h>
-
-#include <dev/wscons/wsksymdef.h>
-#include <dev/wscons/wsksymvar.h>
-
-#include <hp300/dev/dnkbdmap.h>
-
-#ifdef WSDISPLAY_COMPAT_RAWKBD
-#include <dev/wscons/wskbdraw.h>
-
-/*
- * Translate Domain keycodes to US keyboard XT scancodes, for proper
- * X11-over-wsmux operation.
- */
-const u_int8_t dnkbd_raw[0x80] = {
- RAWKEY_Null,
- RAWKEY_Null, /* 01 Ins Mark */
- RAWKEY_Null, /* 02 Line Del */
- RAWKEY_Null, /* 03 Char Del */
- RAWKEY_f10, /* 04 f0 */
- RAWKEY_f1,
- RAWKEY_f2,
- RAWKEY_f3,
- RAWKEY_f4,
- RAWKEY_f5,
- RAWKEY_f6,
- RAWKEY_f7,
- RAWKEY_f8,
- RAWKEY_f9,
- RAWKEY_Null, /* 0e Again */
- RAWKEY_Null, /* 0f Read */
- RAWKEY_Null, /* 10 Save Edit */
- RAWKEY_Null, /* 11 Abort Exit */
- RAWKEY_Hold_Screen, /* 12 Help Hold */
- RAWKEY_Null, /* 13 Cut Copy */
- RAWKEY_Null, /* 14 Undo Paste */
- RAWKEY_Null, /* 15 Move Grow */
- RAWKEY_Escape,
- RAWKEY_Escape,
- RAWKEY_1,
- RAWKEY_2,
- RAWKEY_3,
- RAWKEY_4,
- RAWKEY_5,
- RAWKEY_6,
- RAWKEY_7,
- RAWKEY_8,
- RAWKEY_9,
- RAWKEY_0,
- RAWKEY_minus,
- RAWKEY_equal,
- RAWKEY_grave,
- RAWKEY_BackSpace,
- RAWKEY_Null,
- RAWKEY_Null, /* 27 Left Edge */
- RAWKEY_Null, /* 28 Shell Cmd */
- RAWKEY_Null, /* 29 Right Edge */
- RAWKEY_Null,
- RAWKEY_Null,
- RAWKEY_Tab,
- RAWKEY_q,
- RAWKEY_w,
- RAWKEY_e,
- RAWKEY_r,
- RAWKEY_t,
- RAWKEY_y,
- RAWKEY_u,
- RAWKEY_i,
- RAWKEY_o,
- RAWKEY_p,
- RAWKEY_bracketleft,
- RAWKEY_bracketright,
- RAWKEY_Null,
- RAWKEY_Delete,
- RAWKEY_Null,
- RAWKEY_KP_Home,
- RAWKEY_KP_Up,
- RAWKEY_KP_Prior,
- RAWKEY_KP_Add,
- RAWKEY_Null, /* 40 Left Box */
- RAWKEY_Up,
- RAWKEY_Null, /* 42 Right Box */
- RAWKEY_Control_L,
- RAWKEY_Null,
- RAWKEY_Null,
- RAWKEY_a,
- RAWKEY_s,
- RAWKEY_d,
- RAWKEY_f,
- RAWKEY_g,
- RAWKEY_h,
- RAWKEY_j,
- RAWKEY_k,
- RAWKEY_l,
- RAWKEY_semicolon,
- RAWKEY_apostrophe,
- RAWKEY_Null,
- RAWKEY_Return,
- RAWKEY_backslash,
- RAWKEY_Null,
- RAWKEY_KP_Left,
- RAWKEY_KP_Begin,
- RAWKEY_KP_Right,
- RAWKEY_KP_Subtract,
- RAWKEY_Left,
- RAWKEY_Null, /* 5a Next Wndw */
- RAWKEY_Right,
- RAWKEY_Null,
- RAWKEY_Null, /* 5d Rept */
- RAWKEY_Shift_L,
- RAWKEY_Null,
- RAWKEY_z,
- RAWKEY_x,
- RAWKEY_c,
- RAWKEY_v,
- RAWKEY_b,
- RAWKEY_n,
- RAWKEY_m,
- RAWKEY_comma,
- RAWKEY_period,
- RAWKEY_slash,
- RAWKEY_Shift_R,
- RAWKEY_Null,
- RAWKEY_Null, /* 6c Pop */
- RAWKEY_Null,
- RAWKEY_KP_End,
- RAWKEY_KP_Down,
- RAWKEY_KP_Next,
- RAWKEY_Null,
- RAWKEY_Null, /* 72 Top Box */
- RAWKEY_Down,
- RAWKEY_Null, /* 74 Bottom Box */
- RAWKEY_Alt_L,
- RAWKEY_space,
- RAWKEY_Alt_R,
- RAWKEY_Null,
- RAWKEY_KP_Insert,
- RAWKEY_Null,
- RAWKEY_KP_Delete,
- RAWKEY_KP_Enter,
- RAWKEY_Null,
- RAWKEY_Caps_Lock,
- RAWKEY_Null
-};
-#endif
-
-#define KC(n) KS_KEYCODE(n)
-
-/*
- * US English
- */
-
-static const keysym_t dnkbd_keydesc_us[] = {
-/* pos command normal shifted */
- /* 01 Ins Mark */
- /* 02 Line Del */
- /* 03 Char Del */
- KC(0x04), KS_f10,
- KC(0x05), KS_f1,
- KC(0x06), KS_f2,
- KC(0x07), KS_f3,
- KC(0x08), KS_f4,
- KC(0x09), KS_f5,
- KC(0x0a), KS_f6,
- KC(0x0b), KS_f7,
- KC(0x0c), KS_f8,
- KC(0x0d), KS_f9,
- /* 0e Again */
- /* 0f Read */
- /* 10 Save Edit */
- /* 11 Abort Exit */
- KC(0x12), KS_Hold_Screen,
- /* 13 Cut Copy */
- /* 14 Undo Paste */
- /* 15 Move Grow */
- KC(0x17), KS_Cmd_Debugger, KS_Escape,
- KC(0x18), KS_1, KS_exclam,
- KC(0x19), KS_2, KS_at,
- KC(0x1a), KS_3, KS_numbersign,
- KC(0x1b), KS_4, KS_dollar,
- KC(0x1c), KS_5, KS_percent,
- KC(0x1d), KS_6, KS_asciicircum,
- KC(0x1e), KS_7, KS_ampersand,
- KC(0x1f), KS_8, KS_asterisk,
- KC(0x20), KS_9, KS_parenleft,
- KC(0x21), KS_0, KS_parenright,
- KC(0x22), KS_minus, KS_underscore,
- KC(0x23), KS_equal, KS_plus,
- KC(0x24), KS_grave, KS_asciitilde,
- KC(0x25), KS_Cmd_ResetEmul, KS_Delete, /* backspace */
- KC(0x27), KS_Home,
- /* 28 Shell Cmd */
- KC(0x29), KS_End,
- KC(0x2c), KS_Tab,
- KC(0x2d), KS_q,
- KC(0x2e), KS_w,
- KC(0x2f), KS_e,
- KC(0x30), KS_r,
- KC(0x31), KS_t,
- KC(0x32), KS_y,
- KC(0x33), KS_u,
- KC(0x34), KS_i,
- KC(0x35), KS_o,
- KC(0x36), KS_p,
- KC(0x37), KS_bracketleft, KS_braceleft,
- KC(0x38), KS_bracketright,KS_braceright,
- KC(0x3a), KS_Delete,
- KC(0x3c), KS_KP_7,
- KC(0x3d), KS_KP_8,
- KC(0x3e), KS_KP_9,
- KC(0x3f), KS_KP_Add,
- /* 40 Left Box */
- KC(0x41), KS_Up,
- /* 42 Right Box */
- KC(0x43), KS_Cmd1, KS_Control_L,
- KC(0x46), KS_a,
- KC(0x47), KS_s,
- KC(0x48), KS_d,
- KC(0x49), KS_f,
- KC(0x4a), KS_g,
- KC(0x4b), KS_h,
- KC(0x4c), KS_j,
- KC(0x4d), KS_k,
- KC(0x4e), KS_l,
- KC(0x4f), KS_semicolon, KS_colon,
- KC(0x50), KS_apostrophe, KS_quotedbl,
- KC(0x52), KS_Return,
- KC(0x53), KS_backslash, KS_bar,
- KC(0x55), KS_KP_4,
- KC(0x56), KS_KP_5,
- KC(0x57), KS_KP_6,
- KC(0x58), KS_KP_Subtract,
- KC(0x59), KS_Left,
- /* 5a Next Wndw */
- KC(0x5b), KS_Right,
- /* 5d Rept */
- KC(0x5e), KS_Shift_L,
- KC(0x60), KS_z,
- KC(0x61), KS_x,
- KC(0x62), KS_c,
- KC(0x63), KS_v,
- KC(0x64), KS_b,
- KC(0x65), KS_n,
- KC(0x66), KS_m,
- KC(0x67), KS_comma, KS_less,
- KC(0x68), KS_period, KS_greater,
- KC(0x69), KS_slash, KS_question,
- KC(0x6a), KS_Shift_R,
- /* 6c Pop */
- KC(0x6e), KS_KP_1,
- KC(0x6f), KS_KP_2,
- KC(0x70), KS_KP_3,
- /* 72 Top Box */
- KC(0x73), KS_Down,
- /* 74 Bottom Box */
- KC(0x75), KS_Cmd2, KS_Alt_L,
- KC(0x76), KS_space,
- KC(0x77), KS_Cmd2, KS_Alt_R, KS_Multi_key,
- KC(0x79), KS_KP_0,
- KC(0x7b), KS_KP_Separator,
- KC(0x7c), KS_KP_Enter,
- KC(0x7e), KS_Caps_Lock
-};
-
-/*
- * German
- */
-
-static const keysym_t dnkbd_keydesc_de[] = {
-/* pos normal shifted altgr */
- KC(0x17), KS_dead_circumflex, KS_dead_abovering,
- KC(0x19), KS_2, KS_quotedbl,
- KC(0x1a), KS_3, KS_at, KS_section,
- KC(0x1d), KS_6, KS_ampersand,
- KC(0x1e), KS_7, KS_slash,
- KC(0x1f), KS_8, KS_parenleft,
- KC(0x20), KS_9, KS_parenright,
- KC(0x21), KS_0, KS_equal,
- KC(0x22), KS_dead_tilde, KS_question, KS_ssharp,
- KC(0x23), KS_dead_acute, KS_dead_grave,
- KC(0x32), KS_z,
- KC(0x37), KS_braceright, KS_bracketright,KS_udiaeresis,
- KC(0x38), KS_plus, KS_asterisk,
- KC(0x4f), KS_bar, KS_backslash, KS_odiaeresis,
- KC(0x50), KS_braceleft, KS_bracketleft, KS_adiaeresis,
- KC(0x51), KS_numbersign, KS_apostrophe,
- KC(0x5f), KS_less, KS_greater,
- KC(0x60), KS_y,
- KC(0x67), KS_comma, KS_semicolon,
- KC(0x68), KS_period, KS_colon,
- KC(0x69), KS_minus, KS_underscore,
- KC(0x77), KS_Mode_switch, KS_Multi_key
-};
-
-static const keysym_t dnkbd_keydesc_de_nodead[] = {
- KC(0x17), KS_asciicircum, KS_degree,
- KC(0x22), KS_asciitilde, KS_question, KS_ssharp,
- KC(0x23), KS_apostrophe, KS_grave
-};
-
-/*
- * Norwegian / Danish
- */
-
-static const keysym_t dnkbd_keydesc_dk[] = {
-/* pos normal shifted altgr */
- KC(0x17), KS_underscore,
- KC(0x19), KS_2, KS_quotedbl,
- KC(0x1d), KS_6, KS_ampersand,
- KC(0x1e), KS_7, KS_slash,
- KC(0x1f), KS_8, KS_parenleft,
- KC(0x20), KS_9, KS_parenright,
- KC(0x21), KS_0, KS_equal,
- KC(0x22), KS_plus, KS_question,
- KC(0x23), KS_dead_grave, KS_at,
- KC(0x37), KS_braceright, KS_bracketright,KS_aring,
- KC(0x38), KS_dead_tilde, KS_dead_circumflex,KS_dead_diaeresis,
- KC(0x4f), KS_bar, KS_backslash, KS_oslash,
- KC(0x50), KS_braceleft, KS_bracketleft, KS_ae,
- KC(0x51), KS_dead_acute, KS_asterisk,
- KC(0x5f), KS_less, KS_greater,
- KC(0x67), KS_comma, KS_semicolon,
- KC(0x68), KS_period, KS_colon,
- KC(0x69), KS_minus, KS_underscore,
- KC(0x77), KS_Mode_switch, KS_Multi_key
-};
-
-static const keysym_t dnkbd_keydesc_dk_nodead[] = {
-/* pos normal shifted altgr */
- KC(0x23), KS_grave, KS_at,
- KC(0x38), KS_asciitilde, KS_asciicircum, KS_diaeresis,
- KC(0x51), KS_apostrophe, KS_asterisk,
-};
-
-/*
- * French
- */
-
-static const keysym_t dnkbd_keydesc_fr[] = {
-/* pos normal shifted altgr */
- KC(0x17), KS_bracketleft, KS_degree,
- KC(0x18), KS_ampersand, KS_1,
- KC(0x19), KS_braceleft, KS_2, KS_eacute,
- KC(0x1a), KS_quotedbl, KS_3,
- KC(0x1b), KS_apostrophe, KS_4,
- KC(0x1c), KS_parenleft, KS_5,
- KC(0x1d), KS_bracketright,KS_6, KS_section,
- KC(0x1e), KS_braceright, KS_7, KS_egrave,
- KC(0x1f), KS_exclam, KS_8,
- KC(0x20), KS_backslash, KS_9, KS_ccedilla,
- KC(0x21), KS_at, KS_0, KS_agrave,
- KC(0x22), KS_parenright, KS_degree,
- KC(0x23), KS_minus, KS_underscore,
- KC(0x2d), KS_a,
- KC(0x2e), KS_z,
- KC(0x37), KS_dead_circumflex, KS_asciitilde, KS_dead_diaeresis,
- KC(0x38), KS_dollar, KS_asterisk,
- KC(0x46), KS_q,
- KC(0x4f), KS_m,
- KC(0x50), KS_bar, KS_percent, KS_ugrave,
- KC(0x51), KS_grave, KS_numbersign,
- KC(0x5f), KS_less, KS_greater,
- KC(0x60), KS_w,
- KC(0x66), KS_comma, KS_question,
- KC(0x67), KS_semicolon, KS_period,
- KC(0x68), KS_colon, KS_slash,
- KC(0x69), KS_equal, KS_plus,
- KC(0x77), KS_Mode_switch, KS_Multi_key
-};
-
-/*
- * Japanese (and basis for international layouts)
- *
- * Apparently this layout lacks all japanese keys (Zenkaku/Hankaku,
- * Hiragana/Katakana, Henkan and Muhenkan). Makes one wonder about
- * its usefulness.
- */
-
-static const keysym_t dnkbd_keydesc_jp[] = {
-/* pos cmd normal shifted */
- KC(0x16), KS_Cmd_Debugger, KS_Escape,
- KC(0x17), KS_grave, KS_asciitilde,
- KC(0x24), KS_Cmd_ResetEmul, KS_Delete, /* backspace */
- KC(0x25), KS_Delete,
- /* 2b Rept */
- KC(0x3b), KS_KP_Add,
- KC(0x3f), KS_parenleft, /* KS_KP_parenleft */
- KC(0x51), KS_backslash, KS_bar,
- KC(0x54), KS_KP_Subtract,
- KC(0x58), KS_parenright, /* KS_KP_parenright */
- KC(0x5f), KS_less, KS_greater,
- KC(0x6d), KS_KP_Multiply,
- KC(0x78), KS_KP_Divide,
-};
-
-/*
- * Swiss (relative to the German layout)
- */
-
-static const keysym_t dnkbd_keydesc_sg[] = {
-/* pos normal shifted altgr */
- KC(0x17), KS_at, KS_exclam, KS_section,
- KC(0x18), KS_1, KS_plus,
- KC(0x1a), KS_3, KS_asterisk,
- KC(0x1b), KS_4, KS_backslash, KS_ccedilla,
- KC(0x22), KS_apostrophe, KS_question,
- KC(0x23), KS_dead_circumflex,KS_dead_grave,
- KC(0x37), KS_braceright, KS_dead_tilde, KS_udiaeresis, KS_egrave,
- KC(0x38), KS_dead_diaeresis,KS_dead_acute,
- KC(0x4f), KS_bar, KS_bracketleft, KS_odiaeresis, KS_eacute,
- KC(0x50), KS_braceleft, KS_bracketright,KS_adiaeresis, KS_agrave,
- KC(0x51), KS_dollar, KS_numbersign, KS_sterling
-};
-
-static const keysym_t dnkbd_keydesc_sg_nodead[] = {
-/* pos normal shifted altgr */
- KC(0x23), KS_asciicircum, KS_grave,
- KC(0x37), KS_braceright, KS_asciitilde, KS_udiaeresis, KS_egrave,
- KC(0x38), KS_diaeresis, KS_apostrophe
-};
-
-/*
- * Swedish / Finnish (relative to the Norwegian / Danish layout)
- */
-
-static const keysym_t dnkbd_keydesc_sv[] = {
-/* pos normal shifted altgr */
- KC(0x1b), KS_4, KS_dollar, KS_currency,
- KC(0x23), KS_dead_grave, KS_at, KS_eacute,
- KC(0x38), KS_dead_tilde, KS_dead_circumflex,KS_udiaeresis,
- KC(0x4f), KS_bar, KS_backslash, KS_odiaeresis,
- KC(0x50), KS_braceleft, KS_bracketleft, KS_adiaeresis
-};
-
-static const keysym_t dnkbd_keydesc_sv_nodead[] = {
-/* pos normal shifted altgr */
- KC(0x23), KS_grave, KS_at, KS_eacute,
- KC(0x38), KS_asciitilde, KS_asciicircum, KS_udiaeresis,
- KC(0x51), KS_apostrophe, KS_asterisk,
-};
-
-/*
- * UK English
- */
-
-static const keysym_t dnkbd_keydesc_uk[] = {
-/* pos normal shifted */
- KC(0x17), KS_underscore,
- KC(0x19), KS_2, KS_quotedbl,
- KC(0x1d), KS_6, KS_ampersand,
- KC(0x1e), KS_7, KS_apostrophe,
- KC(0x1f), KS_8, KS_parenleft,
- KC(0x20), KS_9, KS_parenright,
- KC(0x21), KS_0, KS_underscore,
- KC(0x22), KS_minus, KS_equal,
- KC(0x23), KS_asciicircum, KS_asciitilde,
- KC(0x37), KS_at, KS_grave,
- KC(0x38), KS_bracketleft, KS_braceleft,
- KC(0x4f), KS_semicolon, KS_plus,
- KC(0x50), KS_colon, KS_asterisk,
- KC(0x51), KS_bracketright,KS_braceright,
- KC(0x5f), KS_backslash, KS_bar
-};
-
-#define KBD_MAP(name, base, map) \
- { name, base, sizeof(map) / sizeof(keysym_t), map }
-
-const struct wscons_keydesc dnkbd_keydesctab[] = {
- KBD_MAP(KB_US, 0, dnkbd_keydesc_us),
- KBD_MAP(KB_DE, KB_JP, dnkbd_keydesc_de),
- KBD_MAP(KB_DE | KB_NODEAD, KB_DE, dnkbd_keydesc_de_nodead),
- KBD_MAP(KB_DK, KB_JP, dnkbd_keydesc_dk),
- KBD_MAP(KB_DK | KB_NODEAD, KB_DK, dnkbd_keydesc_dk_nodead),
- KBD_MAP(KB_FR, KB_JP, dnkbd_keydesc_fr),
- KBD_MAP(KB_JP, KB_US, dnkbd_keydesc_jp),
- KBD_MAP(KB_SG, KB_DE, dnkbd_keydesc_sg),
- KBD_MAP(KB_SG | KB_NODEAD, KB_SG, dnkbd_keydesc_sg_nodead),
- KBD_MAP(KB_SV, KB_DK, dnkbd_keydesc_sv),
- KBD_MAP(KB_SV | KB_NODEAD, KB_SV, dnkbd_keydesc_sv_nodead),
- KBD_MAP(KB_UK, KB_JP, dnkbd_keydesc_uk),
- { 0, 0, 0, 0 }
-};
diff --git a/sys/arch/hp300/dev/dnkbdmap.h b/sys/arch/hp300/dev/dnkbdmap.h
deleted file mode 100644
index 90ffb046925..00000000000
--- a/sys/arch/hp300/dev/dnkbdmap.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* $OpenBSD: dnkbdmap.h,v 1.1 2005/04/22 11:59:11 miod Exp $ */
-/*
- * Copyright (c) 2005, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-extern const struct wscons_keydesc dnkbd_keydesctab[];
-extern const u_int8_t dnkbd_raw[0x80];
diff --git a/sys/arch/hp300/dev/dvbox.c b/sys/arch/hp300/dev/dvbox.c
deleted file mode 100644
index 44d24c6cd87..00000000000
--- a/sys/arch/hp300/dev/dvbox.c
+++ /dev/null
@@ -1,431 +0,0 @@
-/* $OpenBSD: dvbox.c,v 1.15 2013/10/21 10:36:12 miod Exp $ */
-
-/*
- * Copyright (c) 2005, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_dv.c 1.12 93/08/13$
- *
- * @(#)grf_dv.c 8.4 (Berkeley) 1/12/94
- */
-
-/*
- * Graphics routines for the DaVinci, HP98730/98731 Graphics system.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/proc.h>
-#include <sys/ioctl.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-#include <hp300/dev/intiovar.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/rasops/rasops.h>
-
-#include <hp300/dev/diofbreg.h>
-#include <hp300/dev/diofbvar.h>
-#include <hp300/dev/dvboxreg.h>
-
-struct dvbox_softc {
- struct device sc_dev;
- struct diofb *sc_fb;
- struct diofb sc_fb_store;
- int sc_scode;
-};
-
-int dvbox_dio_match(struct device *, void *, void *);
-void dvbox_dio_attach(struct device *, struct device *, void *);
-int dvbox_intio_match(struct device *, void *, void *);
-void dvbox_intio_attach(struct device *, struct device *, void *);
-
-struct cfattach dvbox_dio_ca = {
- sizeof(struct dvbox_softc), dvbox_dio_match, dvbox_dio_attach
-};
-
-struct cfattach dvbox_intio_ca = {
- sizeof(struct dvbox_softc), dvbox_intio_match, dvbox_intio_attach
-};
-
-struct cfdriver dvbox_cd = {
- NULL, "dvbox", DV_DULL
-};
-
-int dvbox_reset(struct diofb *, int, struct diofbreg *);
-void dvbox_restore(struct diofb *);
-void dvbox_setcolor(struct diofb *, u_int,
- u_int8_t, u_int8_t, u_int8_t);
-int dvbox_windowmove(struct diofb *, u_int16_t, u_int16_t, u_int16_t,
- u_int16_t, u_int16_t, u_int16_t, int16_t, int16_t);
-
-int dvbox_ioctl(void *, u_long, caddr_t, int, struct proc *);
-void dvbox_burner(void *, u_int, u_int);
-
-struct wsdisplay_accessops dvbox_accessops = {
- .ioctl = dvbox_ioctl,
- .mmap = diofb_mmap,
- .alloc_screen = diofb_alloc_screen,
- .free_screen = diofb_free_screen,
- .show_screen = diofb_show_screen,
- .load_font = diofb_load_font,
- .list_font = diofb_list_font,
- .burn_screen = dvbox_burner
-};
-
-/*
- * Attachment glue
- */
-
-int
-dvbox_intio_match(struct device *parent, void *match, void *aux)
-{
- struct intio_attach_args *ia = aux;
- struct diofbreg *fbr;
-
- fbr = (struct diofbreg *)IIOV(GRFIADDR);
-
- if (badaddr((caddr_t)fbr))
- return (0);
-
- if (fbr->id == GRFHWID && fbr->fbid == GID_DAVINCI) {
- ia->ia_addr = (caddr_t)GRFIADDR;
- return (1);
- }
-
- return (0);
-}
-
-void
-dvbox_intio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct dvbox_softc *sc = (struct dvbox_softc *)self;
- struct diofbreg *fbr;
-
- fbr = (struct diofbreg *)IIOV(GRFIADDR);
- sc->sc_scode = CONSCODE_INTERNAL;
-
- if (sc->sc_scode == conscode) {
- sc->sc_fb = &diofb_cn;
- } else {
- sc->sc_fb = &sc->sc_fb_store;
- dvbox_reset(sc->sc_fb, sc->sc_scode, fbr);
- }
-
- diofb_end_attach(sc, &dvbox_accessops, sc->sc_fb,
- sc->sc_scode == conscode, NULL);
-}
-
-int
-dvbox_dio_match(struct device *parent, void *match, void *aux)
-{
- struct dio_attach_args *da = aux;
-
- if (da->da_id == DIO_DEVICE_ID_FRAMEBUFFER &&
- da->da_secid == DIO_DEVICE_SECID_DAVINCI)
- return (1);
-
- return (0);
-}
-
-void
-dvbox_dio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct dvbox_softc *sc = (struct dvbox_softc *)self;
- struct dio_attach_args *da = aux;
- struct diofbreg *fbr;
-
- sc->sc_scode = da->da_scode;
- if (sc->sc_scode == conscode) {
- fbr = (struct diofbreg *)conaddr; /* already mapped */
- sc->sc_fb = &diofb_cn;
- } else {
- sc->sc_fb = &sc->sc_fb_store;
- fbr = (struct diofbreg *)
- iomap(dio_scodetopa(sc->sc_scode), da->da_size);
- if (fbr == NULL ||
- dvbox_reset(sc->sc_fb, sc->sc_scode, fbr) != 0) {
- printf(": can't map framebuffer\n");
- return;
- }
- }
-
- diofb_end_attach(sc, &dvbox_accessops, sc->sc_fb,
- sc->sc_scode == conscode, NULL);
-}
-
-/*
- * Initialize hardware and display routines.
- */
-int
-dvbox_reset(struct diofb *fb, int scode, struct diofbreg *fbr)
-{
- int rc;
-
- if ((rc = diofb_fbinquire(fb, scode, fbr)) != 0)
- return (rc);
-
- /*
- * Restrict the framebuffer to a monochrome view for now, until
- * I know better how to detect and frob overlay planes, and
- * setup a proper colormap. -- miod
- */
- fb->planes = fb->planemask = 1;
-
- fb->bmv = dvbox_windowmove;
- dvbox_restore(fb);
- diofb_fbsetup(fb);
-
- return (0);
-}
-
-/*
- * Magic initialization code.
- */
-void
-dvbox_restore(struct diofb *fb)
-{
- volatile struct dvboxfb *db = (struct dvboxfb *)fb->regkva;
- u_int i;
-
- db->regs.id = 0x80;
- DELAY(100);
-
- db->regs.interrupt = 0x04;
- db->en_scan = 0x01;
- db->fbwen = ~0;
- db->opwen = ~0;
- db->fold = 0x01; /* 8bpp */
- db->drive = 0x01; /* use FB plane */
- db->rep_rule = DVBOX_DUALROP(RR_COPY);
- db->alt_rr = DVBOX_DUALROP(RR_COPY);
- db->zrr = DVBOX_DUALROP(RR_COPY);
-
- db->fbvenp = 0xFF; /* enable video */
- db->dispen = 0x01; /* enable display */
- db->fbvens = 0x0;
- db->fv_trig = 0x01;
- DELAY(100);
- db->vdrive = 0x0;
- db->zconfig = 0x0;
-
- while (db->wbusy & 0x01)
- DELAY(10);
-
- db->cmapbank = 0;
-
- db->red0 = 0;
- db->red1 = 0;
- db->green0 = 0;
- db->green1 = 0;
- db->blue0 = 0;
- db->blue1 = 0;
-
- db->panxh = 0;
- db->panxl = 0;
- db->panyh = 0;
- db->panyl = 0;
- db->zoom = 0;
- db->cdwidth = 0x50;
- db->chstart = 0x52;
- db->cvwidth = 0x22;
- db->pz_trig = 1;
-
- /*
- * Turn on frame buffer, turn on overlay planes, set replacement
- * rule, enable top overlay plane writes for ite, disable all frame
- * buffer planes, set byte per pixel, and display frame buffer 0.
- * Lastly, turn on the box.
- */
- db->regs.interrupt = 0x04;
- db->drive = 0x10;
- db->rep_rule = DVBOX_DUALROP(RR_COPY);
- db->opwen = 0x01;
- db->fbwen = 0x0;
- db->fold = 0x01;
- db->vdrive = 0x0;
- db->dispen = 0x01;
-
- /*
- * Video enable top overlay plane.
- */
- db->opvenp = 0x01;
- db->opvens = 0x01;
-
- /*
- * Make sure that overlay planes override frame buffer planes.
- */
- db->ovly0p = 0x0;
- db->ovly0s = 0x0;
- db->ovly1p = 0x0;
- db->ovly1s = 0x0;
- db->fv_trig = 0x1;
- DELAY(100);
-
- /*
- * Setup the overlay colormaps. Need to set the 0,1 (black/white)
- * color for both banks.
- */
- db_waitbusy(db);
- for (i = 0; i <= 1; i++) {
- db->cmapbank = i;
- db->rgb[0].red = 0x00;
- db->rgb[0].green = 0x00;
- db->rgb[0].blue = 0x00;
- db->rgb[1].red = 0xff;
- db->rgb[1].green = 0xff;
- db->rgb[1].blue = 0xff;
- }
- db->cmapbank = 0;
- db_waitbusy(db);
-}
-
-int
-dvbox_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p)
-{
- struct diofb *fb = v;
- struct wsdisplay_fbinfo *wdf;
-
- switch (cmd) {
- case WSDISPLAYIO_GTYPE:
- *(u_int *)data = WSDISPLAY_TYPE_DVBOX;
- break;
- case WSDISPLAYIO_SMODE:
- fb->mapmode = *(u_int *)data;
- if (fb->mapmode == WSDISPLAYIO_MODE_EMUL)
- dvbox_restore(fb);
- break;
- case WSDISPLAYIO_GINFO:
- wdf = (void *)data;
- wdf->width = fb->ri.ri_width;
- wdf->height = fb->ri.ri_height;
- wdf->depth = fb->ri.ri_depth;
- wdf->cmsize = 0; /* XXX */
- break;
- case WSDISPLAYIO_LINEBYTES:
- *(u_int *)data = fb->ri.ri_stride;
- break;
- case WSDISPLAYIO_GETCMAP:
- case WSDISPLAYIO_PUTCMAP:
- break; /* XXX until color support is implemented */
- case WSDISPLAYIO_GVIDEO:
- case WSDISPLAYIO_SVIDEO:
- break;
- default:
- return (-1);
- }
-
- return (0);
-}
-
-void
-dvbox_burner(void *v, u_int on, u_int flags)
-{
- struct diofb *fb = v;
- volatile struct dvboxfb *db = (struct dvboxfb *)fb->regkva;
-
- if (on)
- db->dispen = 0x01;
- else
- db->dispen = 0x00;
-}
-
-int
-dvbox_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy,
- u_int16_t dx, u_int16_t dy, u_int16_t cx, u_int16_t cy, int16_t rop,
- int16_t planemask)
-{
- volatile struct dvboxfb *db = (struct dvboxfb *)fb->regkva;
-
- if (planemask != 0xff)
- return (EINVAL);
-
- db_waitbusy(db);
-
- db->rep_rule = DVBOX_DUALROP(rop);
- db->source_y = sy;
- db->source_x = sx;
- db->dest_y = dy;
- db->dest_x = dx;
- db->wheight = cy;
- db->wwidth = cx;
- db->wmove = 1;
-
- db_waitbusy(db);
-
- return (0);
-}
-
-/*
- * DaVinci console support
- */
-
-void
-dvboxcninit()
-{
- dvbox_reset(&diofb_cn, conscode, (struct diofbreg *)conaddr);
- diofb_cnattach(&diofb_cn);
-}
diff --git a/sys/arch/hp300/dev/dvboxreg.h b/sys/arch/hp300/dev/dvboxreg.h
deleted file mode 100644
index 910b19bb504..00000000000
--- a/sys/arch/hp300/dev/dvboxreg.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/* $OpenBSD: dvboxreg.h,v 1.3 2013/02/02 13:34:29 miod Exp $ */
-/* $NetBSD: grf_dvreg.h,v 1.5 1994/10/26 07:23:50 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_dvreg.h 1.5 92/01/21$
- *
- * @(#)grf_dvreg.h 8.1 (Berkeley) 6/10/93
- */
-
-#define db_waitbusy(regaddr) \
-do { \
- while (((volatile struct dvboxfb *)(regaddr))->wbusy != 0 || \
- ((volatile struct dvboxfb *)(regaddr))->as_busy != 0) \
- DELAY(10); \
-} while (0)
-
-#define DVBOX_DUALROP(rop) ((rop) << 4 | (rop))
-
-struct rgb {
- u_int8_t :8, :8, :8;
- u_int8_t red;
- u_int8_t :8, :8, :8;
- u_int8_t green;
- u_int8_t :8, :8, :8;
- u_int8_t blue;
-};
-
-struct dvboxfb {
- struct diofbreg regs;
- u_int8_t f2[16359];
- u_int8_t wbusy; /* Window move in progress 0x4047 */
- u_int8_t f3[0x405b-0x4047-1];
- u_int8_t as_busy; /* Scan accessing frame buf. 0x405B */
- u_int8_t f4[0x4090-0x405b-1];
- u_int32_t fbwen; /* Frame buffer write enable 0x4090 */
- u_int8_t f5[0x409f-0x4090-4];
- u_int8_t wmove; /* Initiate window move. 0x409F */
- u_int8_t f6[0x40b3-0x409f-1];
- u_int8_t fold; /* Byte/longword per pixel 0x40B3 */
- u_int8_t f7[0x40b7-0x40b3-1];
- u_int8_t opwen; /* Overlay plane write enable 0x40B7 */
- u_int8_t f8[0x40bf-0x40b7-1];
- u_int8_t drive; /* Select FB vs. Overlay. 0x40BF */
-
- u_int8_t f8a[0x40cb-0x40bf-1];
- u_int8_t zconfig; /* Z buffer configuration 0x40CB */
- u_int8_t f8b[0x40cf-0x40cb-1];
- u_int8_t alt_rr; /* Alternate replacement rule 0x40CF */
- u_int8_t f8c[0x40d3-0x40cf-1];
- u_int8_t zrr; /* Z replacement rule 0x40D3 */
-
- u_int8_t f9[0x40d7-0x40d3-1];
- u_int8_t en_scan; /* Enable scan DTACK. 0x40D7 */
- u_int8_t f10[0x40ef-0x40d7-1];
- u_int8_t rep_rule; /* Replacement rule 0x40EF */
- u_int8_t f11[0x40f2-0x40ef-1];
- u_int16_t source_x; /* Window source X origin 0x40F2 */
- u_int8_t f12[0x40f6-0x40f2-2];
- u_int16_t source_y; /* Window source Y origin 0x40F6 */
- u_int8_t f13[0x40fa-0x40f6-2];
- u_int16_t dest_x; /* Window dest X origin 0x40FA */
- u_int8_t f14[0x40fe -0x40fa-2];
- u_int16_t dest_y; /* Window dest Y origin 0x40FE */
- u_int8_t f15[0x4102-0x40fe -2];
- u_int16_t wwidth; /* Window width 0x4102 */
- u_int8_t f16[0x4106-0x4102-2];
- u_int16_t wheight; /* Window height 0x4106 */
- u_int8_t f17[0x6003-0x4106-2];
- u_int8_t cmapbank; /* Bank select (0 or 1) 0x6003 */
- u_int8_t f18[0x6007-0x6003-1];
- u_int8_t dispen; /* Display enable 0x6007 */
-
- u_int8_t f18a[0x600B-0x6007-1];
- u_int8_t fbvenp; /* Frame buffer video enable 0x600B */
- u_int8_t f18b[0x6017-0x600B-1];
- u_int8_t fbvens; /* fbvenp blink counterpart 0x6017 */
-
- u_int8_t f19[0x6023-0x6017-1];
- u_int8_t vdrive; /* Video display mode 0x6023 */
- u_int8_t f20[0x6083-0x6023-1];
- u_int8_t panxh; /* Pan display in X (high) 0x6083 */
- u_int8_t f21[0x6087-0x6083-1];
- u_int8_t panxl; /* Pan display in X (low) 0x6087 */
- u_int8_t f22[0x608b-0x6087-1];
- u_int8_t panyh; /* Pan display in Y (high) 0x608B */
- u_int8_t f23[0x608f-0x608b-1];
- u_int8_t panyl; /* Pan display in Y (low) 0x608F */
- u_int8_t f24[0x6093-0x608f-1];
- u_int8_t zoom; /* Zoom factor 0x6093 */
- u_int8_t f25[0x6097-0x6093-1];
- u_int8_t pz_trig; /* Pan & zoom trigger 0x6097 */
- u_int8_t f26[0x609b-0x6097-1];
- u_int8_t ovly0p; /* Overlay 0 primary map 0x609B */
- u_int8_t f27[0x609f-0x609b-1];
- u_int8_t ovly1p; /* Overlay 1 primary map 0x609F */
- u_int8_t f28[0x60a3-0x609f-1];
- u_int8_t ovly0s; /* Overlay 0 secondary map 0x60A3 */
- u_int8_t f29[0x60a7-0x60a3-1];
- u_int8_t ovly1s; /* Overlay 1 secondary map 0x60A7 */
- u_int8_t f30[0x60ab-0x60a7-1];
- u_int8_t opvenp; /* Overlay video enable 0x60AB */
- u_int8_t f31[0x60af-0x60ab-1];
- u_int8_t opvens; /* Overlay blink enable 0x60AF */
- u_int8_t f32[0x60b3-0x60af-1];
- u_int8_t fv_trig; /* Trigger control registers 0x60B3 */
- u_int8_t f33[0x60b7-0x60b3-1];
- u_int8_t cdwidth; /* Iris cdwidth timing reg. 0x60B7 */
- u_int8_t f34[0x60bb-0x60b7-1];
- u_int8_t chstart; /* Iris chstart timing reg. 0x60BB */
- u_int8_t f35[0x60bf-0x60bb-1];
- u_int8_t cvwidth; /* Iris cvwidth timing reg. 0x60BF */
- u_int8_t f36[0x6100-0x60bf-1];
- struct rgb rgb[8]; /* overlay color map */
- u_int8_t f37[0x6403-0x6100-sizeof(struct rgb)*8];
- u_int8_t red0;
- u_int8_t f38[0x6803-0x6403-1];
- u_int8_t green0;
- u_int8_t f39[0x6c03-0x6803-1];
- u_int8_t blue0;
- u_int8_t f40[0x7403-0x6c03-1];
- u_int8_t red1;
- u_int8_t f41[0x7803-0x7403-1];
- u_int8_t green1;
- u_int8_t f42[0x7c03-0x7803-1];
- u_int8_t blue1;
- u_int8_t f43[0x8012-0x7c03-1];
- u_int16_t status1; /* Master Status register 0x8012 */
- u_int8_t f44[0xC226-0x8012-2];
- u_int16_t trans; /* Transparency 0xC226 */
- u_int8_t f45[0xC23E -0xC226-2];
- u_int16_t pstop; /* Pace value control 0xc23e */
-} __packed;
diff --git a/sys/arch/hp300/dev/fhpib.c b/sys/arch/hp300/dev/fhpib.c
deleted file mode 100644
index c51994d199c..00000000000
--- a/sys/arch/hp300/dev/fhpib.c
+++ /dev/null
@@ -1,673 +0,0 @@
-/* $OpenBSD: fhpib.c,v 1.16 2009/07/23 21:26:20 blambert Exp $ */
-/* $NetBSD: fhpib.c,v 1.18 1997/05/05 21:04:16 thorpej Exp $ */
-
-/*
- * Copyright (c) 1996, 1997 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)fhpib.c 8.2 (Berkeley) 1/12/94
- */
-
-/*
- * 98625A/B HPIB driver
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/buf.h>
-#include <sys/device.h>
-#include <sys/timeout.h>
-
-#include <machine/autoconf.h>
-#include <machine/intr.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-
-#include <hp300/dev/dmavar.h>
-
-#include <hp300/dev/fhpibreg.h>
-#include <hp300/dev/hpibvar.h>
-
-/*
- * Inline version of fhpibwait to be used in places where
- * we don't worry about getting hung.
- */
-#define FHPIBWAIT(hd, m) while (((hd)->hpib_intr & (m)) == 0) DELAY(1)
-
-#ifdef DEBUG
-int fhpibdebugunit = -1;
-int fhpibdebug = 0;
-#define FDB_FAIL 0x01
-#define FDB_DMA 0x02
-#define FDB_WAIT 0x04
-#define FDB_PPOLL 0x08
-
-int dopriodma = 0; /* use high priority DMA */
-int doworddma = 1; /* non-zero if we should attempt word dma */
-int doppollint = 1; /* use ppoll interrupts instead of watchdog */
-int fhpibppolldelay = 50;
-#endif
-
-void fhpibifc(struct fhpibdevice *);
-void fhpibdmadone(void *);
-int fhpibwait(struct fhpibdevice *, int);
-
-void fhpibreset(struct hpibbus_softc *);
-int fhpibsend(struct hpibbus_softc *, int, int, void *, int);
-int fhpibrecv(struct hpibbus_softc *, int, int, void *, int);
-int fhpibppoll(struct hpibbus_softc *);
-void fhpibppwatch(void *);
-void fhpibgo(struct hpibbus_softc *, int, int, void *, int, int, int);
-void fhpibdone(struct hpibbus_softc *);
-int fhpibintr(void *);
-
-/*
- * Our controller ops structure.
- */
-struct hpib_controller fhpib_controller = {
- fhpibreset,
- fhpibsend,
- fhpibrecv,
- fhpibppoll,
- fhpibppwatch,
- fhpibgo,
- fhpibdone,
- fhpibintr
-};
-
-struct fhpib_softc {
- struct device sc_dev; /* generic device glue */
- struct isr sc_isr;
- struct fhpibdevice *sc_regs; /* device registers */
- struct timeout sc_dma_to; /* DMA done timeout */
-#ifdef DEBUG
- struct timeout sc_watch_to; /* fhpibppwatch timeout */
-#endif
- int sc_cmd;
- struct hpibbus_softc *sc_hpibbus; /* XXX */
-};
-
-int fhpibmatch(struct device *, void *, void *);
-void fhpibattach(struct device *, struct device *, void *);
-
-struct cfattach fhpib_ca = {
- sizeof(struct fhpib_softc), fhpibmatch, fhpibattach
-};
-
-struct cfdriver fhpib_cd = {
- NULL, "fhpib", DV_DULL
-};
-
-int
-fhpibmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct dio_attach_args *da = aux;
-
- if (da->da_id == DIO_DEVICE_ID_FHPIB)
- return (1);
-
- return (0);
-}
-
-void
-fhpibattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct fhpib_softc *sc = (struct fhpib_softc *)self;
- struct dio_attach_args *da = aux;
- struct hpibdev_attach_args ha;
- int ipl;
-
- sc->sc_regs = (struct fhpibdevice *)iomap(dio_scodetopa(da->da_scode),
- da->da_size);
- if (sc->sc_regs == NULL) {
- printf("\n%s: can't map registers\n", self->dv_xname);
- return;
- }
-
- ipl = DIO_IPL(sc->sc_regs);
- printf(" ipl %d: %s\n", ipl, DIO_DEVICE_DESC_FHPIB);
-
- /* Initialize timeout structures */
- timeout_set(&sc->sc_dma_to, fhpibdmadone, sc);
-
- /* Establish the interrupt handler. */
- sc->sc_isr.isr_func = fhpibintr;
- sc->sc_isr.isr_arg = sc;
- sc->sc_isr.isr_ipl = ipl;
- sc->sc_isr.isr_priority = IPL_BIO;
- dio_intr_establish(&sc->sc_isr, self->dv_xname);
-
- ha.ha_ops = &fhpib_controller;
- ha.ha_type = HPIBC; /* XXX */
- ha.ha_ba = HPIBC_BA;
- ha.ha_softcpp = &sc->sc_hpibbus; /* XXX */
- (void)config_found(self, &ha, hpibdevprint);
-}
-
-void
-fhpibreset(hs)
- struct hpibbus_softc *hs;
-{
- struct fhpib_softc *sc = (struct fhpib_softc *)hs->sc_dev.dv_parent;
- struct fhpibdevice *hd = sc->sc_regs;
-
- hd->hpib_cid = 0xFF;
- DELAY(100);
- hd->hpib_cmd = CT_8BIT;
- hd->hpib_ar = AR_ARONC;
- fhpibifc(hd);
- hd->hpib_ie = IDS_IE;
- hd->hpib_data = C_DCL;
- DELAY(100000);
- /*
- * See if we can do word dma.
- * If so, we should be able to write and read back the apropos bit.
- */
- hd->hpib_ie |= IDS_WDMA;
- if (hd->hpib_ie & IDS_WDMA) {
- hd->hpib_ie &= ~IDS_WDMA;
- hs->sc_flags |= HPIBF_DMA16;
-#ifdef DEBUG
- if (fhpibdebug & FDB_DMA)
- printf("fhpibtype: %s has word dma\n",
- sc->sc_dev.dv_xname);
-
-#endif
- }
-}
-
-void
-fhpibifc(hd)
- struct fhpibdevice *hd;
-{
- hd->hpib_cmd |= CT_IFC;
- hd->hpib_cmd |= CT_INITFIFO;
- DELAY(100);
- hd->hpib_cmd &= ~CT_IFC;
- hd->hpib_cmd |= CT_REN;
- hd->hpib_stat = ST_ATN;
-}
-
-int
-fhpibsend(hs, slave, sec, ptr, origcnt)
- struct hpibbus_softc *hs;
- int slave, sec, origcnt;
- void *ptr;
-{
- struct fhpib_softc *sc = (struct fhpib_softc *)hs->sc_dev.dv_parent;
- struct fhpibdevice *hd = sc->sc_regs;
- int cnt = origcnt;
- int timo;
- char *addr = ptr;
-
- hd->hpib_stat = 0;
- hd->hpib_imask = IM_IDLE | IM_ROOM;
- if (fhpibwait(hd, IM_IDLE) < 0)
- goto senderr;
- hd->hpib_stat = ST_ATN;
- hd->hpib_data = C_UNL;
- hd->hpib_data = C_TAG + hs->sc_ba;
- hd->hpib_data = C_LAG + slave;
- if (sec < 0) {
- if (sec == -2) /* selected device clear KLUDGE */
- hd->hpib_data = C_SDC;
- } else
- hd->hpib_data = C_SCG + sec;
- if (fhpibwait(hd, IM_IDLE) < 0)
- goto senderr;
- if (cnt) {
- hd->hpib_stat = ST_WRITE;
- while (--cnt) {
- hd->hpib_data = *addr++;
- timo = hpibtimeout;
- while ((hd->hpib_intr & IM_ROOM) == 0) {
- if (--timo <= 0)
- goto senderr;
- DELAY(1);
- }
- }
- hd->hpib_stat = ST_EOI;
- hd->hpib_data = *addr;
- FHPIBWAIT(hd, IM_ROOM);
- hd->hpib_stat = ST_ATN;
- /* XXX: HP-UX claims bug with CS80 transparent messages */
- if (sec == 0x12)
- DELAY(150);
- hd->hpib_data = C_UNL;
- (void) fhpibwait(hd, IM_IDLE);
- }
- hd->hpib_imask = 0;
- return (origcnt);
-
-senderr:
- hd->hpib_imask = 0;
- fhpibifc(hd);
-#ifdef DEBUG
- if (fhpibdebug & FDB_FAIL) {
- printf("%s: fhpibsend failed: slave %d, sec %x, ",
- sc->sc_dev.dv_xname, slave, sec);
- printf("sent %d of %d bytes\n", origcnt-cnt-1, origcnt);
- }
-#endif
- return (origcnt - cnt - 1);
-}
-
-int
-fhpibrecv(hs, slave, sec, ptr, origcnt)
- struct hpibbus_softc *hs;
- int slave, sec, origcnt;
- void *ptr;
-{
- struct fhpib_softc *sc = (struct fhpib_softc *)hs->sc_dev.dv_parent;
- struct fhpibdevice *hd = sc->sc_regs;
- int cnt = origcnt;
- int timo;
- char *addr = ptr;
-
- /*
- * Slave < 0 implies continuation of a previous receive
- * that probably timed out.
- */
- if (slave >= 0) {
- hd->hpib_stat = 0;
- hd->hpib_imask = IM_IDLE | IM_ROOM | IM_BYTE;
- if (fhpibwait(hd, IM_IDLE) < 0)
- goto recverror;
- hd->hpib_stat = ST_ATN;
- hd->hpib_data = C_UNL;
- hd->hpib_data = C_LAG + hs->sc_ba;
- hd->hpib_data = C_TAG + slave;
- if (sec != -1)
- hd->hpib_data = C_SCG + sec;
- if (fhpibwait(hd, IM_IDLE) < 0)
- goto recverror;
- hd->hpib_stat = ST_READ0;
- hd->hpib_data = 0;
- }
- if (cnt) {
- while (--cnt >= 0) {
- timo = hpibtimeout;
- while ((hd->hpib_intr & IM_BYTE) == 0) {
- if (--timo == 0)
- goto recvbyteserror;
- DELAY(1);
- }
- *addr++ = hd->hpib_data;
- }
- FHPIBWAIT(hd, IM_ROOM);
- hd->hpib_stat = ST_ATN;
- hd->hpib_data = (slave == 31) ? C_UNA : C_UNT;
- (void) fhpibwait(hd, IM_IDLE);
- }
- hd->hpib_imask = 0;
- return (origcnt);
-
-recverror:
- fhpibifc(hd);
-recvbyteserror:
- hd->hpib_imask = 0;
-#ifdef DEBUG
- if (fhpibdebug & FDB_FAIL) {
- printf("%s: fhpibrecv failed: slave %d, sec %x, ",
- sc->sc_dev.dv_xname, slave, sec);
- printf("got %d of %d bytes\n", origcnt-cnt-1, origcnt);
- }
-#endif
- return (origcnt - cnt - 1);
-}
-
-void
-fhpibgo(hs, slave, sec, ptr, count, rw, timo)
- struct hpibbus_softc *hs;
- int slave, sec, count, rw, timo;
- void *ptr;
-{
- struct fhpib_softc *sc = (struct fhpib_softc *)hs->sc_dev.dv_parent;
- struct fhpibdevice *hd = sc->sc_regs;
- int i;
- char *addr = ptr;
- int flags = 0;
-
- hs->sc_flags |= HPIBF_IO;
- if (timo)
- hs->sc_flags |= HPIBF_TIMO;
- if (rw == B_READ)
- hs->sc_flags |= HPIBF_READ;
-#ifdef DEBUG
- else if (hs->sc_flags & HPIBF_READ) {
- printf("fhpibgo: HPIBF_READ still set\n");
- hs->sc_flags &= ~HPIBF_READ;
- }
-#endif
- hs->sc_count = count;
- hs->sc_addr = addr;
-#ifdef DEBUG
- /* fhpibtransfer[unit]++; XXX */
-#endif
- if ((hs->sc_flags & HPIBF_DMA16) &&
- ((int)addr & 1) == 0 && count && (count & 1) == 0
-#ifdef DEBUG
- && doworddma
-#endif
- ) {
-#ifdef DEBUG
- /* fhpibworddma[unit]++; XXX */
-#endif
- flags |= DMAGO_WORD;
- hd->hpib_latch = 0;
- }
-#ifdef DEBUG
- if (dopriodma)
- flags |= DMAGO_PRI;
-#endif
- if (hs->sc_flags & HPIBF_READ) {
- sc->sc_cmd = CT_REN | CT_8BIT;
- hs->sc_curcnt = count;
- dmago(hs->sc_dq->dq_chan, addr, count, flags|DMAGO_READ);
- if (fhpibrecv(hs, slave, sec, 0, 0) < 0) {
-#ifdef DEBUG
- printf("fhpibgo: recv failed, retrying...\n");
-#endif
- (void) fhpibrecv(hs, slave, sec, 0, 0);
- }
- i = hd->hpib_cmd;
- hd->hpib_cmd = sc->sc_cmd;
- hd->hpib_ie = IDS_DMA(hs->sc_dq->dq_chan) |
- ((flags & DMAGO_WORD) ? IDS_WDMA : 0);
- return;
- }
- sc->sc_cmd = CT_REN | CT_8BIT | CT_FIFOSEL;
- if (count < hpibdmathresh) {
-#ifdef DEBUG
- /* fhpibnondma[unit]++; XXX */
- if (flags & DMAGO_WORD)
- /* fhpibworddma[unit]--; XXX */ ;
-#endif
- hs->sc_curcnt = count;
- (void) fhpibsend(hs, slave, sec, addr, count);
- fhpibdone(hs);
- return;
- }
- count -= (flags & DMAGO_WORD) ? 2 : 1;
- hs->sc_curcnt = count;
- dmago(hs->sc_dq->dq_chan, addr, count, flags);
- if (fhpibsend(hs, slave, sec, 0, 0) < 0) {
-#ifdef DEBUG
- printf("fhpibgo: send failed, retrying...\n");
-#endif
- (void) fhpibsend(hs, slave, sec, 0, 0);
- }
- i = hd->hpib_cmd;
- hd->hpib_cmd = sc->sc_cmd;
- hd->hpib_ie = IDS_DMA(hs->sc_dq->dq_chan) | IDS_WRITE |
- ((flags & DMAGO_WORD) ? IDS_WDMA : 0);
-}
-
-/*
- * A DMA read can finish but the device can still be waiting (MAG-tape
- * with more data than we're waiting for). This timeout routine
- * takes care of that. Somehow, the thing gets hosed. For now, since
- * this should be a very rare occurrence, we RESET it.
- */
-void
-fhpibdmadone(arg)
- void *arg;
-{
- struct fhpib_softc *sc = arg;
- struct hpibbus_softc *hs = sc->sc_hpibbus;
- int s;
-
- s = splbio();
- if (hs->sc_flags & HPIBF_IO) {
- struct fhpibdevice *hd = sc->sc_regs;
- struct hpibqueue *hq;
-
- hd->hpib_imask = 0;
- hd->hpib_cid = 0xFF;
- DELAY(100);
- hd->hpib_cmd = CT_8BIT;
- hd->hpib_ar = AR_ARONC;
- fhpibifc(hd);
- hd->hpib_ie = IDS_IE;
- hs->sc_flags &= ~(HPIBF_DONE|HPIBF_IO|HPIBF_READ|HPIBF_TIMO);
- dmafree(hs->sc_dq);
-
- hq = TAILQ_FIRST(&hs->sc_queue);
- (hq->hq_intr)(hq->hq_softc);
- }
- splx(s);
-}
-
-void
-fhpibdone(hs)
- struct hpibbus_softc *hs;
-{
- struct fhpib_softc *sc = (struct fhpib_softc *)hs->sc_dev.dv_parent;
- struct fhpibdevice *hd = sc->sc_regs;
- char *addr;
- int cnt;
-
- cnt = hs->sc_curcnt;
- hs->sc_addr += cnt;
- hs->sc_count -= cnt;
-#ifdef DEBUG
- if ((fhpibdebug & FDB_DMA) && fhpibdebugunit == sc->sc_dev.dv_unit)
- printf("fhpibdone: addr %p cnt %d\n",
- hs->sc_addr, hs->sc_count);
-#endif
- if (hs->sc_flags & HPIBF_READ) {
- hd->hpib_imask = IM_IDLE | IM_BYTE;
- if (hs->sc_flags & HPIBF_TIMO)
- timeout_add_msec(&sc->sc_dma_to, 250);
- } else {
- cnt = hs->sc_count;
- if (cnt) {
- addr = hs->sc_addr;
- hd->hpib_imask = IM_IDLE | IM_ROOM;
- FHPIBWAIT(hd, IM_IDLE);
- hd->hpib_stat = ST_WRITE;
- while (--cnt) {
- hd->hpib_data = *addr++;
- FHPIBWAIT(hd, IM_ROOM);
- }
- hd->hpib_stat = ST_EOI;
- hd->hpib_data = *addr;
- }
- hd->hpib_imask = IM_IDLE;
- }
- hs->sc_flags |= HPIBF_DONE;
- hd->hpib_stat = ST_IENAB;
- hd->hpib_ie = IDS_IE;
-}
-
-int
-fhpibintr(arg)
- void *arg;
-{
- struct fhpib_softc *sc = arg;
- struct hpibbus_softc *hs = sc->sc_hpibbus;
- struct fhpibdevice *hd = sc->sc_regs;
- struct hpibqueue *hq;
- int stat0;
-
- stat0 = hd->hpib_ids;
- if ((stat0 & (IDS_IE|IDS_IR)) != (IDS_IE|IDS_IR)) {
-#ifdef DEBUG
- if ((fhpibdebug & FDB_FAIL) && (stat0 & IDS_IR) &&
- (hs->sc_flags & (HPIBF_IO|HPIBF_DONE)) != HPIBF_IO)
- printf("%s: fhpibintr: bad status %x\n",
- sc->sc_dev.dv_xname, stat0);
- /* fhpibbadint[0]++; XXX */
-#endif
- return(0);
- }
- if ((hs->sc_flags & (HPIBF_IO|HPIBF_DONE)) == HPIBF_IO) {
-#ifdef DEBUG
- /* fhpibbadint[1]++; XXX */
-#endif
- return(0);
- }
-
-#ifdef DEBUG
- if ((fhpibdebug & FDB_DMA) && fhpibdebugunit == sc->sc_dev.dv_unit)
- printf("fhpibintr: flags %x\n", hs->sc_flags);
-#endif
- hq = TAILQ_FIRST(&hs->sc_queue);
- if (hs->sc_flags & HPIBF_IO) {
- if (hs->sc_flags & HPIBF_TIMO)
- timeout_del(&sc->sc_dma_to);
- stat0 = hd->hpib_cmd;
- hd->hpib_cmd = sc->sc_cmd & ~CT_8BIT;
- hd->hpib_stat = 0;
- hd->hpib_cmd = CT_REN | CT_8BIT;
- stat0 = hd->hpib_intr;
- hd->hpib_imask = 0;
- hs->sc_flags &= ~(HPIBF_DONE|HPIBF_IO|HPIBF_READ|HPIBF_TIMO);
- dmafree(hs->sc_dq);
- (hq->hq_intr)(hq->hq_softc);
- } else if (hs->sc_flags & HPIBF_PPOLL) {
- stat0 = hd->hpib_intr;
-#ifdef DEBUG
- if ((fhpibdebug & FDB_FAIL) &&
- doppollint && (stat0 & IM_PPRESP) == 0)
- printf("%s: fhpibintr: bad intr reg %x\n",
- sc->sc_dev.dv_xname, stat0);
-#endif
- hd->hpib_stat = 0;
- hd->hpib_imask = 0;
-#ifdef DEBUG
- stat0 = fhpibppoll(hs);
- if ((fhpibdebug & FDB_PPOLL) &&
- fhpibdebugunit == sc->sc_dev.dv_unit)
- printf("fhpibintr: got PPOLL status %x\n", stat0);
- if ((stat0 & (0x80 >> hq->hq_slave)) == 0) {
- /*
- * XXX give it another shot (68040)
- */
- /* fhpibppollfail[unit]++; XXX */
- DELAY(fhpibppolldelay);
- stat0 = fhpibppoll(hs);
- if ((stat0 & (0x80 >> hq->hq_slave)) == 0 &&
- (fhpibdebug & FDB_PPOLL) &&
- fhpibdebugunit == sc->sc_dev.dv_unit)
- printf("fhpibintr: PPOLL: unit %d slave %d stat %x\n",
- sc->sc_dev.dv_unit, hq->hq_slave, stat0);
- }
-#endif
- hs->sc_flags &= ~HPIBF_PPOLL;
- (hq->hq_intr)(hq->hq_softc);
- }
- return(1);
-}
-
-int
-fhpibppoll(hs)
- struct hpibbus_softc *hs;
-{
- struct fhpib_softc *sc = (struct fhpib_softc *)hs->sc_dev.dv_parent;
- struct fhpibdevice *hd = sc->sc_regs;
- int ppoll;
-
- hd->hpib_stat = 0;
- hd->hpib_psense = 0;
- hd->hpib_pmask = 0xFF;
- hd->hpib_imask = IM_PPRESP | IM_PABORT;
- DELAY(25);
- hd->hpib_intr = IM_PABORT;
- ppoll = hd->hpib_data;
- if (hd->hpib_intr & IM_PABORT)
- ppoll = 0;
- hd->hpib_imask = 0;
- hd->hpib_pmask = 0;
- hd->hpib_stat = ST_IENAB;
- return(ppoll);
-}
-
-int
-fhpibwait(hd, x)
- struct fhpibdevice *hd;
- int x;
-{
- int timo = hpibtimeout;
-
- while ((hd->hpib_intr & x) == 0 && --timo)
- DELAY(1);
- if (timo == 0) {
-#ifdef DEBUG
- if (fhpibdebug & FDB_FAIL)
- printf("fhpibwait(%p, %x) timeout\n", hd, x);
-#endif
- return(-1);
- }
- return(0);
-}
-
-/*
- * XXX: this will have to change if we ever allow more than one
- * pending operation per HP-IB.
- */
-void
-fhpibppwatch(arg)
- void *arg;
-{
- struct hpibbus_softc *hs = arg;
- struct fhpib_softc *sc = (struct fhpib_softc *)hs->sc_dev.dv_parent;
- struct fhpibdevice *hd = sc->sc_regs;
- int slave;
-
- if ((hs->sc_flags & HPIBF_PPOLL) == 0)
- return;
- slave = (0x80 >> TAILQ_FIRST(&hs->sc_queue)->hq_slave);
-#ifdef DEBUG
- if (!doppollint) {
- if (fhpibppoll(hs) & slave) {
- hd->hpib_stat = ST_IENAB;
- hd->hpib_imask = IM_IDLE | IM_ROOM;
- } else {
- timeout_set(&sc->sc_watch_to, fhpibppwatch, hs);
- timeout_add(&sc->sc_watch_to, 1);
- }
- return;
- }
- if ((fhpibdebug & FDB_PPOLL) && sc->sc_dev.dv_unit == fhpibdebugunit)
- printf("fhpibppwatch: sense request on %s\n",
- sc->sc_dev.dv_xname);
-#endif
- hd->hpib_psense = ~slave;
- hd->hpib_pmask = slave;
- hd->hpib_stat = ST_IENAB;
- hd->hpib_imask = IM_PPRESP | IM_PABORT;
- hd->hpib_ie = IDS_IE;
-}
diff --git a/sys/arch/hp300/dev/fhpibreg.h b/sys/arch/hp300/dev/fhpibreg.h
deleted file mode 100644
index d30661b963d..00000000000
--- a/sys/arch/hp300/dev/fhpibreg.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* $OpenBSD: fhpibreg.h,v 1.3 2003/06/02 23:27:44 millert Exp $ */
-/* $NetBSD: fhpibreg.h,v 1.4 1994/10/26 07:23:45 cgd Exp $ */
-
-/*
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)fhpibreg.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <hp300/dev/iotypes.h> /* XXX */
-
-struct fhpibdevice {
- u_char hpib_pad0;
- vu_char hpib_cid;
- u_char hpib_pad1;
-#define hpib_ie hpib_ids
- vu_char hpib_ids;
- u_char hpib_pad2;
- vu_char hpib_ctrl2;
- u_char hpib_pad3;
- vu_char hpib_latch;
- u_char hpib_pad4[9];
- vu_char hpib_intr;
- u_char hpib_pad5;
- vu_char hpib_imask;
- u_char hpib_pad6;
- vu_char hpib_data;
- u_char hpib_pad7;
- vu_char hpib_stat;
- u_char hpib_pad8;
- vu_char hpib_cmd;
- u_char hpib_pad9;
- vu_char hpib_ar;
- u_char hpib_pad10;
- vu_char hpib_pmask;
- u_char hpib_pad11;
- vu_char hpib_psense;
-};
-
-/* status bits */
-#define ST_READ0 0xC0
-#define ST_READ1 0x80
-#define ST_IENAB 0x80
-#define ST_EOI 0x80
-#define ST_ATN 0x40
-#define ST_WRITE 0x00
-
-/* control bits */
-#define CT_8BIT 0x80
-#define CT_REN 0x20
-#define CT_IFC 0x10
-#define CT_FIFOSEL 0x02
-#define CT_INITFIFO 0x01
-
-#define IM_PABORT 0x40
-#define IM_PPRESP 0x20
-#define IM_ROOM 0x08
-#define IM_BYTE 0x04
-#define IM_IDLE 0x02
-
-#define AR_ARONC 0x80
diff --git a/sys/arch/hp300/dev/frodo.c b/sys/arch/hp300/dev/frodo.c
deleted file mode 100644
index a8589989aea..00000000000
--- a/sys/arch/hp300/dev/frodo.c
+++ /dev/null
@@ -1,484 +0,0 @@
-/* $OpenBSD: frodo.c,v 1.14 2011/08/18 19:54:18 miod Exp $ */
-/* $NetBSD: frodo.c,v 1.5 1999/07/31 21:15:20 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 1997 Michael Smith. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Support for the "Frodo" (a.k.a. "Apollo Utility") chip found
- * in HP Apollo 9000/4xx workstations, as well as HP 9000/382.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/syslog.h>
-#include <sys/device.h>
-
-#include <machine/bus.h>
-#include <machine/cpu.h>
-#include <machine/intr.h>
-#include <machine/hp300spu.h>
-
-#include <hp300/dev/intiovar.h>
-
-#include <hp300/dev/frodoreg.h>
-#include <hp300/dev/frodovar.h>
-
-#include "isabr.h"
-
-#if NISABR > 0
-#include <uvm/uvm_extern.h>
-
-#include <dev/isa/isareg.h>
-#include <hp300/dev/isabrreg.h>
-#endif
-
-struct frodo_softc {
- struct device sc_dev; /* generic device glue */
- volatile u_int8_t *sc_regs; /* register base */
- struct isr *sc_intr[FRODO_NINTR]; /* interrupt handlers */
- struct isr sc_isr; /* main interrupt handler */
- u_int sc_refcnt; /* number of interrupt refs */
-};
-
-int frodomatch(struct device *, void *, void *);
-void frodoattach(struct device *, struct device *, void *);
-
-int frodoprint(void *, const char *);
-int frodosubmatch(struct device *, void *, void *);
-
-int frodointr(void *);
-void frodo_imask(struct frodo_softc *, u_int16_t, u_int16_t);
-int frodo_isa_exists(void);
-void frodo_state(struct frodo_softc *);
-
-struct cfattach frodo_ca = {
- sizeof(struct frodo_softc), frodomatch, frodoattach
-};
-
-struct cfdriver frodo_cd = {
- NULL, "frodo", DV_DULL
-};
-
-struct frodo_attach_args frodo_subdevs[] = {
- { "dnkbd", NULL, FRODO_APCI_OFFSET(0), FRODO_INTR_APCI0 },
- { "apci", NULL, FRODO_APCI_OFFSET(1), FRODO_INTR_APCI1 },
- { "apci", NULL, FRODO_APCI_OFFSET(2), FRODO_INTR_APCI2 },
- { "apci", NULL, FRODO_APCI_OFFSET(3), FRODO_INTR_APCI3 },
- { NULL, NULL, 0, 0 },
-};
-
-#define FRODO_IPL 5
-
-int
-frodomatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct intio_attach_args *ia = aux;
- caddr_t va;
- static int frodo_matched = 0;
-
- /* only allow one instance */
- if (frodo_matched)
- return (0);
-
- /* only specific workstations can have this */
- switch (machineid) {
- case HP_382:
- case HP_400:
- case HP_425:
- case HP_433:
- break;
-
- default:
- return (0);
- }
-
- /* make sure the hardware is there in any case */
- va = (caddr_t)IIOV(FRODO_BASE);
- if (badaddr(va))
- return (0);
-
- frodo_matched = 1;
- ia->ia_addr = (caddr_t)FRODO_BASE;
- return (1);
-}
-
-void
-frodoattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct frodo_softc *sc = (struct frodo_softc *)self;
- struct intio_attach_args *ia = aux;
- int i;
-
- sc->sc_regs = (volatile u_int8_t *)IIOV(ia->ia_addr);
-
- printf(" ipl %d", FRODO_IPL);
- if ((FRODO_READ(sc, FRODO_IISR) & FRODO_IISR_SERVICE) == 0)
- printf(": service mode enabled");
- printf("\n");
-
- /* Clear all of the interrupt handlers. */
- bzero(sc->sc_intr, sizeof(sc->sc_intr));
-
- /*
- * Disable all of the interrupt lines; we reenable them
- * as subdevices attach.
- */
- frodo_imask(sc, 0, 0xffff);
-
- /* Clear any pending interrupts. */
- FRODO_WRITE(sc, FRODO_PIC_PU, 0xff);
- FRODO_WRITE(sc, FRODO_PIC_PL, 0xff);
-
- /* Set interrupt polarities... */
- FRODO_WRITE(sc, FRODO_PIO_IPR, 0x10);
-
- /* ...and configure 1-5 for edge triggering. */
- FRODO_WRITE(sc, FRODO_PIO_IELR, 0xc1);
-
- /* Initialize IVR high half to zero so we don't need to mask it later */
- FRODO_WRITE(sc, FRODO_PIC_IVR, 0x00);
-
- /* Mask ISA interrupts until an ISA interrupt handler is registered. */
- FRODO_WRITE(sc, FRODO_PIO_ISA_CONTROL, 0x80);
-
- /*
- * We defer hooking up our interrupt handler until
- * a subdevice hooks up theirs.
- */
- sc->sc_refcnt = 0;
-
- /* ... and attach subdevices. */
- for (i = 0; frodo_subdevs[i].fa_name != NULL; i++) {
- /*
- * Skip the first serial port if we're not a 425e;
- * it's mapped to the DCA at select code 9 on all
- * other models.
- */
- if (frodo_subdevs[i].fa_offset == FRODO_APCI_OFFSET(1) &&
- mmuid != MMUID_425_E)
- continue;
- frodo_subdevs[i].fa_tag = ia->ia_tag;
- config_found_sm(self, &frodo_subdevs[i],
- frodoprint, frodosubmatch);
- }
-
-#if NISABR > 0
- /*
- * Only attempt to attach the isa bridge if it exists on this
- * machine.
- */
- if (frodo_isa_exists()) {
- struct frodo_attach_args fa;
-
- fa.fa_name = "isabr";
- fa.fa_tag = ia->ia_tag;
- fa.fa_offset = fa.fa_line = 0;
- config_found_sm(self, &fa, frodoprint, frodosubmatch);
- }
-#endif
-}
-
-int
-frodosubmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct cfdata *cf = match;
- struct frodo_attach_args *fa = aux;
-
- if (cf->frodocf_offset != FRODO_UNKNOWN_OFFSET &&
- cf->frodocf_offset != fa->fa_offset)
- return (0);
-
- return ((*cf->cf_attach->ca_match)(parent, cf, aux));
-}
-
-int
-frodoprint(aux, pnp)
- void *aux;
- const char *pnp;
-{
- struct frodo_attach_args *fa = aux;
-
- if (pnp)
- printf("%s at %s", fa->fa_name, pnp);
- printf(" offset 0x%x", fa->fa_offset);
- return (UNCONF);
-}
-
-int
-frodo_intr_establish(struct device *frdev, int line, struct isr *isr,
- const char *name)
-{
- struct frodo_softc *sc = (struct frodo_softc *)frdev;
- int priority = isr->isr_priority;
-
- if (line <= 0 || line >= FRODO_NINTR) {
- panic("%s: bad interrupt line %d",
- sc->sc_dev.dv_xname, line);
- }
- if (sc->sc_intr[line] != NULL) {
-#ifdef DEBUG
- printf("%s: interrupt line %d already used\n",
- sc->sc_dev.dv_xname, line);
-#endif
- return (EPERM);
- }
-
- /*
- * If this is the first one, establish the frodo
- * interrupt handler. If not, reestablish at a
- * higher priority if necessary.
- */
- if (sc->sc_isr.isr_priority < priority) {
- if (sc->sc_refcnt != 0)
- intr_disestablish(&sc->sc_isr);
- sc->sc_isr.isr_func = frodointr;
- sc->sc_isr.isr_arg = sc;
- sc->sc_isr.isr_ipl = FRODO_IPL;
- sc->sc_isr.isr_priority = priority;
- intr_establish(&sc->sc_isr, sc->sc_dev.dv_xname);
- }
-
- sc->sc_refcnt++;
-
- /* Install the handler. */
- isr->isr_ipl = sc->sc_isr.isr_ipl;
- evcount_attach(&isr->isr_count, name, &isr->isr_ipl);
- sc->sc_intr[line] = isr;
-
- /* Enable the interrupt line. */
- frodo_imask(sc, FRODO_INTR_BIT(line), 0);
-
-#if NISABR > 0
- /* Unmask ISA interrupts if necessary. */
- if (FRODO_INTR_ISA(line))
- FRODO_WRITE(sc, FRODO_PIO_ISA_CONTROL, 0x00);
-#endif
-
- return (0);
-}
-
-void
-frodo_intr_disestablish(frdev, line)
- struct device *frdev;
- int line;
-{
- struct frodo_softc *sc = (struct frodo_softc *)frdev;
- int newpri;
-
-#ifdef DIAGNOSTIC
- if (sc->sc_intr[line] == NULL) {
- printf("%s(%s): no handler for line %d",
- sc->sc_dev.dv_xname, __func__, line);
- return;
- }
-#endif
-
- sc->sc_intr[line] = NULL;
- frodo_imask(sc, 0, FRODO_INTR_BIT(line));
-
-#if NISABR > 0
- /* Mask ISA interrupts if necessary. */
- if (FRODO_INTR_ISA(line)) {
- if (sc->sc_intr[FRODO_INTR_ILOW] == NULL &&
- sc->sc_intr[FRODO_INTR_IMID] == NULL &&
- sc->sc_intr[FRODO_INTR_IHI] == NULL)
- FRODO_WRITE(sc, FRODO_PIO_ISA_CONTROL, 0x80);
- }
-#endif
-
- /* If this was the last, unhook ourselves. */
- if (sc->sc_refcnt-- == 1) {
- intr_disestablish(&sc->sc_isr);
- return;
- }
-
- /* Lower our priority, if appropriate. */
- for (newpri = 0, line = 0; line < FRODO_NINTR; line++)
- if (sc->sc_intr[line] != NULL &&
- sc->sc_intr[line]->isr_priority > newpri)
- newpri = sc->sc_intr[line]->isr_priority;
-
- if (newpri != sc->sc_isr.isr_priority) {
- intr_disestablish(&sc->sc_isr);
- sc->sc_isr.isr_func = frodointr;
- sc->sc_isr.isr_arg = sc;
- sc->sc_isr.isr_ipl = FRODO_IPL;
- sc->sc_isr.isr_priority = newpri;
- intr_establish(&sc->sc_isr, sc->sc_dev.dv_xname);
- }
-}
-
-int
-frodointr(arg)
- void *arg;
-{
- struct frodo_softc *sc = arg;
- struct isr *fisr;
- int pending, line, rc = 0;
-
-#ifdef DEBUG
- frodo_state(sc);
-#endif
-
- /* Any interrupts pending? */
- while ((pending = FRODO_GETPEND(sc)) != 0) {
- rc++;
-
- /*
- * Get pending interrupt; this also clears it for us.
- */
- line = FRODO_READ(sc, FRODO_PIC_ACK) /* & 0x0f */;
-
- fisr = sc->sc_intr[line];
- if (fisr == NULL) {
- printf("%s: unhandled interrupt on line %d\n",
- sc->sc_dev.dv_xname, line);
-#ifdef DEBUG
- /* Disable interrupt source */
- frodo_imask(sc, 0, FRODO_INTR_BIT(line));
-#endif
- } else {
- if ((*fisr->isr_func)(fisr->isr_arg) != 0) {
- fisr->isr_count.ec_count++;
- } else {
- printf("%s: spurious interrupt on line %d\n",
- sc->sc_dev.dv_xname, line);
- }
- }
-
- if (rc > 100)
- panic("frodointr: looping, pending %x line %d fisr %p",
- pending, line, fisr);
-
-#ifdef DEBUG
- frodo_state(sc);
-#endif
- }
-
- return (rc);
-}
-
-void
-frodo_imask(sc, set, clear)
- struct frodo_softc *sc;
- u_int16_t set, clear;
-{
- u_int16_t imask;
-
- imask = FRODO_GETMASK(sc);
-
- imask |= set;
- imask &= ~clear;
-
- FRODO_SETMASK(sc, imask);
-}
-
-#ifdef DEBUG
-void
-frodo_state(struct frodo_softc *sc)
-{
- int i;
-
- printf("%s state:", sc->sc_dev.dv_xname);
- for (i = 0xc0; i < 0x100; i += 4) {
- printf(" %02x", FRODO_READ(sc, i));
- if (i == 0xcc || i == 0xdc || i == 0xec)
- printf(" /");
- }
- printf("\n");
-}
-#endif
-
-#if NISABR > 0
-int
-frodo_isa_exists()
-{
- vaddr_t va;
- int rv;
-
- va = uvm_km_valloc(kernel_map, PAGE_SIZE);
- if (va == NULL)
- return (0);
-
- /*
- * Check that the iomem space answers probes
- */
- pmap_kenter_cache(va, ISABR_IOMEM_BASE, PG_RW | PG_CI);
- pmap_update(pmap_kernel());
- rv = badbaddr((caddr_t)va);
- pmap_kremove(va, PAGE_SIZE);
- pmap_update(pmap_kernel());
-
- /*
- * Check that the ioport space answers probes
- */
- pmap_kenter_cache(va, ISABR_IOPORT_BASE, PG_RW | PG_CI);
- pmap_update(pmap_kernel());
- rv |= badbaddr((caddr_t)va);
- pmap_kremove(va, PAGE_SIZE);
- pmap_update(pmap_kernel());
-
- uvm_km_free(kernel_map, va, PAGE_SIZE);
-
- return (!rv);
-}
-#endif
diff --git a/sys/arch/hp300/dev/frodoreg.h b/sys/arch/hp300/dev/frodoreg.h
deleted file mode 100644
index 07b2280e4c3..00000000000
--- a/sys/arch/hp300/dev/frodoreg.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/* $OpenBSD: frodoreg.h,v 1.2 2007/01/06 20:17:43 miod Exp $ */
-/* $NetBSD: frodoreg.h,v 1.1 1997/05/12 08:03:49 thorpej Exp $ */
-
-/*
- * Copyright (c) 1997 Michael Smith. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* Base address of the Frodo part */
-#define FRODO_BASE (INTIOBASE + 0x1c000)
-
-/*
- * Where we find the 8250-like APCI ports, and how far apart they are.
- */
-#define FRODO_APCIBASE 0x0
-#define FRODO_APCISPACE 0x20
-#define FRODO_APCI_OFFSET(x) (FRODO_APCIBASE + ((x) * FRODO_APCISPACE))
-
-/*
- * Other items in the Frodo part
- */
-
-/* An mc146818-like calendar, but no battery... lame */
-#define FRODO_CALENDAR 0x80
-
-#define FRODO_TIMER 0xa0 /* 8254-like timer */
-#define FRODO_T1_CTR 0xa0 /* counter 1 */
-#define FRODO_T2_CTR 0xa4 /* counter 2 */
-#define FRODO_T3_CTR 0xa8 /* counter 3 */
-#define FRODO_T_CTRL 0xac /* control register */
-#define FRODO_T_PSCALE 0xb0 /* prescaler */
-#define FRODO_T_PCOUNT 0xb4 /* precounter ? */
-#define FRODO_T_OVCOUNT 0xb8 /* overflow counter (0, 1, 2) */
-
-#define FRODO_PIO 0xc0 /* programmable i/o registers start
- here */
-#define FRODO_IISR 0xc0 /* ISA Interrupt Status Register
- (also PIR) */
-#define FRODO_IISR_SERVICE (1<<0) /* service switch "on" if 0 */
-#define FRODO_IISR_ILOW (1<<1) /* IRQ 3,4,5 or 6 on ISA if 0 */
-#define FRODO_IISR_IMID (1<<2) /* IRQ 7,9,10 or 11 on ISA if 0 */
-#define FRODO_IISR_IHI (1<<3) /* IRQ 12,13,14 or 15 on ISA if 0 */
- /* bits 4 and 5 are DN2500 SCSI interrupts */
- /* bit 6 is unused */
-#define FRODO_IISR_IOCHK (1<<7) /* ISA board asserted IOCHK if low */
-
-#define FRODO_PIO_IPR 0xc4 /* input polarity register
- (ints 7->0) */
-
-#define FRODO_PIO_IELR 0xc8 /* input edge/level register */
-#define FRODO_PIO_ISA_CONTROL 0xcc /* ISA interrupts masking */
-
-/* This is probably not used on the 4xx */
-#define FRODO_DIAGCTL 0xd0 /* Diagnostic Control Register */
-
-#define FRODO_PIC_MU 0xe0 /* upper Interrupt Mask register */
-#define FRODO_PIC_ML 0xe4 /* lower Interrupt Mask register */
-#define FRODO_PIC_PU 0xe8 /* upper Interrupt Pending register */
-#define FRODO_PIC_PL 0xec /* lower Interrupt Pending register */
-#define FRODO_PIC_IVR 0xf8 /* Interrupt Vector register */
-#define FRODO_PIC_ACK 0xf8 /* Interrupt Acknowledge */
-
-/* Shorthand for register access. */
-#define FRODO_READ(sc, reg) ((sc)->sc_regs[(reg)])
-#define FRODO_WRITE(sc, reg, val) (sc)->sc_regs[(reg)] = (val)
-
-/* manipulate interrupt registers */
-#define FRODO_GETMASK(sc) \
- ((FRODO_READ((sc), FRODO_PIC_MU) << 8) | \
- FRODO_READ((sc), FRODO_PIC_ML))
-#define FRODO_SETMASK(sc, val) do { \
- FRODO_WRITE((sc), FRODO_PIC_MU, ((val) >> 8) & 0xff); \
- FRODO_WRITE((sc), FRODO_PIC_ML, (val) & 0xff); } while (0)
-
-#define FRODO_GETPEND(sc) \
- ((FRODO_READ((sc), FRODO_PIC_PU) << 8) | \
- FRODO_READ((sc), FRODO_PIC_PL))
-
-/*
- * Interrupt lines. Use FRODO_INTR_BIT() below to get a bit
- * suitable for one of the interrupt mask registers. Yes, line
- * 0 is unused.
- */
-#define FRODO_INTR_ILOW 1
-#define FRODO_INTR_IMID 2
-#define FRODO_INTR_IHI 3
-#define FRODO_INTR_SCSIDMA 4 /* DN2500 only */
-#define FRODO_INTR_SCSI 5 /* DN2500 only */
-#define FRODO_INTR_HORIZ 6
-#define FRODO_INTR_IOCHK 7
-#define FRODO_INTR_CALENDAR 8
-#define FRODO_INTR_TIMER0 9
-#define FRODO_INTR_TIMER1 10
-#define FRODO_INTR_TIMER2 11
-#define FRODO_INTR_APCI0 12
-#define FRODO_INTR_APCI1 13
-#define FRODO_INTR_APCI2 14
-#define FRODO_INTR_APCI3 15
-
-#define FRODO_NINTR 16
-
-#define FRODO_INTR_ISA(l) ((l) != 0 && (l) <= FRODO_INTR_IHI)
-#define FRODO_INTR_BIT(line) (1 << (line))
diff --git a/sys/arch/hp300/dev/frodovar.h b/sys/arch/hp300/dev/frodovar.h
deleted file mode 100644
index 3f78a022f4b..00000000000
--- a/sys/arch/hp300/dev/frodovar.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* $OpenBSD: frodovar.h,v 1.7 2007/01/06 20:17:43 miod Exp $ */
-/* $NetBSD: frodovar.h,v 1.1 1997/05/12 08:03:50 thorpej Exp $ */
-
-/*
- * Copyright (c) 1997 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1997 Michael Smith. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Autoconfiguration definitions and prototypes for the Frodo ASIC in
- * the HP 9000/4xx series.
- */
-
-/*
- * Arguments used to attach Frodo subdevices.
- */
-struct frodo_attach_args {
- const char *fa_name; /* device name */
- bus_space_tag_t fa_tag;
- int fa_offset; /* offset from Frodo base */
- int fa_line; /* Frodo interrupt line */
-};
-
-#define frodocf_offset cf_loc[0]
-#define FRODO_UNKNOWN_OFFSET -1
-
-int frodo_intr_establish(struct device *, int, struct isr *, const char *);
-void frodo_intr_disestablish(struct device *, int);
diff --git a/sys/arch/hp300/dev/gbox.c b/sys/arch/hp300/dev/gbox.c
deleted file mode 100644
index 7ec25558432..00000000000
--- a/sys/arch/hp300/dev/gbox.c
+++ /dev/null
@@ -1,452 +0,0 @@
-/* $OpenBSD: gbox.c,v 1.17 2013/10/21 10:36:12 miod Exp $ */
-
-/*
- * Copyright (c) 2005, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_gb.c 1.18 93/08/13$
- *
- * @(#)grf_gb.c 8.4 (Berkeley) 1/12/94
- */
-
-/*
- * Graphics routines for the Gatorbox.
- *
- * Note: In the context of this system, "gator" and "gatorbox" both refer to
- * HP 987x0 graphics systems. "Gator" is not used for high res mono.
- * (as in 9837 Gator systems)
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/proc.h>
-#include <sys/ioctl.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-#include <hp300/dev/intiovar.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/rasops/rasops.h>
-
-#include <hp300/dev/diofbreg.h>
-#include <hp300/dev/diofbvar.h>
-#include <hp300/dev/gboxreg.h>
-
-struct gbox_softc {
- struct device sc_dev;
- struct diofb *sc_fb;
- struct diofb sc_fb_store;
- int sc_scode;
-};
-
-int gbox_dio_match(struct device *, void *, void *);
-void gbox_dio_attach(struct device *, struct device *, void *);
-int gbox_intio_match(struct device *, void *, void *);
-void gbox_intio_attach(struct device *, struct device *, void *);
-
-struct cfattach gbox_dio_ca = {
- sizeof(struct gbox_softc), gbox_dio_match, gbox_dio_attach
-};
-
-struct cfattach gbox_intio_ca = {
- sizeof(struct gbox_softc), gbox_intio_match, gbox_intio_attach
-};
-
-struct cfdriver gbox_cd = {
- NULL, "gbox", DV_DULL
-};
-
-int gbox_reset(struct diofb *, int, struct diofbreg *);
-void gbox_restore(struct diofb *);
-int gbox_setcmap(struct diofb *, struct wsdisplay_cmap *);
-void gbox_setcolor(struct diofb *, u_int);
-int gbox_windowmove(struct diofb *, u_int16_t, u_int16_t, u_int16_t,
- u_int16_t, u_int16_t, u_int16_t, int16_t, int16_t);
-
-int gbox_ioctl(void *, u_long, caddr_t, int, struct proc *);
-void gbox_burner(void *, u_int, u_int);
-
-struct wsdisplay_accessops gbox_accessops = {
- .ioctl = gbox_ioctl,
- .mmap = diofb_mmap,
- .alloc_screen = diofb_alloc_screen,
- .free_screen = diofb_free_screen,
- .show_screen = diofb_show_screen,
- .load_font = diofb_load_font,
- .list_font = diofb_list_font,
- .burn_screen = gbox_burner
-};
-
-/*
- * Attachment glue
- */
-int
-gbox_intio_match(struct device *parent, void *match, void *aux)
-{
- struct intio_attach_args *ia = aux;
- struct diofbreg *fbr;
-
- fbr = (struct diofbreg *)IIOV(GRFIADDR);
-
- if (badaddr((caddr_t)fbr))
- return (0);
-
- if (fbr->id == GRFHWID && fbr->fbid == GID_GATORBOX) {
- ia->ia_addr = (caddr_t)GRFIADDR;
- return (1);
- }
-
- return (0);
-}
-
-void
-gbox_intio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct gbox_softc *sc = (struct gbox_softc *)self;
- struct diofbreg *fbr;
-
- fbr = (struct diofbreg *)IIOV(GRFIADDR);
- sc->sc_scode = CONSCODE_INTERNAL;
-
- if (sc->sc_scode == conscode) {
- sc->sc_fb = &diofb_cn;
- } else {
- sc->sc_fb = &sc->sc_fb_store;
- gbox_reset(sc->sc_fb, sc->sc_scode, fbr);
- }
-
- diofb_end_attach(sc, &gbox_accessops, sc->sc_fb,
- sc->sc_scode == conscode, NULL);
-}
-
-int
-gbox_dio_match(struct device *parent, void *match, void *aux)
-{
- struct dio_attach_args *da = aux;
-
- /* We can not appear in DIO-II space */
- if (DIO_ISDIOII(da->da_scode))
- return (0);
-
- if (da->da_id == DIO_DEVICE_ID_FRAMEBUFFER &&
- da->da_secid == DIO_DEVICE_SECID_GATORBOX)
- return (1);
-
- return (0);
-}
-
-void
-gbox_dio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct gbox_softc *sc = (struct gbox_softc *)self;
- struct dio_attach_args *da = aux;
- struct diofbreg * fbr;
-
- sc->sc_scode = da->da_scode;
- if (sc->sc_scode == conscode) {
- fbr = (struct diofbreg *)conaddr; /* already mapped */
- sc->sc_fb = &diofb_cn;
- } else {
- sc->sc_fb = &sc->sc_fb_store;
- fbr = (struct diofbreg *)
- iomap(dio_scodetopa(sc->sc_scode), da->da_size);
- if (fbr == NULL ||
- gbox_reset(sc->sc_fb, sc->sc_scode, fbr) != 0) {
- printf(": can't map framebuffer\n");
- return;
- }
- }
-
- diofb_end_attach(sc, &gbox_accessops, sc->sc_fb,
- sc->sc_scode == conscode, NULL);
-}
-
-/*
- * Initialize hardware and display routines.
- */
-
-const u_int8_t crtc_init_data[] = {
- 0x29, 0x20, 0x23, 0x04, 0x30, 0x0b, 0x30,
- 0x30, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00
-};
-
-int
-gbox_reset(struct diofb *fb, int scode, struct diofbreg *fbr)
-{
- int rc;
- u_int i;
-
- /* XXX don't trust hardware, force defaults */
- fb->fbwidth = 1024;
- fb->fbheight = 1024;
- fb->dwidth = 1024;
- fb->dheight = 768;
- if ((rc = diofb_fbinquire(fb, scode, fbr)) != 0)
- return (rc);
-
- fb->bmv = gbox_windowmove;
- gbox_restore(fb);
-
- /*
- * Find out how many colors are available by determining
- * which planes are installed. That is, write all ones to
- * a frame buffer location, see how many ones are read back.
- */
- if (1 /* fb->planes == 0 */) {
- volatile u_int8_t *fbp;
- u_int8_t save;
-
- fbp = (u_int8_t *)fb->fbkva;
- save = *fbp;
- *fbp = 0xff;
- fb->planemask = *fbp;
- *fbp = save;
-
- for (fb->planes = 1; fb->planemask >= (1 << fb->planes);
- fb->planes++);
- if (fb->planes > 8)
- fb->planes = 8;
- fb->planemask = (1 << fb->planes) - 1;
- }
-
- diofb_fbsetup(fb);
- for (i = 0; i <= fb->planemask; i++)
- gbox_setcolor(fb, i);
-
- return (0);
-}
-
-void
-gbox_restore(struct diofb *fb)
-{
- volatile struct gboxfb *gb = (struct gboxfb *)fb->regkva;
- u_int i;
-
- /*
- * The minimal info here is from the Gatorbox X driver.
- */
- gb->write_protect = 0x0;
- gb->regs.interrupt = 0x4;
- gb->rep_rule = RR_COPY;
- gb->blink1 = 0xff;
- gb->blink2 = 0xff;
-
- /*
- * Program the 6845.
- */
- for (i = 0; i < sizeof(crtc_init_data); i++) {
- gb->crtc_address = i;
- gb->crtc_data = crtc_init_data[i];
- }
-
- tile_mover_waitbusy(gb);
-
- /* Enable display */
- gb->regs.sec_interrupt = 0x01;
-}
-
-int
-gbox_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p)
-{
- struct diofb *fb = v;
- struct wsdisplay_fbinfo *wdf;
- u_int i;
-
- switch (cmd) {
- case WSDISPLAYIO_GTYPE:
- *(u_int *)data = WSDISPLAY_TYPE_GBOX;
- break;
- case WSDISPLAYIO_SMODE:
- fb->mapmode = *(u_int *)data;
- if (fb->mapmode == WSDISPLAYIO_MODE_EMUL) {
- gbox_restore(fb);
- for (i = 0; i <= fb->planemask; i++)
- gbox_setcolor(fb, i);
- }
- break;
- case WSDISPLAYIO_GINFO:
- wdf = (void *)data;
- wdf->width = fb->ri.ri_width;
- wdf->height = fb->ri.ri_height;
- wdf->depth = fb->ri.ri_depth;
- wdf->cmsize = 1 << fb->planes;
- break;
- case WSDISPLAYIO_LINEBYTES:
- *(u_int *)data = fb->ri.ri_stride;
- break;
- case WSDISPLAYIO_GETCMAP:
- return (diofb_getcmap(fb, (struct wsdisplay_cmap *)data));
- case WSDISPLAYIO_PUTCMAP:
- return (gbox_setcmap(fb, (struct wsdisplay_cmap *)data));
- case WSDISPLAYIO_GVIDEO:
- case WSDISPLAYIO_SVIDEO:
- break;
- default:
- return (-1);
- }
-
- return (0);
-}
-
-void
-gbox_burner(void *v, u_int on, u_int flags)
-{
- struct diofb *fb = v;
- volatile struct gboxfb *gb = (struct gboxfb *)fb->regkva;
-
- if (on)
- gb->regs.sec_interrupt = 0x01;
- else
- gb->regs.sec_interrupt = 0x00;
-}
-
-void
-gbox_setcolor(struct diofb *fb, u_int index)
-{
- volatile struct gboxfb *gb = (struct gboxfb *)fb->regkva;
-
- gb->creg_select = index;
- gb->cmap_red = fb->cmap.r[index];
- gb->cmap_grn = fb->cmap.g[index];
- gb->cmap_blu = fb->cmap.b[index];
- gb->cmap_write = !!index;
- gbcm_waitbusy(gb);
-}
-
-int
-gbox_setcmap(struct diofb *fb, struct wsdisplay_cmap *cm)
-{
- u_int8_t r[256], g[256], b[256];
- u_int index = cm->index, count = cm->count;
- u_int colcount = 1 << fb->planes;
- int error;
-
- if (index >= colcount || count > colcount - index)
- return (EINVAL);
-
- if ((error = copyin(cm->red, r, count)) != 0)
- return (error);
- if ((error = copyin(cm->green, g, count)) != 0)
- return (error);
- if ((error = copyin(cm->blue, b, count)) != 0)
- return (error);
-
- bcopy(r, fb->cmap.r + index, count);
- bcopy(g, fb->cmap.g + index, count);
- bcopy(b, fb->cmap.b + index, count);
-
- while (count-- != 0)
- gbox_setcolor(fb, index++);
-
- return (0);
-}
-
-int
-gbox_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy,
- u_int16_t dx, u_int16_t dy, u_int16_t cx, u_int16_t cy, int16_t rop,
- int16_t planemask)
-{
- volatile struct gboxfb *gb = (struct gboxfb *)fb->regkva;
- int src, dest;
-
- if (planemask != 0xff)
- return (EINVAL);
-
- src = (sy * 1024) + sx; /* upper left corner in pixels */
- dest = (dy * 1024) + dx;
-
- tile_mover_waitbusy(gb);
-
- gb->width = -(cx / 4);
- gb->height = -(cy / 4);
- if (src < dest)
- gb->rep_rule = MOVE_DOWN_RIGHT | rop;
- else {
- gb->rep_rule = MOVE_UP_LEFT | rop;
- /*
- * Adjust to top of lower right tile of the block.
- */
- src = src + ((cy - 4) * 1024) + (cx - 4);
- dest= dest + ((cy - 4) * 1024) + (cx - 4);
- }
- *(volatile u_int8_t *)(fb->fbkva + dest) =
- *(volatile u_int8_t *)(fb->fbkva + src);
-
- tile_mover_waitbusy(gb);
-
- return (0);
-}
-
-/*
- * Gatorbox console support
- */
-
-void
-gboxcninit()
-{
- gbox_reset(&diofb_cn, conscode, (struct diofbreg *)conaddr);
- diofb_cnattach(&diofb_cn);
-}
diff --git a/sys/arch/hp300/dev/gboxreg.h b/sys/arch/hp300/dev/gboxreg.h
deleted file mode 100644
index 64597b6cc85..00000000000
--- a/sys/arch/hp300/dev/gboxreg.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* $OpenBSD: gboxreg.h,v 1.2 2005/01/24 21:36:39 miod Exp $ */
-/* $NetBSD: grf_gbreg.h,v 1.4 1994/10/26 07:23:53 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_gbreg.h 1.11 92/01/21$
- *
- * @(#)grf_gbreg.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * Gatorbox driver regs
- */
-
-#define TILER_ENABLE 0x80
-#define LINE_MOVER_ENABLE 0x80
-#define UP_LEFT 0x00
-#define DOWN_RIGHT 0x40
-#define MOVE_UP_LEFT (TILER_ENABLE | UP_LEFT)
-#define MOVE_DOWN_RIGHT (TILER_ENABLE | DOWN_RIGHT)
-
-#define tile_mover_waitbusy(regaddr) \
-do { \
- while (((struct gboxfb *)(regaddr))->regs.sec_interrupt & 0x10) \
- DELAY(1); \
-} while (0)
-
-#define line_mover_waitbusy(regaddr) \
-do { \
- while ((((struct gboxfb *)(regaddr))->status & 0x80) == 0) \
- DELAY(1); \
-} while (0)
-
-#define gbcm_waitbusy(regaddr) \
-do { \
- while (((struct gboxfb *)(regaddr))->cmap_busy != 0xff) \
- DELAY(1); \
-} while (0)
-
-struct gboxfb {
- struct diofbreg regs;
- u_int8_t f2[0x4000-0x5f-1];
- u_int8_t crtc_address; /* CTR controller address reg 0x4000 */
- u_int8_t status; /* Status register 0x4001 */
- u_int8_t crtc_data; /* CTR controller data reg 0x4002 */
- u_int8_t f3[6];
- u_int8_t line_mover_rep_rule; /* Line move rep rule */
- u_int8_t :8, :8;
- u_int8_t line_mover_width; /* Line move width */
- u_int8_t f4[0xff3];
- u_int8_t width; /* width in tiles 0x5001 */
- u_int8_t :8;
- u_int8_t height; /* height in tiles 0x5003 */
- u_int8_t f5[3];
- u_int8_t rep_rule; /* replacement rule 0x5007 */
- u_int8_t f6[0x6001-0x5007-1];
- u_int8_t blink1; /* blink 1 0x6001 */
- u_int8_t f7[3];
- u_int8_t blink2; /* blink 2 0x6005 */
- u_int8_t f8[3];
- u_int8_t write_protect; /* write protect 0x6009 */
- u_int8_t f9[0x6803-0x6009-1];
- u_int8_t cmap_busy; /* color map busy 0x6803 */
- u_int8_t f10[0x68b9-0x6803-1];
- u_int8_t creg_select; /* color map register select 0x68b8 */
- u_int8_t f11[0x68f1-0x68b9-1];
- u_int8_t cmap_write; /* color map write trigger 0x68f1 */
- u_int8_t f12[0x69b3-0x68f1-1];
- u_int8_t cmap_red; /* red value register 0x69b3 */
- u_int8_t :8;
- u_int8_t cmap_grn; /* green value register 0x69b5 */
- u_int8_t :8;
- u_int8_t cmap_blu; /* blue value register 0x69b6 */
-};
diff --git a/sys/arch/hp300/dev/hd.c b/sys/arch/hp300/dev/hd.c
deleted file mode 100644
index 4bfd3ef7848..00000000000
--- a/sys/arch/hp300/dev/hd.c
+++ /dev/null
@@ -1,1330 +0,0 @@
-/* $OpenBSD: hd.c,v 1.75 2013/11/20 05:19:29 miod Exp $ */
-/* $NetBSD: rd.c,v 1.33 1997/07/10 18:14:08 kleink Exp $ */
-
-/*
- * Copyright (c) 1996, 1997 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: rd.c 1.44 92/12/26$
- *
- * @(#)rd.c 8.2 (Berkeley) 5/19/94
- */
-
-/*
- * CS80/SS80 disk driver
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/disk.h>
-#include <sys/disklabel.h>
-#include <sys/fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/proc.h>
-#include <sys/stat.h>
-#include <sys/syslog.h>
-#include <sys/dkio.h>
-
-#include <ufs/ffs/fs.h> /* for BBSIZE and SBSIZE */
-
-#include <hp300/dev/hpibvar.h>
-
-#include <hp300/dev/hdreg.h>
-#include <hp300/dev/hdvar.h>
-
-#ifdef USELEDS
-#include <hp300/hp300/leds.h>
-#endif
-
-#ifndef HDRETRY
-#define HDRETRY 5
-#endif
-
-#ifndef HDWAITC
-#define HDWAITC 1 /* min time for timeout in seconds */
-#endif
-
-int hderrthresh = HDRETRY - 1; /* when to start reporting errors */
-
-#ifdef DEBUG
-/* error message tables */
-const char *err_reject[16] = {
- NULL,
- NULL,
- "channel parity error", /* 0x2000 */
- NULL,
- NULL,
- "illegal opcode", /* 0x0400 */
- "module addressing", /* 0x0200 */
- "address bounds", /* 0x0100 */
- "parameter bounds", /* 0x0080 */
- "illegal parameter", /* 0x0040 */
- "message sequence", /* 0x0020 */
- NULL,
- "message length", /* 0x0008 */
- NULL,
- NULL,
- NULL
-};
-
-const char *err_fault[16] = {
- NULL,
- "cross unit", /* 0x4000 */
- NULL,
- "controller fault", /* 0x1000 */
- NULL,
- NULL,
- "unit fault", /* 0x0200 */
- NULL,
- "diagnostic result", /* 0x0080 */
- NULL,
- "operator release request", /* 0x0020 */
- "diagnostic release request", /* 0x0010 */
- "internal maintenance release request", /* 0x0008 */
- NULL,
- "power fail", /* 0x0002 */
- "retransmit" /* 0x0001 */
-};
-
-const char *err_access[16] = {
- "illegal parallel operation", /* 0x8000 */
- "uninitialized media", /* 0x4000 */
- "no spares available", /* 0x2000 */
- "not ready", /* 0x1000 */
- "write protect", /* 0x0800 */
- "no data found", /* 0x0400 */
- NULL,
- NULL,
- "unrecoverable data overflow", /* 0x0080 */
- "unrecoverable data", /* 0x0040 */
- NULL,
- "end of file", /* 0x0010 */
- "end of volume", /* 0x0008 */
- NULL,
- NULL,
- NULL
-};
-
-const char *err_info[16] = {
- "operator release request", /* 0x8000 */
- "diagnostic release request", /* 0x4000 */
- "internal maintenance release request", /* 0x2000 */
- "media wear", /* 0x1000 */
- "latency induced", /* 0x0800 */
- NULL,
- NULL,
- "auto sparing invoked", /* 0x0100 */
- NULL,
- "recoverable data overflow", /* 0x0040 */
- "marginal data", /* 0x0020 */
- "recoverable data", /* 0x0010 */
- NULL,
- "maintenance track overflow", /* 0x0004 */
- NULL,
- NULL
-};
-
-#define HDB_FOLLOW 0x01
-#define HDB_STATUS 0x02
-#define HDB_IDENT 0x04
-#define HDB_IO 0x08
-#define HDB_ASYNC 0x10
-#define HDB_ERROR 0x80
-int hddebug = HDB_ERROR | HDB_IDENT;
-#endif
-
-/*
- * Misc. HW description, indexed by sc_type.
- * Nothing really critical here, could do without it.
- */
-const struct hdidentinfo hdidentinfo[] = {
- { HD7946AID, 0, "7945A", NHD7945ABPT,
- NHD7945ATRK, 968, 108416 },
-
- { HD9134DID, 1, "9134D", NHD9134DBPT,
- NHD9134DTRK, 303, 29088 },
-
- { HD9134LID, 1, "9122S", NHD9122SBPT,
- NHD9122STRK, 77, 1232 },
-
- { HD7912PID, 0, "7912P", NHD7912PBPT,
- NHD7912PTRK, 572, 128128 },
-
- { HD7914PID, 0, "7914P", NHD7914PBPT,
- NHD7914PTRK, 1152, 258048 },
-
- { HD7958AID, 0, "7958A", NHD7958ABPT,
- NHD7958ATRK, 1013, 255276 },
-
- { HD7957AID, 0, "7957A", NHD7957ABPT,
- NHD7957ATRK, 1036, 159544 },
-
- { HD7933HID, 0, "7933H", NHD7933HBPT,
- NHD7933HTRK, 1321, 789958 },
-
- { HD9134LID, 1, "9134L", NHD9134LBPT,
- NHD9134LTRK, 973, 77840 },
-
- { HD7936HID, 0, "7936H", NHD7936HBPT,
- NHD7936HTRK, 698, 600978 },
-
- { HD7937HID, 0, "7937H", NHD7937HBPT,
- NHD7937HTRK, 698, 1116102 },
-
- { HD7914CTID, 0, "7914CT", NHD7914PBPT,
- NHD7914PTRK, 1152, 258048 },
-
- { HD7946AID, 0, "7946A", NHD7945ABPT,
- NHD7945ATRK, 968, 108416 },
-
- { HD9134LID, 1, "9122D", NHD9122SBPT,
- NHD9122STRK, 77, 1232 },
-
- { HD7957BID, 0, "7957B", NHD7957BBPT,
- NHD7957BTRK, 1269, 159894 },
-
- { HD7958BID, 0, "7958B", NHD7958BBPT,
- NHD7958BTRK, 786, 297108 },
-
- { HD7959BID, 0, "7959B", NHD7959BBPT,
- NHD7959BTRK, 1572, 594216 },
-
- { HD2200AID, 0, "2200A", NHD2200ABPT,
- NHD2200ATRK, 1449, 654948 },
-
- { HD2203AID, 0, "2203A", NHD2203ABPT,
- NHD2203ATRK, 1449, 1309896 }
-};
-const int numhdidentinfo = sizeof(hdidentinfo) / sizeof(hdidentinfo[0]);
-
-bdev_decl(hd);
-cdev_decl(hd);
-
-int hdident(struct device *, struct hd_softc *,
- struct hpibbus_attach_args *);
-void hdreset(int, int, int);
-void hdustart(struct hd_softc *);
-int hdgetdisklabel(dev_t, struct hd_softc *, struct disklabel *, int);
-void hdrestart(void *);
-struct buf *hdfinish(struct hd_softc *, struct buf *);
-
-void hdstart(void *);
-void hdinterrupt(void *);
-void hdgo(void *);
-int hdstatus(struct hd_softc *);
-int hderror(int);
-#ifdef DEBUG
-void hdprinterr(const char *, short, const char **);
-#endif
-
-int hdmatch(struct device *, void *, void *);
-void hdattach(struct device *, struct device *, void *);
-
-struct cfattach hd_ca = {
- sizeof(struct hd_softc), hdmatch, hdattach
-};
-
-struct cfdriver hd_cd = {
- NULL, "hd", DV_DISK
-};
-
-#define hdlookup(unit) (struct hd_softc *)device_lookup(&hd_cd, (unit))
-
-int
-hdmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct hpibbus_attach_args *ha = aux;
-
- return (hdident(parent, NULL, ha));
-}
-
-void
-hdattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct hd_softc *sc = (struct hd_softc *)self;
- struct hpibbus_attach_args *ha = aux;
-
- if (hdident(parent, sc, ha) == 0) {
- printf("\n%s: didn't respond to describe command!\n",
- sc->sc_dev.dv_xname);
- return;
- }
-
- /*
- * Initialize and attach the disk structure.
- */
- sc->sc_dkdev.dk_name = sc->sc_dev.dv_xname;
- disk_attach(&sc->sc_dev, &sc->sc_dkdev);
- bufq_init(&sc->sc_bufq, BUFQ_DEFAULT);
-
- sc->sc_slave = ha->ha_slave;
- sc->sc_punit = ha->ha_punit;
-
- /* Initialize the hpib job queue entry */
- sc->sc_hq.hq_softc = sc;
- sc->sc_hq.hq_slave = sc->sc_slave;
- sc->sc_hq.hq_start = hdstart;
- sc->sc_hq.hq_go = hdgo;
- sc->sc_hq.hq_intr = hdinterrupt;
-
-#ifdef DEBUG
- /* always report errors */
- if (hddebug & HDB_ERROR)
- hderrthresh = 0;
-#endif
-
- /* Initialize timeout structure */
- timeout_set(&sc->sc_timeout, hdrestart, sc);
-}
-
-int
-hdident(parent, sc, ha)
- struct device *parent;
- struct hd_softc *sc;
- struct hpibbus_attach_args *ha;
-{
- struct cs80_describe desc;
- u_char stat, cmd[3];
- char name[7];
- int i, id, n, ctlr, slave;
-
- ctlr = parent->dv_unit;
- slave = ha->ha_slave;
-
- /* Verify that we have a CS80 device. */
- if ((ha->ha_id & 0x200) == 0)
- return (0);
-
- /* Is it one of the disks we support? */
- for (id = 0; id < numhdidentinfo; id++)
- if (ha->ha_id == hdidentinfo[id].ri_hwid &&
- ha->ha_punit <= hdidentinfo[id].ri_maxunum)
- break;
- if (id == numhdidentinfo)
- return (0);
-
- /*
- * Reset device and collect description
- */
- bzero(&desc, sizeof(desc));
- stat = 0;
- hdreset(ctlr, slave, ha->ha_punit);
- cmd[0] = C_SUNIT(ha->ha_punit);
- cmd[1] = C_SVOL(0);
- cmd[2] = C_DESC;
- hpibsend(ctlr, slave, C_CMD, cmd, sizeof(cmd));
- hpibrecv(ctlr, slave, C_EXEC, &desc, sizeof(desc));
- hpibrecv(ctlr, slave, C_QSTAT, &stat, sizeof(stat));
-
- if (desc.d_name == 0 && stat != 0)
- return (0);
-
- /*
- * If we're just probing for the device, that's all the
- * work we need to do.
- */
- if (sc == NULL)
- return (1);
-
- bzero(name, sizeof(name));
- n = desc.d_name;
- for (i = 5; i >= 0; i--) {
- name[i] = (n & 0xf) + '0';
- n >>= 4;
- }
-
-#ifdef DEBUG
- if (hddebug & HDB_IDENT) {
- printf(": stat %d name: %x ('%s')\n", stat, desc.d_name, name);
- printf(" iuw %x, maxxfr %d, ctype %d\n",
- desc.d_iuw, desc.d_cmaxxfr, desc.d_ctype);
- printf(" utype %d, bps %d, blkbuf %d, burst %d, blktime %d\n",
- desc.d_utype, desc.d_sectsize,
- desc.d_blkbuf, desc.d_burstsize, desc.d_blocktime);
- printf(" avxfr %d, ort %d, atp %d, maxint %d, fv %x, rv %x\n",
- desc.d_uavexfr, desc.d_retry, desc.d_access,
- desc.d_maxint, desc.d_fvbyte, desc.d_rvbyte);
- printf(" maxcyl/head/sect %d/%d/%d, maxvsect %d, inter %d\n",
- desc.d_maxcyl, desc.d_maxhead, desc.d_maxsect,
- desc.d_maxvsectl, desc.d_interleave);
- printf("%s:", sc->sc_dev.dv_xname);
- }
-#endif
-
- /*
- * Take care of a couple of anomalies:
- * 1. 7945A and 7946A both return same HW id
- * 2. 9122S and 9134D both return same HW id
- * 3. 9122D and 9134L both return same HW id
- */
- switch (ha->ha_id) {
- case HD7946AID:
- if (bcmp(name, "079450", 6) == 0)
- id = HD7945A;
- else
- id = HD7946A;
- break;
-
- case HD9134LID:
- if (bcmp(name, "091340", 6) == 0)
- id = HD9134L;
- else
- id = HD9122D;
- break;
-
- case HD9134DID:
- if (bcmp(name, "091220", 6) == 0)
- id = HD9122S;
- else
- id = HD9134D;
- break;
- }
-
- sc->sc_type = id;
-
- /*
- * XXX We use DEV_BSIZE instead of the sector size value pulled
- * XXX off the driver because all of this code assumes 512 byte
- * XXX blocks. ICK!
- */
- printf(": %s\n", hdidentinfo[id].ri_desc);
- printf("%s: %luMB, %lu cyl, %lu head, %lu sec, %lu bytes/sec, %lu sec total\n",
- sc->sc_dev.dv_xname,
- hdidentinfo[id].ri_nblocks / (1048576 / DEV_BSIZE),
- hdidentinfo[id].ri_ncyl, hdidentinfo[id].ri_ntpc,
- hdidentinfo[id].ri_nbpt, DEV_BSIZE, hdidentinfo[id].ri_nblocks);
-
- return (1);
-}
-
-void
-hdreset(ctlr, slave, punit)
- int ctlr, slave, punit;
-{
- struct hd_ssmcmd ssmc;
- struct hd_srcmd src;
- struct hd_clearcmd clear;
- u_char stat;
-
- bzero(&clear, sizeof(clear));
- clear.c_unit = C_SUNIT(punit);
- clear.c_cmd = C_CLEAR;
- hpibsend(ctlr, slave, C_TCMD, &clear, sizeof(clear));
- hpibswait(ctlr, slave);
- hpibrecv(ctlr, slave, C_QSTAT, &stat, sizeof(stat));
-
- bzero(&src, sizeof(src));
- src.c_unit = C_SUNIT(HDCTLR);
- src.c_nop = C_NOP;
- src.c_cmd = C_SREL;
- src.c_param = C_REL;
- hpibsend(ctlr, slave, C_CMD, &src, sizeof(src));
- hpibswait(ctlr, slave);
- hpibrecv(ctlr, slave, C_QSTAT, &stat, sizeof(stat));
-
- bzero(&ssmc, sizeof(ssmc));
- ssmc.c_unit = C_SUNIT(punit);
- ssmc.c_cmd = C_SSM;
- ssmc.c_refm = REF_MASK;
- ssmc.c_fefm = FEF_MASK;
- ssmc.c_aefm = AEF_MASK;
- ssmc.c_iefm = IEF_MASK;
- hpibsend(ctlr, slave, C_CMD, &ssmc, sizeof(ssmc));
- hpibswait(ctlr, slave);
- hpibrecv(ctlr, slave, C_QSTAT, &stat, sizeof(stat));
-}
-
-/*
- * Read or construct a disklabel
- */
-int
-hdgetdisklabel(dev, rs, lp, spoofonly)
- dev_t dev;
- struct hd_softc *rs;
- struct disklabel *lp;
- int spoofonly;
-{
- bzero(lp, sizeof(struct disklabel));
-
- /*
- * Create a default disk label based on geometry.
- * This will get overridden if there is a real label on the disk.
- */
- lp->d_secsize = DEV_BSIZE;
- lp->d_ntracks = hdidentinfo[rs->sc_type].ri_ntpc;
- lp->d_nsectors = hdidentinfo[rs->sc_type].ri_nbpt;
- lp->d_ncylinders = hdidentinfo[rs->sc_type].ri_ncyl;
- lp->d_secpercyl = lp->d_nsectors * lp->d_ntracks;
- if (lp->d_secpercyl == 0) {
- lp->d_secpercyl = 100;
- /* as long as it's not 0 - readdisklabel divides by it */
- }
-
- lp->d_type = DTYPE_HPIB;
- strncpy(lp->d_typename, hdidentinfo[rs->sc_type].ri_desc,
- sizeof(lp->d_typename));
- strncpy(lp->d_packname, "fictitious", sizeof lp->d_packname);
-
- DL_SETDSIZE(lp, hdidentinfo[rs->sc_type].ri_nblocks);
- lp->d_flags = 0;
- lp->d_version = 1;
-
- /* XXX - these values for BBSIZE and SBSIZE assume ffs */
- lp->d_bbsize = BBSIZE;
- lp->d_sbsize = SBSIZE;
-
- lp->d_magic = DISKMAGIC;
- lp->d_magic2 = DISKMAGIC;
- lp->d_checksum = dkcksum(lp);
-
- /*
- * Now try to read the disklabel
- */
- return readdisklabel(DISKLABELDEV(dev), hdstrategy, lp, spoofonly);
-}
-
-int
-hdopen(dev, flags, mode, p)
- dev_t dev;
- int flags, mode;
- struct proc *p;
-{
- int unit = DISKUNIT(dev);
- struct hd_softc *rs;
- int mask, part;
- int error;
-
- rs = hdlookup(unit);
- if (rs == NULL)
- return (ENXIO);
-
- /*
- * Fail open if we tried to attach but the disk did not answer.
- */
- if (!ISSET(rs->sc_dkdev.dk_flags, DKF_CONSTRUCTED)) {
- device_unref(&rs->sc_dev);
- return (ENXIO);
- }
-
- if ((error = disk_lock(&rs->sc_dkdev)) != 0) {
- device_unref(&rs->sc_dev);
- return (error);
- }
-
- /*
- * On first open, get label and partition info.
- * We may block reading the label, so be careful
- * to stop any other opens.
- */
- if (rs->sc_dkdev.dk_openmask == 0) {
- rs->sc_flags |= HDF_OPENING;
- error = hdgetdisklabel(dev, rs, rs->sc_dkdev.dk_label, 0);
- rs->sc_flags &= ~HDF_OPENING;
- if (error == EIO)
- goto out;
- }
-
- part = DISKPART(dev);
- mask = 1 << part;
-
- /* Check that the partition exists. */
- if (part != RAW_PART &&
- (part > rs->sc_dkdev.dk_label->d_npartitions ||
- rs->sc_dkdev.dk_label->d_partitions[part].p_fstype == FS_UNUSED)) {
- error = ENXIO;
- goto out;
- }
-
- /* Ensure only one open at a time. */
- switch (mode) {
- case S_IFCHR:
- rs->sc_dkdev.dk_copenmask |= mask;
- break;
- case S_IFBLK:
- rs->sc_dkdev.dk_bopenmask |= mask;
- break;
- }
- rs->sc_dkdev.dk_openmask =
- rs->sc_dkdev.dk_copenmask | rs->sc_dkdev.dk_bopenmask;
-
- error = 0;
-out:
- disk_unlock(&rs->sc_dkdev);
- device_unref(&rs->sc_dev);
- return (error);
-}
-
-int
-hdclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- int unit = DISKUNIT(dev);
- struct hd_softc *rs;
- struct disk *dk;
- int mask, s;
-
- rs = hdlookup(unit);
- if (rs == NULL)
- return (ENXIO);
-
- disk_lock_nointr(&rs->sc_dkdev);
-
- mask = 1 << DISKPART(dev);
- dk = &rs->sc_dkdev;
- switch (mode) {
- case S_IFCHR:
- dk->dk_copenmask &= ~mask;
- break;
- case S_IFBLK:
- dk->dk_bopenmask &= ~mask;
- break;
- }
- dk->dk_openmask = dk->dk_copenmask | dk->dk_bopenmask;
-
- /*
- * On last close, we wait for all activity to cease since
- * the label/parition info will become invalid.
- * Note we don't have to about other closes since we know
- * we are the last one.
- */
- if (dk->dk_openmask == 0) {
- rs->sc_flags |= HDF_CLOSING;
- s = splbio();
- while (rs->sc_bp == NULL) {
- rs->sc_flags |= HDF_WANTED;
- tsleep((caddr_t)&rs->sc_bp, PRIBIO, "hdclose", 0);
- }
- splx(s);
- rs->sc_flags &= ~(HDF_CLOSING);
- }
-
- disk_unlock(&rs->sc_dkdev);
- device_unref(&rs->sc_dev);
- return (0);
-}
-
-void
-hdstrategy(bp)
- struct buf *bp;
-{
- int unit = DISKUNIT(bp->b_dev);
- struct hd_softc *rs;
- int s;
-
- rs = hdlookup(unit);
- if (rs == NULL) {
- bp->b_error = ENXIO;
- goto bad;
- }
-
-#ifdef DEBUG
- if (hddebug & HDB_FOLLOW)
- printf("hdstrategy(%x): dev %x, bn %x, bcount %lx, %c\n",
- bp, bp->b_dev, bp->b_blkno, bp->b_bcount,
- (bp->b_flags & B_READ) ? 'R' : 'W');
-#endif
-
- /* Validate the request. */
- if (bounds_check_with_label(bp, rs->sc_dkdev.dk_label) == -1)
- goto done;
-
- bufq_queue(&rs->sc_bufq, bp);
-
- s = splbio();
- if (rs->sc_bp == NULL) {
- rs->sc_bp = bufq_dequeue(&rs->sc_bufq);
- hdustart(rs);
- }
- splx(s);
-
- device_unref(&rs->sc_dev);
- return;
-
- bad:
- bp->b_flags |= B_ERROR;
- bp->b_resid = bp->b_bcount;
- done:
- s = splbio();
- biodone(bp);
- splx(s);
- if (rs != NULL)
- device_unref(&rs->sc_dev);
-}
-
-/*
- * Called via timeout(9) when handling maintenance releases
- */
-void
-hdrestart(arg)
- void *arg;
-{
- int s = splbio();
- hdustart((struct hd_softc *)arg);
- splx(s);
-}
-
-void
-hdustart(rs)
- struct hd_softc *rs;
-{
- struct buf *bp;
-
- bp = rs->sc_bp;
- rs->sc_addr = bp->b_data;
- rs->sc_resid = bp->b_bcount;
- if (hpibreq(rs->sc_dev.dv_parent, &rs->sc_hq))
- hdstart(rs);
-}
-
-struct buf *
-hdfinish(rs, bp)
- struct hd_softc *rs;
- struct buf *bp;
-{
- int s;
-
- rs->sc_errcnt = 0;
- bp->b_resid = 0;
- s = splbio();
- biodone(bp);
- splx(s);
-
- hpibfree(rs->sc_dev.dv_parent, &rs->sc_hq);
- rs->sc_bp = bufq_dequeue(&rs->sc_bufq);
-
- if (rs->sc_bp == NULL && rs->sc_flags & HDF_WANTED) {
- rs->sc_flags &= ~HDF_WANTED;
- wakeup((caddr_t)&rs->sc_bp);
- }
-
- return (rs->sc_bp);
-}
-
-void
-hdstart(arg)
- void *arg;
-{
- struct hd_softc *rs = arg;
- struct disklabel *lp;
- struct buf *bp = rs->sc_bp;
- int ctlr, slave;
- daddr_t bn;
-
- ctlr = rs->sc_dev.dv_parent->dv_unit;
- slave = rs->sc_slave;
-
-again:
-#ifdef DEBUG
- if (hddebug & HDB_FOLLOW)
- printf("hdstart(%s): bp %p, %c\n", rs->sc_dev.dv_xname, bp,
- (bp->b_flags & B_READ) ? 'R' : 'W');
-#endif
- lp = rs->sc_dkdev.dk_label;
- bn = bp->b_blkno +
- DL_GETPOFFSET(&lp->d_partitions[DISKPART(bp->b_dev)]);
-
- rs->sc_flags |= HDF_SEEK;
- rs->sc_ioc.c_unit = C_SUNIT(rs->sc_punit);
- rs->sc_ioc.c_volume = C_SVOL(0);
- rs->sc_ioc.c_saddr = C_SADDR;
- rs->sc_ioc.c_hiaddr = 0;
- rs->sc_ioc.c_addr = HDBTOS(bn);
- rs->sc_ioc.c_nop2 = C_NOP;
- rs->sc_ioc.c_slen = C_SLEN;
- rs->sc_ioc.c_len = rs->sc_resid;
- rs->sc_ioc.c_cmd = bp->b_flags & B_READ ? C_READ : C_WRITE;
-#ifdef DEBUG
- if (hddebug & HDB_IO)
- printf("hdstart: hpibsend(%x, %x, %x, %p, %x)\n",
- ctlr, slave, C_CMD,
- &rs->sc_ioc.c_unit, sizeof(rs->sc_ioc)-2);
-#endif
- if (hpibsend(ctlr, slave, C_CMD, &rs->sc_ioc.c_unit,
- sizeof(rs->sc_ioc)-2) == sizeof(rs->sc_ioc)-2) {
-
- /* Instrumentation. */
- disk_busy(&rs->sc_dkdev);
- rs->sc_dkdev.dk_seek++;
-
-#ifdef DEBUG
- if (hddebug & HDB_IO)
- printf("hdstart: hpibawait(%x)\n", ctlr);
-#endif
- hpibawait(ctlr);
- return;
- }
- /*
- * Experience has shown that the hpibwait in this hpibsend will
- * occasionally timeout. It appears to occur mostly on old 7914
- * drives with full maintenance tracks. We should probably
- * integrate this with the backoff code in hderror.
- */
-#ifdef DEBUG
- if (hddebug & HDB_ERROR)
- printf("%s: hdstart: cmd %x adr %lx blk %d len %d ecnt %ld\n",
- rs->sc_dev.dv_xname, rs->sc_ioc.c_cmd, rs->sc_ioc.c_addr,
- bp->b_blkno, rs->sc_resid, rs->sc_errcnt);
- rs->sc_stats.hdretries++;
-#endif
- rs->sc_flags &= ~HDF_SEEK;
- hdreset(rs->sc_dev.dv_parent->dv_unit, rs->sc_slave, rs->sc_punit);
- if (rs->sc_errcnt++ < HDRETRY)
- goto again;
- printf("%s: hdstart err: err: cmd 0x%x sect %ld blk %d len %d\n",
- rs->sc_dev.dv_xname, rs->sc_ioc.c_cmd, rs->sc_ioc.c_addr,
- bp->b_blkno, rs->sc_resid);
- bp->b_flags |= B_ERROR;
- bp->b_error = EIO;
- bp = hdfinish(rs, bp);
- if (bp) {
- rs->sc_addr = bp->b_data;
- rs->sc_resid = bp->b_bcount;
- if (hpibreq(rs->sc_dev.dv_parent, &rs->sc_hq))
- goto again;
- }
-}
-
-void
-hdgo(arg)
- void *arg;
-{
- struct hd_softc *rs = arg;
- struct buf *bp = rs->sc_bp;
- int rw, ctlr, slave;
-
- ctlr = rs->sc_dev.dv_parent->dv_unit;
- slave = rs->sc_slave;
-
- rw = bp->b_flags & B_READ;
-
- /* Instrumentation. */
- disk_busy(&rs->sc_dkdev);
-
-#ifdef USELEDS
- ledcontrol(0, 0, LED_DISK);
-#endif
- hpibgo(ctlr, slave, C_EXEC, rs->sc_addr, rs->sc_resid, rw, rw != 0);
-}
-
-/* ARGSUSED */
-void
-hdinterrupt(arg)
- void *arg;
-{
- struct hd_softc *rs = arg;
- int unit = rs->sc_dev.dv_unit;
- struct buf *bp = rs->sc_bp;
- u_char stat = 13; /* in case hpibrecv fails */
- int rv, restart, ctlr, slave;
-
- ctlr = rs->sc_dev.dv_parent->dv_unit;
- slave = rs->sc_slave;
-
-#ifdef DEBUG
- if (hddebug & HDB_FOLLOW)
- printf("hdinterrupt(%d): bp %p, %c, flags %x\n", unit, bp,
- (bp->b_flags & B_READ) ? 'R' : 'W', rs->sc_flags);
- if (bp == NULL) {
- printf("%s: bp == NULL\n", rs->sc_dev.dv_xname);
- return;
- }
-#endif
- disk_unbusy(&rs->sc_dkdev, (bp->b_bcount - bp->b_resid),
- (bp->b_flags & B_READ));
-
- if (rs->sc_flags & HDF_SEEK) {
- rs->sc_flags &= ~HDF_SEEK;
- if (hpibustart(ctlr))
- hdgo(rs);
- return;
- }
- if ((rs->sc_flags & HDF_SWAIT) == 0) {
-#ifdef DEBUG
- rs->sc_stats.hdpolltries++;
-#endif
- if (hpibpptest(ctlr, slave) == 0) {
-#ifdef DEBUG
- rs->sc_stats.hdpollwaits++;
-#endif
-
- /* Instrumentation. */
- disk_busy(&rs->sc_dkdev);
- rs->sc_flags |= HDF_SWAIT;
- hpibawait(ctlr);
- return;
- }
- } else
- rs->sc_flags &= ~HDF_SWAIT;
- rv = hpibrecv(ctlr, slave, C_QSTAT, &stat, 1);
- if (rv != 1 || stat) {
-#ifdef DEBUG
- if (hddebug & HDB_ERROR)
- printf("hdinterrupt: recv failed or bad stat %d\n", stat);
-#endif
- restart = hderror(unit);
-#ifdef DEBUG
- rs->sc_stats.hdretries++;
-#endif
- if (rs->sc_errcnt++ < HDRETRY) {
- if (restart)
- hdstart(rs);
- return;
- }
- bp->b_flags |= B_ERROR;
- bp->b_error = EIO;
- }
- if (hdfinish(rs, bp))
- hdustart(rs);
-}
-
-int
-hdstatus(rs)
- struct hd_softc *rs;
-{
- int c, s;
- u_char stat;
- int rv;
-
- c = rs->sc_dev.dv_parent->dv_unit;
- s = rs->sc_slave;
- rs->sc_rsc.c_unit = C_SUNIT(rs->sc_punit);
- rs->sc_rsc.c_sram = C_SRAM;
- rs->sc_rsc.c_ram = C_RAM;
- rs->sc_rsc.c_cmd = C_STATUS;
- bzero((caddr_t)&rs->sc_stat, sizeof(rs->sc_stat));
- rv = hpibsend(c, s, C_CMD, &rs->sc_rsc, sizeof(rs->sc_rsc));
- if (rv != sizeof(rs->sc_rsc)) {
-#ifdef DEBUG
- if (hddebug & HDB_STATUS)
- printf("hdstatus: send C_CMD failed %d != %d\n",
- rv, sizeof(rs->sc_rsc));
-#endif
- return(1);
- }
- rv = hpibrecv(c, s, C_EXEC, &rs->sc_stat, sizeof(rs->sc_stat));
- if (rv != sizeof(rs->sc_stat)) {
-#ifdef DEBUG
- if (hddebug & HDB_STATUS)
- printf("hdstatus: send C_EXEC failed %d != %d\n",
- rv, sizeof(rs->sc_stat));
-#endif
- return(1);
- }
- rv = hpibrecv(c, s, C_QSTAT, &stat, 1);
- if (rv != 1 || stat) {
-#ifdef DEBUG
- if (hddebug & HDB_STATUS)
- printf("hdstatus: recv failed %d or bad stat %d\n",
- rv, stat);
-#endif
- return(1);
- }
- return(0);
-}
-
-/*
- * Deal with errors.
- * Returns 1 if request should be restarted,
- * 0 if we should just quietly give up.
- */
-int
-hderror(unit)
- int unit;
-{
- struct hd_softc *rs = hd_cd.cd_devs[unit];
- struct hd_stat *sp;
- struct buf *bp;
- daddr_t hwbn, pbn;
-
- if (hdstatus(rs)) {
-#ifdef DEBUG
- printf("%s: couldn't get status\n", rs->sc_dev.dv_xname);
-#endif
- hdreset(rs->sc_dev.dv_parent->dv_unit,
- rs->sc_slave, rs->sc_punit);
- return(1);
- }
- sp = &rs->sc_stat;
- if (sp->c_fef & FEF_REXMT)
- return(1);
- if (sp->c_fef & FEF_PF) {
- hdreset(rs->sc_dev.dv_parent->dv_unit,
- rs->sc_slave, rs->sc_punit);
- return(1);
- }
- /*
- * Unit requests release for internal maintenance.
- * We just delay a while and try again later. Use exponentially
- * increasing backoff a la ethernet drivers since we don't really
- * know how long the maintenance will take. With HDWAITC and
- * HDRETRY as defined, the range is 1 to 32 seconds.
- */
- if (sp->c_fef & FEF_IMR) {
- int hdtimo = HDWAITC << rs->sc_errcnt;
-#ifdef DEBUG
- printf("%s: internal maintenance, %d second timeout\n",
- rs->sc_dev.dv_xname, hdtimo);
- rs->sc_stats.hdtimeouts++;
-#endif
- hpibfree(rs->sc_dev.dv_parent, &rs->sc_hq);
- timeout_add_sec(&rs->sc_timeout, hdtimo);
- return(0);
- }
- /*
- * Only report error if we have reached the error reporting
- * threshold. By default, this will only report after the
- * retry limit has been exceeded.
- */
- if (rs->sc_errcnt < hderrthresh)
- return(1);
-
- /*
- * First conjure up the block number at which the error occurred.
- * Note that not all errors report a block number, in that case
- * we just use b_blkno.
- */
- bp = rs->sc_bp;
- pbn = DL_GETPOFFSET(&rs->sc_dkdev.dk_label->d_partitions[DISKPART(bp->b_dev)]);
- if ((sp->c_fef & FEF_CU) || (sp->c_fef & FEF_DR) ||
- (sp->c_ief & IEF_RRMASK)) {
- hwbn = HDBTOS(pbn + bp->b_blkno);
- pbn = bp->b_blkno;
- } else {
- hwbn = sp->c_blk;
- pbn = HDSTOB(hwbn) - pbn;
- }
-
- diskerr(bp, hd_cd.cd_name, "hard error", LOG_PRINTF,
- pbn - bp->b_blkno, rs->sc_dkdev.dk_label);
- printf("\n%s%c: ", rs->sc_dev.dv_xname, 'a' + DISKPART(bp->b_dev));
-
-#ifdef DEBUG
- if (hddebug & HDB_ERROR) {
- /* status info */
- printf("volume: %d, unit: %d\n",
- (sp->c_vu>>4)&0xF, sp->c_vu&0xF);
- hdprinterr("reject", sp->c_ref, err_reject);
- hdprinterr("fault", sp->c_fef, err_fault);
- hdprinterr("access", sp->c_aef, err_access);
- hdprinterr("info", sp->c_ief, err_info);
- printf(" block: %lld, P1-P10: ", (long long)hwbn);
- printf("0x%04x", *(u_int *)&sp->c_raw[0]);
- printf("%04x", *(u_int *)&sp->c_raw[4]);
- printf("%02x\n", *(u_short *)&sp->c_raw[8]);
- /* command */
- printf(" ioc: ");
- printf("0x%x", *(u_int *)&rs->sc_ioc.c_pad);
- printf("0x%x", *(u_short *)&rs->sc_ioc.c_hiaddr);
- printf("0x%x", *(u_int *)&rs->sc_ioc.c_addr);
- printf("0x%x", *(u_short *)&rs->sc_ioc.c_nop2);
- printf("0x%x", *(u_int *)&rs->sc_ioc.c_len);
- printf("0x%x\n", *(u_short *)&rs->sc_ioc.c_cmd);
- } else
-#endif
- {
- printf("v%d u%d, R0x%x F0x%x A0x%x I0x%x",
- (sp->c_vu>>4)&0xF, sp->c_vu&0xF,
- sp->c_ref, sp->c_fef, sp->c_aef, sp->c_ief);
- printf(" P1-P10: 0x%04x%04x%02x\n",
- *(u_int *)&sp->c_raw[0], *(u_int *)&sp->c_raw[4],
- *(u_short *)&sp->c_raw[8]);
- }
- return (1);
-}
-
-int
-hdread(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
-
- return (physio(hdstrategy, dev, B_READ, minphys, uio));
-}
-
-int
-hdwrite(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
-
- return (physio(hdstrategy, dev, B_WRITE, minphys, uio));
-}
-
-int
-hdioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- int unit = DISKUNIT(dev);
- struct disklabel *lp;
- struct hd_softc *sc;
- int error = 0;
-
- sc = hdlookup(unit);
- if (sc == NULL)
- return (ENXIO);
-
- switch (cmd) {
- case DIOCRLDINFO:
- lp = malloc(sizeof(*lp), M_TEMP, M_WAITOK);
- hdgetdisklabel(dev, sc, lp, 0);
- *(sc->sc_dkdev.dk_label) = *lp;
- free(lp, M_TEMP);
- return 0;
-
- case DIOCGPDINFO:
- hdgetdisklabel(dev, sc, (struct disklabel *)data, 1);
- goto exit;
-
- case DIOCGDINFO:
- *(struct disklabel *)data = *sc->sc_dkdev.dk_label;
- goto exit;
-
- case DIOCGPART:
- ((struct partinfo *)data)->disklab = sc->sc_dkdev.dk_label;
- ((struct partinfo *)data)->part =
- &sc->sc_dkdev.dk_label->d_partitions[DISKPART(dev)];
- goto exit;
-
- case DIOCWDINFO:
- case DIOCSDINFO:
- if ((flag & FWRITE) == 0) {
- error = EBADF;
- goto exit;
- }
-
- if ((error = disk_lock(&sc->sc_dkdev)) != 0)
- goto exit;
-
- error = setdisklabel(sc->sc_dkdev.dk_label,
- (struct disklabel *)data, /* sc->sc_dkdev.dk_openmask */ 0);
- if (error == 0) {
- if (cmd == DIOCWDINFO)
- error = writedisklabel(DISKLABELDEV(dev),
- hdstrategy, sc->sc_dkdev.dk_label);
- }
-
- disk_unlock(&sc->sc_dkdev);
- goto exit;
-
- default:
- error = EINVAL;
- break;
- }
-
-exit:
- device_unref(&sc->sc_dev);
- return (error);
-}
-
-daddr_t
-hdsize(dev)
- dev_t dev;
-{
- struct hd_softc *rs;
- int unit = DISKUNIT(dev);
- int part, omask;
- daddr_t size;
-
- rs = hdlookup(unit);
- if (rs == NULL)
- return (-1);
-
- part = DISKPART(dev);
- omask = rs->sc_dkdev.dk_openmask & (1 << part);
-
- /*
- * We get called very early on (via swapconf)
- * without the device being open so we may need
- * to handle it here.
- */
- if (omask == 0 && hdopen(dev, FREAD | FWRITE, S_IFBLK, NULL) != 0) {
- size = -1;
- goto out;
- }
-
- if (rs->sc_dkdev.dk_label->d_partitions[part].p_fstype != FS_SWAP)
- size = -1;
- else
- size = DL_GETPSIZE(&rs->sc_dkdev.dk_label->d_partitions[part]) *
- (rs->sc_dkdev.dk_label->d_secsize / DEV_BSIZE);
-
- if (hdclose(dev, FREAD | FWRITE, S_IFBLK, NULL) != 0)
- size = -1;
-
-out:
- device_unref(&rs->sc_dev);
- return (size);
-}
-
-#ifdef DEBUG
-void
-hdprinterr(str, err, tab)
- const char *str;
- short err;
- const char **tab;
-{
- int i;
- int printed;
-
- if (err == 0)
- return;
- printf(" %s error %d field:", str, err);
- printed = 0;
- for (i = 0; i < 16; i++)
- if (err & (0x8000 >> i))
- printf("%s%s", printed++ ? " + " : " ", tab[i]);
- printf("\n");
-}
-#endif
-
-static int hddoingadump; /* simple mutex */
-
-/*
- * Non-interrupt driven, non-dma dump routine.
- */
-int
-hddump(dev, blkno, va, size)
- dev_t dev;
- daddr_t blkno;
- caddr_t va;
- size_t size;
-{
- int sectorsize; /* size of a disk sector */
- daddr_t nsects; /* number of sectors in partition */
- daddr_t sectoff; /* sector offset of partition */
- int totwrt; /* total number of sectors left to write */
- int nwrt; /* current number of sectors to write */
- int unit, part;
- int ctlr, slave;
- struct hd_softc *rs;
- struct disklabel *lp;
- char stat;
-
- /* Check for recursive dump; if so, punt. */
- if (hddoingadump)
- return (EFAULT);
- hddoingadump = 1;
-
- /* Decompose unit and partition. */
- unit = DISKUNIT(dev);
- part = DISKPART(dev);
-
- /* Make sure dump device is ok. */
- rs = hdlookup(unit);
- if (rs == NULL)
- return (ENXIO);
- device_unref(&rs->sc_dev);
-
- ctlr = rs->sc_dev.dv_parent->dv_unit;
- slave = rs->sc_slave;
-
- /*
- * Convert to disk sectors. Request must be a multiple of size.
- */
- lp = rs->sc_dkdev.dk_label;
- sectorsize = lp->d_secsize;
- if ((size % sectorsize) != 0)
- return (EFAULT);
- totwrt = size / sectorsize;
- blkno = dbtob(blkno) / sectorsize; /* blkno in DEV_BSIZE units */
-
- nsects = DL_GETPSIZE(&lp->d_partitions[part]);
- sectoff = DL_GETPOFFSET(&lp->d_partitions[part]);
-
- /* Check transfer bounds against partition size. */
- if ((blkno < 0) || (blkno + totwrt) > nsects)
- return (EINVAL);
-
- /* Offset block number to start of partition. */
- blkno += sectoff;
-
- while (totwrt > 0) {
- nwrt = totwrt; /* XXX */
-#ifndef HD_DUMP_NOT_TRUSTED
- /*
- * Fill out and send HPIB command.
- */
- rs->sc_ioc.c_unit = C_SUNIT(rs->sc_punit);
- rs->sc_ioc.c_volume = C_SVOL(0);
- rs->sc_ioc.c_saddr = C_SADDR;
- rs->sc_ioc.c_hiaddr = 0;
- rs->sc_ioc.c_addr = HDBTOS(blkno);
- rs->sc_ioc.c_nop2 = C_NOP;
- rs->sc_ioc.c_slen = C_SLEN;
- rs->sc_ioc.c_len = nwrt * sectorsize;
- rs->sc_ioc.c_cmd = C_WRITE;
- hpibsend(ctlr, slave, C_CMD, &rs->sc_ioc.c_unit,
- sizeof(rs->sc_ioc)-2);
- if (hpibswait(ctlr, slave))
- return (EIO);
-
- /*
- * Send the data.
- */
- hpibsend(ctlr, slave, C_EXEC, va, nwrt * sectorsize);
- (void) hpibswait(ctlr, slave);
- hpibrecv(ctlr, slave, C_QSTAT, &stat, 1);
- if (stat)
- return (EIO);
-#else /* HD_DUMP_NOT_TRUSTED */
- /* Let's just talk about this first... */
- printf("%s: dump addr %p, blk %d\n", sc->sc_dev.dv_xname,
- va, blkno);
- delay(500 * 1000); /* half a second */
-#endif /* HD_DUMP_NOT_TRUSTED */
-
- /* update block count */
- totwrt -= nwrt;
- blkno += nwrt;
- va += sectorsize * nwrt;
- }
- hddoingadump = 0;
- return (0);
-}
diff --git a/sys/arch/hp300/dev/hdreg.h b/sys/arch/hp300/dev/hdreg.h
deleted file mode 100644
index 64c169f7b29..00000000000
--- a/sys/arch/hp300/dev/hdreg.h
+++ /dev/null
@@ -1,251 +0,0 @@
-/* $OpenBSD: hdreg.h,v 1.7 2013/02/02 13:34:29 miod Exp $ */
-/* $NetBSD: rdreg.h,v 1.7 1996/02/09 18:00:37 scottr Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: rdreg.h 1.2 90/10/12$
- *
- * @(#)rdreg.h 8.1 (Berkeley) 6/10/93
- */
-
-struct hd_iocmd {
- char c_pad;
- char c_unit;
- char c_volume;
- char c_saddr;
- short c_hiaddr;
- long c_addr;
- char c_nop2;
- char c_slen;
- long c_len;
- char c_cmd;
- char c_pad2;
-} __packed;
-
-struct hd_rscmd {
- char c_unit;
- char c_sram;
- char c_ram;
- char c_cmd;
-} __packed;
-
-struct hd_stat {
- char c_vu;
- char c_pend;
- short c_ref;
- short c_fef;
- short c_aef;
- short c_ief;
- union {
- char cu_raw[10];
- struct {
- short cu_msw;
- long cu_lsl;
- } cu_sva;
- struct {
- long cu_cyhd;
- short cu_sect;
- } cu_tva;
- } c_pf;
-} __packed;
-#define c_raw c_pf.cu_raw
-#define c_blk c_pf.cu_sva.cu_lsl /* for now */
-#define c_tva c_pf.cu_tva
-
-struct hd_ssmcmd {
- char c_unit;
- char c_cmd;
- short c_refm;
- short c_fefm;
- short c_aefm;
- short c_iefm;
-} __packed;
-
-struct hd_srcmd {
- char c_unit;
- char c_nop;
- char c_cmd;
- char c_param;
-} __packed;
-
-struct hd_clearcmd {
- char c_unit;
- char c_cmd;
-} __packed;
-
-/* HW ids */
-#define HD7946AID 0x220 /* also 7945A */
-#define HD9134DID 0x221 /* also 9122S */
-#define HD9134LID 0x222 /* also 9122D */
-#define HD7912PID 0x209
-#define HD7914CTID 0x20A
-#define HD7914PID 0x20B
-#define HD7958AID 0x22B
-#define HD7957AID 0x22A
-#define HD7933HID 0x212
-#define HD7936HID 0x213 /* just guessing -- as of yet unknown */
-#define HD7937HID 0x214
-#define HD7957BID 0x22C /* another guess based on 7958B */
-#define HD7958BID 0x22D
-#define HD7959BID 0x22E /* another guess based on 7958B */
-#define HD2200AID 0x22F
-#define HD2203AID 0x230 /* yet another guess */
-
-/* SW ids -- indices into hdidentinfo, order is arbitrary */
-#define HD7945A 0
-#define HD9134D 1
-#define HD9122S 2
-#define HD7912P 3
-#define HD7914P 4
-#define HD7958A 5
-#define HD7957A 6
-#define HD7933H 7
-#define HD9134L 8
-#define HD7936H 9
-#define HD7937H 10
-#define HD7914CT 11
-#define HD7946A 12
-#define HD9122D 13
-#define HD7957B 14
-#define HD7958B 15
-#define HD7959B 16
-
-#define NHD7945ABPT 16
-#define NHD7945ATRK 7
-#define NHD9134DBPT 16
-#define NHD9134DTRK 6
-#define NHD9122SBPT 8
-#define NHD9122STRK 2
-#define NHD7912PBPT 32
-#define NHD7912PTRK 7
-#define NHD7914PBPT 32
-#define NHD7914PTRK 7
-#define NHD7933HBPT 46
-#define NHD7933HTRK 13
-#define NHD9134LBPT 16
-#define NHD9134LTRK 5
-
-/*
- * Several HP drives have an odd number of 256 byte sectors per track.
- * This makes it rather difficult to break them into 512 and 1024 byte blocks.
- * So...we just do like HPUX and don't bother to respect hardware track/head
- * boundaries -- we just mold the disk so that we use the entire capacity.
- * HPUX also sometimes doen't abide by cylinder boundaries, we attempt to
- * whenever possible.
- *
- * DISK REAL (256 BPS) HPUX (1024 BPS) BSD (512 BPS)
- * SPT x HD x CYL SPT x HD x CYL SPT x HD x CYL
- * ----- --------------- --------------- --------------
- * 7936: 123 x 7 x 1396 25 x 7 x 1716 123 x 7 x 698
- * 7937: 123 x 13 x 1396 25 x 16 x 1395 123 x 13 x 698
- *
- * 7957A: 63 x 5 x 1013 11 x 7 x 1036 22 x 7 x 1036
- * 7958A: 63 x 8 x 1013 21 x 6 x 1013 36 x 7 x 1013
- *
- * 7957B: 63 x 4 x 1269 9 x 7 x 1269 18 x 7 x 1269
- * 7958B: 63 x 6 x 1572 21 x 9 x 786 42 x 9 x 786
- * 7959B: 63 x 12 x 1572 21 x 9 x 1572 42 x 9 x 1572
- *
- * 2200A: 113 x 8 x 1449 113 x 2 x 1449 113 x 4 x 1449
- * 2203A: 113 x 16 x 1449 113 x 4 x 1449 113 x 8 x 1449
- */
-#define NHD7936HBPT 123
-#define NHD7936HTRK 7
-#define NHD7937HBPT 123
-#define NHD7937HTRK 13
-#define NHD7957ABPT 22
-#define NHD7957ATRK 7
-#define NHD7958ABPT 36
-#define NHD7958ATRK 7
-#define NHD7957BBPT 18
-#define NHD7957BTRK 7
-#define NHD7958BBPT 42
-#define NHD7958BTRK 9
-#define NHD7959BBPT 42
-#define NHD7959BTRK 9
-#define NHD2200ABPT 113
-#define NHD2200ATRK 4
-#define NHD2203ABPT 113
-#define NHD2203ATRK 8
-
-/* controller "unit" number */
-#define HDCTLR 15
-
-/* convert 512 byte count into DEV_BSIZE count */
-#define HDSZ(x) ((x) >> (DEV_BSHIFT-9))
-
-/* convert block number into sector number and back */
-#define HDBTOS(x) ((x) << (DEV_BSHIFT-8))
-#define HDSTOB(x) ((x) >> (DEV_BSHIFT-8))
-
-/* extract cyl/head/sect info from three-vector address */
-#define HDCYL(tva) ((u_long)(tva).cu_cyhd >> 8)
-#define HDHEAD(tva) ((tva).cu_cyhd & 0xFF)
-#define HDSECT(tva) ((tva).cu_sect)
-
-#define REF_MASK 0x0
-#define FEF_MASK 0x0
-#define AEF_MASK 0x0
-#define IEF_MASK 0xF970
-
-#define FEF_CU 0x4000 /* cross-unit */
-#define FEF_DR 0x0080 /* diagnostic result */
-#define FEF_IMR 0x0008 /* internal maintenance release */
-#define FEF_PF 0x0002 /* power fail */
-#define FEF_REXMT 0x0001 /* retransmit */
-#define AEF_UD 0x0040 /* unrecoverable data */
-#define IEF_RRMASK 0xe000 /* request release bits */
-#define IEF_MD 0x0020 /* marginal data */
-#define IEF_RD 0x0010 /* recoverable data */
-
-#define C_READ 0x00
-#define C_RAM 0x00 /* single vector (i.e. sector number) */
-#define C_WRITE 0x02
-#define C_CLEAR 0x08
-#define C_STATUS 0x0d
-#define C_SADDR 0x10
-#define C_SLEN 0x18
-#define C_SUNIT(x) (0x20 | (x))
-#define C_SVOL(x) (0x40 | (x))
-#define C_NOP 0x34
-#define C_DESC 0x35
-#define C_SREL 0x3b
-#define C_SSM 0x3e
-#define C_SRAM 0x48
-#define C_REL 0xc0
-
-#define C_CMD 0x05
-#define C_EXEC 0x0e
-#define C_QSTAT 0x10
-#define C_TCMD 0x12
diff --git a/sys/arch/hp300/dev/hdvar.h b/sys/arch/hp300/dev/hdvar.h
deleted file mode 100644
index 1add006a3c7..00000000000
--- a/sys/arch/hp300/dev/hdvar.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* $OpenBSD: hdvar.h,v 1.12 2013/11/20 00:12:37 dlg Exp $ */
-/* $NetBSD: rdvar.h,v 1.6 1997/01/30 09:14:19 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: rdvar.h 1.1 92/12/21$
- *
- * @(#)rdvar.h 8.1 (Berkeley) 6/10/93
- */
-
-struct hdidentinfo {
- short ri_hwid; /* 2 byte HW id */
- short ri_maxunum; /* maximum allowed unit number */
- char *ri_desc; /* drive type description */
- int ri_nbpt; /* DEV_BSIZE blocks per track */
- int ri_ntpc; /* tracks per cylinder */
- int ri_ncyl; /* cylinders per unit */
- int ri_nblocks; /* DEV_BSIZE blocks on disk */
-};
-
-struct hdstats {
- long hdretries;
- long hdtimeouts;
- long hdpolltries;
- long hdpollwaits;
-};
-
-struct hd_softc {
- struct device sc_dev;
- struct disk sc_dkdev;
- int sc_slave; /* HP-IB slave */
- int sc_punit; /* physical unit on slave */
- int sc_flags;
- short sc_type;
- char *sc_addr;
- int sc_resid;
- int sc_errcnt;
- struct hpibqueue sc_hq; /* hpib job queue entry */
- struct hd_iocmd sc_ioc;
- struct hd_rscmd sc_rsc;
- struct hd_stat sc_stat;
- struct bufq sc_bufq; /* buffer queue */
- struct buf *sc_bp;
-#ifdef DEBUG
- struct hdstats sc_stats;
-#endif
- struct timeout sc_timeout;
-};
-
-/* sc_flags values */
-#define HDF_SEEK 0x01
-#define HDF_SWAIT 0x02
-#define HDF_OPENING 0x04
-#define HDF_CLOSING 0x08
-#define HDF_WANTED 0x10
-
-#ifdef _KERNEL
-extern const struct hdidentinfo hdidentinfo[];
-#endif
diff --git a/sys/arch/hp300/dev/hil_intio.c b/sys/arch/hp300/dev/hil_intio.c
deleted file mode 100644
index e818f03cb0a..00000000000
--- a/sys/arch/hp300/dev/hil_intio.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/* $OpenBSD: hil_intio.c,v 1.8 2007/01/06 20:10:57 miod Exp $ */
-
-/*
- * Copyright (c) 2005, Miodrag Vallat.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/conf.h>
-
-#include <machine/bus.h>
-#include <machine/cpu.h>
-#include <machine/intr.h>
-
-#include <dev/cons.h>
-
-#include <hp300/dev/intiovar.h>
-
-#include <machine/hil_machdep.h>
-#include <machine/bus.h>
-#include <dev/hil/hilvar.h>
-
-int hil_intio_match(struct device *, void *, void *);
-void hil_intio_attach(struct device *, struct device *, void *);
-
-struct cfattach hil_intio_ca = {
- sizeof(struct hil_softc), hil_intio_match, hil_intio_attach
-};
-
-int
-hil_intio_match(struct device *parent, void *match, void *aux)
-{
- struct intio_attach_args *ia = aux;
-static int hil_matched = 0;
-
- /* Allow only one instance. */
- if (hil_matched != 0)
- return (0);
-
- if (badaddr((caddr_t)IIOV(HILADDR))) /* should not happen! */
- return (0);
-
- ia->ia_addr = (caddr_t)HILADDR;
- return (1);
-}
-
-struct isr hil_isr;
-int hil_is_console = -1; /* undecided */
-
-void
-hil_intio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct hil_softc *sc = (void *)self;
- struct intio_attach_args *ia = aux;
- extern struct consdev wsdisplay_cons;
-
- sc->sc_bst = ia->ia_tag;
- if (bus_space_map(sc->sc_bst, HILADDR,
- HILMAPSIZE, 0, &sc->sc_bsh) != 0) {
- printf(": couldn't map hil controller\n");
- return;
- }
-
- /*
- * Check that the configured console device is a wsdisplay.
- */
- if (cn_tab != &wsdisplay_cons)
- hil_is_console = 0;
-
- hil_isr.isr_func = hil_intr;
- hil_isr.isr_arg = sc;
- hil_isr.isr_ipl = 1;
- hil_isr.isr_priority = IPL_TTY;
-
- printf(" ipl %d", hil_isr.isr_ipl);
-
- hil_attach(sc, &hil_is_console);
- intr_establish(&hil_isr, self->dv_xname);
-
- startuphook_establish(hil_attach_deferred, sc);
-}
diff --git a/sys/arch/hp300/dev/hp98265reg.h b/sys/arch/hp300/dev/hp98265reg.h
deleted file mode 100644
index f8b6dbcf00b..00000000000
--- a/sys/arch/hp300/dev/hp98265reg.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* $OpenBSD: hp98265reg.h,v 1.1 2004/08/03 21:46:56 miod Exp $ */
-/* $NetBSD: hp98265reg.h,v 1.1 2003/08/01 01:18:45 tsutsui Exp $ */
-
-/*
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)scsireg.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * HP 98265A SCSI Interface Hardware Description.
- */
-
-#define SPC_OFFSET 32
-#define SPC_SIZE (32 * 2) /* XXX */
-
-#define HPSCSI_ID 0x00
-#define ID_MASK 0x1f
-#define SCSI_ID 0x07
-#define ID_WORD_DMA 0x20
-
-#define HPSCSI_CSR 0x01
-#define CSR_IE 0x80
-#define CSR_IR 0x40
-#define SCSI_IPL(csr) ((((csr) >> 4) & 3) + 3)
-#define CSR_DMA32 0x08
-#define CSR_DMAIN 0x04
-#define CSR_DE1 0x02
-#define CSR_DE0 0x01
-
-#define HPSCSI_WRAP 0x02
-#define WRAP_REQ 0x80
-#define WRAP_ACK 0x40
-#define WRAP_BSY 0x08
-#define WRAP_MSG 0x04
-#define WRAP_CD 0x02
-#define WRAP_IO 0x01
-
-#define HPSCSI_HCONF 0x03
-#define HCONF_TP 0x80
-#define SCSI_SYNC_XFER(hconf) (((hconf) >> 5) & 3)
-#define HCONF_SD 0x10
-#define HCONF_PARITY 0x08
diff --git a/sys/arch/hp300/dev/hpib.c b/sys/arch/hp300/dev/hpib.c
deleted file mode 100644
index 382fa549036..00000000000
--- a/sys/arch/hp300/dev/hpib.c
+++ /dev/null
@@ -1,412 +0,0 @@
-/* $OpenBSD: hpib.c,v 1.14 2009/01/25 14:57:44 miod Exp $ */
-/* $NetBSD: hpib.c,v 1.16 1997/04/27 20:58:57 thorpej Exp $ */
-
-/*
- * Copyright (c) 1996, 1997 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)hpib.c 8.2 (Berkeley) 1/12/94
- */
-
-/*
- * HP-IB bus driver
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/malloc.h>
-#include <sys/device.h>
-
-#include <hp300/dev/dmavar.h>
-
-#include <hp300/dev/hpibvar.h>
-
-#include <machine/cpu.h>
-#include <machine/hp300spu.h>
-
-int hpibbusmatch(struct device *, void *, void *);
-void hpibbusattach(struct device *, struct device *, void *);
-
-struct cfattach hpibbus_ca = {
- sizeof(struct hpibbus_softc), hpibbusmatch, hpibbusattach
-};
-
-struct cfdriver hpibbus_cd = {
- NULL, "hpibbus", DV_DULL
-};
-
-void hpibbus_attach_children(struct hpibbus_softc *);
-int hpibbussubmatch(struct device *, void *, void *);
-int hpibbusprint(void *, const char *);
-
-void hpibstart(void *);
-void hpibdone(void *);
-
-int hpibtimeout = 100000; /* # of status tests before we give up */
-int hpibidtimeout = 10000; /* # of status tests for hpibid() calls */
-int hpibdmathresh = 3; /* byte count beyond which to attempt dma */
-
-/*
- * HP-IB is essentially an IEEE 488 bus, with an HP command
- * set (CS/80 on `newer' devices, Amigo on before-you-were-born
- * devices) thrown on top. Devices that respond to CS/80 (and
- * probably Amigo, too) are tagged with a 16-bit ID.
- *
- * HP-IB has a 2-level addressing scheme; slave, the analog
- * of a SCSI ID, and punit, the analog of a SCSI LUN. Unfortunately,
- * IDs are on a per-slave basis; punits are often used for disk
- * drives that have an accompanying tape drive on the second punit.
- *
- * In addition, not all HP-IB devices speak CS/80 or Amigo.
- * Examples of such devices are HP-IB plotters, which simply
- * take raw plotter commands over 488. These devices do not
- * have ID tags, and often the host cannot even tell if such
- * a device is attached to the system!
- *
- * We nevertheless probe the whole (slave, punit) tuple space, since
- * drivers for devices with a unique ID know exactly where to attach;
- * and we disallow ``star'' locators for other drivers.
- */
-
-int
-hpibbusmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
-
- return (1);
-}
-
-void
-hpibbusattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct hpibbus_softc *sc = (struct hpibbus_softc *)self;
- struct hpibdev_attach_args *ha = aux;
-
- printf("\n");
-
- /* Get the operations vector for the controller. */
- sc->sc_ops = ha->ha_ops;
- sc->sc_type = ha->ha_type; /* XXX */
- sc->sc_ba = ha->ha_ba;
- *(ha->ha_softcpp) = sc; /* XXX */
-
- hpibreset(self->dv_unit); /* XXX souldn't be here */
-
- /*
- * Initialize the DMA queue entry.
- */
- sc->sc_dq = (struct dmaqueue *)malloc(sizeof(struct dmaqueue),
- M_DEVBUF, M_NOWAIT);
- if (sc->sc_dq == NULL) {
- printf("%s: can't allocate DMA queue entry\n", self->dv_xname);
- return;
- }
- sc->sc_dq->dq_softc = sc;
- sc->sc_dq->dq_start = hpibstart;
- sc->sc_dq->dq_done = hpibdone;
-
- /* Initialize the slave request queue. */
- TAILQ_INIT(&sc->sc_queue);
-
- /* Attach any devices on the bus. */
- hpibbus_attach_children(sc);
-}
-
-void
-hpibbus_attach_children(sc)
- struct hpibbus_softc *sc;
-{
- struct hpibbus_attach_args ha;
- int id, slave, punit;
- int i;
-
- for (slave = 0; slave < HPIB_NSLAVES; slave++) {
- /*
- * Get the ID tag for the device, if any.
- * Plotters won't identify themselves, and
- * get the same value as non-existent devices.
- * However, aging HP-IB drives are slow to respond; try up
- * to three times to get a valid ID.
- */
- for (i = 0; i < 3; i++) {
- id = hpibid(sc->sc_dev.dv_unit, slave);
- if ((id & 0x200) != 0)
- break;
- delay(10000);
- }
-
- for (punit = 0; punit < HPIB_NPUNITS; punit++) {
- /*
- * Search through all configured children for this bus.
- */
- ha.ha_id = id;
- ha.ha_slave = slave;
- ha.ha_punit = punit;
- (void)config_found_sm(&sc->sc_dev, &ha, hpibbusprint,
- hpibbussubmatch);
- }
- }
-}
-
-int
-hpibbussubmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct cfdata *cf = match;
- struct hpibbus_attach_args *ha = aux;
-
- if (cf->hpibbuscf_slave != HPIBBUS_SLAVE_UNK &&
- cf->hpibbuscf_slave != ha->ha_slave)
- return (0);
- if (cf->hpibbuscf_punit != HPIBBUS_PUNIT_UNK &&
- cf->hpibbuscf_punit != ha->ha_punit)
- return (0);
- return ((*cf->cf_attach->ca_match)(parent, match, aux));
-}
-
-int
-hpibbusprint(aux, pnp)
- void *aux;
- const char *pnp;
-{
- struct hpibbus_attach_args *ha = aux;
-
- if (pnp != NULL) {
- if (ha->ha_id == 0 || ha->ha_punit != 0 /* XXX */)
- return (QUIET);
- printf("HP-IB device (id %04X) at %s", ha->ha_id, pnp);
- }
- printf(" slave %d punit %d", ha->ha_slave, ha->ha_punit);
- return (UNCONF);
-}
-
-int
-hpibdevprint(aux, pnp)
- void *aux;
- const char *pnp;
-{
-
- /* only hpibbus's can attach to hpibdev's -- easy. */
- if (pnp != NULL)
- printf("hpibbus at %s", pnp);
- return (UNCONF);
-}
-
-void
-hpibreset(unit)
- int unit;
-{
- struct hpibbus_softc *sc = hpibbus_cd.cd_devs[unit];
-
- (*sc->sc_ops->hpib_reset)(sc);
-}
-
-int
-hpibreq(pdev, hq)
- struct device *pdev;
- struct hpibqueue *hq;
-{
- struct hpibbus_softc *sc = (struct hpibbus_softc *)pdev;
- int s;
-
- s = splhigh(); /* XXXthorpej */
- TAILQ_INSERT_TAIL(&sc->sc_queue, hq, hq_list);
- splx(s);
-
- if (TAILQ_FIRST(&sc->sc_queue) == hq)
- return (1);
-
- return (0);
-}
-
-void
-hpibfree(pdev, hq)
- struct device *pdev;
- struct hpibqueue *hq;
-{
- struct hpibbus_softc *sc = (struct hpibbus_softc *)pdev;
- int s;
-
- s = splhigh(); /* XXXthorpej */
- TAILQ_REMOVE(&sc->sc_queue, hq, hq_list);
- splx(s);
-
- if ((hq = TAILQ_FIRST(&sc->sc_queue)) != NULL)
- (*hq->hq_start)(hq->hq_softc);
-}
-
-int
-hpibid(unit, slave)
- int unit, slave;
-{
- short id;
- int ohpibtimeout;
-
- /*
- * XXX shorten timeout value so autoconfig doesn't
- * take forever on slow CPUs.
- */
- ohpibtimeout = hpibtimeout;
- if (cputype == CPU_68040)
- hpibtimeout = hpibidtimeout * (cpuspeed / 3);
- else
- hpibtimeout = hpibidtimeout * (cpuspeed / 8);
- if (hpibrecv(unit, 31, slave, &id, 2) != 2)
- id = 0;
- hpibtimeout = ohpibtimeout;
- return(id);
-}
-
-int
-hpibsend(unit, slave, sec, addr, cnt)
- int unit, slave, sec, cnt;
- void *addr;
-{
- struct hpibbus_softc *sc = hpibbus_cd.cd_devs[unit];
-
- return ((*sc->sc_ops->hpib_send)(sc, slave, sec, addr, cnt));
-}
-
-int
-hpibrecv(unit, slave, sec, addr, cnt)
- int unit, slave, sec, cnt;
- void *addr;
-{
- struct hpibbus_softc *sc = hpibbus_cd.cd_devs[unit];
-
- return ((*sc->sc_ops->hpib_recv)(sc, slave, sec, addr, cnt));
-}
-
-int
-hpibpptest(unit, slave)
- int unit;
- int slave;
-{
- struct hpibbus_softc *sc = hpibbus_cd.cd_devs[unit];
-
- return ((*sc->sc_ops->hpib_ppoll)(sc) & (0x80 >> slave));
-}
-
-void
-hpibppclear(unit)
- int unit;
-{
- struct hpibbus_softc *sc = hpibbus_cd.cd_devs[unit];
-
- sc->sc_flags &= ~HPIBF_PPOLL;
-}
-
-void
-hpibawait(unit)
- int unit;
-{
- struct hpibbus_softc *sc = hpibbus_cd.cd_devs[unit];
-
- sc->sc_flags |= HPIBF_PPOLL;
- (*sc->sc_ops->hpib_ppwatch)(sc);
-}
-
-int
-hpibswait(unit, slave)
- int unit;
- int slave;
-{
- struct hpibbus_softc *sc = hpibbus_cd.cd_devs[unit];
- int timo = hpibtimeout;
- int mask, (*ppoll)(struct hpibbus_softc *);
-
- ppoll = sc->sc_ops->hpib_ppoll;
- mask = 0x80 >> slave;
- while (((*ppoll)(sc) & mask) == 0) {
- if (--timo == 0) {
- printf("%s: swait timeout\n", sc->sc_dev.dv_xname);
- return(-1);
- }
- }
- return(0);
-}
-
-int
-hpibustart(unit)
- int unit;
-{
- struct hpibbus_softc *sc = hpibbus_cd.cd_devs[unit];
-
- if (sc->sc_type == HPIBA)
- sc->sc_dq->dq_chan = DMA0;
- else
- sc->sc_dq->dq_chan = DMA0 | DMA1;
- if (dmareq(sc->sc_dq))
- return(1);
- return(0);
-}
-
-void
-hpibstart(arg)
- void *arg;
-{
- struct hpibbus_softc *sc = arg;
- struct hpibqueue *hq;
-
- hq = TAILQ_FIRST(&sc->sc_queue);
- (*hq->hq_go)(hq->hq_softc);
-}
-
-void
-hpibgo(unit, slave, sec, vbuf, count, rw, timo)
- int unit, slave, sec;
- void *vbuf;
- int count, rw, timo;
-{
- struct hpibbus_softc *sc = hpibbus_cd.cd_devs[unit];
-
- (*sc->sc_ops->hpib_go)(sc, slave, sec, vbuf, count, rw, timo);
-}
-
-void
-hpibdone(arg)
- void *arg;
-{
- struct hpibbus_softc *sc = arg;
-
- (*sc->sc_ops->hpib_done)(sc);
-}
-
-int
-hpibintr(arg)
- void *arg;
-{
- struct hpibbus_softc *sc = arg;
-
- return ((sc->sc_ops->hpib_intr)(arg));
-}
diff --git a/sys/arch/hp300/dev/hpibvar.h b/sys/arch/hp300/dev/hpibvar.h
deleted file mode 100644
index b8c7e93b097..00000000000
--- a/sys/arch/hp300/dev/hpibvar.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/* $OpenBSD: hpibvar.h,v 1.11 2010/09/06 14:44:18 jasper Exp $ */
-/* $NetBSD: hpibvar.h,v 1.10 1997/03/31 07:34:25 scottr Exp $ */
-
-/*
- * Copyright (c) 1996, 1997 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)hpibvar.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/queue.h>
-
-#define HPIB_IPL(x) ((((x) >> 4) & 0x3) + 3)
-
-#define HPIBA 32
-#define HPIBB 1
-#define HPIBC 8
-#define HPIBA_BA 21
-#define HPIBC_BA 30
-#define HPIBA_IPL 3
-
-#define CSA_BA 0x1F
-
-#define IDS_WDMA 0x04
-#define IDS_WRITE 0x08
-#define IDS_IR 0x40
-#define IDS_IE 0x80
-#define IDS_DMA(x) (1 << (x))
-
-#define C_SDC 0x04 /* Selected device clear */
-#define C_SDC_P 0x04 /* with odd parity */
-#define C_DCL 0x14 /* Universal device clear */
-#define C_DCL_P 0x94 /* with odd parity */
-#define C_LAG 0x20 /* Listener address group commands */
-#define C_UNL 0x3f /* Universal unlisten */
-#define C_UNL_P 0xbf /* with odd parity */
-#define C_TAG 0x40 /* Talker address group commands */
-#define C_UNA 0x5e /* Unaddress (master talk address?) */
-#define C_UNA_P 0x5e /* with odd parity */
-#define C_UNT 0x5f /* Universal untalk */
-#define C_UNT_P 0xdf /* with odd parity */
-#define C_SCG 0x60 /* Secondary group commands */
-
-struct hpibbus_softc;
-
-/*
- * Each of the HP-IB controller drivers fills in this structure, which
- * is used by the indirect driver to call controller-specific functions.
- */
-struct hpib_controller {
- void (*hpib_reset)(struct hpibbus_softc *);
- int (*hpib_send)(struct hpibbus_softc *,
- int, int, void *, int);
- int (*hpib_recv)(struct hpibbus_softc *,
- int, int, void *, int);
- int (*hpib_ppoll)(struct hpibbus_softc *);
- void (*hpib_ppwatch)(void *);
- void (*hpib_go)(struct hpibbus_softc *,
- int, int, void *, int, int, int);
- void (*hpib_done)(struct hpibbus_softc *);
- int (*hpib_intr)(void *);
-};
-
-/*
- * Attach an HP-IB bus to an HP-IB controller.
- */
-struct hpibdev_attach_args {
- struct hpib_controller *ha_ops; /* controller ops vector */
- int ha_type; /* XXX */
- int ha_ba;
- struct hpibbus_softc **ha_softcpp; /* XXX */
-};
-
-/*
- * Attach an HP-IB device to an HP-IB bus.
- */
-struct hpibbus_attach_args {
- u_int16_t ha_id; /* device id */
- int ha_slave; /* HP-IB bus slave */
- int ha_punit; /* physical unit on slave */
-};
-
-/* Locator shorthand */
-#define hpibbuscf_slave cf_loc[0]
-#define hpibbuscf_punit cf_loc[1]
-
-#define HPIBBUS_SLAVE_UNK -1
-#define HPIBBUS_PUNIT_UNK -1
-
-#define HPIB_NSLAVES 8 /* number of slaves on a bus */
-#define HPIB_NPUNITS 2 /* number of punits per slave */
-
-/*
- * An HP-IB job queue entry. Slave drivers have one of these used
- * to queue requests with the controller.
- */
-struct hpibqueue {
- TAILQ_ENTRY(hpibqueue) hq_list; /* entry on queue */
- void *hq_softc; /* slave's softc */
- int hq_slave; /* slave on bus */
-
- /*
- * Callbacks used to start and stop the slave driver.
- */
- void (*hq_start)(void *);
- void (*hq_go)(void *);
- void (*hq_intr)(void *);
-};
-
-struct dmaqueue;
-
-/*
- * Software state per HP-IB bus.
- */
-struct hpibbus_softc {
- struct device sc_dev; /* generic device glue */
- struct hpib_controller *sc_ops; /* controller ops vector */
- volatile int sc_flags; /* misc flags */
- struct dmaqueue *sc_dq;
- TAILQ_HEAD(, hpibqueue) sc_queue;
- int sc_ba;
- int sc_type;
- char *sc_addr;
- int sc_count;
- int sc_curcnt;
-};
-
-/* sc_flags */
-#define HPIBF_IO 0x1
-#define HPIBF_DONE 0x2
-#define HPIBF_PPOLL 0x4
-#define HPIBF_READ 0x8
-#define HPIBF_TIMO 0x10
-#define HPIBF_DMA16 0x8000
-
-/*
- * Description structure for CS/80 devices.
- */
-
-struct cs80_describe {
- u_int d_iuw:16, /* controller: installed unit word */
- d_cmaxxfr:16, /* controller: max transfer rate (Kb) */
- d_ctype:8, /* controller: controller type */
- d_utype:8, /* unit: unit type */
- d_name:24, /* unit: name (6 BCD digits) */
- d_sectsize:16, /* unit: # of bytes per block (sector) */
- d_blkbuf:8, /* unit: # of blocks which can be buffered */
- d_burstsize:8, /* unit: recommended burst size */
- d_blocktime:16, /* unit: block time (u-sec) */
- d_uavexfr:16, /* unit: average transfer rate (Kb) */
- d_retry:16, /* unit: optimal retry time (1/100-sec) */
- d_access:16, /* unit: access time param (1/100-sec) */
- d_maxint:8, /* unit: maximum interleave */
- d_fvbyte:8, /* unit: fixed volume byte */
- d_rvbyte:8, /* unit: removable volume byte */
- d_maxcyl:24, /* volume: maximum cylinder */
- d_maxhead:8, /* volume: maximum head */
- d_maxsect:16, /* volume: maximum sector on track */
- d_maxvsecth:16, /* volume: maximum sector on volume (MSW) */
- d_maxvsectl:32, /* volume: maximum sector on volume (LSWs) */
- d_interleave:8; /* volume: current interleave */
-} __packed;
-
-#ifdef _KERNEL
-extern caddr_t internalhpib;
-extern int hpibtimeout;
-extern int hpibdmathresh;
-
-void hpibreset(int);
-int hpibsend(int, int, int, void *, int);
-int hpibrecv(int, int, int, void *, int);
-int hpibustart(int);
-void hpibstart(void *);
-void hpibgo(int, int, int, void *, int, int, int);
-void hpibdone(void *);
-int hpibpptest(int, int);
-void hpibppclear(int);
-void hpibawait(int);
-int hpibswait(int, int);
-int hpibid(int, int);
-
-int hpibreq(struct device *, struct hpibqueue *);
-void hpibfree(struct device *, struct hpibqueue *);
-
-int hpibintr(void *);
-int hpibdevprint(void *, const char *);
-#endif
diff --git a/sys/arch/hp300/dev/hyper.c b/sys/arch/hp300/dev/hyper.c
deleted file mode 100644
index 70fe53af6d7..00000000000
--- a/sys/arch/hp300/dev/hyper.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/* $OpenBSD: hyper.c,v 1.17 2013/10/21 10:36:13 miod Exp $ */
-
-/*
- * Copyright (c) 2005, Miodrag Vallat.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-/*
- * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1991 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Mark Davies of the Department of Computer
- * Science, Victoria University of Wellington, New Zealand.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_hy.c 1.2 93/08/13$
- *
- * @(#)grf_hy.c 8.4 (Berkeley) 1/12/94
- */
-
-/*
- * Graphics routines for HYPERION frame buffer
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-#include <hp300/dev/intiovar.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/rasops/rasops.h>
-
-#include <hp300/dev/diofbreg.h>
-#include <hp300/dev/diofbvar.h>
-#include <hp300/dev/hyperreg.h>
-
-struct hyper_softc {
- struct device sc_dev;
- struct diofb *sc_fb;
- struct diofb sc_fb_store;
-};
-
-int hyper_match(struct device *, void *, void *);
-void hyper_attach(struct device *, struct device *, void *);
-
-struct cfattach hyper_ca = {
- sizeof(struct hyper_softc), hyper_match, hyper_attach
-};
-
-struct cfdriver hyper_cd = {
- NULL, "hyper", DV_DULL
-};
-
-int hyper_reset(struct diofb *, int, struct diofbreg *);
-
-int hyper_ioctl(void *, u_long, caddr_t, int, struct proc *);
-void hyper_burner(void *, u_int, u_int);
-
-struct wsdisplay_accessops hyper_accessops = {
- .ioctl = hyper_ioctl,
- .mmap = diofb_mmap,
- .alloc_screen = diofb_alloc_screen,
- .free_screen = diofb_free_screen,
- .show_screen = diofb_show_screen,
- .load_font = diofb_load_font,
- .list_font = diofb_list_font,
- .burn_screen = hyper_burner
-};
-
-/*
- * Attachment glue
- */
-
-int
-hyper_match(struct device *parent, void *match, void *aux)
-{
- struct dio_attach_args *da = aux;
-
- if (da->da_id == DIO_DEVICE_ID_FRAMEBUFFER &&
- da->da_secid == DIO_DEVICE_SECID_HYPERION)
- return (1);
-
- return (0);
-}
-
-void
-hyper_attach(struct device *parent, struct device *self, void *aux)
-{
- struct hyper_softc *sc = (struct hyper_softc *)self;
- struct dio_attach_args *da = aux;
- struct diofbreg *fbr;
- int scode;
-
- scode = da->da_scode;
- if (scode == conscode) {
- fbr = (struct diofbreg *)conaddr; /* already mapped */
- sc->sc_fb = &diofb_cn;
- } else {
- sc->sc_fb = &sc->sc_fb_store;
- fbr = (struct diofbreg *)
- iomap(dio_scodetopa(scode), da->da_size);
- if (fbr == NULL ||
- hyper_reset(sc->sc_fb, scode, fbr) != 0) {
- printf(": can't map framebuffer\n");
- return;
- }
- }
-
- diofb_end_attach(self, &hyper_accessops, sc->sc_fb,
- scode == conscode, NULL);
-}
-
-/*
- * Initialize hardware and display routines.
- */
-int
-hyper_reset(struct diofb *fb, int scode, struct diofbreg *fbr)
-{
- volatile struct hyboxfb *hy = (struct hyboxfb *)fbr;
- int rc;
-
- if ((rc = diofb_fbinquire(fb, scode, fbr)) != 0)
- return (rc);
-
- fb->bmv = diofb_mono_windowmove;
-
- fb->ri.ri_depth = 1; /* do not fake a 8bpp frame buffer */
- diofb_fbsetup(fb);
-
- /* enable display */
- hy->nblank = DISP_VIDEO_ENABLE | DISP_SYNC_ENABLE;
-
- return (0);
-}
-
-int
-hyper_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p)
-{
- struct diofb *fb = v;
- struct wsdisplay_fbinfo *wdf;
-
- switch (cmd) {
- case WSDISPLAYIO_GTYPE:
- *(u_int *)data = WSDISPLAY_TYPE_HYPERION;
- break;
- case WSDISPLAYIO_SMODE:
- fb->mapmode = *(u_int *)data;
- break;
- case WSDISPLAYIO_GINFO:
- wdf = (void *)data;
- wdf->width = fb->ri.ri_width;
- wdf->height = fb->ri.ri_height;
- wdf->depth = fb->ri.ri_depth;
- wdf->cmsize = 0;
- break;
- case WSDISPLAYIO_LINEBYTES:
- *(u_int *)data = fb->ri.ri_stride;
- break;
- case WSDISPLAYIO_GVIDEO:
- case WSDISPLAYIO_SVIDEO:
- case WSDISPLAYIO_GETCMAP:
- case WSDISPLAYIO_PUTCMAP:
- break;
- default:
- return (-1);
- }
-
- return (0);
-}
-
-void
-hyper_burner(void *v, u_int on, u_int flags)
-{
- struct diofb *fb = v;
- volatile struct hyboxfb *hy = (struct hyboxfb *)fb->regkva;
-
- if (on) {
- hy->nblank = DISP_VIDEO_ENABLE | DISP_SYNC_ENABLE;
- } else {
- if (flags & WSDISPLAY_BURN_VBLANK)
- hy->nblank = 0;
- else
- hy->nblank = DISP_SYNC_ENABLE;
- }
-}
-
-/*
- * Hyperion console support
- */
-
-void
-hypercninit()
-{
- hyper_reset(&diofb_cn, conscode, (struct diofbreg *)conaddr);
- diofb_cnattach(&diofb_cn);
-}
diff --git a/sys/arch/hp300/dev/hyperreg.h b/sys/arch/hp300/dev/hyperreg.h
deleted file mode 100644
index 55eed690860..00000000000
--- a/sys/arch/hp300/dev/hyperreg.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* $OpenBSD: hyperreg.h,v 1.3 2005/01/24 21:36:39 miod Exp $ */
-/* $NetBSD: grf_hyreg.h,v 1.2 1994/10/26 07:23:57 cgd Exp $ */
-
-/*
- * Copyright (c) 1991 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Mark Davies of the Department of Computer
- * Science, Victoria University of Wellington, New Zealand.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_hyreg.h 1.1 92/01/22$
- *
- * @(#)grf_hyreg.h 8.1 (Berkeley) 6/10/93
- */
-
-struct hyboxfb {
- struct diofbreg regs;
- u_int8_t f2[0x4000-0x5f-1];
- u_int8_t nblank; /* display enable planes 0x4000 */
-};
-
-/* Values for nblank */
-#define DISP_SYNC_ENABLE 0x01
-#define DISP_VIDEO_ENABLE 0x04
diff --git a/sys/arch/hp300/dev/if_le.c b/sys/arch/hp300/dev/if_le.c
deleted file mode 100644
index 80386ad2dd5..00000000000
--- a/sys/arch/hp300/dev/if_le.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/* $OpenBSD: if_le.c,v 1.18 2013/09/24 20:10:44 miod Exp $ */
-/* $NetBSD: if_le.c,v 1.43 1997/05/05 21:05:32 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1995 Charles M. Hannum. All rights reserved.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell and Rick Macklem.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)if_le.c 8.2 (Berkeley) 11/16/93
- */
-
-#include "bpfilter.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/mbuf.h>
-#include <sys/syslog.h>
-#include <sys/socket.h>
-#include <sys/device.h>
-
-#include <net/if.h>
-
-#ifdef INET
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-#endif
-
-#include <net/if_media.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-#include <machine/intr.h>
-
-#include <dev/ic/lancereg.h>
-#include <dev/ic/lancevar.h>
-#include <dev/ic/am7990reg.h>
-#include <dev/ic/am7990var.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-#include <hp300/dev/if_lereg.h>
-#include <hp300/dev/if_levar.h>
-
-#ifdef USELEDS
-#include <hp300/hp300/leds.h>
-#endif
-
-int lematch(struct device *, void *, void *);
-void leattach(struct device *, struct device *, void *);
-
-struct cfattach le_ca = {
- sizeof(struct le_softc), lematch, leattach
-};
-
-int leintr(void *);
-
-/* offsets for: ID, REGS, MEM, NVRAM */
-const int lestd[] = { 0, 0x4000, 0x8000, 0xC008 };
-
-void lewrcsr(struct lance_softc *, uint16_t, uint16_t);
-uint16_t lerdcsr(struct lance_softc *, uint16_t);
-
-void
-lewrcsr(struct lance_softc *sc, uint16_t port, uint16_t val)
-{
- struct lereg0 *ler0 = ((struct le_softc *)sc)->sc_r0;
- struct lereg1 *ler1 = ((struct le_softc *)sc)->sc_r1;
-
- do {
- ler1->ler1_rap = port;
- } while ((ler0->ler0_status & LE_ACK) == 0);
- do {
- ler1->ler1_rdp = val;
- } while ((ler0->ler0_status & LE_ACK) == 0);
-}
-
-uint16_t
-lerdcsr(struct lance_softc *sc, uint16_t port)
-{
- struct lereg0 *ler0 = ((struct le_softc *)sc)->sc_r0;
- struct lereg1 *ler1 = ((struct le_softc *)sc)->sc_r1;
- uint16_t val;
-
- do {
- ler1->ler1_rap = port;
- } while ((ler0->ler0_status & LE_ACK) == 0);
- do {
- val = ler1->ler1_rdp;
- } while ((ler0->ler0_status & LE_ACK) == 0);
- return (val);
-}
-
-int
-lematch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct dio_attach_args *da = aux;
-
- if ((da->da_id == DIO_DEVICE_ID_LAN) ||
- (da->da_id == DIO_DEVICE_ID_LANREM))
- return (1);
- return (0);
-}
-
-/*
- * Interface exists: make available by filling in network interface
- * record. System will initialize the interface when it is ready
- * to accept packets.
- */
-void
-leattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct lereg0 *ler0;
- struct dio_attach_args *da = aux;
- struct le_softc *lesc = (struct le_softc *)self;
- caddr_t addr;
- struct lance_softc *sc = &lesc->sc_am7990.lsc;
- char *cp;
- int i, ipl;
-
- addr = iomap(dio_scodetopa(da->da_scode), da->da_size);
- if (addr == 0) {
- printf("\n%s: can't map LANCE registers\n",
- sc->sc_dev.dv_xname);
- return;
- }
-
- ler0 = lesc->sc_r0 = (struct lereg0 *)(lestd[0] + (int)addr);
- ler0->ler0_id = 0xFF;
- DELAY(100);
-
- ipl = DIO_IPL(addr);
- printf(" ipl %d", ipl);
-
- lesc->sc_r1 = (struct lereg1 *)(lestd[1] + (int)addr);
- sc->sc_mem = (void *)(lestd[2] + (int)addr);
- sc->sc_conf3 = LE_C3_BSWP;
- sc->sc_addr = 0;
- sc->sc_memsize = 16384;
-
- /*
- * Read the ethernet address off the board, one nibble at a time.
- */
- cp = (char *)(lestd[3] + (int)addr);
- for (i = 0; i < sizeof(sc->sc_arpcom.ac_enaddr); i++) {
- sc->sc_arpcom.ac_enaddr[i] = (*++cp & 0xF) << 4;
- cp++;
- sc->sc_arpcom.ac_enaddr[i] |= *++cp & 0xF;
- cp++;
- }
-
- sc->sc_copytodesc = lance_copytobuf_contig;
- sc->sc_copyfromdesc = lance_copyfrombuf_contig;
- sc->sc_copytobuf = lance_copytobuf_contig;
- sc->sc_copyfrombuf = lance_copyfrombuf_contig;
- sc->sc_zerobuf = lance_zerobuf_contig;
-
- sc->sc_rdcsr = lerdcsr;
- sc->sc_wrcsr = lewrcsr;
- sc->sc_hwreset = NULL;
- sc->sc_hwinit = NULL;
-
- am7990_config(&lesc->sc_am7990);
-
- /* Establish the interrupt handler. */
- lesc->sc_isr.isr_func = leintr;
- lesc->sc_isr.isr_arg = lesc;
- lesc->sc_isr.isr_ipl = ipl;
- lesc->sc_isr.isr_priority = IPL_NET;
- dio_intr_establish(&lesc->sc_isr, self->dv_xname);
- ler0->ler0_status = LE_IE;
-}
-
-int
-leintr(arg)
- void *arg;
-{
- struct le_softc *lesc = (struct le_softc *)arg;
- struct lance_softc *sc = &lesc->sc_am7990.lsc;
-#ifdef USELEDS
- uint16_t isr;
-
- isr = lerdcsr(sc, LE_CSR0);
-
- if ((isr & LE_C0_INTR) == 0)
- return (0);
-
- if (isr & LE_C0_RINT)
- ledcontrol(0, 0, LED_LANRCV);
-
- if (isr & LE_C0_TINT)
- ledcontrol(0, 0, LED_LANXMT);
-#endif /* USELEDS */
-
- return am7990_intr(sc);
-}
diff --git a/sys/arch/hp300/dev/if_lereg.h b/sys/arch/hp300/dev/if_lereg.h
deleted file mode 100644
index 1f4247b7b1f..00000000000
--- a/sys/arch/hp300/dev/if_lereg.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* $OpenBSD: if_lereg.h,v 1.4 2003/06/02 23:27:45 millert Exp $ */
-/* $NetBSD: if_lereg.h,v 1.8 1995/12/10 00:49:36 mycroft Exp $ */
-
-/*
- * Copyright (c) 1982, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)if_lereg.h 7.1 (Berkeley) 5/8/90
- */
-
-#define LEID 21
-
-/*
- * DIO registers.
- */
-struct lereg0 {
- u_int8_t ler0_pad0;
- volatile u_int8_t ler0_id; /* ID */
- u_int8_t ler0_pad1;
- volatile u_int8_t ler0_status; /* interrupt enable/status */
-};
-
-/*
- * Control and status bits -- lereg0
- */
-#define LE_IE 0x80 /* interrupt enable */
-#define LE_IR 0x40 /* interrupt requested */
-#define LE_LOCK 0x08 /* lock status register */
-#define LE_ACK 0x04 /* ack of lock */
-#define LE_JAB 0x02 /* loss of tx clock (???) */
-#define LE_IPL(x) ((((x) >> 4) & 0x3) + 3)
-
-/*
- * LANCE registers.
- */
-struct lereg1 {
- volatile u_int16_t ler1_rdp; /* data port */
- volatile u_int16_t ler1_rap; /* register select port */
-};
diff --git a/sys/arch/hp300/dev/if_levar.h b/sys/arch/hp300/dev/if_levar.h
deleted file mode 100644
index 8fbed649e56..00000000000
--- a/sys/arch/hp300/dev/if_levar.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* $OpenBSD: if_levar.h,v 1.7 2004/09/29 07:35:52 miod Exp $ */
-/* $NetBSD: if_levar.h,v 1.8 1997/04/14 02:30:45 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1995 Charles M. Hannum. All rights reserved.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell and Rick Macklem.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)if_le.c 8.2 (Berkeley) 11/16/93
- */
-
-/*
- * Ethernet software status per interface.
- *
- * Each interface is referenced by a network interface structure,
- * arpcom.ac_if, which the routing code uses to locate the interface.
- * This structure contains the output queue for the interface, its address, ...
- */
-struct le_softc {
- struct am7990_softc sc_am7990; /* glue to MI code */
- struct isr sc_isr;
-
- struct lereg0 *sc_r0; /* DIO registers */
- struct lereg1 *sc_r1; /* LANCE registers */
-};
diff --git a/sys/arch/hp300/dev/intio.c b/sys/arch/hp300/dev/intio.c
deleted file mode 100644
index 4ff81012fa5..00000000000
--- a/sys/arch/hp300/dev/intio.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* $OpenBSD: intio.c,v 1.7 2008/06/26 05:42:10 ray Exp $ */
-/* $NetBSD: intio.c,v 1.2 1997/01/30 09:18:54 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Autoconfiguration support for hp300 internal i/o space.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-
-#include <machine/bus.h>
-
-#include <hp300/dev/intiovar.h>
-
-int intiomatch(struct device *, void *, void *);
-void intioattach(struct device *, struct device *, void *);
-int intioprint(void *, const char *);
-int intiosearch(struct device *, void *, void *);
-
-struct cfattach intio_ca = {
- sizeof(struct device), intiomatch, intioattach
-};
-
-struct cfdriver intio_cd = {
- NULL, "intio", DV_DULL
-};
-
-int
-intiomatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- static int intio_matched = 0;
-
- /* Allow only one instance. */
- if (intio_matched)
- return (0);
-
- intio_matched = 1;
- return (1);
-}
-
-void
-intioattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
-
- printf("\n");
-
- /* Search for and attach children. */
- config_search(intiosearch, self, NULL);
-}
-
-int
-intioprint(aux, pnp)
- void *aux;
- const char *pnp;
-{
- struct intio_attach_args *ia = aux;
-
- if (ia->ia_addr != 0)
- printf(" addr %p", ia->ia_addr);
- return (UNCONF);
-}
-
-int
-intiosearch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct cfdata *cf = match;
- struct intio_attach_args ia;
- extern struct hp300_bus_space_tag hp300_mem_tag;
-
- bzero(&ia, sizeof(ia));
- ia.ia_tag = &hp300_mem_tag;
-
- if ((*cf->cf_attach->ca_match)(parent, cf, &ia) > 0)
- config_attach(parent, cf, &ia, intioprint);
-
- return (0);
-}
diff --git a/sys/arch/hp300/dev/intiovar.h b/sys/arch/hp300/dev/intiovar.h
deleted file mode 100644
index de3b8108de9..00000000000
--- a/sys/arch/hp300/dev/intiovar.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* $OpenBSD: intiovar.h,v 1.4 2008/06/26 05:42:10 ray Exp $ */
-/* $NetBSD: intiovar.h,v 1.2 1997/01/30 09:18:55 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Autoconfiguration definitions and prototypes for the hp300
- * internal i/o space.
- */
-
-/*
- * Arguments used to attach a device to the internal i/o space.
- */
-struct intio_attach_args {
- caddr_t ia_addr; /* physical address */
- bus_space_tag_t ia_tag;
-};
diff --git a/sys/arch/hp300/dev/iotypes.h b/sys/arch/hp300/dev/iotypes.h
deleted file mode 100644
index 7a52a188bb8..00000000000
--- a/sys/arch/hp300/dev/iotypes.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* $OpenBSD: iotypes.h,v 1.3 2003/06/02 23:27:45 millert Exp $ */
-/* $NetBSD: iotypes.h,v 1.2 1994/10/26 07:24:24 cgd Exp $ */
-
-/*
- * Copyright (c) 1991 University of Utah.
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: iotypes.h 1.1 91/12/12$
- *
- * @(#)iotypes.h 8.1 (Berkeley) 6/10/93
- */
-
-#ifndef _IOTYPES_
-#define _IOTYPES_
-
-/*
- * Where do these really belong?
- */
-typedef volatile char v_char;
-typedef volatile unsigned char vu_char;
-typedef volatile short v_short;
-typedef volatile unsigned short vu_short;
-typedef volatile int v_int;
-typedef volatile unsigned int vu_int;
-#endif
diff --git a/sys/arch/hp300/dev/isa_machdep.h b/sys/arch/hp300/dev/isa_machdep.h
deleted file mode 100644
index f796298a580..00000000000
--- a/sys/arch/hp300/dev/isa_machdep.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* $OpenBSD: isa_machdep.h,v 1.1 2007/01/06 20:17:43 miod Exp $ */
-
-/*
- * Copyright (c) 2007 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice, this permission notice, and the disclaimer below
- * appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef _HP300_ISA_MACHDEP_H_
-#define _HP300_ISA_MACHDEP_H_
-
-#include <machine/bus.h>
-
-#define __NO_ISA_INTR_CHECK
-
-typedef void * isa_chipset_tag_t;
-
-void isa_attach_hook(struct device *, struct device *,
- struct isabus_attach_args *);
-void *isa_intr_establish(isa_chipset_tag_t, int, int, int,
- int (*)(void *), void *, char *);
-void isa_intr_disestablish(isa_chipset_tag_t, void *);
-
-#define IST_NONE 0
-#define IST_PULSE 1
-#define IST_EDGE 2
-#define IST_LEVEL 3
-
-#endif /* _HP300_ISA_MACHDEP_H_ */
diff --git a/sys/arch/hp300/dev/isabr.c b/sys/arch/hp300/dev/isabr.c
deleted file mode 100644
index 10459182fb3..00000000000
--- a/sys/arch/hp300/dev/isabr.c
+++ /dev/null
@@ -1,1003 +0,0 @@
-/* $OpenBSD: isabr.c,v 1.2 2007/01/14 17:54:45 miod Exp $ */
-
-/*
- * Copyright (c) 2007 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice, this permission notice, and the disclaimer below
- * appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * HP 9000/4xx model `t' single ISA slot attachment
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/extent.h>
-#include <sys/malloc.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-#include <machine/hp300spu.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <dev/isa/isareg.h>
-#include <dev/isa/isavar.h>
-
-#include <hp300/dev/frodoreg.h>
-#include <hp300/dev/frodovar.h>
-#include <hp300/dev/isabrreg.h>
-
-int isabr_match(struct device *, void *, void *);
-void isabr_attach(struct device *, struct device *, void *);
-int isabr_print(void *, const char *);
-
-struct isabr_softc {
- struct device sc_dev;
- struct extent *sc_io_extent;
- struct extent *sc_mem_extent;
-};
-
-struct cfattach isabr_ca = {
- sizeof(struct isabr_softc), isabr_match, isabr_attach
-};
-
-struct cfdriver isabr_cd = {
- NULL, "isabr", DV_DULL
-};
-
-struct isabr_softc *isabr;
-
-int isabr_bus_space_setup(struct isabr_softc *, struct frodo_attach_args *,
- struct isabus_attach_args *);
-
-int
-isabr_match(struct device *parent, void *match, void *aux)
-{
- struct frodo_attach_args *fa = aux;
- static int isa_matched = 0;
-
- if (isa_matched != 0)
- return (0);
-
- if (strcmp(fa->fa_name, isabr_cd.cd_name) != 0)
- return (0);
-
- /*
- * We assume parent has checked our physical existence for us.
- */
-
- return (isa_matched = 1);
-}
-
-void
-isabr_attach(struct device *parent, struct device *self, void *aux)
-{
- struct isabus_attach_args iba;
- struct isabr_softc *sc = (struct isabr_softc *)self;
- struct frodo_attach_args *faa = (struct frodo_attach_args *)aux;
-
- bzero(&iba, sizeof(iba));
-
- if (isabr_bus_space_setup(sc, faa, &iba) != 0) {
- printf(": can not initialize bus_space\n");
- return;
- }
- printf("\n");
-
- iba.iba_busname = "isa";
- config_found(self, &iba, isabr_print);
-}
-
-int
-isabr_print(void *aux, const char *pnp)
-{
- if (pnp)
- printf("isa at %s", pnp);
- return (UNCONF);
-}
-
-/*
- * ISA support functions
- */
-
-void
-isa_attach_hook(struct device *parent, struct device *self,
- struct isabus_attach_args *iba)
-{
- iba->iba_ic = parent; /* isabr0 */
-}
-
-/*
- * Interrupt handling.
- *
- * We are currently registering ISA interrupt handlers as Frodo interrupt
- * handlers directly. We can because model `t' only have a single slot.
- *
- * Eventually this should be replaced with an isabr interrupt dispatcher,
- * allowing multiple interrupts on the same Frodo line. This would also
- * move the ISA-specific acknowledge out of non-ISA Frodo lines processing.
- * And this would allow a real intr_disestablish function.
- */
-void *
-isa_intr_establish(isa_chipset_tag_t ic, int irq, int type, int level,
- int (*handler)(void *), void *arg, char *name)
-{
- struct isabr_softc *sc = (struct isabr_softc *)ic;
- struct isr *isr;
- int fline;
-
- /*
- * Frodo is configured for edge interrupts.
- */
- if (type != IST_EDGE) {
-#ifdef DIAGNOSTIC
- printf("%s: non-edge interrupt type not supported on hp300\n",
- name);
-#endif
- return (NULL);
- }
-
- switch (irq) {
- case 3:
- case 4:
- case 5:
- case 6:
- fline = FRODO_INTR_ILOW;
- break;
- case 7:
- case 9:
- case 10:
- case 11:
- fline = FRODO_INTR_IMID;
- break;
- case 12:
- case 14:
- case 15:
- fline = FRODO_INTR_IHI;
- break;
- default:
-#ifdef DIAGNOSTIC
- printf("%s: ISA irq %d not available on " MACHINE "\n", name);
-#endif
- return (NULL);
- }
-
- isr = (struct isr *)malloc(sizeof(struct isr), M_DEVBUF, M_NOWAIT);
- if (isr == NULL)
- return (NULL);
-
- isr->isr_func = handler;
- isr->isr_arg = arg;
- isr->isr_priority = level;
-
- if (frodo_intr_establish(sc->sc_dev.dv_parent, fline, isr, name) == 0)
- return (isr);
-
- free(isr, M_DEVBUF);
- return (NULL);
-}
-
-void
-isa_intr_disestablish(isa_chipset_tag_t ic, void *cookie)
-{
-#if 0
- struct isabr_softc *sc = (struct isabr_softc *)ic;
- struct isr *isr = cookie;
-
- /* XXX how to find fline back? */
- frodo_intr_disestablish(sc->dv_parent, fline);
- free(isr, M_DEVBUF);
-#else
- panic("isa_intr_disestablish");
-#endif
-}
-
-/*
- * Implementation of bus_space mapping for the hp300 isa slot.
- *
- * Everything is memory mapped, but the I/O space is scattered for better
- * userland access control granularity, should we ever provide iopl
- * facilities, thus i/o space accesses need their own routines set, while
- * memory space simply reuse the ``canonical'' bus_space routines.
- *
- * For the I/O space, all bus_space_map allocations are extended to a 8 ports
- * granularity, so that they span entire, contiguous pages; the handle value
- * however needs to keep track of the in-page offset if the first port is
- * not aligned to a ``line'' boundary.
- *
- * I.e, a bus_space_map(0x302, 0xe) call will map the 0x300-0x30f area,
- * and return a pointer the 0x302 port. Access routines will then, from
- * this pointer, construct a (0x300, 0x02) tuple, which they can use to
- * access the remainder of the range.
- */
-
-/*
- * ISA I/O space
- */
-
-int hp300_isa_io_map(bus_addr_t, bus_size_t, int, bus_space_handle_t *);
-void hp300_isa_io_unmap(bus_space_handle_t, bus_size_t);
-int hp300_isa_io_subregion(bus_space_handle_t, bus_size_t, bus_size_t,
- bus_space_handle_t *);
-void * hp300_isa_io_vaddr(bus_space_handle_t);
-
-u_int8_t hp300_isa_io_bsr1(bus_space_handle_t, bus_size_t);
-u_int16_t hp300_isa_io_bsr2(bus_space_handle_t, bus_size_t);
-u_int32_t hp300_isa_io_bsr4(bus_space_handle_t, bus_size_t);
-u_int16_t __hp300_isa_io_bsr2(bus_space_handle_t, bus_size_t);
-u_int32_t __hp300_isa_io_bsr4(bus_space_handle_t, bus_size_t);
-void hp300_isa_io_bsrm1(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
-void hp300_isa_io_bsrm2(bus_space_handle_t, bus_size_t, u_int16_t *, size_t);
-void hp300_isa_io_bsrm4(bus_space_handle_t, bus_size_t, u_int32_t *, size_t);
-void hp300_isa_io_bsrrm2(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
-void hp300_isa_io_bsrrm4(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
-void hp300_isa_io_bsrr1(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
-void hp300_isa_io_bsrr2(bus_space_handle_t, bus_size_t, u_int16_t *, size_t);
-void hp300_isa_io_bsrr4(bus_space_handle_t, bus_size_t, u_int32_t *, size_t);
-void hp300_isa_io_bsrrr2(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
-void hp300_isa_io_bsrrr4(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
-void hp300_isa_io_bsw1(bus_space_handle_t, bus_size_t, u_int8_t);
-void hp300_isa_io_bsw2(bus_space_handle_t, bus_size_t, u_int16_t);
-void hp300_isa_io_bsw4(bus_space_handle_t, bus_size_t, u_int32_t);
-void __hp300_isa_io_bsw2(bus_space_handle_t, bus_size_t, u_int16_t);
-void __hp300_isa_io_bsw4(bus_space_handle_t, bus_size_t, u_int32_t);
-void hp300_isa_io_bswm1(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
-void hp300_isa_io_bswm2(bus_space_handle_t, bus_size_t, const u_int16_t *, size_t);
-void hp300_isa_io_bswm4(bus_space_handle_t, bus_size_t, const u_int32_t *, size_t);
-void hp300_isa_io_bswrm2(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
-void hp300_isa_io_bswrm4(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
-void hp300_isa_io_bswr1(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
-void hp300_isa_io_bswr2(bus_space_handle_t, bus_size_t, const u_int16_t *, size_t);
-void hp300_isa_io_bswr4(bus_space_handle_t, bus_size_t, const u_int32_t *, size_t);
-void hp300_isa_io_bswrr2(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
-void hp300_isa_io_bswrr4(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
-void hp300_isa_io_bssm1(bus_space_handle_t, bus_size_t, u_int8_t, size_t);
-void hp300_isa_io_bssm2(bus_space_handle_t, bus_size_t, u_int16_t, size_t);
-void hp300_isa_io_bssm4(bus_space_handle_t, bus_size_t, u_int32_t, size_t);
-void hp300_isa_io_bssr1(bus_space_handle_t, bus_size_t, u_int8_t, size_t);
-void hp300_isa_io_bssr2(bus_space_handle_t, bus_size_t, u_int16_t, size_t);
-void hp300_isa_io_bssr4(bus_space_handle_t, bus_size_t, u_int32_t, size_t);
-
-struct hp300_bus_space_tag hp300_isa_io_tag = {
- hp300_isa_io_map,
- hp300_isa_io_unmap,
- hp300_isa_io_subregion,
- hp300_isa_io_vaddr,
-
- hp300_isa_io_bsr1,
- hp300_isa_io_bsr2,
- hp300_isa_io_bsr4,
-
- hp300_isa_io_bsrm1,
- hp300_isa_io_bsrm2,
- hp300_isa_io_bsrm4,
-
- hp300_isa_io_bsrrm2,
- hp300_isa_io_bsrrm4,
-
- hp300_isa_io_bsrr1,
- hp300_isa_io_bsrr2,
- hp300_isa_io_bsrr4,
-
- hp300_isa_io_bsrrr2,
- hp300_isa_io_bsrrr4,
-
- hp300_isa_io_bsw1,
- hp300_isa_io_bsw2,
- hp300_isa_io_bsw4,
-
- hp300_isa_io_bswm1,
- hp300_isa_io_bswm2,
- hp300_isa_io_bswm4,
-
- hp300_isa_io_bswrm2,
- hp300_isa_io_bswrm4,
-
- hp300_isa_io_bswr1,
- hp300_isa_io_bswr2,
- hp300_isa_io_bswr4,
-
- hp300_isa_io_bswrr2,
- hp300_isa_io_bswrr4,
-
- hp300_isa_io_bssm1,
- hp300_isa_io_bssm2,
- hp300_isa_io_bssm4,
-
- hp300_isa_io_bssr1,
- hp300_isa_io_bssr2,
- hp300_isa_io_bssr4
-};
-
-int
-hp300_isa_io_map(bus_addr_t bpa, bus_size_t size, int flags,
- bus_space_handle_t *bshp)
-{
- int error;
- u_int iobase, iosize, npg;
- vaddr_t va;
- paddr_t pa;
-
-#ifdef DEBUG
- printf("isa_io_map(%04x, %04x)", bpa, size);
-#endif
-
- /*
- * Reserve the range in the allocation extent.
- */
- if (bpa < IO_ISABEGIN || bpa + size > IO_ISAEND + 1) {
-#ifdef DEBUG
- printf(" outside available range\n");
-#endif
- return (ERANGE);
- }
- error = extent_alloc_region(isabr->sc_io_extent, bpa, size,
- EX_MALLOCOK);
- if (error != 0) {
-#ifdef DEBUG
- printf(" overlaps extent\n");
-#endif
- return (error);
- }
-
- /*
- * Round the allocation to a multiple of 8 bytes, to end up
- * with entire pages.
- */
- iobase = bpa & ~(ISABR_IOPORT_LINE - 1);
- iosize = ((bpa + size + (ISABR_IOPORT_LINE - 1)) &
- ~(ISABR_IOPORT_LINE - 1)) - iobase;
-
- /*
- * Compute how many pages will be necessary to map this range.
- */
- npg = iosize / ISABR_IOPORT_LINE;
-#ifdef DEBUG
- printf("->(%04x, %04x)=%d@", iobase, iosize, npg);
-#endif
-
- /*
- * Allocate virtual address space to map this space in.
- */
- va = uvm_km_valloc(kernel_map, ptoa(npg));
- if (va == 0) {
-#ifdef DEBUG
- printf("NULL\n");
-#endif
- extent_free(isabr->sc_io_extent, bpa, size, EX_MALLOCOK);
- return (ENOMEM);
- }
-
- *bshp = (bus_space_handle_t)(va + (bpa - iobase));
-
- pa = ISABR_IOPORT_BASE + ISAADDR(iobase);
-#ifdef DEBUG
- printf("%08x (ret %08x) pa %08x\n", va, *bshp, pa);
-#endif
-
- while (npg != 0) {
- pmap_kenter_cache(va, pa, PG_RW | PG_CI);
- npg--;
- va += PAGE_SIZE;
- pa += PAGE_SIZE;
- }
- pmap_update(pmap_kernel());
-
- return (0);
-}
-
-void
-hp300_isa_io_unmap(bus_space_handle_t bsh, bus_size_t size)
-{
- u_int iobase, iosize, npg;
- vaddr_t va;
- paddr_t pa;
-
-#ifdef DEBUG
- printf("isa_io_unmap(%08x, %04x)", bsh, size);
-#endif
-
- /*
- * Find the pa matching this allocation, and the I/O port base
- * from it.
- */
- va = (vaddr_t)bsh;
- if (pmap_extract(pmap_kernel(), va, &pa) == FALSE) {
-#ifdef DEBUG
- printf("-> no pa\n");
-#endif
- return; /* XXX be vocal? */
- }
-
-#ifdef DEBUG
- printf("-> pa %08x ", pa);
-#endif
- pa -= ISABR_IOPORT_BASE;
- iobase = ISAPORT(pa);
- if (iobase < IO_ISABEGIN || iobase > IO_ISAEND) {
-#ifdef DEBUG
- printf("iobase %08x???\n", iobase);
-#endif
- return; /* XXX be vocal? */
- }
-
- iosize = size + (iobase & (ISABR_IOPORT_LINE - 1)) +
- (ISABR_IOPORT_LINE - 1);
- npg = iosize / ISABR_IOPORT_LINE;
-#ifdef DEBUG
- printf(" range %04x-%04x: %d\n", iobase, size, npg);
-#endif
-
- pmap_kremove(va, ptoa(npg));
- pmap_update(pmap_kernel());
- uvm_km_free(kernel_map, va, ptoa(npg));
-
- (void)extent_free(isabr->sc_io_extent, (u_long)iobase, size,
- EX_MALLOCOK);
-}
-
-/*
- * Round down an I/O space bus_space_handle, so that it points to the
- * beginning of a page.
- * This is gonna be hell when we support ports above 0x400.
- */
-#define REALIGN_IO_HANDLE(h, o) \
-do { \
- u_int tmp; \
- tmp = (h) & (ISABR_IOPORT_LINE - 1); \
- (h) -= tmp; \
- (o) += tmp; \
-} while (0)
-
-/* ARGSUSED */
-int
-hp300_isa_io_subregion(bus_space_handle_t bsh, bus_size_t offset,
- bus_size_t size, bus_space_handle_t *nbshp)
-{
- REALIGN_IO_HANDLE(bsh, offset);
- bsh += ISAADDR(offset);
- *nbshp = bsh;
- return (0);
-}
-
-void *
-hp300_isa_io_vaddr(bus_space_handle_t h)
-{
- return (NULL);
-}
-
-/* bus_space_read_X */
-
-u_int8_t
-hp300_isa_io_bsr1(bus_space_handle_t bsh, bus_size_t offset)
-{
- vaddr_t va;
- u_int8_t rc;
-
- REALIGN_IO_HANDLE(bsh, offset);
- va = (vaddr_t)bsh + ISAADDR(offset);
- rc = *(volatile u_int8_t *)va;
-#ifdef DEBUG
- printf("R%03x(%x):%02x\t", offset, va, rc);
-#endif
- return (rc);
-}
-
-u_int16_t
-__hp300_isa_io_bsr2(bus_space_handle_t bsh, bus_size_t offset)
-{
- u_int16_t rc;
- vaddr_t va;
-
- if (offset & 1) {
- rc = hp300_isa_io_bsr1(bsh, offset + 1) << 8;
- rc |= hp300_isa_io_bsr1(bsh, offset);
- } else {
- REALIGN_IO_HANDLE(bsh, offset);
- va = (vaddr_t)bsh + ISAADDR(offset);
- rc = *(volatile u_int16_t *)va;
- }
-#ifdef DEBUG
- printf("R%03x:%04x\t", offset, rc);
-#endif
- return (rc);
-}
-
-u_int16_t
-hp300_isa_io_bsr2(bus_space_handle_t bsh, bus_size_t offset)
-{
- u_int16_t rc;
-
- rc = __hp300_isa_io_bsr2(bsh, offset);
- return (letoh16(rc));
-}
-
-u_int32_t
-__hp300_isa_io_bsr4(bus_space_handle_t bsh, bus_size_t offset)
-{
- u_int32_t rc;
- vaddr_t va;
-
- if (offset & 3) {
- rc = hp300_isa_io_bsr1(bsh, offset + 3) << 24;
- rc |= hp300_isa_io_bsr1(bsh, offset + 2) << 16;
- rc |= hp300_isa_io_bsr1(bsh, offset + 1) << 8;
- rc |= hp300_isa_io_bsr1(bsh, offset);
- } else {
- REALIGN_IO_HANDLE(bsh, offset);
- va = (vaddr_t)bsh + ISAADDR(offset);
- rc = *(volatile u_int32_t *)va;
- }
-#ifdef DEBUG
- printf("R%03x:%08x\t", offset, rc);
-#endif
- return (rc);
-}
-
-u_int32_t
-hp300_isa_io_bsr4(bus_space_handle_t bsh, bus_size_t offset)
-{
- u_int32_t rc;
-
- rc = __hp300_isa_io_bsr4(bsh, offset);
- return (letoh32(rc));
-}
-
-/* bus_space_read_multi_X */
-
-void
-hp300_isa_io_bsrm1(bus_space_handle_t h, bus_size_t offset,
- u_int8_t *a, size_t c)
-{
- while ((int)--c >= 0)
- *a++ = hp300_isa_io_bsr1(h, offset);
-}
-
-void
-hp300_isa_io_bsrm2(bus_space_handle_t h, bus_size_t offset,
- u_int16_t *a, size_t c)
-{
- while ((int)--c >= 0)
- *a++ = hp300_isa_io_bsr2(h, offset);
-}
-
-void
-hp300_isa_io_bsrm4(bus_space_handle_t h, bus_size_t offset,
- u_int32_t *a, size_t c)
-{
- while ((int)--c >= 0)
- *a++ = hp300_isa_io_bsr4(h, offset);
-}
-
-/* bus_space_read_raw_multi_X */
-
-void
-hp300_isa_io_bsrrm2(bus_space_handle_t h, bus_size_t offset,
- u_int8_t *a, size_t c)
-{
- while ((int)--c >= 0) {
- *(u_int16_t *)a = __hp300_isa_io_bsr2(h, offset);
- a += 2;
- }
-}
-
-void
-hp300_isa_io_bsrrm4(bus_space_handle_t h, bus_size_t offset,
- u_int8_t *a, size_t c)
-{
- while ((int)--c >= 0) {
- *(u_int32_t *)a = __hp300_isa_io_bsr4(h, offset);
- a += 4;
- }
-}
-
-/* bus_space_read_region_X */
-
-void
-hp300_isa_io_bsrr1(bus_space_handle_t h, bus_size_t offset,
- u_int8_t *a, size_t c)
-{
- while ((int)--c >= 0)
- *a++ = hp300_isa_io_bsr1(h, offset++);
-}
-
-void
-hp300_isa_io_bsrr2(bus_space_handle_t h, bus_size_t offset,
- u_int16_t *a, size_t c)
-{
- while ((int)--c >= 0) {
- *a++ = hp300_isa_io_bsr2(h, offset);
- offset += 2;
- }
-}
-
-void
-hp300_isa_io_bsrr4(bus_space_handle_t h, bus_size_t offset,
- u_int32_t *a, size_t c)
-{
- while ((int)--c >= 0) {
- *a++ = hp300_isa_io_bsr4(h, offset);
- offset += 4;
- }
-}
-
-/* bus_space_read_raw_region_X */
-
-void
-hp300_isa_io_bsrrr2(bus_space_handle_t h, bus_size_t offset,
- u_int8_t *a, size_t c)
-{
- c >>= 1;
- while ((int)--c >= 0) {
- *(u_int16_t *)a = __hp300_isa_io_bsr2(h, offset);
- offset += 2;
- a += 2;
- }
-}
-
-void
-hp300_isa_io_bsrrr4(bus_space_handle_t h, bus_size_t offset,
- u_int8_t *a, size_t c)
-{
- c >>= 2;
- while ((int)--c >= 0) {
- *(u_int32_t *)a = __hp300_isa_io_bsr4(h, offset);
- offset += 4;
- a += 4;
- }
-}
-
-/* bus_space_write_X */
-
-void
-hp300_isa_io_bsw1(bus_space_handle_t h, bus_size_t offset, u_int8_t v)
-{
- vaddr_t va;
-
- REALIGN_IO_HANDLE(h, offset);
- va = (vaddr_t)h + ISAADDR(offset);
- *(volatile u_int8_t *)va = v;
-#ifdef DEBUG
- printf("W%03x:%02x\t", offset, v);
-#endif
-}
-
-void
-__hp300_isa_io_bsw2(bus_space_handle_t h, bus_size_t offset, u_int16_t v)
-{
- vaddr_t va;
-
- if (offset & 1) {
- hp300_isa_io_bsw1(h, offset + 1, v >> 8);
- hp300_isa_io_bsw1(h, offset, v);
- } else {
- REALIGN_IO_HANDLE(h, offset);
- va = (vaddr_t)h + ISAADDR(offset);
- *(volatile u_int16_t *)va = v;
- }
-#ifdef DEBUG
- printf("W%03x:%04x\t", offset, v);
-#endif
-}
-
-void
-hp300_isa_io_bsw2(bus_space_handle_t h, bus_size_t offset, u_int16_t v)
-{
- __hp300_isa_io_bsw2(h, offset, htole16(v));
-}
-
-void
-__hp300_isa_io_bsw4(bus_space_handle_t h, bus_size_t offset, u_int32_t v)
-{
- vaddr_t va;
-
- if (offset & 3) {
- hp300_isa_io_bsw1(h, offset + 3, v >> 24);
- hp300_isa_io_bsw1(h, offset + 2, v >> 16);
- hp300_isa_io_bsw1(h, offset + 1, v >> 8);
- hp300_isa_io_bsw1(h, offset, v);
- } else {
- REALIGN_IO_HANDLE(h, offset);
- va = (vaddr_t)h + ISAADDR(offset);
- *(volatile u_int32_t *)va = v;
- }
-#ifdef DEBUG
- printf("W%03x:%08x\t", offset, v);
-#endif
-}
-
-void
-hp300_isa_io_bsw4(bus_space_handle_t h, bus_size_t offset, u_int32_t v)
-{
- __hp300_isa_io_bsw4(h, offset, htole32(v));
-}
-
-/* bus_space_write_multi_X */
-
-void
-hp300_isa_io_bswm1(bus_space_handle_t h, bus_size_t offset,
- const u_int8_t *a, size_t c)
-{
- while ((int)--c >= 0)
- hp300_isa_io_bsw1(h, offset, *a++);
-}
-
-void
-hp300_isa_io_bswm2(bus_space_handle_t h, bus_size_t offset,
- const u_int16_t *a, size_t c)
-{
- while ((int)--c >= 0)
- hp300_isa_io_bsw2(h, offset, *a++);
-}
-
-void
-hp300_isa_io_bswm4(bus_space_handle_t h, bus_size_t offset,
- const u_int32_t *a, size_t c)
-{
- while ((int)--c >= 0)
- hp300_isa_io_bsw4(h, offset, *a++);
-}
-
-/* bus_space_write_raw_multi_X */
-
-void
-hp300_isa_io_bswrm2(bus_space_handle_t h, bus_size_t offset,
- const u_int8_t *a, size_t c)
-{
- while ((int)--c >= 0) {
- __hp300_isa_io_bsw2(h, offset, *(u_int16_t *)a);
- a += 2;
- }
-}
-
-void
-hp300_isa_io_bswrm4(bus_space_handle_t h, bus_size_t offset,
- const u_int8_t *a, size_t c)
-{
- while ((int)--c >= 0) {
- __hp300_isa_io_bsw4(h, offset, *(u_int32_t *)a);
- a += 4;
- }
-}
-
-/* bus_space_write_region_X */
-
-void
-hp300_isa_io_bswr1(bus_space_handle_t h, bus_size_t offset,
- const u_int8_t *a, size_t c)
-{
- while ((int)--c >= 0)
- hp300_isa_io_bsw1(h, offset++, *a++);
-}
-
-void
-hp300_isa_io_bswr2(bus_space_handle_t h, bus_size_t offset,
- const u_int16_t *a, size_t c)
-{
- while ((int)--c >= 0) {
- hp300_isa_io_bsw2(h, offset, *a++);
- offset += 2;
- }
-}
-
-void
-hp300_isa_io_bswr4(bus_space_handle_t h, bus_size_t offset,
- const u_int32_t *a, size_t c)
-{
- while ((int)--c >= 0) {
- hp300_isa_io_bsw4(h, offset, *a++);
- offset += 4;
- }
-}
-
-/* bus_space_write_raw_region_X */
-
-void
-hp300_isa_io_bswrr2(bus_space_handle_t h, bus_size_t offset,
- const u_int8_t *a, size_t c)
-{
- c >>= 1;
- while ((int)--c >= 0) {
- __hp300_isa_io_bsw2(h, offset, *(u_int16_t *)a);
- offset += 2;
- a += 2;
- }
-}
-
-void
-hp300_isa_io_bswrr4(bus_space_handle_t h, bus_size_t offset,
- const u_int8_t *a, size_t c)
-{
- c >>= 2;
- while ((int)--c >= 0) {
- __hp300_isa_io_bsw4(h, offset, *(u_int32_t *)a);
- offset += 4;
- a += 4;
- }
-}
-
-/* bus_space_set_multi_X */
-
-void
-hp300_isa_io_bssm1(bus_space_handle_t h, bus_size_t offset,
- u_int8_t v, size_t c)
-{
- while ((int)--c >= 0)
- hp300_isa_io_bsw1(h, offset, v);
-}
-
-void
-hp300_isa_io_bssm2(bus_space_handle_t h, bus_size_t offset,
- u_int16_t v, size_t c)
-{
- while ((int)--c >= 0)
- hp300_isa_io_bsw2(h, offset, v);
-}
-
-void
-hp300_isa_io_bssm4(bus_space_handle_t h, bus_size_t offset,
- u_int32_t v, size_t c)
-{
- while ((int)--c >= 0)
- hp300_isa_io_bsw4(h, offset, v);
-}
-
-/* bus_space_set_region_X */
-
-void
-hp300_isa_io_bssr1(bus_space_handle_t h, bus_size_t offset,
- u_int8_t v, size_t c)
-{
- while ((int)--c >= 0)
- hp300_isa_io_bsw1(h, offset++, v);
-}
-
-void
-hp300_isa_io_bssr2(bus_space_handle_t h, bus_size_t offset,
- u_int16_t v, size_t c)
-{
- while ((int)--c >= 0) {
- hp300_isa_io_bsw2(h, offset, v);
- offset += 2;
- }
-}
-
-void
-hp300_isa_io_bssr4(bus_space_handle_t h, bus_size_t offset,
- u_int32_t v, size_t c)
-{
- while ((int)--c >= 0) {
- hp300_isa_io_bsw4(h, offset, v);
- offset += 4;
- }
-}
-
-/*
- * ISA memory space
- */
-
-int hp300_isa_mem_map(bus_addr_t, bus_size_t, int, bus_space_handle_t *);
-void hp300_isa_mem_unmap(bus_space_handle_t, bus_size_t);
-
-int
-hp300_isa_mem_map(bus_addr_t bpa, bus_size_t size, int flags,
- bus_space_handle_t *bshp)
-{
- int error;
- bus_addr_t membase;
- bus_size_t rsize;
- vaddr_t va;
- paddr_t pa;
- pt_entry_t template;
-
- /*
- * Reserve the range in the allocation extent.
- */
- if (bpa < IOM_BEGIN || bpa + size > IOM_END)
- return (ERANGE);
- error = extent_alloc_region(isabr->sc_mem_extent, bpa, size,
- EX_MALLOCOK);
- if (error != 0)
- return (error);
-
- /*
- * Allocate virtual address space to map this space in.
- */
- membase = trunc_page(bpa);
- rsize = round_page(bpa + size) - membase;
- va = uvm_km_valloc(kernel_map, rsize);
- if (va == 0) {
- extent_free(isabr->sc_mem_extent, bpa, size, EX_MALLOCOK);
- return (ENOMEM);
- }
-
- *bshp = (bus_space_handle_t)(va + (bpa - membase));
-
- pa = membase + (ISABR_IOMEM_BASE - IOM_BEGIN);
-
- if (flags & BUS_SPACE_MAP_CACHEABLE)
- template = PG_RW;
- else
- template = PG_RW | PG_CI;
-
- while (rsize != 0) {
- pmap_kenter_cache(va, pa, template);
- rsize -= PAGE_SIZE;
- va += PAGE_SIZE;
- pa += PAGE_SIZE;
- }
- pmap_update(pmap_kernel());
-
- return (0);
-}
-
-void
-hp300_isa_mem_unmap(bus_space_handle_t bsh, bus_size_t size)
-{
- vaddr_t va;
- vsize_t rsize;
-
- va = trunc_page((vaddr_t)bsh);
- rsize = round_page((vaddr_t)bsh + size) - va;
-
- pmap_kremove(va, rsize);
- pmap_update(pmap_kernel());
- uvm_km_free(kernel_map, va, rsize);
-
- (void)extent_free(isabr->sc_mem_extent, (u_long)bsh, size, EX_MALLOCOK);
-}
-
-struct hp300_bus_space_tag hp300_isa_mem_tag; /* will be filled in */
-
-/*
- * ISA bus_space initialization.
- * This creates the necessary accounting elements and initializes the
- * memory space bus_space_tag.
- */
-
-int
-isabr_bus_space_setup(struct isabr_softc *sc, struct frodo_attach_args *faa,
- struct isabus_attach_args *iba)
-{
- /*
- * Create the space extents.
- * We only use them to prevent multiple allocations of the same areas.
- */
-
- sc->sc_io_extent = extent_create("isa_io", IO_ISABEGIN,
- IO_ISAEND + 1, M_DEVBUF, NULL, 0, EX_NOWAIT | EX_MALLOCOK);
- if (sc->sc_io_extent == NULL)
- return (ENOMEM);
-
- sc->sc_mem_extent = extent_create("isa_mem", IOM_BEGIN,
- IOM_END, M_DEVBUF, NULL, 0, EX_NOWAIT | EX_MALLOCOK);
- if (sc->sc_mem_extent == NULL) {
- extent_destroy(sc->sc_io_extent);
- return (ENOMEM);
- }
-
- iba->iba_iot = &hp300_isa_io_tag;
- bcopy(faa->fa_tag, &hp300_isa_mem_tag,
- sizeof(struct hp300_bus_space_tag));
- hp300_isa_mem_tag.bs_map = hp300_isa_mem_map;
- hp300_isa_mem_tag.bs_unmap = hp300_isa_mem_unmap;
- iba->iba_memt = &hp300_isa_mem_tag;
-
- isabr = sc;
-
- return (0);
-}
diff --git a/sys/arch/hp300/dev/isabrreg.h b/sys/arch/hp300/dev/isabrreg.h
deleted file mode 100644
index 6881e91a0bf..00000000000
--- a/sys/arch/hp300/dev/isabrreg.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* $OpenBSD: isabrreg.h,v 1.1 2007/01/06 20:17:43 miod Exp $ */
-
-/*
- * Copyright (c) 2007 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice, this permission notice, and the disclaimer below
- * appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * Models 4xx ISA slot memory spaces
- */
-
-#define ISABR_IOMEM_BASE (0x30000000 + IOM_BEGIN)
-#define ISABR_IOMEM_END (0x30000000 + IOM_END)
-
-#define ISABR_IOPORT_BASE 0x30000000
-#define ISABR_IOPORT_END 0x30080000
-
-/*
- * Ye mighty logic by which ports are interleaved.
- * The actual scheme is more complex, to allow ports over 0x400 to be mapped
- * in bits 3-11 of the address. But we don't support the multi-slot EISA
- * bridges yet.
- */
-#define ISABR_IOPORT_LINE 0x08
-#define ISAADDR(p) \
- ((((p) & ~(ISABR_IOPORT_LINE - 1)) << 9) | ((p) & (ISABR_IOPORT_LINE - 1)))
-#define ISAPORT(a) \
- ((((a) >> 9) & ~(ISABR_IOPORT_LINE - 1)) | ((a) & (ISABR_IOPORT_LINE - 1)))
diff --git a/sys/arch/hp300/dev/maskbits.h b/sys/arch/hp300/dev/maskbits.h
deleted file mode 100644
index cca65807aff..00000000000
--- a/sys/arch/hp300/dev/maskbits.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* $OpenBSD: maskbits.h,v 1.6 2006/08/05 09:58:56 miod Exp $ */
-/* $NetBSD: maskbits.h,v 1.3 1997/03/31 07:37:28 scottr Exp $ */
-
-/*-
- * Copyright (c) 1994
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)maskbits.h 8.2 (Berkeley) 3/21/94
- */
-
-/*
- * Derived from X11R4
- */
-
-/* the following notes use the following conventions:
-SCREEN LEFT SCREEN RIGHT
-in this file and maskbits.c, left and right refer to screen coordinates,
-NOT bit numbering in registers.
-
-rasops_lmask[n]
- bits[0,n-1] = 0 bits[n,31] = 1
-rasops_rmask[n] =
- bits[0,n-1] = 1 bits[n,31] = 0
-
-maskbits(x, w, startmask, endmask, nlw)
- for a span of width w starting at position x, returns
-a mask for ragged bits at start, mask for ragged bits at end,
-and the number of whole longwords between the ends.
-
-*/
-
-#define maskbits(x, w, startmask, endmask, nlw) \
-do { \
- startmask = rasops_lmask[(x) & 0x1f]; \
- endmask = rasops_rmask[((x) + (w)) & 0x1f]; \
- if (startmask) \
- nlw = (((w) - (32 - ((x) & 0x1f))) >> 5); \
- else \
- nlw = (w) >> 5; \
-} while (0)
-
-#define FASTGETBITS(psrc, x, w, dst) \
- asm ("bfextu %3{%1:%2},%0" \
- : "=d" (dst) : "di" (x), "di" (w), "o" (*(char *)(psrc)))
-
-#define FASTPUTBITS(src, x, w, pdst) \
- asm ("bfins %3,%0{%1:%2}" \
- : "=o" (*(char *)(pdst)) \
- : "di" (x), "di" (w), "d" (src), "0" (*(char *) (pdst)))
-
-#define getandputrop(psrc, srcbit, dstbit, width, pdst, rop) \
-do { \
- unsigned int _tmpdst; \
- if (rop == RR_CLEAR) \
- _tmpdst = 0; \
- else \
- FASTGETBITS(psrc, srcbit, width, _tmpdst); \
- FASTPUTBITS(_tmpdst, dstbit, width, pdst); \
-} while (0)
-
-#define getunalignedword(psrc, x, dst) \
-do { \
- int _tmp; \
- FASTGETBITS(psrc, x, 32, _tmp); \
- dst = _tmp; \
-} while (0)
diff --git a/sys/arch/hp300/dev/mb89352.c b/sys/arch/hp300/dev/mb89352.c
deleted file mode 100644
index 43cfdfc5fbc..00000000000
--- a/sys/arch/hp300/dev/mb89352.c
+++ /dev/null
@@ -1,2010 +0,0 @@
-/* $OpenBSD: mb89352.c,v 1.29 2011/09/18 19:23:46 miod Exp $ */
-/* $NetBSD: mb89352.c,v 1.5 2000/03/23 07:01:31 thorpej Exp $ */
-/* NecBSD: mb89352.c,v 1.4 1998/03/14 07:31:20 kmatsuda Exp */
-
-/*-
- * Copyright (c) 1996,97,98,99 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Charles M. Hannum, Masaru Oki and Kouichi Matsuda.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Charles M. Hannum.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * Copyright (c) 1994 Jarle Greipsland
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * [NetBSD for NEC PC-98 series]
- * Copyright (c) 1996, 1997, 1998
- * NetBSD/pc98 porting staff. All rights reserved.
- * Copyright (c) 1996, 1997, 1998
- * Kouichi Matsuda. All rights reserved.
- */
-
-/*
- * Acknowledgements: Many of the algorithms used in this driver are
- * inspired by the work of Julian Elischer (julian@tfs.com) and
- * Charles Hannum (mycroft@duality.gnu.ai.mit.edu). Thanks a million!
- */
-
-/*
- * A few customizable items:
- */
-
-/* Synchronous data transfers? */
-#define SPC_USE_SYNCHRONOUS 0
-#define SPC_SYNC_REQ_ACK_OFS 8
-
-/* Wide data transfers? */
-#define SPC_USE_WIDE 0
-#define SPC_MAX_WIDTH 0
-
-/* Max attempts made to transmit a message */
-#define SPC_MSG_MAX_ATTEMPT 3 /* Not used now XXX */
-
-/*
- * Some spin loop parameters (essentially how long to wait some places)
- * The problem(?) is that sometimes we expect either to be able to transmit a
- * byte or to get a new one from the SCSI bus pretty soon. In order to avoid
- * returning from the interrupt just to get yanked back for the next byte we
- * may spin in the interrupt routine waiting for this byte to come. How long?
- * This is really (SCSI) device and processor dependent. Tunable, I guess.
- */
-#define SPC_MSGIN_SPIN 1 /* Will spinwait upto ?ms for a new msg byte */
-#define SPC_MSGOUT_SPIN 1
-
-/*
- * Include debug functions? At the end of this file there are a bunch of
- * functions that will print out various information regarding queued SCSI
- * commands, driver state and chip contents. You can call them from the
- * kernel debugger. If you set SPC_DEBUG to 0 they are not included (the
- * kernel uses less memory) but you lose the debugging facilities.
- */
-#if 0
-#define SPC_DEBUG
-#endif
-
-#define SPC_ABORT_TIMEOUT 2000 /* time to wait for abort */
-
-/* threshold length for DMA transfer */
-#define SPC_MIN_DMA_LEN 32
-
-/* End of customizable parameters */
-
-/*
- * MB89352 SCSI Protocol Controller (SPC) routines.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/errno.h>
-#include <sys/ioctl.h>
-#include <sys/device.h>
-#include <sys/buf.h>
-#include <sys/proc.h>
-#include <sys/queue.h>
-
-#include <machine/intr.h>
-
-#include <scsi/scsi_all.h>
-#include <scsi/scsi_message.h>
-#include <scsi/scsiconf.h>
-
-#include <hp300/dev/mb89352reg.h>
-#include <hp300/dev/mb89352var.h>
-
-#ifdef SPC_DEBUG
-int spc_debug = 0x00; /* SPC_SHOWSTART|SPC_SHOWMISC|SPC_SHOWTRACE; */
-#endif
-
-void spc_done (struct spc_softc *, struct spc_acb *);
-void spc_dequeue (struct spc_softc *, struct spc_acb *);
-void spc_scsi_cmd (struct scsi_xfer *);
-int spc_poll (struct spc_softc *, struct scsi_xfer *, int);
-void spc_sched_msgout(struct spc_softc *, u_char);
-void spc_setsync(struct spc_softc *, struct spc_tinfo *);
-void spc_select (struct spc_softc *, struct spc_acb *);
-void spc_timeout (void *);
-void spc_scsi_reset (struct spc_softc *);
-void spc_acb_free (void *, void *);
-void *spc_acb_alloc(void *);
-int spc_reselect (struct spc_softc *, int);
-void spc_sense (struct spc_softc *, struct spc_acb *);
-void spc_msgin (struct spc_softc *);
-void spc_abort (struct spc_softc *, struct spc_acb *);
-void spc_msgout (struct spc_softc *);
-int spc_dataout_pio (struct spc_softc *, u_char *, int);
-int spc_datain_pio (struct spc_softc *, u_char *, int);
-void spc_process_intr(void *, u_char);
-#ifdef SPC_DEBUG
-void spc_print_acb (struct spc_acb *);
-void spc_dump_driver (struct spc_softc *);
-void spc_dump89352 (struct spc_softc *);
-void spc_show_scsi_cmd(struct spc_acb *);
-void spc_print_active_acb(void);
-#endif
-
-extern struct cfdriver spc_cd;
-
-struct scsi_adapter spc_switch = {
- spc_scsi_cmd,
- scsi_minphys,
- NULL,
- NULL
-};
-
-/*
- * INITIALIZATION ROUTINES (probe, attach ++)
- */
-
-void
-spc_attach(struct spc_softc *sc)
-{
- struct scsibus_attach_args saa;
-
- SPC_TRACE(("spc_attach "));
- sc->sc_state = SPC_INIT;
-
- sc->sc_freq = 20; /* XXX Assume 20 MHz. */
-
-#if SPC_USE_SYNCHRONOUS
- /*
- * These are the bounds of the sync period, based on the frequency of
- * the chip's clock input and the size and offset of the sync period
- * register.
- *
- * For a 20MHz clock, this gives us 25, or 100nS, or 10MB/s, as a
- * maximum transfer rate, and 112.5, or 450nS, or 2.22MB/s, as a
- * minimum transfer rate.
- */
- sc->sc_minsync = (2 * 250) / sc->sc_freq;
- sc->sc_maxsync = (9 * 250) / sc->sc_freq;
-#endif
-
- spc_init(sc); /* Init chip and driver */
-
- /*
- * Fill in the adapter.
- */
- sc->sc_link.adapter_softc = sc;
- sc->sc_link.adapter_target = sc->sc_initiator;
- sc->sc_link.adapter = &spc_switch;
- sc->sc_link.openings = 2;
- sc->sc_link.pool = &sc->sc_iopool;
-
- bzero(&saa, sizeof(saa));
- saa.saa_sc_link = &sc->sc_link;
-
- /*
- * ask the adapter what subunits are present
- */
- config_found(&sc->sc_dev, &saa, scsiprint);
-}
-
-/*
- * Initialize the MB89352 chip itself.
- */
-void
-spc_reset(struct spc_softc *sc)
-{
- SPC_TRACE(("spc_reset "));
- /*
- * Disable interrupts then reset the FUJITSU chip.
- */
- spc_write(SCTL, SCTL_DISABLE | SCTL_CTRLRST);
- spc_write(SCMD, 0);
- spc_write(TMOD, 0);
- spc_write(PCTL, 0);
- spc_write(TEMP, 0);
- spc_write(TCH, 0);
- spc_write(TCM, 0);
- spc_write(TCL, 0);
- spc_write(INTS, 0);
- spc_write(SCTL, sc->sc_ctlflags |
- SCTL_DISABLE | SCTL_ABRT_ENAB | SCTL_SEL_ENAB | SCTL_RESEL_ENAB);
- spc_write(BDID, sc->sc_initiator);
- delay(400);
- spc_write(SCTL, spc_read(SCTL) & ~SCTL_DISABLE);
-}
-
-
-/*
- * Pull the SCSI RST line for 500us.
- */
-void
-spc_scsi_reset(struct spc_softc *sc)
-{
- SPC_TRACE(("spc_scsi_reset "));
- spc_write(SCMD, spc_read(SCMD) | SCMD_RST);
- delay(500);
- spc_write(SCMD, spc_read(SCMD) & ~SCMD_RST);
- delay(50);
-}
-
-/*
- * Initialize spc SCSI driver.
- */
-void
-spc_init(struct spc_softc *sc)
-{
- struct spc_acb *acb;
- int r;
-
- SPC_TRACE(("spc_init "));
- (*sc->sc_reset)(sc);
- spc_scsi_reset(sc);
- (*sc->sc_reset)(sc);
-
- if (sc->sc_state == SPC_INIT) {
- /* First time through; initialize. */
- TAILQ_INIT(&sc->ready_list);
- TAILQ_INIT(&sc->nexus_list);
- TAILQ_INIT(&sc->free_list);
- mtx_init(&sc->sc_acb_mtx, IPL_BIO);
- scsi_iopool_init(&sc->sc_iopool, sc, spc_acb_alloc,
- spc_acb_free);
- sc->sc_nexus = NULL;
- acb = sc->sc_acb;
- bzero(acb, sizeof(sc->sc_acb));
- for (r = 0; r < sizeof(sc->sc_acb) / sizeof(*acb); r++) {
- TAILQ_INSERT_TAIL(&sc->free_list, acb, chain);
- acb++;
- }
- bzero(&sc->sc_tinfo, sizeof(sc->sc_tinfo));
- } else {
- /* Cancel any active commands. */
- sc->sc_state = SPC_CLEANING;
- if ((acb = sc->sc_nexus) != NULL) {
- acb->xs->error = XS_DRIVER_STUFFUP;
- spc_done(sc, acb);
- }
- while ((acb = TAILQ_FIRST(&sc->nexus_list)) != NULL) {
- acb->xs->error = XS_DRIVER_STUFFUP;
- spc_done(sc, acb);
- }
- }
-
- sc->sc_prevphase = PH_INVALID;
- for (r = 0; r < 8; r++) {
- struct spc_tinfo *ti = &sc->sc_tinfo[r];
-
- ti->flags = 0;
-#if SPC_USE_SYNCHRONOUS
- ti->flags |= DO_SYNC;
- ti->period = sc->sc_minsync;
- ti->offset = SPC_SYNC_REQ_ACK_OFS;
-#else
- ti->period = ti->offset = 0;
-#endif
-#if SPC_USE_WIDE
- ti->flags |= DO_WIDE;
- ti->width = SPC_MAX_WIDTH;
-#else
- ti->width = 0;
-#endif
- }
-
- sc->sc_state = SPC_IDLE;
- spc_write(SCTL, spc_read(SCTL) | SCTL_INTR_ENAB);
-}
-
-void
-spc_acb_free(void *xsc, void *xacb)
-{
- struct spc_softc *sc = xsc;
- struct spc_acb *acb = xacb;
-
- SPC_TRACE(("spc_acb_free "));
-
- acb->flags = 0;
-
- mtx_enter(&sc->sc_acb_mtx);
- TAILQ_INSERT_HEAD(&sc->free_list, acb, chain);
- mtx_leave(&sc->sc_acb_mtx);
-}
-
-void *
-spc_acb_alloc(void *xsc)
-{
- struct spc_softc *sc = xsc;
- struct spc_acb *acb;
-
- SPC_TRACE(("spc_acb_alloc "));
-
- mtx_enter(&sc->sc_acb_mtx);
- acb = TAILQ_FIRST(&sc->free_list);
- if (acb)
- TAILQ_REMOVE(&sc->free_list, acb, chain);
- mtx_leave(&sc->sc_acb_mtx);
-
- return acb;
-}
-
-/*
- * DRIVER FUNCTIONS CALLABLE FROM HIGHER LEVEL DRIVERS
- */
-
-/*
- * Expected sequence:
- * 1) Command inserted into ready list
- * 2) Command selected for execution
- * 3) Command won arbitration and has selected target device
- * 4) Send message out (identify message, eventually also sync.negotiations)
- * 5) Send command
- * 5a) Receive disconnect message, disconnect.
- * 5b) Reselected by target
- * 5c) Receive identify message from target.
- * 6) Send or receive data
- * 7) Receive status
- * 8) Receive message (command complete etc.)
- * 9) If status == SCSI_CHECK construct a synthetic request sense SCSI cmd.
- * Repeat 2-8 (no disconnects please...)
- */
-
-/*
- * Start a SCSI-command
- * This function is called by the higher level SCSI-driver to queue/run
- * SCSI-commands.
- */
-void
-spc_scsi_cmd(struct scsi_xfer *xs)
-{
- struct scsi_link *sc_link = xs->sc_link;
- struct spc_softc *sc = sc_link->adapter_softc;
- struct spc_acb *acb;
- int s, flags;
-
- SPC_TRACE(("spc_scsi_cmd "));
- SPC_CMDS(("[0x%x, %d]->%d ", (int)xs->cmd->opcode, xs->cmdlen,
- sc_link->target));
-
- flags = xs->flags;
- acb = xs->io;
-
- /* Initialize acb */
- acb->xs = xs;
- acb->timeout = xs->timeout;
- timeout_set(&xs->stimeout, spc_timeout, acb);
-
- if (xs->flags & SCSI_RESET) {
- acb->flags |= ACB_RESET;
- acb->scsi_cmd_length = 0;
- acb->data_length = 0;
- } else {
- bcopy(xs->cmd, &acb->scsi_cmd, xs->cmdlen);
- acb->scsi_cmd_length = xs->cmdlen;
- acb->data_addr = xs->data;
- acb->data_length = xs->datalen;
- }
- acb->target_stat = 0;
-
- s = splbio();
-
- TAILQ_INSERT_TAIL(&sc->ready_list, acb, chain);
- /*
- * Start scheduling unless a queue process is in progress.
- */
- if (sc->sc_state == SPC_IDLE)
- spc_sched(sc);
- /*
- * After successful sending, check if we should return just now.
- */
-
- splx(s);
-
- if ((flags & SCSI_POLL) == 0)
- return;
-
- /* Not allowed to use interrupts, use polling instead */
- s = splbio();
- if (spc_poll(sc, xs, acb->timeout)) {
- spc_timeout(acb);
- if (spc_poll(sc, xs, acb->timeout))
- spc_timeout(acb);
- }
- splx(s);
-}
-
-/*
- * Used when interrupt driven I/O isn't allowed, e.g. during boot.
- */
-int
-spc_poll(struct spc_softc *sc, struct scsi_xfer *xs, int count)
-{
- u_char intr;
-
- SPC_TRACE(("spc_poll "));
- while (count) {
- /*
- * If we had interrupts enabled, would we
- * have got an interrupt?
- */
- intr = spc_read(INTS);
- if (intr != 0)
- spc_process_intr(sc, intr);
- if ((xs->flags & ITSDONE) != 0)
- return 0;
- delay(1000);
- count--;
- }
- return 1;
-}
-
-/*
- * LOW LEVEL SCSI UTILITIES
- */
-
-void
-spc_sched_msgout(struct spc_softc *sc, u_char m)
-{
- SPC_TRACE(("spc_sched_msgout "));
- if (sc->sc_msgpriq == 0)
- spc_write(SCMD, SCMD_SET_ATN);
- sc->sc_msgpriq |= m;
-}
-
-/*
- * Set synchronous transfer offset and period.
- */
-void
-spc_setsync(struct spc_softc *sc, struct spc_tinfo *ti)
-{
-#if SPC_USE_SYNCHRONOUS
- SPC_TRACE(("spc_setsync "));
- if (ti->offset != 0)
- spc_write(TMOD,
- ((ti->period * sc->sc_freq) / 250 - 2) << 4 | ti->offset);
- else
- spc_write(TMOD, 0);
-#endif
-}
-
-/*
- * Start a selection. This is used by spc_sched() to select an idle target,
- * and by spc_done() to immediately reselect a target to get sense information.
- */
-void
-spc_select(struct spc_softc *sc, struct spc_acb *acb)
-{
- struct scsi_link *sc_link = acb->xs->sc_link;
- int target = sc_link->target;
- struct spc_tinfo *ti = &sc->sc_tinfo[target];
-
- SPC_TRACE(("spc_select "));
- spc_setsync(sc, ti);
-
-#if 0
- spc_write(SCMD, SCMD_SET_ATN);
-#endif
-
- spc_write(PCTL, 0);
- spc_write(TEMP, (1 << sc->sc_initiator) | (1 << target));
-
- /*
- * Setup BSY timeout (selection timeout).
- * 250ms according to the SCSI specification.
- * T = (X * 256 + 15) * Tclf * 2 (Tclf = 200ns on x68k)
- * To setup 256ms timeout,
- * 128000ns/200ns = X * 256 + 15
- * 640 - 15 = X * 256
- * X = 625 / 256
- * X = 2 + 113 / 256
- * ==> tch = 2, tcm = 113 (correct?)
- */
- /* Time to the information transfer phase start. */
- /* XXX These values should be calculated from sc_freq */
- spc_write(TCH, 2);
- spc_write(TCM, 113);
- spc_write(TCL, 3);
- spc_write(SCMD, SCMD_SELECT);
-
- sc->sc_state = SPC_SELECTING;
-}
-
-int
-spc_reselect(struct spc_softc *sc, int message)
-{
- u_char selid, target, lun;
- struct spc_acb *acb;
- struct scsi_link *sc_link;
- struct spc_tinfo *ti;
-
- SPC_TRACE(("spc_reselect "));
- /*
- * The SCSI chip made a snapshot of the data bus while the reselection
- * was being negotiated. This enables us to determine which target did
- * the reselect.
- */
- selid = sc->sc_selid & ~(1 << sc->sc_initiator);
- if (selid & (selid - 1)) {
- printf("%s: reselect with invalid selid %02x; "
- "sending DEVICE RESET\n", sc->sc_dev.dv_xname, selid);
- SPC_BREAK();
- goto reset;
- }
-
- /*
- * Search wait queue for disconnected cmd
- * The list should be short, so I haven't bothered with
- * any more sophisticated structures than a simple
- * singly linked list.
- */
- target = ffs(selid) - 1;
- lun = message & 0x07;
- TAILQ_FOREACH(acb, &sc->nexus_list, chain) {
- sc_link = acb->xs->sc_link;
- if (sc_link->target == target &&
- sc_link->lun == lun)
- break;
- }
- if (acb == NULL) {
- printf("%s: reselect from target %d lun %d with no nexus; "
- "sending ABORT\n", sc->sc_dev.dv_xname, target, lun);
- SPC_BREAK();
- goto abort;
- }
-
- /* Make this nexus active again. */
- TAILQ_REMOVE(&sc->nexus_list, acb, chain);
- sc->sc_state = SPC_CONNECTED;
- sc->sc_nexus = acb;
- ti = &sc->sc_tinfo[target];
- ti->lubusy |= (1 << lun);
- spc_setsync(sc, ti);
-
- if (acb->flags & ACB_RESET)
- spc_sched_msgout(sc, SEND_DEV_RESET);
- else if (acb->flags & ACB_ABORT)
- spc_sched_msgout(sc, SEND_ABORT);
-
- /* Do an implicit RESTORE POINTERS. */
- sc->sc_dp = acb->data_addr;
- sc->sc_dleft = acb->data_length;
- sc->sc_cp = (u_char *)&acb->scsi_cmd;
- sc->sc_cleft = acb->scsi_cmd_length;
-
- return (0);
-
-reset:
- spc_sched_msgout(sc, SEND_DEV_RESET);
- return (1);
-
-abort:
- spc_sched_msgout(sc, SEND_ABORT);
- return (1);
-}
-
-/*
- * Schedule a SCSI operation. This has now been pulled out of the interrupt
- * handler so that we may call it from spc_scsi_cmd and spc_done. This may
- * save us an unnecessary interrupt just to get things going. Should only be
- * called when state == SPC_IDLE and at bio ipl.
- */
-void
-spc_sched(struct spc_softc *sc)
-{
- struct spc_acb *acb;
- struct scsi_link *sc_link;
- struct spc_tinfo *ti;
-
- splassert(IPL_BIO);
-
- /* missing the hw, just return and wait for our hw */
- if (sc->sc_flags & SPC_INACTIVE)
- return;
- SPC_TRACE(("spc_sched "));
- /*
- * Find first acb in ready queue that is for a target/lunit pair that
- * is not busy.
- */
- TAILQ_FOREACH(acb, &sc->ready_list, chain) {
- sc_link = acb->xs->sc_link;
- ti = &sc->sc_tinfo[sc_link->target];
- if ((ti->lubusy & (1 << sc_link->lun)) == 0) {
- SPC_MISC(("selecting %d:%d ",
- sc_link->target, sc_link->lun));
- TAILQ_REMOVE(&sc->ready_list, acb, chain);
- sc->sc_nexus = acb;
- spc_select(sc, acb);
- return;
- } else
- SPC_MISC(("%d:%d busy\n",
- sc_link->target, sc_link->lun));
- }
- SPC_MISC(("idle "));
- /* Nothing to start; just enable reselections and wait. */
-}
-
-void
-spc_sense(struct spc_softc *sc, struct spc_acb *acb)
-{
- struct scsi_xfer *xs = acb->xs;
- struct scsi_link *sc_link = xs->sc_link;
- struct spc_tinfo *ti = &sc->sc_tinfo[sc_link->target];
- struct scsi_sense *ss = (void *)&acb->scsi_cmd;
-
- SPC_MISC(("requesting sense "));
- /* Next, setup a request sense command block */
- bzero(ss, sizeof(*ss));
- ss->opcode = REQUEST_SENSE;
- ss->byte2 = sc_link->lun << 5;
- ss->length = sizeof(struct scsi_sense_data);
- acb->scsi_cmd_length = sizeof(*ss);
- acb->data_addr = (char *)&xs->sense;
- acb->data_length = sizeof(struct scsi_sense_data);
- acb->flags |= ACB_SENSE;
- ti->senses++;
- if (acb->flags & ACB_NEXUS)
- ti->lubusy &= ~(1 << sc_link->lun);
- if (acb == sc->sc_nexus) {
- spc_select(sc, acb);
- } else {
- spc_dequeue(sc, acb);
- TAILQ_INSERT_HEAD(&sc->ready_list, acb, chain);
- if (sc->sc_state == SPC_IDLE)
- spc_sched(sc);
- }
-}
-
-/*
- * POST PROCESSING OF SCSI_CMD (usually current)
- */
-void
-spc_done(struct spc_softc *sc, struct spc_acb *acb)
-{
- struct scsi_xfer *xs = acb->xs;
- struct scsi_link *sc_link = xs->sc_link;
- struct spc_tinfo *ti = &sc->sc_tinfo[sc_link->target];
-
- SPC_TRACE(("spc_done "));
-
- timeout_del(&acb->xs->stimeout);
-
- /*
- * Now, if we've come here with no error code, i.e. we've kept the
- * initial XS_NOERROR, and the status code signals that we should
- * check sense, we'll need to set up a request sense cmd block and
- * push the command back into the ready queue *before* any other
- * commands for this target/lunit, else we lose the sense info.
- * We don't support chk sense conditions for the request sense cmd.
- */
- if (xs->error == XS_NOERROR) {
- if (acb->flags & ACB_ABORT) {
- xs->error = XS_DRIVER_STUFFUP;
- } else if (acb->flags & ACB_SENSE) {
- xs->error = XS_SENSE;
- } else {
- switch (acb->target_stat) {
- case SCSI_CHECK:
- /* First, save the return values */
- xs->resid = acb->data_length;
- xs->status = acb->target_stat;
- spc_sense(sc, acb);
- return;
- case SCSI_BUSY:
- xs->error = XS_BUSY;
- break;
- case SCSI_OK:
- xs->resid = acb->data_length;
- break;
- default:
- xs->error = XS_DRIVER_STUFFUP;
-#ifdef SPC_DEBUG
- printf("%s: spc_done: bad stat 0x%x\n",
- sc->sc_dev.dv_xname, acb->target_stat);
-#endif
- break;
- }
- }
- }
-
-#ifdef SPC_DEBUG
- if ((spc_debug & SPC_SHOWMISC) != 0) {
- if (xs->resid != 0)
- printf("resid=%d ", xs->resid);
- if (xs->error == XS_SENSE)
- printf("sense=0x%02x\n", xs->sense.error_code);
- else
- printf("error=%d\n", xs->error);
- }
-#endif
-
- /*
- * Remove the ACB from whatever queue it happens to be on.
- */
- if (acb->flags & ACB_NEXUS)
- ti->lubusy &= ~(1 << sc_link->lun);
- if (acb == sc->sc_nexus) {
- sc->sc_nexus = NULL;
- sc->sc_state = SPC_IDLE;
- spc_sched(sc);
- } else
- spc_dequeue(sc, acb);
-
- ti->cmds++;
- scsi_done(xs);
-}
-
-void
-spc_dequeue(struct spc_softc *sc, struct spc_acb *acb)
-{
- SPC_TRACE(("spc_dequeue "));
- if (acb->flags & ACB_NEXUS)
- TAILQ_REMOVE(&sc->nexus_list, acb, chain);
- else
- TAILQ_REMOVE(&sc->ready_list, acb, chain);
-}
-
-/*
- * INTERRUPT/PROTOCOL ENGINE
- */
-
-/*
- * Precondition:
- * The SCSI bus is already in the MSGI phase and there is a message byte
- * on the bus, along with an asserted REQ signal.
- */
-void
-spc_msgin(struct spc_softc *sc)
-{
- int n;
- u_int8_t msg;
-
- SPC_TRACE(("spc_msgin "));
-
- if (sc->sc_prevphase == PH_MSGIN) {
- /* This is a continuation of the previous message. */
- n = sc->sc_imp - sc->sc_imess;
- goto nextbyte;
- }
-
- /* This is a new MESSAGE IN phase. Clean up our state. */
- sc->sc_flags &= ~SPC_DROP_MSGIN;
-
-nextmsg:
- n = 0;
- sc->sc_imp = &sc->sc_imess[n];
-
-nextbyte:
- /*
- * Read a whole message, but don't ack the last byte. If we reject the
- * message, we have to assert ATN during the message transfer phase
- * itself.
- */
- for (;;) {
- /* If parity error, just dump everything on the floor. */
- if ((spc_read(SERR) & (SERR_SCSI_PAR|SERR_SPC_PAR)) != 0) {
- sc->sc_flags |= SPC_DROP_MSGIN;
- spc_sched_msgout(sc, SEND_PARITY_ERROR);
- }
-
- if ((spc_read(PSNS) & PSNS_ATN) != 0)
- spc_write(SCMD, SCMD_RST_ATN);
- spc_write(PCTL, PCTL_BFINT_ENAB | PH_MSGIN);
-
- while ((spc_read(PSNS) & PSNS_REQ) == 0) {
- if (((spc_read(PSNS) & PH_MASK) != PH_MSGIN &&
- (spc_read(SSTS) & SSTS_INITIATOR) == 0) ||
- spc_read(INTS) != 0)
- /*
- * Target left MESSAGE IN, probably because it
- * a) noticed our ATN signal, or
- * b) ran out of messages.
- */
- goto out;
- DELAY(1);
- }
-
- msg = spc_read(TEMP);
-
- /* Gather incoming message bytes if needed. */
- if ((sc->sc_flags & SPC_DROP_MSGIN) == 0) {
- if (n >= SPC_MAX_MSG_LEN) {
- sc->sc_flags |= SPC_DROP_MSGIN;
- spc_sched_msgout(sc, SEND_REJECT);
- } else {
- *sc->sc_imp++ = msg;
- n++;
- /*
- * This testing is suboptimal, but most
- * messages will be of the one byte variety, so
- * it should not affect performance
- * significantly.
- */
- if (n == 1 && IS1BYTEMSG(sc->sc_imess[0]))
- break;
- if (n == 2 && IS2BYTEMSG(sc->sc_imess[0]))
- break;
- if (n >= 3 && ISEXTMSG(sc->sc_imess[0]) &&
- n == sc->sc_imess[1] + 2)
- break;
- }
- }
-
- /*
- * If we reach this spot we're either:
- * a) in the middle of a multi-byte message, or
- * b) dropping bytes.
- */
-
- /* Ack the last byte read. */
- spc_write(SCMD, SCMD_SET_ACK);
- while ((spc_read(PSNS) & PSNS_REQ) != 0)
- DELAY(1); /* XXX needs timeout */
- spc_write(SCMD, SCMD_RST_ACK);
- }
-
- SPC_MISC(("n=%d imess=0x%02x ", n, sc->sc_imess[0]));
-
- /* We now have a complete message. Parse it. */
- switch (sc->sc_state) {
- struct spc_acb *acb;
- struct scsi_link *sc_link;
- struct spc_tinfo *ti;
-
- case SPC_CONNECTED:
- SPC_ASSERT(sc->sc_nexus != NULL);
- acb = sc->sc_nexus;
- ti = &sc->sc_tinfo[acb->xs->sc_link->target];
-
- switch (sc->sc_imess[0]) {
- case MSG_CMDCOMPLETE:
- if (sc->sc_dleft < 0) {
- sc_link = acb->xs->sc_link;
- printf("%s: %d extra bytes from %d:%d\n",
- sc->sc_dev.dv_xname, -sc->sc_dleft,
- sc_link->target, sc_link->lun);
- sc->sc_dleft = 0;
- }
- acb->xs->resid = acb->data_length = sc->sc_dleft;
- sc->sc_state = SPC_CMDCOMPLETE;
- break;
-
- case MSG_PARITY_ERROR:
- /* Resend the last message. */
- spc_sched_msgout(sc, sc->sc_lastmsg);
- break;
-
- case MSG_MESSAGE_REJECT:
- SPC_MISC(("message rejected %02x ", sc->sc_lastmsg));
- switch (sc->sc_lastmsg) {
-#if SPC_USE_SYNCHRONOUS + SPC_USE_WIDE
- case SEND_IDENTIFY:
- ti->flags &= ~(DO_SYNC | DO_WIDE);
- ti->period = ti->offset = 0;
- spc_setsync(sc, ti);
- ti->width = 0;
- break;
-#endif
-#if SPC_USE_SYNCHRONOUS
- case SEND_SDTR:
- ti->flags &= ~DO_SYNC;
- ti->period = ti->offset = 0;
- spc_setsync(sc, ti);
- break;
-#endif
-#if SPC_USE_WIDE
- case SEND_WDTR:
- ti->flags &= ~DO_WIDE;
- ti->width = 0;
- break;
-#endif
- case SEND_INIT_DET_ERR:
- spc_sched_msgout(sc, SEND_ABORT);
- break;
- }
- break;
-
- case MSG_NOOP:
- break;
-
- case MSG_DISCONNECT:
- ti->dconns++;
- sc->sc_state = SPC_DISCONNECT;
- break;
-
- case MSG_SAVEDATAPOINTER:
- acb->data_addr = sc->sc_dp;
- acb->data_length = sc->sc_dleft;
- break;
-
- case MSG_RESTOREPOINTERS:
- sc->sc_dp = acb->data_addr;
- sc->sc_dleft = acb->data_length;
- sc->sc_cp = (u_char *)&acb->scsi_cmd;
- sc->sc_cleft = acb->scsi_cmd_length;
- break;
-
- case MSG_EXTENDED:
- switch (sc->sc_imess[2]) {
-#if SPC_USE_SYNCHRONOUS
- case MSG_EXT_SDTR:
- if (sc->sc_imess[1] != 3)
- goto reject;
- ti->period = sc->sc_imess[3];
- ti->offset = sc->sc_imess[4];
- ti->flags &= ~DO_SYNC;
- if (ti->offset == 0) {
- } else if (ti->period < sc->sc_minsync ||
- ti->period > sc->sc_maxsync ||
- ti->offset > 8) {
- ti->period = ti->offset = 0;
- spc_sched_msgout(sc, SEND_SDTR);
- } else {
- sc_print_addr(acb->xs->sc_link);
- printf("sync, offset %d, "
- "period %dnsec\n",
- ti->offset, ti->period * 4);
- }
- spc_setsync(sc, ti);
- break;
-#endif
-
-#if SPC_USE_WIDE
- case MSG_EXT_WDTR:
- if (sc->sc_imess[1] != 2)
- goto reject;
- ti->width = sc->sc_imess[3];
- ti->flags &= ~DO_WIDE;
- if (ti->width == 0) {
- } else if (ti->width > SPC_MAX_WIDTH) {
- ti->width = 0;
- spc_sched_msgout(sc, SEND_WDTR);
- } else {
- sc_print_addr(acb->xs->sc_link);
- printf("wide, width %d\n",
- 1 << (3 + ti->width));
- }
- break;
-#endif
-
- default:
- printf("%s: unrecognized MESSAGE EXTENDED 0x%x;"
- " sending REJECT\n",
- sc->sc_dev.dv_xname, sc->sc_imess[2]);
- SPC_BREAK();
- goto reject;
- }
- break;
-
- default:
- printf("%s: unrecognized MESSAGE; sending REJECT\n",
- sc->sc_dev.dv_xname);
- SPC_BREAK();
- reject:
- spc_sched_msgout(sc, SEND_REJECT);
- break;
- }
- break;
-
- case SPC_RESELECTED:
- if (!MSG_ISIDENTIFY(sc->sc_imess[0])) {
- printf("%s: reselect without IDENTIFY; "
- "sending DEVICE RESET\n", sc->sc_dev.dv_xname);
- SPC_BREAK();
- goto reset;
- }
-
- (void) spc_reselect(sc, sc->sc_imess[0]);
- break;
-
- default:
- printf("%s: unexpected MESSAGE IN; sending DEVICE RESET\n",
- sc->sc_dev.dv_xname);
- SPC_BREAK();
- reset:
- spc_sched_msgout(sc, SEND_DEV_RESET);
- break;
-
-#ifdef notdef
- abort:
- spc_sched_msgout(sc, SEND_ABORT);
- break;
-#endif
- }
-
- /* Ack the last message byte. */
- spc_write(SCMD, SCMD_SET_ACK);
- while ((spc_read(PSNS) & PSNS_REQ) != 0)
- DELAY(1); /* XXX needs timeout */
- spc_write(SCMD, SCMD_RST_ACK);
-
- /* Go get the next message, if any. */
- goto nextmsg;
-
-out:
- SPC_MISC(("n=%d imess=0x%02x ", n, sc->sc_imess[0]));
-}
-
-/*
- * Send the highest priority, scheduled message.
- */
-void
-spc_msgout(struct spc_softc *sc)
-{
-#if SPC_USE_SYNCHRONOUS
- struct spc_tinfo *ti;
-#endif
- int n;
-
- SPC_TRACE(("spc_msgout "));
-
- if (sc->sc_prevphase == PH_MSGOUT) {
- if (sc->sc_omp == sc->sc_omess) {
- /*
- * This is a retransmission.
- *
- * We get here if the target stayed in MESSAGE OUT
- * phase. Section 5.1.9.2 of the SCSI 2 spec indicates
- * that all of the previously transmitted messages must
- * be sent again, in the same order. Therefore, we
- * requeue all the previously transmitted messages, and
- * start again from the top. Our simple priority
- * scheme keeps the messages in the right order.
- */
- SPC_MISC(("retransmitting "));
- sc->sc_msgpriq |= sc->sc_msgoutq;
- /*
- * Set ATN. If we're just sending a trivial 1-byte
- * message, we'll clear ATN later on anyway.
- */
- spc_write(SCMD, SCMD_SET_ATN); /* XXX? */
- } else {
- /* This is a continuation of the previous message. */
- n = sc->sc_omp - sc->sc_omess;
- goto nextbyte;
- }
- }
-
- /* No messages transmitted so far. */
- sc->sc_msgoutq = 0;
- sc->sc_lastmsg = 0;
-
-nextmsg:
- /* Pick up highest priority message. */
- sc->sc_currmsg = sc->sc_msgpriq & -sc->sc_msgpriq;
- sc->sc_msgpriq &= ~sc->sc_currmsg;
- sc->sc_msgoutq |= sc->sc_currmsg;
-
- /* Build the outgoing message data. */
- switch (sc->sc_currmsg) {
- case SEND_IDENTIFY:
- SPC_ASSERT(sc->sc_nexus != NULL);
- sc->sc_omess[0] =
- MSG_IDENTIFY(sc->sc_nexus->xs->sc_link->lun, 1);
- n = 1;
- break;
-
-#if SPC_USE_SYNCHRONOUS
- case SEND_SDTR:
- SPC_ASSERT(sc->sc_nexus != NULL);
- ti = &sc->sc_tinfo[sc->sc_nexus->xs->sc_link->target];
- sc->sc_omess[4] = MSG_EXTENDED;
- sc->sc_omess[3] = MSG_EXT_SDTR_LEN;
- sc->sc_omess[2] = MSG_EXT_SDTR;
- sc->sc_omess[1] = ti->period >> 2;
- sc->sc_omess[0] = ti->offset;
- n = 5;
- break;
-#endif
-
-#if SPC_USE_WIDE
- case SEND_WDTR:
- SPC_ASSERT(sc->sc_nexus != NULL);
- ti = &sc->sc_tinfo[sc->sc_nexus->xs->sc_link->target];
- sc->sc_omess[3] = MSG_EXTENDED;
- sc->sc_omess[2] = MSG_EXT_WDTR_LEN;
- sc->sc_omess[1] = MSG_EXT_WDTR;
- sc->sc_omess[0] = ti->width;
- n = 4;
- break;
-#endif
-
- case SEND_DEV_RESET:
- sc->sc_flags |= SPC_ABORTING;
- sc->sc_omess[0] = MSG_BUS_DEV_RESET;
- n = 1;
- break;
-
- case SEND_REJECT:
- sc->sc_omess[0] = MSG_MESSAGE_REJECT;
- n = 1;
- break;
-
- case SEND_PARITY_ERROR:
- sc->sc_omess[0] = MSG_PARITY_ERROR;
- n = 1;
- break;
-
- case SEND_INIT_DET_ERR:
- sc->sc_omess[0] = MSG_INITIATOR_DET_ERR;
- n = 1;
- break;
-
- case SEND_ABORT:
- sc->sc_flags |= SPC_ABORTING;
- sc->sc_omess[0] = MSG_ABORT;
- n = 1;
- break;
-
- default:
- printf("%s: unexpected MESSAGE OUT; sending NOOP\n",
- sc->sc_dev.dv_xname);
- SPC_BREAK();
- sc->sc_omess[0] = MSG_NOOP;
- n = 1;
- break;
- }
- sc->sc_omp = &sc->sc_omess[n];
-
-nextbyte:
- /* Send message bytes. */
- /* send TRANSFER command. */
- spc_write(TCH, n >> 16);
- spc_write(TCM, n >> 8);
- spc_write(TCL, n);
- spc_write(PCTL, sc->sc_phase | PCTL_BFINT_ENAB);
- spc_write(SCMD, SCMD_XFR | SCMD_PROG_XFR);
- for (;;) {
- if ((spc_read(SSTS) & SSTS_BUSY) != 0)
- break;
- if (spc_read(INTS) != 0)
- goto out;
- }
- for (;;) {
-#if 0
- for (;;) {
- if ((spc_read(PSNS) & PSNS_REQ) != 0)
- break;
- /* Wait for REQINIT. XXX Need timeout. */
- }
-#endif
- if (spc_read(INTS) != 0) {
- /*
- * Target left MESSAGE OUT, possibly to reject
- * our message.
- *
- * If this is the last message being sent, then we
- * deassert ATN, since either the target is going to
- * ignore this message, or it's going to ask for a
- * retransmission via MESSAGE PARITY ERROR (in which
- * case we reassert ATN anyway).
- */
-#if 0
- if (sc->sc_msgpriq == 0)
- spc_write(SCMD, SCMD_RST_ATN);
-#endif
- goto out;
- }
-
-#if 0
- /* Clear ATN before last byte if this is the last message. */
- if (n == 1 && sc->sc_msgpriq == 0)
- spc_write(SCMD, SCMD_RST_ATN);
-#endif
-
- while ((spc_read(SSTS) & SSTS_DREG_FULL) != 0)
- DELAY(1);
- /* Send message byte. */
- spc_write(DREG, *--sc->sc_omp);
- --n;
- /* Keep track of the last message we've sent any bytes of. */
- sc->sc_lastmsg = sc->sc_currmsg;
-#if 0
- /* Wait for ACK to be negated. XXX Need timeout. */
- while ((spc_read(PSNS) & ACKI) != 0)
- ;
-#endif
-
- if (n == 0)
- break;
- }
-
- /* We get here only if the entire message has been transmitted. */
- if (sc->sc_msgpriq != 0) {
- /* There are more outgoing messages. */
- goto nextmsg;
- }
-
- /*
- * The last message has been transmitted. We need to remember the last
- * message transmitted (in case the target switches to MESSAGE IN phase
- * and sends a MESSAGE REJECT), and the list of messages transmitted
- * this time around (in case the target stays in MESSAGE OUT phase to
- * request a retransmit).
- */
-
-out:
- /* Disable REQ/ACK protocol. */
- return;
-}
-
-/*
- * spc_dataout_pio: perform a data transfer using the FIFO datapath in the spc
- * Precondition: The SCSI bus should be in the DOUT phase, with REQ asserted
- * and ACK deasserted (i.e. waiting for a data byte).
- *
- * This new revision has been optimized (I tried) to make the common case fast,
- * and the rarer cases (as a result) somewhat more complex.
- */
-int
-spc_dataout_pio(struct spc_softc *sc, u_char *p, int n)
-{
- u_char intstat = 0;
- int out = 0;
-#define DOUTAMOUNT 8 /* Full FIFO */
-
- SPC_TRACE(("spc_dataout_pio "));
- /* send TRANSFER command. */
- spc_write(TCH, n >> 16);
- spc_write(TCM, n >> 8);
- spc_write(TCL, n);
- spc_write(PCTL, sc->sc_phase | PCTL_BFINT_ENAB);
- spc_write(SCMD, SCMD_XFR | SCMD_PROG_XFR); /* XXX */
- for (;;) {
- if ((spc_read(SSTS) & SSTS_BUSY) != 0)
- break;
- if (spc_read(INTS) != 0)
- break;
- }
-
- /*
- * I have tried to make the main loop as tight as possible. This
- * means that some of the code following the loop is a bit more
- * complex than otherwise.
- */
- while (n > 0) {
- int xfer;
-
- for (;;) {
- intstat = spc_read(INTS);
- /* Wait till buffer is empty. */
- if ((spc_read(SSTS) & SSTS_DREG_EMPTY) != 0)
- break;
- /* Break on interrupt. */
- if (intstat != 0)
- goto phasechange;
- DELAY(1);
- }
-
- xfer = min(DOUTAMOUNT, n);
-
- SPC_MISC(("%d> ", xfer));
-
- n -= xfer;
- out += xfer;
-
- while (xfer-- > 0)
- spc_write(DREG, *p++);
- }
-
- if (out == 0) {
- for (;;) {
- if (spc_read(INTS) != 0)
- break;
- DELAY(1);
- }
- SPC_MISC(("extra data "));
- } else {
- /* See the bytes off chip */
- for (;;) {
- /* Wait till buffer is empty. */
- if ((spc_read(SSTS) & SSTS_DREG_EMPTY) != 0)
- break;
- intstat = spc_read(INTS);
- /* Break on interrupt. */
- if (intstat != 0)
- goto phasechange;
- DELAY(1);
- }
- }
-
-phasechange:
- /* Stop the FIFO data path. */
-
- if (intstat != 0) {
- /* Some sort of phase change. */
- int amount;
-
- amount = ((spc_read(TCH) << 16) |
- (spc_read(TCM) << 8) | spc_read(TCL));
- if (amount > 0) {
- out -= amount;
- SPC_MISC(("+%d ", amount));
- }
- }
-
- return out;
-}
-
-/*
- * spc_datain_pio: perform data transfers using the FIFO datapath in the spc
- * Precondition: The SCSI bus should be in the DIN phase, with REQ asserted
- * and ACK deasserted (i.e. at least one byte is ready).
- *
- * For now, uses a pretty dumb algorithm, hangs around until all data has been
- * transferred. This, is OK for fast targets, but not so smart for slow
- * targets which don't disconnect or for huge transfers.
- */
-int
-spc_datain_pio(struct spc_softc *sc, u_char *p, int n)
-{
- int in = 0;
- u_int8_t intstat, sstat;
-#define DINAMOUNT 8 /* Full FIFO */
-
- SPC_TRACE(("spc_datain_pio "));
- /* send TRANSFER command. */
- spc_write(TCH, n >> 16);
- spc_write(TCM, n >> 8);
- spc_write(TCL, n);
- spc_write(PCTL, sc->sc_phase | PCTL_BFINT_ENAB);
- spc_write(SCMD, SCMD_XFR | SCMD_PROG_XFR); /* XXX */
-
- /*
- * We leave this loop if one or more of the following is true:
- * a) phase != PH_DATAIN && FIFOs are empty
- * b) reset has occurred or busfree is detected.
- */
- intstat = 0;
- while (n > 0) {
- int xfer;
-
- sstat = spc_read(SSTS);
- if ((sstat & SSTS_DREG_FULL) != 0) {
- xfer = DINAMOUNT;
- n -= xfer;
- in += xfer;
- while (xfer-- > 0)
- *p++ = spc_read(DREG);
- } else if ((sstat & SSTS_DREG_EMPTY) == 0) {
- n--;
- in++;
- *p++ = spc_read(DREG);
- } else {
- if (intstat != 0)
- goto phasechange;
- intstat = spc_read(INTS);
- }
- }
-
- /*
- * Some SCSI-devices are rude enough to transfer more data than what
- * was requested, e.g. 2048 bytes from a CD-ROM instead of the
- * requested 512. Test for progress, i.e. real transfers. If no real
- * transfers have been performed (n is probably already zero) and the
- * FIFO is not empty, waste some bytes....
- */
- if (in == 0) {
- for (;;) {
- sstat = spc_read(SSTS);
- if ((sstat & SSTS_DREG_EMPTY) == 0) {
- (void) spc_read(DREG);
- } else {
- if (intstat != 0)
- goto phasechange;
- intstat = spc_read(INTS);
- }
- DELAY(1);
- }
- SPC_MISC(("extra data "));
- }
-
-phasechange:
- /* Stop the FIFO data path. */
-
- return in;
-}
-
-/*
- * Catch an interrupt from the adaptor
- */
-int
-spc_intr(void *arg)
-{
- struct spc_softc *sc = arg;
- u_char ints;
-
- SPC_TRACE(("spc_intr "));
-
- /*
- * Disable interrupt.
- */
- spc_write(SCTL, spc_read(SCTL) & ~SCTL_INTR_ENAB);
-
- ints = spc_read(INTS);
- if (ints != 0)
- spc_process_intr(arg, ints);
-
- spc_write(SCTL, spc_read(SCTL) | SCTL_INTR_ENAB);
- return 1;
-}
-
-void
-spc_process_intr(void *arg, u_char ints)
-{
- struct spc_softc *sc = arg;
- struct spc_acb *acb;
- struct scsi_link *sc_link;
- struct spc_tinfo *ti;
- int n;
-
- SPC_TRACE(("spc_process_intr "));
-
- goto start;
-
-loop:
- /*
- * Loop until transfer completion.
- */
- ints = spc_read(INTS);
-start:
- SPC_MISC(("ints = 0x%x ", ints));
-
- /*
- * Check for the end of a DMA operation before doing anything else...
- */
- if ((sc->sc_flags & SPC_DOINGDMA) != 0) {
- (*sc->sc_dma_done)(sc);
- }
-
- /*
- * Then check for abnormal conditions, such as reset.
- */
- if ((ints & INTS_RST) != 0) {
- printf("%s: SCSI bus reset\n", sc->sc_dev.dv_xname);
- goto reset;
- }
-
- /*
- * Check for less serious errors.
- */
- if ((spc_read(SERR) & (SERR_SCSI_PAR|SERR_SPC_PAR))
- != 0) {
- printf("%s: SCSI bus parity error\n", sc->sc_dev.dv_xname);
- if (sc->sc_prevphase == PH_MSGIN) {
- sc->sc_flags |= SPC_DROP_MSGIN;
- spc_sched_msgout(sc, SEND_PARITY_ERROR);
- } else
- spc_sched_msgout(sc, SEND_INIT_DET_ERR);
- }
-
- /*
- * If we're not already busy doing something test for the following
- * conditions:
- * 1) We have been reselected by something
- * 2) We have selected something successfully
- * 3) Our selection process has timed out
- * 4) This is really a bus free interrupt just to get a new command
- * going?
- * 5) Spurious interrupt?
- */
- switch (sc->sc_state) {
- case SPC_IDLE:
- case SPC_SELECTING:
- SPC_MISC(("ints:0x%02x ", ints));
-
- if ((ints & INTS_SEL) != 0) {
- /*
- * We don't currently support target mode.
- */
- printf("%s: target mode selected; going to BUS FREE\n",
- sc->sc_dev.dv_xname);
-
- goto sched;
- } else if ((ints & INTS_RESEL) != 0) {
- SPC_MISC(("reselected "));
-
- /*
- * If we're trying to select a target ourselves,
- * push our command back into the ready list.
- */
- if (sc->sc_state == SPC_SELECTING) {
- SPC_MISC(("backoff selector "));
- SPC_ASSERT(sc->sc_nexus != NULL);
- acb = sc->sc_nexus;
- sc->sc_nexus = NULL;
- TAILQ_INSERT_HEAD(&sc->ready_list, acb, chain);
- }
-
- /* Save reselection ID. */
- sc->sc_selid = spc_read(TEMP);
-
- sc->sc_state = SPC_RESELECTED;
- } else if ((ints & INTS_CMD_DONE) != 0) {
- SPC_MISC(("selected "));
-
- /*
- * We have selected a target. Things to do:
- * a) Determine what message(s) to send.
- * b) Verify that we're still selecting the target.
- * c) Mark device as busy.
- */
- if (sc->sc_state != SPC_SELECTING) {
- printf("%s: selection out while idle; "
- "resetting\n", sc->sc_dev.dv_xname);
- SPC_BREAK();
- goto reset;
- }
- SPC_ASSERT(sc->sc_nexus != NULL);
- acb = sc->sc_nexus;
- sc_link = acb->xs->sc_link;
- ti = &sc->sc_tinfo[sc_link->target];
-
- sc->sc_msgpriq = SEND_IDENTIFY;
- if (acb->flags & ACB_RESET)
- sc->sc_msgpriq |= SEND_DEV_RESET;
- else if (acb->flags & ACB_ABORT)
- sc->sc_msgpriq |= SEND_ABORT;
- else {
-#if SPC_USE_SYNCHRONOUS
- if ((ti->flags & DO_SYNC) != 0)
- sc->sc_msgpriq |= SEND_SDTR;
-#endif
-#if SPC_USE_WIDE
- if ((ti->flags & DO_WIDE) != 0)
- sc->sc_msgpriq |= SEND_WDTR;
-#endif
- }
-
- acb->flags |= ACB_NEXUS;
- ti->lubusy |= (1 << sc_link->lun);
-
- /* Do an implicit RESTORE POINTERS. */
- sc->sc_dp = acb->data_addr;
- sc->sc_dleft = acb->data_length;
- sc->sc_cp = (u_char *)&acb->scsi_cmd;
- sc->sc_cleft = acb->scsi_cmd_length;
-
- /* On our first connection, schedule a timeout. */
- if ((acb->xs->flags & SCSI_POLL) == 0)
- timeout_add_msec(&acb->xs->stimeout,
- acb->timeout);
- sc->sc_state = SPC_CONNECTED;
- } else if ((ints & INTS_TIMEOUT) != 0) {
- SPC_MISC(("selection timeout "));
-
- if (sc->sc_state != SPC_SELECTING) {
- printf("%s: selection timeout while idle; "
- "resetting\n", sc->sc_dev.dv_xname);
- SPC_BREAK();
- goto reset;
- }
- SPC_ASSERT(sc->sc_nexus != NULL);
- acb = sc->sc_nexus;
-
- delay(250);
-
- acb->xs->error = XS_SELTIMEOUT;
- goto finish;
- } else {
- if (sc->sc_state != SPC_IDLE) {
- printf("%s: BUS FREE while not idle; "
- "state=%d\n",
- sc->sc_dev.dv_xname, sc->sc_state);
- SPC_BREAK();
- goto out;
- }
-
- goto sched;
- }
-
- /*
- * Turn off selection stuff, and prepare to catch bus free
- * interrupts, parity errors, and phase changes.
- */
-
- sc->sc_flags = 0;
- sc->sc_prevphase = PH_INVALID;
- goto dophase;
- }
-
- if ((ints & INTS_DISCON) != 0) {
- /* disable disconnect interrupt */
- spc_write(PCTL, spc_read(PCTL) & ~PCTL_BFINT_ENAB);
- /* XXX reset interrput */
- spc_write(INTS, ints);
-
- switch (sc->sc_state) {
- case SPC_RESELECTED:
- goto sched;
-
- case SPC_CONNECTED:
- SPC_ASSERT(sc->sc_nexus != NULL);
- acb = sc->sc_nexus;
-
-#if SPC_USE_SYNCHRONOUS + SPC_USE_WIDE
- if (sc->sc_prevphase == PH_MSGOUT) {
- /*
- * If the target went to BUS FREE phase during
- * or immediately after sending a SDTR or WDTR
- * message, disable negotiation.
- */
- sc_link = acb->xs->sc_link;
- ti = &sc->sc_tinfo[sc_link->target];
- switch (sc->sc_lastmsg) {
-#if SPC_USE_SYNCHRONOUS
- case SEND_SDTR:
- ti->flags &= ~DO_SYNC;
- ti->period = ti->offset = 0;
- break;
-#endif
-#if SPC_USE_WIDE
- case SEND_WDTR:
- ti->flags &= ~DO_WIDE;
- ti->width = 0;
- break;
-#endif
- }
- }
-#endif
-
- if ((sc->sc_flags & SPC_ABORTING) == 0) {
- /*
- * Section 5.1.1 of the SCSI 2 spec suggests
- * issuing a REQUEST SENSE following an
- * unexpected disconnect. Some devices go into
- * a contingent allegiance condition when
- * disconnecting, and this is necessary to
- * clean up their state.
- */
- printf("%s: unexpected disconnect; "
- "sending REQUEST SENSE\n",
- sc->sc_dev.dv_xname);
- SPC_BREAK();
- spc_sense(sc, acb);
- goto out;
- }
-
- acb->xs->error = XS_DRIVER_STUFFUP;
- goto finish;
-
- case SPC_DISCONNECT:
- SPC_ASSERT(sc->sc_nexus != NULL);
- acb = sc->sc_nexus;
- TAILQ_INSERT_HEAD(&sc->nexus_list, acb, chain);
- sc->sc_nexus = NULL;
- goto sched;
-
- case SPC_CMDCOMPLETE:
- SPC_ASSERT(sc->sc_nexus != NULL);
- acb = sc->sc_nexus;
- goto finish;
- }
- }
- else if ((ints & INTS_CMD_DONE) != 0 &&
- sc->sc_prevphase == PH_MSGIN &&
- sc->sc_state != SPC_CONNECTED)
- goto out;
-
- /*
- * Do not change phase (yet) if we have a pending DMA operation.
- */
- if ((sc->sc_flags & SPC_DOINGDMA) != 0) {
- goto out;
- }
-
-dophase:
-#if 0
- if ((spc_read(PSNS) & PSNS_REQ) == 0) {
- /* Wait for REQINIT. */
- goto out;
- }
-#else
- spc_write(INTS, ints);
- while ((spc_read(PSNS) & PSNS_REQ) == 0)
- DELAY(1); /* need timeout XXX */
-#endif
-
- /*
- * State transition.
- */
- sc->sc_phase = spc_read(PSNS) & PH_MASK;
-#if 0
- spc_write(PCTL, sc->sc_phase);
-#endif
-
- SPC_MISC(("phase=%d\n", sc->sc_phase));
- switch (sc->sc_phase) {
- case PH_MSGOUT:
- if (sc->sc_state != SPC_CONNECTED &&
- sc->sc_state != SPC_RESELECTED)
- break;
- spc_msgout(sc);
- sc->sc_prevphase = PH_MSGOUT;
- goto loop;
-
- case PH_MSGIN:
- if (sc->sc_state != SPC_CONNECTED &&
- sc->sc_state != SPC_RESELECTED)
- break;
- spc_msgin(sc);
- sc->sc_prevphase = PH_MSGIN;
- goto loop;
-
- case PH_CMD:
- if (sc->sc_state != SPC_CONNECTED)
- break;
-#ifdef SPC_DEBUG
- if ((spc_debug & SPC_SHOWMISC) != 0) {
- SPC_ASSERT(sc->sc_nexus != NULL);
- acb = sc->sc_nexus;
- printf("cmd=0x%02x+%d ",
- acb->scsi_cmd.opcode, acb->scsi_cmd_length - 1);
- }
-#endif
- n = spc_dataout_pio(sc, sc->sc_cp, sc->sc_cleft);
- sc->sc_cp += n;
- sc->sc_cleft -= n;
- sc->sc_prevphase = PH_CMD;
- goto loop;
-
- case PH_DATAOUT:
- if (sc->sc_state != SPC_CONNECTED)
- break;
- SPC_MISC(("dataout dleft=%d ", sc->sc_dleft));
- if (sc->sc_dma_start != NULL &&
- sc->sc_dleft > SPC_MIN_DMA_LEN) {
- if ((*sc->sc_dma_start)
- (sc, sc->sc_dp, sc->sc_dleft, 0) == 0) {
- sc->sc_prevphase = PH_DATAOUT;
- goto out;
- }
- }
- n = spc_dataout_pio(sc, sc->sc_dp, sc->sc_dleft);
- sc->sc_dp += n;
- sc->sc_dleft -= n;
- sc->sc_prevphase = PH_DATAOUT;
- goto loop;
-
- case PH_DATAIN:
- if (sc->sc_state != SPC_CONNECTED)
- break;
- SPC_MISC(("datain "));
- if (sc->sc_dma_start != NULL &&
- sc->sc_dleft > SPC_MIN_DMA_LEN) {
- if ((*sc->sc_dma_start)
- (sc, sc->sc_dp, sc->sc_dleft, 1) == 0) {
- sc->sc_prevphase = PH_DATAIN;
- goto out;
- }
- }
- n = spc_datain_pio(sc, sc->sc_dp, sc->sc_dleft);
- sc->sc_dp += n;
- sc->sc_dleft -= n;
- sc->sc_prevphase = PH_DATAIN;
- goto loop;
-
- case PH_STAT:
- if (sc->sc_state != SPC_CONNECTED)
- break;
- SPC_ASSERT(sc->sc_nexus != NULL);
- acb = sc->sc_nexus;
- if ((spc_read(PSNS) & PSNS_ATN) != 0)
- spc_write(SCMD, SCMD_RST_ATN);
- spc_write(PCTL, PCTL_BFINT_ENAB | PH_STAT);
- while ((spc_read(PSNS) & PSNS_REQ) == 0)
- DELAY(1); /* XXX needs timeout */
- acb->target_stat = spc_read(TEMP);
- spc_write(SCMD, SCMD_SET_ACK);
- while ((spc_read(PSNS) & PSNS_REQ) != 0)
- DELAY(1); /* XXX needs timeout */
- spc_write(SCMD, SCMD_RST_ACK);
-
- SPC_MISC(("target_stat=0x%02x ", acb->target_stat));
- sc->sc_prevphase = PH_STAT;
- goto loop;
- }
-
- printf("%s: unexpected bus phase; resetting\n", sc->sc_dev.dv_xname);
- SPC_BREAK();
-reset:
- spc_init(sc);
- return;
-
-finish:
- spc_write(INTS, ints);
- ints = 0;
- spc_done(sc, acb);
- return;
-
-sched:
- sc->sc_state = SPC_IDLE;
- spc_sched(sc);
- goto out;
-
-out:
- if (ints != 0)
- spc_write(INTS, ints);
-}
-
-void
-spc_abort(struct spc_softc *sc, struct spc_acb *acb)
-{
- /* 2 secs for the abort */
- acb->timeout = SPC_ABORT_TIMEOUT;
- acb->flags |= ACB_ABORT;
-
- if (acb == sc->sc_nexus) {
- /*
- * If we're still selecting, the message will be scheduled
- * after selection is complete.
- */
- if (sc->sc_state == SPC_CONNECTED)
- spc_sched_msgout(sc, SEND_ABORT);
- } else {
- spc_dequeue(sc, acb);
- TAILQ_INSERT_HEAD(&sc->ready_list, acb, chain);
- if (sc->sc_state == SPC_IDLE)
- spc_sched(sc);
- }
-}
-
-void
-spc_timeout(void *arg)
-{
- struct spc_acb *acb = arg;
- struct scsi_xfer *xs = acb->xs;
- struct scsi_link *sc_link = xs->sc_link;
- struct spc_softc *sc = sc_link->adapter_softc;
- int s;
-
- sc_print_addr(sc_link);
-
- s = splbio();
-
- /*
- * We might have missed a DMA completion.
- * If so, fake an interrupt (even if the INTS register is zero - what
- * we want here is to change phase).
- */
- if ((sc->sc_flags & SPC_DOINGDMA) != 0) {
- if ((*sc->sc_dma_done)(sc)) {
- printf("missed DMA completion\n");
- spc_process_intr(sc, spc_read(INTS));
- splx(s);
- return;
- }
- }
-
- printf("timed out");
- if (acb->flags & ACB_ABORT) {
- /* abort timed out */
- printf(" AGAIN\n");
- /* XXX Must reset! */
- } else {
- /* abort the operation that has timed out */
- printf("\n");
- acb->xs->error = XS_TIMEOUT;
- spc_abort(sc, acb);
- }
-
- splx(s);
-}
-
-#ifdef SPC_DEBUG
-/*
- * The following functions are mostly used for debugging purposes, either
- * directly called from the driver or from the kernel debugger.
- */
-
-void
-spc_show_scsi_cmd(struct spc_acb *acb)
-{
- u_char *b = (u_char *)&acb->scsi_cmd;
- struct scsi_link *sc_link = acb->xs->sc_link;
- int i;
-
- sc_print_addr(sc_link);
- if ((acb->xs->flags & SCSI_RESET) == 0) {
- for (i = 0; i < acb->scsi_cmd_length; i++) {
- if (i)
- printf(",");
- printf("%x", b[i]);
- }
- printf("\n");
- } else
- printf("RESET\n");
-}
-
-void
-spc_print_acb(struct spc_acb *acb)
-{
- printf("acb@%p xs=%p flags=%x", acb, acb->xs, acb->flags);
- printf(" dp=%p dleft=%d target_stat=%x\n",
- acb->data_addr, acb->data_length, acb->target_stat);
- spc_show_scsi_cmd(acb);
-}
-
-void
-spc_print_active_acb(void)
-{
- struct spc_acb *acb;
- struct spc_softc *sc = spc_cd.cd_devs[0]; /* XXX */
-
- printf("ready list:\n");
- TAILQ_FOREACH(acb, &sc->ready_list, chain)
- spc_print_acb(acb);
- printf("nexus:\n");
- if (sc->sc_nexus != NULL)
- spc_print_acb(sc->sc_nexus);
- printf("nexus list:\n");
- TAILQ_FOREACH(acb, &sc->nexus_list, chain)
- spc_print_acb(acb);
-}
-
-void
-spc_dump89352(struct spc_softc *sc)
-{
- printf("mb89352: BDID=%x SCTL=%x SCMD=%x TMOD=%x\n",
- spc_read(BDID), spc_read(SCTL), spc_read(SCMD), spc_read(TMOD));
- printf(" INTS=%x PSNS=%x SSTS=%x SERR=%x PCTL=%x\n",
- spc_read(INTS), spc_read(PSNS), spc_read(SSTS), spc_read(SERR),
- spc_read(PCTL));
- printf(" MBC=%x DREG=%x TEMP=%x TCH=%x TCM=%x\n",
- spc_read(MBC),
-#if 0
- spc_read(DREG),
-#else
- 0,
-#endif
- spc_read(TEMP), spc_read(TCH), spc_read(TCM));
- printf(" TCL=%x EXBF=%x\n", spc_read(TCL), spc_read(EXBF));
-}
-
-void
-spc_dump_driver(struct spc_softc *sc)
-{
- struct spc_tinfo *ti;
- int i;
-
- printf("nexus=%p phase=%x prevphase=%x\n",
- sc->sc_nexus, sc->sc_phase, sc->sc_prevphase);
- printf("state=%x msgin=%x msgpriq=%x msgoutq=%x lastmsg=%x "
- "currmsg=%x\n", sc->sc_state, sc->sc_imess[0],
- sc->sc_msgpriq, sc->sc_msgoutq, sc->sc_lastmsg, sc->sc_currmsg);
- for (i = 0; i < 7; i++) {
- ti = &sc->sc_tinfo[i];
- printf("tinfo%d: %d cmds %d disconnects %d timeouts",
- i, ti->cmds, ti->dconns, ti->touts);
- printf(" %d senses flags=%x\n", ti->senses, ti->flags);
- }
-}
-#endif
diff --git a/sys/arch/hp300/dev/mb89352reg.h b/sys/arch/hp300/dev/mb89352reg.h
deleted file mode 100644
index fc45a14682a..00000000000
--- a/sys/arch/hp300/dev/mb89352reg.h
+++ /dev/null
@@ -1,231 +0,0 @@
-/* $OpenBSD: mb89352reg.h,v 1.2 2008/10/17 18:30:20 okan Exp $ */
-/* $NetBSD: mb89352reg.h,v 1.3 2003/08/07 16:31:02 agc Exp $ */
-/* NecBSD: mb89352reg.h,v 1.3 1998/03/14 07:04:34 kmatsuda Exp */
-
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Charles M. Hannum, Masaru Oki and Kouichi Matsuda.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)scsireg.h 8.1 (Berkeley) 6/10/93
- */
-
-/*-
- * Copyright (c) 1996,97,98,99 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Charles M. Hannum, Masaru Oki and Kouichi Matsuda.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)scsireg.h 8.1 (Berkeley) 6/10/93
- */
-/*
- * [NetBSD for NEC PC-98 series]
- * Copyright (c) 1996, 1997, 1998
- * NetBSD/pc98 porting staff. All rights reserved.
- * Copyright (c) 1996, 1997, 1998
- * Kouichi Matsuda. All rights reserved.
- */
-
-/*
- * FUJITSU MB89352A SCSI Protocol Controller Hardware Description.
- */
-
-/* Definitions, most of them has turned out to be unneccesary, but here they
- * are anyway.
- */
-
-#define BDID 0x00 /* Bus Device ID (R/W) */
-#define SCTL 0x01 /* SPC Control register (R/W) */
-#define SCMD 0x02 /* Command Register (R/W) */
-#define TMOD 0x03 /* Transmit Mode Register (synch models) */
-#define INTS 0x04 /* Interrupt sense (R); Interrupt Reset (W) */
-#define PSNS 0x05 /* Phase Sense (R); SPC Diagnostic Control (W) */
-#define SSTS 0x06 /* SPC status (R/O) */
-#define SERR 0x07 /* SPC error status (R/O) */
-#define PCTL 0x08 /* Phase Control (R/W) */
-#define MBC 0x09 /* Modified Byte Counter (R/O) */
-#define DREG 0x0a /* Data Register (R/W) */
-#define TEMP 0x0b /* Temporary Register (R/W) */
-#define TCH 0x0c /* Transfer Counter High (R/W) */
-#define TCM 0x0d /* Transfer Counter Middle (R/W) */
-#define TCL 0x0e /* Transfer Counter Low (R/W) */
-#define EXBF 0x0f /* External Buffer (synch models) */
-
-/* What all the bits do */
-
-/* SCSI_BDID */
-/* SCSI selection/reselection ID (both target *and* initiator) */
-#define SELID7 0x80
-#define SELID6 0x40
-#define SELID5 0x20
-#define SELID4 0x10
-#define SELID3 0x08
-#define SELID2 0x04
-#define SELID1 0x02
-#define SELID0 0x01
-
-/* SCSI_SCTL */
-#define SCTL_DISABLE 0x80
-#define SCTL_CTRLRST 0x40
-#define SCTL_DIAG 0x20
-#define SCTL_ABRT_ENAB 0x10
-#define SCTL_PARITY_ENAB 0x08
-#define SCTL_SEL_ENAB 0x04
-#define SCTL_RESEL_ENAB 0x02
-#define SCTL_INTR_ENAB 0x01
-
-/* SCSI_SCMD */
-#define SCMD_RST 0x10
-#define SCMD_ICPT_XFR 0x08
-#define SCMD_PROG_XFR 0x04
-#define SCMD_PAD 0x01 /* if initiator */
-#define SCMD_PERR_STOP 0x01 /* if target */
- /* command codes */
-#define SCMD_BUS_REL 0x00
-#define SCMD_SELECT 0x20
-#define SCMD_RST_ATN 0x40
-#define SCMD_SET_ATN 0x60
-#define SCMD_XFR 0x80
-#define SCMD_XFR_PAUSE 0xa0
-#define SCMD_RST_ACK 0xc0
-#define SCMD_SET_ACK 0xe0
-
-/* SCSI_TMOD */
-#define TMOD_SYNC 0x80
-
-/* SCSI_INTS */
-#define INTS_SEL 0x80
-#define INTS_RESEL 0x40
-#define INTS_DISCON 0x20
-#define INTS_CMD_DONE 0x10
-#define INTS_SRV_REQ 0x08
-#define INTS_TIMEOUT 0x04
-#define INTS_HARD_ERR 0x02
-#define INTS_RST 0x01
-
-/* SCSI_PSNS */
-#define PSNS_REQ 0x80
-#define PSNS_ACK 0x40
-#define PSNS_ATN 0x20
-#define PSNS_SEL 0x10
-#define PSNS_BSY 0x08
-
-/* PSNS */
-#define REQI 0x80
-#define ACKI 0x40
-#define ATNI 0x20
-#define SELI 0x10
-#define BSYI 0x08
-#define MSGI 0x04
-#define CDI 0x02
-#define IOI 0x01
-
-/* Important! The 3 most significant bits of this register, in initiator mode,
- * represents the "expected" SCSI bus phase and can be used to trigger phase
- * mismatch and phase change interrupts. But more important: If there is a
- * phase mismatch the chip will not transfer any data! This is actually a nice
- * feature as it gives us a bit more control over what is happening when we are
- * bursting data (in) through the FIFOs and the phase suddenly changes from
- * DATA IN to STATUS or MESSAGE IN. The transfer will stop and wait for the
- * proper phase to be set in this register instead of dumping the bits into the
- * FIFOs.
- */
-#if 0
-#define REQO 0x80
-#define ACKO 0x40
-#define ATNO 0x20
-#define SELO 0x10
-#define BSYO 0x08
-#endif
-/* PCTL */
-#define MSGO 0x04
-#define CDO 0x02
-#define IOO 0x01
-
-/* Information transfer phases */
-#define PH_DATAOUT (0)
-#define PH_DATAIN (IOI)
-#define PH_CMD (CDI)
-#define PH_STAT (CDI | IOI)
-#define PH_MSGOUT (MSGI | CDI)
-#define PH_MSGIN (MSGI | CDI | IOI)
-
-#define PH_MASK (MSGI | CDI | IOI)
-
-#define PH_INVALID 0xff
-
-/* SCSI_SSTS */
-#define SSTS_INITIATOR 0x80
-#define SSTS_TARGET 0x40
-#define SSTS_BUSY 0x20
-#define SSTS_XFR 0x10
-#define SSTS_ACTIVE (SSTS_INITIATOR|SSTS_XFR)
-#define SSTS_RST 0x08
-#define SSTS_TCZERO 0x04
-#define SSTS_DREG_FULL 0x02
-#define SSTS_DREG_EMPTY 0x01
-
-/* SCSI_SERR */
-#define SERR_SCSI_PAR 0x80
-#define SERR_SPC_PAR 0x40
-#define SERR_TC_PAR 0x08
-#define SERR_PHASE_ERR 0x04
-#define SERR_SHORT_XFR 0x02
-#define SERR_OFFSET 0x01
-
-/* SCSI_PCTL */
-#define PCTL_BFINT_ENAB 0x80
diff --git a/sys/arch/hp300/dev/mb89352var.h b/sys/arch/hp300/dev/mb89352var.h
deleted file mode 100644
index 14e9c9ec84a..00000000000
--- a/sys/arch/hp300/dev/mb89352var.h
+++ /dev/null
@@ -1,222 +0,0 @@
-/* $OpenBSD: mb89352var.h,v 1.8 2011/05/30 20:01:29 miod Exp $ */
-/* $NetBSD: mb89352var.h,v 1.6 2003/08/02 12:48:09 tsutsui Exp $ */
-/* NecBSD: mb89352var.h,v 1.4 1998/03/14 07:31:22 kmatsuda Exp */
-
-/*-
- * Copyright (c) 1996,97,98,99 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Charles M. Hannum, Masaru Oki and Kouichi Matsuda.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Charles M. Hannum.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * Copyright (c) 1994 Jarle Greipsland
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * [NetBSD for NEC PC-98 series]
- * Copyright (c) 1996, 1997, 1998
- * NetBSD/pc98 porting staff. All rights reserved.
- * Copyright (c) 1996, 1997, 1998
- * Kouich Matsuda. All rights reserved.
- */
-
-#ifndef _MB89352VAR_H_
-#define _MB89352VAR_H_
-
-/*
- * ACB. Holds additional information for each SCSI command Comments: We
- * need a separate scsi command block because we may need to overwrite it
- * with a request sense command. Basicly, we refrain from fiddling with
- * the scsi_xfer struct (except do the expected updating of return values).
- * We'll generally update: xs->{flags,resid,error,sense,status} and
- * occasionally xs->retries.
- */
-struct spc_acb {
- struct scsi_generic scsi_cmd;
- int scsi_cmd_length;
- u_char *data_addr; /* Saved data pointer */
- int data_length; /* Residue */
-
- u_char target_stat; /* SCSI status byte */
-
-#ifdef notdef
- struct spc_dma_seg dma[SPC_NSEG]; /* Physical addresses+len */
-#endif
-
- TAILQ_ENTRY(spc_acb) chain;
- struct scsi_xfer *xs; /* SCSI xfer ctrl block from above */
- int flags;
-#define ACB_NEXUS 0x02
-#define ACB_SENSE 0x04
-#define ACB_ABORT 0x40
-#define ACB_RESET 0x80
- int timeout;
-};
-
-/*
- * Some info about each (possible) target on the SCSI bus. This should
- * probably have been a "per target+lunit" structure, but we'll leave it at
- * this for now.
- */
-struct spc_tinfo {
- int cmds; /* #commands processed */
- int dconns; /* #disconnects */
- int touts; /* #timeouts */
- int perrs; /* #parity errors */
- int senses; /* #request sense commands sent */
- ushort lubusy; /* What local units/subr. are busy? */
- u_char flags;
-#define DO_SYNC 0x01 /* (Re)Negotiate synchronous options */
-#define DO_WIDE 0x02 /* (Re)Negotiate wide options */
- u_char period; /* Period suggestion */
- u_char offset; /* Offset suggestion */
- u_char width; /* Width suggestion */
-};
-
-struct spc_softc {
- struct device sc_dev;
-
- volatile u_int8_t *sc_regs;
-
- struct scsi_link sc_link; /* prototype for subdevs */
-
- TAILQ_HEAD(, spc_acb) free_list, ready_list, nexus_list;
- struct spc_acb *sc_nexus; /* current command */
- struct spc_acb sc_acb[8];
- struct spc_tinfo sc_tinfo[8];
- struct mutex sc_acb_mtx;
- struct scsi_iopool sc_iopool;
-
- /* Data about the current nexus (updated for every cmd switch) */
- u_char *sc_dp; /* Current data pointer */
- size_t sc_dleft; /* Data bytes left to transfer */
- u_char *sc_cp; /* Current command pointer */
- size_t sc_cleft; /* Command bytes left to transfer */
-
- /* Adapter state */
- u_char sc_phase; /* Current bus phase */
- u_char sc_prevphase; /* Previous bus phase */
- u_char sc_state; /* State applicable to the adapter */
-#define SPC_INIT 0
-#define SPC_IDLE 1
-#define SPC_SELECTING 2 /* SCSI command is arbiting */
-#define SPC_RESELECTED 3 /* Has been reselected */
-#define SPC_CONNECTED 4 /* Actively using the SCSI bus */
-#define SPC_DISCONNECT 5 /* MSG_DISCONNECT received */
-#define SPC_CMDCOMPLETE 6 /* MSG_CMDCOMPLETE received */
-#define SPC_CLEANING 7
- u_char sc_flags;
-#define SPC_DROP_MSGIN 0x01 /* Discard all msgs (parity err detected) */
-#define SPC_ABORTING 0x02 /* Bailing out */
-#define SPC_DOINGDMA 0x04 /* doing DMA */
-#define SPC_INACTIVE 0x80 /* The FIFO data path is active! */
- u_char sc_selid; /* Reselection ID */
-
- /* Message stuff */
- u_char sc_msgpriq; /* Messages we want to send */
- u_char sc_msgoutq; /* Messages sent during last MESSAGE OUT */
- u_char sc_lastmsg; /* Message last transmitted */
- u_char sc_currmsg; /* Message currently ready to transmit */
-#define SEND_DEV_RESET 0x01
-#define SEND_PARITY_ERROR 0x02
-#define SEND_INIT_DET_ERR 0x04
-#define SEND_REJECT 0x08
-#define SEND_IDENTIFY 0x10
-#define SEND_ABORT 0x20
-#define SEND_SDTR 0x40
-#define SEND_WDTR 0x80
-#define SPC_MAX_MSG_LEN 8
- u_char sc_omess[SPC_MAX_MSG_LEN];
- u_char *sc_omp; /* Outgoing message pointer */
- u_char sc_imess[SPC_MAX_MSG_LEN];
- u_char *sc_imp; /* Incoming message pointer */
-
- /* Hardware stuff */
- int sc_initiator; /* Our scsi id */
- int sc_freq; /* Clock frequency in MHz */
- int sc_minsync; /* Minimum sync period / 4 */
- int sc_maxsync; /* Maximum sync period / 4 */
- int sc_ctlflags;
-
- /* DMA function set from MD code */
- int (*sc_dma_start)(struct spc_softc *, void *, size_t, int);
- int (*sc_dma_done)(struct spc_softc *);
-
- /* Reset hook */
- void (*sc_reset)(struct spc_softc *);
-};
-
-#ifdef SPC_DEBUG
-#define SPC_SHOWACBS 0x01
-#define SPC_SHOWINTS 0x02
-#define SPC_SHOWCMDS 0x04
-#define SPC_SHOWMISC 0x08
-#define SPC_SHOWTRACE 0x10
-#define SPC_SHOWSTART 0x20
-#define SPC_DOBREAK 0x40
-extern int spc_debug; /* SPC_SHOWSTART|SPC_SHOWMISC|SPC_SHOWTRACE; */
-#define SPC_PRINT(b, s) do {if ((spc_debug & (b)) != 0) printf s;} while (0)
-#define SPC_BREAK() do {if ((spc_debug & SPC_DOBREAK) != 0) Debugger();} while (0)
-#define SPC_ASSERT(x) do {if (x) {} else {printf("%s at line %d: assertion failed\n", sc->sc_dev.dv_xname, __LINE__); Debugger();}} while (0)
-#else
-#define SPC_PRINT(b, s)
-#define SPC_BREAK()
-#define SPC_ASSERT(x)
-#endif
-
-#define SPC_ACBS(s) SPC_PRINT(SPC_SHOWACBS, s)
-#define SPC_INTS(s) SPC_PRINT(SPC_SHOWINTS, s)
-#define SPC_CMDS(s) SPC_PRINT(SPC_SHOWCMDS, s)
-#define SPC_MISC(s) SPC_PRINT(SPC_SHOWMISC, s)
-#define SPC_TRACE(s) SPC_PRINT(SPC_SHOWTRACE, s)
-#define SPC_START(s) SPC_PRINT(SPC_SHOWSTART, s)
-
-void spc_attach(struct spc_softc *);
-int spc_intr(void *);
-void spc_init(struct spc_softc *);
-void spc_sched(struct spc_softc *);
-void spc_scsi_cmd(struct scsi_xfer *);
-void spc_reset(struct spc_softc *);
-
-#define SPC_ADDRESS(o) (sc->sc_regs + ((o) << 1) + 1)
-#define spc_read(o) *(volatile u_int8_t *)(SPC_ADDRESS(o))
-#define spc_write(o, v) *(volatile u_int8_t *)(SPC_ADDRESS(o)) = (v)
-
-#endif /* _MB89352VAR_H_ */
diff --git a/sys/arch/hp300/dev/mt.c b/sys/arch/hp300/dev/mt.c
deleted file mode 100644
index edd90b5fefc..00000000000
--- a/sys/arch/hp300/dev/mt.c
+++ /dev/null
@@ -1,981 +0,0 @@
-/* $OpenBSD: mt.c,v 1.26 2013/06/11 16:42:07 deraadt Exp $ */
-/* $NetBSD: mt.c,v 1.8 1997/03/31 07:37:29 scottr Exp $ */
-
-/*
- * Copyright (c) 1996, 1997 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1992, The University of Utah and
- * the Computer Systems Laboratory at the University of Utah (CSL).
- * All rights reserved.
- *
- * Permission to use, copy, modify and distribute this software is hereby
- * granted provided that (1) source code retains these copyright, permission,
- * and disclaimer notices, and (2) redistributions including binaries
- * reproduce the notices in supporting documentation, and (3) all advertising
- * materials mentioning features or use of this software display the following
- * acknowledgement: ``This product includes software developed by the
- * Computer Systems Laboratory at the University of Utah.''
- *
- * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
- * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
- * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * CSL requests users of this software to return to csl-dist@cs.utah.edu any
- * improvements that they make and grant CSL redistribution rights.
- *
- * Utah $Hdr: mt.c 1.8 95/09/12$
- */
-/* @(#)mt.c 3.9 90/07/10 mt Xinu
- *
- * Magnetic tape driver (7974a, 7978a/b, 7979a, 7980a, 7980xc)
- * Original version contributed by Mt. Xinu.
- * Modified for 4.4BSD by Mark Davies and Andrew Vignaux, Department of
- * Computer Science, Victoria University of Wellington
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/ioctl.h>
-#include <sys/mtio.h>
-#include <sys/file.h>
-#include <sys/proc.h>
-#include <sys/errno.h>
-#include <sys/syslog.h>
-#include <sys/tty.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-#include <sys/conf.h>
-
-#include <hp300/dev/hpibvar.h>
-
-#include <hp300/dev/mtreg.h>
-
-struct mtinfo {
- u_short hwid;
- char *desc;
-} mtinfo[] = {
- { MT7978ID, "7978" },
- { MT7979AID, "7979A" },
- { MT7980ID, "7980" },
- { MT7974AID, "7974A" },
-};
-int nmtinfo = sizeof(mtinfo) / sizeof(mtinfo[0]);
-
-struct mt_softc {
- struct device sc_dev;
- int sc_hpibno; /* logical HPIB this slave it attached to */
- int sc_slave; /* HPIB slave address (0-6) */
- short sc_flags; /* see below */
- u_char sc_lastdsj; /* place for DSJ in mtreaddsj() */
- u_char sc_lastecmd; /* place for End Command in mtreaddsj() */
- short sc_recvtimeo; /* count of hpibsend timeouts to prevent hang */
- short sc_statindex; /* index for next sc_stat when MTF_STATTIMEO */
- struct mt_stat sc_stat;/* status bytes last read from device */
- short sc_density; /* current density of tape (mtio.h format) */
- short sc_type; /* tape drive model (hardware IDs) */
- struct hpibqueue sc_hq; /* HPIB device queue member */
- struct buf sc_tab; /* buf queue */
- struct timeout sc_start_to; /* spl_mtstart timeout */
- struct timeout sc_intr_to; /* spl_mtintr timeout */
-};
-
-#ifdef DEBUG
-int mtdebug = 0;
-#define dlog if (mtdebug) log
-#else
-#define dlog if (0) log
-#endif
-
-#define UNIT(x) (minor(x) & 3)
-
-#define B_CMD B_XXX /* command buf instead of data */
-#define b_cmd b_blkno /* blkno holds cmd when B_CMD */
-
-int mtmatch(struct device *, void *, void *);
-void mtattach(struct device *, struct device *, void *);
-
-struct cfattach mt_ca = {
- sizeof(struct mt_softc), mtmatch, mtattach
-};
-
-struct cfdriver mt_cd = {
- NULL, "mt", DV_TAPE
-};
-
-int mtident(struct mt_softc *, struct hpibbus_attach_args *);
-void mtustart(struct mt_softc *);
-int mtreaddsj(struct mt_softc *, int);
-int mtcommand(dev_t, int, int);
-void spl_mtintr(void *);
-void spl_mtstart(void *);
-
-void mtstart(void *);
-void mtgo(void *);
-void mtintr(void *);
-
-bdev_decl(mt);
-cdev_decl(mt);
-
-int
-mtmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct hpibbus_attach_args *ha = aux;
-
- return (mtident(NULL, ha));
-}
-
-void
-mtattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct mt_softc *sc = (struct mt_softc *)self;
- struct hpibbus_attach_args *ha = aux;
- int unit, hpibno, slave;
-
- if (mtident(sc, ha) == 0) {
- printf("\n%s: impossible!\n", sc->sc_dev.dv_xname);
- return;
- }
-
- unit = self->dv_unit;
- hpibno = parent->dv_unit;
- slave = ha->ha_slave;
-
- sc->sc_tab.b_actb = &sc->sc_tab.b_actf;
-
- sc->sc_hpibno = hpibno;
- sc->sc_slave = slave;
- sc->sc_flags = MTF_EXISTS;
-
- /* Initialize hpib job queue entry. */
- sc->sc_hq.hq_softc = sc;
- sc->sc_hq.hq_slave = sc->sc_slave;
- sc->sc_hq.hq_start = mtstart;
- sc->sc_hq.hq_go = mtgo;
- sc->sc_hq.hq_intr = mtintr;
-
- /* Initialize timeout structures */
- timeout_set(&sc->sc_start_to, spl_mtstart, sc);
- timeout_set(&sc->sc_intr_to, spl_mtintr, sc);
-}
-
-int
-mtident(sc, ha)
- struct mt_softc *sc;
- struct hpibbus_attach_args *ha;
-{
- int i;
-
- for (i = 0; i < nmtinfo; i++) {
- if (ha->ha_id == mtinfo[i].hwid &&
- ha->ha_punit == 0) {
- if (sc != NULL) {
- sc->sc_type = mtinfo[i].hwid;
- printf(": %s tape\n", mtinfo[i].desc);
- }
- return (1);
- }
- }
- return (0);
-}
-
-/*
- * Perform a read of "Device Status Jump" register and update the
- * status if necessary. If status is read, the given "ecmd" is also
- * performed, unless "ecmd" is zero. Returns DSJ value, -1 on failure
- * and -2 on "temporary" failure.
- */
-int
-mtreaddsj(sc, ecmd)
- struct mt_softc *sc;
- int ecmd;
-{
- int retval;
-
- if (sc->sc_flags & MTF_STATTIMEO)
- goto getstats;
- retval = hpibrecv(sc->sc_hpibno,
- (sc->sc_flags & MTF_DSJTIMEO) ? -1 : sc->sc_slave,
- MTT_DSJ, &(sc->sc_lastdsj), 1);
- sc->sc_flags &= ~MTF_DSJTIMEO;
- if (retval != 1) {
- dlog(LOG_DEBUG, "%s can't hpibrecv DSJ",
- sc->sc_dev.dv_xname);
- if (sc->sc_recvtimeo == 0)
- sc->sc_recvtimeo = hz;
- if (--sc->sc_recvtimeo == 0)
- return (-1);
- if (retval == 0)
- sc->sc_flags |= MTF_DSJTIMEO;
- return (-2);
- }
- sc->sc_recvtimeo = 0;
- sc->sc_statindex = 0;
- dlog(LOG_DEBUG, "%s readdsj: 0x%x", sc->sc_dev.dv_xname,
- sc->sc_lastdsj);
- sc->sc_lastecmd = ecmd;
- switch (sc->sc_lastdsj) {
- case 0:
- if (ecmd & MTE_DSJ_FORCE)
- break;
- return (0);
-
- case 2:
- sc->sc_lastecmd = MTE_COMPLETE;
- case 1:
- break;
-
- default:
- log(LOG_ERR, "%s readdsj: DSJ 0x%x\n", sc->sc_dev.dv_xname,
- sc->sc_lastdsj);
- return (-1);
- }
- getstats:
- retval = hpibrecv(sc->sc_hpibno,
- (sc->sc_flags & MTF_STATCONT) ? -1 : sc->sc_slave,
- MTT_STAT, ((char *)&(sc->sc_stat)) + sc->sc_statindex,
- sizeof(sc->sc_stat) - sc->sc_statindex);
- sc->sc_flags &= ~(MTF_STATTIMEO | MTF_STATCONT);
- if (retval != sizeof(sc->sc_stat) - sc->sc_statindex) {
- if (sc->sc_recvtimeo == 0)
- sc->sc_recvtimeo = hz;
- if (--sc->sc_recvtimeo != 0) {
- if (retval >= 0) {
- sc->sc_statindex += retval;
- sc->sc_flags |= MTF_STATCONT;
- }
- sc->sc_flags |= MTF_STATTIMEO;
- return (-2);
- }
- log(LOG_ERR, "%s readdsj: can't read status",
- sc->sc_dev.dv_xname);
- return (-1);
- }
- sc->sc_recvtimeo = 0;
- sc->sc_statindex = 0;
- dlog(LOG_DEBUG, "%s readdsj: status is %x %x %x %x %x %x",
- sc->sc_dev.dv_xname,
- sc->sc_stat1, sc->sc_stat2, sc->sc_stat3,
- sc->sc_stat4, sc->sc_stat5, sc->sc_stat6);
- if (sc->sc_lastecmd)
- (void) hpibsend(sc->sc_hpibno, sc->sc_slave,
- MTL_ECMD, &(sc->sc_lastecmd), 1);
- return ((int) sc->sc_lastdsj);
-}
-
-int
-mtopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- int unit = UNIT(dev);
- struct mt_softc *sc;
- int req_den;
- int error;
-
- if (unit >= mt_cd.cd_ndevs ||
- (sc = mt_cd.cd_devs[unit]) == NULL ||
- (sc->sc_flags & MTF_EXISTS) == 0)
- return (ENXIO);
-
- dlog(LOG_DEBUG, "%s open: flags 0x%x", sc->sc_dev.dv_xname,
- sc->sc_flags);
- if (sc->sc_flags & MTF_OPEN)
- return (EBUSY);
- sc->sc_flags |= MTF_OPEN;
- if ((sc->sc_flags & MTF_ALIVE) == 0) {
- error = mtcommand(dev, MTRESET, 0);
- if (error != 0 || (sc->sc_flags & MTF_ALIVE) == 0)
- goto errout;
- if ((sc->sc_stat1 & (SR1_BOT | SR1_ONLINE)) == SR1_ONLINE)
- (void) mtcommand(dev, MTREW, 0);
- }
- for (;;) {
- if ((error = mtcommand(dev, MTNOP, 0)) != 0)
- goto errout;
- if (!(sc->sc_flags & MTF_REW))
- break;
- if (tsleep((caddr_t) &lbolt, PCATCH | (PZERO + 1),
- "mt", 0) != 0) {
- error = EINTR;
- goto errout;
- }
- }
- if ((flag & FWRITE) && (sc->sc_stat1 & SR1_RO)) {
- error = EROFS;
- goto errout;
- }
- if (!(sc->sc_stat1 & SR1_ONLINE)) {
- uprintf("%s: not online\n", sc->sc_dev.dv_xname);
- error = EIO;
- goto errout;
- }
- /*
- * Select density:
- * - find out what density the drive is set to
- * (i.e. the density of the current tape)
- * - if we are going to write
- * - if we're not at the beginning of the tape
- * - complain if we want to change densities
- * - otherwise, select the mtcommand to set the density
- *
- * If the drive doesn't support it then don't change the recorded
- * density.
- *
- * The original MOREbsd code had these additional conditions
- * for the mid-tape change
- *
- * req_den != T_BADBPI &&
- * sc->sc_density != T_6250BPI
- *
- * which suggests that it would be possible to write multiple
- * densities if req_den == T_BAD_BPI or the current tape
- * density was 6250. Testing of our 7980 suggests that the
- * device cannot change densities mid-tape.
- *
- * ajv@comp.vuw.ac.nz
- */
- sc->sc_density = (sc->sc_stat2 & SR2_6250) ? T_6250BPI : (
- (sc->sc_stat3 & SR3_1600) ? T_1600BPI : (
- (sc->sc_stat3 & SR3_800) ? T_800BPI : -1));
- req_den = (dev & T_DENSEL);
-
- if (flag & FWRITE) {
- if (!(sc->sc_stat1 & SR1_BOT)) {
- if (sc->sc_density != req_den) {
- uprintf("%s: can't change density mid-tape\n",
- sc->sc_dev.dv_xname);
- error = EIO;
- goto errout;
- }
- }
- else {
- int mtset_density =
- (req_den == T_800BPI ? MTSET800BPI : (
- req_den == T_1600BPI ? MTSET1600BPI : (
- req_den == T_6250BPI ? MTSET6250BPI : (
- sc->sc_type == MT7980ID
- ? MTSET6250DC
- : MTSET6250BPI))));
- if (mtcommand(dev, mtset_density, 0) == 0)
- sc->sc_density = req_den;
- }
- }
- return (0);
-errout:
- sc->sc_flags &= ~MTF_OPEN;
- return (error);
-}
-
-int
-mtclose(dev, flag, fmt, p)
- dev_t dev;
- int flag, fmt;
- struct proc *p;
-{
- struct mt_softc *sc = mt_cd.cd_devs[UNIT(dev)];
-
- if (sc->sc_flags & MTF_WRT) {
- (void) mtcommand(dev, MTWEOF, 2);
- (void) mtcommand(dev, MTBSF, 0);
- }
- if ((minor(dev) & T_NOREWIND) == 0)
- (void) mtcommand(dev, MTREW, 0);
- sc->sc_flags &= ~MTF_OPEN;
- return (0);
-}
-
-int
-mtcommand(dev, cmd, cnt)
- dev_t dev;
- int cmd;
- int cnt;
-{
- struct buf b;
- int error = 0;
-
- bzero(&b, sizeof(b));
- b.b_cmd = cmd;
- b.b_dev = dev;
- do {
- b.b_flags = B_BUSY | B_CMD | B_RAW;
- mtstrategy(&b);
- biowait(&b);
- if (b.b_flags & B_ERROR) {
- error = (int) (unsigned) b.b_error;
- break;
- }
- } while (--cnt > 0);
-
- return (error);
-}
-
-/*
- * Only thing to check here is for legal record lengths (writes only).
- */
-void
-mtstrategy(bp)
- struct buf *bp;
-{
- struct mt_softc *sc;
- struct buf *dp;
- int unit;
- int s;
-
- unit = UNIT(bp->b_dev);
- sc = mt_cd.cd_devs[unit];
- dlog(LOG_DEBUG, "%s strategy", sc->sc_dev.dv_xname);
- if ((bp->b_flags & (B_CMD | B_READ)) == 0) {
-#define WRITE_BITS_IGNORED 8
-#if 0
- if (bp->b_bcount & ((1 << WRITE_BITS_IGNORED) - 1)) {
- printf("%s: write record must be multiple of %d\n",
- sc->sc_dev.dv_xname, 1 << WRITE_BITS_IGNORED);
- goto error;
- }
-#endif
- s = 16 * 1024;
- if (sc->sc_stat2 & SR2_LONGREC) {
- switch (sc->sc_density) {
- case T_1600BPI:
- s = 32 * 1024;
- break;
-
- case T_6250BPI:
- case T_BADBPI:
- s = 60 * 1024;
- break;
- }
- }
- if (bp->b_bcount > s) {
- printf("%s: write record (%ld) too big: limit (%d)\n",
- sc->sc_dev.dv_xname, bp->b_bcount, s);
-#if 0 /* XXX see above */
- error:
-#endif
- bp->b_flags |= B_ERROR;
- bp->b_error = EIO;
- s = splbio();
- biodone(bp);
- splx(s);
- return;
- }
- }
- dp = &sc->sc_tab;
- bp->b_actf = NULL;
- s = splbio();
- bp->b_actb = dp->b_actb;
- *dp->b_actb = bp;
- dp->b_actb = &bp->b_actf;
- if (dp->b_active == 0) {
- dp->b_active = 1;
- mtustart(sc);
- }
- splx(s);
-}
-
-void
-mtustart(sc)
- struct mt_softc *sc;
-{
-
- dlog(LOG_DEBUG, "%s ustart", sc->sc_dev.dv_xname);
- if (hpibreq(sc->sc_dev.dv_parent, &sc->sc_hq))
- mtstart(sc);
-}
-
-void
-spl_mtintr(arg)
- void *arg;
-{
- struct mt_softc *sc = arg;
- int s = splbio();
-
- hpibppclear(sc->sc_hpibno);
- mtintr(sc);
- splx(s);
-}
-
-void
-spl_mtstart(arg)
- void *arg;
-{
- int s = splbio();
-
- mtstart(arg);
- splx(s);
-}
-
-void
-mtstart(arg)
- void *arg;
-{
- struct mt_softc *sc = arg;
- struct buf *bp, *dp;
- short cmdcount = 1;
- u_char cmdbuf[2];
- int s;
-
- dlog(LOG_DEBUG, "%s start", sc->sc_dev.dv_xname);
- sc->sc_flags &= ~MTF_WRT;
- bp = sc->sc_tab.b_actf;
- if ((sc->sc_flags & MTF_ALIVE) == 0 &&
- ((bp->b_flags & B_CMD) == 0 || bp->b_cmd != MTRESET))
- goto fatalerror;
-
- if (sc->sc_flags & MTF_REW) {
- if (!hpibpptest(sc->sc_hpibno, sc->sc_slave))
- goto stillrew;
- switch (mtreaddsj(sc, MTE_DSJ_FORCE|MTE_COMPLETE|MTE_IDLE)) {
- case 0:
- case 1:
- stillrew:
- if ((sc->sc_stat1 & SR1_BOT) ||
- !(sc->sc_stat1 & SR1_ONLINE)) {
- sc->sc_flags &= ~MTF_REW;
- break;
- }
- case -2:
- /*
- * -2 means "timeout" reading DSJ, which is probably
- * temporary. This is considered OK when doing a NOP,
- * but not otherwise.
- */
- if (sc->sc_flags & (MTF_DSJTIMEO | MTF_STATTIMEO)) {
- timeout_add_msec(&sc->sc_start_to, 1000 >> 5);
- return;
- }
- case 2:
- if (bp->b_cmd != MTNOP || !(bp->b_flags & B_CMD)) {
- bp->b_error = EBUSY;
- goto errdone;
- }
- goto done;
-
- default:
- goto fatalerror;
- }
- }
- if (bp->b_flags & B_CMD) {
- if (sc->sc_flags & MTF_PASTEOT) {
- switch(bp->b_cmd) {
- case MTFSF:
- case MTWEOF:
- case MTFSR:
- bp->b_error = ENOSPC;
- goto errdone;
-
- case MTBSF:
- case MTOFFL:
- case MTBSR:
- case MTREW:
- sc->sc_flags &= ~(MTF_PASTEOT | MTF_ATEOT);
- break;
- }
- }
- switch(bp->b_cmd) {
- case MTFSF:
- if (sc->sc_flags & MTF_HITEOF)
- goto done;
- cmdbuf[0] = MTTC_FSF;
- break;
-
- case MTBSF:
- if (sc->sc_flags & MTF_HITBOF)
- goto done;
- cmdbuf[0] = MTTC_BSF;
- break;
-
- case MTOFFL:
- sc->sc_flags |= MTF_REW;
- cmdbuf[0] = MTTC_REWOFF;
- break;
-
- case MTWEOF:
- cmdbuf[0] = MTTC_WFM;
- break;
-
- case MTBSR:
- cmdbuf[0] = MTTC_BSR;
- break;
-
- case MTFSR:
- cmdbuf[0] = MTTC_FSR;
- break;
-
- case MTREW:
- sc->sc_flags |= MTF_REW;
- cmdbuf[0] = MTTC_REW;
- break;
-
- case MTNOP:
- /*
- * NOP is supposed to set status bits.
- * Force readdsj to do it.
- */
- switch (mtreaddsj(sc,
- MTE_DSJ_FORCE | MTE_COMPLETE | MTE_IDLE)) {
- default:
- goto done;
-
- case -1:
- /*
- * If this fails, perform a device clear
- * to fix any protocol problems and (most
- * likely) get the status.
- */
- bp->b_cmd = MTRESET;
- break;
-
- case -2:
- timeout_add_msec(&sc->sc_start_to, 1000 >> 5);
- return;
- }
-
- case MTRESET:
- /*
- * 1) selected device clear (send with "-2" secondary)
- * 2) set timeout, then wait for "service request"
- * 3) interrupt will read DSJ (and END COMPLETE-IDLE)
- */
- if (hpibsend(sc->sc_hpibno, sc->sc_slave, -2, NULL, 0)){
- log(LOG_ERR, "%s can't reset",
- sc->sc_dev.dv_xname);
- goto fatalerror;
- }
- timeout_add_sec(&sc->sc_intr_to, 4);
- hpibawait(sc->sc_hpibno);
- return;
-
- case MTSET800BPI:
- cmdbuf[0] = MTTC_800;
- break;
-
- case MTSET1600BPI:
- cmdbuf[0] = MTTC_1600;
- break;
-
- case MTSET6250BPI:
- cmdbuf[0] = MTTC_6250;
- break;
-
- case MTSET6250DC:
- cmdbuf[0] = MTTC_DC6250;
- break;
- }
- } else {
- if (sc->sc_flags & MTF_PASTEOT) {
- bp->b_error = ENOSPC;
- goto errdone;
- }
- if (bp->b_flags & B_READ) {
- sc->sc_flags |= MTF_IO;
- cmdbuf[0] = MTTC_READ;
- } else {
- sc->sc_flags |= MTF_WRT | MTF_IO;
- cmdbuf[0] = MTTC_WRITE;
- cmdbuf[1] = (bp->b_bcount + ((1 << WRITE_BITS_IGNORED) - 1)) >> WRITE_BITS_IGNORED;
- cmdcount = 2;
- }
- }
- if (hpibsend(sc->sc_hpibno, sc->sc_slave, MTL_TCMD, cmdbuf, cmdcount)
- == cmdcount) {
- if (sc->sc_flags & MTF_REW)
- goto done;
- hpibawait(sc->sc_hpibno);
- return;
- }
-fatalerror:
- /*
- * If anything fails, the drive is probably hosed, so mark it not
- * "ALIVE" (but it EXISTS and is OPEN or we wouldn't be here, and
- * if, last we heard, it was REWinding, remember that).
- */
- sc->sc_flags &= MTF_EXISTS | MTF_OPEN | MTF_REW;
- bp->b_error = EIO;
-errdone:
- bp->b_flags |= B_ERROR;
-done:
- sc->sc_flags &= ~(MTF_HITEOF | MTF_HITBOF);
- s = splbio();
- biodone(bp);
- splx(s);
- if ((dp = bp->b_actf))
- dp->b_actb = bp->b_actb;
- else
- sc->sc_tab.b_actb = bp->b_actb;
- *bp->b_actb = dp;
- hpibfree(sc->sc_dev.dv_parent, &sc->sc_hq);
- if ((bp = dp) == NULL)
- sc->sc_tab.b_active = 0;
- else
- mtustart(sc);
-}
-
-/*
- * The Utah code had a bug which meant that the driver was unable to read.
- * "rw" was initialized to bp->b_flags & B_READ before "bp" was initialized.
- * -- ajv@comp.vuw.ac.nz
- */
-void
-mtgo(arg)
- void *arg;
-{
- struct mt_softc *sc = arg;
- struct buf *bp;
- int rw;
-
- dlog(LOG_DEBUG, "%s go", sc->sc_dev.dv_xname);
- bp = sc->sc_tab.b_actf;
- rw = bp->b_flags & B_READ;
- hpibgo(sc->sc_hpibno, sc->sc_slave, rw ? MTT_READ : MTL_WRITE,
- bp->b_data, bp->b_bcount, rw, rw != 0);
-}
-
-void
-mtintr(arg)
- void *arg;
-{
- struct mt_softc *sc = arg;
- struct buf *bp, *dp;
- int i;
- u_char cmdbuf[4];
-
- bp = sc->sc_tab.b_actf;
- if (bp == NULL) {
- log(LOG_ERR, "%s intr: bp == NULL", sc->sc_dev.dv_xname);
- return;
- }
-
- dlog(LOG_DEBUG, "%s intr", sc->sc_dev.dv_xname);
-
- /*
- * Some operation completed. Read status bytes and report errors.
- * Clear EOF flags here `cause they're set once on specific conditions
- * below when a command succeeds.
- * A DSJ of 2 always means keep waiting. If the command was READ
- * (and we're in data DMA phase) stop data transfer first.
- */
- sc->sc_flags &= ~(MTF_HITEOF | MTF_HITBOF);
- if ((bp->b_flags & (B_CMD|B_READ)) == B_READ &&
- !(sc->sc_flags & (MTF_IO | MTF_STATTIMEO | MTF_DSJTIMEO))){
- cmdbuf[0] = MTE_STOP;
- (void) hpibsend(sc->sc_hpibno, sc->sc_slave, MTL_ECMD,cmdbuf,1);
- }
- switch (mtreaddsj(sc, 0)) {
- case 0:
- break;
-
- case 1:
- /*
- * If we're in the middle of a READ/WRITE and have yet to
- * start the data transfer, a DSJ of one should terminate it.
- */
- sc->sc_flags &= ~MTF_IO;
- break;
-
- case 2:
- (void) hpibawait(sc->sc_hpibno);
- return;
-
- case -2:
- /*
- * -2 means that the drive failed to respond quickly enough
- * to the request for DSJ. It's probably just "busy" figuring
- * it out and will know in a little bit...
- */
- timeout_add_msec(&sc->sc_intr_to, 1000 >> 5);
- return;
-
- default:
- log(LOG_ERR, "%s intr: can't get drive stat",
- sc->sc_dev.dv_xname);
- goto error;
- }
- if (sc->sc_stat1 & (SR1_ERR | SR1_REJECT)) {
- i = sc->sc_stat4 & SR4_ERCLMASK;
- log(LOG_ERR, "%s: %s error, retry %d, SR2/3 %x/%x, code %d",
- sc->sc_dev.dv_xname, i == SR4_DEVICE ? "device" :
- (i == SR4_PROTOCOL ? "protocol" :
- (i == SR4_SELFTEST ? "selftest" : "unknown")),
- sc->sc_stat4 & SR4_RETRYMASK, sc->sc_stat2,
- sc->sc_stat3, sc->sc_stat5);
-
- if ((bp->b_flags & B_CMD) && bp->b_cmd == MTRESET)
- timeout_del(&sc->sc_intr_to);
- if (sc->sc_stat3 & SR3_POWERUP)
- sc->sc_flags &= MTF_OPEN | MTF_EXISTS;
- goto error;
- }
- /*
- * Report and clear any soft errors.
- */
- if (sc->sc_stat1 & SR1_SOFTERR) {
- log(LOG_WARNING, "%s: soft error, retry %d\n",
- sc->sc_dev.dv_xname, sc->sc_stat4 & SR4_RETRYMASK);
- sc->sc_stat1 &= ~SR1_SOFTERR;
- }
- /*
- * We've initiated a read or write, but haven't actually started to
- * DMA the data yet. At this point, the drive's ready.
- */
- if (sc->sc_flags & MTF_IO) {
- sc->sc_flags &= ~MTF_IO;
- if (hpibustart(sc->sc_hpibno))
- mtgo(sc);
- return;
- }
- /*
- * Check for End Of Tape - we're allowed to hit EOT and then write (or
- * read) one more record. If we get here and have not already hit EOT,
- * return ENOSPC to inform the process that it's hit it. If we get
- * here and HAVE already hit EOT, don't allow any more operations that
- * move the tape forward.
- */
- if (sc->sc_stat1 & SR1_EOT) {
- if (sc->sc_flags & MTF_ATEOT)
- sc->sc_flags |= MTF_PASTEOT;
- else {
- bp->b_flags |= B_ERROR;
- bp->b_error = ENOSPC;
- sc->sc_flags |= MTF_ATEOT;
- }
- }
- /*
- * If a motion command was being executed, check for Tape Marks.
- * If we were doing data, make sure we got the right amount, and
- * check for hitting tape marks on reads.
- */
- if (bp->b_flags & B_CMD) {
- if (sc->sc_stat1 & SR1_EOF) {
- if (bp->b_cmd == MTFSR)
- sc->sc_flags |= MTF_HITEOF;
- if (bp->b_cmd == MTBSR)
- sc->sc_flags |= MTF_HITBOF;
- }
- if (bp->b_cmd == MTRESET) {
- timeout_del(&sc->sc_intr_to);
- sc->sc_flags |= MTF_ALIVE;
- }
- } else {
- i = hpibrecv(sc->sc_hpibno, sc->sc_slave, MTT_BCNT, cmdbuf, 2);
- if (i != 2) {
- log(LOG_ERR, "%s intr: can't get xfer length\n",
- sc->sc_dev.dv_xname);
- goto error;
- }
- i = (int) *((u_short *) cmdbuf);
- if (i <= bp->b_bcount) {
- if (i == 0)
- sc->sc_flags |= MTF_HITEOF;
- bp->b_resid = bp->b_bcount - i;
- dlog(LOG_DEBUG, "%s intr: bcount %ld, resid %d",
- sc->sc_dev.dv_xname, bp->b_bcount, bp->b_resid);
- } else {
- printf("%s: record (%d) larger than wanted (%ld)\n",
- sc->sc_dev.dv_xname, i, bp->b_bcount);
- error:
- sc->sc_flags &= ~MTF_IO;
- bp->b_error = EIO;
- bp->b_flags |= B_ERROR;
- }
- }
- /*
- * The operation is completely done.
- * Let the drive know with an END command.
- */
- cmdbuf[0] = MTE_COMPLETE | MTE_IDLE;
- (void) hpibsend(sc->sc_hpibno, sc->sc_slave, MTL_ECMD, cmdbuf, 1);
- bp->b_flags &= ~B_CMD;
- biodone(bp);
- if ((dp = bp->b_actf))
- dp->b_actb = bp->b_actb;
- else
- sc->sc_tab.b_actb = bp->b_actb;
- *bp->b_actb = dp;
- hpibfree(sc->sc_dev.dv_parent, &sc->sc_hq);
-#if 0
- if (bp /*sc->sc_tab.b_actf*/ == NULL)
-#else
- if (sc->sc_tab.b_actf == NULL)
-#endif
- sc->sc_tab.b_active = 0;
- else
- mtustart(sc);
-}
-
-int
-mtread(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- return (physio(mtstrategy, dev, B_READ, minphys, uio));
-}
-
-int
-mtwrite(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- return (physio(mtstrategy, dev, B_WRITE, minphys, uio));
-}
-
-int
-mtioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- struct mtop *op;
- int cnt;
-
- switch (cmd) {
- case MTIOCTOP:
- op = (struct mtop *)data;
- switch(op->mt_op) {
- case MTWEOF:
- case MTFSF:
- case MTBSR:
- case MTBSF:
- case MTFSR:
- cnt = op->mt_count;
- break;
-
- case MTOFFL:
- case MTREW:
- case MTNOP:
- cnt = 0;
- break;
-
- default:
- return (EINVAL);
- }
- return (mtcommand(dev, op->mt_op, cnt));
-
- case MTIOCGET:
- break;
-
- default:
- return (EINVAL);
- }
- return (0);
-}
-
-/*ARGSUSED*/
-int
-mtdump(dev, blkno, va, size)
- dev_t dev;
- daddr_t blkno;
- caddr_t va;
- size_t size;
-{
- return (ENODEV);
-}
diff --git a/sys/arch/hp300/dev/mtreg.h b/sys/arch/hp300/dev/mtreg.h
deleted file mode 100644
index 0277ca49056..00000000000
--- a/sys/arch/hp300/dev/mtreg.h
+++ /dev/null
@@ -1,297 +0,0 @@
-/* $OpenBSD: mtreg.h,v 1.4 2005/01/15 21:13:08 miod Exp $ */
-/* $NetBSD: mtreg.h,v 1.1 1995/10/02 00:28:22 thorpej Exp $ */
-
-/*
- * Copyright (c) 1992, The University of Utah and
- * the Computer Systems Laboratory at the University of Utah (CSL).
- * All rights reserved.
- *
- * Permission to use, copy, modify and distribute this software is hereby
- * granted provided that (1) source code retains these copyright, permission,
- * and disclaimer notices, and (2) redistributions including binaries
- * reproduce the notices in supporting documentation, and (3) all advertising
- * materials mentioning features or use of this software display the following
- * acknowledgement: ``This product includes software developed by the
- * Computer Systems Laboratory at the University of Utah.''
- *
- * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
- * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
- * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * CSL requests users of this software to return to csl-dist@cs.utah.edu any
- * improvements that they make and grant CSL redistribution rights.
- *
- * Utah $Hdr: mtreg.h 1.4 95/09/12$
- */
-/* @(#)mtreg.h 3.4 90/07/10 mt Xinu
- *
- * Hewlett-Packard 7974, 7978, 7979 and 7980 HPIB Mag-Tape declarations.
- */
-
-/*
- * Hardware Id's
- */
-
-#define MT7974AID 0x174
-#define MT7978ID 0x178
-#define MT7979AID 0x179
-#define MT7980ID 0x180
-
-/* convert bytes to 1k tape block and back */
-#define CTBTOK(x) ((x) >> 10)
-#define CTKTOB(x) ((x) << 10)
-
-/*
- * Listen Secondary Commands
- */
-
-#define MTL_WRITE 0 /* write execute */
-#define MTL_TCMD 1 /* tape command */
-#define MTL_DIAG 4 /* download diagnostic */
-#define MTL_FUP 6 /* write firmware update */
-#define MTL_ECMD 7 /* end command */
-#define MTL_DCL 16 /* amigo device clear */
-#define MTL_CCRC 17 /* clear CRC */
-#define MTL_XTEST 29 /* run 7979a/7980 extended self test */
-#define MTL_LOOP 30 /* write interface loopback */
-#define MTL_TEST 31 /* run self test */
-
-/*
- * Talk Secondary Commands
- */
-
-#define MTT_READ 0 /* read execute */
-#define MTT_STAT 1 /* read status */
-#define MTT_BCNT 2 /* read byte count */
-#define MTT_DIAG 3 /* read diagnostic results */
-#define MTT_FREV 4 /* read firmware revisions (7980xc) */
-#define MTT_LOG 5 /* read diagnostic log */
-#define MTT_FUP 6 /* read firmware update */
-#define MTT_XSTAT 15 /* read extended status (7979a/7980a) */
-#define MTT_DSJ 16 /* read DSJ (device specified jump) */
-#define MTT_RCRC 17 /* read CRC */
-#define MTT_XTEST 29 /* read 7979a/7980 extended self test */
-#define MTT_LOOP 30 /* read interface loopback */
-#define MTT_TEST 31 /* read self test */
-
-/*
- * Tape commands
- */
-
-#define MTTC_SEL0 0 /* Select Unit 0 (native protocol) */
-#define MTTC_WRITE 5 /* Write Record */
-#define MTTC_WFM 6 /* Write File Mark */
-#define MTTC_WGAP 7 /* Write Gap */
-#define MTTC_READ 8 /* Read record */
-#define MTTC_FSR 9 /* forward space record */
-#define MTTC_BSR 10 /* backward space record */
-#define MTTC_FSF 11 /* forward space file */
-#define MTTC_BSF 12 /* backward space file */
-#define MTTC_REW 13 /* rewind */
-#define MTTC_REWOFF 14 /* rewind and go offline */
-#define MTTC_DC6250 15 /* set data compressed 6250 */
-#define MTTC_6250 16 /* set 6250 bpi */
-#define MTTC_1600 17 /* set 1600 bpi */
-#define MTTC_800 18 /* set 800 bpi */
-#define MTTC_NC6250 19 /* set non-compressed 6250 */
-#define MTTC_STSTP 20 /* start/stop mode only */
-#define MTTC_STRM 21 /* enable streaming */
-#define MTTC_DIRM 22 /* disable immediate report mode */
-#define MTTC_EIRM 23 /* enable immediate report mode */
-#define MTTC_STAT 24 /* request status */
-#define MTTC_RLD 25 /* remote load */
-#define MTTC_RUNLD 26 /* remote unload */
-#define MTTC_RON 28 /* remote online */
-#define MTTC_DDC 30 /* disable data compression */
-#define MTTC_EDC 31 /* enable data compression */
-
-/*
- * End Command Bits (of any interest)
- */
-#define MTE_COMPLETE 0x08 /* "marks the end of the report phase" */
-#define MTE_IDLE 0x04 /* enables parallel poll resp. for online */
-#define MTE_STOP 0x02 /* aborts transfer of "read" data */
-
-#define MTE_DSJ_FORCE 0x100 /* XXX During readDSJ, force a status fetch */
-
-
-struct mt_stat {
- u_char m_stat[6];
-};
-
-/* sc_flags */
-#define MTF_OPEN 0x0001 /* drive is in use (single-access device) */
-#define MTF_EXISTS 0x0002 /* device was found at boot time */
-#define MTF_ALIVE 0x0004 /* drive actually talks to us */
-#define MTF_WRT 0x0008 /* last command was a WRITE */
-#define MTF_IO 0x0010 /* next interrupt should start I/O (DMA) */
-#define MTF_REW 0x0020 /* tape is rewinding - must wait for it */
-#define MTF_HITEOF 0x0040 /* last read or FSR hit EOF (file mark) */
-#define MTF_HITBOF 0x0080 /* last BSR hit EOF (file mark) */
-#define MTF_ATEOT 0x0100 /* tape hit EOT - can allow one forward op */
-#define MTF_PASTEOT 0x0200 /* tape is beyond EOT - force backward motion */
-#define MTF_DSJTIMEO 0x0400 /* timed out hpibrecv()ing DSJ - continue it */
-#define MTF_STATTIMEO 0x0800 /* timed out receiving STATUS - continue it */
-#define MTF_STATCONT 0x1000 /* STATTIMEO is continuable */
-
-/* additional "mtcommand"s */
-#define MTRESET 16 /* reset the thing from scratch */
-#define MTSET800BPI 17 /* density select */
-#define MTSET1600BPI 18
-#define MTSET6250BPI 19
-#define MTSET6250DC 20 /* (data compressed - MT7980ID only) */
-
-/* status bytes */
-#define sc_stat1 sc_stat.m_stat[0]
-#define sc_stat2 sc_stat.m_stat[1]
-#define sc_stat3 sc_stat.m_stat[2]
-#define sc_stat4 sc_stat.m_stat[3]
-#define sc_stat5 sc_stat.m_stat[4]
-#define sc_stat6 sc_stat.m_stat[5]
-
-/*
- * Status Register definitions
- */
-
-#define SR1_EOF 0x80 /* positioned at File Mark */
-#define SR1_BOT 0x40 /* positioned at Beginning of Tape */
-#define SR1_EOT 0x20 /* positioned at End of Tape */
-#define SR1_SOFTERR 0x10 /* Recoverable Error has Occured */
-#define SR1_REJECT 0x08 /* HPIB Cmd rejected - Regs 4 & 5 have info */
-#define SR1_RO 0x04 /* No Write Ring */
-#define SR1_ERR 0x02 /* Unrecoverable Data error - Reg 5 has info */
-#define SR1_ONLINE 0x01 /* Drive Online (must be to do any operation) */
-
-#define SR2_6250 0x80 /* tape is 6250BPI */
-#define SR2_UNKDEN 0x40 /* non-blank tape is of unknown density */
-#define SR2_PARITY 0x20 /* internal bus data parity error detected */
-#define SR2_OVERRUN 0x10 /* data buffer overrun (not possible?) */
-#define SR2_RUNAWAY 0x08 /* during read, no data detected on tape */
-#define SR2_OPEN 0x04 /* tape door is open */
-#define SR2_LONGREC 0x02 /* large record support (32k@1600, 60K@6250,
- otherwise, it's 16K at all densities) */
-#define SR2_IMMED 0x01 /* Immediate Response (for writes) enabled */
-
-#define SR3_1600 0x80 /* tape is 1600BPI */
-#define SR3_800 0x40 /* tape is 800BPI */
-#define SR3_POWERUP 0x20 /* power recently restored or Dev Clr done */
-#define SR3_HPIBPAR 0x10 /* HPIB command parity error detected */
-#define SR3_LOST 0x08 /* position on tape is unknown */
-#define SR3_FMTERR 0x04 /* formatter error - Reg 5 has info */
-#define SR3_SVOERR 0x02 /* motion servo error - Reg 4 has info */
-#define SR3_CTLERR 0x01 /* controller error - Reg 5 has info */
-
-#define SR4_ERCLMASK 0xe0 /* Mask of error classes (for SR1_REJECT) */
-#define SR4_NONE 0x00
-#define SR4_DEVICE 0x40
-#define SR4_PROTOCOL 0x60
-#define SR4_SELFTEST 0xe0
-#define SR4_RETRYMASK 0x1f /* Mask for retry count (for any error) */
-
-/* SR5 holds lots of error codes, referenced above. Complete list:
- * (DEVICE REJECT)
- * 5 Tape is write protected
- * 6 Tape isn't loaded
- * 7 Requested density not supported
- * 9 Tape being read is unreadable
- * 10 Tape being written is unidentifiable
- * 11 Drive offline
- * 16 Changing density while not at BOT
- * 19 Backward motion requested while at BOT
- * 23 Protocol out of sync
- * 24 Unknown tape command
- * 31 Write request too big for drive/density
- * 32 Beyond EOT
- * 33 Self Test Failure
- * 37 Tape positioning failure while removing readaheads
- * 40 Door open
- * (UNRECOVERED DATA/FORMAT ERRORS)
- * 41 Tape velocity out of spec
- * 45 Multiple track data error
- * 47 Write verify failed
- * 48 Noise found while trying to detect data record
- * 49 Data format error
- * 50 Couldn't identify tape after rewind
- * 51 Gap detected before end of data record
- * 52 Data block dropout
- * 53 CRC error
- * 54 Parity error
- * 55 Door open
- * 57 Maximum skew exceeded
- * 58 False data block detected
- * 59 Corrected data error on write
- * 60 Buffer overrun - record size on tape larger than supported
- * 61 Data block timeout (possibly record length too long)
- * 62 Tape mark dropout
- * 63 Tape mark unverified
- * 64 Tape mark timeout (no gap following tape mark)
- * (POSITION or SERVO ERRORS) - these are ALL internal to tape drive
- * 81 Servo unresponsive
- * 82 Servo didn't respond with corect state
- * 83 Servo shutdown
- * 84 Servo detected hardware failure
- * 85 Servo protocol error
- * 86 Runtime Servo error
- * 87 Missing position interrupt
- * 88 No Gap after read or write
- * 89 Motor shutdown for safety reasons
- * 90 Couldn't find tape BOT mark
- * 91 Drive motor running too fast or slow
- * 92 Requested controller state invalid within context
- * 94 Tape positioning failure
- * (FORMATTER ERROR)
- * 101,108 Read formatter unresponsive
- * 102,107 Read formatter hardware error
- * 103 Write detected bad block
- * 104 Erase failure
- * 105 No data detected after write
- * 106 Tracks out of sync on write verify
- * 109 No gap timeout
- * 110 Formatter <--> data buffer byte count mismatch
- * (CONTROLLER ERROR) - these are ALL internal to drive
- * 121 Transaction ID mismatch (device vs. controller)
- * 122 Devoce report has no coorepinding command
- * 123 Invalid device report
- * 124 Repost queue overflow
- * 125 Unknown command from device
- * 126 Command queue overflow
- * 128 Missing End-Of-Record flag in data buffer
- * 129 Data buffer parity error
- * 130 Data buffer underrun during write
- * 131 Byte count mismatch in data buffer queue
- * 132 Bad message type from device
- * 133 Abort between HPIB interface and channel program
- * 134 Unknown HPIB interface exception
- * 137 Illegal access to servo conntroller registers
- * 138 Device program firmware error
- * 139 Hardware utilities firmware error
- * 140 Channel program firmware error
- * 141 Encoder inoperative
- * 150 Tape position synchronization error
- * 151 Tape deblocking error (Xtra Capacity only)
- * 152 Compression/Decompression hardware error (Xtra Capacity only)
- * (PROTOCOL ERROR) - USUALLY indicates deficiency in driver
- * 161 No room in Command Queue
- * 162 Expected "request DSJ"
- * 163 Expected status request
- * 165 Unknown unit select
- * 166 Tape command secondary expected
- * 167 Data byte expected
- * 168 Missing EOI on data byte
- * 170 Write command phase protocol error
- * 172 Read record report phase error
- * 173 Report phase protocol error
- * 174 Cold load sequence error
- * 175 HPIB protocol sequence error
- * 176 END command expected
- * 178 END DATA expected
- * 180 Unknown interface secondary command
- * 181 Misplaced data byte
- * 184 Interface Loopback protocol error
- * 185 Self test protocol error
- * 188 HPIB parity error
- * 189 Operator reset during protocol sequence
- * 190 Device clear received
- */
-
-/* SR6 is count of commands accepted since Immediate Response command failed */
diff --git a/sys/arch/hp300/dev/nhpib.c b/sys/arch/hp300/dev/nhpib.c
deleted file mode 100644
index 896e1a7f75f..00000000000
--- a/sys/arch/hp300/dev/nhpib.c
+++ /dev/null
@@ -1,555 +0,0 @@
-/* $OpenBSD: nhpib.c,v 1.18 2013/08/04 07:21:13 martin Exp $ */
-/* $NetBSD: nhpib.c,v 1.17 1997/05/05 21:06:41 thorpej Exp $ */
-
-/*
- * Copyright (c) 1996, 1997 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)nhpib.c 8.2 (Berkeley) 1/12/94
- */
-
-/*
- * Internal/98624 HPIB driver
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/buf.h>
-#include <sys/device.h>
-#include <sys/timeout.h>
-
-#include <machine/autoconf.h>
-#include <machine/intr.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-
-#include <hp300/dev/dmavar.h>
-
-#include <hp300/dev/nhpibreg.h>
-#include <hp300/dev/hpibvar.h>
-
-/*
- * ODD parity table for listen and talk addresses and secondary commands.
- * The TI9914A doesn't produce the parity bit.
- */
-static const u_char listnr_par[] = {
- 0040,0241,0242,0043,0244,0045,0046,0247,
- 0250,0051,0052,0253,0054,0255,0256,0057,
- 0260,0061,0062,0263,0064,0265,0266,0067,
- 0070,0271,0272,0073,0274,0075,0076,0277,
-};
-static const u_char talker_par[] = {
- 0100,0301,0302,0103,0304,0105,0106,0307,
- 0310,0111,0112,0313,0114,0315,0316,0117,
- 0320,0121,0122,0323,0124,0325,0326,0127,
- 0130,0331,0332,0133,0334,0135,0136,0337,
-};
-static const u_char sec_par[] = {
- 0340,0141,0142,0343,0144,0345,0346,0147,
- 0150,0351,0352,0153,0354,0155,0156,0357,
- 0160,0361,0362,0163,0364,0165,0166,0367,
- 0370,0171,0172,0373,0174,0375,0376,0177
-};
-
-void nhpibifc(struct nhpibdevice *);
-void nhpibreadtimo(void *);
-int nhpibwait(struct nhpibdevice *, int);
-
-void nhpibreset(struct hpibbus_softc *);
-int nhpibsend(struct hpibbus_softc *, int, int, void *, int);
-int nhpibrecv(struct hpibbus_softc *, int, int, void *, int);
-int nhpibppoll(struct hpibbus_softc *);
-void nhpibppwatch(void *);
-void nhpibgo(struct hpibbus_softc *, int, int, void *, int, int, int);
-void nhpibdone(struct hpibbus_softc *);
-int nhpibintr(void *);
-
-/*
- * Our controller ops structure.
- */
-struct hpib_controller nhpib_controller = {
- nhpibreset,
- nhpibsend,
- nhpibrecv,
- nhpibppoll,
- nhpibppwatch,
- nhpibgo,
- nhpibdone,
- nhpibintr
-};
-
-struct nhpib_softc {
- struct device sc_dev; /* generic device glue */
- struct isr sc_isr;
- struct nhpibdevice *sc_regs; /* device registers */
- struct hpibbus_softc *sc_hpibbus; /* XXX */
- struct timeout sc_read_to; /* nhpibreadtimo timeout */
- struct timeout sc_watch_to; /* nhpibppwatch timeout */
-};
-
-int nhpibmatch(struct device *, void *, void *);
-void nhpibattach(struct device *, struct device *, void *);
-
-struct cfattach nhpib_ca = {
- sizeof(struct nhpib_softc), nhpibmatch, nhpibattach
-};
-
-struct cfdriver nhpib_cd = {
- NULL, "nhpib", DV_DULL
-};
-
-int
-nhpibmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct dio_attach_args *da = aux;
-
- /*
- * Internal HP-IB doesn't always return a device ID,
- * so we rely on the sysflags.
- */
- if (da->da_scode == 7 && internalhpib)
- return (1);
-
- if (da->da_id == DIO_DEVICE_ID_NHPIB)
- return (1);
-
- return (0);
-}
-
-void
-nhpibattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct nhpib_softc *sc = (struct nhpib_softc *)self;
- struct dio_attach_args *da = aux;
- struct hpibdev_attach_args ha;
- const char *desc;
- int ipl, type = HPIBA;
-
- sc->sc_regs = (struct nhpibdevice *)iomap(dio_scodetopa(da->da_scode),
- da->da_size);
- if (sc->sc_regs == NULL) {
- printf("\n%s: can't map registers\n", self->dv_xname);
- return;
- }
-
- ipl = DIO_IPL(sc->sc_regs);
-
- if (da->da_scode == 7 && internalhpib)
- desc = DIO_DEVICE_DESC_IHPIB;
- else if (da->da_id == DIO_DEVICE_ID_NHPIB) {
- type = HPIBB;
- desc = DIO_DEVICE_DESC_NHPIB;
- } else
- desc = "unknown HP-IB!";
-
- printf(" ipl %d: %s\n", ipl, desc);
-
- /* Establish the interrupt handler. */
- sc->sc_isr.isr_func = nhpibintr;
- sc->sc_isr.isr_arg = sc;
- sc->sc_isr.isr_ipl = ipl;
- sc->sc_isr.isr_priority = IPL_BIO;
- dio_intr_establish(&sc->sc_isr, self->dv_xname);
-
- /* Initialize timeout structures */
- timeout_set(&sc->sc_read_to, nhpibreadtimo, sc);
-
- ha.ha_ops = &nhpib_controller;
- ha.ha_type = type; /* XXX */
- ha.ha_ba = (type == HPIBA) ? HPIBA_BA :
- (sc->sc_regs->hpib_csa & CSA_BA);
- ha.ha_softcpp = &sc->sc_hpibbus; /* XXX */
- (void)config_found(self, &ha, hpibdevprint);
-}
-
-void
-nhpibreset(hs)
- struct hpibbus_softc *hs;
-{
- struct nhpib_softc *sc = (struct nhpib_softc *)hs->sc_dev.dv_parent;
- struct nhpibdevice *hd = sc->sc_regs;
-
- hd->hpib_acr = AUX_SSWRST;
- hd->hpib_ar = hs->sc_ba;
- hd->hpib_lim = LIS_ERR;
- hd->hpib_mim = 0;
- hd->hpib_acr = AUX_CDAI;
- hd->hpib_acr = AUX_CSHDW;
- hd->hpib_acr = AUX_SSTD1;
- hd->hpib_acr = AUX_SVSTD1;
- hd->hpib_acr = AUX_CPP;
- hd->hpib_acr = AUX_CHDFA;
- hd->hpib_acr = AUX_CHDFE;
- hd->hpib_acr = AUX_RHDF;
- hd->hpib_acr = AUX_CSWRST;
- nhpibifc(hd);
- hd->hpib_ie = IDS_IE;
- hd->hpib_data = C_DCL_P;
- DELAY(100000);
-}
-
-void
-nhpibifc(hd)
- struct nhpibdevice *hd;
-{
- hd->hpib_acr = AUX_TCA;
- hd->hpib_acr = AUX_CSRE;
- hd->hpib_acr = AUX_SSIC;
- DELAY(100);
- hd->hpib_acr = AUX_CSIC;
- hd->hpib_acr = AUX_SSRE;
-}
-
-int
-nhpibsend(hs, slave, sec, ptr, origcnt)
- struct hpibbus_softc *hs;
- int slave, sec, origcnt;
- void *ptr;
-{
- struct nhpib_softc *sc = (struct nhpib_softc *)hs->sc_dev.dv_parent;
- struct nhpibdevice *hd = sc->sc_regs;
- int cnt = origcnt;
- char *addr = ptr;
-
- hd->hpib_acr = AUX_TCA;
- hd->hpib_data = C_UNL_P;
- if (nhpibwait(hd, MIS_BO))
- goto senderror;
- hd->hpib_data = talker_par[hs->sc_ba];
- hd->hpib_acr = AUX_STON;
- if (nhpibwait(hd, MIS_BO))
- goto senderror;
- hd->hpib_data = listnr_par[slave];
- if (nhpibwait(hd, MIS_BO))
- goto senderror;
- if (sec >= 0 || sec == -2) {
- if (sec == -2) /* selected device clear KLUDGE */
- hd->hpib_data = C_SDC_P;
- else
- hd->hpib_data = sec_par[sec];
- if (nhpibwait(hd, MIS_BO))
- goto senderror;
- }
- hd->hpib_acr = AUX_GTS;
- if (cnt) {
- while (--cnt > 0) {
- hd->hpib_data = *addr++;
- if (nhpibwait(hd, MIS_BO))
- goto senderror;
- }
- hd->hpib_acr = AUX_EOI;
- hd->hpib_data = *addr;
- if (nhpibwait(hd, MIS_BO))
- goto senderror;
- hd->hpib_acr = AUX_TCA;
-#if 0
- /*
- * May be causing 345 disks to hang due to interference
- * with PPOLL mechanism.
- */
- hd->hpib_data = C_UNL_P;
- (void) nhpibwait(hd, MIS_BO);
-#endif
- }
- return(origcnt);
-
-senderror:
- nhpibifc(hd);
- return(origcnt - cnt - 1);
-}
-
-int
-nhpibrecv(hs, slave, sec, ptr, origcnt)
- struct hpibbus_softc *hs;
- int slave, sec, origcnt;
- void *ptr;
-{
- struct nhpib_softc *sc = (struct nhpib_softc *)hs->sc_dev.dv_parent;
- struct nhpibdevice *hd = sc->sc_regs;
- int cnt = origcnt;
- char *addr = ptr;
-
- /*
- * Slave < 0 implies continuation of a previous receive
- * that probably timed out.
- */
- if (slave >= 0) {
- hd->hpib_acr = AUX_TCA;
- hd->hpib_data = C_UNL_P;
- if (nhpibwait(hd, MIS_BO))
- goto recverror;
- hd->hpib_data = listnr_par[hs->sc_ba];
- hd->hpib_acr = AUX_SLON;
- if (nhpibwait(hd, MIS_BO))
- goto recverror;
- hd->hpib_data = talker_par[slave];
- if (nhpibwait(hd, MIS_BO))
- goto recverror;
- if (sec >= 0) {
- hd->hpib_data = sec_par[sec];
- if (nhpibwait(hd, MIS_BO))
- goto recverror;
- }
- hd->hpib_acr = AUX_RHDF;
- hd->hpib_acr = AUX_GTS;
- }
- if (cnt) {
- while (--cnt >= 0) {
- if (nhpibwait(hd, MIS_BI))
- goto recvbyteserror;
- *addr++ = hd->hpib_data;
- }
- hd->hpib_acr = AUX_TCA;
- hd->hpib_data = (slave == 31) ? C_UNA_P : C_UNT_P;
- (void) nhpibwait(hd, MIS_BO);
- }
- return(origcnt);
-
-recverror:
- nhpibifc(hd);
-recvbyteserror:
- return(origcnt - cnt - 1);
-}
-
-void
-nhpibgo(hs, slave, sec, ptr, count, rw, timo)
- struct hpibbus_softc *hs;
- int slave, sec, count, rw, timo;
- void *ptr;
-{
- struct nhpib_softc *sc = (struct nhpib_softc *)hs->sc_dev.dv_parent;
- struct nhpibdevice *hd = sc->sc_regs;
- char *addr = ptr;
-
- hs->sc_flags |= HPIBF_IO;
- if (timo)
- hs->sc_flags |= HPIBF_TIMO;
- if (rw == B_READ)
- hs->sc_flags |= HPIBF_READ;
-#ifdef DEBUG
- else if (hs->sc_flags & HPIBF_READ) {
- printf("nhpibgo: HPIBF_READ still set\n");
- hs->sc_flags &= ~HPIBF_READ;
- }
-#endif
- hs->sc_count = count;
- hs->sc_addr = addr;
- if (hs->sc_flags & HPIBF_READ) {
- hs->sc_curcnt = count;
- dmago(hs->sc_dq->dq_chan, addr, count, DMAGO_BYTE|DMAGO_READ);
- nhpibrecv(hs, slave, sec, 0, 0);
- hd->hpib_mim = MIS_END;
- } else {
- hd->hpib_mim = 0;
- if (count < hpibdmathresh) {
- hs->sc_curcnt = count;
- nhpibsend(hs, slave, sec, addr, count);
- nhpibdone(hs);
- return;
- }
- hs->sc_curcnt = --count;
- dmago(hs->sc_dq->dq_chan, addr, count, DMAGO_BYTE);
- nhpibsend(hs, slave, sec, 0, 0);
- }
- hd->hpib_ie = IDS_IE | IDS_DMA(hs->sc_dq->dq_chan);
-}
-
-/*
- * This timeout can only happen if a DMA read finishes DMAing with the read
- * still pending (more data in read transaction than the driver was prepared
- * to accept). At the moment, variable-record tape drives are the only things
- * capabale of doing this. We repeat the necessary code from nhpibintr() -
- * easier and quicker than calling nhpibintr() for this special case.
- */
-void
-nhpibreadtimo(arg)
- void *arg;
-{
- struct nhpib_softc *sc = arg;
- struct hpibbus_softc *hs = sc->sc_hpibbus;
- int s;
-
- s = splbio();
- if (hs->sc_flags & HPIBF_IO) {
- struct nhpibdevice *hd = sc->sc_regs;
- struct hpibqueue *hq;
-
- hd->hpib_mim = 0;
- hd->hpib_acr = AUX_TCA;
- hs->sc_flags &= ~(HPIBF_DONE|HPIBF_IO|HPIBF_READ|HPIBF_TIMO);
- dmafree(hs->sc_dq);
-
- hq = TAILQ_FIRST(&hs->sc_queue);
- (hq->hq_intr)(hq->hq_softc);
- }
- splx(s);
-}
-
-void
-nhpibdone(hs)
- struct hpibbus_softc *hs;
-{
- struct nhpib_softc *sc = (struct nhpib_softc *)hs->sc_dev.dv_parent;
- struct nhpibdevice *hd = sc->sc_regs;
- int cnt;
-
- cnt = hs->sc_curcnt;
- hs->sc_addr += cnt;
- hs->sc_count -= cnt;
- hs->sc_flags |= HPIBF_DONE;
- hd->hpib_ie = IDS_IE;
- if (hs->sc_flags & HPIBF_READ) {
- if ((hs->sc_flags & HPIBF_TIMO) &&
- (hd->hpib_ids & IDS_IR) == 0)
- timeout_add_msec(&sc->sc_read_to, 1000 >> 2);
- } else {
- if (hs->sc_count == 1) {
- (void) nhpibwait(hd, MIS_BO);
- hd->hpib_acr = AUX_EOI;
- hd->hpib_data = *hs->sc_addr;
- hd->hpib_mim = MIS_BO;
- }
-#ifdef DEBUG
- else if (hs->sc_count)
- panic("nhpibdone");
-#endif
- }
-}
-
-int
-nhpibintr(arg)
- void *arg;
-{
- struct nhpib_softc *sc = arg;
- struct hpibbus_softc *hs = sc->sc_hpibbus;
- struct nhpibdevice *hd = sc->sc_regs;
- struct hpibqueue *hq;
- int stat0;
- int stat1;
-
- if ((hd->hpib_ids & IDS_IR) == 0)
- return(0);
- stat0 = hd->hpib_mis;
- stat1 = hd->hpib_lis;
-
- hq = TAILQ_FIRST(&hs->sc_queue);
-
- if (hs->sc_flags & HPIBF_IO) {
- hd->hpib_mim = 0;
- if ((hs->sc_flags & HPIBF_DONE) == 0) {
- hs->sc_flags &= ~HPIBF_TIMO;
- dmastop(hs->sc_dq->dq_chan);
- } else if (hs->sc_flags & HPIBF_TIMO)
- timeout_del(&sc->sc_read_to);
- hd->hpib_acr = AUX_TCA;
- hs->sc_flags &= ~(HPIBF_DONE|HPIBF_IO|HPIBF_READ|HPIBF_TIMO);
-
- dmafree(hs->sc_dq);
- (hq->hq_intr)(hq->hq_softc);
- } else if (hs->sc_flags & HPIBF_PPOLL) {
- hd->hpib_mim = 0;
- stat0 = nhpibppoll(hs);
- if (stat0 & (0x80 >> hq->hq_slave)) {
- hs->sc_flags &= ~HPIBF_PPOLL;
- (hq->hq_intr)(hq->hq_softc);
- }
-#ifdef DEBUG
- else
- printf("%s: PPOLL intr bad status %x\n",
- hs->sc_dev.dv_xname, stat0);
-#endif
- }
- return(1);
-}
-
-int
-nhpibppoll(hs)
- struct hpibbus_softc *hs;
-{
- struct nhpib_softc *sc = (struct nhpib_softc *)hs->sc_dev.dv_parent;
- struct nhpibdevice *hd = sc->sc_regs;
- int ppoll;
-
- hd->hpib_acr = AUX_SPP;
- DELAY(25);
- ppoll = hd->hpib_cpt;
- hd->hpib_acr = AUX_CPP;
- return(ppoll);
-}
-
-#ifdef DEBUG
-int nhpibreporttimo = 0;
-#endif
-
-int
-nhpibwait(hd, x)
- struct nhpibdevice *hd;
- int x;
-{
- int timo = hpibtimeout;
-
- while ((hd->hpib_mis & x) == 0 && --timo)
- DELAY(1);
- if (timo == 0) {
-#ifdef DEBUG
- if (nhpibreporttimo)
- printf("hpib0: %s timo\n", x==MIS_BO?"OUT":"IN");
-#endif
- return(-1);
- }
- return(0);
-}
-
-void
-nhpibppwatch(arg)
- void *arg;
-{
- struct hpibbus_softc *hs = arg;
- struct nhpib_softc *sc = (struct nhpib_softc *)hs->sc_dev.dv_parent;
-
- if ((hs->sc_flags & HPIBF_PPOLL) == 0)
- return;
-
-again:
- if (nhpibppoll(hs) & (0x80 >> TAILQ_FIRST(&hs->sc_queue)->hq_slave))
- sc->sc_regs->hpib_mim = MIS_BO;
- else if (cold)
- /* timeouts not working yet */
- goto again;
- else {
- timeout_set(&sc->sc_watch_to, nhpibppwatch, hs);
- timeout_add(&sc->sc_watch_to, 1);
- }
-}
diff --git a/sys/arch/hp300/dev/nhpibreg.h b/sys/arch/hp300/dev/nhpibreg.h
deleted file mode 100644
index 5a580cdea4c..00000000000
--- a/sys/arch/hp300/dev/nhpibreg.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/* $OpenBSD: nhpibreg.h,v 1.3 2003/06/02 23:27:45 millert Exp $ */
-/* $NetBSD: nhpibreg.h,v 1.5 1995/01/07 10:30:15 mycroft Exp $ */
-
-/*
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)nhpibreg.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <hp300/dev/iotypes.h> /* XXX */
-
-struct nhpibdevice {
- u_char hpib_pad0;
- vu_char hpib_cid;
- u_char hpib_pad1;
-#define hpib_ie hpib_ids
- vu_char hpib_ids;
- u_char hpib_pad2;
- vu_char hpib_csa;
- u_char hpib_pad3[11];
-#define hpib_mim hpib_mis
- vu_char hpib_mis;
- u_char hpib_pad4;
-#define hpib_lim hpib_lis
- vu_char hpib_lis;
- u_char hpib_pad5;
- vu_char hpib_is;
- u_char hpib_pad6;
-#define hpib_acr hpib_cls
- vu_char hpib_cls;
- u_char hpib_pad7;
- vu_char hpib_ar;
- u_char hpib_pad8;
- vu_char hpib_sprb;
- u_char hpib_pad9;
-#define hpib_ppr hpib_cpt
- vu_char hpib_cpt;
- u_char hpib_pad10;
- vu_char hpib_data;
-};
-
-/*
- * Bits in hpib_lis (and hpib_lim).
- */
-#define LIS_IFC 0x01
-#define LIS_SRQ 0x02
-#define LIS_MA 0x04
-#define LIS_DCAS 0x08
-#define LIS_APT 0x10
-#define LIS_UCG 0x20
-#define LIS_ERR 0x40
-#define LIS_GET 0x80
-
-#define MIS_END 0x08
-#define MIS_BO 0x10
-#define MIS_BI 0x20
-
-#define IS_TADS 0x02
-#define IS_LADS 0x04
-
-/*
- * ti9914 "Auxiliary Commands" - Some are Set/Clear, others pulse.
- */
-#define AUX_CSWRST 0x00 /* End software reset */
-#define AUX_RHDF 0x02 /* release RFD (ready for data) holdoff */
-#define AUX_CHDFA 0x03 /* Clear holdoff on all data */
-#define AUX_CHDFE 0x04 /* Clear holdoff on EOI data only */
-#define AUX_EOI 0x08 /* Pulse EOI (with data) */
-#define AUX_CLON 0x09 /* Clear listen only */
-#define AUX_CTON 0x0a /* Clear talk only */
-#define AUX_GTS 0x0b /* Go to standby (clears ATN line) */
-#define AUX_TCA 0x0c /* Take control (async) */
-#define AUX_TCS 0x0d /* Take control (sync) */
-#define AUX_CPP 0x0e /* Clear parallel poll */
-#define AUX_CSIC 0x0f /* Clear IFC (interface clear) line */
-#define AUX_CSRE 0x10 /* Clear REN (remote enable) line */
-#define AUX_CDAI 0x13 /* Clear interrupt disable */
-#define AUX_CSTD1 0x15 /* Clear 1200ns T1 delay */
-#define AUX_CSHDW 0x16 /* Clear shadow handshake */
-#define AUX_CVSTD1 0x17 /* Clear 600ns T1 delay */
-
-#define AUX_SSWRST 0x80 /* Start software reset */
-#define AUX_SHDFA 0x83 /* Set holdoff on all data */
-#define AUX_SHDFE 0x84 /* Set holdoff on EOI data only */
-#define AUX_SLON 0x89 /* Set listen only */
-#define AUX_STON 0x8a /* Set talk only */
-#define AUX_SPP 0x8e /* Set parallel poll */
-#define AUX_SSIC 0x8f /* Set IFC line */
-#define AUX_SSRE 0x90 /* Set REN line */
-#define AUX_SDAI 0x93 /* Disable all interrupts */
-#define AUX_SSTD1 0x95 /* Set T1 delay to 1200ns */
-#define AUX_SSHDW 0x96 /* Set shadow handshake */
-#define AUX_SVSTD1 0x97 /* Set T1 delay to 600ns */
diff --git a/sys/arch/hp300/dev/ppi.c b/sys/arch/hp300/dev/ppi.c
deleted file mode 100644
index eed6fcc8117..00000000000
--- a/sys/arch/hp300/dev/ppi.c
+++ /dev/null
@@ -1,466 +0,0 @@
-/* $OpenBSD: ppi.c,v 1.17 2009/07/30 20:32:44 blambert Exp $ */
-/* $NetBSD: ppi.c,v 1.13 1997/04/02 22:37:33 scottr Exp $ */
-
-/*
- * Copyright (c) 1996, 1997 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ppi.c 8.1 (Berkeley) 6/16/93
- */
-
-/*
- * Printer/Plotter HPIB interface
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/errno.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/proc.h>
-#include <sys/timeout.h>
-#include <sys/uio.h>
-
-#include <hp300/dev/hpibvar.h>
-
-#include <hp300/dev/ppiioctl.h>
-
-struct ppi_softc {
- struct device sc_dev;
- int sc_flags;
- struct hpibqueue sc_hq; /* HP-IB job queue entry */
- struct ppiparam sc_param;
-#define sc_burst sc_param.burst
-#define sc_timo sc_param.timo
-#define sc_delay sc_param.delay
- int sc_sec;
- int sc_slave; /* HP-IB slave address */
- struct timeout sc_to; /* ppitimo timeout */
- struct timeout sc_start_to; /* ppistart timeout */
-};
-
-/* sc_flags values */
-#define PPIF_ALIVE 0x01
-#define PPIF_OPEN 0x02
-#define PPIF_UIO 0x04
-#define PPIF_TIMO 0x08
-#define PPIF_DELAY 0x10
-
-int ppimatch(struct device *, void *, void *);
-void ppiattach(struct device *, struct device *, void *);
-
-struct cfattach ppi_ca = {
- sizeof(struct ppi_softc), ppimatch, ppiattach
-};
-
-struct cfdriver ppi_cd = {
- NULL, "ppi", DV_DULL
-};
-
-void ppistart(void *);
-void ppinoop(void *);
-
-void ppitimo(void *);
-int ppirw(dev_t, struct uio *);
-
-cdev_decl(ppi);
-
-#define UNIT(x) minor(x)
-
-#ifdef DEBUG
-int ppidebug = 0x80;
-#define PDB_FOLLOW 0x01
-#define PDB_IO 0x02
-#define PDB_NOCHECK 0x80
-#endif
-
-int
-ppimatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct cfdata *cf = match;
- struct hpibbus_attach_args *ha = aux;
-
- /*
- * The printer/plotter doesn't return an ID tag.
- * The check below prevents us from matching a CS80
- * device by mistake.
- */
- if (ha->ha_id & 0x200)
- return (0);
-
- /*
- * To prevent matching all unused slots on the bus, we
- * don't allow wildcarded locators.
- */
- if (cf->hpibbuscf_slave == HPIBBUS_SLAVE_UNK ||
- cf->hpibbuscf_punit == HPIBBUS_PUNIT_UNK)
- return (0);
-
- return (1);
-}
-
-void
-ppiattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct ppi_softc *sc = (struct ppi_softc *)self;
- struct hpibbus_attach_args *ha = aux;
-
- printf("\n");
-
- sc->sc_slave = ha->ha_slave;
-
- /* Initialize the hpib queue entry. */
- sc->sc_hq.hq_softc = sc;
- sc->sc_hq.hq_slave = sc->sc_slave;
- sc->sc_hq.hq_start = ppistart;
- sc->sc_hq.hq_go = ppinoop;
- sc->sc_hq.hq_intr = ppinoop;
-
- sc->sc_flags = PPIF_ALIVE;
-
- /* Initialize timeout structures */
- timeout_set(&sc->sc_to, ppitimo, sc);
- timeout_set(&sc->sc_start_to, ppistart, sc);
-}
-
-void
-ppinoop(arg)
- void *arg;
-{
- /* Noop! */
-}
-
-int
-ppiopen(dev, flags, fmt, p)
- dev_t dev;
- int flags, fmt;
- struct proc *p;
-{
- int unit = UNIT(dev);
- struct ppi_softc *sc;
-
- if (unit >= ppi_cd.cd_ndevs ||
- (sc = ppi_cd.cd_devs[unit]) == NULL ||
- (sc->sc_flags & PPIF_ALIVE) == 0)
- return (ENXIO);
-
-#ifdef DEBUG
- if (ppidebug & PDB_FOLLOW)
- printf("ppiopen(%x, %x): flags %x\n",
- dev, flags, sc->sc_flags);
-#endif
- if (sc->sc_flags & PPIF_OPEN)
- return (EBUSY);
- sc->sc_flags |= PPIF_OPEN;
- sc->sc_burst = PPI_BURST;
- sc->sc_timo = PPI_TIMO;
- sc->sc_delay = PPI_DELAY;
- sc->sc_sec = -1;
- return(0);
-}
-
-int
-ppiclose(dev, flags, fmt, p)
- dev_t dev;
- int flags, fmt;
- struct proc *p;
-{
- int unit = UNIT(dev);
- struct ppi_softc *sc = ppi_cd.cd_devs[unit];
-
-#ifdef DEBUG
- if (ppidebug & PDB_FOLLOW)
- printf("ppiclose(%x, %x): flags %x\n",
- dev, flags, sc->sc_flags);
-#endif
- sc->sc_flags &= ~PPIF_OPEN;
- return(0);
-}
-
-void
-ppistart(arg)
- void *arg;
-{
- struct ppi_softc *sc = arg;
-
-#ifdef DEBUG
- if (ppidebug & PDB_FOLLOW)
- printf("ppistart(%x)\n", sc->sc_dev.dv_unit);
-#endif
- sc->sc_flags &= ~PPIF_DELAY;
- wakeup(sc);
-}
-
-void
-ppitimo(arg)
- void *arg;
-{
- struct ppi_softc *sc = arg;
-
-#ifdef DEBUG
- if (ppidebug & PDB_FOLLOW)
- printf("ppitimo(%x)\n", sc->sc_dev.dv_unit);
-#endif
- sc->sc_flags &= ~(PPIF_UIO|PPIF_TIMO);
- wakeup(sc);
-}
-
-int
-ppiread(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
-
-#ifdef DEBUG
- if (ppidebug & PDB_FOLLOW)
- printf("ppiread(%x, %p)\n", dev, uio);
-#endif
- return (ppirw(dev, uio));
-}
-
-int
-ppiwrite(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
-
-#ifdef DEBUG
- if (ppidebug & PDB_FOLLOW)
- printf("ppiwrite(%x, %p)\n", dev, uio);
-#endif
- return (ppirw(dev, uio));
-}
-
-int
-ppirw(dev, uio)
- dev_t dev;
- struct uio *uio;
-{
- int unit = UNIT(dev);
- struct ppi_softc *sc = ppi_cd.cd_devs[unit];
- int s, len, cnt;
- char *cp;
- int error = 0, gotdata = 0;
- int buflen, ctlr, slave;
- char *buf;
-
- if (uio->uio_resid == 0)
- return(0);
-
- ctlr = sc->sc_dev.dv_parent->dv_unit;
- slave = sc->sc_slave;
-
-#ifdef DEBUG
- if (ppidebug & (PDB_FOLLOW|PDB_IO))
- printf("ppirw(%x, %p, %c): burst %d, timo %d, resid %x\n",
- dev, uio, uio->uio_rw == UIO_READ ? 'R' : 'W',
- sc->sc_burst, sc->sc_timo, uio->uio_resid);
-#endif
- buflen = min(sc->sc_burst, uio->uio_resid);
- buf = (char *)malloc(buflen, M_DEVBUF, M_WAITOK);
- sc->sc_flags |= PPIF_UIO;
- if (sc->sc_timo > 0) {
- sc->sc_flags |= PPIF_TIMO;
- timeout_add_msec(&sc->sc_to, sc->sc_timo);
- }
- len = cnt = 0;
- while (uio->uio_resid > 0) {
- len = min(buflen, uio->uio_resid);
- cp = buf;
- if (uio->uio_rw == UIO_WRITE) {
- error = uiomove(cp, len, uio);
- if (error)
- break;
- }
-again:
- s = splbio();
- if ((sc->sc_flags & PPIF_UIO) &&
- hpibreq(sc->sc_dev.dv_parent, &sc->sc_hq) == 0)
- tsleep(sc, PRIBIO+1, "ppirw", 0);
- /*
- * Check if we timed out during sleep or uiomove
- */
- if ((sc->sc_flags & PPIF_UIO) == 0) {
-#ifdef DEBUG
- if (ppidebug & PDB_IO)
- printf("ppirw: uiomove/sleep timo, flags %x\n",
- sc->sc_flags);
-#endif
- if (sc->sc_flags & PPIF_TIMO) {
- timeout_del(&sc->sc_to);
- sc->sc_flags &= ~PPIF_TIMO;
- }
- splx(s);
- break;
- }
- /*
- * Perform the operation
- */
- if (uio->uio_rw == UIO_WRITE)
- cnt = hpibsend(ctlr, slave, sc->sc_sec, cp, len);
- else
- cnt = hpibrecv(ctlr, slave, sc->sc_sec, cp, len);
- hpibfree(sc->sc_dev.dv_parent, &sc->sc_hq);
-#ifdef DEBUG
- if (ppidebug & PDB_IO)
- printf("ppirw: %s(%d, %d, %x, %p, %d) -> %d\n",
- uio->uio_rw == UIO_READ ? "recv" : "send",
- ctlr, slave, sc->sc_sec, cp, len, cnt);
-#endif
- if (uio->uio_rw == UIO_READ) {
- if (cnt) {
- error = uiomove(cp, cnt, uio);
- if (error) {
- splx(s);
- break;
- }
- gotdata++;
- }
- /*
- * Didn't get anything this time, but did in the past.
- * Consider us done.
- */
- else if (gotdata) {
- splx(s);
- break;
- }
- }
- /*
- * Operation timeout (or non-blocking), quit now.
- */
- if ((sc->sc_flags & PPIF_UIO) == 0) {
-#ifdef DEBUG
- if (ppidebug & PDB_IO)
- printf("ppirw: timeout/done\n");
-#endif
- splx(s);
- break;
- }
- /*
- * Implement inter-read delay
- */
- if (sc->sc_delay > 0) {
- sc->sc_flags |= PPIF_DELAY;
- timeout_add_msec(&sc->sc_start_to, sc->sc_delay);
- error = tsleep(sc, (PCATCH|PZERO) + 1, "hpib", 0);
- if (error) {
- splx(s);
- break;
- }
- }
- /*
- * Must not call uiomove again til we've used all data
- * that we already grabbed.
- */
- if (uio->uio_rw == UIO_WRITE && cnt != len) {
- cp += cnt;
- len -= cnt;
- cnt = 0;
- splx(s);
- goto again;
- }
- splx(s);
- }
- if (sc->sc_flags & PPIF_TIMO) {
- timeout_del(&sc->sc_to);
- sc->sc_flags &= ~PPIF_TIMO;
- }
- if (sc->sc_flags & PPIF_DELAY) {
- timeout_del(&sc->sc_start_to);
- sc->sc_flags &= ~PPIF_DELAY;
- }
- /*
- * Adjust for those chars that we uiomove'ed but never wrote
- */
- if (uio->uio_rw == UIO_WRITE && cnt != len) {
- uio->uio_resid += (len - cnt);
-#ifdef DEBUG
- if (ppidebug & PDB_IO)
- printf("ppirw: short write, adjust by %d\n",
- len-cnt);
-#endif
- }
- free(buf, M_DEVBUF);
-#ifdef DEBUG
- if (ppidebug & (PDB_FOLLOW|PDB_IO))
- printf("ppirw: return %d, resid %d\n", error, uio->uio_resid);
-#endif
- return (error);
-}
-
-int
-ppiioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- struct ppi_softc *sc = ppi_cd.cd_devs[UNIT(dev)];
- struct ppiparam *pp, *upp;
- int tmp;
- int error = 0;
-
- switch (cmd) {
- case PPIIOCGPARAM:
- pp = &sc->sc_param;
- upp = (struct ppiparam *)data;
- upp->burst = pp->burst;
- upp->timo = pp->timo;
- upp->delay = pp->delay;
- break;
- case PPIIOCSPARAM:
- pp = &sc->sc_param;
- upp = (struct ppiparam *)data;
- if (upp->burst < PPI_BURST_MIN || upp->burst > PPI_BURST_MAX ||
- upp->delay < PPI_DELAY_MIN || upp->delay > PPI_DELAY_MAX)
- return(EINVAL);
- pp->burst = upp->burst;
- pp->timo = upp->timo;
- pp->delay = upp->delay;
- break;
- case PPIIOCSSEC:
- tmp = *(int *)data;
- if (tmp == -1 || (tmp >= 0 && tmp <= 0x1f))
- sc->sc_sec = tmp;
- else
- error = EINVAL;
- break;
- default:
- return (ENOTTY);
- }
- return (error);
-}
diff --git a/sys/arch/hp300/dev/ppiioctl.h b/sys/arch/hp300/dev/ppiioctl.h
deleted file mode 100644
index 4a0acc8fea9..00000000000
--- a/sys/arch/hp300/dev/ppiioctl.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* $OpenBSD: ppiioctl.h,v 1.3 2003/06/02 23:27:45 millert Exp $ */
-/* $NetBSD: ppiioctl.h,v 1.4 1994/10/26 07:24:48 cgd Exp $ */
-
-/*
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ppiioctl.h 8.1 (Berkeley) 6/10/93
- */
-
-#ifndef _IOCTL_
-#include <sys/ioctl.h>
-#endif
-
-struct ppiparam {
- int burst; /* chars to send/recv in one call */
- int timo; /* timeout: -1 blocking, 0 non-blocking, >0 msec */
- int delay; /* delay between polls (msec) */
-};
-
-#define PPI_BLOCK -1
-#define PPI_NOBLOCK 0
-
-/* default values */
-#define PPI_BURST 1024
-#define PPI_TIMO PPI_BLOCK
-#define PPI_DELAY 10
-
-/* limits */
-#define PPI_BURST_MIN 1
-#define PPI_BURST_MAX 1024
-#define PPI_DELAY_MIN 0
-#define PPI_DELAY_MAX 30000
-
-#define PPIIOCSPARAM _IOW('P', 0x1, struct ppiparam)
-#define PPIIOCGPARAM _IOR('P', 0x2, struct ppiparam)
-#define PPIIOCSSEC _IOW('P', 0x3, int)
diff --git a/sys/arch/hp300/dev/rbox.c b/sys/arch/hp300/dev/rbox.c
deleted file mode 100644
index 610248573f7..00000000000
--- a/sys/arch/hp300/dev/rbox.c
+++ /dev/null
@@ -1,394 +0,0 @@
-/* $OpenBSD: rbox.c,v 1.16 2013/10/21 10:36:13 miod Exp $ */
-
-/*
- * Copyright (c) 2005, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_rb.c 1.15 93/08/13$
- *
- * @(#)grf_rb.c 8.4 (Berkeley) 1/12/94
- */
-
-/*
- * Graphics routines for the Renaissance, HP98720 Graphics system.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/proc.h>
-#include <sys/ioctl.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-#include <hp300/dev/intiovar.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/rasops/rasops.h>
-
-#include <hp300/dev/diofbreg.h>
-#include <hp300/dev/diofbvar.h>
-#include <hp300/dev/rboxreg.h>
-
-struct rbox_softc {
- struct device sc_dev;
- struct diofb *sc_fb;
- struct diofb sc_fb_store;
- int sc_scode;
-};
-
-int rbox_dio_match(struct device *, void *, void *);
-void rbox_dio_attach(struct device *, struct device *, void *);
-int rbox_intio_match(struct device *, void *, void *);
-void rbox_intio_attach(struct device *, struct device *, void *);
-
-struct cfattach rbox_dio_ca = {
- sizeof(struct rbox_softc), rbox_dio_match, rbox_dio_attach
-};
-
-struct cfattach rbox_intio_ca = {
- sizeof(struct rbox_softc), rbox_intio_match, rbox_intio_attach
-};
-
-struct cfdriver rbox_cd = {
- NULL, "rbox", DV_DULL
-};
-
-int rbox_reset(struct diofb *, int, struct diofbreg *);
-void rbox_restore(struct diofb *);
-void rbox_setcolor(struct diofb *, u_int,
- u_int8_t, u_int8_t, u_int8_t);
-int rbox_windowmove(struct diofb *, u_int16_t, u_int16_t, u_int16_t,
- u_int16_t, u_int16_t, u_int16_t, int16_t, int16_t);
-
-int rbox_ioctl(void *, u_long, caddr_t, int, struct proc *);
-void rbox_burner(void *, u_int, u_int);
-
-struct wsdisplay_accessops rbox_accessops = {
- .ioctl = rbox_ioctl,
- .mmap = diofb_mmap,
- .alloc_screen = diofb_alloc_screen,
- .free_screen = diofb_free_screen,
- .show_screen = diofb_show_screen,
- .load_font = diofb_load_font,
- .list_font = diofb_list_font,
- .burn_screen = rbox_burner
-};
-
-/*
- * Attachment glue
- */
-
-int
-rbox_intio_match(struct device *parent, void *match, void *aux)
-{
- struct intio_attach_args *ia = aux;
- struct diofbreg *fbr;
-
- fbr = (struct diofbreg *)IIOV(GRFIADDR);
-
- if (badaddr((caddr_t)fbr))
- return (0);
-
- if (fbr->id == GRFHWID && fbr->fbid == GID_RENAISSANCE) {
- ia->ia_addr = (caddr_t)GRFIADDR;
- return (1);
- }
-
- return (0);
-}
-
-void
-rbox_intio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct rbox_softc *sc = (struct rbox_softc *)self;
- struct diofbreg *fbr;
-
- fbr = (struct diofbreg *)IIOV(GRFIADDR);
- sc->sc_scode = CONSCODE_INTERNAL;
-
- if (sc->sc_scode == conscode) {
- sc->sc_fb = &diofb_cn;
- } else {
- sc->sc_fb = &sc->sc_fb_store;
- rbox_reset(sc->sc_fb, sc->sc_scode, fbr);
- }
-
- diofb_end_attach(sc, &rbox_accessops, sc->sc_fb,
- sc->sc_scode == conscode, NULL);
-}
-
-int
-rbox_dio_match(struct device *parent, void *match, void *aux)
-{
- struct dio_attach_args *da = aux;
-
- if (da->da_id == DIO_DEVICE_ID_FRAMEBUFFER &&
- da->da_secid == DIO_DEVICE_SECID_RENAISSANCE)
- return (1);
-
- return (0);
-}
-
-void
-rbox_dio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct rbox_softc *sc = (struct rbox_softc *)self;
- struct dio_attach_args *da = aux;
- struct diofbreg *fbr;
-
- sc->sc_scode = da->da_scode;
- if (sc->sc_scode == conscode) {
- fbr = (struct diofbreg *)conaddr; /* already mapped */
- sc->sc_fb = &diofb_cn;
- } else {
- sc->sc_fb = &sc->sc_fb_store;
- fbr = (struct diofbreg *)
- iomap(dio_scodetopa(sc->sc_scode), da->da_size);
- if (fbr == NULL ||
- rbox_reset(sc->sc_fb, sc->sc_scode, fbr) != 0) {
- printf(": can't map framebuffer\n");
- return;
- }
- }
-
- diofb_end_attach(sc, &rbox_accessops, sc->sc_fb,
- sc->sc_scode == conscode, NULL);
-}
-
-/*
- * Initialize hardware and display routines.
- */
-int
-rbox_reset(struct diofb *fb, int scode, struct diofbreg *fbr)
-{
- int rc;
-
- if ((rc = diofb_fbinquire(fb, scode, fbr)) != 0)
- return (rc);
-
- /*
- * Restrict the framebuffer to a monochrome view for now, until
- * I know better how to detect and frob overlay planes, and
- * setup a proper colormap. -- miod
- */
- fb->planes = fb->planemask = 1;
-
- fb->bmv = rbox_windowmove;
- rbox_restore(fb);
- diofb_fbsetup(fb);
-
- return (0);
-}
-
-void
-rbox_restore(struct diofb *fb)
-{
- volatile struct rboxfb *rb = (struct rboxfb *)fb->regkva;
- u_int i;
-
- rb_waitbusy(rb);
-
- rb->regs.id = GRFHWID; /* trigger reset */
- DELAY(1000);
-
- rb->regs.interrupt = 0x04;
- rb->video_enable = 0x01;
- rb->drive = 0x01;
- rb->vdrive = 0x0;
-
- rb->opwen = 0xFF;
-
- /*
- * Clear color map
- */
- rb_waitbusy(fb->regkva);
- for (i = 0; i < 16; i++) {
- *(fb->regkva + 0x63c3 + i*4) = 0x0;
- *(fb->regkva + 0x6403 + i*4) = 0x0;
- *(fb->regkva + 0x6803 + i*4) = 0x0;
- *(fb->regkva + 0x6c03 + i*4) = 0x0;
- *(fb->regkva + 0x73c3 + i*4) = 0x0;
- *(fb->regkva + 0x7403 + i*4) = 0x0;
- *(fb->regkva + 0x7803 + i*4) = 0x0;
- *(fb->regkva + 0x7c03 + i*4) = 0x0;
- }
-
- rb->rep_rule = RBOX_DUALROP(RR_COPY);
-
- /*
- * I cannot figure out how to make the blink planes stop. So, we
- * must set both colormaps so that when the planes blink, and
- * the secondary colormap is active, we still get text.
- */
- CM1RED(fb)[0x00].value = 0x00;
- CM1GRN(fb)[0x00].value = 0x00;
- CM1BLU(fb)[0x00].value = 0x00;
- CM1RED(fb)[0x01].value = 0xFF;
- CM1GRN(fb)[0x01].value = 0xFF;
- CM1BLU(fb)[0x01].value = 0xFF;
-
- CM2RED(fb)[0x00].value = 0x00;
- CM2GRN(fb)[0x00].value = 0x00;
- CM2BLU(fb)[0x00].value = 0x00;
- CM2RED(fb)[0x01].value = 0xFF;
- CM2GRN(fb)[0x01].value = 0xFF;
- CM2BLU(fb)[0x01].value = 0xFF;
-
- rb->blink = 0x00;
- rb->write_enable = 0x01;
- rb->opwen = 0x00;
-
- /* enable display */
- rb->display_enable = 0x01;
-}
-
-int
-rbox_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p)
-{
- struct diofb *fb = v;
- struct wsdisplay_fbinfo *wdf;
-
- switch (cmd) {
- case WSDISPLAYIO_GTYPE:
- *(u_int *)data = WSDISPLAY_TYPE_RBOX;
- break;
- case WSDISPLAYIO_SMODE:
- fb->mapmode = *(u_int *)data;
- if (fb->mapmode == WSDISPLAYIO_MODE_EMUL)
- rbox_restore(fb);
- break;
- case WSDISPLAYIO_GINFO:
- wdf = (void *)data;
- wdf->width = fb->ri.ri_width;
- wdf->height = fb->ri.ri_height;
- wdf->depth = fb->ri.ri_depth;
- wdf->cmsize = 0; /* XXX */
- break;
- case WSDISPLAYIO_LINEBYTES:
- *(u_int *)data = fb->ri.ri_stride;
- break;
- case WSDISPLAYIO_GETCMAP:
- case WSDISPLAYIO_PUTCMAP:
- break; /* XXX until color support is implemented */
- break;
- case WSDISPLAYIO_GVIDEO:
- case WSDISPLAYIO_SVIDEO:
- break;
- default:
- return (-1);
- }
-
- return (0);
-}
-
-void
-rbox_burner(void *v, u_int on, u_int flags)
-{
- struct diofb *fb = v;
- volatile struct rboxfb *rb = (struct rboxfb *)fb->regkva;
-
- if (on) {
- rb->display_enable = 0x01;
- } else {
- rb->display_enable = 0x00;
- }
-}
-
-int
-rbox_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy,
- u_int16_t dx, u_int16_t dy, u_int16_t cx, u_int16_t cy, int16_t rop,
- int16_t planemask)
-{
- volatile struct rboxfb *rb = (struct rboxfb *)fb->regkva;
-
- if (planemask != 0xff)
- return (EINVAL);
-
- rb_waitbusy(rb);
-
- rb->rep_rule = RBOX_DUALROP(rop);
- rb->source_y = sy;
- rb->source_x = sx;
- rb->dest_y = dy;
- rb->dest_x = dx;
- rb->wheight = cy;
- rb->wwidth = cx;
- rb->wmove = 1;
-
- rb_waitbusy(rb);
-
- return (0);
-}
-
-/*
- * Renaissance console support
- */
-
-void
-rboxcninit()
-{
- rbox_reset(&diofb_cn, conscode, (struct diofbreg *)conaddr);
- diofb_cnattach(&diofb_cn);
-}
diff --git a/sys/arch/hp300/dev/rboxreg.h b/sys/arch/hp300/dev/rboxreg.h
deleted file mode 100644
index 2e5fd3a7974..00000000000
--- a/sys/arch/hp300/dev/rboxreg.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/* $OpenBSD: rboxreg.h,v 1.3 2013/02/02 13:34:29 miod Exp $ */
-/* $NetBSD: grf_rbreg.h,v 1.4 1994/10/26 07:24:03 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_rbreg.h 1.9 92/01/21$
- *
- * @(#)grf_rbreg.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * Map of the Renaissance frame buffer controller chip in memory ...
- */
-
-#define rb_waitbusy(regaddr) \
-do { \
- while (((volatile struct rboxfb *)(regaddr))->wbusy & 0x01) \
- DELAY(10); \
-} while (0)
-
-#define RBOX_DUALROP(rop) ((rop) << 4 | (rop))
-
-#define CM1RED(fb) ((volatile struct rencm *)((fb)->regkva + 0x6400))
-#define CM1GRN(fb) ((volatile struct rencm *)((fb)->regkva + 0x6800))
-#define CM1BLU(fb) ((volatile struct rencm *)((fb)->regkva + 0x6C00))
-#define CM2RED(fb) ((volatile struct rencm *)((fb)->regkva + 0x7400))
-#define CM2GRN(fb) ((volatile struct rencm *)((fb)->regkva + 0x7800))
-#define CM2BLU(fb) ((volatile struct rencm *)((fb)->regkva + 0x7C00))
-
-struct rencm {
- u_int8_t :8, :8, :8;
- u_int8_t value;
-};
-
-struct rboxfb {
- struct diofbreg regs;
- u_int8_t filler2[16359];
- u_int8_t wbusy; /* window mover is active 0x4047 */
- u_int8_t filler3[0x405b - 0x4048];
- u_int8_t scanbusy; /* scan converteris active 0x405B */
- u_int8_t filler3b[0x4083 - 0x405c];
- u_int8_t video_enable; /* drive vid. refresh bus 0x4083 */
- u_int8_t filler4[3];
- u_int8_t display_enable; /* enable the display 0x4087 */
- u_int8_t filler5[8];
- u_int32_t write_enable; /* write enable register 0x4090 */
- u_int8_t filler6[11];
- u_int8_t wmove; /* start window mover 0x409f */
- u_int8_t filler7[3];
- u_int8_t blink; /* blink register 0x40a3 */
- u_int8_t filler8[15];
- u_int8_t fold; /* fold register 0x40b3 */
- u_int32_t opwen; /* overlay plane write enable 0x40b4 */
- u_int8_t filler9[3];
- u_int8_t tmode; /* Tile mode size 0x40bb */
- u_int8_t filler9a[3];
- u_int8_t drive; /* drive register 0x40bf */
- u_int8_t filler10[3];
- u_int8_t vdrive; /* vdrive register 0x40c3 */
- u_int8_t filler10a[0x40cb-0x40c4];
- u_int8_t zconfig; /* Z-buffer mode 0x40cb */
- u_int8_t filler11a[2];
- u_int16_t tpatt; /* Transparency pattern 0x40ce */
- u_int8_t filler11b[3];
- u_int8_t dmode; /* dither mode 0x40d3 */
- u_int8_t filler11c[3];
- u_int8_t en_scan; /* enable scan board to DTACK 0x40d7 */
- u_int8_t filler11d[0x40ef-0x40d8];
- u_int8_t rep_rule; /* replacement rule 0x40ef */
- u_int8_t filler12[2];
- u_int16_t source_x; /* source x 0x40f2 */
- u_int8_t filler13[2];
- u_int16_t source_y; /* source y 0x40f6 */
- u_int8_t filler14[2];
- u_int16_t dest_x; /* dest x 0x40fa */
- u_int8_t filler15[2];
- u_int16_t dest_y; /* dest y 0x40fe */
- u_int8_t filler16[2];
- u_int16_t wwidth; /* window width 0x4102 */
- u_int8_t filler17[2];
- u_int16_t wheight; /* window height 0x4106 */
- u_int8_t filler18[18];
- u_int16_t patt_x; /* pattern x 0x411a */
- u_int8_t filler19[2];
- u_int16_t patt_y; /* pattern y 0x411e */
- u_int8_t filler20[0x8012 - 0x4120];
- u_int16_t te_status; /* transform engine status 0x8012 */
- u_int8_t filler21[0x1ffff-0x8014];
-} __packed;
diff --git a/sys/arch/hp300/dev/sgc.c b/sys/arch/hp300/dev/sgc.c
deleted file mode 100644
index b0030934fc1..00000000000
--- a/sys/arch/hp300/dev/sgc.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/* $OpenBSD: sgc.c,v 1.7 2011/08/18 19:54:18 miod Exp $ */
-
-/*
- * Copyright (c) 2005, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-/*
- * SGC bus attachment and mapping glue.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-#include <machine/hp300spu.h>
-
-#include <hp300/dev/sgcreg.h>
-#include <hp300/dev/sgcvar.h>
-
-int sgcmatch(struct device *, void *, void *);
-void sgcattach(struct device *, struct device *, void *);
-int sgcprint(void *, const char *);
-
-struct cfattach sgc_ca = {
- sizeof(struct device), sgcmatch, sgcattach
-};
-
-struct cfdriver sgc_cd = {
- NULL, "sgc", DV_DULL
-};
-
-int
-sgcmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
-static int sgc_matched = 0;
-
- /* Allow only one instance. */
- if (sgc_matched)
- return 0;
-
- /*
- * Leave out machines which can not have an SGC bus.
- */
-
- switch (machineid) {
- case HP_400:
- case HP_425:
- case HP_433:
- return sgc_matched = 1;
- default:
- return 0;
- }
-}
-
-void
-sgcattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct sgc_attach_args saa;
- caddr_t pa, va;
- int slot, rv;
- extern struct hp300_bus_space_tag hp300_mem_tag;
-
- printf("\n");
-
- for (slot = 0; slot < SGC_NSLOTS; slot++) {
- pa = sgc_slottopa(slot);
- va = iomap(pa, PAGE_SIZE);
- if (va == NULL) {
- printf("%s: can't map slot %d\n", self->dv_xname, slot);
- continue;
- }
-
- /* Check for hardware. */
- rv = badaddr(va);
- iounmap(va, PAGE_SIZE);
-
- if (rv != 0)
- continue;
-
- bzero(&saa, sizeof(saa));
- saa.saa_slot = slot;
- saa.saa_iot = &hp300_mem_tag;
-
- /* Attach matching device. */
- config_found(self, &saa, sgcprint);
- }
-}
-
-int
-sgcprint(aux, pnp)
- void *aux;
- const char *pnp;
-{
- struct sgc_attach_args *saa = aux;
-
- if (pnp)
- printf("unknown SGC card at %s", pnp);
- printf(" slot %d", saa->saa_slot);
- return (UNCONF);
-}
-
-/*
- * Convert a slot number to a system physical address.
- * This is needed for bus_space.
- */
-void *
-sgc_slottopa(int slot)
-{
- u_long rval;
-
- if (slot < 0 || slot >= SGC_NSLOTS)
- rval = 0;
- else
- rval = SGC_BASE + (slot * SGC_DEVSIZE);
-
- return ((void *)rval);
-}
diff --git a/sys/arch/hp300/dev/sgcreg.h b/sys/arch/hp300/dev/sgcreg.h
deleted file mode 100644
index 5a7e4c744ee..00000000000
--- a/sys/arch/hp300/dev/sgcreg.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* $OpenBSD: sgcreg.h,v 1.1 2005/01/14 22:39:26 miod Exp $ */
-
-/*
- * Copyright (c) 2005, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Register definitions for the SGC bus.
- */
-
-/*
- * SGC ranges from slots 0-3 at physical addresses given by:
- * 0x20000000 + slot * 0x04000000
- */
-
-#define SGC_BASE 0x20000000
-#define SGC_END 0x30000000
-#define SGC_DEVSIZE 0x04000000
-
-#define SGC_NSLOTS 4
diff --git a/sys/arch/hp300/dev/sgcvar.h b/sys/arch/hp300/dev/sgcvar.h
deleted file mode 100644
index e61c1a99548..00000000000
--- a/sys/arch/hp300/dev/sgcvar.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* $OpenBSD: sgcvar.h,v 1.2 2007/01/06 20:09:12 miod Exp $ */
-
-/*
- * Copyright (c) 2005, Miodrag Vallat.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-/*
- * Autoconfiguration definitions and prototypes for the SGC bus.
- */
-
-struct sgc_attach_args {
- int saa_slot; /* slot number */
- bus_space_tag_t saa_iot;
-};
-
-#ifdef _KERNEL
-void *sgc_slottopa(int);
-#endif /* _KERNEL */
-
-/* Macros to switch between SGC slot numbers and kernel conscode */
-#define SGC_SLOT_TO_CONSCODE(slot) (256 + (slot))
-#define CONSCODE_TO_SGC_SLOT(code) ((code) - 256)
diff --git a/sys/arch/hp300/dev/spc.c b/sys/arch/hp300/dev/spc.c
deleted file mode 100644
index c6eb44edfb8..00000000000
--- a/sys/arch/hp300/dev/spc.c
+++ /dev/null
@@ -1,330 +0,0 @@
-/* $OpenBSD: spc.c,v 1.13 2008/07/30 18:08:02 miod Exp $ */
-/* $NetBSD: spc.c,v 1.2 2003/11/17 14:37:59 tsutsui Exp $ */
-
-/*
- * Copyright (c) 2003 Izumi Tsutsui.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/buf.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-#include <machine/intr.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-
-#include <scsi/scsi_all.h>
-#include <scsi/scsi_message.h>
-#include <scsi/scsiconf.h>
-
-#include <hp300/dev/mb89352reg.h>
-#include <hp300/dev/mb89352var.h>
-
-#include <hp300/dev/hp98265reg.h>
-#include <hp300/dev/dmareg.h>
-#include <hp300/dev/dmavar.h>
-
-#ifdef USELEDS
-#include <hp300/hp300/leds.h>
-#endif
-
-int spc_dio_match(struct device *, void *, void *);
-void spc_dio_attach(struct device *, struct device *, void *);
-int spc_dio_dmastart(struct spc_softc *, void *, size_t, int);
-int spc_dio_dmadone(struct spc_softc *);
-void spc_dio_dmago(void *);
-void spc_dio_dmastop(void *);
-int spc_dio_intr(void *);
-void spc_dio_reset(struct spc_softc *);
-
-#define HPSPC_ADDRESS(o) (dsc->sc_dregs + ((o) << 1) + 1)
-#define hpspc_read(o) *(volatile u_int8_t *)(HPSPC_ADDRESS(o))
-#define hpspc_write(o, v) *(volatile u_int8_t *)(HPSPC_ADDRESS(o)) = (v)
-
-struct spc_dio_softc {
- struct spc_softc sc_spc; /* MI spc softc */
- struct isr sc_isr;
- volatile u_int8_t *sc_dregs; /* Complete registers */
-
- struct dmaqueue sc_dq; /* DMA job queue */
- u_int sc_dflags; /* DMA flags */
-#define SCSI_DMA32 0x01 /* 32-bit DMA should be used */
-#define SCSI_HAVEDMA 0x02 /* controller has DMA channel */
-#define SCSI_DATAIN 0x04 /* DMA direction */
-};
-
-struct cfattach spc_ca = {
- sizeof(struct spc_dio_softc), spc_dio_match, spc_dio_attach
-};
-
-struct cfdriver spc_cd = {
- NULL, "spc", DV_DULL
-};
-
-/* cf_flags */
-#define SPC_NODMA 0x01
-
-int
-spc_dio_match(struct device *parent, void *vcf, void *aux)
-{
- struct dio_attach_args *da = aux;
-
- switch (da->da_id) {
- case DIO_DEVICE_ID_SCSI0:
- case DIO_DEVICE_ID_SCSI1:
- case DIO_DEVICE_ID_SCSI2:
- case DIO_DEVICE_ID_SCSI3:
- return 1;
- }
-
- return 0;
-}
-
-void
-spc_dio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct spc_dio_softc *dsc = (struct spc_dio_softc *)self;
- struct spc_softc *sc = &dsc->sc_spc;
- struct dio_attach_args *da = aux;
- int ipl;
- u_int8_t id, hconf;
-
- dsc->sc_dregs = (u_int8_t *)iomap(dio_scodetopa(da->da_scode),
- da->da_size);
- if (dsc->sc_dregs == NULL) {
- printf(": can't map SCSI registers\n");
- return;
- }
- sc->sc_regs = dsc->sc_dregs + SPC_OFFSET;
-
- ipl = DIO_IPL(sc->sc_regs);
- printf(" ipl %d: 98265A SCSI", ipl);
-
- hpspc_write(HPSCSI_ID, 0xff);
- DELAY(100);
- id = hpspc_read(HPSCSI_ID);
- hconf = hpspc_read(HPSCSI_HCONF);
-
- if ((id & ID_WORD_DMA) == 0) {
- printf(", 32-bit DMA");
- dsc->sc_dflags |= SCSI_DMA32;
- }
- if ((hconf & HCONF_PARITY) == 0)
- printf(", no parity");
-
- printf("\n");
-
- if ((hconf & HCONF_PARITY) != 0)
- sc->sc_ctlflags = SCTL_PARITY_ENAB;
-
- id &= ID_MASK;
- sc->sc_initiator = id;
-
- if ((sc->sc_dev.dv_cfdata->cf_flags & SPC_NODMA) == 0) {
- sc->sc_dma_start = spc_dio_dmastart;
- sc->sc_dma_done = spc_dio_dmadone;
- }
- sc->sc_reset = spc_dio_reset;
-
- dsc->sc_dq.dq_softc = dsc;
- dsc->sc_dq.dq_start = spc_dio_dmago;
- dsc->sc_dq.dq_done = spc_dio_dmastop;
-
- hpspc_write(HPSCSI_CSR, 0x00);
- hpspc_write(HPSCSI_HCONF, 0x00);
-
- dsc->sc_isr.isr_func = spc_dio_intr;
- dsc->sc_isr.isr_arg = dsc;
- dsc->sc_isr.isr_ipl = ipl;
- dsc->sc_isr.isr_priority = IPL_BIO;
- dio_intr_establish(&dsc->sc_isr, self->dv_xname);
-
- spc_attach(sc);
-
- /* Enable SPC interrupts. */
- hpspc_write(HPSCSI_CSR, CSR_IE);
-}
-
-int
-spc_dio_dmastart(struct spc_softc *sc, void *addr, size_t size, int datain)
-{
- struct spc_dio_softc *dsc = (struct spc_dio_softc *)sc;
-
- /*
- * The HP98658 hardware cannot do odd length transfers, the
- * last byte of data will always be 0x00.
- */
- if ((size & 1) != 0)
- return (EINVAL);
-
- dsc->sc_dq.dq_chan = DMA0 | DMA1;
- dsc->sc_dflags |= SCSI_HAVEDMA;
- if (datain)
- dsc->sc_dflags |= SCSI_DATAIN;
- else
- dsc->sc_dflags &= ~SCSI_DATAIN;
-
- if (dmareq(&dsc->sc_dq) != 0)
- /* DMA channel is available, so start DMA immediately */
- spc_dio_dmago((void *)dsc);
- /* else dma start function will be called later from dmafree(). */
-
- return (0);
-}
-
-void
-spc_dio_dmago(void *arg)
-{
- struct spc_dio_softc *dsc = (struct spc_dio_softc *)arg;
- struct spc_softc *sc = &dsc->sc_spc;
- int len, chan;
- u_int32_t dmaflags;
- u_int8_t cmd;
-
- hpspc_write(HPSCSI_HCONF, 0);
- cmd = CSR_IE;
- dmaflags = DMAGO_NOINT;
- chan = dsc->sc_dq.dq_chan;
- if ((dsc->sc_dflags & SCSI_DATAIN) != 0) {
- cmd |= CSR_DMAIN;
- dmaflags |= DMAGO_READ;
- }
- if ((dsc->sc_dflags & SCSI_DMA32) != 0 &&
- ((u_int)sc->sc_dp & 3) == 0 &&
- (sc->sc_dleft & 3) == 0) {
- cmd |= CSR_DMA32;
- dmaflags |= DMAGO_LWORD;
- } else {
- dmaflags |= DMAGO_WORD;
- }
-
- sc->sc_flags |= SPC_DOINGDMA;
- dmago(chan, sc->sc_dp, sc->sc_dleft, dmaflags);
-
- hpspc_write(HPSCSI_CSR, cmd);
- cmd |= (chan == 0) ? CSR_DE0 : CSR_DE1;
- hpspc_write(HPSCSI_CSR, cmd);
-
- cmd = SCMD_XFR;
- len = sc->sc_dleft;
-
- if ((len & (DEV_BSIZE -1)) != 0) {
- cmd |= SCMD_PAD;
-#if 0
- /*
- * XXX - If we don't do this, the last 2 or 4 bytes
- * (depending on word/lword DMA) of a read get trashed.
- * It looks like it is necessary for the DMA to complete
- * before the SPC goes into "pad mode"??? Note: if we
- * also do this on a write, the request never completes.
- */
- if ((dsc->sc_dflags & SCSI_DATAIN) != 0)
- len += 2;
-#endif
- }
-
- spc_write(TCH, len >> 16);
- spc_write(TCM, len >> 8);
- spc_write(TCL, len);
- spc_write(PCTL, sc->sc_phase | PCTL_BFINT_ENAB);
- spc_write(SCMD, cmd);
-}
-
-int
-spc_dio_dmadone(struct spc_softc *sc)
-{
- struct spc_dio_softc *dsc = (struct spc_dio_softc *)sc;
- int resid, trans;
- u_int8_t cmd;
-
- /* Check if the DMA operation is finished. */
- if ((spc_read(SSTS) & SSTS_BUSY) != 0)
- return (0);
-
- sc->sc_flags &= ~SPC_DOINGDMA;
- if ((dsc->sc_dflags & SCSI_HAVEDMA) != 0) {
- dsc->sc_dflags &= ~SCSI_HAVEDMA;
- dmafree(&dsc->sc_dq);
- }
-
- cmd = hpspc_read(HPSCSI_CSR);
- cmd &= ~(CSR_DE1 | CSR_DE0);
- hpspc_write(HPSCSI_CSR, cmd);
-
- resid = spc_read(TCH) << 16 |
- spc_read(TCM) << 8 |
- spc_read(TCL);
- trans = sc->sc_dleft - resid;
- sc->sc_dp += trans;
- sc->sc_dleft -= trans;
-
- return (1);
-}
-
-void
-spc_dio_dmastop(void *arg)
-{
- struct spc_dio_softc *dsc = (struct spc_dio_softc *)arg;
- struct spc_softc *sc = &dsc->sc_spc;
- u_int8_t cmd;
-
- cmd = hpspc_read(HPSCSI_CSR);
- cmd &= ~(CSR_DE1 | CSR_DE0);
- hpspc_write(HPSCSI_CSR, cmd);
-
- dsc->sc_dflags &= ~SCSI_HAVEDMA;
- sc->sc_flags &= ~SPC_DOINGDMA;
-}
-
-int
-spc_dio_intr(void *arg)
-{
- struct spc_dio_softc *dsc = (struct spc_dio_softc *)arg;
-
- /* if we are sharing the ipl level, this interrupt may not be for us. */
- if ((hpspc_read(HPSCSI_CSR) & (CSR_IE | CSR_IR)) != (CSR_IE | CSR_IR))
- return (0);
-
-#ifdef USELEDS
- ledcontrol(0, 0, LED_DISK);
-#endif
-
- return (spc_intr(arg));
-}
-
-void
-spc_dio_reset(struct spc_softc *sc)
-{
- struct spc_dio_softc *dsc = (struct spc_dio_softc *)sc;
-
- spc_reset(sc);
- hpspc_write(HPSCSI_HCONF, 0x00);
-}
diff --git a/sys/arch/hp300/dev/sti_dio.c b/sys/arch/hp300/dev/sti_dio.c
deleted file mode 100644
index c2204b6275c..00000000000
--- a/sys/arch/hp300/dev/sti_dio.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/* $OpenBSD: sti_dio.c,v 1.1 2011/08/18 20:02:57 miod Exp $ */
-
-/*
- * Copyright (c) 2005, 2011, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/wscons/wsconsio.h>
-
-#include <dev/ic/stireg.h>
-#include <dev/ic/stivar.h>
-#include <hp300/dev/sti_machdep.h>
-
-#include <uvm/uvm_extern.h>
-
-void sti_dio_attach(struct device *, struct device *, void *);
-int sti_dio_match(struct device *, void *, void *);
-
-struct cfattach sti_dio_ca = {
- sizeof(struct sti_softc), sti_dio_match, sti_dio_attach
-};
-
-extern struct hp300_bus_space_tag hp300_mem_tag;
-
-int
-sti_dio_match(struct device *parent, void *match, void *aux)
-{
- struct dio_attach_args *da = aux;
-
- if (da->da_id != DIO_DEVICE_ID_FRAMEBUFFER ||
- (da->da_secid != DIO_DEVICE_SECID_FB3X2_A &&
- da->da_secid != DIO_DEVICE_SECID_FB3X2_B))
- return (0);
-
- /*
- * If we already probed it successfully as a console device, go ahead,
- * since we will not be able to bus_space_map() again.
- */
- if (da->da_scode == conscode)
- return (1);
-
- return (sti_dio_probe(da->da_scode));
-}
-
-void
-sti_dio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct sti_softc *sc = (void *)self;
- struct dio_attach_args *da = aux;
- bus_addr_t base;
- bus_space_tag_t iot;
- bus_space_handle_t romh;
- u_int romend;
- int i;
-
- /*
- * If we already probed it successfully as a console device, go ahead,
- * since we will not be able to bus_space_map() again.
- */
- if (da->da_scode == conscode) {
- sc->sc_flags |= STI_CONSOLE | STI_ATTACHED;
- sc->sc_rom = &sticn_rom;
- sc->sc_scr = &sticn_scr;
- bcopy(sticn_bases, sc->bases, sizeof(sc->bases));
-
- sti_describe(sc);
- } else {
- base = (bus_addr_t)
- dio_scodetopa(da->da_scode + STI_DIO_SCODE_OFFSET);
- iot = &hp300_mem_tag;
-
- if (bus_space_map(iot, base, PAGE_SIZE, 0, &romh)) {
- printf(": can't map frame buffer");
- return;
- }
-
- /*
- * Compute real PROM size
- */
- romend = sti_rom_size(iot, romh);
-
- bus_space_unmap(iot, romh, PAGE_SIZE);
-
- if (bus_space_map(iot, base, romend, 0, &romh)) {
- printf(": can't map frame buffer");
- return;
- }
-
- sc->bases[0] = romh;
- for (i = 1; i < STI_REGION_MAX; i++)
- sc->bases[i] = base;
-
- if (sti_attach_common(sc, iot, iot, romh,
- STI_CODEBASE_M68K) != 0)
- return;
- }
-
- sti_end_attach(sc);
-}
-
-int
-sti_dio_probe(int scode)
-{
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- int devtype;
- uint span;
-
- iot = &hp300_mem_tag;
-
- /*
- * Sanity checks:
- * these devices provide both a DIO and an STI ROM. We expect the
- * DIO ROM to be a DIO-II ROM (i.e. to be at a DIO-II select code)
- * and report the device as spanning at least four select codes.
- */
-
- if (!DIO_ISDIOII(scode))
- return 0;
-
- if (bus_space_map(iot, (bus_addr_t)dio_scodetopa(scode),
- PAGE_SIZE, 0, &ioh))
- return 0;
- span = bus_space_read_1(iot, ioh, DIOII_SIZEOFF);
- bus_space_unmap(iot, ioh, PAGE_SIZE);
-
- if (span < STI_DIO_SIZE - 1)
- return 0;
-
- if (bus_space_map(iot,
- (bus_addr_t)dio_scodetopa(scode + STI_DIO_SCODE_OFFSET),
- PAGE_SIZE, 0, &ioh))
- return 0;
- devtype = bus_space_read_1(iot, ioh, 3);
- bus_space_unmap(iot, ioh, PAGE_SIZE);
-
- if (devtype != STI_DEVTYPE1 && devtype != STI_DEVTYPE4)
- return 0;
-
- return 1;
-}
diff --git a/sys/arch/hp300/dev/sti_machdep.c b/sys/arch/hp300/dev/sti_machdep.c
deleted file mode 100644
index 7f454f4b481..00000000000
--- a/sys/arch/hp300/dev/sti_machdep.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* $OpenBSD: sti_machdep.c,v 1.1 2011/08/18 20:02:57 miod Exp $ */
-
-/*
- * Copyright (c) 2005, 2011, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/sgcvar.h>
-
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/wscons/wsconsio.h>
-
-#include <dev/ic/stireg.h>
-#include <dev/ic/stivar.h>
-#include <hp300/dev/sti_machdep.h>
-
-extern struct hp300_bus_space_tag hp300_mem_tag;
-
-/* Console data */
-struct sti_rom sticn_rom;
-struct sti_screen sticn_scr;
-bus_addr_t sticn_bases[STI_REGION_MAX];
-
-void
-sticninit()
-{
- bus_space_tag_t iot;
- bus_addr_t base;
- int i;
-
- /*
- * We are not interested by the *first* console pass.
- */
- if (consolepass == 0)
- return;
-
- iot = &hp300_mem_tag;
- if (conscode >= SGC_SLOT_TO_CONSCODE(0))
- base = (bus_addr_t)sgc_slottopa(CONSCODE_TO_SGC_SLOT(conscode));
- else
- base =
- (bus_addr_t)dio_scodetopa(conscode + STI_DIO_SCODE_OFFSET);
-
- /* sticn_bases[0] will be fixed in sti_cnattach() */
- for (i = 0; i < STI_REGION_MAX; i++)
- sticn_bases[i] = base;
-
- sti_cnattach(&sticn_rom, &sticn_scr, iot, sticn_bases,
- STI_CODEBASE_M68K);
-
- /*
- * Since the copyright notice could not be displayed before,
- * display it again now.
- */
- printf("%s\n", copyright);
-}
diff --git a/sys/arch/hp300/dev/sti_machdep.h b/sys/arch/hp300/dev/sti_machdep.h
deleted file mode 100644
index c30770fe7cf..00000000000
--- a/sys/arch/hp300/dev/sti_machdep.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* $OpenBSD: sti_machdep.h,v 1.2 2013/01/01 17:17:44 miod Exp $ */
-
-/*
- * Copyright (c) 2005, 2011, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#ifndef _STANDALONE
-/* Console data */
-extern struct sti_rom sticn_rom;
-extern struct sti_screen sticn_scr;
-extern bus_addr_t sticn_bases[STI_REGION_MAX];
-
-void sticninit(void);
-int sti_dio_probe(int);
-int sti_sgc_probe(bus_space_tag_t, int);
-#endif
-
-/* DIO attachment defines */
-#define STI_DIO_SCODE_OFFSET 0x02 /* offset to SGC rom, in select codes */
-#define STI_DIO_SIZE 0x10 /* expected total device size
- in DIO-II size units */
diff --git a/sys/arch/hp300/dev/sti_sgc.c b/sys/arch/hp300/dev/sti_sgc.c
deleted file mode 100644
index 2bfbba78dda..00000000000
--- a/sys/arch/hp300/dev/sti_sgc.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/* $OpenBSD: sti_sgc.c,v 1.16 2011/08/18 20:02:57 miod Exp $ */
-
-/*
- * Copyright (c) 2005, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-
-#include <hp300/dev/sgcreg.h>
-#include <hp300/dev/sgcvar.h>
-
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/wscons/wsconsio.h>
-
-#include <dev/ic/stireg.h>
-#include <dev/ic/stivar.h>
-#include <hp300/dev/sti_machdep.h>
-
-#include <uvm/uvm_extern.h>
-
-void sti_sgc_attach(struct device *, struct device *, void *);
-int sti_sgc_match(struct device *, void *, void *);
-
-struct cfattach sti_sgc_ca = {
- sizeof(struct sti_softc), sti_sgc_match, sti_sgc_attach
-};
-
-int
-sti_sgc_match(struct device *parent, void *match, void *aux)
-{
- struct sgc_attach_args *saa = aux;
-
- /*
- * If we already probed it successfully as a console device, go ahead,
- * since we will not be able to bus_space_map() again.
- */
- if (SGC_SLOT_TO_CONSCODE(saa->saa_slot) == conscode)
- return (1);
-
- return (sti_sgc_probe(saa->saa_iot, saa->saa_slot));
-}
-
-void
-sti_sgc_attach(struct device *parent, struct device *self, void *aux)
-{
- struct sti_softc *sc = (void *)self;
- struct sgc_attach_args *saa = aux;
- bus_addr_t base;
- bus_space_handle_t romh;
- u_int romend;
- int i;
-
- /*
- * If we already probed it successfully as a console device, go ahead,
- * since we will not be able to bus_space_map() again.
- */
- if (SGC_SLOT_TO_CONSCODE(saa->saa_slot) == conscode) {
- sc->sc_flags |= STI_CONSOLE | STI_ATTACHED;
- sc->sc_rom = &sticn_rom;
- sc->sc_scr = &sticn_scr;
- bcopy(sticn_bases, sc->bases, sizeof(sc->bases));
-
- sti_describe(sc);
- } else {
- base = (bus_addr_t)sgc_slottopa(saa->saa_slot);
-
- if (bus_space_map(saa->saa_iot, base, PAGE_SIZE, 0, &romh)) {
- printf(": can't map frame buffer");
- return;
- }
-
- /*
- * Compute real PROM size
- */
- romend = sti_rom_size(saa->saa_iot, romh);
-
- bus_space_unmap(saa->saa_iot, romh, PAGE_SIZE);
-
- if (bus_space_map(saa->saa_iot, base, romend, 0, &romh)) {
- printf(": can't map frame buffer");
- return;
- }
-
- sc->bases[0] = romh;
- for (i = 1; i < STI_REGION_MAX; i++)
- sc->bases[i] = base;
-
- if (sti_attach_common(sc, saa->saa_iot, saa->saa_iot, romh,
- STI_CODEBASE_M68K) != 0)
- return;
- }
-
- sti_end_attach(sc);
-}
-
-int
-sti_sgc_probe(bus_space_tag_t iot, int slot)
-{
- bus_space_handle_t ioh;
- int devtype;
-
- if (bus_space_map(iot, (bus_addr_t)sgc_slottopa(slot),
- PAGE_SIZE, 0, &ioh))
- return (0);
-
- devtype = bus_space_read_1(iot, ioh, 3);
-
- bus_space_unmap(iot, ioh, PAGE_SIZE);
-
- /*
- * This might not be reliable enough. On the other hand, non-STI
- * SGC cards will apparently not initialize in an hp300, to the
- * point of not even answering bus probes (checked with an
- * Harmony/FDDI SGC card).
- */
- if (devtype != STI_DEVTYPE1 && devtype != STI_DEVTYPE4)
- return (0);
-
- return (1);
-}
diff --git a/sys/arch/hp300/dev/topcat.c b/sys/arch/hp300/dev/topcat.c
deleted file mode 100644
index ce23ed7724c..00000000000
--- a/sys/arch/hp300/dev/topcat.c
+++ /dev/null
@@ -1,522 +0,0 @@
-/* $OpenBSD: topcat.c,v 1.18 2013/10/21 10:36:13 miod Exp $ */
-
-/*
- * Copyright (c) 2005, Miodrag Vallat.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-/*
- * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_tc.c 1.20 93/08/13$
- *
- * @(#)grf_tc.c 8.4 (Berkeley) 1/12/94
- */
-
-/*
- * Graphics routines for TOPCAT, CATSEYE and KATHMANDU frame buffers
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/proc.h>
-#include <sys/ioctl.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-#include <hp300/dev/intiovar.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/rasops/rasops.h>
-
-#include <hp300/dev/diofbreg.h>
-#include <hp300/dev/diofbvar.h>
-#include <hp300/dev/topcatreg.h>
-
-struct topcat_softc {
- struct device sc_dev;
- struct diofb *sc_fb;
- struct diofb sc_fb_store;
- int sc_scode;
-};
-
-int topcat_dio_match(struct device *, void *, void *);
-void topcat_dio_attach(struct device *, struct device *, void *);
-int topcat_intio_match(struct device *, void *, void *);
-void topcat_intio_attach(struct device *, struct device *, void *);
-
-struct cfattach topcat_dio_ca = {
- sizeof(struct topcat_softc), topcat_dio_match, topcat_dio_attach
-};
-
-struct cfattach topcat_intio_ca = {
- sizeof(struct topcat_softc), topcat_intio_match, topcat_intio_attach
-};
-
-struct cfdriver topcat_cd = {
- NULL, "topcat", DV_DULL
-};
-
-void topcat_end_attach(struct topcat_softc *, u_int8_t);
-int topcat_reset(struct diofb *, int, struct diofbreg *);
-void topcat_restore(struct diofb *);
-int topcat_setcmap(struct diofb *, struct wsdisplay_cmap *);
-void topcat_setcolor(struct diofb *, u_int);
-int topcat_windowmove(struct diofb *, u_int16_t, u_int16_t, u_int16_t,
- u_int16_t, u_int16_t, u_int16_t, int16_t, int16_t);
-
-int topcat_ioctl(void *, u_long, caddr_t, int, struct proc *);
-void topcat_burner(void *, u_int, u_int);
-
-struct wsdisplay_accessops topcat_accessops = {
- .ioctl = topcat_ioctl,
- .mmap = diofb_mmap,
- .alloc_screen = diofb_alloc_screen,
- .free_screen = diofb_free_screen,
- .show_screen = diofb_show_screen,
- .load_font = diofb_load_font,
- .list_font = diofb_list_font,
- .burn_screen = topcat_burner
-};
-
-/*
- * Attachment glue
- */
-
-int
-topcat_intio_match(struct device *parent, void *match, void *aux)
-{
- struct intio_attach_args *ia = aux;
- struct diofbreg *fbr;
-
- fbr = (struct diofbreg *)IIOV(GRFIADDR);
-
- if (badaddr((caddr_t)fbr))
- return (0);
-
- if (fbr->id == GRFHWID) {
- switch (fbr->fbid) {
- case GID_TOPCAT:
- case GID_LRCATSEYE:
- case GID_HRCCATSEYE:
- case GID_HRMCATSEYE:
-#if 0
- case GID_XXXCATSEYE:
-#endif
- ia->ia_addr = (caddr_t)GRFIADDR;
- return (1);
- }
- }
-
- return (0);
-}
-
-void
-topcat_intio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct topcat_softc *sc = (struct topcat_softc *)self;
- struct diofbreg *fbr;
-
- fbr = (struct diofbreg *)IIOV(GRFIADDR);
- sc->sc_scode = CONSCODE_INTERNAL;
-
- if (sc->sc_scode == conscode) {
- sc->sc_fb = &diofb_cn;
- } else {
- sc->sc_fb = &sc->sc_fb_store;
- topcat_reset(sc->sc_fb, sc->sc_scode, fbr);
- }
-
- topcat_end_attach(sc, fbr->fbid);
-}
-
-int
-topcat_dio_match(struct device *parent, void *match, void *aux)
-{
- struct dio_attach_args *da = aux;
-
- if (da->da_id == DIO_DEVICE_ID_FRAMEBUFFER) {
- switch (da->da_secid) {
- case DIO_DEVICE_SECID_TOPCAT:
- case DIO_DEVICE_SECID_LRCATSEYE:
- case DIO_DEVICE_SECID_HRCCATSEYE:
- case DIO_DEVICE_SECID_HRMCATSEYE:
-#if 0
- case DIO_DEVICE_SECID_XXXCATSEYE:
-#endif
- return (1);
- }
- }
-
- return (0);
-}
-
-void
-topcat_dio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct topcat_softc *sc = (struct topcat_softc *)self;
- struct dio_attach_args *da = aux;
- struct diofbreg *fbr;
-
- sc->sc_scode = da->da_scode;
- if (sc->sc_scode == conscode) {
- fbr = (struct diofbreg *)conaddr; /* already mapped */
- sc->sc_fb = &diofb_cn;
- } else {
- sc->sc_fb = &sc->sc_fb_store;
- fbr = (struct diofbreg *)
- iomap(dio_scodetopa(sc->sc_scode), da->da_size);
- if (fbr == NULL ||
- topcat_reset(sc->sc_fb, sc->sc_scode, fbr) != 0) {
- printf(": can't map framebuffer\n");
- return;
- }
- }
-
- topcat_end_attach(sc, fbr->fbid);
-}
-
-void
-topcat_end_attach(struct topcat_softc *sc, u_int8_t id)
-{
- const char *fbname = "unknown";
-
- switch (id) {
- case GID_TOPCAT:
- switch (sc->sc_fb->planes) {
- case 1:
- if (sc->sc_fb->dheight == 400)
- fbname = "HP98542 topcat";
- else
- fbname = "HP98544 topcat";
- break;
- case 4:
- if (sc->sc_fb->dheight == 400)
- fbname = "HP98543 topcat";
- else
- fbname = "HP98545 topcat";
- break;
- case 6:
- fbname = "HP98547 topcat";
- break;
- }
- break;
- case GID_HRCCATSEYE:
- fbname = "HP98550 catseye"; /* also A1416 kathmandu */
- break;
- case GID_LRCATSEYE:
- fbname = "HP98549 catseye";
- break;
- case GID_HRMCATSEYE:
- fbname = "HP98548 catseye";
- break;
- }
-
- diofb_end_attach(sc, &topcat_accessops, sc->sc_fb,
- sc->sc_scode == conscode, fbname);
-}
-
-/*
- * Initialize hardware and display routines.
- */
-int
-topcat_reset(struct diofb *fb, int scode, struct diofbreg *fbr)
-{
- volatile struct tcboxfb *tc = (struct tcboxfb *)fbr;
- int rc;
- u_int i;
-
- if ((rc = diofb_fbinquire(fb, scode, fbr)) != 0)
- return (rc);
-
- /*
- * If we could not get a valid number of planes, determine it
- * by writing to the first frame buffer display location,
- * then reading it back.
- */
- if (fb->planes == 0) {
- volatile u_int8_t *fbp;
- u_int8_t save;
-
- fbp = (u_int8_t *)fb->fbkva;
- tc->fben = ~0;
- tc->wen = ~0;
- tc->ren = ~0;
- tc->prr = RR_COPY;
- save = *fbp;
- *fbp = 0xff;
- fb->planemask = *fbp;
- *fbp = save;
-
- for (fb->planes = 1; fb->planemask >= (1 << fb->planes);
- fb->planes++);
- if (fb->planes > 8)
- fb->planes = 8;
- fb->planemask = (1 << fb->planes) - 1;
- }
-
- fb->bmv = topcat_windowmove;
- topcat_restore(fb);
- diofb_fbsetup(fb);
- for (i = 0; i <= fb->planemask; i++)
- topcat_setcolor(fb, i);
-
- return (0);
-}
-
-void
-topcat_restore(struct diofb *fb)
-{
- volatile struct tcboxfb *tc = (struct tcboxfb *)fb->regkva;
-
- /*
- * Catseye looks a lot like a topcat, but not completely.
- * So, we set some bits to make it work.
- */
- if (tc->regs.fbid != GID_TOPCAT) {
- while ((tc->catseye_status & 1))
- ;
- tc->catseye_status = 0x0;
- tc->vb_select = 0x0;
- tc->tcntrl = 0x0;
- tc->acntrl = 0x0;
- tc->pncntrl = 0x0;
- tc->rug_cmdstat = 0x90;
- }
-
- /*
- * Enable reading/writing of all the planes.
- */
- tc->fben = fb->planemask;
- tc->wen = fb->planemask;
- tc->ren = fb->planemask;
- tc->prr = RR_COPY;
-
- /* Enable display */
- tc->nblank = 0xff;
-}
-
-int
-topcat_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p)
-{
- struct diofb *fb = v;
- struct wsdisplay_fbinfo *wdf;
- u_int i;
-
- switch (cmd) {
- case WSDISPLAYIO_GTYPE:
- *(u_int *)data = WSDISPLAY_TYPE_TOPCAT;
- break;
- case WSDISPLAYIO_SMODE:
- fb->mapmode = *(u_int *)data;
- if (fb->mapmode == WSDISPLAYIO_MODE_EMUL) {
- topcat_restore(fb);
- for (i = 0; i <= fb->planemask; i++)
- topcat_setcolor(fb, i);
- }
- break;
- case WSDISPLAYIO_GINFO:
- wdf = (void *)data;
- wdf->width = fb->ri.ri_width;
- wdf->height = fb->ri.ri_height;
- wdf->depth = fb->ri.ri_depth;
- wdf->cmsize = 1 << fb->planes;
- break;
- case WSDISPLAYIO_LINEBYTES:
- *(u_int *)data = fb->ri.ri_stride;
- break;
- case WSDISPLAYIO_GETCMAP:
- return (diofb_getcmap(fb, (struct wsdisplay_cmap *)data));
- case WSDISPLAYIO_PUTCMAP:
- return (topcat_setcmap(fb, (struct wsdisplay_cmap *)data));
- case WSDISPLAYIO_GVIDEO:
- case WSDISPLAYIO_SVIDEO:
- break;
- default:
- return (-1);
- }
-
- return (0);
-}
-
-void
-topcat_burner(void *v, u_int on, u_int flags)
-{
- struct diofb *fb = v;
- volatile struct tcboxfb *tc = (struct tcboxfb *)fb->regkva;
-
- if (on) {
- tc->nblank = 0xff;
- } else {
- tc->nblank = 0;
- }
-}
-
-void
-topcat_setcolor(struct diofb *fb, u_int index)
-{
- volatile struct tcboxfb *tc = (struct tcboxfb *)fb->regkva;
-
- /* Monochrome topcat may not have the colormap logic present */
- if (fb->planes <= 1)
- return;
-
- if (tc->regs.fbid != GID_TOPCAT) {
- tccm_waitbusy(tc);
- tc->plane_mask = 0xff;
- tc->cindex = ~index;
- tc->rdata = fb->cmap.r[index];
- tc->gdata = fb->cmap.g[index];
- tc->bdata = fb->cmap.b[index];
- tc->strobe = 0xff;
-
- tccm_waitbusy(tc);
- tc->cindex = 0;
- } else {
- tccm_waitbusy(tc);
- tc->plane_mask = 0xff;
- tc->rdata = fb->cmap.r[index];
- tc->gdata = fb->cmap.g[index];
- tc->bdata = fb->cmap.b[index];
- tc->cindex = ~index;
- tc->strobe = 0xff;
-
- tccm_waitbusy(tc);
- tc->rdata = 0;
- tc->gdata = 0;
- tc->bdata = 0;
- tc->cindex = 0;
- }
-}
-
-int
-topcat_setcmap(struct diofb *fb, struct wsdisplay_cmap *cm)
-{
- u_int8_t r[256], g[256], b[256];
- u_int index = cm->index, count = cm->count;
- u_int colcount = 1 << fb->planes;
- int error;
-
- if (index >= colcount || count > colcount - index)
- return (EINVAL);
-
- if ((error = copyin(cm->red, r, count)) != 0)
- return (error);
- if ((error = copyin(cm->green, g, count)) != 0)
- return (error);
- if ((error = copyin(cm->blue, b, count)) != 0)
- return (error);
-
- bcopy(r, fb->cmap.r + index, count);
- bcopy(g, fb->cmap.g + index, count);
- bcopy(b, fb->cmap.b + index, count);
-
- while (count-- != 0)
- topcat_setcolor(fb, index++);
-
- return (0);
-}
-
-/*
- * Accelerated routines
- */
-
-int
-topcat_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy,
- u_int16_t dx, u_int16_t dy, u_int16_t cx, u_int16_t cy, int16_t rop,
- int16_t planemask)
-{
- volatile struct tcboxfb *tc = (struct tcboxfb *)fb->regkva;
-
- tc_waitbusy(tc, fb->planemask);
-
- tc->wen = planemask;
- tc->wmrr = rop;
- if (planemask != 0xff) {
- tc->wen = planemask ^ 0xff;
- tc->wmrr = rop ^ 0x0f;
- tc->wen = fb->planemask;
- }
- tc->source_y = sy;
- tc->source_x = sx;
- tc->dest_y = dy;
- tc->dest_x = dx;
- tc->wheight = cy;
- tc->wwidth = cx;
- tc->wmove = fb->planemask;
-
- tc_waitbusy(tc, fb->planemask);
-
- return (0);
-}
-
-/*
- * Topcat/catseye console support
- */
-
-void
-topcatcninit()
-{
- topcat_reset(&diofb_cn, conscode, (struct diofbreg *)conaddr);
- diofb_cnattach(&diofb_cn);
-}
diff --git a/sys/arch/hp300/dev/topcatreg.h b/sys/arch/hp300/dev/topcatreg.h
deleted file mode 100644
index 76fd18f3887..00000000000
--- a/sys/arch/hp300/dev/topcatreg.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/* $OpenBSD: topcatreg.h,v 1.3 2013/02/02 13:34:29 miod Exp $ */
-/* $NetBSD: grf_tcreg.h,v 1.6 1994/10/26 07:24:06 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_tcreg.h 1.11 92/01/21$
- *
- * @(#)grf_tcreg.h 8.1 (Berkeley) 6/10/93
- */
-
-#define tccm_waitbusy(regaddr) \
-do { \
- while (((volatile struct tcboxfb *)(regaddr))->cmap_busy & 0x04) \
- DELAY(10); \
-} while (0)
-
-#define tc_waitbusy(regaddr,planes) \
-do { \
- while (((volatile struct tcboxfb *)(regaddr))->busy & planes) \
- DELAY(10); \
-} while (0)
-
-struct tcboxfb {
- struct diofbreg regs;
- u_int8_t f2[0x4040-0x5f-1];
- u_int8_t vblank; /* vertical blanking 0x4040 */
- u_int8_t :8,:8,:8;
- u_int8_t busy; /* window move active 0x4044 */
- u_int8_t :8,:8,:8;
- u_int8_t vtrace_request; /* vert retrace intr request 0x4048 */
- u_int8_t :8,:8,:8;
- u_int8_t move_request; /* window move intr request 0x404C */
- u_int8_t f3[0x4080-0x404c-1];
- u_int8_t nblank; /* display enable planes 0x4080 */
- u_int8_t f4[0x4088-0x4080-1];
- u_int8_t wen; /* write enable plane 0x4088 */
- u_int8_t f5[0x408c-0x4088-1];
- u_int8_t ren; /* read enable plane 0x408c */
- u_int8_t f6[0x4090-0x408c-1];
- u_int8_t fben; /* frame buffer write enable 0x4090 */
- u_int8_t f7[0x409c-0x4090-1];
- u_int8_t wmove; /* start window move 0x409c */
- u_int8_t f8[0x40a0-0x409c-1];
- u_int8_t blink; /* enable blink planes 0x40a0 */
- u_int8_t f9[0x40a8-0x40a0-1];
- u_int8_t altframe; /* enable alternate frame 0x40a8 */
- u_int8_t f10[0x40ac-0x40a8-1];
- u_int8_t curon; /* cursor control register 0x40ac */
- u_int8_t f11[0x40ea-0x40ac-1];
- u_int8_t prr; /* pixel replacement rule 0x40ea */
- u_int8_t f12[0x40ef-0x40ea-1];
- u_int8_t wmrr; /* move replacement rule 0x40ef */
- u_int8_t f13[0x40f2-0x40ef-1];
- u_int16_t source_x; /* source x pixel # 0x40f2 */
- u_int8_t f14[0x40f6-0x40f2-2];
- u_int16_t source_y; /* source y pixel # 0x40f6 */
- u_int8_t f15[0x40fa-0x40f6-2];
- u_int16_t dest_x; /* dest x pixel # 0x40fa */
- u_int8_t f16[0x40fe -0x40fa-2];
- u_int16_t dest_y; /* dest y pixel # 0x40fe */
- u_int8_t f17[0x4102-0x40fe -2];
- u_int16_t wwidth; /* block mover pixel width 0x4102 */
- u_int8_t f18[0x4106-0x4102-2];
- u_int16_t wheight; /* block mover pixel height 0x4106 */
- /* Catseye */
- u_int8_t f19[0x4206-0x4106-2];
- u_int16_t rug_cmdstat; /* RUG Command/Staus 0x4206 */
- u_int8_t f20[0x4510-0x4206-2];
- u_int16_t vb_select; /* Vector/BitBlt Select 0x4510 */
- u_int16_t tcntrl; /* Three Operand Control 0x4512 */
- u_int16_t acntrl; /* BitBlt Mode 0x4514 */
- u_int16_t pncntrl; /* Plane Control 0x4516 */
- u_int8_t f21[0x4800-0x4516-2];
- u_int16_t catseye_status; /* Catseye Status 0x4800 */
- /* End of Catseye */
- u_int8_t f22[0x6002-0x4800-2];
- u_int16_t cmap_busy; /* Color Ram busy 0x6002 */
- u_int8_t f23[0x60b2-0x6002-2];
- u_int16_t rdata; /* color map red data 0x60b2 */
- u_int16_t gdata; /* color map green data 0x60b4 */
- u_int16_t bdata; /* color map blue data 0x60b6 */
- u_int16_t cindex; /* color map index 0x60b8 */
- u_int16_t plane_mask; /* plane mask select 0x60ba */
- u_int8_t f24[0x60f0-0x60ba-2];
- u_int16_t strobe; /* color map trigger 0x60f0 */
-} __packed;
diff --git a/sys/arch/hp300/dev/tvrx.c b/sys/arch/hp300/dev/tvrx.c
deleted file mode 100644
index e441225b104..00000000000
--- a/sys/arch/hp300/dev/tvrx.c
+++ /dev/null
@@ -1,393 +0,0 @@
-/* $OpenBSD: tvrx.c,v 1.4 2013/10/21 10:36:13 miod Exp $ */
-
-/*
- * Copyright (c) 2006, 2011, Miodrag Vallat.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-/*
- * Graphics routines for the ``TigerShark'' PersonalVRX frame buffer,
- * in its non-STI flavour (DIO-II 98702-66501 interface board; the SGC
- * 98705-66582 board is expected to be supported by the sti(4) driver).
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/proc.h>
-#include <sys/ioctl.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-
-#include <dev/cons.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/rasops/rasops.h>
-
-#include <hp300/dev/diofbreg.h>
-#include <hp300/dev/diofbvar.h>
-
-/*
- * Hardware registers
- */
-
-#define TVRX_FV_TRIG 0x5003 /* commit mode settings */
-#define TVRX_DISPLAY_ENABLE 0x500f /* enable display */
-#define TVRX_FB_P_ENABLE 0x5017 /* enable primary fb planes */
-#define TVRX_FB_S_ENABLE 0x501b /* enable secondary fb planes */
-#define TVRX_O_P_ENABLE 0x5023 /* enable primary overlay planes */
-#define TVRX_O_S_ENABLE 0x5027 /* enable secondary overlay planes */
-#define TVRX_WBUSY 0x7047 /* window mover busy */
-#define TVRX_ZHERE 0x7053 /* Z buffer available */
-#define TVRX_FB_WEN 0x7093 /* fb planes write enable */
-#define TVRX_WMOVE 0x709f /* trigger window mover */
-#define TVRX_O_WEN 0x70b7 /* overlay planes write enable */
-#define TVRX_DRIVE 0x70bf /* vram access mode */
-#define DRIVE_OVERLAY_ENABLE 0x10 /* drive vram to overlays */
-#define DRIVE_1BPP 0x80 /* force 1bpp packed memory */
-#define DRIVE_PLANE_MASK 0x0f /* overlay planes read mask */
-#define TVRX_REP_RULE 0x70ef /* window mover replacement rule */
-#define TVRX_ROP(rop) ((rop) << 4 | (rop))
-#define TVRX_SRC_X 0x70f2 /* window mover source position */
-#define TVRX_SRC_Y 0x70f6
-#define TVRX_DST_X 0x70fa /* window mover destination position */
-#define TVRX_DST_Y 0x70fe
-#define TVRX_CNT_X 0x7102 /* window mover span */
-#define TVRX_CNT_Y 0x7106
-
-#define TVRX_CMAP_O_P 0x5203 /* primary overlay colormap (16xRGB) */
-#define TVRX_CMAP_O_S 0x5303 /* secondary overlay colormap */
-#define TVRX_CMAP_FB_P_R 0x5403 /* primary fb colormap, 256xR */
-#define TVRX_CMAP_FB_P_G 0x5803 /* primary fb colormap, 256xG */
-#define TVRX_CMAP_FB_P_B 0x5c03 /* primary fb colormap, 256xB */
-#define TVRX_CMAP_FB_S_R 0x6403 /* secondary fb colormap, 256xR */
-#define TVRX_CMAP_FB_S_G 0x6803 /* secondary fb colormap, 256xG */
-#define TVRX_CMAP_FB_S_B 0x6c03 /* secondary fb colormap, 256xB */
-
-#define tvrx_reg(kva,type,offset) \
- (*(volatile type *)((kva) + (offset)))
-
-/* wait for window mover to become idle */
-#define tvrx_waitbusy(fb) \
-do { \
- while (tvrx_reg((fb)->regkva, uint8_t, TVRX_WBUSY) & 0x01) \
- ; \
-} while (0)
-
-
-struct tvrx_softc {
- struct device sc_dev;
- struct diofb *sc_fb;
- struct diofb sc_fb_store;
-
- int sc_scode;
-};
-
-int tvrx_match(struct device *, void *, void *);
-void tvrx_attach(struct device *, struct device *, void *);
-
-struct cfattach tvrx_ca = {
- sizeof(struct tvrx_softc), tvrx_match, tvrx_attach
-};
-
-struct cfdriver tvrx_cd = {
- NULL, "tvrx", DV_DULL
-};
-
-int tvrx_reset(struct diofb *, int, struct diofbreg *);
-void tvrx_restore(struct diofb *);
-int tvrx_setcmap(struct diofb *, struct wsdisplay_cmap *);
-void tvrx_setcolor(struct diofb *, u_int);
-int tvrx_windowmove(struct diofb *, u_int16_t, u_int16_t, u_int16_t,
- u_int16_t, u_int16_t, u_int16_t, int16_t, int16_t);
-
-int tvrx_ioctl(void *, u_long, caddr_t, int, struct proc *);
-void tvrx_burner(void *, u_int, u_int);
-
-struct wsdisplay_accessops tvrx_accessops = {
- .ioctl = tvrx_ioctl,
- .mmap = diofb_mmap,
- .alloc_screen = diofb_alloc_screen,
- .free_screen = diofb_free_screen,
- .show_screen = diofb_show_screen,
- .load_font = diofb_load_font,
- .list_font = diofb_list_font,
- .burn_screen = tvrx_burner
-};
-
-/*
- * Attachment glue
- */
-
-int
-tvrx_match(struct device *parent, void *match, void *aux)
-{
- struct dio_attach_args *da = aux;
-
- if (da->da_id != DIO_DEVICE_ID_FRAMEBUFFER ||
- da->da_secid != DIO_DEVICE_SECID_TIGERSHARK)
- return (0);
-
- return (1);
-}
-
-void
-tvrx_attach(struct device *parent, struct device *self, void *aux)
-{
- struct tvrx_softc *sc = (struct tvrx_softc *)self;
- struct dio_attach_args *da = aux;
- struct diofbreg *fbr;
-
- sc->sc_scode = da->da_scode;
- if (sc->sc_scode == conscode) {
- fbr = (struct diofbreg *)conaddr; /* already mapped */
- sc->sc_fb = &diofb_cn;
- } else {
- sc->sc_fb = &sc->sc_fb_store;
- fbr = (struct diofbreg *)
- iomap(dio_scodetopa(sc->sc_scode), da->da_size);
- if (fbr == NULL ||
- tvrx_reset(sc->sc_fb, sc->sc_scode, fbr) != 0) {
- printf(": can't map framebuffer\n");
- return;
- }
- }
-
- diofb_end_attach(sc, &tvrx_accessops, sc->sc_fb,
- sc->sc_scode == conscode, NULL);
-}
-
-/*
- * Initialize hardware and display routines.
- */
-int
-tvrx_reset(struct diofb *fb, int scode, struct diofbreg *fbr)
-{
- int rc;
- u_int i;
-
- if ((rc = diofb_fbinquire(fb, scode, fbr)) != 0)
- return (rc);
-
- /* diofb_fbinquire will return 8 (or maybe 16) planes, but we
- only use the 4 overlay planes */
- fb->planes = 4;
- fb->planemask = (1 << 4) - 1;
-
- fb->bmv = tvrx_windowmove;
- tvrx_restore(fb);
- diofb_fbsetup(fb);
- for (i = 0; i <= fb->planemask; i++)
- tvrx_setcolor(fb, i);
-
- return (0);
-}
-
-void
-tvrx_restore(struct diofb *fb)
-{
- volatile struct diofbreg *fbr = (volatile struct diofbreg *)fb->regkva;
-
- /*
- * Resetting the hardware is slow, disables display output, and
- * does not clear video memory. Give it some time before we setup
- * ourselves.
- */
- fbr->id = GRFHWID;
- DELAY(100000);
-
- /* run the overlay planes unpacked... */
- tvrx_reg(fb->regkva, uint8_t, TVRX_DRIVE) =
- DRIVE_OVERLAY_ENABLE | fb->planemask;
- /* ...and enable the four of them */
- tvrx_reg(fb->regkva, uint8_t, TVRX_O_P_ENABLE) = fb->planemask;
- tvrx_reg(fb->regkva, uint8_t, TVRX_O_S_ENABLE) = fb->planemask;
- tvrx_reg(fb->regkva, uint8_t, TVRX_O_WEN) = fb->planemask;
- /* disable fb planes for safety */
- tvrx_reg(fb->regkva, uint8_t, TVRX_FB_P_ENABLE) = 0;
- tvrx_reg(fb->regkva, uint8_t, TVRX_FB_S_ENABLE) = 0;
-
- tvrx_reg(fb->regkva, uint8_t, TVRX_REP_RULE) = TVRX_ROP(RR_COPY);
- tvrx_reg(fb->regkva, uint8_t, TVRX_DISPLAY_ENABLE) = 0x01;
- tvrx_reg(fb->regkva, uint8_t, TVRX_FV_TRIG) = 0x01;
-}
-
-int
-tvrx_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p)
-{
- struct diofb *fb = v;
- struct wsdisplay_fbinfo *wdf;
- u_int i;
-
- switch (cmd) {
- case WSDISPLAYIO_GTYPE:
- *(u_int *)data = WSDISPLAY_TYPE_TVRX;
- break;
- case WSDISPLAYIO_SMODE:
- fb->mapmode = *(u_int *)data;
- if (fb->mapmode == WSDISPLAYIO_MODE_EMUL) {
- tvrx_restore(fb);
- /* clear display */
- (*fb->bmv)(fb, 0, 0, 0, 0, fb->fbwidth, fb->fbheight,
- RR_CLEAR, fb->planemask);
- /* restore colormap */
- diofb_resetcmap(fb);
- for (i = 0; i <= fb->planemask; i++)
- tvrx_setcolor(fb, i);
- }
- break;
- case WSDISPLAYIO_GINFO:
- wdf = (void *)data;
- wdf->width = fb->ri.ri_width;
- wdf->height = fb->ri.ri_height;
- wdf->depth = fb->ri.ri_depth;
- wdf->cmsize = 1 << fb->planes;
- break;
- case WSDISPLAYIO_LINEBYTES:
- *(u_int *)data = fb->ri.ri_stride;
- break;
- case WSDISPLAYIO_GETCMAP:
- return (diofb_getcmap(fb, (struct wsdisplay_cmap *)data));
- case WSDISPLAYIO_PUTCMAP:
- return (tvrx_setcmap(fb, (struct wsdisplay_cmap *)data));
- case WSDISPLAYIO_GVIDEO:
- case WSDISPLAYIO_SVIDEO:
- break;
- default:
- return (-1);
- }
-
- return (0);
-}
-
-void
-tvrx_burner(void *v, u_int on, u_int flags)
-{
- struct diofb *fb = v;
-
- tvrx_reg(fb->regkva, uint8_t, TVRX_DISPLAY_ENABLE) = on ? 0x01 : 0x00;
- tvrx_reg(fb->regkva, uint8_t, TVRX_FV_TRIG) = 0x01;
-}
-
-void
-tvrx_setcolor(struct diofb *fb, u_int index)
-{
- u_int index_scaled = index * 3 * 4;
-
- tvrx_reg(fb->regkva, uint8_t, TVRX_CMAP_O_P + index_scaled) =
- tvrx_reg(fb->regkva, uint8_t, TVRX_CMAP_O_S + index_scaled) =
- fb->cmap.r[index];
- tvrx_reg(fb->regkva, uint8_t, TVRX_CMAP_O_P + 4 + index_scaled) =
- tvrx_reg(fb->regkva, uint8_t, TVRX_CMAP_O_S + 4 + index_scaled) =
- fb->cmap.g[index];
- tvrx_reg(fb->regkva, uint8_t, TVRX_CMAP_O_P + 2 * 4 + index_scaled) =
- tvrx_reg(fb->regkva, uint8_t, TVRX_CMAP_O_S + 2 * 4 + index_scaled) =
- fb->cmap.b[index];
-}
-
-int
-tvrx_setcmap(struct diofb *fb, struct wsdisplay_cmap *cm)
-{
- u_int8_t r[256], g[256], b[256];
- u_int index = cm->index, count = cm->count;
- u_int colcount = 1 << fb->planes;
- int error;
-
- if (index >= colcount || count > colcount - index)
- return (EINVAL);
-
- if ((error = copyin(cm->red, r, count)) != 0)
- return (error);
- if ((error = copyin(cm->green, g, count)) != 0)
- return (error);
- if ((error = copyin(cm->blue, b, count)) != 0)
- return (error);
-
- bcopy(r, fb->cmap.r + index, count);
- bcopy(g, fb->cmap.g + index, count);
- bcopy(b, fb->cmap.b + index, count);
-
- while (count-- != 0)
- tvrx_setcolor(fb, index++);
-
- return (0);
-}
-
-int
-tvrx_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy, u_int16_t dx,
- u_int16_t dy, u_int16_t cx, u_int16_t cy, int16_t rop, int16_t planemask)
-{
-#ifdef TVRX_DEBUG
- printf("%s: %dx%d %dx%d %dx%d rx %x planemask %x\n",
- __func__, fb->sx, sy, dx, dy, cx, cy, rop, planemask);
-#endif
-
- planemask &= fb->planemask;
-
- tvrx_reg(fb->regkva, uint16_t, TVRX_SRC_Y) = sy;
- tvrx_reg(fb->regkva, uint16_t, TVRX_SRC_X) = sx;
- tvrx_reg(fb->regkva, uint16_t, TVRX_DST_Y) = dy;
- tvrx_reg(fb->regkva, uint16_t, TVRX_DST_X) = dx;
- tvrx_reg(fb->regkva, uint16_t, TVRX_CNT_Y) = cy;
- tvrx_reg(fb->regkva, uint16_t, TVRX_CNT_X) = cx;
-
- tvrx_reg(fb->regkva, uint8_t, TVRX_REP_RULE) = TVRX_ROP(rop);
- tvrx_reg(fb->regkva, uint8_t, TVRX_O_WEN) = planemask;
- tvrx_reg(fb->regkva, uint8_t, TVRX_WMOVE) = 1;
- tvrx_waitbusy(fb);
-
- if (planemask != fb->planemask) {
- rop ^= 0x0f;
- planemask ^= fb->planemask;
- tvrx_reg(fb->regkva, uint8_t, TVRX_REP_RULE) = TVRX_ROP(rop);
- tvrx_reg(fb->regkva, uint8_t, TVRX_O_WEN) = planemask;
- tvrx_reg(fb->regkva, uint8_t, TVRX_WMOVE) = 1;
- tvrx_waitbusy(fb);
- }
-
- tvrx_reg(fb->regkva, uint8_t, TVRX_O_WEN) = fb->planemask;
- tvrx_reg(fb->regkva, uint8_t, TVRX_REP_RULE) = TVRX_ROP(RR_COPY);
-
- return 0;
-}
-
-/*
- * Console support
- */
-
-void
-tvrxcninit()
-{
- tvrx_reset(&diofb_cn, conscode, (struct diofbreg *)conaddr);
- diofb_cnattach(&diofb_cn);
-}
diff --git a/sys/arch/hp300/hp300/autoconf.c b/sys/arch/hp300/hp300/autoconf.c
deleted file mode 100644
index e054fb7ab8f..00000000000
--- a/sys/arch/hp300/hp300/autoconf.c
+++ /dev/null
@@ -1,871 +0,0 @@
-/* $OpenBSD: autoconf.c,v 1.49 2010/06/09 15:44:17 miod Exp $ */
-/* $NetBSD: autoconf.c,v 1.45 1999/04/10 17:31:02 kleink Exp $ */
-
-/*
- * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: autoconf.c 1.36 92/12/20$
- *
- * @(#)autoconf.c 8.2 (Berkeley) 1/12/94
- */
-
-/*
- * Setup the system to run on the current machine.
- *
- * cpu_configure() is called at boot time. Available
- * devices are determined (from possibilities mentioned in ioconf.c),
- * and the drivers are initialized.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/disklabel.h>
-#include <sys/malloc.h>
-#include <sys/extent.h>
-#include <sys/mount.h>
-#include <sys/queue.h>
-#include <sys/reboot.h>
-#include <sys/tty.h>
-
-#include <dev/cons.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/vmparam.h>
-#include <machine/cpu.h>
-#include <machine/hp300spu.h>
-#include <machine/intr.h>
-#include <machine/pte.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diodevs.h>
-
-#include <hp300/dev/dmavar.h>
-
-#include <hp300/dev/hpibvar.h>
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-
-#include <uvm/uvm_extern.h>
-
-/*
- * The following several variables are related to
- * the configuration process, and are used in initializing
- * the machine.
- */
-
-struct extent *extio;
-
-extern caddr_t internalhpib;
-extern char *extiobase;
-
-/* The boot device. */
-struct device *bootdv;
-
-/* The device we mount as root. */
-struct device *root_device;
-
-/* How we were booted. */
-u_int bootdev;
-
-/*
- * This information is built during the autoconfig process.
- * A little explanation about the way this works is in order.
- *
- * device_register() links all devices into dev_data_list.
- * If the device is an hpib controller, it is also linked
- * into dev_data_list_hpib. If the device is a scsi controller,
- * it is also linked into dev_data_list_scsi.
- *
- * dev_data_list_hpib and dev_data_list_scsi are sorted
- * by select code, from lowest to highest.
- *
- * After autoconfiguration is complete, we need to determine
- * which device was the boot device. The boot block assigns
- * controller unit numbers in order of select code. Thus,
- * providing the controller is configured in the kernel, we
- * can determine our version of controller unit number from
- * the sorted hpib/scsi list.
- *
- * At this point, we know the controller (device type
- * encoded in bootdev tells us "scsi disk", or "hpib tape",
- * etc.). The next step is to find the device which
- * has the following properties:
- *
- * - A child of the boot controller.
- * - Same slave as encoded in bootdev.
- * - Same physical unit as encoded in bootdev.
- *
- * Later, after we've set the root device in stone, we
- * reverse the process to re-encode bootdev so it can be
- * passed back to the boot block.
- */
-struct dev_data {
- LIST_ENTRY(dev_data) dd_list; /* dev_data_list */
- LIST_ENTRY(dev_data) dd_clist; /* ctlr list */
- struct device *dd_dev; /* device described by this entry */
- int dd_scode; /* select code of device */
- int dd_slave; /* ...or slave */
- int dd_punit; /* and punit... */
-};
-typedef LIST_HEAD(, dev_data) ddlist_t;
-ddlist_t dev_data_list; /* all dev_datas */
-ddlist_t dev_data_list_hpib; /* hpib controller dev_datas */
-ddlist_t dev_data_list_scsi; /* scsi controller dev_datas */
-
-void findbootdev(void);
-void findbootdev_slave(ddlist_t *, int, int, int);
-void setbootdev(void);
-
-static struct dev_data *dev_data_lookup(struct device *);
-static void dev_data_insert(struct dev_data *, ddlist_t *);
-
-static int device_match(struct device *, const char *);
-
-int mainbusmatch(struct device *, void *, void *);
-void mainbusattach(struct device *, struct device *, void *);
-int mainbussearch(struct device *, void *, void *);
-
-struct cfattach mainbus_ca = {
- sizeof(struct device), mainbusmatch, mainbusattach
-};
-
-struct cfdriver mainbus_cd = {
- NULL, "mainbus", DV_DULL
-};
-
-int
-mainbusmatch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- static int mainbus_matched = 0;
-
- /* Allow only one instance. */
- if (mainbus_matched)
- return (0);
-
- mainbus_matched = 1;
- return (1);
-}
-
-void
-mainbusattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
-
- printf("\n");
-
- /* Search for and attach children. */
- config_search(mainbussearch, self, NULL);
-}
-
-int
-mainbussearch(parent, match, aux)
- struct device *parent;
- void *match, *aux;
-{
- struct cfdata *cf = match;
-
- if ((*cf->cf_attach->ca_match)(parent, cf, NULL) > 0)
- config_attach(parent, cf, NULL, NULL);
- return (0);
-}
-
-/*
- * Determine the device configuration for the running system.
- */
-void
-cpu_configure()
-{
- /* this couldn't be done in intr_init() because this uses malloc() */
- softintr_init();
-
- /*
- * Initialize the dev_data_lists.
- */
- LIST_INIT(&dev_data_list);
- LIST_INIT(&dev_data_list_hpib);
- LIST_INIT(&dev_data_list_scsi);
-
- (void)splhigh();
- if (config_rootfound("mainbus", "mainbus") == NULL)
- panic("no mainbus found");
- (void)spl0();
-
- intr_printlevels();
-
- /*
- * Find boot device.
- */
- if ((bootdev & B_MAGICMASK) != B_DEVMAGIC) {
- printf("WARNING: boot program didn't supply boot device.\n");
- printf("Please update your boot program.\n");
- } else {
- findbootdev();
- if (bootdv == NULL) {
- printf("WARNING: can't find match for bootdev:\n");
- printf(
- "type = %d, ctlr = %d, slave = %d, punit = %d, part = %d\n",
- B_TYPE(bootdev), B_ADAPTOR(bootdev),
- B_CONTROLLER(bootdev), B_UNIT(bootdev),
- B_PARTITION(bootdev));
- bootdev = 0; /* invalidate bootdev */
- } else {
- printf("boot device: %s\n", bootdv->dv_xname);
- }
- }
- cold = 0;
-}
-
-void
-diskconf(void)
-{
- int bootpartition = 0;
-
- /*
- * If bootdev is bogus, ask the user anyhow.
- */
- if (bootdev == 0)
- boothowto |= RB_ASKNAME;
- else
- bootpartition = B_PARTITION(bootdev);
-
- /*
- * If we booted from tape, ask the user.
- */
- if (bootdv != NULL && bootdv->dv_class == DV_TAPE)
- boothowto |= RB_ASKNAME;
-
- setroot(bootdv, bootpartition, RB_USERREQ);
- dumpconf();
-
- /*
- * Set bootdev based on the device we booted from.
- * This is given to the boot program when we reboot.
- */
- setbootdev();
-}
-
-/**********************************************************************
- * Code to find and set the boot device
- **********************************************************************/
-
-static int
-device_match(struct device *dv, const char *template)
-{
- return strcmp(dv->dv_cfdata->cf_driver->cd_name, template);
-}
-
-/*
- * Register a device. We're passed the device and the arguments
- * used to attach it. This is used to find the boot device.
- */
-void
-device_register(dev, aux)
- struct device *dev;
- void *aux;
-{
- struct dev_data *dd;
- static int seen_netdevice = 0;
-
- /*
- * Allocate a dev_data structure and fill it in.
- * This means making some tests twice, but we don't
- * care; this doesn't really have to be fast.
- *
- * Note that we only really care about devices that
- * we can mount as root.
- */
- dd = (struct dev_data *)malloc(sizeof(struct dev_data),
- M_DEVBUF, M_NOWAIT | M_ZERO);
- if (dd == NULL)
- panic("device_register: can't allocate dev_data");
-
- dd->dd_dev = dev;
-
- /*
- * BOOTROM and boot program can really only understand
- * using the lowest select code network interface,
- * so we ignore all but the first.
- */
- if (dev->dv_class == DV_IFNET && seen_netdevice == 0) {
- struct dio_attach_args *da = aux;
-
- seen_netdevice = 1;
- dd->dd_scode = da->da_scode;
- goto linkup;
- }
-
- if (device_match(dev, "fhpib") == 0 ||
- device_match(dev, "nhpib") == 0 ||
- device_match(dev, "spc") == 0) {
- struct dio_attach_args *da = aux;
-
- dd->dd_scode = da->da_scode;
- goto linkup;
- }
-
- if (device_match(dev, "hd") == 0) {
- struct hpibbus_attach_args *ha = aux;
-
- dd->dd_slave = ha->ha_slave;
- dd->dd_punit = ha->ha_punit;
- goto linkup;
- }
-
- if (device_match(dev, "cd") == 0 ||
- device_match(dev, "sd") == 0 ||
- device_match(dev, "st") == 0) {
- struct scsi_attach_args *sa = aux;
-
- dd->dd_slave = sa->sa_sc_link->target;
- dd->dd_punit = sa->sa_sc_link->lun;
- goto linkup;
- }
-
- /*
- * Didn't need the dev_data.
- */
- free(dd, M_DEVBUF);
- return;
-
- linkup:
- LIST_INSERT_HEAD(&dev_data_list, dd, dd_list);
-
- if (device_match(dev, "fhpib") == 0 ||
- device_match(dev, "nhpib") == 0) {
- dev_data_insert(dd, &dev_data_list_hpib);
- return;
- }
-
- if (device_match(dev, "spc") == 0) {
- dev_data_insert(dd, &dev_data_list_scsi);
- return;
- }
-}
-
-void
-findbootdev()
-{
- int type, ctlr, slave, punit;
- int scsiboot, hpibboot, netboot;
- struct dev_data *dd;
-
- bootdv = NULL;
-
- if ((bootdev & B_MAGICMASK) != B_DEVMAGIC)
- return;
-
- type = B_TYPE(bootdev);
- ctlr = B_ADAPTOR(bootdev);
- slave = B_CONTROLLER(bootdev);
- punit = B_UNIT(bootdev);
-
- scsiboot = (type == 4); /* sd major */
- hpibboot = (type == 0 || type == 2); /* ct/hd major */
- netboot = (type == 6); /* le - special */
-
- /*
- * Check for network boot first, since it's a little
- * different. The BOOTROM/boot program can only boot
- * off of the first (lowest select code) ethernet
- * device. device_register() knows this and only
- * registers one DV_IFNET. This is a safe assumption
- * since the code that finds devices on the DIO bus
- * always starts at scode 0 and works its way up.
- */
- if (netboot) {
- LIST_FOREACH(dd, &dev_data_list, dd_list) {
- if (dd->dd_dev->dv_class == DV_IFNET) {
- /*
- * Found it!
- */
- bootdv = dd->dd_dev;
- break;
- }
- }
- return;
- }
-
- /*
- * Check for HP-IB boots next.
- */
- if (hpibboot) {
- findbootdev_slave(&dev_data_list_hpib, ctlr,
- slave, punit);
- if (bootdv == NULL)
- return;
-
-#ifdef DIAGNOSTIC
- /*
- * Sanity check.
- */
- if ((type == 0 &&
- device_match(bootdv, "ct")) ||
- (type == 2 &&
- device_match(bootdv, "hd"))) {
- printf("WARNING: boot device/type mismatch!\n");
- printf("device = %s, type = %d\n",
- bootdv->dv_xname, type);
- bootdv = NULL;
- }
-#endif
- return;
- }
-
- /*
- * Check for SCSI boots last.
- */
- if (scsiboot) {
- findbootdev_slave(&dev_data_list_scsi, ctlr,
- slave, punit);
- if (bootdv == NULL)
- return;
-
-#ifdef DIAGNOSTIC
- /*
- * Sanity check.
- */
- if (device_match(bootdv, "cd") != 0 &&
- device_match(bootdv, "sd") != 0 &&
- device_match(bootdv, "st") != 0) {
- printf("WARNING: boot device/type mismatch!\n");
- printf("device = %s, type = %d\n",
- bootdv->dv_xname, type);
- bootdv = NULL;
- }
-#endif
- return;
- }
-
- /* Oof! */
- printf("WARNING: UNKNOWN BOOT DEVICE TYPE = %d\n", type);
-}
-
-void
-findbootdev_slave(ddlist, ctlr, slave, punit)
- ddlist_t *ddlist;
- int ctlr, slave, punit;
-{
- struct dev_data *cdd, *dd;
-
- /*
- * Find the booted controller.
- */
- for (cdd = LIST_FIRST(ddlist); ctlr != 0 && cdd != LIST_END(ddlist);
- cdd = LIST_NEXT(cdd, dd_clist))
- ctlr--;
- if (cdd == NULL) {
- /*
- * Oof, couldn't find it...
- */
- return;
- }
-
- /*
- * Now find the device with the right slave/punit
- * that's a child of the controller.
- */
- LIST_FOREACH(dd, &dev_data_list, dd_list) {
- /*
- * "sd" / "st" / "cd" -> "scsibus" -> "spc"
- * "hd" -> "hpibbus" -> "fhpib"
- */
- if (dd->dd_dev->dv_parent->dv_parent != cdd->dd_dev)
- continue;
-
- if (dd->dd_slave == slave &&
- dd->dd_punit == punit) {
- /*
- * Found it!
- */
- bootdv = dd->dd_dev;
- break;
- }
- }
-}
-
-void
-setbootdev()
-{
- struct dev_data *cdd, *dd;
- int type, ctlr;
-
- /*
- * Note our magic numbers for type:
- *
- * 0 == ct
- * 2 == hd
- * 4 == scsi
- * 6 == le
- *
- * All are bdevsw major numbers, except for le, which
- * is just special. SCSI needs specific care since the
- * ROM wants to see 4, but depending upon the real device
- * we booted from, we might have a different major value.
- */
-
- /*
- * Start with a clean slate.
- */
- bootdev = 0;
-
- /*
- * If we don't have a saveable root_device, just punt.
- */
- if (root_device == NULL)
- goto out;
-
- dd = dev_data_lookup(root_device);
-
- /*
- * If the root device is network, we're done
- * early.
- */
- if (root_device->dv_class == DV_IFNET) {
- bootdev = MAKEBOOTDEV(6, 0, 0, 0, 0);
- goto out;
- }
-
- /*
- * Determine device type.
- */
- if (device_match(root_device, "hd") == 0)
- type = 2;
- else if (device_match(root_device, "cd") == 0 ||
- device_match(root_device, "sd") == 0 ||
- device_match(root_device, "st") == 0)
- /* force scsi disk regardless of the actual device */
- type = 4;
- else {
- printf("WARNING: strange root device!\n");
- goto out;
- }
-
- /*
- * Get parent's info.
- *
- * "hd" -> "hpibbus" -> "fhpib"
- * "sd" / "cd" / "st" -> "scsibus" -> "spc"
- */
- for (cdd = LIST_FIRST(&dev_data_list_hpib), ctlr = 0;
- cdd != LIST_END(&dev_data_list_hpib);
- cdd = LIST_NEXT(cdd, dd_clist), ctlr++) {
- if (cdd->dd_dev == root_device->dv_parent->dv_parent) {
- /*
- * Found it!
- */
- bootdev = MAKEBOOTDEV(type, ctlr, dd->dd_slave,
- dd->dd_punit, DISKPART(rootdev));
- break;
- }
- }
-
- out:
- /* Don't need this anymore. */
- for (dd = LIST_FIRST(&dev_data_list);
- dd != LIST_END(&dev_data_list); ) {
- cdd = dd;
- dd = LIST_NEXT(dd, dd_list);
- free(cdd, M_DEVBUF);
- }
-}
-
-/*
- * Return the dev_data corresponding to the given device.
- */
-static struct dev_data *
-dev_data_lookup(dev)
- struct device *dev;
-{
- struct dev_data *dd;
-
- LIST_FOREACH(dd, &dev_data_list, dd_list)
- if (dd->dd_dev == dev)
- return (dd);
-
- panic("dev_data_lookup");
-}
-
-/*
- * Insert a dev_data into the provided list, sorted by select code.
- */
-static void
-dev_data_insert(dd, ddlist)
- struct dev_data *dd;
- ddlist_t *ddlist;
-{
- struct dev_data *de;
-
-#ifdef DIAGNOSTIC
- if (dd->dd_scode < 0 || dd->dd_scode > 255) {
- panic("bogus select code for %s", dd->dd_dev->dv_xname);
- }
-#endif
-
- /*
- * Just insert at head if list is empty.
- */
- if (LIST_EMPTY(ddlist)) {
- LIST_INSERT_HEAD(ddlist, dd, dd_clist);
- return;
- }
-
- /*
- * Traverse the list looking for a device who's select code
- * is greater than ours. When we find it, insert ourselves
- * into the list before it.
- */
- for (de = LIST_FIRST(ddlist);
- LIST_NEXT(de, dd_clist) != LIST_END(ddlist);
- de = LIST_NEXT(de, dd_clist)) {
- if (de->dd_scode > dd->dd_scode) {
- LIST_INSERT_BEFORE(de, dd, dd_clist);
- return;
- }
- }
-
- /*
- * Our select code is greater than everyone else's. We go
- * onto the end.
- */
- LIST_INSERT_AFTER(de, dd, dd_clist);
-}
-
-/**********************************************************************
- * Code to find and initialize the console
- **********************************************************************/
-
-/*
- * Scan all select codes, passing the corresponding VA to (*func)().
- * (*func)() is a driver-specific routine that looks for the console
- * hardware.
- */
-void
-console_scan(func, arg)
- int (*func)(int, caddr_t, void *);
- void *arg;
-{
- int size, scode, sctop, sctmp;
- caddr_t pa, va;
-
- /*
- * Scan all select codes. Check each location for some
- * hardware. If there's something there, call (*func)().
- */
- sctop = DIO_SCMAX(machineid);
- for (scode = 0; scode < sctop; scode++) {
- /*
- * Skip over the select code hole and
- * the internal HP-IB controller.
- */
- if ((sctmp = dio_inhole(scode)) != 0) {
- scode = sctmp - 1;
- continue;
- }
- if (scode == 7 && internalhpib)
- continue;
-
- /* Map current PA. */
- pa = dio_scodetopa(scode);
- va = iomap(pa, PAGE_SIZE);
- if (va == NULL)
- continue;
-
- /* Check to see if hardware exists. */
- if (badaddr(va)) {
- iounmap(va, PAGE_SIZE);
- continue;
- }
-
- /*
- * Hardware present, call callback. Driver returns
- * size of region to map if console probe successful
- * and worthwhile.
- */
- size = (*func)(scode, va, arg);
- iounmap(va, PAGE_SIZE);
- if (size != 0 && conscode == scode) {
- /* Free last mapping. */
- if (convasize)
- iounmap(conaddr, convasize);
- convasize = 0;
-
- /* Remap to correct size. */
- va = iomap(pa, size);
- if (va == NULL)
- continue;
-
- /* Save this state for next time. */
- conaddr = va;
- convasize = size;
- }
- }
-}
-
-int consolepass = -1;
-struct consdev *cn_tab;
-
-/*
- * Special version of cninit(). Actually, crippled somewhat.
- * This version lets the drivers assign cn_tab.
- */
-void
-hp300_cninit(void)
-{
- struct consdev *cp;
- extern struct consdev constab[];
-
- if (++consolepass == 0) {
- cn_tab = NULL;
-
- /*
- * Call all of the console probe functions.
- */
- for (cp = constab; cp->cn_probe; cp++)
- (*cp->cn_probe)(cp);
- }
-
- /*
- * No console, we can handle it.
- */
- if (cn_tab == NULL)
- return;
-
- /*
- * Turn on the console.
- *
- * Note that we need to check for cn_init because DIO frame buffers
- * will cause cn_tab to switch to wsdisplaycons, which does not
- * have an cn_init function.
- */
- if (cn_tab->cn_init != NULL) {
- (*cn_tab->cn_init)(cn_tab);
- }
-}
-
-/**********************************************************************
- * Mapping functions
- **********************************************************************/
-
-/*
- * Allocate/deallocate a cache-inhibited range of kernel virtual address
- * space mapping the indicated physical address range [pa - pa+size)
- */
-caddr_t
-iomap(pa, size)
- caddr_t pa;
- int size;
-{
- vaddr_t iova, tva, off;
- paddr_t ppa;
- int error;
-
- if (size <= 0)
- return NULL;
-
- ppa = trunc_page((paddr_t)pa);
- off = (paddr_t)pa & PAGE_MASK;
- size = round_page(off + size);
-
- error = extent_alloc(extio, size, PAGE_SIZE, 0, EX_NOBOUNDARY,
- EX_NOWAIT | EX_MALLOCOK, &iova);
-
- if (error != 0)
- return (NULL);
-
- tva = iova;
- while (size != 0) {
- pmap_kenter_cache(tva, ppa, PG_RW | PG_CI);
- size -= PAGE_SIZE;
- tva += PAGE_SIZE;
- ppa += PAGE_SIZE;
- }
- pmap_update(pmap_kernel());
- return ((void *)(iova + off));
-}
-
-/*
- * Unmap a previously mapped device.
- */
-void
-iounmap(va, size)
- caddr_t va;
- int size;
-{
- vaddr_t kva, off;
- int error;
-
- off = (vaddr_t)va & PAGE_MASK;
- kva = trunc_page((vaddr_t)va);
- size = round_page(off + size);
-
- pmap_kremove(kva, size);
- pmap_update(pmap_kernel());
-
- error = extent_free(extio, kva, size, EX_NOWAIT);
-#ifdef DIAGNOSTIC
- if (error != 0)
- printf("iounmap: extent_free failed\n");
-#endif
-}
-
-struct nam2blk nam2blk[] = {
- { "ct", 0 },
- { "hd", 2 },
- { "sd", 4 },
- { "st", 7 },
- { "rd", 8 },
- { "cd", 9 },
- { "vnd", 6 },
- { NULL, -1 }
-};
diff --git a/sys/arch/hp300/hp300/bus_space.c b/sys/arch/hp300/hp300/bus_space.c
deleted file mode 100644
index 194194d175d..00000000000
--- a/sys/arch/hp300/hp300/bus_space.c
+++ /dev/null
@@ -1,714 +0,0 @@
-/* $OpenBSD: bus_space.c,v 1.8 2013/02/02 13:34:29 miod Exp $ */
-/* $NetBSD: bus_space.c,v 1.6 2002/09/27 15:36:02 provos Exp $ */
-
-/*-
- * Copyright (c) 1998 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Implementation of bus_space mapping for the hp300.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/extent.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-
-#include <uvm/uvm_extern.h>
-
-#ifdef DIAGNOSTIC
-extern char *extiobase;
-#endif
-extern struct extent *extio;
-
-/*
- * Memory mapped devices (intio, dio and sgc)
- */
-
-int hp300_mem_map(bus_addr_t, bus_size_t, int, bus_space_handle_t *);
-void hp300_mem_unmap(bus_space_handle_t, bus_size_t);
-int hp300_mem_subregion(bus_space_handle_t, bus_size_t, bus_size_t,
- bus_space_handle_t *);
-void * hp300_mem_vaddr(bus_space_handle_t);
-
-u_int8_t hp300_mem_bsr1(bus_space_handle_t, bus_size_t);
-u_int16_t hp300_mem_bsr2(bus_space_handle_t, bus_size_t);
-u_int32_t hp300_mem_bsr4(bus_space_handle_t, bus_size_t);
-void hp300_mem_bsrm1(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
-void hp300_mem_bsrm2(bus_space_handle_t, bus_size_t, u_int16_t *, size_t);
-void hp300_mem_bsrm4(bus_space_handle_t, bus_size_t, u_int32_t *, size_t);
-void hp300_mem_bsrrm2(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
-void hp300_mem_bsrrm4(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
-void hp300_mem_bsrr1(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
-void hp300_mem_bsrr2(bus_space_handle_t, bus_size_t, u_int16_t *, size_t);
-void hp300_mem_bsrr4(bus_space_handle_t, bus_size_t, u_int32_t *, size_t);
-void hp300_mem_bsrrr2(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
-void hp300_mem_bsrrr4(bus_space_handle_t, bus_size_t, u_int8_t *, size_t);
-void hp300_mem_bsw1(bus_space_handle_t, bus_size_t, u_int8_t);
-void hp300_mem_bsw2(bus_space_handle_t, bus_size_t, u_int16_t);
-void hp300_mem_bsw4(bus_space_handle_t, bus_size_t, u_int32_t);
-void hp300_mem_bswm1(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
-void hp300_mem_bswm2(bus_space_handle_t, bus_size_t, const u_int16_t *, size_t);
-void hp300_mem_bswm4(bus_space_handle_t, bus_size_t, const u_int32_t *, size_t);
-void hp300_mem_bswrm2(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
-void hp300_mem_bswrm4(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
-void hp300_mem_bswr1(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
-void hp300_mem_bswr2(bus_space_handle_t, bus_size_t, const u_int16_t *, size_t);
-void hp300_mem_bswr4(bus_space_handle_t, bus_size_t, const u_int32_t *, size_t);
-void hp300_mem_bswrr2(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
-void hp300_mem_bswrr4(bus_space_handle_t, bus_size_t, const u_int8_t *, size_t);
-void hp300_mem_bssm1(bus_space_handle_t, bus_size_t, u_int8_t, size_t);
-void hp300_mem_bssm2(bus_space_handle_t, bus_size_t, u_int16_t, size_t);
-void hp300_mem_bssm4(bus_space_handle_t, bus_size_t, u_int32_t, size_t);
-void hp300_mem_bssr1(bus_space_handle_t, bus_size_t, u_int8_t, size_t);
-void hp300_mem_bssr2(bus_space_handle_t, bus_size_t, u_int16_t, size_t);
-void hp300_mem_bssr4(bus_space_handle_t, bus_size_t, u_int32_t, size_t);
-
-struct hp300_bus_space_tag hp300_mem_tag = {
- hp300_mem_map,
- hp300_mem_unmap,
- hp300_mem_subregion,
- hp300_mem_vaddr,
-
- hp300_mem_bsr1,
- hp300_mem_bsr2,
- hp300_mem_bsr4,
- hp300_mem_bsrm1,
- hp300_mem_bsrm2,
- hp300_mem_bsrm4,
- hp300_mem_bsrrm2,
- hp300_mem_bsrrm4,
- hp300_mem_bsrr1,
- hp300_mem_bsrr2,
- hp300_mem_bsrr4,
- hp300_mem_bsrrr2,
- hp300_mem_bsrrr4,
- hp300_mem_bsw1,
- hp300_mem_bsw2,
- hp300_mem_bsw4,
- hp300_mem_bswm1,
- hp300_mem_bswm2,
- hp300_mem_bswm4,
- hp300_mem_bswrm2,
- hp300_mem_bswrm4,
- hp300_mem_bswr1,
- hp300_mem_bswr2,
- hp300_mem_bswr4,
- hp300_mem_bswrr2,
- hp300_mem_bswrr4,
- hp300_mem_bssm1,
- hp300_mem_bssm2,
- hp300_mem_bssm4,
- hp300_mem_bssr1,
- hp300_mem_bssr2,
- hp300_mem_bssr4
-};
-
-int
-hp300_mem_map(bus_addr_t bpa, bus_size_t size, int flags,
- bus_space_handle_t *bshp)
-{
- u_long kva;
- pt_entry_t template;
- int error;
-
- /*
- * intio space is direct-mapped in pmap_bootstrap(); just do the
- * translation in this case.
- */
- if (bpa >= INTIOBASE && bpa < INTIOTOP) {
- *bshp = IIOV(bpa);
- return (0);
- }
-
- /*
- * Allocate virtual address space from the extio extent map.
- */
- size = round_page(bpa + size) - trunc_page(bpa);
- error = extent_alloc(extio, size, PAGE_SIZE, 0, EX_NOBOUNDARY,
- EX_NOWAIT | EX_MALLOCOK, &kva);
- if (error)
- return (error);
-
- *bshp = (bus_space_handle_t)kva + (bpa & PAGE_MASK);
- bpa = trunc_page(bpa);
-
- /*
- * Map the range.
- */
- if (flags & BUS_SPACE_MAP_CACHEABLE)
- template = PG_RW;
- else
- template = PG_RW | PG_CI;
- while (size != 0) {
- pmap_kenter_cache(kva, bpa, template);
- size -= PAGE_SIZE;
- kva += PAGE_SIZE;
- bpa += PAGE_SIZE;
- }
- pmap_update(pmap_kernel());
-
- /*
- * All done.
- */
- return (0);
-}
-
-void
-hp300_mem_unmap(bus_space_handle_t bsh, bus_size_t size)
-{
-#ifdef DIAGNOSTIC
- extern int eiomapsize;
-#endif
- int error;
-
- /*
- * intio space is direct-mapped in pmap_bootstrap(); nothing
- * to do.
- */
- if (IIOP(bsh) >= INTIOBASE && IIOP(bsh) < INTIOTOP)
- return;
-
-#ifdef DIAGNOSTIC
- if ((caddr_t)bsh < extiobase ||
- (caddr_t)bsh >= extiobase + ptoa(eiomapsize)) {
- printf("bus_space_unmap: bad bus space handle %x\n", bsh);
- return;
- }
-#endif
-
- size = round_page(bsh + size) - trunc_page(bsh);
- bsh = trunc_page(bsh);
-
- /*
- * Unmap the range.
- */
- pmap_kremove(bsh, size);
- pmap_update(pmap_kernel());
-
- /*
- * Free it from the extio extent map.
- */
- error = extent_free(extio, (u_long)bsh, size, EX_NOWAIT | EX_MALLOCOK);
-#ifdef DIAGNOSTIC
- if (error != 0) {
- printf("bus_space_unmap: kva 0x%lx size 0x%lx: "
- "can't free region (%d)\n", (vaddr_t)bsh, size, error);
- }
-#endif
-}
-
-/* ARGSUSED */
-int
-hp300_mem_subregion(bus_space_handle_t bsh, bus_size_t offset, bus_size_t size,
- bus_space_handle_t *nbshp)
-{
- *nbshp = bsh + offset;
- return (0);
-}
-
-#if 0
-/* ARGSUSED */
-paddr_t
-hp300_mem_mmap(bus_addr_t addr, off_t offset, int prot, int flags)
-{
- return (((paddr_t)addr + offset) >> PAGE_SHIFT);
-}
-#endif
-
-void *
-hp300_mem_vaddr(bus_space_handle_t h)
-{
- return ((void *)h);
-}
-
-u_int8_t
-hp300_mem_bsr1(bus_space_handle_t bsh, bus_size_t offset)
-{
- return (*(volatile u_int8_t *) (bsh + offset));
-}
-
-u_int16_t
-hp300_mem_bsr2(bus_space_handle_t bsh, bus_size_t offset)
-{
- return (*(volatile u_int16_t *) (bsh + offset));
-}
-
-u_int32_t
-hp300_mem_bsr4(bus_space_handle_t bsh, bus_size_t offset)
-{
- return (*(volatile u_int32_t *) (bsh + offset));
-}
-
-void
-hp300_mem_bsrm1(bus_space_handle_t h, bus_size_t offset,
- u_int8_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movb %%a0@,%%a1@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bsrm2(bus_space_handle_t h, bus_size_t offset,
- u_int16_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movw %%a0@,%%a1@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bsrm4(bus_space_handle_t h, bus_size_t offset,
- u_int32_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movl %%a0@,%%a1@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bsrrm2(bus_space_handle_t h, bus_size_t offset,
- u_int8_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movw %%a0@,%%a1@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bsrrm4(bus_space_handle_t h, bus_size_t offset,
- u_int8_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movl %%a0@,%%a1@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bsrr1(bus_space_handle_t h, bus_size_t offset,
- u_int8_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movb %%a0@+,%%a1@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bsrr2(bus_space_handle_t h, bus_size_t offset,
- u_int16_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movw %%a0@+,%%a1@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bsrr4(bus_space_handle_t h, bus_size_t offset,
- u_int32_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movl %%a0@+,%%a1@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bsrrr2(bus_space_handle_t h, bus_size_t offset,
- u_int8_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movw %%a0@+,%%a1@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c / 2) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bsrrr4(bus_space_handle_t h, bus_size_t offset,
- u_int8_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movl %%a0@+,%%a1@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c / 4) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bsw1(bus_space_handle_t h, bus_size_t offset,
- u_int8_t v)
-{
- (*(volatile u_int8_t *)(h + offset)) = v;
-}
-
-void
-hp300_mem_bsw2(bus_space_handle_t h, bus_size_t offset,
- u_int16_t v)
-{
- (*(volatile u_int16_t *)(h + offset)) = v;
-}
-
-void
-hp300_mem_bsw4(bus_space_handle_t h, bus_size_t offset,
- u_int32_t v)
-{
- (*(volatile u_int32_t *)(h + offset)) = v;
-}
-
-void
-hp300_mem_bswm1(bus_space_handle_t h, bus_size_t offset,
- const u_int8_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movb %%a1@+,%%a0@ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bswm2(bus_space_handle_t h, bus_size_t offset,
- const u_int16_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movw %%a1@+,%%a0@ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bswm4(bus_space_handle_t h, bus_size_t offset,
- const u_int32_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movl %%a1@+,%%a0@ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bswrm2(bus_space_handle_t h, bus_size_t offset,
- const u_int8_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movw %%a1@+,%%a0@ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bswrm4(bus_space_handle_t h, bus_size_t offset,
- const u_int8_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movl %%a1@+,%%a0@ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bswr1(bus_space_handle_t h, bus_size_t offset,
- const u_int8_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movb %%a1@+,%%a0@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bswr2(bus_space_handle_t h, bus_size_t offset,
- const u_int16_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movw %%a1@+,%%a0@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bswr4(bus_space_handle_t h, bus_size_t offset,
- const u_int32_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movl %%a1@+,%%a0@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bswrr2(bus_space_handle_t h, bus_size_t offset,
- const u_int8_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movw %%a1@+,%%a0@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c / 2) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bswrr4(bus_space_handle_t h, bus_size_t offset,
- const u_int8_t *a, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%a1 ;"
- " movl %2,%%d0 ;"
- "1: movl %%a1@+,%%a0@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" (a), "g" (c / 4) :
- "a0","a1","d0");
-}
-
-void
-hp300_mem_bssm1(bus_space_handle_t h, bus_size_t offset,
- u_int8_t v, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%d1 ;"
- " movl %2,%%d0 ;"
- "1: movb %%d1,%%a0@ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" ((u_long)v), "g" (c) :
- "a0","d0","d1");
-}
-
-void
-hp300_mem_bssm2(bus_space_handle_t h, bus_size_t offset,
- u_int16_t v, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%d1 ;"
- " movl %2,%%d0 ;"
- "1: movw %%d1,%%a0@ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" ((u_long)v), "g" (c) :
- "a0","d0","d1");
-}
-
-void
-hp300_mem_bssm4(bus_space_handle_t h, bus_size_t offset,
- u_int32_t v, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%d1 ;"
- " movl %2,%%d0 ;"
- "1: movl %%d1,%%a0@ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" ((u_long)v), "g" (c) :
- "a0","d0","d1");
-}
-
-void
-hp300_mem_bssr1(bus_space_handle_t h, bus_size_t offset,
- u_int8_t v, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%d1 ;"
- " movl %2,%%d0 ;"
- "1: movb %%d1,%%a0@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" ((u_long)v), "g" (c) :
- "a0","d0","d1");
-}
-
-void
-hp300_mem_bssr2(bus_space_handle_t h, bus_size_t offset,
- u_int16_t v, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%d1 ;"
- " movl %2,%%d0 ;"
- "1: movw %%d1,%%a0@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" ((u_long)v), "g" (c) :
- "a0","d0","d1");
-}
-
-void
-hp300_mem_bssr4(bus_space_handle_t h, bus_size_t offset,
- u_int32_t v, size_t c)
-{
- __asm __volatile (
- " movl %0,%%a0 ;"
- " movl %1,%%d1 ;"
- " movl %2,%%d0 ;"
- "1: movl %%d1,%%a0@+ ;"
- " subql #1,%%d0 ;"
- " jne 1b" :
- :
- "r" (h + offset), "g" ((u_long)v), "g" (c) :
- "a0","d0","d1");
-}
-
-#if 0
-paddr_t
-bus_space_mmap(bus_space_tag_t t, bus_addr_t addr, off_t offset, int prot,
- int flags)
-{
- return ((paddr_t)addr + offset);
-}
-#endif
diff --git a/sys/arch/hp300/hp300/clock.c b/sys/arch/hp300/hp300/clock.c
deleted file mode 100644
index 559d2e89090..00000000000
--- a/sys/arch/hp300/hp300/clock.c
+++ /dev/null
@@ -1,628 +0,0 @@
-/* $OpenBSD: clock.c,v 1.15 2012/09/08 19:24:28 miod Exp $ */
-/* $NetBSD: clock.c,v 1.20 1997/04/27 20:43:38 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: clock.c 1.18 91/01/21$
- *
- * @(#)clock.c 8.2 (Berkeley) 1/12/94
- */
-
-/*
- * HPs use the MC6840 PTM with the following arrangement:
- * Timers 1 and 3 are externally driver from a 25MHz source.
- * Output from timer 3 is tied to the input of timer 2.
- * The latter makes it possible to use timers 3 and 2 together to get
- * a 32-bit countdown timer.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/evcount.h>
-#include <sys/timetc.h>
-
-#include <machine/psl.h>
-#include <machine/cpu.h>
-#include <machine/hp300spu.h>
-
-#include <dev/hil/hilreg.h> /* for BBC */
-#include <hp300/hp300/clockreg.h>
-
-#ifdef GPROF
-#include <sys/gmon.h>
-#endif
-
-int clkstd[1];
-int clkint; /* clock interval, as loaded */
-uint32_t clkcounter; /* for timecounter */
-
-/*
- * Statistics clock interval and variance, in usec. Variance must be a
- * power of two. Since this gives us an even number, not an odd number,
- * we discard one case and compensate. That is, a variance of 1024 would
- * give us offsets in [0..1023]. Instead, we take offsets in [1..1023].
- * This is symmetric about the point 512, or statvar/2, and thus averages
- * to that value (assuming uniform random numbers).
- */
-static int statvar = 1024 / 4; /* {stat,prof}clock variance */
-static int statmin; /* statclock interval - variance/2 */
-static int profmin; /* profclock interval - variance/2 */
-static int timer3min; /* current, from above choices */
-static int statprev; /* previous value in stat timer */
-
-static int month_days[12] = {
- 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
-};
-u_char bbc_registers[13];
-volatile u_int8_t *bbcaddr = NULL;
-
-void clockintr(struct clockframe *);
-void statintr(struct clockframe *);
-u_int mc6840_counter(struct timecounter *);
-
-void hp300_calibrate_delay(void);
-struct bbc_tm *gmt_to_bbc(long);
-int bbc_to_gmt(u_long *);
-void read_bbc(void);
-u_char read_bbc_reg(int);
-void send_clock_cmd(volatile u_int8_t *, u_int8_t, u_int8_t *,
- u_int8_t, u_int8_t *);
-u_char write_bbc_reg(int, u_int);
-
-static int clock_ipl = IPL_CLOCK;
-static int stat_ipl = IPL_STATCLOCK;
-struct evcount clockcnt;
-struct evcount statcnt;
-
-/*
- * Machine-dependent clock routines.
- *
- * A note on the real-time clock:
- * We actually load the clock with interval-1 instead of interval.
- * This is because the counter decrements to zero after N+1 enabled clock
- * periods where N is the value loaded into the counter.
- *
- * The frequencies of the HP300 clocks must be a multiple of four
- * microseconds (since the clock counts in 4 us units).
- */
-#define COUNTS_PER_SEC (1000000 / CLK_RESOLUTION)
-
-struct timecounter mc6840_tc = {
- mc6840_counter, NULL, ~0, COUNTS_PER_SEC, "mc6840", 100, NULL
-};
-
-/*
- * Calibrate the delay constant, based on Chuck Cranor's
- * mvme68k delay calibration algorithm.
- */
-void
-hp300_calibrate_delay()
-{
- extern int delay_divisor;
- volatile struct clkreg *clk;
- volatile u_char csr;
- int intvl;
-
- clkstd[0] = IIOV(0x5F8000); /* XXX yuck */
- clk = (volatile struct clkreg *)clkstd[0];
-
- /*
- * Calibrate delay() using the 4 usec counter.
- * We adjust delay_divisor until we get the result we want.
- * We assume we've been called at splhigh().
- */
- for (delay_divisor = 140; delay_divisor > 1; delay_divisor--) {
- /* Reset clock chip */
- clk->clk_cr2 = CLK_CR1;
- clk->clk_cr1 = CLK_RESET;
-
- /*
- * Prime the timer. We're looking for
- * 10,000 usec (10ms). See interval comment
- * above.
- */
- intvl = (10000 / CLK_RESOLUTION) - 1;
- asm volatile(" movpw %0,%1@(5)" : : "d" (intvl), "a" (clk));
-
- /* Enable the timer */
- clk->clk_cr2 = CLK_CR1;
- clk->clk_cr1 = CLK_IENAB;
-
- delay(10000);
-
- /* Timer1 interrupt flag high? */
- csr = clk->clk_sr;
- if (csr & CLK_INT1) {
- /*
- * Got it. Clear interrupt and get outta here.
- */
- asm volatile(" movpw %0@(5),%1" : :
- "a" (clk), "d" (intvl));
- break;
- }
-
- /*
- * Nope. Poll for completion of the interval,
- * clear interrupt, and try again.
- */
- do {
- csr = clk->clk_sr;
- } while ((csr & CLK_INT1) == 0);
-
- asm volatile(" movpw %0@(5),%1" : : "a" (clk), "d" (intvl));
- }
-
- /*
- * Make sure the clock interrupt is disabled. Otherwise,
- * we can end up calling hardclock() before proc0 is set up,
- * causing a bad pointer deref.
- */
- clk->clk_cr2 = CLK_CR1;
- clk->clk_cr1 = CLK_RESET;
-
- /*
- * Sanity check the delay_divisor value. If we totally lost,
- * assume a 50MHz CPU;
- */
- if (delay_divisor == 0)
- delay_divisor = 2048 / 50;
-
- /* Calculate CPU speed. */
- cpuspeed = 2048 / delay_divisor;
-}
-
-/*
- * Set up the real-time and statistics clocks. Leave stathz 0 only if
- * no alternative timer is available.
- */
-void
-cpu_initclocks()
-{
- volatile struct clkreg *clk;
- int intvl, statint, profint, minint;
-
- clkstd[0] = IIOV(0x5F8000); /* XXX grot */
- clk = (volatile struct clkreg *)clkstd[0];
-
- if (COUNTS_PER_SEC % hz) {
- printf("cannot get %d Hz clock; using 100 Hz\n", hz);
- hz = 100;
- }
- /*
- * Clock has several counters, so we can always use separate
- * statclock.
- */
- if (stathz == 0) /* XXX should be set in param.c */
- stathz = hz;
- else if (COUNTS_PER_SEC % stathz) {
- printf("cannot get %d Hz statclock; using 100 Hz\n", stathz);
- stathz = 100;
- }
- if (profhz == 0) /* XXX should be set in param.c */
- profhz = stathz * 5;
- else if (profhz < stathz || COUNTS_PER_SEC % profhz) {
- printf("cannot get %d Hz profclock; using %d Hz\n",
- profhz, stathz);
- profhz = stathz;
- }
-
- intvl = COUNTS_PER_SEC / hz;
- statint = COUNTS_PER_SEC / stathz;
- profint = COUNTS_PER_SEC / profhz;
- minint = statint / 2 + 100;
- while (statvar > minint)
- statvar >>= 1;
-
- tick = intvl * CLK_RESOLUTION;
-
- /* adjust interval counts, per note above */
- intvl--;
- statint--;
- profint--;
-
- /* calculate base reload values */
- clkint = intvl;
- statmin = statint - (statvar >> 1);
- profmin = profint - (statvar >> 1);
- timer3min = statmin;
- statprev = statint;
-
- evcount_attach(&statcnt, "stat", &stat_ipl);
- evcount_attach(&clockcnt, "clock", &clock_ipl);
-
- /* finally, load hardware */
- clk->clk_cr2 = CLK_CR1;
- clk->clk_cr1 = CLK_RESET;
- asm volatile(" movpw %0,%1@(5)" : : "d" (intvl), "a" (clk));
- asm volatile(" movpw %0,%1@(9)" : : "d" (0), "a" (clk));
- asm volatile(" movpw %0,%1@(13)" : : "d" (statint), "a" (clk));
- clk->clk_cr2 = CLK_CR1;
- clk->clk_cr1 = CLK_IENAB;
- clk->clk_cr2 = CLK_CR3;
- clk->clk_cr3 = CLK_IENAB;
-
- tc_init(&mc6840_tc);
-}
-
-/*
- * We assume newhz is either stathz or profhz, and that neither will
- * change after being set up above. Could recalculate intervals here
- * but that would be a drag.
- */
-void
-setstatclockrate(newhz)
- int newhz;
-{
-
- if (newhz == stathz)
- timer3min = statmin;
- else
- timer3min = profmin;
-}
-
-/*
- * Timer clock interrupt.
- */
-void
-clockintr(fp)
- struct clockframe *fp;
-{
- clockcnt.ec_count++;
- hardclock(fp);
-}
-
-/*
- * Statistics/profiling clock interrupt. Compute a new interval.
- * Interrupt has already been cleared.
- */
-void
-statintr(fp)
- struct clockframe *fp;
-{
- volatile struct clkreg *clk;
- int newint, r, var;
-
- clk = (volatile struct clkreg *)clkstd[0];
- var = statvar;
- do {
- r = random() & (var - 1);
- } while (r == 0);
- newint = timer3min + r;
-
- /*
- * The timer was automatically reloaded with the previous latch
- * value at the time of the interrupt. Compensate now for the
- * amount of time that has run off since then (minimum of 2-12
- * timer ticks depending on CPU type) plus one tick roundoff.
- * This should keep us closer to the mean.
- */
- asm volatile(" clrl %0; movpw %1@(13),%0" : "=d" (r) : "a" (clk));
- newint -= (statprev - r + 1);
-
- asm volatile(" movpw %0,%1@(13)" : : "d" (newint), "a" (clk));
- statprev = newint;
- statcnt.ec_count++;
- statclock(fp);
-}
-
-u_int
-mc6840_counter(struct timecounter *tc)
-{
- volatile struct clkreg *clk;
- uint32_t ccounter, count;
- static uint32_t lastcount;
- int s;
-
- clk = (volatile struct clkreg *)clkstd[0];
-
- s = splclock();
- ccounter = clkcounter;
- /* XXX reading counter clears interrupt flag?? */
- __asm__ __volatile__
- ("clrl %0; movpw %1@(5),%0" : "=d" (count) : "a" (clk));
- splx(s);
-
- count = ccounter + (clkint - count);
- if ((int32_t)(count - lastcount) < 0) {
- /* XXX wrapped; maybe hardclock() is blocked more than 1/hz */
- count = lastcount + 1;
- }
- lastcount = count;
-
- return count;
-}
-
-/*
- * Initialize the time of day register, based on the time base which is, e.g.
- * from a filesystem.
- */
-void
-inittodr(base)
- time_t base;
-{
- u_long timbuf = base; /* assume no battery clock exists */
- static int bbcinited = 0;
- int badbase = 0, waszero = base == 0;
- struct timespec ts;
-
- if (base < (2012 - 1970) * SECYR) {
- /*
- * If base is 0, assume filesystem time is just unknown
- * instead of preposterous. Don't bark.
- */
- if (base != 0)
- printf("WARNING: preposterous time in file system\n");
- /* not going to use it anyway, if the chip is readable */
- base = (2012 - 1970) * SECYR;
- badbase = 1;
- }
-
- /* XXX */
- if (!bbcinited) {
- if (machineid == HP_425 && mmuid == MMUID_425_E)
- bbcaddr = NULL;
- else {
- if (badbaddr((caddr_t)(BBCADDR + HILP_STAT)))
- printf("WARNING: no battery clock\n");
- else
- bbcaddr = BBCADDR;
- }
- bbcinited = 1;
- }
-
- /*
- * bbc_to_gmt converts and stores the gmt in timbuf.
- * If an error is detected in bbc_to_gmt, or if the filesystem
- * time is more recent than the gmt time in the clock,
- * then use the filesystem time and warn the user.
- */
- if (bbcaddr != NULL) {
- if (!bbc_to_gmt(&timbuf) || timbuf < base) {
- printf("WARNING: bad date in battery clock\n");
- timbuf = base;
- }
- }
-
- if (timbuf != base) {
- int deltat = timbuf - base;
-
- if (deltat < 0)
- deltat = -deltat;
- if (!waszero && deltat >= 2 * SECDAY)
- printf("WARNING: clock %s %d days"
- " -- CHECK AND RESET THE DATE!\n",
- timbuf < base ? "lost" : "gained", deltat / SECDAY);
- }
-
- /* Battery clock does not store usec's, so forget about it. */
- ts.tv_sec = timbuf;
- ts.tv_nsec = 0;
-
- tc_setclock(&ts);
-}
-
-/*
- * Restore the time of day hardware after a time change.
- */
-void
-resettodr()
-{
- int i;
- struct bbc_tm *tmptr;
-
- if (bbcaddr == NULL)
- return;
-
- tmptr = gmt_to_bbc(time_second);
-
- decimal_to_bbc(0, 1, tmptr->tm_sec);
- decimal_to_bbc(2, 3, tmptr->tm_min);
- decimal_to_bbc(4, 5, tmptr->tm_hour);
- decimal_to_bbc(7, 8, tmptr->tm_mday);
- decimal_to_bbc(9, 10, tmptr->tm_mon);
- decimal_to_bbc(11, 12, tmptr->tm_year);
-
- /* Some bogusness to deal with seemingly broken hardware. Nonsense */
- bbc_registers[5] = ((tmptr->tm_hour / 10) & 0x03) + 8;
-
- write_bbc_reg(15, 13); /* reset prescalar */
-
- for (i = 0; i <= NUM_BBC_REGS; i++)
- if (bbc_registers[i] != write_bbc_reg(i, bbc_registers[i])) {
- printf("Cannot set battery backed clock\n");
- break;
- }
-}
-
-struct bbc_tm *
-gmt_to_bbc(tim)
- long tim;
-{
- int i;
- long hms, day;
- static struct bbc_tm rt;
-
- day = tim / SECDAY;
- hms = tim % SECDAY;
-
- /* Hours, minutes, seconds are easy */
- rt.tm_hour = hms / 3600;
- rt.tm_min = (hms % 3600) / 60;
- rt.tm_sec = (hms % 3600) % 60;
-
- /* Number of years in days */
- for (i = STARTOFTIME - 1900; day >= days_in_year(i); i++)
- day -= days_in_year(i);
- rt.tm_year = i;
-
- /* Number of months in days left */
- if (leapyear(rt.tm_year))
- days_in_month(FEBRUARY) = 29;
- for (i = 1; day >= days_in_month(i); i++)
- day -= days_in_month(i);
- days_in_month(FEBRUARY) = 28;
- rt.tm_mon = i;
-
- /* Days are what is left over (+1) from all that. */
- rt.tm_mday = day + 1;
-
- return(&rt);
-}
-
-int
-bbc_to_gmt(timbuf)
- u_long *timbuf;
-{
- int i;
- u_long tmp;
- int year, month, day, hour, min, sec;
-
- read_bbc();
-
- sec = bbc_to_decimal(1, 0);
- min = bbc_to_decimal(3, 2);
-
- /*
- * Hours are different for some reason. Makes no sense really.
- */
- hour = ((bbc_registers[5] & 0x03) * 10) + bbc_registers[4];
- day = bbc_to_decimal(8, 7);
- month = bbc_to_decimal(10, 9);
- year = bbc_to_decimal(12, 11) + 1900;
-
- range_test(hour, 0, 23);
- range_test(day, 1, 31);
- range_test(month, 1, 12);
- range_test(year, STARTOFTIME, 2038); /* 2038 is the end of time. */
-
- tmp = 0;
-
- for (i = STARTOFTIME; i < year; i++)
- tmp += days_in_year(i);
- if (leapyear(year) && month > FEBRUARY)
- tmp++;
-
- for (i = 1; i < month; i++)
- tmp += days_in_month(i);
-
- tmp += (day - 1);
- tmp = ((tmp * 24 + hour) * 60 + min) * 60 + sec;
-
- *timbuf = tmp;
- return(1);
-}
-
-void
-read_bbc()
-{
- int i, read_okay;
-
- read_okay = 0;
- while (!read_okay) {
- read_okay = 1;
- for (i = 0; i <= NUM_BBC_REGS; i++)
- bbc_registers[i] = read_bbc_reg(i);
- for (i = 0; i <= NUM_BBC_REGS; i++)
- if (bbc_registers[i] != read_bbc_reg(i))
- read_okay = 0;
- }
-}
-
-u_char
-read_bbc_reg(reg)
- int reg;
-{
- u_char data = reg;
-
- if (bbcaddr != NULL) {
- send_clock_cmd(bbcaddr, BBC_SET_REG, &data, 1, NULL);
- send_clock_cmd(bbcaddr, BBC_READ_REG, NULL, 0, &data);
- }
- return(data);
-}
-
-u_char
-write_bbc_reg(reg, data)
- int reg;
- u_int data;
-{
- u_char tmp;
-
- tmp = (u_char) ((data << HIL_SSHIFT) | reg);
-
- if (bbcaddr != NULL) {
- send_clock_cmd(bbcaddr, BBC_SET_REG, &tmp, 1, NULL);
- send_clock_cmd(bbcaddr, BBC_WRITE_REG, NULL, 0, NULL);
- send_clock_cmd(bbcaddr, BBC_READ_REG, NULL, 0, &tmp);
- }
- return(tmp);
-}
-
-/*
- * Battery-backed clock command interface.
- * The BBC appears to have an HIL-like command interface, but can not attach
- * as a complete HIL device to an HIL controller driver.
- * The following routine is a simplified command loop.
- */
-void
-send_clock_cmd(volatile u_int8_t *address, u_int8_t cmd, u_int8_t *data,
- u_int8_t dlen, u_int8_t *rdata)
-{
- u_int8_t status;
- int s;
-
- s = splvm();
-
- while ((address[HILP_STAT] & HIL_BUSY) != 0)
- DELAY(1);
- address[HILP_CMD] = cmd;
- while (dlen--) {
- while ((address[HILP_STAT] & HIL_BUSY) != 0)
- DELAY(1);
- address[HILP_DATA] = *data++;
- DELAY(1);
- }
- if (rdata != NULL) {
- do {
- while ((address[HILP_STAT] & HIL_DATA_RDY) == 0)
- DELAY(1);
- status = address[HILP_STAT];
- *rdata = address[HILP_DATA];
- DELAY(1);
- } while (((status >> HIL_SSHIFT) & HIL_SMASK) != HIL_68K);
- }
-
- splx(s);
-}
diff --git a/sys/arch/hp300/hp300/clockreg.h b/sys/arch/hp300/hp300/clockreg.h
deleted file mode 100644
index 9346d67dea0..00000000000
--- a/sys/arch/hp300/hp300/clockreg.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/* $OpenBSD: clockreg.h,v 1.5 2005/01/14 22:39:27 miod Exp $ */
-/* $NetBSD: clockreg.h,v 1.5 1994/10/26 07:25:26 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: clockreg.h 1.14 91/01/18$
- *
- * @(#)clockreg.h 8.2 (Berkeley) 1/12/94
- */
-
-/*
- * HP300 "real time clock" (MC6840) registers
- */
-
-struct clkreg {
- u_char clk_dummy1;
- u_char clk_cr3;
-#define clk_cr1 clk_cr3
- u_char clk_dummy2;
- u_char clk_cr2;
-#define clk_sr clk_cr2
- u_char clk_dummy3;
- u_char clk_msb1;
- u_char clk_dummy4;
- u_char clk_lsb1;
- u_char clk_dummy5;
- u_char clk_msb2;
- u_char clk_dummy6;
- u_char clk_lsb2;
- u_char clk_dummy7;
- u_char clk_msb3;
- u_char clk_dummy8;
- u_char clk_lsb3;
-};
-
-/* base/offsets for register access (for locore.s) */
-#define CLKBASE IIOPOFF(0x5F8000)
-#define CLKCR1 0x1
-#define CLKCR2 0x3
-#define CLKCR3 CLKCR1
-#define CLKSR CLKCR2
-#define CLKMSB1 0x5
-#define CLKMSB2 0x9
-#define CLKMSB3 0xD
-
-/* output of counter 3 clocks counter 2 */
-
-#define CLK_OENAB 0x80 /* output enable */
-#define CLK_IENAB 0x40 /* interrupt enable */
-#define CLK_8BIT 0x04 /* 8 bit mode */
-#define CLK_RESET 0x01 /* chip reset (CR1 only) */
-#define CLK_CR1 0x01 /* select CR1 (CR2 only) */
-#define CLK_CR3 0x00 /* select CR3 (CR2 only) */
-#define CLK_INT1 0x01 /* interrupt flag for timer 1 (SR only) */
-#define CLK_INT2 0x02 /* interrupt flag for timer 2 (SR only) */
-#define CLK_INT3 0x04 /* interrupt flag for timer 3 (SR only) */
-#define CLK_INTR 0x80 /* composite interrupt flag (SR only) */
-
-#define CLK_RESOLUTION 4 /* 4 usec resolution (250KHz) */
-#define CLK_INTERVAL 2500 /* 10msec interval at 250KHz */
-#ifdef NOTDEF
-#define CLK_INTERVAL 5000 /* 20msec interval at 250KHz */
-#endif
-
-/*
- * HP300 battery-backed clock
- */
-
-#define BBCADDR (u_int8_t *)(IIOV(0x420000))
-
-struct bbc_tm {
- int tm_sec;
- int tm_min;
- int tm_hour;
- int tm_mday;
- int tm_mon;
- int tm_year;
-};
-
-#define FEBRUARY 2
-#define STARTOFTIME 1970
-#define SECDAY 86400L
-#define SECYR (SECDAY * 365)
-
-#define BBC_SET_REG 0xe0
-#define BBC_WRITE_REG 0xc2
-#define BBC_READ_REG 0xc3
-#define NUM_BBC_REGS 12
-
-#define leapyear(year) ((year) % 4 == 0)
-#define range_test(n, l, h) if ((n) < (l) || (n) > (h)) return(0)
-#define days_in_year(a) (leapyear(a) ? 366 : 365)
-#define days_in_month(a) (month_days[(a) - 1])
-#define bbc_to_decimal(a,b) (bbc_registers[a] * 10 + bbc_registers[b])
-#define decimal_to_bbc(a,b,n) { \
- bbc_registers[a] = (n) % 10; \
- bbc_registers[b] = (n) / 10; \
-}
diff --git a/sys/arch/hp300/hp300/conf.c b/sys/arch/hp300/hp300/conf.c
deleted file mode 100644
index 70ead37cdd7..00000000000
--- a/sys/arch/hp300/hp300/conf.c
+++ /dev/null
@@ -1,294 +0,0 @@
-/* $OpenBSD: conf.c,v 1.55 2013/06/03 15:54:47 tedu Exp $ */
-/* $NetBSD: conf.c,v 1.39 1997/05/12 08:17:53 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)conf.c 7.9 (Berkeley) 5/28/91
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/conf.h>
-#include <sys/vnode.h>
-
-#include "cd.h"
-#include "ch.h"
-#include "ct.h"
-bdev_decl(ct);
-#include "mt.h"
-bdev_decl(mt);
-#include "hd.h"
-bdev_decl(hd);
-#include "rd.h"
-#include "sd.h"
-#include "st.h"
-#include "uk.h"
-#include "vnd.h"
-
-struct bdevsw bdevsw[] =
-{
- bdev_tape_init(NCT,ct), /* 0: cs80 cartridge tape */
- bdev_tape_init(NMT,mt), /* 1: magnetic reel tape */
- bdev_disk_init(NHD,hd), /* 2: HPIB disk */
- bdev_swap_init(1,sw), /* 3: swap pseudo-device */
- bdev_disk_init(NSD,sd), /* 4: SCSI disk */
- bdev_notdef(), /* 5: was: concatenated disk driver */
- bdev_disk_init(NVND,vnd), /* 6: vnode disk driver */
- bdev_tape_init(NST,st), /* 7: SCSI tape */
- bdev_disk_init(NRD,rd), /* 8: RAM disk */
- bdev_disk_init(NCD,cd), /* 9: SCSI CD-ROM */
- bdev_lkm_dummy(), /* 10 */
- bdev_lkm_dummy(), /* 11 */
- bdev_lkm_dummy(), /* 12 */
- bdev_lkm_dummy(), /* 13 */
- bdev_lkm_dummy(), /* 14 */
- bdev_lkm_dummy(), /* 15 */
-};
-int nblkdev = nitems(bdevsw);
-
-/* open, close, read, write, ioctl -- XXX should be a generic device */
-#define cdev_ppi_init(c,n) { \
- dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
- dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) nullop, \
- 0, (dev_type_poll((*))) enodev, (dev_type_mmap((*))) enodev }
-
-#include "audio.h"
-#include "bio.h"
-#define mmread mmrw
-#define mmwrite mmrw
-cdev_decl(mm);
-#include "pty.h"
-cdev_decl(ct);
-cdev_decl(hd);
-#include "ppi.h"
-cdev_decl(ppi);
-#include "dca.h"
-cdev_decl(dca);
-#include "apci.h"
-cdev_decl(apci);
-#include "dcm.h"
-cdev_decl(dcm);
-cdev_decl(mt);
-cdev_decl(fd);
-#include "bpfilter.h"
-#include "tun.h"
-#include "ksyms.h"
-#include "wsdisplay.h"
-#include "wskbd.h"
-#include "wsmouse.h"
-#include "wsmux.h"
-#include "pf.h"
-#include "systrace.h"
-#include "vscsi.h"
-#include "pppx.h"
-#include "hotplug.h"
-#include "fuse.h"
-
-struct cdevsw cdevsw[] =
-{
- cdev_cn_init(1,cn), /* 0: virtual console */
- cdev_ctty_init(1,ctty), /* 1: controlling terminal */
- cdev_mm_init(1,mm), /* 2: /dev/{null,mem,kmem,...} */
- cdev_notdef(), /* 3 was /dev/drum */
- cdev_tty_init(NPTY,pts), /* 4: pseudo-tty slave */
- cdev_ptc_init(NPTY,ptc), /* 5: pseudo-tty master */
- cdev_log_init(1,log), /* 6: /dev/klog */
- cdev_tape_init(NCT,ct), /* 7: cs80 cartridge tape */
- cdev_disk_init(NSD,sd), /* 8: SCSI disk */
- cdev_disk_init(NHD,hd), /* 9: HPIB disk */
- cdev_notdef(), /* 10 */
- cdev_ppi_init(NPPI,ppi), /* 11: printer/plotter interface */
- cdev_tty_init(NDCA,dca), /* 12: built-in single-port serial */
- cdev_notdef(), /* 13: was console terminal emulator */
- cdev_notdef(), /* 14: was human interface loop */
- cdev_tty_init(NDCM,dcm), /* 15: 4-port serial */
- cdev_tape_init(NMT,mt), /* 16: magnetic reel tape */
- cdev_notdef(), /* 17: was: concatenated disk */
- cdev_disk_init(NCD,cd), /* 18: SCSI CD-ROM */
- cdev_disk_init(NVND,vnd), /* 19: vnode disk driver */
- cdev_tape_init(NST,st), /* 20: SCSI tape */
- cdev_fd_init(1,filedesc), /* 21: file descriptor pseudo-device */
- cdev_bpf_init(NBPFILTER,bpf), /* 22: Berkeley packet filter */
- cdev_tun_init(NTUN,tun), /* 23: network tunnel */
- cdev_lkm_init(NLKM,lkm), /* 24: loadable module driver */
- cdev_lkm_dummy(), /* 25 */
- cdev_lkm_dummy(), /* 26 */
- cdev_lkm_dummy(), /* 27 */
- cdev_lkm_dummy(), /* 28 */
- cdev_lkm_dummy(), /* 29 */
- cdev_lkm_dummy(), /* 30 */
- cdev_lkm_dummy(), /* 31 */
- cdev_random_init(1,random), /* 32: random generator */
- cdev_pf_init(NPF,pf), /* 33: packet filter */
- cdev_disk_init(NRD,rd), /* 34: RAM disk */
- cdev_tty_init(NAPCI,apci), /* 35: Apollo APCI UARTs */
- cdev_ksyms_init(NKSYMS,ksyms), /* 36: Kernel symbols device */
- cdev_uk_init(NUK,uk), /* 37 */
- cdev_notdef(), /* 38 */
- cdev_ch_init(NCH,ch), /* 39 */
- cdev_wsdisplay_init(NWSDISPLAY,wsdisplay), /* 40: frame buffers */
- cdev_mouse_init(NWSKBD,wskbd), /* 41: keyboards */
- cdev_mouse_init(NWSMOUSE,wsmouse), /* 42: mice */
- cdev_mouse_init(NWSMUX,wsmux), /* 43: ws multiplexor */
- cdev_audio_init(NAUDIO,audio), /* 44: audio */
- cdev_notdef(), /* 45 */
- cdev_notdef(), /* 46 */
- cdev_notdef(), /* 47 */
- cdev_notdef(), /* 48 */
- cdev_bio_init(NBIO,bio), /* 49: ioctl tunnel */
- cdev_systrace_init(NSYSTRACE,systrace), /* 50 system call tracing */
- cdev_notdef(), /* 51 */
- cdev_ptm_init(NPTY,ptm), /* 52: pseudo-tty ptm device */
- cdev_vscsi_init(NVSCSI,vscsi), /* 53: vscsi */
- cdev_disk_init(1,diskmap), /* 54: disk mapper */
- cdev_pppx_init(NPPPX,pppx), /* 55: pppx */
- cdev_hotplug_init(NHOTPLUG,hotplug), /* 56: devices hot plugging */
- cdev_fuse_init(NFUSE,fuse), /* 57: fuse */
-};
-int nchrdev = nitems(cdevsw);
-
-int mem_no = 2; /* major device number of memory special file */
-
-/*
- * Swapdev is a fake device implemented
- * in sw.c used only internally to get to swstrategy.
- * It cannot be provided to the users, because the
- * swstrategy routine munches the b_dev and b_blkno entries
- * before calling the appropriate driver. This would horribly
- * confuse, e.g. the hashing routines. Instead, /dev/drum is
- * provided as a character (raw) device.
- */
-dev_t swapdev = makedev(3, 0);
-
-/*
- * Returns true if dev is /dev/mem or /dev/kmem.
- */
-int
-iskmemdev(dev)
- dev_t dev;
-{
-
- return (major(dev) == mem_no && minor(dev) < 2);
-}
-
-/*
- * Returns true if dev is /dev/zero.
- */
-int
-iszerodev(dev)
- dev_t dev;
-{
-
- return (major(dev) == mem_no && minor(dev) == 12);
-}
-
-dev_t
-getnulldev()
-{
- return makedev(mem_no, 2);
-}
-
-int chrtoblktbl[] = {
- /* XXXX This needs to be dynamic for LKMs. */
- /*VCHR*/ /*VBLK*/
- /* 0 */ NODEV,
- /* 1 */ NODEV,
- /* 2 */ NODEV,
- /* 3 */ NODEV,
- /* 4 */ NODEV,
- /* 5 */ NODEV,
- /* 6 */ NODEV,
- /* 7 */ 0, /* ct */
- /* 8 */ 4, /* sd */
- /* 9 */ 2, /* hd */
- /* 10 */ NODEV,
- /* 11 */ NODEV,
- /* 12 */ NODEV,
- /* 13 */ NODEV,
- /* 14 */ NODEV,
- /* 15 */ NODEV,
- /* 16 */ 1, /* mt */
- /* 17 */ NODEV,
- /* 18 */ 9, /* cd */
- /* 19 */ 6, /* vnd */
- /* 20 */ 7, /* st */
- /* 21 */ NODEV,
- /* 22 */ NODEV,
- /* 23 */ NODEV,
- /* 24 */ NODEV,
- /* 25 */ NODEV,
- /* 26 */ NODEV,
- /* 27 */ NODEV,
- /* 28 */ NODEV,
- /* 29 */ NODEV,
- /* 30 */ NODEV,
- /* 31 */ NODEV,
- /* 32 */ NODEV,
- /* 33 */ NODEV,
- /* 34 */ 8, /* rd */
-};
-int nchrtoblktbl = nitems(chrtoblktbl);
-
-/*
- * This entire table could be autoconfig()ed but that would mean that
- * the kernel's idea of the console would be out of sync with that of
- * the standalone boot. I think it best that they both use the same
- * known algorithm unless we see a pressing need otherwise.
- */
-#include <dev/cons.h>
-
-cons_decl(ws);
-
-#define dcacnpollc nullcnpollc
-cons_decl(dca);
-
-#define apcicnpollc nullcnpollc
-cons_decl(apci);
-
-#define dcmcnpollc nullcnpollc
-cons_decl(dcm);
-
-struct consdev constab[] = {
-#if NWSDISPLAY > 0
- cons_init(ws),
-#endif
-#if NDCA > 0
- cons_init(dca),
-#endif
-#if NAPCI > 0
- cons_init(apci),
-#endif
-#if NDCM > 0
- cons_init(dcm),
-#endif
- { 0 },
-};
diff --git a/sys/arch/hp300/hp300/db_memrw.c b/sys/arch/hp300/hp300/db_memrw.c
deleted file mode 100644
index 94946da45a7..00000000000
--- a/sys/arch/hp300/hp300/db_memrw.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/* $OpenBSD: db_memrw.c,v 1.11 2011/11/01 21:20:55 miod Exp $ */
-/* $NetBSD: db_memrw.c,v 1.5 1997/06/10 18:48:47 veego Exp $ */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Gordon W. Ross and Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Interface to the debugger for virtual memory read/write.
- * This file is shared by DDB and KGDB, and must work even
- * when only KGDB is included (thus no db_printf calls).
- *
- * To write in the text segment, we have to first make
- * the page writable, do the write, then restore the PTE.
- * For writes outside the text segment, and all reads,
- * just do the access -- if it causes a fault, the debugger
- * will recover with a longjmp to an appropriate place.
- *
- * ALERT! If you want to access device registers with a
- * specific size, then the read/write functions have to
- * make sure to do the correct sized pointer access.
- *
- * Modified from sun3 version for hp300 (and probably other m68ks, too)
- * by Jason R. Thorpe <thorpej@NetBSD.ORG>.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/pte.h>
-#include <machine/db_machdep.h>
-#include <machine/cpu.h>
-
-#include <ddb/db_access.h>
-
-static void db_write_text(db_addr_t, size_t, char *);
-
-/*
- * Read bytes from kernel address space for debugger.
- * This used to check for valid PTEs, but now that
- * traps in DDB work correctly, "Just Do It!"
- */
-void
-db_read_bytes(addr, size, data)
- db_addr_t addr;
- size_t size;
- char *data;
-{
- char *src = (char *)addr;
-
- if (size == 4) {
- *((int *)data) = *((int *)src);
- return;
- }
-
- if (size == 2) {
- *((short *)data) = *((short *)src);
- return;
- }
-
- while (size > 0) {
- --size;
- *data++ = *src++;
- }
-}
-
-/*
- * Write bytes somewhere in kernel text.
- * Makes text page writable temporarily.
- * We're probably a little to cache-paranoid.
- */
-static void
-db_write_text(addr, size, data)
- db_addr_t addr;
- size_t size;
- char *data;
-{
- char *dst, *odst;
- pt_entry_t *pte, oldpte, tmppte;
- vaddr_t pgva;
- int limit;
-
- if (size == 0)
- return;
-
- dst = (char *)addr;
-
- do {
- /*
- * Get the VA for the page.
- */
- pgva = trunc_page((vaddr_t)dst);
-
- /*
- * Save this destination address, for TLB
- * flush.
- */
- odst = dst;
-
- /*
- * Compute number of bytes that can be written
- * with this mapping and subtract it from the
- * total size.
- */
- limit = NBPG - ((u_long)dst & PGOFSET);
- if (limit > size)
- limit = size;
- size -= limit;
-
- /*
- * Make the page writable. Note the mapping is
- * cache-inhibited to save hair.
- */
- pte = kvtopte(pgva);
- oldpte = *pte;
-
- if ((oldpte & PG_V) == 0) {
- printf(" address %p not a valid page\n", dst);
- return;
- }
-
- tmppte = (oldpte & ~PG_RO) | PG_RW | PG_CI;
- *pte = tmppte;
- TBIS((vaddr_t)odst);
-
- /*
- * Page is now writable. Do as much access as we
- * can in this page.
- */
- for (; limit > 0; limit--)
- *dst++ = *data++;
-
- /*
- * Restore the old PTE.
- */
- *pte = oldpte;
- TBIS((vaddr_t)odst);
- } while (size != 0);
-
- /*
- * Invalidate the instruction cache so our changes
- * take effect.
- */
- ICIA();
-}
-
-/*
- * Write bytes to kernel address space for debugger.
- */
-extern char kernel_text[], etext[];
-void
-db_write_bytes(addr, size, data)
- db_addr_t addr;
- size_t size;
- char *data;
-{
- char *dst = (char *)addr;
-
- /* If any part is in kernel text, use db_write_text() */
- if ((dst < etext) && ((dst + size) > kernel_text)) {
- db_write_text(addr, size, data);
- return;
- }
-
- if (size == 4) {
- *((int *)dst) = *((int *)data);
- return;
- }
-
- if (size == 2) {
- *((short *)dst) = *((short *)data);
- return;
- }
-
- while (size > 0) {
- --size;
- *dst++ = *data++;
- }
-}
diff --git a/sys/arch/hp300/hp300/disksubr.c b/sys/arch/hp300/hp300/disksubr.c
deleted file mode 100644
index ce78c543c23..00000000000
--- a/sys/arch/hp300/hp300/disksubr.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/* $OpenBSD: disksubr.c,v 1.51 2011/04/16 03:21:15 krw Exp $ */
-/* $NetBSD: disksubr.c,v 1.9 1997/04/01 03:12:13 scottr Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1988, 1993
- * The Regents of the University of California. All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/disk.h>
-#include <sys/disklabel.h>
-#include <sys/syslog.h>
-
-/*
- * Attempt to read a disk label from a device using the indicated strategy
- * routine. The label must be partly set up before this: secpercyl and
- * anything required in the strategy routine (e.g., sector size) must be
- * filled in before calling us.
- */
-int
-readdisklabel(dev_t dev, void (*strat)(struct buf *),
- struct disklabel *lp, int spoofonly)
-{
- struct buf *bp = NULL;
- int error;
-
- if ((error = initdisklabel(lp)))
- goto done;
-
- bp = geteblk((int)lp->d_secsize);
- bp->b_dev = dev;
-
- DL_SETBSTART(lp, lp->d_secpercyl);
-
- /* don't read the on-disk label if we are in spoofed-only mode */
- if (spoofonly)
- goto done;
-
- bp->b_blkno = LABELSECTOR;
- bp->b_bcount = lp->d_secsize;
- CLR(bp->b_flags, B_READ | B_WRITE | B_DONE);
- SET(bp->b_flags, B_BUSY | B_READ | B_RAW);
- (*strat)(bp);
- if (biowait(bp)) {
- error = bp->b_error;
- goto done;
- }
-
- error = checkdisklabel(bp->b_data + LABELOFFSET, lp,
- DL_GETBSTART(lp), DL_GETDSIZE(lp));
- if (error == 0)
- goto done;
-
-#if defined(CD9660)
- error = iso_disklabelspoof(dev, strat, lp);
- if (error == 0)
- goto done;
-#endif
-#if defined(UDF)
- error = udf_disklabelspoof(dev, strat, lp);
- if (error == 0)
- goto done;
-#endif
-
-done:
- if (bp) {
- bp->b_flags |= B_INVAL;
- brelse(bp);
- }
- disk_change = 1;
- return (error);
-}
-
-/*
- * Write disk label back to device after modification.
- */
-int
-writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp)
-{
- struct buf *bp = NULL;
- struct disklabel *dlp;
- int error = 0;
-
- /* get a buffer and initialize it */
- bp = geteblk((int)lp->d_secsize);
- bp->b_dev = dev;
- bp->b_blkno = LABELSECTOR;
- bp->b_bcount = lp->d_secsize;
- CLR(bp->b_flags, B_READ | B_WRITE | B_DONE);
- SET(bp->b_flags, B_BUSY | B_READ | B_RAW);
- (*strat)(bp);
- if ((error = biowait(bp)) != 0)
- goto done;
-
- /* Write it in the regular place. */
- dlp = (struct disklabel *)(bp->b_data + LABELOFFSET);
- *dlp = *lp;
- CLR(bp->b_flags, B_READ | B_WRITE | B_DONE);
- SET(bp->b_flags, B_BUSY | B_WRITE | B_RAW);
- (*strat)(bp);
- error = biowait(bp);
-
-done:
- if (bp) {
- bp->b_flags |= B_INVAL;
- brelse(bp);
- }
- disk_change = 1;
- return (error);
-}
diff --git a/sys/arch/hp300/hp300/genassym.cf b/sys/arch/hp300/hp300/genassym.cf
deleted file mode 100644
index 250929ceb04..00000000000
--- a/sys/arch/hp300/hp300/genassym.cf
+++ /dev/null
@@ -1,171 +0,0 @@
-# $OpenBSD: genassym.cf,v 1.22 2011/08/18 19:54:18 miod Exp $
-# $NetBSD: genassym.cf,v 1.11 1998/02/16 20:58:29 thorpej Exp $
-
-#
-# Copyright (c) 1982, 1990, 1993
-# The Regents of the University of California. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. Neither the name of the University nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# @(#)genassym.c 8.3 (Berkeley) 1/4/94
-#
-
-include <sys/param.h>
-include <sys/buf.h>
-include <sys/proc.h>
-include <sys/mbuf.h>
-include <sys/msgbuf.h>
-include <sys/syscall.h>
-include <sys/user.h>
-
-include <uvm/uvm_extern.h>
-
-include <machine/hp300spu.h>
-include <machine/cpu.h>
-include <machine/psl.h>
-include <machine/reg.h>
-include <machine/pte.h>
-
-include <hp300/dev/frodoreg.h>
-include <hp300/hp300/clockreg.h>
-
-# values for machineid
-export HP_320
-export HP_330
-export HP_340
-export HP_345
-export HP_350
-export HP_36X
-export HP_370
-export HP_375
-export HP_380
-export HP_382
-export HP_385
-export HP_400
-export HP_425
-export HP_433
-
-# values for mmuid
-export MMUID_345
-export MMUID_375
-export MMUID_382
-export MMUID_385
-export MMUID_425_T
-export MMUID_425_S
-export MMUID_433_T
-export MMUID_433_S
-export MMUID_425_E
-
-export MMUID_SHIFT
-export MMUID_MASK
-
-# values for ectype
-export EC_PHYS
-export EC_NONE
-export EC_VIRT
-
-# general constants
-export UPAGES
-export USPACE
-export PGSHIFT
-export USRSTACK
-export MAXADDR
-
-# proc fields and values
-struct proc
-member P_MD_FLAGS p_md.md_flags
-member P_MD_REGS p_md.md_regs
-
-export SSLEEP
-
-# PSL values
-export PSL_S
-export PSL_IPL7
-export PSL_LOWIPL
-export PSL_USER
-define PSL_TS PSL_T | PSL_S
-define SPL1 PSL_S | PSL_IPL1
-define SPL2 PSL_S | PSL_IPL2
-define SPL3 PSL_S | PSL_IPL3
-define SPL4 PSL_S | PSL_IPL4
-define SPL5 PSL_S | PSL_IPL5
-define SPL6 PSL_S | PSL_IPL6
-
-# magic
-export FC_PURGE
-export INTIOBASE
-export MMUBASE
-export MMUSTAT
-export MMUCMD
-export MMUSSTP
-export MMUUSTP
-export MMUTBINVAL
-export MMU_BERR
-export MMU_ENAB
-export MMU_FAULT
-export MMU_CEN
-export MMU_IEN
-export MMU_FPE
-export CACHE_ON
-export CACHE_OFF
-export CACHE_CLR
-export IC_CLEAR
-export DC_CLEAR
-
-# pte/ste bits
-export PG_V
-export PG_NV
-export PG_RO
-export PG_RW
-export PG_CI
-export PG_PROT
-export PG_FRAME
-export SG_V
-export SG_NV
-export SG_RW
-export SG_FRAME
-export SG_ISHIFT
-
-# pcb fields
-struct pcb
-member pcb_ps
-member pcb_usp
-member pcb_regs
-member PCB_FPCTX pcb_fpregs
-define SIZEOF_PCB sizeof(struct pcb)
-
-# exception frame size
-define FR_SIZE sizeof(struct trapframe)
-
-# system calls
-export SYS_execve
-
-# clock registers
-export CLKSR
-export CLKMSB1
-export CLKMSB3
-
-# frodo physical address
-export FRODO_BASE
diff --git a/sys/arch/hp300/hp300/intr.c b/sys/arch/hp300/hp300/intr.c
deleted file mode 100644
index a533b6a70a5..00000000000
--- a/sys/arch/hp300/hp300/intr.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/* $OpenBSD: intr.c,v 1.26 2013/02/02 13:34:29 miod Exp $ */
-/* $NetBSD: intr.c,v 1.5 1998/02/16 20:58:30 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Adam Glass, Gordon W. Ross, and Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Link and dispatch interrupts.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/vmmeter.h>
-
-#include <uvm/uvm_extern.h>
-
-#include "ppp.h"
-#include "bridge.h"
-
-#include <machine/cpu.h>
-#include <machine/intr.h>
-
-/*
- * The location and size of the autovectored interrupt portion
- * of the vector table.
- */
-#define ISRLOC 0x18
-
-typedef LIST_HEAD(, isr) isr_list_t;
-isr_list_t isr_list[NISR];
-
-/*
- * Default interrupt priorities.
- * IPL_BIO, IPL_NET and IPL_TTY will be adjusted when devices attach.
- */
-u_short hp300_varpsl[NISR] = {
- PSL_S | PSL_IPL0, /* IPL_NONE */
- PSL_S | PSL_IPL1, /* IPL_SOFT */
- PSL_S | PSL_IPL3, /* IPL_BIO */
- PSL_S | PSL_IPL3, /* IPL_NET */
- PSL_S | PSL_IPL3, /* IPL_TTY */
- PSL_S | PSL_IPL5, /* IPL_VM */
- PSL_S | PSL_IPL6, /* IPL_AUDIO, IPL_CLOCK */
- PSL_S | PSL_IPL7 /* IPL_HIGH */
-};
-
-void intr_computeipl(void);
-
-void
-intr_init()
-{
- int i;
-
- /* Initialize the ISR lists. */
- for (i = 0; i < NISR; ++i)
- LIST_INIT(&isr_list[i]);
-}
-
-/*
- * Scan all of the ISRs, recomputing the interrupt levels for the spl*()
- * calls. This doesn't have to be fast.
- */
-void
-intr_computeipl()
-{
- struct isr *isr;
- int ipl;
-
- /* Start with low values. */
- hp300_varpsl[IPL_BIO] = hp300_varpsl[IPL_NET] =
- hp300_varpsl[IPL_TTY] = PSL_S | PSL_IPL3;
-
- for (ipl = 0; ipl < NISR; ipl++) {
- LIST_FOREACH(isr, &isr_list[ipl], isr_link) {
- /*
- * Bump up the level for a given priority,
- * if necessary.
- */
- switch (isr->isr_priority) {
- case IPL_BIO:
- if (ipl > PSLTOIPL(hp300_varpsl[IPL_BIO]))
- hp300_varpsl[IPL_BIO] = IPLTOPSL(ipl);
- break;
-
- case IPL_NET:
- if (ipl > PSLTOIPL(hp300_varpsl[IPL_NET]))
- hp300_varpsl[IPL_NET] = IPLTOPSL(ipl);
- break;
-
- case IPL_TTY:
- if (ipl > PSLTOIPL(hp300_varpsl[IPL_TTY]))
- hp300_varpsl[IPL_TTY] = IPLTOPSL(ipl);
- break;
-
- case IPL_AUDIO:
- /* audio is always at level 6 */
- break;
-
- default:
- panic("intr_computeipl: bad priority %d",
- isr->isr_priority);
- }
- }
- }
-
- /*
- * Enforce `bio <= net <= tty <= vm'
- */
-
- if (hp300_varpsl[IPL_NET] < hp300_varpsl[IPL_BIO])
- hp300_varpsl[IPL_NET] = hp300_varpsl[IPL_BIO];
-
- if (hp300_varpsl[IPL_TTY] < hp300_varpsl[IPL_NET])
- hp300_varpsl[IPL_TTY] = hp300_varpsl[IPL_NET];
-}
-
-void
-intr_printlevels()
-{
-
-#ifdef DEBUG
- printf("psl: bio = 0x%x, net = 0x%x, tty = 0x%x\n",
- hp300_varpsl[IPL_BIO], hp300_varpsl[IPL_NET],
- hp300_varpsl[IPL_TTY]);
-#endif
-
- printf("interrupt levels: bio = %d, net = %d, tty = %d\n",
- PSLTOIPL(hp300_varpsl[IPL_BIO]), PSLTOIPL(hp300_varpsl[IPL_NET]),
- PSLTOIPL(hp300_varpsl[IPL_TTY]));
-}
-
-/*
- * Establish an interrupt handler.
- * Called by driver attach functions.
- */
-void
-intr_establish(struct isr *isr, const char *name)
-{
- struct isr *curisr;
- isr_list_t *list;
-
-#ifdef DIAGNOSTIC
- if (isr->isr_ipl < 0 || isr->isr_ipl >= NISR)
- panic("intr_establish: bad ipl %d", isr->isr_ipl);
-#endif
-
- evcount_attach(&isr->isr_count, name, &isr->isr_ipl);
-
- /*
- * Some devices are particularly sensitive to interrupt
- * handling latency. The DCA, for example, can lose many
- * characters if its interrupt isn't handled with reasonable
- * speed. For this reason, we sort ISRs by IPL_* priority,
- * inserting higher priority interrupts before lower priority
- * interrupts.
- */
-
- /*
- * Get the appropriate ISR list. If the list is empty, no
- * additional work is necessary; we simply insert ourselves
- * at the head of the list.
- */
- list = &isr_list[isr->isr_ipl];
- if (LIST_EMPTY(list)) {
- LIST_INSERT_HEAD(list, isr, isr_link);
- goto compute;
- }
-
- /*
- * A little extra work is required. We traverse the list
- * and place ourselves after any ISRs with our current (or
- * higher) priority.
- */
- for (curisr = LIST_FIRST(list);
- LIST_NEXT(curisr, isr_link) != LIST_END(list);
- curisr = LIST_NEXT(curisr, isr_link)) {
- if (isr->isr_priority > curisr->isr_priority) {
- LIST_INSERT_BEFORE(curisr, isr, isr_link);
- goto compute;
- }
- }
-
- /*
- * We're the least important entry, it seems. We just go
- * on the end.
- */
- LIST_INSERT_AFTER(curisr, isr, isr_link);
-
- compute:
- /* Compute new interrupt levels. */
- intr_computeipl();
-}
-
-/*
- * Disestablish an interrupt handler.
- */
-void
-intr_disestablish(struct isr *isr)
-{
- evcount_detach(&isr->isr_count);
- LIST_REMOVE(isr, isr_link);
- intr_computeipl();
-}
-
-/*
- * This is the dispatcher called by the low-level
- * assembly language interrupt routine.
- */
-void
-intr_dispatch(evec)
- int evec; /* format | vector offset */
-{
- struct isr *isr;
- isr_list_t *list;
- int handled, rc, ipl, vec;
- static int straycount, unexpected;
-
- vec = (evec & 0xfff) >> 2;
-#ifdef DIAGNOSTIC
- if (vec < ISRLOC || vec >= (ISRLOC + NISR))
- panic("isrdispatch: bad vec 0x%x", vec);
-#endif
- ipl = vec - ISRLOC;
-
- uvmexp.intrs++;
-
- list = &isr_list[ipl];
- if (LIST_EMPTY(list)) {
- if (ipl != IPL_CLOCK) {
- printf("intr_dispatch: ipl %d unexpected\n", ipl);
- if (++unexpected > 10)
- panic("intr_dispatch:"
- " too many unexpected interrupts");
- }
- return;
- }
-
- handled = 0;
- /* Give all the handlers a chance. */
- LIST_FOREACH(isr, list, isr_link) {
- rc = (*isr->isr_func)(isr->isr_arg);
- if (rc > 0)
- isr->isr_count.ec_count++;
- handled |= rc;
- }
-
- if (ipl != IPL_CLOCK) {
- if (handled)
- straycount = 0;
- else if (++straycount > 50)
- panic("intr_dispatch: too many stray interrupts");
- else
- printf("intr_dispatch: stray level %d interrupt\n", ipl);
- }
-}
-
-#ifdef DIAGNOSTIC
-void
-splassert_check(int wantipl, const char *func)
-{
- int oldipl, realwantipl;
-
- __asm __volatile ("movew %%sr,%0" : "=&d" (oldipl));
-
- realwantipl = PSLTOIPL(hp300_varpsl[wantipl]);
- oldipl = PSLTOIPL(oldipl);
-
- if (oldipl < realwantipl) {
- splassert_fail(realwantipl, oldipl, func);
- /*
- * If the splassert_ctl is set to not panic, raise the ipl
- * in a feeble attempt to reduce damage.
- */
- _spl(hp300_varpsl[wantipl]);
- }
-}
-#endif
diff --git a/sys/arch/hp300/hp300/kgdb_machdep.c b/sys/arch/hp300/hp300/kgdb_machdep.c
deleted file mode 100644
index 82dd1a3404d..00000000000
--- a/sys/arch/hp300/hp300/kgdb_machdep.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* $OpenBSD: kgdb_machdep.c,v 1.4 2005/11/13 17:50:44 fgsch Exp $ */
-/* $NetBSD: kgdb_machdep.c,v 1.1 1997/05/05 20:51:05 thorpej Exp $ */
-
-/*
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratories.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)kgdb_stub.c 8.4 (Berkeley) 1/12/94
- */
-
-/*
- * Machine-dependent part of the KGDB remote "stub"
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kgdb.h>
-
-#include <machine/db_machdep.h>
-#include <machine/pte.h>
-
-/*
- * Determine if the memory at va..(va+len) is valid.
- */
-int
-kgdb_acc(va, ulen)
- vaddr_t va;
- size_t ulen;
-{
- int len, pgoff;
- pt_entry_t *pte;
-
- len = (int)ulen;
- pgoff = va & PGOFSET;
- va -= pgoff;
- len += pgoff;
-
- while (len > 0) {
- pte = kvtopte(va);
- if ((*pte & PG_V) == 0)
- return (0);
- va += NBPG;
- len -= NBPG;
- }
-
- return (1);
-}
diff --git a/sys/arch/hp300/hp300/leds.c b/sys/arch/hp300/hp300/leds.c
deleted file mode 100644
index 388d8dcee43..00000000000
--- a/sys/arch/hp300/hp300/leds.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/* $OpenBSD: leds.c,v 1.8 2005/01/08 22:13:24 miod Exp $ */
-/* $NetBSD: leds.c,v 1.1 1997/05/05 20:54:35 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: machdep.c 1.74 92/12/20$
- *
- * @(#)machdep.c 8.10 (Berkeley) 4/20/94
- */
-
-#include <sys/param.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <hp300/hp300/leds.h>
-
-extern caddr_t ledbase; /* kva of LED page */
-u_int8_t *ledaddr; /* actual address of LEDs */
-static int inledcontrol; /* mutex */
-
-/*
- * Map the LED page and setup the KVA to access it.
- */
-void
-ledinit()
-{
-
- pmap_enter(pmap_kernel(), (vaddr_t)ledbase, (paddr_t)LED_ADDR,
- VM_PROT_READ|VM_PROT_WRITE, VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED);
- pmap_update(pmap_kernel());
- ledaddr = (u_int8_t *) ((long)ledbase | (LED_ADDR & PGOFSET));
-}
-
-/*
- * Do lights:
- * `ons' is a mask of LEDs to turn on,
- * `offs' is a mask of LEDs to turn off,
- * `togs' is a mask of LEDs to toggle.
- * Note we don't use splclock/splx for mutual exclusion.
- * They are expensive and we really don't need to be that precise.
- * Besides we would like to be able to profile this routine.
- */
-void
-ledcontrol(ons, offs, togs)
- int ons, offs, togs;
-{
- static u_int8_t currentleds;
- u_int8_t leds;
-
- if (inledcontrol)
- return;
-
- inledcontrol = 1;
- leds = currentleds;
- if (ons)
- leds |= ons;
- if (offs)
- leds &= ~offs;
- if (togs)
- leds ^= togs;
- currentleds = leds;
- *ledaddr = ~leds;
- inledcontrol = 0;
-}
diff --git a/sys/arch/hp300/hp300/leds.h b/sys/arch/hp300/hp300/leds.h
deleted file mode 100644
index 7efdf727a47..00000000000
--- a/sys/arch/hp300/hp300/leds.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* $OpenBSD: leds.h,v 1.3 2003/06/02 23:27:45 millert Exp $ */
-/* $NetBSD: leds.h,v 1.1 1997/05/05 20:54:36 thorpej Exp $ */
-
-/*
- * Copyright (c) 1992 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: led.h 1.2 92/08/27$
- *
- * @(#)led.h 8.1 (Berkeley) 6/10/93
- */
-
-#define LED_ADDR 0x1FFFF /* a ROM address--strange but true */
-
-#define LED_LANXMT 0x80 /* for LAN transmit activity */
-#define LED_LANRCV 0x40 /* for LAN receive activity */
-#define LED_DISK 0x20 /* for disk activity */
-#define LED_PULSE 0x10 /* heartbeat */
-
-#if defined(_KERNEL) && !defined(_LOCORE)
-void ledinit(void);
-void ledcontrol(int, int, int);
-#endif
diff --git a/sys/arch/hp300/hp300/locore.s b/sys/arch/hp300/hp300/locore.s
deleted file mode 100644
index 59d442fc97d..00000000000
--- a/sys/arch/hp300/hp300/locore.s
+++ /dev/null
@@ -1,1861 +0,0 @@
-/* $OpenBSD: locore.s,v 1.73 2013/06/30 23:47:07 miod Exp $ */
-/* $NetBSD: locore.s,v 1.91 1998/11/11 06:41:25 thorpej Exp $ */
-
-/*
- * Copyright (c) 1997 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1994, 1995 Gordon W. Ross
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1980, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: locore.s 1.66 92/12/22$
- *
- * @(#)locore.s 8.6 (Berkeley) 5/27/94
- */
-
-#include "assym.h"
-#include <machine/asm.h>
-#include <machine/trap.h>
-
-#include "audio.h"
-#include "ksyms.h"
-#ifdef USELEDS
-#include <hp300/hp300/leds.h>
-#endif
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diofbreg.h>
-
-#include "sgc.h"
-#if NSGC > 0
-#include <hp300/dev/sgcreg.h>
-#endif
-
-#define SYSFLAG 0xfffffed2
-
-#define MMUADDR(ar) movl _C_LABEL(MMUbase),ar
-#define CLKADDR(ar) movl _C_LABEL(CLKbase),ar
-
-/*
- * This is for kvm_mkdb, and should be the address of the beginning
- * of the kernel text segment (not necessarily the same as kernbase).
- */
- .chip 68020
- .text
-GLOBAL(kernel_text)
-
-/*
- * Clear and skip the first page of text; it will not be mapped.
- */
- .fill NBPG/4,4,0
-
-/*
- * Temporary stack for a variety of purposes.
- * Try and make this the first thing in the data segment so it
- * is page aligned. Note that if we overflow here, we run into
- * our text segment.
- */
- .data
- .space NBPG
-ASLOCAL(tmpstk)
-
-#include <hp300/hp300/vectors.s>
-
-/*
- * Macro to relocate a symbol, used before MMU is enabled.
- */
-#ifdef __STDC__
-#define RELOC(var, ar) \
- moveal #_C_LABEL(var),ar; \
- addl %a5,ar
-#define ASRELOC(var, ar) \
- moveal #_ASM_LABEL(var),ar; \
- addl %a5,ar
-#else
-#define _RELOC(var, ar) \
- movel #var,ar; \
- addl %a5,ar
-#define RELOC(var, ar) _RELOC(_C_LABEL(var), ar)
-#define ASRELOC(var, ar) _RELOC(_ASM_LABEL(var), ar)
-#endif
-
-/*
- * Final bits of grunt work required to reboot the system. The MMU
- * must be disabled when this is invoked.
- */
-#define DOREBOOT \
- /* Reset Vector Base Register to what PROM expects. */ \
- movl #0,%d0; \
- movc %d0,%vbr; \
- /* Jump to REQ_REBOOT */ \
- jmp 0x1A4;
-
-/*
- * Initialization
- *
- * A4 contains the address of the end of the symtab
- * A5 contains physical load point from boot
- * VBR contains zero from ROM. Exceptions will continue to vector
- * through ROM until MMU is turned on at which time they will vector
- * through our table (vectors.s).
- */
-
-BSS(lowram,4)
-BSS(esym,4)
-
-ASENTRY_NOPROFILE(start)
- movw #PSL_HIGHIPL,%sr | no interrupts
- ASRELOC(tmpstk, %a0)
- movl %a0,%sp | give ourselves a temporary stack
- RELOC(esym, %a0)
- movl %a4,%a0@ | store end of symbol table
- RELOC(lowram, %a0)
- movl %a5,%a0@ | store start of physical memory
- movl #CACHE_OFF,%d0
- movc %d0,%cacr | clear and disable on-chip cache(s)
-
- /* check for internal HP-IB in SYSFLAG */
- btst #5,SYSFLAG | internal HP-IB?
- jeq Lhaveihpib | yes, have HP-IB just continue
- RELOC(internalhpib, %a0)
- movl #0,%a0@ | no, clear associated address
-Lhaveihpib:
-
- RELOC(boothowto, %a0) | save reboot flags
- movl %d7,%a0@
- RELOC(bootdev, %a0) | and boot device
- movl %d6,%a0@
-
- /*
- * All data registers are now free. All address registers
- * except a5 are free. a5 is used by the RELOC() macro,
- * and cannot be used until after the MMU is enabled.
- */
-
-/* determine our CPU/MMU combo - check for all regardless of kernel config */
- movl #INTIOBASE+MMUBASE,%a1
- movl #0x200,%d0 | data freeze bit
- movc %d0,%cacr | only exists on 68030
- movc %cacr,%d0 | read it back
- tstl %d0 | zero?
- jeq Lnot68030 | yes, we have 68020/68040
-
- /*
- * 68030 models
- */
-
- RELOC(mmutype, %a0) | no, we have 68030
- movl #MMU_68030,%a0@ | set to reflect 68030 PMMU
- RELOC(cputype, %a0)
- movl #CPU_68030,%a0@ | and 68030 CPU
- RELOC(machineid, %a0)
- movl #0x80,%a1@(MMUCMD) | set magic cookie
- movl %a1@(MMUCMD),%d0 | read it back
- btst #7,%d0 | cookie still on?
- jeq Lnot370 | no, 360 or 375
- movl #0,%a1@(MMUCMD) | clear magic cookie
- movl %a1@(MMUCMD),%d0 | read it back
- btst #7,%d0 | still on?
- jeq Lisa370 | no, must be a 370
- movl #HP_340,%a0@ | yes, must be a 340
- jra Lstart1
-Lnot370:
- movl #HP_36X,%a0@ | type is at least a 360
- movl #0,%a1@(MMUCMD) | clear magic cookie2
- movl %a1@(MMUCMD),%d0 | read it back
- btst #16,%d0 | still on?
- jeq Lisa36x | no, must be a 360 or a 362
- RELOC(mmuid, %a0) | save MMU ID
- lsrl #MMUID_SHIFT,%d0
- andl #MMUID_MASK,%d0
- movl %d0,%a0@
- RELOC(machineid, %a0)
- cmpb #MMUID_345,%d0 | are we a 345?
- beq Lisa345
- cmpb #MMUID_375,%d0 | how about a 375?
- beq Lisa375
- movl #HP_400,%a0@ | must be a 400
- jra Lhaspac
-Lisa345:
- movl #HP_345,%a0@
- jra Lhaspac
-Lisa375:
- movl #HP_375,%a0@
- jra Lhaspac
-Lisa370:
- movl #HP_370,%a0@ | set to 370
-Lhaspac:
- RELOC(ectype, %a0)
- movl #EC_PHYS,%a0@ | also has a physical address cache
- jra Lstart1
-
- /*
- * End of 68030 section
- */
-
-Lnot68030:
- bset #31,%d0 | data cache enable bit
- movc %d0,%cacr | only exists on 68040
- movc %cacr,%d0 | read it back
- tstl %d0 | zero?
- beq Lis68020 | yes, we have 68020
- moveq #CACHE40_OFF,%d0 | now turn it back off
- movc %d0,%cacr | before we access any data
-
- /*
- * 68040 models
- */
-
- RELOC(mmutype, %a0)
- movl #MMU_68040,%a0@ | with a 68040 MMU
- RELOC(cputype, %a0)
- movl #CPU_68040,%a0@ | and a 68040 CPU
- RELOC(fputype, %a0)
- movl #FPU_68040,%a0@ | ...and FPU
- RELOC(ectype, %a0)
- movl #EC_NONE,%a0@ | and no cache (for now XXX)
- RELOC(mmuid, %a0)
- movl %a1@(MMUCMD),%d0 | read MMU register
- lsrl #MMUID_SHIFT,%d0
- andl #MMUID_MASK,%d0
- movl %d0,%a0@ | save MMU ID
- RELOC(machineid, %a0)
- cmpb #MMUID_425_T,%d0 | are we a 425t?
- jeq Lisa425
- cmpb #MMUID_425_S,%d0 | how about 425s?
- jeq Lisa425
- cmpb #MMUID_425_E,%d0 | or maybe a 425e?
- jeq Lisa425
- cmpb #MMUID_433_T,%d0 | or a 433t?
- jeq Lisa433
- cmpb #MMUID_433_S,%d0 | maybe a 433s?
- jeq Lisa433
- cmpb #MMUID_385,%d0 | then a 385?
- jeq Lisa385
- cmpb #MMUID_382,%d0 | last chance...
- jeq Lisa382
- movl #HP_380,%a0@ | guess we're a 380
- jra Lstart1
-Lisa425:
- movl #HP_425,%a0@
- jra Lstart1
-Lisa433:
- movl #HP_433,%a0@
- jra Lstart1
-Lisa385:
- movl #HP_385,%a0@
- jra Lstart1
-Lisa382:
- movl #HP_382,%a0@
- jra Lstart1
-
- /*
- * End of 68040 section
- */
-
- /*
- * 68020 models
- */
-
-Lis68020:
- RELOC(fputype, %a0) | all of the 68020 systems
- movl #FPU_68881,%a0@ | have a 68881 FPU
- movl #1,%a1@(MMUCMD) | a 68020, write HP MMU location
- movl %a1@(MMUCMD),%d0 | read it back
- btst #0,%d0 | non-zero?
- jne Lunsupp | yes, we have HP MMU
- RELOC(mmutype, %a0)
- movl #MMU_68851,%a0@ | no, we have PMMU
- RELOC(machineid, %a0)
- movl #HP_330,%a0@ | and 330 CPU
- jra Lstart1
-
- /*
- * End of 68020 section
- */
-
-Lisa36x:
- /*
- * There is currently no easy way of telling a 362 and a 360
- * apart, except perhaps checking for the 362 frame buffer if
- * it isn't disabled.
- */
- /* FALLTHROUGH */
-
-Lstart1:
- /*
- * Now we need to know how much space the external I/O map has to be.
- * This has to be done before pmap_bootstrap() is invoked, but since
- * we are not running in virtual mode and will cause several bus
- * errors while probing, it is easier to do this before setting up
- * our own vectors table.
- */
- clrl %d3
-
- /*
- * Don't probe the DIO-I space, simply assume the whole 0-31
- * select code range is taken, i.e. 32 boards.
- */
- addl #(DIO_DEVSIZE * 32), %d3
-
- /*
- * Check the ``internal'' frame buffer address. If there is one,
- * assume an extra 2MB of frame buffer memory at 0x200000.
- */
- movl #GRFIADDR, %a0
- ASRELOC(phys_badaddr, %a3)
- jbsr %a3@
- tstl %d0 | success?
- jne dioiicheck | no, skip
- movl #0x200000, %d1 | yes, add the 200000-400000 range
- addl %d1, %d3
-
- /*
- * Probe for DIO-II devices, select codes 132 to 255.
- */
-dioiicheck:
- RELOC(machineid,%a0)
- cmpl #HP_320,%a0@
- jeq eiodone | HP 320 has nothing more
-
- movl #DIOII_SCBASE, %d2 | our select code...
- movl #DIOII_BASE, %a0 | and first address
-dioloop:
- ASRELOC(phys_badaddr, %a3)
- jbsr %a3@ | probe address (read ID)
- movl #DIOII_DEVSIZE, %d1
- tstl %d0 | success?
- jne 1f | no, skip
- addl %d1, %d3 | yes, count it
-1:
- addl %d1, %a0 | next slot address...
- addql #1, %d2 | and slot number
- cmpl #256, %d2
- jne dioloop
-
-#if NSGC > 0
- /*
- * Probe for SGC devices, slots 0 to 3.
- * Only do the probe on machines which might have an SGC bus.
- */
- RELOC(machineid,%a0)
- cmpl #HP_400,%a0@
- jeq sgcprobe
- cmpl #HP_425,%a0@
- jeq sgcprobe
- cmpl #HP_433,%a0@
- jne eiodone
-sgcprobe:
- clrl %d2 | first slot...
- movl #SGC_BASE, %a0 | and first address
-sgcloop:
- ASRELOC(phys_badaddr, %a3)
- jbsr %a3@ | probe address
- movl #SGC_DEVSIZE, %d1
- tstl %d0 | success?
- jne 2f | no, skip
- addl %d1, %d3 | yes, count it
-2:
- addl %d1, %a0 | next slot address...
- addql #1, %d2 | and slot number
- cmpl #SGC_NSLOTS, %d2
- jne sgcloop
-#endif
-
-eiodone:
- moveq #PGSHIFT, %d2
- lsrl %d2, %d3 | convert from bytes to pages
- RELOC(eiomapsize,%a2)
- addql #1, %d3 | add an extra page for device probes
- movl %d3,%a2@
-
- /*
- * Now that we know what CPU we have, initialize the address error
- * and bus error handlers in the vector table:
- *
- * vectab+8 bus error
- * vectab+12 address error
- */
- RELOC(cputype, %a0)
- RELOC(vectab, %a2)
-#if defined(M68040)
- cmpl #CPU_68040,%a0@ | 68040?
- jne 1f | no, skip
- movl #_C_LABEL(buserr40),%a2@(8)
- movl #_C_LABEL(addrerr4060),%a2@(12)
- jra Lstart2
-1:
-#endif
-#if defined(M68020) || defined(M68030)
- cmpl #CPU_68040,%a0@ | 68040?
- jeq 1f | yes, skip
- movl #_C_LABEL(busaddrerr2030),%a2@(8)
- movl #_C_LABEL(busaddrerr2030),%a2@(12)
- jra Lstart2
-1:
-#endif
-Lunsupp:
- /* Config botch; no hope. */
- DOREBOOT
-
-Lstart2:
-/* initialize source/destination control registers for movs */
- moveq #FC_USERD,%d0 | user space
- movc %d0,%sfc | as source
- movc %d0,%dfc | and destination of transfers
-/* initialize memory size (for pmap_bootstrap) */
- movl #MAXADDR,%d1 | last page
- movl %a5,%d0 | lowram value from ROM via boot
- moveq #PGSHIFT,%d2
- subl %d0,%d1 | compute amount of RAM present
- lsrl %d2,%d1 | convert to pages
- addl #3,%d1 | restore the 3 pages lost (2 from
- | the bootloader and the MAXADDR one)
- RELOC(physmem, %a0)
- movl %d1,%a0@ | save as physmem
-
-/* configure kernel and proc0 VA space so we can get going */
-#if defined(DDB) || NKSYMS > 0
- RELOC(esym,%a0) | end of static kernel test/data/syms
- movl %a0@,%d5
- jne Lstart3
-#endif
- movl #_C_LABEL(end),%d5 | end of static kernel text/data
-Lstart3:
- addl #NBPG-1,%d5
- andl #PG_FRAME,%d5 | round to a page
- movl %d5,%a4
- addl %a5,%a4 | convert to PA
- pea %a5@ | firstpa
- pea %a4@ | nextpa
- RELOC(pmap_bootstrap,%a0)
- jbsr %a0@ | pmap_bootstrap(firstpa, nextpa)
- addql #8,%sp
-
-/*
- * While still running physical, override copypage() with the 68040
- * optimized version, copypage040(), if possible.
- * This relies upon the fact that copypage() immediately follows
- * copypage040() in memory.
- */
- RELOC(mmutype, %a0)
- cmpl #MMU_68040,%a0@
- jgt Lmmu_enable
- RELOC(copypage040, %a0)
- RELOC(copypage, %a1)
- movl %a1, %a2
-1:
- movw %a0@+, %a2@+
- cmpl %a0, %a1
- jgt 1b
-
-/*
- * Prepare to enable MMU.
- * Since the kernel is not mapped logical == physical we must insure
- * that when the MMU is turned on, all prefetched addresses (including
- * the PC) are valid. In order to guarantee that, we use the last physical
- * page (which is conveniently mapped == VA) and load it up with enough
- * code to defeat the prefetch, then we execute the jump back to here.
- *
- * Is this all really necessary, or am I paranoid??
- */
-Lmmu_enable:
- RELOC(Sysseg, %a0) | system segment table addr
- movl %a0@,%d1 | read value (a KVA)
- addl %a5,%d1 | convert to PA
- RELOC(mmutype, %a0)
- cmpl #MMU_68040,%a0@ | 68040?
- jne Lmotommu1 | no, skip
- .chip 68040
- movc %d1,%srp
- .chip 68020
- jra Lstploaddone
-Lmotommu1:
- ASRELOC(protorp, %a0)
- movl #0x80000202,%a0@ | nolimit + share global + 4 byte PTEs
- movl %d1,%a0@(4) | + segtable address
- pmove %a0@,%srp | load the supervisor root pointer
- movl #0x80000002,%a0@ | reinit upper half for CRP loads
-
-Lstploaddone:
- lea MAXADDR,%a2 | PA of last RAM page
- ASRELOC(Lhighcode, %a1) | addr of high code
- ASRELOC(Lehighcode, %a3) | end addr
-Lcodecopy:
- movw %a1@+,%a2@+ | copy a word
- cmpl %a3,%a1 | done yet?
- jcs Lcodecopy | no, keep going
- jmp MAXADDR | go for it!
-
- /*
- * BEGIN MMU TRAMPOLINE. This section of code is not
- * executed in-place. It's copied to the last page
- * of RAM (mapped va == pa) and executed there.
- */
-
-Lhighcode:
- /*
- * Set up the vector table, and race to get the MMU
- * enabled.
- */
- movl #_C_LABEL(vectab),%d0 | set Vector Base Register
- movc %d0,%vbr
-
- RELOC(mmutype, %a0)
- cmpl #MMU_68040,%a0@ | 68040?
- jne Lmotommu2 | no, skip
- .chip 68040
- movw #0,INTIOBASE+MMUBASE+MMUCMD+2
- movw #MMU_IEN+MMU_CEN+MMU_FPE,INTIOBASE+MMUBASE+MMUCMD+2
- | enable FPU and caches
- moveq #0,%d0 | ensure TT regs are disabled
- movc %d0,%itt0
- movc %d0,%itt1
- movc %d0,%dtt1
-
- /*
- * Set up transparent translation for supervisor data access.
- * The range 0xc0000000-0xffffffff will not be translated, and
- * thus yields a 1:1 mapping of the physical memory in the top
- * of the address space (as long as we don't have more than
- * 1GB of memory, which will be very unlikely...)
- */
- movl #0xc03fa020,%d0
- movc %d0,%dtt0
-
- cinva %bc
- pflusha
- movl #0x8000,%d0
- movc %d0,%tc
- movl #CACHE40_ON,%d0
- movc %d0,%cacr | turn on both caches
- jmp Lenab1:l | forced to not be pc-relative
- .chip 68020
-Lmotommu2:
- cmpl #MMU_68030,%a0@ | 68030?
- jne Lmotommu2b | no, skip
- .chip 68030
- /*
- * Set up transparent translation for supervisor data access
- * (FC == 5), similar to the 68040 logic above.
- */
- ASRELOC(mmuscratch, %a2)
- movl #0xc03f8150,%a2@ | build our TT0 value
- pmove %a2@,%tt0
- .chip 68020
-Lmotommu2b:
- movl #MMU_IEN+MMU_FPE,INTIOBASE+MMUBASE+MMUCMD
- | enable MMU and i-cache
- ASRELOC(mmuscratch, %a2)
- movl #0x82c0aa00,%a2@ | value to load TC with
- pmove %a2@,%tc | load it
- jmp Lenab1:l | forced to not be pc-relative
-Lehighcode:
-
- /*
- * END MMU TRAMPOLINE. Address register a5 is now free.
- */
-
-/*
- * Should be running mapped from this point on
- */
-Lenab1:
-/* select the software page size now */
- lea _ASM_LABEL(tmpstk),%sp | temporary stack
- jbsr _C_LABEL(uvm_setpagesize) | select software page size
-/* set kernel stack, user SP, and initial pcb */
- movl _C_LABEL(proc0paddr),%a1 | get proc0 pcb addr
- lea %a1@(USPACE-4),%sp | set kernel stack to end of area
- lea _C_LABEL(proc0),%a2 | initialize proc0.p_addr so that
- movl %a1,%a2@(P_ADDR) | we don't deref NULL in trap()
- movl #USRSTACK-4,%a2
- movl %a2,%usp | init user SP
- movl %a1,_C_LABEL(curpcb) | proc0 is running
-
- tstl _C_LABEL(fputype) | Have an FPU?
- jeq Lenab2 | No, skip.
- clrl %a1@(PCB_FPCTX) | ensure null FP context
- movl %a1,%sp@-
- jbsr _C_LABEL(m68881_restore) | restore it (does not kill a1)
- addql #4,%sp
-Lenab2:
-/* flush TLB and turn on caches */
- jbsr _ASM_LABEL(TBIA) | invalidate TLB
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040?
- jeq Lnocache0 | yes, cache already on
- movl #CACHE_ON,%d0
- movc %d0,%cacr | clear cache(s)
- tstl _C_LABEL(ectype)
- jeq Lnocache0
- MMUADDR(%a0)
- orl #MMU_CEN,%a0@(MMUCMD) | turn on external cache
-Lnocache0:
-/* Final setup for call to main(). */
- jbsr _C_LABEL(hp300_init)
-
-/*
- * Create a fake exception frame so that cpu_fork() can copy it.
- * main() never returns; we exit to user mode from a forked process
- * later on.
- */
- clrw %sp@- | vector offset/frame type
- clrl %sp@- | PC - filled in by "execve"
- movw #PSL_USER,%sp@- | in user mode
- clrl %sp@- | stack adjust count and padding
- lea %sp@(-64),%sp | construct space for D0-D7/A0-A7
- lea _C_LABEL(proc0),%a0 | save pointer to frame
- movl %sp,%a0@(P_MD_REGS) | in proc0.p_md.md_regs
-
- jra _C_LABEL(main) | main()
- PANIC("main() returned")
- /* NOTREACHED */
-
-/*
- * proc_trampoline: call function in register a2 with a3 as an arg
- * and then rei.
- */
-GLOBAL(proc_trampoline)
- movl %a3,%sp@- | push function arg
- jbsr %a2@ | call function
- addql #4,%sp | pop arg
- movl %sp@(FR_SP),%a0 | grab and load
- movl %a0,%usp | user SP
- moveml %sp@+,#0x7FFF | restore most user regs
- addql #8,%sp | toss SP and stack adjust
- jra _ASM_LABEL(rei) | and return
-
-
-/*
- * Trap/interrupt vector routines
- */
-#include <m68k/m68k/trap_subr.s>
-
- .data
-GLOBAL(m68k_fault_addr)
- .long 0
-
-#if defined(M68040)
-ENTRY_NOPROFILE(addrerr4060)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save user registers
- movl %usp,%a0 | save the user SP
- movl %a0,%sp@(FR_SP) | in the savearea
- movl %sp@(FR_HW+8),%sp@-
- clrl %sp@- | dummy code
- movl #T_ADDRERR,%sp@- | mark address error
- jra _ASM_LABEL(faultstkadj) | and deal with it
-
-ENTRY_NOPROFILE(buserr40)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save user registers
- movl %usp,%a0 | save the user SP
- movl %a0,%sp@(FR_SP) | in the savearea
- movl %sp@(FR_HW+20),%d1 | get fault address
- moveq #0,%d0
- movw %sp@(FR_HW+12),%d0 | get SSW
- btst #11,%d0 | check for mis-aligned
- jeq Lbe1stpg | no skip
- addl #3,%d1 | get into next page
- andl #PG_FRAME,%d1 | and truncate
-Lbe1stpg:
- movl %d1,%sp@- | pass fault address.
- movl %d0,%sp@- | pass SSW as code
- btst #10,%d0 | test ATC
- jeq Lberr40 | it is a bus error
- movl #T_MMUFLT,%sp@- | show that we are an MMU fault
- jra _ASM_LABEL(faultstkadj) | and deal with it
-Lberr40:
- tstl _C_LABEL(nofault) | catch bus error?
- jeq Lisberr | no, handle as usual
- movl %sp@(FR_HW+8+20),_C_LABEL(m68k_fault_addr) | save fault addr
- movl _C_LABEL(nofault),%sp@- | yes,
- jbsr _C_LABEL(longjmp) | longjmp(nofault)
- /* NOTREACHED */
-#endif
-
-#if defined(M68020) || defined(M68030)
-ENTRY_NOPROFILE(busaddrerr2030)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save user registers
- movl %usp,%a0 | save the user SP
- movl %a0,%sp@(FR_SP) | in the savearea
- moveq #0,%d0
- movw %sp@(FR_HW+10),%d0 | grab SSW for fault processing
- btst #12,%d0 | RB set?
- jeq LbeX0 | no, test RC
- bset #14,%d0 | yes, must set FB
- movw %d0,%sp@(FR_HW+10) | for hardware too
-LbeX0:
- btst #13,%d0 | RC set?
- jeq LbeX1 | no, skip
- bset #15,%d0 | yes, must set FC
- movw %d0,%sp@(FR_HW+10) | for hardware too
-LbeX1:
- btst #8,%d0 | data fault?
- jeq Lbe0 | no, check for hard cases
- movl %sp@(FR_HW+16),%d1 | fault address is as given in frame
- jra Lbe10 | thats it
-Lbe0:
- btst #4,%sp@(FR_HW+6) | long (type B) stack frame?
- jne Lbe4 | yes, go handle
- movl %sp@(FR_HW+2),%d1 | no, can use save PC
- btst #14,%d0 | FB set?
- jeq Lbe3 | no, try FC
- addql #4,%d1 | yes, adjust address
- jra Lbe10 | done
-Lbe3:
- btst #15,%d0 | FC set?
- jeq Lbe10 | no, done
- addql #2,%d1 | yes, adjust address
- jra Lbe10 | done
-Lbe4:
- movl %sp@(FR_HW+36),%d1 | long format, use stage B address
- btst #15,%d0 | FC set?
- jeq Lbe10 | no, all done
- subql #2,%d1 | yes, adjust address
-Lbe10:
- movl %d1,%sp@- | push fault VA
- movl %d0,%sp@- | and padded SSW
- movw %sp@(FR_HW+8+6),%d0 | get frame format/vector offset
- andw #0x0FFF,%d0 | clear out frame format
- cmpw #12,%d0 | address error vector?
- jeq Lisaerr | yes, go to it
- movl %d1,%a0 | fault address
- movl %sp@,%d0 | function code from ssw
- btst #8,%d0 | data fault?
- jne Lbe10a
- movql #1,%d0 | user program access FC
- | (we dont separate data/program)
- btst #5,%sp@(FR_HW+8) | supervisor mode?
- jeq Lbe10a | if no, done
- movql #5,%d0 | else supervisor program access
-Lbe10a:
- ptestr %d0,%a0@,#7 | do a table search
- pmove %psr,%sp@ | save result
- movb %sp@,%d1
- btst #2,%d1 | invalid (incl. limit viol. and berr)?
- jeq Lmightnotbemerr | no -> wp check
- btst #7,%d1 | is it MMU table berr?
- jne Lisberr1 | yes, needs not be fast.
-Lismerr:
- movl #T_MMUFLT,%sp@- | show that we are an MMU fault
- jra _ASM_LABEL(faultstkadj) | and deal with it
-Lmightnotbemerr:
- btst #3,%d1 | write protect bit set?
- jeq Lisberr1 | no: must be bus error
- movl %sp@,%d0 | ssw into low word of d0
- andw #0xc0,%d0 | Write protect is set on page:
- cmpw #0x40,%d0 | was it read cycle?
- jne Lismerr | no, was not WPE, must be MMU fault
- jra Lisberr1 | real bus err needs not be fast.
-Lisaerr:
- movl #T_ADDRERR,%sp@- | mark address error
- jra _ASM_LABEL(faultstkadj) | and deal with it
-Lisberr1:
- clrw %sp@ | re-clear pad word
- tstl _C_LABEL(nofault) | catch bus error?
- jeq Lisberr | no, handle as usual
- movl %sp@(FR_HW+8+16),_C_LABEL(m68k_fault_addr) | save fault addr
- movl _C_LABEL(nofault),%sp@- | yes,
- jbsr _C_LABEL(longjmp) | longjmp(nofault)
- /* NOTREACHED */
-#endif /* M68020 || M68030 */
-
-Lisberr: | also used by M68040/60
- movl #T_BUSERR,%sp@- | mark bus error
- jra _ASM_LABEL(faultstkadj) | and deal with it
-
-/*
- * FP exceptions.
- */
-ENTRY_NOPROFILE(fpfline)
-#if defined(M68040)
- cmpl #FPU_68040,_C_LABEL(fputype) | 68040 FPU?
- jne Lfp_unimp | no, skip FPSP
- cmpw #0x202c,%sp@(6) | format type 2?
- jne _C_LABEL(illinst) | no, not an FP emulation
-Ldofp_unimp:
-#ifdef FPSP
- jmp _ASM_LABEL(fpsp_unimp) | yes, go handle it
-#endif
-Lfp_unimp:
-#endif /* M68040 */
-#ifdef FPU_EMULATE
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save registers
- moveq #T_FPEMULI,%d0 | denote as FP emulation trap
- jra _ASM_LABEL(fault) | do it
-#else
- jra _C_LABEL(illinst)
-#endif
-
-ENTRY_NOPROFILE(fpunsupp)
-#if defined(M68040)
- cmpl #FPU_68040,_C_LABEL(fputype) | 68040 FPU?
- jne _C_LABEL(illinst) | no, treat as illinst
-#ifdef FPSP
- jmp _ASM_LABEL(fpsp_unsupp) | yes, go handle it
-#endif
-Lfp_unsupp:
-#endif /* M68040 */
-#ifdef FPU_EMULATE
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save registers
- moveq #T_FPEMULD,%d0 | denote as FP emulation trap
- jra _ASM_LABEL(fault) | do it
-#else
- jra _C_LABEL(illinst)
-#endif
-
-/*
- * Handles all other FP coprocessor exceptions.
- * Note that since some FP exceptions generate mid-instruction frames
- * and may cause signal delivery, we need to test for stack adjustment
- * after the trap call.
- */
-ENTRY_NOPROFILE(fpfault)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save user registers
- movl %usp,%a0 | and save
- movl %a0,%sp@(FR_SP) | the user stack pointer
- clrl %sp@- | no VA arg
- movl _C_LABEL(curpcb),%a0 | current pcb
- lea %a0@(PCB_FPCTX),%a0 | address of FP savearea
- fsave %a0@ | save state
-#if defined(M68040) || defined(M68060)
- /* always null state frame on 68040, 68060 */
- cmpl #FPU_68040,_C_LABEL(fputype)
- jge Lfptnull
-#endif
- tstb %a0@ | null state frame?
- jeq Lfptnull | yes, safe
- clrw %d0 | no, need to tweak BIU
- movb %a0@(1),%d0 | get frame size
- bset #3,%a0@(0,%d0:w) | set exc_pend bit of BIU
-Lfptnull:
- fmovem %fpsr,%sp@- | push fpsr as code argument
- frestore %a0@ | restore state
- movl #T_FPERR,%sp@- | push type arg
- jra _ASM_LABEL(faultstkadj) | call trap and deal with stack cleanup
-
-/*
- * Other exceptions only cause four and six word stack frame and require
- * no post-trap stack adjustment.
- */
-
-ENTRY_NOPROFILE(badtrap)
- moveml #0xC0C0,%sp@- | save scratch regs
- movw %sp@(22),%sp@- | push exception vector info
- clrw %sp@-
- movl %sp@(22),%sp@- | and PC
- jbsr _C_LABEL(straytrap) | report
- addql #8,%sp | pop args
- moveml %sp@+,#0x0303 | restore regs
- jra _ASM_LABEL(rei) | all done
-
-ENTRY_NOPROFILE(trap0)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save user registers
- movl %usp,%a0 | save the user SP
- movl %a0,%sp@(FR_SP) | in the savearea
- movl %d0,%sp@- | push syscall number
- jbsr _C_LABEL(syscall) | handle it
- addql #4,%sp | pop syscall arg
- tstl _C_LABEL(astpending)
- jne Lrei2
- tstl _C_LABEL(softpending)
- jeq Ltrap1
- movw #SPL1,%sr
- tstl _C_LABEL(softpending)
- jne Lsir1
-Ltrap1:
- movl %sp@(FR_SP),%a0 | grab and restore
- movl %a0,%usp | user SP
- moveml %sp@+,#0x7FFF | restore most registers
- addql #8,%sp | pop SP and stack adjust
- rte
-
-/*
- * Trap 1 - sigreturn
- */
-ENTRY_NOPROFILE(trap1)
- jra _ASM_LABEL(sigreturn)
-
-/*
- * Trap 2 - trace trap
- */
-ENTRY_NOPROFILE(trap2)
- jra _C_LABEL(trace)
-
-/*
- * Trap 12 is the entry point for the cachectl "syscall"
- * cachectl(command, addr, length)
- * command in d0, addr in a1, length in d1
- */
-ENTRY_NOPROFILE(trap12)
- movl %d1,%sp@- | push length
- movl %a1,%sp@- | push addr
- movl %d0,%sp@- | push command
- movl CURPROC,%sp@- | push proc pointer
- jbsr _C_LABEL(cachectl) | do it
- lea %sp@(16),%sp | pop args
- jra _ASM_LABEL(rei) | all done
-
-/*
- * Trace (single-step) trap. Kernel-mode is special.
- * User mode traps are simply passed on to trap().
- */
-ENTRY_NOPROFILE(trace)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@-
- moveq #T_TRACE,%d0
-
- | Check PSW and see what happened.
- | T=0 S=0 (should not happen)
- | T=1 S=0 trace trap from user mode
- | T=0 S=1 trace trap on a trap instruction
- | T=1 S=1 trace trap from system mode (kernel breakpoint)
-
- movw %sp@(FR_HW),%d1 | get PSW
- notw %d1 | XXX no support for T0 on 680[234]0
- andw #PSL_TS,%d1 | from system mode (T=1, S=1)?
- jeq Lkbrkpt | yes, kernel breakpoint
- jra _ASM_LABEL(fault) | no, user-mode fault
-
-/*
- * Trap 15 is used for:
- * - GDB breakpoints (in user programs)
- * - KGDB breakpoints (in the kernel)
- * - trace traps for SUN binaries (not fully supported yet)
- * User mode traps are simply passed to trap().
- */
-ENTRY_NOPROFILE(trap15)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@-
- moveq #T_TRAP15,%d0
- movw %sp@(FR_HW),%d1 | get PSW
- andw #PSL_S,%d1 | from system mode?
- jne Lkbrkpt | yes, kernel breakpoint
- jra _ASM_LABEL(fault) | no, user-mode fault
-
-Lkbrkpt: | Kernel-mode breakpoint or trace trap. (d0=trap_type)
- | Save the system sp rather than the user sp.
- movw #PSL_HIGHIPL,%sr | lock out interrupts
- lea %sp@(FR_SIZE),%a6 | Save stack pointer
- movl %a6,%sp@(FR_SP) | from before trap
-
- | If we are not on tmpstk switch to it.
- | (so debugger can change the stack pointer)
- movl %a6,%d1
- cmpl #_ASM_LABEL(tmpstk),%d1
- jls Lbrkpt2 | already on tmpstk
- | Copy frame to the temporary stack
- movl %sp,%a0 | a0=src
- lea _ASM_LABEL(tmpstk)-96,%a1 | a1=dst
- movl %a1,%sp | sp=new frame
- moveq #FR_SIZE,%d1
-Lbrkpt1:
- movl %a0@+,%a1@+
- subql #4,%d1
- bgt Lbrkpt1
-
-Lbrkpt2:
- | Call the trap handler for the kernel debugger.
- | Do not call trap() to do it, so that we can
- | set breakpoints in trap() if we want. We know
- | the trap type is either T_TRACE or T_BREAKPOINT.
- | If we have both DDB and KGDB, let KGDB see it first,
- | because KGDB will just return 0 if not connected.
- | Save args in d2, a2
- movl %d0,%d2 | trap type
- movl %sp,%a2 | frame ptr
-#ifdef KGDB
- | Let KGDB handle it (if connected)
- movl %a2,%sp@- | push frame ptr
- movl %d2,%sp@- | push trap type
- jbsr _C_LABEL(kgdb_trap) | handle the trap
- addql #8,%sp | pop args
- cmpl #0,%d0 | did kgdb handle it?
- jne Lbrkpt3 | yes, done
-#endif
-#ifdef DDB
- | Let DDB handle it
- movl %a2,%sp@- | push frame ptr
- movl %d2,%sp@- | push trap type
- jbsr _C_LABEL(kdb_trap) | handle the trap
- addql #8,%sp | pop args
-#if 0 /* not needed on hp300 */
- cmpl #0,%d0 | did ddb handle it?
- jne Lbrkpt3 | yes, done
-#endif
-#endif
- /* Sun 3 drops into PROM here. */
-Lbrkpt3:
- | The stack pointer may have been modified, or
- | data below it modified (by kgdb push call),
- | so push the hardware frame at the current sp
- | before restoring registers and returning.
-
- movl %sp@(FR_SP),%a0 | modified sp
- lea %sp@(FR_SIZE),%a1 | end of our frame
- movl %a1@-,%a0@- | copy 2 longs with
- movl %a1@-,%a0@- | ... predecrement
- movl %a0,%sp@(FR_SP) | sp = h/w frame
- moveml %sp@+,#0x7FFF | restore all but sp
- movl %sp@,%sp | ... and sp
- rte | all done
-
-/*
- * Use common m68k sigreturn.
- */
-#include <m68k/m68k/sigreturn.s>
-
-/*
- * Interrupt handlers.
- * All device interrupts are auto-vectored. The CPU provides
- * the vector 0x18+level. Note we count spurious interrupts, but
- * we don't do anything else with them.
- */
-
-#define INTERRUPT_SAVEREG moveml #0xC0C0,%sp@-
-#define INTERRUPT_RESTOREREG moveml %sp@+,#0x0303
-
-ENTRY_NOPROFILE(spurintr) /* level 0 */
- addql #1,_C_LABEL(uvmexp)+UVMEXP_INTRS
- jra _ASM_LABEL(rei)
-
-ENTRY_NOPROFILE(intrhand) /* levels 2 through 5 */
- INTERRUPT_SAVEREG
- movw %sp@(22),%sp@- | push exception vector info
- clrw %sp@-
- jbsr _C_LABEL(intr_dispatch) | call dispatch routine
- addql #4,%sp
- INTERRUPT_RESTOREREG
- jra _ASM_LABEL(rei) | all done
-
-ENTRY_NOPROFILE(lev6intr) /* level 6: clock */
- INTERRUPT_SAVEREG
- CLKADDR(%a0)
- movb %a0@(CLKSR),%d0 | read clock status
-Lclkagain:
- btst #0,%d0 | clear timer1 int immediately to
- jeq Lnotim1 | minimize chance of losing another
- movpw %a0@(CLKMSB1),%d1 | due to statintr processing delay
- movl _C_LABEL(clkint),%d1 | clkcounter += clkint
- addl %d1,_C_LABEL(clkcounter)
-Lnotim1:
- btst #2,%d0 | timer3 interrupt?
- jeq Lnotim3 | no, skip statclock
- movpw %a0@(CLKMSB3),%d1 | clear timer3 interrupt
- lea %sp@(16),%a1 | a1 = &clockframe
- movl %d0,%sp@- | save status
- movl %a1,%sp@-
- jbsr _C_LABEL(statintr) | statintr(&frame)
- addql #4,%sp
- movl %sp@+,%d0 | restore pre-statintr status
- CLKADDR(%a0)
-Lnotim3:
- btst #0,%d0 | timer1 interrupt?
- jeq Lrecheck | no, skip hardclock
- lea %sp@(16),%a1 | a1 = &clockframe
- movl %a1,%sp@-
-#ifdef USELEDS
- tstl _C_LABEL(ledaddr) | using LEDs?
- jeq Lnoleds0 | no, skip this code
- movl _ASM_LABEL(heartbeat),%d0 | get tick count
- addql #1,%d0 | increment
- movl _C_LABEL(hz),%d1
- addl #50,%d1 | get the timing a little closer
- cmpl #0,_ASM_LABEL(beatstatus) | time to slow down?
- jeq Lslowthrob | yes, slow down
- lsrl #3,%d1 | no, fast throb
-Lslowthrob:
- lsrl #1,%d1 | slow throb
- cmpl %d0,%d1 | are we there yet?
- jne Lnoleds1 | no, nothing to do
- addl #1,_ASM_LABEL(beatstatus) | incr beat status
- cmpl #3,_ASM_LABEL(beatstatus) | time to reset?
- ble Ltwinkle | no, twinkle the lights
- movl #0,_ASM_LABEL(beatstatus) | reset the status indicator
-Ltwinkle:
- movl #LED_PULSE,%sp@-
- movl #LED_DISK+LED_LANRCV+LED_LANXMT,%sp@-
- clrl %sp@-
- jbsr _C_LABEL(ledcontrol) | toggle pulse, turn all others off
- lea %sp@(12),%sp
- movql #0,%d0
-Lnoleds1:
- movl %d0,_ASM_LABEL(heartbeat)
-Lnoleds0:
-#endif /* USELEDS */
- jbsr _C_LABEL(clockintr) | clockintr(&frame)
- addql #4,%sp
- CLKADDR(%a0)
-Lrecheck:
- addql #1,_C_LABEL(uvmexp)+UVMEXP_INTRS | chalk up another interrupt
- movb %a0@(CLKSR),%d0 | see if anything happened
- jmi Lclkagain | while we were in clockintr/statintr
-#if NAUDIO >0
- movw %sp@(22),%sp@- | push exception vector info
- clrw %sp@-
- jbsr _C_LABEL(intr_dispatch) | call dispatch routine
- addql #4,%sp
-#endif
- INTERRUPT_RESTOREREG
- jra _ASM_LABEL(rei) | all done
-
-ENTRY_NOPROFILE(lev7intr) /* level 7: parity errors, reset key */
- clrl %sp@-
- moveml #0xFFFF,%sp@- | save registers
- movl %usp,%a0 | and save
- movl %a0,%sp@(FR_SP) | the user stack pointer
- jbsr _C_LABEL(nmihand) | call handler
- movl %sp@(FR_SP),%a0 | restore
- movl %a0,%usp | user SP
- moveml %sp@+,#0x7FFF | and remaining registers
- addql #8,%sp | pop SP and stack adjust
- jra _ASM_LABEL(rei) | all done
-
-/*
- * Emulation of VAX REI instruction.
- *
- * This code deals with checking for and servicing ASTs
- * (profiling, scheduling) and software interrupts (network, softclock).
- * We check for ASTs first, just like the VAX. To avoid excess overhead
- * the T_ASTFLT handling code will also check for software interrupts so we
- * do not have to do it here. After identifing that we need an AST we
- * drop the IPL to allow device interrupts.
- *
- * This code is complicated by the fact that sendsig may have been called
- * necessitating a stack cleanup.
- */
-
-BSS(softpending,4)
-
-ASENTRY_NOPROFILE(rei)
- tstl _C_LABEL(astpending) | AST pending?
- jeq Lchksir | no, go check for SIR
-Lrei1:
- btst #5,%sp@ | yes, are we returning to user mode?
- jne Lchksir | no, go check for SIR
- movw #PSL_LOWIPL,%sr | lower SPL
- clrl %sp@- | stack adjust
- moveml #0xFFFF,%sp@- | save all registers
- movl %usp,%a1 | including
- movl %a1,%sp@(FR_SP) | the users SP
-Lrei2:
- clrl %sp@- | VA == none
- clrl %sp@- | code == none
- movl #T_ASTFLT,%sp@- | type == async system trap
- jbsr _C_LABEL(trap) | go handle it
- lea %sp@(12),%sp | pop value args
- movl %sp@(FR_SP),%a0 | restore user SP
- movl %a0,%usp | from save area
- movw %sp@(FR_ADJ),%d0 | need to adjust stack?
- jne Laststkadj | yes, go to it
- moveml %sp@+,#0x7FFF | no, restore most user regs
- addql #8,%sp | toss SP and stack adjust
- rte | and do real RTE
-Laststkadj:
- lea %sp@(FR_HW),%a1 | pointer to HW frame
- addql #8,%a1 | source pointer
- movl %a1,%a0 | source
- addw %d0,%a0 | + hole size = dest pointer
- movl %a1@-,%a0@- | copy
- movl %a1@-,%a0@- | 8 bytes
- movl %a0,%sp@(FR_SP) | new SSP
- moveml %sp@+,#0x7FFF | restore user registers
- movl %sp@,%sp | and our SP
- rte | and do real RTE
-Lchksir:
- tstl _C_LABEL(softpending) | SIR pending?
- jeq Ldorte | no, all done
- movl %d0,%sp@- | need a scratch register
- movw %sp@(4),%d0 | get SR
- andw #PSL_IPL7,%d0 | mask all but IPL
- jne Lnosir | came from interrupt, no can do
- movl %sp@+,%d0 | restore scratch register
-Lgotsir:
- movw #SPL1,%sr | prevent others from servicing int
- tstl _C_LABEL(softpending) | too late?
- jeq Ldorte | yes, oh well...
- clrl %sp@- | stack adjust
- moveml #0xFFFF,%sp@- | save all registers
- movl %usp,%a1 | including
- movl %a1,%sp@(FR_SP) | the users SP
-Lsir1:
- clrl %sp@- | VA == none
- clrl %sp@- | code == none
- movl #T_SSIR,%sp@- | type == software interrupt
- jbsr _C_LABEL(trap) | go handle it
- lea %sp@(12),%sp | pop value args
- movl %sp@(FR_SP),%a0 | restore
- movl %a0,%usp | user SP
- moveml %sp@+,#0x7FFF | and all remaining registers
- addql #8,%sp | pop SP and stack adjust
- rte
-Lnosir:
- movl %sp@+,%d0 | restore scratch register
-Ldorte:
- rte | real return
-
-/*
- * Use common m68k signal trampoline.
- */
-#include <m68k/m68k/sigcode.s>
-
-/*
- * Primitives
- */
-
-/*
- * Use common m68k support routines.
- */
-#include <m68k/m68k/support.s>
-
- .data
- .p2align 2
-GLOBAL(curpcb)
- .long 0
-
-ASBSS(nullpcb,SIZEOF_PCB)
-
-ENTRY_NOPROFILE(cpu_idle_cycle)
- stop #PSL_LOWIPL
- rts
-
-/*
- * cpu_switchto(struct proc *oldproc, struct proc *newproc)
- *
- * NOTE: On the mc68851 (318/319/330) we attempt to avoid flushing the
- * entire ATC. The effort involved in selective flushing may not be
- * worth it, maybe we should just flush the whole thing?
- *
- * NOTE 2: With the new VM layout we now no longer know if an inactive
- * user's PTEs have been changed (formerly denoted by the SPTECHG p_flag
- * bit). For now, we just always flush the full ATC.
- */
-ENTRY(cpu_switchto)
- movl %sp@(4), %d0 | oldproc
- beq Lswnofpsave | is NULL, don't save anything
-
- /*
- * Save state of previous process in its pcb.
- */
- movl _C_LABEL(curpcb),%a1
- movw %sr, %a1@(PCB_PS) | save sr before switching context
- moveml #0xFCFC,%a1@(PCB_REGS) | save non-scratch registers
- movl %usp,%a2 | grab USP (a2 has been saved)
- movl %a2,%a1@(PCB_USP) | and save it
-
- tstl _C_LABEL(fputype) | Do we have an FPU?
- jeq Lswnofpsave | No Then don't attempt save.
- lea %a1@(PCB_FPCTX),%a2 | pointer to FP save area
- fsave %a2@ | save FP state
- tstb %a2@ | null state frame?
- jeq Lswnofpsave | yes, all done
- fmovem %fp0-%fp7,%a2@(FPF_REGS) | save FP general registers
- fmovem %fpcr/%fpsr/%fpi,%a2@(FPF_FPCR) | save FP control registers
-
-Lswnofpsave:
- movl %sp@(8), %a0 | newproc
-
- movl %a0, CURPROC
- movb #SONPROC,%a0@(P_STAT)
- movl %a0@(P_ADDR),%a1 | get p_addr
- movl %a1,_C_LABEL(curpcb)
-
- /*
- * Activate process's address space.
- * XXX Should remember the last USTP value loaded, and call this
- * XXX only if it has changed.
- */
- pea %a0@ | push proc
- jbsr _C_LABEL(pmap_activate) | pmap_activate(p)
- addql #4,%sp
- movl _C_LABEL(curpcb),%a1 | restore p_addr
-
- lea _ASM_LABEL(tmpstk),%sp | now goto a tmp stack for NMI
-
- moveml %a1@(PCB_REGS),#0xFCFC | and registers
- movl %a1@(PCB_USP),%a0
- movl %a0,%usp | and USP
-
- tstl _C_LABEL(fputype) | If we don't have an FPU,
- jeq Lnofprest | don't try to restore it.
- lea %a1@(PCB_FPCTX),%a0 | pointer to FP save area
- tstb %a0@ | null state frame?
- jeq Lresfprest | yes, easy
-#if defined(M68040)
-#if defined(M68020) || defined(M68030)
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040?
- jne Lresnot040 | no, skip
-#endif
- clrl %sp@- | yes...
- frestore %sp@+ | ...magic!
-Lresnot040:
-#endif
- fmovem %a0@(FPF_FPCR),%fpcr/%fpsr/%fpi | restore FP control registers
- fmovem %a0@(FPF_REGS),%fp0-%fp7 | restore FP general registers
-Lresfprest:
- frestore %a0@ | restore state
-
-Lnofprest:
- movw %a1@(PCB_PS),%sr | no, restore PS
- moveq #1,%d0 | return 1 (for alternate returns)
- rts
-
-/*
- * savectx(pcb)
- * Update pcb, saving current processor state.
- */
-ENTRY(savectx)
- movl %sp@(4),%a1
- movw %sr,%a1@(PCB_PS)
- movl %usp,%a0 | grab USP
- movl %a0,%a1@(PCB_USP) | and save it
- moveml #0xFCFC,%a1@(PCB_REGS) | save non-scratch registers
-
- tstl _C_LABEL(fputype) | Do we have FPU?
- jeq Lsvnofpsave | No? Then don't save state.
- lea %a1@(PCB_FPCTX),%a0 | pointer to FP save area
- fsave %a0@ | save FP state
- tstb %a0@ | null state frame?
- jeq Lsvnofpsave | yes, all done
- fmovem %fp0-%fp7,%a0@(FPF_REGS) | save FP general registers
- fmovem %fpcr/%fpsr/%fpi,%a0@(FPF_FPCR) | save FP control registers
-Lsvnofpsave:
- moveq #0,%d0 | return 0
- rts
-
-#if defined(M68040)
-ENTRY(suline)
- movl %sp@(4),%a0 | address to write
- movl _C_LABEL(curpcb),%a1 | current pcb
- movl #Lslerr,%a1@(PCB_ONFAULT) | where to return to on a fault
- movl %sp@(8),%a1 | address of line
- movl %a1@+,%d0 | get lword
- movsl %d0,%a0@+ | put lword
- nop | sync
- movl %a1@+,%d0 | get lword
- movsl %d0,%a0@+ | put lword
- nop | sync
- movl %a1@+,%d0 | get lword
- movsl %d0,%a0@+ | put lword
- nop | sync
- movl %a1@+,%d0 | get lword
- movsl %d0,%a0@+ | put lword
- nop | sync
- moveq #0,%d0 | indicate no fault
- jra Lsldone
-Lslerr:
- moveq #-1,%d0
-Lsldone:
- movl _C_LABEL(curpcb),%a1 | current pcb
- clrl %a1@(PCB_ONFAULT) | clear fault address
- rts
-#endif
-
-/*
- * Invalidate entire TLB.
- */
-ASENTRY_NOPROFILE(TBIA)
-#if defined(M68040)
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040?
- jne Lmotommu3 | no, skip
- .chip 68040
- pflusha
- rts
-Lmotommu3:
- .chip 68020
-#endif
- pflusha | flush entire TLB
- tstl _C_LABEL(mmutype)
- jpl Lmc68851a | 68851 implies no d-cache
- movl #DC_CLEAR,%d0
- movc %d0,%cacr | invalidate on-chip d-cache
-Lmc68851a:
- rts
-
-/*
- * Invalidate any TLB entry for given VA (TB Invalidate Single)
- */
-ENTRY(TBIS)
-#if defined(M68040)
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040?
- jne Lmotommu4 | no, skip
- .chip 68040
- movl %sp@(4),%a0
- movc %dfc,%d1
- moveq #FC_USERD,%d0 | user space
- movc %d0,%dfc
- pflush %a0@
- moveq #FC_SUPERD,%d0 | super space
- movc %d0,%dfc
- pflush %a0@
- movc %d1,%dfc
- rts
- .chip 68020
-Lmotommu4:
-#endif
- movl %sp@(4),%a0 | get addr to flush
- tstl _C_LABEL(mmutype)
- jpl Lmc68851b | is 68851?
- pflush #0,#0,%a0@ | flush address from both sides
- movl #DC_CLEAR,%d0
- movc %d0,%cacr | invalidate on-chip data cache
- rts
-Lmc68851b:
- pflushs #0,#0,%a0@ | flush address from both sides
- rts
-
-/*
- * Invalidate instruction cache
- */
-ENTRY(ICIA)
-#if defined(M68040)
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040
- jne Lmotommu7 | no, skip
- .chip 68040
- cinva %ic
- rts
- .chip 68020
-Lmotommu7:
-#endif
- movl #IC_CLEAR,%d0
- movc %d0,%cacr | invalidate i-cache
- rts
-
-/*
- * Invalidate data cache.
- * HP external cache allows for invalidation of user/supervisor portions.
- * NOTE: we do not flush 68030 on-chip cache as there are no aliasing
- * problems with DC_WA. The only cases we have to worry about are context
- * switch and TLB changes, both of which are handled "in-line" in resume
- * and TBI*.
- */
-ENTRY(DCIA)
-#if defined(M68040)
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040
- jne Lmotommu8 | no, skip
- .chip 68040
- cpusha %dc
- rts
- .chip 68020
-Lmotommu8:
-#endif
- rts
-
-ENTRY(DCIS)
-#if defined(M68040)
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040
- jne Lmotommu9 | no, skip
- .chip 68040
- cpusha %dc
- rts
- .chip 68020
-Lmotommu9:
-#endif
- rts
-
-ENTRY(DCIU)
-#if defined(M68040)
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040
- jne LmotommuA | no, skip
- .chip 68040
- cpusha %dc
- rts
- .chip 68020
-LmotommuA:
-#endif
- rts
-
-#if defined(M68040) || defined(CACHE_HAVE_PAC)
-ENTRY(PCIA)
-#if defined(M68040)
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040
- jne LmotommuB | no, skip
- .chip 68040
- cpusha %dc
- rts
- .chip 68020
-LmotommuB:
-#endif
-#if defined(CACHE_HAVE_PAC)
- /*
- * On non-68040 machines, PCIA() will only get invoked if
- * ectype == EC_PHYS, thus we do not need to test anything.
- */
- movl #DC_CLEAR,%d0
- movc %d0,%cacr | invalidate on-chip d-cache
- MMUADDR(%a0)
- andl #~MMU_CEN,%a0@(MMUCMD) | disable cache in MMU control reg
- orl #MMU_CEN,%a0@(MMUCMD) | reenable cache in MMU control reg
- rts
-#endif
-#endif
-
-#if defined(M68040)
- .chip 68040
-ENTRY(ICPA)
- cinva %ic
- rts
-ENTRY(DCFA)
- cpusha %dc
- rts
-ENTRY(ICPL)
- movl %sp@(4),%a0 | address
- cinvl %ic,%a0@
- rts
-ENTRY(ICPP)
- movl %sp@(4),%a0 | address
- cinvp %ic,%a0@
- rts
-ENTRY(DCPL)
- movl %sp@(4),%a0 | address
- cinvl %dc,%a0@
- rts
-ENTRY(DCPP)
- movl %sp@(4),%a0 | address
- cinvp %dc,%a0@
- rts
-ENTRY(DCFL)
- movl %sp@(4),%a0 | address
- cpushl %dc,%a0@
- rts
-ENTRY(DCFP)
- movl %sp@(4),%a0 | address
- cpushp %dc,%a0@
- rts
- .chip 68020
-#endif
-
-ENTRY(ecacheon)
- tstl _C_LABEL(ectype)
- jeq Lnocache7
- MMUADDR(%a0)
- orl #MMU_CEN,%a0@(MMUCMD)
-Lnocache7:
- rts
-
-ENTRY(ecacheoff)
- tstl _C_LABEL(ectype)
- jeq Lnocache8
- MMUADDR(%a0)
- andl #~MMU_CEN,%a0@(MMUCMD)
-Lnocache8:
- rts
-
-ENTRY_NOPROFILE(getsfc)
- movc %sfc,%d0
- rts
-
-ENTRY_NOPROFILE(getdfc)
- movc %dfc,%d0
- rts
-
-/*
- * Load a new user segment table pointer.
- */
-ENTRY(loadustp)
- movl %sp@(4),%d0 | new USTP
- moveq #PGSHIFT,%d1
- lsll %d1,%d0 | convert to addr
-#if defined(M68040)
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040?
- jne LmotommuC | no, skip
- .chip 68040
- pflusha
- movc %d0,%urp
- rts
- .chip 68020
-LmotommuC:
-#endif
- pflusha | flush entire TLB
- lea _ASM_LABEL(protorp),%a0 | CRP prototype
- movl %d0,%a0@(4) | stash USTP
- pmove %a0@,%crp | load root pointer
- movl #CACHE_CLR,%d0
- movc %d0,%cacr | invalidate cache(s)
- rts
-
-/*
- * Set processor priority level calls. Most are implemented with
- * inline asm expansions. However, spl0 requires special handling
- * as we need to check for our emulated software interrupts.
- */
-
-ENTRY(spl0)
- moveq #0,%d0
- movw %sr,%d0 | get old SR for return
- movw #PSL_LOWIPL,%sr | restore new SR
- tstl _C_LABEL(softpending) | software interrupt pending?
- jeq Lspldone | no, all done
- subql #4,%sp | make room for RTE frame
- movl %sp@(4),%sp@(2) | position return address
- clrw %sp@(6) | set frame type 0
- movw #PSL_LOWIPL,%sp@ | and new SR
- jra Lgotsir | go handle it
-Lspldone:
- rts
-
-/*
- * _delay(u_int N)
- *
- * Delay for at least (N/256) microseconds.
- * This routine depends on the variable: delay_divisor
- * which should be set based on the CPU clock rate.
- */
-ENTRY_NOPROFILE(_delay)
- | d0 = arg = (usecs << 8)
- movl %sp@(4),%d0
- | d1 = delay_divisor
- movl _C_LABEL(delay_divisor),%d1
- jra L_delay /* Jump into the loop! */
-
- /*
- * Align the branch target of the loop to a half-line (8-byte)
- * boundary to minimize cache effects. This guarantees both
- * that there will be no prefetch stalls due to cache line burst
- * operations and that the loop will run from a single cache
- * half-line.
- */
- .balign 8
-L_delay:
- subl %d1,%d0
- jgt L_delay
- rts
-
-/*
- * Save and restore 68881 state.
- */
-ENTRY(m68881_save)
- movl %sp@(4),%a0 | save area pointer
- fsave %a0@ | save state
- tstb %a0@ | null state frame?
- jeq Lm68881sdone | yes, all done
- fmovem %fp0-%fp7,%a0@(FPF_REGS) | save FP general registers
- fmovem %fpcr/%fpsr/%fpi,%a0@(FPF_FPCR) | save FP control registers
-Lm68881sdone:
- rts
-
-ENTRY(m68881_restore)
- movl %sp@(4),%a0 | save area pointer
- tstb %a0@ | null state frame?
- jeq Lm68881rdone | yes, easy
- fmovem %a0@(FPF_FPCR),%fpcr/%fpsr/%fpi | restore FP control registers
- fmovem %a0@(FPF_REGS),%fp0-%fp7 | restore FP general registers
-Lm68881rdone:
- frestore %a0@ | restore state
- rts
-
-/*
- * Probe a memory address, and see if it causes a bus error.
- * This function is only to be used in physical mode, and before our
- * trap vectors are initialized.
- * Invoke with address to probe in a0.
- * Alters: a3 d0 d1
- */
-#define BUSERR 0xfffffffc
-ASLOCAL(phys_badaddr)
- ASRELOC(_bsave,%a3)
- movl BUSERR,%a3@ | save ROM bus errror handler
- ASRELOC(_ssave,%a3)
- movl %sp,%a3@ | and current stack pointer
- ASRELOC(catchbad,%a3)
- movl %a3,BUSERR | plug in our handler
- movw %a0@,%d1 | access address
- ASRELOC(_bsave,%a3) | no fault!
- movl %a3@,BUSERR
- clrl %d0 | return success
- rts
-ASLOCAL(catchbad)
- ASRELOC(_bsave,%a3) | got a bus error, so restore handler
- movl %a3@,BUSERR
- ASRELOC(_ssave,%a3)
- movl %a3@,%sp | and stack
- moveq #1,%d0 | return fault
- rts
-#undef BUSERR
-
- .data
- .p2align 2
-ASLOCAL(_bsave)
- .long 0
-ASLOCAL(_ssave)
- .long 0
- .text
-
-/*
- * Handle the nitty-gritty of rebooting the machine.
- * Basically we just turn off the MMU and jump to the appropriate ROM routine.
- * Note that we must be running in an address range that is mapped one-to-one
- * logical to physical so that the PC is still valid immediately after the MMU
- * is turned off. We have conveniently mapped the last page of physical
- * memory this way.
- */
-ENTRY_NOPROFILE(doboot)
-#if defined(M68040)
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040?
- jeq Lnocache5 | yes, skip
-#endif
- movl #CACHE_OFF,%d0
- movc %d0,%cacr | disable on-chip cache(s)
- tstl _C_LABEL(ectype) | external cache?
- jeq Lnocache5 | no, skip
- MMUADDR(%a0)
- andl #~MMU_CEN,%a0@(MMUCMD) | disable external cache
-Lnocache5:
- lea MAXADDR,%a0 | last page of physical memory
- movl _C_LABEL(boothowto),%a0@+ | store howto
- movl _C_LABEL(bootdev),%a0@+ | and devtype
- lea Lbootcode,%a1 | start of boot code
- lea Lebootcode,%a3 | end of boot code
-Lbootcopy:
- movw %a1@+,%a0@+ | copy a word
- cmpl %a3,%a1 | done yet?
- jcs Lbootcopy | no, keep going
-#if defined(M68040)
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040?
- jne LmotommuE | no, skip
- .chip 68040
- cpusha %bc
-LmotommuE:
- .chip 68020
-#endif
- jmp MAXADDR+8 | jump to last page
-
-Lbootcode:
- lea MAXADDR+0x800,%sp | physical SP in case of NMI
-#if defined(M68040)
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040?
- jne LmotommuF | no, skip
- .chip 68040
- movl #0,%d0
- movc %d0,%cacr | caches off
- movc %d0,%tc
- movl %d2,MAXADDR+NBPG-4 | restore old high page contents
- DOREBOOT
- .chip 68020
-LmotommuF:
-#endif
- movl #0,%a0@ | value for pmove to TC (turn off MMU)
- pmove %a0@,%tc | disable MMU
- DOREBOOT
-Lebootcode:
-
-/*
- * Misc. global variables.
- */
- .data
- .p2align 2
-GLOBAL(machineid)
- .long -1 | default to unknown
-
-GLOBAL(mmuid)
- .long 0 | default to nothing
-
-GLOBAL(mmutype)
- .long 0 | default to unknown
-
-GLOBAL(cputype)
- .long CPU_68020 | default to 68020 CPU
-
-GLOBAL(ectype)
- .long EC_NONE | external cache type, default to none
-
-GLOBAL(fputype)
- .long FPU_68882 | default to 68882 FPU
-
-ASLOCAL(protorp)
- .long 0,0 | prototype root pointer
-
-ASLOCAL(mmuscratch)
- .long 0 | scratch space for 68851/68030 MMU operation
-
-GLOBAL(internalhpib)
- .long 1 | has internal HP-IB, default to yes
-
-GLOBAL(cold)
- .long 1 | cold start flag
-
-GLOBAL(want_resched)
- .long 0
-
-GLOBAL(proc0paddr)
- .long 0 | KVA of proc0 u-area
-
-GLOBAL(intiobase)
- .long 0 | KVA of base of internal IO space
-
-GLOBAL(intiolimit)
- .long 0 | KVA of end of internal IO space
-
-GLOBAL(extiobase)
- .long 0 | KVA of base of external IO space
-
-GLOBAL(eiomapsize)
- .long 0 | size of external IO space in pages
-
-GLOBAL(CLKbase)
- .long 0 | KVA of base of clock registers
-
-GLOBAL(MMUbase)
- .long 0 | KVA of base of HP MMU registers
-
-#ifdef USELEDS
-ASLOCAL(heartbeat)
- .long 0 | clock ticks since last pulse of heartbeat
-
-ASLOCAL(beatstatus)
- .long 0 | for determining a fast or slow throb
-#endif
diff --git a/sys/arch/hp300/hp300/machdep.c b/sys/arch/hp300/hp300/machdep.c
deleted file mode 100644
index d4808dfddf6..00000000000
--- a/sys/arch/hp300/hp300/machdep.c
+++ /dev/null
@@ -1,1038 +0,0 @@
-/* $OpenBSD: machdep.c,v 1.141 2014/03/13 03:52:55 dlg Exp $ */
-/* $NetBSD: machdep.c,v 1.121 1999/03/26 23:41:29 mycroft Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: machdep.c 1.74 92/12/20$
- *
- * @(#)machdep.c 8.10 (Berkeley) 4/20/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/timeout.h>
-#include <sys/conf.h>
-#include <sys/exec.h>
-#include <sys/file.h>
-#include <sys/ioctl.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-#include <sys/extent.h>
-#include <sys/mbuf.h>
-#include <sys/mount.h>
-#include <sys/msgbuf.h>
-#include <sys/proc.h>
-#include <sys/reboot.h>
-#include <sys/signalvar.h>
-#include <sys/tty.h>
-#include <sys/user.h>
-#include <sys/exec.h>
-#include <sys/core.h>
-#include <sys/kcore.h>
-#include <sys/vnode.h>
-#include <sys/sysctl.h>
-#include <sys/syscallargs.h>
-#include <sys/syslog.h>
-
-#include <machine/db_machdep.h>
-#ifdef DDB
-#include <ddb/db_var.h>
-#endif
-#include <ddb/db_sym.h>
-#include <ddb/db_extern.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-#include <machine/hp300spu.h>
-#include <machine/kcore.h>
-#include <machine/reg.h>
-#include <machine/psl.h>
-#include <machine/pte.h>
-
-#include <dev/cons.h>
-
-#include <net/if.h>
-#include <uvm/uvm_extern.h>
-#include <uvm/uvm_swap.h>
-
-#ifdef USELEDS
-#include <hp300/hp300/leds.h>
-#endif
-
-/* the following is used externally (sysctl_hw) */
-char machine[] = MACHINE; /* from <machine/param.h> */
-
-struct vm_map *exec_map = NULL;
-struct vm_map *phys_map = NULL;
-
-extern paddr_t avail_start, avail_end;
-
-int physmem; /* size of physical memory, in pages */
-
-struct uvm_constraint_range dma_constraint = { 0x0, (paddr_t)-1 };
-struct uvm_constraint_range *uvm_md_constraints[] = { NULL };
-
-/*
- * safepri is a safe priority for sleep to set for a spin-wait
- * during autoconfiguration or after a panic.
- */
-int safepri = PSL_LOWIPL;
-
-extern u_int lowram;
-extern short exframesize[];
-
-/*
- * Some storage space must be allocated statically because of the
- * early console initialization.
- */
-char extiospace[EXTENT_FIXED_STORAGE_SIZE(8)];
-extern int eiomapsize;
-
-/* prototypes for local functions */
-void parityenable(void);
-int parityerror(struct frame *);
-int parityerrorfind(void);
-void identifycpu(void);
-void initcpu(void);
-void dumpmem(int *, int, int);
-char *hexstr(int, int);
-
-/* functions called from locore.s */
-void dumpsys(void);
-void hp300_init(void);
-void straytrap(int, u_short);
-void nmihand(struct frame);
-
-/*
- * Select code of console. Set to CONSCODE_INTERNAL if console is on
- * "internal" framebuffer.
- */
-int conscode;
-caddr_t conaddr; /* for drivers in cn_init() */
-int convasize; /* size of mapped console device */
-
-/*
- * Note that the value of delay_divisor is roughly
- * 2048 / cpuspeed (where cpuspeed is in MHz) on 68020
- * and 68030 systems. See clock.c for the delay
- * calibration algorithm.
- */
-int cpuspeed; /* relative cpu speed */
-int delay_divisor; /* delay constant */
-
- /*
- * Early initialization, before main() is called.
- */
-void
-hp300_init()
-{
- /*
- * Tell the VM system about available physical memory. The
- * hp300 only has one segment.
- */
- uvm_page_physload(atop(avail_start), atop(avail_end),
- atop(avail_start), atop(avail_end), 0);
-
- /* Initialize the interrupt handlers. */
- intr_init();
-
- /* Calibrate the delay loop. */
- hp300_calibrate_delay();
-}
-
-/*
- * Console initialization: called early on from main,
- * before vm init or startup. Do enough configuration
- * to choose and initialize a console.
- */
-void
-consinit()
-{
- extern struct extent *extio;
- extern char *extiobase;
-
- /*
- * Initialize some variables for sanity.
- */
- convasize = 0;
- conscode = CONSCODE_INVALID;
-
- /*
- * Initialize the bus extent.
- */
- extio = extent_create("extio",
- (u_long)extiobase, (u_long)extiobase + ptoa(eiomapsize),
- M_DEVBUF, extiospace, sizeof(extiospace), EX_NOWAIT);
-
- /*
- * Initialize the console before we print anything out.
- */
- hp300_cninit();
-
-#ifdef DDB
- ddb_init();
- if (boothowto & RB_KDB)
- Debugger();
-#endif
-}
-
-/*
- * cpu_startup: allocate memory for variable-sized tables,
- * initialize cpu, and do autoconfiguration.
- */
-void
-cpu_startup()
-{
- extern char *etext;
- unsigned i;
- vaddr_t minaddr, maxaddr;
-#ifdef DEBUG
- extern int pmapdebug;
- int opmapdebug = pmapdebug;
-
- pmapdebug = 0;
-#endif
-
- /*
- * Now that VM services are available, give another chance at
- * console devices to initialize, if they could not before.
- */
- hp300_cninit();
-
- /*
- * Initialize error message buffer (at end of core).
- * avail_end was pre-decremented in pmap_bootstrap to compensate.
- */
- for (i = 0; i < atop(MSGBUFSIZE); i++)
- pmap_enter(pmap_kernel(), (vaddr_t)msgbufp + i * NBPG,
- avail_end + i * NBPG, VM_PROT_READ|VM_PROT_WRITE,
- VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED);
- pmap_update(pmap_kernel());
- initmsgbuf((caddr_t)msgbufp, round_page(MSGBUFSIZE));
-
- /*
- * Good {morning,afternoon,evening,night}.
- */
- printf(version);
- identifycpu();
- printf("real mem = %u (%uMB)\n", ptoa(physmem),
- ptoa(physmem)/1024/1024);
-
- /*
- * Allocate a submap for exec arguments. This map effectively
- * limits the number of processes exec'ing at any time.
- */
- minaddr = vm_map_min(kernel_map);
- exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
- 16*NCARGS, VM_MAP_PAGEABLE, FALSE, NULL);
-
- /*
- * Allocate a submap for physio
- */
- phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
- VM_PHYS_SIZE, 0, FALSE, NULL);
-
-#ifdef DEBUG
- pmapdebug = opmapdebug;
-#endif
- printf("avail mem = %lu (%luMB)\n", ptoa(uvmexp.free),
- ptoa(uvmexp.free)/1024/1024);
-
- /*
- * Tell the VM system that page 0 isn't mapped.
- *
- * XXX This is bogus; should just fix KERNBASE and
- * XXX VM_MIN_KERNEL_ADDRESS, but not right now.
- */
- if (uvm_map_protect(kernel_map, 0, NBPG, UVM_PROT_NONE, TRUE))
- panic("can't mark page 0 off-limits");
-
- /*
- * Tell the VM system that writing to kernel text isn't allowed.
- * If we don't, we might end up COW'ing the text segment!
- *
- * XXX Should be trunc_page(&kernel_text) instead
- * XXX of NBPG.
- */
- if (uvm_map_protect(kernel_map, NBPG, round_page((vaddr_t)&etext),
- UVM_PROT_READ|UVM_PROT_EXEC, TRUE))
- panic("can't protect kernel text");
-
- /*
- * Set up CPU-specific registers, cache, etc.
- */
- initcpu();
-
- /*
- * Set up buffers, so they can be used to read disk labels.
- */
- bufinit();
-
- /*
- * Configure the system.
- */
- if (boothowto & RB_CONFIG) {
-#ifdef BOOT_CONFIG
- user_config();
-#else
- printf("kernel does not support -c; continuing..\n");
-#endif
- }
-}
-
-/*
- * Info for CTL_HW
- */
-char cpu_model[120];
-
-/*
- * Text description of models we support, indexed by machineid.
- */
-const char *hp300_models[] = {
- "320", /* HP_320 */
- "318/319/330", /* HP_330 */
- "350", /* HP_350 */
- "360", /* HP_36X */
- "370", /* HP_370 */
- "340", /* HP_340 */
- "345", /* HP_345 */
- "375", /* HP_375 */
- "400", /* HP_400 */
- "380", /* HP_380 */
- "425", /* HP_425 */
- "433", /* HP_433 */
- "385", /* HP_385 */
- "382", /* HP_382 */
-};
-
-/* Map mmuid to single letter designation in 4xx models (e.g. 425s, 425t) */
-char hp300_designations[] = " ttss e";
-
-void
-identifycpu()
-{
- const char *t;
- char mc, *td;
- int len;
-#ifdef FPSP
- extern u_long fpvect_tab, fpvect_end, fpsp_tab;
-#endif
-
- /*
- * Map machineid to model name.
- */
- if (machineid >= sizeof(hp300_models) / sizeof(char *)) {
- printf("\nunknown machineid %d\n", machineid);
- goto lose;
- }
- t = hp300_models[machineid];
-
- /*
- * Look up special designation (425s, 425t, etc) by mmuid.
- */
- if (mmuid < strlen(hp300_designations) &&
- hp300_designations[mmuid] != ' ') {
- td = &hp300_designations[mmuid];
- td[1] = '\0';
- } else
- td = "";
-
- /*
- * ...and the CPU type
- */
- switch (cputype) {
- case CPU_68040:
- mc = '4';
- /* adjust cpuspeed by 3/8 on '040 boxes */
- cpuspeed *= 3;
- cpuspeed /= 8;
- break;
- case CPU_68030:
- mc = '3';
- break;
- case CPU_68020:
- mc = '2';
- break;
- default:
- printf("\nunknown cputype %d\n", cputype);
- goto lose;
- }
- snprintf(cpu_model, sizeof cpu_model,
- "HP 9000/%s%s (%dMHz MC680%c0 CPU", t, td, cpuspeed, mc);
-
- /*
- * ...and the MMU type.
- */
- switch (mmutype) {
- case MMU_68040:
- case MMU_68030:
- strlcat(cpu_model, "+MMU", sizeof cpu_model);
- break;
- case MMU_68851:
- strlcat(cpu_model, ", MC68851 MMU", sizeof cpu_model);
- break;
- default:
- printf("%s\nunknown MMU type %d\n", cpu_model, mmutype);
- panic("startup");
- }
-
- /*
- * ...and the FPU type.
- */
- switch (fputype) {
- case FPU_68040:
- strlcat(cpu_model, "+FPU", sizeof cpu_model);
- break;
- case FPU_68882:
- len = strlen(cpu_model);
- snprintf(cpu_model + len, sizeof cpu_model - len,
- ", %dMHz MC68882 FPU", cpuspeed);
- break;
- case FPU_68881:
- len = strlen(cpu_model);
- snprintf(cpu_model + len, sizeof cpu_model - len,
- ", %dMHz MC68881 FPU", machineid == HP_350 ? 20 : 16);
- break;
- default:
- strlcat(cpu_model, ", unknown FPU", sizeof cpu_model);
- }
-
- /*
- * ...and finally, the cache type.
- */
- if (cputype == CPU_68040)
- strlcat(cpu_model, ", 4k on-chip physical I/D caches",
- sizeof cpu_model);
- else {
- len = strlen(cpu_model);
- switch (ectype) {
- case EC_VIRT:
- snprintf(cpu_model + len, sizeof cpu_model - len,
- ", %dK virtual-address cache",
- machineid == HP_320 ? 16 : 32);
- break;
- case EC_PHYS:
- snprintf(cpu_model + len, sizeof cpu_model - len,
- ", %dK physical-address cache",
- machineid == HP_370 ? 64 : 32);
- break;
- }
- }
-
- printf("%s)\n", cpu_model);
-#ifdef DEBUG
- printf("cpu: delay divisor %d", delay_divisor);
- if (mmuid)
- printf(", mmuid %d", mmuid);
- printf("\n");
-#endif
-
- /*
- * Now that we have told the user what they have,
- * let them know if that machine type isn't configured.
- */
- switch (machineid) {
- case -1: /* keep compilers happy */
-#if !defined(HP320)
- case HP_320:
-#endif
-#if !defined(HP330)
- case HP_330:
-#endif
-#if !defined(HP340)
- case HP_340:
-#endif
-#if !defined(HP345)
- case HP_345:
-#endif
-#if !defined(HP350)
- case HP_350:
-#endif
-#if !defined(HP360) && !defined(HP_362)
- case HP_36X:
-#endif
-#if !defined(HP370)
- case HP_370:
-#endif
-#if !defined(HP375)
- case HP_375:
-#endif
-#if !defined(HP380)
- case HP_380:
-#endif
-#if !defined(HP382)
- case HP_382:
-#endif
-#if !defined(HP385)
- case HP_385:
-#endif
-#if !defined(HP400)
- case HP_400:
-#endif
-#if !defined(HP425)
- case HP_425:
-#endif
-#if !defined(HP433)
- case HP_433:
-#endif
- panic("SPU type not configured for machineid %d", machineid);
- default:
- break;
- }
-
-#ifdef FPSP
- if (cputype == CPU_68040) {
- bcopy(&fpsp_tab, &fpvect_tab,
- (&fpvect_end - &fpvect_tab) * sizeof (fpvect_tab));
- }
-#endif
-
- return;
-lose:
- panic("startup");
-}
-
-/*
- * machine dependent system variables.
- */
-int
-cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
- int *name;
- u_int namelen;
- void *oldp;
- size_t *oldlenp;
- void *newp;
- size_t newlen;
- struct proc *p;
-{
- dev_t consdev;
-
- /* all sysctl names at this level are terminal */
- if (namelen != 1)
- return (ENOTDIR); /* overloaded */
-
- switch (name[0]) {
- case CPU_CONSDEV:
- if (cn_tab != NULL)
- consdev = cn_tab->cn_dev;
- else
- consdev = NODEV;
- return (sysctl_rdstruct(oldp, oldlenp, newp, &consdev,
- sizeof consdev));
- case CPU_CPUSPEED:
- return (sysctl_rdint(oldp, oldlenp, newp, cpuspeed));
- case CPU_MACHINEID:
- return (sysctl_rdint(oldp, oldlenp, newp, machineid));
- case CPU_MMUID:
- return (sysctl_rdint(oldp, oldlenp, newp, mmuid));
- default:
- return (EOPNOTSUPP);
- }
- /* NOTREACHED */
-}
-
-int waittime = -1;
-
-void
-boot(howto)
- int howto;
-{
- struct device *mainbus;
-
- /* take a snap shot before clobbering any registers */
- if (curproc && curproc->p_addr)
- savectx(&curproc->p_addr->u_pcb);
-
- /*
- * Prevent mi code from spinning disks off, in case the operator
- * changes his mind and prefers to reboot - we can't power down
- * the machine, and it will not send a spin up command to the
- * disks.
- */
- howto &= ~RB_POWERDOWN;
-
- /* If system is cold, just halt. */
- if (cold) {
- /* (Unless the user explicitly asked for reboot.) */
- if ((howto & RB_USERREQ) == 0)
- howto |= RB_HALT;
- goto haltsys;
- }
-
- boothowto = howto;
- if ((howto & RB_NOSYNC) == 0 && waittime < 0) {
- waittime = 0;
- vfs_shutdown();
- /*
- * If we've been adjusting the clock, the todr
- * will be out of synch; adjust it now unless
- * the system was sitting in ddb.
- */
- if ((howto & RB_TIMEBAD) == 0) {
- resettodr();
- } else {
- printf("WARNING: not updating battery clock\n");
- }
- }
- if_downall();
-
- uvm_shutdown();
- splhigh(); /* Disable interrupts. */
-
- /* If rebooting and a dump is requested do it. */
- if (howto & RB_DUMP)
- dumpsys();
-
-haltsys:
- doshutdownhooks();
- mainbus = device_mainbus();
- if (mainbus != NULL)
- config_suspend(mainbus, DVACT_POWERDOWN);
-
- /* Finally, halt/reboot the system. */
- if (howto & RB_HALT) {
- printf("System halted. Hit any key to reboot.\n\n");
- cnpollc(1);
- while (cngetc() == 0);
- cnpollc(0);
- }
-
- printf("rebooting...\n");
- DELAY(1000000);
- doboot();
- /*NOTREACHED*/
-}
-
-/*
- * These variables are needed by /sbin/savecore
- */
-u_long dumpmag = 0x8fca0101; /* magic number */
-int dumpsize = 0; /* pages */
-long dumplo = 0; /* blocks */
-cpu_kcore_hdr_t cpu_kcore_hdr;
-
-/*
- * This is called by configure to set dumplo and dumpsize.
- * Dumps always skip the first PAGE_SIZE of disk space
- * in case there might be a disk label stored there.
- * If there is extra space, put dump at the end to
- * reduce the chance that swapping trashes it.
- */
-void
-dumpconf(void)
-{
- int nblks; /* size of dump area */
-
- if (dumpdev == NODEV ||
- (nblks = (bdevsw[major(dumpdev)].d_psize)(dumpdev)) == 0)
- return;
- if (nblks <= ctod(1))
- return;
-
- /*
- * Since lowram starts two pages after the beginning of memory,
- * we're not dumping exactly all the memory.
- */
- dumpsize = physmem - 2;
-
- /* hp300 only uses a single segment. */
- cpu_kcore_hdr.ram_segs[0].start = lowram;
- cpu_kcore_hdr.ram_segs[0].size = ptoa(dumpsize);
- cpu_kcore_hdr.mmutype = mmutype;
- cpu_kcore_hdr.kernel_pa = lowram;
- cpu_kcore_hdr.sysseg_pa = pmap_kernel()->pm_stpa;
-
- /* Always skip the first block, in case there is a label there. */
- if (dumplo < ctod(1))
- dumplo = ctod(1);
-
- /* Put dump at end of partition, and make it fit. */
- if (dumpsize > dtoc(nblks - dumplo))
- dumpsize = dtoc(nblks - dumplo);
- if (dumplo < nblks - ctod(dumpsize))
- dumplo = nblks - ctod(dumpsize);
-}
-
-/*
- * Dump physical memory onto the dump device. Called by doadump()
- * in locore.s or by boot() here in machdep.c
- */
-void
-dumpsys()
-{
- daddr_t blkno; /* current block to write */
- /* dump routine */
- int (*dump)(dev_t, daddr_t, caddr_t, size_t);
- int pg; /* page being dumped */
- paddr_t maddr; /* PA being dumped */
- int error; /* error code from (*dump)() */
- kcore_seg_t *kseg_p;
- cpu_kcore_hdr_t *chdr_p;
- char dump_hdr[dbtob(1)]; /* XXX assume hdr fits in 1 block */
- extern int msgbufmapped;
-
- /* XXX initialized here because of gcc lossage */
- maddr = lowram;
- pg = 0;
-
- /* Don't put dump messages in msgbuf. */
- msgbufmapped = 0;
-
- /* Make sure dump device is valid. */
- if (dumpdev == NODEV)
- return;
- if (dumpsize == 0) {
- dumpconf();
- if (dumpsize == 0)
- return;
- }
- if (dumplo <= 0) {
- printf("\ndump to dev %u,%u not possible\n", major(dumpdev),
- minor(dumpdev));
- return;
- }
- dump = bdevsw[major(dumpdev)].d_dump;
- blkno = dumplo;
-
- printf("\ndumping to dev %u,%u offset %ld\n", major(dumpdev),
- minor(dumpdev), dumplo);
-
-#ifdef UVM_SWAP_ENCRYPT
- uvm_swap_finicrypt_all();
-#endif
-
- kseg_p = (kcore_seg_t *)dump_hdr;
- chdr_p = (cpu_kcore_hdr_t *)&dump_hdr[ALIGN(sizeof(*kseg_p))];
- bzero(dump_hdr, sizeof(dump_hdr));
-
- /*
- * Generate a segment header
- */
- CORE_SETMAGIC(*kseg_p, KCORE_MAGIC, MID_MACHINE, CORE_CPU);
- kseg_p->c_size = dbtob(1) - ALIGN(sizeof(*kseg_p));
-
- /*
- * Add the md header
- */
-
- *chdr_p = cpu_kcore_hdr;
-
- printf("dump ");
- maddr = cpu_kcore_hdr.ram_segs[0].start;
- /* Dump the header. */
- error = (*dump) (dumpdev, blkno++, (caddr_t)dump_hdr, dbtob(1));
- switch (error) {
- case 0:
- break;
-
- case ENXIO:
- printf("device bad\n");
- return;
-
- case EFAULT:
- printf("device not ready\n");
- return;
-
- case EINVAL:
- printf("area improper\n");
- return;
-
- case EIO:
- printf("i/o error\n");
- return;
-
- case EINTR:
- printf("aborted from console\n");
- return;
-
- default:
- printf("error %d\n", error);
- return;
- }
- for (pg = 0; pg < dumpsize; pg++) {
-#define NPGMB (1024*1024/NBPG)
- /* print out how many MBs we have dumped */
- if (pg && (pg % NPGMB) == 0)
- printf("%d ", pg / NPGMB);
-#undef NPGMB
- pmap_enter(pmap_kernel(), (vaddr_t)vmmap, maddr,
- VM_PROT_READ, VM_PROT_READ|PMAP_WIRED);
-
- pmap_update(pmap_kernel());
- error = (*dump)(dumpdev, blkno, vmmap, NBPG);
- switch (error) {
- case 0:
- maddr += NBPG;
- blkno += btodb(NBPG);
- break;
-
- case ENXIO:
- printf("device bad\n");
- return;
-
- case EFAULT:
- printf("device not ready\n");
- return;
-
- case EINVAL:
- printf("area improper\n");
- return;
-
- case EIO:
- printf("i/o error\n");
- return;
-
- case EINTR:
- printf("aborted from console\n");
- return;
-
- default:
- printf("error %d\n", error);
- return;
- }
- }
- printf("succeeded\n");
-}
-
-void
-initcpu()
-{
-
- parityenable();
-#ifdef USELEDS
- ledinit();
-#endif
-}
-
-void
-straytrap(pc, evec)
- int pc;
- u_short evec;
-{
- printf("unexpected trap (vector offset %x) from %x\n",
- evec & 0xFFF, pc);
-}
-
-/* XXX should change the interface, and make one badaddr() function */
-
-int *nofault;
-
-int
-badaddr(addr)
- caddr_t addr;
-{
- int i;
- label_t faultbuf;
-
- nofault = (int *) &faultbuf;
- if (setjmp((label_t *)nofault)) {
- nofault = (int *) 0;
- return(1);
- }
- i = *(volatile short *)addr;
- nofault = (int *) 0;
- return(0);
-}
-
-int
-badbaddr(addr)
- caddr_t addr;
-{
- int i;
- label_t faultbuf;
-
- nofault = (int *) &faultbuf;
- if (setjmp((label_t *)nofault)) {
- nofault = (int *) 0;
- return(1);
- }
- i = *(volatile char *)addr;
- nofault = (int *) 0;
- return(0);
-}
-
-static int innmihand; /* simple mutex */
-
-/*
- * Level 7 interrupts can be caused by HIL keyboards (in cooked mode only,
- * but we run them in raw mode) or parity errors.
- */
-void
-nmihand(frame)
- struct frame frame;
-{
-
- /* Prevent unwanted recursion. */
- if (innmihand)
- return;
- innmihand = 1;
-
- if (parityerror(&frame)) {
- innmihand = 0;
- return;
- }
-
- /* panic?? */
- printf("unexpected level 7 interrupt ignored\n");
-
- innmihand = 0;
-}
-
-/*
- * Parity error section. Contains magic.
- */
-#define PARREG ((volatile short *)IIOV(0x5B0000))
-static int gotparmem = 0;
-#ifdef DEBUG
-int ignorekperr = 0; /* ignore kernel parity errors */
-#endif
-
-/*
- * Enable parity detection
- */
-void
-parityenable()
-{
- label_t faultbuf;
-
- nofault = (int *) &faultbuf;
- if (setjmp((label_t *)nofault)) {
- nofault = (int *) 0;
- printf("No parity memory\n");
- return;
- }
- *PARREG = 1;
- nofault = (int *) 0;
- gotparmem = 1;
- printf("Parity detection enabled\n");
-}
-
-/*
- * Determine if level 7 interrupt was caused by a parity error
- * and deal with it if it was. Returns 1 if it was a parity error.
- */
-int
-parityerror(fp)
- struct frame *fp;
-{
- if (!gotparmem)
- return(0);
- *PARREG = 0;
- DELAY(10);
- *PARREG = 1;
- if (panicstr) {
- printf("parity error after panic ignored\n");
- return (1);
- }
- if (!parityerrorfind())
- printf("WARNING: transient parity error ignored\n");
- else if (USERMODE(fp->f_sr)) {
- log(LOG_ERR, "pid %d was killed: memory parity error\n",
- curproc->p_pid);
- uprintf("sorry, pid %d killed: memory parity error\n",
- curproc->p_pid);
- psignal(curproc, SIGKILL);
-#ifdef DEBUG
- } else if (ignorekperr) {
- printf("WARNING: kernel parity error ignored\n");
-#endif
- } else {
- regdump(&(fp->F_t), 128);
- panic("kernel parity error");
- }
- return (1);
-}
-
-/*
- * Yuck! There has got to be a better way to do this!
- * Searching all of memory with interrupts blocked can lead to disaster.
- */
-int
-parityerrorfind()
-{
- static label_t parcatch;
- static int looking = 0;
- volatile int pg, o, s;
- volatile int *ip;
- int i;
- int found;
-
- /*
- * If looking is true we are searching for a known parity error
- * and it has just occurred. All we do is return to the higher
- * level invocation.
- */
- if (looking)
- longjmp(&parcatch);
- s = splhigh();
- /*
- * If setjmp returns true, the parity error we were searching
- * for has just occurred (longjmp above) at the current pg+o
- */
- if (setjmp(&parcatch)) {
- printf("Parity error at 0x%x\n", ptoa(pg)|o);
- found = 1;
- goto done;
- }
- /*
- * If we get here, a parity error has occurred for the first time
- * and we need to find it. We turn off any external caches and
- * loop thru memory, testing every longword til a fault occurs and
- * we regain control at setjmp above. Note that because of the
- * setjmp, pg and o need to be volatile or their values will be lost.
- */
- looking = 1;
- ecacheoff();
- for (pg = atop(lowram); pg < atop(lowram)+physmem; pg++) {
- pmap_kenter_pa((vaddr_t)vmmap, ptoa(pg), VM_PROT_READ);
- pmap_update(pmap_kernel());
- ip = (int *)vmmap;
- for (o = 0; o < PAGE_SIZE; o += sizeof(int))
- i = *ip++;
- }
- /*
- * Getting here implies no fault was found. Should never happen.
- */
- printf("Couldn't locate parity error\n");
- found = 0;
-done:
- looking = 0;
- ecacheon(); /* pmap_kremove() may cause a cache flush */
- pmap_kremove((vaddr_t)vmmap, PAGE_SIZE);
- pmap_update(pmap_kernel());
- splx(s);
- return(found);
-}
diff --git a/sys/arch/hp300/hp300/mem.c b/sys/arch/hp300/hp300/mem.c
deleted file mode 100644
index c2e8bfa663c..00000000000
--- a/sys/arch/hp300/hp300/mem.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/* $OpenBSD: mem.c,v 1.26 2010/12/26 15:40:59 miod Exp $ */
-/* $NetBSD: mem.c,v 1.25 1999/03/27 00:30:06 mycroft Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)mem.c 8.3 (Berkeley) 1/12/94
- */
-
-/*
- * Memory special file
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/conf.h>
-#include <sys/malloc.h>
-#include <sys/proc.h>
-#include <sys/uio.h>
-
-#include <machine/cpu.h>
-
-#include <uvm/uvm_extern.h>
-
-extern u_int lowram;
-extern char *extiobase;
-extern int eiomapsize;
-static caddr_t devzeropage;
-
-#define mmread mmrw
-#define mmwrite mmrw
-cdev_decl(mm);
-
-/*ARGSUSED*/
-int
-mmopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
-
- switch (minor(dev)) {
- case 0:
- case 1:
- case 2:
- case 12:
- return (0);
- default:
- return (ENXIO);
- }
-}
-
-/*ARGSUSED*/
-int
-mmclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
-
- return (0);
-}
-
-/*ARGSUSED*/
-int
-mmrw(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- vaddr_t o, v;
- int c;
- struct iovec *iov;
- int error = 0;
- static int physlock;
- vm_prot_t prot;
-
- if (minor(dev) == 0) {
- /* lock against other uses of shared vmmap */
- while (physlock > 0) {
- physlock++;
- error = tsleep((caddr_t)&physlock, PZERO | PCATCH,
- "mmrw", 0);
- if (error)
- return (error);
- }
- physlock = 1;
- }
- while (uio->uio_resid > 0 && error == 0) {
- iov = uio->uio_iov;
- if (iov->iov_len == 0) {
- uio->uio_iov++;
- uio->uio_iovcnt--;
- if (uio->uio_iovcnt < 0)
- panic("mmrw");
- continue;
- }
- switch (minor(dev)) {
-
-/* minor device 0 is physical memory */
- case 0:
- v = uio->uio_offset;
-
- /*
- * Only allow reads in physical RAM.
- */
- if (v >= 0xFFFFFFFC || v < lowram) {
- error = EFAULT;
- goto unlock;
- }
-
- prot = uio->uio_rw == UIO_READ ? VM_PROT_READ :
- VM_PROT_WRITE;
- pmap_enter(pmap_kernel(), (vaddr_t)vmmap,
- trunc_page(v), prot, prot|PMAP_WIRED);
- pmap_update(pmap_kernel());
- o = uio->uio_offset & PGOFSET;
- c = min(uio->uio_resid, (int)(NBPG - o));
- error = uiomove((caddr_t)vmmap + o, c, uio);
- pmap_remove(pmap_kernel(), (vaddr_t)vmmap,
- (vaddr_t)vmmap + NBPG);
- pmap_update(pmap_kernel());
- continue;
-
-/* minor device 1 is kernel memory */
- case 1:
- v = uio->uio_offset;
- c = min(iov->iov_len, MAXPHYS);
-
- if (v > HP300_DIRECT_BASE) {
- /*
- * Direct mapping: only allow access to
- * physical memory.
- */
- if (v >= 0xfffffffc || v < lowram)
- return (EFAULT);
- } else {
- /*
- * Translated mapping: check for permission.
- */
- if (!uvm_kernacc((caddr_t)v, c,
- uio->uio_rw == UIO_READ ? B_READ : B_WRITE))
- return (EFAULT);
- }
-
- /*
- * Don't allow reading intio or dio
- * device space. This could lead to
- * corruption of device registers.
- */
- if (ISIIOVA(v) ||
- ((caddr_t)v >= extiobase &&
- (caddr_t)v < (extiobase + (eiomapsize * NBPG))))
- return (EFAULT);
-
- error = uiomove((caddr_t)v, c, uio);
- continue;
-
-/* minor device 2 is EOF/RATHOLE */
- case 2:
- if (uio->uio_rw == UIO_WRITE)
- uio->uio_resid = 0;
- return (0);
-
-/* minor device 12 (/dev/zero) is source of nulls on read, rathole on write */
- case 12:
- if (uio->uio_rw == UIO_WRITE) {
- c = iov->iov_len;
- break;
- }
- /*
- * On the first call, allocate and zero a page
- * of memory for use with /dev/zero.
- */
- if (devzeropage == NULL) {
- devzeropage = (caddr_t)
- malloc(PAGE_SIZE, M_TEMP,
- M_WAITOK | M_ZERO);
- }
- c = min(iov->iov_len, PAGE_SIZE);
- error = uiomove(devzeropage, c, uio);
- continue;
-
- default:
- return (ENXIO);
- }
- if (error)
- break;
- iov->iov_base = (caddr_t)iov->iov_base + c;
- iov->iov_len -= c;
- uio->uio_offset += c;
- uio->uio_resid -= c;
- }
- if (minor(dev) == 0) {
-unlock:
- if (physlock > 1)
- wakeup((caddr_t)&physlock);
- physlock = 0;
- }
- return (error);
-}
-
-paddr_t
-mmmmap(dev, off, prot)
- dev_t dev;
- off_t off;
- int prot;
-{
- /*
- * /dev/mem is the only one that makes sense through this
- * interface. For /dev/kmem any physaddr we return here
- * could be transient and hence incorrect or invalid at
- * a later time. /dev/null just doesn't make any sense
- * and /dev/zero is a hack that is handled via the default
- * pager in mmap().
- */
- if (minor(dev) != 0)
- return (-1);
-
- /*
- * Allow access only in RAM.
- */
- if ((u_int)off < lowram || (u_int)off >= 0xFFFFFFFC)
- return (-1);
- return (off);
-}
-
-int
-mmioctl(dev, cmd, data, flags, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flags;
- struct proc *p;
-{
- return (EOPNOTSUPP);
-}
diff --git a/sys/arch/hp300/hp300/pmap_bootstrap.c b/sys/arch/hp300/hp300/pmap_bootstrap.c
deleted file mode 100644
index 7b6b6c29059..00000000000
--- a/sys/arch/hp300/hp300/pmap_bootstrap.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/* $OpenBSD: pmap_bootstrap.c,v 1.26 2008/02/13 21:19:54 miod Exp $ */
-/* $NetBSD: pmap_bootstrap.c,v 1.13 1997/06/10 18:56:50 veego Exp $ */
-
-/*
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pmap_bootstrap.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/msgbuf.h>
-
-#include <machine/cpu.h>
-#include <machine/frame.h>
-#include <machine/pte.h>
-#include <machine/vmparam.h>
-
-#include <machine/hp300spu.h>
-#include <hp300/hp300/clockreg.h>
-
-#include <uvm/uvm_extern.h>
-
-caddr_t ledbase; /* SPU LEDs mapping */
-
-extern vaddr_t CLKbase, MMUbase;
-extern char *extiobase;
-extern int eiomapsize;
-
-#define RELOC(v, t) *((t*)((u_int)&(v) + firstpa))
-#define PA2VA(v, t) *((t*)((u_int)&(v)))
-
-#define MACHINE_IIOMAPSIZE IIOMAPSIZE
-#define MACHINE_INTIOBASE INTIOBASE
-#define MACHINE_EIOMAPSIZE RELOC(eiomapsize, int)
-
-#define PMAP_MD_LOCALS /* nothing */
-
-#define PMAP_MD_RELOC1() /* nothing */
-
-#define PMAP_MD_MAPIOSPACE() /* nothing */
-
- /*
- * intiobase, intiolimit: base and end of internal (DIO) IO space.
- * MACHINE_IIOMAPSIZE pages prior to external IO space at end of
- * static kernel page table.
- * extiobase: base of external (DIO-II) IO space.
- * MACHINE_EIOMAPSIZE pages at the end of the static kernel page table.
- * CLKbase, MMUbase: important registers in internal IO space
- * accessed from locore.
- */
-#define PMAP_MD_RELOC2() \
-do { \
- RELOC(intiobase, char *) = (char *)iiobase; \
- RELOC(intiolimit, char *) = (char *)eiobase; \
- RELOC(extiobase, char *) = (char *)eiobase; \
- RELOC(CLKbase, vaddr_t) = iiobase + CLKBASE; \
- RELOC(MMUbase, vaddr_t) = iiobase + MMUBASE; \
-} while (0)
-
-#define PMAP_MD_MEMSIZE() \
-do { \
- RELOC(avail_end, paddr_t) = MAXADDR - PAGE_SIZE - \
- round_page(MSGBUFSIZE); \
-} while (0)
-
- /*
- * Allocate some fixed, special purpose kernel virtual addresses
- */
-#define PMAP_MD_RELOC3() \
-do { \
- RELOC(ledbase, caddr_t) = (caddr_t)va; \
- va += NBPG; \
-} while (0)
-
-#include <m68k/m68k/pmap_bootstrap.c>
-
-void
-pmap_init_md()
-{
- vaddr_t addr;
-
- /*
- * mark as unavailable the regions which we have mapped in
- * pmap_bootstrap().
- */
- addr = (vaddr_t) intiobase;
- if (uvm_map(kernel_map, &addr,
- ptoa(IIOMAPSIZE + eiomapsize),
- NULL, UVM_UNKNOWN_OFFSET, 0,
- UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE,
- UVM_INH_NONE, UVM_ADV_RANDOM,
- UVM_FLAG_FIXED)))
- panic("pmap_init: bogons in the VM system!");
-}
diff --git a/sys/arch/hp300/hp300/sys_machdep.c b/sys/arch/hp300/hp300/sys_machdep.c
deleted file mode 100644
index e22aa956161..00000000000
--- a/sys/arch/hp300/hp300/sys_machdep.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* $OpenBSD: sys_machdep.c,v 1.15 2005/08/01 11:54:19 miod Exp $ */
-/* $NetBSD: sys_machdep.c,v 1.17 1997/05/19 10:15:00 veego Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)sys_machdep.c 8.2 (Berkeley) 1/13/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/ioctl.h>
-#include <sys/file.h>
-#include <sys/time.h>
-#include <sys/proc.h>
-#include <sys/signalvar.h>
-#include <sys/uio.h>
-#include <sys/kernel.h>
-#include <sys/mtio.h>
-#include <sys/buf.h>
-#include <sys/mount.h>
-
-#include <sys/syscallargs.h>
-
-int
-sys_sysarch(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
-#if 0 /* unused */
- struct sys_sysarch_args /* {
- syscallarg(int) op;
- syscallarg(char *) parms;
- } */ *uap = v;
-#endif
-
- return ENOSYS;
-}
diff --git a/sys/arch/hp300/hp300/trap.c b/sys/arch/hp300/hp300/trap.c
deleted file mode 100644
index d543792ab26..00000000000
--- a/sys/arch/hp300/hp300/trap.c
+++ /dev/null
@@ -1,1002 +0,0 @@
-/* $OpenBSD: trap.c,v 1.63 2013/11/02 13:49:22 miod Exp $ */
-/* $NetBSD: trap.c,v 1.57 1998/02/16 20:58:31 thorpej Exp $ */
-
-/*
- * Copyright (c) 1997 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: trap.c 1.37 92/12/20$
- *
- * @(#)trap.c 8.5 (Berkeley) 1/4/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/acct.h>
-#include <sys/kernel.h>
-#include <sys/signalvar.h>
-#include <sys/resourcevar.h>
-#include <sys/syscall.h>
-#include <sys/syscall_mi.h>
-#include <sys/syslog.h>
-#include <sys/user.h>
-
-#include <m68k/frame.h>
-
-#include <machine/db_machdep.h>
-#include <machine/psl.h>
-#include <machine/trap.h>
-#include <machine/cpu.h>
-#include <machine/reg.h>
-#include <machine/intr.h>
-
-#include <uvm/uvm_extern.h>
-#include <uvm/uvm_pmap.h>
-
-#include <dev/cons.h>
-
-int writeback(struct frame *);
-void trap(int type, u_int code, u_int v, struct frame frame);
-void syscall(register_t code, struct frame frame);
-void wb_userret(struct proc *, struct frame *);
-
-#ifdef DEBUG
-void dumpssw(u_short);
-void dumpwb(int, u_short, u_int, u_int);
-#endif
-
-int astpending;
-
-char *trap_type[] = {
- "Bus error",
- "Address error",
- "Illegal instruction",
- "Zero divide",
- "CHK instruction",
- "TRAPV instruction",
- "Privilege violation",
- "Trace trap",
- "MMU fault",
- "SSIR trap",
- "Format error",
- "68881 exception",
- "Coprocessor violation",
- "Async system trap"
-};
-int trap_types = sizeof trap_type / sizeof trap_type[0];
-
-/*
- * Size of various exception stack frames (minus the standard 8 bytes)
- */
-short exframesize[] = {
- FMT0SIZE, /* type 0 - normal (68020/030/040/060) */
- FMT1SIZE, /* type 1 - throwaway (68020/030/040) */
- FMT2SIZE, /* type 2 - normal 6-word (68020/030/040/060) */
- FMT3SIZE, /* type 3 - FP post-instruction (68040/060) */
- FMT4SIZE, /* type 4 - access error/fp disabled (68060) */
- -1, -1, /* type 5-6 - undefined */
- FMT7SIZE, /* type 7 - access error (68040) */
- 58, /* type 8 - bus fault (68010) */
- FMT9SIZE, /* type 9 - coprocessor mid-instruction (68020/030) */
- FMTASIZE, /* type A - short bus fault (68020/030) */
- FMTBSIZE, /* type B - long bus fault (68020/030) */
- -1, -1, -1, -1 /* type C-F - undefined */
-};
-
-#ifdef M68060
-#define KDFAULT_060(c) (cputype == CPU_68060 && ((c) & FSLW_TM_SV))
-#define WRFAULT_060(c) (cputype == CPU_68060 && ((c) & FSLW_RW_W))
-#else
-#define KDFAULT_060(c) 0
-#define WRFAULT_060(c) 0
-#endif
-
-#ifdef M68040
-#define KDFAULT_040(c) (cputype == CPU_68040 && \
- ((c) & SSW4_TMMASK) == SSW4_TMKD)
-#define WRFAULT_040(c) (cputype == CPU_68040 && \
- ((c) & SSW4_RW) == 0)
-#else
-#define KDFAULT_040(c) 0
-#define WRFAULT_040(c) 0
-#endif
-
-#if defined(M68030) || defined(M68020)
-#define KDFAULT_OTH(c) (cputype <= CPU_68030 && \
- ((c) & (SSW_DF|SSW_FCMASK)) == (SSW_DF|FC_SUPERD))
-#define WRFAULT_OTH(c) (cputype <= CPU_68030 && \
- ((c) & (SSW_DF|SSW_RW)) == SSW_DF)
-#else
-#define KDFAULT_OTH(c) 0
-#define WRFAULT_OTH(c) 0
-#endif
-
-#define KDFAULT(c) (KDFAULT_060(c) || KDFAULT_040(c) || KDFAULT_OTH(c))
-#define WRFAULT(c) (WRFAULT_060(c) || WRFAULT_040(c) || WRFAULT_OTH(c))
-
-#ifdef DEBUG
-int mmudebug = 0;
-int mmupid = -1;
-#define MDB_FOLLOW 1
-#define MDB_WBFOLLOW 2
-#define MDB_WBFAILED 4
-#define MDB_ISPID(p) ((p) == mmupid)
-#endif
-
-#ifdef M68040
-/*
- * Handle writeback completion on 68040.
- */
-void
-wb_userret(struct proc *p, struct frame *fp)
-{
- /*
- * Deal with user mode writebacks (from trap, or from sigreturn).
- * If any writeback fails, go back and attempt signal delivery.
- * unless we have already been here and attempted the writeback
- * (e.g. bad address with user ignoring SIGSEGV). In that case
- * we just return to the user without successfully completing
- * the writebacks. Maybe we should just drop the sucker?
- */
- if (cputype == CPU_68040 && fp->f_format == FMT7) {
- int sig;
- union sigval sv;
-
- if ((sig = writeback(fp)) != 0) {
- sv.sival_ptr = (caddr_t)fp->f_fmt7.f_fa;
- trapsignal(p, sig, T_MMUFLT, SEGV_MAPERR, sv);
-
- userret(p);
- }
- }
-}
-#endif
-
-/*
- * Trap is called from locore to handle most types of processor traps,
- * including events such as simulated software interrupts/AST's.
- * System calls are broken out for efficiency.
- */
-/*ARGSUSED*/
-void
-trap(type, code, v, frame)
- int type;
- unsigned code;
- unsigned v;
- struct frame frame;
-{
- struct proc *p;
- int i, s;
- u_int ucode;
- int typ = 0;
- union sigval sv;
-
- uvmexp.traps++;
- p = curproc;
- ucode = 0;
-
- /* I have verified that this DOES happen! -gwr */
- if (p == NULL)
- p = &proc0;
-#ifdef DIAGNOSTIC
- if (p->p_addr == NULL)
- panic("trap: no pcb");
-#endif
-
- if (USERMODE(frame.f_sr)) {
- type |= T_USER;
- p->p_md.md_regs = frame.f_regs;
- }
- switch (type) {
-
- default:
-dopanic:
- printf("trap type %d, code = 0x%x, v = 0x%x\n", type, code, v);
- printf("%s program counter = 0x%x\n",
- (type & T_USER) ? "user" : "kernel", frame.f_pc);
- /*
- * Let the kernel debugger see the trap frame that
- * caused us to panic. This is a convenience so
- * one can see registers at the point of failure.
- */
- s = splhigh();
-#ifdef KGDB
- /* If connected, step or cont returns 1 */
- if (kgdb_trap(type, &frame))
- goto kgdb_cont;
-#endif
-#ifdef DDB
- (void)kdb_trap(type, (db_regs_t *)&frame);
-#endif
-#ifdef KGDB
- kgdb_cont:
-#endif
- splx(s);
- if (panicstr) {
- printf("trap during panic!\n");
-#ifdef DEBUG
- /* XXX should be a machine-dependent hook */
- printf("(press a key)\n");
- cnpollc(1); (void)cngetc(); cnpollc(0);
-#endif
- }
- regdump(&(frame.F_t), 128);
- type &= ~T_USER;
- if ((u_int)type < trap_types)
- panic(trap_type[type]);
- panic("trap");
-
- case T_BUSERR: /* kernel bus error */
- if (p->p_addr->u_pcb.pcb_onfault == 0)
- goto dopanic;
- /* FALLTHROUGH */
-
- copyfault:
- /*
- * If we have arranged to catch this fault in any of the
- * copy to/from user space routines, set PC to return to
- * indicated location and set flag informing buserror code
- * that it may need to clean up stack frame.
- */
- frame.f_stackadj = exframesize[frame.f_format];
- frame.f_format = frame.f_vector = 0;
- frame.f_pc = (int) p->p_addr->u_pcb.pcb_onfault;
- return;
-
- case T_BUSERR|T_USER: /* bus error */
- typ = BUS_OBJERR;
- ucode = code & ~T_USER;
- i = SIGBUS;
- break;
- case T_ADDRERR|T_USER: /* address error */
- typ = BUS_ADRALN;
- ucode = code & ~T_USER;
- i = SIGBUS;
- break;
-
- case T_COPERR: /* kernel coprocessor violation */
- case T_FMTERR|T_USER: /* do all RTE errors come in as T_USER? */
- case T_FMTERR: /* ...just in case... */
- /*
- * The user has most likely trashed the RTE or FP state info
- * in the stack frame of a signal handler.
- */
- printf("pid %d: kernel %s exception\n", p->p_pid,
- type==T_COPERR ? "coprocessor" : "format");
- sigexit(p, SIGILL);
- /* NOTREACHED */
- break;
-
- case T_COPERR|T_USER: /* user coprocessor violation */
- /* What is a proper response here? */
- typ = FPE_FLTINV;
- ucode = 0;
- i = SIGFPE;
- break;
-
- case T_FPERR|T_USER: /* 68881 exceptions */
- /*
- * We pass along the 68881 status which locore stashed
- * in code for us. Note that there is a possibility that the
- * bit pattern of this will conflict with one of the
- * FPE_* codes defined in signal.h. Fortunately for us, the
- * only such codes we use are all in the range 1-7 and the low
- * 3 bits of the status are defined as 0 so there is
- * no clash.
- */
- typ = FPE_FLTRES;
- ucode = code;
- i = SIGFPE;
- v = frame.f_pc;
- break;
-
-#ifdef M68040
- case T_FPEMULI|T_USER: /* unimplemented FP instruction */
- case T_FPEMULD|T_USER: /* unimplemented FP data type */
- /* XXX need to FSAVE */
- printf("pid %d(%s): unimplemented FP %s at %x (EA %x)\n",
- p->p_pid, p->p_comm,
- frame.f_format == 2 ? "instruction" : "data type",
- frame.f_pc, frame.f_fmt2.f_iaddr);
- /* XXX need to FRESTORE */
- typ = FPE_FLTINV;
- i = SIGFPE;
- v = frame.f_pc;
- break;
-#endif
-
- case T_ILLINST|T_USER: /* illegal instruction fault */
- ucode = frame.f_format; /* XXX was ILL_PRIVIN_FAULT */
- typ = ILL_ILLOPC;
- i = SIGILL;
- v = frame.f_pc;
- break;
-
- case T_PRIVINST|T_USER: /* privileged instruction fault */
- ucode = frame.f_format; /* XXX was ILL_PRIVIN_FAULT */
- typ = ILL_PRVOPC;
- i = SIGILL;
- v = frame.f_pc;
- break;
-
- case T_ZERODIV|T_USER: /* Divide by zero */
- ucode = frame.f_format; /* XXX was FPE_INTDIV_TRAP */
- typ = FPE_INTDIV;
- i = SIGFPE;
- v = frame.f_pc;
- break;
-
- case T_CHKINST|T_USER: /* CHK instruction trap */
- ucode = frame.f_format; /* XXX was FPE_SUBRNG_TRAP */
- typ = FPE_FLTSUB;
- i = SIGFPE;
- v = frame.f_pc;
- break;
-
- case T_TRAPVINST|T_USER: /* TRAPV instruction trap */
- ucode = frame.f_format; /* XXX was FPE_INTOVF_TRAP */
- typ = ILL_ILLTRP;
- i = SIGILL;
- v = frame.f_pc;
- break;
-
- /*
- * XXX: Trace traps are a nightmare.
- *
- * HP-UX uses trap #1 for breakpoints,
- * OpenBSD/m68k uses trap #2,
- * SUN 3.x uses trap #15,
- * DDB and KGDB uses trap #15 (for kernel breakpoints;
- * handled elsewhere).
- *
- * OpenBSD and HP-UX traps both get mapped by locore.s into T_TRACE.
- * SUN 3.x traps get passed through as T_TRAP15 and are not really
- * supported yet.
- *
- * XXX: We should never get kernel-mode T_TRAP15
- * XXX: because locore.s now gives them special treatment.
- */
- case T_TRAP15: /* kernel breakpoint */
-#ifdef DEBUG
- printf("unexpected kernel trace trap, type = %d\n", type);
- printf("program counter = 0x%x\n", frame.f_pc);
-#endif
- frame.f_sr &= ~PSL_T;
- return;
-
- case T_TRACE|T_USER: /* user trace trap */
- case T_TRACE: /* tracing a trap instruction */
- case T_TRAP15|T_USER: /* SUN user trace trap */
- frame.f_sr &= ~PSL_T;
- i = SIGTRAP;
- typ = TRAP_TRACE;
- break;
-
- case T_ASTFLT: /* system async trap, cannot happen */
- goto dopanic;
-
- case T_ASTFLT|T_USER: /* user async trap */
- astpending = 0;
- /*
- * We check for software interrupts first. This is because
- * they are at a higher level than ASTs, and on a VAX would
- * interrupt the AST. We assume that if we are processing
- * an AST that we must be at IPL0 so we don't bother to
- * check. Note that we ensure that we are at least at SIR
- * IPL while processing the SIR.
- */
- splsoft();
- /* FALLTHROUGH */
-
- case T_SSIR: /* software interrupt */
- case T_SSIR|T_USER:
- {
- int sir, q, mask;
-
- while ((sir = softpending) != 0) {
- atomic_clearbits_int(&softpending, sir);
-
- for (q = SI_NQUEUES - 1, mask = 1 << (SI_NQUEUES - 1);
- mask != 0; q--, mask >>= 1)
- if (mask & sir)
- softintr_dispatch(q);
- }
- }
-
- /*
- * If this was not an AST trap, we are all done.
- */
- if (type != (T_ASTFLT|T_USER)) {
- uvmexp.traps--;
- return;
- }
- spl0();
- if (p->p_flag & P_OWEUPC) {
- ADDUPROF(p);
- }
- if (type == (T_ASTFLT | T_USER) && want_resched) {
- preempt(NULL);
- }
- goto out;
-
- case T_MMUFLT: /* kernel mode page fault */
- case T_MMUFLT|T_USER: /* page fault */
- {
- vaddr_t va;
- struct vmspace *vm = p->p_vmspace;
- struct vm_map *map;
- int rv;
- vm_prot_t ftype, vftype;
- extern struct vm_map *kernel_map;
-
-#ifdef DEBUG
- if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid))
- printf("trap: T_MMUFLT pid=%d, code=%x, v=%x, pc=%x, sr=%x\n",
- p->p_pid, code, v, frame.f_pc, frame.f_sr);
-#endif
- /*
- * It is only a kernel address space fault iff:
- * 1. (type & T_USER) == 0 and
- * 2. pcb_onfault not set or
- * 3. pcb_onfault set but supervisor space data fault
- * The last can occur during an exec() copyin where the
- * argument space is lazy-allocated.
- */
- if ((type & T_USER) == 0 &&
- ((p->p_addr->u_pcb.pcb_onfault == 0) || KDFAULT(code)))
- map = kernel_map;
- else
- map = vm ? &vm->vm_map : kernel_map;
-
- if (WRFAULT(code)) {
- vftype = VM_PROT_WRITE;
- ftype = VM_PROT_READ | VM_PROT_WRITE;
- } else
- vftype = ftype = VM_PROT_READ;
-
- va = trunc_page((vaddr_t)v);
-
- if (map == kernel_map && va == 0) {
- printf("trap: bad kernel %s access at 0x%x\n",
- (ftype & VM_PROT_WRITE) ? "read/write" :
- "read", v);
- goto dopanic;
- }
-
- rv = uvm_fault(map, va, 0, ftype);
-#ifdef DEBUG
- if (rv && MDB_ISPID(p->p_pid))
- printf("uvm_fault(%p, 0x%lx, 0, 0x%x) -> 0x%x\n",
- map, va, ftype, rv);
-#endif
- /*
- * If this was a stack access we keep track of the maximum
- * accessed stack size. Also, if vm_fault gets a protection
- * failure it is due to accessing the stack region outside
- * the current limit and we need to reflect that as an access
- * error.
- */
- if ((vm != NULL && (caddr_t)va >= vm->vm_maxsaddr)
- && map != kernel_map) {
- if (rv == 0) {
- uvm_grow(p, va);
- } else if (rv == EACCES)
- rv = EFAULT;
- }
- if (rv == 0) {
- if (type == T_MMUFLT) {
-#ifdef M68040
- if (cputype == CPU_68040)
- (void)writeback(&frame);
-#endif
- return;
- }
- goto out;
- }
- if (type == T_MMUFLT) {
- if (p->p_addr->u_pcb.pcb_onfault)
- goto copyfault;
- printf("uvm_fault(%p, 0x%lx, 0, 0x%x) -> 0x%x\n",
- map, va, ftype, rv);
- printf(" type %x, code [mmu,,ssw]: %x\n",
- type, code);
- goto dopanic;
- }
- frame.f_pad = code & 0xffff;
- ucode = vftype;
- typ = SEGV_MAPERR;
- i = SIGSEGV;
- break;
- }
- }
- sv.sival_ptr = (caddr_t)v;
- trapsignal(p, i, ucode, typ, sv);
-out:
- if ((type & T_USER) == 0)
- return;
- userret(p);
-#ifdef M68040
- wb_userret(p, &frame);
-#endif
-}
-
-#ifdef M68040
-#ifdef DEBUG
-struct writebackstats {
- int calls;
- int cpushes;
- int move16s;
- int wb1s, wb2s, wb3s;
- int wbsize[4];
-} wbstats;
-
-char *f7sz[] = { "longword", "byte", "word", "line" };
-char *f7tt[] = { "normal", "MOVE16", "AFC", "ACK" };
-char *f7tm[] = { "d-push", "u-data", "u-code", "M-data",
- "M-code", "k-data", "k-code", "RES" };
-char wberrstr[] =
- "WARNING: pid %d(%s) writeback [%s] failed, pc=%x fa=%x wba=%x wbd=%x\n";
-#endif
-
-int
-writeback(struct frame *fp)
-{
- struct fmt7 *f = &fp->f_fmt7;
- struct proc *p = curproc;
- int err = 0;
- u_int fa;
- paddr_t pa;
- caddr_t oonfault = p->p_addr->u_pcb.pcb_onfault;
-
-#ifdef DEBUG
- if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid)) {
- printf(" pid=%d, fa=%x,", p->p_pid, f->f_fa);
- dumpssw(f->f_ssw);
- }
- wbstats.calls++;
-#endif
- /*
- * Deal with special cases first.
- */
- if ((f->f_ssw & SSW4_TMMASK) == SSW4_TMDCP) {
- /*
- * Dcache push fault.
- * Line-align the address and write out the push data to
- * the indicated physical address.
- */
-#ifdef DEBUG
- if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid)) {
- printf(" pushing %s to PA %x, data %x",
- f7sz[(f->f_ssw & SSW4_SZMASK) >> 5],
- f->f_fa, f->f_pd0);
- if ((f->f_ssw & SSW4_SZMASK) == SSW4_SZLN)
- printf("/%x/%x/%x",
- f->f_pd1, f->f_pd2, f->f_pd3);
- printf("\n");
- }
- if (f->f_wb1s & SSW4_WBSV)
- panic("writeback: cache push with WB1S valid");
- wbstats.cpushes++;
-#endif
- /*
- * XXX there are security problems if we attempt to do a
- * cache push after a signal handler has been called.
- */
- pmap_kenter_pa((vaddr_t)vmmap,
- trunc_page((vaddr_t)f->f_fa), VM_PROT_WRITE);
- pmap_update(pmap_kernel());
- fa = (u_int)&vmmap[(f->f_fa & PGOFSET) & ~0x000f];
- bcopy((caddr_t)&f->f_pd0, (caddr_t)fa, 16);
- pmap_extract(pmap_kernel(), (vaddr_t)fa, &pa);
- DCFL(pa);
- pmap_kremove((vaddr_t)vmmap, PAGE_SIZE);
- pmap_update(pmap_kernel());
- } else if ((f->f_ssw & (SSW4_RW|SSW4_TTMASK)) == SSW4_TTM16) {
- /*
- * MOVE16 fault.
- * Line-align the address and write out the push data to
- * the indicated virtual address.
- */
-#ifdef DEBUG
- if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid))
- printf(" MOVE16 to VA %x(%x), data %x/%x/%x/%x\n",
- f->f_fa, f->f_fa & ~0xF, f->f_pd0, f->f_pd1,
- f->f_pd2, f->f_pd3);
- if (f->f_wb1s & SSW4_WBSV)
- panic("writeback: MOVE16 with WB1S valid");
- wbstats.move16s++;
-#endif
- if (KDFAULT(f->f_wb1s))
- bcopy((caddr_t)&f->f_pd0, (caddr_t)(f->f_fa & ~0xF), 16);
- else
- err = suline((caddr_t)(f->f_fa & ~0xF), (caddr_t)&f->f_pd0);
- if (err) {
- fa = f->f_fa & ~0xF;
-#ifdef DEBUG
- if (mmudebug & MDB_WBFAILED)
- printf(wberrstr, p->p_pid, p->p_comm,
- "MOVE16", fp->f_pc, f->f_fa,
- f->f_fa & ~0xF, f->f_pd0);
-#endif
- }
- } else if (f->f_wb1s & SSW4_WBSV) {
- /*
- * Writeback #1.
- * Position the "memory-aligned" data and write it out.
- */
- u_int wb1d = f->f_wb1d;
- int off;
-
-#ifdef DEBUG
- if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid))
- dumpwb(1, f->f_wb1s, f->f_wb1a, f->f_wb1d);
- wbstats.wb1s++;
- wbstats.wbsize[(f->f_wb2s&SSW4_SZMASK)>>5]++;
-#endif
- off = (f->f_wb1a & 3) * 8;
- switch (f->f_wb1s & SSW4_SZMASK) {
- case SSW4_SZLW:
- if (off)
- wb1d = (wb1d >> (32 - off)) | (wb1d << off);
- if (KDFAULT(f->f_wb1s))
- *(long *)f->f_wb1a = wb1d;
- else
- err = copyout(&wb1d, (caddr_t)f->f_wb1a,
- sizeof(int));
- break;
- case SSW4_SZB:
- off = 24 - off;
- if (off)
- wb1d >>= off;
- if (KDFAULT(f->f_wb1s))
- *(char *)f->f_wb1a = wb1d;
- else {
- char tmp = wb1d;
-
- err = copyout(&tmp, (caddr_t)f->f_wb1a,
- sizeof(char));
- }
- break;
- case SSW4_SZW:
- off = (off + 16) % 32;
- if (off)
- wb1d = (wb1d >> (32 - off)) | (wb1d << off);
- if (KDFAULT(f->f_wb1s))
- *(short *)f->f_wb1a = wb1d;
- else {
- short tmp = wb1d;
-
- err = copyout(&tmp, (caddr_t)f->f_wb1a,
- sizeof(short));
- }
- break;
- }
- if (err) {
- fa = f->f_wb1a;
-#ifdef DEBUG
- if (mmudebug & MDB_WBFAILED)
- printf(wberrstr, p->p_pid, p->p_comm,
- "#1", fp->f_pc, f->f_fa,
- f->f_wb1a, f->f_wb1d);
-#endif
- }
- }
- /*
- * Deal with the "normal" writebacks.
- *
- * XXX writeback2 is known to reflect a LINE size writeback after
- * a MOVE16 was already dealt with above. Ignore it.
- */
- if (err == 0 && (f->f_wb2s & SSW4_WBSV) &&
- (f->f_wb2s & SSW4_SZMASK) != SSW4_SZLN) {
-#ifdef DEBUG
- if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid))
- dumpwb(2, f->f_wb2s, f->f_wb2a, f->f_wb2d);
- wbstats.wb2s++;
- wbstats.wbsize[(f->f_wb2s&SSW4_SZMASK)>>5]++;
-#endif
- switch (f->f_wb2s & SSW4_SZMASK) {
- case SSW4_SZLW:
- if (KDFAULT(f->f_wb2s))
- *(long *)f->f_wb2a = f->f_wb2d;
- else
- err = copyout(&f->f_wb2d, (caddr_t)f->f_wb2a,
- sizeof(int));
- break;
- case SSW4_SZB:
- if (KDFAULT(f->f_wb2s))
- *(char *)f->f_wb2a = f->f_wb2d;
- else {
- char tmp = f->f_wb2d;
-
- err = copyout(&tmp, (caddr_t)f->f_wb2a,
- sizeof(char));
- }
- break;
- case SSW4_SZW:
- if (KDFAULT(f->f_wb2s))
- *(short *)f->f_wb2a = f->f_wb2d;
- else {
- short tmp = f->f_wb2d;
-
- err = copyout(&tmp, (caddr_t)f->f_wb2a,
- sizeof(short));
- }
- break;
- }
- if (err) {
- fa = f->f_wb2a;
-#ifdef DEBUG
- if (mmudebug & MDB_WBFAILED) {
- printf(wberrstr, p->p_pid, p->p_comm,
- "#2", fp->f_pc, f->f_fa,
- f->f_wb2a, f->f_wb2d);
- dumpssw(f->f_ssw);
- dumpwb(2, f->f_wb2s, f->f_wb2a, f->f_wb2d);
- }
-#endif
- }
- }
- if (err == 0 && (f->f_wb3s & SSW4_WBSV)) {
-#ifdef DEBUG
- if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid))
- dumpwb(3, f->f_wb3s, f->f_wb3a, f->f_wb3d);
- wbstats.wb3s++;
- wbstats.wbsize[(f->f_wb3s&SSW4_SZMASK)>>5]++;
-#endif
- switch (f->f_wb3s & SSW4_SZMASK) {
- case SSW4_SZLW:
- if (KDFAULT(f->f_wb3s))
- *(long *)f->f_wb3a = f->f_wb3d;
- else
- err = copyout(&f->f_wb3d, (caddr_t)f->f_wb3a,
- sizeof(int));
- break;
- case SSW4_SZB:
- if (KDFAULT(f->f_wb3s))
- *(char *)f->f_wb3a = f->f_wb3d;
- else {
- char tmp = f->f_wb3d;
-
- err = copyout(&tmp, (caddr_t)f->f_wb3a,
- sizeof(char));
- }
- break;
- case SSW4_SZW:
- if (KDFAULT(f->f_wb3s))
- *(short *)f->f_wb3a = f->f_wb3d;
- else {
- short tmp = f->f_wb3d;
-
- err = copyout(&tmp, (caddr_t)f->f_wb3a,
- sizeof(short));
- }
- break;
-#ifdef DEBUG
- case SSW4_SZLN:
- panic("writeback: wb3s indicates LINE write");
-#endif
- }
- if (err) {
- fa = f->f_wb3a;
-#ifdef DEBUG
- if (mmudebug & MDB_WBFAILED)
- printf(wberrstr, p->p_pid, p->p_comm,
- "#3", fp->f_pc, f->f_fa,
- f->f_wb3a, f->f_wb3d);
-#endif
- }
- }
- p->p_addr->u_pcb.pcb_onfault = oonfault;
- /*
- * Any problems are SIGSEGV's
- */
- if (err)
- err = SIGSEGV;
- return(err);
-}
-
-#ifdef DEBUG
-void
-dumpssw(ssw)
- u_short ssw;
-{
- printf(" SSW: %x: ", ssw);
- if (ssw & SSW4_CP)
- printf("CP,");
- if (ssw & SSW4_CU)
- printf("CU,");
- if (ssw & SSW4_CT)
- printf("CT,");
- if (ssw & SSW4_CM)
- printf("CM,");
- if (ssw & SSW4_MA)
- printf("MA,");
- if (ssw & SSW4_ATC)
- printf("ATC,");
- if (ssw & SSW4_LK)
- printf("LK,");
- if (ssw & SSW4_RW)
- printf("RW,");
- printf(" SZ=%s, TT=%s, TM=%s\n",
- f7sz[(ssw & SSW4_SZMASK) >> 5],
- f7tt[(ssw & SSW4_TTMASK) >> 3],
- f7tm[ssw & SSW4_TMMASK]);
-}
-
-void
-dumpwb(num, s, a, d)
- int num;
- u_short s;
- u_int a, d;
-{
- struct proc *p = curproc;
- paddr_t pa;
- int tmp;
-
- printf(" writeback #%d: VA %x, data %x, SZ=%s, TT=%s, TM=%s\n",
- num, a, d, f7sz[(s & SSW4_SZMASK) >> 5],
- f7tt[(s & SSW4_TTMASK) >> 3], f7tm[s & SSW4_TMMASK]);
- printf(" PA ");
- if (pmap_extract(p->p_vmspace->vm_map.pmap, (vaddr_t)a, &pa) == FALSE)
- printf("<invalid address>");
- else {
- if (copyin((caddr_t)a, &tmp, sizeof(int)) == 0)
- printf("%lx, current value %lx", pa, tmp);
- else
- printf("%lx, current value inaccessible", pa);
- }
- printf("\n");
-}
-#endif
-#endif
-
-/*
- * Process a system call.
- */
-void
-syscall(code, frame)
- register_t code;
- struct frame frame;
-{
- caddr_t params;
- struct sysent *callp;
- struct proc *p;
- int error, opc, nsys;
- size_t argsize;
- register_t args[8], rval[2];
-
- uvmexp.syscalls++;
- if (!USERMODE(frame.f_sr))
- panic("syscall");
- p = curproc;
- p->p_md.md_regs = frame.f_regs;
- opc = frame.f_pc;
-
- nsys = p->p_emul->e_nsysent;
- callp = p->p_emul->e_sysent;
-
- params = (caddr_t)frame.f_regs[SP] + sizeof(int);
-
- switch (code) {
- case SYS_syscall:
- /*
- * Code is first argument, followed by actual args.
- */
- if ((error = copyin(params, &code, sizeof(register_t))))
- goto bad;
- params += sizeof(int);
- /*
- * XXX sigreturn requires special stack manipulation
- * that is only done if entered via the sigreturn
- * trap. Cannot allow it here so make sure we fail.
- */
- if (code == SYS_sigreturn)
- code = nsys;
- break;
- case SYS___syscall:
- /*
- * Like syscall, but code is a quad, so as to maintain
- * quad alignment for the rest of the arguments.
- */
- if (callp != sysent)
- break;
- if ((error = copyin(params + _QUAD_LOWWORD * sizeof(int),
- &code, sizeof(register_t))))
- goto bad;
- params += sizeof(quad_t);
- break;
- default:
- break;
- }
- if (code < 0 || code >= nsys)
- callp += p->p_emul->e_nosys; /* illegal */
- else
- callp += code;
- argsize = callp->sy_argsize;
- if (argsize && (error = copyin(params, args, argsize)))
- goto bad;
-
- rval[0] = 0;
- rval[1] = frame.f_regs[D1];
-
- error = mi_syscall(p, code, callp, args, rval);
-
- switch (error) {
- case 0:
- frame.f_regs[D0] = rval[0];
- frame.f_regs[D1] = rval[1];
- frame.f_sr &= ~PSL_C; /* carry bit */
- break;
- case ERESTART:
- /*
- * We always enter through a `trap' instruction, which is 2
- * bytes, so adjust the pc by that amount.
- */
- frame.f_pc = opc - 2;
- break;
- case EJUSTRETURN:
- /* nothing to do */
- break;
- default:
- bad:
- frame.f_regs[D0] = error;
- frame.f_sr |= PSL_C; /* carry bit */
- break;
- }
-
- mi_syscall_return(p, code, error, rval);
-}
diff --git a/sys/arch/hp300/hp300/vectors.s b/sys/arch/hp300/hp300/vectors.s
deleted file mode 100644
index 0131b1d2bf8..00000000000
--- a/sys/arch/hp300/hp300/vectors.s
+++ /dev/null
@@ -1,147 +0,0 @@
-| $OpenBSD: vectors.s,v 1.10 2005/01/14 22:39:28 miod Exp $
-| $NetBSD: vectors.s,v 1.12 1997/07/14 19:18:32 thorpej Exp $
-
-| Copyright (c) 1997 Jason R. Thorpe. All rights reserved.
-| Copyright (c) 1988 University of Utah
-| Copyright (c) 1990, 1993
-| The Regents of the University of California. All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions
-| are met:
-| 1. Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| 2. Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| 3. Neither the name of the University nor the names of its contributors
-| may be used to endorse or promote products derived from this software
-| without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-| ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-| IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-| ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-| FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-| DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-| OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-| LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-| OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-| SUCH DAMAGE.
-|
-| @(#)vectors.s 8.2 (Berkeley) 1/21/94
-|
-
-#define BADTRAP16 \
- VECTOR(badtrap) ; VECTOR(badtrap) ; \
- VECTOR(badtrap) ; VECTOR(badtrap) ; \
- VECTOR(badtrap) ; VECTOR(badtrap) ; \
- VECTOR(badtrap) ; VECTOR(badtrap) ; \
- VECTOR(badtrap) ; VECTOR(badtrap) ; \
- VECTOR(badtrap) ; VECTOR(badtrap) ; \
- VECTOR(badtrap) ; VECTOR(badtrap) ; \
- VECTOR(badtrap) ; VECTOR(badtrap)
-
- /*
- * bus error and address error vectors are initialized
- * in locore.s once we know our CPU type.
- */
-
- .data
-GLOBAL(vectab)
- VECTOR_UNUSED /* 0: NOT USED (reset SSP) */
- VECTOR_UNUSED /* 1: NOT USED (reset PC) */
- VECTOR_UNUSED /* 2: bus error */
- VECTOR_UNUSED /* 3: address error */
- VECTOR(illinst) /* 4: illegal instruction */
- VECTOR(zerodiv) /* 5: zero divide */
- VECTOR(chkinst) /* 6: CHK instruction */
- VECTOR(trapvinst) /* 7: TRAPV instruction */
- VECTOR(privinst) /* 8: privilege violation */
- VECTOR(trace) /* 9: trace */
- VECTOR(illinst) /* 10: line 1010 emulator */
- VECTOR(fpfline) /* 11: line 1111 emulator */
- VECTOR(badtrap) /* 12: unassigned, reserved */
- VECTOR(coperr) /* 13: coprocessor protocol violation */
- VECTOR(fmterr) /* 14: format error */
- VECTOR(badtrap) /* 15: uninitialized interrupt vector */
- VECTOR(badtrap) /* 16: unassigned, reserved */
- VECTOR(badtrap) /* 17: unassigned, reserved */
- VECTOR(badtrap) /* 18: unassigned, reserved */
- VECTOR(badtrap) /* 19: unassigned, reserved */
- VECTOR(badtrap) /* 20: unassigned, reserved */
- VECTOR(badtrap) /* 21: unassigned, reserved */
- VECTOR(badtrap) /* 22: unassigned, reserved */
- VECTOR(badtrap) /* 23: unassigned, reserved */
- VECTOR(spurintr) /* 24: spurious interrupt */
- VECTOR(intrhand) /* 25: level 1 interrupt autovector */
- VECTOR(intrhand) /* 26: level 2 interrupt autovector */
- VECTOR(intrhand) /* 27: level 3 interrupt autovector */
- VECTOR(intrhand) /* 28: level 4 interrupt autovector */
- VECTOR(intrhand) /* 29: level 5 interrupt autovector */
- VECTOR(lev6intr) /* 30: level 6 interrupt autovector */
- VECTOR(lev7intr) /* 31: level 7 interrupt autovector */
- VECTOR(trap0) /* 32: syscalls */
- VECTOR(trap1) /* 33: sigreturn syscall or breakpoint */
- VECTOR(trap2) /* 34: breakpoint or sigreturn syscall */
- VECTOR(illinst) /* 35: TRAP instruction vector */
- VECTOR(illinst) /* 36: TRAP instruction vector */
- VECTOR(illinst) /* 37: TRAP instruction vector */
- VECTOR(illinst) /* 38: TRAP instruction vector */
- VECTOR(illinst) /* 39: TRAP instruction vector */
- VECTOR(illinst) /* 40: TRAP instruction vector */
- VECTOR(illinst) /* 41: TRAP instruction vector */
- VECTOR(illinst) /* 42: TRAP instruction vector */
- VECTOR(illinst) /* 43: TRAP instruction vector */
- VECTOR(trap12) /* 44: TRAP instruction vector */
- VECTOR(illinst) /* 45: TRAP instruction vector */
- VECTOR(illinst) /* 46: TRAP instruction vector */
- VECTOR(trap15) /* 47: TRAP instruction vector */
-
-GLOBAL(fpvect_tab)
- VECTOR(fpfault) /* 48: FPCP branch/set on unordered cond */
- VECTOR(fpfault) /* 49: FPCP inexact result */
- VECTOR(fpfault) /* 50: FPCP divide by zero */
- VECTOR(fpfault) /* 51: FPCP underflow */
- VECTOR(fpfault) /* 52: FPCP operand error */
- VECTOR(fpfault) /* 53: FPCP overflow */
- VECTOR(fpfault) /* 54: FPCP signalling NAN */
-GLOBAL(fpvect_end)
-
- VECTOR(fpunsupp) /* 55: FPCP unimplemented data type */
- VECTOR(badtrap) /* 56: unassigned, reserved */
- VECTOR(badtrap) /* 57: unassigned, reserved */
- VECTOR(badtrap) /* 58: unassigned, reserved */
- VECTOR(badtrap) /* 59: unassigned, reserved */
- VECTOR(badtrap) /* 60: unassigned, reserved */
- VECTOR(badtrap) /* 61: unassigned, reserved */
- VECTOR(badtrap) /* 62: unassigned, reserved */
- VECTOR(badtrap) /* 63: unassigned, reserved */
-
- BADTRAP16 /* 64-255: user interrupt vectors */
- BADTRAP16 /* 64-255: user interrupt vectors */
- BADTRAP16 /* 64-255: user interrupt vectors */
- BADTRAP16 /* 64-255: user interrupt vectors */
- BADTRAP16 /* 64-255: user interrupt vectors */
- BADTRAP16 /* 64-255: user interrupt vectors */
- BADTRAP16 /* 64-255: user interrupt vectors */
- BADTRAP16 /* 64-255: user interrupt vectors */
- BADTRAP16 /* 64-255: user interrupt vectors */
- BADTRAP16 /* 64-255: user interrupt vectors */
- BADTRAP16 /* 64-255: user interrupt vectors */
- BADTRAP16 /* 64-255: user interrupt vectors */
-
-#ifdef FPSP
- /*
- * 68040: this chunk of vectors is copied into the fpfault zone
- */
-GLOBAL(fpsp_tab)
- ASVECTOR(fpsp_bsun) /* 48: FPCP branch/set on unordered cond */
- ASVECTOR(inex) /* 49: FPCP inexact result */
- ASVECTOR(dz) /* 50: FPCP divide by zero */
- ASVECTOR(fpsp_unfl) /* 51: FPCP underflow */
- ASVECTOR(fpsp_operr) /* 52: FPCP operand error */
- ASVECTOR(fpsp_ovfl) /* 53: FPCP overflow */
- ASVECTOR(fpsp_snan) /* 54: FPCP signalling NAN */
-#endif /* FPSP */
diff --git a/sys/arch/hp300/hp300/vm_machdep.c b/sys/arch/hp300/hp300/vm_machdep.c
deleted file mode 100644
index d5eec2d9a95..00000000000
--- a/sys/arch/hp300/hp300/vm_machdep.c
+++ /dev/null
@@ -1,258 +0,0 @@
-/* $OpenBSD: vm_machdep.c,v 1.46 2013/01/16 19:04:43 miod Exp $ */
-/* $NetBSD: vm_machdep.c,v 1.60 2001/07/06 05:53:35 chs Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: vm_machdep.c 1.21 91/04/06$
- *
- * @(#)vm_machdep.c 8.6 (Berkeley) 1/12/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/signalvar.h>
-#include <sys/malloc.h>
-#include <sys/buf.h>
-#include <sys/vnode.h>
-#include <sys/user.h>
-#include <sys/core.h>
-#include <sys/exec.h>
-#include <sys/ptrace.h>
-
-#include <machine/frame.h>
-#include <machine/cpu.h>
-#include <machine/pte.h>
-#include <machine/reg.h>
-
-#include <uvm/uvm_extern.h>
-
-/*
- * Finish a fork operation, with process p2 nearly set up.
- * Copy and update the pcb and trap frame, making the child ready to run.
- *
- * Rig the child's kernel stack so that it will start out in
- * proc_trampoline() and call child_return() with p2 as an
- * argument. This causes the newly-created child process to go
- * directly to user level with an apparent return value of 0 from
- * fork(), while the parent process returns normally.
- *
- * p1 is the process being forked; if p1 == &proc0, we are creating
- * a kernel thread, and the return path and argument are specified with
- * `func' and `arg'.
- *
- * If an alternate user-level stack is requested (with non-zero values
- * in both the stack and stacksize args), set up the user stack pointer
- * accordingly.
- */
-void
-cpu_fork(p1, p2, stack, stacksize, func, arg)
- struct proc *p1, *p2;
- void *stack;
- size_t stacksize;
- void (*func)(void *);
- void *arg;
-{
- struct pcb *pcb = &p2->p_addr->u_pcb;
- struct trapframe *tf;
- struct switchframe *sf;
- extern struct pcb *curpcb;
-
- p2->p_md.md_flags = p1->p_md.md_flags;
-
- /* Copy pcb from proc p1 to p2. */
- if (p1 == curproc) {
- /* Sync the PCB before we copy it. */
- savectx(curpcb);
- }
-#ifdef DIAGNOSTIC
- else if (p1 != &proc0)
- panic("cpu_fork: curproc");
-#endif
- *pcb = p1->p_addr->u_pcb;
-
- /*
- * Copy the trap frame.
- */
- tf = (struct trapframe *)((u_int)p2->p_addr + USPACE) - 1;
- p2->p_md.md_regs = (int *)tf;
- *tf = *(struct trapframe *)p1->p_md.md_regs;
-
- /*
- * If specified, give the child a different stack.
- */
- if (stack != NULL)
- tf->tf_regs[15] = (u_int)stack + stacksize;
-
- sf = (struct switchframe *)tf - 1;
- sf->sf_pc = (u_int)proc_trampoline;
- pcb->pcb_regs[6] = (int)func; /* A2 */
- pcb->pcb_regs[7] = (int)arg; /* A3 */
- pcb->pcb_regs[11] = (int)sf; /* SSP */
- pcb->pcb_ps = PSL_LOWIPL; /* start kthreads at IPL 0 */
-}
-
-/*
- * cpu_exit is called as the last action during exit.
- *
- * Call switch_exit() which will switch to another process thus we never return.
- */
-void
-cpu_exit(p)
- struct proc *p;
-{
- pmap_deactivate(p);
- sched_exit(p);
-}
-
-/*
- * Dump the machine specific header information at the start of a core dump.
- */
-struct md_core {
- struct reg intreg;
- struct fpreg freg;
-};
-int
-cpu_coredump(p, vp, cred, chdr)
- struct proc *p;
- struct vnode *vp;
- struct ucred *cred;
- struct core *chdr;
-{
- struct md_core md_core;
- struct coreseg cseg;
- int error;
-
- CORE_SETMAGIC(*chdr, COREMAGIC, MID_MACHINE, 0);
- chdr->c_hdrsize = ALIGN(sizeof(*chdr));
- chdr->c_seghdrsize = ALIGN(sizeof(cseg));
- chdr->c_cpusize = sizeof(md_core);
-
- /* Save integer registers. */
- error = process_read_regs(p, &md_core.intreg);
- if (error)
- return error;
-
- if (fputype) {
- /* Save floating point registers. */
- error = process_read_fpregs(p, &md_core.freg);
- if (error)
- return error;
- } else {
- /* Make sure these are clear. */
- bzero((caddr_t)&md_core.freg, sizeof(md_core.freg));
- }
-
- CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_MACHINE, CORE_CPU);
- cseg.c_addr = 0;
- cseg.c_size = chdr->c_cpusize;
-
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cseg, chdr->c_seghdrsize,
- (off_t)chdr->c_hdrsize, UIO_SYSSPACE, IO_UNIT, cred, NULL, p);
- if (error)
- return error;
-
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&md_core, sizeof(md_core),
- (off_t)(chdr->c_hdrsize + chdr->c_seghdrsize), UIO_SYSSPACE,
- IO_UNIT, cred, NULL, p);
- if (error)
- return error;
-
- chdr->c_nseg++;
- return 0;
-}
-
-/*
- * Map a user I/O request into kernel virtual address space.
- * Note: the pages are already locked by uvm_vslock(), so we
- * do not need to pass an access_type to pmap_enter().
- */
-void
-vmapbuf(bp, len)
- struct buf *bp;
- vsize_t len;
-{
- struct pmap *upmap, *kpmap;
- vaddr_t uva; /* User VA (map from) */
- vaddr_t kva; /* Kernel VA (new to) */
- paddr_t pa; /* physical address */
- vsize_t off;
-
- if ((bp->b_flags & B_PHYS) == 0)
- panic("vmapbuf");
-
- uva = trunc_page((vaddr_t)(bp->b_saveaddr = bp->b_data));
- off = (vaddr_t)bp->b_data - uva;
- len = round_page(off + len);
- kva = uvm_km_valloc_wait(phys_map, len);
- bp->b_data = (caddr_t)(kva + off);
-
- upmap = vm_map_pmap(&bp->b_proc->p_vmspace->vm_map);
- kpmap = vm_map_pmap(phys_map);
- do {
- if (pmap_extract(upmap, uva, &pa) == FALSE)
- panic("vmapbuf: null page frame");
- pmap_enter(kpmap, kva, pa, VM_PROT_READ|VM_PROT_WRITE,
- VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED);
- uva += PAGE_SIZE;
- kva += PAGE_SIZE;
- len -= PAGE_SIZE;
- } while (len);
- pmap_update(pmap_kernel());
-}
-
-/*
- * Unmap a previously-mapped user I/O request.
- */
-void
-vunmapbuf(bp, len)
- struct buf *bp;
- vsize_t len;
-{
- vaddr_t kva;
- vsize_t off;
-
- if ((bp->b_flags & B_PHYS) == 0)
- panic("vunmapbuf");
-
- kva = trunc_page((vaddr_t)(bp->b_data));
- off = (vaddr_t)bp->b_data - kva;
- len = round_page(off + len);
-
- pmap_remove(vm_map_pmap(phys_map), kva, kva + len);
- pmap_update(pmap_kernel());
- uvm_km_free_wakeup(phys_map, kva, len);
- bp->b_data = bp->b_saveaddr;
- bp->b_saveaddr = 0;
-}
diff --git a/sys/arch/hp300/hp300/wscons_machdep.c b/sys/arch/hp300/hp300/wscons_machdep.c
deleted file mode 100644
index 409a3e3eb4b..00000000000
--- a/sys/arch/hp300/hp300/wscons_machdep.c
+++ /dev/null
@@ -1,359 +0,0 @@
-/* $OpenBSD: wscons_machdep.c,v 1.12 2011/08/18 20:02:58 miod Exp $ */
-
-/*
- * Copyright (c) 2005, 2011, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * Copyright (c) 2002 Michael Shalayeff
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-#include <machine/hp300spu.h>
-
-#include <dev/cons.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/rasops/rasops.h>
-
-#include "wsdisplay.h"
-#include "wskbd.h"
-#if NWSKBD > 0
-#include <dev/wscons/wskbdvar.h>
-#endif
-
-#include "dvbox.h"
-#include "gbox.h"
-#include "hyper.h"
-#include "rbox.h"
-#include "sti.h"
-#include "topcat.h"
-#include "tvrx.h"
-
-#if NDVBOX > 0 || NGBOX > 0 || NHYPER > 0 || NRBOX > 0 || NSTI_DIO > 0 || NTOPCAT > 0 || NTVRX > 0
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diovar.h>
-#include <hp300/dev/diofbreg.h>
-#include <hp300/dev/diofbvar.h>
-struct diofb diofb_cn;
-#endif
-
-#if NSTI > 0
-#include <hp300/dev/sgcreg.h>
-#include <hp300/dev/sgcvar.h>
-#include <dev/ic/stireg.h>
-#include <dev/ic/stivar.h>
-#include <hp300/dev/sti_machdep.h>
-#endif
-
-extern struct hp300_bus_space_tag hp300_mem_tag;
-extern caddr_t internalhpib;
-
-cons_decl(ws);
-
-void (*wsfbcninit)(void) = NULL;
-
-#if NDVBOX > 0 || NGBOX > 0 || NHYPER > 0 || NRBOX > 0 || NSTI_DIO > 0 || NTOPCAT > 0 || NTVRX > 0
-int dio_fbidentify(int, struct diofbreg *);
-
-/*
- * Identify a DIO frame buffer and set up wsfbcninit accordingly.
- */
-int
-dio_fbidentify(int scode, struct diofbreg *fbr)
-{
- if (fbr->id == GRFHWID)
- switch (fbr->fbid) {
-#if NDVBOX > 0
- case GID_DAVINCI:
- wsfbcninit = dvboxcninit;
- return (1);
-#endif
-#if NGBOX > 0
- case GID_GATORBOX:
- wsfbcninit = gboxcninit;
- return (1);
-#endif
-#if NHYPER > 0
- case GID_HYPERION:
- wsfbcninit = hypercninit;
- return (1);
-#endif
-#if NRBOX > 0
- case GID_RENAISSANCE:
- wsfbcninit = rboxcninit;
- return (1);
-#endif
-#if NSTI_DIO > 0
- case GID_FB3X2_A:
- case GID_FB3X2_B:
- if (scode >= 0 && sti_dio_probe(scode) != 0) {
- wsfbcninit = sticninit;
- return (1);
- }
- break;
-#endif
-#if NTOPCAT > 0
- case GID_TOPCAT:
- case GID_LRCATSEYE:
- case GID_HRCCATSEYE:
- case GID_HRMCATSEYE:
- wsfbcninit = topcatcninit;
- return (1);
-#endif
-#if NTVRX > 0
- case GID_TIGER:
- wsfbcninit = tvrxcninit;
- return (1);
-#endif
- default:
- break;
- }
-
- return (0);
-}
-#endif
-
-/*
- * This routine handles the dirty work of picking the best frame buffer
- * suitable for the console.
- * We try to behave as close as possible to the PROM's logic, by preferring
- * devices for which we have drivers, in that order:
- * - internal video.
- * - lowest select code on DIO bus.
- * - lowest slot on SGC bus.
- */
-void
-wscnprobe(struct consdev *cp)
-{
- int maj, tmpconscode;
- vsize_t mapsize;
- vaddr_t va;
-#if NDVBOX > 0 || NGBOX > 0 || NHYPER > 0 || NRBOX > 0 || NSTI_DIO > 0 || NTOPCAT > 0 || NTVRX > 0
- paddr_t pa;
- u_int scode, sctop, sctmp;
- struct diofbreg *fbr;
-#endif
-
- for (maj = 0; maj < nchrdev; maj++) {
- if (cdevsw[maj].d_open == wsdisplayopen)
- break;
- }
-
- cp->cn_dev = makedev(maj, 0);
- wsfbcninit = NULL;
-
-#if NDVBOX > 0 || NGBOX > 0 || NRBOX > 0 || NTOPCAT > 0
- /*
- * Look for an ``internal'' frame buffer.
- */
- va = IIOV(GRFIADDR);
- fbr = (struct diofbreg *)va;
- if (!badaddr((caddr_t)va)) {
- if (dio_fbidentify(-1, fbr)) {
- tmpconscode = CONSCODE_INTERNAL;
- mapsize = 0;
- goto found;
- }
- }
-#endif
-
-#if NDVBOX > 0 || NGBOX > 0 || NHYPER > 0 || NRBOX > 0 || NSTI_DIO > 0 || NTOPCAT > 0 || NTVRX > 0
- /*
- * Scan the DIO bus.
- */
- sctop = DIO_SCMAX(machineid);
- for (scode = 0; scode < sctop; scode++) {
- /*
- * Skip over the select code hole and the internal
- * HP-IB controller.
- */
- if ((sctmp = dio_inhole(scode)) != 0) {
- scode = sctmp - 1;
- continue;
- }
- if (scode == 7 && internalhpib)
- continue;
-
- /* Map current PA. */
- pa = (paddr_t)dio_scodetopa(scode);
- va = (vaddr_t)iomap((caddr_t)pa, PAGE_SIZE);
- if (va == 0)
- continue;
-
- /* Check to see if hardware exists. */
- if (badaddr((caddr_t)va)) {
- iounmap((caddr_t)va, PAGE_SIZE);
- continue;
- }
-
- /* Check hardware. */
- fbr = (struct diofbreg *)va;
- if (dio_fbidentify(scode, fbr)) {
- tmpconscode = scode;
- mapsize = DIO_SIZE(scode, va);
- iounmap((caddr_t)va, PAGE_SIZE);
-
-#if NSTI_DIO > 0
- if (wsfbcninit == sticninit) {
- mapsize = 0;
- va = 0;
- } else
-#endif
- {
- va = (vaddr_t)iomap((caddr_t)pa, mapsize);
- if (va == 0)
- continue;
- }
- goto found;
- } else
- iounmap((caddr_t)va, PAGE_SIZE);
- }
-#endif
-
-#if NSTI_SGC > 0
- /*
- * Scan the SGC bus.
- */
- for (scode = 0; scode < SGC_NSLOTS; scode++) {
- int rv;
-
- /* Map current PA. */
- pa = (paddr_t)sgc_slottopa(scode);
- va = (vaddr_t)iomap((caddr_t)pa, PAGE_SIZE);
- if (va == 0)
- continue;
-
- /* Check to see if hardware exists. */
- rv = badaddr((caddr_t)va);
- iounmap((caddr_t)va, PAGE_SIZE);
- if (rv != 0)
- continue;
-
- /* Check hardware. */
- if (sti_sgc_probe(&hp300_mem_tag, scode) != 0) {
- wsfbcninit = sticninit;
- tmpconscode = SGC_SLOT_TO_CONSCODE(scode);
- mapsize = 0;
- va = 0;
- goto found;
- }
- }
-#endif
-
- return;
-
-found:
- cp->cn_pri = CN_MIDPRI;
-#ifdef CONSCODE
- if (CONSCODE == tmpconscode)
- cp->cn_pri = CN_FORCED;
-#endif
-
- /*
- * If our priority is higher than the currently remembered console,
- * install ourselves, and unmap whichever device might be currently
- * mapped.
- */
- if (cn_tab == NULL || cp->cn_pri > cn_tab->cn_pri) {
- cn_tab = cp;
- /* Free last mapping. */
- if (convasize)
- iounmap(conaddr, convasize);
- conscode = tmpconscode;
- conaddr = (caddr_t)va;
- convasize = mapsize;
- }
-}
-
-void
-wscninit(struct consdev *cp)
-{
- /*
- * Note that this relies on the fact that DIO frame buffers (except
- * for sti@dio) will cause cn_tab to switch to wsdisplaycons, so
- * their cninit function will never get invoked a second time during
- * the second console pass.
- */
- if (wsfbcninit != NULL)
- (*wsfbcninit)();
-}
-
-void
-wscnputc(dev_t dev, int i)
-{
-#if NWSDISPLAY > 0
- wsdisplay_cnputc(dev, i);
-#endif
-}
-
-int
-wscngetc(dev_t dev)
-{
-#if NWSKBD > 0
- return (wskbd_cngetc(dev));
-#else
- return (0);
-#endif
-}
-
-void
-wscnpollc(dev_t dev, int on)
-{
-#if NWSKBD > 0
- wskbd_cnpollc(dev, on);
-#endif
-}
diff --git a/sys/arch/hp300/include/_float.h b/sys/arch/hp300/include/_float.h
deleted file mode 100644
index 32bc0d2538c..00000000000
--- a/sys/arch/hp300/include/_float.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: _float.h,v 1.1 2012/06/26 16:12:44 deraadt Exp $ */
-
-#include <m68k/_float.h>
diff --git a/sys/arch/hp300/include/_types.h b/sys/arch/hp300/include/_types.h
deleted file mode 100644
index 1cc7c32cc55..00000000000
--- a/sys/arch/hp300/include/_types.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* $OpenBSD: _types.h,v 1.5 2012/11/05 19:39:34 miod Exp $ */
-
-/* public domain */
-
-#ifndef _MACHINE__TYPES_H_
-#define _MACHINE__TYPES_H_
-
-#include <m68k/_types.h>
-
-#endif /* _MACHINE__TYPES_H_ */
diff --git a/sys/arch/hp300/include/asm.h b/sys/arch/hp300/include/asm.h
deleted file mode 100644
index cf9ef23de52..00000000000
--- a/sys/arch/hp300/include/asm.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: asm.h,v 1.2 1997/01/12 15:13:31 downsj Exp $ */
-/* $NetBSD: asm.h,v 1.2 1994/10/26 07:26:18 cgd Exp $ */
-
-#include <m68k/asm.h>
diff --git a/sys/arch/hp300/include/atomic.h b/sys/arch/hp300/include/atomic.h
deleted file mode 100644
index 94c3f687476..00000000000
--- a/sys/arch/hp300/include/atomic.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* $OpenBSD: atomic.h,v 1.3 2011/03/23 16:54:34 pirofti Exp $ */
-
-/* Public Domain */
-
-#ifndef _MACHINE_ATOMIC_H_
-#define _MACHINE_ATOMIC_H_
-
-#include <m68k/atomic.h>
-
-#endif /* _MACHINE_ATOMIC_H_ */
diff --git a/sys/arch/hp300/include/autoconf.h b/sys/arch/hp300/include/autoconf.h
deleted file mode 100644
index d5035e671bc..00000000000
--- a/sys/arch/hp300/include/autoconf.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* $OpenBSD: autoconf.h,v 1.15 2008/06/26 05:42:10 ray Exp $ */
-/* $NetBSD: autoconf.h,v 1.4 1997/04/01 03:03:56 scottr Exp $ */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifdef _KERNEL
-extern int conscode; /* select code of console device */
-#define CONSCODE_INTERNAL (-1)
-#define CONSCODE_INVALID (-2)
-extern caddr_t conaddr; /* KVA of console device */
-extern int convasize; /* size of mapping at conaddr */
-extern int consolepass; /* console initialization pass */
-
-void hp300_cninit(void);
-void console_scan(int (*)(int, caddr_t, void *), void *);
-caddr_t iomap(caddr_t, int);
-void iounmap(caddr_t, int);
-#endif /* _KERNEL */
diff --git a/sys/arch/hp300/include/bus.h b/sys/arch/hp300/include/bus.h
deleted file mode 100644
index 4a553b65591..00000000000
--- a/sys/arch/hp300/include/bus.h
+++ /dev/null
@@ -1,281 +0,0 @@
-/* $OpenBSD: bus.h,v 1.7 2011/03/23 16:54:34 pirofti Exp $ */
-/* $NetBSD: bus.h,v 1.9 1998/01/13 18:32:15 scottr Exp $ */
-
-/*-
- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
- * NASA Ames Research Center.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Copyright (C) 1997 Scott Reynolds. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_BUS_H_
-#define _MACHINE_BUS_H_
-
-/*
- * Bus address and size types
- */
-typedef u_long bus_addr_t;
-typedef u_long bus_size_t;
-
-/*
- * Access methods for bus resources and address space.
- */
-typedef u_long bus_space_handle_t;
-
-struct hp300_bus_space_tag {
- int (*bs_map)(bus_addr_t, bus_size_t, int, bus_space_handle_t *);
- void (*bs_unmap)(bus_space_handle_t, bus_size_t);
- int (*bs_subregion)(bus_space_handle_t, bus_size_t, bus_size_t,
- bus_space_handle_t *);
- void * (*bs_vaddr)(bus_space_handle_t);
-
- u_int8_t (*bsr1)(bus_space_handle_t, bus_size_t);
- u_int16_t (*bsr2)(bus_space_handle_t, bus_size_t);
- u_int32_t (*bsr4)(bus_space_handle_t, bus_size_t);
- void (*bsrm1)(bus_space_handle_t, bus_size_t,
- u_int8_t *, size_t);
- void (*bsrm2)(bus_space_handle_t, bus_size_t,
- u_int16_t *, size_t);
- void (*bsrm4)(bus_space_handle_t, bus_size_t,
- u_int32_t *, size_t);
- void (*bsrrm2)(bus_space_handle_t, bus_size_t,
- u_int8_t *, size_t);
- void (*bsrrm4)(bus_space_handle_t, bus_size_t,
- u_int8_t *, size_t);
- void (*bsrr1)(bus_space_handle_t, bus_size_t,
- u_int8_t *, size_t);
- void (*bsrr2)(bus_space_handle_t, bus_size_t,
- u_int16_t *, size_t);
- void (*bsrr4)(bus_space_handle_t, bus_size_t,
- u_int32_t *, size_t);
- void (*bsrrr2)(bus_space_handle_t, bus_size_t,
- u_int8_t *, size_t);
- void (*bsrrr4)(bus_space_handle_t, bus_size_t,
- u_int8_t *, size_t);
- void (*bsw1)(bus_space_handle_t, bus_size_t, u_int8_t);
- void (*bsw2)(bus_space_handle_t, bus_size_t,
- u_int16_t);
- void (*bsw4)(bus_space_handle_t, bus_size_t,
- u_int32_t);
- void (*bswm1)(bus_space_handle_t, bus_size_t,
- const u_int8_t *, size_t);
- void (*bswm2)(bus_space_handle_t, bus_size_t,
- const u_int16_t *, size_t);
- void (*bswm4)(bus_space_handle_t, bus_size_t,
- const u_int32_t *, size_t);
- void (*bswrm2)(bus_space_handle_t, bus_size_t,
- const u_int8_t *, size_t);
- void (*bswrm4)(bus_space_handle_t, bus_size_t,
- const u_int8_t *, size_t);
- void (*bswr1)(bus_space_handle_t, bus_size_t,
- const u_int8_t *, size_t);
- void (*bswr2)(bus_space_handle_t, bus_size_t,
- const u_int16_t *, size_t);
- void (*bswr4)(bus_space_handle_t, bus_size_t,
- const u_int32_t *, size_t);
- void (*bswrr2)(bus_space_handle_t, bus_size_t,
- const u_int8_t *, size_t);
- void (*bswrr4)(bus_space_handle_t, bus_size_t,
- const u_int8_t *, size_t);
- void (*bssm1)(bus_space_handle_t, bus_size_t,
- u_int8_t v, size_t);
- void (*bssm2)(bus_space_handle_t, bus_size_t,
- u_int16_t v, size_t);
- void (*bssm4)(bus_space_handle_t, bus_size_t,
- u_int32_t v, size_t);
- void (*bssr1)(bus_space_handle_t, bus_size_t,
- u_int8_t v, size_t);
- void (*bssr2)(bus_space_handle_t, bus_size_t,
- u_int16_t v, size_t);
- void (*bssr4)(bus_space_handle_t, bus_size_t,
- u_int32_t v, size_t);
-};
-
-typedef const struct hp300_bus_space_tag *bus_space_tag_t;
-
-#define BUS_SPACE_MAP_CACHEABLE 0x01
-#define BUS_SPACE_MAP_LINEAR 0x02
-#define BUS_SPACE_MAP_PREFETCHABLE 0x04
-
-#define bus_space_map(t,a,s,f,r) ((t)->bs_map(a,s,f,r))
-#define bus_space_unmap(t,h,s) ((t)->bs_unmap(h,s))
-#define bus_space_subregion(t,h,o,s,r) ((t)->bs_subregion(h,o,s,r))
-#define bus_space_vaddr(t,h) ((t)->bs_vaddr(h))
-
-/*
- * u_intN_t bus_space_read_N(bus_space_tag_t tag,
- * bus_space_handle_t bsh, bus_size_t offset);
- *
- * Read a 1, 2, 4, or 8 byte quantity from bus space
- * described by tag/handle/offset.
- */
-
-#define bus_space_read_1(t,h,o) (t)->bsr1(h, o)
-#define bus_space_read_2(t,h,o) (t)->bsr2(h, o)
-#define bus_space_read_4(t,h,o) (t)->bsr4(h, o)
-
-/*
- * void bus_space_read_multi_N(bus_space_tag_t tag,
- * bus_space_handle_t bsh, bus_size_t offset,
- * u_intN_t *addr, size_t count);
- *
- * Read `count' 1, 2, 4, or 8 byte quantities from bus space
- * described by tag/handle/offset and copy into buffer provided.
- */
-
-#define bus_space_read_multi_1(t, h, o, a, c) (t)->bsrm1(h, o, a, c)
-#define bus_space_read_multi_2(t, h, o, a, c) (t)->bsrm2(h, o, a, c)
-#define bus_space_read_multi_4(t, h, o, a, c) (t)->bsrm4(h, o, a, c)
-#define bus_space_read_raw_multi_2(t, h, o, a, c) (t)->bsrrm2(h, o, a, c)
-#define bus_space_read_raw_multi_4(t, h, o, a, c) (t)->bsrrm4(h, o, a, c)
-
-/*
- * void bus_space_read_region_N(bus_space_tag_t tag,
- * bus_space_handle_t bsh, bus_size_t offset,
- * u_intN_t *addr, size_t count);
- *
- * Read `count' 1, 2, 4, or 8 byte quantities from bus space
- * described by tag/handle and starting at `offset' and copy into
- * buffer provided.
- */
-
-#define bus_space_read_region_1(t, h, o, a, c) (t)->bsrr1(h,o,a,c)
-#define bus_space_read_region_2(t, h, o, a, c) (t)->bsrr2(h,o,a,c)
-#define bus_space_read_region_4(t, h, o, a, c) (t)->bsrr4(h,o,a,c)
-#define bus_space_read_raw_region_2(t, h, o, a, c) (t)->bsrrr2(h,o,a,c)
-#define bus_space_read_raw_region_4(t, h, o, a, c) (t)->bsrrr4(h,o,a,c)
-
-/*
- * void bus_space_write_N(bus_space_tag_t tag,
- * bus_space_handle_t bsh, bus_size_t offset,
- * u_intN_t value);
- *
- * Write the 1, 2, 4, or 8 byte value `value' to bus space
- * described by tag/handle/offset.
- */
-
-#define bus_space_write_1(t, h, o, v) (t)->bsw1(h, o, v)
-#define bus_space_write_2(t, h, o, v) (t)->bsw2(h, o, v)
-#define bus_space_write_4(t, h, o, v) (t)->bsw4(h, o, v)
-
-/*
- * void bus_space_write_multi_N(bus_space_tag_t tag,
- * bus_space_handle_t bsh, bus_size_t offset,
- * const u_intN_t *addr, size_t count);
- *
- * Write `count' 1, 2, 4, or 8 byte quantities from the buffer
- * provided to bus space described by tag/handle/offset.
- */
-
-#define bus_space_write_multi_1(t, h, o, a, c) (t)->bswm1(h, o, a, c)
-#define bus_space_write_multi_2(t, h, o, a, c) (t)->bswm2(h, o, a, c)
-#define bus_space_write_multi_4(t, h, o, a, c) (t)->bswm4(h, o, a, c)
-#define bus_space_write_raw_multi_2(t, h, o, a, c) (t)->bswrm2(h, o, a, c)
-#define bus_space_write_raw_multi_4(t, h, o, a, c) (t)->bswrm4(h, o, a, c)
-
-/*
- * void bus_space_write_region_N(bus_space_tag_t tag,
- * bus_space_handle_t bsh, bus_size_t offset,
- * const u_intN_t *addr, size_t count);
- *
- * Write `count' 1, 2, 4, or 8 byte quantities from the buffer provided
- * to bus space described by tag/handle starting at `offset'.
- */
-
-#define bus_space_write_region_1(t, h, o, a, c) (t)->bswr1(h, o, a, c)
-#define bus_space_write_region_2(t, h, o, a, c) (t)->bswr2(h, o, a, c)
-#define bus_space_write_region_4(t, h, o, a, c) (t)->bswr4(h, o, a, c)
-#define bus_space_write_raw_region_2(t, h, o, a, c) (t)->bswrr2(h, o, a, c)
-#define bus_space_write_raw_region_4(t, h, o, a, c) (t)->bswrr4(h, o, a, c)
-
-/*
- * void bus_space_set_multi_N(bus_space_tag_t tag,
- * bus_space_handle_t bsh, bus_size_t offset, u_intN_t val,
- * size_t count);
- *
- * Write the 1, 2, 4, or 8 byte value `val' to bus space described
- * by tag/handle/offset `count' times.
- */
-
-#define bus_space_set_multi_1(t, h, o, val, c) (t)->bssm1(h, o, val, c)
-#define bus_space_set_multi_2(t, h, o, val, c) (t)->bssm2(h, o, val, c)
-#define bus_space_set_multi_4(t, h, o, val, c) (t)->bssm4(h, o, val, c)
-
-/*
- * void bus_space_set_region_N(bus_space_tag_t tag,
- * bus_space_handle_t bsh, bus_size_t offset, u_intN_t val,
- * size_t count);
- *
- * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described
- * by tag/handle starting at `offset'.
- */
-
-#define bus_space_set_region_1(t, h, o, val, c) (t)->bssr1(h, o, val, c)
-#define bus_space_set_region_2(t, h, o, val, c) (t)->bssr2(h, o, val, c)
-#define bus_space_set_region_4(t, h, o, val, c) (t)->bssr4(h, o, val, c)
-
-/*
- * Bus read/write barrier methods.
- *
- * void bus_space_barrier(bus_space_tag_t tag,
- * bus_space_handle_t bsh, bus_size_t offset,
- * bus_size_t len, int flags);
- *
- * Note: the 680x0 does not currently require barriers, but we must
- * provide the flags to MI code.
- */
-#define bus_space_barrier(t, h, o, l, f) \
- ((void)((void)(t), (void)(h), (void)(o), (void)(l), (void)(f)))
-#define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */
-#define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */
-
-#endif /* _MACHINE_BUS_H_ */
diff --git a/sys/arch/hp300/include/cdefs.h b/sys/arch/hp300/include/cdefs.h
deleted file mode 100644
index a06bff6b7c7..00000000000
--- a/sys/arch/hp300/include/cdefs.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $OpenBSD: cdefs.h,v 1.3 2005/11/24 20:46:44 deraadt Exp $ */
-
-#ifndef _MACHINE_CDEFS_H_
-#define _MACHINE_CDEFS_H_
-
-#include <m68k/cdefs.h>
-
-#endif
diff --git a/sys/arch/hp300/include/cpu.h b/sys/arch/hp300/include/cpu.h
deleted file mode 100644
index 5b491cb61dc..00000000000
--- a/sys/arch/hp300/include/cpu.h
+++ /dev/null
@@ -1,200 +0,0 @@
-/* $OpenBSD: cpu.h,v 1.39 2011/03/23 16:54:34 pirofti Exp $ */
-/* $NetBSD: cpu.h,v 1.28 1998/02/13 07:41:51 scottr Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: cpu.h 1.16 91/03/25$
- *
- * @(#)cpu.h 8.4 (Berkeley) 1/5/94
- */
-
-#ifndef _MACHINE_CPU_H_
-#define _MACHINE_CPU_H_
-
-/*
- * Exported definitions unique to hp300/68k cpu support.
- */
-
-/*
- * Get common m68k CPU definitions.
- */
-#include <m68k/cpu.h>
-
-#ifdef _KERNEL
-
-/*
- * Get interrupt glue.
- */
-#include <machine/intr.h>
-
-/*
- * Arguments to hardclock and gatherstats encapsulate the previous
- * machine state in an opaque clockframe. On the hp300, we use
- * what the hardware pushes on an interrupt (frame format 0).
- */
-struct clockframe {
- u_short sr; /* sr at time of interrupt */
- u_long pc; /* pc at time of interrupt */
- u_short vo; /* vector offset (4-word frame) */
-};
-
-#define CLKF_USERMODE(framep) (((framep)->sr & PSL_S) == 0)
-#define CLKF_PC(framep) ((framep)->pc)
-#if 0
-/* We would like to do it this way... */
-#define CLKF_INTR(framep) (((framep)->sr & PSL_M) == 0)
-#else
-/* but until we start using PSL_M, we have to do this instead */
-#define CLKF_INTR(framep) (0) /* XXX */
-#endif
-
-
-/*
- * Preempt the current process if in interrupt from user mode,
- * or after the current trap/syscall if in system mode.
- */
-extern int want_resched; /* resched() was called */
-#define need_resched(ci) { want_resched = 1; aston(); }
-#define clear_resched(ci) want_resched = 0
-
-/*
- * Give a profiling tick to the current process when the user profiling
- * buffer pages are invalid. On the hp300, request an ast to send us
- * through trap, marking the proc as needing a profiling tick.
- */
-#define need_proftick(p) aston()
-
-/*
- * Notify the current process (p) that it has a signal pending,
- * process as soon as possible.
- */
-#define signotify(p) aston()
-
-extern int astpending; /* need to trap before returning to user mode */
-#define aston() (astpending = 1)
-
-#endif /* _KERNEL */
-
-/*
- * CTL_MACHDEP definitions.
- */
-#define CPU_CONSDEV 1 /* dev_t: console terminal device */
-#define CPU_CPUSPEED 2 /* CPU speed in MHz */
-#define CPU_MACHINEID 3 /* machine id (HP_XXX) */
-#define CPU_MMUID 4 /* mmu id (MMUID_*) */
-#define CPU_MAXID 5 /* number of valid machdep ids */
-
-#define CTL_MACHDEP_NAMES { \
- { 0, 0 }, \
- { "console_device", CTLTYPE_STRUCT }, \
- { "cpuspeed", CTLTYPE_INT }, \
- { "machineid", CTLTYPE_INT }, \
- { "mmuid", CTLTYPE_INT }, \
-}
-
-/*
- * The rest of this should probably be moved to <machine/hp300spu.h>,
- * although some of it could probably be put into generic 68k headers.
- */
-
-#ifdef _KERNEL
-extern char *intiobase, *intiolimit;
-extern void (*vectab[])(void);
-
-struct frame;
-struct fpframe;
-struct pcb;
-
-/* locore.s functions */
-void PCIA(void);
-__dead void doboot(void);
-void ecacheon(void);
-void ecacheoff(void);
-
-/* clock.c functions */
-void hp300_calibrate_delay(void);
-
-/* machdep.c functions */
-int badaddr(caddr_t);
-int badbaddr(caddr_t);
-void dumpconf(void);
-
-#endif /* _KERNEL */
-
-/* physical memory sections */
-#define ROMBASE (0x00000000)
-#define INTIOBASE (0x00400000)
-#define INTIOTOP (0x00600000)
-#define MAXADDR (0xFFFFF000)
-
-/*
- * Internal IO space:
- *
- * Ranges from 0x400000 to 0x600000 (IIOMAPSIZE).
- *
- * Internal IO space is mapped in the kernel from ``intiobase'' to
- * ``intiolimit'' (defined in locore.s). Since it is always mapped,
- * conversion between physical and kernel virtual addresses is easy.
- */
-#define ISIIOVA(va) \
- ((char *)(va) >= intiobase && (char *)(va) < intiolimit)
-#define IIOV(pa) ((int)(pa)-INTIOBASE+(int)intiobase)
-#define IIOP(va) ((int)(va)-(int)intiobase+INTIOBASE)
-#define IIOPOFF(pa) ((int)(pa)-INTIOBASE)
-#define IIOMAPSIZE atop(INTIOTOP-INTIOBASE) /* 2mb */
-
-/*
- * HP MMU
- */
-#define MMUBASE IIOPOFF(0x5F4000)
-#define MMUSSTP 0x0
-#define MMUUSTP 0x4
-#define MMUTBINVAL 0x8
-#define MMUSTAT 0xC
-#define MMUCMD MMUSTAT
-
-#define MMU_UMEN 0x0001 /* enable user mapping */
-#define MMU_SMEN 0x0002 /* enable supervisor mapping */
-#define MMU_CEN 0x0004 /* enable data cache */
-#define MMU_BERR 0x0008 /* bus error */
-#define MMU_IEN 0x0020 /* enable instruction cache */
-#define MMU_FPE 0x0040 /* enable 68881 FP coprocessor */
-#define MMU_WPF 0x2000 /* write protect fault */
-#define MMU_PF 0x4000 /* page fault */
-#define MMU_PTF 0x8000 /* page table fault */
-
-#define MMU_FAULT (MMU_PTF|MMU_PF|MMU_WPF|MMU_BERR)
-#define MMU_ENAB (MMU_UMEN|MMU_SMEN|MMU_IEN|MMU_FPE)
-
-#endif /* _MACHINE_CPU_H_ */
diff --git a/sys/arch/hp300/include/db_machdep.h b/sys/arch/hp300/include/db_machdep.h
deleted file mode 100644
index bf3b49e5752..00000000000
--- a/sys/arch/hp300/include/db_machdep.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: db_machdep.h,v 1.2 1997/01/12 15:13:33 downsj Exp $ */
-/* $NetBSD: db_machdep.h,v 1.2 1994/10/26 07:26:21 cgd Exp $ */
-
-/* Just use the common m68k definition */
-#include <m68k/db_machdep.h>
diff --git a/sys/arch/hp300/include/disklabel.h b/sys/arch/hp300/include/disklabel.h
deleted file mode 100644
index 29c598bccf1..00000000000
--- a/sys/arch/hp300/include/disklabel.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* $OpenBSD: disklabel.h,v 1.8 2007/06/20 18:15:45 deraadt Exp $ */
-
-/*
- * Copyright (c) 1994 Christopher G. Demetriou
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christopher G. Demetriou.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_DISKLABEL_H_
-#define _MACHINE_DISKLABEL_H_
-
-#define LABELSECTOR 2 /* sector containing label */
-#define LABELOFFSET 0 /* offset of label in sector */
-#define MAXPARTITIONS 16 /* number of partitions */
-
-#endif /* _MACHINE_DISKLABEL_H_ */
diff --git a/sys/arch/hp300/include/endian.h b/sys/arch/hp300/include/endian.h
deleted file mode 100644
index adaabad0352..00000000000
--- a/sys/arch/hp300/include/endian.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: endian.h,v 1.5 2011/03/15 18:23:38 deraadt Exp $ */
-/* $NetBSD: endian.h,v 1.6 1994/10/26 07:26:22 cgd Exp $ */
-
-/* Just use the common m68k definition */
-#include <m68k/endian.h>
diff --git a/sys/arch/hp300/include/exec.h b/sys/arch/hp300/include/exec.h
deleted file mode 100644
index efcb5a0d14f..00000000000
--- a/sys/arch/hp300/include/exec.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* $OpenBSD: exec.h,v 1.9 2003/10/09 21:48:45 miod Exp $ */
-/* $NetBSD: exec.h,v 1.10 1995/11/20 01:15:26 thorpej Exp $ */
-
-/*
- * Copyright (c) 1993 Christopher G. Demetriou
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <m68k/exec.h>
diff --git a/sys/arch/hp300/include/fenv.h b/sys/arch/hp300/include/fenv.h
deleted file mode 100644
index e0663cb85a3..00000000000
--- a/sys/arch/hp300/include/fenv.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: fenv.h,v 1.2 2013/06/01 21:20:54 jasper Exp $ */
-/* public domain */
-#include <m68k/fenv.h>
diff --git a/sys/arch/hp300/include/frame.h b/sys/arch/hp300/include/frame.h
deleted file mode 100644
index fc372d5c7e8..00000000000
--- a/sys/arch/hp300/include/frame.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: frame.h,v 1.2 1997/01/12 15:13:35 downsj Exp $ */
-/* $NetBSD: frame.h,v 1.6 1994/10/26 07:26:26 cgd Exp $ */
-
-#include <m68k/frame.h>
diff --git a/sys/arch/hp300/include/hil_machdep.h b/sys/arch/hp300/include/hil_machdep.h
deleted file mode 100644
index e7bf41150ef..00000000000
--- a/sys/arch/hp300/include/hil_machdep.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* $OpenBSD: hil_machdep.h,v 1.1 2005/01/14 22:39:29 miod Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: hilreg.h 1.10 92/01/21$
- *
- * @(#)hilreg.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * HP 9000/300-series specific HIL definitions
- */
-
-#define HILP_DATA 1 /* (R/W) data port */
-#define HILP_CMD 3 /* (R/W) status and control port */
-#define HILP_STAT HILP_CMD
-
-#define HILBUFSIZE 40 /* size of interrupt poll buffer */
-
-#define HILADDR 0x428000
-
-#define HILMAPSIZE 4
diff --git a/sys/arch/hp300/include/hp300spu.h b/sys/arch/hp300/include/hp300spu.h
deleted file mode 100644
index 3d6b86bb959..00000000000
--- a/sys/arch/hp300/include/hp300spu.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* $OpenBSD: hp300spu.h,v 1.10 2011/08/18 19:54:18 miod Exp $ */
-/* $NetBSD: hp300spu.h,v 1.2 1997/05/01 05:26:48 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_HP300SPU_H_
-#define _MACHINE_HP300SPU_H_
-
-/*
- * This file describes various constants that describe and/or
- * are unique to the HP 9000/300 or 400 SPUs.
- */
-
-/* values for machineid */
-#define HP_320 0 /* 16MHz 68020+HP MMU+16K external cache */
-#define HP_330 1 /* 16MHz 68020+68851 MMU */
-#define HP_350 2 /* 25MHz 68020+HP MMU+32K external cache */
-#define HP_36X 3 /* 25MHz 68030 */
-#define HP_370 4 /* 33MHz 68030+64K external cache */
-#define HP_340 5 /* 16MHz 68030 */
-#define HP_345 6 /* 50MHz 68030+32K external cache */
-#define HP_375 7 /* 50MHz 68030+32K external cache */
-#define HP_400 8 /* 50MHz 68030+32K external cache */
-#define HP_380 9 /* 25MHz 68040 */
-#define HP_425 10 /* 25MHz 68040 */
-#define HP_433 11 /* 33MHz 68040 */
-#define HP_385 12 /* 33MHz 68040 */
-#define HP_382 13 /* 25MHz 68040 */
-
-/* values for mmuid - used to differentiate similar CPU/cache combos */
-#define MMUID_345 1 /* 345 */
-#define MMUID_375 3 /* 375 */
-#define MMUID_382 11 /* 382 */
-#define MMUID_385 2 /* 385 */
-#define MMUID_425_T 5 /* 425t - 25MHz Trailways */
-#define MMUID_425_S 7 /* 425s - 25MHz Strider */
-#define MMUID_433_T 4 /* 433t - 33MHz Trailways */
-#define MMUID_433_S 6 /* 433s - 33MHz Strider */
-#define MMUID_425_E 9 /* 425e - 25MHz Woody */
-
-#define MMUID_SHIFT 8 /* right shift by this... */
-#define MMUID_MASK 0xff /* ...and mask with this to get mmuid */
-
-#if defined (_KERNEL) && !defined(_LOCORE)
-extern int machineid; /* CPU model */
-extern int cpuspeed; /* CPU speed, in MHz */
-extern int mmuid; /* MMU id */
-#endif /* _KERNEL && ! _LOCORE */
-
-#endif /* _MACHINE_HP300SPU_H_ */
diff --git a/sys/arch/hp300/include/ieee.h b/sys/arch/hp300/include/ieee.h
deleted file mode 100644
index df8030deb2b..00000000000
--- a/sys/arch/hp300/include/ieee.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: ieee.h,v 1.1 2001/09/06 00:07:09 millert Exp $ */
-
-#include <m68k/ieee.h>
diff --git a/sys/arch/hp300/include/ieeefp.h b/sys/arch/hp300/include/ieeefp.h
deleted file mode 100644
index 0f5193f345f..00000000000
--- a/sys/arch/hp300/include/ieeefp.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: ieeefp.h,v 1.2 1997/01/12 15:13:36 downsj Exp $ */
-/* $NetBSD: ieeefp.h,v 1.2 1995/04/16 16:47:08 jtc Exp $ */
-
-/* Just use the common m68k definition */
-#include <m68k/ieeefp.h>
diff --git a/sys/arch/hp300/include/intr.h b/sys/arch/hp300/include/intr.h
deleted file mode 100644
index 2d5d61e0e7f..00000000000
--- a/sys/arch/hp300/include/intr.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/* $OpenBSD: intr.h,v 1.30 2013/05/17 19:38:51 kettenis Exp $ */
-/* $NetBSD: intr.h,v 1.2 1997/07/24 05:43:08 scottr Exp $ */
-
-/*-
- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_INTR_H_
-#define _MACHINE_INTR_H_
-
-#include <machine/psl.h>
-#include <sys/evcount.h>
-#include <sys/queue.h>
-
-#ifdef _KERNEL
-struct isr {
- LIST_ENTRY(isr) isr_link;
- int (*isr_func)(void *);
- void *isr_arg;
- int isr_ipl;
- int isr_priority;
- struct evcount isr_count;
-};
-
-#define NISR 8
-
-/*
- * Interrupt "levels". These are a more abstract representation
- * of interrupt levels, and do not have the same meaning as m68k
- * CPU interrupt levels. They serve two purposes:
- *
- * - properly order ISRs in the list for that CPU ipl
- * - compute CPU PSL values for the spl*() calls.
- */
-#define IPL_NONE 0
-#define IPL_SOFTINT 1
-#define IPL_BIO 2
-#define IPL_NET 3
-#define IPL_TTY 4
-#define IPL_VM 5
-#define IPL_AUDIO 6
-#define IPL_CLOCK 6
-#define IPL_STATCLOCK 6
-#define IPL_SCHED 7
-#define IPL_HIGH 7
-
-#define IPL_MPSAFE 0 /* no "mpsafe" interrupts */
-
-/*
- * This array contains the appropriate PSL_S|PSL_IPL? values
- * to raise interrupt priority to the requested level.
- */
-extern unsigned short hp300_varpsl[NISR];
-#define MD_IPLTOPSL(ipl) hp300_varpsl[ipl]
-
-/* These spl calls are used by machine-independent code. */
-#define splsoft() _splraise(PSL_S | PSL_IPL1)
-#define splsoftclock() splsoft()
-#define splsoftnet() splsoft()
-#define splbio() _splraise(hp300_varpsl[IPL_BIO])
-#define splnet() _splraise(hp300_varpsl[IPL_NET])
-#define spltty() _splraise(hp300_varpsl[IPL_TTY])
-#define splaudio() _splraise(PSL_S | PSL_IPL6)
-#define splclock() _splraise(PSL_S | PSL_IPL6)
-#define splstatclock() _splraise(PSL_S | PSL_IPL6)
-#define splvm() _splraise(PSL_S | PSL_IPL5)
-#define splhigh() _spl(PSL_S | PSL_IPL7)
-#define splsched() splhigh()
-
-/* watch out for side effects */
-#define splx(s) ((s) & PSL_IPL ? _spl((s)) : spl0())
-
-#include <m68k/intr.h> /* soft interrupt support */
-
-/* locore.s */
-int spl0(void);
-
-/* intr.c */
-void intr_init(void);
-void intr_establish(struct isr *, const char *);
-void intr_disestablish(struct isr *);
-void intr_dispatch(int);
-void intr_printlevels(void);
-#endif /* _KERNEL */
-
-#endif /* _MACHINE_INTR_H_ */
diff --git a/sys/arch/hp300/include/kcore.h b/sys/arch/hp300/include/kcore.h
deleted file mode 100644
index 759565a3c72..00000000000
--- a/sys/arch/hp300/include/kcore.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* $OpenBSD: kcore.h,v 1.1 1998/04/25 08:28:16 downsj Exp $ */
-/* $NetBSD: kcore.h,v 1.1 1996/05/12 02:47:46 mhitch Exp $ */
-
-#ifndef _MACHINE_KCORE_H_
-#define _MACHINE_KCORE_H_
-
-#include <m68k/kcore.h>
-
-#endif
diff --git a/sys/arch/hp300/include/limits.h b/sys/arch/hp300/include/limits.h
deleted file mode 100644
index 0ee861ad0fe..00000000000
--- a/sys/arch/hp300/include/limits.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* $OpenBSD: limits.h,v 1.3 1997/07/24 14:48:48 deraadt Exp $ */
-/* $NetBSD: limits.h,v 1.7 1994/10/26 07:26:27 cgd Exp $ */
-
-#ifndef _MACHINE_LIMITS_H_
-#define _MACHINE_LIMITS_H_
-
-/* Just use the common m68k definition */
-#include <m68k/limits.h>
-
-#endif /* _MACHINE_LIMITS_H_ */
diff --git a/sys/arch/hp300/include/loadfile_machdep.h b/sys/arch/hp300/include/loadfile_machdep.h
deleted file mode 100644
index 5a3c87d1ac8..00000000000
--- a/sys/arch/hp300/include/loadfile_machdep.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* $OpenBSD: loadfile_machdep.h,v 1.2 2013/10/17 11:53:59 miod Exp $ */
-
-/*-
- * Copyright (c) 1999 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Christos Zoulas.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define BOOT_ELF
-
-#define LOAD_KERNEL LOAD_ALL
-#define COUNT_KERNEL COUNT_ALL
-
-#define LOADADDR(a) (((u_long)(a)) + offset)
-#define ALIGNENTRY(a) 0
-#define READ(f, b, c) read((f), (void *)LOADADDR(b), (c))
-#define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c))
-#define BZERO(d, c) memset((void *)LOADADDR(d), 0, (c))
-#define WARN(a) (void)(printf a, \
- printf((errno ? ": %s\n" : "\n"), \
- strerror(errno)))
-#define PROGRESS(a) (void) printf a
-#define ALLOC(a) alloc(a)
-#define FREE(a, b) free(a, b)
diff --git a/sys/arch/hp300/include/lock.h b/sys/arch/hp300/include/lock.h
deleted file mode 100644
index 97101bc5338..00000000000
--- a/sys/arch/hp300/include/lock.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: lock.h,v 1.1 2007/05/01 18:56:27 miod Exp $ */
-/* public domain */
-#include <m68k/lock.h>
diff --git a/sys/arch/hp300/include/mutex.h b/sys/arch/hp300/include/mutex.h
deleted file mode 100644
index 6b77b1fcae8..00000000000
--- a/sys/arch/hp300/include/mutex.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: mutex.h,v 1.1 2007/02/03 20:08:48 miod Exp $ */
-/* public domain */
-#include <m68k/mutex.h>
diff --git a/sys/arch/hp300/include/param.h b/sys/arch/hp300/include/param.h
deleted file mode 100644
index 4b1ffd21653..00000000000
--- a/sys/arch/hp300/include/param.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* $OpenBSD: param.h,v 1.26 2013/03/23 16:12:22 deraadt Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_PARAM_H_
-#define _MACHINE_PARAM_H_
-
-#define _MACHINE hp300
-#define MACHINE "hp300"
-
-#define PAGE_SHIFT 12
-
-#define KERNBASE 0x00000000 /* start of kernel virtual */
-
-#include <m68k/param.h>
-
-#define MSGBUFSIZE 4096
-
-#if defined(_KERNEL) && !defined(_LOCORE)
-#define delay(us) _delay((us) << 8)
-#define DELAY(us) delay(us)
-
-void _delay(u_int);
-#endif /* _KERNEL && !_LOCORE */
-
-#endif /* _MACHINE_PARAM_H_ */
diff --git a/sys/arch/hp300/include/pcb.h b/sys/arch/hp300/include/pcb.h
deleted file mode 100644
index 6ae98b579bb..00000000000
--- a/sys/arch/hp300/include/pcb.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* $OpenBSD: pcb.h,v 1.5 2003/10/09 21:48:45 miod Exp $ */
-/* $NetBSD: pcb.h,v 1.8 1995/05/12 12:55:17 mycroft Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: pcb.h 1.14 91/03/25$
- *
- * @(#)pcb.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <m68k/pcb.h>
diff --git a/sys/arch/hp300/include/pmap.h b/sys/arch/hp300/include/pmap.h
deleted file mode 100644
index 8ccf6b6bc35..00000000000
--- a/sys/arch/hp300/include/pmap.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* $OpenBSD: pmap.h,v 1.16 2006/08/22 21:03:54 miod Exp $ */
-
-#ifndef _MACHINE_PMAP_H_
-#define _MACHINE_PMAP_H_
-
-#include <m68k/pmap_motorola.h>
-
-#if !defined(M68020)
-#define pmap_map_direct(pg) ((vaddr_t)VM_PAGE_TO_PHYS(pg))
-#define pmap_unmap_direct(va) PHYS_TO_VM_PAGE((paddr_t)va)
-#define __HAVE_PMAP_DIRECT
-#define PMAP_STEAL_MEMORY
-#endif
-
-#ifdef _KERNEL
-void pmap_init_md(void);
-#define PMAP_INIT_MD() pmap_init_md()
-#endif
-
-#endif /* _MACHINE_PMAP_H_ */
diff --git a/sys/arch/hp300/include/proc.h b/sys/arch/hp300/include/proc.h
deleted file mode 100644
index ccdd88ff0ee..00000000000
--- a/sys/arch/hp300/include/proc.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* $OpenBSD: proc.h,v 1.6 2003/10/09 21:48:45 miod Exp $ */
-/* $NetBSD: proc.h,v 1.7 1997/03/16 09:41:36 thorpej Exp $ */
-
-/*
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)proc.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <m68k/proc.h>
diff --git a/sys/arch/hp300/include/profile.h b/sys/arch/hp300/include/profile.h
deleted file mode 100644
index 644a9fdfeaa..00000000000
--- a/sys/arch/hp300/include/profile.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: profile.h,v 1.2 1997/01/12 15:13:40 downsj Exp $ */
-/* $NetBSD: profile.h,v 1.2 1994/10/26 07:26:38 cgd Exp $ */
-
-#include <m68k/profile.h>
diff --git a/sys/arch/hp300/include/psl.h b/sys/arch/hp300/include/psl.h
deleted file mode 100644
index 12ece870daa..00000000000
--- a/sys/arch/hp300/include/psl.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: psl.h,v 1.2 1997/01/12 15:13:41 downsj Exp $ */
-/* $NetBSD: psl.h,v 1.5 1994/10/26 07:26:39 cgd Exp $ */
-
-#include <m68k/psl.h>
diff --git a/sys/arch/hp300/include/pte.h b/sys/arch/hp300/include/pte.h
deleted file mode 100644
index 601e0c8ca1e..00000000000
--- a/sys/arch/hp300/include/pte.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* $OpenBSD: pte.h,v 1.5 2002/01/10 21:10:47 miod Exp $ */
-
-#ifndef _MACHINE_PTE_H_
-#define _MACHINE_PTE_H_
-
-#include <m68k/pte_motorola.h>
-
-#define MACHINE_STSIZE M68K_STSIZE
-#define MACHINE_MAX_PTSIZE M68K_MAX_PTSIZE
-#define MACHINE_MAX_KPTSIZE M68K_MAX_KPTSIZE
-#define MACHINE_PTBASE M68K_PTBASE
-#define MACHINE_PTMAXSIZE M68K_PTMAXSIZE
-
-#endif /* _MACHINE_PTE_H_ */
diff --git a/sys/arch/hp300/include/ptrace.h b/sys/arch/hp300/include/ptrace.h
deleted file mode 100644
index d7682944e9e..00000000000
--- a/sys/arch/hp300/include/ptrace.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: ptrace.h,v 1.2 1997/01/12 15:13:42 downsj Exp $ */
-/* $NetBSD: ptrace.h,v 1.2 1994/10/26 07:26:42 cgd Exp $ */
-
-/* Just use the common m68k definition */
-#include <m68k/ptrace.h>
diff --git a/sys/arch/hp300/include/reg.h b/sys/arch/hp300/include/reg.h
deleted file mode 100644
index 125fddf9825..00000000000
--- a/sys/arch/hp300/include/reg.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* $OpenBSD: reg.h,v 1.2 1997/01/12 15:13:42 downsj Exp $ */
-/* $NetBSD: reg.h,v 1.9 1994/10/26 07:26:43 cgd Exp $ */
-
-#ifndef _MACHINE_REG_H_
-#define _MACHINE_REG_H_
-
-#include <m68k/reg.h>
-
-#endif /* _MACHINE_REG_H_ */
diff --git a/sys/arch/hp300/include/reloc.h b/sys/arch/hp300/include/reloc.h
deleted file mode 100644
index e4c43abb13e..00000000000
--- a/sys/arch/hp300/include/reloc.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: reloc.h,v 1.1 2013/02/02 13:34:29 miod Exp $ */
-/* public domain */
-#include <m68k/reloc.h>
diff --git a/sys/arch/hp300/include/setjmp.h b/sys/arch/hp300/include/setjmp.h
deleted file mode 100644
index d3e4e17d501..00000000000
--- a/sys/arch/hp300/include/setjmp.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: setjmp.h,v 1.2 1997/01/12 15:13:43 downsj Exp $ */
-/* $NetBSD: setjmp.h,v 1.1 1994/12/20 10:36:38 cgd Exp $ */
-
-#include <m68k/setjmp.h>
diff --git a/sys/arch/hp300/include/signal.h b/sys/arch/hp300/include/signal.h
deleted file mode 100644
index 3703f702862..00000000000
--- a/sys/arch/hp300/include/signal.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: signal.h,v 1.2 1997/01/12 15:13:43 downsj Exp $ */
-/* $NetBSD: signal.h,v 1.3 1994/10/26 07:26:44 cgd Exp $ */
-
-/* Just use the common m68k definition */
-#include <m68k/signal.h>
diff --git a/sys/arch/hp300/include/spinlock.h b/sys/arch/hp300/include/spinlock.h
deleted file mode 100644
index ef70517a7dc..00000000000
--- a/sys/arch/hp300/include/spinlock.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: spinlock.h,v 1.1 1999/01/21 02:59:33 millert Exp $ */
-
-#include <m68k/spinlock.h>
diff --git a/sys/arch/hp300/include/stdarg.h b/sys/arch/hp300/include/stdarg.h
deleted file mode 100644
index 89cf018016a..00000000000
--- a/sys/arch/hp300/include/stdarg.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: stdarg.h,v 1.2 1997/01/12 15:13:44 downsj Exp $ */
-/* $NetBSD: stdarg.h,v 1.4 1994/10/26 07:26:45 cgd Exp $ */
-
-/* Just use the common m68k definition */
-#include <m68k/stdarg.h>
diff --git a/sys/arch/hp300/include/tcb.h b/sys/arch/hp300/include/tcb.h
deleted file mode 100644
index 6b2b8157f85..00000000000
--- a/sys/arch/hp300/include/tcb.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: tcb.h,v 1.2 2013/06/01 21:20:54 jasper Exp $ */
-/* public domain */
-#include <m68k/tcb.h>
diff --git a/sys/arch/hp300/include/trap.h b/sys/arch/hp300/include/trap.h
deleted file mode 100644
index bd17be38436..00000000000
--- a/sys/arch/hp300/include/trap.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: trap.h,v 1.2 1997/01/12 15:13:44 downsj Exp $ */
-/* $NetBSD: trap.h,v 1.6 1994/10/26 07:26:47 cgd Exp $ */
-
-#include <m68k/trap.h>
diff --git a/sys/arch/hp300/include/varargs.h b/sys/arch/hp300/include/varargs.h
deleted file mode 100644
index c6c7fbecba6..00000000000
--- a/sys/arch/hp300/include/varargs.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $OpenBSD: varargs.h,v 1.2 1997/01/12 15:13:45 downsj Exp $ */
-/* $NetBSD: varargs.h,v 1.2 1994/10/26 07:26:50 cgd Exp $ */
-
-/* Just use the common m68k definition */
-#include <m68k/varargs.h>
diff --git a/sys/arch/hp300/include/vmparam.h b/sys/arch/hp300/include/vmparam.h
deleted file mode 100644
index 0ec70df2e4b..00000000000
--- a/sys/arch/hp300/include/vmparam.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* $OpenBSD: vmparam.h,v 1.19 2011/03/23 16:54:34 pirofti Exp $ */
-/* $NetBSD: vmparam.h,v 1.16 1998/08/20 08:33:48 kleink Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: vmparam.h 1.16 91/01/18$
- *
- * @(#)vmparam.h 8.2 (Berkeley) 4/19/94
- */
-
-#ifndef _MACHINE_VMPARAM_H_
-#define _MACHINE_VMPARAM_H_
-
-/*
- * Machine dependent constants for HP300
- */
-
-/* address where direct translation starts */
-#define HP300_DIRECT_BASE 0xc0000000
-
-#include <m68k/vmparam.h>
-
-#undef VM_MAX_KERNEL_ADDRESS
-#define VM_MAX_KERNEL_ADDRESS (HP300_DIRECT_BASE - PAGE_SIZE)
-
-/*
- * Constants which control the way the VM system deals with memory segments.
- * The hp300 only has one physical memory segment.
- */
-#define VM_PHYSSEG_MAX 1
-#define VM_PHYSSEG_STRAT VM_PSTRAT_RANDOM
-
-#endif /* _MACHINE_VMPARAM_H_ */
diff --git a/sys/arch/hp300/stand/Makefile b/sys/arch/hp300/stand/Makefile
deleted file mode 100644
index 4a93dba19f4..00000000000
--- a/sys/arch/hp300/stand/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# $OpenBSD: Makefile,v 1.18 2007/11/26 10:01:42 deraadt Exp $
-# $NetBSD: Makefile,v 1.23 1997/02/04 03:51:37 thorpej Exp $
-
-.if ${MACHINE} == "hp300"
-SUBDIR= libsa libsaz libz common mkboot uboot cdboot installboot
-.endif
-
-.include <bsd.subdir.mk>
diff --git a/sys/arch/hp300/stand/Makefile.inc b/sys/arch/hp300/stand/Makefile.inc
deleted file mode 100644
index 6a38f063f22..00000000000
--- a/sys/arch/hp300/stand/Makefile.inc
+++ /dev/null
@@ -1,94 +0,0 @@
-# $OpenBSD: Makefile.inc,v 1.13 2013/02/10 20:27:18 miod Exp $
-# $NetBSD: Makefile.inc,v 1.7 1997/05/12 07:43:18 thorpej Exp $
-
-BINDIR= /usr/mdec
-
-# RELOC=FFF00000 allows for boot prog up to FF000 (1044480) bytes long
-RELOC= FFF00000
-
-CFLAGS+= -Wall -Wstrict-prototypes -Wmissing-prototypes \
- -fno-stack-protector -msoft-float
-CFLAGS+= -fno-builtin-printf -fno-builtin-putchar \
- -fno-builtin-vprintf
-
-SA_CPPFLAGS+= -DAPCICONSOLE -DDCACONSOLE -DDCMCONSOLE -DITECONSOLE
-SA_CPPFLAGS+= -DHIL_KEYBOARD -DDOMAIN_KEYBOARD
-SA_CPPFLAGS+= -D_STANDALONE -D__hp300__
-SA_CPPFLAGS+= -DCOMPAT_UFS -DNO_LSEEK
-
-# Limit the alloc() heap to below the msgbuf and ROM scratch pages.
-SA_CPPFLAGS+= -DHEAP_LIMIT="0xffffdfff"
-
-### Figure out what to use for libcommon
-COMMONDIR= ${.CURDIR}/../common
-
-.if exists(${COMMONDIR}/${__objdir})
-COMMONOBJDIR= ${COMMONDIR}/${__objdir}
-.else
-COMMONOBJDIR= ${COMMONDIR}
-.endif
-
-LIBCOMMON= ${COMMONOBJDIR}/libcommon.a
-
-### Figure out what to use for libsa
-LIBSADIR= ${.CURDIR}/../libsa
-
-.if exists(${LIBSADIR}/${__objdir})
-LIBSAOBJDIR= ${LIBSADIR}/${__objdir}
-.else
-LIBSAOBJDIR= ${LIBSADIR}
-.endif
-
-LIBSA= ${LIBSAOBJDIR}/libsa.a
-
-### Figure out what to use for libsaz
-LIBSAZDIR= ${.CURDIR}/../libsaz
-
-.if exists(${LIBSAZDIR}/${__objdir})
-LIBSAZOBJDIR= ${LIBSAZDIR}/${__objdir}
-.else
-LIBSAZOBJDIR= ${LIBSAZDIR}
-.endif
-
-LIBSAZ= ${LIBSAZOBJDIR}/libsaz.a
-
-### Figure out what to use for libz
-LIBZDIR= ${.CURDIR}/../libz
-
-.if exists(${LIBZDIR}/${__objdir})
-LIBZOBJDIR= ${LIBZDIR}/${__objdir}
-.else
-LIBZOBJDIR= ${LIBZDIR}
-.endif
-
-LIBZ= ${LIBZOBJDIR}/libz.a
-
-### Figure out what to use for mkboot
-MKBOOTDIR= ${.CURDIR}/../mkboot
-
-.if exists(${MKBOOTDIR}/${__objdir})
-MKBOOTOBJDIR= ${MKBOOTDIR}/${__objdir}
-.else
-MKBOOTOBJDIR= ${MKBOOTDIR}
-.endif
-
-MKBOOT_PROG= ${MKBOOTOBJDIR}/mkboot
-
-### Figure out what to use for stripboot
-STRIPBOOTDIR= ${.CURDIR}/../stripboot
-
-.if exists(${STRIPBOOTDIR}/${__objdir})
-STRIPBOOTOBJDIR= ${STRIPBOOTDIR}/${__objdir}
-.else
-STRIPBOOTOBJDIR= ${STRIPBOOTDIR}
-.endif
-
-STRIPBOOT_PROG= ${STRIPBOOTOBJDIR}/stripboot
-
-# Make sure ${MKBOOT_PROG} is always available
-${MKBOOT_PROG}:
- @cd ${MKBOOTDIR} && make depend && make
-
-# Make sure ${STRIPBOOT_PROG} is always available
-${STRIPBOOT_PROG}:
- @cd ${STRIPBOOTDIR} && make depend && make
diff --git a/sys/arch/hp300/stand/cdboot/Makefile b/sys/arch/hp300/stand/cdboot/Makefile
deleted file mode 100644
index 175025fe33a..00000000000
--- a/sys/arch/hp300/stand/cdboot/Makefile
+++ /dev/null
@@ -1,43 +0,0 @@
-# $OpenBSD: Makefile,v 1.8 2013/02/02 13:34:29 miod Exp $
-
-PROG= cdboot
-OBJCOPY?=objcopy
-SIZE?= size
-
-NOMAN=
-NOPIE=
-
-CPPFLAGS+= ${SA_CPPFLAGS}
-
-.PATH: ${.CURDIR}/../uboot
-
-CFLAGS+=-DOSREV=\"${OSREV}\" -I${.CURDIR}/../include \
- -I${.CURDIR}/../libsa -I${.CURDIR}/../.. -I${.CURDIR}/../../.. \
- -I${.CURDIR}/../../../..
-
-AFLAGS= -x assembler-with-cpp -traditional-cpp -I${.CURDIR}/../include \
- -I${.CURDIR}/../libsa -I${.CURDIR}/../.. -I${.CURDIR}/../../.. \
- -I${.CURDIR}/../../../..
-
-SRCS= srt0.S cdboot.c clock.c conf.c cons.c devopen.c
-
-LIBS= ${LIBCOMMON} ${LIBSA} ${LIBZ}
-
-CLEANFILES+= ${PROG}.bin ${PROG}.lif
-
-cdboot.lif: ${PROG}
- ${OBJCOPY} -S -O binary ${PROG} ${PROG}.bin
- ${MKBOOT_PROG} -l 0x${RELOC} ${PROG}.bin $@
-
-cdboot: ${OBJS} ${LIBS}
- ${LD} -N -Ttext ${RELOC} -e begin --warn-common ${OBJS} ${LIBS} -o $@
- @${SIZE} $@
- @echo $@ total size may not exceed 30000 bytes
-
-install: cdboot.lif ${MKBOOT_PROG}
- ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 cdboot.lif \
- ${DESTDIR}/usr/mdec
-
-cdboot.o: Makefile
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/hp300/stand/cdboot/cdboot.c b/sys/arch/hp300/stand/cdboot/cdboot.c
deleted file mode 100644
index a92ee017c1b..00000000000
--- a/sys/arch/hp300/stand/cdboot/cdboot.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/* $OpenBSD: cdboot.c,v 1.9 2014/02/23 19:22:40 miod Exp $ */
-/* $NetBSD: uboot.c,v 1.3 1997/04/27 21:17:13 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)boot.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-#include <machine/exec.h>
-#include <a.out.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-
-/*
- * Boot program... bits in `howto' determine whether boot stops to
- * ask for system name. Boot device is derived from ROM provided
- * information.
- */
-
-extern u_int opendev;
-extern char *lowram;
-extern int noconsole;
-
-extern const char version[];
-
-/*
- * XXX UFS accepts a /, NFS doesn't.
- */
-char *names[] = {
-#ifdef OSREV
- OSREV "/hp300/bsd.rd",
-#endif
- "bsd.rd", "bsd",
-};
-#define NUMNAMES (sizeof(names) / sizeof(char *))
-
-#if 0
-static int bdev, badapt, bctlr, bunit, bpart;
-#endif
-
-char rnddata[BOOTRANDOM_MAX]; /* XXX dummy */
-
-int
-main(void)
-{
- int currname = 0;
- char *name;
-
- printf("\n>> OpenBSD [%dKB] CDROM BOOT %s HP 9000/%s CPU\n",
- (__LDPGSZ / 1024), version, getmachineid());
-
-#if 0
- bdev = B_TYPE(bootdev);
- badapt = B_ADAPTOR(bootdev);
- bctlr = B_CONTROLLER(bootdev);
- bunit = B_UNIT(bootdev);
- bpart = B_PARTITION(bootdev);
-#endif
-
- for (;;) {
- name = names[currname++];
- if (currname == NUMNAMES)
- currname = 0;
-
- howto = RB_SINGLE;
-
- printf(": %s\n", name);
-
- exec(name, lowram, howto);
- printf("boot: %s\n", strerror(errno));
- }
- return (0);
-}
diff --git a/sys/arch/hp300/stand/cdboot/conf.c b/sys/arch/hp300/stand/cdboot/conf.c
deleted file mode 100644
index ce0ad14d5b3..00000000000
--- a/sys/arch/hp300/stand/cdboot/conf.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/* $OpenBSD: conf.c,v 1.7 2011/08/18 20:02:58 miod Exp $ */
-/* $NetBSD: conf.c,v 1.12 1996/10/14 07:29:15 thorpej Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)conf.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-
-#include <lib/libsa/cd9660.h>
-
-int debug = 0; /* XXX */
-
-/*
- * Device configuration
- */
-int sdstrategy(void *, int, daddr32_t, size_t, void *, size_t *);
-int sdopen(struct open_file *, ...);
-int sdclose(struct open_file *);
-#define sdioctl noioctl
-
-#define xxstrategy \
- (int (*)(void *, int, daddr32_t, size_t, void *, size_t *))nullsys
-#define xxopen (int (*)(struct open_file *, ...))nodev
-#define xxclose (int (*)(struct open_file *))nullsys
-
-struct devsw devsw[] = {
- { "??", xxstrategy, xxopen, xxclose, noioctl }, /*0*/
- { "??", xxstrategy, xxopen, xxclose, noioctl }, /*1*/
- { "??", xxstrategy, xxopen, xxclose, noioctl }, /*2*/
- { "??", xxstrategy, xxopen, xxclose, noioctl }, /*3*/
- { "sd", sdstrategy, sdopen, sdclose, sdioctl }, /*4*/
-};
-int ndevs = (sizeof(devsw) / sizeof(devsw[0]));
-
-/*
- * Physical unit/lun detection.
- */
-int punitzero(int, int, int *);
-
-int
-punitzero(int ctlr, int slave, int *punit)
-{
-
- *punit = 0;
- return (0);
-}
-
-#define xxpunit punitzero
-#define sdpunit punitzero
-
-struct punitsw punitsw[] = {
- { xxpunit },
- { xxpunit },
- { xxpunit },
- { xxpunit },
- { sdpunit },
-};
-
-/*
- * Filesystem configuration
- */
-struct fs_ops file_system_cd9660[] = {
- { cd9660_open, cd9660_close, cd9660_read, cd9660_write, cd9660_seek,
- cd9660_stat },
-};
-
-struct fs_ops file_system[2];
-int nfsys = 1; /* default; changed per device type. */
diff --git a/sys/arch/hp300/stand/cdboot/cons.c b/sys/arch/hp300/stand/cdboot/cons.c
deleted file mode 100644
index fbf12355849..00000000000
--- a/sys/arch/hp300/stand/cdboot/cons.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/* $OpenBSD: cons.c,v 1.4 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: cons.c,v 1.2 1997/05/12 07:44:53 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: cons.c 1.7 92/02/28
- *
- * @(#)cons.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-#include "consdefs.h"
-
-struct consdev *cn_tab;
-int noconsole;
-extern int userom;
-extern int donottwiddle; /* from libsa */
-
-void
-cninit()
-{
- cn_tab = NULL;
- noconsole = 1;
- userom = 1;
- donottwiddle = 1;
-}
-
-int
-cngetc()
-{
- return(0);
-}
-
-void
-cnputc(int c)
-{
- romputchar(c);
-}
-
-void
-putchar(int c)
-{
- cnputc(c);
- if (c == '\n')
- cnputc('\r');
-}
diff --git a/sys/arch/hp300/stand/cdboot/devopen.c b/sys/arch/hp300/stand/cdboot/devopen.c
deleted file mode 100644
index 2584c0cbf1b..00000000000
--- a/sys/arch/hp300/stand/cdboot/devopen.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/* $OpenBSD: devopen.c,v 1.4 2013/01/11 23:22:35 miod Exp $ */
-/* $NetBSD: devopen.c,v 1.7 1996/10/14 07:31:47 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1993 John Brezak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-
-int atoi(char *);
-int devlookup(const char*, int);
-int devparse(const char *, int *, int *, int *, int *, int *, char **);
-void usage(void);
-
-u_int opendev;
-
-#define ispart(c) ((c) >= 'a' && (c) <= 'h')
-
-int
-atoi(char *cp)
-{
- int val = 0;
- while(isdigit(*cp))
- val = val * 10 + (*cp++ - '0');
- return(val);
-}
-
-void
-usage()
-{
- printf("Usage: device(adaptor, controller, drive, partition)file\n"
- " <device><unit><partitionletter>:file\n");
-}
-
-int
-devlookup(const char *d, int len)
-{
- struct devsw *dp = devsw;
- int i;
-
- for (i = 0; i < ndevs; i++, dp++) {
- if (dp->dv_name && strncmp(dp->dv_name, d, len) == 0) {
- /*
- * Set the filesystem and startup up according to
- * the device being opened.
- */
- switch (i) {
- case 4: /* sd - only supports cd9660 */
- bcopy(file_system_cd9660, file_system,
- sizeof(struct fs_ops));
- break;
-
- case 0: /* ct - not supported */
- case 2: /* hd - not supported */
- case 6: /* le - not supported */
- default:
- /* Agh! What happened?! */
- goto bad;
- }
- return(i);
- }
- }
-
-bad:
- printf("No such device - Configured devices are:\n");
- for (dp = devsw, i = 0; i < ndevs; i++, dp++)
- if (dp->dv_name)
- printf(" %s", dp->dv_name);
- printf("\n");
- errno = ENODEV;
- return(-1);
-}
-
-/*
- * Parse a device spec in one of two forms.
- *
- * dev(adapt, ctlr, unit, part)file
- * [A-Za-z]*[0-9]*[A-Za-z]:file
- * dev unit part
- */
-int
-devparse(const char *fname, int *dev, int *adapt, int *ctlr, int *unit,
- int *part, char **file)
-{
- int i;
- char *s, *args[4];
-
- /* check for device name */
- for (s = (char *)fname; *s && *s != '/' && *s != ':' && *s != '('; s++)
- /* if (isupper(*s)) *s = tolower(*s) */;
-
- /* first form */
- if (*s == '(') {
- /* make device name lower case */
- for (s = (char *)fname; *s != '('; s++)
- if (isupper(*s)) *s = tolower(*s);
- /* lookup device and get index */
- if ((*dev = devlookup(fname, s - fname)) < 0)
- goto baddev;
-
- /* tokenize device ident */
- args[0] = ++s;
- for (args[0] = s, i = 1; *s && *s != ')'; s++) {
- if (*s == ',')
- args[i++] = ++s;
- }
- switch(i) {
- case 4:
- *adapt = atoi(args[0]);
- *ctlr = atoi(args[1]);
- *unit = atoi(args[2]);
- *part = atoi(args[3]);
- break;
- case 3:
- *ctlr = atoi(args[0]);
- *unit = atoi(args[1]);
- *part = atoi(args[2]);
- break;
- case 2:
- *unit = atoi(args[0]);
- *part = atoi(args[1]);
- break;
- case 1:
- *part = atoi(args[0]);
- break;
- case 0:
- break;
- }
- *file = ++s;
- }
-
- /* second form */
- else if (*s == ':') {
- int temp;
-
- /* isolate device and make its name lower case*/
- for (s = (char *)fname; *s != ':' && !isdigit(*s); s++)
- if (isupper(*s)) *s = tolower(*s);
-
- /* lookup device and get index */
- if ((*dev = devlookup(fname, s - fname)) < 0)
- goto baddev;
-
- /* isolate unit */
- if ((temp = atoi(s)) > 255)
- goto bad;
- *adapt = temp / 8;
- *ctlr = temp % 8;
- for (; isdigit(*s); s++);
-
- /* translate partition */
- if (!ispart(*s))
- goto bad;
-
- *part = *s++ - 'a';
- if (*s != ':')
- goto bad;
- *file = ++s;
- }
-
- /* no device present */
- else
- *file = (char *)fname;
-
- /* return the remaining unparsed part as the file to boot */
- return(0);
-
-bad:
- usage();
-
-baddev:
- return(-1);
-}
-
-
-int
-devopen(struct open_file *f, const char *fname, char **file)
-{
- int error;
- int dev, adapt, ctlr, unit, part;
- struct devsw *dp = &devsw[0];
-
- dev = B_TYPE(bootdev);
- adapt = B_ADAPTOR(bootdev);
- ctlr = B_CONTROLLER(bootdev);
- unit = B_UNIT(bootdev);
- part = B_PARTITION(bootdev);
-
- if ((error = devparse(fname, &dev, &adapt, &ctlr, &unit, &part, file)))
- return(error);
-
- /*
- * Set up filesystem type based on what device we're opening.
- */
- switch (dev) {
- case 4: /* sd - only supports cd9660 */
- bcopy(file_system_cd9660, file_system, sizeof(struct fs_ops));
- break;
-
- case 0: /* ct - not supported */
- case 2: /* hd - not supported */
- case 6: /* le - not supported */
- default:
- /* XXX what else should we do here? */
- printf("WARNING: BOGUS BOOT DEV TYPE 0x%x!\n", dev);
- return (EIO);
- }
-
- dp = &devsw[dev];
-
- if (!dp->dv_open)
- return(ENODEV);
-
- f->f_dev = dp;
-
- if ((error = (*dp->dv_open)(f, adapt, ctlr, part)) == 0) {
- if ((error =
- (*punitsw[dev].p_punit)(adapt, ctlr, &unit)) != 0) {
- goto bad;
- }
- opendev = MAKEBOOTDEV(dev, adapt, ctlr, unit, part);
- return(0);
- }
-
-bad:
- printf("%s(%d,%d,%d,%d): %s\n", devsw[dev].dv_name,
- adapt, ctlr, unit, part, strerror(error));
-
- return(error);
-}
diff --git a/sys/arch/hp300/stand/common/Makefile b/sys/arch/hp300/stand/common/Makefile
deleted file mode 100644
index 2ff68c674c0..00000000000
--- a/sys/arch/hp300/stand/common/Makefile
+++ /dev/null
@@ -1,22 +0,0 @@
-# $OpenBSD: Makefile,v 1.7 2013/01/01 17:17:44 miod Exp $
-
-LIB= common
-
-NOMAN= noman
-
-CPPFLAGS+= ${SA_CPPFLAGS}
-
-SRCS= apci.c autoconf.c cons.c ct.c dca.c dcm.c dnkbd.c \
- fhpib.c hd.c hil.c hpib.c if_le.c ite.c ite_dv.c ite_gb.c ite_hy.c \
- ite_rb.c ite_sti.c ite_subr.c ite_tc.c ite_tvrx.c kbd.c kbdconf.c \
- machdep.c nhpib.c scsi.c sd.c version.c
-
-CFLAGS+=-I${.CURDIR}/../include \
- -I${.CURDIR}/../../.. -I${.CURDIR}/../../../.. -DCD9660_DUMMYLABEL
-
-NOPROFILE=
-NOPIC=
-
-install:
-
-.include <bsd.lib.mk>
diff --git a/sys/arch/hp300/stand/common/apci.c b/sys/arch/hp300/stand/common/apci.c
deleted file mode 100644
index eb3eefbec6d..00000000000
--- a/sys/arch/hp300/stand/common/apci.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/* $OpenBSD: apci.c,v 1.11 2010/08/16 14:50:16 miod Exp $ */
-/* $NetBSD: apci.c,v 1.2 1997/10/04 17:20:15 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1997, 1999 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)dca.c 8.1 (Berkeley) 6/10/93
- */
-
-#ifdef APCICONSOLE
-#include <sys/param.h>
-
-#include <hp300/dev/frodoreg.h> /* for APCI offsets */
-#include <hp300/dev/apcireg.h> /* for register map */
-#include <hp300/dev/dcareg.h> /* for register bits */
-
-#include "samachdep.h"
-#include "consdefs.h"
-
-struct apciregs *apcicnaddr = 0;
-
-void
-apciprobe(struct consdev *cp)
-{
- volatile u_int8_t *frodoregs;
-
- /*
- * Only a 425e can have an APCI console. On all other 4xx models,
- * the "first" serial port is mapped to the DCA at select code 9.
- */
- if (machineid != HP_425 || mmuid != MMUID_425_E)
- return;
-
- /*
- * Check the service switch. On the 425e, this is a physical
- * switch, unlike other frodo-based machines, so we can use it
- * as a serial vs internal video selector, since the PROM can not
- * be configured for serial console.
- */
- frodoregs = (volatile u_int8_t *)IIOV(FRODO_BASE);
- if (badaddr((caddr_t)frodoregs) == 0 &&
- (frodoregs[FRODO_IISR] & FRODO_IISR_SERVICE) == 0)
- cp->cn_pri = CN_HIGHPRI;
- else
- cp->cn_pri = CN_LOWPRI;
-
- apcicnaddr = (struct apciregs *)IIOV(FRODO_BASE + FRODO_APCI_OFFSET(1));
-}
-
-void
-apciinit(struct consdev *cp)
-{
- struct apciregs *apci = (struct apciregs *)apcicnaddr;
-
- apci->ap_cfcr = CFCR_DLAB;
- apci->ap_data = APCIBRD(9600) & 0xff;
- apci->ap_ier = (APCIBRD(9600) >> 8) & 0xff;
- apci->ap_cfcr = CFCR_8BITS;
- apci->ap_fifo =
- FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST | FIFO_TRIGGER_1;
- apci->ap_mcr = MCR_DTR | MCR_RTS;
-}
-
-/* ARGSUSED */
-int
-apcigetchar(dev_t dev)
-{
-#ifndef SMALL
- struct apciregs *apci = apcicnaddr;
- short stat;
- int c;
-
- if (((stat = apci->ap_lsr) & LSR_RXRDY) == 0)
- return (0);
- c = apci->ap_data;
- return (c);
-#else
- return (0);
-#endif
-}
-
-/* ARGSUSED */
-void
-apciputchar(dev_t dev, int c)
-{
- struct apciregs *apci = apcicnaddr;
- int timo;
- short stat;
-
- /* wait a reasonable time for the transmitter to come ready */
- timo = 50000;
- while (((stat = apci->ap_lsr) & LSR_TXRDY) == 0 && --timo)
- ;
- apci->ap_data = c;
- /* wait for this transmission to complete */
- timo = 1000000;
- while (((stat = apci->ap_lsr) & LSR_TXRDY) == 0 && --timo)
- ;
-}
-#endif
diff --git a/sys/arch/hp300/stand/common/autoconf.c b/sys/arch/hp300/stand/common/autoconf.c
deleted file mode 100644
index c8c1e17389c..00000000000
--- a/sys/arch/hp300/stand/common/autoconf.c
+++ /dev/null
@@ -1,272 +0,0 @@
-/* $OpenBSD: autoconf.c,v 1.10 2013/02/02 13:34:29 miod Exp $ */
-/* $NetBSD: autoconf.c,v 1.12 1997/01/30 10:32:51 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: autoconf.c 1.16 92/05/29
- *
- * @(#)autoconf.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-#include "consdefs.h"
-#include "rominfo.h"
-#include "device.h"
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/diodevs.h>
-#include <hp300/dev/diofbreg.h>
-
-void configure(void);
-void find_devs(void);
-u_long msustobdev(void);
-void printrominfo(void);
-
-/*
- * Mapping of ROM MSUS types to BSD major device numbers
- * WARNING: major numbers must match bdevsw indices in hp300/conf.c.
- */
-char rom2mdev[] = {
- 0, 0, /* 0-1: none */
- 6, /* 2: network device; special */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 3-13: none */
- 4, /* 14: SCSI disk */
- 0, /* 15: none */
- 2, /* 16: CS/80 device on HPIB */
- 2, /* 17: CS/80 device on HPIB */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 18-31: none */
-};
-
-struct hp_hw sc_table[MAXCTLRS];
-int cpuspeed;
-
-extern int internalhpib;
-
-void find_devs(void);
-
-#ifdef PRINTROMINFO
-void
-printrominfo()
-{
- struct rominfo *rp = (struct rominfo *)ROMADDR;
-
- printf("boottype %lx, name %s, lowram %lx, sysflag %x\n",
- rp->boottype, rp->name, rp->lowram, rp->sysflag&0xff);
- printf("rambase %lx, ndrives %x, sysflag2 %x, msus %lx\n",
- rp->rambase, rp->ndrives, rp->sysflag2&0xff, rp->msus);
-}
-#endif
-
-void
-configure()
-{
- switch (machineid) {
- case HP_320:
- case HP_330:
- case HP_340:
- cpuspeed = MHZ_16;
- break;
- case HP_350:
- case HP_36X:
- cpuspeed = MHZ_25;
- break;
- case HP_370:
- cpuspeed = MHZ_33;
- break;
- case HP_380:
- case HP_382:
- case HP_425:
- cpuspeed = MHZ_25 * 2; /* XXX */
- break;
- case HP_385:
- case HP_433:
- cpuspeed = MHZ_33 * 2; /* XXX */
- break;
- case HP_345:
- case HP_375:
- case HP_400:
- default: /* assume the fastest (largest delay value) */
- cpuspeed = MHZ_50;
- break;
- }
- find_devs();
- cninit();
-#ifdef PRINTROMINFO
- printrominfo();
-#endif
- hpibinit();
- scsiinit();
- if ((bootdev & B_MAGICMASK) != B_DEVMAGIC)
- bootdev = msustobdev();
-}
-
-/*
- * Convert HP MSUS to a valid bootdev layout:
- * TYPE comes from MSUS device type as mapped by rom2mdev
- * PARTITION is set to 0 ('a')
- * UNIT comes from MSUS unit (almost always 0)
- * CONTROLLER comes from MSUS primary address
- * ADAPTER comes from SCSI/HPIB driver logical unit number (hw_ctrl)
- */
-u_long
-msustobdev()
-{
- struct rominfo *rp = (struct rominfo *)ROMADDR;
- u_long bdev = 0;
- struct hp_hw *hw;
- int sc, type, ctlr, slave, punit;
-
- sc = (rp->msus >> 8) & 0xFF;
- for (hw = sc_table; hw < &sc_table[MAXCTLRS]; hw++)
- if (hw->hw_sc == sc)
- break;
-
- type = rom2mdev[(rp->msus >> 24) & 0x1F];
- ctlr = hw->hw_ctrl;
- slave = (rp->msus & 0xFF);
- punit = ((rp->msus >> 16) & 0xFF);
-
- bdev = MAKEBOOTDEV(type, ctlr, slave, punit, 0);
-
-#ifdef PRINTROMINFO
- printf("msus %lx -> bdev %lx\n", rp->msus, bdev);
-#endif
- return (bdev);
-}
-
-u_long
-sctoaddr(int sc)
-{
- if (sc == -1)
- return (GRFIADDR);
- if (sc == 7 && internalhpib)
- return (internalhpib);
- if (DIO_ISDIO(sc))
- return (DIO_BASE + sc * DIO_DEVSIZE);
- if (DIO_ISDIOII(sc))
- return (DIOII_BASE + (sc - DIOII_SCBASE) * DIOII_DEVSIZE);
- return 0;
-}
-
-/*
- * Probe all DIO select codes (0 - 32), the internal display address,
- * and DIO-II select codes (132 - 256). SGC frame buffers are probed
- * separately.
- *
- * Note that we only care about displays, LANCEs, SCSIs and HP-IBs.
- */
-void
-find_devs()
-{
- short sc, sctop;
- u_char *id_reg;
- caddr_t addr;
- struct hp_hw *hw;
-
- hw = sc_table;
- sctop = machineid == HP_320 ? 32 : 256; /* DIO_SCMAX(machineid); */
- /* starting at -1 to probe the intio framebuffer, if any */
- for (sc = -1; sc < sctop; sc++) {
- if (sc >= 32 && sc < DIOII_SCBASE)
- continue;
- addr = (caddr_t)sctoaddr(sc);
- if (badaddr(addr))
- continue;
-
- id_reg = (u_char *)addr;
- hw->hw_kva = addr;
- hw->hw_type = 0;
- hw->hw_sc = sc;
- hw->hw_ctrl = 0;
-
- /*
- * Not all internal HP-IBs respond rationally to id requests
- * so we just go by the "internal HPIB" indicator in SYSFLAG.
- */
- if (sc == 7 && internalhpib) {
- hw->hw_type = C_HPIB;
- hw++;
- continue;
- }
-
- switch (id_reg[DIO_IDOFF]) {
- case DIO_DEVICE_ID_DCM:
- case DIO_DEVICE_ID_DCMREM:
- hw->hw_type = D_COMMDCM;
- break;
- case DIO_DEVICE_ID_FHPIB:
- case DIO_DEVICE_ID_NHPIB:
- hw->hw_type = C_HPIB;
- break;
- case DIO_DEVICE_ID_LAN:
- case DIO_DEVICE_ID_LANREM: /* does this even make sense? */
- hw->hw_type = D_LAN;
- break;
- case DIO_DEVICE_ID_FRAMEBUFFER:
- hw->hw_type = D_BITMAP;
- switch(id_reg[DIO_SECIDOFF]) {
- case DIO_DEVICE_SECID_RENAISSANCE:
- case DIO_DEVICE_SECID_DAVINCI:
- sc += 2 - 1; /* occupy 2 select codes */
- break;
- case DIO_DEVICE_SECID_TIGERSHARK:
- sc += 3 - 1; /* occupy 3 select codes */
- break;
- case DIO_DEVICE_SECID_FB3X2_A:
- case DIO_DEVICE_SECID_FB3X2_B:
- sc += 4 - 1; /* occupy 4 select codes */
- break;
- }
- break;
- case DIO_DEVICE_ID_SCSI0:
- case DIO_DEVICE_ID_SCSI1:
- case DIO_DEVICE_ID_SCSI2:
- case DIO_DEVICE_ID_SCSI3:
- hw->hw_type = C_SCSI;
- break;
- default: /* who cares */
- break;
- }
- if (hw->hw_type == 0)
- continue;
- hw++;
- if (hw == sc_table + MAXCTLRS)
- break; /* oflows are so boring */
- }
-}
diff --git a/sys/arch/hp300/stand/common/cons.c b/sys/arch/hp300/stand/common/cons.c
deleted file mode 100644
index 9ee2fd5ba35..00000000000
--- a/sys/arch/hp300/stand/common/cons.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/* $OpenBSD: cons.c,v 1.5 2008/01/23 16:37:56 jsing Exp $ */
-/* $NetBSD: cons.c,v 1.2 1997/05/12 07:44:53 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: cons.c 1.7 92/02/28
- *
- * @(#)cons.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-
-#include "samachdep.h"
-#include "consdefs.h"
-
-struct consdev constab[] = {
-#ifdef ITECONSOLE
- { iteprobe, iteinit, itegetchar, iteputchar },
-#endif
-#ifdef DCACONSOLE
- { dcaprobe, dcainit, dcagetchar, dcaputchar },
-#endif
-#ifdef APCICONSOLE
- { apciprobe, apciinit, apcigetchar, apciputchar },
-#endif
-#ifdef DCMCONSOLE
- { dcmprobe, dcminit, dcmgetchar, dcmputchar },
-#endif
- { 0 },
-};
-
-struct consdev *cn_tab;
-int noconsole;
-
-void
-cninit()
-{
- struct consdev *cp;
-
- cn_tab = NULL;
- noconsole = 1;
- for (cp = constab; cp->cn_probe; cp++) {
- (*cp->cn_probe)(cp);
- if (cp->cn_pri != CN_DEAD &&
- (cn_tab == NULL || cp->cn_pri > cn_tab->cn_pri))
- cn_tab = cp;
- }
- if (cn_tab) {
- (*cn_tab->cn_init)(cn_tab);
- noconsole = 0;
- }
-}
-
-int
-cngetc()
-{
-
- /* Note: the dev_t arguments are not used! */
- if (cn_tab)
- return((*cn_tab->cn_getc)(0));
- return(0);
-}
-
-void
-cnputc(c)
- int c;
-{
- /* Note: the dev_t arguments are not used! */
- if (userom)
- romputchar(c);
- else if (cn_tab)
- (*cn_tab->cn_putc)(0, c);
-}
diff --git a/sys/arch/hp300/stand/common/ct.c b/sys/arch/hp300/stand/common/ct.c
deleted file mode 100644
index 8db58fee3b7..00000000000
--- a/sys/arch/hp300/stand/common/ct.c
+++ /dev/null
@@ -1,316 +0,0 @@
-/* $OpenBSD: ct.c,v 1.6 2011/03/13 00:13:52 deraadt Exp $ */
-/* $NetBSD: ct.c,v 1.9 1996/10/14 07:29:57 thorpej Exp $ */
-
-/*
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ct.c 8.1 (Berkeley) 7/15/93
- */
-
-/*
- * CS80 tape driver
- */
-#include <sys/param.h>
-
-#include <hp300/dev/ctreg.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-#include "hpibvar.h"
-
-struct ct_iocmd ct_ioc;
-struct ct_rscmd ct_rsc;
-struct ct_stat ct_stat;
-struct ct_ssmcmd ct_ssmc;
-
-struct ct_softc {
- int sc_ctlr;
- int sc_unit;
- char sc_retry;
- char sc_alive;
- short sc_punit;
- int sc_blkno;
-} ct_softc[NHPIB][NCT];
-
-#define CTRETRY 5
-#define MTFSF 10
-#define MTREW 11
-
-int ctclose(struct open_file *);
-int cterror(int, int);
-int ctident(int, int);
-int ctinit(int, int);
-int ctopen(struct open_file *, int, int, int);
-int ctpunit(int, int, int *);
-int ctstrategy(void *, int, daddr32_t, size_t, void *, size_t *);
-
-char ctio_buf[MAXBSIZE];
-
-struct ctinfo {
- short hwid;
- short punit;
-} ctinfo[] = {
- { CT7946ID, 1 },
- { CT7912PID, 1 },
- { CT7914PID, 1 },
- { CT9144ID, 0 },
- { CT9145ID, 0 }
-};
-int nctinfo = sizeof(ctinfo) / sizeof(ctinfo[0]);
-
-int
-ctinit(int ctlr, int unit)
-{
- struct ct_softc *rs = &ct_softc[ctlr][unit];
- u_char stat;
-
- if (hpibrecv(ctlr, unit, C_QSTAT, &stat, 1) != 1 || stat)
- return (0);
- if (ctident(ctlr, unit) < 0)
- return (0);
- bzero(&ct_ssmc, sizeof(ct_ssmc));
- ct_ssmc.unit = C_SUNIT(rs->sc_punit);
- ct_ssmc.cmd = C_SSM;
- ct_ssmc.fefm = FEF_MASK;
- ct_ssmc.refm = REF_MASK;
- ct_ssmc.aefm = AEF_MASK;
- ct_ssmc.iefm = IEF_MASK;
- hpibsend(ctlr, unit, C_CMD, &ct_ssmc, sizeof(ct_ssmc));
- hpibswait(ctlr, unit);
- hpibrecv(ctlr, unit, C_QSTAT, &stat, 1);
- rs->sc_alive = 1;
- return (1);
-}
-
-int
-ctident(int ctlr, int unit)
-{
- struct cs80_describe desc;
- u_char stat, cmd[3];
- char name[7];
- int id, i;
-
- id = hpibid(ctlr, unit);
- if ((id & 0x200) == 0)
- return(-1);
- for (i = 0; i < nctinfo; i++)
- if (id == ctinfo[i].hwid)
- break;
- if (i == nctinfo)
- return(-1);
- ct_softc[ctlr][unit].sc_punit = ctinfo[i].punit;
- id = i;
-
- /*
- * Collect device description.
- * Right now we only need this to differentiate 7945 from 7946.
- * Note that we always issue the describe command to unit 0.
- */
- cmd[0] = C_SUNIT(0);
- cmd[1] = C_SVOL(0);
- cmd[2] = C_DESC;
- hpibsend(ctlr, unit, C_CMD, cmd, sizeof(cmd));
- hpibrecv(ctlr, unit, C_EXEC, &desc, sizeof(desc));
- hpibrecv(ctlr, unit, C_QSTAT, &stat, sizeof(stat));
- bzero(name, sizeof(name));
- if (!stat) {
- int n = desc.d_name;
- for (i = 5; i >= 0; i--) {
- name[i] = (n & 0xf) + '0';
- n >>= 4;
- }
- }
- switch (ctinfo[id].hwid) {
- case CT7946ID:
- if (bcmp(name, "079450", 6) == 0)
- id = -1; /* not really a 7946 */
- break;
- default:
- break;
- }
- return(id);
-}
-
-int
-ctpunit(int ctlr, int slave, int *punit)
-{
- struct ct_softc *rs;
-
- if (ctlr >= NHPIB || hpibalive(ctlr) == 0)
- return(EADAPT);
- if (slave >= NCT)
- return(ECTLR);
- rs = &ct_softc[ctlr][slave];
-
- if (rs->sc_alive == 0)
- return(ENXIO);
-
- *punit = rs->sc_punit;
- return (0);
-}
-
-int
-ctopen(struct open_file *f, int ctlr, int unit, int part)
-{
- struct ct_softc *rs;
- int skip;
- size_t resid;
-
- if (ctlr >= NHPIB || hpibalive(ctlr) == 0)
- return(EADAPT);
- if (unit >= NCT)
- return(ECTLR);
- rs = &ct_softc[ctlr][unit];
- rs->sc_blkno = 0;
- rs->sc_unit = unit;
- rs->sc_ctlr = ctlr;
- if (rs->sc_alive == 0)
- if (ctinit(ctlr, unit) == 0)
- return(ENXIO);
- f->f_devdata = (void *)rs;
- ctstrategy(f->f_devdata, MTREW, 0, 0, ctio_buf, &resid);
- skip = part;
- while (skip--)
- ctstrategy(f->f_devdata, MTFSF, 0, 0, ctio_buf, &resid);
- return(0);
-}
-
-int
-ctclose(struct open_file *f)
-{
- size_t resid;
-
- ctstrategy(f->f_devdata, MTREW, 0, 0, ctio_buf, &resid);
- return (0);
-}
-
-int
-ctstrategy(void *devdata, int func, daddr32_t dblk, size_t size, void *v_buf,
- size_t *rsize)
-{
- struct ct_softc *rs = devdata;
- char *buf = v_buf;
- int ctlr = rs->sc_ctlr;
- int unit = rs->sc_unit;
- char stat;
-
- if (size == 0 && (func == F_READ || func == F_WRITE))
- return(0);
-
- rs->sc_retry = 0;
- bzero(&ct_ioc, sizeof(ct_ioc));
- ct_ioc.unit = C_SUNIT(rs->sc_punit);
- ct_ioc.saddr = C_SADDR;
- ct_ioc.nop2 = C_NOP;
- ct_ioc.slen = C_SLEN;
- ct_ioc.nop3 = C_NOP;
-top:
- if (func == F_READ) {
- ct_ioc.cmd = C_READ;
- ct_ioc.addr = rs->sc_blkno;
- ct_ioc.len = size;
- }
- else if (func == F_WRITE) {
- ct_ioc.cmd = C_WRITE;
- ct_ioc.addr = rs->sc_blkno;
- ct_ioc.len = size;
- }
- else if (func == MTFSF) {
- ct_ioc.cmd = C_READ;
- ct_ioc.addr = rs->sc_blkno;
- ct_ioc.len = size = MAXBSIZE;
- }
- else {
- ct_ioc.cmd = C_READ;
- ct_ioc.addr = 0;
- ct_ioc.len = 0;
- rs->sc_blkno = 0;
- size = 0;
- }
-retry:
- hpibsend(ctlr, unit, C_CMD, &ct_ioc, sizeof(ct_ioc));
- if (func != MTREW) {
- hpibswait(ctlr, unit);
- hpibgo(ctlr, unit, C_EXEC, buf, size,
- func != F_WRITE ? F_READ : F_WRITE);
- hpibswait(ctlr, unit);
- } else {
- while (hpibswait(ctlr, unit) < 0)
- ;
- }
- hpibrecv(ctlr, unit, C_QSTAT, &stat, 1);
- if (stat) {
- stat = cterror(ctlr, unit);
- if (stat == 0)
- return (-1);
- if (stat == 2)
- return (0);
- if (++rs->sc_retry > CTRETRY)
- return (-1);
- goto retry;
- }
- rs->sc_blkno += CTBTOK(size);
- if (func == MTFSF)
- goto top;
- *rsize = size;
-
- return(0);
-}
-
-int
-cterror(int ctlr, int unit)
-{
- struct ct_softc *rs = &ct_softc[ctlr][unit];
- char stat;
-
- bzero(&ct_rsc, sizeof(ct_rsc));
- bzero(&ct_stat, sizeof(ct_stat));
- ct_rsc.unit = C_SUNIT(rs->sc_punit);
- ct_rsc.cmd = C_STATUS;
- hpibsend(ctlr, unit, C_CMD, &ct_rsc, sizeof(ct_rsc));
- hpibrecv(ctlr, unit, C_EXEC, &ct_stat, sizeof(ct_stat));
- hpibrecv(ctlr, unit, C_QSTAT, &stat, 1);
- if (stat) {
- printf("ct%d: request status fail %d\n", unit, stat);
- return(0);
- }
- if (ct_stat.c_aef & AEF_EOF) {
- /* 9145 drives don't increment block number at EOF */
- if ((ct_stat.c_blk - rs->sc_blkno) == 0)
- rs->sc_blkno++;
- else
- rs->sc_blkno = ct_stat.c_blk;
- return (2);
- }
- printf("ct%d err: vu 0x%x, pend 0x%x, bn%ld", unit,
- ct_stat.c_vu, ct_stat.c_pend, ct_stat.c_blk);
- printf(", R 0x%x F 0x%x A 0x%x I 0x%x\n", ct_stat.c_ref,
- ct_stat.c_fef, ct_stat.c_aef, ct_stat.c_ief);
- return (1);
-}
diff --git a/sys/arch/hp300/stand/common/dca.c b/sys/arch/hp300/stand/common/dca.c
deleted file mode 100644
index b639b411725..00000000000
--- a/sys/arch/hp300/stand/common/dca.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/* $OpenBSD: dca.c,v 1.8 2011/08/18 20:02:58 miod Exp $ */
-/* $NetBSD: dca.c,v 1.10 1996/10/06 01:42:48 mycroft Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)dca.c 8.1 (Berkeley) 6/10/93
- */
-
-#ifdef DCACONSOLE
-#include <sys/param.h>
-
-#include <hp300/dev/dcareg.h>
-
-#include "samachdep.h"
-#include "consdefs.h"
-
-struct dcadevice *dcacnaddr = NULL;
-
-#define DCACONSCODE 9 /* XXX */
-
-void
-dcaprobe(struct consdev *cp)
-{
- struct dcadevice *dca;
-
- dcacnaddr = (struct dcadevice *)sctoaddr(DCACONSCODE);
- if (badaddr((char *)dcacnaddr))
- return;
-
- dca = dcacnaddr;
- switch (dca->dca_id) {
- case DCAID0:
- case DCAID1:
- cp->cn_pri = CN_LOWPRI;
- break;
- case DCAID0 | DCACON:
- case DCAID1 | DCACON:
- cp->cn_pri = CN_HIGHPRI;
- break;
- default:
- break;
- }
-}
-
-void
-dcainit(struct consdev *cp)
-{
- struct dcadevice *dca = dcacnaddr;
-
- dca->dca_reset = 0xFF;
- DELAY(100);
- dca->dca_ic = 0;
- dca->dca_cfcr = CFCR_DLAB;
- dca->dca_data = DCABRD(9600) & 0xFF;
- dca->dca_ier = DCABRD(9600) >> 8;
- dca->dca_cfcr = CFCR_8BITS;
- dca->dca_fifo =
- FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST | FIFO_TRIGGER_1;
- dca->dca_mcr = MCR_DTR | MCR_RTS;
-}
-
-/* ARGSUSED */
-int
-dcagetchar(dev_t dev)
-{
-#ifndef SMALL
- struct dcadevice *dca = dcacnaddr;
- short stat;
- int c;
-
- if (((stat = dca->dca_lsr) & LSR_RXRDY) == 0)
- return(0);
- c = dca->dca_data;
- return(c);
-#else
- return(0);
-#endif
-}
-
-/* ARGSUSED */
-void
-dcaputchar(dev_t dev, int c)
-{
- struct dcadevice *dca = dcacnaddr;
- int timo;
- short stat;
-
- /* wait a reasonable time for the transmitter to come ready */
- timo = 50000;
- while (((stat = dca->dca_lsr) & LSR_TXRDY) == 0 && --timo)
- ;
- dca->dca_data = c;
- /* wait for this transmission to complete */
- timo = 1000000;
- while (((stat = dca->dca_lsr) & LSR_TXRDY) == 0 && --timo)
- ;
-}
-#endif
diff --git a/sys/arch/hp300/stand/common/dcm.c b/sys/arch/hp300/stand/common/dcm.c
deleted file mode 100644
index 157c938c845..00000000000
--- a/sys/arch/hp300/stand/common/dcm.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/* $OpenBSD: dcm.c,v 1.6 2008/01/23 16:37:56 jsing Exp $ */
-/* $NetBSD: dcm.c,v 1.2 1997/04/14 05:58:32 scottr Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)dcm.c 8.1 (Berkeley) 6/10/93
- */
-
-#ifdef DCMCONSOLE
-#include <sys/param.h>
-
-#include <hp300/dev/dcmreg.h>
-
-#include "samachdep.h"
-#include "consdefs.h"
-#include "device.h"
-
-struct dcmdevice *dcmcnaddr = NULL;
-
-#define DCMCONUNIT 1 /* XXX */
-
-void
-dcmprobe(struct consdev *cp)
-{
- extern struct hp_hw sc_table[];
- struct hp_hw *hw;
- struct dcmdevice *dcm;
-
- for (hw = sc_table; hw < &sc_table[MAXCTLRS]; hw++)
- if (HW_ISDEV(hw, D_COMMDCM) && !badaddr((caddr_t)hw->hw_kva))
- break;
- if (!HW_ISDEV(hw, D_COMMDCM))
- return;
- dcmcnaddr = (struct dcmdevice *) hw->hw_kva;
-
- dcm = dcmcnaddr;
- switch (dcm->dcm_rsid) {
- case DCMID:
- cp->cn_pri = CN_LOWPRI;
- break;
- case DCMID|DCMCON:
- cp->cn_pri = CN_HIGHPRI;
- break;
- default:
- break;
- }
-}
-
-void
-dcminit(struct consdev *cp)
-{
- struct dcmdevice *dcm = dcmcnaddr;
- int port = DCMCONUNIT;
-
- dcm->dcm_ic = IC_ID;
- while (dcm->dcm_thead[port].ptr != dcm->dcm_ttail[port].ptr)
- ;
- dcm->dcm_data[port].dcm_baud = BR_9600;
- dcm->dcm_data[port].dcm_conf = LC_8BITS | LC_1STOP;
- SEM_LOCK(dcm);
- dcm->dcm_cmdtab[port].dcm_data |= CT_CON;
- dcm->dcm_cr |= (1 << port);
- SEM_UNLOCK(dcm);
- DELAY(15000);
-}
-
-/* ARGSUSED */
-int
-dcmgetchar(dev_t dev)
-{
-#ifndef SMALL
- struct dcmdevice *dcm = dcmcnaddr;
- struct dcmrfifo *fifo;
- struct dcmpreg *pp;
- unsigned head;
- int c, stat, port;
-
- port = DCMCONUNIT;
- pp = dcm_preg(dcm, port);
- head = pp->r_head & RX_MASK;
- if (head == (pp->r_tail & RX_MASK))
- return(0);
- fifo = &dcm->dcm_rfifos[3-port][head>>1];
- c = fifo->data_char;
- stat = fifo->data_stat;
- pp->r_head = (head + 2) & RX_MASK;
- SEM_LOCK(dcm);
- stat = dcm->dcm_iir;
- SEM_UNLOCK(dcm);
- return(c);
-#else
- return(0);
-#endif
-}
-
-/* ARGSUSED */
-void
-dcmputchar(dev_t dev, int c)
-{
- struct dcmdevice *dcm = dcmcnaddr;
- struct dcmpreg *pp;
- int timo;
- unsigned tail;
- int port, stat;
-
- port = DCMCONUNIT;
- pp = dcm_preg(dcm, port);
- tail = pp->t_tail & TX_MASK;
- timo = 50000;
- while (tail != (pp->t_head & TX_MASK) && --timo)
- ;
- dcm->dcm_tfifos[3-port][tail].data_char = c;
- pp->t_tail = tail = (tail + 1) & TX_MASK;
- SEM_LOCK(dcm);
- dcm->dcm_cmdtab[port].dcm_data |= CT_TX;
- dcm->dcm_cr |= (1 << port);
- SEM_UNLOCK(dcm);
- timo = 1000000;
- while (tail != (pp->t_head & TX_MASK) && --timo)
- ;
- SEM_LOCK(dcm);
- stat = dcm->dcm_iir;
- SEM_UNLOCK(dcm);
-}
-#endif
diff --git a/sys/arch/hp300/stand/common/dnkbd.c b/sys/arch/hp300/stand/common/dnkbd.c
deleted file mode 100644
index 9bfac1b34db..00000000000
--- a/sys/arch/hp300/stand/common/dnkbd.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/* $OpenBSD: dnkbd.c,v 1.5 2011/08/18 19:54:19 miod Exp $ */
-/* $NetBSD: dnkbd.c,v 1.3 1997/05/12 07:47:03 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1997 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Michael Smith and Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Apollo Domain keyboard routines for the standalone ITE.
- */
-
-#if defined(ITECONSOLE) && defined(DOMAIN_KEYBOARD)
-
-#include <sys/param.h>
-
-#include <hp300/dev/frodoreg.h> /* for apci offsets */
-#include <hp300/dev/dcareg.h> /* for the register bit definitions */
-#include <hp300/dev/apcireg.h> /* for the apci registers */
-
-#include "samachdep.h"
-#include "kbdvar.h"
-
-#ifndef SMALL
-
-/*
- * The Apollo keyboard is used in `cooked' mode as configured by the
- * firmware; only one table is required.
- *
- * Note that if an entry in this table is set to 0, the key is passed
- * through untranslated. If the entry is 0xff, the key is ignored.
- */
-u_char dnkbd_keymap[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 07 */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 17 */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 1f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 27 */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 2f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 37 */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 3f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 47 */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 4f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 57 */
- 0x00, 0x00, 0x00, '{', 0x00, '}', 0x00, 0x00, /* 5f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 67 */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 6f */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 77 */
- 0x00, 0x00, 0x00, '[', 0x00, ']', 0x00, 0x00, /* 7f */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 87 */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 8f */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 97 */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 9f */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* a7 */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* af */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* b7 */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* bf */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* c7 */
- '\\', '|', 0x09, 0x0a, '/', 0xff, 0xff, 0xff, /* cf */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* d7 */
- 0xff, 0xff, 0xff, 0xff, '?', 0xff, 0x08, 0xff, /* df */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* e7 */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* ef */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* f7 */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* ff */
-};
-
-int dnkbd_ignore; /* for ignoring mouse packets */
-
-int
-dnkbd_getc()
-{
- struct apciregs *apci =
- (struct apciregs *)IIOV(FRODO_BASE + FRODO_APCI_OFFSET(0));
- int c;
-
- /* default to `no key' */
- c = 0;
-
- /* Is data in the UART? */
- if (apci->ap_lsr & LSR_RXRDY) {
- /* Get the character. */
- c = apci->ap_data;
-
- /* Ignoring mouse? */
- if (dnkbd_ignore) {
- dnkbd_ignore--;
- return (0);
- }
-
- /* Is this the start of a mouse packet? */
- if (c == 0xdf) {
- dnkbd_ignore = 3; /* 3 bytes of junk */
- return (0);
- }
-
- /* It's a keyboard event. */
- switch (dnkbd_keymap[c]) {
- case 0x00:
- /* passthrough */
- break;
-
- case 0xff:
- /* ignore */
- c = 0;
- break;
-
- default:
- c = dnkbd_keymap[c];
- break;
- }
- }
-
- return (c);
-}
-#endif /* SMALL */
-
-void
-dnkbd_nmi()
-{
-
- /*
- * XXX Should we do anything? Can we even generate one?
- */
-}
-
-int
-dnkbd_init()
-{
-
- /*
- * 400, 425, and 433 models can have a Domain keyboard.
- */
- switch (machineid) {
- case HP_400:
- case HP_425:
- case HP_433:
- break;
- default:
- return (0);
- }
-
- /*
- * Look for a Frodo utility chip. If we find one, assume there
- * is a Domain keyboard attached.
- */
- if (badaddr((caddr_t)IIOV(FRODO_BASE + FRODO_APCI_OFFSET(0))))
- return (0);
-
- /*
- * XXX Any other initialization? This appears to work ok.
- */
- return (1);
-}
-#endif /* ITECONSOLE && DOMAIN_KEYBOARD */
diff --git a/sys/arch/hp300/stand/common/fhpib.c b/sys/arch/hp300/stand/common/fhpib.c
deleted file mode 100644
index 53aee75511c..00000000000
--- a/sys/arch/hp300/stand/common/fhpib.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/* $OpenBSD: fhpib.c,v 1.4 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: fhpib.c,v 1.5 1995/08/05 16:47:42 thorpej Exp $ */
-
-/*
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)fhpib.c 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * 98625A/B HPIB driver
- */
-
-#include <sys/param.h>
-
-#include <hp300/dev/fhpibreg.h>
-
-#include "samachdep.h"
-#include "hpibvar.h"
-
-int fhpibinit(int);
-void fhpibreset(int);
-int fhpibwait(struct fhpibdevice *, int);
-
-int
-fhpibinit(int unit)
-{
- struct hpib_softc *hs = &hpib_softc[unit];
- struct fhpibdevice *hd = (struct fhpibdevice *)hs->sc_addr;
-
- if (hd->hpib_cid != HPIBC)
- return(0);
- hs->sc_type = HPIBC;
- hs->sc_ba = HPIBC_BA;
- fhpibreset(unit);
- return(1);
-}
-
-void
-fhpibreset(int unit)
-{
- struct hpib_softc *hs = &hpib_softc[unit];
- struct fhpibdevice *hd;
-
- hd = (struct fhpibdevice *)hs->sc_addr;
- hd->hpib_cid = 0xFF;
- DELAY(100);
- hd->hpib_cmd = CT_8BIT;
- hd->hpib_ar = AR_ARONC;
- hd->hpib_cmd |= CT_IFC;
- hd->hpib_cmd |= CT_INITFIFO;
- DELAY(100);
- hd->hpib_cmd &= ~CT_IFC;
- hd->hpib_cmd |= CT_REN;
- hd->hpib_stat = ST_ATN;
- hd->hpib_data = C_DCL;
- DELAY(100000);
-}
-
-int
-fhpibsend(int unit, int slave, int sec, char *buf, int cnt)
-{
- struct hpib_softc *hs = &hpib_softc[unit];
- struct fhpibdevice *hd;
- int origcnt = cnt;
-
- hd = (struct fhpibdevice *)hs->sc_addr;
- hd->hpib_stat = 0;
- hd->hpib_imask = IM_IDLE | IM_ROOM;
- fhpibwait(hd, IM_IDLE);
- hd->hpib_stat = ST_ATN;
- hd->hpib_data = C_UNL;
- hd->hpib_data = C_TAG + hs->sc_ba;
- hd->hpib_data = C_LAG + slave;
- if (sec != -1)
- hd->hpib_data = C_SCG + sec;
- fhpibwait(hd, IM_IDLE);
- hd->hpib_stat = ST_WRITE;
- if (cnt) {
- while (--cnt) {
- hd->hpib_data = *buf++;
- if (fhpibwait(hd, IM_ROOM) < 0)
- break;
- }
- hd->hpib_stat = ST_EOI;
- hd->hpib_data = *buf;
- if (fhpibwait(hd, IM_ROOM) < 0)
- cnt++;
- hd->hpib_stat = ST_ATN;
- /* XXX: HP-UX claims bug with CS80 transparent messages */
- if (sec == 0x12)
- DELAY(150);
- hd->hpib_data = C_UNL;
- fhpibwait(hd, IM_IDLE);
- }
- hd->hpib_imask = 0;
- return(origcnt - cnt);
-}
-
-int
-fhpibrecv(int unit, int slave, int sec, char *buf, int cnt)
-{
- struct hpib_softc *hs = &hpib_softc[unit];
- struct fhpibdevice *hd;
- int origcnt = cnt;
-
- hd = (struct fhpibdevice *)hs->sc_addr;
- hd->hpib_stat = 0;
- hd->hpib_imask = IM_IDLE | IM_ROOM | IM_BYTE;
- fhpibwait(hd, IM_IDLE);
- hd->hpib_stat = ST_ATN;
- hd->hpib_data = C_UNL;
- hd->hpib_data = C_LAG + hs->sc_ba;
- hd->hpib_data = C_TAG + slave;
- if (sec != -1)
- hd->hpib_data = C_SCG + sec;
- fhpibwait(hd, IM_IDLE);
- hd->hpib_stat = ST_READ0;
- hd->hpib_data = 0;
- if (cnt) {
- while (--cnt >= 0) {
- if (fhpibwait(hd, IM_BYTE) < 0)
- break;
- *buf++ = hd->hpib_data;
- }
- cnt++;
- fhpibwait(hd, IM_ROOM);
- hd->hpib_stat = ST_ATN;
- hd->hpib_data = (slave == 31) ? C_UNA : C_UNT;
- fhpibwait(hd, IM_IDLE);
- }
- hd->hpib_imask = 0;
- return(origcnt - cnt);
-}
-
-int
-fhpibppoll(int unit)
-{
- struct hpib_softc *hs = &hpib_softc[unit];
- struct fhpibdevice *hd;
- int ppoll;
-
- hd = (struct fhpibdevice *)hs->sc_addr;
- hd->hpib_stat = 0;
- hd->hpib_psense = 0;
- hd->hpib_pmask = 0xFF;
- hd->hpib_imask = IM_PPRESP | IM_PABORT;
- DELAY(25);
- hd->hpib_intr = IM_PABORT;
- ppoll = hd->hpib_data;
- if (hd->hpib_intr & IM_PABORT)
- ppoll = 0;
- hd->hpib_imask = 0;
- hd->hpib_pmask = 0;
- hd->hpib_stat = ST_IENAB;
- return(ppoll);
-}
-
-int
-fhpibwait(struct fhpibdevice *hd, int x)
-{
- int timo = 100000;
-
- while ((hd->hpib_intr & x) == 0 && --timo)
- ;
- if (timo == 0)
- return(-1);
- return(0);
-}
diff --git a/sys/arch/hp300/stand/common/hd.c b/sys/arch/hp300/stand/common/hd.c
deleted file mode 100644
index 730857f789d..00000000000
--- a/sys/arch/hp300/stand/common/hd.c
+++ /dev/null
@@ -1,362 +0,0 @@
-/* $OpenBSD: hd.c,v 1.9 2013/04/01 12:55:27 miod Exp $ */
-/* $NetBSD: rd.c,v 1.11 1996/12/21 21:34:40 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: rd.c 1.20 92/12/21
- *
- * @(#)rd.c 8.1 (Berkeley) 7/15/93
- */
-
-/*
- * CS80/SS80 disk driver
- */
-#include <sys/param.h>
-#include <sys/disklabel.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-
-#define DEV_BSHIFT _DEV_BSHIFT
-#include <hp300/dev/hdreg.h>
-#include "hpibvar.h"
-
-struct hd_iocmd hd_ioc;
-struct hd_rscmd hd_rsc;
-struct hd_stat hd_stat;
-struct hd_ssmcmd hd_ssmc;
-
-struct disklabel hdlabel;
-
-struct hdminilabel {
- u_short npart;
- u_long offset[MAXPARTITIONS];
-};
-
-struct hd_softc {
- int sc_ctlr;
- int sc_unit;
- int sc_part;
- char sc_retry;
- char sc_alive;
- short sc_type;
- struct hdminilabel sc_pinfo;
-} hd_softc[NHPIB][NHD];
-
-#define HDRETRY 5
-
-struct hdidentinfo {
- short ri_hwid;
- short ri_maxunum;
- int ri_nblocks;
-} hdidentinfo[] = {
- { HD7946AID, 0, 108416 },
- { HD9134DID, 1, 29088 },
- { HD9134LID, 1, 1232 },
- { HD7912PID, 0, 128128 },
- { HD7914PID, 0, 258048 },
- { HD7958AID, 0, 255276 },
- { HD7957AID, 0, 159544 },
- { HD7933HID, 0, 789958 },
- { HD9134LID, 1, 77840 },
- { HD7936HID, 0, 600978 },
- { HD7937HID, 0, 1116102 },
- { HD7914CTID, 0, 258048 },
- { HD7946AID, 0, 108416 },
- { HD9134LID, 1, 1232 },
- { HD7957BID, 0, 159894 },
- { HD7958BID, 0, 297108 },
- { HD7959BID, 0, 594216 },
- { HD2200AID, 0, 654948 },
- { HD2203AID, 0, 1309896 }
-};
-int numhdidentinfo = sizeof(hdidentinfo) / sizeof(hdidentinfo[0]);
-
-int hdclose(struct open_file *);
-int hderror(int, int, int);
-int hdgetinfo(struct hd_softc *);
-int hdident(int, int);
-int hdinit(int, int);
-int hdopen(struct open_file *, int, int, int);
-void hdreset(int, int);
-int hdstrategy(void *, int, daddr32_t, size_t, void *, size_t *);
-
-int
-hdinit(int ctlr, int unit)
-{
- struct hd_softc *rs = &hd_softc[ctlr][unit];
-
- rs->sc_type = hdident(ctlr, unit);
- if (rs->sc_type < 0)
- return (0);
- rs->sc_alive = 1;
- return (1);
-}
-
-void
-hdreset(int ctlr, int unit)
-{
- u_char stat;
-
- hd_ssmc.c_unit = C_SUNIT(0);
- hd_ssmc.c_cmd = C_SSM;
- hd_ssmc.c_refm = REF_MASK;
- hd_ssmc.c_fefm = FEF_MASK;
- hd_ssmc.c_aefm = AEF_MASK;
- hd_ssmc.c_iefm = IEF_MASK;
- hpibsend(ctlr, unit, C_CMD, &hd_ssmc, sizeof(hd_ssmc));
- hpibswait(ctlr, unit);
- hpibrecv(ctlr, unit, C_QSTAT, &stat, 1);
-}
-
-int
-hdident(int ctlr, int unit)
-{
- struct cs80_describe desc;
- u_char stat, cmd[3];
- char name[7];
- int id, i;
-
- id = hpibid(ctlr, unit);
- if ((id & 0x200) == 0)
- return(-1);
- for (i = 0; i < numhdidentinfo; i++)
- if (id == hdidentinfo[i].ri_hwid)
- break;
- if (i == numhdidentinfo)
- return(-1);
- id = i;
- hdreset(ctlr, unit);
- cmd[0] = C_SUNIT(0);
- cmd[1] = C_SVOL(0);
- cmd[2] = C_DESC;
- hpibsend(ctlr, unit, C_CMD, cmd, sizeof(cmd));
- hpibrecv(ctlr, unit, C_EXEC, &desc, sizeof(desc));
- hpibrecv(ctlr, unit, C_QSTAT, &stat, sizeof(stat));
- bzero(name, sizeof(name));
- if (!stat) {
- int n = desc.d_name;
- for (i = 5; i >= 0; i--) {
- name[i] = (n & 0xf) + '0';
- n >>= 4;
- }
- }
- /*
- * Take care of a couple of anomalies:
- * 1. 7945A and 7946A both return same HW id
- * 2. 9122S and 9134D both return same HW id
- * 3. 9122D and 9134L both return same HW id
- */
- switch (hdidentinfo[id].ri_hwid) {
- case HD7946AID:
- if (bcmp(name, "079450", 6) == 0)
- id = HD7945A;
- else
- id = HD7946A;
- break;
-
- case HD9134LID:
- if (bcmp(name, "091340", 6) == 0)
- id = HD9134L;
- else
- id = HD9122D;
- break;
-
- case HD9134DID:
- if (bcmp(name, "091220", 6) == 0)
- id = HD9122S;
- else
- id = HD9134D;
- break;
- }
- return(id);
-}
-
-char hdio_buf[MAXBSIZE];
-
-int
-hdgetinfo(struct hd_softc *rs)
-{
- struct hdminilabel *pi = &rs->sc_pinfo;
- struct disklabel *lp = &hdlabel;
- char *msg;
- int err, savepart;
- size_t i;
-
- bzero((caddr_t)lp, sizeof *lp);
- lp->d_secsize = DEV_BSIZE;
-
- /* Disklabel is always from RAW_PART. */
- savepart = rs->sc_part;
- rs->sc_part = RAW_PART;
- err = hdstrategy(rs, F_READ, LABELSECTOR,
- lp->d_secsize ? lp->d_secsize : DEV_BSIZE, hdio_buf, &i);
- rs->sc_part = savepart;
-
- if (err) {
- printf("hdgetinfo: hdstrategy error %d\n", err);
- return(0);
- }
-
- msg = getdisklabel(hdio_buf, lp);
- if (msg) {
- printf("hd(%d,%d,%d): WARNING: %s, ",
- rs->sc_ctlr, rs->sc_unit, rs->sc_part, msg);
- printf("defining `c' partition as entire disk\n");
- pi->npart = 3;
- pi->offset[0] = pi->offset[1] = -1;
- pi->offset[2] = 0;
- } else {
- pi->npart = lp->d_npartitions;
- for (i = 0; i < pi->npart; i++)
- pi->offset[i] = lp->d_partitions[i].p_size == 0 ?
- -1 : lp->d_partitions[i].p_offset;
- }
- return(1);
-}
-
-int
-hdopen(struct open_file *f, int ctlr, int unit, int part)
-{
- struct hd_softc *rs;
-
- if (ctlr >= NHPIB || hpibalive(ctlr) == 0)
- return (EADAPT);
- if (unit >= NHD)
- return (ECTLR);
- rs = &hd_softc[ctlr][unit];
- rs->sc_part = part;
- rs->sc_unit = unit;
- rs->sc_ctlr = ctlr;
- if (rs->sc_alive == 0) {
- if (hdinit(ctlr, unit) == 0)
- return (ENXIO);
- if (hdgetinfo(rs) == 0)
- return (ERDLAB);
- }
- if (part != RAW_PART && /* always allow RAW_PART to be opened */
- (part >= rs->sc_pinfo.npart || rs->sc_pinfo.offset[part] == -1))
- return (EPART);
- f->f_devdata = (void *)rs;
- return (0);
-}
-
-int
-hdclose(struct open_file *f)
-{
- struct hd_softc *rs = f->f_devdata;
-
- /*
- * Mark the disk `not alive' so that the disklabel
- * will be re-loaded at next open.
- */
- bzero(rs, sizeof(struct hd_softc));
- f->f_devdata = NULL;
- return (0);
-}
-
-int
-hdstrategy(void *devdata, int func, daddr32_t dblk, size_t size, void *v_buf,
- size_t *rsize)
-{
- char *buf = v_buf;
- struct hd_softc *rs = devdata;
- int ctlr = rs->sc_ctlr;
- int unit = rs->sc_unit;
- daddr32_t blk;
- char stat;
-
- if (size == 0)
- return(0);
-
- /*
- * Don't do partition translation on the `raw partition'.
- */
- blk = (dblk + ((rs->sc_part == RAW_PART) ? 0 :
- rs->sc_pinfo.offset[rs->sc_part]));
-
- rs->sc_retry = 0;
- hd_ioc.c_unit = C_SUNIT(0);
- hd_ioc.c_volume = C_SVOL(0);
- hd_ioc.c_saddr = C_SADDR;
- hd_ioc.c_hiaddr = 0;
- hd_ioc.c_addr = HDBTOS(blk);
- hd_ioc.c_nop2 = C_NOP;
- hd_ioc.c_slen = C_SLEN;
- hd_ioc.c_len = size;
- hd_ioc.c_cmd = func == F_READ ? C_READ : C_WRITE;
-retry:
- hpibsend(ctlr, unit, C_CMD, &hd_ioc.c_unit, sizeof(hd_ioc)-2);
- hpibswait(ctlr, unit);
- hpibgo(ctlr, unit, C_EXEC, buf, size, func);
- hpibswait(ctlr, unit);
- hpibrecv(ctlr, unit, C_QSTAT, &stat, 1);
- if (stat) {
- if (hderror(ctlr, unit, rs->sc_part) == 0)
- return(EIO);
- if (++rs->sc_retry > HDRETRY)
- return(EIO);
- goto retry;
- }
- *rsize = size;
-
- return(0);
-}
-
-int
-hderror(int ctlr, int unit, int part)
-{
- char stat;
-
- hd_rsc.c_unit = C_SUNIT(0);
- hd_rsc.c_sram = C_SRAM;
- hd_rsc.c_ram = C_RAM;
- hd_rsc.c_cmd = C_STATUS;
- hpibsend(ctlr, unit, C_CMD, &hd_rsc, sizeof(hd_rsc));
- hpibrecv(ctlr, unit, C_EXEC, &hd_stat, sizeof(hd_stat));
- hpibrecv(ctlr, unit, C_QSTAT, &stat, 1);
- if (stat) {
- printf("hd(%d,%d,0,%d): request status fail %d\n",
- ctlr, unit, part, stat);
- return(0);
- }
- printf("hd(%d,%d,0,%d) err: vu 0x%x",
- ctlr, unit, part, hd_stat.c_vu);
- if ((hd_stat.c_aef & AEF_UD) || (hd_stat.c_ief & (IEF_MD|IEF_RD)))
- printf(", block %ld", hd_stat.c_blk);
- printf(", R0x%x F0x%x A0x%x I0x%x\n",
- hd_stat.c_ref, hd_stat.c_fef, hd_stat.c_aef, hd_stat.c_ief);
- return(1);
-}
diff --git a/sys/arch/hp300/stand/common/hil.c b/sys/arch/hp300/stand/common/hil.c
deleted file mode 100644
index 37c9fad103b..00000000000
--- a/sys/arch/hp300/stand/common/hil.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/* $OpenBSD: hil.c,v 1.7 2011/08/18 19:37:26 miod Exp $ */
-/* $NetBSD: hil.c,v 1.2 1997/04/14 19:00:10 thorpej Exp $ */
-
-/*
- * Copyright (c) 1997 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: hil.c 1.1 89/08/22
- *
- * @(#)hil.c 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * HIL keyboard routines for the standalone ITE.
- */
-
-#if defined(ITECONSOLE) && defined(HIL_KEYBOARD)
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-#include "hilreg.h"
-#include "itevar.h"
-#include "kbdvar.h"
-
-#ifndef SMALL
-
-#define ESC '\033'
-#define DEL '\177'
-
-/*
- * HIL cooked keyboard keymaps.
- * Supports only unshifted, shifted and control keys.
- */
-char hilkbd_keymap[] = {
- 0, '`', '\\', ESC, 0, DEL, 0, 0,
- '\n', '\t', 0, 0, 0, 0, 0, 0,
- 0, '\n', 0, 0, 0, 0, 0, 0,
- 0, '\t', 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, '\b', 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- ESC, '\r', 0, '\n', '0', '.', ',', '+',
- '1', '2', '3', '-', '4', '5', '6', '*',
- '7', '8', '9', '/', 'E', '(', ')', '^',
- '1', '2', '3', '4', '5', '6', '7', '8',
- '9', '0', '-', '=', '[', ']', ';', '\'',
- ',', '.', '/', '\040', 'o', 'p', 'k', 'l',
- 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i',
- 'a', 's', 'd', 'f', 'g', 'h', 'j', 'm',
- 'z', 'x', 'c', 'v', 'b', 'n', 0, 0
-};
-
-char hilkbd_shiftmap[] = {
- 0, '~', '|', DEL, 0, DEL, 0, 0,
- '\n', '\t', 0, 0, 0, 0, 0, 0,
- 0, '\n', 0, 0, 0, 0, 0, 0,
- 0, '\t', 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, DEL, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- ESC, '\r', 0, '\n', '0', '.', ',', '+',
- '1', '2', '3', '-', '4', '5', '6', '*',
- '7', '8', '9', '/', '`', '|', '\\', '~',
- '!', '@', '#', '$', '%', '^', '&', '*',
- '(', ')', '_', '+', '{', '}', ':', '\"',
- '<', '>', '?', '\040', 'O', 'P', 'K', 'L',
- 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I',
- 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'M',
- 'Z', 'X', 'C', 'V', 'B', 'N', 0, 0
-};
-
-char hilkbd_ctrlmap[] = {
- 0, '`', '\034', ESC, 0, DEL, 0, 0,
- '\n', '\t', 0, 0, 0, 0, 0, 0,
- 0, '\n', 0, 0, 0, 0, 0, 0,
- 0, '\t', 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, '\b', 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- ESC, '\r', 0, '\n', '0', '.', ',', '+',
- '1', '2', '3', '-', '4', '5', '6', '*',
- '7', '8', '9', '/', 'E', '(', ')', '\036',
- '1', '2', '3', '4', '5', '6', '7', '8',
- '9', '0', '-', '=', '\033', '\035', ';', '\'',
- ',', '.', '/', '\040', '\017', '\020', '\013', '\014',
- '\021', '\027', '\005', '\022', '\024', '\031', '\025', '\011',
- '\001', '\023', '\004', '\006', '\007', '\010', '\012', '\015',
- '\032', '\030', '\003', '\026', '\002', '\016', 0, 0
-};
-
-int
-hilkbd_getc()
-{
- int status, c;
- struct hil_dev *hiladdr = HILADDR;
-
- status = hiladdr->hil_stat;
- if ((status & HIL_DATA_RDY) == 0)
- return(0);
- c = hiladdr->hil_data;
- switch ((status >> HIL_SSHIFT) & HIL_SMASK) {
- case KBD_SHIFT:
- c = hilkbd_shiftmap[c & KBD_CHARMASK];
- break;
- case KBD_CTRL:
- c = hilkbd_ctrlmap[c & KBD_CHARMASK];
- break;
- case KBD_KEY:
- c = hilkbd_keymap[c & KBD_CHARMASK];
- break;
- default:
- c = 0;
- break;
- }
- return(c);
-}
-#endif /* SMALL */
-
-void
-hilkbd_nmi()
-{
- struct hil_dev *hiladdr = HILADDR;
-
- HILWAIT(hiladdr);
- hiladdr->hil_cmd = HIL_CNMT;
- HILWAIT(hiladdr);
- hiladdr->hil_cmd = HIL_CNMT;
- HILWAIT(hiladdr);
- printf("\nboot interrupted\n");
-}
-
-int
-hilkbd_init()
-{
- struct hil_dev *hiladdr = HILADDR;
-
- /*
- * Determine the existence of a HIL keyboard.
- */
- HILWAIT(hiladdr);
- hiladdr->hil_cmd = HIL_READKBDSADR;
- HILDATAWAIT(hiladdr);
- if (hiladdr->hil_data == 0)
- return (0);
-
- HILWAIT(hiladdr);
- hiladdr->hil_cmd = HIL_SETARR;
- HILWAIT(hiladdr);
- hiladdr->hil_data = ar_format(KBD_ARR);
- HILWAIT(hiladdr);
- hiladdr->hil_cmd = HIL_INTON;
-
- return (1);
-}
-#endif /* ITECONSOLE && HIL_KEYBOARD */
diff --git a/sys/arch/hp300/stand/common/hpib.c b/sys/arch/hp300/stand/common/hpib.c
deleted file mode 100644
index 7064ebd16fb..00000000000
--- a/sys/arch/hp300/stand/common/hpib.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/* $OpenBSD: hpib.c,v 1.5 2011/08/18 20:02:58 miod Exp $ */
-/* $NetBSD: hpib.c,v 1.2 1997/05/12 07:48:23 thorpej Exp $ */
-
-/*
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)hpib.c 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * HPIB driver
- */
-#include <sys/param.h>
-#include <sys/reboot.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-#include "device.h"
-#include "hpibvar.h"
-
-#include <hp300/dev/dioreg.h>
-
-int internalhpib = IIOV(DIO_IHPIBADDR);
-
-struct hpib_softc hpib_softc[NHPIB];
-
-void
-hpibinit()
-{
- extern struct hp_hw sc_table[];
- struct hp_hw *hw;
- struct hpib_softc *hs;
- int i;
-
- i = 0;
- for (hw = sc_table; i < NHPIB && hw < &sc_table[MAXCTLRS]; hw++) {
- if (!HW_ISHPIB(hw))
- continue;
- hs = &hpib_softc[i];
- hs->sc_addr = hw->hw_kva;
- if (nhpibinit(i) == 0)
- if (fhpibinit(i) == 0)
- continue;
- if (howto & RB_ASKNAME)
- printf("hpib%d at sc%d\n", i, hw->hw_sc);
- hw->hw_ctrl = i;
- hs->sc_alive = 1;
- i++;
- }
-}
-
-int
-hpibalive(int unit)
-{
- if (unit >= NHPIB || hpib_softc[unit].sc_alive == 0)
- return (0);
- return (1);
-}
-
-int
-hpibid(int unit, int slave)
-{
- short id;
- int rv;
-
- if (hpib_softc[unit].sc_type == HPIBC)
- rv = fhpibrecv(unit, 31, slave, (char *)&id, 2);
- else
- rv = nhpibrecv(unit, 31, slave, (char *)&id, 2);
- if (rv != 2)
- return (0);
- return (id);
-}
-
-int
-hpibsend(int unit, int slave, int sec, void *buf, int cnt)
-{
- if (hpib_softc[unit].sc_type == HPIBC)
- return (fhpibsend(unit, slave, sec, (char *)buf, cnt));
- else
- return (nhpibsend(unit, slave, sec, (char *)buf, cnt));
-}
-
-int
-hpibrecv(int unit, int slave, int sec, void *buf, int cnt)
-{
- if (hpib_softc[unit].sc_type == HPIBC)
- return (fhpibrecv(unit, slave, sec, (char *)buf, cnt));
- else
- return (nhpibrecv(unit, slave, sec, (char *)buf, cnt));
-}
-
-int
-hpibswait(int unit, int slave)
-{
- int timo = 1000000;
- int (*poll)(int);
-
- slave = 0x80 >> slave;
- if (hpib_softc[unit].sc_type == HPIBC)
- poll = fhpibppoll;
- else
- poll = nhpibppoll;
- while (((*poll)(unit) & slave) == 0)
- if (--timo == 0)
- break;
- if (timo == 0)
- return (-1);
- return (0);
-}
-
-void
-hpibgo(int unit, int slave, int sec, void *addr, int count, int flag)
-{
- if (hpib_softc[unit].sc_type == HPIBC) {
- if (flag == F_READ)
- fhpibrecv(unit, slave, sec, (char *)addr, count);
- else
- fhpibsend(unit, slave, sec, (char *)addr, count);
- } else {
- if (flag == F_READ)
- nhpibrecv(unit, slave, sec, (char *)addr, count);
- else
- nhpibsend(unit, slave, sec, (char *)addr, count);
- }
-}
diff --git a/sys/arch/hp300/stand/common/if_le.c b/sys/arch/hp300/stand/common/if_le.c
deleted file mode 100644
index 97bbd4a1dd0..00000000000
--- a/sys/arch/hp300/stand/common/if_le.c
+++ /dev/null
@@ -1,601 +0,0 @@
-/* $OpenBSD: if_le.c,v 1.8 2011/08/18 20:02:58 miod Exp $ */;
-/* $NetBSD: if_le.c,v 1.9 1997/01/30 10:32:54 thorpej Exp $ */
-
-/*
- * Copyright (c) 1993 Adam Glass
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Adam Glass.
- * 4. The name of the Author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/types.h>
-
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-
-#include <lib/libsa/stand.h>
-#include <lib/libsa/netif.h>
-
-#include "samachdep.h"
-#include "device.h"
-#include "if_lereg.h"
-
-#ifndef NLE
-#define NLE 1
-#endif
-
-#ifdef LE_DEBUG
-int le_debug = 0;
-#endif
-
-#define ETHER_MIN_LEN 64
-#define ETHER_MAX_LEN 1518
-#define ETHER_ADDR_LEN 6
-
-int le_probe(struct netif *, void *);
-int le_match(struct netif *, void *);
-void le_init(struct iodesc *, void *);
-int le_get(struct iodesc *, void *, size_t, time_t);
-int le_put(struct iodesc *, void *, size_t);
-void le_end(struct netif *);
-
-struct le_sel {
- int le_id;
- int le_regs;
- int le_mem;
- int le_nvram;
- int le_heat;
- int le_bonus;
-} le0conf[] = {
-/* offsets for: ID REGS MEM NVRAM le_heat le_bonus*/
-{ 0, 0x4000, 0x8000, 0xC008, 1, 10 }
-};
-
-extern struct netif_stats le_stats[];
-
-struct netif_dif le_ifs[] = {
-/* dif_unit dif_nsel dif_stats dif_private */
-{ 0, nitems(le0conf),&le_stats[0], le0conf, },
-};
-
-struct netif_stats le_stats[nitems(le_ifs)];
-
-struct netif_driver le_driver = {
- "le", /* netif_bname */
- le_match, /* netif_match */
- le_probe, /* netif_probe */
- le_init, /* netif_init */
- le_get, /* netif_get */
- le_put, /* netif_put */
- le_end, /* netif_end */
- le_ifs, /* netif_ifs */
- nitems(le_ifs) /* netif_nifs */
-};
-
-struct le_softc {
- struct lereg0 *sc_r0; /* DIO registers */
- struct lereg1 *sc_r1; /* LANCE registers */
- void *sc_mem;
- struct init_block *sc_init;
- struct mds *sc_rd, *sc_td;
- u_char *sc_rbuf, *sc_tbuf;
- int sc_next_rd, sc_next_td;
- u_char sc_addr[ETHER_ADDR_LEN];
-} le_softc[NLE];
-
-static inline void
-lewrcsr(struct le_softc *sc, u_short port, u_short val)
-{
- struct lereg0 *ler0 = sc->sc_r0;
- struct lereg1 *ler1 = sc->sc_r1;
-
- do {
- ler1->ler1_rap = port;
- } while ((ler0->ler0_status & LE_ACK) == 0);
- do {
- ler1->ler1_rdp = val;
- } while ((ler0->ler0_status & LE_ACK) == 0);
-}
-
-static inline u_short
-lerdcsr(struct le_softc *sc, u_short port)
-{
- struct lereg0 *ler0 = sc->sc_r0;
- struct lereg1 *ler1 = sc->sc_r1;
- u_short val;
-
- do {
- ler1->ler1_rap = port;
- } while ((ler0->ler0_status & LE_ACK) == 0);
- do {
- val = ler1->ler1_rdp;
- } while ((ler0->ler0_status & LE_ACK) == 0);
- return (val);
-}
-
-void leinit(void);
-void lememinit(struct le_softc *);
-void le_error(int, char *, u_short);
-int le_poll(struct iodesc *, void *, int);
-void le_reset(int, u_char *);
-
-void
-leinit()
-{
- extern struct hp_hw sc_table[];
- struct hp_hw *hw;
- struct le_softc *sc;
- struct le_sel *sels;
- int i, n;
- char *cp;
-
- i = 0;
-
- for (hw = sc_table; i < NLE && hw < &sc_table[MAXCTLRS]; hw++) {
-#ifdef LE_DEBUG
- if (le_debug)
- printf("found type %x\n", hw->hw_type);
-#endif
-
-#if 0
- if (!HW_ISDEV(hw, D_LAN))
- continue;
-#endif
-
- sels = (struct le_sel *)le_ifs[i].dif_private;
-
- sc = &le_softc[i];
- sc->sc_r0 = (struct lereg0 *)(sels->le_id + (int)hw->hw_kva);
-
- if (sc->sc_r0->ler0_id != LEID)
- continue;
-
- sc->sc_r1 = (struct lereg1 *)(sels->le_regs + (int)hw->hw_kva);
- sc->sc_mem = (struct lereg2 *)(sels->le_mem + (int)hw->hw_kva);
-
-#ifdef LE_DEBUG
- if (le_debug)
- printf("le%d: DIO=%x regs=%x mem=%x\n",
- i, sc->sc_r0, sc->sc_r1, sc->sc_mem);
-#endif
-
- /*
- * Read the ethernet address off the board, one nibble at a time.
- */
- cp = (char *)(sels->le_nvram + (int)hw->hw_kva);
- for (n = 0; n < sizeof(sc->sc_addr); n++) {
- sc->sc_addr[n] = (*++cp & 0xF) << 4;
- cp++;
- sc->sc_addr[n] |= *++cp & 0xF;
- cp++;
- }
-#ifdef LE_DEBUG
- if (le_debug)
- printf("le%d at sc%d physical address %s\n",
- i, hw->hw_sc, ether_sprintf(sc->sc_addr));
-#endif
- hw->hw_ctrl = i;
- i++;
- }
-}
-
-int
-le_match(struct netif *nif, void *machdep_hint)
-{
- struct le_sel *sels;
- char *name = machdep_hint;
- int rv = 0;
-
- if (nif->nif_sel < le_ifs[nif->nif_unit].dif_nsel) {
- sels = (struct le_sel *)le_ifs[nif->nif_unit].dif_private;
- rv = sels[nif->nif_sel].le_heat;
- if (name && !strncmp(le_driver.netif_bname, name, 2))
- rv += sels[nif->nif_sel].le_bonus;
- }
-#ifdef LE_DEBUG
- if (le_debug)
- printf("le%d: sel %d --> %d\n", nif->nif_unit, nif->nif_sel,
- rv);
-#endif
- return rv;
-}
-
-int
-le_probe(struct netif *nif, void *machdep_hint)
-{
-
- /* the set unit is the current unit */
-#ifdef LE_DEBUG
- if (le_debug)
- printf("le%d.%d: le_probe called\n", nif->nif_unit, nif->nif_sel);
-#endif
- /* XXX reset controller */
- return 0;
-}
-
-void
-le_error(int unit, char *str, u_short stat)
-{
-
- if (stat & LE_BABL)
- panic("le%d: been babbling, found by '%s'", unit, str);
- if (stat & LE_CERR)
- le_stats[unit].collision_error++;
- if (stat & LE_MISS)
- le_stats[unit].missed++;
- if (stat & LE_MERR) {
- panic("le%d: memory error in '%s'", unit, str);
- }
-}
-
-#define LANCE_ADDR(sc, a) \
- ((u_long)(a) - (u_long)sc->sc_mem)
-
-/* LANCE initialization block set up. */
-void
-lememinit(struct le_softc *sc)
-{
- int i;
- void *mem;
- u_long a;
-
- /*
- * At this point we assume that the memory allocated to the Lance is
- * quadword aligned. If it isn't then the initialisation is going
- * fail later on.
- */
- mem = sc->sc_mem;
-
- sc->sc_init = mem;
- sc->sc_init->mode = LE_NORMAL;
- for (i = 0; i < ETHER_ADDR_LEN; i++)
- sc->sc_init->padr[i] = sc->sc_addr[i^1];
- sc->sc_init->ladrf[0] = sc->sc_init->ladrf[1] = 0;
- mem += sizeof(struct init_block);
-
- sc->sc_rd = mem;
- a = LANCE_ADDR(sc, mem);
- sc->sc_init->rdra = a;
- sc->sc_init->rlen = ((a >> 16) & 0xff) | (RLEN << 13);
- mem += NRBUF * sizeof(struct mds);
-
- sc->sc_td = mem;
- a = LANCE_ADDR(sc, mem);
- sc->sc_init->tdra = a;
- sc->sc_init->tlen = ((a >> 16) & 0xff) | (TLEN << 13);
- mem += NTBUF * sizeof(struct mds);
-
- /*
- * Set up receive ring descriptors.
- */
- sc->sc_rbuf = mem;
- for (i = 0; i < NRBUF; i++) {
- a = LANCE_ADDR(sc, mem);
- sc->sc_rd[i].addr = a;
- sc->sc_rd[i].flags = ((a >> 16) & 0xff) | LE_OWN;
- sc->sc_rd[i].bcnt = -BUFSIZE;
- sc->sc_rd[i].mcnt = 0;
- mem += BUFSIZE;
- }
-
- /*
- * Set up transmit ring descriptors.
- */
- sc->sc_tbuf = mem;
- for (i = 0; i < NTBUF; i++) {
- a = LANCE_ADDR(sc, mem);
- sc->sc_td[i].addr = a;
- sc->sc_td[i].flags = ((a >> 16) & 0xff);
- sc->sc_td[i].bcnt = 0xf000;
- sc->sc_td[i].mcnt = 0;
- mem += BUFSIZE;
- }
-}
-
-void
-le_reset(int unit, u_char *myea)
-{
- struct le_softc *sc = &le_softc[unit];
- u_long a;
- int timo = 100000;
-
-#ifdef LE_DEBUG
- if (le_debug) {
- printf("le%d: le_reset called\n", unit);
- printf(" r0=%x, r1=%x, mem=%x, addr=%x:%x:%x:%x:%x:%x\n",
- sc->sc_r0, sc->sc_r1, sc->sc_mem,
- sc->sc_addr[0], sc->sc_addr[1], sc->sc_addr[2],
- sc->sc_addr[3], sc->sc_addr[4], sc->sc_addr[5]);
- }
-#endif
- lewrcsr(sc, 0, LE_STOP);
- for (timo = 1000; timo; timo--);
-
- sc->sc_next_rd = sc->sc_next_td = 0;
-
- /* Set up LANCE init block. */
- lememinit(sc);
-
- if (myea)
- bcopy(sc->sc_addr, myea, ETHER_ADDR_LEN);
-
- /* Turn on byte swapping. */
- lewrcsr(sc, 3, LE_BSWP);
-
- /* Give LANCE the physical address of its init block. */
- a = LANCE_ADDR(sc, sc->sc_init);
- lewrcsr(sc, 1, a);
- lewrcsr(sc, 2, (a >> 16) & 0xff);
-
-#ifdef LE_DEBUG
- if (le_debug)
- printf("le%d: before init\n", unit);
-#endif
-
- /* Try to initialize the LANCE. */
- lewrcsr(sc, 0, LE_INIT);
-
- /* Wait for initialization to finish. */
- for (timo = 100000; timo; timo--)
- if (lerdcsr(sc, 0) & LE_IDON)
- break;
-
- if (lerdcsr(sc, 0) & LE_IDON) {
- /* Start the LANCE. */
- lewrcsr(sc, 0, LE_INEA | LE_STRT | LE_IDON);
- } else
- printf("le%d: card failed to initialize\n", unit);
-
-#ifdef LE_DEBUG
- if (le_debug)
- printf("le%d: after init\n", unit);
-#endif
-}
-
-int
-le_poll(struct iodesc *desc, void *pkt, int len)
-{
-#if 0
- struct netif *nif = desc->io_netif;
- int unit = nif->nif_unit;
-#else
- int unit = 0;
-#endif
- struct le_softc *sc = &le_softc[unit];
- int length;
- volatile struct mds *cdm;
- int stat;
-
-#ifdef LE_DEBUG
- if (/*le_debug*/0)
- printf("le%d: le_poll called. next_rd=%d\n", unit, sc->sc_next_rd);
-#endif
- stat = lerdcsr(sc, 0);
- lewrcsr(sc, 0, stat & (LE_BABL | LE_MISS | LE_MERR | LE_RINT));
- cdm = &sc->sc_rd[sc->sc_next_rd];
- if (cdm->flags & LE_OWN)
- return 0;
-#ifdef LE_DEBUG
- if (le_debug) {
- printf("next_rd %d\n", sc->sc_next_rd);
- printf("cdm->flags %x\n", cdm->flags);
- printf("cdm->bcnt %x, cdm->mcnt %x\n", cdm->bcnt, cdm->mcnt);
- printf("cdm->rbuf msg %d buf %d\n", cdm->mcnt, -cdm->bcnt );
- }
-#endif
- if (stat & (LE_BABL | LE_CERR | LE_MISS | LE_MERR))
- le_error(unit, "le_poll", stat);
- if (cdm->flags & (LE_FRAM | LE_OFLO | LE_CRC | LE_RBUFF)) {
- printf("le%d_poll: rmd status 0x%x\n", unit, cdm->flags);
- length = 0;
- goto cleanup;
- }
- if ((cdm->flags & (LE_STP|LE_ENP)) != (LE_STP|LE_ENP))
- panic("le_poll: chained packet");
-
- length = cdm->mcnt;
-#ifdef LE_DEBUG
- if (le_debug)
- printf("le_poll: length %d\n", length);
-#endif
- if (length >= BUFSIZE) {
- length = 0;
- panic("csr0 when bad things happen: %x", stat);
- goto cleanup;
- }
- if (!length)
- goto cleanup;
- length -= 4;
-
- if (length > 0) {
- /*
- * If the length of the packet is greater than the size of the
- * buffer, we have to truncate it, to avoid Bad Things.
- * XXX Is this the right thing to do?
- */
- if (length > len)
- length = len;
-
- bcopy(sc->sc_rbuf + (BUFSIZE * sc->sc_next_rd), pkt, length);
- }
-
-cleanup:
- cdm->mcnt = 0;
- cdm->flags |= LE_OWN;
- if (++sc->sc_next_rd >= NRBUF)
- sc->sc_next_rd = 0;
-#ifdef LE_DEBUG
- if (le_debug)
- printf("new next_rd %d\n", sc->sc_next_rd);
-#endif
-
- return length;
-}
-
-int
-le_put(struct iodesc *desc, void *pkt, size_t len)
-{
-#if 0
- struct netif *nif = desc->io_netif;
- int unit = nif->nif_unit;
-#else
- int unit = 0;
-#endif
- struct le_softc *sc = &le_softc[unit];
- volatile struct mds *cdm;
- int timo, i, stat;
-
- le_put_loop:
- timo = 100000;
-
-#ifdef LE_DEBUG
- if (le_debug)
- printf("le%d: le_put called. next_td=%d\n", unit, sc->sc_next_td);
-#endif
- stat = lerdcsr(sc, 0);
- lewrcsr(sc, 0, stat & (LE_BABL | LE_MISS | LE_MERR | LE_TINT));
- if (stat & (LE_BABL | LE_CERR | LE_MISS | LE_MERR))
- le_error(unit, "le_put(way before xmit)", stat);
- cdm = &sc->sc_td[sc->sc_next_td];
- i = 0;
-#if 0
- while (cdm->flags & LE_OWN) {
- if ((i % 100) == 0)
- printf("le%d: output buffer busy - flags=%x\n",
- unit, cdm->flags);
- if (i++ > 500) break;
- }
- if (cdm->flags & LE_OWN)
- getchar();
-#else
- while (cdm->flags & LE_OWN);
-#endif
- bcopy(pkt, sc->sc_tbuf + (BUFSIZE * sc->sc_next_td), len);
- if (len < ETHER_MIN_LEN)
- cdm->bcnt = -ETHER_MIN_LEN;
- else
- cdm->bcnt = -len;
- cdm->mcnt = 0;
- cdm->flags |= LE_OWN | LE_STP | LE_ENP;
- stat = lerdcsr(sc, 0);
- if (stat & (LE_BABL | LE_CERR | LE_MISS | LE_MERR))
- le_error(unit, "le_put(before xmit)", stat);
- lewrcsr(sc, 0, LE_TDMD);
- stat = lerdcsr(sc, 0);
- if (stat & (LE_BABL | LE_CERR | LE_MISS | LE_MERR))
- le_error(unit, "le_put(after xmit)", stat);
- do {
- if (--timo == 0) {
- printf("le%d: transmit timeout, stat = 0x%x\n",
- unit, stat);
- if (stat & LE_SERR)
- le_error(unit, "le_put(timeout)", stat);
- if (stat & LE_INIT) {
- printf("le%d: reset and retry packet\n", unit);
- lewrcsr(sc, 0, LE_TINT); /* sanity */
- le_init(desc, NULL);
- goto le_put_loop;
- }
- break;
- }
- stat = lerdcsr(sc, 0);
- } while ((stat & LE_TINT) == 0);
- lewrcsr(sc, 0, LE_TINT);
- if (stat & (LE_BABL |/* LE_CERR |*/ LE_MISS | LE_MERR)) {
- printf("le_put: xmit error, buf %d\n", sc->sc_next_td);
- le_error(unit, "le_put(xmit error)", stat);
- }
- if (++sc->sc_next_td >= NTBUF)
- sc->sc_next_td = 0;
- if (cdm->flags & LE_DEF)
- le_stats[unit].deferred++;
- if (cdm->flags & LE_ONE)
- le_stats[unit].collisions++;
- if (cdm->flags & LE_MORE)
- le_stats[unit].collisions+=2;
- if (cdm->flags & LE_ERR) {
- printf("le%d: transmit error, error = 0x%x\n", unit,
- cdm->mcnt);
- return -1;
- }
-#ifdef LE_DEBUG
- if (le_debug) {
- printf("le%d: le_put() successful: sent %d\n", unit, len);
- printf("le%d: le_put(): flags: %x mcnt: %x\n", unit,
- (unsigned int) cdm->flags,
- (unsigned int) cdm->mcnt);
- }
-#endif
- return len;
-}
-
-
-int
-le_get(struct iodesc *desc, void *pkt, size_t len, time_t timeout)
-{
- time_t t;
- int cc;
-
- t = getsecs();
- cc = 0;
- while (((getsecs() - t) < timeout) && !cc) {
- cc = le_poll(desc, pkt, len);
- }
- return cc;
-}
-
-void
-le_init(struct iodesc *desc, void *machdep_hint)
-{
- struct netif *nif = desc->io_netif;
- int unit = nif->nif_unit;
-
- /* Get machine's common ethernet interface. This is done in leinit() */
- /* machdep_common_ether(myea); */
- leinit();
-
-#ifdef LE_DEBUG
- if (le_debug)
- printf("le%d: le_init called\n", unit);
-#endif
- unit = 0;
- le_reset(unit, desc->myea);
-}
-
-void
-le_end(struct netif *nif)
-{
- int unit = nif->nif_unit;
-
-#ifdef LE_DEBUG
- if (le_debug)
- printf("le%d: le_end called\n", unit);
-#endif
-
- lewrcsr(&le_softc[unit], 0, LE_STOP);
-}
diff --git a/sys/arch/hp300/stand/common/ite.c b/sys/arch/hp300/stand/common/ite.c
deleted file mode 100644
index 0b8032a3ce0..00000000000
--- a/sys/arch/hp300/stand/common/ite.c
+++ /dev/null
@@ -1,344 +0,0 @@
-/* $OpenBSD: ite.c,v 1.11 2011/08/18 20:02:58 miod Exp $ */
-/* $NetBSD: ite.c,v 1.12 1997/01/30 10:32:55 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: ite.c 1.24 93/06/25$
- *
- * @(#)ite.c 8.1 (Berkeley) 7/8/93
- */
-
-/*
- * Standalone Internal Terminal Emulator (CRT and keyboard)
- */
-
-#ifdef ITECONSOLE
-
-#include <sys/param.h>
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/sgcreg.h>
-#include <hp300/dev/diofbreg.h>
-#include <dev/ic/stireg.h>
-
-#include "samachdep.h"
-#include "consdefs.h"
-#include "device.h"
-#include "itevar.h"
-#include "kbdvar.h"
-
-void itecheckwrap(struct ite_data *, struct itesw *);
-void iteconfig(void);
-void ite_clrtoeol(struct ite_data *, struct itesw *, int, int);
-
-#define GID_STI 0x100 /* any value which is not a DIO fb, really */
-
-struct itesw itesw[] = {
- { GID_TOPCAT,
- NULL, topcat_init,
- ite_dio_clear, ite_dio_putc8bpp, ite_dio_cursor, ite_dio_scroll },
-
- { GID_GATORBOX,
- NULL, gbox_init,
- ite_dio_clear, ite_dio_putc8bpp, ite_dio_cursor, gbox_scroll },
-
- { GID_RENAISSANCE,
- NULL, rbox_init,
- ite_dio_clear, ite_dio_putc8bpp, ite_dio_cursor, ite_dio_scroll },
-
- { GID_LRCATSEYE,
- NULL, topcat_init,
- ite_dio_clear, ite_dio_putc8bpp, ite_dio_cursor, ite_dio_scroll },
-
- { GID_HRCCATSEYE,
- NULL, topcat_init,
- ite_dio_clear, ite_dio_putc8bpp, ite_dio_cursor, ite_dio_scroll },
-
- { GID_HRMCATSEYE,
- NULL, topcat_init,
- ite_dio_clear, ite_dio_putc8bpp, ite_dio_cursor, ite_dio_scroll },
-
- { GID_DAVINCI,
- NULL, dvbox_init,
- ite_dio_clear, ite_dio_putc8bpp, ite_dio_cursor, ite_dio_scroll },
-
- { GID_HYPERION,
- NULL, hyper_init,
- ite_dio_clear, ite_dio_putc1bpp, ite_dio_cursor, ite_dio_scroll },
-
- { GID_TIGER,
- NULL, tvrx_init,
- ite_dio_clear, ite_dio_putc1bpp, ite_dio_cursor, ite_dio_scroll },
-
- { GID_FB3X2_A,
- sti_dio_probe, sti_iteinit_dio,
- sti_clear, sti_putc, sti_cursor, sti_scroll },
-
- { GID_FB3X2_B,
- sti_dio_probe, sti_iteinit_dio,
- sti_clear, sti_putc, sti_cursor, sti_scroll },
-
- { GID_STI,
- NULL, sti_iteinit_sgc,
- sti_clear, sti_putc, sti_cursor, sti_scroll }
-};
-
-/* these guys need to be in initialized data */
-int itecons = -1;
-struct ite_data ite_data[NITE] = { { 0 } };
-
-/*
- * Locate all bitmapped displays
- */
-void
-iteconfig()
-{
- extern struct hp_hw sc_table[];
- int dtype, fboff, slotno, i;
- u_int8_t *va;
- struct hp_hw *hw;
- struct diofbreg *fb;
- struct ite_data *ip;
-
- i = 0;
- for (hw = sc_table; hw < &sc_table[MAXCTLRS]; hw++) {
- if (!HW_ISDEV(hw, D_BITMAP))
- continue;
- fb = (struct diofbreg *)hw->hw_kva;
- /* XXX: redundent but safe */
- if (badaddr((caddr_t)fb) || fb->id != GRFHWID)
- continue;
- for (dtype = 0; dtype < nitems(itesw); dtype++)
- if (itesw[dtype].ite_hwid == fb->fbid)
- break;
- if (dtype == nitems(itesw))
- continue;
- if (i >= NITE)
- break;
- ip = &ite_data[i];
- ip->scode = hw->hw_sc;
- ip->isw = &itesw[dtype];
- ip->regbase = (caddr_t)fb;
- fboff = (fb->fbomsb << 8) | fb->fbolsb;
- ip->fbbase = (caddr_t) (*((u_char *)ip->regbase+fboff) << 16);
- /* DIO II: FB offset is relative to select code space */
- if (DIO_ISDIOII(ip->scode))
- ip->fbbase += (int)ip->regbase;
- ip->fbwidth = fb->fbwmsb << 8 | fb->fbwlsb;
- ip->fbheight = fb->fbhmsb << 8 | fb->fbhlsb;
- ip->dwidth = fb->dwmsb << 8 | fb->dwlsb;
- ip->dheight = fb->dhmsb << 8 | fb->dhlsb;
- /*
- * XXX some displays (e.g. the davinci) appear
- * to return a display height greater than the
- * returned FB height. Guess we should go back
- * to getting the display dimensions from the
- * fontrom...
- */
- if (ip->dwidth > ip->fbwidth)
- ip->dwidth = ip->fbwidth;
- if (ip->dheight > ip->fbheight)
- ip->dheight = ip->fbheight;
- /* confirm hardware is what we think it is */
- if (itesw[dtype].ite_probe != NULL &&
- (*itesw[dtype].ite_probe)(ip) != 0)
- continue;
- ip->alive = 1;
- i++;
- }
-
- /*
- * Now probe for SGC frame buffers.
- */
- switch (machineid) {
- case HP_400:
- case HP_425:
- case HP_433:
- break;
- default:
- return;
- }
-
- /* SGC frame buffers can only be STI... */
- for (dtype = 0; dtype < nitems(itesw); dtype++)
- if (itesw[dtype].ite_hwid == GID_STI)
- break;
- if (dtype == nitems(itesw))
- return;
-
- for (slotno = 0; slotno < SGC_NSLOTS; slotno++) {
- va = (u_int8_t *)IIOV(SGC_BASE + (slotno * SGC_DEVSIZE));
-
- /* Check to see if hardware exists. */
- if (badaddr(va) != 0)
- continue;
-
- /* Check hardware. */
- if (va[3] == STI_DEVTYPE1) {
- if (i >= NITE)
- break;
- ip = &ite_data[i];
- ip->scode = slotno;
- ip->isw = &itesw[dtype];
- ip->regbase = (caddr_t)GRFIADDR; /* to get CN_MIDPRI */
- /* ...and do not need an ite_probe() check */
- ip->alive = 1;
- i++;
- /* we only support one SGC frame buffer at the moment */
- break;
- }
- }
-}
-
-void
-iteprobe(struct consdev *cp)
-{
- int ite;
- struct ite_data *ip;
- int unit, pri;
-
- iteconfig();
- unit = -1;
- pri = CN_DEAD;
- for (ite = 0; ite < NITE; ite++) {
- ip = &ite_data[ite];
- if (ip->alive == 0)
- continue;
- if ((int)ip->regbase == GRFIADDR) {
- pri = CN_MIDPRI;
- unit = ite;
- } else if (unit < 0) {
- pri = CN_LOWPRI;
- unit = ite;
- }
- }
- cp->cn_dev = unit;
- cp->cn_pri = pri;
-}
-
-void
-iteinit(struct consdev *cp)
-{
- int ite = cp->cn_dev;
- struct ite_data *ip;
-
- ip = &ite_data[ite];
-
- ip->curx = 0;
- ip->cury = 0;
- ip->cursorx = 0;
- ip->cursory = 0;
-
- (*ip->isw->ite_init)(ip);
- (*ip->isw->ite_cursor)(ip, DRAW_CURSOR);
-
- itecons = ite;
- kbdinit();
-}
-
-/* ARGSUSED */
-void
-iteputchar(dev_t dev, int c)
-{
- struct ite_data *ip = &ite_data[itecons];
- struct itesw *sp = ip->isw;
-
- c &= 0x7F;
- switch (c) {
-
- case '\n':
- if (++ip->cury == ip->rows) {
- ip->cury--;
- (*sp->ite_scroll)(ip);
- ite_clrtoeol(ip, sp, ip->cury, 0);
- }
- else
- (*sp->ite_cursor)(ip, MOVE_CURSOR);
- break;
-
- case '\r':
- ip->curx = 0;
- (*sp->ite_cursor)(ip, MOVE_CURSOR);
- break;
-
- case '\b':
- if (--ip->curx < 0)
- ip->curx = 0;
- else
- (*sp->ite_cursor)(ip, MOVE_CURSOR);
- break;
-
- default:
- if (c < ' ' || c == 0177)
- break;
- (*sp->ite_putc)(ip, c, ip->cury, ip->curx);
- (*sp->ite_cursor)(ip, DRAW_CURSOR);
- itecheckwrap(ip, sp);
- break;
- }
-}
-
-void
-itecheckwrap(struct ite_data *ip, struct itesw *sp)
-{
- if (++ip->curx == ip->cols) {
- ip->curx = 0;
- if (++ip->cury == ip->rows) {
- --ip->cury;
- (*sp->ite_scroll)(ip);
- ite_clrtoeol(ip, sp, ip->cury, 0);
- return;
- }
- }
- (*sp->ite_cursor)(ip, MOVE_CURSOR);
-}
-
-void
-ite_clrtoeol(struct ite_data *ip, struct itesw *sp, int y, int x)
-{
- (*sp->ite_clear)(ip, y, x, 1, ip->cols - x);
- (*sp->ite_cursor)(ip, DRAW_CURSOR);
-}
-
-/* ARGSUSED */
-int
-itegetchar(dev_t dev)
-{
-#ifdef SMALL
- return (0);
-#else
- return (kbdgetc());
-#endif
-}
-#endif
diff --git a/sys/arch/hp300/stand/common/ite_dv.c b/sys/arch/hp300/stand/common/ite_dv.c
deleted file mode 100644
index 0dbbfbe5fd3..00000000000
--- a/sys/arch/hp300/stand/common/ite_dv.c
+++ /dev/null
@@ -1,202 +0,0 @@
-/* $OpenBSD: ite_dv.c,v 1.6 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: ite_dv.c,v 1.8 1996/03/03 04:23:35 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: ite_dv.c 1.2 92/01/20$
- *
- * @(#)ite_dv.c 8.1 (Berkeley) 6/10/93
- */
-
-#ifdef ITECONSOLE
-
-#include <sys/param.h>
-
-#include "samachdep.h"
-#include "itevar.h"
-#include "grf_dvreg.h"
-
-#define REGBASE ((struct dvboxfb *)(ip->regbase))
-
-void dvbox_windowmove(struct ite_data *, int, int, int, int, int, int, int);
-void dv_reset(struct dvboxfb *);
-
-void
-dvbox_init(struct ite_data *ip)
-{
- int i;
-
- ip->bmv = dvbox_windowmove;
- dv_reset((struct dvboxfb *)ip->regbase);
- DELAY(4000);
-
- /*
- * Turn on frame buffer, turn on overlay planes, set replacement
- * rule, enable top overlay plane writes for ite, disable all frame
- * buffer planes, set byte per pixel, and display frame buffer 0.
- * Lastly, turn on the box.
- */
- REGBASE->interrupt = 0x04;
- REGBASE->drive = 0x10;
- REGBASE->rep_rule = RR_COPY << 4 | RR_COPY;
- REGBASE->opwen = 0x01;
- REGBASE->fbwen = 0x0;
- REGBASE->fold = 0x01;
- REGBASE->vdrive = 0x0;
- REGBASE->dispen = 0x01;
-
- /*
- * Video enable top overlay plane.
- */
- REGBASE->opvenp = 0x01;
- REGBASE->opvens = 0x01;
-
- /*
- * Make sure that overlay planes override frame buffer planes.
- */
- REGBASE->ovly0p = 0x0;
- REGBASE->ovly0s = 0x0;
- REGBASE->ovly1p = 0x0;
- REGBASE->ovly1s = 0x0;
- REGBASE->fv_trig = 0x1;
- DELAY(400);
-
- /*
- * Setup the overlay colormaps. Need to set the 0,1 (black/white)
- * color for both banks.
- */
-
- for (i = 0; i <= 1; i++) {
- REGBASE->cmapbank = i;
- REGBASE->rgb[0].red = 0x00;
- REGBASE->rgb[0].green = 0x00;
- REGBASE->rgb[0].blue = 0x00;
- REGBASE->rgb[1].red = 0xFF;
- REGBASE->rgb[1].green = 0xFF;
- REGBASE->rgb[1].blue = 0xFF;
- }
- REGBASE->cmapbank = 0;
-
- db_waitbusy(ip->regbase);
-
- ite_fontinfo(ip);
- ite_fontinit8bpp(ip);
-
- /*
- * Clear the (visible) framebuffer.
- */
- dvbox_windowmove(ip, 0, 0, 0, 0, ip->dheight, ip->dwidth, RR_CLEAR);
- db_waitbusy(ip->regbase);
-
- /*
- * Stash the inverted cursor.
- */
- dvbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
- ip->cblanky, ip->cblankx, ip->ftheight,
- ip->ftwidth, RR_COPYINVERTED);
- db_waitbusy(ip->regbase);
-}
-
-void
-dvbox_windowmove(struct ite_data *ip, int sy, int sx, int dy, int dx, int h,
- int w, int func)
-{
- struct dvboxfb *dp = REGBASE;
- if (h == 0 || w == 0)
- return;
-
- db_waitbusy(ip->regbase);
- dp->rep_rule = func << 4 | func;
- dp->source_y = sy;
- dp->source_x = sx;
- dp->dest_y = dy;
- dp->dest_x = dx;
- dp->wheight = h;
- dp->wwidth = w;
- dp->wmove = 1;
-}
-
-void
-dv_reset(struct dvboxfb *dbp)
-{
- dbp->reset = 0x80;
- DELAY(400);
-
- dbp->interrupt = 0x04;
- dbp->en_scan = 0x01;
- dbp->fbwen = ~0;
- dbp->opwen = ~0;
- dbp->fold = 0x01;
- dbp->drive = 0x01;
- dbp->rep_rule = 0x33;
- dbp->alt_rr = 0x33;
- dbp->zrr = 0x33;
-
- dbp->fbvenp = 0xFF;
- dbp->dispen = 0x01;
- dbp->fbvens = 0x0;
- dbp->fv_trig = 0x01;
- DELAY(400);
- dbp->vdrive = 0x0;
- dbp->zconfig = 0x0;
-
- while (dbp->wbusy & 0x01)
- DELAY(400);
-
- /*
- * Start of missing ROM code.
- */
- dbp->cmapbank = 0;
-
- dbp->red0 = 0;
- dbp->red1 = 0;
- dbp->green0 = 0;
- dbp->green1 = 0;
- dbp->blue0 = 0;
- dbp->blue1 = 0;
-
- dbp->panxh = 0;
- dbp->panxl = 0;
- dbp->panyh = 0;
- dbp->panyl = 0;
- dbp->zoom = 0;
- dbp->cdwidth = 0x50;
- dbp->chstart = 0x52;
- dbp->cvwidth = 0x22;
- dbp->pz_trig = 1;
- /*
- * End of missing ROM code.
- */
-}
-#endif
diff --git a/sys/arch/hp300/stand/common/ite_gb.c b/sys/arch/hp300/stand/common/ite_gb.c
deleted file mode 100644
index 7d55acbfc99..00000000000
--- a/sys/arch/hp300/stand/common/ite_gb.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/* $OpenBSD: ite_gb.c,v 1.5 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: ite_gb.c,v 1.8 1996/03/03 04:23:36 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: ite_gb.c 1.9 92/01/20$
- *
- * @(#)ite_gb.c 8.1 (Berkeley) 6/10/93
- */
-
-#ifdef ITECONSOLE
-
-#include <sys/param.h>
-
-#include "samachdep.h"
-#include "itevar.h"
-#include "itereg.h"
-#include "grf_gbreg.h"
-
-#define REGBASE ((struct gboxfb *)(ip->regbase))
-
-void gbox_windowmove(struct ite_data *, int, int, int, int,
- int, int, int);
-
-void
-gbox_init(struct ite_data *ip)
-{
- ip->bmv = gbox_windowmove;
-
- REGBASE->write_protect = 0x0;
- REGBASE->interrupt = 0x4;
- REGBASE->rep_rule = RR_COPY;
- REGBASE->blink1 = 0xff;
- REGBASE->blink2 = 0xff;
- REGBASE->sec_interrupt = 0x01;
-
- /*
- * Set up the color map entries. We use three entries in the
- * color map. The first, is for black, the second is for
- * white, and the very last entry is for the inverted cursor.
- */
- REGBASE->creg_select = 0x00;
- REGBASE->cmap_red = 0x00;
- REGBASE->cmap_grn = 0x00;
- REGBASE->cmap_blu = 0x00;
- REGBASE->cmap_write = 0x00;
- gbcm_waitbusy(ip->regbase);
-
- REGBASE->creg_select = 0x01;
- REGBASE->cmap_red = 0xFF;
- REGBASE->cmap_grn = 0xFF;
- REGBASE->cmap_blu = 0xFF;
- REGBASE->cmap_write = 0x01;
- gbcm_waitbusy(ip->regbase);
-
- REGBASE->creg_select = 0xFF;
- REGBASE->cmap_red = 0xFF;
- REGBASE->cmap_grn = 0xFF;
- REGBASE->cmap_blu = 0xFF;
- REGBASE->cmap_write = 0x01;
- gbcm_waitbusy(ip->regbase);
-
- ite_fontinfo(ip);
- ite_fontinit8bpp(ip);
-
- /*
- * Clear the display. This used to be before the font unpacking
- * but it crashes. Figure it out later.
- */
- gbox_windowmove(ip, 0, 0, 0, 0, ip->dheight, ip->dwidth, RR_CLEAR);
- tile_mover_waitbusy(ip->regbase);
-
- /*
- * Stash the inverted cursor.
- */
- gbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
- ip->cblanky, ip->cblankx, ip->ftheight,
- ip->ftwidth, RR_COPYINVERTED);
-}
-
-void
-gbox_scroll(struct ite_data *ip)
-{
- tile_mover_waitbusy(ip->regbase);
- REGBASE->write_protect = 0x0;
-
- ite_dio_scroll(ip);
-}
-
-void
-gbox_windowmove(struct ite_data *ip, int sy, int sx, int dy, int dx, int h,
- int w, int mask)
-{
- int src, dest;
-
- src = (sy * 1024) + sx; /* upper left corner in pixels */
- dest = (dy * 1024) + dx;
-
- tile_mover_waitbusy(ip->regbase);
- REGBASE->width = -(w / 4);
- REGBASE->height = -(h / 4);
- if (src < dest)
- REGBASE->rep_rule = MOVE_DOWN_RIGHT|mask;
- else {
- REGBASE->rep_rule = MOVE_UP_LEFT|mask;
- /*
- * Adjust to top of lower right tile of the block.
- */
- src = src + ((h - 4) * 1024) + (w - 4);
- dest= dest + ((h - 4) * 1024) + (w - 4);
- }
- FBBASE[dest] = FBBASE[src];
-}
-#endif
diff --git a/sys/arch/hp300/stand/common/ite_hy.c b/sys/arch/hp300/stand/common/ite_hy.c
deleted file mode 100644
index cc7865770f5..00000000000
--- a/sys/arch/hp300/stand/common/ite_hy.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* $OpenBSD: ite_hy.c,v 1.7 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: ite_hy.c,v 1.3 1996/03/03 04:23:37 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Mark Davies of the Department of Computer
- * Science, Victoria University of Wellington, New Zealand.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: ite_hy.c 1.1 92/01/22$
- *
- * @(#)ite_hy.c 8.1 (Berkeley) 6/10/93
- */
-
-#ifdef ITECONSOLE
-#include <sys/param.h>
-
-#include "samachdep.h"
-#include "itevar.h"
-#include "grf_hyreg.h"
-
-#define REGBASE ((struct hyboxfb *)(ip->regbase))
-
-void
-hyper_init(struct ite_data *ip)
-{
- int width;
-
- ip->bmv = ite_dio_windowmove1bpp;
- ite_fontinfo(ip);
- width = ((ip->ftwidth + 7) / 8) * 8;
- ip->cpl = (ip->fbwidth - ip->dwidth) / width;
- ip->cblanky = ip->fonty + ((128 / ip->cpl) +1) * ip->ftheight;
-
- REGBASE->nblank = 0x05;
-
- /*
- * Clear the framebuffer on all planes.
- */
- ite_dio_windowmove1bpp(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth,
- RR_CLEAR);
-
- ite_fontinit1bpp(ip);
-
- /*
- * Stash the inverted cursor.
- */
- ite_dio_windowmove1bpp(ip, charY(ip, ' '), charX1bpp(ip, ' '),
- ip->cblanky, ip->cblankx, ip->ftheight, ip->ftwidth,
- RR_COPYINVERTED);
-}
-#endif
diff --git a/sys/arch/hp300/stand/common/ite_rb.c b/sys/arch/hp300/stand/common/ite_rb.c
deleted file mode 100644
index f0d4746c23c..00000000000
--- a/sys/arch/hp300/stand/common/ite_rb.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/* $OpenBSD: ite_rb.c,v 1.5 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: ite_rb.c,v 1.8 1996/03/03 04:23:38 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: ite_rb.c 1.6 92/01/20$
- *
- * @(#)ite_rb.c 8.1 (Berkeley) 6/10/93
- */
-
-#ifdef ITECONSOLE
-
-#include <sys/param.h>
-
-#include "samachdep.h"
-#include "itevar.h"
-#include "grf_rbreg.h"
-
-#define REGBASE ((struct rboxfb *)(ip->regbase))
-
-void rbox_windowmove(struct ite_data *, int, int, int, int,
- int, int, int);
-
-void
-rbox_init(struct ite_data *ip)
-{
- int i;
-
- ip->bmv = rbox_windowmove;
-
- rb_waitbusy(ip->regbase);
- DELAY(3000);
-
- REGBASE->interrupt = 0x04;
- REGBASE->display_enable = 0x01;
- REGBASE->video_enable = 0x01;
- REGBASE->drive = 0x01;
- REGBASE->vdrive = 0x0;
-
- ite_fontinfo(ip);
-
- REGBASE->opwen = 0xFF;
-
- /*
- * Clear the framebuffer.
- */
- rbox_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
- rb_waitbusy(ip->regbase);
-
- for(i = 0; i < 16; i++) {
- *(ip->regbase + 0x63c3 + i*4) = 0x0;
- *(ip->regbase + 0x6403 + i*4) = 0x0;
- *(ip->regbase + 0x6803 + i*4) = 0x0;
- *(ip->regbase + 0x6c03 + i*4) = 0x0;
- *(ip->regbase + 0x73c3 + i*4) = 0x0;
- *(ip->regbase + 0x7403 + i*4) = 0x0;
- *(ip->regbase + 0x7803 + i*4) = 0x0;
- *(ip->regbase + 0x7c03 + i*4) = 0x0;
- }
-
- REGBASE->rep_rule = 0x33;
-
- /*
- * I cannot figure out how to make the blink planes stop. So, we
- * must set both colormaps so that when the planes blink, and
- * the secondary colormap is active, we still get text.
- */
- CM1RED[0x00].value = 0x00;
- CM1GRN[0x00].value = 0x00;
- CM1BLU[0x00].value = 0x00;
- CM1RED[0x01].value = 0xFF;
- CM1GRN[0x01].value = 0xFF;
- CM1BLU[0x01].value = 0xFF;
-
- CM2RED[0x00].value = 0x00;
- CM2GRN[0x00].value = 0x00;
- CM2BLU[0x00].value = 0x00;
- CM2RED[0x01].value = 0xFF;
- CM2GRN[0x01].value = 0xFF;
- CM2BLU[0x01].value = 0xFF;
-
- REGBASE->blink = 0x00;
- REGBASE->write_enable = 0x01;
- REGBASE->opwen = 0x00;
-
- ite_fontinit8bpp(ip);
-
- /*
- * Stash the inverted cursor.
- */
- rbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
- ip->cblanky, ip->cblankx, ip->ftheight,
- ip->ftwidth, RR_COPYINVERTED);
-}
-
-void
-rbox_windowmove(struct ite_data *ip, int sy, int sx, int dy, int dx, int h,
- int w, int func)
-{
- struct rboxfb *rp = REGBASE;
- if (h == 0 || w == 0)
- return;
-
- rb_waitbusy(ip->regbase);
- rp->rep_rule = func << 4 | func;
- rp->source_y = sy;
- rp->source_x = sx;
- rp->dest_y = dy;
- rp->dest_x = dx;
- rp->wheight = h;
- rp->wwidth = w;
- rp->wmove = 1;
-}
-#endif
diff --git a/sys/arch/hp300/stand/common/ite_sti.c b/sys/arch/hp300/stand/common/ite_sti.c
deleted file mode 100644
index e035fd7b178..00000000000
--- a/sys/arch/hp300/stand/common/ite_sti.c
+++ /dev/null
@@ -1,358 +0,0 @@
-/* $OpenBSD: ite_sti.c,v 1.2 2011/08/18 20:02:58 miod Exp $ */
-/*
- * Copyright (c) 2006, 2011, Miodrag Vallat
- * Copyright (c) 2000-2003 Michael Shalayeff
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifdef ITECONSOLE
-#include <sys/param.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-#include "consdefs.h"
-#include "itevar.h"
-
-#include <hp300/dev/dioreg.h>
-#include <hp300/dev/sgcreg.h>
-#include <hp300/dev/sti_machdep.h>
-#include <dev/ic/stireg.h>
-
-/*
- * sti-specific data not available in the ite_data structure.
- * Since we will only configure one sti display, it is ok to use a global.
- */
-static struct {
- u_int32_t codeptr[STI_CODECNT];
- u_int8_t *code;
- u_int32_t fontbase;
- u_int firstchar, lastchar;
- struct sti_cfg cfg;
- struct sti_ecfg ecfg;
-} sti;
-
-#define parseshort1(addr, ofs) \
- (((addr)[(ofs) + 3] << 8) | ((addr)[(ofs) + 7]))
-#define parseword1(addr, ofs) \
- (((addr)[(ofs) + 3] << 24) | ((addr)[(ofs) + 7] << 16) | \
- ((addr)[(ofs) + 11] << 8) | ((addr)[(ofs) + 15]))
-
-void sti_do_cursor(struct ite_data *);
-void sti_fontinfo(struct ite_data *);
-void sti_init(int);
-void sti_inqcfg(struct sti_inqconfout *);
-void sti_iteinit_common(struct ite_data *);
-
-/* kinda similar to sti_dio_probe() */
-int
-sti_dio_probe(struct ite_data *ip)
-{
- int scode = ip->scode;
- uint8_t *id_reg;
-
- id_reg = (uint8_t *)sctoaddr(scode);
- if (id_reg[DIOII_SIZEOFF] < STI_DIO_SIZE - 1)
- return ENODEV;
-
- id_reg = (uint8_t *)sctoaddr(scode + STI_DIO_SCODE_OFFSET);
- if (id_reg[3] != STI_DEVTYPE1)
- return ENODEV;
-
- return 0;
-}
-
-void
-sti_iteinit_dio(struct ite_data *ip)
-{
- ip->fbbase = (caddr_t)sctoaddr(ip->scode + STI_DIO_SCODE_OFFSET);
- sti_iteinit_common(ip);
-}
-
-void
-sti_iteinit_sgc(struct ite_data *ip)
-{
- ip->fbbase = (caddr_t)IIOV(SGC_BASE + (ip->scode * SGC_DEVSIZE));
- sti_iteinit_common(ip);
-}
-
-/*
- * Initialize the sti device for ite's needs.
- * We don't bother to check for failures since
- * - we are in tight space already
- * - since romputchar() does not work with sti devices, there is no way we
- * can report errors (although we could switch to serial...)
- */
-void
-sti_iteinit_common(struct ite_data *ip)
-{
- int i;
- size_t codesize, memsize;
- u_int8_t *va, *code;
- u_int addr, eaddr, reglist, tmp;
- struct sti_inqconfout cfg;
- struct sti_einqconfout ecfg;
-
- bzero(&sti, sizeof sti);
- va = (u_int8_t *)ip->fbbase;
-
- /*
- * Read the microcode.
- */
-
- for (i = 0; i < STI_CODECNT; i++)
- sti.codeptr[i] =
- parseword1(va, (STI_CODEBASE_M68K << 2) + i * 0x10);
-
- for (i = STI_END; sti.codeptr[i] == 0; i--);
- codesize = sti.codeptr[i] - sti.codeptr[STI_BEGIN];
- codesize = (codesize + 3) / 4;
-
- sti.code = (u_int8_t *)alloc(codesize);
- code = sti.code;
- addr = (u_int)va + sti.codeptr[STI_BEGIN];
- eaddr = addr + codesize * 4;
- for (; addr < eaddr; addr += 4)
- *code++ = *(u_int8_t *)addr;
-
- for (i = STI_CODECNT - 1; i != 0; i--)
- if (sti.codeptr[i] != 0) {
- sti.codeptr[i] -= sti.codeptr[0];
- sti.codeptr[i] /= 4;
- }
-
- sti.codeptr[0] = 0;
- for (i = STI_END; sti.codeptr[i] == 0; i--);
- sti.codeptr[i] = 0;
-
- /*
- * Read the regions list.
- */
-
- reglist = parseword1(va, 0x60);
- for (i = 0; i < STI_REGION_MAX; i++) {
- tmp = parseword1(va, (reglist & ~3) + i * 0x10);
- sti.cfg.regions[i] = (u_int)va + ((tmp >> 18) << 12);
- if (tmp & 0x4000)
- break;
- }
-
- /*
- * Allocate scratch memory for the microcode if it needs it.
- */
-
- sti.cfg.ext_cfg = &sti.ecfg;
- memsize = parseword1(va, 0xa0);
- if (memsize != 0)
- sti.ecfg.addr = alloc(memsize);
-
- /*
- * Initialize the display, and get geometry information.
- */
-
- sti_init(0);
-
- bzero(&cfg, sizeof cfg);
- bzero(&ecfg, sizeof ecfg);
- cfg.ext = &ecfg;
- sti_inqcfg(&cfg);
-
- if (cfg.owidth == cfg.width && cfg.oheight == cfg.height) {
- sti.cfg.oscr_width = cfg.owidth = cfg.fbwidth - cfg.width;
- sti.cfg.oscr_height = cfg.oheight = cfg.fbheight - cfg.height;
- }
-
- ip->dheight = cfg.height;
- ip->dwidth = cfg.width;
- ip->fbheight = cfg.fbheight;
- ip->fbwidth = cfg.fbwidth;
-
- /*
- * Get ready for ite operation!
- */
-
- sti_init(1);
- sti_fontinfo(ip);
- sti_clear(ip, 0, 0, ip->rows, ip->cols); /* necessary? */
-}
-
-void
-sti_putc(struct ite_data *ip, int c, int dy, int dx)
-{
- sti_unpmv_t unpmv;
- struct {
- struct sti_unpmvflags flags;
- struct sti_unpmvin in;
- struct sti_unpmvout out;
- } a;
-
- bzero(&a, sizeof a);
- a.flags.flags = STI_UNPMVF_WAIT;
- a.in.bg_colour = STI_COLOUR_BLACK;
- a.in.fg_colour = STI_COLOUR_WHITE;
- a.in.x = dx * ip->ftwidth;
- a.in.y = dy * ip->ftheight;
- a.in.font_addr = (u_int32_t *)(ip->fbbase + sti.fontbase);
- a.in.index = c;
-
- unpmv = (sti_unpmv_t)(sti.code + sti.codeptr[STI_FONT_UNPMV]);
- (*unpmv)(&a.flags, &a.in, &a.out, &sti.cfg);
-}
-
-void
-sti_cursor(struct ite_data *ip, int flag)
-{
- switch (flag) {
- case MOVE_CURSOR:
- sti_do_cursor(ip);
- /* FALLTHROUGH */
- case DRAW_CURSOR:
- ip->cursorx = ip->curx;
- ip->cursory = ip->cury;
- /* FALLTHROUGH */
- default:
- sti_do_cursor(ip);
- break;
- }
-}
-
-void
-sti_do_cursor(struct ite_data *ip)
-{
- sti_blkmv_t blkmv;
- struct {
- struct sti_blkmvflags flags;
- struct sti_blkmvin in;
- struct sti_blkmvout out;
- } a;
-
- bzero(&a, sizeof a);
- a.flags.flags = STI_BLKMVF_WAIT | STI_BLKMVF_COLR;
- a.in.fg_colour = STI_COLOUR_BLACK;
- a.in.bg_colour = STI_COLOUR_WHITE;
- a.in.dstx = a.in.srcx = ip->cursorx * ip->ftwidth;
- a.in.dsty = a.in.srcy = ip->cursory * ip->ftheight;
- a.in.width = ip->ftwidth;
- a.in.height = ip->ftheight;
-
- blkmv = (sti_blkmv_t)(sti.code + sti.codeptr[STI_BLOCK_MOVE]);
- (*blkmv)(&a.flags, &a.in, &a.out, &sti.cfg);
-}
-
-void
-sti_clear(struct ite_data *ip, int sy, int sx, int h, int w)
-{
- sti_blkmv_t blkmv;
- struct {
- struct sti_blkmvflags flags;
- struct sti_blkmvin in;
- struct sti_blkmvout out;
- } a;
-
- bzero(&a, sizeof a);
- a.flags.flags = STI_BLKMVF_WAIT | STI_BLKMVF_CLR;
- a.in.bg_colour = STI_COLOUR_BLACK;
- a.in.dstx = a.in.srcx = sx * ip->ftwidth;
- a.in.dsty = a.in.srcy = sy * ip->ftheight;
- a.in.width = w * ip->ftwidth;
- a.in.height = h * ip->ftheight;
-
- blkmv = (sti_blkmv_t)(sti.code + sti.codeptr[STI_BLOCK_MOVE]);
- (*blkmv)(&a.flags, &a.in, &a.out, &sti.cfg);
-}
-
-void
-sti_scroll(struct ite_data *ip)
-{
- sti_blkmv_t blkmv;
- struct {
- struct sti_blkmvflags flags;
- struct sti_blkmvin in;
- struct sti_blkmvout out;
- } a;
-
- bzero(&a, sizeof a);
- a.flags.flags = STI_BLKMVF_WAIT;
- a.in.bg_colour = STI_COLOUR_BLACK;
- a.in.fg_colour = STI_COLOUR_WHITE;
- a.in.dstx = a.in.srcx = 0;
- a.in.dsty = 0;
- a.in.srcy = ip->ftheight;
- a.in.width = ip->dwidth;
- a.in.height = (ip->rows - 1) * ip->ftheight;
-
- blkmv = (sti_blkmv_t)(sti.code + sti.codeptr[STI_BLOCK_MOVE]);
- (*blkmv)(&a.flags, &a.in, &a.out, &sti.cfg);
-}
-
-void
-sti_fontinfo(struct ite_data *ip)
-{
- u_int32_t fontbase;
-
- fontbase = sti.fontbase = parseword1((u_int8_t *)ip->fbbase, 0x30) & ~3;
- ip->ftwidth = (u_int8_t)ip->fbbase[fontbase + 0x13];
- ip->ftheight = (u_int8_t)ip->fbbase[fontbase + 0x17];
- ip->rows = ip->dheight / ip->ftheight;
- ip->cols = ip->dwidth / ip->ftwidth;
-}
-
-void
-sti_init(int full)
-{
- sti_init_t init;
- struct {
- struct sti_initflags flags;
- struct sti_initin in;
- struct sti_initout out;
- } a;
-
- bzero(&a, sizeof a);
- a.flags.flags = STI_INITF_WAIT | STI_INITF_CMB | STI_INITF_EBET;
- if (full)
- a.flags.flags |= STI_INITF_TEXT | STI_INITF_PBET |
- STI_INITF_PBETI | STI_INITF_ICMT;
- a.in.text_planes = 1;
-
- init = (sti_init_t)(sti.code + sti.codeptr[STI_INIT_GRAPH]);
- (*init)(&a.flags, &a.in, &a.out, &sti.cfg);
-}
-
-void
-sti_inqcfg(struct sti_inqconfout *ico)
-{
- sti_inqconf_t inqconf;
- struct {
- struct sti_inqconfflags flags;
- struct sti_inqconfin in;
- } a;
-
- bzero(&a, sizeof a);
- a.flags.flags = STI_INQCONFF_WAIT;
-
- inqconf = (sti_inqconf_t)(sti.code + sti.codeptr[STI_INQ_CONF]);
- (*inqconf)(&a.flags, &a.in, ico, &sti.cfg);
-}
-
-#endif
diff --git a/sys/arch/hp300/stand/common/ite_subr.c b/sys/arch/hp300/stand/common/ite_subr.c
deleted file mode 100644
index f34fcda7bc0..00000000000
--- a/sys/arch/hp300/stand/common/ite_subr.c
+++ /dev/null
@@ -1,404 +0,0 @@
-/* $OpenBSD: ite_subr.c,v 1.5 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: ite_subr.c,v 1.8 1996/03/03 04:23:40 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: ite_subr.c 1.2 92/01/20$
- *
- * @(#)ite_subr.c 8.1 (Berkeley) 6/10/93
- */
-
-#ifdef ITECONSOLE
-
-#include <sys/param.h>
-
-#include "samachdep.h"
-#include "itevar.h"
-#include "itereg.h"
-
-#define getbyte(ip, offset) \
- *(((u_char *)(ip)->regbase) + (offset))
-
-#define getword(ip, offset) \
- ((getbyte(ip, offset) << 8) | getbyte(ip, (offset) + 2))
-
-u_char ite_readbyte(struct ite_data *, int);
-void ite_writeglyph(struct ite_data *, u_char *, u_char *);
-
-void
-ite_fontinfo(struct ite_data *ip)
-{
- u_long fontaddr = getword(ip, getword(ip, FONTROM) + FONTADDR);
-
- ip->ftheight = getbyte(ip, fontaddr + FONTHEIGHT);
- ip->ftwidth = getbyte(ip, fontaddr + FONTWIDTH);
- ip->rows = ip->dheight / ip->ftheight;
- ip->cols = ip->dwidth / ip->ftwidth;
-
- if (ip->fbwidth > ip->dwidth) {
- /*
- * Stuff goes to right of display.
- */
- ip->fontx = ip->dwidth;
- ip->fonty = 0;
- ip->cpl = (ip->fbwidth - ip->dwidth) / ip->ftwidth;
- ip->cblankx = ip->dwidth;
- ip->cblanky = ip->fonty + ((128 / ip->cpl) +1) * ip->ftheight;
- } else {
- /*
- * Stuff goes below the display.
- */
- ip->fontx = 0;
- ip->fonty = ip->dheight;
- ip->cpl = ip->fbwidth / ip->ftwidth;
- ip->cblankx = 0;
- ip->cblanky = ip->fonty + ((128 / ip->cpl) + 1) * ip->ftheight;
- }
-}
-
-void
-ite_fontinit1bpp(struct ite_data *ip)
-{
- u_char *fbmem, *dp;
- int c, l, b;
- int stride, width;
-
- dp = (u_char *)(getword(ip, getword(ip, FONTROM) + FONTADDR) +
- ip->regbase) + FONTDATA;
- stride = ip->fbwidth >> 3;
- width = (ip->ftwidth + 7) / 8;
-
- for (c = 0; c < 128; c++) {
- fbmem = (u_char *)FBBASE +
- (ip->fonty + (c / ip->cpl) * ip->ftheight) * stride;
- fbmem += (ip->fontx >> 3) + (c % ip->cpl) * width;
- for (l = 0; l < ip->ftheight; l++) {
- for (b = 0; b < width; b++) {
- *fbmem++ = *dp;
- dp += 2;
- }
- fbmem -= width;
- fbmem += stride;
- }
- }
-}
-
-void
-ite_fontinit8bpp(struct ite_data *ip)
-{
- int bytewidth = (((ip->ftwidth - 1) / 8) + 1);
- int glyphsize = bytewidth * ip->ftheight;
- u_char fontbuf[500];
- u_char *dp, *fbmem;
- int c, i, romp;
-
- romp = getword(ip, getword(ip, FONTROM) + FONTADDR) + FONTDATA;
- for (c = 0; c < 128; c++) {
- fbmem = (u_char *)(FBBASE +
- (ip->fonty + (c / ip->cpl) * ip->ftheight) * ip->fbwidth +
- (ip->fontx + (c % ip->cpl) * ip->ftwidth));
- dp = fontbuf;
- for (i = 0; i < glyphsize; i++) {
- *dp++ = getbyte(ip, romp);
- romp += 2;
- }
- ite_writeglyph(ip, fbmem, fontbuf);
- }
-}
-
-void
-ite_writeglyph(struct ite_data *ip, u_char *fbmem, u_char *glyphp)
-{
- int bn;
- int l, b;
-
- for (l = 0; l < ip->ftheight; l++) {
- bn = 7;
- for (b = 0; b < ip->ftwidth; b++) {
- if ((1 << bn) & *glyphp)
- *fbmem++ = 1;
- else
- *fbmem++ = 0;
- if (--bn < 0) {
- bn = 7;
- glyphp++;
- }
- }
- if (bn < 7)
- glyphp++;
- fbmem -= ip->ftwidth;
- fbmem += ip->fbwidth;
- }
-}
-
-/*
- * The cursor is just an inverted space.
- */
-#define flip_cursor(ip) \
- (*ip->bmv)(ip, ip->cblanky, ip->cblankx, ip->cursory * ip->ftheight, \
- ip->cursorx * ip->ftwidth, ip->ftheight, ip->ftwidth, RR_XOR)
-
-void
-ite_dio_cursor(struct ite_data *ip, int flag)
-{
- switch (flag) {
- case MOVE_CURSOR:
- flip_cursor(ip);
- /* FALLTHROUGH */
- case DRAW_CURSOR:
- ip->cursorx = ip->curx;
- ip->cursory = ip->cury;
- /* FALLTHROUGH */
- default:
- flip_cursor(ip);
- break;
- }
-}
-
-void
-ite_dio_putc1bpp(struct ite_data *ip, int c, int dy, int dx)
-{
- ite_dio_windowmove1bpp(ip, charY(ip, c), charX1bpp(ip, c),
- dy * ip->ftheight, dx * ip->ftwidth,
- ip->ftheight, ip->ftwidth, RR_COPY);
-}
-
-void
-ite_dio_putc8bpp(struct ite_data *ip, int c, int dy, int dx)
-{
- (*ip->bmv)(ip, charY(ip, c), charX(ip, c),
- dy * ip->ftheight, dx * ip->ftwidth,
- ip->ftheight, ip->ftwidth, RR_COPY);
-}
-
-void
-ite_dio_clear(struct ite_data *ip, int sy, int sx, int h, int w)
-{
- (*ip->bmv)(ip, sy * ip->ftheight, sx * ip->ftwidth,
- sy * ip->ftheight, sx * ip->ftwidth,
- h * ip->ftheight, w * ip->ftwidth, RR_CLEAR);
-}
-
-void
-ite_dio_scroll(struct ite_data *ip)
-{
- flip_cursor(ip);
-
- (*ip->bmv)(ip, ip->ftheight, 0, 0, 0, (ip->rows - 1) * ip->ftheight,
- ip->cols * ip->ftwidth, RR_COPY);
-}
-
-#include "maskbits.h"
-
-/* NOTE:
- * the first element in starttab could be 0xffffffff. making it 0
- * lets us deal with a full first word in the middle loop, rather
- * than having to do the multiple reads and masks that we'd
- * have to do if we thought it was partial.
- */
-int starttab[32] = {
- 0x00000000,
- 0x7FFFFFFF,
- 0x3FFFFFFF,
- 0x1FFFFFFF,
- 0x0FFFFFFF,
- 0x07FFFFFF,
- 0x03FFFFFF,
- 0x01FFFFFF,
- 0x00FFFFFF,
- 0x007FFFFF,
- 0x003FFFFF,
- 0x001FFFFF,
- 0x000FFFFF,
- 0x0007FFFF,
- 0x0003FFFF,
- 0x0001FFFF,
- 0x0000FFFF,
- 0x00007FFF,
- 0x00003FFF,
- 0x00001FFF,
- 0x00000FFF,
- 0x000007FF,
- 0x000003FF,
- 0x000001FF,
- 0x000000FF,
- 0x0000007F,
- 0x0000003F,
- 0x0000001F,
- 0x0000000F,
- 0x00000007,
- 0x00000003,
- 0x00000001
-};
-
-int endtab[32] = {
- 0x00000000,
- 0x80000000,
- 0xC0000000,
- 0xE0000000,
- 0xF0000000,
- 0xF8000000,
- 0xFC000000,
- 0xFE000000,
- 0xFF000000,
- 0xFF800000,
- 0xFFC00000,
- 0xFFE00000,
- 0xFFF00000,
- 0xFFF80000,
- 0xFFFC0000,
- 0xFFFE0000,
- 0xFFFF0000,
- 0xFFFF8000,
- 0xFFFFC000,
- 0xFFFFE000,
- 0xFFFFF000,
- 0xFFFFF800,
- 0xFFFFFC00,
- 0xFFFFFE00,
- 0xFFFFFF00,
- 0xFFFFFF80,
- 0xFFFFFFC0,
- 0xFFFFFFE0,
- 0xFFFFFFF0,
- 0xFFFFFFF8,
- 0xFFFFFFFC,
- 0xFFFFFFFE
-};
-
-void
-ite_dio_windowmove1bpp(struct ite_data *ip, int sy, int sx, int dy, int dx,
- int h, int w, int func)
-{
- int width; /* add to get to same position in next line */
-
- unsigned int *psrcLine, *pdstLine;
- /* pointers to line with current src and dst */
- unsigned int *psrc; /* pointer to current src longword */
- unsigned int *pdst; /* pointer to current dst longword */
-
- /* following used for looping through a line */
- unsigned int startmask, endmask; /* masks for writing ends of dst */
- int nlMiddle; /* whole longwords in dst */
- int nl; /* temp copy of nlMiddle */
- unsigned int tmpSrc; /* place to store full source word */
- int xoffSrc; /* offset (>= 0, < 32) from which to
- fetch whole longwords fetched
- in src */
- int nstart; /* number of ragged bits at start of dst */
- int nend; /* number of ragged bits at end of dst */
- int srcStartOver; /* pulling nstart bits from src
- overflows into the next word? */
-
- if (h == 0 || w == 0)
- return;
-
- width = ip->fbwidth >> 5;
- psrcLine = ((unsigned int *) ip->fbbase) + (sy * width);
- pdstLine = ((unsigned int *) ip->fbbase) + (dy * width);
-
- /* x direction doesn't matter for < 1 longword */
- if (w <= 32) {
- int srcBit, dstBit; /* bit offset of src and dst */
-
- pdstLine += (dx >> 5);
- psrcLine += (sx >> 5);
- psrc = psrcLine;
- pdst = pdstLine;
-
- srcBit = sx & 0x1f;
- dstBit = dx & 0x1f;
-
- while (h--) {
- getandputrop(psrc, srcBit, dstBit, w, pdst, func);
- pdst += width;
- psrc += width;
- }
- } else {
- maskbits(dx, w, startmask, endmask, nlMiddle);
- if (startmask)
- nstart = 32 - (dx & 0x1f);
- else
- nstart = 0;
- if (endmask)
- nend = (dx + w) & 0x1f;
- else
- nend = 0;
-
- xoffSrc = ((sx & 0x1f) + nstart) & 0x1f;
- srcStartOver = ((sx & 0x1f) + nstart) > 31;
-
- pdstLine += (dx >> 5);
- psrcLine += (sx >> 5);
-
- while (h--) {
- psrc = psrcLine;
- pdst = pdstLine;
-
- if (startmask) {
- getandputrop(psrc, (sx & 0x1f), (dx & 0x1f),
- nstart, pdst, func);
- pdst++;
- if (srcStartOver)
- psrc++;
- }
-
- /* special case for aligned operations */
- if (xoffSrc == 0) {
- nl = nlMiddle;
- while (nl--) {
- DoRop (*pdst, func, *psrc++, *pdst);
- pdst++;
- }
- } else {
- nl = nlMiddle + 1;
- while (--nl) {
- getunalignedword (psrc, xoffSrc,
- tmpSrc);
- DoRop (*pdst, func, tmpSrc, *pdst);
- pdst++;
- psrc++;
- }
- }
-
- if (endmask) {
- getandputrop0(psrc, xoffSrc, nend, pdst, func);
- }
-
- pdstLine += width;
- psrcLine += width;
- }
- }
-}
-#endif
diff --git a/sys/arch/hp300/stand/common/ite_tc.c b/sys/arch/hp300/stand/common/ite_tc.c
deleted file mode 100644
index f968282efc3..00000000000
--- a/sys/arch/hp300/stand/common/ite_tc.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/* $OpenBSD: ite_tc.c,v 1.6 2011/08/18 20:02:58 miod Exp $ */
-/* $NetBSD: ite_tc.c,v 1.8 1996/03/03 04:23:41 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: ite_tc.c 1.11 92/01/20$
- *
- * @(#)ite_tc.c 8.1 (Berkeley) 6/10/93
- */
-
-#ifdef ITECONSOLE
-
-#include <sys/param.h>
-
-#include "samachdep.h"
-#include "itevar.h"
-#include "itereg.h"
-
-#include <hp300/dev/diofbreg.h>
-
-#include "grf_tcreg.h"
-
-#define REGBASE ((struct tcboxfb *)(ip->regbase))
-
-void topcat_windowmove(struct ite_data *, int, int, int, int,
- int, int, int);
-
-void
-topcat_init(struct ite_data *ip)
-{
- ip->bmv = topcat_windowmove;
-
- /*
- * Catseye looks a lot like a topcat, but not completely.
- * So, we set some bits to make it work.
- */
- if (REGBASE->fbid != GID_TOPCAT) {
- while ((REGBASE->catseye_status & 1))
- ;
- REGBASE->catseye_status = 0x0;
- REGBASE->vb_select = 0x0;
- REGBASE->tcntrl = 0x0;
- REGBASE->acntrl = 0x0;
- REGBASE->pncntrl = 0x0;
- REGBASE->rug_cmdstat = 0x90;
- }
-
- /*
- * Determine the number of planes by writing to the first frame
- * buffer display location, then reading it back.
- */
- REGBASE->wen = ~0;
- REGBASE->fben = ~0;
- REGBASE->prr = RR_COPY;
- *FBBASE = 0xFF;
- ip->planemask = *FBBASE;
-
- /*
- * Enable reading/writing of all the planes.
- */
- REGBASE->fben = ip->planemask;
- REGBASE->wen = ip->planemask;
- REGBASE->ren = ip->planemask;
- REGBASE->prr = RR_COPY;
-
- ite_fontinfo(ip);
-
- /*
- * Clear the framebuffer on all planes.
- */
- topcat_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
- tc_waitbusy(ip->regbase, ip->planemask);
-
- ite_fontinit8bpp(ip);
-
- /*
- * Stash the inverted cursor.
- */
- topcat_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
- ip->cblanky, ip->cblankx, ip->ftheight,
- ip->ftwidth, RR_COPYINVERTED);
-}
-
-void
-topcat_windowmove(struct ite_data *ip, int sy, int sx, int dy, int dx, int h,
- int w, int func)
-{
- struct tcboxfb *rp = REGBASE;
-
- if (h == 0 || w == 0)
- return;
- tc_waitbusy(ip->regbase, ip->planemask);
- rp->wmrr = func;
- rp->source_y = sy;
- rp->source_x = sx;
- rp->dest_y = dy;
- rp->dest_x = dx;
- rp->wheight = h;
- rp->wwidth = w;
- rp->wmove = ip->planemask;
-}
-#endif
diff --git a/sys/arch/hp300/stand/common/ite_tvrx.c b/sys/arch/hp300/stand/common/ite_tvrx.c
deleted file mode 100644
index 9309b093349..00000000000
--- a/sys/arch/hp300/stand/common/ite_tvrx.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* $OpenBSD: ite_tvrx.c,v 1.2 2006/08/17 06:31:10 miod Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Mark Davies of the Department of Computer
- * Science, Victoria University of Wellington, New Zealand.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: ite_hy.c 1.1 92/01/22$
- *
- * @(#)ite_hy.c 8.1 (Berkeley) 6/10/93
- */
-
-#ifdef ITECONSOLE
-#include <sys/param.h>
-
-#include "samachdep.h"
-#include "itevar.h"
-
-void
-tvrx_init(struct ite_data *ip)
-{
- int width;
-
- ip->bmv = ite_dio_windowmove1bpp;
- ite_fontinfo(ip);
- width = ((ip->ftwidth + 7) / 8) * 8;
- ip->cpl = (ip->fbwidth - ip->dwidth) / width;
- ip->cblanky = ip->fonty + ((128 / ip->cpl) +1) * ip->ftheight;
-
- /*
- * Clear the framebuffer on all planes.
- */
- ite_dio_windowmove1bpp(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth,
- RR_CLEAR);
-
- ite_fontinit1bpp(ip);
-
- /*
- * Stash the inverted cursor.
- */
- ite_dio_windowmove1bpp(ip, charY(ip, ' '), charX1bpp(ip, ' '),
- ip->cblanky, ip->cblankx, ip->ftheight, ip->ftwidth,
- RR_COPYINVERTED);
-}
-#endif
diff --git a/sys/arch/hp300/stand/common/kbd.c b/sys/arch/hp300/stand/common/kbd.c
deleted file mode 100644
index 3eeb328247d..00000000000
--- a/sys/arch/hp300/stand/common/kbd.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/* $OpenBSD: kbd.c,v 1.3 2008/06/26 05:42:10 ray Exp $ */
-/* $NetBSD: kbd.c,v 1.2 1997/05/12 07:51:32 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1997 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Indirect keyboard driver for standalone ITE.
- */
-
-#ifdef ITECONSOLE
-
-#include <sys/param.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-#include "kbdvar.h"
-
-#ifndef SMALL
-
-/*
- * Function switch initialized by keyboard drivers.
- */
-struct kbdsw *selected_kbd;
-
-int
-kbdgetc()
-{
-
- return ((selected_kbd != NULL) ? (*selected_kbd->k_getc)() : 0);
-}
-
-void
-kbdnmi()
-{
-
- if (selected_kbd != NULL)
- (*selected_kbd->k_nmi)();
-
- /*
- * This is the only reasonable thing to do, unfortunately.
- * Simply restarting the boot block by frobbing the stack and
- * jumping to begin: doesn't properly reset variables that
- * are in the data segment.
- */
- printf("\nboot interrupted, resetting...\n");
- DELAY(1000000);
- call_req_reboot();
-}
-
-void
-kbdinit()
-{
- int i;
-
- selected_kbd = NULL;
-
- for (i = 0; kbdsw[i].k_init != NULL; i++) {
- if ((*kbdsw[i].k_init)()) {
- selected_kbd = &kbdsw[i];
- return;
- }
- }
-}
-
-#endif /* SMALL */
-
-#endif /* ITECONSOLE */
diff --git a/sys/arch/hp300/stand/common/kbdconf.c b/sys/arch/hp300/stand/common/kbdconf.c
deleted file mode 100644
index c0f3bdf2fe0..00000000000
--- a/sys/arch/hp300/stand/common/kbdconf.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* $OpenBSD: kbdconf.c,v 1.2 2008/06/26 05:42:10 ray Exp $ */
-/* $NetBSD: kbdconf.c,v 1.1 1997/04/14 19:00:12 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1997 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Keyboard support configuration.
- */
-
-#ifdef ITECONSOLE
-
-#include <sys/param.h>
-
-#include "samachdep.h"
-#include "kbdvar.h"
-
-#ifndef SMALL
-
-/*
- * Note, these are arranged in order of preference. The first `init'
- * routine to report success gets to play.
- */
-struct kbdsw kbdsw[] = {
-#ifdef HIL_KEYBOARD
- { hilkbd_getc, hilkbd_nmi, hilkbd_init },
-#endif
-#ifdef DOMAIN_KEYBOARD
- { dnkbd_getc, dnkbd_nmi, dnkbd_init },
-#endif
- { NULL, NULL, NULL },
-};
-
-#endif /* SMALL */
-
-#endif /* ITECONSOLE */
diff --git a/sys/arch/hp300/stand/common/machdep.c b/sys/arch/hp300/stand/common/machdep.c
deleted file mode 100644
index 4adf12b9323..00000000000
--- a/sys/arch/hp300/stand/common/machdep.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/* $OpenBSD: machdep.c,v 1.9 2013/02/02 13:34:29 miod Exp $ */
-/* $NetBSD: machdep.c,v 1.4 1997/06/28 07:20:25 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: machdep.c 1.10 92/06/18
- *
- * @(#)machdep.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-
-char *
-getmachineid()
-{
- extern int machineid, mmuid;
- char *cp;
-
- switch (machineid) {
- case HP_320:
- cp = "320"; break;
- case HP_330:
- cp = "318/319/330"; break;
- case HP_340:
- cp = "340"; break;
- case HP_345:
- cp = "345"; break;
- case HP_350:
- cp = "350"; break;
- case HP_36X:
- /* bootblocks do not tell 360 apart from 362 at the moment */
- cp = "360/362"; break;
- case HP_370:
- cp = "370"; break;
- case HP_375:
- cp = "375"; break;
- case HP_380:
- cp = "380"; break;
- case HP_382:
- cp = "382"; break;
- case HP_385:
- cp = "385"; break;
- case HP_400:
- cp = "400"; break;
- case HP_425:
- switch (mmuid) {
- case MMUID_425_T:
- cp = "425t"; break;
- case MMUID_425_S:
- cp = "425s"; break;
- case MMUID_425_E:
- cp = "425e"; break;
- default:
- cp = "425"; break;
- }
- break;
- case HP_433:
- switch (mmuid) {
- case MMUID_433_T:
- cp = "433t"; break;
- case MMUID_433_S:
- cp = "433s"; break;
- default:
- cp = "433"; break;
- }
- break;
- default:
- cp = "???"; break;
- }
- return(cp);
-}
-
-int userom;
-
-struct trapframe {
- int dregs[8];
- int aregs[8];
- int whoknows;
- short sr;
- int pc;
- short frame;
-};
-
-int trap(struct trapframe *);
-
-int
-trap(fp)
- struct trapframe *fp;
-{
- static int intrap = 0;
-
- if (intrap)
- return(0);
- intrap = 1;
-
-#if 0
- userom = 1;
-#endif
-
- printf("Got unexpected trap: format=%x vector=%x ps=%x pc=%x\n",
- (fp->frame>>12)&0xF, fp->frame&0xFFF, fp->sr, fp->pc);
- printf("dregs: %x %x %x %x %x %x %x %x\n",
- fp->dregs[0], fp->dregs[1], fp->dregs[2], fp->dregs[3],
- fp->dregs[4], fp->dregs[5], fp->dregs[6], fp->dregs[7]);
- printf("aregs: %x %x %x %x %x %x %x %x\n",
- fp->aregs[0], fp->aregs[1], fp->aregs[2], fp->aregs[3],
- fp->aregs[4], fp->aregs[5], fp->aregs[6], fp->aregs[7]);
- printf("bytes at pc: %x %x %x %x %x %x\n",
- ((char *)fp->pc)[0], ((char *)fp->pc)[1], ((char *)fp->pc)[2],
- ((char *)fp->pc)[3], ((char *)fp->pc)[4], ((char *)fp->pc)[5]);
-
-#if 0
- userom = 0;
-#endif
-
- intrap = 0;
-
- return(0);
-}
-
-#define ROWS 24
-#define COLS 80
-
-void
-romputchar(int c)
-{
- static char buf[COLS];
- static int col = 0, row = 0;
- int i;
-
- switch (c) {
- case '\0':
- break;
- case '\r':
- break; /* ignore */
- case '\n':
- for (i = col; i < COLS-1; i++)
- buf[i] = ' ';
- buf[i] = '\0';
- romout(row, buf);
- col = 0;
- if (++row == ROWS)
- row = 0;
- break;
-
- case '\t':
- do {
- romputchar(' ');
- } while (col & 7);
- break;
-
- default:
- buf[col] = c;
- if (++col == COLS-1)
- romputchar('\n');
- break;
- }
-}
-
-void
-machdep_start(char *entry, int howto, char *loadaddr, char *ssym, char *esym)
-{
- /* Fix what we were passed in from exec() */
-#define round_to_size(x) (((int)(x) + sizeof(int) - 1) & ~(sizeof(int) - 1))
- esym = (char *)round_to_size(esym - (char *)loadaddr);
-#undef round_to_size
-
- __asm __volatile ("movl %0,%%d7" : : "m" (howto));
- __asm __volatile ("movl %0,%%d6" : : "m" (opendev));
- __asm __volatile ("movl %0,%%a5" : : "a" (loadaddr));
- __asm __volatile ("movl %0,%%a4" : : "a" (esym));
- (*((int (*)(void))entry))();
-}
diff --git a/sys/arch/hp300/stand/common/nhpib.c b/sys/arch/hp300/stand/common/nhpib.c
deleted file mode 100644
index 7b7c5884caa..00000000000
--- a/sys/arch/hp300/stand/common/nhpib.c
+++ /dev/null
@@ -1,208 +0,0 @@
-/* $OpenBSD: nhpib.c,v 1.4 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: nhpib.c,v 1.5 1995/08/05 16:47:46 thorpej Exp $ */
-
-/*
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)nhpib.c 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * Internal/98624 HPIB driver
- */
-
-#include <sys/param.h>
-
-#include <hp300/dev/nhpibreg.h>
-
-#include "samachdep.h"
-#include "hpibvar.h"
-
-int nhpibiwait(struct nhpibdevice *);
-int nhpibowait(struct nhpibdevice *);
-void nhpibreset(int);
-
-int
-nhpibinit(int unit)
-{
- struct hpib_softc *hs = &hpib_softc[unit];
- struct nhpibdevice *hd = (struct nhpibdevice *)hs->sc_addr;
- extern int internalhpib;
-
- if ((int)hd == internalhpib) {
- hs->sc_type = HPIBA;
- hs->sc_ba = HPIBA_BA;
- }
- else if (hd->hpib_cid == HPIBB) {
- hs->sc_type = HPIBB;
- hs->sc_ba = hd->hpib_csa & CSA_BA;
- }
- else
- return(0);
- nhpibreset(unit);
- return(1);
-}
-
-void
-nhpibreset(int unit)
-{
- struct hpib_softc *hs = &hpib_softc[unit];
- struct nhpibdevice *hd;
-
- hd = (struct nhpibdevice *)hs->sc_addr;
- hd->hpib_acr = AUX_SSWRST;
- hd->hpib_ar = hs->sc_ba;
- hd->hpib_lim = 0;
- hd->hpib_mim = 0;
- hd->hpib_acr = AUX_CDAI;
- hd->hpib_acr = AUX_CSHDW;
- hd->hpib_acr = AUX_SSTD1;
- hd->hpib_acr = AUX_SVSTD1;
- hd->hpib_acr = AUX_CPP;
- hd->hpib_acr = AUX_CHDFA;
- hd->hpib_acr = AUX_CHDFE;
- hd->hpib_acr = AUX_RHDF;
- hd->hpib_acr = AUX_CSWRST;
- hd->hpib_acr = AUX_TCA;
- hd->hpib_acr = AUX_CSRE;
- hd->hpib_acr = AUX_SSIC;
- DELAY(100);
- hd->hpib_acr = AUX_CSIC;
- hd->hpib_acr = AUX_SSRE;
- hd->hpib_data = C_DCL;
- DELAY(100000);
-}
-
-int
-nhpibsend(int unit, int slave, int sec, char *buf, int cnt)
-{
- struct hpib_softc *hs = &hpib_softc[unit];
- struct nhpibdevice *hd;
- int origcnt = cnt;
-
- hd = (struct nhpibdevice *)hs->sc_addr;
- hd->hpib_acr = AUX_TCA;
- hd->hpib_data = C_UNL;
- nhpibowait(hd);
- hd->hpib_data = C_TAG + hs->sc_ba;
- hd->hpib_acr = AUX_STON;
- nhpibowait(hd);
- hd->hpib_data = C_LAG + slave;
- nhpibowait(hd);
- if (sec != -1) {
- hd->hpib_data = C_SCG + sec;
- nhpibowait(hd);
- }
- hd->hpib_acr = AUX_GTS;
- if (cnt) {
- while (--cnt) {
- hd->hpib_data = *buf++;
- if (nhpibowait(hd) < 0)
- break;
- }
- hd->hpib_acr = AUX_EOI;
- hd->hpib_data = *buf;
- if (nhpibowait(hd) < 0)
- cnt++;
- hd->hpib_acr = AUX_TCA;
- }
- return(origcnt - cnt);
-}
-
-int
-nhpibrecv(int unit, int slave, int sec, char *buf, int cnt)
-{
- struct hpib_softc *hs = &hpib_softc[unit];
- struct nhpibdevice *hd;
- int origcnt = cnt;
-
- hd = (struct nhpibdevice *)hs->sc_addr;
- hd->hpib_acr = AUX_TCA;
- hd->hpib_data = C_UNL;
- nhpibowait(hd);
- hd->hpib_data = C_LAG + hs->sc_ba;
- hd->hpib_acr = AUX_SLON;
- nhpibowait(hd);
- hd->hpib_data = C_TAG + slave;
- nhpibowait(hd);
- if (sec != -1) {
- hd->hpib_data = C_SCG + sec;
- nhpibowait(hd);
- }
- hd->hpib_acr = AUX_RHDF;
- hd->hpib_acr = AUX_GTS;
- if (cnt) {
- while (--cnt >= 0) {
- if (nhpibiwait(hd) < 0)
- break;
- *buf++ = hd->hpib_data;
- }
- cnt++;
- hd->hpib_acr = AUX_TCA;
- }
- return(origcnt - cnt);
-}
-
-int
-nhpibppoll(int unit)
-{
- struct hpib_softc *hs = &hpib_softc[unit];
- struct nhpibdevice *hd;
- int ppoll;
-
- hd = (struct nhpibdevice *)hs->sc_addr;
- hd->hpib_acr = AUX_SPP;
- DELAY(25);
- ppoll = hd->hpib_cpt;
- hd->hpib_acr = AUX_CPP;
- return(ppoll);
-}
-
-int
-nhpibowait(struct nhpibdevice *hd)
-{
- int timo = 100000;
-
- while ((hd->hpib_mis & MIS_BO) == 0 && --timo)
- ;
- if (timo == 0)
- return(-1);
- return(0);
-}
-
-int
-nhpibiwait(struct nhpibdevice *hd)
-{
- int timo = 100000;
-
- while ((hd->hpib_mis & MIS_BI) == 0 && --timo)
- ;
- if (timo == 0)
- return(-1);
- return(0);
-}
diff --git a/sys/arch/hp300/stand/common/scsi.c b/sys/arch/hp300/stand/common/scsi.c
deleted file mode 100644
index bf283a46b4f..00000000000
--- a/sys/arch/hp300/stand/common/scsi.c
+++ /dev/null
@@ -1,414 +0,0 @@
-/* $OpenBSD: scsi.c,v 1.10 2013/09/23 22:14:44 miod Exp $ */
-/* $NetBSD: scsi.c,v 1.7 1997/01/30 10:32:57 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of Lawrence Berkeley Laboratory and the Systems
- * Programming Group of the University of Utah Computer Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: scsi.c 1.3 90/01/27$
- *
- * @(#)scsi.c 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * SCSI bus driver for standalone programs.
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-#include "device.h"
-#include "scsireg.h"
-#include "scsivar.h"
-
-struct scsi_softc scsi_softc[NSCSI];
-
-int scsi_cmd_wait = 50000; /* use the "real" driver init_wait value */
-int scsi_data_wait = 50000; /* use the "real" driver init_wait value */
-
-void scsiabort(struct scsi_softc *, volatile struct scsidevice *);
-void scsireset(int);
-int scsi_request_sense(int, int, u_char *, u_int);
-
-void
-scsiinit()
-{
- extern struct hp_hw sc_table[];
- struct hp_hw *hw;
- struct scsi_softc *hs;
- int i;
- static int waitset = 0;
-
- i = 0;
- for (hw = sc_table; i < NSCSI && hw < &sc_table[MAXCTLRS]; hw++) {
- if (!HW_ISSCSI(hw))
- continue;
- hs = &scsi_softc[i];
- hs->sc_addr = hw->hw_kva;
- scsireset(i);
- if (howto & RB_ASKNAME)
- printf("scsi%d at sc%d\n", i, hw->hw_sc);
- hw->hw_ctrl = i;
- hs->sc_alive = 1;
- i++;
- }
- /*
- * Adjust the wait values
- */
- if (!waitset) {
- scsi_cmd_wait *= cpuspeed;
- scsi_data_wait *= cpuspeed;
- waitset = 1;
- }
-}
-
-int
-scsialive(int unit)
-{
- if (unit >= NSCSI || scsi_softc[unit].sc_alive == 0)
- return (0);
- return (1);
-}
-
-void
-scsireset(int unit)
-{
- volatile struct scsidevice *hd;
- struct scsi_softc *hs;
- u_int i;
-
- hs = &scsi_softc[unit];
- hd = (struct scsidevice *)hs->sc_addr;
- hd->scsi_id = 0xFF;
- DELAY(100);
- /*
- * Disable interrupts then reset the FUJI chip.
- */
- hd->scsi_csr = 0;
- hd->scsi_sctl = SCTL_DISABLE | SCTL_CTRLRST;
- hd->scsi_scmd = 0;
- hd->scsi_tmod = 0;
- hd->scsi_pctl = 0;
- hd->scsi_temp = 0;
- hd->scsi_tch = 0;
- hd->scsi_tcm = 0;
- hd->scsi_tcl = 0;
- hd->scsi_ints = 0;
-
- /*
- * Configure the FUJI chip with its SCSI address, all
- * interrupts enabled & appropriate parity.
- */
- i = (~hd->scsi_hconf) & 0x7;
- hs->sc_scsi_addr = 1 << i;
- hd->scsi_bdid = i;
- if (hd->scsi_hconf & HCONF_PARITY)
- hd->scsi_sctl = SCTL_DISABLE | SCTL_ABRT_ENAB |
- SCTL_SEL_ENAB | SCTL_RESEL_ENAB |
- SCTL_INTR_ENAB | SCTL_PARITY_ENAB;
- else
- hd->scsi_sctl = SCTL_DISABLE | SCTL_ABRT_ENAB |
- SCTL_SEL_ENAB | SCTL_RESEL_ENAB |
- SCTL_INTR_ENAB;
- hd->scsi_sctl &=~ SCTL_DISABLE;
-}
-
-
-void
-scsiabort(struct scsi_softc *hs, volatile struct scsidevice *hd)
-{
- printf("scsi%d error: scsiabort\n", (int)(hs - scsi_softc));
-
- scsireset(hs - scsi_softc);
- DELAY(1000000);
-}
-
-static int
-issue_select(volatile struct scsidevice *hd, u_char target, u_char our_addr)
-{
- if (hd->scsi_ssts & (SSTS_INITIATOR|SSTS_TARGET|SSTS_BUSY))
- return (1);
-
- if (hd->scsi_ints & INTS_DISCON)
- hd->scsi_ints = INTS_DISCON;
-
- hd->scsi_pctl = 0;
- hd->scsi_temp = (1 << target) | our_addr;
- /* select timeout is hardcoded to 250ms */
- hd->scsi_tch = 2;
- hd->scsi_tcm = 113;
- hd->scsi_tcl = 3;
-
- hd->scsi_scmd = SCMD_SELECT;
- return (0);
-}
-
-static int
-wait_for_select(volatile struct scsidevice *hd)
-{
- int wait;
- u_char ints;
-
- wait = scsi_data_wait;
- while ((ints = hd->scsi_ints) == 0) {
- if (--wait < 0)
- return (1);
- DELAY(1);
- }
- hd->scsi_ints = ints;
- return (!(hd->scsi_ssts & SSTS_INITIATOR));
-}
-
-static int
-ixfer_start(volatile struct scsidevice *hd, int len, u_char phase, int wait)
-{
-
- hd->scsi_tch = len >> 16;
- hd->scsi_tcm = len >> 8;
- hd->scsi_tcl = len;
- hd->scsi_pctl = phase;
- hd->scsi_tmod = 0; /*XXX*/
- hd->scsi_scmd = SCMD_XFR | SCMD_PROG_XFR;
-
- /* wait for xfer to start or svc_req interrupt */
- while ((hd->scsi_ssts & SSTS_BUSY) == 0) {
- if (hd->scsi_ints || --wait < 0)
- return (0);
- DELAY(1);
- }
- return (1);
-}
-
-static int
-ixfer_out(volatile struct scsidevice *hd, int len, u_char *buf)
-{
- int wait = scsi_data_wait;
-
- for (; len > 0; --len) {
- while (hd->scsi_ssts & SSTS_DREG_FULL) {
- if (hd->scsi_ints || --wait < 0)
- return (len);
- DELAY(1);
- }
- hd->scsi_dreg = *buf++;
- }
- return (0);
-}
-
-static int
-ixfer_in(volatile struct scsidevice *hd, int len, u_char *buf)
-{
- int wait = scsi_data_wait;
-
- for (; len > 0; --len) {
- while (hd->scsi_ssts & SSTS_DREG_EMPTY) {
- if (hd->scsi_ints || --wait < 0) {
- while (! (hd->scsi_ssts & SSTS_DREG_EMPTY)) {
- *buf++ = hd->scsi_dreg;
- --len;
- }
- return (len);
- }
- DELAY(1);
- }
- *buf++ = hd->scsi_dreg;
- }
- return (len);
-}
-
-static int
-scsiicmd(struct scsi_softc *hs, int target, u_char *cbuf, int clen, u_char *buf,
- int len, u_char xferphase)
-{
- volatile struct scsidevice *hd = (struct scsidevice *)hs->sc_addr;
- u_char phase, ints;
- int wait;
-
- /* select the SCSI bus (it's an error if bus isn't free) */
- if (issue_select(hd, target, hs->sc_scsi_addr))
- return (-2);
- if (wait_for_select(hd))
- return (-2);
- /*
- * Wait for a phase change (or error) then let the device
- * sequence us through the various SCSI phases.
- */
- hs->sc_stat = -1;
- phase = CMD_PHASE;
- while (1) {
- wait = scsi_cmd_wait;
- switch (phase) {
-
- case CMD_PHASE:
- if (ixfer_start(hd, clen, phase, wait))
- if (ixfer_out(hd, clen, cbuf))
- goto abort;
- phase = xferphase;
- break;
-
- case DATA_IN_PHASE:
- if (len <= 0)
- goto abort;
- wait = scsi_data_wait;
- if (ixfer_start(hd, len, phase, wait) ||
- !(hd->scsi_ssts & SSTS_DREG_EMPTY))
- ixfer_in(hd, len, buf);
- phase = STATUS_PHASE;
- break;
-
- case DATA_OUT_PHASE:
- if (len <= 0)
- goto abort;
- wait = scsi_data_wait;
- if (ixfer_start(hd, len, phase, wait))
- if (ixfer_out(hd, len, buf))
- goto abort;
- phase = STATUS_PHASE;
- break;
-
- case STATUS_PHASE:
- wait = scsi_data_wait;
- if (ixfer_start(hd, sizeof(hs->sc_stat), phase, wait) ||
- !(hd->scsi_ssts & SSTS_DREG_EMPTY))
- ixfer_in(hd, sizeof(hs->sc_stat), &hs->sc_stat);
- phase = MESG_IN_PHASE;
- break;
-
- case MESG_IN_PHASE:
- if (ixfer_start(hd, sizeof(hs->sc_msg), phase, wait) ||
- !(hd->scsi_ssts & SSTS_DREG_EMPTY)) {
- ixfer_in(hd, sizeof(hs->sc_msg),
- (u_char *)&hs->sc_msg);
- hd->scsi_scmd = SCMD_RST_ACK;
- }
- phase = BUS_FREE_PHASE;
- break;
-
- case BUS_FREE_PHASE:
- goto out;
-
- default:
- printf("scsi%d: unexpected scsi phase %d\n",
- (int)(hs - scsi_softc), phase);
- goto abort;
- }
- /* wait for last command to complete */
- while ((ints = hd->scsi_ints) == 0) {
- if (--wait < 0)
- goto abort;
- DELAY(1);
- }
- hd->scsi_ints = ints;
- if (ints & INTS_SRV_REQ)
- phase = hd->scsi_psns & PHASE;
- else if (ints & INTS_DISCON)
- goto out;
- else if ((ints & INTS_CMD_DONE) == 0)
- goto abort;
- }
-abort:
- scsiabort(hs, hd);
-out:
- return (hs->sc_stat);
-}
-
-int
-scsi_test_unit_rdy(int ctlr, int slave)
-{
- struct scsi_softc *hs = &scsi_softc[ctlr];
- static struct scsi_cdb6 cdb = { CMD_TEST_UNIT_READY };
-
- return (scsiicmd(hs, slave, (u_char *)&cdb, sizeof(cdb),
- (u_char *)0, 0, STATUS_PHASE));
-}
-
-int
-scsi_request_sense(int ctlr, int slave, u_char *buf, u_int len)
-{
- struct scsi_softc *hs = &scsi_softc[ctlr];
- static struct scsi_cdb6 cdb = { CMD_REQUEST_SENSE };
-
- cdb.len = len;
- return (scsiicmd(hs, slave, (u_char *)&cdb, sizeof(cdb),
- buf, len, DATA_IN_PHASE));
-}
-
-int
-scsi_read_capacity(int ctlr, int slave, u_char *buf, u_int len)
-{
- struct scsi_softc *hs = &scsi_softc[ctlr];
- static struct scsi_cdb10 cdb = { CMD_READ_CAPACITY };
-
- return (scsiicmd(hs, slave, (u_char *)&cdb, sizeof(cdb),
- buf, len, DATA_IN_PHASE));
-}
-
-int
-scsi_tt_read(int ctlr, int slave, u_char *buf, u_int len, daddr32_t blk,
- u_int nblk)
-{
- struct scsi_softc *hs = &scsi_softc[ctlr];
- struct scsi_cdb10 cdb;
-
- bzero(&cdb, sizeof(cdb));
- cdb.cmd = CMD_READ_EXT;
- cdb.lbah = blk >> 24;
- cdb.lbahm = blk >> 16;
- cdb.lbalm = blk >> 8;
- cdb.lbal = blk;
- cdb.lenh = nblk / (256 * DEV_BSIZE);
- cdb.lenl = nblk / DEV_BSIZE;
- return (scsiicmd(hs, slave, (u_char *)&cdb, sizeof(cdb),
- buf, len, DATA_IN_PHASE));
-}
-
-int
-scsi_tt_write(int ctlr, int slave, u_char *buf, u_int len, daddr32_t blk,
- u_int nblk)
-{
- struct scsi_softc *hs = &scsi_softc[ctlr];
- struct scsi_cdb10 cdb;
-
- bzero(&cdb, sizeof(cdb));
- cdb.cmd = CMD_WRITE_EXT;
- cdb.lbah = blk >> 24;
- cdb.lbahm = blk >> 16;
- cdb.lbalm = blk >> 8;
- cdb.lbal = blk;
- cdb.lenh = nblk / (256 * DEV_BSIZE);
- cdb.lenl = nblk / DEV_BSIZE;
- return (scsiicmd(hs, slave, (u_char *)&cdb, sizeof(cdb),
- buf, len, DATA_OUT_PHASE));
-}
diff --git a/sys/arch/hp300/stand/common/sd.c b/sys/arch/hp300/stand/common/sd.c
deleted file mode 100644
index 9af149b02d7..00000000000
--- a/sys/arch/hp300/stand/common/sd.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/* $OpenBSD: sd.c,v 1.8 2013/02/02 13:34:29 miod Exp $ */
-/* $NetBSD: sd.c,v 1.9 1996/12/21 21:34:41 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of Lawrence Berkeley Laboratory and the Systems
- * Programming Group of the University of Utah Computer Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: sd.c 1.9 92/12/21$
- *
- * @(#)sd.c 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * SCSI CCS disk driver
- */
-
-#include <sys/param.h>
-#include <sys/disklabel.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-#include "scsireg.h"
-
-struct disklabel sdlabel;
-
-struct sdminilabel {
- u_short npart;
- u_long offset[MAXPARTITIONS];
-};
-
-struct sd_softc {
- int sc_ctlr;
- int sc_unit;
- int sc_part;
- char sc_retry;
- char sc_alive;
- short sc_blkshift;
- struct sdminilabel sc_pinfo;
-} sd_softc[NSCSI][NSD];
-
-#define SDRETRY 2
-
-int sdclose(struct open_file *);
-int sdgetinfo(struct sd_softc *);
-int sdinit(int, int);
-int sdopen(struct open_file *, int, int, int);
-void sdreset(int, int);
-int sdstrategy(struct sd_softc *, int, daddr32_t, size_t, void *, size_t *);
-
-int
-sdinit(int ctlr, int unit)
-{
- struct sd_softc *ss = &sd_softc[ctlr][unit];
- u_char stat;
- int capbuf[2];
-
- stat = scsi_test_unit_rdy(ctlr, unit);
- if (stat) {
- /* drive may be doing RTZ - wait a bit */
- if (stat == STS_CHECKCOND) {
- DELAY(1000000);
- stat = scsi_test_unit_rdy(ctlr, unit);
- }
- if (stat) {
- printf("sd(%d,%d,0,0): init failed (stat=%x)\n",
- ctlr, unit, stat);
- return (0);
- }
- }
- /*
- * try to get the drive block size.
- */
- capbuf[0] = 0;
- capbuf[1] = 0;
- stat = scsi_read_capacity(ctlr, unit,
- (u_char *)capbuf, sizeof(capbuf));
- if (stat == 0) {
- if (capbuf[1] > DEV_BSIZE)
- for (; capbuf[1] > DEV_BSIZE; capbuf[1] >>= 1)
- ++ss->sc_blkshift;
- }
- ss->sc_alive = 1;
- return (1);
-}
-
-void
-sdreset(int ctlr, int unit)
-{
-}
-
-char sdio_buf[MAXBSIZE];
-
-int
-sdgetinfo(struct sd_softc *ss)
-{
- struct sdminilabel *pi = &ss->sc_pinfo;
- struct disklabel *lp = &sdlabel;
- char *msg;
- int err, savepart;
- size_t i;
-
- bzero((caddr_t)lp, sizeof *lp);
- lp->d_secsize = (DEV_BSIZE << ss->sc_blkshift);
-
- /* Disklabel is always from RAW_PART. */
- savepart = ss->sc_part;
- ss->sc_part = RAW_PART;
- err = sdstrategy(ss, F_READ, LABELSECTOR,
- lp->d_secsize ? lp->d_secsize : DEV_BSIZE, sdio_buf, &i);
- ss->sc_part = savepart;
-
- if (err) {
- printf("sdgetinfo: sdstrategy error %d\n", err);
- return(0);
- }
-
- msg = getdisklabel(sdio_buf, lp);
- if (msg) {
- printf("sd(%d,%d,%d): WARNING: %s, ",
- ss->sc_ctlr, ss->sc_unit, ss->sc_part, msg);
- printf("defining `c' partition as entire disk\n");
- pi->npart = 3;
-#ifdef CD9660_DUMMYLABEL
- pi->offset[0] = 0;
- lp->d_partitions[0].p_fstype = FS_ISO9660; /* just for kicks */
-#else
- pi->offset[0] = -1;
-#endif
- pi->offset[1] = -1;
- pi->offset[2] = 0;
- } else {
- pi->npart = lp->d_npartitions;
- for (i = 0; i < pi->npart; i++)
- pi->offset[i] = lp->d_partitions[i].p_size == 0 ?
- -1 : lp->d_partitions[i].p_offset;
- }
- return(1);
-}
-
-int
-sdopen(struct open_file *f, int ctlr, int unit, int part)
-{
- struct sd_softc *ss;
-
-#ifdef SD_DEBUG
- if (debug)
- printf("sdopen: ctlr=%d unit=%d part=%d\n",
- ctlr, unit, part);
-#endif
-
- if (ctlr >= NSCSI || scsialive(ctlr) == 0)
- return (EADAPT);
- if (unit >= NSD)
- return (ECTLR);
- ss = &sd_softc[ctlr][unit];
- ss->sc_part = part;
- ss->sc_unit = unit;
- ss->sc_ctlr = ctlr;
- if (ss->sc_alive == 0) {
- if (sdinit(ctlr, unit) == 0)
- return (ENXIO);
- if (sdgetinfo(ss) == 0)
- return (ERDLAB);
- }
- if (part != RAW_PART && /* always allow RAW_PART to be opened */
- (part >= ss->sc_pinfo.npart || ss->sc_pinfo.offset[part] == -1))
- return (EPART);
- f->f_devdata = (void *)ss;
- return (0);
-}
-
-int
-sdclose(struct open_file *f)
-{
- struct sd_softc *ss = f->f_devdata;
-
- /*
- * Mark the disk `not alive' so that the disklabel
- * will be re-loaded at next open.
- */
- bzero(ss, sizeof(sd_softc));
- f->f_devdata = NULL;
-
- return (0);
-}
-
-int
-sdstrategy(struct sd_softc *ss, int func, daddr32_t dblk, size_t size,
- void *v_buf, size_t *rsize)
-{
- char *buf = v_buf;
- int ctlr = ss->sc_ctlr;
- int unit = ss->sc_unit;
- u_int nblk = size >> ss->sc_blkshift;
- daddr32_t blk;
- char stat;
-
- if (size == 0)
- return(0);
-
- /*
- * Don't do partition translation on the `raw partition'.
- */
- blk = (dblk + ((ss->sc_part == RAW_PART) ? 0 :
- ss->sc_pinfo.offset[ss->sc_part])) >> ss->sc_blkshift;
-
- ss->sc_retry = 0;
-
-#ifdef SD_DEBUG
- if (debug)
- printf("sdstrategy(%d,%d): size=%d blk=%d nblk=%d\n",
- ctlr, unit, size, blk, nblk);
-#endif
-
-retry:
- if (func == F_READ)
- stat = scsi_tt_read(ctlr, unit, buf, size, blk, nblk);
- else
- stat = scsi_tt_write(ctlr, unit, buf, size, blk, nblk);
- if (stat) {
- printf("sd(%d,%d,%d): block=%x, error=0x%x\n",
- ctlr, unit, ss->sc_part, blk, stat);
- if (++ss->sc_retry > SDRETRY)
- return(EIO);
- goto retry;
- }
- *rsize = size;
-
- return(0);
-}
diff --git a/sys/arch/hp300/stand/common/version.c b/sys/arch/hp300/stand/common/version.c
deleted file mode 100644
index 84ffcd059cb..00000000000
--- a/sys/arch/hp300/stand/common/version.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* $OpenBSD: version.c,v 1.16 2014/02/23 19:22:40 miod Exp $ */
-
-/*
- * Record major changes in the boot code here, and increment the version
- * number.
- */
-
-/*
- * 2.0 INITIAL REVISION
- * 2.1 APCI support, config changes from NetBSD.
- * 2.2 Grand reorganization.
- * 2.3 Added CD9660 boot support.
- * 2.4 Added/fixed 425e support.
- * 2.5 Added SYS_CDBOOT.
- * 2.6 Fixed RTC reading for 2001.
- * 2.7 Minor syncs with the kernel (recognize more models and use the same
- * logic to pick the console on 425e).
- * 2.8 TurboVRX frame buffer support.
- * 2.9 SGC frame buffers support, bug fixes and code cleanup.
- * 2.10 Blind SGC support on models 362 and 382, turned out to be useless.
- * 2.11 sti@dio frame buffer support (for models 362 and 382), and various
- * cleanups.
- * 2.12 Switch to MI loadfile code.
- * 2.13 Allow kernels with uppercase characters in their names to be loaded
- * from the default boot device without an explicit device or a leading
- * `/'.
- * 2.14 Build with the ELF toolchain.
- * 2.15 Remove SLOWSCSI from scsi code, and increase target selection timeout.
- * 2.16 Loadfile support for .openbsd.randomdata section.
- * 2.17 /etc/random.seed support in uboot (SYS_UBOOT).
- */
-
-const char version[] = "2.17";
diff --git a/sys/arch/hp300/stand/include/consdefs.h b/sys/arch/hp300/stand/include/consdefs.h
deleted file mode 100644
index 2d46d88f7cc..00000000000
--- a/sys/arch/hp300/stand/include/consdefs.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* $OpenBSD: consdefs.h,v 1.5 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: consdefs.h,v 1.2 1997/05/12 07:45:41 thorpej Exp $ */
-
-/*
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <dev/cons.h>
-
-/*
- * Console routine prototypes.
- */
-void cninit(void);
-int cngetc(void);
-void cnputc(int);
-
-#ifdef STICONSOLE
-void stiprobe(struct consdev *);
-void stiinit(struct consdev *);
-int stigetchar(dev_t);
-void stiputchar(dev_t, int);
-#endif
-#ifdef ITECONSOLE
-void iteprobe(struct consdev *);
-void iteinit(struct consdev *);
-int itegetchar(dev_t);
-void iteputchar(dev_t, int);
-#endif
-#ifdef DCACONSOLE
-void dcaprobe(struct consdev *);
-void dcainit(struct consdev *);
-int dcagetchar(dev_t);
-void dcaputchar(dev_t, int);
-#endif
-#ifdef APCICONSOLE
-void apciprobe(struct consdev *);
-void apciinit(struct consdev *);
-int apcigetchar(dev_t);
-void apciputchar(dev_t, int);
-#endif
-#ifdef DCMCONSOLE
-void dcmprobe(struct consdev *);
-void dcminit(struct consdev *);
-int dcmgetchar(dev_t);
-void dcmputchar(dev_t, int);
-#endif
diff --git a/sys/arch/hp300/stand/include/device.h b/sys/arch/hp300/stand/include/device.h
deleted file mode 100644
index 1147efa30c2..00000000000
--- a/sys/arch/hp300/stand/include/device.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* $OpenBSD: device.h,v 1.3 2011/08/18 20:02:58 miod Exp $ */
-/* $NetBSD: device.h,v 1.1 1997/01/30 10:31:44 thorpej Exp $ */
-
-/*
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)device.h 8.1 (Berkeley) 6/10/93
- */
-
-struct hp_hw {
- caddr_t hw_kva; /* kernel virtual address of control space */
- short hw_type; /* type (defined below) */
- short hw_sc; /* select code (if applicable) */
- int hw_ctrl; /* controller number */
-};
-
-#define MAXCTLRS 16 /* Size of HW table (arbitrary) */
-
-/* controller types */
-#define C_MASK 0xF0
-#define C_HPIB 0x10
-#define C_SCSI 0x20
-/* device types (controllers with no slaves) */
-#define D_MASK 0x0F
-#define D_BITMAP 0x01
-#define D_LAN 0x02
-#define D_COMMDCM 0x03
-
-#define HW_ISHPIB(hw) (((hw)->hw_type & C_MASK) == C_HPIB)
-#define HW_ISSCSI(hw) (((hw)->hw_type & C_MASK) == C_SCSI)
-#define HW_ISDEV(hw,d) (((hw)->hw_type & D_MASK) == (d))
diff --git a/sys/arch/hp300/stand/include/grf_dvreg.h b/sys/arch/hp300/stand/include/grf_dvreg.h
deleted file mode 100644
index fe45b6b63cf..00000000000
--- a/sys/arch/hp300/stand/include/grf_dvreg.h
+++ /dev/null
@@ -1,190 +0,0 @@
-/* $OpenBSD: grf_dvreg.h,v 1.1 2005/01/19 17:09:32 miod Exp $ */
-/* $NetBSD: grf_dvreg.h,v 1.5 1994/10/26 07:23:50 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_dvreg.h 1.5 92/01/21$
- *
- * @(#)grf_dvreg.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <hp300/dev/iotypes.h> /* XXX */
-
-/*
- * Map of the DaVinci frame buffer controller chip in memory ...
- */
-
-#define db_waitbusy(regaddr) \
- while (((struct dvboxfb *)(regaddr))->wbusy || \
- ((struct dvboxfb *)(regaddr))->as_busy) DELAY(100)
-
-struct rgb {
- u_char :8, :8, :8;
- vu_char red;
- u_char :8, :8, :8;
- vu_char green;
- u_char :8, :8, :8;
- vu_char blue;
-};
-
-struct dvboxfb {
- u_char :8;
- vu_char reset; /* reset register 0x01 */
- u_char fb_address; /* frame buffer address 0x02 */
- vu_char interrupt; /* interrupt register 0x03 */
- u_char :8;
- vu_char fbwmsb; /* frame buffer width MSB 0x05 */
- u_char :8;
- vu_char fbwlsb; /* frame buffer width MSB 0x07 */
- u_char :8;
- vu_char fbhmsb; /* frame buffer height MSB 0x09 */
- u_char :8;
- vu_char fbhlsb; /* frame buffer height MSB 0x0b */
- u_char :8;
- vu_char dwmsb; /* display width MSB 0x0d */
- u_char :8;
- vu_char dwlsb; /* display width MSB 0x0f */
- u_char :8;
- vu_char dhmsb; /* display height MSB 0x11 */
- u_char :8;
- vu_char dhlsb; /* display height MSB 0x13 */
- u_char :8;
- vu_char fbid; /* frame buffer id 0x15 */
- u_char f1[0x47];
- vu_char fbomsb; /* frame buffer offset MSB 0x5d */
- u_char :8;
- vu_char fbolsb; /* frame buffer offset LSB 0x5f */
- u_char f2[16359];
- vu_char wbusy; /* Window move in progress 0x4047 */
- u_char f3[0x405b-0x4047-1];
- vu_char as_busy; /* Scan accessing frame buf. 0x405B */
- u_char f4[0x4090-0x405b-1];
- vu_int fbwen; /* Frame buffer write enable 0x4090 */
- u_char f5[0x409f-0x4090-4];
- vu_char wmove; /* Initiate window move. 0x409F */
- u_char f6[0x40b3-0x409f-1];
- vu_char fold; /* Byte/longword per pixel 0x40B3 */
- u_char f7[0x40b7-0x40b3-1];
- vu_char opwen; /* Overlay plane write enable 0x40B7 */
- u_char f8[0x40bf-0x40b7-1];
- vu_char drive; /* Select FB vs. Overlay. 0x40BF */
-
- u_char f8a[0x40cb-0x40bf-1];
- vu_char zconfig; /* Z buffer configuration 0x40CB */
- u_char f8b[0x40cf-0x40cb-1];
- vu_char alt_rr; /* Alternate replacement rule 0x40CF */
- u_char f8c[0x40d3-0x40cf-1];
- vu_char zrr; /* Z replacement rule 0x40D3 */
-
- u_char f9[0x40d7-0x40d3-1];
- vu_char en_scan; /* Enable scan DTACK. 0x40D7 */
- u_char f10[0x40ef-0x40d7-1];
- vu_char rep_rule; /* Replacement rule 0x40EF */
- u_char f11[0x40f2-0x40ef-1];
- vu_short source_x; /* Window source X origin 0x40F2 */
- u_char f12[0x40f6-0x40f2-2];
- vu_short source_y; /* Window source Y origin 0x40F6 */
- u_char f13[0x40fa-0x40f6-2];
- vu_short dest_x; /* Window dest X origin 0x40FA */
- u_char f14[0x40fe -0x40fa-2];
- vu_short dest_y; /* Window dest Y origin 0x40FE */
- u_char f15[0x4102-0x40fe -2];
- vu_short wwidth; /* Window width 0x4102 */
- u_char f16[0x4106-0x4102-2];
- vu_short wheight; /* Window height 0x4106 */
- u_char f17[0x6003-0x4106-2];
- vu_char cmapbank; /* Bank select (0 or 1) 0x6003 */
- u_char f18[0x6007-0x6003-1];
- vu_char dispen; /* Display enable 0x6007 */
-
- u_char f18a[0x600B-0x6007-1];
- vu_char fbvenp; /* Frame buffer video enable 0x600B */
- u_char f18b[0x6017-0x600B-1];
- vu_char fbvens; /* fbvenp blink counterpart 0x6017 */
-
- u_char f19[0x6023-0x6017-1];
- vu_char vdrive; /* Video display mode 0x6023 */
- u_char f20[0x6083-0x6023-1];
- vu_char panxh; /* Pan display in X (high) 0x6083 */
- u_char f21[0x6087-0x6083-1];
- vu_char panxl; /* Pan display in X (low) 0x6087 */
- u_char f22[0x608b-0x6087-1];
- vu_char panyh; /* Pan display in Y (high) 0x608B */
- u_char f23[0x608f-0x608b-1];
- vu_char panyl; /* Pan display in Y (low) 0x608F */
- u_char f24[0x6093-0x608f-1];
- vu_char zoom; /* Zoom factor 0x6093 */
- u_char f25[0x6097-0x6093-1];
- vu_char pz_trig; /* Pan & zoom trigger 0x6097 */
- u_char f26[0x609b-0x6097-1];
- vu_char ovly0p; /* Overlay 0 primary map 0x609B */
- u_char f27[0x609f-0x609b-1];
- vu_char ovly1p; /* Overlay 1 primary map 0x609F */
- u_char f28[0x60a3-0x609f-1];
- vu_char ovly0s; /* Overlay 0 secondary map 0x60A3 */
- u_char f29[0x60a7-0x60a3-1];
- vu_char ovly1s; /* Overlay 1 secondary map 0x60A7 */
- u_char f30[0x60ab-0x60a7-1];
- vu_char opvenp; /* Overlay video enable 0x60AB */
- u_char f31[0x60af-0x60ab-1];
- vu_char opvens; /* Overlay blink enable 0x60AF */
- u_char f32[0x60b3-0x60af-1];
- vu_char fv_trig; /* Trigger control registers 0x60B3 */
- u_char f33[0x60b7-0x60b3-1];
- vu_char cdwidth; /* Iris cdwidth timing reg. 0x60B7 */
- u_char f34[0x60bb-0x60b7-1];
- vu_char chstart; /* Iris chstart timing reg. 0x60BB */
- u_char f35[0x60bf-0x60bb-1];
- vu_char cvwidth; /* Iris cvwidth timing reg. 0x60BF */
- u_char f36[0x6100-0x60bf-1];
- struct rgb rgb[8]; /* overlay color map */
- u_char f37[0x6403-0x6100-sizeof(struct rgb)*8];
- vu_char red0;
- u_char f38[0x6803-0x6403-1];
- vu_char green0;
- u_char f39[0x6c03-0x6803-1];
- vu_char blue0;
- u_char f40[0x7403-0x6c03-1];
- vu_char red1;
- u_char f41[0x7803-0x7403-1];
- vu_char green1;
- u_char f42[0x7c03-0x7803-1];
- vu_char blue1;
- u_char f43[0x8012-0x7c03-1];
- vu_short status1; /* Master Status register 0x8012 */
- u_char f44[0xC226-0x8012-2];
- vu_short trans; /* Transparency 0xC226 */
- u_char f45[0xC23E -0xC226-2];
- vu_short pstop; /* Pace value control 0xc23e */
-};
diff --git a/sys/arch/hp300/stand/include/grf_gbreg.h b/sys/arch/hp300/stand/include/grf_gbreg.h
deleted file mode 100644
index 7778851e58b..00000000000
--- a/sys/arch/hp300/stand/include/grf_gbreg.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/* $OpenBSD: grf_gbreg.h,v 1.1 2005/01/19 17:09:32 miod Exp $ */
-/* $NetBSD: grf_gbreg.h,v 1.4 1994/10/26 07:23:53 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_gbreg.h 1.11 92/01/21$
- *
- * @(#)grf_gbreg.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <hp300/dev/iotypes.h> /* XXX */
-
-/*
- * Gatorbox driver regs
- */
-
-#define TILER_ENABLE 0x80
-#define LINE_MOVER_ENABLE 0x80
-#define UP_LEFT 0x00
-#define DOWN_RIGHT 0x40
-#define MOVE_UP_LEFT TILER_ENABLE|UP_LEFT
-#define MOVE_DOWN_RIGHT TILER_ENABLE|DOWN_RIGHT
-
-#define tile_mover_waitbusy(regaddr) \
- while (((struct gboxfb *)(regaddr))->sec_interrupt & 0x10)
-
-#define line_mover_waitbusy(regaddr) \
- while ((((struct gboxfb *)(regaddr))->status & 0x80) == 0)
-
-#define gbcm_waitbusy(regaddr) \
- while (((struct gboxfb *)(regaddr))->cmap_busy != 0xff)
-
-struct gboxfb {
- u_char :8;
- vu_char reset; /* reset register 0x01 */
- vu_char sec_interrupt; /* Secondary interrupt register 0x03 */
- vu_char interrupt; /* interrupt register 0x03 */
- u_char :8;
- vu_char fbwmsb; /* frame buffer width MSB 0x05 */
- u_char :8;
- vu_char fbwlsb; /* frame buffer width MSB 0x07 */
- u_char :8;
- vu_char fbhmsb; /* frame buffer height MSB 0x09 */
- u_char :8;
- vu_char fbhlsb; /* frame buffer height MSB 0x0b */
- u_char :8;
- vu_char dwmsb; /* display width MSB 0x0d */
- u_char :8;
- vu_char dwlsb; /* display width MSB 0x0f */
- u_char :8;
- vu_char dhmsb; /* display height MSB 0x11 */
- u_char :8;
- vu_char dhlsb; /* display height MSB 0x13 */
- u_char :8;
- vu_char fbid; /* Scondary frame buffer id 0x15 */
- u_char f1[0x5d-0x15-1];
- vu_char fbomsb; /* frame buffer offset MSB 0x5d */
- u_char :8;
- vu_char fbolsb; /* frame buffer offset LSB 0x5f */
- u_char f2[0x4000-0x5f-1];
- vu_char crtc_address; /* CTR controller address reg 0x4000 */
- vu_char status; /* Status register 0x4001 */
- vu_char crtc_data; /* CTR controller data reg 0x4002 */
- u_char f3[6];
- vu_char line_mover_rep_rule; /* Line move rep rule */
- u_char :8, :8;
- vu_char line_mover_width; /* Line move width */
- u_char f4[0xff3];
- vu_char width; /* width in tiles 0x5001 */
- u_char :8;
- vu_char height; /* height in tiles 0x5003 */
- u_char f5[3];
- vu_char rep_rule; /* replacement rule 0x5007 */
- u_char f6[0x6001-0x5007-1];
- vu_char blink1; /* blink 1 0x6001 */
- u_char f7[3];
- vu_char blink2; /* blink 2 0x6005 */
- u_char f8[3];
- vu_char write_protect; /* write protect 0x6009 */
- u_char f9[0x6803-0x6009-1];
- vu_char cmap_busy; /* color map busy 0x6803 */
- u_char f10[0x68b9-0x6803-1];
- vu_char creg_select; /* color map register select 0x68b8 */
- u_char f11[0x68f1-0x68b9-1];
- vu_char cmap_write; /* color map write trigger 0x68f1 */
- u_char f12[0x69b3-0x68f1-1];
- vu_char cmap_red; /* red value register 0x69b3 */
- u_char :8;
- vu_char cmap_grn; /* green value register 0x69b5 */
- u_char :8;
- vu_char cmap_blu; /* blue value register 0x69b6 */
-};
diff --git a/sys/arch/hp300/stand/include/grf_hyreg.h b/sys/arch/hp300/stand/include/grf_hyreg.h
deleted file mode 100644
index 6d0ea53d2d0..00000000000
--- a/sys/arch/hp300/stand/include/grf_hyreg.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* $OpenBSD: grf_hyreg.h,v 1.1 2005/01/19 17:09:32 miod Exp $ */
-/* $NetBSD: grf_hyreg.h,v 1.2 1994/10/26 07:23:57 cgd Exp $ */
-
-/*
- * Copyright (c) 1991 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department and Mark Davies of the Department of Computer
- * Science, Victoria University of Wellington, New Zealand.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_hyreg.h 1.1 92/01/22$
- *
- * @(#)grf_hyreg.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <hp300/dev/iotypes.h> /* XXX */
-
-struct hyboxfb {
- u_char :8;
- vu_char reset; /* reset register 0x01 */
- vu_char fb_address; /* frame buffer address 0x02 */
- vu_char interrupt; /* interrupt register 0x03 */
- u_char :8;
- vu_char fbwmsb; /* frame buffer width MSB 0x05 */
- u_char :8;
- vu_char fbwlsb; /* frame buffer width MSB 0x07 */
- u_char :8;
- vu_char fbhmsb; /* frame buffer height MSB 0x09 */
- u_char :8;
- vu_char fbhlsb; /* frame buffer height MSB 0x0b */
- u_char :8;
- vu_char dwmsb; /* display width MSB 0x0d */
- u_char :8;
- vu_char dwlsb; /* display width MSB 0x0f */
- u_char :8;
- vu_char dhmsb; /* display height MSB 0x11 */
- u_char :8;
- vu_char dhlsb; /* display height MSB 0x13 */
- u_char :8;
- vu_char fbid; /* Scondary frame buffer id 0x15 */
- u_char :8;
- vu_char bits; /* square(0)/double-high(1) 0x17 */
- u_char f1[0x5b-0x17-1];
- vu_char num_planes; /* number of color planes 0x5b */
- u_char :8;
- vu_char fbomsb; /* frame buffer offset MSB 0x5d */
- u_char :8;
- vu_char fbolsb; /* frame buffer offset LSB 0x5f */
- u_char f2[0x4000-0x5f-1];
- vu_char nblank; /* display enable planes 0x4000 */
-};
-
diff --git a/sys/arch/hp300/stand/include/grf_rbreg.h b/sys/arch/hp300/stand/include/grf_rbreg.h
deleted file mode 100644
index b868ae7b51a..00000000000
--- a/sys/arch/hp300/stand/include/grf_rbreg.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/* $OpenBSD: grf_rbreg.h,v 1.2 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: grf_rbreg.h,v 1.4 1994/10/26 07:24:03 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_rbreg.h 1.9 92/01/21$
- *
- * @(#)grf_rbreg.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * Map of the Renaissance frame buffer controller chip in memory ...
- */
-
-#include <hp300/dev/iotypes.h> /* XXX */
-
-#define rb_waitbusy(regaddr) \
- while (((struct rboxfb *)(regaddr))->wbusy & 0x01) DELAY(100)
-
-#define CM1RED ((struct rencm *)(ip->regbase + 0x6400))
-#define CM1GRN ((struct rencm *)(ip->regbase + 0x6800))
-#define CM1BLU ((struct rencm *)(ip->regbase + 0x6C00))
-#define CM2RED ((struct rencm *)(ip->regbase + 0x7400))
-#define CM2GRN ((struct rencm *)(ip->regbase + 0x7800))
-#define CM2BLU ((struct rencm *)(ip->regbase + 0x7C00))
-
-struct rencm {
- u_char :8, :8, :8;
- vu_char value;
-};
-
-struct rboxfb {
- u_char filler1[1];
- vu_char reset; /* reset register 0x01 */
- vu_char fb_address; /* frame buffer address 0x02 */
- vu_char interrupt; /* interrupt register 0x03 */
- u_char filler1a;
- vu_char fbwmsb; /* frame buffer width MSB 0x05 */
- u_char filler1b;
- vu_char fbwlsb; /* frame buffer width MSB 0x07 */
- u_char filler1c;
- vu_char fbhmsb; /* frame buffer height MSB 0x09 */
- u_char filler1d;
- vu_char fbhlsb; /* frame buffer height MSB 0x0b */
- u_char filler1e;
- vu_char dwmsb; /* display width MSB 0x0d */
- u_char filler1f;
- vu_char dwlsb; /* display width MSB 0x0f */
- u_char filler1g;
- vu_char dhmsb; /* display height MSB 0x11 */
- u_char filler1h;
- vu_char dhlsb; /* display height MSB 0x13 */
- u_char filler1i;
- vu_char fbid; /* frame buffer id 0x15 */
- u_char filler1j[0x47];
- vu_char fbomsb; /* frame buffer offset MSB 0x5d */
- u_char filler1k;
- vu_char fbolsb; /* frame buffer offset LSB 0x5f */
- u_char filler2[16359];
- vu_char wbusy; /* window mover is active 0x4047 */
- u_char filler3[0x405b - 0x4048];
- vu_char scanbusy; /* scan converteris active 0x405B */
- u_char filler3b[0x4083 - 0x405c];
- vu_char video_enable; /* drive vid. refresh bus 0x4083 */
- u_char filler4[3];
- vu_char display_enable; /* enable the display 0x4087 */
- u_char filler5[8];
- vu_int write_enable; /* write enable register 0x4090 */
- u_char filler6[11];
- vu_char wmove; /* start window mover 0x409f */
- u_char filler7[3];
- vu_char blink; /* blink register 0x40a3 */
- u_char filler8[15];
- vu_char fold; /* fold register 0x40b3 */
- vu_int opwen; /* overlay plane write enable 0x40b4 */
- u_char filler9[3];
- vu_char tmode; /* Tile mode size 0x40bb */
- u_char filler9a[3];
- vu_char drive; /* drive register 0x40bf */
- u_char filler10[3];
- vu_char vdrive; /* vdrive register 0x40c3 */
- u_char filler10a[0x40cb-0x40c4];
- vu_char zconfig; /* Z-buffer mode 0x40cb */
- u_char filler11a[2];
- vu_short tpatt; /* Transparency pattern 0x40ce */
- u_char filler11b[3];
- vu_char dmode; /* dither mode 0x40d3 */
- u_char filler11c[3];
- vu_char en_scan; /* enable scan board to DTACK 0x40d7 */
- u_char filler11d[0x40ef-0x40d8];
- vu_char rep_rule; /* replacement rule 0x40ef */
- u_char filler12[2];
- vu_short source_x; /* source x 0x40f2 */
- u_char filler13[2];
- vu_short source_y; /* source y 0x40f6 */
- u_char filler14[2];
- vu_short dest_x; /* dest x 0x40fa */
- u_char filler15[2];
- vu_short dest_y; /* dest y 0x40fe */
- u_char filler16[2];
- vu_short wwidth; /* window width 0x4102 */
- u_char filler17[2];
- vu_short wheight; /* window height 0x4106 */
- u_char filler18[18];
- vu_short patt_x; /* pattern x 0x411a */
- u_char filler19[2];
- vu_short patt_y; /* pattern y 0x411e */
- u_char filler20[0x8012 - 0x4120];
- vu_short te_status; /* transform engine status 0x8012 */
- u_char filler21[0x1ffff-0x8014];
-};
diff --git a/sys/arch/hp300/stand/include/grf_tcreg.h b/sys/arch/hp300/stand/include/grf_tcreg.h
deleted file mode 100644
index b08dedc079e..00000000000
--- a/sys/arch/hp300/stand/include/grf_tcreg.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/* $OpenBSD: grf_tcreg.h,v 1.1 2005/01/19 17:09:32 miod Exp $ */
-/* $NetBSD: grf_tcreg.h,v 1.6 1994/10/26 07:24:06 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: grf_tcreg.h 1.11 92/01/21$
- *
- * @(#)grf_tcreg.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <hp300/dev/iotypes.h> /* XXX */
-
-#define tccm_waitbusy(regaddr) \
- while (((struct tcboxfb *)(regaddr))->cmap_busy & 0x04) DELAY(100)
-
-#define tc_waitbusy(regaddr,planes) \
- while (((struct tcboxfb *)(regaddr))->busy & planes) DELAY(100)
-
-struct tcboxfb {
- u_char :8;
- vu_char reset; /* reset register 0x01 */
- vu_char fb_address; /* frame buffer address 0x02 */
- vu_char interrupt; /* interrupt register 0x03 */
- u_char :8;
- vu_char fbwmsb; /* frame buffer width MSB 0x05 */
- u_char :8;
- vu_char fbwlsb; /* frame buffer width MSB 0x07 */
- u_char :8;
- vu_char fbhmsb; /* frame buffer height MSB 0x09 */
- u_char :8;
- vu_char fbhlsb; /* frame buffer height MSB 0x0b */
- u_char :8;
- vu_char dwmsb; /* display width MSB 0x0d */
- u_char :8;
- vu_char dwlsb; /* display width MSB 0x0f */
- u_char :8;
- vu_char dhmsb; /* display height MSB 0x11 */
- u_char :8;
- vu_char dhlsb; /* display height MSB 0x13 */
- u_char :8;
- vu_char fbid; /* Scondary frame buffer id 0x15 */
- u_char :8;
- vu_char bits; /* square(0)/double-high(1) 0x17 */
- u_char f1[0x5b-0x17-1];
- vu_char num_planes; /* number of color planes 0x5b */
- u_char :8;
- vu_char fbomsb; /* frame buffer offset MSB 0x5d */
- u_char :8;
- vu_char fbolsb; /* frame buffer offset LSB 0x5f */
- u_char f2[0x4040-0x5f-1];
- vu_char vblank; /* vertical blanking 0x4040 */
- u_char :8,:8,:8;
- vu_char busy; /* window move active 0x4044 */
- u_char :8,:8,:8;
- vu_char vtrace_request; /* vert retrace intr request 0x4048 */
- u_char :8,:8,:8;
- vu_char move_request; /* window move intr request 0x404C */
- u_char f3[0x4080-0x404c-1];
- vu_char nblank; /* display enable planes 0x4080 */
- u_char f4[0x4088-0x4080-1];
- vu_char wen; /* write enable plane 0x4088 */
- u_char f5[0x408c-0x4088-1];
- vu_char ren; /* read enable plane 0x408c */
- u_char f6[0x4090-0x408c-1];
- vu_char fben; /* frame buffer write enable 0x4090 */
- u_char f7[0x409c-0x4090-1];
- vu_char wmove; /* start window move 0x409c */
- u_char f8[0x40a0-0x409c-1];
- vu_char blink; /* enable blink planes 0x40a0 */
- u_char f9[0x40a8-0x40a0-1];
- vu_char altframe; /* enable alternate frame 0x40a8 */
- u_char f10[0x40ac-0x40a8-1];
- vu_char curon; /* cursor control register 0x40ac */
- u_char f11[0x40ea-0x40ac-1];
- vu_char prr; /* pixel replacement rule 0x40ea */
- u_char f12[0x40ef-0x40ea-1];
- vu_char wmrr; /* move replacement rule 0x40ef */
- u_char f13[0x40f2-0x40ef-1];
- vu_short source_x; /* source x pixel # 0x40f2 */
- u_char f14[0x40f6-0x40f2-2];
- vu_short source_y; /* source y pixel # 0x40f6 */
- u_char f15[0x40fa-0x40f6-2];
- vu_short dest_x; /* dest x pixel # 0x40fa */
- u_char f16[0x40fe -0x40fa-2];
- vu_short dest_y; /* dest y pixel # 0x40fe */
- u_char f17[0x4102-0x40fe -2];
- vu_short wwidth; /* block mover pixel width 0x4102 */
- u_char f18[0x4106-0x4102-2];
- vu_short wheight; /* block mover pixel height 0x4106 */
- /* Catseye */
- u_char f19[0x4206-0x4106-2];
- vu_short rug_cmdstat; /* RUG Command/Staus 0x4206 */
- u_char f20[0x4510-0x4206-2];
- vu_short vb_select; /* Vector/BitBlt Select 0x4510 */
- vu_short tcntrl; /* Three Operand Control 0x4512 */
- vu_short acntrl; /* BitBlt Mode 0x4514 */
- vu_short pncntrl; /* Plane Control 0x4516 */
- u_char f21[0x4800-0x4516-2];
- vu_short catseye_status; /* Catseye Status 0x4800 */
- /* End of Catseye */
- u_char f22[0x6002-0x4800-2];
- vu_short cmap_busy; /* Color Ram busy 0x6002 */
- u_char f23[0x60b2-0x6002-2];
- vu_short rdata; /* color map red data 0x60b2 */
- vu_short gdata; /* color map green data 0x60b4 */
- vu_short bdata; /* color map blue data 0x60b6 */
- vu_short cindex; /* color map index 0x60b8 */
- vu_short plane_mask; /* plane mask select 0x60ba */
- u_char f24[0x60f0-0x60ba-2];
- vu_short strobe; /* color map trigger 0x60f0 */
-};
diff --git a/sys/arch/hp300/stand/include/hilreg.h b/sys/arch/hp300/stand/include/hilreg.h
deleted file mode 100644
index ef70853fc8d..00000000000
--- a/sys/arch/hp300/stand/include/hilreg.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/* $OpenBSD: hilreg.h,v 1.2 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: hilreg.h,v 1.6 1997/02/02 09:39:21 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: hilreg.h 1.10 92/01/21$
- *
- * @(#)hilreg.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <hp300/dev/iotypes.h> /* XXX */
-
-struct hil_dev {
- char hil_pad0;
- vu_char hil_data;
- char hil_pad1;
- vu_char hil_cmd;
-#define hil_stat hil_cmd
-};
-
-#define HILADDR ((struct hil_dev *)IIOV(0x428000))
-
-#define READHILDATA(x) ((x)->hil_data)
-#define READHILSTAT(x) ((x)->hil_stat)
-#define READHILCMD(x) ((x)->hil_cmd)
-#define WRITEHILDATA(x, y) ((x)->hil_data = (y))
-#define WRITEHILSTAT(x, y) ((x)->hil_stat = (y))
-#define WRITEHILCMD(x, y) ((x)->hil_cmd = (y))
-
-#define HIL_BUSY 0x02
-#define HIL_DATA_RDY 0x01
-
-#define HILWAIT(hil_dev) while ((READHILSTAT(hil_dev) & HIL_BUSY))
-#define HILDATAWAIT(hil_dev) while (!(READHILSTAT(hil_dev) & HIL_DATA_RDY))
-
-/* HIL status bits */
-#define HIL_POLLDATA 0x10 /* HIL poll data follows */
-#define HIL_COMMAND 0x08 /* Start of original command */
-#define HIL_ERROR 0x080 /* HIL error */
-#define HIL_RECONFIG 0x080 /* HIL has reconfigured */
-#define HIL_STATMASK (HIL_DATA | HIL_COMMAND)
-
-#define HIL_SSHIFT 4 /* Bits to shift status over */
-#define HIL_SMASK 0xF /* Service request status mask */
-#define HIL_DEVMASK 0x07
-
-/* HIL status types */
-#define HIL_STATUS 0x5 /* HIL status in data register */
-#define HIL_DATA 0x6 /* HIL data in data register */
-#define HIL_CTRLSHIFT 0x8 /* key + CTRL + SHIFT */
-#define HIL_CTRL 0x9 /* key + CTRL */
-#define HIL_SHIFT 0xA /* key + SHIFT */
-#define HIL_KEY 0xB /* key only */
-#define HIL_68K 0x4 /* Data from the 68k is ready */
-
-/* HIL commands */
-#define HIL_SETARD 0xA0 /* set auto-repeat delay */
-#define HIL_SETARR 0xA2 /* set auto-repeat rate */
-#define HIL_SETTONE 0xA3 /* set tone generator */
-#define HIL_CNMT 0xB2 /* clear nmi */
-#define HIL_INTON 0x5C /* Turn on interrupts. */
-#define HIL_INTOFF 0x5D /* Turn off interrupts. */
-#define HIL_TRIGGER 0xC5 /* trigger command */
-#define HIL_STARTCMD 0xE0 /* start loop command */
-#define HIL_TIMEOUT 0xFE /* timeout */
-#define HIL_READTIME 0x13 /* Read real time register */
-
-/* Read/write various registers on the 8042. */
-#define HIL_READBUSY 0x02 /* internal "busy" register */
-#define HIL_READKBDLANG 0x12 /* read keyboard language code */
-#define HIL_READKBDSADR 0xF9
-#define HIL_WRITEKBDSADR 0xE9
-#define HIL_READLPSTAT 0xFA
-#define HIL_WRITELPSTAT 0xEA
-#define HIL_READLPCTRL 0xFB
-#define HIL_WRITELPCTRL 0xEB
-
-/* BUSY bits */
-#define BSY_LOOPBUSY 0x04
-
-/* LPCTRL bits */
-#define LPC_AUTOPOLL 0x01 /* enable auto-polling */
-#define LPC_NOERROR 0x02 /* don't report errors */
-#define LPC_NORECONF 0x04 /* don't report reconfigure */
-#define LPC_KBDCOOK 0x10 /* cook all keyboards */
-#define LPC_RECONF 0x80 /* reconfigure the loop */
-
-/* LPSTAT bits */
-#define LPS_DEVMASK 0x07 /* number of loop devices */
-#define LPS_CONFGOOD 0x08 /* reconfiguration worked */
-#define LPS_CONFFAIL 0x80 /* reconfiguration failed */
-
-/* HIL packet headers */
-#define HIL_MOUSEDATA 0x2
-#define HIL_KBDDATA 0x40
-
-#define HIL_MOUSEMOTION 0x02 /* mouse movement event */
-#define HIL_KBDBUTTON 0x40 /* keyboard button event */
-#define HIL_MOUSEBUTTON 0x40 /* mouse button event */
-#define HIL_BUTTONBOX 0x60 /* button box event */
-#define HIL_TABLET 0x02 /* tablet motion event */
-#define HIL_KNOBBOX 0x03 /* knob box motion data */
-
-/* For setting auto repeat on the keyboard */
-#define ar_format(x) ~((x - 10) / 10)
-#define KBD_ARD 400 /* initial delay in msec (10 - 2560) */
-#define KBD_ARR 60 /* rate (10 - 2550 msec, 2551 == off) */
-
-/* Magic */
-#define KBDNMISTAT ((volatile char *)IIOV(0x478005))
-#define KBDNMI 0x04
-
-/* keyboard status */
-#define KBD_CHARMASK 0x7F
-#define KBD_CTRLSHIFT 0x8 /* key + CTRL + SHIFT */
-#define KBD_CTRL 0x9 /* key + CTRL */
-#define KBD_SHIFT 0xA /* key + SHIFT */
-#define KBD_KEY 0xB /* key only */
-
diff --git a/sys/arch/hp300/stand/include/hpibvar.h b/sys/arch/hp300/stand/include/hpibvar.h
deleted file mode 100644
index a083db26667..00000000000
--- a/sys/arch/hp300/stand/include/hpibvar.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* $OpenBSD: hpibvar.h,v 1.4 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: hpibvar.h,v 1.4 1994/10/26 07:27:24 cgd Exp $ */
-
-/*
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)hpibvar.h 8.1 (Berkeley) 6/10/93
- */
-
-#define HPIBA 32
-#define HPIBB 1
-#define HPIBC 8
-#define HPIBA_BA 21
-#define HPIBC_BA 30
-
-#define CSA_BA 0x1F
-
-#define C_DCL 20
-#define C_LAG 32
-#define C_UNL 63
-#define C_TAG 64
-#define C_UNA 94
-#define C_UNT 95
-#define C_SCG 96
-
-struct hpib_softc {
- char sc_alive;
- char sc_type;
- int sc_ba;
- char *sc_addr;
-};
-
-extern struct hpib_softc hpib_softc[];
-
-/*
- * Description structure for CS/80 devices.
- */
-
-struct cs80_describe {
- u_int d_iuw:16, /* controller: installed unit word */
- d_cmaxxfr:16, /* controller: max transfer rate (Kb) */
- d_ctype:8, /* controller: controller type */
- d_utype:8, /* unit: unit type */
- d_name:24, /* unit: name (6 BCD digits) */
- d_sectsize:16, /* unit: # of bytes per block (sector) */
- d_blkbuf:8, /* unit: # of blocks which can be buffered */
- d_burstsize:8, /* unit: recommended burst size */
- d_blocktime:16, /* unit: block time (u-sec) */
- d_uavexfr:16, /* unit: average transfer rate (Kb) */
- d_retry:16, /* unit: optimal retry time (1/100-sec) */
- d_access:16, /* unit: access time param (1/100-sec) */
- d_maxint:8, /* unit: maximum interleave */
- d_fvbyte:8, /* unit: fixed volume byte */
- d_rvbyte:8, /* unit: removable volume byte */
- d_maxcyl:24, /* volume: maximum cylinder */
- d_maxhead:8, /* volume: maximum head */
- d_maxsect:16, /* volume: maximum sector on track */
- d_maxvsecth:16, /* volume: maximum sector on volume (MSW) */
- d_maxvsectl:32, /* volume: maximum sector on volume (LSWs) */
- d_interleave:8; /* volume: current interleave */
-} __packed;
-
-int hpibalive(int);
-void hpibgo(int, int, int, void *, int, int);
-int hpibid(int, int);
-int hpibrecv(int, int, int, void *, int);
-int hpibsend(int, int, int, void *, int);
-int hpibswait(int, int);
-
-int fhpibinit(int);
-int fhpibppoll(int);
-int fhpibrecv(int, int, int, char *, int);
-int fhpibsend(int, int, int, char *, int);
-int nhpibinit(int);
-int nhpibppoll(int);
-int nhpibrecv(int, int, int, char *, int);
-int nhpibsend(int, int, int, char *, int);
diff --git a/sys/arch/hp300/stand/include/if_lereg.h b/sys/arch/hp300/stand/include/if_lereg.h
deleted file mode 100644
index 56341370c0a..00000000000
--- a/sys/arch/hp300/stand/include/if_lereg.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/* $OpenBSD: if_lereg.h,v 1.3 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: if_lereg.h,v 1.1 1996/01/01 18:10:56 thorpej Exp $ */
-
-/*
- * Copyright (c) 1982, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)if_lereg.h 7.1 (Berkeley) 5/8/90
- */
-
-#define LEID 21
-
-#define NTBUF 2
-#define TLEN 1
-#define NRBUF 8
-#define RLEN 3
-#define BUFSIZE 1518
-
-#define vu_char volatile u_char
-#define vu_short volatile u_short
-
-/*
- * LANCE registers.
- */
-struct lereg0 {
- u_char ler0_pad0;
- vu_char ler0_id; /* ID */
- u_char ler0_pad1;
- vu_char ler0_status; /* interrupt enable/status */
-};
-
-/*
- * Control and status bits -- lereg0
- */
-#define LE_IE 0x80 /* interrupt enable */
-#define LE_IR 0x40 /* interrupt requested */
-#define LE_LOCK 0x08 /* lock status register */
-#define LE_ACK 0x04 /* ack of lock */
-#define LE_JAB 0x02 /* loss of tx clock (???) */
-#define LE_IPL(x) ((((x) >> 4) & 0x3) + 3)
-
-struct lereg1 {
- vu_short ler1_rdp; /* data port */
- vu_short ler1_rap; /* register select port */
-};
-
-/*
- * Control and status bits -- lereg1
- */
-#define LE_SERR 0x8000
-#define LE_BABL 0x4000
-#define LE_CERR 0x2000
-#define LE_MISS 0x1000
-#define LE_MERR 0x0800
-#define LE_RINT 0x0400
-#define LE_TINT 0x0200
-#define LE_IDON 0x0100
-#define LE_INTR 0x0080
-#define LE_INEA 0x0040
-#define LE_RXON 0x0020
-#define LE_TXON 0x0010
-#define LE_TDMD 0x0008
-#define LE_STOP 0x0004
-#define LE_STRT 0x0002
-#define LE_INIT 0x0001
-
-#define LE_BSWP 0x0004
-#define LE_ACON 0x0002
-#define LE_BCON 0x0001
-
-/*
- * Overlayed on 16K dual-port RAM.
- * Current size is 15,284 bytes with 8 x 1518 receive buffers and
- * 2 x 1518 transmit buffers.
- */
-
-/*
- * LANCE initialization block
- */
-struct init_block {
- u_short mode; /* mode register */
- u_char padr[6]; /* ethernet address */
- u_long ladrf[2]; /* logical address filter (multicast) */
- u_short rdra; /* low order pointer to receive ring */
- u_short rlen; /* high order pointer and no. rings */
- u_short tdra; /* low order pointer to transmit ring */
- u_short tlen; /* high order pointer and no rings */
-};
-
-/*
- * Mode bits -- init_block
- */
-#define LE_PROM 0x8000 /* promiscuous */
-#define LE_INTL 0x0040 /* internal loopback */
-#define LE_DRTY 0x0020 /* disable retry */
-#define LE_COLL 0x0010 /* force collision */
-#define LE_DTCR 0x0008 /* disable transmit crc */
-#define LE_LOOP 0x0004 /* loopback */
-#define LE_DTX 0x0002 /* disable transmitter */
-#define LE_DRX 0x0001 /* disable receiver */
-#define LE_NORMAL 0x0000
-
-/*
- * Message descriptor
- */
-struct mds {
- u_short addr;
- u_short flags;
- u_short bcnt;
- u_short mcnt;
-};
-
-/* Message descriptor flags */
-#define LE_OWN 0x8000 /* owner bit, 0=host, 1=LANCE */
-#define LE_ERR 0x4000 /* error */
-#define LE_STP 0x0200 /* start of packet */
-#define LE_ENP 0x0100 /* end of packet */
-
-/* Receive ring status flags */
-#define LE_FRAM 0x2000 /* framing error error */
-#define LE_OFLO 0x1000 /* silo overflow */
-#define LE_CRC 0x0800 /* CRC error */
-#define LE_RBUFF 0x0400 /* buffer error */
-
-/* Transmit ring status flags */
-#define LE_MORE 0x1000 /* more than 1 retry */
-#define LE_ONE 0x0800 /* one retry */
-#define LE_DEF 0x0400 /* deferred transmit */
-
-/* Transmit errors */
-#define LE_TBUFF 0x8000 /* buffer error */
-#define LE_UFLO 0x4000 /* silo underflow */
-#define LE_LCOL 0x1000 /* late collision */
-#define LE_LCAR 0x0800 /* loss of carrier */
-#define LE_RTRY 0x0400 /* tried 16 times */
diff --git a/sys/arch/hp300/stand/include/itereg.h b/sys/arch/hp300/stand/include/itereg.h
deleted file mode 100644
index c4566e0292e..00000000000
--- a/sys/arch/hp300/stand/include/itereg.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* $OpenBSD: itereg.h,v 1.2 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: itereg.h,v 1.5 1994/10/26 07:24:39 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: itereg.h 1.3 92/01/21$
- *
- * @(#)itereg.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * Offsets into the display ROM that is part of the first 4K of each
- * display device.
- */
-#define FONTROM 0x3B /* Offset of font information structure. */
-#define FONTADDR 0x4 /* Offset from FONTROM to font address. */
-#define FONTHEIGHT 0x0 /* Offset from font address to font height. */
-#define FONTWIDTH 0x2 /* Offset from font address to font width. */
-#define FONTDATA 0xA /* Offset from font address to font glyphs. */
-
-#define FBBASE ((volatile u_char *)ip->fbbase)
diff --git a/sys/arch/hp300/stand/include/itevar.h b/sys/arch/hp300/stand/include/itevar.h
deleted file mode 100644
index 12c46c0f330..00000000000
--- a/sys/arch/hp300/stand/include/itevar.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/* $OpenBSD: itevar.h,v 1.6 2011/08/18 20:02:58 miod Exp $ */
-/* $NetBSD: itevar.h,v 1.1 1996/03/03 04:23:42 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: itevar.h 1.15 92/12/20$
- *
- * @(#)itevar.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * Standalone version of hp300 ITE.
- */
-
-struct ite_data;
-
-typedef void (*ite_windowmover)(struct ite_data *, int, int, int, int, int,
- int, int);
-
-struct ite_data {
- int alive;
- int scode; /* DIO select code or SGC slot # */
- struct itesw *isw;
- caddr_t regbase, fbbase;
- short curx, cury;
- short cursorx, cursory;
- short cblankx, cblanky;
- short rows, cols;
- short cpl;
- short dheight, dwidth;
- short fbheight, fbwidth;
- short ftheight, ftwidth;
- short fontx, fonty;
- short planemask;
- ite_windowmover bmv;
-};
-
-struct itesw {
- int ite_hwid;
- int (*ite_probe)(struct ite_data *);
- void (*ite_init)(struct ite_data *);
- void (*ite_clear)(struct ite_data *, int, int, int, int);
- void (*ite_putc)(struct ite_data *, int, int, int);
- void (*ite_cursor)(struct ite_data *, int);
- void (*ite_scroll)(struct ite_data *);
-};
-
-/*
- * X and Y location of character 'c' in the framebuffer, in pixels.
- */
-#define charX(ip,c) \
- (((c) % (ip)->cpl) * (ip)->ftwidth + (ip)->fontx)
-
-#define charX1bpp(ip,c) \
- (((c) % (ip)->cpl) * ((((ip)->ftwidth + 7) / 8) * 8) + (ip)->fontx)
-
-#define charY(ip,c) \
- (((c) / (ip)->cpl) * (ip)->ftheight + (ip)->fonty)
-
-/* Replacement Rules */
-#define RR_CLEAR 0x0
-#define RR_COPY 0x3
-#define RR_XOR 0x6
-#define RR_COPYINVERTED 0xc
-
-#define DRAW_CURSOR 0x00
-#define ERASE_CURSOR 0x01
-#define MOVE_CURSOR 0x02
-
-extern struct ite_data ite_data[];
-extern struct itesw itesw[];
-extern int nitesw;
-
-/*
- * Prototypes.
- */
-void ite_fontinfo(struct ite_data *);
-void ite_fontinit1bpp(struct ite_data *);
-void ite_fontinit8bpp(struct ite_data *);
-void ite_dio_clear(struct ite_data *, int, int, int, int);
-void ite_dio_cursor(struct ite_data *, int);
-void ite_dio_putc1bpp(struct ite_data *, int, int, int);
-void ite_dio_putc8bpp(struct ite_data *, int, int, int);
-void ite_dio_scroll(struct ite_data *);
-void ite_dio_windowmove1bpp(struct ite_data *, int, int, int, int,
- int, int, int);
-
-/*
- * Framebuffer-specific ITE prototypes.
- */
-void topcat_init(struct ite_data *);
-void gbox_init(struct ite_data *);
-void gbox_scroll(struct ite_data *);
-void rbox_init(struct ite_data *);
-void dvbox_init(struct ite_data *);
-void hyper_init(struct ite_data *);
-void tvrx_init(struct ite_data *);
-
-int sti_dio_probe(struct ite_data *);
-void sti_iteinit_dio(struct ite_data *);
-void sti_iteinit_sgc(struct ite_data *);
-void sti_clear(struct ite_data *, int, int, int, int);
-void sti_putc(struct ite_data *, int, int, int);
-void sti_cursor(struct ite_data *, int);
-void sti_scroll(struct ite_data *);
diff --git a/sys/arch/hp300/stand/include/kbdvar.h b/sys/arch/hp300/stand/include/kbdvar.h
deleted file mode 100644
index a21e7cd5ae0..00000000000
--- a/sys/arch/hp300/stand/include/kbdvar.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* $OpenBSD: kbdvar.h,v 1.5 2008/06/26 05:42:10 ray Exp $ */
-/* $NetBSD: kbdvar.h,v 1.1 1997/04/14 19:00:13 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1997 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Structure definitions and prototypes for the indirect keyboard driver
- * for standalone ITE.
- */
-
-struct kbdsw {
- int (*k_getc)(void); /* get character */
- void (*k_nmi)(void); /* handle non-maskable interrupt */
- int (*k_init)(void); /* probe/initialize keyboard */
-};
-
-#ifdef ITECONSOLE
-
-extern struct kbdsw kbdsw[];
-
-int kbdgetc(void);
-void kbdinit(void);
-void kbdnmi(void);
-
-#ifdef HIL_KEYBOARD
-int hilkbd_getc(void);
-int hilkbd_init(void);
-void hilkbd_nmi(void);
-#endif
-
-#ifdef DOMAIN_KEYBOARD
-int dnkbd_getc(void);
-int dnkbd_init(void);
-void dnkbd_nmi(void);
-#endif
-#endif /* ITECONSOLE */
diff --git a/sys/arch/hp300/stand/include/maskbits.h b/sys/arch/hp300/stand/include/maskbits.h
deleted file mode 100644
index 4cd160a7645..00000000000
--- a/sys/arch/hp300/stand/include/maskbits.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/* $OpenBSD: maskbits.h,v 1.1 2006/08/05 09:58:57 miod Exp $ */
-
-/*-
- * Copyright (c) 1994
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)maskbits.h 8.2 (Berkeley) 3/21/94
- */
-
-/*
- * Derived from X11R4
- */
-
-/* the following notes use the following conventions:
-SCREEN LEFT SCREEN RIGHT
-in this file and maskbits.c, left and right refer to screen coordinates,
-NOT bit numbering in registers.
-
-starttab[n]
- bits[0,n-1] = 0 bits[n,31] = 1
-endtab[n] =
- bits[0,n-1] = 1 bits[n,31] = 0
-
-maskbits(x, w, startmask, endmask, nlw)
- for a span of width w starting at position x, returns
-a mask for ragged bits at start, mask for ragged bits at end,
-and the number of whole longwords between the ends.
-
-*/
-
-#define maskbits(x, w, startmask, endmask, nlw) \
-do { \
- startmask = starttab[(x) & 0x1f]; \
- endmask = endtab[((x) + (w)) & 0x1f]; \
- if (startmask) \
- nlw = (((w) - (32 - ((x) & 0x1f))) >> 5); \
- else \
- nlw = (w) >> 5; \
-} while (0)
-
-#define FASTGETBITS(psrc, x, w, dst) \
- asm ("bfextu %3{%1:%2},%0" \
- : "=d" (dst) : "di" (x), "di" (w), "o" (*(char *)(psrc)))
-
-#define FASTPUTBITS(src, x, w, pdst) \
- asm ("bfins %3,%0{%1:%2}" \
- : "=o" (*(char *)(pdst)) \
- : "di" (x), "di" (w), "d" (src), "0" (*(char *) (pdst)))
-
-#define getandputrop(psrc, srcbit, dstbit, width, pdst, rop) \
-do { \
- unsigned int _tmpsrc, _tmpdst; \
- FASTGETBITS(pdst, dstbit, width, _tmpdst); \
- FASTGETBITS(psrc, srcbit, width, _tmpsrc); \
- DoRop(_tmpdst, rop, _tmpsrc, _tmpdst); \
- FASTPUTBITS(_tmpdst, dstbit, width, pdst); \
-} while (0)
-
-#define getandputrop0(psrc, srcbit, width, pdst, rop) \
- getandputrop(psrc, srcbit, 0, width, pdst, rop)
-
-#define getunalignedword(psrc, x, dst) \
-do { \
- int _tmp; \
- FASTGETBITS(psrc, x, 32, _tmp); \
- dst = _tmp; \
-} while (0)
-
-#define fnCLEAR(src, dst) (0)
-#define fnCOPY(src, dst) (src)
-#define fnXOR(src, dst) ((src) ^ (dst))
-#define fnCOPYINVERTED(src, dst) (~(src))
-
-#define DoRop(result, alu, src, dst) \
-do { \
- switch (alu) { \
- case RR_CLEAR: \
- default: \
- result = fnCLEAR(src, dst); \
- break; \
- case RR_COPY: \
- result = fnCOPY(src, dst); \
- break; \
- case RR_XOR: \
- result = fnXOR(src, dst); \
- break; \
- case RR_COPYINVERTED: \
- result = fnCOPYINVERTED(src, dst); \
- break; \
- } \
-} while (0)
diff --git a/sys/arch/hp300/stand/include/rominfo.h b/sys/arch/hp300/stand/include/rominfo.h
deleted file mode 100644
index c7a824e3a96..00000000000
--- a/sys/arch/hp300/stand/include/rominfo.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* $OpenBSD: rominfo.h,v 1.3 2013/02/02 13:34:29 miod Exp $ */
-/* $NetBSD: rominfo.h,v 1.5 1994/10/26 07:27:53 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: rominfo.h 1.2 88/05/24$
- *
- * @(#)rominfo.h 8.1 (Berkeley) 6/10/93
- */
-
-#define ROMADDR 0xFFFFF000
-
-struct jmpvec {
- short op; /* jmp instruction */
- long addr; /* address */
-} __packed;
-
-struct rominfo {
- char p1[0xDC0];
- short boottype; /* ?? (FFFFFDC0) */
- char name[10]; /* HP system name, e.g. SYSHPUX (FFFFFDC2) */
- short p2; /* ?? (FFFFFDCC) */
- long lowram; /* lowest useable RAM location (FFFFFDCE) */
- char p3[0x100]; /* ?? (FFFFFDD2) */
- char sysflag; /* HP system flags (FFFFFED2) */
- char p4; /* ?? (FFFFFED3) */
- long rambase; /* physaddr of lowest RAM (FFFFFED4) */
- char ndrives; /* number of drives (FFFFFED8) */
- char p5; /* ?? (FFFFFED9) */
- char sysflag2; /* more system flags (FFFFFEDA) */
- char p6; /* ?? (FFFFFEDB) */
- long msus; /* ?? (FFFFFEDC) */
- struct jmpvec jvec[48]; /* jump vectors (FFFFFEE0) */
-} __packed;
diff --git a/sys/arch/hp300/stand/include/samachdep.h b/sys/arch/hp300/stand/include/samachdep.h
deleted file mode 100644
index 6463bae7706..00000000000
--- a/sys/arch/hp300/stand/include/samachdep.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* $OpenBSD: samachdep.h,v 1.9 2013/04/01 12:55:27 miod Exp $ */
-/* $NetBSD: samachdep.h,v 1.3 1997/05/12 07:54:45 thorpej Exp $ */
-
-/*
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)samachdep.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/types.h>
-#include <machine/hp300spu.h>
-
-#define NHPIB 4
-#define NSCSI 2
-#define NHD 8
-#define NCT 8
-#define NSD 8
-
-#define NITE 4
-
-/* from cpu.h */
-#define INTIOBASE (0x00400000)
-#define IIOV(x) (x)
-
-#define MHZ_8 1
-#define MHZ_16 2
-#define MHZ_25 3
-#define MHZ_33 4
-#define MHZ_50 6
-
-extern int cpuspeed, machineid, mmuid;
-extern int howto;
-extern u_int opendev;
-extern u_int bootdev;
-extern int userom;
-
-int badaddr(char *);
-void call_req_reboot(void);
-void exec(char *, void *, int);
-char *getmachineid(void);
-void hpibinit(void);
-void romout(int, char *);
-void romputchar(int);
-void scsiinit(void);
-u_long sctoaddr(int);
-int tgets(char *);
-
-#define DELAY(n) { int N = cpuspeed * (n); while (--N > 0); }
-
-/*
- * Switch we use to set punit in devopen.
- */
-struct punitsw {
- int (*p_punit)(int, int, int *);
-};
-extern struct punitsw punitsw[];
-
-extern struct fs_ops file_system_rawfs[];
-extern struct fs_ops file_system_ufs[];
-extern struct fs_ops file_system_nfs[];
-extern struct fs_ops file_system_cd9660[];
diff --git a/sys/arch/hp300/stand/include/scsireg.h b/sys/arch/hp300/stand/include/scsireg.h
deleted file mode 100644
index 708bcd32c97..00000000000
--- a/sys/arch/hp300/stand/include/scsireg.h
+++ /dev/null
@@ -1,483 +0,0 @@
-/* $OpenBSD: scsireg.h,v 1.4 2013/02/02 13:34:29 miod Exp $ */
-/* $NetBSD: scsireg.h,v 1.4 1994/10/26 07:24:59 cgd Exp $ */
-
-/*
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)scsireg.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * HP 98265A SCSI Interface Hardware Description.
- */
-
-struct scsidevice {
- u_char p0, scsi_id;
-#define ID_MASK 0x1f
-#define SCSI_ID 0x07
-#define ID_WORD_DMA 0x20
- u_char p2, scsi_csr;
-#define CSR_IE 0x80
-#define CSR_IR 0x40
-#define SCSI_IPL(csr) ((((csr)>>4)&3)+3)
-#define CSR_DMA32 0x08
-#define CSR_DMAIN 0x04
-#define CSR_DE1 0x02
-#define CSR_DE0 0x01
- u_char p4, scsi_wrap;
-#define WRAP_REQ 0x80
-#define WRAP_ACK 0x40
-#define WRAP_BSY 0x08
-#define WRAP_MSG 0x04
-#define WRAP_CD 0x02
-#define WRAP_IO 0x01
- u_char p6, scsi_hconf;
-#define HCONF_TP 0x80
-#define SCSI_SYNC_XFER(hconf) (((hconf)>>5)&3)
-#define HCONF_SD 0x10
-#define HCONF_PARITY 0x08
- u_char p8[24];
- u_char p32, scsi_bdid;
- u_char p34, scsi_sctl;
-#define SCTL_DISABLE 0x80
-#define SCTL_CTRLRST 0x40
-#define SCTL_DIAG 0x20
-#define SCTL_ABRT_ENAB 0x10
-#define SCTL_PARITY_ENAB 0x08
-#define SCTL_SEL_ENAB 0x04
-#define SCTL_RESEL_ENAB 0x02
-#define SCTL_INTR_ENAB 0x01
- u_char p36, scsi_scmd;
-#define SCMD_RST 0x10
-#define SCMD_ICPT_XFR 0x08
-#define SCMD_PROG_XFR 0x04
-#define SCMD_PAD 0x01 /* if initiator */
-#define SCMD_PERR_STOP 0x01 /* if target */
- /* command codes */
-#define SCMD_BUS_REL 0x00
-#define SCMD_SELECT 0x20
-#define SCMD_RST_ATN 0x40
-#define SCMD_SET_ATN 0x60
-#define SCMD_XFR 0x80
-#define SCMD_XFR_PAUSE 0xa0
-#define SCMD_RST_ACK 0xc0
-#define SCMD_SET_ACK 0xe0
- u_char p38, scsi_tmod;
-#define TMOD_SYNC 0x80
- u_char p40, scsi_ints;
-#define INTS_SEL 0x80
-#define INTS_RESEL 0x40
-#define INTS_DISCON 0x20
-#define INTS_CMD_DONE 0x10
-#define INTS_SRV_REQ 0x08
-#define INTS_TIMEOUT 0x04
-#define INTS_HARD_ERR 0x02
-#define INTS_RST 0x01
- u_char p42, scsi_psns;
-#define PSNS_REQ 0x80
-#define PSNS_ACK 0x40
-#define PSNS_ATN 0x20
-#define PSNS_SEL 0x10
-#define PSNS_BSY 0x08
- u_char p44, scsi_ssts;
-#define SSTS_INITIATOR 0x80
-#define SSTS_TARGET 0x40
-#define SSTS_BUSY 0x20
-#define SSTS_XFR 0x10
-#define SSTS_ACTIVE (SSTS_INITIATOR|SSTS_XFR)
-#define SSTS_RST 0x08
-#define SSTS_TCZERO 0x04
-#define SSTS_DREG_FULL 0x02
-#define SSTS_DREG_EMPTY 0x01
- u_char p46, scsi_serr;
-#define SERR_SCSI_PAR 0x80
-#define SERR_SPC_PAR 0x40
-#define SERR_TC_PAR 0x08
-#define SERR_PHASE_ERR 0x04
-#define SERR_SHORT_XFR 0x02
-#define SERR_OFFSET 0x01
- u_char p48, scsi_pctl;
-#define PCTL_BFINT_ENAB 0x80
- u_char p50, scsi_mbc;
- u_char p52, scsi_dreg;
- u_char p54, scsi_temp;
- u_char p56, scsi_tch;
- u_char p58, scsi_tcm;
- u_char p60, scsi_tcl;
- u_char p62, scsi_exbf;
-};
-
-/* psns/pctl phase lines as bits */
-#define PHASE_MSG 0x04
-#define PHASE_CD 0x02 /* =1 if 'command' */
-#define PHASE_IO 0x01 /* =1 if data inbound */
-/* Phase lines as values */
-#define PHASE 0x07 /* mask for psns/pctl phase */
-#define DATA_OUT_PHASE 0x00
-#define DATA_IN_PHASE 0x01
-#define CMD_PHASE 0x02
-#define STATUS_PHASE 0x03
-#define BUS_FREE_PHASE 0x04
-#define ARB_SEL_PHASE 0x05 /* Fuji chip combines arbitration with sel. */
-#define MESG_OUT_PHASE 0x06
-#define MESG_IN_PHASE 0x07
-
-/* SCSI Messages */
-
-#define MSG_CMD_COMPLETE 0x00
-#define MSG_EXT_MESSAGE 0x01
-#define MSG_SAVE_DATA_PTR 0x02
-#define MSG_RESTORE_PTR 0x03
-#define MSG_DISCONNECT 0x04
-#define MSG_INIT_DETECT_ERROR 0x05
-#define MSG_ABORT 0x06
-#define MSG_REJECT 0x07
-#define MSG_NOOP 0x08
-#define MSG_PARITY_ERROR 0x09
-#define MSG_BUS_DEVICE_RESET 0x0C
-#define MSG_IDENTIFY 0x80
-#define MSG_IDENTIFY_DR 0xc0 /* (disconnect/reconnect allowed) */
-#define MSG_SYNC_REQ 0x01
-
-/* SCSI Commands */
-
-#define CMD_TEST_UNIT_READY 0x00
-#define CMD_REQUEST_SENSE 0x03
-#define CMD_INQUIRY 0x12
-#define CMD_SEND_DIAGNOSTIC 0x1D
-
-#define CMD_REWIND 0x01
-#define CMD_REZERO 0x01
-#define CMD_FORMAT_UNIT 0x04
-#define CMD_READ_BLOCK_LIMITS 0x05
-#define CMD_REASSIGN_BLOCKS 0x07
-#define CMD_READ 0x08
-#define CMD_WRITE 0x0A
-#define CMD_WRITE_FILEMARK 0x10
-#define CMD_SPACE 0x11
-#define CMD_MODE_SELECT 0x15
-#define CMD_RELEASE_UNIT 0x17
-#define CMD_ERASE 0x19
-#define CMD_MODE_SENSE 0x1A
-#define CMD_LOADUNLOAD 0x1B
-#define CMD_RECEIVE_DIAG 0x1C
-#define CMD_SEND_DIAG 0x1D
-#define CMD_P_A_MEDIA_REMOVAL 0x1E
-#define CMD_READ_CAPACITY 0x25
-#define CMD_READ_EXT 0x28
-#define CMD_WRITE_EXT 0x2A
-#define CMD_READ_DEFECT_DATA 0x37
-#define SD_MANUFAC_DEFECTS 0x14000000
-#define SD_GROWN_DEFECTS 0x0c000000
-#define CMD_READ_BUFFER 0x3B
-#define CMD_WRITE_BUFFER 0x3C
-#define CMD_READ_FULL 0xF0
-#define CMD_MEDIA_TEST 0xF1
-#define CMD_ACCESS_LOG 0xF2
-#define CMD_WRITE_FULL 0xFC
-#define CMD_MANAGE_PRIMARY 0xFD
-#define CMD_EXECUTE_DATA 0xFE
-
-/* SCSI status bits */
-
-#define STS_CHECKCOND 0x02 /* Check Condition (ie., read sense) */
-#define STS_CONDMET 0x04 /* Condition Met (ie., search worked) */
-#define STS_BUSY 0x08
-#define STS_INTERMED 0x10 /* Intermediate status sent */
-#define STS_EXT 0x80 /* Extended status valid */
-
-/* command descriptor blocks */
-
-struct scsi_cdb6 {
- u_char cmd; /* command code */
- u_char lun: 3, /* logical unit on ctlr */
- lbah: 5; /* msb of read/write logical block addr */
- u_char lbam; /* middle byte of l.b.a. */
- u_char lbal; /* lsb of l.b.a. */
- u_char len; /* transfer length */
- u_char xtra;
-};
-
-struct scsi_cdb10 {
- u_char cmd; /* command code */
- u_char lun: 3, /* logical unit on ctlr */
- : 4,
- rel: 1; /* l.b.a. is relative addr if =1 */
- u_char lbah; /* msb of read/write logical block addr */
- u_char lbahm; /* high middle byte of l.b.a. */
- u_char lbalm; /* low middle byte of l.b.a. */
- u_char lbal; /* lsb of l.b.a. */
- u_char reserved;
- u_char lenh; /* msb transfer length */
- u_char lenl; /* lsb transfer length */
- u_char xtra;
-};
-
-/* basic sense data */
-
-struct scsi_sense {
- u_char valid: 1, /* l.b.a. is valid */
- class: 3,
- code: 4;
- u_char vu: 4, /* vendor unique */
- lbah: 4;
- u_char lbam;
- u_char lbal;
-};
-
-struct scsi_xsense {
- u_char valid: 1, /* l.b.a. is valid */
- class: 3,
- code: 4;
- u_char segment;
- u_char filemark: 1,
- eom: 1,
- ili: 1, /* illegal length indicator */
- rsvd: 1,
- key: 4;
- u_char info1;
- u_char info2;
- u_char info3;
- u_char info4;
- u_char len; /* additional sense length */
-};
-
-/* inquiry data */
-struct scsi_inquiry {
- u_char type;
- u_char qual;
- u_char version;
- u_char rsvd;
- u_char len;
- char class[3];
- char vendor_id[8];
- char product_id[16];
- char rev[4];
-};
-
-struct scsi_format_parms { /* physical BFI format */
- u_short reserved;
- u_short list_len;
- struct defect {
- unsigned cyl : 24;
- unsigned head : 8;
- long bytes_from_index;
- } defect[127];
-};
-
-struct scsi_reassign_parms {
- u_short reserved;
- u_short list_len; /* length in bytes of defects only */
- struct new_defect {
- unsigned lba; /* logical block address */
- } new_defect[2];
-};
-
-struct scsi_modesel_hdr {
- u_char rsvd1;
- u_char media_type;
- u_char rsvd2;
- u_char block_desc_len;
- u_int density : 8;
- u_int number_blocks :24;
- u_int rsvd3 : 8;
- u_int block_length :24;
-};
-
-struct scsi_modesense_hdr {
- u_char len;
- u_char media_type;
- u_char wp : 1;
- u_char rsvd1 : 7;
- u_char block_desc_len;
- u_int density : 8;
- u_int number_blocks :24;
- u_int rsvd2 : 8;
- u_int block_length :24;
-};
-
-/*
- * Mode Select / Mode sense "pages"
- */
-
-/*
- * Page One - Error Recovery Parameters
- */
-struct scsi_err_recovery {
- u_char page_savable : 1; /* save parameters */
- u_char reserved : 1;
- u_char page_code : 6; /* = 0x01 */
- u_char page_length; /* = 6 */
- u_char awre : 1; /* auto write realloc enabled */
- u_char arre : 1; /* auto read realloc enabled */
- u_char tb : 1; /* transfer block */
- u_char rc : 1; /* read continuous */
- u_char eec : 1; /* enable early correction */
- u_char per : 1; /* post error */
- u_char dte : 1; /* disable transfer on error */
- u_char dcr : 1; /* disable correction */
- u_char retry_count;
- u_char correction_span;
- u_char head_offset_count;
- u_char strobe_offset_count;
- u_char recovery_time_limit;
-};
-
-/*
- * Page Two - Disconnect / Reconnect Control Parameters
- */
-struct scsi_disco_reco {
- u_char page_savable : 1; /* save parameters */
- u_char rsvd : 1;
- u_char page_code : 6; /* = 0x02 */
- u_char page_length; /* = 10 */
- u_char buffer_full_ratio; /* write, how full before reconnect? */
- u_char buffer_empty_ratio; /* read, how full before reconnect? */
-
- u_short bus_inactivity_limit; /* how much bus time for busy */
- u_short disconnect_time_limit; /* min to remain disconnected */
- u_short connect_time_limit; /* min to remain connected */
- u_short reserved_1;
-};
-
-/*
- * Page Three - Direct Access Device Format Parameters
- */
-struct scsi_format {
- u_char page_savable : 1; /* save parameters */
- u_char rsvd : 1;
- u_char page_code : 6; /* = 0x03 */
- u_char page_length; /* = 22 */
- u_short tracks_per_zone; /* Handling of Defects Fields */
- u_short alt_sect_zone;
- u_short alt_tracks_zone;
- u_short alt_tracks_vol;
- u_short sect_track; /* Track Format Field */
- u_short data_sect; /* Sector Format Fields */
- u_short interleave;
- u_short track_skew_factor;
- u_short cyl_skew_factor;
- u_char ssec : 1; /* Drive Type Field */
- u_char hsec : 1;
- u_char rmb : 1;
- u_char surf : 1;
- u_char ins : 1;
- u_char reserved_1 : 3;
- u_char reserved_2;
- u_char reserved_3;
- u_char reserved_4;
-};
-
-/*
- * Page Four - Rigid Disk Drive Geometry Parameters
- */
-struct scsi_geometry {
- u_char page_savable : 1; /* save parameters */
- u_char rsvd : 1;
- u_char page_code : 6; /* = 0x04 */
- u_char page_length; /* = 18 */
- u_char cyl_ub; /* number of cylinders */
- u_char cyl_mb;
- u_char cyl_lb;
- u_char heads; /* number of heads */
- u_char precomp_cyl_ub; /* cylinder to start precomp */
- u_char precomp_cyl_mb;
- u_char precomp_cyl_lb;
- u_char current_cyl_ub; /* cyl to start reduced current */
- u_char current_cyl_mb;
- u_char current_cyl_lb;
- u_short step_rate; /* drive step rate */
- u_char landing_cyl_ub; /* landing zone cylinder */
- u_char landing_cyl_mb;
- u_char landing_cyl_lb;
- u_char reserved_1;
- u_char reserved_2;
- u_char reserved_3;
-};
-
-/*
- * Page 0x38 - Cache Control Parameters
- */
-struct scsi_cache {
- u_char page_savable : 1; /* save parameters */
- u_char rsvd : 1;
- u_char page_code : 6; /* = 0x38 */
- u_char page_length; /* = 14 */
- u_char rsvd_1 : 1;
- u_char wie : 1; /* write index enable */
- u_char rsvd_2 : 1;
- u_char ce : 1; /* cache enable */
- u_char table_size : 4;
- u_char prefetch_threshold;
- u_char maximum_threshold;
- u_char maximumprefetch_multiplier;
- u_char minimum_threshold;
- u_char minimum_prefetch_multiplier;
- u_char reserved[8];
-};
-
-/*
- * Control for SCSI "format" mode.
- *
- * "Format" mode allows a privileged process to issue direct SCSI
- * commands to a drive (it is intended primarily to allow on-line
- * formatting). SDIOCSFORMAT with a non-zero arg will put the drive
- * into format mode; a zero arg will take it out. When in format
- * mode, only the process that issued the SDIOCFORMAT can read or
- * write the drive.
- *
- * In format mode, process is expected to
- * - do SDIOCSCSICOMMAND to supply cdb for next SCSI op
- * - do read or write as appropriate for cdb
- * - if i/o error, optionally do SDIOCSENSE to get completion
- * status and sense data from last scsi operation.
- */
-
-struct scsi_fmt_cdb {
- int len; /* cdb length (in bytes) */
- u_char cdb[28]; /* cdb to use on next read/write */
-};
-
-struct scsi_fmt_sense {
- u_int status; /* completion status of last op */
- u_char sense[28]; /* sense data (if any) from last op */
-};
-
-#define SDIOCSFORMAT _IOW('S', 0x1, int)
-#define SDIOCGFORMAT _IOR('S', 0x2, int)
-#define SDIOCSCSICOMMAND _IOW('S', 0x3, struct scsi_fmt_cdb)
-#define SDIOCSENSE _IOR('S', 0x4, struct scsi_fmt_sense)
-
-int scsialive(int);
-int scsi_read_capacity(int, int, u_char *, u_int);
-int scsi_test_unit_rdy(int, int);
-int scsi_tt_read(int, int, u_char *, u_int, daddr32_t, u_int);
-int scsi_tt_write(int, int, u_char *, u_int, daddr32_t, u_int);
diff --git a/sys/arch/hp300/stand/include/scsivar.h b/sys/arch/hp300/stand/include/scsivar.h
deleted file mode 100644
index 67ad06bf8db..00000000000
--- a/sys/arch/hp300/stand/include/scsivar.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* $OpenBSD: scsivar.h,v 1.2 2003/06/02 23:27:46 millert Exp $ */
-/* $NetBSD: scsivar.h,v 1.4 1994/10/26 07:27:58 cgd Exp $ */
-
-/*
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of Lawrence Berkeley Laboratory and the Systems
- * Programming Group of the University of Utah Computer Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)scsivar.h 8.1 (Berkeley) 6/10/93
- */
-
-struct scsi_softc {
- int sc_ba;
- char *sc_addr;
- char sc_alive;
- char sc_scsi_addr;
- char sc_stat;
- char sc_msg[7];
-};
-
-extern struct scsi_softc scsi_softc[];
diff --git a/sys/arch/hp300/stand/include/volhdr.h b/sys/arch/hp300/stand/include/volhdr.h
deleted file mode 100644
index fe63d2ef938..00000000000
--- a/sys/arch/hp300/stand/include/volhdr.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* $OpenBSD: volhdr.h,v 1.2 2003/06/02 23:27:46 millert Exp $ */
-/* $NetBSD: volhdr.h,v 1.4 1994/10/26 07:28:08 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)volhdr.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * vohldr.h: volume header for "LIF" format volumes
- */
-
-struct lifvol {
- short vol_id;
- char vol_label[6];
- int vol_addr;
- short vol_oct;
- short vol_dummy;
- int vol_dirsize;
- short vol_version;
- short vol_zero;
- int vol_huh1;
- int vol_huh2;
- int vol_length;
-};
-
-struct lifdir {
- char dir_name[10];
- short dir_type;
- int dir_addr;
- int dir_length;
- char dir_toc[6];
- short dir_flag;
- int dir_exec;
-};
-
-/* load header for boot rom */
-struct load {
- int address;
- int count;
-};
-
-#define VOL_ID -32768
-#define VOL_OCT 4096
-#define DIR_TYPE -5822
-#define DIR_FLAG 0x8001 /* dont ask me! */
-#define SECTSIZE 256
diff --git a/sys/arch/hp300/stand/installboot/Makefile b/sys/arch/hp300/stand/installboot/Makefile
deleted file mode 100644
index 0e6c328bdcc..00000000000
--- a/sys/arch/hp300/stand/installboot/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2012/08/21 14:46:18 pascal Exp $
-# $NetBSD: Makefile,v 1.1 1997/02/04 03:52:59 thorpej Exp $
-
-NOMAN=
-NOPIE=
-
-beforeinstall:
- ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
- ${.CURDIR}/installboot.sh ${DESTDIR}${BINDIR}/installboot
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/hp300/stand/installboot/installboot.sh b/sys/arch/hp300/stand/installboot/installboot.sh
deleted file mode 100644
index d3e5e39b3c1..00000000000
--- a/sys/arch/hp300/stand/installboot/installboot.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh
-# $OpenBSD: installboot.sh,v 1.1 1997/07/14 08:14:42 downsj Exp $
-# $NetBSD: installboot.sh,v 1.2 1994/10/26 07:27:26 cgd Exp $
-
-# compatibility with old installboot program
-#
-# @(#)installboot.sh 8.1 (Berkeley) 6/10/93
-#
-if [ $# != 2 ]
-then
- echo "Usage: installboot bootprog device"
- exit 1
-fi
-if [ ! -f $1 ]
-then
- echo "Usage: installboot bootprog device"
- echo "${1}: bootprog must be a regular file"
- exit 1
-fi
-if [ ! -c $2 ]
-then
- echo "Usage: installboot bootprog device"
- echo "${2}: device must be a char special file"
- exit 1
-fi
-/sbin/disklabel -B -b $1 $2
-exit $?
diff --git a/sys/arch/hp300/stand/libsa/Makefile b/sys/arch/hp300/stand/libsa/Makefile
deleted file mode 100644
index f5ac234fbb7..00000000000
--- a/sys/arch/hp300/stand/libsa/Makefile
+++ /dev/null
@@ -1,41 +0,0 @@
-# $OpenBSD: Makefile,v 1.18 2014/02/23 19:22:40 miod Exp $
-
-LIB= sa
-
-CPPFLAGS+= ${SA_CPPFLAGS}
-
-CFLAGS+=-I${.CURDIR} -I${.CURDIR}/../include -I${.CURDIR}/../.. \
- -I${.CURDIR}/../../.. -I${.CURDIR}/../../../.. \
- -I${.CURDIR}/../../../../lib/libsa
-
-# local source
-SRCS+= devopen.c exec_hp300.c rawfs.c
-
-# stand routines
-.PATH: ${.CURDIR}/../../../../lib/libsa
-SRCS+= alloc.c exit.c getfile.c gets.c globals.c loadfile.c \
- memcmp.c memcpy.c memset.c printf.c snprintf.c strcmp.c \
- strerror.c strlcat.c strlen.c strncmp.c strncpy.c
-
-.PATH: ${.CURDIR}/../../../../lib/libkern
-SRCS+= __main.c
-
-# io routines
-SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \
- open.c read.c stat.c write.c
-
-# network routines
-SRCS+= arp.c ether.c in_cksum.c net.c netif.c rpc.c
-
-# network info services
-SRCS+= bootp.c bootparam.c rarp.c
-
-# boot filesystems
-SRCS+= ufs.c nfs.c cd9660.c
-
-NOPROFILE=
-NOPIC=
-
-install:
-
-.include <bsd.lib.mk>
diff --git a/sys/arch/hp300/stand/libsa/devopen.c b/sys/arch/hp300/stand/libsa/devopen.c
deleted file mode 100644
index 5cd06293198..00000000000
--- a/sys/arch/hp300/stand/libsa/devopen.c
+++ /dev/null
@@ -1,288 +0,0 @@
-/* $OpenBSD: devopen.c,v 1.5 2013/01/11 23:22:35 miod Exp $ */
-/* $NetBSD: devopen.c,v 1.7 1996/10/14 07:31:47 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1993 John Brezak
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-
-int atoi(char *);
-int devlookup(const char *, int);
-int devopen(struct open_file *, const char *, char **);
-int devparse(const char *, int *, int *, int *, int *, int *, char **);
-void usage(void);
-
-u_int opendev;
-
-#define ispart(c) ((c) >= 'a' && (c) <= 'h')
-
-int
-atoi(char *cp)
-{
- int val = 0;
-
- while(isdigit(*cp))
- val = val * 10 + (*cp++ - '0');
- return(val);
-}
-
-void
-usage()
-{
- printf("Usage: device(adaptor, controller, drive, partition)file\n"
- " <device><unit><partitionletter>:file\n");
-}
-
-int
-devlookup(const char *d, int len)
-{
- struct devsw *dp = devsw;
- int i;
-
- for (i = 0; i < ndevs; i++, dp++) {
- if (dp->dv_name && strncmp(dp->dv_name, d, len) == 0) {
- /*
- * Set the filesystem and startup up according to
- * the device being opened.
- */
- switch (i) {
- case 0: /* ct */
- bcopy(file_system_rawfs, file_system,
- sizeof(struct fs_ops));
- break;
-
- case 2: /* hd */
- bcopy(file_system_ufs, file_system,
- sizeof(struct fs_ops));
- break;
-
- case 4: /* sd */
- bcopy(file_system_ufs, file_system,
- sizeof(struct fs_ops));
- bcopy(file_system_cd9660, &file_system[1],
- sizeof(struct fs_ops));
- nfsys = 2;
- break;
-
- case 6: /* le */
- bcopy(file_system_nfs, file_system,
- sizeof(struct fs_ops));
- break;
-
- default:
- /* Agh! What happened?! */
- goto bad;
- }
- return(i);
- }
- }
-
-bad:
- printf("No such device - Configured devices are:\n");
- for (dp = devsw, i = 0; i < ndevs; i++, dp++)
- if (dp->dv_name)
- printf(" %s", dp->dv_name);
- printf("\n");
- errno = ENODEV;
- return(-1);
-}
-
-/*
- * Parse a device spec in one of two forms.
- *
- * dev(adapt, ctlr, unit, part)file
- * [A-Za-z]*[0-9]*[A-Za-z]:file
- * dev unit part
- */
-int
-devparse(const char *fname, int *dev, int *adapt, int *ctlr, int *unit,
- int *part, char **file)
-{
- int i;
- char *s, *args[4];
-
- /* check for device name */
- for (s = (char *)fname; *s && *s != '/' && *s != ':' && *s != '('; s++)
- /* if (isupper(*s)) *s = tolower(*s) */;
-
- /* first form */
- if (*s == '(') {
- /* make device name lower case */
- for (s = (char *)fname; *s != '('; s++)
- if (isupper(*s)) *s = tolower(*s);
- /* lookup device and get index */
- if ((*dev = devlookup(fname, s - fname)) < 0)
- goto baddev;
-
- /* tokenize device ident */
- args[0] = ++s;
- for (args[0] = s, i = 1; *s && *s != ')'; s++) {
- if (*s == ',')
- args[i++] = ++s;
- }
- switch(i) {
- case 4:
- *adapt = atoi(args[0]);
- *ctlr = atoi(args[1]);
- *unit = atoi(args[2]);
- *part = atoi(args[3]);
- break;
- case 3:
- *ctlr = atoi(args[0]);
- *unit = atoi(args[1]);
- *part = atoi(args[2]);
- break;
- case 2:
- *unit = atoi(args[0]);
- *part = atoi(args[1]);
- break;
- case 1:
- *part = atoi(args[0]);
- break;
- case 0:
- break;
- }
- *file = ++s;
- }
-
- /* second form */
- else if (*s == ':') {
- int temp;
-
- /* isolate device and make its name lower case*/
- for (s = (char *)fname; *s != ':' && !isdigit(*s); s++)
- if (isupper(*s)) *s = tolower(*s);
-
- /* lookup device and get index */
- if ((*dev = devlookup(fname, s - fname)) < 0)
- goto baddev;
-
- /* isolate unit */
- if ((temp = atoi(s)) > 255)
- goto bad;
- *adapt = temp / 8;
- *ctlr = temp % 8;
- for (; isdigit(*s); s++);
-
- /* translate partition */
- if (!ispart(*s))
- goto bad;
-
- *part = *s++ - 'a';
- if (*s != ':')
- goto bad;
- *file = ++s;
- }
-
- /* no device present */
- else
- *file = (char *)fname;
-
- /* return the remaining unparsed part as the file to boot */
- return(0);
-
-bad:
- usage();
-
-baddev:
- return(-1);
-}
-
-int
-devopen(struct open_file *f, const char *fname, char **file)
-{
- int error;
- int dev, adapt, ctlr, unit, part;
- struct devsw *dp = &devsw[0];
-
- dev = B_TYPE(bootdev);
- adapt = B_ADAPTOR(bootdev);
- ctlr = B_CONTROLLER(bootdev);
- unit = B_UNIT(bootdev);
- part = B_PARTITION(bootdev);
-
- if ((error = devparse(fname, &dev, &adapt, &ctlr, &unit, &part, file)))
- return(error);
-
- /*
- * Set up filesystem type based on what device we're opening.
- */
- switch (dev) {
- case 0: /* ct */
- bcopy(file_system_rawfs, file_system, sizeof(struct fs_ops));
- break;
-
- case 2: /* hd */
- bcopy(file_system_ufs, file_system, sizeof(struct fs_ops));
- break;
-
- case 4: /* sd */
- bcopy(file_system_ufs, file_system, sizeof(struct fs_ops));
- bcopy(file_system_cd9660, &file_system[1],
- sizeof(struct fs_ops));
- nfsys = 2;
- break;
-
- case 6: /* le */
- bcopy(file_system_nfs, file_system, sizeof(struct fs_ops));
- break;
-
- default:
- /* XXX what else should we do here? */
- printf("WARNING: BOGUS BOOT DEV TYPE 0x%x!\n", dev);
- return (EIO);
- }
-
- dp = &devsw[dev];
-
- if (!dp->dv_open)
- return(ENODEV);
-
- f->f_dev = dp;
-
- if ((error = (*dp->dv_open)(f, adapt, ctlr, part)) == 0) {
- if ((error =
- (*punitsw[dev].p_punit)(adapt, ctlr, &unit)) != 0) {
- goto bad;
- }
- opendev = MAKEBOOTDEV(dev, adapt, ctlr, unit, part);
- return(0);
- }
-
- bad:
- printf("%s(%d,%d,%d,%d): %s\n", devsw[dev].dv_name,
- adapt, ctlr, unit, part, strerror(error));
-
- return(error);
-}
diff --git a/sys/arch/hp300/stand/libsa/exec_hp300.c b/sys/arch/hp300/stand/libsa/exec_hp300.c
deleted file mode 100644
index fc520b85062..00000000000
--- a/sys/arch/hp300/stand/libsa/exec_hp300.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/* $OpenBSD: exec_hp300.c,v 1.5 2014/02/23 19:22:40 miod Exp $ */
-/* $NetBSD: exec.c,v 1.15 1996/10/13 02:29:01 christos Exp $ */
-
-/*-
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-
-#include "stand.h"
-#include "samachdep.h"
-
-#include <lib/libsa/loadfile.h>
-
-void
-exec(char *path, void *loadaddr, int howto)
-{
- u_long marks[MARK_MAX];
- int rc;
-
- marks[MARK_START] = (u_long)loadaddr;
- rc = loadfile(path, marks, LOAD_KERNEL | COUNT_KERNEL);
- if (rc != 0)
- return;
-
- printf("Start @ 0x%lx\n", marks[MARK_ENTRY]);
-
- machdep_start((char *)marks[MARK_ENTRY], howto, loadaddr,
- (char *)marks[MARK_SYM], (char *)marks[MARK_END]);
-
- /* exec failed */
- printf("exec: kernel returned!\n");
- errno = ENOEXEC;
-}
diff --git a/sys/arch/hp300/stand/libsa/rawfs.c b/sys/arch/hp300/stand/libsa/rawfs.c
deleted file mode 100644
index 9c27263aee7..00000000000
--- a/sys/arch/hp300/stand/libsa/rawfs.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/* $OpenBSD: rawfs.c,v 1.5 2011/03/13 00:13:52 deraadt Exp $ */
-/* $NetBSD: rawfs.c,v 1.2 1996/10/06 19:07:53 thorpej Exp $ */
-
-/*
- * Copyright (c) 1995 Gordon W. Ross
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- * 4. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Gordon W. Ross
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Raw file system - for stream devices like tapes.
- * No random access, only sequential read allowed.
- * This exists only to allow upper level code to be
- * shielded from the fact that the device must be
- * read only with whole block position and size.
- */
-
-#include <sys/param.h>
-
-#include <lib/libsa/stand.h>
-#include "rawfs.h"
-
-extern int debug;
-
-/* Our devices are generally willing to do 8K transfers. */
-#define RAWFS_BSIZE 0x2000
-
-/*
- * In-core open file.
- */
-struct rawfs_file {
- daddr32_t fs_nextblk; /* block number to read next */
- int fs_len; /* amount left in f_buf */
- char * fs_ptr; /* read pointer into f_buf */
- char fs_buf[RAWFS_BSIZE];
-};
-
-static int
-rawfs_get_block(struct open_file *);
-
-int
-rawfs_open(char *path, struct open_file *f)
-{
- struct rawfs_file *fs;
-
- /*
- * The actual tape driver has already been opened.
- * Just allocate the I/O buffer, etc.
- */
- fs = alloc(sizeof(struct rawfs_file));
- fs->fs_nextblk = 0;
- fs->fs_len = 0;
- fs->fs_ptr = fs->fs_buf;
-
-#ifdef DEBUG_RAWFS
- printf("rawfs_open: fs=0x%x\n", (u_long)fs);
-#endif
-
- f->f_fsdata = fs;
- return (0);
-}
-
-int
-rawfs_close(struct open_file *f)
-{
- struct rawfs_file *fs;
-
- fs = (struct rawfs_file *) f->f_fsdata;
- f->f_fsdata = (void *)0;
-
-#ifdef DEBUG_RAWFS
- printf("rawfs_close: fs=0x%x\n", (u_long)fs);
-#endif
-
- if (fs != (struct rawfs_file *)0)
- free(fs, sizeof(*fs));
-
- return (0);
-}
-
-int
-rawfs_read(struct open_file *f, void *start, size_t size, size_t *resid)
-{
- struct rawfs_file *fs = (struct rawfs_file *)f->f_fsdata;
- char *addr = start;
- int error = 0;
- size_t csize;
-
-#ifdef DEBUG_RAWFS
- printf("rawfs_read: file=0x%x, start=0x%x, size=%d, resid=0x%x\n",
- (u_long)f, (u_long)start, size, resid);
- printf(" fs=0x%x\n", (u_long)fs);
-#endif
-
- while (size != 0) {
-
- if (fs->fs_len == 0)
- if ((error = rawfs_get_block(f)) != 0)
- break;
-
- if (fs->fs_len <= 0)
- break; /* EOF */
-
- csize = size;
- if (csize > fs->fs_len)
- csize = fs->fs_len;
-
- bcopy(fs->fs_ptr, addr, csize);
- fs->fs_ptr += csize;
- fs->fs_len -= csize;
- addr += csize;
- size -= csize;
- }
- if (resid)
- *resid = size;
- return (error);
-}
-
-int
-rawfs_write(struct open_file *f, void *start, size_t size, size_t *resid)
-{
-#ifdef DEBUG_RAWFS
- printf("rawfs_write: YOU'RE NOT SUPPOSED TO GET HERE!\n");
-#endif
- return (EROFS);
-}
-
-off_t
-rawfs_seek(struct open_file *f, off_t offset, int where)
-{
-#ifdef DEBUG_RAWFS
- printf("rawfs_seek: YOU'RE NOT SUPPOSED TO GET HERE!\n");
-#endif
- return (EFTYPE);
-}
-
-int
-rawfs_stat(struct open_file *f, struct stat *sb)
-{
-#ifdef DEBUG_RAWFS
- printf("rawfs_stat: I'll let you live only because of exec.c\n");
-#endif
- /*
- * Clear out the stat buffer so that the uid check
- * won't fail. See sys/lib/libsa/exec.c
- */
- bzero(sb, sizeof(*sb));
-
- return (EFTYPE);
-}
-
-/*
- * Read a block from the underlying stream device
- * (In our case, a tape drive.)
- */
-static int
-rawfs_get_block(struct open_file *f)
-{
- struct rawfs_file *fs;
- size_t len;
- int error;
-
- fs = (struct rawfs_file *)f->f_fsdata;
- fs->fs_ptr = fs->fs_buf;
-
- twiddle();
-#ifdef DEBUG_RAWFS
- printf("rawfs_get_block: calling strategy\n");
-#endif
- error = f->f_dev->dv_strategy(f->f_devdata, F_READ,
- fs->fs_nextblk, RAWFS_BSIZE, fs->fs_buf, &len);
-#ifdef DEBUG_RAWFS
- printf("rawfs_get_block: strategy returned %d\n", error);
-#endif
-
- if (!error) {
- fs->fs_len = len;
- fs->fs_nextblk += (RAWFS_BSIZE / DEV_BSIZE);
- }
-
- return (error);
-}
diff --git a/sys/arch/hp300/stand/libsa/rawfs.h b/sys/arch/hp300/stand/libsa/rawfs.h
deleted file mode 100644
index d86eac48d34..00000000000
--- a/sys/arch/hp300/stand/libsa/rawfs.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* $OpenBSD: rawfs.h,v 1.3 2006/01/18 14:15:12 deraadt Exp $ */
-/* $NetBSD: rawfs.h,v 1.1 1996/06/26 17:44:36 thorpej Exp $ */
-
-/*
- * Raw file system - for stream devices like tapes.
- * No random access, only sequential read allowed.
- */
-
-int rawfs_open(char *path, struct open_file *f);
-int rawfs_close(struct open_file *f);
-int rawfs_read(struct open_file *f, void *buf,
- size_t size, size_t *resid);
-int rawfs_write(struct open_file *f, void *buf,
- size_t size, size_t *resid);
-off_t rawfs_seek(struct open_file *f, off_t offset, int where);
-int rawfs_stat(struct open_file *f, struct stat *sb);
diff --git a/sys/arch/hp300/stand/libsaz/Makefile b/sys/arch/hp300/stand/libsaz/Makefile
deleted file mode 100644
index 30f2dfaff96..00000000000
--- a/sys/arch/hp300/stand/libsaz/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-# $OpenBSD: Makefile,v 1.5 2012/08/21 14:46:18 pascal Exp $
-
-CFLAGS+=-D__INTERNAL_LIBSA_CREAD
-
-NOPIE=
-
-# io routines
-SRCS+= cread.c
-
-.include "${.CURDIR}/../libsa/Makefile"
-.PATH: ${.CURDIR}/../libsa
-
-LIB= saz
diff --git a/sys/arch/hp300/stand/libz/Makefile b/sys/arch/hp300/stand/libz/Makefile
deleted file mode 100644
index 8e1a2abd4c9..00000000000
--- a/sys/arch/hp300/stand/libz/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-# $OpenBSD: Makefile,v 1.6 2013/01/01 17:17:44 miod Exp $
-
-S=${.CURDIR}/../../../..
-ZDST=${.OBJDIR}
-
-NOPIE=
-
-.PATH: ${S}/lib/libz
-
-CPPFLAGS+= ${SA_CPPFLAGS}
-
-CFLAGS+=-I${S}
-
-.include "${S}/lib/libz/Makefile"
diff --git a/sys/arch/hp300/stand/mkboot/Makefile b/sys/arch/hp300/stand/mkboot/Makefile
deleted file mode 100644
index c0f16a9a46b..00000000000
--- a/sys/arch/hp300/stand/mkboot/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-# $OpenBSD: Makefile,v 1.4 2013/01/01 17:17:44 miod Exp $
-# $NetBSD: Makefile,v 1.2 1997/05/14 07:57:13 thorpej Exp $
-
-PROG= mkboot
-NOMAN=
-NOPIE=
-
-CFLAGS+= -I${.CURDIR}/../include
-CPPFLAGS=
-
-install:
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/hp300/stand/mkboot/mkboot.c b/sys/arch/hp300/stand/mkboot/mkboot.c
deleted file mode 100644
index 2de22f91fe9..00000000000
--- a/sys/arch/hp300/stand/mkboot/mkboot.c
+++ /dev/null
@@ -1,277 +0,0 @@
-/* $OpenBSD: mkboot.c,v 1.8 2013/02/02 13:34:29 miod Exp $ */
-/* $NetBSD: mkboot.c,v 1.10 2006/06/18 05:53:51 gdamore Exp $ */
-
-/*
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)mkboot.c 8.1 (Berkeley) 7/15/93
- */
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/param.h>
-#include <sys/file.h>
-#include <sys/stat.h>
-
-#include "volhdr.h"
-
-#include <stdio.h>
-#include <ctype.h>
-
-#define LIF_NUMDIR 8
-
-#define LIF_VOLSTART 0
-#define LIF_VOLSIZE sizeof(struct lifvol)
-#define LIF_DIRSTART 512
-#define LIF_DIRSIZE (LIF_NUMDIR * sizeof(struct lifdir))
-#define LIF_FILESTART 8192
-
-#define btolifs(b) (((b) + (SECTSIZE - 1)) / SECTSIZE)
-#define lifstob(s) ((s) * SECTSIZE)
-
-int lpflag;
-int loadpoint;
-struct load ld;
-struct lifvol lifv;
-struct lifdir lifd[LIF_NUMDIR];
-
-void bcddate(char *, char *);
-char *lifname(char *);
-int putfile(char *, int);
-void usage(void);
-
-/*
- * Old Format:
- * sector 0: LIF volume header (40 bytes)
- * sector 1: <unused>
- * sector 2: LIF directory (8 x 32 == 256 bytes)
- * sector 3-: LIF file 0, LIF file 1, etc.
- * where sectors are 256 bytes.
- *
- * New Format:
- * sector 0: LIF volume header (40 bytes)
- * sector 1: <unused>
- * sector 2: LIF directory (8 x 32 == 256 bytes)
- * sector 3: <unused>
- * sector 4-31: disklabel (~300 bytes right now)
- * sector 32-: LIF file 0, LIF file 1, etc.
- */
-int
-main(int argc, char **argv)
-{
- char *n1, *n2, *n3;
- int n, to;
- int count;
-
- --argc;
- ++argv;
- if (argc == 0)
- usage();
- if (!strcmp(argv[0], "-l")) {
- argv++;
- argc--;
- if (argc == 0)
- usage();
- sscanf(argv[0], "0x%x", &loadpoint);
- lpflag++;
- argv++;
- argc--;
- }
- if (!lpflag || argc == 0)
- usage();
- n1 = argv[0];
- argv++;
- argc--;
- if (argc == 0)
- usage();
- if (argc > 1) {
- n2 = argv[0];
- argv++;
- argc--;
- if (argc > 1) {
- n3 = argv[0];
- argv++;
- argc--;
- } else
- n3 = NULL;
- } else
- n2 = n3 = NULL;
-
- to = open(argv[0], O_WRONLY | O_TRUNC | O_CREAT, 0644);
- if (to < 0) {
- perror("open");
- exit(1);
- }
- /* clear possibly unused directory entries */
- bcopy(" ", lifd[1].dir_name, 10);
- lifd[1].dir_type = htobe16(-1);
- lifd[1].dir_addr = htobe32(0);
- lifd[1].dir_length = htobe32(0);
- lifd[1].dir_flag = htobe16(0xFF);
- lifd[1].dir_exec = htobe32(0);
- lifd[7] = lifd[6] = lifd[5] = lifd[4] = lifd[3] = lifd[2] = lifd[1];
- /* record volume info */
- lifv.vol_id = htobe16(VOL_ID);
- bcopy("BOOT44", lifv.vol_label, 6);
- lifv.vol_addr = htobe32(btolifs(LIF_DIRSTART));
- lifv.vol_oct = htobe16(VOL_OCT);
- lifv.vol_dirsize = htobe32(btolifs(LIF_DIRSIZE));
- lifv.vol_version = htobe16(1);
- /* output bootfile one */
- lseek(to, LIF_FILESTART, SEEK_SET);
- count = putfile(n1, to);
- n = btolifs(count);
- strlcpy(lifd[0].dir_name, lifname(n1), sizeof lifd[0].dir_name);
- lifd[0].dir_type = htobe16(DIR_TYPE);
- lifd[0].dir_addr = htobe32(btolifs(LIF_FILESTART));
- lifd[0].dir_length = htobe32(n);
- bcddate(n1, lifd[0].dir_toc);
- lifd[0].dir_flag = htobe16(DIR_FLAG);
- lifd[0].dir_exec = htobe32(loadpoint);
- lifv.vol_length = htobe32(htobe32(lifd[0].dir_addr) +
- htobe32(lifd[0].dir_length));
- /* if there is an optional second boot program, output it */
- if (n2) {
- lseek(to, LIF_FILESTART+lifstob(n), SEEK_SET);
- count = putfile(n2, to);
- n = btolifs(count);
- strlcpy(lifd[1].dir_name, lifname(n2), sizeof lifd[1].dir_name);
- lifd[1].dir_type = htobe16(DIR_TYPE);
- lifd[1].dir_addr = htobe32(lifv.vol_length);
- lifd[1].dir_length = htobe32(n);
- bcddate(n2, lifd[1].dir_toc);
- lifd[1].dir_flag = htobe16(DIR_FLAG);
- lifd[1].dir_exec = htobe32(loadpoint);
- lifv.vol_length = htobe32(htobe32(lifd[1].dir_addr) +
- htobe32(lifd[1].dir_length));
- }
- /* ditto for three */
- if (n3) {
- lseek(to, LIF_FILESTART+lifstob(lifd[0].dir_length+n),
- SEEK_SET);
- count = putfile(n3, to);
- n = btolifs(count);
- strlcpy(lifd[2].dir_name, lifname(n3), sizeof lifd[2].dir_name);
- lifd[2].dir_type = htobe16(DIR_TYPE);
- lifd[2].dir_addr = htobe32(lifv.vol_length);
- lifd[2].dir_length = htobe32(n);
- bcddate(n3, lifd[2].dir_toc);
- lifd[2].dir_flag = htobe16(DIR_FLAG);
- lifd[2].dir_exec = htobe32(loadpoint);
- lifv.vol_length = htobe32(htobe32(lifd[2].dir_addr) +
- htobe32(lifd[2].dir_length));
- }
- /* output volume/directory header info */
- lseek(to, LIF_VOLSTART, SEEK_SET);
- write(to, &lifv, LIF_VOLSIZE);
- lseek(to, LIF_DIRSTART, SEEK_SET);
- write(to, lifd, LIF_DIRSIZE);
- exit(0);
-}
-
-int
-putfile(char *from, int to)
-{
- int fd;
- struct stat statb;
- int nr;
- void *bp;
-
- if ((fd = open(from, 0)) < 0) {
- printf("error: unable to open file %s\n", from);
- exit(1);
- }
- fstat(fd, &statb);
- ld.address = htobe32(loadpoint);
- ld.count = htobe32(statb.st_size);
- bp = malloc(statb.st_size);
- if ((nr = read(fd, bp, statb.st_size)) < 0) {
- printf("error: reading from file %s\n", from);
- exit(1);
- }
- (void)close(fd);
- write(to, &ld, sizeof(ld));
- write(to, bp, statb.st_size);
- free(bp);
- return (statb.st_size + sizeof(ld));
-}
-
-void
-usage(void)
-{
-
- fprintf(stderr,
- "usage: mkboot -l loadpoint prog1 [ prog2 ] outfile\n");
- exit(1);
-}
-
-char *
-lifname(char *str)
-{
- static char lname[10] = "SYS_XXXXX";
- char *cp;
- int i;
-
- if ((cp = strrchr(str, '/')) != NULL)
- str = ++cp;
- for (i = 4; i < 10; i++) {
- if (islower(*str))
- lname[i] = toupper(*str);
- else if (isalnum(*str) || *str == '_')
- lname[i] = *str;
- else
- break;
- str++;
- }
- for ( ; i < 10; i++)
- lname[i] = ' ';
- return(lname);
-}
-
-void
-bcddate(char *name, char *toc)
-{
- struct stat statb;
- struct tm *tm;
-
- stat(name, &statb);
- tm = localtime(&statb.st_ctime);
- *toc = ((tm->tm_mon+1) / 10) << 4;
- *toc++ |= (tm->tm_mon+1) % 10;
- *toc = (tm->tm_mday / 10) << 4;
- *toc++ |= tm->tm_mday % 10;
- *toc = (tm->tm_year / 10) << 4;
- *toc++ |= tm->tm_year % 10;
- *toc = (tm->tm_hour / 10) << 4;
- *toc++ |= tm->tm_hour % 10;
- *toc = (tm->tm_min / 10) << 4;
- *toc++ |= tm->tm_min % 10;
- *toc = (tm->tm_sec / 10) << 4;
- *toc |= tm->tm_sec % 10;
-}
diff --git a/sys/arch/hp300/stand/uboot/Makefile b/sys/arch/hp300/stand/uboot/Makefile
deleted file mode 100644
index 49b0a3d018d..00000000000
--- a/sys/arch/hp300/stand/uboot/Makefile
+++ /dev/null
@@ -1,56 +0,0 @@
-# $OpenBSD: Makefile,v 1.9 2013/02/02 13:34:29 miod Exp $
-
-PROG= uboot
-OBJCOPY?= objcopy
-SIZE?= size
-
-NOMAN=
-NOPIE=
-
-CPPFLAGS+= ${SA_CPPFLAGS}
-
-CFLAGS+=-I${.CURDIR}/../include \
- -I${.CURDIR}/../libsa -I${.CURDIR}/../.. -I${.CURDIR}/../../.. \
- -I${.CURDIR}/../../../..
-
-AFLAGS= -x assembler-with-cpp -traditional-cpp -I${.CURDIR}/../include \
- -I${.CURDIR}/../libsa -I${.CURDIR}/../.. -I${.CURDIR}/../../.. \
- -I${.CURDIR}/../../../..
-
-SRCS= srt0.S uboot.c tgets.c netio.c clock.c conf.c prf.c
-
-LIBS= ${LIBCOMMON} ${LIBSAZ} ${LIBZ}
-
-CLEANFILES+= ${PROG}.bin ${PROG}.lif
-
-uboot.lif: ${PROG}
- ${OBJCOPY} -S -O binary ${PROG} ${PROG}.bin
- ${MKBOOT_PROG} -l 0x${RELOC} ${PROG}.bin $@
-
-uboot: ${OBJS} ${LIBS}
- ${LD} -N -Ttext ${RELOC} -e begin --warn-common ${OBJS} ${LIBS} \
- `${CC} -print-libgcc-file-name` -o $@
- @${SIZE} $@
- @echo $@ total size should not exceed 1044480 bytes
-
-install: uboot.lif ${MKBOOT_PROG}
- ${INSTALL} -d -m 755 -o ${BINOWN} -g ${BINGRP} \
- ${DESTDIR}/usr/mdec/rbootd
- ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 uboot.lif \
- ${DESTDIR}/usr/mdec
- rm -f ${DESTDIR}/usr/mdec/hdboot
- ln ${DESTDIR}/usr/mdec/uboot.lif ${DESTDIR}/usr/mdec/hdboot
- rm -f ${DESTDIR}/usr/mdec/boothd
- ln ${DESTDIR}/usr/mdec/uboot.lif ${DESTDIR}/usr/mdec/boothd
- rm -f ${DESTDIR}/usr/mdec/sdboot
- ln ${DESTDIR}/usr/mdec/uboot.lif ${DESTDIR}/usr/mdec/sdboot
- rm -f ${DESTDIR}/usr/mdec/bootsd
- ln ${DESTDIR}/usr/mdec/uboot.lif ${DESTDIR}/usr/mdec/bootsd
- rm -f ${DESTDIR}/usr/mdec/ctboot
- ln ${DESTDIR}/usr/mdec/uboot.lif ${DESTDIR}/usr/mdec/ctboot
- rm -f ${DESTDIR}/usr/mdec/bootct
- ln ${DESTDIR}/usr/mdec/uboot.lif ${DESTDIR}/usr/mdec/bootct
- rm -f ${DESTDIR}/usr/mdec/rbootd/SYS_UBOOT
- ln ${DESTDIR}/usr/mdec/uboot.lif ${DESTDIR}/usr/mdec/rbootd/SYS_UBOOT
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/hp300/stand/uboot/clock.c b/sys/arch/hp300/stand/uboot/clock.c
deleted file mode 100644
index c6f192e76d9..00000000000
--- a/sys/arch/hp300/stand/uboot/clock.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/* $OpenBSD: clock.c,v 1.5 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: clock.c,v 1.3 1995/02/20 00:12:09 mycroft Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: clock.c 1.18 91/01/21$
- *
- * @(#)clock.c 8.2 (Berkeley) 1/12/94
- */
-
-#include <sys/param.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-#include "hilreg.h"
-#include <hp300/hp300/clockreg.h>
-
-extern void send_hil_cmd(struct hil_dev *, u_char, u_char *, u_char, u_char *);
-
-static int month_days[12] = {
- 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
-};
-
-u_char bbc_registers[13];
-struct hil_dev *bbcaddr = (struct hil_dev *)BBCADDR;
-
-int bbc_to_gmt(u_long *);
-void read_bbc(void);
-u_char read_bbc_reg(int);
-
-time_t
-getsecs()
-{
- static int bbcinited = 0;
- u_long timbuf = 0;
-
- if (!bbc_to_gmt(&timbuf) && !bbcinited)
- printf("WARNING: bad date in battery clock\n");
- bbcinited = 1;
-
- /* Battery clock does not store usec's, so forget about it. */
- return((time_t)timbuf);
-}
-
-int
-bbc_to_gmt(u_long *timbuf)
-{
- int i;
- u_long tmp;
- int year, month, day, hour, min, sec;
-
- read_bbc();
-
- sec = bbc_to_decimal(1, 0);
- min = bbc_to_decimal(3, 2);
-
- /*
- * Hours are different for some reason. Makes no sense really.
- */
- hour = ((bbc_registers[5] & 0x03) * 10) + bbc_registers[4];
- day = bbc_to_decimal(8, 7);
- month = bbc_to_decimal(10, 9);
- year = bbc_to_decimal(12, 11) + 1900;
-
- range_test(hour, 0, 23);
- range_test(day, 1, 31);
- range_test(month, 1, 12);
- range_test(year, STARTOFTIME, 2038); /* 2038 is the end of time. */
-
- tmp = 0;
-
- for (i = STARTOFTIME; i < year; i++)
- tmp += days_in_year(i);
- if (leapyear(year) && month > FEBRUARY)
- tmp++;
-
- for (i = 1; i < month; i++)
- tmp += days_in_month(i);
-
- tmp += (day - 1);
- tmp = ((tmp * 24 + hour) * 60 + min) * 60 + sec;
-
- *timbuf = tmp;
- return(1);
-}
-
-void
-read_bbc()
-{
- int i, read_okay;
-
- read_okay = 0;
- while (!read_okay) {
- read_okay = 1;
- for (i = 0; i <= NUM_BBC_REGS; i++)
- bbc_registers[i] = read_bbc_reg(i);
- for (i = 0; i <= NUM_BBC_REGS; i++)
- if (bbc_registers[i] != read_bbc_reg(i))
- read_okay = 0;
- }
-}
-
-u_char
-read_bbc_reg(int reg)
-{
- u_char data = reg;
-
- if (bbcaddr) {
-#if 0
- send_hil_cmd(bbcaddr, BBC_SET_REG, &data, 1, NULL);
- send_hil_cmd(bbcaddr, BBC_READ_REG, NULL, 0, &data);
-#else
- HILWAIT(bbcaddr);
- bbcaddr->hil_cmd = BBC_SET_REG;
- HILWAIT(bbcaddr);
- bbcaddr->hil_data = data;
- HILWAIT(bbcaddr);
- bbcaddr->hil_cmd = BBC_READ_REG;
- HILDATAWAIT(bbcaddr);
- data = bbcaddr->hil_data;
-#endif
- }
- return(data);
-}
diff --git a/sys/arch/hp300/stand/uboot/conf.c b/sys/arch/hp300/stand/uboot/conf.c
deleted file mode 100644
index f9abd637d67..00000000000
--- a/sys/arch/hp300/stand/uboot/conf.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* $OpenBSD: conf.c,v 1.8 2011/08/18 20:02:58 miod Exp $ */
-/* $NetBSD: conf.c,v 1.12 1996/10/14 07:29:15 thorpej Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)conf.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-
-#include <sys/socket.h>
-#include <net/if.h>
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-#include <netinet/in_systm.h>
-
-#include <lib/libsa/nfs.h>
-#include <lib/libsa/cd9660.h>
-#include <lib/libsa/ufs.h>
-#include "rawfs.h"
-
-int debug = 0; /* XXX */
-
-/*
- * Device configuration
- */
-int netstrategy(void *, int, daddr32_t, size_t, void *, size_t *);
-int netopen(struct open_file *, ...);
-int netclose(struct open_file *);
-#define netioctl noioctl
-
-int ctstrategy(void *, int, daddr32_t, size_t, void *, size_t *);
-int ctopen(struct open_file *, ...);
-int ctclose(struct open_file *);
-#define ctioctl noioctl
-
-int hdstrategy(void *, int, daddr32_t, size_t, void *, size_t *);
-int hdopen(struct open_file *, ...);
-int hdclose(struct open_file *);
-#define hdioctl noioctl
-
-int sdstrategy(void *, int, daddr32_t, size_t, void *, size_t *);
-int sdopen(struct open_file *, ...);
-int sdclose(struct open_file *);
-#define sdioctl noioctl
-
-#define xxstrategy \
- (int (*)(void *, int, daddr32_t, size_t, void *, size_t *))nullsys
-#define xxopen (int (*)(struct open_file *, ...))nodev
-#define xxclose (int (*)(struct open_file *))nullsys
-
-/*
- * Note: "le" isn't a major offset.
- */
-struct devsw devsw[] = {
- { "ct", ctstrategy, ctopen, ctclose, ctioctl }, /*0*/
- { "??", xxstrategy, xxopen, xxclose, noioctl }, /*1*/
- { "hd", hdstrategy, hdopen, hdclose, hdioctl }, /*2*/
- { "??", xxstrategy, xxopen, xxclose, noioctl }, /*3*/
- { "sd", sdstrategy, sdopen, sdclose, sdioctl }, /*4*/
- { "??", xxstrategy, xxopen, xxclose, noioctl }, /*5*/
- { "le", netstrategy, netopen, netclose, netioctl },/*6*/
-};
-int ndevs = (sizeof(devsw) / sizeof(devsw[0]));
-
-extern struct netif_driver le_driver;
-
-struct netif_driver *netif_drivers[] = {
- &le_driver,
-};
-int n_netif_drivers = (sizeof(netif_drivers) / sizeof(netif_drivers[0]));
-
-/*
- * Physical unit/lun detection.
- */
-int punitzero(int, int, int *);
-
-int
-punitzero(int ctlr, int slave, int *punit)
-{
- *punit = 0;
- return (0);
-}
-
-extern int ctpunit(int, int, int *);
-#define xxpunit punitzero
-#define hdpunit punitzero
-#define sdpunit punitzero
-#define lepunit punitzero
-
-struct punitsw punitsw[] = {
- { ctpunit },
- { xxpunit },
- { hdpunit },
- { xxpunit },
- { sdpunit },
- { xxpunit },
- { lepunit },
-};
-
-/*
- * Filesystem configuration
- */
-struct fs_ops file_system_rawfs[] = {
- { rawfs_open, rawfs_close, rawfs_read, rawfs_write, rawfs_seek,
- rawfs_stat },
-};
-
-struct fs_ops file_system_ufs[] = {
- { ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat },
-};
-
-struct fs_ops file_system_nfs[] = {
- { nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat },
-};
-
-struct fs_ops file_system_cd9660[] = {
- { cd9660_open, cd9660_close, cd9660_read, cd9660_write, cd9660_seek,
- cd9660_stat },
-};
-
-struct fs_ops file_system[2];
-int nfsys = 1; /* default; changed per device type. */
diff --git a/sys/arch/hp300/stand/uboot/netio.c b/sys/arch/hp300/stand/uboot/netio.c
deleted file mode 100644
index afbce4820f2..00000000000
--- a/sys/arch/hp300/stand/uboot/netio.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/* $OpenBSD: netio.c,v 1.5 2011/08/18 20:02:58 miod Exp $ */
-/* $NetBSD: netio.c,v 1.5 1997/01/30 10:32:56 thorpej Exp $ */
-
-/*
- * Copyright (c) 1995, 1996 Jason R. Thorpe
- * Copyright (c) 1995 Gordon W. Ross
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- * 4. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Gordon W. Ross
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * This module implements a "raw device" interface suitable for
- * use by the stand-alone I/O library NFS code. This interface
- * does not support any "block" access, and exists only for the
- * purpose of initializing the network interface, getting boot
- * parameters, and performing the NFS mount.
- *
- * At open time, this does:
- *
- * find interface - netif_open()
- * RARP for IP address - rarp_getipaddress()
- * RPC/bootparams - callrpc(d, RPC_BOOTPARAMS, ...)
- * RPC/mountd - nfs_mount(sock, ip, path)
- *
- * the root file handle from mountd is saved in a global
- * for use by the NFS open code (NFS/lookup).
- */
-
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-#include <netinet/in_systm.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-
-#include <lib/libsa/net.h>
-#include <lib/libsa/netif.h>
-#include <lib/libsa/bootparam.h>
-#include <lib/libsa/nfs.h>
-
-extern int nfs_root_node[]; /* XXX - get from nfs_mount() */
-
-/* Why be any different? */
-#define SUN_BOOTPARAMS
-
-#ifndef SUN_BOOTPARAMS
-n_long netmask;
-#endif
-
-int netdev_sock = -1;
-static int open_count;
-
-int netclose(struct open_file *);
-int netmountroot(struct open_file *, char *);
-int netopen(struct open_file *, char *);
-int netstrategy(void *, int, daddr32_t, size_t, void *, size_t *);
-
-/*
- * Called by devopen after it sets f->f_dev to our devsw entry.
- * This opens the low-level device and sets f->f_devdata.
- */
-int
-netopen(struct open_file *f, char *devname)
-{
- int error = 0;
-
- /* On first open, do netif open, mount, etc. */
- if (open_count == 0) {
- /* Find network interface. */
- if ((netdev_sock = netif_open(devname)) < 0)
- return (error=ENXIO);
- if ((error = netmountroot(f, devname)) != 0)
- return (error);
- }
- open_count++;
- f->f_devdata = nfs_root_node;
- return (error);
-}
-
-int
-netclose(struct open_file *f)
-{
- /* On last close, do netif close, etc. */
- if (open_count > 0)
- if (--open_count == 0)
- netif_close(netdev_sock);
- f->f_devdata = NULL;
- return (0);
-}
-
-int
-netstrategy(void *devdata, int func, daddr32_t dblk, size_t size, void *v_buf,
- size_t *rsize)
-{
-
- *rsize = size;
- return EIO;
-}
-
-int
-netmountroot(struct open_file *f, char *devname)
-{
-#ifdef DEBUG
- printf("netmountroot: %s\n", devname);
-#endif
-
- /*
- * Get info for NFS boot: our IP address, our hostname,
- * server IP address, and our root path on the server.
- * There are two ways to do this: The old, Sun way,
- * and the more modern, BOOTP way. (RFC951, RFC1048)
- */
-
-#ifdef SUN_BOOTPARAMS
- /* Get boot info using RARP and Sun bootparams. */
-
- /* Get our IP address. (rarp.c) */
- if (rarp_getipaddress(netdev_sock) == -1)
- return (errno);
-
- printf("boot: client IP address: %s\n", inet_ntoa(myip));
-
- /* Get our hostname, server IP address. */
- if (bp_whoami(netdev_sock))
- return (errno);
-
- printf("boot: client name: %s\n", hostname);
-
- /* Get the root pathname. */
- if (bp_getfile(netdev_sock, "root", &rootip, rootpath))
- return (errno);
-
-#else
-
- /* Get boot info using BOOTP way. (RFC951, RFC1048) */
- bootp(netdev_sock);
-
- printf("Using IP address: %s\n", inet_ntoa(myip));
-
- printf("myip: %s (%s)", hostname, inet_ntoa(myip));
- if (mask)
- printf(", mask: %s", intoa(netmask));
- printf("\n");
-
-#endif /* SUN_BOOTPARAMS */
-
- printf("root addr=%s path=%s\n", inet_ntoa(rootip), rootpath);
-
- /* Get the NFS file handle (mount). */
- return nfs_mount(netdev_sock, rootip, rootpath);
-}
diff --git a/sys/arch/hp300/stand/uboot/prf.c b/sys/arch/hp300/stand/uboot/prf.c
deleted file mode 100644
index 5b565c738a0..00000000000
--- a/sys/arch/hp300/stand/uboot/prf.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* $OpenBSD: prf.c,v 1.1 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: prf.c,v 1.5 1994/10/26 07:27:50 cgd Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)prf.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-
-#include <lib/libsa/stand.h>
-
-#include "consdefs.h"
-
-int
-getchar()
-{
- int c;
-
- while((c = cngetc()) == 0)
- ;
- if (c == '\r')
- c = '\n';
- else if (c == ('c'&037)) {
- panic("^C");
- /* NOTREACHED */
- }
- return(c);
-}
-
-void
-putchar(int c)
-{
- cnputc(c);
- if (c == '\n')
- cnputc('\r');
-}
diff --git a/sys/arch/hp300/stand/uboot/srt0.S b/sys/arch/hp300/stand/uboot/srt0.S
deleted file mode 100644
index 9d2104addf5..00000000000
--- a/sys/arch/hp300/stand/uboot/srt0.S
+++ /dev/null
@@ -1,328 +0,0 @@
-/* $OpenBSD: srt0.S,v 1.9 2013/03/21 21:51:00 deraadt Exp $ */
-/* $NetBSD: srt0.S,v 1.4 1997/05/12 07:56:00 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: srt0.c 1.18 92/12/21$
- *
- * @(#)srt0.c 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * Startup code for standalone system
- */
-
-#include <machine/asm.h>
-#include <machine/hp300spu.h>
-
- STACK = 0xfffff000 | below the ROM page
- BOOTTYPE = 0xfffffdc0
- LOWRAM = 0xfffffdce
- SYSFLAG = 0xfffffed2 | system flags
- MSUS = 0xfffffedc | MSUS (?) structure
- VECTORS = 0xfffffee0 | beginning of jump vectors
- NMIRESET = 0xffffff9c | reset vector
- BUSERR = 0xfffffffc
- MAXADDR = 0xfffff000
- PAGE_SIZE =4096
- MMUCMD = 0x005f400c | MMU command/status register
-
- .data
-GLOBAL(bootdev)
- .long 0
-GLOBAL(howto)
- .long 0
-GLOBAL(lowram)
- .long 0
-GLOBAL(machineid)
- .long 0
-GLOBAL(mmuid)
- .long 0
-
- .chip 68020
- .text
-ASENTRY_NOPROFILE(begin)
- movl #STACK,%sp
- moveq #47,%d0 | # of vectors - 1
- movl #VECTORS+2,%a0 | addr part of first vector
-1:
- movl #_ASM_LABEL(__trap),%a0@ | make it direct to __trap
- addql #6,%a0 | move to next vector addr
- dbf %d0,1b | go til done
- movl #NMIRESET,%a0 | NMI keyboard reset addr
- movl #nmi,%a0@ | catch in reset routine
-
-/*
- * Determine our SPU type and look for internal HP-IB
- */
- lea _C_LABEL(machineid),%a0
- movl #0x808,%d0
- movc %d0,%cacr | clear and disable on-chip cache(s)
- movl #0x200,%d0 | data freeze bit
- movc %d0,%cacr | only exists on 68030
- movc %cacr,%d0 | read it back
- tstl %d0 | zero?
- jeq not68030 | yes, we have 68020/68040
-
- /*
- * 68030 models
- */
-
- .chip 68030
- movl #0x808,%d0
- movc %d0,%cacr | clear data freeze bit again
- movl #0x80,MMUCMD | set magic cookie
- movl MMUCMD,%d0 | read it back
- btst #7,%d0 | cookie still on?
- jeq not370 | no, 360 or 375
- movl #HP_370,%a0@ | consider a 370 for now
- movl #0,MMUCMD | clear magic cookie
- movl MMUCMD,%d0 | read it back
- btst #7,%d0 | still on?
- jeq ihpibcheck | no, a 370
- movl #HP_340,%a0@ | yes, must be a 340
- jra ihpibcheck
-
-not370:
- movl #HP_36X,%a0@ | type is at least a 360
- movl #0,MMUCMD | clear magic cookie2
- movl MMUCMD,%d0 | read it back
- btst #16,%d0 | still on?
- jeq ihpibcheck | no, a 360 or a 362
- lsrl #MMUID_SHIFT,%d0 | save MMU ID
- andl #MMUID_MASK,%d0
- movl %d0,_C_LABEL(mmuid) | save mmuid
- cmpb #MMUID_345,%d0 | are we a 345?
- jeq isa345
- cmpb #MMUID_375,%d0 | how about a 375?
- jeq isa375
- movl #HP_400,%a0@ | must be a 400
- jra ihpibcheck
-isa345:
- movl #HP_345,%a0@
- jra ihpibcheck
-isa375:
- movl #HP_375,%a0@
- jra ihpibcheck
- .chip 68020
-
- /*
- * End of 68030 section
- */
-
-not68030:
- bset #31,%d0 | data cache enable bit
- movc %d0,%cacr | only exists on 68040
- movc %cacr,%d0 | read it back
- tstl %d0 | zero?
- beq is68020 | yes, we have 68020
- moveq #0,%d0 | now turn it back off
- movec %d0,%cacr | before we access any data
-
- /*
- * 68040 models
- */
-
- .chip 68040
- movc %d0,%itt0
- movc %d0,%itt1
- movc %d0,%dtt0
- movc %d0,%dtt1
- cinva %bc
- movl MMUCMD,%d0 | get MMU ID
- lsrl #MMUID_SHIFT,%d0
- andl #MMUID_MASK,%d0
- movl %d0,_C_LABEL(mmuid) | save mmuid
- cmpb #MMUID_425_T,%d0 | are we a 425t?
- jeq isa425
- cmpb #MMUID_425_S,%d0 | how about 425s?
- jeq isa425
- cmpb #MMUID_425_E,%d0 | or maybe a 425e?
- jeq isa425
- cmpb #MMUID_433_T,%d0 | or a 433t?
- jeq isa433
- cmpb #MMUID_433_S,%d0 | maybe a 433s?
- jeq isa433
- cmpb #MMUID_385,%d0 | then a 385?
- jeq isa385
- cmpb #MMUID_382,%d0 | last chance...
- jeq isa382
- movl #HP_380,%a0@ | guess we are a 380
- jra ihpibcheck
-isa425:
- movl #HP_425,%a0@
- jra ihpibcheck
-isa433:
- movl #HP_433,%a0@
- jra ihpibcheck
-isa385:
- movl #HP_385,%a0@
- jra ihpibcheck
-isa382:
- movl #HP_382,%a0@
- jra ihpibcheck
- .chip 68020
-
- /*
- * End 68040 section
- */
-
- /*
- * 68020 models
- */
-
-is68020:
- movl #HP_330,%a0@ | consider a 330 for now
- movl #1,MMUCMD | a 68020, write HP MMU location
- movl MMUCMD,%d0 | read it back
- btst #0,%d0 | zero?
- jeq ihpibcheck | yes, a 330
- movl #HP_320,%a0@ | no, consider a 320 for now
- movl #0x80,MMUCMD | set magic cookie
- movl MMUCMD,%d0 | read it back
- btst #7,%d0 | cookie still on?
- jeq ihpibcheck | no, just a 320
- movl #HP_350,%a0@ | yes, a 350
-
- /*
- * End 68020 section
- */
-
-ihpibcheck:
- movl #0,MMUCMD | make sure MMU is off
- btst #5,SYSFLAG | do we have an internal HP-IB?
- jeq boottype | yes, continue
- clrl _C_LABEL(internalhpib) | no, clear the internal address
-/*
- * If this is a reboot, extract howto/bootdev stored by kernel
- */
-boottype:
- cmpw #12,BOOTTYPE | is this a reboot (REQ_REBOOT)?
- jne notreboot | no, skip
- lea MAXADDR,%a0 | find last page
- movl %a0@+,%d7 | and extract howto, bootdev
- movl %a0@+,%d6 | from where doboot() left them
- jra boot1
-/*
- * At this point we do not know which logical device the MSUS select
- * code refers to so we cannot construct bootdev. So we just punt
- * and let configure() construct it.
- */
-notreboot:
- moveq #0,%d6 | make sure bootdev is invalid
- cmpw #18,BOOTTYPE | does the user want to interact?
- jeq askme | yes, go to it
- moveq #0,%d7 | default to RB_AUTOBOOT
- jra boot1
-askme:
- moveq #3,%d7 | default to RB_SINGLE|RB_ASKNAME
-boot1:
- movl %d6,_C_LABEL(bootdev) | save bootdev and howto
- movl %d7,_C_LABEL(howto) | globally so all can access
- movl LOWRAM,%d0 | read lowram value from bootrom
- /*
- * Must preserve the scratch area for the BOOT ROM.
- * Round up to the next 8k boundary.
- */
- addl #((2*PAGE_SIZE)-1),%d0
- andl #-(2*PAGE_SIZE),%d0
- movl %d0,_C_LABEL(lowram) | stash that value
-start:
- movl #_C_LABEL(edata),%a2 | start of BSS
- movl #_C_LABEL(end),%a3 | end
-1:
- clrb %a2@+ | clear BSS
- cmpl %a2,%a3 | done?
- bne 1b | no, keep going
- jsr _C_LABEL(configure) | configure critical devices
- jsr _C_LABEL(main) | lets go
-GLOBAL(_rtt)
- movl #3,_C_LABEL(howto) | restarts get RB_SINGLE|RB_ASKNAME
- jmp start
-
-/*
- * probe a location and see if it causes a bus error
- */
-ENTRY_NOPROFILE(badaddr)
- movl BUSERR,_C_LABEL(_bsave) | save ROM bus error handler address
- movl %sp,_C_LABEL(_ssave) | and current stack pointer
- movl #catchbad,BUSERR | plug in our handler
- movl %sp@(4),%a0 | address to probe
- movw %a0@,%d1 | do it
- movl _C_LABEL(_bsave),BUSERR | if we got here, it did not fault
- clrl %d0 | return that this was not a bad addr
- rts
-
-catchbad:
- movl _C_LABEL(_bsave),BUSERR | got a bus error, so restore
- | old handler
- movl _C_LABEL(_ssave),%sp | manually restore stack
- moveq #1,%d0 | indicate that we got a fault
- rts | return to caller of badaddr()
-
- .data
-GLOBAL(_bsave)
- .long 0
-
-GLOBAL(_ssave)
- .long 0
-
-ASENTRY_NOPROFILE(__trap)
- moveml #0xFFFF,%sp@- | save registers
- movl %sp,%sp@- | push pointer to frame
- jsr _C_LABEL(trap) | call C routine to deal with it
- tstl %d0
- jeq Lstop
- addql #4,%sp
- moveml %sp@+,#0x7FFF
- addql #8,%sp
- rte
-Lstop:
- stop #0x2700 | stop cold
-
-ASENTRY_NOPROFILE(nmi)
- movw #18,BOOTTYPE | mark as system switch
- jsr _C_LABEL(kbdnmi) | clear the interrupt, and
- | reset the system
- stop #0 | SCREEEECH!
-
-ENTRY_NOPROFILE(call_req_reboot)
- jmp 0x1A4 | call ROM reboot function
- rts | XXX: just in case?
-
-ENTRY_NOPROFILE(romout)
- movl %sp@(4),%d0 | line number
- movl %sp@(8),%a0 | string
- jsr 0x150 | do it
- rts
diff --git a/sys/arch/hp300/stand/uboot/tgets.c b/sys/arch/hp300/stand/uboot/tgets.c
deleted file mode 100644
index eb852ecfe4c..00000000000
--- a/sys/arch/hp300/stand/uboot/tgets.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/* $OpenBSD: tgets.c,v 1.3 2006/08/17 06:31:10 miod Exp $ */
-/* $NetBSD: tgets.c,v 1.4 1994/10/26 07:28:05 cgd Exp $ */
-
-/*-
- * Copyright (c) 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)gets.c 8.1 (Berkeley) 6/11/93
- */
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-
-int tgetchar(void);
-
-int
-tgetchar()
-{
- int c;
-
- if ((c = cngetc()) == 0)
- return(0);
-
- if (c == '\r')
- c = '\n';
- else if (c == ('c'&037)) {
- panic("^C");
- /* NOTREACHED */
- }
- return(c);
-}
-
-int
-tgets(char *buf)
-{
- int c;
- int i;
- char *lp = buf;
-
- for (i = 240000; i > 0; i--) {
- c = tgetchar() & 0177;
- if (c) {
- for (;;) {
- switch (c) {
- case '\n':
- case '\r':
- *lp = '\0';
- putchar('\n');
- return (1);
- case '\b':
- case '\177':
- if (lp > buf) {
- lp--;
- putchar('\b');
- putchar(' ');
- putchar('\b');
- }
- break;
- case '#':
- if (lp > buf)
- --lp;
- break;
- case 'r' & 037:
- {
- char *p;
- putchar('\n');
- for (p = buf; p < lp; ++p)
- putchar(*p);
- }
- break;
- case '@':
- case 'u' & 037:
- case 'w' & 037:
- lp = buf;
- putchar('\n');
- break;
- default:
- *lp++ = c;
- putchar(c);
- }
- c = getchar() & 0177;
- }
- }
- }
- return (0);
-}
diff --git a/sys/arch/hp300/stand/uboot/uboot.c b/sys/arch/hp300/stand/uboot/uboot.c
deleted file mode 100644
index edf1485aaa9..00000000000
--- a/sys/arch/hp300/stand/uboot/uboot.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/* $OpenBSD: uboot.c,v 1.7 2014/02/23 19:22:40 miod Exp $ */
-/* $NetBSD: uboot.c,v 1.3 1997/04/27 21:17:13 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)boot.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-#include <sys/stat.h>
-#define _KERNEL
-#include <sys/fcntl.h>
-#undef _KERNERL
-
-#include <machine/exec.h>
-#include <a.out.h>
-
-#include <lib/libsa/stand.h>
-
-#include "samachdep.h"
-
-/*
- * Boot program... bits in `howto' determine whether boot stops to
- * ask for system name. Boot device is derived from ROM provided
- * information.
- */
-
-char line[100];
-
-extern u_int opendev;
-extern char *lowram;
-extern int noconsole;
-
-extern const char version[];
-
-extern int devparse(const char *, int *, int *, int *, int *, int *, char **);
-
-/*
- * XXX UFS accepts a /, NFS doesn't.
- */
-char *name;
-char *names[] = {
- "bsd"
-};
-#define NUMNAMES (sizeof(names) / sizeof(char *))
-
-static int bdev, badapt, bctlr, bunit, bpart;
-
-void boot(char *, void *, int);
-void getbootdev(int *);
-int loadrandom(const char *, void *, size_t);
-
-char rnddata[BOOTRANDOM_MAX];
-
-int
-main(void)
-{
- int currname = 0;
-
- printf("\n>> OpenBSD [%dKB] UNIFIED BOOT %s HP 9000/%s CPU\n",
- (__LDPGSZ / 1024), version, getmachineid());
- printf(">> Enter \"reset\" to reset system.\n");
-
- bdev = B_TYPE(bootdev);
- badapt = B_ADAPTOR(bootdev);
- bctlr = B_CONTROLLER(bootdev);
- bunit = B_UNIT(bootdev);
- bpart = B_PARTITION(bootdev);
-
- for (;;) {
- name = names[currname++];
- if (currname == NUMNAMES)
- currname = 0;
-
- if (!noconsole) {
- howto = 0;
- getbootdev(&howto);
- } else
- printf(": %s\n", name);
-
- boot(name, lowram, howto);
- printf("boot: %s\n", strerror(errno));
- }
- return (0);
-}
-
-void
-getbootdev(int *howto)
-{
- char c, *ptr = line;
-
- printf("Boot: [[[%s%d%c:]%s][-acds]] :- ",
- devsw[bdev].dv_name, bctlr + (8 * badapt), 'a' + bpart, name);
-
- if (tgets(line)) {
- if (strcmp(line, "reset") == 0) {
- call_req_reboot(); /* reset machine */
- printf("panic: can't reboot, halting\n");
- asm("stop #0x2700");
- }
- while ((c = *ptr) != '\0') {
- while (c == ' ')
- c = *++ptr;
- if (!c)
- return;
- if (c == '-')
- while ((c = *++ptr) && c != ' ')
- switch (c) {
- case 'a':
- *howto |= RB_ASKNAME;
- continue;
- case 'b':
- *howto |= RB_HALT;
- continue;
- case 'c':
- *howto |= RB_CONFIG;
- continue;
- case 'd':
- *howto |= RB_KDB;
- continue;
- case 's':
- *howto |= RB_SINGLE;
- continue;
- }
- else {
- name = ptr;
- while ((c = *++ptr) && c != ' ');
- if (c)
- *ptr++ = 0;
- }
- }
- } else
- printf("\n");
-}
-
-void
-boot(char *path, void *loadaddr, int howto)
-{
- static int rnd_loaded = 0;
- char rndpath[MAXPATHLEN];
- int dev, adapt, ctlr, unit, part;
- char *fname;
-
- /*
- * Try and load randomness from the boot device if this is a disk.
- */
- if (rnd_loaded == 0) {
- if (devparse(path, &dev, &adapt, &ctlr, &unit, &part,
- &fname) != 0) {
- /*
- * If the device name is bogus, devlookup() has
- * complained loudly. No need to attempt to load a
- * kernel from the same string.
- */
- return;
- }
- if (fname - path < sizeof(rndpath)) {
- memcpy(rndpath, path, fname - path);
- rndpath[fname - path] = '\0';
- strlcat(rndpath, BOOTRANDOM, sizeof rndpath);
- rnd_loaded = loadrandom(rndpath, rnddata,
- sizeof(rnddata));
- }
- }
-
- exec(path, loadaddr, howto);
-}
-
-int
-loadrandom(const char *path, void *buf, size_t buflen)
-{
- struct stat sb;
- int fd;
- int rc = 0;
-
- fd = open(path, O_RDONLY);
- if (fd == -1) {
- if (errno != EPERM)
- printf("cannot open %s: %s\n", path, strerror(errno));
- return 0;
- }
- if (fstat(fd, &sb) == -1 || sb.st_uid != 0 || !S_ISREG(sb.st_mode) ||
- (sb.st_mode & (S_IWOTH|S_IROTH)))
- goto fail;
- (void) read(fd, buf, buflen);
- rc = 1;
-fail:
- close(fd);
- return rc;
-}
diff --git a/sys/arch/m68k/060sp/Makefile b/sys/arch/m68k/060sp/Makefile
deleted file mode 100644
index 73852dd6739..00000000000
--- a/sys/arch/m68k/060sp/Makefile
+++ /dev/null
@@ -1,38 +0,0 @@
-# $OpenBSD: Makefile,v 1.7 2013/02/02 13:32:05 miod Exp $
-# $NetBSD: Makefile,v 1.3 1996/12/31 22:44:13 veego Exp $
-#
-.if ${MACHINE_ARCH} == "m68k"
-
-AS?= as
-AS+= -m68060
-LD= ld
-
-.SUFFIXES: .o .S .sa .defs .h
-
-.sa.S:
- sh ${.CURDIR}/asm2gas ${.IMPSRC} >${.TARGET}
-
-060sp.o: netbsd.S inetbsd.S fnetbsd.S isp.S fpsp.S copyright.S
- $(CC) ${AFLAGS} -m68060 ${CPPFLAGS} -I${.CURDIR} -I. \
- -c -o ${.TARGET} ${.CURDIR}/netbsd.S
-
-clean cleandir:
- rm -f 060sp.o isp.S fpsp.S
-
-_SUBDIRUSE:
-
-.else
-clean cleandir:
-
-.endif
-
-all:
-
-depend:
-
-install:
-
-includes:
-
-.include <bsd.obj.mk>
-.include <bsd.own.mk>
diff --git a/sys/arch/m68k/060sp/Makefile.inc b/sys/arch/m68k/060sp/Makefile.inc
deleted file mode 100644
index 52d9c74cf7e..00000000000
--- a/sys/arch/m68k/060sp/Makefile.inc
+++ /dev/null
@@ -1,26 +0,0 @@
-# $OpenBSD: Makefile.inc,v 1.4 2001/08/22 18:10:17 miod Exp $
-# $NetBSD: Makefile.inc,v 1.2 1997/05/07 07:15:43 mycroft Exp $
-#
-# NOTE: $S must correspond to the top of the `sys' tree
-
-060SPSRCDIR= $S/arch/m68k/060sp
-
-060SPOBJDIR!= cd $(060SPSRCDIR); \
- printf "xxx: .MAKE\n\t@echo \$${.OBJDIR}\n" | $(MAKE) -s -f-
-
-060SPOBJ= $(060SPOBJDIR)/060sp.o
-
-060SPMAKE= \
- cd ${060SPSRCDIR} && MAKEOBJDIR=${060SPOBJDIR} ${MAKE}
-
-$(060SPOBJ): .NOTMAIN __always_make_060sp
- @echo making sure the 060sp is up to date...
- @${060SPMAKE}
-
-clean:: .NOTMAIN __always_make_060sp
- @echo cleaning the 060sp objects
- @${060SPMAKE} clean
-
-060SP!= printf "\#ifdef M060SP\n${060SPOBJ}\n\#endif\n" | cpp -P -undef ${CPPFLAGS:M-DM060SP}
-
-__always_make_060sp: .NOTMAIN
diff --git a/sys/arch/m68k/060sp/ReadMe.NetBSD b/sys/arch/m68k/060sp/ReadMe.NetBSD
deleted file mode 100644
index fdfff726061..00000000000
--- a/sys/arch/m68k/060sp/ReadMe.NetBSD
+++ /dev/null
@@ -1,102 +0,0 @@
-$OpenBSD: ReadMe.NetBSD,v 1.2 1996/05/30 22:13:57 niklas Exp $
-$NetBSD: ReadMe.NetBSD,v 1.1 1996/05/15 21:06:20 is Exp $
-
-Copyright (c) 1996 Ignatios Souvatzis. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-3. All advertising materials mentioning features or use of this software
- must display the following acknowledgement:
- This product includes software developed by Ignatios Souvatzis.
-4. The name of the author may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-Notes about the NetBSD integration
-----------------------------------
-
-Preface and Acknowledgements:
-
-A first try at integrating the M68060 Software Package was done by
-Yasushi Yamasaki of the NetBSD/x68k group, but only available as a
-patch file to their source tree (which wasn't integrated into the
-NetBSD master tree at that time).
-
-I started with their glue code version from the patch file, and
-changed the following things up to now:
-
-- collapse a few identical glue routines (fetch code/data words/longs
-from user space) into a multi-labeled one
-
-- make the gas syntax files of the glue code the Master files
-
-- I call the access error handler (label _buserr) directly, instead of
-through an RTE as in the example file
-
-Other changes are only in the method this was integrated into the
-Amiga vs. X68k port, which is machine dependend anyway.
-
-Thanks for the initial effort!
-
-
-
-I. File suffix convention
-
-I cvs imported all of the Motorola files (with lowercase names).
-
-These are:
-
-*.s: Assembler files "unsupported by Motorola, provided as a reference only"
-*.sa: Pseudo assembler hex dump files, which is Motorolas supported version.
-*.doc: docs by Motorola
-
-errata, changes, files, readme: by Motorola.
-
-
-I choose .S as the file suffix which is feeded to our assembler
-directly or indirectly.
-
-We use: To create:
-
-isp.sa isp.S
-fpsp.sa fpsp.S
-
-In addition, inetbsd.S and fnetbsd.S are our part specific glue files,
-netbsd.S is our general glue file, and copyright.S ensures we have a
-copy of the copyright notice in the kernel if using the 060SP.
-
-To enforce the right relative positions of isp/its glue code inetbsd.S
-includes isp.S at the end, and fnetbsd.S includes fpsp.S.
-
-Ia: Don't Change Files
-
-- all Motorola doc files, all .sa (hex) files.
-
-Ib: Nearly Don't Change Files
-
-- for now, the .s files by Motorola. We might use the fpsp.s file
-later to create an optimized version, once we a) verified its
-identical to the supported .s and b) write a conversion (to .S format)
-script.
-
-II. Interface to the arch/$machine/$machine files:
-
-[to be continued]
-
diff --git a/sys/arch/m68k/060sp/asm2gas b/sys/arch/m68k/060sp/asm2gas
deleted file mode 100644
index cc5117e4466..00000000000
--- a/sys/arch/m68k/060sp/asm2gas
+++ /dev/null
@@ -1,240 +0,0 @@
-#!/bin/sh
-# $OpenBSD: asm2gas,v 1.3 2013/02/02 13:32:05 miod Exp $
-# $NetBSD: asm2gas,v 1.6 2000/12/06 21:31:05 is Exp $
-
-#
-# Copyright (c) 1998 The NetBSD Foundation, Inc.
-# All rights reserved.
-#
-# This code is derived from software contributed to The NetBSD Foundation
-# by Charles M. Hannum.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by the NetBSD
-# Foundation, Inc. and its contributors.
-# 4. Neither the name of The NetBSD Foundation nor the names of its
-# contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
-# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
-# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-# This ugly script converts assembler code from Motorola's format to a
-# form that gas (MIT syntax) can digest.
-
-cat $1 | sed -e '
- # format canonicalization
-
- /[ ]IDNT[ ]/{s/^/|/;p;d;}
- /^\*/{s//|/;p;d;}
- s/;/|/
- /[ ]equ[ ]/{
- s/\([A-Za-z_][A-Za-z0-9_]*\)[ ]*equ[ ]*/\1,/
- s/[ ][ ]*\(.*\)$/ |\1/
- s/ ||/ |/
- s/^/ .set /
- p;d
- }
- s/^\([A-Za-z_][A-Za-z0-9_]*\)[ ][ ]*/\1: /
- s/^\([A-Za-z_][A-Za-z0-9_]*\)$/\1:/
- /^[A-Za-z_][A-Za-z0-9_]*:/{
- h
- s/:.*$/:/
- p
- g
- s/^.*:[ ]*/ /
- /^ $/d
- }
- /^[ ][ ]*\([.a-zA-Z][.a-zA-Z0-9]*\)/{
- h
- s///
- s/^[ ][ ]*//
- s/[ ][ ]*\(.*\)$/ |\1/
- s/ ||/ |/
- x
- s/^[ ][ ]*//
- s/[ ][ ]*.*$/ /
- y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
- s/^/ /
- G
- s/\n//
- }
-' | sed -e '
- # operator conversion
-
- s/^ section 7/ .text/
- s/^ section 8/ .text/
- s/^ section 15/ .data/
- /^ include/{s/include[ ]/.include "/;s/\.h[ ]*$/.defs"/;p;d;}
- s/^ xref/| xref/
- s/^ end/| end/
- s/^ xdef/ .global/
-
- s/^ dc\.l/ .long/
- s/^ dc\.w/ .short/
- s/^ dc\.b/ .byte/
-
- /^ [aceg-z]/{
- /^ add[aiqx]*\.[bwl] /{s/\.//;p;d;}
- /^ andi*\.[bwl] /{s/\.//;p;d;}
- /^ as[lr]\.[bwl] /{s/\.//;p;d;}
- /^ clr\.[bwl] /{s/\.//;p;d;}
- /^ cmp[i2]*\.[bwl] /{s/\.//;p;d;}
- /^ eori*\.[bwl] /{s/\.//;p;d;}
- /^ lea\.l /{s/\..//;p;d;}
- /^ ls[lr]\.[bwl] /{s/\.//;p;d;}
- /^ move[acmqs]*\.[bwl] /{s/\.//;p;d;}
- /^ mul[su]\.[wl] /{s/\.//;p;d;}
- /^ neg\.[bwl] /{s/\.//;p;d;}
- /^ ori*\.[bwl] /{s/\.//;p;d;}
- /^ ro[lrx]*\.[bwl] /{s/\.//;p;d;}
- /^ sub[aiqx]*\.[bwl] /{s/\.//;p;d;}
- /^ swap\.w /{s/\..//;p;d;}
- /^ s\([a-tv-z][a-z]*\)\.b /{s/\..//;p;d;}
- /^ tst\.[bwl] /{s/\.//;p;d;}
- p;d
- }
-
- /^ bchg\.[bl] /{s/\..//;p;d;}
- /^ bclr\.[bl] /{s/\..//;p;d;}
- /^ bset\.[bl] /{s/\..//;p;d;}
- /^ btst\.[bl] /{s/\..//;p;d;}
- /^ div[sul]*\.[wl] /{s/\.//;p;d;}
- /^ fabs\.[sdx] /{s/\.//;p;d;}
- /^ fadd\.[sdxbwl] /{s/\.//;p;d;}
- /^ fcmp\.[sdxbwl] /{s/\.//;p;d;}
- /^ fdiv\.[sdx] /{s/\.//;p;d;}
- /^ fmove[mx]*\.[sdxbwl] /{s/\.//;p;d;}
- /^ fmul\.[sdx] /{s/\.//;p;d;}
- /^ fneg\.[sdx] /{s/\.//;p;d;}
- /^ fsqrt\.[sdx] /{s/\.//;p;d;}
- /^ fsub\.[sdxbwl] /{s/\.//;p;d;}
- /^ ftst\.[sdx] /{s/\.//;p;d;}
-
- /^ b[a-eg-z][a-z]*\.b /{s/\.b/s/;p;d;}
- /^ b[a-eg-z][a-z]*\.w /{s/\.w//;p;d;}
- /^ b[a-eg-z][a-z]*\.l /{s/\.l/l/;p;d;}
- /^ db[a-z][a-z]*\.w /{s/\.w//;p;d;}
- /^ fb[a-eg-z][a-z]*\.w /{s/\.w//;p;d;}
- /^ fb[a-eg-z][a-z]*\.l /{s/\.l/l/;p;d;}
-' | sed -e '
- # operand conversion
-
- s/\([^_a-zA-Z0-9]\)FPIAR\([^_a-zA-Z0-9]\)/\1%FPI\2/g
- s/\([^_a-zA-Z0-9]\)FPIAR$/\1%FPI/g
- s/\([^_a-zA-Z0-9]\)fpiar\([^_a-zA-Z0-9]\)/\1%fpi\2/g
- s/\([^_a-zA-Z0-9]\)fpiar$/\1%fpi/g
- s/\([^_a-zA-Z0-9]\)FPCR\([^_a-zA-Z0-9]\)/\1%FPCR\2/g
- s/\([^_a-zA-Z0-9]\)FPCR$/\1%FPCR/g
- s/\([^_a-zA-Z0-9]\)fpcr\([^_a-zA-Z0-9]\)/\1%fpcr\2/g
- s/\([^_a-zA-Z0-9]\)fpcr$/\1%fpcr/g
- s/\([^_a-zA-Z0-9]\)FPSR\([^_a-zA-Z0-9]\)/\1%FPSR\2/g
- s/\([^_a-zA-Z0-9]\)FPSR$/\1%FPSR/g
- s/\([^_a-zA-Z0-9]\)fpsr\([^_a-zA-Z0-9]\)/\1%fpsr\2/g
- s/\([^_a-zA-Z0-9]\)fpsr$/\1%fpsr/g
-
- # RCS Id
- s/\$\(NetBSD.*\)\$/\1/g
- s/\$\(OpenBSD.*\)\$/\1/g
- s/\$/0x/g
- s/#:/#:0x/g
-
- s/\([^[:alnum:]_]\)\([dDaA][0-7]\)\([^[:alnum:]_]\)/\1%\2\3/g
- s/\([^[:alnum:]_]\)\([fF][pP][0-7]\)\([^[:alnum:]_]\)/\1%\2\3/g
- s/\([^[:alnum:]_]\)\(sp\)\([^[:alnum:]_]\)/\1%\2\3/g
- s/\([^[:alnum:]_]\)\(pc\)\([^[:alnum:]_]\)/\1%\2\3/g
-
- s/\([^[:alnum:]_]\)\([dDaA][0-7]\)$/\1%\2/g
- s/\([^[:alnum:]_]\)\([fF][pP][0-7]\)$/\1%\2/g
- s/\([^[:alnum:]_]\)\(sp\)$/\1%\2/g
-
- s/\(,\)\([dDaA][0-7]\)/\1%\2/g
- s/\(,\)\([fF][pP][0-7]\)/\1%\2/g
-
- s/-(\(%[sSpPaA][pPcC0-7]\))/\1@-/g
- s/(\(%[sSpPaA][pPcC0-7]\))+/\1@+/g
- s/\([-+A-Za-z0-9_]*\)(\(%[sSpPaA][pPcC0-7]\)\([),]\)/\2@(\1\3/g
-
- s/\.\([bBwWlL])\)/:\1/g
- s/\.\([bBwWlL]\)\*\([0-9][0-9]*)\)/:\1:\2/g
- s/\*\([0-9][0-9]*\))/:l:\1)/g
- s/{\([0-9][0-9]*\):\([0-9][0-9]*\)}/{#\1:#\2}/g
- s/{\(%[dD][0-7]\):\([0-9][0-9]*\)}/{\1:#\2}/g
- s/{\([dD][0-7]\):\([0-9][0-9]*\)}/{%\1:#\2}/g
- s/{\([dD][0-7]\):\(%[dD][0-9]*\)}/{%\1:\2}/g
-
- s/\(-\)\([dDaA][0-7]\)\([^_a-zA-Z0-9]\)/\1%\2\3/g
- s/\(-\)\([fF][pP][0-7]\)\([^_a-zA-Z0-9]\)/\1%\2\3/g
-
- s/\(\/\)\([dDaA][0-7]\)\([^_a-zA-Z0-9]\)/\1%\2\3/g
- s/\(\/\)\([fF][pP][0-7]\)\([^_a-zA-Z0-9]\)/\1%\2\3/g
-
- s/@(0*)/@/g
- s/(,/(/g;s/:)/)/g
-
- # make up for a gas bug
- /^ fmovemx /{
- s/ \(%[fF][pP][0-7]\),/ \1-\1,/
- s/,\(%[fF][pP][0-7]\) /,\1-\1 /
- s/,\(%[fF][pP][0-7]\)$/,\1-\1/
- }
-' | sed -e '
- # Floating point literal conversion
-
- s/:0x41dfffffffc00000/0r2147483647.0/g
- s/:0xc1e0000000000000/0r-2147483648.0/g
- s/:0x41dfffffffe00000/0r2147483647.5/g
- s/:0xc1e0000000100000/0r-2147483648.5/g
- s/:0x46fffe00/0r32767.0/g
- s/:0xc7000000/0r-32768.0/g
- s/:0x46ffff00/0r32767.5/g
- s/:0xc7000080/0r-32768.5/g
- s/:0x42fe0000/0r127.0/g
- s/:0xc3000000/0r-128.0/g
- s/:0x42ff0000/0r127.5/g
- s/:0xc3008000/0r-128.5/g
- s/:0x3F800000/0r1.0/g
- s/:0x00000000/0r0.0/g
- s/:0xBF800000/0r-1.0/g
- s/:0x3F000000/0r0.5/g
- s/:0x3E800000/0r0.25/g
- s/:0x42B8AA3B/0r92.332481384277343750/g
- s/:0xBC317218/0r-0.0108304247260093688964843750/g
- s/:0x3AB60B70/0r0.001388890668749809265136718750/g
- s/:0x3C088895/0r0.0083333449438214302062988281250/g
- s/:0x42B8AA3B/0r92.332481384277343750/g
- s/:0x3950097B/0r0.0001983995753107592463493347167968750/g
- s/:0x3AB60B6A/0r0.001388889970257878303527832031250/g
- s/:0x2F30CAA8/0r1.60791047143504783889511600136756896972656250e-10/g
- s/:0x310F8290/0r2.0883454965314740547910332679748535156250e-09/g
- s/:0x32D73220/0r2.5052088403754169121384620666503906250e-08/g
- s/:0x3493F281/0r2.755732850800995947793126106262207031250e-07/g
- s/:0x40000000/0r2.0/g
- s/:0x42800000/0r6.40e+01/g
- s/:0x3C800000/0r1.56250e-02/g
- s/fadds #:0x00800000,%[fF][pP]0/ .long 0xf23c4422,0x00800000/
- s/fsubs #:0x00800000,%[fF][pP]0/ .long 0xf23c4428,0x00800000/
- s/fsubs #:0x00800000,%[fF][pP]1/ .long 0xf23c44a8,0x00800000/
- s/fmoves #:0x80000000,%[fF][pP]0/ .long 0xf23c4400,0x80000000/
- s/fmoves #:0x00000000,%[fF][pP]0/ .long 0xf23c4400,0x00000000/
-
-'
diff --git a/sys/arch/m68k/060sp/changes b/sys/arch/m68k/060sp/changes
deleted file mode 100644
index a7ccc539f40..00000000000
--- a/sys/arch/m68k/060sp/changes
+++ /dev/null
@@ -1,129 +0,0 @@
-#
-# $OpenBSD: changes,v 1.2 1996/05/30 22:13:59 niklas Exp $
-# $NetBSD: changes,v 1.2 1996/05/15 19:47:31 is Exp $
-#
-
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-# M68000 Hi-Performance Microprocessor Division
-# M68060 Software Package Production Release
-#
-# M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
-# All rights reserved.
-#
-# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-# To the maximum extent permitted by applicable law,
-# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
-# FOR A PARTICULAR PURPOSE and any warranty against infringement with
-# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-# and any accompanying written materials.
-#
-# To the maximum extent permitted by applicable law,
-# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
-# BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
-# ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
-#
-# Motorola assumes no responsibility for the maintenance and support
-# of the SOFTWARE.
-#
-# You are hereby granted a copyright license to use, modify, and distribute the
-# SOFTWARE so long as this entire notice is retained without alteration
-# in any modified and/or redistributed versions, and that such modified
-# versions are clearly identified as such.
-# No licenses are granted by implication, estoppel or otherwise under any
-# patents or trademarks of Motorola, Inc.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-CHANGES SINCE LAST RELEASE:
----------------------------
-
-1) "movep" emulation where data was being read from memory
-was reading the intermediate bytes. Emulation now only
-reads the required bytes.
-
-2) "flogn", "flog2", and "flog10" of "1" was setting the
-Inexact FPSR bit. Emulation now does not set Inexact for
-this case.
-
-3) For an opclass three FP instruction where the effective addressing
-mode was pre-decrement or post-increment and the address register
-was A0 or A1, the address register was not being updated as a result
-of the operation. This has been corrected.
-
-4) Beta 1.2 version had the following erratum:
-
- Scenario:
- ---------
- If {i,d}mem_{read,write}_{byte,word,long}() returns
- a failing value to the 68060SP, the package ignores
- this return value and continues with program execution
- as if it never received a failing value.
-
- Effect:
- -------
- For example, if a user executed "fsin.x ADDR,fp0" where
- ADDR should cause a "segmentation violation", the memory read
- requested by the package should return a failing value
- to the package. Since the package currently ignores this
- return value, the user program will continue to the
- next instruction, and the result created in fp0 will be
- undefined.
-
- Fix:
- ----
- This has been fixed in the current release.
-
- Notes:
- ------
- Upon receiving a non-zero (failing) return value from
- a {i,d}mem_{read,write}_{byte,word,long}() "call-out",
- the package creates a 16-byte access error stack frame
- from the current exception stack frame and exits
- through the "call-out" _real_access(). This is the process
- as described in the MC68060 User's Manual.
-
- For instruction read access errors, the info stacked is:
- SR = SR at time of exception
- PC = PC of instruction being emulated
- VOFF = $4008 (stack frame format type)
- ADDRESS = PC of instruction being emulated
- FSLW = FAULT STATUS LONGWORD
-
- The valid FSLW bits are:
- bit 27 = 1 (misaligned bit)
- bit 24 = 1 (read)
- bit 23 = 0 (write)
- bit 22:21 = 10 (SIZE = word)
- bit 20:19 = 00 (TT)
- bit 18:16 = x10 (TM; x = 1 for supervisor mode)
- bit 15 = 1 (IO)
- bit 0 = 1 (Software Emulation Error)
-
- all other bits are EQUAL TO ZERO and can be set by the _real_access()
- "call-out" stub by the user as appropriate. The MC68060 User's Manual
- stated that ONLY "bit 0" would be set. The 060SP attempts to set a few
- other bits.
-
- For data read/write access errors, the info stacked is:
- SR = SR at time of exception
- PC = PC of instruction being emulated
- VOFF = $4008 (stack frame format type)
- ADDRESS = Address of source or destination operand
- FSLW = FAULT STATUS LONGWORD
-
- The valid FSLW bits are:
- bit 27 = 0 (misaligned bit)
- bit 24 = x (read; 1 if read, 0 if write)
- bit 23 = x (write; 1 if write, 0 if read)
- bit 22:21 = xx (SIZE; see MC68060 User's Manual)
- bit 20:19 = 00 (TT)
- bit 18:16 = x01 (TM; x = 1 for supervisor mode)
- bit 15 = 0 (IO)
- bit 0 = 1 (Software Emulation Error)
-
- all other bits are EQUAL TO ZERO and can be set by the _real_access()
- "call-out" stub by the user as appropriate. The MC68060 User's Manual
- stated that ONLY "bit 0" would be set. The 060SP attempts to set a few
- other bits.
diff --git a/sys/arch/m68k/060sp/copyright.S b/sys/arch/m68k/060sp/copyright.S
deleted file mode 100644
index f947617392d..00000000000
--- a/sys/arch/m68k/060sp/copyright.S
+++ /dev/null
@@ -1,45 +0,0 @@
-|#
-|# $OpenBSD: copyright.S,v 1.3 2013/02/02 13:32:05 miod Exp $
-|# $NetBSD: copyright.S,v 1.2 1996/05/16 15:37:49 is Exp $
-|#
-
- .ascii "MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP\n"
- .ascii "M68000 Hi-Performance Microprocessor Division\n"
- .ascii "M68060 Software Package Production Release \n"
- .ascii "\n"
- .ascii "M68060 Software Package Copyright (C) 1993, 1994, "
- .ascii "1995, 1996 Motorola Inc.\n"
- .ascii "All rights reserved.\n"
- .ascii "\n"
- .ascii "THE SOFTWARE is provided on an \"AS IS\" basis and without"
- .ascii " warranty.\n"
- .ascii "To the maximum extent permitted by applicable law,\n"
- .ascii "MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,\n"
- .ascii "INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS\n"
- .ascii "FOR A PARTICULAR PURPOSE and any warranty against infringement with\n"
- .ascii "regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)\n"
- .ascii "and any accompanying written materials. \n"
- .ascii "\n"
- .ascii "To the maximum extent permitted by applicable law,\n"
- .ascii "IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER\n"
- .ascii "(INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF"
- .ascii " BUSINESS PROFITS,\n"
- .ascii "BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER"
- .ascii " PECUNIARY LOSS)\n"
- .ascii "ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.\n"
- .ascii "\n"
- .ascii "Motorola assumes no responsibility for the maintenance and support\n"
- .ascii "of the SOFTWARE. \n"
- .ascii "\n"
- .ascii "You are hereby granted a copyright license to use, modify, and"
- .ascii " distribute the\n"
- .ascii "SOFTWARE so long as this entire notice is retained without"
- .ascii " alteration\n"
- .ascii "in any modified and/or redistributed versions, and that such"
- .ascii " modified\n"
- .ascii "versions are clearly identified as such.\n"
- .ascii "No licenses are granted by implication, estoppel or otherwise"
- .ascii " under any\n"
- .ascii "patents or trademarks of Motorola, Inc.\n"
- .byte 0
- .even
diff --git a/sys/arch/m68k/060sp/errata b/sys/arch/m68k/060sp/errata
deleted file mode 100644
index c6db215f5df..00000000000
--- a/sys/arch/m68k/060sp/errata
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# $OpenBSD: errata,v 1.2 1996/05/30 22:14:03 niklas Exp $
-# $NetBSD: errata,v 1.2 1996/05/15 19:47:33 is Exp $
-#
-
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-# M68000 Hi-Performance Microprocessor Division
-# M68060 Software Package Production Release
-#
-# M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
-# All rights reserved.
-#
-# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-# To the maximum extent permitted by applicable law,
-# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
-# FOR A PARTICULAR PURPOSE and any warranty against infringement with
-# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-# and any accompanying written materials.
-#
-# To the maximum extent permitted by applicable law,
-# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
-# BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
-# ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
-#
-# Motorola assumes no responsibility for the maintenance and support
-# of the SOFTWARE.
-#
-# You are hereby granted a copyright license to use, modify, and distribute the
-# SOFTWARE so long as this entire notice is retained without alteration
-# in any modified and/or redistributed versions, and that such modified
-# versions are clearly identified as such.
-# No licenses are granted by implication, estoppel or otherwise under any
-# patents or trademarks of Motorola, Inc.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-68060 Software Package Errata As of 7 October 1994
-------------------------------
-
-No known errata for this release.
diff --git a/sys/arch/m68k/060sp/fnetbsd.S b/sys/arch/m68k/060sp/fnetbsd.S
deleted file mode 100644
index e3f3ab76eaf..00000000000
--- a/sys/arch/m68k/060sp/fnetbsd.S
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
- * $OpenBSD: fnetbsd.S,v 1.3 2013/02/02 13:32:05 miod Exp $
- * $NetBSD: fnetbsd.S,v 1.2 1996/05/15 21:16:45 is Exp $
- *
- *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- * MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
- * M68000 Hi-Performance Microprocessor Division
- * M68060 Software Package Production Release
- *
- * M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
- * All rights reserved.
- *
- * THE SOFTWARE is provided on an "AS IS" basis and without warranty.
- * To the maximum extent permitted by applicable law,
- * MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
- * INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
- * FOR A PARTICULAR PURPOSE and any warranty against infringement with
- * regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
- * and any accompanying written materials.
- *
- * To the maximum extent permitted by applicable law,
- * IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
- * (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
- * BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
- * ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
- *
- * Motorola assumes no responsibility for the maintenance and support
- * of the SOFTWARE.
- *
- * You are hereby granted a copyright license to use, modify, and distribute the
- * SOFTWARE so long as this entire notice is retained without alteration
- * in any modified and/or redistributed versions, and that such modified
- * versions are clearly identified as such.
- * No licenses are granted by implication, estoppel or otherwise under any
- * patents or trademarks of Motorola, Inc.
- *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * Derived from:
- * fskeleton.s
- *
- * This file contains:
- * (1) example "Call-out"s
- * (2) example package entry code
- * (3) example "Call-out" table
- */
-
-
-/********************************
- * (1) EXAMPLE CALL-OUTS *
- * *
- * _060_fpsp_done() *
- * _060_real_ovfl() *
- * _060_real_unfl() *
- * _060_real_operr() *
- * _060_real_snan() *
- * _060_real_dz() *
- * _060_real_inex() *
- * _060_real_bsun() *
- * _060_real_fline() *
- * _060_real_fpu_disabled() *
- * _060_real_trap() *
- ********************************/
-
-/*
- * _060_fpsp_done():
- *
- * This is the main exit point for the 68060 Floating-Point
- * Software Package. For a normal exit, all 060FPSP routines call this
- * routine. The operating system can do system dependent clean-up or
- * simply execute an "rte" as with the sample code below.
- */
-ASENTRY_NOPROFILE(_060_fpsp_done)
- rte
-
-/*
- * _060_real_ovfl():
- *
- * This is the exit point for the 060FPSP when an enabled overflow exception
- * is present. The routine below should point to the operating system handler
- * for enabled overflow conditions. The exception stack frame is an overflow
- * stack frame. The FP state frame holds the EXCEPTIONAL OPERAND.
- *
- * The sample routine below simply clears the exception status bit and
- * does an "rte".
- */
-ASENTRY_NOPROFILE(_060_real_ovfl)
- fsave %sp@-
- movew #0x6000,%sp@(0x2)
- frestore %sp@+
- jmp _C_LABEL(fpfault)
-
-/*
- * _060_real_unfl():
- *
- * This is the exit point for the 060FPSP when an enabled underflow exception
- * is present. The routine below should point to the operating system handler
- * for enabled underflow conditions. The exception stack frame is an underflow
- * stack frame. The FP state frame holds the EXCEPTIONAL OPERAND.
- *
- * The sample routine below simply clears the exception status bit and
- * does an "rte".
- */
-ASENTRY_NOPROFILE(_060_real_unfl)
- fsave %sp@-
- movew #0x6000,%sp@(0x2)
- frestore %sp@+
- jmp _C_LABEL(fpfault)
-
-/*
- * _060_real_operr():
- *
- * This is the exit point for the 060FPSP when an enabled operand error exception
- * is present. The routine below should point to the operating system handler
- * for enabled operand error exceptions. The exception stack frame is an operand error
- * stack frame. The FP state frame holds the source operand of the faulting
- * instruction.
- *
- * The sample routine below simply clears the exception status bit and
- * does an "rte".
- */
-ASENTRY_NOPROFILE(_060_real_operr)
- fsave %sp@-
- movew #0x6000,%sp@(0x2)
- frestore %sp@+
- jmp _C_LABEL(fpfault)
-
-/*
- * _060_real_snan():
- *
- * This is the exit point for the 060FPSP when an enabled signalling NaN exception
- * is present. The routine below should point to the operating system handler
- * for enabled signalling NaN exceptions. The exception stack frame is a signalling NaN
- * stack frame. The FP state frame holds the source operand of the faulting
- * instruction.
- *
- * The sample routine below simply clears the exception status bit and
- * does an "rte".
- */
-ASENTRY_NOPROFILE(_060_real_snan)
- fsave %sp@-
- movew #0x6000,%sp@(0x2)
- frestore %sp@+
- jmp _C_LABEL(fpfault)
-
-/*
- * _060_real_dz():
- *
- * This is the exit point for the 060FPSP when an enabled divide-by-zero exception
- * is present. The routine below should point to the operating system handler
- * for enabled divide-by-zero exceptions. The exception stack frame is a divide-by-zero
- * stack frame. The FP state frame holds the source operand of the faulting
- * instruction.
- *
- * The sample routine below simply clears the exception status bit and
- * does an "rte".
- */
-ASENTRY_NOPROFILE(_060_real_dz)
- fsave %sp@-
- movew #0x6000,%sp@(0x2)
- frestore %sp@+
- jmp _C_LABEL(fpfault)
-
-/*
- * _060_real_inex():
- *
- * This is the exit point for the 060FPSP when an enabled inexact exception
- * is present. The routine below should point to the operating system handler
- * for enabled inexact exceptions. The exception stack frame is an inexact
- * stack frame. The FP state frame holds the source operand of the faulting
- * instruction.
- *
- * The sample routine below simply clears the exception status bit and
- * does an "rte".
- */
-ASENTRY_NOPROFILE(_060_real_inex)
- fsave %sp@-
- movew #0x6000,%sp@(0x2)
- frestore %sp@+
- jmp _C_LABEL(fpfault)
-
-/*
- * _060_real_bsun():
- *
- * This is the exit point for the 060FPSP when an enabled bsun exception
- * is present. The routine below should point to the operating system handler
- * for enabled bsun exceptions. The exception stack frame is a bsun
- * stack frame.
- *
- * The sample routine below clears the exception status bit, clears the NaN
- * bit in the FPSR, and does an "rte". The instruction that caused the
- * bsun will now be re-executed but with the NaN FPSR bit cleared.
- */
-ASENTRY_NOPROFILE(_060_real_bsun)
- fsave %sp@-
-
- fmovel %fpsr,%sp@-
- andib #0xfe,%sp@
- fmovel %sp@+,%fpsr
-
- addl #0xc,%sp
- jmp _C_LABEL(fpfault)
-
-/*
- * _060_real_fline():
- *
- * This is the exit point for the 060FPSP when an F-Line Illegal exception is
- * encountered. Three different types of exceptions can enter the F-Line exception
- * vector number 11: FP Unimplemented Instructions, FP implemented instructions when
- * the FPU is disabled, and F-Line Illegal instructions. The 060FPSP module
- * _fpsp_fline() distinguishes between the three and acts appropriately. F-Line
- * Illegals branch here.
- */
-ASENTRY_NOPROFILE(_060_real_fline)
- jmp _C_LABEL(fpfault)
-
-/*
- * _060_real_fpu_disabled():
- *
- * This is the exit point for the 060FPSP when an FPU disabled exception is
- * encountered. Three different types of exceptions can enter the F-Line exception
- * vector number 11: FP Unimplemented Instructions, FP implemented instructions when
- * the FPU is disabled, and F-Line Illegal instructions. The 060FPSP module
- * _fpsp_fline() distinguishes between the three and acts appropriately. FPU disabled
- * exceptions branch here.
- *
- * The sample code below enables the FPU, sets the PC field in the exception stack
- * frame to the PC of the instruction causing the exception, and does an "rte".
- * The execution of the instruction then proceeds with an enabled floating-point
- * unit.
- */
-ASENTRY_NOPROFILE(_060_real_fpu_disabled)
- movel %d0,%sp@- |# enabled the fpu
-
- .short 0x4e7a,0x0808 |* movec.l pcr,d0
- bclr #0x1,%d0
- .short 0x4e7b,0x0808 |* movec.l d0,pcr
- movel %sp@+,%d0
-
- movel %sp@(0xc),%sp@(0x2) |# set "Current PC"
- rte
-
-/*
- * _060_real_trap():
- *
- * This is the exit point for the 060FPSP when an emulated "ftrapcc" instruction
- * discovers that the trap condition is true and it should branch to the operating
- * system handler for the trap exception vector number 7.
- *
- * The sample code below simply executes an "rte".
- */
-ASENTRY_NOPROFILE(_060_real_trap)
- rte
-
-/*****************************************************************************/
-
-/**********************************
- * (2) EXAMPLE PACKAGE ENTRY CODE *
- **********************************/
-
-ASENTRY_NOPROFILE(_060_fpsp_snan)
- bral _C_LABEL(FP_CALL_TOP)+0x80+0x00
-
-ASENTRY_NOPROFILE(_060_fpsp_operr)
- bral _C_LABEL(FP_CALL_TOP)+0x80+0x08
-
-ASENTRY_NOPROFILE(_060_fpsp_ovfl)
- bral _C_LABEL(FP_CALL_TOP)+0x80+0x10
-
-ASENTRY_NOPROFILE(_060_fpsp_unfl)
- bral _C_LABEL(FP_CALL_TOP)+0x80+0x18
-
-ASENTRY_NOPROFILE(_060_fpsp_dz)
- bral _C_LABEL(FP_CALL_TOP)+0x80+0x20
-
-ASENTRY_NOPROFILE(_060_fpsp_inex)
- bral _C_LABEL(FP_CALL_TOP)+0x80+0x28
-
-ASENTRY_NOPROFILE(_060_fpsp_fline)
- bral _C_LABEL(FP_CALL_TOP)+0x80+0x30
-
-ASENTRY_NOPROFILE(_060_fpsp_unsupp)
- bral _C_LABEL(FP_CALL_TOP)+0x80+0x38
-
-ASENTRY_NOPROFILE(_060_fpsp_effadd)
- bral _C_LABEL(FP_CALL_TOP)+0x80+0x40
-
-/*****************************************************************************/
-
-/********************************
- * (3) EXAMPLE CALL-OUT SECTION *
- ********************************/
-
-/*
- * The size of this section MUST be 128 bytes!!!
- */
-
-GLOBAL(FP_CALL_TOP)
- .long _ASM_LABEL(_060_real_bsun)-_C_LABEL(FP_CALL_TOP)
- .long _ASM_LABEL(_060_real_snan)-_C_LABEL(FP_CALL_TOP)
- .long _ASM_LABEL(_060_real_operr)-_C_LABEL(FP_CALL_TOP)
- .long _ASM_LABEL(_060_real_ovfl)-_C_LABEL(FP_CALL_TOP)
- .long _ASM_LABEL(_060_real_unfl)-_C_LABEL(FP_CALL_TOP)
- .long _ASM_LABEL(_060_real_dz)-_C_LABEL(FP_CALL_TOP)
- .long _ASM_LABEL(_060_real_inex)-_C_LABEL(FP_CALL_TOP)
- .long _ASM_LABEL(_060_real_fline)-_C_LABEL(FP_CALL_TOP)
- .long _ASM_LABEL(_060_real_fpu_disabled)-_C_LABEL(FP_CALL_TOP)
- .long _ASM_LABEL(_060_real_trap)-_C_LABEL(FP_CALL_TOP)
- .long _ASM_LABEL(_060_real_trace)-_C_LABEL(FP_CALL_TOP)
- .long _ASM_LABEL(_060_real_access)-_C_LABEL(FP_CALL_TOP)
- .long _ASM_LABEL(_060_fpsp_done)-_C_LABEL(FP_CALL_TOP)
-
- .long 0x00000000,0x00000000,0x00000000
-
- .long _ASM_LABEL(_060_imem_read)-_C_LABEL(FP_CALL_TOP)
- .long _ASM_LABEL(_060_dmem_read)-_C_LABEL(FP_CALL_TOP)
- .long _ASM_LABEL(_060_dmem_write)-_C_LABEL(FP_CALL_TOP)
- .long _ASM_LABEL(_060_imem_read_word)-_C_LABEL(FP_CALL_TOP)
- .long _ASM_LABEL(_060_imem_read_long)-_C_LABEL(FP_CALL_TOP)
- .long _ASM_LABEL(_060_dmem_read_byte)-_C_LABEL(FP_CALL_TOP)
- .long _ASM_LABEL(_060_dmem_read_word)-_C_LABEL(FP_CALL_TOP)
- .long _ASM_LABEL(_060_dmem_read_long)-_C_LABEL(FP_CALL_TOP)
- .long _ASM_LABEL(_060_dmem_write_byte)-_C_LABEL(FP_CALL_TOP)
- .long _ASM_LABEL(_060_dmem_write_word)-_C_LABEL(FP_CALL_TOP)
- .long _ASM_LABEL(_060_dmem_write_long)-_C_LABEL(FP_CALL_TOP)
-
- .long 0x00000000
-
- .long 0x00000000,0x00000000,0x00000000,0x00000000
-
-/*****************************************************************************/
-
-/*
- * 060 FPSP KERNEL PACKAGE NEEDS TO GO HERE!!!
- */
-
-#include "fpsp.S"
-
diff --git a/sys/arch/m68k/060sp/fplsp.doc b/sys/arch/m68k/060sp/fplsp.doc
deleted file mode 100644
index d242502bd10..00000000000
--- a/sys/arch/m68k/060sp/fplsp.doc
+++ /dev/null
@@ -1,240 +0,0 @@
-#
-# $OpenBSD: fplsp.doc,v 1.2 1996/05/30 22:14:06 niklas Exp $
-# $NetBSD: fplsp.doc,v 1.2 1996/05/15 19:47:35 is Exp $
-#
-
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-# M68000 Hi-Performance Microprocessor Division
-# M68060 Software Package Production Release
-#
-# M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
-# All rights reserved.
-#
-# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-# To the maximum extent permitted by applicable law,
-# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
-# FOR A PARTICULAR PURPOSE and any warranty against infringement with
-# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-# and any accompanying written materials.
-#
-# To the maximum extent permitted by applicable law,
-# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
-# BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
-# ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
-#
-# Motorola assumes no responsibility for the maintenance and support
-# of the SOFTWARE.
-#
-# You are hereby granted a copyright license to use, modify, and distribute the
-# SOFTWARE so long as this entire notice is retained without alteration
-# in any modified and/or redistributed versions, and that such modified
-# versions are clearly identified as such.
-# No licenses are granted by implication, estoppel or otherwise under any
-# patents or trademarks of Motorola, Inc.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-68060 FLOATING-POINT SOFTWARE PACKAGE (Library version)
---------------------------------------------------------
-
-The file fplsp.sa contains the "Library version" of the
-68060SP Floating-Point Software Package. The routines
-included in this module can be used to emulate the
-FP instructions not implemented in 68060 hardware. These
-instructions normally take exception vector #11
-"FP Unimplemented Instruction".
-
-By re-compiling a program that uses these instructions, and
-making subroutine calls in place of the unimplemented
-instructions, a program can avoid the overhead associated
-with taking the exception.
-
-Release file format:
---------------------
-The file fplsp.sa is essentially a hexadecimal image of the
-release package. This is the ONLY format which will be supported.
-The hex image was created by assembling the source code and
-then converting the resulting binary output image into an
-ASCII text file. The hexadecimal numbers are listed
-using the Motorola Assembly Syntax assembler directive "dc.l"
-(define constant longword). The file can be converted to other
-assembly syntaxes by using any word processor with a global
-search and replace function.
-
-To assist in assembling and linking this module with other modules,
-the installer should add a symbolic label to the top of the file.
-This will allow calling routines to access the entry points
-of this package.
-
-The source code fplsp.s has also been included but only for
-documentation purposes.
-
-Release file structure:
------------------------
-The file fplsp.sa contains an "Entry-Point" section and a
-code section. The FPLSP has no "Call-Out" section. The first section
-is the "Entry-Point" section. In order to access a function in the
-package, a program must "bsr" or "jsr" to the location listed
-below in "68060FPLSP entry points" that corresponds to the desired
-function. A branch instruction located at the selected entry point
-within the package will then enter the correct emulation code routine.
-
-The entry point addresses at the beginning of the package will remain
-fixed so that a program calling the routines will not have to be
-re-compiled with every new 68060FPLSP release.
-
-There are 3 entry-points for each instruction type: single precision,
-double precision, and extended precision.
-
-As an example, the "fsin" library instruction can be passed an
-extended precision operand if program executes:
-
-# fsin.x fp0
-
- fmovm.x &0x01,-(%sp) # pass operand on stack
- bsr.l _060FPLSP_TOP+0x1a8 # branch to fsin routine
- add.l &0xc,%sp # clear operand from stack
-
-Upon return, fp0 holds the correct result. The FPSR is
-set correctly. The FPCR is unchanged. The FPIAR is undefined.
-
-Another example. This time, a dyadic operation:
-
-# frem.s %fp1,%fp0
-
- fmov.s %fp1,-(%sp) # pass src operand
- fmov.s %fp0,-(%sp) # pass dst operand
- bsr.l _060FPLSP_TOP+0x168 # branch to frem routine
- addq.l &0x8,%sp # clear operands from stack
-
-Again, the result is returned in fp0. Note that BOTH operands
-are passed in single precision format.
-
-Exception reporting:
---------------------
-The package takes exceptions according to the FPCR value upon subroutine
-entry. If an exception should be reported, then the package forces
-this exception using implemented floating-point instructions.
-For example, if the instruction being emulated should cause a
-floating-point Operand Error exception, then the library routine
-executes an FMUL of a zero and an infinity to force the OPERR
-exception. Although the FPIAR will be undefined for the enabled
-Operand Error exception handler, the user will at least be able
-to record that the event occurred.
-
-Miscellaneous:
---------------
-The package does not attempt to correctly emulate instructions
-with Signalling NAN inputs. Use of SNANs should be avoided with
-this package.
-
-The fabs/fadd/fdiv/fint/fintrz/fmul/fneg/fsqrt/fsub entry points
-are provided for the convenience of older compilers that make
-subroutine calls for all fp instructions. The code does NOT emulate
-the instruction but rather simply executes it.
-
-68060FPLSP entry points:
-------------------------
-_060FPLSP_TOP:
-0x000: _060LSP__facoss_
-0x008: _060LSP__facosd_
-0x010: _060LSP__facosx_
-0x018: _060LSP__fasins_
-0x020: _060LSP__fasind_
-0x028: _060LSP__fasinx_
-0x030: _060LSP__fatans_
-0x038: _060LSP__fatand_
-0x040: _060LSP__fatanx_
-0x048: _060LSP__fatanhs_
-0x050: _060LSP__fatanhd_
-0x058: _060LSP__fatanhx_
-0x060: _060LSP__fcoss_
-0x068: _060LSP__fcosd_
-0x070: _060LSP__fcosx_
-0x078: _060LSP__fcoshs_
-0x080: _060LSP__fcoshd_
-0x088: _060LSP__fcoshx_
-0x090: _060LSP__fetoxs_
-0x098: _060LSP__fetoxd_
-0x0a0: _060LSP__fetoxx_
-0x0a8: _060LSP__fetoxm1s_
-0x0b0: _060LSP__fetoxm1d_
-0x0b8: _060LSP__fetoxm1x_
-0x0c0: _060LSP__fgetexps_
-0x0c8: _060LSP__fgetexpd_
-0x0d0: _060LSP__fgetexpx_
-0x0d8: _060LSP__fgetmans_
-0x0e0: _060LSP__fgetmand_
-0x0e8: _060LSP__fgetmanx_
-0x0f0: _060LSP__flog10s_
-0x0f8: _060LSP__flog10d_
-0x100: _060LSP__flog10x_
-0x108: _060LSP__flog2s_
-0x110: _060LSP__flog2d_
-0x118: _060LSP__flog2x_
-0x120: _060LSP__flogns_
-0x128: _060LSP__flognd_
-0x130: _060LSP__flognx_
-0x138: _060LSP__flognp1s_
-0x140: _060LSP__flognp1d_
-0x148: _060LSP__flognp1x_
-0x150: _060LSP__fmods_
-0x158: _060LSP__fmodd_
-0x160: _060LSP__fmodx_
-0x168: _060LSP__frems_
-0x170: _060LSP__fremd_
-0x178: _060LSP__fremx_
-0x180: _060LSP__fscales_
-0x188: _060LSP__fscaled_
-0x190: _060LSP__fscalex_
-0x198: _060LSP__fsins_
-0x1a0: _060LSP__fsind_
-0x1a8: _060LSP__fsinx_
-0x1b0: _060LSP__fsincoss_
-0x1b8: _060LSP__fsincosd_
-0x1c0: _060LSP__fsincosx_
-0x1c8: _060LSP__fsinhs_
-0x1d0: _060LSP__fsinhd_
-0x1d8: _060LSP__fsinhx_
-0x1e0: _060LSP__ftans_
-0x1e8: _060LSP__ftand_
-0x1f0: _060LSP__ftanx_
-0x1f8: _060LSP__ftanhs_
-0x200: _060LSP__ftanhd_
-0x208: _060LSP__ftanhx_
-0x210: _060LSP__ftentoxs_
-0x218: _060LSP__ftentoxd_
-0x220: _060LSP__ftentoxx_
-0x228: _060LSP__ftwotoxs_
-0x230: _060LSP__ftwotoxd_
-0x238: _060LSP__ftwotoxx_
-
-0x240: _060LSP__fabss_
-0x248: _060LSP__fabsd_
-0x250: _060LSP__fabsx_
-0x258: _060LSP__fadds_
-0x260: _060LSP__faddd_
-0x268: _060LSP__faddx_
-0x270: _060LSP__fdivs_
-0x278: _060LSP__fdivd_
-0x280: _060LSP__fdivx_
-0x288: _060LSP__fints_
-0x290: _060LSP__fintd_
-0x298: _060LSP__fintx_
-0x2a0: _060LSP__fintrzs_
-0x2a8: _060LSP__fintrzd_
-0x2b0: _060LSP__fintrzx_
-0x2b8: _060LSP__fmuls_
-0x2c0: _060LSP__fmuld_
-0x2c8: _060LSP__fmulx_
-0x2d0: _060LSP__fnegs_
-0x2d8: _060LSP__fnegd_
-0x2e0: _060LSP__fnegx_
-0x2e8: _060LSP__fsqrts_
-0x2f0: _060LSP__fsqrtd_
-0x2f8: _060LSP__fsqrtx_
-0x300: _060LSP__fsubs_
-0x308: _060LSP__fsubd_
-0x310: _060LSP__fsubx_
diff --git a/sys/arch/m68k/060sp/fplsp.s b/sys/arch/m68k/060sp/fplsp.s
deleted file mode 100644
index 5365cf33bd2..00000000000
--- a/sys/arch/m68k/060sp/fplsp.s
+++ /dev/null
@@ -1,10990 +0,0 @@
-#
-# $OpenBSD: fplsp.s,v 1.3 2003/11/07 10:36:08 miod Exp $
-# $NetBSD: fplsp.s,v 1.2 1996/05/15 19:47:41 is Exp $
-#
-
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-# M68000 Hi-Performance Microprocessor Division
-# M68060 Software Package Production Release
-#
-# M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
-# All rights reserved.
-#
-# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-# To the maximum extent permitted by applicable law,
-# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
-# FOR A PARTICULAR PURPOSE and any warranty against infringement with
-# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-# and any accompanying written materials.
-#
-# To the maximum extent permitted by applicable law,
-# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
-# BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
-# ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
-#
-# Motorola assumes no responsibility for the maintenance and support
-# of the SOFTWARE.
-#
-# You are hereby granted a copyright license to use, modify, and distribute the
-# SOFTWARE so long as this entire notice is retained without alteration
-# in any modified and/or redistributed versions, and that such modified
-# versions are clearly identified as such.
-# No licenses are granted by implication, estoppel or otherwise under any
-# patents or trademarks of Motorola, Inc.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-#
-# lfptop.s:
-# This file is appended to the top of the 060ILSP package
-# and contains the entry points into the package. The user, in
-# effect, branches to one of the branch table entries located here.
-#
-
- bra.l _facoss_
- short 0x0000
- bra.l _facosd_
- short 0x0000
- bra.l _facosx_
- short 0x0000
-
- bra.l _fasins_
- short 0x0000
- bra.l _fasind_
- short 0x0000
- bra.l _fasinx_
- short 0x0000
-
- bra.l _fatans_
- short 0x0000
- bra.l _fatand_
- short 0x0000
- bra.l _fatanx_
- short 0x0000
-
- bra.l _fatanhs_
- short 0x0000
- bra.l _fatanhd_
- short 0x0000
- bra.l _fatanhx_
- short 0x0000
-
- bra.l _fcoss_
- short 0x0000
- bra.l _fcosd_
- short 0x0000
- bra.l _fcosx_
- short 0x0000
-
- bra.l _fcoshs_
- short 0x0000
- bra.l _fcoshd_
- short 0x0000
- bra.l _fcoshx_
- short 0x0000
-
- bra.l _fetoxs_
- short 0x0000
- bra.l _fetoxd_
- short 0x0000
- bra.l _fetoxx_
- short 0x0000
-
- bra.l _fetoxm1s_
- short 0x0000
- bra.l _fetoxm1d_
- short 0x0000
- bra.l _fetoxm1x_
- short 0x0000
-
- bra.l _fgetexps_
- short 0x0000
- bra.l _fgetexpd_
- short 0x0000
- bra.l _fgetexpx_
- short 0x0000
-
- bra.l _fgetmans_
- short 0x0000
- bra.l _fgetmand_
- short 0x0000
- bra.l _fgetmanx_
- short 0x0000
-
- bra.l _flog10s_
- short 0x0000
- bra.l _flog10d_
- short 0x0000
- bra.l _flog10x_
- short 0x0000
-
- bra.l _flog2s_
- short 0x0000
- bra.l _flog2d_
- short 0x0000
- bra.l _flog2x_
- short 0x0000
-
- bra.l _flogns_
- short 0x0000
- bra.l _flognd_
- short 0x0000
- bra.l _flognx_
- short 0x0000
-
- bra.l _flognp1s_
- short 0x0000
- bra.l _flognp1d_
- short 0x0000
- bra.l _flognp1x_
- short 0x0000
-
- bra.l _fmods_
- short 0x0000
- bra.l _fmodd_
- short 0x0000
- bra.l _fmodx_
- short 0x0000
-
- bra.l _frems_
- short 0x0000
- bra.l _fremd_
- short 0x0000
- bra.l _fremx_
- short 0x0000
-
- bra.l _fscales_
- short 0x0000
- bra.l _fscaled_
- short 0x0000
- bra.l _fscalex_
- short 0x0000
-
- bra.l _fsins_
- short 0x0000
- bra.l _fsind_
- short 0x0000
- bra.l _fsinx_
- short 0x0000
-
- bra.l _fsincoss_
- short 0x0000
- bra.l _fsincosd_
- short 0x0000
- bra.l _fsincosx_
- short 0x0000
-
- bra.l _fsinhs_
- short 0x0000
- bra.l _fsinhd_
- short 0x0000
- bra.l _fsinhx_
- short 0x0000
-
- bra.l _ftans_
- short 0x0000
- bra.l _ftand_
- short 0x0000
- bra.l _ftanx_
- short 0x0000
-
- bra.l _ftanhs_
- short 0x0000
- bra.l _ftanhd_
- short 0x0000
- bra.l _ftanhx_
- short 0x0000
-
- bra.l _ftentoxs_
- short 0x0000
- bra.l _ftentoxd_
- short 0x0000
- bra.l _ftentoxx_
- short 0x0000
-
- bra.l _ftwotoxs_
- short 0x0000
- bra.l _ftwotoxd_
- short 0x0000
- bra.l _ftwotoxx_
- short 0x0000
-
- bra.l _fabss_
- short 0x0000
- bra.l _fabsd_
- short 0x0000
- bra.l _fabsx_
- short 0x0000
-
- bra.l _fadds_
- short 0x0000
- bra.l _faddd_
- short 0x0000
- bra.l _faddx_
- short 0x0000
-
- bra.l _fdivs_
- short 0x0000
- bra.l _fdivd_
- short 0x0000
- bra.l _fdivx_
- short 0x0000
-
- bra.l _fints_
- short 0x0000
- bra.l _fintd_
- short 0x0000
- bra.l _fintx_
- short 0x0000
-
- bra.l _fintrzs_
- short 0x0000
- bra.l _fintrzd_
- short 0x0000
- bra.l _fintrzx_
- short 0x0000
-
- bra.l _fmuls_
- short 0x0000
- bra.l _fmuld_
- short 0x0000
- bra.l _fmulx_
- short 0x0000
-
- bra.l _fnegs_
- short 0x0000
- bra.l _fnegd_
- short 0x0000
- bra.l _fnegx_
- short 0x0000
-
- bra.l _fsqrts_
- short 0x0000
- bra.l _fsqrtd_
- short 0x0000
- bra.l _fsqrtx_
- short 0x0000
-
- bra.l _fsubs_
- short 0x0000
- bra.l _fsubd_
- short 0x0000
- bra.l _fsubx_
- short 0x0000
-
-# leave room for future possible additions
- align 0x400
-
-#
-# This file contains a set of define statements for constants
-# in order to promote readability within the corecode itself.
-#
-
-set LOCAL_SIZE, 192 # stack frame size(bytes)
-set LV, -LOCAL_SIZE # stack offset
-
-set EXC_SR, 0x4 # stack status register
-set EXC_PC, 0x6 # stack pc
-set EXC_VOFF, 0xa # stacked vector offset
-set EXC_EA, 0xc # stacked <ea>
-
-set EXC_FP, 0x0 # frame pointer
-
-set EXC_AREGS, -68 # offset of all address regs
-set EXC_DREGS, -100 # offset of all data regs
-set EXC_FPREGS, -36 # offset of all fp regs
-
-set EXC_A7, EXC_AREGS+(7*4) # offset of saved a7
-set OLD_A7, EXC_AREGS+(6*4) # extra copy of saved a7
-set EXC_A6, EXC_AREGS+(6*4) # offset of saved a6
-set EXC_A5, EXC_AREGS+(5*4)
-set EXC_A4, EXC_AREGS+(4*4)
-set EXC_A3, EXC_AREGS+(3*4)
-set EXC_A2, EXC_AREGS+(2*4)
-set EXC_A1, EXC_AREGS+(1*4)
-set EXC_A0, EXC_AREGS+(0*4)
-set EXC_D7, EXC_DREGS+(7*4)
-set EXC_D6, EXC_DREGS+(6*4)
-set EXC_D5, EXC_DREGS+(5*4)
-set EXC_D4, EXC_DREGS+(4*4)
-set EXC_D3, EXC_DREGS+(3*4)
-set EXC_D2, EXC_DREGS+(2*4)
-set EXC_D1, EXC_DREGS+(1*4)
-set EXC_D0, EXC_DREGS+(0*4)
-
-set EXC_FP0, EXC_FPREGS+(0*12) # offset of saved fp0
-set EXC_FP1, EXC_FPREGS+(1*12) # offset of saved fp1
-set EXC_FP2, EXC_FPREGS+(2*12) # offset of saved fp2 (not used)
-
-set FP_SCR1, LV+80 # fp scratch 1
-set FP_SCR1_EX, FP_SCR1+0
-set FP_SCR1_SGN, FP_SCR1+2
-set FP_SCR1_HI, FP_SCR1+4
-set FP_SCR1_LO, FP_SCR1+8
-
-set FP_SCR0, LV+68 # fp scratch 0
-set FP_SCR0_EX, FP_SCR0+0
-set FP_SCR0_SGN, FP_SCR0+2
-set FP_SCR0_HI, FP_SCR0+4
-set FP_SCR0_LO, FP_SCR0+8
-
-set FP_DST, LV+56 # fp destination operand
-set FP_DST_EX, FP_DST+0
-set FP_DST_SGN, FP_DST+2
-set FP_DST_HI, FP_DST+4
-set FP_DST_LO, FP_DST+8
-
-set FP_SRC, LV+44 # fp source operand
-set FP_SRC_EX, FP_SRC+0
-set FP_SRC_SGN, FP_SRC+2
-set FP_SRC_HI, FP_SRC+4
-set FP_SRC_LO, FP_SRC+8
-
-set USER_FPIAR, LV+40 # FP instr address register
-
-set USER_FPSR, LV+36 # FP status register
-set FPSR_CC, USER_FPSR+0 # FPSR condition codes
-set FPSR_QBYTE, USER_FPSR+1 # FPSR qoutient byte
-set FPSR_EXCEPT, USER_FPSR+2 # FPSR exception status byte
-set FPSR_AEXCEPT, USER_FPSR+3 # FPSR accrued exception byte
-
-set USER_FPCR, LV+32 # FP control register
-set FPCR_ENABLE, USER_FPCR+2 # FPCR exception enable
-set FPCR_MODE, USER_FPCR+3 # FPCR rounding mode control
-
-set L_SCR3, LV+28 # integer scratch 3
-set L_SCR2, LV+24 # integer scratch 2
-set L_SCR1, LV+20 # integer scratch 1
-
-set STORE_FLG, LV+19 # flag: operand store (ie. not fcmp/ftst)
-
-set EXC_TEMP2, LV+24 # temporary space
-set EXC_TEMP, LV+16 # temporary space
-
-set DTAG, LV+15 # destination operand type
-set STAG, LV+14 # source operand type
-
-set SPCOND_FLG, LV+10 # flag: special case (see below)
-
-set EXC_CC, LV+8 # saved condition codes
-set EXC_EXTWPTR, LV+4 # saved current PC (active)
-set EXC_EXTWORD, LV+2 # saved extension word
-set EXC_CMDREG, LV+2 # saved extension word
-set EXC_OPWORD, LV+0 # saved operation word
-
-################################
-
-# Helpful macros
-
-set FTEMP, 0 # offsets within an
-set FTEMP_EX, 0 # extended precision
-set FTEMP_SGN, 2 # value saved in memory.
-set FTEMP_HI, 4
-set FTEMP_LO, 8
-set FTEMP_GRS, 12
-
-set LOCAL, 0 # offsets within an
-set LOCAL_EX, 0 # extended precision
-set LOCAL_SGN, 2 # value saved in memory.
-set LOCAL_HI, 4
-set LOCAL_LO, 8
-set LOCAL_GRS, 12
-
-set DST, 0 # offsets within an
-set DST_EX, 0 # extended precision
-set DST_HI, 4 # value saved in memory.
-set DST_LO, 8
-
-set SRC, 0 # offsets within an
-set SRC_EX, 0 # extended precision
-set SRC_HI, 4 # value saved in memory.
-set SRC_LO, 8
-
-set SGL_LO, 0x3f81 # min sgl prec exponent
-set SGL_HI, 0x407e # max sgl prec exponent
-set DBL_LO, 0x3c01 # min dbl prec exponent
-set DBL_HI, 0x43fe # max dbl prec exponent
-set EXT_LO, 0x0 # min ext prec exponent
-set EXT_HI, 0x7ffe # max ext prec exponent
-
-set EXT_BIAS, 0x3fff # extended precision bias
-set SGL_BIAS, 0x007f # single precision bias
-set DBL_BIAS, 0x03ff # double precision bias
-
-set NORM, 0x00 # operand type for STAG/DTAG
-set ZERO, 0x01 # operand type for STAG/DTAG
-set INF, 0x02 # operand type for STAG/DTAG
-set QNAN, 0x03 # operand type for STAG/DTAG
-set DENORM, 0x04 # operand type for STAG/DTAG
-set SNAN, 0x05 # operand type for STAG/DTAG
-set UNNORM, 0x06 # operand type for STAG/DTAG
-
-##################
-# FPSR/FPCR bits #
-##################
-set neg_bit, 0x3 # negative result
-set z_bit, 0x2 # zero result
-set inf_bit, 0x1 # infinite result
-set nan_bit, 0x0 # NAN result
-
-set q_sn_bit, 0x7 # sign bit of quotient byte
-
-set bsun_bit, 7 # branch on unordered
-set snan_bit, 6 # signalling NAN
-set operr_bit, 5 # operand error
-set ovfl_bit, 4 # overflow
-set unfl_bit, 3 # underflow
-set dz_bit, 2 # divide by zero
-set inex2_bit, 1 # inexact result 2
-set inex1_bit, 0 # inexact result 1
-
-set aiop_bit, 7 # accrued inexact operation bit
-set aovfl_bit, 6 # accrued overflow bit
-set aunfl_bit, 5 # accrued underflow bit
-set adz_bit, 4 # accrued dz bit
-set ainex_bit, 3 # accrued inexact bit
-
-#############################
-# FPSR individual bit masks #
-#############################
-set neg_mask, 0x08000000 # negative bit mask (lw)
-set inf_mask, 0x02000000 # infinity bit mask (lw)
-set z_mask, 0x04000000 # zero bit mask (lw)
-set nan_mask, 0x01000000 # nan bit mask (lw)
-
-set neg_bmask, 0x08 # negative bit mask (byte)
-set inf_bmask, 0x02 # infinity bit mask (byte)
-set z_bmask, 0x04 # zero bit mask (byte)
-set nan_bmask, 0x01 # nan bit mask (byte)
-
-set bsun_mask, 0x00008000 # bsun exception mask
-set snan_mask, 0x00004000 # snan exception mask
-set operr_mask, 0x00002000 # operr exception mask
-set ovfl_mask, 0x00001000 # overflow exception mask
-set unfl_mask, 0x00000800 # underflow exception mask
-set dz_mask, 0x00000400 # dz exception mask
-set inex2_mask, 0x00000200 # inex2 exception mask
-set inex1_mask, 0x00000100 # inex1 exception mask
-
-set aiop_mask, 0x00000080 # accrued illegal operation
-set aovfl_mask, 0x00000040 # accrued overflow
-set aunfl_mask, 0x00000020 # accrued underflow
-set adz_mask, 0x00000010 # accrued divide by zero
-set ainex_mask, 0x00000008 # accrued inexact
-
-######################################
-# FPSR combinations used in the FPSP #
-######################################
-set dzinf_mask, inf_mask+dz_mask+adz_mask
-set opnan_mask, nan_mask+operr_mask+aiop_mask
-set nzi_mask, 0x01ffffff #clears N, Z, and I
-set unfinx_mask, unfl_mask+inex2_mask+aunfl_mask+ainex_mask
-set unf2inx_mask, unfl_mask+inex2_mask+ainex_mask
-set ovfinx_mask, ovfl_mask+inex2_mask+aovfl_mask+ainex_mask
-set inx1a_mask, inex1_mask+ainex_mask
-set inx2a_mask, inex2_mask+ainex_mask
-set snaniop_mask, nan_mask+snan_mask+aiop_mask
-set snaniop2_mask, snan_mask+aiop_mask
-set naniop_mask, nan_mask+aiop_mask
-set neginf_mask, neg_mask+inf_mask
-set infaiop_mask, inf_mask+aiop_mask
-set negz_mask, neg_mask+z_mask
-set opaop_mask, operr_mask+aiop_mask
-set unfl_inx_mask, unfl_mask+aunfl_mask+ainex_mask
-set ovfl_inx_mask, ovfl_mask+aovfl_mask+ainex_mask
-
-#########
-# misc. #
-#########
-set rnd_stky_bit, 29 # stky bit pos in longword
-
-set sign_bit, 0x7 # sign bit
-set signan_bit, 0x6 # signalling nan bit
-
-set sgl_thresh, 0x3f81 # minimum sgl exponent
-set dbl_thresh, 0x3c01 # minimum dbl exponent
-
-set x_mode, 0x0 # extended precision
-set s_mode, 0x4 # single precision
-set d_mode, 0x8 # double precision
-
-set rn_mode, 0x0 # round-to-nearest
-set rz_mode, 0x1 # round-to-zero
-set rm_mode, 0x2 # round-tp-minus-infinity
-set rp_mode, 0x3 # round-to-plus-infinity
-
-set mantissalen, 64 # length of mantissa in bits
-
-set BYTE, 1 # len(byte) == 1 byte
-set WORD, 2 # len(word) == 2 bytes
-set LONG, 4 # len(longword) == 2 bytes
-
-set BSUN_VEC, 0xc0 # bsun vector offset
-set INEX_VEC, 0xc4 # inexact vector offset
-set DZ_VEC, 0xc8 # dz vector offset
-set UNFL_VEC, 0xcc # unfl vector offset
-set OPERR_VEC, 0xd0 # operr vector offset
-set OVFL_VEC, 0xd4 # ovfl vector offset
-set SNAN_VEC, 0xd8 # snan vector offset
-
-###########################
-# SPecial CONDition FLaGs #
-###########################
-set ftrapcc_flg, 0x01 # flag bit: ftrapcc exception
-set fbsun_flg, 0x02 # flag bit: bsun exception
-set mia7_flg, 0x04 # flag bit: (a7)+ <ea>
-set mda7_flg, 0x08 # flag bit: -(a7) <ea>
-set fmovm_flg, 0x40 # flag bit: fmovm instruction
-set immed_flg, 0x80 # flag bit: &<data> <ea>
-
-set ftrapcc_bit, 0x0
-set fbsun_bit, 0x1
-set mia7_bit, 0x2
-set mda7_bit, 0x3
-set immed_bit, 0x7
-
-##################################
-# TRANSCENDENTAL "LAST-OP" FLAGS #
-##################################
-set FMUL_OP, 0x0 # fmul instr performed last
-set FDIV_OP, 0x1 # fdiv performed last
-set FADD_OP, 0x2 # fadd performed last
-set FMOV_OP, 0x3 # fmov performed last
-
-#############
-# CONSTANTS #
-#############
-T1: long 0x40C62D38,0xD3D64634 # 16381 LOG2 LEAD
-T2: long 0x3D6F90AE,0xB1E75CC7 # 16381 LOG2 TRAIL
-
-PI: long 0x40000000,0xC90FDAA2,0x2168C235,0x00000000
-PIBY2: long 0x3FFF0000,0xC90FDAA2,0x2168C235,0x00000000
-
-TWOBYPI:
- long 0x3FE45F30,0x6DC9C883
-
-#########################################################################
-# MONADIC TEMPLATE #
-#########################################################################
- global _fsins_
-_fsins_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.s 0x8(%a6),%fp0 # load sgl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L0_2s
- bsr.l ssin # operand is a NORM
- bra.b _L0_6s
-_L0_2s:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L0_3s # no
- bsr.l src_zero # yes
- bra.b _L0_6s
-_L0_3s:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L0_4s # no
- bsr.l t_operr # yes
- bra.b _L0_6s
-_L0_4s:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L0_5s # no
- bsr.l src_qnan # yes
- bra.b _L0_6s
-_L0_5s:
- bsr.l ssind # operand is a DENORM
-_L0_6s:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _fsind_
-_fsind_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.d 0x8(%a6),%fp0 # load dbl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- mov.b %d1,STAG(%a6)
- tst.b %d1
- bne.b _L0_2d
- bsr.l ssin # operand is a NORM
- bra.b _L0_6d
-_L0_2d:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L0_3d # no
- bsr.l src_zero # yes
- bra.b _L0_6d
-_L0_3d:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L0_4d # no
- bsr.l t_operr # yes
- bra.b _L0_6d
-_L0_4d:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L0_5d # no
- bsr.l src_qnan # yes
- bra.b _L0_6d
-_L0_5d:
- bsr.l ssind # operand is a DENORM
-_L0_6d:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _fsinx_
-_fsinx_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- lea FP_SRC(%a6),%a0
- mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
- mov.l 0x8+0x4(%a6),0x4(%a0)
- mov.l 0x8+0x8(%a6),0x8(%a0)
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L0_2x
- bsr.l ssin # operand is a NORM
- bra.b _L0_6x
-_L0_2x:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L0_3x # no
- bsr.l src_zero # yes
- bra.b _L0_6x
-_L0_3x:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L0_4x # no
- bsr.l t_operr # yes
- bra.b _L0_6x
-_L0_4x:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L0_5x # no
- bsr.l src_qnan # yes
- bra.b _L0_6x
-_L0_5x:
- bsr.l ssind # operand is a DENORM
-_L0_6x:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
-
-#########################################################################
-# MONADIC TEMPLATE #
-#########################################################################
- global _fcoss_
-_fcoss_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.s 0x8(%a6),%fp0 # load sgl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L1_2s
- bsr.l scos # operand is a NORM
- bra.b _L1_6s
-_L1_2s:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L1_3s # no
- bsr.l ld_pone # yes
- bra.b _L1_6s
-_L1_3s:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L1_4s # no
- bsr.l t_operr # yes
- bra.b _L1_6s
-_L1_4s:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L1_5s # no
- bsr.l src_qnan # yes
- bra.b _L1_6s
-_L1_5s:
- bsr.l scosd # operand is a DENORM
-_L1_6s:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _fcosd_
-_fcosd_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.d 0x8(%a6),%fp0 # load dbl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- mov.b %d1,STAG(%a6)
- tst.b %d1
- bne.b _L1_2d
- bsr.l scos # operand is a NORM
- bra.b _L1_6d
-_L1_2d:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L1_3d # no
- bsr.l ld_pone # yes
- bra.b _L1_6d
-_L1_3d:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L1_4d # no
- bsr.l t_operr # yes
- bra.b _L1_6d
-_L1_4d:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L1_5d # no
- bsr.l src_qnan # yes
- bra.b _L1_6d
-_L1_5d:
- bsr.l scosd # operand is a DENORM
-_L1_6d:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _fcosx_
-_fcosx_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- lea FP_SRC(%a6),%a0
- mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
- mov.l 0x8+0x4(%a6),0x4(%a0)
- mov.l 0x8+0x8(%a6),0x8(%a0)
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L1_2x
- bsr.l scos # operand is a NORM
- bra.b _L1_6x
-_L1_2x:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L1_3x # no
- bsr.l ld_pone # yes
- bra.b _L1_6x
-_L1_3x:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L1_4x # no
- bsr.l t_operr # yes
- bra.b _L1_6x
-_L1_4x:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L1_5x # no
- bsr.l src_qnan # yes
- bra.b _L1_6x
-_L1_5x:
- bsr.l scosd # operand is a DENORM
-_L1_6x:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
-
-#########################################################################
-# MONADIC TEMPLATE #
-#########################################################################
- global _fsinhs_
-_fsinhs_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.s 0x8(%a6),%fp0 # load sgl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L2_2s
- bsr.l ssinh # operand is a NORM
- bra.b _L2_6s
-_L2_2s:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L2_3s # no
- bsr.l src_zero # yes
- bra.b _L2_6s
-_L2_3s:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L2_4s # no
- bsr.l src_inf # yes
- bra.b _L2_6s
-_L2_4s:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L2_5s # no
- bsr.l src_qnan # yes
- bra.b _L2_6s
-_L2_5s:
- bsr.l ssinhd # operand is a DENORM
-_L2_6s:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _fsinhd_
-_fsinhd_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.d 0x8(%a6),%fp0 # load dbl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- mov.b %d1,STAG(%a6)
- tst.b %d1
- bne.b _L2_2d
- bsr.l ssinh # operand is a NORM
- bra.b _L2_6d
-_L2_2d:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L2_3d # no
- bsr.l src_zero # yes
- bra.b _L2_6d
-_L2_3d:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L2_4d # no
- bsr.l src_inf # yes
- bra.b _L2_6d
-_L2_4d:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L2_5d # no
- bsr.l src_qnan # yes
- bra.b _L2_6d
-_L2_5d:
- bsr.l ssinhd # operand is a DENORM
-_L2_6d:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _fsinhx_
-_fsinhx_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- lea FP_SRC(%a6),%a0
- mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
- mov.l 0x8+0x4(%a6),0x4(%a0)
- mov.l 0x8+0x8(%a6),0x8(%a0)
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L2_2x
- bsr.l ssinh # operand is a NORM
- bra.b _L2_6x
-_L2_2x:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L2_3x # no
- bsr.l src_zero # yes
- bra.b _L2_6x
-_L2_3x:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L2_4x # no
- bsr.l src_inf # yes
- bra.b _L2_6x
-_L2_4x:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L2_5x # no
- bsr.l src_qnan # yes
- bra.b _L2_6x
-_L2_5x:
- bsr.l ssinhd # operand is a DENORM
-_L2_6x:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
-
-#########################################################################
-# MONADIC TEMPLATE #
-#########################################################################
- global _flognp1s_
-_flognp1s_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.s 0x8(%a6),%fp0 # load sgl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L3_2s
- bsr.l slognp1 # operand is a NORM
- bra.b _L3_6s
-_L3_2s:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L3_3s # no
- bsr.l src_zero # yes
- bra.b _L3_6s
-_L3_3s:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L3_4s # no
- bsr.l sopr_inf # yes
- bra.b _L3_6s
-_L3_4s:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L3_5s # no
- bsr.l src_qnan # yes
- bra.b _L3_6s
-_L3_5s:
- bsr.l slognp1d # operand is a DENORM
-_L3_6s:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _flognp1d_
-_flognp1d_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.d 0x8(%a6),%fp0 # load dbl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- mov.b %d1,STAG(%a6)
- tst.b %d1
- bne.b _L3_2d
- bsr.l slognp1 # operand is a NORM
- bra.b _L3_6d
-_L3_2d:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L3_3d # no
- bsr.l src_zero # yes
- bra.b _L3_6d
-_L3_3d:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L3_4d # no
- bsr.l sopr_inf # yes
- bra.b _L3_6d
-_L3_4d:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L3_5d # no
- bsr.l src_qnan # yes
- bra.b _L3_6d
-_L3_5d:
- bsr.l slognp1d # operand is a DENORM
-_L3_6d:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _flognp1x_
-_flognp1x_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- lea FP_SRC(%a6),%a0
- mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
- mov.l 0x8+0x4(%a6),0x4(%a0)
- mov.l 0x8+0x8(%a6),0x8(%a0)
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L3_2x
- bsr.l slognp1 # operand is a NORM
- bra.b _L3_6x
-_L3_2x:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L3_3x # no
- bsr.l src_zero # yes
- bra.b _L3_6x
-_L3_3x:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L3_4x # no
- bsr.l sopr_inf # yes
- bra.b _L3_6x
-_L3_4x:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L3_5x # no
- bsr.l src_qnan # yes
- bra.b _L3_6x
-_L3_5x:
- bsr.l slognp1d # operand is a DENORM
-_L3_6x:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
-
-#########################################################################
-# MONADIC TEMPLATE #
-#########################################################################
- global _fetoxm1s_
-_fetoxm1s_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.s 0x8(%a6),%fp0 # load sgl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L4_2s
- bsr.l setoxm1 # operand is a NORM
- bra.b _L4_6s
-_L4_2s:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L4_3s # no
- bsr.l src_zero # yes
- bra.b _L4_6s
-_L4_3s:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L4_4s # no
- bsr.l setoxm1i # yes
- bra.b _L4_6s
-_L4_4s:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L4_5s # no
- bsr.l src_qnan # yes
- bra.b _L4_6s
-_L4_5s:
- bsr.l setoxm1d # operand is a DENORM
-_L4_6s:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _fetoxm1d_
-_fetoxm1d_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.d 0x8(%a6),%fp0 # load dbl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- mov.b %d1,STAG(%a6)
- tst.b %d1
- bne.b _L4_2d
- bsr.l setoxm1 # operand is a NORM
- bra.b _L4_6d
-_L4_2d:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L4_3d # no
- bsr.l src_zero # yes
- bra.b _L4_6d
-_L4_3d:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L4_4d # no
- bsr.l setoxm1i # yes
- bra.b _L4_6d
-_L4_4d:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L4_5d # no
- bsr.l src_qnan # yes
- bra.b _L4_6d
-_L4_5d:
- bsr.l setoxm1d # operand is a DENORM
-_L4_6d:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _fetoxm1x_
-_fetoxm1x_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- lea FP_SRC(%a6),%a0
- mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
- mov.l 0x8+0x4(%a6),0x4(%a0)
- mov.l 0x8+0x8(%a6),0x8(%a0)
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L4_2x
- bsr.l setoxm1 # operand is a NORM
- bra.b _L4_6x
-_L4_2x:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L4_3x # no
- bsr.l src_zero # yes
- bra.b _L4_6x
-_L4_3x:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L4_4x # no
- bsr.l setoxm1i # yes
- bra.b _L4_6x
-_L4_4x:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L4_5x # no
- bsr.l src_qnan # yes
- bra.b _L4_6x
-_L4_5x:
- bsr.l setoxm1d # operand is a DENORM
-_L4_6x:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
-
-#########################################################################
-# MONADIC TEMPLATE #
-#########################################################################
- global _ftanhs_
-_ftanhs_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.s 0x8(%a6),%fp0 # load sgl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L5_2s
- bsr.l stanh # operand is a NORM
- bra.b _L5_6s
-_L5_2s:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L5_3s # no
- bsr.l src_zero # yes
- bra.b _L5_6s
-_L5_3s:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L5_4s # no
- bsr.l src_one # yes
- bra.b _L5_6s
-_L5_4s:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L5_5s # no
- bsr.l src_qnan # yes
- bra.b _L5_6s
-_L5_5s:
- bsr.l stanhd # operand is a DENORM
-_L5_6s:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _ftanhd_
-_ftanhd_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.d 0x8(%a6),%fp0 # load dbl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- mov.b %d1,STAG(%a6)
- tst.b %d1
- bne.b _L5_2d
- bsr.l stanh # operand is a NORM
- bra.b _L5_6d
-_L5_2d:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L5_3d # no
- bsr.l src_zero # yes
- bra.b _L5_6d
-_L5_3d:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L5_4d # no
- bsr.l src_one # yes
- bra.b _L5_6d
-_L5_4d:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L5_5d # no
- bsr.l src_qnan # yes
- bra.b _L5_6d
-_L5_5d:
- bsr.l stanhd # operand is a DENORM
-_L5_6d:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _ftanhx_
-_ftanhx_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- lea FP_SRC(%a6),%a0
- mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
- mov.l 0x8+0x4(%a6),0x4(%a0)
- mov.l 0x8+0x8(%a6),0x8(%a0)
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L5_2x
- bsr.l stanh # operand is a NORM
- bra.b _L5_6x
-_L5_2x:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L5_3x # no
- bsr.l src_zero # yes
- bra.b _L5_6x
-_L5_3x:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L5_4x # no
- bsr.l src_one # yes
- bra.b _L5_6x
-_L5_4x:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L5_5x # no
- bsr.l src_qnan # yes
- bra.b _L5_6x
-_L5_5x:
- bsr.l stanhd # operand is a DENORM
-_L5_6x:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
-
-#########################################################################
-# MONADIC TEMPLATE #
-#########################################################################
- global _fatans_
-_fatans_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.s 0x8(%a6),%fp0 # load sgl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L6_2s
- bsr.l satan # operand is a NORM
- bra.b _L6_6s
-_L6_2s:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L6_3s # no
- bsr.l src_zero # yes
- bra.b _L6_6s
-_L6_3s:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L6_4s # no
- bsr.l spi_2 # yes
- bra.b _L6_6s
-_L6_4s:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L6_5s # no
- bsr.l src_qnan # yes
- bra.b _L6_6s
-_L6_5s:
- bsr.l satand # operand is a DENORM
-_L6_6s:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _fatand_
-_fatand_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.d 0x8(%a6),%fp0 # load dbl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- mov.b %d1,STAG(%a6)
- tst.b %d1
- bne.b _L6_2d
- bsr.l satan # operand is a NORM
- bra.b _L6_6d
-_L6_2d:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L6_3d # no
- bsr.l src_zero # yes
- bra.b _L6_6d
-_L6_3d:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L6_4d # no
- bsr.l spi_2 # yes
- bra.b _L6_6d
-_L6_4d:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L6_5d # no
- bsr.l src_qnan # yes
- bra.b _L6_6d
-_L6_5d:
- bsr.l satand # operand is a DENORM
-_L6_6d:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _fatanx_
-_fatanx_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- lea FP_SRC(%a6),%a0
- mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
- mov.l 0x8+0x4(%a6),0x4(%a0)
- mov.l 0x8+0x8(%a6),0x8(%a0)
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L6_2x
- bsr.l satan # operand is a NORM
- bra.b _L6_6x
-_L6_2x:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L6_3x # no
- bsr.l src_zero # yes
- bra.b _L6_6x
-_L6_3x:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L6_4x # no
- bsr.l spi_2 # yes
- bra.b _L6_6x
-_L6_4x:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L6_5x # no
- bsr.l src_qnan # yes
- bra.b _L6_6x
-_L6_5x:
- bsr.l satand # operand is a DENORM
-_L6_6x:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
-
-#########################################################################
-# MONADIC TEMPLATE #
-#########################################################################
- global _fasins_
-_fasins_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.s 0x8(%a6),%fp0 # load sgl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L7_2s
- bsr.l sasin # operand is a NORM
- bra.b _L7_6s
-_L7_2s:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L7_3s # no
- bsr.l src_zero # yes
- bra.b _L7_6s
-_L7_3s:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L7_4s # no
- bsr.l t_operr # yes
- bra.b _L7_6s
-_L7_4s:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L7_5s # no
- bsr.l src_qnan # yes
- bra.b _L7_6s
-_L7_5s:
- bsr.l sasind # operand is a DENORM
-_L7_6s:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _fasind_
-_fasind_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.d 0x8(%a6),%fp0 # load dbl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- mov.b %d1,STAG(%a6)
- tst.b %d1
- bne.b _L7_2d
- bsr.l sasin # operand is a NORM
- bra.b _L7_6d
-_L7_2d:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L7_3d # no
- bsr.l src_zero # yes
- bra.b _L7_6d
-_L7_3d:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L7_4d # no
- bsr.l t_operr # yes
- bra.b _L7_6d
-_L7_4d:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L7_5d # no
- bsr.l src_qnan # yes
- bra.b _L7_6d
-_L7_5d:
- bsr.l sasind # operand is a DENORM
-_L7_6d:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _fasinx_
-_fasinx_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- lea FP_SRC(%a6),%a0
- mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
- mov.l 0x8+0x4(%a6),0x4(%a0)
- mov.l 0x8+0x8(%a6),0x8(%a0)
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L7_2x
- bsr.l sasin # operand is a NORM
- bra.b _L7_6x
-_L7_2x:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L7_3x # no
- bsr.l src_zero # yes
- bra.b _L7_6x
-_L7_3x:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L7_4x # no
- bsr.l t_operr # yes
- bra.b _L7_6x
-_L7_4x:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L7_5x # no
- bsr.l src_qnan # yes
- bra.b _L7_6x
-_L7_5x:
- bsr.l sasind # operand is a DENORM
-_L7_6x:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
-
-#########################################################################
-# MONADIC TEMPLATE #
-#########################################################################
- global _fatanhs_
-_fatanhs_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.s 0x8(%a6),%fp0 # load sgl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L8_2s
- bsr.l satanh # operand is a NORM
- bra.b _L8_6s
-_L8_2s:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L8_3s # no
- bsr.l src_zero # yes
- bra.b _L8_6s
-_L8_3s:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L8_4s # no
- bsr.l t_operr # yes
- bra.b _L8_6s
-_L8_4s:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L8_5s # no
- bsr.l src_qnan # yes
- bra.b _L8_6s
-_L8_5s:
- bsr.l satanhd # operand is a DENORM
-_L8_6s:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _fatanhd_
-_fatanhd_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.d 0x8(%a6),%fp0 # load dbl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- mov.b %d1,STAG(%a6)
- tst.b %d1
- bne.b _L8_2d
- bsr.l satanh # operand is a NORM
- bra.b _L8_6d
-_L8_2d:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L8_3d # no
- bsr.l src_zero # yes
- bra.b _L8_6d
-_L8_3d:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L8_4d # no
- bsr.l t_operr # yes
- bra.b _L8_6d
-_L8_4d:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L8_5d # no
- bsr.l src_qnan # yes
- bra.b _L8_6d
-_L8_5d:
- bsr.l satanhd # operand is a DENORM
-_L8_6d:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _fatanhx_
-_fatanhx_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- lea FP_SRC(%a6),%a0
- mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
- mov.l 0x8+0x4(%a6),0x4(%a0)
- mov.l 0x8+0x8(%a6),0x8(%a0)
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L8_2x
- bsr.l satanh # operand is a NORM
- bra.b _L8_6x
-_L8_2x:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L8_3x # no
- bsr.l src_zero # yes
- bra.b _L8_6x
-_L8_3x:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L8_4x # no
- bsr.l t_operr # yes
- bra.b _L8_6x
-_L8_4x:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L8_5x # no
- bsr.l src_qnan # yes
- bra.b _L8_6x
-_L8_5x:
- bsr.l satanhd # operand is a DENORM
-_L8_6x:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
-
-#########################################################################
-# MONADIC TEMPLATE #
-#########################################################################
- global _ftans_
-_ftans_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.s 0x8(%a6),%fp0 # load sgl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L9_2s
- bsr.l stan # operand is a NORM
- bra.b _L9_6s
-_L9_2s:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L9_3s # no
- bsr.l src_zero # yes
- bra.b _L9_6s
-_L9_3s:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L9_4s # no
- bsr.l t_operr # yes
- bra.b _L9_6s
-_L9_4s:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L9_5s # no
- bsr.l src_qnan # yes
- bra.b _L9_6s
-_L9_5s:
- bsr.l stand # operand is a DENORM
-_L9_6s:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _ftand_
-_ftand_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.d 0x8(%a6),%fp0 # load dbl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- mov.b %d1,STAG(%a6)
- tst.b %d1
- bne.b _L9_2d
- bsr.l stan # operand is a NORM
- bra.b _L9_6d
-_L9_2d:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L9_3d # no
- bsr.l src_zero # yes
- bra.b _L9_6d
-_L9_3d:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L9_4d # no
- bsr.l t_operr # yes
- bra.b _L9_6d
-_L9_4d:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L9_5d # no
- bsr.l src_qnan # yes
- bra.b _L9_6d
-_L9_5d:
- bsr.l stand # operand is a DENORM
-_L9_6d:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _ftanx_
-_ftanx_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- lea FP_SRC(%a6),%a0
- mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
- mov.l 0x8+0x4(%a6),0x4(%a0)
- mov.l 0x8+0x8(%a6),0x8(%a0)
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L9_2x
- bsr.l stan # operand is a NORM
- bra.b _L9_6x
-_L9_2x:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L9_3x # no
- bsr.l src_zero # yes
- bra.b _L9_6x
-_L9_3x:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L9_4x # no
- bsr.l t_operr # yes
- bra.b _L9_6x
-_L9_4x:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L9_5x # no
- bsr.l src_qnan # yes
- bra.b _L9_6x
-_L9_5x:
- bsr.l stand # operand is a DENORM
-_L9_6x:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
-
-#########################################################################
-# MONADIC TEMPLATE #
-#########################################################################
- global _fetoxs_
-_fetoxs_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.s 0x8(%a6),%fp0 # load sgl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L10_2s
- bsr.l setox # operand is a NORM
- bra.b _L10_6s
-_L10_2s:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L10_3s # no
- bsr.l ld_pone # yes
- bra.b _L10_6s
-_L10_3s:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L10_4s # no
- bsr.l szr_inf # yes
- bra.b _L10_6s
-_L10_4s:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L10_5s # no
- bsr.l src_qnan # yes
- bra.b _L10_6s
-_L10_5s:
- bsr.l setoxd # operand is a DENORM
-_L10_6s:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _fetoxd_
-_fetoxd_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.d 0x8(%a6),%fp0 # load dbl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- mov.b %d1,STAG(%a6)
- tst.b %d1
- bne.b _L10_2d
- bsr.l setox # operand is a NORM
- bra.b _L10_6d
-_L10_2d:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L10_3d # no
- bsr.l ld_pone # yes
- bra.b _L10_6d
-_L10_3d:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L10_4d # no
- bsr.l szr_inf # yes
- bra.b _L10_6d
-_L10_4d:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L10_5d # no
- bsr.l src_qnan # yes
- bra.b _L10_6d
-_L10_5d:
- bsr.l setoxd # operand is a DENORM
-_L10_6d:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _fetoxx_
-_fetoxx_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- lea FP_SRC(%a6),%a0
- mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
- mov.l 0x8+0x4(%a6),0x4(%a0)
- mov.l 0x8+0x8(%a6),0x8(%a0)
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L10_2x
- bsr.l setox # operand is a NORM
- bra.b _L10_6x
-_L10_2x:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L10_3x # no
- bsr.l ld_pone # yes
- bra.b _L10_6x
-_L10_3x:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L10_4x # no
- bsr.l szr_inf # yes
- bra.b _L10_6x
-_L10_4x:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L10_5x # no
- bsr.l src_qnan # yes
- bra.b _L10_6x
-_L10_5x:
- bsr.l setoxd # operand is a DENORM
-_L10_6x:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
-
-#########################################################################
-# MONADIC TEMPLATE #
-#########################################################################
- global _ftwotoxs_
-_ftwotoxs_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.s 0x8(%a6),%fp0 # load sgl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L11_2s
- bsr.l stwotox # operand is a NORM
- bra.b _L11_6s
-_L11_2s:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L11_3s # no
- bsr.l ld_pone # yes
- bra.b _L11_6s
-_L11_3s:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L11_4s # no
- bsr.l szr_inf # yes
- bra.b _L11_6s
-_L11_4s:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L11_5s # no
- bsr.l src_qnan # yes
- bra.b _L11_6s
-_L11_5s:
- bsr.l stwotoxd # operand is a DENORM
-_L11_6s:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _ftwotoxd_
-_ftwotoxd_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.d 0x8(%a6),%fp0 # load dbl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- mov.b %d1,STAG(%a6)
- tst.b %d1
- bne.b _L11_2d
- bsr.l stwotox # operand is a NORM
- bra.b _L11_6d
-_L11_2d:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L11_3d # no
- bsr.l ld_pone # yes
- bra.b _L11_6d
-_L11_3d:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L11_4d # no
- bsr.l szr_inf # yes
- bra.b _L11_6d
-_L11_4d:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L11_5d # no
- bsr.l src_qnan # yes
- bra.b _L11_6d
-_L11_5d:
- bsr.l stwotoxd # operand is a DENORM
-_L11_6d:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _ftwotoxx_
-_ftwotoxx_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- lea FP_SRC(%a6),%a0
- mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
- mov.l 0x8+0x4(%a6),0x4(%a0)
- mov.l 0x8+0x8(%a6),0x8(%a0)
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L11_2x
- bsr.l stwotox # operand is a NORM
- bra.b _L11_6x
-_L11_2x:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L11_3x # no
- bsr.l ld_pone # yes
- bra.b _L11_6x
-_L11_3x:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L11_4x # no
- bsr.l szr_inf # yes
- bra.b _L11_6x
-_L11_4x:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L11_5x # no
- bsr.l src_qnan # yes
- bra.b _L11_6x
-_L11_5x:
- bsr.l stwotoxd # operand is a DENORM
-_L11_6x:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
-
-#########################################################################
-# MONADIC TEMPLATE #
-#########################################################################
- global _ftentoxs_
-_ftentoxs_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.s 0x8(%a6),%fp0 # load sgl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L12_2s
- bsr.l stentox # operand is a NORM
- bra.b _L12_6s
-_L12_2s:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L12_3s # no
- bsr.l ld_pone # yes
- bra.b _L12_6s
-_L12_3s:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L12_4s # no
- bsr.l szr_inf # yes
- bra.b _L12_6s
-_L12_4s:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L12_5s # no
- bsr.l src_qnan # yes
- bra.b _L12_6s
-_L12_5s:
- bsr.l stentoxd # operand is a DENORM
-_L12_6s:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _ftentoxd_
-_ftentoxd_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.d 0x8(%a6),%fp0 # load dbl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- mov.b %d1,STAG(%a6)
- tst.b %d1
- bne.b _L12_2d
- bsr.l stentox # operand is a NORM
- bra.b _L12_6d
-_L12_2d:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L12_3d # no
- bsr.l ld_pone # yes
- bra.b _L12_6d
-_L12_3d:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L12_4d # no
- bsr.l szr_inf # yes
- bra.b _L12_6d
-_L12_4d:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L12_5d # no
- bsr.l src_qnan # yes
- bra.b _L12_6d
-_L12_5d:
- bsr.l stentoxd # operand is a DENORM
-_L12_6d:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _ftentoxx_
-_ftentoxx_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- lea FP_SRC(%a6),%a0
- mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
- mov.l 0x8+0x4(%a6),0x4(%a0)
- mov.l 0x8+0x8(%a6),0x8(%a0)
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L12_2x
- bsr.l stentox # operand is a NORM
- bra.b _L12_6x
-_L12_2x:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L12_3x # no
- bsr.l ld_pone # yes
- bra.b _L12_6x
-_L12_3x:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L12_4x # no
- bsr.l szr_inf # yes
- bra.b _L12_6x
-_L12_4x:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L12_5x # no
- bsr.l src_qnan # yes
- bra.b _L12_6x
-_L12_5x:
- bsr.l stentoxd # operand is a DENORM
-_L12_6x:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
-
-#########################################################################
-# MONADIC TEMPLATE #
-#########################################################################
- global _flogns_
-_flogns_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.s 0x8(%a6),%fp0 # load sgl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L13_2s
- bsr.l slogn # operand is a NORM
- bra.b _L13_6s
-_L13_2s:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L13_3s # no
- bsr.l t_dz2 # yes
- bra.b _L13_6s
-_L13_3s:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L13_4s # no
- bsr.l sopr_inf # yes
- bra.b _L13_6s
-_L13_4s:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L13_5s # no
- bsr.l src_qnan # yes
- bra.b _L13_6s
-_L13_5s:
- bsr.l slognd # operand is a DENORM
-_L13_6s:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _flognd_
-_flognd_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.d 0x8(%a6),%fp0 # load dbl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- mov.b %d1,STAG(%a6)
- tst.b %d1
- bne.b _L13_2d
- bsr.l slogn # operand is a NORM
- bra.b _L13_6d
-_L13_2d:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L13_3d # no
- bsr.l t_dz2 # yes
- bra.b _L13_6d
-_L13_3d:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L13_4d # no
- bsr.l sopr_inf # yes
- bra.b _L13_6d
-_L13_4d:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L13_5d # no
- bsr.l src_qnan # yes
- bra.b _L13_6d
-_L13_5d:
- bsr.l slognd # operand is a DENORM
-_L13_6d:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _flognx_
-_flognx_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- lea FP_SRC(%a6),%a0
- mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
- mov.l 0x8+0x4(%a6),0x4(%a0)
- mov.l 0x8+0x8(%a6),0x8(%a0)
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L13_2x
- bsr.l slogn # operand is a NORM
- bra.b _L13_6x
-_L13_2x:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L13_3x # no
- bsr.l t_dz2 # yes
- bra.b _L13_6x
-_L13_3x:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L13_4x # no
- bsr.l sopr_inf # yes
- bra.b _L13_6x
-_L13_4x:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L13_5x # no
- bsr.l src_qnan # yes
- bra.b _L13_6x
-_L13_5x:
- bsr.l slognd # operand is a DENORM
-_L13_6x:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
-
-#########################################################################
-# MONADIC TEMPLATE #
-#########################################################################
- global _flog10s_
-_flog10s_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.s 0x8(%a6),%fp0 # load sgl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L14_2s
- bsr.l slog10 # operand is a NORM
- bra.b _L14_6s
-_L14_2s:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L14_3s # no
- bsr.l t_dz2 # yes
- bra.b _L14_6s
-_L14_3s:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L14_4s # no
- bsr.l sopr_inf # yes
- bra.b _L14_6s
-_L14_4s:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L14_5s # no
- bsr.l src_qnan # yes
- bra.b _L14_6s
-_L14_5s:
- bsr.l slog10d # operand is a DENORM
-_L14_6s:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _flog10d_
-_flog10d_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.d 0x8(%a6),%fp0 # load dbl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- mov.b %d1,STAG(%a6)
- tst.b %d1
- bne.b _L14_2d
- bsr.l slog10 # operand is a NORM
- bra.b _L14_6d
-_L14_2d:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L14_3d # no
- bsr.l t_dz2 # yes
- bra.b _L14_6d
-_L14_3d:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L14_4d # no
- bsr.l sopr_inf # yes
- bra.b _L14_6d
-_L14_4d:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L14_5d # no
- bsr.l src_qnan # yes
- bra.b _L14_6d
-_L14_5d:
- bsr.l slog10d # operand is a DENORM
-_L14_6d:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _flog10x_
-_flog10x_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- lea FP_SRC(%a6),%a0
- mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
- mov.l 0x8+0x4(%a6),0x4(%a0)
- mov.l 0x8+0x8(%a6),0x8(%a0)
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L14_2x
- bsr.l slog10 # operand is a NORM
- bra.b _L14_6x
-_L14_2x:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L14_3x # no
- bsr.l t_dz2 # yes
- bra.b _L14_6x
-_L14_3x:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L14_4x # no
- bsr.l sopr_inf # yes
- bra.b _L14_6x
-_L14_4x:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L14_5x # no
- bsr.l src_qnan # yes
- bra.b _L14_6x
-_L14_5x:
- bsr.l slog10d # operand is a DENORM
-_L14_6x:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
-
-#########################################################################
-# MONADIC TEMPLATE #
-#########################################################################
- global _flog2s_
-_flog2s_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.s 0x8(%a6),%fp0 # load sgl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L15_2s
- bsr.l slog2 # operand is a NORM
- bra.b _L15_6s
-_L15_2s:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L15_3s # no
- bsr.l t_dz2 # yes
- bra.b _L15_6s
-_L15_3s:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L15_4s # no
- bsr.l sopr_inf # yes
- bra.b _L15_6s
-_L15_4s:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L15_5s # no
- bsr.l src_qnan # yes
- bra.b _L15_6s
-_L15_5s:
- bsr.l slog2d # operand is a DENORM
-_L15_6s:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _flog2d_
-_flog2d_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.d 0x8(%a6),%fp0 # load dbl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- mov.b %d1,STAG(%a6)
- tst.b %d1
- bne.b _L15_2d
- bsr.l slog2 # operand is a NORM
- bra.b _L15_6d
-_L15_2d:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L15_3d # no
- bsr.l t_dz2 # yes
- bra.b _L15_6d
-_L15_3d:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L15_4d # no
- bsr.l sopr_inf # yes
- bra.b _L15_6d
-_L15_4d:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L15_5d # no
- bsr.l src_qnan # yes
- bra.b _L15_6d
-_L15_5d:
- bsr.l slog2d # operand is a DENORM
-_L15_6d:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _flog2x_
-_flog2x_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- lea FP_SRC(%a6),%a0
- mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
- mov.l 0x8+0x4(%a6),0x4(%a0)
- mov.l 0x8+0x8(%a6),0x8(%a0)
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L15_2x
- bsr.l slog2 # operand is a NORM
- bra.b _L15_6x
-_L15_2x:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L15_3x # no
- bsr.l t_dz2 # yes
- bra.b _L15_6x
-_L15_3x:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L15_4x # no
- bsr.l sopr_inf # yes
- bra.b _L15_6x
-_L15_4x:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L15_5x # no
- bsr.l src_qnan # yes
- bra.b _L15_6x
-_L15_5x:
- bsr.l slog2d # operand is a DENORM
-_L15_6x:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
-
-#########################################################################
-# MONADIC TEMPLATE #
-#########################################################################
- global _fcoshs_
-_fcoshs_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.s 0x8(%a6),%fp0 # load sgl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L16_2s
- bsr.l scosh # operand is a NORM
- bra.b _L16_6s
-_L16_2s:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L16_3s # no
- bsr.l ld_pone # yes
- bra.b _L16_6s
-_L16_3s:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L16_4s # no
- bsr.l ld_pinf # yes
- bra.b _L16_6s
-_L16_4s:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L16_5s # no
- bsr.l src_qnan # yes
- bra.b _L16_6s
-_L16_5s:
- bsr.l scoshd # operand is a DENORM
-_L16_6s:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _fcoshd_
-_fcoshd_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.d 0x8(%a6),%fp0 # load dbl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- mov.b %d1,STAG(%a6)
- tst.b %d1
- bne.b _L16_2d
- bsr.l scosh # operand is a NORM
- bra.b _L16_6d
-_L16_2d:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L16_3d # no
- bsr.l ld_pone # yes
- bra.b _L16_6d
-_L16_3d:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L16_4d # no
- bsr.l ld_pinf # yes
- bra.b _L16_6d
-_L16_4d:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L16_5d # no
- bsr.l src_qnan # yes
- bra.b _L16_6d
-_L16_5d:
- bsr.l scoshd # operand is a DENORM
-_L16_6d:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _fcoshx_
-_fcoshx_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- lea FP_SRC(%a6),%a0
- mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
- mov.l 0x8+0x4(%a6),0x4(%a0)
- mov.l 0x8+0x8(%a6),0x8(%a0)
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L16_2x
- bsr.l scosh # operand is a NORM
- bra.b _L16_6x
-_L16_2x:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L16_3x # no
- bsr.l ld_pone # yes
- bra.b _L16_6x
-_L16_3x:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L16_4x # no
- bsr.l ld_pinf # yes
- bra.b _L16_6x
-_L16_4x:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L16_5x # no
- bsr.l src_qnan # yes
- bra.b _L16_6x
-_L16_5x:
- bsr.l scoshd # operand is a DENORM
-_L16_6x:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
-
-#########################################################################
-# MONADIC TEMPLATE #
-#########################################################################
- global _facoss_
-_facoss_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.s 0x8(%a6),%fp0 # load sgl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L17_2s
- bsr.l sacos # operand is a NORM
- bra.b _L17_6s
-_L17_2s:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L17_3s # no
- bsr.l ld_ppi2 # yes
- bra.b _L17_6s
-_L17_3s:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L17_4s # no
- bsr.l t_operr # yes
- bra.b _L17_6s
-_L17_4s:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L17_5s # no
- bsr.l src_qnan # yes
- bra.b _L17_6s
-_L17_5s:
- bsr.l sacosd # operand is a DENORM
-_L17_6s:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _facosd_
-_facosd_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.d 0x8(%a6),%fp0 # load dbl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- mov.b %d1,STAG(%a6)
- tst.b %d1
- bne.b _L17_2d
- bsr.l sacos # operand is a NORM
- bra.b _L17_6d
-_L17_2d:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L17_3d # no
- bsr.l ld_ppi2 # yes
- bra.b _L17_6d
-_L17_3d:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L17_4d # no
- bsr.l t_operr # yes
- bra.b _L17_6d
-_L17_4d:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L17_5d # no
- bsr.l src_qnan # yes
- bra.b _L17_6d
-_L17_5d:
- bsr.l sacosd # operand is a DENORM
-_L17_6d:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _facosx_
-_facosx_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- lea FP_SRC(%a6),%a0
- mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
- mov.l 0x8+0x4(%a6),0x4(%a0)
- mov.l 0x8+0x8(%a6),0x8(%a0)
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L17_2x
- bsr.l sacos # operand is a NORM
- bra.b _L17_6x
-_L17_2x:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L17_3x # no
- bsr.l ld_ppi2 # yes
- bra.b _L17_6x
-_L17_3x:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L17_4x # no
- bsr.l t_operr # yes
- bra.b _L17_6x
-_L17_4x:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L17_5x # no
- bsr.l src_qnan # yes
- bra.b _L17_6x
-_L17_5x:
- bsr.l sacosd # operand is a DENORM
-_L17_6x:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
-
-#########################################################################
-# MONADIC TEMPLATE #
-#########################################################################
- global _fgetexps_
-_fgetexps_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.s 0x8(%a6),%fp0 # load sgl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L18_2s
- bsr.l sgetexp # operand is a NORM
- bra.b _L18_6s
-_L18_2s:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L18_3s # no
- bsr.l src_zero # yes
- bra.b _L18_6s
-_L18_3s:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L18_4s # no
- bsr.l t_operr # yes
- bra.b _L18_6s
-_L18_4s:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L18_5s # no
- bsr.l src_qnan # yes
- bra.b _L18_6s
-_L18_5s:
- bsr.l sgetexpd # operand is a DENORM
-_L18_6s:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _fgetexpd_
-_fgetexpd_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.d 0x8(%a6),%fp0 # load dbl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- mov.b %d1,STAG(%a6)
- tst.b %d1
- bne.b _L18_2d
- bsr.l sgetexp # operand is a NORM
- bra.b _L18_6d
-_L18_2d:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L18_3d # no
- bsr.l src_zero # yes
- bra.b _L18_6d
-_L18_3d:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L18_4d # no
- bsr.l t_operr # yes
- bra.b _L18_6d
-_L18_4d:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L18_5d # no
- bsr.l src_qnan # yes
- bra.b _L18_6d
-_L18_5d:
- bsr.l sgetexpd # operand is a DENORM
-_L18_6d:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _fgetexpx_
-_fgetexpx_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- lea FP_SRC(%a6),%a0
- mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
- mov.l 0x8+0x4(%a6),0x4(%a0)
- mov.l 0x8+0x8(%a6),0x8(%a0)
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L18_2x
- bsr.l sgetexp # operand is a NORM
- bra.b _L18_6x
-_L18_2x:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L18_3x # no
- bsr.l src_zero # yes
- bra.b _L18_6x
-_L18_3x:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L18_4x # no
- bsr.l t_operr # yes
- bra.b _L18_6x
-_L18_4x:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L18_5x # no
- bsr.l src_qnan # yes
- bra.b _L18_6x
-_L18_5x:
- bsr.l sgetexpd # operand is a DENORM
-_L18_6x:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
-
-#########################################################################
-# MONADIC TEMPLATE #
-#########################################################################
- global _fgetmans_
-_fgetmans_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.s 0x8(%a6),%fp0 # load sgl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L19_2s
- bsr.l sgetman # operand is a NORM
- bra.b _L19_6s
-_L19_2s:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L19_3s # no
- bsr.l src_zero # yes
- bra.b _L19_6s
-_L19_3s:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L19_4s # no
- bsr.l t_operr # yes
- bra.b _L19_6s
-_L19_4s:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L19_5s # no
- bsr.l src_qnan # yes
- bra.b _L19_6s
-_L19_5s:
- bsr.l sgetmand # operand is a DENORM
-_L19_6s:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _fgetmand_
-_fgetmand_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.d 0x8(%a6),%fp0 # load dbl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- mov.b %d1,STAG(%a6)
- tst.b %d1
- bne.b _L19_2d
- bsr.l sgetman # operand is a NORM
- bra.b _L19_6d
-_L19_2d:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L19_3d # no
- bsr.l src_zero # yes
- bra.b _L19_6d
-_L19_3d:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L19_4d # no
- bsr.l t_operr # yes
- bra.b _L19_6d
-_L19_4d:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L19_5d # no
- bsr.l src_qnan # yes
- bra.b _L19_6d
-_L19_5d:
- bsr.l sgetmand # operand is a DENORM
-_L19_6d:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _fgetmanx_
-_fgetmanx_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- lea FP_SRC(%a6),%a0
- mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
- mov.l 0x8+0x4(%a6),0x4(%a0)
- mov.l 0x8+0x8(%a6),0x8(%a0)
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L19_2x
- bsr.l sgetman # operand is a NORM
- bra.b _L19_6x
-_L19_2x:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L19_3x # no
- bsr.l src_zero # yes
- bra.b _L19_6x
-_L19_3x:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L19_4x # no
- bsr.l t_operr # yes
- bra.b _L19_6x
-_L19_4x:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L19_5x # no
- bsr.l src_qnan # yes
- bra.b _L19_6x
-_L19_5x:
- bsr.l sgetmand # operand is a DENORM
-_L19_6x:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
-
-#########################################################################
-# MONADIC TEMPLATE #
-#########################################################################
- global _fsincoss_
-_fsincoss_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.s 0x8(%a6),%fp0 # load sgl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L20_2s
- bsr.l ssincos # operand is a NORM
- bra.b _L20_6s
-_L20_2s:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L20_3s # no
- bsr.l ssincosz # yes
- bra.b _L20_6s
-_L20_3s:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L20_4s # no
- bsr.l ssincosi # yes
- bra.b _L20_6s
-_L20_4s:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L20_5s # no
- bsr.l ssincosqnan # yes
- bra.b _L20_6s
-_L20_5s:
- bsr.l ssincosd # operand is a DENORM
-_L20_6s:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x &0x03,-(%sp) # store off fp0/fp1
- fmovm.x (%sp)+,&0x40 # fp0 now in fp1
- fmovm.x (%sp)+,&0x80 # fp1 now in fp0
- unlk %a6
- rts
-
- global _fsincosd_
-_fsincosd_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.d 0x8(%a6),%fp0 # load dbl input
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- mov.b %d1,STAG(%a6)
- tst.b %d1
- bne.b _L20_2d
- bsr.l ssincos # operand is a NORM
- bra.b _L20_6d
-_L20_2d:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L20_3d # no
- bsr.l ssincosz # yes
- bra.b _L20_6d
-_L20_3d:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L20_4d # no
- bsr.l ssincosi # yes
- bra.b _L20_6d
-_L20_4d:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L20_5d # no
- bsr.l ssincosqnan # yes
- bra.b _L20_6d
-_L20_5d:
- bsr.l ssincosd # operand is a DENORM
-_L20_6d:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x &0x03,-(%sp) # store off fp0/fp1
- fmovm.x (%sp)+,&0x40 # fp0 now in fp1
- fmovm.x (%sp)+,&0x80 # fp1 now in fp0
- unlk %a6
- rts
-
- global _fsincosx_
-_fsincosx_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- lea FP_SRC(%a6),%a0
- mov.l 0x8+0x0(%a6),0x0(%a0) # load ext input
- mov.l 0x8+0x4(%a6),0x4(%a0)
- mov.l 0x8+0x8(%a6),0x8(%a0)
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.b %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- tst.b %d1
- bne.b _L20_2x
- bsr.l ssincos # operand is a NORM
- bra.b _L20_6x
-_L20_2x:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L20_3x # no
- bsr.l ssincosz # yes
- bra.b _L20_6x
-_L20_3x:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L20_4x # no
- bsr.l ssincosi # yes
- bra.b _L20_6x
-_L20_4x:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L20_5x # no
- bsr.l ssincosqnan # yes
- bra.b _L20_6x
-_L20_5x:
- bsr.l ssincosd # operand is a DENORM
-_L20_6x:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x &0x03,-(%sp) # store off fp0/fp1
- fmovm.x (%sp)+,&0x40 # fp0 now in fp1
- fmovm.x (%sp)+,&0x80 # fp1 now in fp0
- unlk %a6
- rts
-
-
-#########################################################################
-# DYADIC TEMPLATE #
-#########################################################################
- global _frems_
-_frems_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.s 0x8(%a6),%fp0 # load sgl dst
- fmov.x %fp0,FP_DST(%a6)
- lea FP_DST(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,DTAG(%a6)
-
- fmov.s 0xc(%a6),%fp0 # load sgl src
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.l %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- lea FP_SRC(%a6),%a0 # pass ptr to src
- lea FP_DST(%a6),%a1 # pass ptr to dst
-
- tst.b %d1
- bne.b _L21_2s
- bsr.l srem_snorm # operand is a NORM
- bra.b _L21_6s
-_L21_2s:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L21_3s # no
- bsr.l srem_szero # yes
- bra.b _L21_6s
-_L21_3s:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L21_4s # no
- bsr.l srem_sinf # yes
- bra.b _L21_6s
-_L21_4s:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L21_5s # no
- bsr.l sop_sqnan # yes
- bra.b _L21_6s
-_L21_5s:
- bsr.l srem_sdnrm # operand is a DENORM
-_L21_6s:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _fremd_
-_fremd_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.d 0x8(%a6),%fp0 # load dbl dst
- fmov.x %fp0,FP_DST(%a6)
- lea FP_DST(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,DTAG(%a6)
-
- fmov.d 0x10(%a6),%fp0 # load dbl src
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.l %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- lea FP_SRC(%a6),%a0 # pass ptr to src
- lea FP_DST(%a6),%a1 # pass ptr to dst
-
- tst.b %d1
- bne.b _L21_2d
- bsr.l srem_snorm # operand is a NORM
- bra.b _L21_6d
-_L21_2d:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L21_3d # no
- bsr.l srem_szero # yes
- bra.b _L21_6d
-_L21_3d:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L21_4d # no
- bsr.l srem_sinf # yes
- bra.b _L21_6d
-_L21_4d:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L21_5d # no
- bsr.l sop_sqnan # yes
- bra.b _L21_6d
-_L21_5d:
- bsr.l srem_sdnrm # operand is a DENORM
-_L21_6d:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _fremx_
-_fremx_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- lea FP_DST(%a6),%a0
- mov.l 0x8+0x0(%a6),0x0(%a0) # load ext dst
- mov.l 0x8+0x4(%a6),0x4(%a0)
- mov.l 0x8+0x8(%a6),0x8(%a0)
- bsr.l tag # fetch operand type
- mov.b %d0,DTAG(%a6)
-
- lea FP_SRC(%a6),%a0
- mov.l 0x14+0x0(%a6),0x0(%a0) # load ext src
- mov.l 0x14+0x4(%a6),0x4(%a0)
- mov.l 0x14+0x8(%a6),0x8(%a0)
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.l %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- lea FP_SRC(%a6),%a0 # pass ptr to src
- lea FP_DST(%a6),%a1 # pass ptr to dst
-
- tst.b %d1
- bne.b _L21_2x
- bsr.l srem_snorm # operand is a NORM
- bra.b _L21_6x
-_L21_2x:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L21_3x # no
- bsr.l srem_szero # yes
- bra.b _L21_6x
-_L21_3x:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L21_4x # no
- bsr.l srem_sinf # yes
- bra.b _L21_6x
-_L21_4x:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L21_5x # no
- bsr.l sop_sqnan # yes
- bra.b _L21_6x
-_L21_5x:
- bsr.l srem_sdnrm # operand is a DENORM
-_L21_6x:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
-
-#########################################################################
-# DYADIC TEMPLATE #
-#########################################################################
- global _fmods_
-_fmods_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.s 0x8(%a6),%fp0 # load sgl dst
- fmov.x %fp0,FP_DST(%a6)
- lea FP_DST(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,DTAG(%a6)
-
- fmov.s 0xc(%a6),%fp0 # load sgl src
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.l %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- lea FP_SRC(%a6),%a0 # pass ptr to src
- lea FP_DST(%a6),%a1 # pass ptr to dst
-
- tst.b %d1
- bne.b _L22_2s
- bsr.l smod_snorm # operand is a NORM
- bra.b _L22_6s
-_L22_2s:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L22_3s # no
- bsr.l smod_szero # yes
- bra.b _L22_6s
-_L22_3s:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L22_4s # no
- bsr.l smod_sinf # yes
- bra.b _L22_6s
-_L22_4s:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L22_5s # no
- bsr.l sop_sqnan # yes
- bra.b _L22_6s
-_L22_5s:
- bsr.l smod_sdnrm # operand is a DENORM
-_L22_6s:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _fmodd_
-_fmodd_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.d 0x8(%a6),%fp0 # load dbl dst
- fmov.x %fp0,FP_DST(%a6)
- lea FP_DST(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,DTAG(%a6)
-
- fmov.d 0x10(%a6),%fp0 # load dbl src
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.l %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- lea FP_SRC(%a6),%a0 # pass ptr to src
- lea FP_DST(%a6),%a1 # pass ptr to dst
-
- tst.b %d1
- bne.b _L22_2d
- bsr.l smod_snorm # operand is a NORM
- bra.b _L22_6d
-_L22_2d:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L22_3d # no
- bsr.l smod_szero # yes
- bra.b _L22_6d
-_L22_3d:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L22_4d # no
- bsr.l smod_sinf # yes
- bra.b _L22_6d
-_L22_4d:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L22_5d # no
- bsr.l sop_sqnan # yes
- bra.b _L22_6d
-_L22_5d:
- bsr.l smod_sdnrm # operand is a DENORM
-_L22_6d:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _fmodx_
-_fmodx_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- lea FP_DST(%a6),%a0
- mov.l 0x8+0x0(%a6),0x0(%a0) # load ext dst
- mov.l 0x8+0x4(%a6),0x4(%a0)
- mov.l 0x8+0x8(%a6),0x8(%a0)
- bsr.l tag # fetch operand type
- mov.b %d0,DTAG(%a6)
-
- lea FP_SRC(%a6),%a0
- mov.l 0x14+0x0(%a6),0x0(%a0) # load ext src
- mov.l 0x14+0x4(%a6),0x4(%a0)
- mov.l 0x14+0x8(%a6),0x8(%a0)
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.l %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- lea FP_SRC(%a6),%a0 # pass ptr to src
- lea FP_DST(%a6),%a1 # pass ptr to dst
-
- tst.b %d1
- bne.b _L22_2x
- bsr.l smod_snorm # operand is a NORM
- bra.b _L22_6x
-_L22_2x:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L22_3x # no
- bsr.l smod_szero # yes
- bra.b _L22_6x
-_L22_3x:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L22_4x # no
- bsr.l smod_sinf # yes
- bra.b _L22_6x
-_L22_4x:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L22_5x # no
- bsr.l sop_sqnan # yes
- bra.b _L22_6x
-_L22_5x:
- bsr.l smod_sdnrm # operand is a DENORM
-_L22_6x:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
-
-#########################################################################
-# DYADIC TEMPLATE #
-#########################################################################
- global _fscales_
-_fscales_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.s 0x8(%a6),%fp0 # load sgl dst
- fmov.x %fp0,FP_DST(%a6)
- lea FP_DST(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,DTAG(%a6)
-
- fmov.s 0xc(%a6),%fp0 # load sgl src
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.l %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- lea FP_SRC(%a6),%a0 # pass ptr to src
- lea FP_DST(%a6),%a1 # pass ptr to dst
-
- tst.b %d1
- bne.b _L23_2s
- bsr.l sscale_snorm # operand is a NORM
- bra.b _L23_6s
-_L23_2s:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L23_3s # no
- bsr.l sscale_szero # yes
- bra.b _L23_6s
-_L23_3s:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L23_4s # no
- bsr.l sscale_sinf # yes
- bra.b _L23_6s
-_L23_4s:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L23_5s # no
- bsr.l sop_sqnan # yes
- bra.b _L23_6s
-_L23_5s:
- bsr.l sscale_sdnrm # operand is a DENORM
-_L23_6s:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _fscaled_
-_fscaled_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- fmov.d 0x8(%a6),%fp0 # load dbl dst
- fmov.x %fp0,FP_DST(%a6)
- lea FP_DST(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,DTAG(%a6)
-
- fmov.d 0x10(%a6),%fp0 # load dbl src
- fmov.x %fp0,FP_SRC(%a6)
- lea FP_SRC(%a6),%a0
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.l %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- lea FP_SRC(%a6),%a0 # pass ptr to src
- lea FP_DST(%a6),%a1 # pass ptr to dst
-
- tst.b %d1
- bne.b _L23_2d
- bsr.l sscale_snorm # operand is a NORM
- bra.b _L23_6d
-_L23_2d:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L23_3d # no
- bsr.l sscale_szero # yes
- bra.b _L23_6d
-_L23_3d:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L23_4d # no
- bsr.l sscale_sinf # yes
- bra.b _L23_6d
-_L23_4d:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L23_5d # no
- bsr.l sop_sqnan # yes
- bra.b _L23_6d
-_L23_5d:
- bsr.l sscale_sdnrm # operand is a DENORM
-_L23_6d:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
- global _fscalex_
-_fscalex_:
- link %a6,&-LOCAL_SIZE
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FP0(%a6) # save fp0/fp1
-
- fmov.l &0x0,%fpcr # zero FPCR
-
-#
-# copy, convert, and tag input argument
-#
- lea FP_DST(%a6),%a0
- mov.l 0x8+0x0(%a6),0x0(%a0) # load ext dst
- mov.l 0x8+0x4(%a6),0x4(%a0)
- mov.l 0x8+0x8(%a6),0x8(%a0)
- bsr.l tag # fetch operand type
- mov.b %d0,DTAG(%a6)
-
- lea FP_SRC(%a6),%a0
- mov.l 0x14+0x0(%a6),0x0(%a0) # load ext src
- mov.l 0x14+0x4(%a6),0x4(%a0)
- mov.l 0x14+0x8(%a6),0x8(%a0)
- bsr.l tag # fetch operand type
- mov.b %d0,STAG(%a6)
- mov.l %d0,%d1
-
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd mode,prec
-
- lea FP_SRC(%a6),%a0 # pass ptr to src
- lea FP_DST(%a6),%a1 # pass ptr to dst
-
- tst.b %d1
- bne.b _L23_2x
- bsr.l sscale_snorm # operand is a NORM
- bra.b _L23_6x
-_L23_2x:
- cmpi.b %d1,&ZERO # is operand a ZERO?
- bne.b _L23_3x # no
- bsr.l sscale_szero # yes
- bra.b _L23_6x
-_L23_3x:
- cmpi.b %d1,&INF # is operand an INF?
- bne.b _L23_4x # no
- bsr.l sscale_sinf # yes
- bra.b _L23_6x
-_L23_4x:
- cmpi.b %d1,&QNAN # is operand a QNAN?
- bne.b _L23_5x # no
- bsr.l sop_sqnan # yes
- bra.b _L23_6x
-_L23_5x:
- bsr.l sscale_sdnrm # operand is a DENORM
-_L23_6x:
-
-#
-# Result is now in FP0
-#
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr # restore ctrl regs
- fmovm.x EXC_FP1(%a6),&0x40 # restore fp1
- unlk %a6
- rts
-
-
-#########################################################################
-# ssin(): computes the sine of a normalized input #
-# ssind(): computes the sine of a denormalized input #
-# scos(): computes the cosine of a normalized input #
-# scosd(): computes the cosine of a denormalized input #
-# ssincos(): computes the sine and cosine of a normalized input #
-# ssincosd(): computes the sine and cosine of a denormalized input #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input #
-# d0 = round precision,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = sin(X) or cos(X) #
-# #
-# For ssincos(X): #
-# fp0 = sin(X) #
-# fp1 = cos(X) #
-# #
-# ACCURACY and MONOTONICITY ******************************************* #
-# The returned result is within 1 ulp in 64 significant bit, i.e. #
-# within 0.5001 ulp to 53 bits if the result is subsequently #
-# rounded to double precision. The result is provably monotonic #
-# in double precision. #
-# #
-# ALGORITHM *********************************************************** #
-# #
-# SIN and COS: #
-# 1. If SIN is invoked, set AdjN := 0; otherwise, set AdjN := 1. #
-# #
-# 2. If |X| >= 15Pi or |X| < 2**(-40), go to 7. #
-# #
-# 3. Decompose X as X = N(Pi/2) + r where |r| <= Pi/4. Let #
-# k = N mod 4, so in particular, k = 0,1,2,or 3. #
-# Overwrite k by k := k + AdjN. #
-# #
-# 4. If k is even, go to 6. #
-# #
-# 5. (k is odd) Set j := (k-1)/2, sgn := (-1)**j. #
-# Return sgn*cos(r) where cos(r) is approximated by an #
-# even polynomial in r, 1 + r*r*(B1+s*(B2+ ... + s*B8)), #
-# s = r*r. #
-# Exit. #
-# #
-# 6. (k is even) Set j := k/2, sgn := (-1)**j. Return sgn*sin(r) #
-# where sin(r) is approximated by an odd polynomial in r #
-# r + r*s*(A1+s*(A2+ ... + s*A7)), s = r*r. #
-# Exit. #
-# #
-# 7. If |X| > 1, go to 9. #
-# #
-# 8. (|X|<2**(-40)) If SIN is invoked, return X; #
-# otherwise return 1. #
-# #
-# 9. Overwrite X by X := X rem 2Pi. Now that |X| <= Pi, #
-# go back to 3. #
-# #
-# SINCOS: #
-# 1. If |X| >= 15Pi or |X| < 2**(-40), go to 6. #
-# #
-# 2. Decompose X as X = N(Pi/2) + r where |r| <= Pi/4. Let #
-# k = N mod 4, so in particular, k = 0,1,2,or 3. #
-# #
-# 3. If k is even, go to 5. #
-# #
-# 4. (k is odd) Set j1 := (k-1)/2, j2 := j1 (EOR) (k mod 2), ie. #
-# j1 exclusive or with the l.s.b. of k. #
-# sgn1 := (-1)**j1, sgn2 := (-1)**j2. #
-# SIN(X) = sgn1 * cos(r) and COS(X) = sgn2*sin(r) where #
-# sin(r) and cos(r) are computed as odd and even #
-# polynomials in r, respectively. Exit #
-# #
-# 5. (k is even) Set j1 := k/2, sgn1 := (-1)**j1. #
-# SIN(X) = sgn1 * sin(r) and COS(X) = sgn1*cos(r) where #
-# sin(r) and cos(r) are computed as odd and even #
-# polynomials in r, respectively. Exit #
-# #
-# 6. If |X| > 1, go to 8. #
-# #
-# 7. (|X|<2**(-40)) SIN(X) = X and COS(X) = 1. Exit. #
-# #
-# 8. Overwrite X by X := X rem 2Pi. Now that |X| <= Pi, #
-# go back to 2. #
-# #
-#########################################################################
-
-SINA7: long 0xBD6AAA77,0xCCC994F5
-SINA6: long 0x3DE61209,0x7AAE8DA1
-SINA5: long 0xBE5AE645,0x2A118AE4
-SINA4: long 0x3EC71DE3,0xA5341531
-SINA3: long 0xBF2A01A0,0x1A018B59,0x00000000,0x00000000
-SINA2: long 0x3FF80000,0x88888888,0x888859AF,0x00000000
-SINA1: long 0xBFFC0000,0xAAAAAAAA,0xAAAAAA99,0x00000000
-
-COSB8: long 0x3D2AC4D0,0xD6011EE3
-COSB7: long 0xBDA9396F,0x9F45AC19
-COSB6: long 0x3E21EED9,0x0612C972
-COSB5: long 0xBE927E4F,0xB79D9FCF
-COSB4: long 0x3EFA01A0,0x1A01D423,0x00000000,0x00000000
-COSB3: long 0xBFF50000,0xB60B60B6,0x0B61D438,0x00000000
-COSB2: long 0x3FFA0000,0xAAAAAAAA,0xAAAAAB5E
-COSB1: long 0xBF000000
-
- set INARG,FP_SCR0
-
- set X,FP_SCR0
-# set XDCARE,X+2
- set XFRAC,X+4
-
- set RPRIME,FP_SCR0
- set SPRIME,FP_SCR1
-
- set POSNEG1,L_SCR1
- set TWOTO63,L_SCR1
-
- set ENDFLAG,L_SCR2
- set INT,L_SCR2
-
- set ADJN,L_SCR3
-
-############################################
- global ssin
-ssin:
- mov.l &0,ADJN(%a6) # yes; SET ADJN TO 0
- bra.b SINBGN
-
-############################################
- global scos
-scos:
- mov.l &1,ADJN(%a6) # yes; SET ADJN TO 1
-
-############################################
-SINBGN:
-#--SAVE FPCR, FP1. CHECK IF |X| IS TOO SMALL OR LARGE
-
- fmov.x (%a0),%fp0 # LOAD INPUT
- fmov.x %fp0,X(%a6) # save input at X
-
-# "COMPACTIFY" X
- mov.l (%a0),%d1 # put exp in hi word
- mov.w 4(%a0),%d1 # fetch hi(man)
- and.l &0x7FFFFFFF,%d1 # strip sign
-
- cmpi.l %d1,&0x3FD78000 # is |X| >= 2**(-40)?
- bge.b SOK1 # no
- bra.w SINSM # yes; input is very small
-
-SOK1:
- cmp.l %d1,&0x4004BC7E # is |X| < 15 PI?
- blt.b SINMAIN # no
- bra.w SREDUCEX # yes; input is very large
-
-#--THIS IS THE USUAL CASE, |X| <= 15 PI.
-#--THE ARGUMENT REDUCTION IS DONE BY TABLE LOOK UP.
-SINMAIN:
- fmov.x %fp0,%fp1
- fmul.d TWOBYPI(%pc),%fp1 # X*2/PI
-
- lea PITBL+0x200(%pc),%a1 # TABLE OF N*PI/2, N = -32,...,32
-
- fmov.l %fp1,INT(%a6) # CONVERT TO INTEGER
-
- mov.l INT(%a6),%d1 # make a copy of N
- asl.l &4,%d1 # N *= 16
- add.l %d1,%a1 # tbl_addr = a1 + (N*16)
-
-# A1 IS THE ADDRESS OF N*PIBY2
-# ...WHICH IS IN TWO PIECES Y1 & Y2
- fsub.x (%a1)+,%fp0 # X-Y1
- fsub.s (%a1),%fp0 # fp0 = R = (X-Y1)-Y2
-
-SINCONT:
-#--continuation from REDUCEX
-
-#--GET N+ADJN AND SEE IF SIN(R) OR COS(R) IS NEEDED
- mov.l INT(%a6),%d1
- add.l ADJN(%a6),%d1 # SEE IF D0 IS ODD OR EVEN
- ror.l &1,%d1 # D0 WAS ODD IFF D0 IS NEGATIVE
- cmp.l %d1,&0
- blt.w COSPOLY
-
-#--LET J BE THE LEAST SIG. BIT OF D0, LET SGN := (-1)**J.
-#--THEN WE RETURN SGN*SIN(R). SGN*SIN(R) IS COMPUTED BY
-#--R' + R'*S*(A1 + S(A2 + S(A3 + S(A4 + ... + SA7)))), WHERE
-#--R' = SGN*R, S=R*R. THIS CAN BE REWRITTEN AS
-#--R' + R'*S*( [A1+T(A3+T(A5+TA7))] + [S(A2+T(A4+TA6))])
-#--WHERE T=S*S.
-#--NOTE THAT A3 THROUGH A7 ARE STORED IN DOUBLE PRECISION
-#--WHILE A1 AND A2 ARE IN DOUBLE-EXTENDED FORMAT.
-SINPOLY:
- fmovm.x &0x0c,-(%sp) # save fp2/fp3
-
- fmov.x %fp0,X(%a6) # X IS R
- fmul.x %fp0,%fp0 # FP0 IS S
-
- fmov.d SINA7(%pc),%fp3
- fmov.d SINA6(%pc),%fp2
-
- fmov.x %fp0,%fp1
- fmul.x %fp1,%fp1 # FP1 IS T
-
- ror.l &1,%d1
- and.l &0x80000000,%d1
-# ...LEAST SIG. BIT OF D0 IN SIGN POSITION
- eor.l %d1,X(%a6) # X IS NOW R'= SGN*R
-
- fmul.x %fp1,%fp3 # TA7
- fmul.x %fp1,%fp2 # TA6
-
- fadd.d SINA5(%pc),%fp3 # A5+TA7
- fadd.d SINA4(%pc),%fp2 # A4+TA6
-
- fmul.x %fp1,%fp3 # T(A5+TA7)
- fmul.x %fp1,%fp2 # T(A4+TA6)
-
- fadd.d SINA3(%pc),%fp3 # A3+T(A5+TA7)
- fadd.x SINA2(%pc),%fp2 # A2+T(A4+TA6)
-
- fmul.x %fp3,%fp1 # T(A3+T(A5+TA7))
-
- fmul.x %fp0,%fp2 # S(A2+T(A4+TA6))
- fadd.x SINA1(%pc),%fp1 # A1+T(A3+T(A5+TA7))
- fmul.x X(%a6),%fp0 # R'*S
-
- fadd.x %fp2,%fp1 # [A1+T(A3+T(A5+TA7))]+[S(A2+T(A4+TA6))]
-
- fmul.x %fp1,%fp0 # SIN(R')-R'
-
- fmovm.x (%sp)+,&0x30 # restore fp2/fp3
-
- fmov.l %d0,%fpcr # restore users round mode,prec
- fadd.x X(%a6),%fp0 # last inst - possible exception set
- bra t_inx2
-
-#--LET J BE THE LEAST SIG. BIT OF D0, LET SGN := (-1)**J.
-#--THEN WE RETURN SGN*COS(R). SGN*COS(R) IS COMPUTED BY
-#--SGN + S'*(B1 + S(B2 + S(B3 + S(B4 + ... + SB8)))), WHERE
-#--S=R*R AND S'=SGN*S. THIS CAN BE REWRITTEN AS
-#--SGN + S'*([B1+T(B3+T(B5+TB7))] + [S(B2+T(B4+T(B6+TB8)))])
-#--WHERE T=S*S.
-#--NOTE THAT B4 THROUGH B8 ARE STORED IN DOUBLE PRECISION
-#--WHILE B2 AND B3 ARE IN DOUBLE-EXTENDED FORMAT, B1 IS -1/2
-#--AND IS THEREFORE STORED AS SINGLE PRECISION.
-COSPOLY:
- fmovm.x &0x0c,-(%sp) # save fp2/fp3
-
- fmul.x %fp0,%fp0 # FP0 IS S
-
- fmov.d COSB8(%pc),%fp2
- fmov.d COSB7(%pc),%fp3
-
- fmov.x %fp0,%fp1
- fmul.x %fp1,%fp1 # FP1 IS T
-
- fmov.x %fp0,X(%a6) # X IS S
- ror.l &1,%d1
- and.l &0x80000000,%d1
-# ...LEAST SIG. BIT OF D0 IN SIGN POSITION
-
- fmul.x %fp1,%fp2 # TB8
-
- eor.l %d1,X(%a6) # X IS NOW S'= SGN*S
- and.l &0x80000000,%d1
-
- fmul.x %fp1,%fp3 # TB7
-
- or.l &0x3F800000,%d1 # D0 IS SGN IN SINGLE
- mov.l %d1,POSNEG1(%a6)
-
- fadd.d COSB6(%pc),%fp2 # B6+TB8
- fadd.d COSB5(%pc),%fp3 # B5+TB7
-
- fmul.x %fp1,%fp2 # T(B6+TB8)
- fmul.x %fp1,%fp3 # T(B5+TB7)
-
- fadd.d COSB4(%pc),%fp2 # B4+T(B6+TB8)
- fadd.x COSB3(%pc),%fp3 # B3+T(B5+TB7)
-
- fmul.x %fp1,%fp2 # T(B4+T(B6+TB8))
- fmul.x %fp3,%fp1 # T(B3+T(B5+TB7))
-
- fadd.x COSB2(%pc),%fp2 # B2+T(B4+T(B6+TB8))
- fadd.s COSB1(%pc),%fp1 # B1+T(B3+T(B5+TB7))
-
- fmul.x %fp2,%fp0 # S(B2+T(B4+T(B6+TB8)))
-
- fadd.x %fp1,%fp0
-
- fmul.x X(%a6),%fp0
-
- fmovm.x (%sp)+,&0x30 # restore fp2/fp3
-
- fmov.l %d0,%fpcr # restore users round mode,prec
- fadd.s POSNEG1(%a6),%fp0 # last inst - possible exception set
- bra t_inx2
-
-##############################################
-
-# SINe: Big OR Small?
-#--IF |X| > 15PI, WE USE THE GENERAL ARGUMENT REDUCTION.
-#--IF |X| < 2**(-40), RETURN X OR 1.
-SINBORS:
- cmp.l %d1,&0x3FFF8000
- bgt.l SREDUCEX
-
-SINSM:
- mov.l ADJN(%a6),%d1
- cmp.l %d1,&0
- bgt.b COSTINY
-
-# here, the operation may underflow iff the precision is sgl or dbl.
-# extended denorms are handled through another entry point.
-SINTINY:
-# mov.w &0x0000,XDCARE(%a6) # JUST IN CASE
-
- fmov.l %d0,%fpcr # restore users round mode,prec
- mov.b &FMOV_OP,%d1 # last inst is MOVE
- fmov.x X(%a6),%fp0 # last inst - possible exception set
- bra t_catch
-
-COSTINY:
- fmov.s &0x3F800000,%fp0 # fp0 = 1.0
- fmov.l %d0,%fpcr # restore users round mode,prec
- fadd.s &0x80800000,%fp0 # last inst - possible exception set
- bra t_pinx2
-
-################################################
- global ssind
-#--SIN(X) = X FOR DENORMALIZED X
-ssind:
- bra t_extdnrm
-
-############################################
- global scosd
-#--COS(X) = 1 FOR DENORMALIZED X
-scosd:
- fmov.s &0x3F800000,%fp0 # fp0 = 1.0
- bra t_pinx2
-
-##################################################
-
- global ssincos
-ssincos:
-#--SET ADJN TO 4
- mov.l &4,ADJN(%a6)
-
- fmov.x (%a0),%fp0 # LOAD INPUT
- fmov.x %fp0,X(%a6)
-
- mov.l (%a0),%d1
- mov.w 4(%a0),%d1
- and.l &0x7FFFFFFF,%d1 # COMPACTIFY X
-
- cmp.l %d1,&0x3FD78000 # |X| >= 2**(-40)?
- bge.b SCOK1
- bra.w SCSM
-
-SCOK1:
- cmp.l %d1,&0x4004BC7E # |X| < 15 PI?
- blt.b SCMAIN
- bra.w SREDUCEX
-
-
-#--THIS IS THE USUAL CASE, |X| <= 15 PI.
-#--THE ARGUMENT REDUCTION IS DONE BY TABLE LOOK UP.
-SCMAIN:
- fmov.x %fp0,%fp1
-
- fmul.d TWOBYPI(%pc),%fp1 # X*2/PI
-
- lea PITBL+0x200(%pc),%a1 # TABLE OF N*PI/2, N = -32,...,32
-
- fmov.l %fp1,INT(%a6) # CONVERT TO INTEGER
-
- mov.l INT(%a6),%d1
- asl.l &4,%d1
- add.l %d1,%a1 # ADDRESS OF N*PIBY2, IN Y1, Y2
-
- fsub.x (%a1)+,%fp0 # X-Y1
- fsub.s (%a1),%fp0 # FP0 IS R = (X-Y1)-Y2
-
-SCCONT:
-#--continuation point from REDUCEX
-
- mov.l INT(%a6),%d1
- ror.l &1,%d1
- cmp.l %d1,&0 # D0 < 0 IFF N IS ODD
- bge.w NEVEN
-
-SNODD:
-#--REGISTERS SAVED SO FAR: D0, A0, FP2.
- fmovm.x &0x04,-(%sp) # save fp2
-
- fmov.x %fp0,RPRIME(%a6)
- fmul.x %fp0,%fp0 # FP0 IS S = R*R
- fmov.d SINA7(%pc),%fp1 # A7
- fmov.d COSB8(%pc),%fp2 # B8
- fmul.x %fp0,%fp1 # SA7
- fmul.x %fp0,%fp2 # SB8
-
- mov.l %d2,-(%sp)
- mov.l %d1,%d2
- ror.l &1,%d2
- and.l &0x80000000,%d2
- eor.l %d1,%d2
- and.l &0x80000000,%d2
-
- fadd.d SINA6(%pc),%fp1 # A6+SA7
- fadd.d COSB7(%pc),%fp2 # B7+SB8
-
- fmul.x %fp0,%fp1 # S(A6+SA7)
- eor.l %d2,RPRIME(%a6)
- mov.l (%sp)+,%d2
- fmul.x %fp0,%fp2 # S(B7+SB8)
- ror.l &1,%d1
- and.l &0x80000000,%d1
- mov.l &0x3F800000,POSNEG1(%a6)
- eor.l %d1,POSNEG1(%a6)
-
- fadd.d SINA5(%pc),%fp1 # A5+S(A6+SA7)
- fadd.d COSB6(%pc),%fp2 # B6+S(B7+SB8)
-
- fmul.x %fp0,%fp1 # S(A5+S(A6+SA7))
- fmul.x %fp0,%fp2 # S(B6+S(B7+SB8))
- fmov.x %fp0,SPRIME(%a6)
-
- fadd.d SINA4(%pc),%fp1 # A4+S(A5+S(A6+SA7))
- eor.l %d1,SPRIME(%a6)
- fadd.d COSB5(%pc),%fp2 # B5+S(B6+S(B7+SB8))
-
- fmul.x %fp0,%fp1 # S(A4+...)
- fmul.x %fp0,%fp2 # S(B5+...)
-
- fadd.d SINA3(%pc),%fp1 # A3+S(A4+...)
- fadd.d COSB4(%pc),%fp2 # B4+S(B5+...)
-
- fmul.x %fp0,%fp1 # S(A3+...)
- fmul.x %fp0,%fp2 # S(B4+...)
-
- fadd.x SINA2(%pc),%fp1 # A2+S(A3+...)
- fadd.x COSB3(%pc),%fp2 # B3+S(B4+...)
-
- fmul.x %fp0,%fp1 # S(A2+...)
- fmul.x %fp0,%fp2 # S(B3+...)
-
- fadd.x SINA1(%pc),%fp1 # A1+S(A2+...)
- fadd.x COSB2(%pc),%fp2 # B2+S(B3+...)
-
- fmul.x %fp0,%fp1 # S(A1+...)
- fmul.x %fp2,%fp0 # S(B2+...)
-
- fmul.x RPRIME(%a6),%fp1 # R'S(A1+...)
- fadd.s COSB1(%pc),%fp0 # B1+S(B2...)
- fmul.x SPRIME(%a6),%fp0 # S'(B1+S(B2+...))
-
- fmovm.x (%sp)+,&0x20 # restore fp2
-
- fmov.l %d0,%fpcr
- fadd.x RPRIME(%a6),%fp1 # COS(X)
- bsr sto_cos # store cosine result
- fadd.s POSNEG1(%a6),%fp0 # SIN(X)
- bra t_inx2
-
-NEVEN:
-#--REGISTERS SAVED SO FAR: FP2.
- fmovm.x &0x04,-(%sp) # save fp2
-
- fmov.x %fp0,RPRIME(%a6)
- fmul.x %fp0,%fp0 # FP0 IS S = R*R
-
- fmov.d COSB8(%pc),%fp1 # B8
- fmov.d SINA7(%pc),%fp2 # A7
-
- fmul.x %fp0,%fp1 # SB8
- fmov.x %fp0,SPRIME(%a6)
- fmul.x %fp0,%fp2 # SA7
-
- ror.l &1,%d1
- and.l &0x80000000,%d1
-
- fadd.d COSB7(%pc),%fp1 # B7+SB8
- fadd.d SINA6(%pc),%fp2 # A6+SA7
-
- eor.l %d1,RPRIME(%a6)
- eor.l %d1,SPRIME(%a6)
-
- fmul.x %fp0,%fp1 # S(B7+SB8)
-
- or.l &0x3F800000,%d1
- mov.l %d1,POSNEG1(%a6)
-
- fmul.x %fp0,%fp2 # S(A6+SA7)
-
- fadd.d COSB6(%pc),%fp1 # B6+S(B7+SB8)
- fadd.d SINA5(%pc),%fp2 # A5+S(A6+SA7)
-
- fmul.x %fp0,%fp1 # S(B6+S(B7+SB8))
- fmul.x %fp0,%fp2 # S(A5+S(A6+SA7))
-
- fadd.d COSB5(%pc),%fp1 # B5+S(B6+S(B7+SB8))
- fadd.d SINA4(%pc),%fp2 # A4+S(A5+S(A6+SA7))
-
- fmul.x %fp0,%fp1 # S(B5+...)
- fmul.x %fp0,%fp2 # S(A4+...)
-
- fadd.d COSB4(%pc),%fp1 # B4+S(B5+...)
- fadd.d SINA3(%pc),%fp2 # A3+S(A4+...)
-
- fmul.x %fp0,%fp1 # S(B4+...)
- fmul.x %fp0,%fp2 # S(A3+...)
-
- fadd.x COSB3(%pc),%fp1 # B3+S(B4+...)
- fadd.x SINA2(%pc),%fp2 # A2+S(A3+...)
-
- fmul.x %fp0,%fp1 # S(B3+...)
- fmul.x %fp0,%fp2 # S(A2+...)
-
- fadd.x COSB2(%pc),%fp1 # B2+S(B3+...)
- fadd.x SINA1(%pc),%fp2 # A1+S(A2+...)
-
- fmul.x %fp0,%fp1 # S(B2+...)
- fmul.x %fp2,%fp0 # s(a1+...)
-
-
- fadd.s COSB1(%pc),%fp1 # B1+S(B2...)
- fmul.x RPRIME(%a6),%fp0 # R'S(A1+...)
- fmul.x SPRIME(%a6),%fp1 # S'(B1+S(B2+...))
-
- fmovm.x (%sp)+,&0x20 # restore fp2
-
- fmov.l %d0,%fpcr
- fadd.s POSNEG1(%a6),%fp1 # COS(X)
- bsr sto_cos # store cosine result
- fadd.x RPRIME(%a6),%fp0 # SIN(X)
- bra t_inx2
-
-################################################
-
-SCBORS:
- cmp.l %d1,&0x3FFF8000
- bgt.w SREDUCEX
-
-################################################
-
-SCSM:
-# mov.w &0x0000,XDCARE(%a6)
- fmov.s &0x3F800000,%fp1
-
- fmov.l %d0,%fpcr
- fsub.s &0x00800000,%fp1
- bsr sto_cos # store cosine result
- fmov.l %fpcr,%d0 # d0 must have fpcr,too
- mov.b &FMOV_OP,%d1 # last inst is MOVE
- fmov.x X(%a6),%fp0
- bra t_catch
-
-##############################################
-
- global ssincosd
-#--SIN AND COS OF X FOR DENORMALIZED X
-ssincosd:
- mov.l %d0,-(%sp) # save d0
- fmov.s &0x3F800000,%fp1
- bsr sto_cos # store cosine result
- mov.l (%sp)+,%d0 # restore d0
- bra t_extdnrm
-
-############################################
-
-#--WHEN REDUCEX IS USED, THE CODE WILL INEVITABLY BE SLOW.
-#--THIS REDUCTION METHOD, HOWEVER, IS MUCH FASTER THAN USING
-#--THE REMAINDER INSTRUCTION WHICH IS NOW IN SOFTWARE.
-SREDUCEX:
- fmovm.x &0x3c,-(%sp) # save {fp2-fp5}
- mov.l %d2,-(%sp) # save d2
- fmov.s &0x00000000,%fp1 # fp1 = 0
-
-#--If compact form of abs(arg) in d0=$7ffeffff, argument is so large that
-#--there is a danger of unwanted overflow in first LOOP iteration. In this
-#--case, reduce argument by one remainder step to make subsequent reduction
-#--safe.
- cmp.l %d1,&0x7ffeffff # is arg dangerously large?
- bne.b SLOOP # no
-
-# yes; create 2**16383*PI/2
- mov.w &0x7ffe,FP_SCR0_EX(%a6)
- mov.l &0xc90fdaa2,FP_SCR0_HI(%a6)
- clr.l FP_SCR0_LO(%a6)
-
-# create low half of 2**16383*PI/2 at FP_SCR1
- mov.w &0x7fdc,FP_SCR1_EX(%a6)
- mov.l &0x85a308d3,FP_SCR1_HI(%a6)
- clr.l FP_SCR1_LO(%a6)
-
- ftest.x %fp0 # test sign of argument
- fblt.w sred_neg
-
- or.b &0x80,FP_SCR0_EX(%a6) # positive arg
- or.b &0x80,FP_SCR1_EX(%a6)
-sred_neg:
- fadd.x FP_SCR0(%a6),%fp0 # high part of reduction is exact
- fmov.x %fp0,%fp1 # save high result in fp1
- fadd.x FP_SCR1(%a6),%fp0 # low part of reduction
- fsub.x %fp0,%fp1 # determine low component of result
- fadd.x FP_SCR1(%a6),%fp1 # fp0/fp1 are reduced argument.
-
-#--ON ENTRY, FP0 IS X, ON RETURN, FP0 IS X REM PI/2, |X| <= PI/4.
-#--integer quotient will be stored in N
-#--Intermeditate remainder is 66-bit long; (R,r) in (FP0,FP1)
-SLOOP:
- fmov.x %fp0,INARG(%a6) # +-2**K * F, 1 <= F < 2
- mov.w INARG(%a6),%d1
- mov.l %d1,%a1 # save a copy of D0
- and.l &0x00007FFF,%d1
- sub.l &0x00003FFF,%d1 # d0 = K
- cmp.l %d1,&28
- ble.b SLASTLOOP
-SCONTLOOP:
- sub.l &27,%d1 # d0 = L := K-27
- mov.b &0,ENDFLAG(%a6)
- bra.b SWORK
-SLASTLOOP:
- clr.l %d1 # d0 = L := 0
- mov.b &1,ENDFLAG(%a6)
-
-SWORK:
-#--FIND THE REMAINDER OF (R,r) W.R.T. 2**L * (PI/2). L IS SO CHOSEN
-#--THAT INT( X * (2/PI) / 2**(L) ) < 2**29.
-
-#--CREATE 2**(-L) * (2/PI), SIGN(INARG)*2**(63),
-#--2**L * (PIby2_1), 2**L * (PIby2_2)
-
- mov.l &0x00003FFE,%d2 # BIASED EXP OF 2/PI
- sub.l %d1,%d2 # BIASED EXP OF 2**(-L)*(2/PI)
-
- mov.l &0xA2F9836E,FP_SCR0_HI(%a6)
- mov.l &0x4E44152A,FP_SCR0_LO(%a6)
- mov.w %d2,FP_SCR0_EX(%a6) # FP_SCR0 = 2**(-L)*(2/PI)
-
- fmov.x %fp0,%fp2
- fmul.x FP_SCR0(%a6),%fp2 # fp2 = X * 2**(-L)*(2/PI)
-
-#--WE MUST NOW FIND INT(FP2). SINCE WE NEED THIS VALUE IN
-#--FLOATING POINT FORMAT, THE TWO FMOVE'S FMOVE.L FP <--> N
-#--WILL BE TOO INEFFICIENT. THE WAY AROUND IT IS THAT
-#--(SIGN(INARG)*2**63 + FP2) - SIGN(INARG)*2**63 WILL GIVE
-#--US THE DESIRED VALUE IN FLOATING POINT.
- mov.l %a1,%d2
- swap %d2
- and.l &0x80000000,%d2
- or.l &0x5F000000,%d2 # d2 = SIGN(INARG)*2**63 IN SGL
- mov.l %d2,TWOTO63(%a6)
- fadd.s TWOTO63(%a6),%fp2 # THE FRACTIONAL PART OF FP1 IS ROUNDED
- fsub.s TWOTO63(%a6),%fp2 # fp2 = N
-# fint.x %fp2
-
-#--CREATING 2**(L)*Piby2_1 and 2**(L)*Piby2_2
- mov.l %d1,%d2 # d2 = L
-
- add.l &0x00003FFF,%d2 # BIASED EXP OF 2**L * (PI/2)
- mov.w %d2,FP_SCR0_EX(%a6)
- mov.l &0xC90FDAA2,FP_SCR0_HI(%a6)
- clr.l FP_SCR0_LO(%a6) # FP_SCR0 = 2**(L) * Piby2_1
-
- add.l &0x00003FDD,%d1
- mov.w %d1,FP_SCR1_EX(%a6)
- mov.l &0x85A308D3,FP_SCR1_HI(%a6)
- clr.l FP_SCR1_LO(%a6) # FP_SCR1 = 2**(L) * Piby2_2
-
- mov.b ENDFLAG(%a6),%d1
-
-#--We are now ready to perform (R+r) - N*P1 - N*P2, P1 = 2**(L) * Piby2_1 and
-#--P2 = 2**(L) * Piby2_2
- fmov.x %fp2,%fp4 # fp4 = N
- fmul.x FP_SCR0(%a6),%fp4 # fp4 = W = N*P1
- fmov.x %fp2,%fp5 # fp5 = N
- fmul.x FP_SCR1(%a6),%fp5 # fp5 = w = N*P2
- fmov.x %fp4,%fp3 # fp3 = W = N*P1
-
-#--we want P+p = W+w but |p| <= half ulp of P
-#--Then, we need to compute A := R-P and a := r-p
- fadd.x %fp5,%fp3 # fp3 = P
- fsub.x %fp3,%fp4 # fp4 = W-P
-
- fsub.x %fp3,%fp0 # fp0 = A := R - P
- fadd.x %fp5,%fp4 # fp4 = p = (W-P)+w
-
- fmov.x %fp0,%fp3 # fp3 = A
- fsub.x %fp4,%fp1 # fp1 = a := r - p
-
-#--Now we need to normalize (A,a) to "new (R,r)" where R+r = A+a but
-#--|r| <= half ulp of R.
- fadd.x %fp1,%fp0 # fp0 = R := A+a
-#--No need to calculate r if this is the last loop
- cmp.b %d1,&0
- bgt.w SRESTORE
-
-#--Need to calculate r
- fsub.x %fp0,%fp3 # fp3 = A-R
- fadd.x %fp3,%fp1 # fp1 = r := (A-R)+a
- bra.w SLOOP
-
-SRESTORE:
- fmov.l %fp2,INT(%a6)
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x (%sp)+,&0x3c # restore {fp2-fp5}
-
- mov.l ADJN(%a6),%d1
- cmp.l %d1,&4
-
- blt.w SINCONT
- bra.w SCCONT
-
-#########################################################################
-# stan(): computes the tangent of a normalized input #
-# stand(): computes the tangent of a denormalized input #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input #
-# d0 = round precision,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = tan(X) #
-# #
-# ACCURACY and MONOTONICITY ******************************************* #
-# The returned result is within 3 ulp in 64 significant bit, i.e. #
-# within 0.5001 ulp to 53 bits if the result is subsequently #
-# rounded to double precision. The result is provably monotonic #
-# in double precision. #
-# #
-# ALGORITHM *********************************************************** #
-# #
-# 1. If |X| >= 15Pi or |X| < 2**(-40), go to 6. #
-# #
-# 2. Decompose X as X = N(Pi/2) + r where |r| <= Pi/4. Let #
-# k = N mod 2, so in particular, k = 0 or 1. #
-# #
-# 3. If k is odd, go to 5. #
-# #
-# 4. (k is even) Tan(X) = tan(r) and tan(r) is approximated by a #
-# rational function U/V where #
-# U = r + r*s*(P1 + s*(P2 + s*P3)), and #
-# V = 1 + s*(Q1 + s*(Q2 + s*(Q3 + s*Q4))), s = r*r. #
-# Exit. #
-# #
-# 4. (k is odd) Tan(X) = -cot(r). Since tan(r) is approximated by #
-# a rational function U/V where #
-# U = r + r*s*(P1 + s*(P2 + s*P3)), and #
-# V = 1 + s*(Q1 + s*(Q2 + s*(Q3 + s*Q4))), s = r*r, #
-# -Cot(r) = -V/U. Exit. #
-# #
-# 6. If |X| > 1, go to 8. #
-# #
-# 7. (|X|<2**(-40)) Tan(X) = X. Exit. #
-# #
-# 8. Overwrite X by X := X rem 2Pi. Now that |X| <= Pi, go back #
-# to 2. #
-# #
-#########################################################################
-
-TANQ4:
- long 0x3EA0B759,0xF50F8688
-TANP3:
- long 0xBEF2BAA5,0xA8924F04
-
-TANQ3:
- long 0xBF346F59,0xB39BA65F,0x00000000,0x00000000
-
-TANP2:
- long 0x3FF60000,0xE073D3FC,0x199C4A00,0x00000000
-
-TANQ2:
- long 0x3FF90000,0xD23CD684,0x15D95FA1,0x00000000
-
-TANP1:
- long 0xBFFC0000,0x8895A6C5,0xFB423BCA,0x00000000
-
-TANQ1:
- long 0xBFFD0000,0xEEF57E0D,0xA84BC8CE,0x00000000
-
-INVTWOPI:
- long 0x3FFC0000,0xA2F9836E,0x4E44152A,0x00000000
-
-TWOPI1:
- long 0x40010000,0xC90FDAA2,0x00000000,0x00000000
-TWOPI2:
- long 0x3FDF0000,0x85A308D4,0x00000000,0x00000000
-
-#--N*PI/2, -32 <= N <= 32, IN A LEADING TERM IN EXT. AND TRAILING
-#--TERM IN SGL. NOTE THAT PI IS 64-BIT LONG, THUS N*PI/2 IS AT
-#--MOST 69 BITS LONG.
-# global PITBL
-PITBL:
- long 0xC0040000,0xC90FDAA2,0x2168C235,0x21800000
- long 0xC0040000,0xC2C75BCD,0x105D7C23,0xA0D00000
- long 0xC0040000,0xBC7EDCF7,0xFF523611,0xA1E80000
- long 0xC0040000,0xB6365E22,0xEE46F000,0x21480000
- long 0xC0040000,0xAFEDDF4D,0xDD3BA9EE,0xA1200000
- long 0xC0040000,0xA9A56078,0xCC3063DD,0x21FC0000
- long 0xC0040000,0xA35CE1A3,0xBB251DCB,0x21100000
- long 0xC0040000,0x9D1462CE,0xAA19D7B9,0xA1580000
- long 0xC0040000,0x96CBE3F9,0x990E91A8,0x21E00000
- long 0xC0040000,0x90836524,0x88034B96,0x20B00000
- long 0xC0040000,0x8A3AE64F,0x76F80584,0xA1880000
- long 0xC0040000,0x83F2677A,0x65ECBF73,0x21C40000
- long 0xC0030000,0xFB53D14A,0xA9C2F2C2,0x20000000
- long 0xC0030000,0xEEC2D3A0,0x87AC669F,0x21380000
- long 0xC0030000,0xE231D5F6,0x6595DA7B,0xA1300000
- long 0xC0030000,0xD5A0D84C,0x437F4E58,0x9FC00000
- long 0xC0030000,0xC90FDAA2,0x2168C235,0x21000000
- long 0xC0030000,0xBC7EDCF7,0xFF523611,0xA1680000
- long 0xC0030000,0xAFEDDF4D,0xDD3BA9EE,0xA0A00000
- long 0xC0030000,0xA35CE1A3,0xBB251DCB,0x20900000
- long 0xC0030000,0x96CBE3F9,0x990E91A8,0x21600000
- long 0xC0030000,0x8A3AE64F,0x76F80584,0xA1080000
- long 0xC0020000,0xFB53D14A,0xA9C2F2C2,0x1F800000
- long 0xC0020000,0xE231D5F6,0x6595DA7B,0xA0B00000
- long 0xC0020000,0xC90FDAA2,0x2168C235,0x20800000
- long 0xC0020000,0xAFEDDF4D,0xDD3BA9EE,0xA0200000
- long 0xC0020000,0x96CBE3F9,0x990E91A8,0x20E00000
- long 0xC0010000,0xFB53D14A,0xA9C2F2C2,0x1F000000
- long 0xC0010000,0xC90FDAA2,0x2168C235,0x20000000
- long 0xC0010000,0x96CBE3F9,0x990E91A8,0x20600000
- long 0xC0000000,0xC90FDAA2,0x2168C235,0x1F800000
- long 0xBFFF0000,0xC90FDAA2,0x2168C235,0x1F000000
- long 0x00000000,0x00000000,0x00000000,0x00000000
- long 0x3FFF0000,0xC90FDAA2,0x2168C235,0x9F000000
- long 0x40000000,0xC90FDAA2,0x2168C235,0x9F800000
- long 0x40010000,0x96CBE3F9,0x990E91A8,0xA0600000
- long 0x40010000,0xC90FDAA2,0x2168C235,0xA0000000
- long 0x40010000,0xFB53D14A,0xA9C2F2C2,0x9F000000
- long 0x40020000,0x96CBE3F9,0x990E91A8,0xA0E00000
- long 0x40020000,0xAFEDDF4D,0xDD3BA9EE,0x20200000
- long 0x40020000,0xC90FDAA2,0x2168C235,0xA0800000
- long 0x40020000,0xE231D5F6,0x6595DA7B,0x20B00000
- long 0x40020000,0xFB53D14A,0xA9C2F2C2,0x9F800000
- long 0x40030000,0x8A3AE64F,0x76F80584,0x21080000
- long 0x40030000,0x96CBE3F9,0x990E91A8,0xA1600000
- long 0x40030000,0xA35CE1A3,0xBB251DCB,0xA0900000
- long 0x40030000,0xAFEDDF4D,0xDD3BA9EE,0x20A00000
- long 0x40030000,0xBC7EDCF7,0xFF523611,0x21680000
- long 0x40030000,0xC90FDAA2,0x2168C235,0xA1000000
- long 0x40030000,0xD5A0D84C,0x437F4E58,0x1FC00000
- long 0x40030000,0xE231D5F6,0x6595DA7B,0x21300000
- long 0x40030000,0xEEC2D3A0,0x87AC669F,0xA1380000
- long 0x40030000,0xFB53D14A,0xA9C2F2C2,0xA0000000
- long 0x40040000,0x83F2677A,0x65ECBF73,0xA1C40000
- long 0x40040000,0x8A3AE64F,0x76F80584,0x21880000
- long 0x40040000,0x90836524,0x88034B96,0xA0B00000
- long 0x40040000,0x96CBE3F9,0x990E91A8,0xA1E00000
- long 0x40040000,0x9D1462CE,0xAA19D7B9,0x21580000
- long 0x40040000,0xA35CE1A3,0xBB251DCB,0xA1100000
- long 0x40040000,0xA9A56078,0xCC3063DD,0xA1FC0000
- long 0x40040000,0xAFEDDF4D,0xDD3BA9EE,0x21200000
- long 0x40040000,0xB6365E22,0xEE46F000,0xA1480000
- long 0x40040000,0xBC7EDCF7,0xFF523611,0x21E80000
- long 0x40040000,0xC2C75BCD,0x105D7C23,0x20D00000
- long 0x40040000,0xC90FDAA2,0x2168C235,0xA1800000
-
- set INARG,FP_SCR0
-
- set TWOTO63,L_SCR1
- set INT,L_SCR1
- set ENDFLAG,L_SCR2
-
- global stan
-stan:
- fmov.x (%a0),%fp0 # LOAD INPUT
-
- mov.l (%a0),%d1
- mov.w 4(%a0),%d1
- and.l &0x7FFFFFFF,%d1
-
- cmp.l %d1,&0x3FD78000 # |X| >= 2**(-40)?
- bge.b TANOK1
- bra.w TANSM
-TANOK1:
- cmp.l %d1,&0x4004BC7E # |X| < 15 PI?
- blt.b TANMAIN
- bra.w REDUCEX
-
-TANMAIN:
-#--THIS IS THE USUAL CASE, |X| <= 15 PI.
-#--THE ARGUMENT REDUCTION IS DONE BY TABLE LOOK UP.
- fmov.x %fp0,%fp1
- fmul.d TWOBYPI(%pc),%fp1 # X*2/PI
-
- lea.l PITBL+0x200(%pc),%a1 # TABLE OF N*PI/2, N = -32,...,32
-
- fmov.l %fp1,%d1 # CONVERT TO INTEGER
-
- asl.l &4,%d1
- add.l %d1,%a1 # ADDRESS N*PIBY2 IN Y1, Y2
-
- fsub.x (%a1)+,%fp0 # X-Y1
-
- fsub.s (%a1),%fp0 # FP0 IS R = (X-Y1)-Y2
-
- ror.l &5,%d1
- and.l &0x80000000,%d1 # D0 WAS ODD IFF D0 < 0
-
-TANCONT:
- fmovm.x &0x0c,-(%sp) # save fp2,fp3
-
- cmp.l %d1,&0
- blt.w NODD
-
- fmov.x %fp0,%fp1
- fmul.x %fp1,%fp1 # S = R*R
-
- fmov.d TANQ4(%pc),%fp3
- fmov.d TANP3(%pc),%fp2
-
- fmul.x %fp1,%fp3 # SQ4
- fmul.x %fp1,%fp2 # SP3
-
- fadd.d TANQ3(%pc),%fp3 # Q3+SQ4
- fadd.x TANP2(%pc),%fp2 # P2+SP3
-
- fmul.x %fp1,%fp3 # S(Q3+SQ4)
- fmul.x %fp1,%fp2 # S(P2+SP3)
-
- fadd.x TANQ2(%pc),%fp3 # Q2+S(Q3+SQ4)
- fadd.x TANP1(%pc),%fp2 # P1+S(P2+SP3)
-
- fmul.x %fp1,%fp3 # S(Q2+S(Q3+SQ4))
- fmul.x %fp1,%fp2 # S(P1+S(P2+SP3))
-
- fadd.x TANQ1(%pc),%fp3 # Q1+S(Q2+S(Q3+SQ4))
- fmul.x %fp0,%fp2 # RS(P1+S(P2+SP3))
-
- fmul.x %fp3,%fp1 # S(Q1+S(Q2+S(Q3+SQ4)))
-
- fadd.x %fp2,%fp0 # R+RS(P1+S(P2+SP3))
-
- fadd.s &0x3F800000,%fp1 # 1+S(Q1+...)
-
- fmovm.x (%sp)+,&0x30 # restore fp2,fp3
-
- fmov.l %d0,%fpcr # restore users round mode,prec
- fdiv.x %fp1,%fp0 # last inst - possible exception set
- bra t_inx2
-
-NODD:
- fmov.x %fp0,%fp1
- fmul.x %fp0,%fp0 # S = R*R
-
- fmov.d TANQ4(%pc),%fp3
- fmov.d TANP3(%pc),%fp2
-
- fmul.x %fp0,%fp3 # SQ4
- fmul.x %fp0,%fp2 # SP3
-
- fadd.d TANQ3(%pc),%fp3 # Q3+SQ4
- fadd.x TANP2(%pc),%fp2 # P2+SP3
-
- fmul.x %fp0,%fp3 # S(Q3+SQ4)
- fmul.x %fp0,%fp2 # S(P2+SP3)
-
- fadd.x TANQ2(%pc),%fp3 # Q2+S(Q3+SQ4)
- fadd.x TANP1(%pc),%fp2 # P1+S(P2+SP3)
-
- fmul.x %fp0,%fp3 # S(Q2+S(Q3+SQ4))
- fmul.x %fp0,%fp2 # S(P1+S(P2+SP3))
-
- fadd.x TANQ1(%pc),%fp3 # Q1+S(Q2+S(Q3+SQ4))
- fmul.x %fp1,%fp2 # RS(P1+S(P2+SP3))
-
- fmul.x %fp3,%fp0 # S(Q1+S(Q2+S(Q3+SQ4)))
-
- fadd.x %fp2,%fp1 # R+RS(P1+S(P2+SP3))
- fadd.s &0x3F800000,%fp0 # 1+S(Q1+...)
-
- fmovm.x (%sp)+,&0x30 # restore fp2,fp3
-
- fmov.x %fp1,-(%sp)
- eor.l &0x80000000,(%sp)
-
- fmov.l %d0,%fpcr # restore users round mode,prec
- fdiv.x (%sp)+,%fp0 # last inst - possible exception set
- bra t_inx2
-
-TANBORS:
-#--IF |X| > 15PI, WE USE THE GENERAL ARGUMENT REDUCTION.
-#--IF |X| < 2**(-40), RETURN X OR 1.
- cmp.l %d1,&0x3FFF8000
- bgt.b REDUCEX
-
-TANSM:
- fmov.x %fp0,-(%sp)
- fmov.l %d0,%fpcr # restore users round mode,prec
- mov.b &FMOV_OP,%d1 # last inst is MOVE
- fmov.x (%sp)+,%fp0 # last inst - posibble exception set
- bra t_catch
-
- global stand
-#--TAN(X) = X FOR DENORMALIZED X
-stand:
- bra t_extdnrm
-
-#--WHEN REDUCEX IS USED, THE CODE WILL INEVITABLY BE SLOW.
-#--THIS REDUCTION METHOD, HOWEVER, IS MUCH FASTER THAN USING
-#--THE REMAINDER INSTRUCTION WHICH IS NOW IN SOFTWARE.
-REDUCEX:
- fmovm.x &0x3c,-(%sp) # save {fp2-fp5}
- mov.l %d2,-(%sp) # save d2
- fmov.s &0x00000000,%fp1 # fp1 = 0
-
-#--If compact form of abs(arg) in d0=$7ffeffff, argument is so large that
-#--there is a danger of unwanted overflow in first LOOP iteration. In this
-#--case, reduce argument by one remainder step to make subsequent reduction
-#--safe.
- cmp.l %d1,&0x7ffeffff # is arg dangerously large?
- bne.b LOOP # no
-
-# yes; create 2**16383*PI/2
- mov.w &0x7ffe,FP_SCR0_EX(%a6)
- mov.l &0xc90fdaa2,FP_SCR0_HI(%a6)
- clr.l FP_SCR0_LO(%a6)
-
-# create low half of 2**16383*PI/2 at FP_SCR1
- mov.w &0x7fdc,FP_SCR1_EX(%a6)
- mov.l &0x85a308d3,FP_SCR1_HI(%a6)
- clr.l FP_SCR1_LO(%a6)
-
- ftest.x %fp0 # test sign of argument
- fblt.w red_neg
-
- or.b &0x80,FP_SCR0_EX(%a6) # positive arg
- or.b &0x80,FP_SCR1_EX(%a6)
-red_neg:
- fadd.x FP_SCR0(%a6),%fp0 # high part of reduction is exact
- fmov.x %fp0,%fp1 # save high result in fp1
- fadd.x FP_SCR1(%a6),%fp0 # low part of reduction
- fsub.x %fp0,%fp1 # determine low component of result
- fadd.x FP_SCR1(%a6),%fp1 # fp0/fp1 are reduced argument.
-
-#--ON ENTRY, FP0 IS X, ON RETURN, FP0 IS X REM PI/2, |X| <= PI/4.
-#--integer quotient will be stored in N
-#--Intermeditate remainder is 66-bit long; (R,r) in (FP0,FP1)
-LOOP:
- fmov.x %fp0,INARG(%a6) # +-2**K * F, 1 <= F < 2
- mov.w INARG(%a6),%d1
- mov.l %d1,%a1 # save a copy of D0
- and.l &0x00007FFF,%d1
- sub.l &0x00003FFF,%d1 # d0 = K
- cmp.l %d1,&28
- ble.b LASTLOOP
-CONTLOOP:
- sub.l &27,%d1 # d0 = L := K-27
- mov.b &0,ENDFLAG(%a6)
- bra.b WORK
-LASTLOOP:
- clr.l %d1 # d0 = L := 0
- mov.b &1,ENDFLAG(%a6)
-
-WORK:
-#--FIND THE REMAINDER OF (R,r) W.R.T. 2**L * (PI/2). L IS SO CHOSEN
-#--THAT INT( X * (2/PI) / 2**(L) ) < 2**29.
-
-#--CREATE 2**(-L) * (2/PI), SIGN(INARG)*2**(63),
-#--2**L * (PIby2_1), 2**L * (PIby2_2)
-
- mov.l &0x00003FFE,%d2 # BIASED EXP OF 2/PI
- sub.l %d1,%d2 # BIASED EXP OF 2**(-L)*(2/PI)
-
- mov.l &0xA2F9836E,FP_SCR0_HI(%a6)
- mov.l &0x4E44152A,FP_SCR0_LO(%a6)
- mov.w %d2,FP_SCR0_EX(%a6) # FP_SCR0 = 2**(-L)*(2/PI)
-
- fmov.x %fp0,%fp2
- fmul.x FP_SCR0(%a6),%fp2 # fp2 = X * 2**(-L)*(2/PI)
-
-#--WE MUST NOW FIND INT(FP2). SINCE WE NEED THIS VALUE IN
-#--FLOATING POINT FORMAT, THE TWO FMOVE'S FMOVE.L FP <--> N
-#--WILL BE TOO INEFFICIENT. THE WAY AROUND IT IS THAT
-#--(SIGN(INARG)*2**63 + FP2) - SIGN(INARG)*2**63 WILL GIVE
-#--US THE DESIRED VALUE IN FLOATING POINT.
- mov.l %a1,%d2
- swap %d2
- and.l &0x80000000,%d2
- or.l &0x5F000000,%d2 # d2 = SIGN(INARG)*2**63 IN SGL
- mov.l %d2,TWOTO63(%a6)
- fadd.s TWOTO63(%a6),%fp2 # THE FRACTIONAL PART OF FP1 IS ROUNDED
- fsub.s TWOTO63(%a6),%fp2 # fp2 = N
-# fintrz.x %fp2,%fp2
-
-#--CREATING 2**(L)*Piby2_1 and 2**(L)*Piby2_2
- mov.l %d1,%d2 # d2 = L
-
- add.l &0x00003FFF,%d2 # BIASED EXP OF 2**L * (PI/2)
- mov.w %d2,FP_SCR0_EX(%a6)
- mov.l &0xC90FDAA2,FP_SCR0_HI(%a6)
- clr.l FP_SCR0_LO(%a6) # FP_SCR0 = 2**(L) * Piby2_1
-
- add.l &0x00003FDD,%d1
- mov.w %d1,FP_SCR1_EX(%a6)
- mov.l &0x85A308D3,FP_SCR1_HI(%a6)
- clr.l FP_SCR1_LO(%a6) # FP_SCR1 = 2**(L) * Piby2_2
-
- mov.b ENDFLAG(%a6),%d1
-
-#--We are now ready to perform (R+r) - N*P1 - N*P2, P1 = 2**(L) * Piby2_1 and
-#--P2 = 2**(L) * Piby2_2
- fmov.x %fp2,%fp4 # fp4 = N
- fmul.x FP_SCR0(%a6),%fp4 # fp4 = W = N*P1
- fmov.x %fp2,%fp5 # fp5 = N
- fmul.x FP_SCR1(%a6),%fp5 # fp5 = w = N*P2
- fmov.x %fp4,%fp3 # fp3 = W = N*P1
-
-#--we want P+p = W+w but |p| <= half ulp of P
-#--Then, we need to compute A := R-P and a := r-p
- fadd.x %fp5,%fp3 # fp3 = P
- fsub.x %fp3,%fp4 # fp4 = W-P
-
- fsub.x %fp3,%fp0 # fp0 = A := R - P
- fadd.x %fp5,%fp4 # fp4 = p = (W-P)+w
-
- fmov.x %fp0,%fp3 # fp3 = A
- fsub.x %fp4,%fp1 # fp1 = a := r - p
-
-#--Now we need to normalize (A,a) to "new (R,r)" where R+r = A+a but
-#--|r| <= half ulp of R.
- fadd.x %fp1,%fp0 # fp0 = R := A+a
-#--No need to calculate r if this is the last loop
- cmp.b %d1,&0
- bgt.w RESTORE
-
-#--Need to calculate r
- fsub.x %fp0,%fp3 # fp3 = A-R
- fadd.x %fp3,%fp1 # fp1 = r := (A-R)+a
- bra.w LOOP
-
-RESTORE:
- fmov.l %fp2,INT(%a6)
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x (%sp)+,&0x3c # restore {fp2-fp5}
-
- mov.l INT(%a6),%d1
- ror.l &1,%d1
-
- bra.w TANCONT
-
-#########################################################################
-# satan(): computes the arctangent of a normalized number #
-# satand(): computes the arctangent of a denormalized number #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input #
-# d0 = round precision,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = arctan(X) #
-# #
-# ACCURACY and MONOTONICITY ******************************************* #
-# The returned result is within 2 ulps in 64 significant bit, #
-# i.e. within 0.5001 ulp to 53 bits if the result is subsequently #
-# rounded to double precision. The result is provably monotonic #
-# in double precision. #
-# #
-# ALGORITHM *********************************************************** #
-# Step 1. If |X| >= 16 or |X| < 1/16, go to Step 5. #
-# #
-# Step 2. Let X = sgn * 2**k * 1.xxxxxxxx...x. #
-# Note that k = -4, -3,..., or 3. #
-# Define F = sgn * 2**k * 1.xxxx1, i.e. the first 5 #
-# significant bits of X with a bit-1 attached at the 6-th #
-# bit position. Define u to be u = (X-F) / (1 + X*F). #
-# #
-# Step 3. Approximate arctan(u) by a polynomial poly. #
-# #
-# Step 4. Return arctan(F) + poly, arctan(F) is fetched from a #
-# table of values calculated beforehand. Exit. #
-# #
-# Step 5. If |X| >= 16, go to Step 7. #
-# #
-# Step 6. Approximate arctan(X) by an odd polynomial in X. Exit. #
-# #
-# Step 7. Define X' = -1/X. Approximate arctan(X') by an odd #
-# polynomial in X'. #
-# Arctan(X) = sign(X)*Pi/2 + arctan(X'). Exit. #
-# #
-#########################################################################
-
-ATANA3: long 0xBFF6687E,0x314987D8
-ATANA2: long 0x4002AC69,0x34A26DB3
-ATANA1: long 0xBFC2476F,0x4E1DA28E
-
-ATANB6: long 0x3FB34444,0x7F876989
-ATANB5: long 0xBFB744EE,0x7FAF45DB
-ATANB4: long 0x3FBC71C6,0x46940220
-ATANB3: long 0xBFC24924,0x921872F9
-ATANB2: long 0x3FC99999,0x99998FA9
-ATANB1: long 0xBFD55555,0x55555555
-
-ATANC5: long 0xBFB70BF3,0x98539E6A
-ATANC4: long 0x3FBC7187,0x962D1D7D
-ATANC3: long 0xBFC24924,0x827107B8
-ATANC2: long 0x3FC99999,0x9996263E
-ATANC1: long 0xBFD55555,0x55555536
-
-PPIBY2: long 0x3FFF0000,0xC90FDAA2,0x2168C235,0x00000000
-NPIBY2: long 0xBFFF0000,0xC90FDAA2,0x2168C235,0x00000000
-
-PTINY: long 0x00010000,0x80000000,0x00000000,0x00000000
-NTINY: long 0x80010000,0x80000000,0x00000000,0x00000000
-
-ATANTBL:
- long 0x3FFB0000,0x83D152C5,0x060B7A51,0x00000000
- long 0x3FFB0000,0x8BC85445,0x65498B8B,0x00000000
- long 0x3FFB0000,0x93BE4060,0x17626B0D,0x00000000
- long 0x3FFB0000,0x9BB3078D,0x35AEC202,0x00000000
- long 0x3FFB0000,0xA3A69A52,0x5DDCE7DE,0x00000000
- long 0x3FFB0000,0xAB98E943,0x62765619,0x00000000
- long 0x3FFB0000,0xB389E502,0xF9C59862,0x00000000
- long 0x3FFB0000,0xBB797E43,0x6B09E6FB,0x00000000
- long 0x3FFB0000,0xC367A5C7,0x39E5F446,0x00000000
- long 0x3FFB0000,0xCB544C61,0xCFF7D5C6,0x00000000
- long 0x3FFB0000,0xD33F62F8,0x2488533E,0x00000000
- long 0x3FFB0000,0xDB28DA81,0x62404C77,0x00000000
- long 0x3FFB0000,0xE310A407,0x8AD34F18,0x00000000
- long 0x3FFB0000,0xEAF6B0A8,0x188EE1EB,0x00000000
- long 0x3FFB0000,0xF2DAF194,0x9DBE79D5,0x00000000
- long 0x3FFB0000,0xFABD5813,0x61D47E3E,0x00000000
- long 0x3FFC0000,0x8346AC21,0x0959ECC4,0x00000000
- long 0x3FFC0000,0x8B232A08,0x304282D8,0x00000000
- long 0x3FFC0000,0x92FB70B8,0xD29AE2F9,0x00000000
- long 0x3FFC0000,0x9ACF476F,0x5CCD1CB4,0x00000000
- long 0x3FFC0000,0xA29E7630,0x4954F23F,0x00000000
- long 0x3FFC0000,0xAA68C5D0,0x8AB85230,0x00000000
- long 0x3FFC0000,0xB22DFFFD,0x9D539F83,0x00000000
- long 0x3FFC0000,0xB9EDEF45,0x3E900EA5,0x00000000
- long 0x3FFC0000,0xC1A85F1C,0xC75E3EA5,0x00000000
- long 0x3FFC0000,0xC95D1BE8,0x28138DE6,0x00000000
- long 0x3FFC0000,0xD10BF300,0x840D2DE4,0x00000000
- long 0x3FFC0000,0xD8B4B2BA,0x6BC05E7A,0x00000000
- long 0x3FFC0000,0xE0572A6B,0xB42335F6,0x00000000
- long 0x3FFC0000,0xE7F32A70,0xEA9CAA8F,0x00000000
- long 0x3FFC0000,0xEF888432,0x64ECEFAA,0x00000000
- long 0x3FFC0000,0xF7170A28,0xECC06666,0x00000000
- long 0x3FFD0000,0x812FD288,0x332DAD32,0x00000000
- long 0x3FFD0000,0x88A8D1B1,0x218E4D64,0x00000000
- long 0x3FFD0000,0x9012AB3F,0x23E4AEE8,0x00000000
- long 0x3FFD0000,0x976CC3D4,0x11E7F1B9,0x00000000
- long 0x3FFD0000,0x9EB68949,0x3889A227,0x00000000
- long 0x3FFD0000,0xA5EF72C3,0x4487361B,0x00000000
- long 0x3FFD0000,0xAD1700BA,0xF07A7227,0x00000000
- long 0x3FFD0000,0xB42CBCFA,0xFD37EFB7,0x00000000
- long 0x3FFD0000,0xBB303A94,0x0BA80F89,0x00000000
- long 0x3FFD0000,0xC22115C6,0xFCAEBBAF,0x00000000
- long 0x3FFD0000,0xC8FEF3E6,0x86331221,0x00000000
- long 0x3FFD0000,0xCFC98330,0xB4000C70,0x00000000
- long 0x3FFD0000,0xD6807AA1,0x102C5BF9,0x00000000
- long 0x3FFD0000,0xDD2399BC,0x31252AA3,0x00000000
- long 0x3FFD0000,0xE3B2A855,0x6B8FC517,0x00000000
- long 0x3FFD0000,0xEA2D764F,0x64315989,0x00000000
- long 0x3FFD0000,0xF3BF5BF8,0xBAD1A21D,0x00000000
- long 0x3FFE0000,0x801CE39E,0x0D205C9A,0x00000000
- long 0x3FFE0000,0x8630A2DA,0xDA1ED066,0x00000000
- long 0x3FFE0000,0x8C1AD445,0xF3E09B8C,0x00000000
- long 0x3FFE0000,0x91DB8F16,0x64F350E2,0x00000000
- long 0x3FFE0000,0x97731420,0x365E538C,0x00000000
- long 0x3FFE0000,0x9CE1C8E6,0xA0B8CDBA,0x00000000
- long 0x3FFE0000,0xA22832DB,0xCADAAE09,0x00000000
- long 0x3FFE0000,0xA746F2DD,0xB7602294,0x00000000
- long 0x3FFE0000,0xAC3EC0FB,0x997DD6A2,0x00000000
- long 0x3FFE0000,0xB110688A,0xEBDC6F6A,0x00000000
- long 0x3FFE0000,0xB5BCC490,0x59ECC4B0,0x00000000
- long 0x3FFE0000,0xBA44BC7D,0xD470782F,0x00000000
- long 0x3FFE0000,0xBEA94144,0xFD049AAC,0x00000000
- long 0x3FFE0000,0xC2EB4ABB,0x661628B6,0x00000000
- long 0x3FFE0000,0xC70BD54C,0xE602EE14,0x00000000
- long 0x3FFE0000,0xCD000549,0xADEC7159,0x00000000
- long 0x3FFE0000,0xD48457D2,0xD8EA4EA3,0x00000000
- long 0x3FFE0000,0xDB948DA7,0x12DECE3B,0x00000000
- long 0x3FFE0000,0xE23855F9,0x69E8096A,0x00000000
- long 0x3FFE0000,0xE8771129,0xC4353259,0x00000000
- long 0x3FFE0000,0xEE57C16E,0x0D379C0D,0x00000000
- long 0x3FFE0000,0xF3E10211,0xA87C3779,0x00000000
- long 0x3FFE0000,0xF919039D,0x758B8D41,0x00000000
- long 0x3FFE0000,0xFE058B8F,0x64935FB3,0x00000000
- long 0x3FFF0000,0x8155FB49,0x7B685D04,0x00000000
- long 0x3FFF0000,0x83889E35,0x49D108E1,0x00000000
- long 0x3FFF0000,0x859CFA76,0x511D724B,0x00000000
- long 0x3FFF0000,0x87952ECF,0xFF8131E7,0x00000000
- long 0x3FFF0000,0x89732FD1,0x9557641B,0x00000000
- long 0x3FFF0000,0x8B38CAD1,0x01932A35,0x00000000
- long 0x3FFF0000,0x8CE7A8D8,0x301EE6B5,0x00000000
- long 0x3FFF0000,0x8F46A39E,0x2EAE5281,0x00000000
- long 0x3FFF0000,0x922DA7D7,0x91888487,0x00000000
- long 0x3FFF0000,0x94D19FCB,0xDEDF5241,0x00000000
- long 0x3FFF0000,0x973AB944,0x19D2A08B,0x00000000
- long 0x3FFF0000,0x996FF00E,0x08E10B96,0x00000000
- long 0x3FFF0000,0x9B773F95,0x12321DA7,0x00000000
- long 0x3FFF0000,0x9D55CC32,0x0F935624,0x00000000
- long 0x3FFF0000,0x9F100575,0x006CC571,0x00000000
- long 0x3FFF0000,0xA0A9C290,0xD97CC06C,0x00000000
- long 0x3FFF0000,0xA22659EB,0xEBC0630A,0x00000000
- long 0x3FFF0000,0xA388B4AF,0xF6EF0EC9,0x00000000
- long 0x3FFF0000,0xA4D35F10,0x61D292C4,0x00000000
- long 0x3FFF0000,0xA60895DC,0xFBE3187E,0x00000000
- long 0x3FFF0000,0xA72A51DC,0x7367BEAC,0x00000000
- long 0x3FFF0000,0xA83A5153,0x0956168F,0x00000000
- long 0x3FFF0000,0xA93A2007,0x7539546E,0x00000000
- long 0x3FFF0000,0xAA9E7245,0x023B2605,0x00000000
- long 0x3FFF0000,0xAC4C84BA,0x6FE4D58F,0x00000000
- long 0x3FFF0000,0xADCE4A4A,0x606B9712,0x00000000
- long 0x3FFF0000,0xAF2A2DCD,0x8D263C9C,0x00000000
- long 0x3FFF0000,0xB0656F81,0xF22265C7,0x00000000
- long 0x3FFF0000,0xB1846515,0x0F71496A,0x00000000
- long 0x3FFF0000,0xB28AAA15,0x6F9ADA35,0x00000000
- long 0x3FFF0000,0xB37B44FF,0x3766B895,0x00000000
- long 0x3FFF0000,0xB458C3DC,0xE9630433,0x00000000
- long 0x3FFF0000,0xB525529D,0x562246BD,0x00000000
- long 0x3FFF0000,0xB5E2CCA9,0x5F9D88CC,0x00000000
- long 0x3FFF0000,0xB692CADA,0x7ACA1ADA,0x00000000
- long 0x3FFF0000,0xB736AEA7,0xA6925838,0x00000000
- long 0x3FFF0000,0xB7CFAB28,0x7E9F7B36,0x00000000
- long 0x3FFF0000,0xB85ECC66,0xCB219835,0x00000000
- long 0x3FFF0000,0xB8E4FD5A,0x20A593DA,0x00000000
- long 0x3FFF0000,0xB99F41F6,0x4AFF9BB5,0x00000000
- long 0x3FFF0000,0xBA7F1E17,0x842BBE7B,0x00000000
- long 0x3FFF0000,0xBB471285,0x7637E17D,0x00000000
- long 0x3FFF0000,0xBBFABE8A,0x4788DF6F,0x00000000
- long 0x3FFF0000,0xBC9D0FAD,0x2B689D79,0x00000000
- long 0x3FFF0000,0xBD306A39,0x471ECD86,0x00000000
- long 0x3FFF0000,0xBDB6C731,0x856AF18A,0x00000000
- long 0x3FFF0000,0xBE31CAC5,0x02E80D70,0x00000000
- long 0x3FFF0000,0xBEA2D55C,0xE33194E2,0x00000000
- long 0x3FFF0000,0xBF0B10B7,0xC03128F0,0x00000000
- long 0x3FFF0000,0xBF6B7A18,0xDACB778D,0x00000000
- long 0x3FFF0000,0xBFC4EA46,0x63FA18F6,0x00000000
- long 0x3FFF0000,0xC0181BDE,0x8B89A454,0x00000000
- long 0x3FFF0000,0xC065B066,0xCFBF6439,0x00000000
- long 0x3FFF0000,0xC0AE345F,0x56340AE6,0x00000000
- long 0x3FFF0000,0xC0F22291,0x9CB9E6A7,0x00000000
-
- set X,FP_SCR0
- set XDCARE,X+2
- set XFRAC,X+4
- set XFRACLO,X+8
-
- set ATANF,FP_SCR1
- set ATANFHI,ATANF+4
- set ATANFLO,ATANF+8
-
- global satan
-#--ENTRY POINT FOR ATAN(X), HERE X IS FINITE, NON-ZERO, AND NOT NAN'S
-satan:
- fmov.x (%a0),%fp0 # LOAD INPUT
-
- mov.l (%a0),%d1
- mov.w 4(%a0),%d1
- fmov.x %fp0,X(%a6)
- and.l &0x7FFFFFFF,%d1
-
- cmp.l %d1,&0x3FFB8000 # |X| >= 1/16?
- bge.b ATANOK1
- bra.w ATANSM
-
-ATANOK1:
- cmp.l %d1,&0x4002FFFF # |X| < 16 ?
- ble.b ATANMAIN
- bra.w ATANBIG
-
-#--THE MOST LIKELY CASE, |X| IN [1/16, 16). WE USE TABLE TECHNIQUE
-#--THE IDEA IS ATAN(X) = ATAN(F) + ATAN( [X-F] / [1+XF] ).
-#--SO IF F IS CHOSEN TO BE CLOSE TO X AND ATAN(F) IS STORED IN
-#--A TABLE, ALL WE NEED IS TO APPROXIMATE ATAN(U) WHERE
-#--U = (X-F)/(1+XF) IS SMALL (REMEMBER F IS CLOSE TO X). IT IS
-#--TRUE THAT A DIVIDE IS NOW NEEDED, BUT THE APPROXIMATION FOR
-#--ATAN(U) IS A VERY SHORT POLYNOMIAL AND THE INDEXING TO
-#--FETCH F AND SAVING OF REGISTERS CAN BE ALL HIDED UNDER THE
-#--DIVIDE. IN THE END THIS METHOD IS MUCH FASTER THAN A TRADITIONAL
-#--ONE. NOTE ALSO THAT THE TRADITIONAL SCHEME THAT APPROXIMATE
-#--ATAN(X) DIRECTLY WILL NEED TO USE A RATIONAL APPROXIMATION
-#--(DIVISION NEEDED) ANYWAY BECAUSE A POLYNOMIAL APPROXIMATION
-#--WILL INVOLVE A VERY LONG POLYNOMIAL.
-
-#--NOW WE SEE X AS +-2^K * 1.BBBBBBB....B <- 1. + 63 BITS
-#--WE CHOSE F TO BE +-2^K * 1.BBBB1
-#--THAT IS IT MATCHES THE EXPONENT AND FIRST 5 BITS OF X, THE
-#--SIXTH BITS IS SET TO BE 1. SINCE K = -4, -3, ..., 3, THERE
-#--ARE ONLY 8 TIMES 16 = 2^7 = 128 |F|'S. SINCE ATAN(-|F|) IS
-#-- -ATAN(|F|), WE NEED TO STORE ONLY ATAN(|F|).
-
-ATANMAIN:
-
- and.l &0xF8000000,XFRAC(%a6) # FIRST 5 BITS
- or.l &0x04000000,XFRAC(%a6) # SET 6-TH BIT TO 1
- mov.l &0x00000000,XFRACLO(%a6) # LOCATION OF X IS NOW F
-
- fmov.x %fp0,%fp1 # FP1 IS X
- fmul.x X(%a6),%fp1 # FP1 IS X*F, NOTE THAT X*F > 0
- fsub.x X(%a6),%fp0 # FP0 IS X-F
- fadd.s &0x3F800000,%fp1 # FP1 IS 1 + X*F
- fdiv.x %fp1,%fp0 # FP0 IS U = (X-F)/(1+X*F)
-
-#--WHILE THE DIVISION IS TAKING ITS TIME, WE FETCH ATAN(|F|)
-#--CREATE ATAN(F) AND STORE IT IN ATANF, AND
-#--SAVE REGISTERS FP2.
-
- mov.l %d2,-(%sp) # SAVE d2 TEMPORARILY
- mov.l %d1,%d2 # THE EXP AND 16 BITS OF X
- and.l &0x00007800,%d1 # 4 VARYING BITS OF F'S FRACTION
- and.l &0x7FFF0000,%d2 # EXPONENT OF F
- sub.l &0x3FFB0000,%d2 # K+4
- asr.l &1,%d2
- add.l %d2,%d1 # THE 7 BITS IDENTIFYING F
- asr.l &7,%d1 # INDEX INTO TBL OF ATAN(|F|)
- lea ATANTBL(%pc),%a1
- add.l %d1,%a1 # ADDRESS OF ATAN(|F|)
- mov.l (%a1)+,ATANF(%a6)
- mov.l (%a1)+,ATANFHI(%a6)
- mov.l (%a1)+,ATANFLO(%a6) # ATANF IS NOW ATAN(|F|)
- mov.l X(%a6),%d1 # LOAD SIGN AND EXPO. AGAIN
- and.l &0x80000000,%d1 # SIGN(F)
- or.l %d1,ATANF(%a6) # ATANF IS NOW SIGN(F)*ATAN(|F|)
- mov.l (%sp)+,%d2 # RESTORE d2
-
-#--THAT'S ALL I HAVE TO DO FOR NOW,
-#--BUT ALAS, THE DIVIDE IS STILL CRANKING!
-
-#--U IN FP0, WE ARE NOW READY TO COMPUTE ATAN(U) AS
-#--U + A1*U*V*(A2 + V*(A3 + V)), V = U*U
-#--THE POLYNOMIAL MAY LOOK STRANGE, BUT IS NEVERTHELESS CORRECT.
-#--THE NATURAL FORM IS U + U*V*(A1 + V*(A2 + V*A3))
-#--WHAT WE HAVE HERE IS MERELY A1 = A3, A2 = A1/A3, A3 = A2/A3.
-#--THE REASON FOR THIS REARRANGEMENT IS TO MAKE THE INDEPENDENT
-#--PARTS A1*U*V AND (A2 + ... STUFF) MORE LOAD-BALANCED
-
- fmovm.x &0x04,-(%sp) # save fp2
-
- fmov.x %fp0,%fp1
- fmul.x %fp1,%fp1
- fmov.d ATANA3(%pc),%fp2
- fadd.x %fp1,%fp2 # A3+V
- fmul.x %fp1,%fp2 # V*(A3+V)
- fmul.x %fp0,%fp1 # U*V
- fadd.d ATANA2(%pc),%fp2 # A2+V*(A3+V)
- fmul.d ATANA1(%pc),%fp1 # A1*U*V
- fmul.x %fp2,%fp1 # A1*U*V*(A2+V*(A3+V))
- fadd.x %fp1,%fp0 # ATAN(U), FP1 RELEASED
-
- fmovm.x (%sp)+,&0x20 # restore fp2
-
- fmov.l %d0,%fpcr # restore users rnd mode,prec
- fadd.x ATANF(%a6),%fp0 # ATAN(X)
- bra t_inx2
-
-ATANBORS:
-#--|X| IS IN d0 IN COMPACT FORM. FP1, d0 SAVED.
-#--FP0 IS X AND |X| <= 1/16 OR |X| >= 16.
- cmp.l %d1,&0x3FFF8000
- bgt.w ATANBIG # I.E. |X| >= 16
-
-ATANSM:
-#--|X| <= 1/16
-#--IF |X| < 2^(-40), RETURN X AS ANSWER. OTHERWISE, APPROXIMATE
-#--ATAN(X) BY X + X*Y*(B1+Y*(B2+Y*(B3+Y*(B4+Y*(B5+Y*B6)))))
-#--WHICH IS X + X*Y*( [B1+Z*(B3+Z*B5)] + [Y*(B2+Z*(B4+Z*B6)] )
-#--WHERE Y = X*X, AND Z = Y*Y.
-
- cmp.l %d1,&0x3FD78000
- blt.w ATANTINY
-
-#--COMPUTE POLYNOMIAL
- fmovm.x &0x0c,-(%sp) # save fp2/fp3
-
- fmul.x %fp0,%fp0 # FPO IS Y = X*X
-
- fmov.x %fp0,%fp1
- fmul.x %fp1,%fp1 # FP1 IS Z = Y*Y
-
- fmov.d ATANB6(%pc),%fp2
- fmov.d ATANB5(%pc),%fp3
-
- fmul.x %fp1,%fp2 # Z*B6
- fmul.x %fp1,%fp3 # Z*B5
-
- fadd.d ATANB4(%pc),%fp2 # B4+Z*B6
- fadd.d ATANB3(%pc),%fp3 # B3+Z*B5
-
- fmul.x %fp1,%fp2 # Z*(B4+Z*B6)
- fmul.x %fp3,%fp1 # Z*(B3+Z*B5)
-
- fadd.d ATANB2(%pc),%fp2 # B2+Z*(B4+Z*B6)
- fadd.d ATANB1(%pc),%fp1 # B1+Z*(B3+Z*B5)
-
- fmul.x %fp0,%fp2 # Y*(B2+Z*(B4+Z*B6))
- fmul.x X(%a6),%fp0 # X*Y
-
- fadd.x %fp2,%fp1 # [B1+Z*(B3+Z*B5)]+[Y*(B2+Z*(B4+Z*B6))]
-
- fmul.x %fp1,%fp0 # X*Y*([B1+Z*(B3+Z*B5)]+[Y*(B2+Z*(B4+Z*B6))])
-
- fmovm.x (%sp)+,&0x30 # restore fp2/fp3
-
- fmov.l %d0,%fpcr # restore users rnd mode,prec
- fadd.x X(%a6),%fp0
- bra t_inx2
-
-ATANTINY:
-#--|X| < 2^(-40), ATAN(X) = X
-
- fmov.l %d0,%fpcr # restore users rnd mode,prec
- mov.b &FMOV_OP,%d1 # last inst is MOVE
- fmov.x X(%a6),%fp0 # last inst - possible exception set
-
- bra t_catch
-
-ATANBIG:
-#--IF |X| > 2^(100), RETURN SIGN(X)*(PI/2 - TINY). OTHERWISE,
-#--RETURN SIGN(X)*PI/2 + ATAN(-1/X).
- cmp.l %d1,&0x40638000
- bgt.w ATANHUGE
-
-#--APPROXIMATE ATAN(-1/X) BY
-#--X'+X'*Y*(C1+Y*(C2+Y*(C3+Y*(C4+Y*C5)))), X' = -1/X, Y = X'*X'
-#--THIS CAN BE RE-WRITTEN AS
-#--X'+X'*Y*( [C1+Z*(C3+Z*C5)] + [Y*(C2+Z*C4)] ), Z = Y*Y.
-
- fmovm.x &0x0c,-(%sp) # save fp2/fp3
-
- fmov.s &0xBF800000,%fp1 # LOAD -1
- fdiv.x %fp0,%fp1 # FP1 IS -1/X
-
-#--DIVIDE IS STILL CRANKING
-
- fmov.x %fp1,%fp0 # FP0 IS X'
- fmul.x %fp0,%fp0 # FP0 IS Y = X'*X'
- fmov.x %fp1,X(%a6) # X IS REALLY X'
-
- fmov.x %fp0,%fp1
- fmul.x %fp1,%fp1 # FP1 IS Z = Y*Y
-
- fmov.d ATANC5(%pc),%fp3
- fmov.d ATANC4(%pc),%fp2
-
- fmul.x %fp1,%fp3 # Z*C5
- fmul.x %fp1,%fp2 # Z*B4
-
- fadd.d ATANC3(%pc),%fp3 # C3+Z*C5
- fadd.d ATANC2(%pc),%fp2 # C2+Z*C4
-
- fmul.x %fp3,%fp1 # Z*(C3+Z*C5), FP3 RELEASED
- fmul.x %fp0,%fp2 # Y*(C2+Z*C4)
-
- fadd.d ATANC1(%pc),%fp1 # C1+Z*(C3+Z*C5)
- fmul.x X(%a6),%fp0 # X'*Y
-
- fadd.x %fp2,%fp1 # [Y*(C2+Z*C4)]+[C1+Z*(C3+Z*C5)]
-
- fmul.x %fp1,%fp0 # X'*Y*([B1+Z*(B3+Z*B5)]
-# ... +[Y*(B2+Z*(B4+Z*B6))])
- fadd.x X(%a6),%fp0
-
- fmovm.x (%sp)+,&0x30 # restore fp2/fp3
-
- fmov.l %d0,%fpcr # restore users rnd mode,prec
- tst.b (%a0)
- bpl.b pos_big
-
-neg_big:
- fadd.x NPIBY2(%pc),%fp0
- bra t_minx2
-
-pos_big:
- fadd.x PPIBY2(%pc),%fp0
- bra t_pinx2
-
-ATANHUGE:
-#--RETURN SIGN(X)*(PIBY2 - TINY) = SIGN(X)*PIBY2 - SIGN(X)*TINY
- tst.b (%a0)
- bpl.b pos_huge
-
-neg_huge:
- fmov.x NPIBY2(%pc),%fp0
- fmov.l %d0,%fpcr
- fadd.x PTINY(%pc),%fp0
- bra t_minx2
-
-pos_huge:
- fmov.x PPIBY2(%pc),%fp0
- fmov.l %d0,%fpcr
- fadd.x NTINY(%pc),%fp0
- bra t_pinx2
-
- global satand
-#--ENTRY POINT FOR ATAN(X) FOR DENORMALIZED ARGUMENT
-satand:
- bra t_extdnrm
-
-#########################################################################
-# sasin(): computes the inverse sine of a normalized input #
-# sasind(): computes the inverse sine of a denormalized input #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input #
-# d0 = round precision,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = arcsin(X) #
-# #
-# ACCURACY and MONOTONICITY ******************************************* #
-# The returned result is within 3 ulps in 64 significant bit, #
-# i.e. within 0.5001 ulp to 53 bits if the result is subsequently #
-# rounded to double precision. The result is provably monotonic #
-# in double precision. #
-# #
-# ALGORITHM *********************************************************** #
-# #
-# ASIN #
-# 1. If |X| >= 1, go to 3. #
-# #
-# 2. (|X| < 1) Calculate asin(X) by #
-# z := sqrt( [1-X][1+X] ) #
-# asin(X) = atan( x / z ). #
-# Exit. #
-# #
-# 3. If |X| > 1, go to 5. #
-# #
-# 4. (|X| = 1) sgn := sign(X), return asin(X) := sgn * Pi/2. Exit.#
-# #
-# 5. (|X| > 1) Generate an invalid operation by 0 * infinity. #
-# Exit. #
-# #
-#########################################################################
-
- global sasin
-sasin:
- fmov.x (%a0),%fp0 # LOAD INPUT
-
- mov.l (%a0),%d1
- mov.w 4(%a0),%d1
- and.l &0x7FFFFFFF,%d1
- cmp.l %d1,&0x3FFF8000
- bge.b ASINBIG
-
-# This catch is added here for the '060 QSP. Originally, the call to
-# satan() would handle this case by causing the exception which would
-# not be caught until gen_except(). Now, with the exceptions being
-# detected inside of satan(), the exception would have been handled there
-# instead of inside sasin() as expected.
- cmp.l %d1,&0x3FD78000
- blt.w ASINTINY
-
-#--THIS IS THE USUAL CASE, |X| < 1
-#--ASIN(X) = ATAN( X / SQRT( (1-X)(1+X) ) )
-
-ASINMAIN:
- fmov.s &0x3F800000,%fp1
- fsub.x %fp0,%fp1 # 1-X
- fmovm.x &0x4,-(%sp) # {fp2}
- fmov.s &0x3F800000,%fp2
- fadd.x %fp0,%fp2 # 1+X
- fmul.x %fp2,%fp1 # (1+X)(1-X)
- fmovm.x (%sp)+,&0x20 # {fp2}
- fsqrt.x %fp1 # SQRT([1-X][1+X])
- fdiv.x %fp1,%fp0 # X/SQRT([1-X][1+X])
- fmovm.x &0x01,-(%sp) # save X/SQRT(...)
- lea (%sp),%a0 # pass ptr to X/SQRT(...)
- bsr satan
- add.l &0xc,%sp # clear X/SQRT(...) from stack
- bra t_inx2
-
-ASINBIG:
- fabs.x %fp0 # |X|
- fcmp.s %fp0,&0x3F800000
- fbgt t_operr # cause an operr exception
-
-#--|X| = 1, ASIN(X) = +- PI/2.
-ASINONE:
- fmov.x PIBY2(%pc),%fp0
- mov.l (%a0),%d1
- and.l &0x80000000,%d1 # SIGN BIT OF X
- or.l &0x3F800000,%d1 # +-1 IN SGL FORMAT
- mov.l %d1,-(%sp) # push SIGN(X) IN SGL-FMT
- fmov.l %d0,%fpcr
- fmul.s (%sp)+,%fp0
- bra t_inx2
-
-#--|X| < 2^(-40), ATAN(X) = X
-ASINTINY:
- fmov.l %d0,%fpcr # restore users rnd mode,prec
- mov.b &FMOV_OP,%d1 # last inst is MOVE
- fmov.x (%a0),%fp0 # last inst - possible exception
- bra t_catch
-
- global sasind
-#--ASIN(X) = X FOR DENORMALIZED X
-sasind:
- bra t_extdnrm
-
-#########################################################################
-# sacos(): computes the inverse cosine of a normalized input #
-# sacosd(): computes the inverse cosine of a denormalized input #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input #
-# d0 = round precision,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = arccos(X) #
-# #
-# ACCURACY and MONOTONICITY ******************************************* #
-# The returned result is within 3 ulps in 64 significant bit, #
-# i.e. within 0.5001 ulp to 53 bits if the result is subsequently #
-# rounded to double precision. The result is provably monotonic #
-# in double precision. #
-# #
-# ALGORITHM *********************************************************** #
-# #
-# ACOS #
-# 1. If |X| >= 1, go to 3. #
-# #
-# 2. (|X| < 1) Calculate acos(X) by #
-# z := (1-X) / (1+X) #
-# acos(X) = 2 * atan( sqrt(z) ). #
-# Exit. #
-# #
-# 3. If |X| > 1, go to 5. #
-# #
-# 4. (|X| = 1) If X > 0, return 0. Otherwise, return Pi. Exit. #
-# #
-# 5. (|X| > 1) Generate an invalid operation by 0 * infinity. #
-# Exit. #
-# #
-#########################################################################
-
- global sacos
-sacos:
- fmov.x (%a0),%fp0 # LOAD INPUT
-
- mov.l (%a0),%d1 # pack exp w/ upper 16 fraction
- mov.w 4(%a0),%d1
- and.l &0x7FFFFFFF,%d1
- cmp.l %d1,&0x3FFF8000
- bge.b ACOSBIG
-
-#--THIS IS THE USUAL CASE, |X| < 1
-#--ACOS(X) = 2 * ATAN( SQRT( (1-X)/(1+X) ) )
-
-ACOSMAIN:
- fmov.s &0x3F800000,%fp1
- fadd.x %fp0,%fp1 # 1+X
- fneg.x %fp0 # -X
- fadd.s &0x3F800000,%fp0 # 1-X
- fdiv.x %fp1,%fp0 # (1-X)/(1+X)
- fsqrt.x %fp0 # SQRT((1-X)/(1+X))
- mov.l %d0,-(%sp) # save original users fpcr
- clr.l %d0
- fmovm.x &0x01,-(%sp) # save SQRT(...) to stack
- lea (%sp),%a0 # pass ptr to sqrt
- bsr satan # ATAN(SQRT([1-X]/[1+X]))
- add.l &0xc,%sp # clear SQRT(...) from stack
-
- fmov.l (%sp)+,%fpcr # restore users round prec,mode
- fadd.x %fp0,%fp0 # 2 * ATAN( STUFF )
- bra t_pinx2
-
-ACOSBIG:
- fabs.x %fp0
- fcmp.s %fp0,&0x3F800000
- fbgt t_operr # cause an operr exception
-
-#--|X| = 1, ACOS(X) = 0 OR PI
- tst.b (%a0) # is X positive or negative?
- bpl.b ACOSP1
-
-#--X = -1
-#Returns PI and inexact exception
-ACOSM1:
- fmov.x PI(%pc),%fp0 # load PI
- fmov.l %d0,%fpcr # load round mode,prec
- fadd.s &0x00800000,%fp0 # add a small value
- bra t_pinx2
-
-ACOSP1:
- bra ld_pzero # answer is positive zero
-
- global sacosd
-#--ACOS(X) = PI/2 FOR DENORMALIZED X
-sacosd:
- fmov.l %d0,%fpcr # load user's rnd mode/prec
- fmov.x PIBY2(%pc),%fp0
- bra t_pinx2
-
-#########################################################################
-# setox(): computes the exponential for a normalized input #
-# setoxd(): computes the exponential for a denormalized input #
-# setoxm1(): computes the exponential minus 1 for a normalized input #
-# setoxm1d(): computes the exponential minus 1 for a denormalized input #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input #
-# d0 = round precision,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = exp(X) or exp(X)-1 #
-# #
-# ACCURACY and MONOTONICITY ******************************************* #
-# The returned result is within 0.85 ulps in 64 significant bit, #
-# i.e. within 0.5001 ulp to 53 bits if the result is subsequently #
-# rounded to double precision. The result is provably monotonic #
-# in double precision. #
-# #
-# ALGORITHM and IMPLEMENTATION **************************************** #
-# #
-# setoxd #
-# ------ #
-# Step 1. Set ans := 1.0 #
-# #
-# Step 2. Return ans := ans + sign(X)*2^(-126). Exit. #
-# Notes: This will always generate one exception -- inexact. #
-# #
-# #
-# setox #
-# ----- #
-# #
-# Step 1. Filter out extreme cases of input argument. #
-# 1.1 If |X| >= 2^(-65), go to Step 1.3. #
-# 1.2 Go to Step 7. #
-# 1.3 If |X| < 16380 log(2), go to Step 2. #
-# 1.4 Go to Step 8. #
-# Notes: The usual case should take the branches 1.1 -> 1.3 -> 2.#
-# To avoid the use of floating-point comparisons, a #
-# compact representation of |X| is used. This format is a #
-# 32-bit integer, the upper (more significant) 16 bits #
-# are the sign and biased exponent field of |X|; the #
-# lower 16 bits are the 16 most significant fraction #
-# (including the explicit bit) bits of |X|. Consequently, #
-# the comparisons in Steps 1.1 and 1.3 can be performed #
-# by integer comparison. Note also that the constant #
-# 16380 log(2) used in Step 1.3 is also in the compact #
-# form. Thus taking the branch to Step 2 guarantees #
-# |X| < 16380 log(2). There is no harm to have a small #
-# number of cases where |X| is less than, but close to, #
-# 16380 log(2) and the branch to Step 9 is taken. #
-# #
-# Step 2. Calculate N = round-to-nearest-int( X * 64/log2 ). #
-# 2.1 Set AdjFlag := 0 (indicates the branch 1.3 -> 2 #
-# was taken) #
-# 2.2 N := round-to-nearest-integer( X * 64/log2 ). #
-# 2.3 Calculate J = N mod 64; so J = 0,1,2,..., #
-# or 63. #
-# 2.4 Calculate M = (N - J)/64; so N = 64M + J. #
-# 2.5 Calculate the address of the stored value of #
-# 2^(J/64). #
-# 2.6 Create the value Scale = 2^M. #
-# Notes: The calculation in 2.2 is really performed by #
-# Z := X * constant #
-# N := round-to-nearest-integer(Z) #
-# where #
-# constant := single-precision( 64/log 2 ). #
-# #
-# Using a single-precision constant avoids memory #
-# access. Another effect of using a single-precision #
-# "constant" is that the calculated value Z is #
-# #
-# Z = X*(64/log2)*(1+eps), |eps| <= 2^(-24). #
-# #
-# This error has to be considered later in Steps 3 and 4. #
-# #
-# Step 3. Calculate X - N*log2/64. #
-# 3.1 R := X + N*L1, #
-# where L1 := single-precision(-log2/64). #
-# 3.2 R := R + N*L2, #
-# L2 := extended-precision(-log2/64 - L1).#
-# Notes: a) The way L1 and L2 are chosen ensures L1+L2 #
-# approximate the value -log2/64 to 88 bits of accuracy. #
-# b) N*L1 is exact because N is no longer than 22 bits #
-# and L1 is no longer than 24 bits. #
-# c) The calculation X+N*L1 is also exact due to #
-# cancellation. Thus, R is practically X+N(L1+L2) to full #
-# 64 bits. #
-# d) It is important to estimate how large can |R| be #
-# after Step 3.2. #
-# #
-# N = rnd-to-int( X*64/log2 (1+eps) ), |eps|<=2^(-24) #
-# X*64/log2 (1+eps) = N + f, |f| <= 0.5 #
-# X*64/log2 - N = f - eps*X 64/log2 #
-# X - N*log2/64 = f*log2/64 - eps*X #
-# #
-# #
-# Now |X| <= 16446 log2, thus #
-# #
-# |X - N*log2/64| <= (0.5 + 16446/2^(18))*log2/64 #
-# <= 0.57 log2/64. #
-# This bound will be used in Step 4. #
-# #
-# Step 4. Approximate exp(R)-1 by a polynomial #
-# p = R + R*R*(A1 + R*(A2 + R*(A3 + R*(A4 + R*A5)))) #
-# Notes: a) In order to reduce memory access, the coefficients #
-# are made as "short" as possible: A1 (which is 1/2), A4 #
-# and A5 are single precision; A2 and A3 are double #
-# precision. #
-# b) Even with the restrictions above, #
-# |p - (exp(R)-1)| < 2^(-68.8) for all |R| <= 0.0062. #
-# Note that 0.0062 is slightly bigger than 0.57 log2/64. #
-# c) To fully utilize the pipeline, p is separated into #
-# two independent pieces of roughly equal complexities #
-# p = [ R + R*S*(A2 + S*A4) ] + #
-# [ S*(A1 + S*(A3 + S*A5)) ] #
-# where S = R*R. #
-# #
-# Step 5. Compute 2^(J/64)*exp(R) = 2^(J/64)*(1+p) by #
-# ans := T + ( T*p + t) #
-# where T and t are the stored values for 2^(J/64). #
-# Notes: 2^(J/64) is stored as T and t where T+t approximates #
-# 2^(J/64) to roughly 85 bits; T is in extended precision #
-# and t is in single precision. Note also that T is #
-# rounded to 62 bits so that the last two bits of T are #
-# zero. The reason for such a special form is that T-1, #
-# T-2, and T-8 will all be exact --- a property that will #
-# give much more accurate computation of the function #
-# EXPM1. #
-# #
-# Step 6. Reconstruction of exp(X) #
-# exp(X) = 2^M * 2^(J/64) * exp(R). #
-# 6.1 If AdjFlag = 0, go to 6.3 #
-# 6.2 ans := ans * AdjScale #
-# 6.3 Restore the user FPCR #
-# 6.4 Return ans := ans * Scale. Exit. #
-# Notes: If AdjFlag = 0, we have X = Mlog2 + Jlog2/64 + R, #
-# |M| <= 16380, and Scale = 2^M. Moreover, exp(X) will #
-# neither overflow nor underflow. If AdjFlag = 1, that #
-# means that #
-# X = (M1+M)log2 + Jlog2/64 + R, |M1+M| >= 16380. #
-# Hence, exp(X) may overflow or underflow or neither. #
-# When that is the case, AdjScale = 2^(M1) where M1 is #
-# approximately M. Thus 6.2 will never cause #
-# over/underflow. Possible exception in 6.4 is overflow #
-# or underflow. The inexact exception is not generated in #
-# 6.4. Although one can argue that the inexact flag #
-# should always be raised, to simulate that exception #
-# cost to much than the flag is worth in practical uses. #
-# #
-# Step 7. Return 1 + X. #
-# 7.1 ans := X #
-# 7.2 Restore user FPCR. #
-# 7.3 Return ans := 1 + ans. Exit #
-# Notes: For non-zero X, the inexact exception will always be #
-# raised by 7.3. That is the only exception raised by 7.3.#
-# Note also that we use the FMOVEM instruction to move X #
-# in Step 7.1 to avoid unnecessary trapping. (Although #
-# the FMOVEM may not seem relevant since X is normalized, #
-# the precaution will be useful in the library version of #
-# this code where the separate entry for denormalized #
-# inputs will be done away with.) #
-# #
-# Step 8. Handle exp(X) where |X| >= 16380log2. #
-# 8.1 If |X| > 16480 log2, go to Step 9. #
-# (mimic 2.2 - 2.6) #
-# 8.2 N := round-to-integer( X * 64/log2 ) #
-# 8.3 Calculate J = N mod 64, J = 0,1,...,63 #
-# 8.4 K := (N-J)/64, M1 := truncate(K/2), M = K-M1, #
-# AdjFlag := 1. #
-# 8.5 Calculate the address of the stored value #
-# 2^(J/64). #
-# 8.6 Create the values Scale = 2^M, AdjScale = 2^M1. #
-# 8.7 Go to Step 3. #
-# Notes: Refer to notes for 2.2 - 2.6. #
-# #
-# Step 9. Handle exp(X), |X| > 16480 log2. #
-# 9.1 If X < 0, go to 9.3 #
-# 9.2 ans := Huge, go to 9.4 #
-# 9.3 ans := Tiny. #
-# 9.4 Restore user FPCR. #
-# 9.5 Return ans := ans * ans. Exit. #
-# Notes: Exp(X) will surely overflow or underflow, depending on #
-# X's sign. "Huge" and "Tiny" are respectively large/tiny #
-# extended-precision numbers whose square over/underflow #
-# with an inexact result. Thus, 9.5 always raises the #
-# inexact together with either overflow or underflow. #
-# #
-# setoxm1d #
-# -------- #
-# #
-# Step 1. Set ans := 0 #
-# #
-# Step 2. Return ans := X + ans. Exit. #
-# Notes: This will return X with the appropriate rounding #
-# precision prescribed by the user FPCR. #
-# #
-# setoxm1 #
-# ------- #
-# #
-# Step 1. Check |X| #
-# 1.1 If |X| >= 1/4, go to Step 1.3. #
-# 1.2 Go to Step 7. #
-# 1.3 If |X| < 70 log(2), go to Step 2. #
-# 1.4 Go to Step 10. #
-# Notes: The usual case should take the branches 1.1 -> 1.3 -> 2.#
-# However, it is conceivable |X| can be small very often #
-# because EXPM1 is intended to evaluate exp(X)-1 #
-# accurately when |X| is small. For further details on #
-# the comparisons, see the notes on Step 1 of setox. #
-# #
-# Step 2. Calculate N = round-to-nearest-int( X * 64/log2 ). #
-# 2.1 N := round-to-nearest-integer( X * 64/log2 ). #
-# 2.2 Calculate J = N mod 64; so J = 0,1,2,..., #
-# or 63. #
-# 2.3 Calculate M = (N - J)/64; so N = 64M + J. #
-# 2.4 Calculate the address of the stored value of #
-# 2^(J/64). #
-# 2.5 Create the values Sc = 2^M and #
-# OnebySc := -2^(-M). #
-# Notes: See the notes on Step 2 of setox. #
-# #
-# Step 3. Calculate X - N*log2/64. #
-# 3.1 R := X + N*L1, #
-# where L1 := single-precision(-log2/64). #
-# 3.2 R := R + N*L2, #
-# L2 := extended-precision(-log2/64 - L1).#
-# Notes: Applying the analysis of Step 3 of setox in this case #
-# shows that |R| <= 0.0055 (note that |X| <= 70 log2 in #
-# this case). #
-# #
-# Step 4. Approximate exp(R)-1 by a polynomial #
-# p = R+R*R*(A1+R*(A2+R*(A3+R*(A4+R*(A5+R*A6))))) #
-# Notes: a) In order to reduce memory access, the coefficients #
-# are made as "short" as possible: A1 (which is 1/2), A5 #
-# and A6 are single precision; A2, A3 and A4 are double #
-# precision. #
-# b) Even with the restriction above, #
-# |p - (exp(R)-1)| < |R| * 2^(-72.7) #
-# for all |R| <= 0.0055. #
-# c) To fully utilize the pipeline, p is separated into #
-# two independent pieces of roughly equal complexity #
-# p = [ R*S*(A2 + S*(A4 + S*A6)) ] + #
-# [ R + S*(A1 + S*(A3 + S*A5)) ] #
-# where S = R*R. #
-# #
-# Step 5. Compute 2^(J/64)*p by #
-# p := T*p #
-# where T and t are the stored values for 2^(J/64). #
-# Notes: 2^(J/64) is stored as T and t where T+t approximates #
-# 2^(J/64) to roughly 85 bits; T is in extended precision #
-# and t is in single precision. Note also that T is #
-# rounded to 62 bits so that the last two bits of T are #
-# zero. The reason for such a special form is that T-1, #
-# T-2, and T-8 will all be exact --- a property that will #
-# be exploited in Step 6 below. The total relative error #
-# in p is no bigger than 2^(-67.7) compared to the final #
-# result. #
-# #
-# Step 6. Reconstruction of exp(X)-1 #
-# exp(X)-1 = 2^M * ( 2^(J/64) + p - 2^(-M) ). #
-# 6.1 If M <= 63, go to Step 6.3. #
-# 6.2 ans := T + (p + (t + OnebySc)). Go to 6.6 #
-# 6.3 If M >= -3, go to 6.5. #
-# 6.4 ans := (T + (p + t)) + OnebySc. Go to 6.6 #
-# 6.5 ans := (T + OnebySc) + (p + t). #
-# 6.6 Restore user FPCR. #
-# 6.7 Return ans := Sc * ans. Exit. #
-# Notes: The various arrangements of the expressions give #
-# accurate evaluations. #
-# #
-# Step 7. exp(X)-1 for |X| < 1/4. #
-# 7.1 If |X| >= 2^(-65), go to Step 9. #
-# 7.2 Go to Step 8. #
-# #
-# Step 8. Calculate exp(X)-1, |X| < 2^(-65). #
-# 8.1 If |X| < 2^(-16312), goto 8.3 #
-# 8.2 Restore FPCR; return ans := X - 2^(-16382). #
-# Exit. #
-# 8.3 X := X * 2^(140). #
-# 8.4 Restore FPCR; ans := ans - 2^(-16382). #
-# Return ans := ans*2^(140). Exit #
-# Notes: The idea is to return "X - tiny" under the user #
-# precision and rounding modes. To avoid unnecessary #
-# inefficiency, we stay away from denormalized numbers #
-# the best we can. For |X| >= 2^(-16312), the #
-# straightforward 8.2 generates the inexact exception as #
-# the case warrants. #
-# #
-# Step 9. Calculate exp(X)-1, |X| < 1/4, by a polynomial #
-# p = X + X*X*(B1 + X*(B2 + ... + X*B12)) #
-# Notes: a) In order to reduce memory access, the coefficients #
-# are made as "short" as possible: B1 (which is 1/2), B9 #
-# to B12 are single precision; B3 to B8 are double #
-# precision; and B2 is double extended. #
-# b) Even with the restriction above, #
-# |p - (exp(X)-1)| < |X| 2^(-70.6) #
-# for all |X| <= 0.251. #
-# Note that 0.251 is slightly bigger than 1/4. #
-# c) To fully preserve accuracy, the polynomial is #
-# computed as #
-# X + ( S*B1 + Q ) where S = X*X and #
-# Q = X*S*(B2 + X*(B3 + ... + X*B12)) #
-# d) To fully utilize the pipeline, Q is separated into #
-# two independent pieces of roughly equal complexity #
-# Q = [ X*S*(B2 + S*(B4 + ... + S*B12)) ] + #
-# [ S*S*(B3 + S*(B5 + ... + S*B11)) ] #
-# #
-# Step 10. Calculate exp(X)-1 for |X| >= 70 log 2. #
-# 10.1 If X >= 70log2 , exp(X) - 1 = exp(X) for all #
-# practical purposes. Therefore, go to Step 1 of setox. #
-# 10.2 If X <= -70log2, exp(X) - 1 = -1 for all practical #
-# purposes. #
-# ans := -1 #
-# Restore user FPCR #
-# Return ans := ans + 2^(-126). Exit. #
-# Notes: 10.2 will always create an inexact and return -1 + tiny #
-# in the user rounding precision and mode. #
-# #
-#########################################################################
-
-L2: long 0x3FDC0000,0x82E30865,0x4361C4C6,0x00000000
-
-EEXPA3: long 0x3FA55555,0x55554CC1
-EEXPA2: long 0x3FC55555,0x55554A54
-
-EM1A4: long 0x3F811111,0x11174385
-EM1A3: long 0x3FA55555,0x55554F5A
-
-EM1A2: long 0x3FC55555,0x55555555,0x00000000,0x00000000
-
-EM1B8: long 0x3EC71DE3,0xA5774682
-EM1B7: long 0x3EFA01A0,0x19D7CB68
-
-EM1B6: long 0x3F2A01A0,0x1A019DF3
-EM1B5: long 0x3F56C16C,0x16C170E2
-
-EM1B4: long 0x3F811111,0x11111111
-EM1B3: long 0x3FA55555,0x55555555
-
-EM1B2: long 0x3FFC0000,0xAAAAAAAA,0xAAAAAAAB
- long 0x00000000
-
-TWO140: long 0x48B00000,0x00000000
-TWON140:
- long 0x37300000,0x00000000
-
-EEXPTBL:
- long 0x3FFF0000,0x80000000,0x00000000,0x00000000
- long 0x3FFF0000,0x8164D1F3,0xBC030774,0x9F841A9B
- long 0x3FFF0000,0x82CD8698,0xAC2BA1D8,0x9FC1D5B9
- long 0x3FFF0000,0x843A28C3,0xACDE4048,0xA0728369
- long 0x3FFF0000,0x85AAC367,0xCC487B14,0x1FC5C95C
- long 0x3FFF0000,0x871F6196,0x9E8D1010,0x1EE85C9F
- long 0x3FFF0000,0x88980E80,0x92DA8528,0x9FA20729
- long 0x3FFF0000,0x8A14D575,0x496EFD9C,0xA07BF9AF
- long 0x3FFF0000,0x8B95C1E3,0xEA8BD6E8,0xA0020DCF
- long 0x3FFF0000,0x8D1ADF5B,0x7E5BA9E4,0x205A63DA
- long 0x3FFF0000,0x8EA4398B,0x45CD53C0,0x1EB70051
- long 0x3FFF0000,0x9031DC43,0x1466B1DC,0x1F6EB029
- long 0x3FFF0000,0x91C3D373,0xAB11C338,0xA0781494
- long 0x3FFF0000,0x935A2B2F,0x13E6E92C,0x9EB319B0
- long 0x3FFF0000,0x94F4EFA8,0xFEF70960,0x2017457D
- long 0x3FFF0000,0x96942D37,0x20185A00,0x1F11D537
- long 0x3FFF0000,0x9837F051,0x8DB8A970,0x9FB952DD
- long 0x3FFF0000,0x99E04593,0x20B7FA64,0x1FE43087
- long 0x3FFF0000,0x9B8D39B9,0xD54E5538,0x1FA2A818
- long 0x3FFF0000,0x9D3ED9A7,0x2CFFB750,0x1FDE494D
- long 0x3FFF0000,0x9EF53260,0x91A111AC,0x20504890
- long 0x3FFF0000,0xA0B0510F,0xB9714FC4,0xA073691C
- long 0x3FFF0000,0xA2704303,0x0C496818,0x1F9B7A05
- long 0x3FFF0000,0xA43515AE,0x09E680A0,0xA0797126
- long 0x3FFF0000,0xA5FED6A9,0xB15138EC,0xA071A140
- long 0x3FFF0000,0xA7CD93B4,0xE9653568,0x204F62DA
- long 0x3FFF0000,0xA9A15AB4,0xEA7C0EF8,0x1F283C4A
- long 0x3FFF0000,0xAB7A39B5,0xA93ED338,0x9F9A7FDC
- long 0x3FFF0000,0xAD583EEA,0x42A14AC8,0xA05B3FAC
- long 0x3FFF0000,0xAF3B78AD,0x690A4374,0x1FDF2610
- long 0x3FFF0000,0xB123F581,0xD2AC2590,0x9F705F90
- long 0x3FFF0000,0xB311C412,0xA9112488,0x201F678A
- long 0x3FFF0000,0xB504F333,0xF9DE6484,0x1F32FB13
- long 0x3FFF0000,0xB6FD91E3,0x28D17790,0x20038B30
- long 0x3FFF0000,0xB8FBAF47,0x62FB9EE8,0x200DC3CC
- long 0x3FFF0000,0xBAFF5AB2,0x133E45FC,0x9F8B2AE6
- long 0x3FFF0000,0xBD08A39F,0x580C36C0,0xA02BBF70
- long 0x3FFF0000,0xBF1799B6,0x7A731084,0xA00BF518
- long 0x3FFF0000,0xC12C4CCA,0x66709458,0xA041DD41
- long 0x3FFF0000,0xC346CCDA,0x24976408,0x9FDF137B
- long 0x3FFF0000,0xC5672A11,0x5506DADC,0x201F1568
- long 0x3FFF0000,0xC78D74C8,0xABB9B15C,0x1FC13A2E
- long 0x3FFF0000,0xC9B9BD86,0x6E2F27A4,0xA03F8F03
- long 0x3FFF0000,0xCBEC14FE,0xF2727C5C,0x1FF4907D
- long 0x3FFF0000,0xCE248C15,0x1F8480E4,0x9E6E53E4
- long 0x3FFF0000,0xD06333DA,0xEF2B2594,0x1FD6D45C
- long 0x3FFF0000,0xD2A81D91,0xF12AE45C,0xA076EDB9
- long 0x3FFF0000,0xD4F35AAB,0xCFEDFA20,0x9FA6DE21
- long 0x3FFF0000,0xD744FCCA,0xD69D6AF4,0x1EE69A2F
- long 0x3FFF0000,0xD99D15C2,0x78AFD7B4,0x207F439F
- long 0x3FFF0000,0xDBFBB797,0xDAF23754,0x201EC207
- long 0x3FFF0000,0xDE60F482,0x5E0E9124,0x9E8BE175
- long 0x3FFF0000,0xE0CCDEEC,0x2A94E110,0x20032C4B
- long 0x3FFF0000,0xE33F8972,0xBE8A5A50,0x2004DFF5
- long 0x3FFF0000,0xE5B906E7,0x7C8348A8,0x1E72F47A
- long 0x3FFF0000,0xE8396A50,0x3C4BDC68,0x1F722F22
- long 0x3FFF0000,0xEAC0C6E7,0xDD243930,0xA017E945
- long 0x3FFF0000,0xED4F301E,0xD9942B84,0x1F401A5B
- long 0x3FFF0000,0xEFE4B99B,0xDCDAF5CC,0x9FB9A9E3
- long 0x3FFF0000,0xF281773C,0x59FFB138,0x20744C05
- long 0x3FFF0000,0xF5257D15,0x2486CC2C,0x1F773A19
- long 0x3FFF0000,0xF7D0DF73,0x0AD13BB8,0x1FFE90D5
- long 0x3FFF0000,0xFA83B2DB,0x722A033C,0xA041ED22
- long 0x3FFF0000,0xFD3E0C0C,0xF486C174,0x1F853F3A
-
- set ADJFLAG,L_SCR2
- set SCALE,FP_SCR0
- set ADJSCALE,FP_SCR1
- set SC,FP_SCR0
- set ONEBYSC,FP_SCR1
-
- global setox
-setox:
-#--entry point for EXP(X), here X is finite, non-zero, and not NaN's
-
-#--Step 1.
- mov.l (%a0),%d1 # load part of input X
- and.l &0x7FFF0000,%d1 # biased expo. of X
- cmp.l %d1,&0x3FBE0000 # 2^(-65)
- bge.b EXPC1 # normal case
- bra EXPSM
-
-EXPC1:
-#--The case |X| >= 2^(-65)
- mov.w 4(%a0),%d1 # expo. and partial sig. of |X|
- cmp.l %d1,&0x400CB167 # 16380 log2 trunc. 16 bits
- blt.b EXPMAIN # normal case
- bra EEXPBIG
-
-EXPMAIN:
-#--Step 2.
-#--This is the normal branch: 2^(-65) <= |X| < 16380 log2.
- fmov.x (%a0),%fp0 # load input from (a0)
-
- fmov.x %fp0,%fp1
- fmul.s &0x42B8AA3B,%fp0 # 64/log2 * X
- fmovm.x &0xc,-(%sp) # save fp2 {%fp2/%fp3}
- mov.l &0,ADJFLAG(%a6)
- fmov.l %fp0,%d1 # N = int( X * 64/log2 )
- lea EEXPTBL(%pc),%a1
- fmov.l %d1,%fp0 # convert to floating-format
-
- mov.l %d1,L_SCR1(%a6) # save N temporarily
- and.l &0x3F,%d1 # D0 is J = N mod 64
- lsl.l &4,%d1
- add.l %d1,%a1 # address of 2^(J/64)
- mov.l L_SCR1(%a6),%d1
- asr.l &6,%d1 # D0 is M
- add.w &0x3FFF,%d1 # biased expo. of 2^(M)
- mov.w L2(%pc),L_SCR1(%a6) # prefetch L2, no need in CB
-
-EXPCONT1:
-#--Step 3.
-#--fp1,fp2 saved on the stack. fp0 is N, fp1 is X,
-#--a0 points to 2^(J/64), D0 is biased expo. of 2^(M)
- fmov.x %fp0,%fp2
- fmul.s &0xBC317218,%fp0 # N * L1, L1 = lead(-log2/64)
- fmul.x L2(%pc),%fp2 # N * L2, L1+L2 = -log2/64
- fadd.x %fp1,%fp0 # X + N*L1
- fadd.x %fp2,%fp0 # fp0 is R, reduced arg.
-
-#--Step 4.
-#--WE NOW COMPUTE EXP(R)-1 BY A POLYNOMIAL
-#-- R + R*R*(A1 + R*(A2 + R*(A3 + R*(A4 + R*A5))))
-#--TO FULLY UTILIZE THE PIPELINE, WE COMPUTE S = R*R
-#--[R+R*S*(A2+S*A4)] + [S*(A1+S*(A3+S*A5))]
-
- fmov.x %fp0,%fp1
- fmul.x %fp1,%fp1 # fp1 IS S = R*R
-
- fmov.s &0x3AB60B70,%fp2 # fp2 IS A5
-
- fmul.x %fp1,%fp2 # fp2 IS S*A5
- fmov.x %fp1,%fp3
- fmul.s &0x3C088895,%fp3 # fp3 IS S*A4
-
- fadd.d EEXPA3(%pc),%fp2 # fp2 IS A3+S*A5
- fadd.d EEXPA2(%pc),%fp3 # fp3 IS A2+S*A4
-
- fmul.x %fp1,%fp2 # fp2 IS S*(A3+S*A5)
- mov.w %d1,SCALE(%a6) # SCALE is 2^(M) in extended
- mov.l &0x80000000,SCALE+4(%a6)
- clr.l SCALE+8(%a6)
-
- fmul.x %fp1,%fp3 # fp3 IS S*(A2+S*A4)
-
- fadd.s &0x3F000000,%fp2 # fp2 IS A1+S*(A3+S*A5)
- fmul.x %fp0,%fp3 # fp3 IS R*S*(A2+S*A4)
-
- fmul.x %fp1,%fp2 # fp2 IS S*(A1+S*(A3+S*A5))
- fadd.x %fp3,%fp0 # fp0 IS R+R*S*(A2+S*A4),
-
- fmov.x (%a1)+,%fp1 # fp1 is lead. pt. of 2^(J/64)
- fadd.x %fp2,%fp0 # fp0 is EXP(R) - 1
-
-#--Step 5
-#--final reconstruction process
-#--EXP(X) = 2^M * ( 2^(J/64) + 2^(J/64)*(EXP(R)-1) )
-
- fmul.x %fp1,%fp0 # 2^(J/64)*(Exp(R)-1)
- fmovm.x (%sp)+,&0x30 # fp2 restored {%fp2/%fp3}
- fadd.s (%a1),%fp0 # accurate 2^(J/64)
-
- fadd.x %fp1,%fp0 # 2^(J/64) + 2^(J/64)*...
- mov.l ADJFLAG(%a6),%d1
-
-#--Step 6
- tst.l %d1
- beq.b NORMAL
-ADJUST:
- fmul.x ADJSCALE(%a6),%fp0
-NORMAL:
- fmov.l %d0,%fpcr # restore user FPCR
- mov.b &FMUL_OP,%d1 # last inst is MUL
- fmul.x SCALE(%a6),%fp0 # multiply 2^(M)
- bra t_catch
-
-EXPSM:
-#--Step 7
- fmovm.x (%a0),&0x80 # load X
- fmov.l %d0,%fpcr
- fadd.s &0x3F800000,%fp0 # 1+X in user mode
- bra t_pinx2
-
-EEXPBIG:
-#--Step 8
- cmp.l %d1,&0x400CB27C # 16480 log2
- bgt.b EXP2BIG
-#--Steps 8.2 -- 8.6
- fmov.x (%a0),%fp0 # load input from (a0)
-
- fmov.x %fp0,%fp1
- fmul.s &0x42B8AA3B,%fp0 # 64/log2 * X
- fmovm.x &0xc,-(%sp) # save fp2 {%fp2/%fp3}
- mov.l &1,ADJFLAG(%a6)
- fmov.l %fp0,%d1 # N = int( X * 64/log2 )
- lea EEXPTBL(%pc),%a1
- fmov.l %d1,%fp0 # convert to floating-format
- mov.l %d1,L_SCR1(%a6) # save N temporarily
- and.l &0x3F,%d1 # D0 is J = N mod 64
- lsl.l &4,%d1
- add.l %d1,%a1 # address of 2^(J/64)
- mov.l L_SCR1(%a6),%d1
- asr.l &6,%d1 # D0 is K
- mov.l %d1,L_SCR1(%a6) # save K temporarily
- asr.l &1,%d1 # D0 is M1
- sub.l %d1,L_SCR1(%a6) # a1 is M
- add.w &0x3FFF,%d1 # biased expo. of 2^(M1)
- mov.w %d1,ADJSCALE(%a6) # ADJSCALE := 2^(M1)
- mov.l &0x80000000,ADJSCALE+4(%a6)
- clr.l ADJSCALE+8(%a6)
- mov.l L_SCR1(%a6),%d1 # D0 is M
- add.w &0x3FFF,%d1 # biased expo. of 2^(M)
- bra.w EXPCONT1 # go back to Step 3
-
-EXP2BIG:
-#--Step 9
- tst.b (%a0) # is X positive or negative?
- bmi t_unfl2
- bra t_ovfl2
-
- global setoxd
-setoxd:
-#--entry point for EXP(X), X is denormalized
- mov.l (%a0),-(%sp)
- andi.l &0x80000000,(%sp)
- ori.l &0x00800000,(%sp) # sign(X)*2^(-126)
-
- fmov.s &0x3F800000,%fp0
-
- fmov.l %d0,%fpcr
- fadd.s (%sp)+,%fp0
- bra t_pinx2
-
- global setoxm1
-setoxm1:
-#--entry point for EXPM1(X), here X is finite, non-zero, non-NaN
-
-#--Step 1.
-#--Step 1.1
- mov.l (%a0),%d1 # load part of input X
- and.l &0x7FFF0000,%d1 # biased expo. of X
- cmp.l %d1,&0x3FFD0000 # 1/4
- bge.b EM1CON1 # |X| >= 1/4
- bra EM1SM
-
-EM1CON1:
-#--Step 1.3
-#--The case |X| >= 1/4
- mov.w 4(%a0),%d1 # expo. and partial sig. of |X|
- cmp.l %d1,&0x4004C215 # 70log2 rounded up to 16 bits
- ble.b EM1MAIN # 1/4 <= |X| <= 70log2
- bra EM1BIG
-
-EM1MAIN:
-#--Step 2.
-#--This is the case: 1/4 <= |X| <= 70 log2.
- fmov.x (%a0),%fp0 # load input from (a0)
-
- fmov.x %fp0,%fp1
- fmul.s &0x42B8AA3B,%fp0 # 64/log2 * X
- fmovm.x &0xc,-(%sp) # save fp2 {%fp2/%fp3}
- fmov.l %fp0,%d1 # N = int( X * 64/log2 )
- lea EEXPTBL(%pc),%a1
- fmov.l %d1,%fp0 # convert to floating-format
-
- mov.l %d1,L_SCR1(%a6) # save N temporarily
- and.l &0x3F,%d1 # D0 is J = N mod 64
- lsl.l &4,%d1
- add.l %d1,%a1 # address of 2^(J/64)
- mov.l L_SCR1(%a6),%d1
- asr.l &6,%d1 # D0 is M
- mov.l %d1,L_SCR1(%a6) # save a copy of M
-
-#--Step 3.
-#--fp1,fp2 saved on the stack. fp0 is N, fp1 is X,
-#--a0 points to 2^(J/64), D0 and a1 both contain M
- fmov.x %fp0,%fp2
- fmul.s &0xBC317218,%fp0 # N * L1, L1 = lead(-log2/64)
- fmul.x L2(%pc),%fp2 # N * L2, L1+L2 = -log2/64
- fadd.x %fp1,%fp0 # X + N*L1
- fadd.x %fp2,%fp0 # fp0 is R, reduced arg.
- add.w &0x3FFF,%d1 # D0 is biased expo. of 2^M
-
-#--Step 4.
-#--WE NOW COMPUTE EXP(R)-1 BY A POLYNOMIAL
-#-- R + R*R*(A1 + R*(A2 + R*(A3 + R*(A4 + R*(A5 + R*A6)))))
-#--TO FULLY UTILIZE THE PIPELINE, WE COMPUTE S = R*R
-#--[R*S*(A2+S*(A4+S*A6))] + [R+S*(A1+S*(A3+S*A5))]
-
- fmov.x %fp0,%fp1
- fmul.x %fp1,%fp1 # fp1 IS S = R*R
-
- fmov.s &0x3950097B,%fp2 # fp2 IS a6
-
- fmul.x %fp1,%fp2 # fp2 IS S*A6
- fmov.x %fp1,%fp3
- fmul.s &0x3AB60B6A,%fp3 # fp3 IS S*A5
-
- fadd.d EM1A4(%pc),%fp2 # fp2 IS A4+S*A6
- fadd.d EM1A3(%pc),%fp3 # fp3 IS A3+S*A5
- mov.w %d1,SC(%a6) # SC is 2^(M) in extended
- mov.l &0x80000000,SC+4(%a6)
- clr.l SC+8(%a6)
-
- fmul.x %fp1,%fp2 # fp2 IS S*(A4+S*A6)
- mov.l L_SCR1(%a6),%d1 # D0 is M
- neg.w %d1 # D0 is -M
- fmul.x %fp1,%fp3 # fp3 IS S*(A3+S*A5)
- add.w &0x3FFF,%d1 # biased expo. of 2^(-M)
- fadd.d EM1A2(%pc),%fp2 # fp2 IS A2+S*(A4+S*A6)
- fadd.s &0x3F000000,%fp3 # fp3 IS A1+S*(A3+S*A5)
-
- fmul.x %fp1,%fp2 # fp2 IS S*(A2+S*(A4+S*A6))
- or.w &0x8000,%d1 # signed/expo. of -2^(-M)
- mov.w %d1,ONEBYSC(%a6) # OnebySc is -2^(-M)
- mov.l &0x80000000,ONEBYSC+4(%a6)
- clr.l ONEBYSC+8(%a6)
- fmul.x %fp3,%fp1 # fp1 IS S*(A1+S*(A3+S*A5))
-
- fmul.x %fp0,%fp2 # fp2 IS R*S*(A2+S*(A4+S*A6))
- fadd.x %fp1,%fp0 # fp0 IS R+S*(A1+S*(A3+S*A5))
-
- fadd.x %fp2,%fp0 # fp0 IS EXP(R)-1
-
- fmovm.x (%sp)+,&0x30 # fp2 restored {%fp2/%fp3}
-
-#--Step 5
-#--Compute 2^(J/64)*p
-
- fmul.x (%a1),%fp0 # 2^(J/64)*(Exp(R)-1)
-
-#--Step 6
-#--Step 6.1
- mov.l L_SCR1(%a6),%d1 # retrieve M
- cmp.l %d1,&63
- ble.b MLE63
-#--Step 6.2 M >= 64
- fmov.s 12(%a1),%fp1 # fp1 is t
- fadd.x ONEBYSC(%a6),%fp1 # fp1 is t+OnebySc
- fadd.x %fp1,%fp0 # p+(t+OnebySc), fp1 released
- fadd.x (%a1),%fp0 # T+(p+(t+OnebySc))
- bra EM1SCALE
-MLE63:
-#--Step 6.3 M <= 63
- cmp.l %d1,&-3
- bge.b MGEN3
-MLTN3:
-#--Step 6.4 M <= -4
- fadd.s 12(%a1),%fp0 # p+t
- fadd.x (%a1),%fp0 # T+(p+t)
- fadd.x ONEBYSC(%a6),%fp0 # OnebySc + (T+(p+t))
- bra EM1SCALE
-MGEN3:
-#--Step 6.5 -3 <= M <= 63
- fmov.x (%a1)+,%fp1 # fp1 is T
- fadd.s (%a1),%fp0 # fp0 is p+t
- fadd.x ONEBYSC(%a6),%fp1 # fp1 is T+OnebySc
- fadd.x %fp1,%fp0 # (T+OnebySc)+(p+t)
-
-EM1SCALE:
-#--Step 6.6
- fmov.l %d0,%fpcr
- fmul.x SC(%a6),%fp0
- bra t_inx2
-
-EM1SM:
-#--Step 7 |X| < 1/4.
- cmp.l %d1,&0x3FBE0000 # 2^(-65)
- bge.b EM1POLY
-
-EM1TINY:
-#--Step 8 |X| < 2^(-65)
- cmp.l %d1,&0x00330000 # 2^(-16312)
- blt.b EM12TINY
-#--Step 8.2
- mov.l &0x80010000,SC(%a6) # SC is -2^(-16382)
- mov.l &0x80000000,SC+4(%a6)
- clr.l SC+8(%a6)
- fmov.x (%a0),%fp0
- fmov.l %d0,%fpcr
- mov.b &FADD_OP,%d1 # last inst is ADD
- fadd.x SC(%a6),%fp0
- bra t_catch
-
-EM12TINY:
-#--Step 8.3
- fmov.x (%a0),%fp0
- fmul.d TWO140(%pc),%fp0
- mov.l &0x80010000,SC(%a6)
- mov.l &0x80000000,SC+4(%a6)
- clr.l SC+8(%a6)
- fadd.x SC(%a6),%fp0
- fmov.l %d0,%fpcr
- mov.b &FMUL_OP,%d1 # last inst is MUL
- fmul.d TWON140(%pc),%fp0
- bra t_catch
-
-EM1POLY:
-#--Step 9 exp(X)-1 by a simple polynomial
- fmov.x (%a0),%fp0 # fp0 is X
- fmul.x %fp0,%fp0 # fp0 is S := X*X
- fmovm.x &0xc,-(%sp) # save fp2 {%fp2/%fp3}
- fmov.s &0x2F30CAA8,%fp1 # fp1 is B12
- fmul.x %fp0,%fp1 # fp1 is S*B12
- fmov.s &0x310F8290,%fp2 # fp2 is B11
- fadd.s &0x32D73220,%fp1 # fp1 is B10+S*B12
-
- fmul.x %fp0,%fp2 # fp2 is S*B11
- fmul.x %fp0,%fp1 # fp1 is S*(B10 + ...
-
- fadd.s &0x3493F281,%fp2 # fp2 is B9+S*...
- fadd.d EM1B8(%pc),%fp1 # fp1 is B8+S*...
-
- fmul.x %fp0,%fp2 # fp2 is S*(B9+...
- fmul.x %fp0,%fp1 # fp1 is S*(B8+...
-
- fadd.d EM1B7(%pc),%fp2 # fp2 is B7+S*...
- fadd.d EM1B6(%pc),%fp1 # fp1 is B6+S*...
-
- fmul.x %fp0,%fp2 # fp2 is S*(B7+...
- fmul.x %fp0,%fp1 # fp1 is S*(B6+...
-
- fadd.d EM1B5(%pc),%fp2 # fp2 is B5+S*...
- fadd.d EM1B4(%pc),%fp1 # fp1 is B4+S*...
-
- fmul.x %fp0,%fp2 # fp2 is S*(B5+...
- fmul.x %fp0,%fp1 # fp1 is S*(B4+...
-
- fadd.d EM1B3(%pc),%fp2 # fp2 is B3+S*...
- fadd.x EM1B2(%pc),%fp1 # fp1 is B2+S*...
-
- fmul.x %fp0,%fp2 # fp2 is S*(B3+...
- fmul.x %fp0,%fp1 # fp1 is S*(B2+...
-
- fmul.x %fp0,%fp2 # fp2 is S*S*(B3+...)
- fmul.x (%a0),%fp1 # fp1 is X*S*(B2...
-
- fmul.s &0x3F000000,%fp0 # fp0 is S*B1
- fadd.x %fp2,%fp1 # fp1 is Q
-
- fmovm.x (%sp)+,&0x30 # fp2 restored {%fp2/%fp3}
-
- fadd.x %fp1,%fp0 # fp0 is S*B1+Q
-
- fmov.l %d0,%fpcr
- fadd.x (%a0),%fp0
- bra t_inx2
-
-EM1BIG:
-#--Step 10 |X| > 70 log2
- mov.l (%a0),%d1
- cmp.l %d1,&0
- bgt.w EXPC1
-#--Step 10.2
- fmov.s &0xBF800000,%fp0 # fp0 is -1
- fmov.l %d0,%fpcr
- fadd.s &0x00800000,%fp0 # -1 + 2^(-126)
- bra t_minx2
-
- global setoxm1d
-setoxm1d:
-#--entry point for EXPM1(X), here X is denormalized
-#--Step 0.
- bra t_extdnrm
-
-#########################################################################
-# sgetexp(): returns the exponent portion of the input argument. #
-# The exponent bias is removed and the exponent value is #
-# returned as an extended precision number in fp0. #
-# sgetexpd(): handles denormalized numbers. #
-# #
-# sgetman(): extracts the mantissa of the input argument. The #
-# mantissa is converted to an extended precision number w/ #
-# an exponent of $3fff and is returned in fp0. The range of #
-# the result is [1.0 - 2.0). #
-# sgetmand(): handles denormalized numbers. #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = exponent(X) or mantissa(X) #
-# #
-#########################################################################
-
- global sgetexp
-sgetexp:
- mov.w SRC_EX(%a0),%d0 # get the exponent
- bclr &0xf,%d0 # clear the sign bit
- subi.w &0x3fff,%d0 # subtract off the bias
- fmov.w %d0,%fp0 # return exp in fp0
- blt.b sgetexpn # it's negative
- rts
-
-sgetexpn:
- mov.b &neg_bmask,FPSR_CC(%a6) # set 'N' ccode bit
- rts
-
- global sgetexpd
-sgetexpd:
- bsr.l norm # normalize
- neg.w %d0 # new exp = -(shft amt)
- subi.w &0x3fff,%d0 # subtract off the bias
- fmov.w %d0,%fp0 # return exp in fp0
- mov.b &neg_bmask,FPSR_CC(%a6) # set 'N' ccode bit
- rts
-
- global sgetman
-sgetman:
- mov.w SRC_EX(%a0),%d0 # get the exp
- ori.w &0x7fff,%d0 # clear old exp
- bclr &0xe,%d0 # make it the new exp +-3fff
-
-# here, we build the result in a tmp location so as not to disturb the input
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6) # copy to tmp loc
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6) # copy to tmp loc
- mov.w %d0,FP_SCR0_EX(%a6) # insert new exponent
- fmov.x FP_SCR0(%a6),%fp0 # put new value back in fp0
- bmi.b sgetmann # it's negative
- rts
-
-sgetmann:
- mov.b &neg_bmask,FPSR_CC(%a6) # set 'N' ccode bit
- rts
-
-#
-# For denormalized numbers, shift the mantissa until the j-bit = 1,
-# then load the exponent with +/1 $3fff.
-#
- global sgetmand
-sgetmand:
- bsr.l norm # normalize exponent
- bra.b sgetman
-
-#########################################################################
-# scosh(): computes the hyperbolic cosine of a normalized input #
-# scoshd(): computes the hyperbolic cosine of a denormalized input #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input #
-# d0 = round precision,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = cosh(X) #
-# #
-# ACCURACY and MONOTONICITY ******************************************* #
-# The returned result is within 3 ulps in 64 significant bit, #
-# i.e. within 0.5001 ulp to 53 bits if the result is subsequently #
-# rounded to double precision. The result is provably monotonic #
-# in double precision. #
-# #
-# ALGORITHM *********************************************************** #
-# #
-# COSH #
-# 1. If |X| > 16380 log2, go to 3. #
-# #
-# 2. (|X| <= 16380 log2) Cosh(X) is obtained by the formulae #
-# y = |X|, z = exp(Y), and #
-# cosh(X) = (1/2)*( z + 1/z ). #
-# Exit. #
-# #
-# 3. (|X| > 16380 log2). If |X| > 16480 log2, go to 5. #
-# #
-# 4. (16380 log2 < |X| <= 16480 log2) #
-# cosh(X) = sign(X) * exp(|X|)/2. #
-# However, invoking exp(|X|) may cause premature #
-# overflow. Thus, we calculate sinh(X) as follows: #
-# Y := |X| #
-# Fact := 2**(16380) #
-# Y' := Y - 16381 log2 #
-# cosh(X) := Fact * exp(Y'). #
-# Exit. #
-# #
-# 5. (|X| > 16480 log2) sinh(X) must overflow. Return #
-# Huge*Huge to generate overflow and an infinity with #
-# the appropriate sign. Huge is the largest finite number #
-# in extended format. Exit. #
-# #
-#########################################################################
-
-TWO16380:
- long 0x7FFB0000,0x80000000,0x00000000,0x00000000
-
- global scosh
-scosh:
- fmov.x (%a0),%fp0 # LOAD INPUT
-
- mov.l (%a0),%d1
- mov.w 4(%a0),%d1
- and.l &0x7FFFFFFF,%d1
- cmp.l %d1,&0x400CB167
- bgt.b COSHBIG
-
-#--THIS IS THE USUAL CASE, |X| < 16380 LOG2
-#--COSH(X) = (1/2) * ( EXP(X) + 1/EXP(X) )
-
- fabs.x %fp0 # |X|
-
- mov.l %d0,-(%sp)
- clr.l %d0
- fmovm.x &0x01,-(%sp) # save |X| to stack
- lea (%sp),%a0 # pass ptr to |X|
- bsr setox # FP0 IS EXP(|X|)
- add.l &0xc,%sp # erase |X| from stack
- fmul.s &0x3F000000,%fp0 # (1/2)EXP(|X|)
- mov.l (%sp)+,%d0
-
- fmov.s &0x3E800000,%fp1 # (1/4)
- fdiv.x %fp0,%fp1 # 1/(2 EXP(|X|))
-
- fmov.l %d0,%fpcr
- mov.b &FADD_OP,%d1 # last inst is ADD
- fadd.x %fp1,%fp0
- bra t_catch
-
-COSHBIG:
- cmp.l %d1,&0x400CB2B3
- bgt.b COSHHUGE
-
- fabs.x %fp0
- fsub.d T1(%pc),%fp0 # (|X|-16381LOG2_LEAD)
- fsub.d T2(%pc),%fp0 # |X| - 16381 LOG2, ACCURATE
-
- mov.l %d0,-(%sp)
- clr.l %d0
- fmovm.x &0x01,-(%sp) # save fp0 to stack
- lea (%sp),%a0 # pass ptr to fp0
- bsr setox
- add.l &0xc,%sp # clear fp0 from stack
- mov.l (%sp)+,%d0
-
- fmov.l %d0,%fpcr
- mov.b &FMUL_OP,%d1 # last inst is MUL
- fmul.x TWO16380(%pc),%fp0
- bra t_catch
-
-COSHHUGE:
- bra t_ovfl2
-
- global scoshd
-#--COSH(X) = 1 FOR DENORMALIZED X
-scoshd:
- fmov.s &0x3F800000,%fp0
-
- fmov.l %d0,%fpcr
- fadd.s &0x00800000,%fp0
- bra t_pinx2
-
-#########################################################################
-# ssinh(): computes the hyperbolic sine of a normalized input #
-# ssinhd(): computes the hyperbolic sine of a denormalized input #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input #
-# d0 = round precision,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = sinh(X) #
-# #
-# ACCURACY and MONOTONICITY ******************************************* #
-# The returned result is within 3 ulps in 64 significant bit, #
-# i.e. within 0.5001 ulp to 53 bits if the result is subsequently #
-# rounded to double precision. The result is provably monotonic #
-# in double precision. #
-# #
-# ALGORITHM *********************************************************** #
-# #
-# SINH #
-# 1. If |X| > 16380 log2, go to 3. #
-# #
-# 2. (|X| <= 16380 log2) Sinh(X) is obtained by the formula #
-# y = |X|, sgn = sign(X), and z = expm1(Y), #
-# sinh(X) = sgn*(1/2)*( z + z/(1+z) ). #
-# Exit. #
-# #
-# 3. If |X| > 16480 log2, go to 5. #
-# #
-# 4. (16380 log2 < |X| <= 16480 log2) #
-# sinh(X) = sign(X) * exp(|X|)/2. #
-# However, invoking exp(|X|) may cause premature overflow. #
-# Thus, we calculate sinh(X) as follows: #
-# Y := |X| #
-# sgn := sign(X) #
-# sgnFact := sgn * 2**(16380) #
-# Y' := Y - 16381 log2 #
-# sinh(X) := sgnFact * exp(Y'). #
-# Exit. #
-# #
-# 5. (|X| > 16480 log2) sinh(X) must overflow. Return #
-# sign(X)*Huge*Huge to generate overflow and an infinity with #
-# the appropriate sign. Huge is the largest finite number in #
-# extended format. Exit. #
-# #
-#########################################################################
-
- global ssinh
-ssinh:
- fmov.x (%a0),%fp0 # LOAD INPUT
-
- mov.l (%a0),%d1
- mov.w 4(%a0),%d1
- mov.l %d1,%a1 # save (compacted) operand
- and.l &0x7FFFFFFF,%d1
- cmp.l %d1,&0x400CB167
- bgt.b SINHBIG
-
-#--THIS IS THE USUAL CASE, |X| < 16380 LOG2
-#--Y = |X|, Z = EXPM1(Y), SINH(X) = SIGN(X)*(1/2)*( Z + Z/(1+Z) )
-
- fabs.x %fp0 # Y = |X|
-
- movm.l &0x8040,-(%sp) # {a1/d0}
- fmovm.x &0x01,-(%sp) # save Y on stack
- lea (%sp),%a0 # pass ptr to Y
- clr.l %d0
- bsr setoxm1 # FP0 IS Z = EXPM1(Y)
- add.l &0xc,%sp # clear Y from stack
- fmov.l &0,%fpcr
- movm.l (%sp)+,&0x0201 # {a1/d0}
-
- fmov.x %fp0,%fp1
- fadd.s &0x3F800000,%fp1 # 1+Z
- fmov.x %fp0,-(%sp)
- fdiv.x %fp1,%fp0 # Z/(1+Z)
- mov.l %a1,%d1
- and.l &0x80000000,%d1
- or.l &0x3F000000,%d1
- fadd.x (%sp)+,%fp0
- mov.l %d1,-(%sp)
-
- fmov.l %d0,%fpcr
- mov.b &FMUL_OP,%d1 # last inst is MUL
- fmul.s (%sp)+,%fp0 # last fp inst - possible exceptions set
- bra t_catch
-
-SINHBIG:
- cmp.l %d1,&0x400CB2B3
- bgt t_ovfl
- fabs.x %fp0
- fsub.d T1(%pc),%fp0 # (|X|-16381LOG2_LEAD)
- mov.l &0,-(%sp)
- mov.l &0x80000000,-(%sp)
- mov.l %a1,%d1
- and.l &0x80000000,%d1
- or.l &0x7FFB0000,%d1
- mov.l %d1,-(%sp) # EXTENDED FMT
- fsub.d T2(%pc),%fp0 # |X| - 16381 LOG2, ACCURATE
-
- mov.l %d0,-(%sp)
- clr.l %d0
- fmovm.x &0x01,-(%sp) # save fp0 on stack
- lea (%sp),%a0 # pass ptr to fp0
- bsr setox
- add.l &0xc,%sp # clear fp0 from stack
-
- mov.l (%sp)+,%d0
- fmov.l %d0,%fpcr
- mov.b &FMUL_OP,%d1 # last inst is MUL
- fmul.x (%sp)+,%fp0 # possible exception
- bra t_catch
-
- global ssinhd
-#--SINH(X) = X FOR DENORMALIZED X
-ssinhd:
- bra t_extdnrm
-
-#########################################################################
-# stanh(): computes the hyperbolic tangent of a normalized input #
-# stanhd(): computes the hyperbolic tangent of a denormalized input #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input #
-# d0 = round precision,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = tanh(X) #
-# #
-# ACCURACY and MONOTONICITY ******************************************* #
-# The returned result is within 3 ulps in 64 significant bit, #
-# i.e. within 0.5001 ulp to 53 bits if the result is subsequently #
-# rounded to double precision. The result is provably monotonic #
-# in double precision. #
-# #
-# ALGORITHM *********************************************************** #
-# #
-# TANH #
-# 1. If |X| >= (5/2) log2 or |X| <= 2**(-40), go to 3. #
-# #
-# 2. (2**(-40) < |X| < (5/2) log2) Calculate tanh(X) by #
-# sgn := sign(X), y := 2|X|, z := expm1(Y), and #
-# tanh(X) = sgn*( z/(2+z) ). #
-# Exit. #
-# #
-# 3. (|X| <= 2**(-40) or |X| >= (5/2) log2). If |X| < 1, #
-# go to 7. #
-# #
-# 4. (|X| >= (5/2) log2) If |X| >= 50 log2, go to 6. #
-# #
-# 5. ((5/2) log2 <= |X| < 50 log2) Calculate tanh(X) by #
-# sgn := sign(X), y := 2|X|, z := exp(Y), #
-# tanh(X) = sgn - [ sgn*2/(1+z) ]. #
-# Exit. #
-# #
-# 6. (|X| >= 50 log2) Tanh(X) = +-1 (round to nearest). Thus, we #
-# calculate Tanh(X) by #
-# sgn := sign(X), Tiny := 2**(-126), #
-# tanh(X) := sgn - sgn*Tiny. #
-# Exit. #
-# #
-# 7. (|X| < 2**(-40)). Tanh(X) = X. Exit. #
-# #
-#########################################################################
-
- set X,FP_SCR0
- set XFRAC,X+4
-
- set SGN,L_SCR3
-
- set V,FP_SCR0
-
- global stanh
-stanh:
- fmov.x (%a0),%fp0 # LOAD INPUT
-
- fmov.x %fp0,X(%a6)
- mov.l (%a0),%d1
- mov.w 4(%a0),%d1
- mov.l %d1,X(%a6)
- and.l &0x7FFFFFFF,%d1
- cmp.l %d1, &0x3fd78000 # is |X| < 2^(-40)?
- blt.w TANHBORS # yes
- cmp.l %d1, &0x3fffddce # is |X| > (5/2)LOG2?
- bgt.w TANHBORS # yes
-
-#--THIS IS THE USUAL CASE
-#--Y = 2|X|, Z = EXPM1(Y), TANH(X) = SIGN(X) * Z / (Z+2).
-
- mov.l X(%a6),%d1
- mov.l %d1,SGN(%a6)
- and.l &0x7FFF0000,%d1
- add.l &0x00010000,%d1 # EXPONENT OF 2|X|
- mov.l %d1,X(%a6)
- and.l &0x80000000,SGN(%a6)
- fmov.x X(%a6),%fp0 # FP0 IS Y = 2|X|
-
- mov.l %d0,-(%sp)
- clr.l %d0
- fmovm.x &0x1,-(%sp) # save Y on stack
- lea (%sp),%a0 # pass ptr to Y
- bsr setoxm1 # FP0 IS Z = EXPM1(Y)
- add.l &0xc,%sp # clear Y from stack
- mov.l (%sp)+,%d0
-
- fmov.x %fp0,%fp1
- fadd.s &0x40000000,%fp1 # Z+2
- mov.l SGN(%a6),%d1
- fmov.x %fp1,V(%a6)
- eor.l %d1,V(%a6)
-
- fmov.l %d0,%fpcr # restore users round prec,mode
- fdiv.x V(%a6),%fp0
- bra t_inx2
-
-TANHBORS:
- cmp.l %d1,&0x3FFF8000
- blt.w TANHSM
-
- cmp.l %d1,&0x40048AA1
- bgt.w TANHHUGE
-
-#-- (5/2) LOG2 < |X| < 50 LOG2,
-#--TANH(X) = 1 - (2/[EXP(2X)+1]). LET Y = 2|X|, SGN = SIGN(X),
-#--TANH(X) = SGN - SGN*2/[EXP(Y)+1].
-
- mov.l X(%a6),%d1
- mov.l %d1,SGN(%a6)
- and.l &0x7FFF0000,%d1
- add.l &0x00010000,%d1 # EXPO OF 2|X|
- mov.l %d1,X(%a6) # Y = 2|X|
- and.l &0x80000000,SGN(%a6)
- mov.l SGN(%a6),%d1
- fmov.x X(%a6),%fp0 # Y = 2|X|
-
- mov.l %d0,-(%sp)
- clr.l %d0
- fmovm.x &0x01,-(%sp) # save Y on stack
- lea (%sp),%a0 # pass ptr to Y
- bsr setox # FP0 IS EXP(Y)
- add.l &0xc,%sp # clear Y from stack
- mov.l (%sp)+,%d0
- mov.l SGN(%a6),%d1
- fadd.s &0x3F800000,%fp0 # EXP(Y)+1
-
- eor.l &0xC0000000,%d1 # -SIGN(X)*2
- fmov.s %d1,%fp1 # -SIGN(X)*2 IN SGL FMT
- fdiv.x %fp0,%fp1 # -SIGN(X)2 / [EXP(Y)+1 ]
-
- mov.l SGN(%a6),%d1
- or.l &0x3F800000,%d1 # SGN
- fmov.s %d1,%fp0 # SGN IN SGL FMT
-
- fmov.l %d0,%fpcr # restore users round prec,mode
- mov.b &FADD_OP,%d1 # last inst is ADD
- fadd.x %fp1,%fp0
- bra t_inx2
-
-TANHSM:
- fmov.l %d0,%fpcr # restore users round prec,mode
- mov.b &FMOV_OP,%d1 # last inst is MOVE
- fmov.x X(%a6),%fp0 # last inst - possible exception set
- bra t_catch
-
-#---RETURN SGN(X) - SGN(X)EPS
-TANHHUGE:
- mov.l X(%a6),%d1
- and.l &0x80000000,%d1
- or.l &0x3F800000,%d1
- fmov.s %d1,%fp0
- and.l &0x80000000,%d1
- eor.l &0x80800000,%d1 # -SIGN(X)*EPS
-
- fmov.l %d0,%fpcr # restore users round prec,mode
- fadd.s %d1,%fp0
- bra t_inx2
-
- global stanhd
-#--TANH(X) = X FOR DENORMALIZED X
-stanhd:
- bra t_extdnrm
-
-#########################################################################
-# slogn(): computes the natural logarithm of a normalized input #
-# slognd(): computes the natural logarithm of a denormalized input #
-# slognp1(): computes the log(1+X) of a normalized input #
-# slognp1d(): computes the log(1+X) of a denormalized input #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input #
-# d0 = round precision,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = log(X) or log(1+X) #
-# #
-# ACCURACY and MONOTONICITY ******************************************* #
-# The returned result is within 2 ulps in 64 significant bit, #
-# i.e. within 0.5001 ulp to 53 bits if the result is subsequently #
-# rounded to double precision. The result is provably monotonic #
-# in double precision. #
-# #
-# ALGORITHM *********************************************************** #
-# LOGN: #
-# Step 1. If |X-1| < 1/16, approximate log(X) by an odd #
-# polynomial in u, where u = 2(X-1)/(X+1). Otherwise, #
-# move on to Step 2. #
-# #
-# Step 2. X = 2**k * Y where 1 <= Y < 2. Define F to be the first #
-# seven significant bits of Y plus 2**(-7), i.e. #
-# F = 1.xxxxxx1 in base 2 where the six "x" match those #
-# of Y. Note that |Y-F| <= 2**(-7). #
-# #
-# Step 3. Define u = (Y-F)/F. Approximate log(1+u) by a #
-# polynomial in u, log(1+u) = poly. #
-# #
-# Step 4. Reconstruct #
-# log(X) = log( 2**k * Y ) = k*log(2) + log(F) + log(1+u) #
-# by k*log(2) + (log(F) + poly). The values of log(F) are #
-# calculated beforehand and stored in the program. #
-# #
-# lognp1: #
-# Step 1: If |X| < 1/16, approximate log(1+X) by an odd #
-# polynomial in u where u = 2X/(2+X). Otherwise, move on #
-# to Step 2. #
-# #
-# Step 2: Let 1+X = 2**k * Y, where 1 <= Y < 2. Define F as done #
-# in Step 2 of the algorithm for LOGN and compute #
-# log(1+X) as k*log(2) + log(F) + poly where poly #
-# approximates log(1+u), u = (Y-F)/F. #
-# #
-# Implementation Notes: #
-# Note 1. There are 64 different possible values for F, thus 64 #
-# log(F)'s need to be tabulated. Moreover, the values of #
-# 1/F are also tabulated so that the division in (Y-F)/F #
-# can be performed by a multiplication. #
-# #
-# Note 2. In Step 2 of lognp1, in order to preserved accuracy, #
-# the value Y-F has to be calculated carefully when #
-# 1/2 <= X < 3/2. #
-# #
-# Note 3. To fully exploit the pipeline, polynomials are usually #
-# separated into two parts evaluated independently before #
-# being added up. #
-# #
-#########################################################################
-LOGOF2:
- long 0x3FFE0000,0xB17217F7,0xD1CF79AC,0x00000000
-
-one:
- long 0x3F800000
-zero:
- long 0x00000000
-infty:
- long 0x7F800000
-negone:
- long 0xBF800000
-
-LOGA6:
- long 0x3FC2499A,0xB5E4040B
-LOGA5:
- long 0xBFC555B5,0x848CB7DB
-
-LOGA4:
- long 0x3FC99999,0x987D8730
-LOGA3:
- long 0xBFCFFFFF,0xFF6F7E97
-
-LOGA2:
- long 0x3FD55555,0x555555A4
-LOGA1:
- long 0xBFE00000,0x00000008
-
-LOGB5:
- long 0x3F175496,0xADD7DAD6
-LOGB4:
- long 0x3F3C71C2,0xFE80C7E0
-
-LOGB3:
- long 0x3F624924,0x928BCCFF
-LOGB2:
- long 0x3F899999,0x999995EC
-
-LOGB1:
- long 0x3FB55555,0x55555555
-TWO:
- long 0x40000000,0x00000000
-
-LTHOLD:
- long 0x3f990000,0x80000000,0x00000000,0x00000000
-
-LOGTBL:
- long 0x3FFE0000,0xFE03F80F,0xE03F80FE,0x00000000
- long 0x3FF70000,0xFF015358,0x833C47E2,0x00000000
- long 0x3FFE0000,0xFA232CF2,0x52138AC0,0x00000000
- long 0x3FF90000,0xBDC8D83E,0xAD88D549,0x00000000
- long 0x3FFE0000,0xF6603D98,0x0F6603DA,0x00000000
- long 0x3FFA0000,0x9CF43DCF,0xF5EAFD48,0x00000000
- long 0x3FFE0000,0xF2B9D648,0x0F2B9D65,0x00000000
- long 0x3FFA0000,0xDA16EB88,0xCB8DF614,0x00000000
- long 0x3FFE0000,0xEF2EB71F,0xC4345238,0x00000000
- long 0x3FFB0000,0x8B29B775,0x1BD70743,0x00000000
- long 0x3FFE0000,0xEBBDB2A5,0xC1619C8C,0x00000000
- long 0x3FFB0000,0xA8D839F8,0x30C1FB49,0x00000000
- long 0x3FFE0000,0xE865AC7B,0x7603A197,0x00000000
- long 0x3FFB0000,0xC61A2EB1,0x8CD907AD,0x00000000
- long 0x3FFE0000,0xE525982A,0xF70C880E,0x00000000
- long 0x3FFB0000,0xE2F2A47A,0xDE3A18AF,0x00000000
- long 0x3FFE0000,0xE1FC780E,0x1FC780E2,0x00000000
- long 0x3FFB0000,0xFF64898E,0xDF55D551,0x00000000
- long 0x3FFE0000,0xDEE95C4C,0xA037BA57,0x00000000
- long 0x3FFC0000,0x8DB956A9,0x7B3D0148,0x00000000
- long 0x3FFE0000,0xDBEB61EE,0xD19C5958,0x00000000
- long 0x3FFC0000,0x9B8FE100,0xF47BA1DE,0x00000000
- long 0x3FFE0000,0xD901B203,0x6406C80E,0x00000000
- long 0x3FFC0000,0xA9372F1D,0x0DA1BD17,0x00000000
- long 0x3FFE0000,0xD62B80D6,0x2B80D62C,0x00000000
- long 0x3FFC0000,0xB6B07F38,0xCE90E46B,0x00000000
- long 0x3FFE0000,0xD3680D36,0x80D3680D,0x00000000
- long 0x3FFC0000,0xC3FD0329,0x06488481,0x00000000
- long 0x3FFE0000,0xD0B69FCB,0xD2580D0B,0x00000000
- long 0x3FFC0000,0xD11DE0FF,0x15AB18CA,0x00000000
- long 0x3FFE0000,0xCE168A77,0x25080CE1,0x00000000
- long 0x3FFC0000,0xDE1433A1,0x6C66B150,0x00000000
- long 0x3FFE0000,0xCB8727C0,0x65C393E0,0x00000000
- long 0x3FFC0000,0xEAE10B5A,0x7DDC8ADD,0x00000000
- long 0x3FFE0000,0xC907DA4E,0x871146AD,0x00000000
- long 0x3FFC0000,0xF7856E5E,0xE2C9B291,0x00000000
- long 0x3FFE0000,0xC6980C69,0x80C6980C,0x00000000
- long 0x3FFD0000,0x82012CA5,0xA68206D7,0x00000000
- long 0x3FFE0000,0xC4372F85,0x5D824CA6,0x00000000
- long 0x3FFD0000,0x882C5FCD,0x7256A8C5,0x00000000
- long 0x3FFE0000,0xC1E4BBD5,0x95F6E947,0x00000000
- long 0x3FFD0000,0x8E44C60B,0x4CCFD7DE,0x00000000
- long 0x3FFE0000,0xBFA02FE8,0x0BFA02FF,0x00000000
- long 0x3FFD0000,0x944AD09E,0xF4351AF6,0x00000000
- long 0x3FFE0000,0xBD691047,0x07661AA3,0x00000000
- long 0x3FFD0000,0x9A3EECD4,0xC3EAA6B2,0x00000000
- long 0x3FFE0000,0xBB3EE721,0xA54D880C,0x00000000
- long 0x3FFD0000,0xA0218434,0x353F1DE8,0x00000000
- long 0x3FFE0000,0xB92143FA,0x36F5E02E,0x00000000
- long 0x3FFD0000,0xA5F2FCAB,0xBBC506DA,0x00000000
- long 0x3FFE0000,0xB70FBB5A,0x19BE3659,0x00000000
- long 0x3FFD0000,0xABB3B8BA,0x2AD362A5,0x00000000
- long 0x3FFE0000,0xB509E68A,0x9B94821F,0x00000000
- long 0x3FFD0000,0xB1641795,0xCE3CA97B,0x00000000
- long 0x3FFE0000,0xB30F6352,0x8917C80B,0x00000000
- long 0x3FFD0000,0xB7047551,0x5D0F1C61,0x00000000
- long 0x3FFE0000,0xB11FD3B8,0x0B11FD3C,0x00000000
- long 0x3FFD0000,0xBC952AFE,0xEA3D13E1,0x00000000
- long 0x3FFE0000,0xAF3ADDC6,0x80AF3ADE,0x00000000
- long 0x3FFD0000,0xC2168ED0,0xF458BA4A,0x00000000
- long 0x3FFE0000,0xAD602B58,0x0AD602B6,0x00000000
- long 0x3FFD0000,0xC788F439,0xB3163BF1,0x00000000
- long 0x3FFE0000,0xAB8F69E2,0x8359CD11,0x00000000
- long 0x3FFD0000,0xCCECAC08,0xBF04565D,0x00000000
- long 0x3FFE0000,0xA9C84A47,0xA07F5638,0x00000000
- long 0x3FFD0000,0xD2420487,0x2DD85160,0x00000000
- long 0x3FFE0000,0xA80A80A8,0x0A80A80B,0x00000000
- long 0x3FFD0000,0xD7894992,0x3BC3588A,0x00000000
- long 0x3FFE0000,0xA655C439,0x2D7B73A8,0x00000000
- long 0x3FFD0000,0xDCC2C4B4,0x9887DACC,0x00000000
- long 0x3FFE0000,0xA4A9CF1D,0x96833751,0x00000000
- long 0x3FFD0000,0xE1EEBD3E,0x6D6A6B9E,0x00000000
- long 0x3FFE0000,0xA3065E3F,0xAE7CD0E0,0x00000000
- long 0x3FFD0000,0xE70D785C,0x2F9F5BDC,0x00000000
- long 0x3FFE0000,0xA16B312E,0xA8FC377D,0x00000000
- long 0x3FFD0000,0xEC1F392C,0x5179F283,0x00000000
- long 0x3FFE0000,0x9FD809FD,0x809FD80A,0x00000000
- long 0x3FFD0000,0xF12440D3,0xE36130E6,0x00000000
- long 0x3FFE0000,0x9E4CAD23,0xDD5F3A20,0x00000000
- long 0x3FFD0000,0xF61CCE92,0x346600BB,0x00000000
- long 0x3FFE0000,0x9CC8E160,0xC3FB19B9,0x00000000
- long 0x3FFD0000,0xFB091FD3,0x8145630A,0x00000000
- long 0x3FFE0000,0x9B4C6F9E,0xF03A3CAA,0x00000000
- long 0x3FFD0000,0xFFE97042,0xBFA4C2AD,0x00000000
- long 0x3FFE0000,0x99D722DA,0xBDE58F06,0x00000000
- long 0x3FFE0000,0x825EFCED,0x49369330,0x00000000
- long 0x3FFE0000,0x9868C809,0x868C8098,0x00000000
- long 0x3FFE0000,0x84C37A7A,0xB9A905C9,0x00000000
- long 0x3FFE0000,0x97012E02,0x5C04B809,0x00000000
- long 0x3FFE0000,0x87224C2E,0x8E645FB7,0x00000000
- long 0x3FFE0000,0x95A02568,0x095A0257,0x00000000
- long 0x3FFE0000,0x897B8CAC,0x9F7DE298,0x00000000
- long 0x3FFE0000,0x94458094,0x45809446,0x00000000
- long 0x3FFE0000,0x8BCF55DE,0xC4CD05FE,0x00000000
- long 0x3FFE0000,0x92F11384,0x0497889C,0x00000000
- long 0x3FFE0000,0x8E1DC0FB,0x89E125E5,0x00000000
- long 0x3FFE0000,0x91A2B3C4,0xD5E6F809,0x00000000
- long 0x3FFE0000,0x9066E68C,0x955B6C9B,0x00000000
- long 0x3FFE0000,0x905A3863,0x3E06C43B,0x00000000
- long 0x3FFE0000,0x92AADE74,0xC7BE59E0,0x00000000
- long 0x3FFE0000,0x8F1779D9,0xFDC3A219,0x00000000
- long 0x3FFE0000,0x94E9BFF6,0x15845643,0x00000000
- long 0x3FFE0000,0x8DDA5202,0x37694809,0x00000000
- long 0x3FFE0000,0x9723A1B7,0x20134203,0x00000000
- long 0x3FFE0000,0x8CA29C04,0x6514E023,0x00000000
- long 0x3FFE0000,0x995899C8,0x90EB8990,0x00000000
- long 0x3FFE0000,0x8B70344A,0x139BC75A,0x00000000
- long 0x3FFE0000,0x9B88BDAA,0x3A3DAE2F,0x00000000
- long 0x3FFE0000,0x8A42F870,0x5669DB46,0x00000000
- long 0x3FFE0000,0x9DB4224F,0xFFE1157C,0x00000000
- long 0x3FFE0000,0x891AC73A,0xE9819B50,0x00000000
- long 0x3FFE0000,0x9FDADC26,0x8B7A12DA,0x00000000
- long 0x3FFE0000,0x87F78087,0xF78087F8,0x00000000
- long 0x3FFE0000,0xA1FCFF17,0xCE733BD4,0x00000000
- long 0x3FFE0000,0x86D90544,0x7A34ACC6,0x00000000
- long 0x3FFE0000,0xA41A9E8F,0x5446FB9F,0x00000000
- long 0x3FFE0000,0x85BF3761,0x2CEE3C9B,0x00000000
- long 0x3FFE0000,0xA633CD7E,0x6771CD8B,0x00000000
- long 0x3FFE0000,0x84A9F9C8,0x084A9F9D,0x00000000
- long 0x3FFE0000,0xA8489E60,0x0B435A5E,0x00000000
- long 0x3FFE0000,0x83993052,0x3FBE3368,0x00000000
- long 0x3FFE0000,0xAA59233C,0xCCA4BD49,0x00000000
- long 0x3FFE0000,0x828CBFBE,0xB9A020A3,0x00000000
- long 0x3FFE0000,0xAC656DAE,0x6BCC4985,0x00000000
- long 0x3FFE0000,0x81848DA8,0xFAF0D277,0x00000000
- long 0x3FFE0000,0xAE6D8EE3,0x60BB2468,0x00000000
- long 0x3FFE0000,0x80808080,0x80808081,0x00000000
- long 0x3FFE0000,0xB07197A2,0x3C46C654,0x00000000
-
- set ADJK,L_SCR1
-
- set X,FP_SCR0
- set XDCARE,X+2
- set XFRAC,X+4
-
- set F,FP_SCR1
- set FFRAC,F+4
-
- set KLOG2,FP_SCR0
-
- set SAVEU,FP_SCR0
-
- global slogn
-#--ENTRY POINT FOR LOG(X) FOR X FINITE, NON-ZERO, NOT NAN'S
-slogn:
- fmov.x (%a0),%fp0 # LOAD INPUT
- mov.l &0x00000000,ADJK(%a6)
-
-LOGBGN:
-#--FPCR SAVED AND CLEARED, INPUT IS 2^(ADJK)*FP0, FP0 CONTAINS
-#--A FINITE, NON-ZERO, NORMALIZED NUMBER.
-
- mov.l (%a0),%d1
- mov.w 4(%a0),%d1
-
- mov.l (%a0),X(%a6)
- mov.l 4(%a0),X+4(%a6)
- mov.l 8(%a0),X+8(%a6)
-
- cmp.l %d1,&0 # CHECK IF X IS NEGATIVE
- blt.w LOGNEG # LOG OF NEGATIVE ARGUMENT IS INVALID
-# X IS POSITIVE, CHECK IF X IS NEAR 1
- cmp.l %d1,&0x3ffef07d # IS X < 15/16?
- blt.b LOGMAIN # YES
- cmp.l %d1,&0x3fff8841 # IS X > 17/16?
- ble.w LOGNEAR1 # NO
-
-LOGMAIN:
-#--THIS SHOULD BE THE USUAL CASE, X NOT VERY CLOSE TO 1
-
-#--X = 2^(K) * Y, 1 <= Y < 2. THUS, Y = 1.XXXXXXXX....XX IN BINARY.
-#--WE DEFINE F = 1.XXXXXX1, I.E. FIRST 7 BITS OF Y AND ATTACH A 1.
-#--THE IDEA IS THAT LOG(X) = K*LOG2 + LOG(Y)
-#-- = K*LOG2 + LOG(F) + LOG(1 + (Y-F)/F).
-#--NOTE THAT U = (Y-F)/F IS VERY SMALL AND THUS APPROXIMATING
-#--LOG(1+U) CAN BE VERY EFFICIENT.
-#--ALSO NOTE THAT THE VALUE 1/F IS STORED IN A TABLE SO THAT NO
-#--DIVISION IS NEEDED TO CALCULATE (Y-F)/F.
-
-#--GET K, Y, F, AND ADDRESS OF 1/F.
- asr.l &8,%d1
- asr.l &8,%d1 # SHIFTED 16 BITS, BIASED EXPO. OF X
- sub.l &0x3FFF,%d1 # THIS IS K
- add.l ADJK(%a6),%d1 # ADJUST K, ORIGINAL INPUT MAY BE DENORM.
- lea LOGTBL(%pc),%a0 # BASE ADDRESS OF 1/F AND LOG(F)
- fmov.l %d1,%fp1 # CONVERT K TO FLOATING-POINT FORMAT
-
-#--WHILE THE CONVERSION IS GOING ON, WE GET F AND ADDRESS OF 1/F
- mov.l &0x3FFF0000,X(%a6) # X IS NOW Y, I.E. 2^(-K)*X
- mov.l XFRAC(%a6),FFRAC(%a6)
- and.l &0xFE000000,FFRAC(%a6) # FIRST 7 BITS OF Y
- or.l &0x01000000,FFRAC(%a6) # GET F: ATTACH A 1 AT THE EIGHTH BIT
- mov.l FFRAC(%a6),%d1 # READY TO GET ADDRESS OF 1/F
- and.l &0x7E000000,%d1
- asr.l &8,%d1
- asr.l &8,%d1
- asr.l &4,%d1 # SHIFTED 20, D0 IS THE DISPLACEMENT
- add.l %d1,%a0 # A0 IS THE ADDRESS FOR 1/F
-
- fmov.x X(%a6),%fp0
- mov.l &0x3fff0000,F(%a6)
- clr.l F+8(%a6)
- fsub.x F(%a6),%fp0 # Y-F
- fmovm.x &0xc,-(%sp) # SAVE FP2-3 WHILE FP0 IS NOT READY
-#--SUMMARY: FP0 IS Y-F, A0 IS ADDRESS OF 1/F, FP1 IS K
-#--REGISTERS SAVED: FPCR, FP1, FP2
-
-LP1CONT1:
-#--AN RE-ENTRY POINT FOR LOGNP1
- fmul.x (%a0),%fp0 # FP0 IS U = (Y-F)/F
- fmul.x LOGOF2(%pc),%fp1 # GET K*LOG2 WHILE FP0 IS NOT READY
- fmov.x %fp0,%fp2
- fmul.x %fp2,%fp2 # FP2 IS V=U*U
- fmov.x %fp1,KLOG2(%a6) # PUT K*LOG2 IN MEMEORY, FREE FP1
-
-#--LOG(1+U) IS APPROXIMATED BY
-#--U + V*(A1+U*(A2+U*(A3+U*(A4+U*(A5+U*A6))))) WHICH IS
-#--[U + V*(A1+V*(A3+V*A5))] + [U*V*(A2+V*(A4+V*A6))]
-
- fmov.x %fp2,%fp3
- fmov.x %fp2,%fp1
-
- fmul.d LOGA6(%pc),%fp1 # V*A6
- fmul.d LOGA5(%pc),%fp2 # V*A5
-
- fadd.d LOGA4(%pc),%fp1 # A4+V*A6
- fadd.d LOGA3(%pc),%fp2 # A3+V*A5
-
- fmul.x %fp3,%fp1 # V*(A4+V*A6)
- fmul.x %fp3,%fp2 # V*(A3+V*A5)
-
- fadd.d LOGA2(%pc),%fp1 # A2+V*(A4+V*A6)
- fadd.d LOGA1(%pc),%fp2 # A1+V*(A3+V*A5)
-
- fmul.x %fp3,%fp1 # V*(A2+V*(A4+V*A6))
- add.l &16,%a0 # ADDRESS OF LOG(F)
- fmul.x %fp3,%fp2 # V*(A1+V*(A3+V*A5))
-
- fmul.x %fp0,%fp1 # U*V*(A2+V*(A4+V*A6))
- fadd.x %fp2,%fp0 # U+V*(A1+V*(A3+V*A5))
-
- fadd.x (%a0),%fp1 # LOG(F)+U*V*(A2+V*(A4+V*A6))
- fmovm.x (%sp)+,&0x30 # RESTORE FP2-3
- fadd.x %fp1,%fp0 # FP0 IS LOG(F) + LOG(1+U)
-
- fmov.l %d0,%fpcr
- fadd.x KLOG2(%a6),%fp0 # FINAL ADD
- bra t_inx2
-
-
-LOGNEAR1:
-
-# if the input is exactly equal to one, then exit through ld_pzero.
-# if these 2 lines weren't here, the correct answer would be returned
-# but the INEX2 bit would be set.
- fcmp.b %fp0,&0x1 # is it equal to one?
- fbeq.l ld_pzero # yes
-
-#--REGISTERS SAVED: FPCR, FP1. FP0 CONTAINS THE INPUT.
- fmov.x %fp0,%fp1
- fsub.s one(%pc),%fp1 # FP1 IS X-1
- fadd.s one(%pc),%fp0 # FP0 IS X+1
- fadd.x %fp1,%fp1 # FP1 IS 2(X-1)
-#--LOG(X) = LOG(1+U/2)-LOG(1-U/2) WHICH IS AN ODD POLYNOMIAL
-#--IN U, U = 2(X-1)/(X+1) = FP1/FP0
-
-LP1CONT2:
-#--THIS IS AN RE-ENTRY POINT FOR LOGNP1
- fdiv.x %fp0,%fp1 # FP1 IS U
- fmovm.x &0xc,-(%sp) # SAVE FP2-3
-#--REGISTERS SAVED ARE NOW FPCR,FP1,FP2,FP3
-#--LET V=U*U, W=V*V, CALCULATE
-#--U + U*V*(B1 + V*(B2 + V*(B3 + V*(B4 + V*B5)))) BY
-#--U + U*V*( [B1 + W*(B3 + W*B5)] + [V*(B2 + W*B4)] )
- fmov.x %fp1,%fp0
- fmul.x %fp0,%fp0 # FP0 IS V
- fmov.x %fp1,SAVEU(%a6) # STORE U IN MEMORY, FREE FP1
- fmov.x %fp0,%fp1
- fmul.x %fp1,%fp1 # FP1 IS W
-
- fmov.d LOGB5(%pc),%fp3
- fmov.d LOGB4(%pc),%fp2
-
- fmul.x %fp1,%fp3 # W*B5
- fmul.x %fp1,%fp2 # W*B4
-
- fadd.d LOGB3(%pc),%fp3 # B3+W*B5
- fadd.d LOGB2(%pc),%fp2 # B2+W*B4
-
- fmul.x %fp3,%fp1 # W*(B3+W*B5), FP3 RELEASED
-
- fmul.x %fp0,%fp2 # V*(B2+W*B4)
-
- fadd.d LOGB1(%pc),%fp1 # B1+W*(B3+W*B5)
- fmul.x SAVEU(%a6),%fp0 # FP0 IS U*V
-
- fadd.x %fp2,%fp1 # B1+W*(B3+W*B5) + V*(B2+W*B4), FP2 RELEASED
- fmovm.x (%sp)+,&0x30 # FP2-3 RESTORED
-
- fmul.x %fp1,%fp0 # U*V*( [B1+W*(B3+W*B5)] + [V*(B2+W*B4)] )
-
- fmov.l %d0,%fpcr
- fadd.x SAVEU(%a6),%fp0
- bra t_inx2
-
-#--REGISTERS SAVED FPCR. LOG(-VE) IS INVALID
-LOGNEG:
- bra t_operr
-
- global slognd
-slognd:
-#--ENTRY POINT FOR LOG(X) FOR DENORMALIZED INPUT
-
- mov.l &-100,ADJK(%a6) # INPUT = 2^(ADJK) * FP0
-
-#----normalize the input value by left shifting k bits (k to be determined
-#----below), adjusting exponent and storing -k to ADJK
-#----the value TWOTO100 is no longer needed.
-#----Note that this code assumes the denormalized input is NON-ZERO.
-
- movm.l &0x3f00,-(%sp) # save some registers {d2-d7}
- mov.l (%a0),%d3 # D3 is exponent of smallest norm. #
- mov.l 4(%a0),%d4
- mov.l 8(%a0),%d5 # (D4,D5) is (Hi_X,Lo_X)
- clr.l %d2 # D2 used for holding K
-
- tst.l %d4
- bne.b Hi_not0
-
-Hi_0:
- mov.l %d5,%d4
- clr.l %d5
- mov.l &32,%d2
- clr.l %d6
- bfffo %d4{&0:&32},%d6
- lsl.l %d6,%d4
- add.l %d6,%d2 # (D3,D4,D5) is normalized
-
- mov.l %d3,X(%a6)
- mov.l %d4,XFRAC(%a6)
- mov.l %d5,XFRAC+4(%a6)
- neg.l %d2
- mov.l %d2,ADJK(%a6)
- fmov.x X(%a6),%fp0
- movm.l (%sp)+,&0xfc # restore registers {d2-d7}
- lea X(%a6),%a0
- bra.w LOGBGN # begin regular log(X)
-
-Hi_not0:
- clr.l %d6
- bfffo %d4{&0:&32},%d6 # find first 1
- mov.l %d6,%d2 # get k
- lsl.l %d6,%d4
- mov.l %d5,%d7 # a copy of D5
- lsl.l %d6,%d5
- neg.l %d6
- add.l &32,%d6
- lsr.l %d6,%d7
- or.l %d7,%d4 # (D3,D4,D5) normalized
-
- mov.l %d3,X(%a6)
- mov.l %d4,XFRAC(%a6)
- mov.l %d5,XFRAC+4(%a6)
- neg.l %d2
- mov.l %d2,ADJK(%a6)
- fmov.x X(%a6),%fp0
- movm.l (%sp)+,&0xfc # restore registers {d2-d7}
- lea X(%a6),%a0
- bra.w LOGBGN # begin regular log(X)
-
- global slognp1
-#--ENTRY POINT FOR LOG(1+X) FOR X FINITE, NON-ZERO, NOT NAN'S
-slognp1:
- fmov.x (%a0),%fp0 # LOAD INPUT
- fabs.x %fp0 # test magnitude
- fcmp.x %fp0,LTHOLD(%pc) # compare with min threshold
- fbgt.w LP1REAL # if greater, continue
- fmov.l %d0,%fpcr
- mov.b &FMOV_OP,%d1 # last inst is MOVE
- fmov.x (%a0),%fp0 # return signed argument
- bra t_catch
-
-LP1REAL:
- fmov.x (%a0),%fp0 # LOAD INPUT
- mov.l &0x00000000,ADJK(%a6)
- fmov.x %fp0,%fp1 # FP1 IS INPUT Z
- fadd.s one(%pc),%fp0 # X := ROUND(1+Z)
- fmov.x %fp0,X(%a6)
- mov.w XFRAC(%a6),XDCARE(%a6)
- mov.l X(%a6),%d1
- cmp.l %d1,&0
- ble.w LP1NEG0 # LOG OF ZERO OR -VE
- cmp.l %d1,&0x3ffe8000 # IS BOUNDS [1/2,3/2]?
- blt.w LOGMAIN
- cmp.l %d1,&0x3fffc000
- bgt.w LOGMAIN
-#--IF 1+Z > 3/2 OR 1+Z < 1/2, THEN X, WHICH IS ROUNDING 1+Z,
-#--CONTAINS AT LEAST 63 BITS OF INFORMATION OF Z. IN THAT CASE,
-#--SIMPLY INVOKE LOG(X) FOR LOG(1+Z).
-
-LP1NEAR1:
-#--NEXT SEE IF EXP(-1/16) < X < EXP(1/16)
- cmp.l %d1,&0x3ffef07d
- blt.w LP1CARE
- cmp.l %d1,&0x3fff8841
- bgt.w LP1CARE
-
-LP1ONE16:
-#--EXP(-1/16) < X < EXP(1/16). LOG(1+Z) = LOG(1+U/2) - LOG(1-U/2)
-#--WHERE U = 2Z/(2+Z) = 2Z/(1+X).
- fadd.x %fp1,%fp1 # FP1 IS 2Z
- fadd.s one(%pc),%fp0 # FP0 IS 1+X
-#--U = FP1/FP0
- bra.w LP1CONT2
-
-LP1CARE:
-#--HERE WE USE THE USUAL TABLE DRIVEN APPROACH. CARE HAS TO BE
-#--TAKEN BECAUSE 1+Z CAN HAVE 67 BITS OF INFORMATION AND WE MUST
-#--PRESERVE ALL THE INFORMATION. BECAUSE 1+Z IS IN [1/2,3/2],
-#--THERE ARE ONLY TWO CASES.
-#--CASE 1: 1+Z < 1, THEN K = -1 AND Y-F = (2-F) + 2Z
-#--CASE 2: 1+Z > 1, THEN K = 0 AND Y-F = (1-F) + Z
-#--ON RETURNING TO LP1CONT1, WE MUST HAVE K IN FP1, ADDRESS OF
-#--(1/F) IN A0, Y-F IN FP0, AND FP2 SAVED.
-
- mov.l XFRAC(%a6),FFRAC(%a6)
- and.l &0xFE000000,FFRAC(%a6)
- or.l &0x01000000,FFRAC(%a6) # F OBTAINED
- cmp.l %d1,&0x3FFF8000 # SEE IF 1+Z > 1
- bge.b KISZERO
-
-KISNEG1:
- fmov.s TWO(%pc),%fp0
- mov.l &0x3fff0000,F(%a6)
- clr.l F+8(%a6)
- fsub.x F(%a6),%fp0 # 2-F
- mov.l FFRAC(%a6),%d1
- and.l &0x7E000000,%d1
- asr.l &8,%d1
- asr.l &8,%d1
- asr.l &4,%d1 # D0 CONTAINS DISPLACEMENT FOR 1/F
- fadd.x %fp1,%fp1 # GET 2Z
- fmovm.x &0xc,-(%sp) # SAVE FP2 {%fp2/%fp3}
- fadd.x %fp1,%fp0 # FP0 IS Y-F = (2-F)+2Z
- lea LOGTBL(%pc),%a0 # A0 IS ADDRESS OF 1/F
- add.l %d1,%a0
- fmov.s negone(%pc),%fp1 # FP1 IS K = -1
- bra.w LP1CONT1
-
-KISZERO:
- fmov.s one(%pc),%fp0
- mov.l &0x3fff0000,F(%a6)
- clr.l F+8(%a6)
- fsub.x F(%a6),%fp0 # 1-F
- mov.l FFRAC(%a6),%d1
- and.l &0x7E000000,%d1
- asr.l &8,%d1
- asr.l &8,%d1
- asr.l &4,%d1
- fadd.x %fp1,%fp0 # FP0 IS Y-F
- fmovm.x &0xc,-(%sp) # FP2 SAVED {%fp2/%fp3}
- lea LOGTBL(%pc),%a0
- add.l %d1,%a0 # A0 IS ADDRESS OF 1/F
- fmov.s zero(%pc),%fp1 # FP1 IS K = 0
- bra.w LP1CONT1
-
-LP1NEG0:
-#--FPCR SAVED. D0 IS X IN COMPACT FORM.
- cmp.l %d1,&0
- blt.b LP1NEG
-LP1ZERO:
- fmov.s negone(%pc),%fp0
-
- fmov.l %d0,%fpcr
- bra t_dz
-
-LP1NEG:
- fmov.s zero(%pc),%fp0
-
- fmov.l %d0,%fpcr
- bra t_operr
-
- global slognp1d
-#--ENTRY POINT FOR LOG(1+Z) FOR DENORMALIZED INPUT
-# Simply return the denorm
-slognp1d:
- bra t_extdnrm
-
-#########################################################################
-# satanh(): computes the inverse hyperbolic tangent of a norm input #
-# satanhd(): computes the inverse hyperbolic tangent of a denorm input #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input #
-# d0 = round precision,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = arctanh(X) #
-# #
-# ACCURACY and MONOTONICITY ******************************************* #
-# The returned result is within 3 ulps in 64 significant bit, #
-# i.e. within 0.5001 ulp to 53 bits if the result is subsequently #
-# rounded to double precision. The result is provably monotonic #
-# in double precision. #
-# #
-# ALGORITHM *********************************************************** #
-# #
-# ATANH #
-# 1. If |X| >= 1, go to 3. #
-# #
-# 2. (|X| < 1) Calculate atanh(X) by #
-# sgn := sign(X) #
-# y := |X| #
-# z := 2y/(1-y) #
-# atanh(X) := sgn * (1/2) * logp1(z) #
-# Exit. #
-# #
-# 3. If |X| > 1, go to 5. #
-# #
-# 4. (|X| = 1) Generate infinity with an appropriate sign and #
-# divide-by-zero by #
-# sgn := sign(X) #
-# atan(X) := sgn / (+0). #
-# Exit. #
-# #
-# 5. (|X| > 1) Generate an invalid operation by 0 * infinity. #
-# Exit. #
-# #
-#########################################################################
-
- global satanh
-satanh:
- mov.l (%a0),%d1
- mov.w 4(%a0),%d1
- and.l &0x7FFFFFFF,%d1
- cmp.l %d1,&0x3FFF8000
- bge.b ATANHBIG
-
-#--THIS IS THE USUAL CASE, |X| < 1
-#--Y = |X|, Z = 2Y/(1-Y), ATANH(X) = SIGN(X) * (1/2) * LOG1P(Z).
-
- fabs.x (%a0),%fp0 # Y = |X|
- fmov.x %fp0,%fp1
- fneg.x %fp1 # -Y
- fadd.x %fp0,%fp0 # 2Y
- fadd.s &0x3F800000,%fp1 # 1-Y
- fdiv.x %fp1,%fp0 # 2Y/(1-Y)
- mov.l (%a0),%d1
- and.l &0x80000000,%d1
- or.l &0x3F000000,%d1 # SIGN(X)*HALF
- mov.l %d1,-(%sp)
-
- mov.l %d0,-(%sp) # save rnd prec,mode
- clr.l %d0 # pass ext prec,RN
- fmovm.x &0x01,-(%sp) # save Z on stack
- lea (%sp),%a0 # pass ptr to Z
- bsr slognp1 # LOG1P(Z)
- add.l &0xc,%sp # clear Z from stack
-
- mov.l (%sp)+,%d0 # fetch old prec,mode
- fmov.l %d0,%fpcr # load it
- mov.b &FMUL_OP,%d1 # last inst is MUL
- fmul.s (%sp)+,%fp0
- bra t_catch
-
-ATANHBIG:
- fabs.x (%a0),%fp0 # |X|
- fcmp.s %fp0,&0x3F800000
- fbgt t_operr
- bra t_dz
-
- global satanhd
-#--ATANH(X) = X FOR DENORMALIZED X
-satanhd:
- bra t_extdnrm
-
-#########################################################################
-# slog10(): computes the base-10 logarithm of a normalized input #
-# slog10d(): computes the base-10 logarithm of a denormalized input #
-# slog2(): computes the base-2 logarithm of a normalized input #
-# slog2d(): computes the base-2 logarithm of a denormalized input #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input #
-# d0 = round precision,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = log_10(X) or log_2(X) #
-# #
-# ACCURACY and MONOTONICITY ******************************************* #
-# The returned result is within 1.7 ulps in 64 significant bit, #
-# i.e. within 0.5003 ulp to 53 bits if the result is subsequently #
-# rounded to double precision. The result is provably monotonic #
-# in double precision. #
-# #
-# ALGORITHM *********************************************************** #
-# #
-# slog10d: #
-# #
-# Step 0. If X < 0, create a NaN and raise the invalid operation #
-# flag. Otherwise, save FPCR in D1; set FpCR to default. #
-# Notes: Default means round-to-nearest mode, no floating-point #
-# traps, and precision control = double extended. #
-# #
-# Step 1. Call slognd to obtain Y = log(X), the natural log of X. #
-# Notes: Even if X is denormalized, log(X) is always normalized. #
-# #
-# Step 2. Compute log_10(X) = log(X) * (1/log(10)). #
-# 2.1 Restore the user FPCR #
-# 2.2 Return ans := Y * INV_L10. #
-# #
-# slog10: #
-# #
-# Step 0. If X < 0, create a NaN and raise the invalid operation #
-# flag. Otherwise, save FPCR in D1; set FpCR to default. #
-# Notes: Default means round-to-nearest mode, no floating-point #
-# traps, and precision control = double extended. #
-# #
-# Step 1. Call sLogN to obtain Y = log(X), the natural log of X. #
-# #
-# Step 2. Compute log_10(X) = log(X) * (1/log(10)). #
-# 2.1 Restore the user FPCR #
-# 2.2 Return ans := Y * INV_L10. #
-# #
-# sLog2d: #
-# #
-# Step 0. If X < 0, create a NaN and raise the invalid operation #
-# flag. Otherwise, save FPCR in D1; set FpCR to default. #
-# Notes: Default means round-to-nearest mode, no floating-point #
-# traps, and precision control = double extended. #
-# #
-# Step 1. Call slognd to obtain Y = log(X), the natural log of X. #
-# Notes: Even if X is denormalized, log(X) is always normalized. #
-# #
-# Step 2. Compute log_10(X) = log(X) * (1/log(2)). #
-# 2.1 Restore the user FPCR #
-# 2.2 Return ans := Y * INV_L2. #
-# #
-# sLog2: #
-# #
-# Step 0. If X < 0, create a NaN and raise the invalid operation #
-# flag. Otherwise, save FPCR in D1; set FpCR to default. #
-# Notes: Default means round-to-nearest mode, no floating-point #
-# traps, and precision control = double extended. #
-# #
-# Step 1. If X is not an integer power of two, i.e., X != 2^k, #
-# go to Step 3. #
-# #
-# Step 2. Return k. #
-# 2.1 Get integer k, X = 2^k. #
-# 2.2 Restore the user FPCR. #
-# 2.3 Return ans := convert-to-double-extended(k). #
-# #
-# Step 3. Call sLogN to obtain Y = log(X), the natural log of X. #
-# #
-# Step 4. Compute log_2(X) = log(X) * (1/log(2)). #
-# 4.1 Restore the user FPCR #
-# 4.2 Return ans := Y * INV_L2. #
-# #
-#########################################################################
-
-INV_L10:
- long 0x3FFD0000,0xDE5BD8A9,0x37287195,0x00000000
-
-INV_L2:
- long 0x3FFF0000,0xB8AA3B29,0x5C17F0BC,0x00000000
-
- global slog10
-#--entry point for Log10(X), X is normalized
-slog10:
- fmov.b &0x1,%fp0
- fcmp.x %fp0,(%a0) # if operand == 1,
- fbeq.l ld_pzero # return an EXACT zero
-
- mov.l (%a0),%d1
- blt.w invalid
- mov.l %d0,-(%sp)
- clr.l %d0
- bsr slogn # log(X), X normal.
- fmov.l (%sp)+,%fpcr
- fmul.x INV_L10(%pc),%fp0
- bra t_inx2
-
- global slog10d
-#--entry point for Log10(X), X is denormalized
-slog10d:
- mov.l (%a0),%d1
- blt.w invalid
- mov.l %d0,-(%sp)
- clr.l %d0
- bsr slognd # log(X), X denorm.
- fmov.l (%sp)+,%fpcr
- fmul.x INV_L10(%pc),%fp0
- bra t_minx2
-
- global slog2
-#--entry point for Log2(X), X is normalized
-slog2:
- mov.l (%a0),%d1
- blt.w invalid
-
- mov.l 8(%a0),%d1
- bne.b continue # X is not 2^k
-
- mov.l 4(%a0),%d1
- and.l &0x7FFFFFFF,%d1
- bne.b continue
-
-#--X = 2^k.
- mov.w (%a0),%d1
- and.l &0x00007FFF,%d1
- sub.l &0x3FFF,%d1
- beq.l ld_pzero
- fmov.l %d0,%fpcr
- fmov.l %d1,%fp0
- bra t_inx2
-
-continue:
- mov.l %d0,-(%sp)
- clr.l %d0
- bsr slogn # log(X), X normal.
- fmov.l (%sp)+,%fpcr
- fmul.x INV_L2(%pc),%fp0
- bra t_inx2
-
-invalid:
- bra t_operr
-
- global slog2d
-#--entry point for Log2(X), X is denormalized
-slog2d:
- mov.l (%a0),%d1
- blt.w invalid
- mov.l %d0,-(%sp)
- clr.l %d0
- bsr slognd # log(X), X denorm.
- fmov.l (%sp)+,%fpcr
- fmul.x INV_L2(%pc),%fp0
- bra t_minx2
-
-#########################################################################
-# stwotox(): computes 2**X for a normalized input #
-# stwotoxd(): computes 2**X for a denormalized input #
-# stentox(): computes 10**X for a normalized input #
-# stentoxd(): computes 10**X for a denormalized input #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input #
-# d0 = round precision,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = 2**X or 10**X #
-# #
-# ACCURACY and MONOTONICITY ******************************************* #
-# The returned result is within 2 ulps in 64 significant bit, #
-# i.e. within 0.5001 ulp to 53 bits if the result is subsequently #
-# rounded to double precision. The result is provably monotonic #
-# in double precision. #
-# #
-# ALGORITHM *********************************************************** #
-# #
-# twotox #
-# 1. If |X| > 16480, go to ExpBig. #
-# #
-# 2. If |X| < 2**(-70), go to ExpSm. #
-# #
-# 3. Decompose X as X = N/64 + r where |r| <= 1/128. Furthermore #
-# decompose N as #
-# N = 64(M + M') + j, j = 0,1,2,...,63. #
-# #
-# 4. Overwrite r := r * log2. Then #
-# 2**X = 2**(M') * 2**(M) * 2**(j/64) * exp(r). #
-# Go to expr to compute that expression. #
-# #
-# tentox #
-# 1. If |X| > 16480*log_10(2) (base 10 log of 2), go to ExpBig. #
-# #
-# 2. If |X| < 2**(-70), go to ExpSm. #
-# #
-# 3. Set y := X*log_2(10)*64 (base 2 log of 10). Set #
-# N := round-to-int(y). Decompose N as #
-# N = 64(M + M') + j, j = 0,1,2,...,63. #
-# #
-# 4. Define r as #
-# r := ((X - N*L1)-N*L2) * L10 #
-# where L1, L2 are the leading and trailing parts of #
-# log_10(2)/64 and L10 is the natural log of 10. Then #
-# 10**X = 2**(M') * 2**(M) * 2**(j/64) * exp(r). #
-# Go to expr to compute that expression. #
-# #
-# expr #
-# 1. Fetch 2**(j/64) from table as Fact1 and Fact2. #
-# #
-# 2. Overwrite Fact1 and Fact2 by #
-# Fact1 := 2**(M) * Fact1 #
-# Fact2 := 2**(M) * Fact2 #
-# Thus Fact1 + Fact2 = 2**(M) * 2**(j/64). #
-# #
-# 3. Calculate P where 1 + P approximates exp(r): #
-# P = r + r*r*(A1+r*(A2+...+r*A5)). #
-# #
-# 4. Let AdjFact := 2**(M'). Return #
-# AdjFact * ( Fact1 + ((Fact1*P) + Fact2) ). #
-# Exit. #
-# #
-# ExpBig #
-# 1. Generate overflow by Huge * Huge if X > 0; otherwise, #
-# generate underflow by Tiny * Tiny. #
-# #
-# ExpSm #
-# 1. Return 1 + X. #
-# #
-#########################################################################
-
-L2TEN64:
- long 0x406A934F,0x0979A371 # 64LOG10/LOG2
-L10TWO1:
- long 0x3F734413,0x509F8000 # LOG2/64LOG10
-
-L10TWO2:
- long 0xBFCD0000,0xC0219DC1,0xDA994FD2,0x00000000
-
-LOG10: long 0x40000000,0x935D8DDD,0xAAA8AC17,0x00000000
-
-LOG2: long 0x3FFE0000,0xB17217F7,0xD1CF79AC,0x00000000
-
-EXPA5: long 0x3F56C16D,0x6F7BD0B2
-EXPA4: long 0x3F811112,0x302C712C
-EXPA3: long 0x3FA55555,0x55554CC1
-EXPA2: long 0x3FC55555,0x55554A54
-EXPA1: long 0x3FE00000,0x00000000,0x00000000,0x00000000
-
-TEXPTBL:
- long 0x3FFF0000,0x80000000,0x00000000,0x3F738000
- long 0x3FFF0000,0x8164D1F3,0xBC030773,0x3FBEF7CA
- long 0x3FFF0000,0x82CD8698,0xAC2BA1D7,0x3FBDF8A9
- long 0x3FFF0000,0x843A28C3,0xACDE4046,0x3FBCD7C9
- long 0x3FFF0000,0x85AAC367,0xCC487B15,0xBFBDE8DA
- long 0x3FFF0000,0x871F6196,0x9E8D1010,0x3FBDE85C
- long 0x3FFF0000,0x88980E80,0x92DA8527,0x3FBEBBF1
- long 0x3FFF0000,0x8A14D575,0x496EFD9A,0x3FBB80CA
- long 0x3FFF0000,0x8B95C1E3,0xEA8BD6E7,0xBFBA8373
- long 0x3FFF0000,0x8D1ADF5B,0x7E5BA9E6,0xBFBE9670
- long 0x3FFF0000,0x8EA4398B,0x45CD53C0,0x3FBDB700
- long 0x3FFF0000,0x9031DC43,0x1466B1DC,0x3FBEEEB0
- long 0x3FFF0000,0x91C3D373,0xAB11C336,0x3FBBFD6D
- long 0x3FFF0000,0x935A2B2F,0x13E6E92C,0xBFBDB319
- long 0x3FFF0000,0x94F4EFA8,0xFEF70961,0x3FBDBA2B
- long 0x3FFF0000,0x96942D37,0x20185A00,0x3FBE91D5
- long 0x3FFF0000,0x9837F051,0x8DB8A96F,0x3FBE8D5A
- long 0x3FFF0000,0x99E04593,0x20B7FA65,0xBFBCDE7B
- long 0x3FFF0000,0x9B8D39B9,0xD54E5539,0xBFBEBAAF
- long 0x3FFF0000,0x9D3ED9A7,0x2CFFB751,0xBFBD86DA
- long 0x3FFF0000,0x9EF53260,0x91A111AE,0xBFBEBEDD
- long 0x3FFF0000,0xA0B0510F,0xB9714FC2,0x3FBCC96E
- long 0x3FFF0000,0xA2704303,0x0C496819,0xBFBEC90B
- long 0x3FFF0000,0xA43515AE,0x09E6809E,0x3FBBD1DB
- long 0x3FFF0000,0xA5FED6A9,0xB15138EA,0x3FBCE5EB
- long 0x3FFF0000,0xA7CD93B4,0xE965356A,0xBFBEC274
- long 0x3FFF0000,0xA9A15AB4,0xEA7C0EF8,0x3FBEA83C
- long 0x3FFF0000,0xAB7A39B5,0xA93ED337,0x3FBECB00
- long 0x3FFF0000,0xAD583EEA,0x42A14AC6,0x3FBE9301
- long 0x3FFF0000,0xAF3B78AD,0x690A4375,0xBFBD8367
- long 0x3FFF0000,0xB123F581,0xD2AC2590,0xBFBEF05F
- long 0x3FFF0000,0xB311C412,0xA9112489,0x3FBDFB3C
- long 0x3FFF0000,0xB504F333,0xF9DE6484,0x3FBEB2FB
- long 0x3FFF0000,0xB6FD91E3,0x28D17791,0x3FBAE2CB
- long 0x3FFF0000,0xB8FBAF47,0x62FB9EE9,0x3FBCDC3C
- long 0x3FFF0000,0xBAFF5AB2,0x133E45FB,0x3FBEE9AA
- long 0x3FFF0000,0xBD08A39F,0x580C36BF,0xBFBEAEFD
- long 0x3FFF0000,0xBF1799B6,0x7A731083,0xBFBCBF51
- long 0x3FFF0000,0xC12C4CCA,0x66709456,0x3FBEF88A
- long 0x3FFF0000,0xC346CCDA,0x24976407,0x3FBD83B2
- long 0x3FFF0000,0xC5672A11,0x5506DADD,0x3FBDF8AB
- long 0x3FFF0000,0xC78D74C8,0xABB9B15D,0xBFBDFB17
- long 0x3FFF0000,0xC9B9BD86,0x6E2F27A3,0xBFBEFE3C
- long 0x3FFF0000,0xCBEC14FE,0xF2727C5D,0xBFBBB6F8
- long 0x3FFF0000,0xCE248C15,0x1F8480E4,0xBFBCEE53
- long 0x3FFF0000,0xD06333DA,0xEF2B2595,0xBFBDA4AE
- long 0x3FFF0000,0xD2A81D91,0xF12AE45A,0x3FBC9124
- long 0x3FFF0000,0xD4F35AAB,0xCFEDFA1F,0x3FBEB243
- long 0x3FFF0000,0xD744FCCA,0xD69D6AF4,0x3FBDE69A
- long 0x3FFF0000,0xD99D15C2,0x78AFD7B6,0xBFB8BC61
- long 0x3FFF0000,0xDBFBB797,0xDAF23755,0x3FBDF610
- long 0x3FFF0000,0xDE60F482,0x5E0E9124,0xBFBD8BE1
- long 0x3FFF0000,0xE0CCDEEC,0x2A94E111,0x3FBACB12
- long 0x3FFF0000,0xE33F8972,0xBE8A5A51,0x3FBB9BFE
- long 0x3FFF0000,0xE5B906E7,0x7C8348A8,0x3FBCF2F4
- long 0x3FFF0000,0xE8396A50,0x3C4BDC68,0x3FBEF22F
- long 0x3FFF0000,0xEAC0C6E7,0xDD24392F,0xBFBDBF4A
- long 0x3FFF0000,0xED4F301E,0xD9942B84,0x3FBEC01A
- long 0x3FFF0000,0xEFE4B99B,0xDCDAF5CB,0x3FBE8CAC
- long 0x3FFF0000,0xF281773C,0x59FFB13A,0xBFBCBB3F
- long 0x3FFF0000,0xF5257D15,0x2486CC2C,0x3FBEF73A
- long 0x3FFF0000,0xF7D0DF73,0x0AD13BB9,0xBFB8B795
- long 0x3FFF0000,0xFA83B2DB,0x722A033A,0x3FBEF84B
- long 0x3FFF0000,0xFD3E0C0C,0xF486C175,0xBFBEF581
-
- set INT,L_SCR1
-
- set X,FP_SCR0
- set XDCARE,X+2
- set XFRAC,X+4
-
- set ADJFACT,FP_SCR0
-
- set FACT1,FP_SCR0
- set FACT1HI,FACT1+4
- set FACT1LOW,FACT1+8
-
- set FACT2,FP_SCR1
- set FACT2HI,FACT2+4
- set FACT2LOW,FACT2+8
-
- global stwotox
-#--ENTRY POINT FOR 2**(X), HERE X IS FINITE, NON-ZERO, AND NOT NAN'S
-stwotox:
- fmovm.x (%a0),&0x80 # LOAD INPUT
-
- mov.l (%a0),%d1
- mov.w 4(%a0),%d1
- fmov.x %fp0,X(%a6)
- and.l &0x7FFFFFFF,%d1
-
- cmp.l %d1,&0x3FB98000 # |X| >= 2**(-70)?
- bge.b TWOOK1
- bra.w EXPBORS
-
-TWOOK1:
- cmp.l %d1,&0x400D80C0 # |X| > 16480?
- ble.b TWOMAIN
- bra.w EXPBORS
-
-TWOMAIN:
-#--USUAL CASE, 2^(-70) <= |X| <= 16480
-
- fmov.x %fp0,%fp1
- fmul.s &0x42800000,%fp1 # 64 * X
- fmov.l %fp1,INT(%a6) # N = ROUND-TO-INT(64 X)
- mov.l %d2,-(%sp)
- lea TEXPTBL(%pc),%a1 # LOAD ADDRESS OF TABLE OF 2^(J/64)
- fmov.l INT(%a6),%fp1 # N --> FLOATING FMT
- mov.l INT(%a6),%d1
- mov.l %d1,%d2
- and.l &0x3F,%d1 # D0 IS J
- asl.l &4,%d1 # DISPLACEMENT FOR 2^(J/64)
- add.l %d1,%a1 # ADDRESS FOR 2^(J/64)
- asr.l &6,%d2 # d2 IS L, N = 64L + J
- mov.l %d2,%d1
- asr.l &1,%d1 # D0 IS M
- sub.l %d1,%d2 # d2 IS M', N = 64(M+M') + J
- add.l &0x3FFF,%d2
-
-#--SUMMARY: a1 IS ADDRESS FOR THE LEADING PORTION OF 2^(J/64),
-#--D0 IS M WHERE N = 64(M+M') + J. NOTE THAT |M| <= 16140 BY DESIGN.
-#--ADJFACT = 2^(M').
-#--REGISTERS SAVED SO FAR ARE (IN ORDER) FPCR, D0, FP1, a1, AND FP2.
-
- fmovm.x &0x0c,-(%sp) # save fp2/fp3
-
- fmul.s &0x3C800000,%fp1 # (1/64)*N
- mov.l (%a1)+,FACT1(%a6)
- mov.l (%a1)+,FACT1HI(%a6)
- mov.l (%a1)+,FACT1LOW(%a6)
- mov.w (%a1)+,FACT2(%a6)
-
- fsub.x %fp1,%fp0 # X - (1/64)*INT(64 X)
-
- mov.w (%a1)+,FACT2HI(%a6)
- clr.w FACT2HI+2(%a6)
- clr.l FACT2LOW(%a6)
- add.w %d1,FACT1(%a6)
- fmul.x LOG2(%pc),%fp0 # FP0 IS R
- add.w %d1,FACT2(%a6)
-
- bra.w expr
-
-EXPBORS:
-#--FPCR, D0 SAVED
- cmp.l %d1,&0x3FFF8000
- bgt.b TEXPBIG
-
-#--|X| IS SMALL, RETURN 1 + X
-
- fmov.l %d0,%fpcr # restore users round prec,mode
- fadd.s &0x3F800000,%fp0 # RETURN 1 + X
- bra t_pinx2
-
-TEXPBIG:
-#--|X| IS LARGE, GENERATE OVERFLOW IF X > 0; ELSE GENERATE UNDERFLOW
-#--REGISTERS SAVE SO FAR ARE FPCR AND D0
- mov.l X(%a6),%d1
- cmp.l %d1,&0
- blt.b EXPNEG
-
- bra t_ovfl2 # t_ovfl expects positive value
-
-EXPNEG:
- bra t_unfl2 # t_unfl expects positive value
-
- global stwotoxd
-stwotoxd:
-#--ENTRY POINT FOR 2**(X) FOR DENORMALIZED ARGUMENT
-
- fmov.l %d0,%fpcr # set user's rounding mode/precision
- fmov.s &0x3F800000,%fp0 # RETURN 1 + X
- mov.l (%a0),%d1
- or.l &0x00800001,%d1
- fadd.s %d1,%fp0
- bra t_pinx2
-
- global stentox
-#--ENTRY POINT FOR 10**(X), HERE X IS FINITE, NON-ZERO, AND NOT NAN'S
-stentox:
- fmovm.x (%a0),&0x80 # LOAD INPUT
-
- mov.l (%a0),%d1
- mov.w 4(%a0),%d1
- fmov.x %fp0,X(%a6)
- and.l &0x7FFFFFFF,%d1
-
- cmp.l %d1,&0x3FB98000 # |X| >= 2**(-70)?
- bge.b TENOK1
- bra.w EXPBORS
-
-TENOK1:
- cmp.l %d1,&0x400B9B07 # |X| <= 16480*log2/log10 ?
- ble.b TENMAIN
- bra.w EXPBORS
-
-TENMAIN:
-#--USUAL CASE, 2^(-70) <= |X| <= 16480 LOG 2 / LOG 10
-
- fmov.x %fp0,%fp1
- fmul.d L2TEN64(%pc),%fp1 # X*64*LOG10/LOG2
- fmov.l %fp1,INT(%a6) # N=INT(X*64*LOG10/LOG2)
- mov.l %d2,-(%sp)
- lea TEXPTBL(%pc),%a1 # LOAD ADDRESS OF TABLE OF 2^(J/64)
- fmov.l INT(%a6),%fp1 # N --> FLOATING FMT
- mov.l INT(%a6),%d1
- mov.l %d1,%d2
- and.l &0x3F,%d1 # D0 IS J
- asl.l &4,%d1 # DISPLACEMENT FOR 2^(J/64)
- add.l %d1,%a1 # ADDRESS FOR 2^(J/64)
- asr.l &6,%d2 # d2 IS L, N = 64L + J
- mov.l %d2,%d1
- asr.l &1,%d1 # D0 IS M
- sub.l %d1,%d2 # d2 IS M', N = 64(M+M') + J
- add.l &0x3FFF,%d2
-
-#--SUMMARY: a1 IS ADDRESS FOR THE LEADING PORTION OF 2^(J/64),
-#--D0 IS M WHERE N = 64(M+M') + J. NOTE THAT |M| <= 16140 BY DESIGN.
-#--ADJFACT = 2^(M').
-#--REGISTERS SAVED SO FAR ARE (IN ORDER) FPCR, D0, FP1, a1, AND FP2.
- fmovm.x &0x0c,-(%sp) # save fp2/fp3
-
- fmov.x %fp1,%fp2
-
- fmul.d L10TWO1(%pc),%fp1 # N*(LOG2/64LOG10)_LEAD
- mov.l (%a1)+,FACT1(%a6)
-
- fmul.x L10TWO2(%pc),%fp2 # N*(LOG2/64LOG10)_TRAIL
-
- mov.l (%a1)+,FACT1HI(%a6)
- mov.l (%a1)+,FACT1LOW(%a6)
- fsub.x %fp1,%fp0 # X - N L_LEAD
- mov.w (%a1)+,FACT2(%a6)
-
- fsub.x %fp2,%fp0 # X - N L_TRAIL
-
- mov.w (%a1)+,FACT2HI(%a6)
- clr.w FACT2HI+2(%a6)
- clr.l FACT2LOW(%a6)
-
- fmul.x LOG10(%pc),%fp0 # FP0 IS R
- add.w %d1,FACT1(%a6)
- add.w %d1,FACT2(%a6)
-
-expr:
-#--FPCR, FP2, FP3 ARE SAVED IN ORDER AS SHOWN.
-#--ADJFACT CONTAINS 2**(M'), FACT1 + FACT2 = 2**(M) * 2**(J/64).
-#--FP0 IS R. THE FOLLOWING CODE COMPUTES
-#-- 2**(M'+M) * 2**(J/64) * EXP(R)
-
- fmov.x %fp0,%fp1
- fmul.x %fp1,%fp1 # FP1 IS S = R*R
-
- fmov.d EXPA5(%pc),%fp2 # FP2 IS A5
- fmov.d EXPA4(%pc),%fp3 # FP3 IS A4
-
- fmul.x %fp1,%fp2 # FP2 IS S*A5
- fmul.x %fp1,%fp3 # FP3 IS S*A4
-
- fadd.d EXPA3(%pc),%fp2 # FP2 IS A3+S*A5
- fadd.d EXPA2(%pc),%fp3 # FP3 IS A2+S*A4
-
- fmul.x %fp1,%fp2 # FP2 IS S*(A3+S*A5)
- fmul.x %fp1,%fp3 # FP3 IS S*(A2+S*A4)
-
- fadd.d EXPA1(%pc),%fp2 # FP2 IS A1+S*(A3+S*A5)
- fmul.x %fp0,%fp3 # FP3 IS R*S*(A2+S*A4)
-
- fmul.x %fp1,%fp2 # FP2 IS S*(A1+S*(A3+S*A5))
- fadd.x %fp3,%fp0 # FP0 IS R+R*S*(A2+S*A4)
- fadd.x %fp2,%fp0 # FP0 IS EXP(R) - 1
-
- fmovm.x (%sp)+,&0x30 # restore fp2/fp3
-
-#--FINAL RECONSTRUCTION PROCESS
-#--EXP(X) = 2^M*2^(J/64) + 2^M*2^(J/64)*(EXP(R)-1) - (1 OR 0)
-
- fmul.x FACT1(%a6),%fp0
- fadd.x FACT2(%a6),%fp0
- fadd.x FACT1(%a6),%fp0
-
- fmov.l %d0,%fpcr # restore users round prec,mode
- mov.w %d2,ADJFACT(%a6) # INSERT EXPONENT
- mov.l (%sp)+,%d2
- mov.l &0x80000000,ADJFACT+4(%a6)
- clr.l ADJFACT+8(%a6)
- mov.b &FMUL_OP,%d1 # last inst is MUL
- fmul.x ADJFACT(%a6),%fp0 # FINAL ADJUSTMENT
- bra t_catch
-
- global stentoxd
-stentoxd:
-#--ENTRY POINT FOR 10**(X) FOR DENORMALIZED ARGUMENT
-
- fmov.l %d0,%fpcr # set user's rounding mode/precision
- fmov.s &0x3F800000,%fp0 # RETURN 1 + X
- mov.l (%a0),%d1
- or.l &0x00800001,%d1
- fadd.s %d1,%fp0
- bra t_pinx2
-
-#########################################################################
-# sscale(): computes the destination operand scaled by the source #
-# operand. If the absoulute value of the source operand is #
-# >= 2^14, an overflow or underflow is returned. #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to double-extended source operand X #
-# a1 = pointer to double-extended destination operand Y #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = scale(X,Y) #
-# #
-#########################################################################
-
-set SIGN, L_SCR1
-
- global sscale
-sscale:
- mov.l %d0,-(%sp) # store off ctrl bits for now
-
- mov.w DST_EX(%a1),%d1 # get dst exponent
- smi.b SIGN(%a6) # use SIGN to hold dst sign
- andi.l &0x00007fff,%d1 # strip sign from dst exp
-
- mov.w SRC_EX(%a0),%d0 # check src bounds
- andi.w &0x7fff,%d0 # clr src sign bit
- cmpi.w %d0,&0x3fff # is src ~ ZERO?
- blt.w src_small # yes
- cmpi.w %d0,&0x400c # no; is src too big?
- bgt.w src_out # yes
-
-#
-# Source is within 2^14 range.
-#
-src_ok:
- fintrz.x SRC(%a0),%fp0 # calc int of src
- fmov.l %fp0,%d0 # int src to d0
-# don't want any accrued bits from the fintrz showing up later since
-# we may need to read the fpsr for the last fp op in t_catch2().
- fmov.l &0x0,%fpsr
-
- tst.b DST_HI(%a1) # is dst denormalized?
- bmi.b sok_norm
-
-# the dst is a DENORM. normalize the DENORM and add the adjustment to
-# the src value. then, jump to the norm part of the routine.
-sok_dnrm:
- mov.l %d0,-(%sp) # save src for now
-
- mov.w DST_EX(%a1),FP_SCR0_EX(%a6) # make a copy
- mov.l DST_HI(%a1),FP_SCR0_HI(%a6)
- mov.l DST_LO(%a1),FP_SCR0_LO(%a6)
-
- lea FP_SCR0(%a6),%a0 # pass ptr to DENORM
- bsr.l norm # normalize the DENORM
- neg.l %d0
- add.l (%sp)+,%d0 # add adjustment to src
-
- fmovm.x FP_SCR0(%a6),&0x80 # load normalized DENORM
-
- cmpi.w %d0,&-0x3fff # is the shft amt really low?
- bge.b sok_norm2 # thank goodness no
-
-# the multiply factor that we're trying to create should be a denorm
-# for the multiply to work. therefore, we're going to actually do a
-# multiply with a denorm which will cause an unimplemented data type
-# exception to be put into the machine which will be caught and corrected
-# later. we don't do this with the DENORMs above because this method
-# is slower. but, don't fret, I don't see it being used much either.
- fmov.l (%sp)+,%fpcr # restore user fpcr
- mov.l &0x80000000,%d1 # load normalized mantissa
- subi.l &-0x3fff,%d0 # how many should we shift?
- neg.l %d0 # make it positive
- cmpi.b %d0,&0x20 # is it > 32?
- bge.b sok_dnrm_32 # yes
- lsr.l %d0,%d1 # no; bit stays in upper lw
- clr.l -(%sp) # insert zero low mantissa
- mov.l %d1,-(%sp) # insert new high mantissa
- clr.l -(%sp) # make zero exponent
- bra.b sok_norm_cont
-sok_dnrm_32:
- subi.b &0x20,%d0 # get shift count
- lsr.l %d0,%d1 # make low mantissa longword
- mov.l %d1,-(%sp) # insert new low mantissa
- clr.l -(%sp) # insert zero high mantissa
- clr.l -(%sp) # make zero exponent
- bra.b sok_norm_cont
-
-# the src will force the dst to a DENORM value or worse. so, let's
-# create an fp multiply that will create the result.
-sok_norm:
- fmovm.x DST(%a1),&0x80 # load fp0 with normalized src
-sok_norm2:
- fmov.l (%sp)+,%fpcr # restore user fpcr
-
- addi.w &0x3fff,%d0 # turn src amt into exp value
- swap %d0 # put exponent in high word
- clr.l -(%sp) # insert new exponent
- mov.l &0x80000000,-(%sp) # insert new high mantissa
- mov.l %d0,-(%sp) # insert new lo mantissa
-
-sok_norm_cont:
- fmov.l %fpcr,%d0 # d0 needs fpcr for t_catch2
- mov.b &FMUL_OP,%d1 # last inst is MUL
- fmul.x (%sp)+,%fp0 # do the multiply
- bra t_catch2 # catch any exceptions
-
-#
-# Source is outside of 2^14 range. Test the sign and branch
-# to the appropriate exception handler.
-#
-src_out:
- mov.l (%sp)+,%d0 # restore ctrl bits
- exg %a0,%a1 # swap src,dst ptrs
- tst.b SRC_EX(%a1) # is src negative?
- bmi t_unfl # yes; underflow
- bra t_ovfl_sc # no; overflow
-
-#
-# The source input is below 1, so we check for denormalized numbers
-# and set unfl.
-#
-src_small:
- tst.b DST_HI(%a1) # is dst denormalized?
- bpl.b ssmall_done # yes
-
- mov.l (%sp)+,%d0
- fmov.l %d0,%fpcr # no; load control bits
- mov.b &FMOV_OP,%d1 # last inst is MOVE
- fmov.x DST(%a1),%fp0 # simply return dest
- bra t_catch2
-ssmall_done:
- mov.l (%sp)+,%d0 # load control bits into d1
- mov.l %a1,%a0 # pass ptr to dst
- bra t_resdnrm
-
-#########################################################################
-# smod(): computes the fp MOD of the input values X,Y. #
-# srem(): computes the fp (IEEE) REM of the input values X,Y. #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input X #
-# a1 = pointer to extended precision input Y #
-# d0 = round precision,mode #
-# #
-# The input operands X and Y can be either normalized or #
-# denormalized. #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = FREM(X,Y) or FMOD(X,Y) #
-# #
-# ALGORITHM *********************************************************** #
-# #
-# Step 1. Save and strip signs of X and Y: signX := sign(X), #
-# signY := sign(Y), X := |X|, Y := |Y|, #
-# signQ := signX EOR signY. Record whether MOD or REM #
-# is requested. #
-# #
-# Step 2. Set L := expo(X)-expo(Y), k := 0, Q := 0. #
-# If (L < 0) then #
-# R := X, go to Step 4. #
-# else #
-# R := 2^(-L)X, j := L. #
-# endif #
-# #
-# Step 3. Perform MOD(X,Y) #
-# 3.1 If R = Y, go to Step 9. #
-# 3.2 If R > Y, then { R := R - Y, Q := Q + 1} #
-# 3.3 If j = 0, go to Step 4. #
-# 3.4 k := k + 1, j := j - 1, Q := 2Q, R := 2R. Go to #
-# Step 3.1. #
-# #
-# Step 4. At this point, R = X - QY = MOD(X,Y). Set #
-# Last_Subtract := false (used in Step 7 below). If #
-# MOD is requested, go to Step 6. #
-# #
-# Step 5. R = MOD(X,Y), but REM(X,Y) is requested. #
-# 5.1 If R < Y/2, then R = MOD(X,Y) = REM(X,Y). Go to #
-# Step 6. #
-# 5.2 If R > Y/2, then { set Last_Subtract := true, #
-# Q := Q + 1, Y := signY*Y }. Go to Step 6. #
-# 5.3 This is the tricky case of R = Y/2. If Q is odd, #
-# then { Q := Q + 1, signX := -signX }. #
-# #
-# Step 6. R := signX*R. #
-# #
-# Step 7. If Last_Subtract = true, R := R - Y. #
-# #
-# Step 8. Return signQ, last 7 bits of Q, and R as required. #
-# #
-# Step 9. At this point, R = 2^(-j)*X - Q Y = Y. Thus, #
-# X = 2^(j)*(Q+1)Y. set Q := 2^(j)*(Q+1), #
-# R := 0. Return signQ, last 7 bits of Q, and R. #
-# #
-#########################################################################
-
- set Mod_Flag,L_SCR3
- set Sc_Flag,L_SCR3+1
-
- set SignY,L_SCR2
- set SignX,L_SCR2+2
- set SignQ,L_SCR3+2
-
- set Y,FP_SCR0
- set Y_Hi,Y+4
- set Y_Lo,Y+8
-
- set R,FP_SCR1
- set R_Hi,R+4
- set R_Lo,R+8
-
-Scale:
- long 0x00010000,0x80000000,0x00000000,0x00000000
-
- global smod
-smod:
- clr.b FPSR_QBYTE(%a6)
- mov.l %d0,-(%sp) # save ctrl bits
- clr.b Mod_Flag(%a6)
- bra.b Mod_Rem
-
- global srem
-srem:
- clr.b FPSR_QBYTE(%a6)
- mov.l %d0,-(%sp) # save ctrl bits
- mov.b &0x1,Mod_Flag(%a6)
-
-Mod_Rem:
-#..Save sign of X and Y
- movm.l &0x3f00,-(%sp) # save data registers
- mov.w SRC_EX(%a0),%d3
- mov.w %d3,SignY(%a6)
- and.l &0x00007FFF,%d3 # Y := |Y|
-
-#
- mov.l SRC_HI(%a0),%d4
- mov.l SRC_LO(%a0),%d5 # (D3,D4,D5) is |Y|
-
- tst.l %d3
- bne.b Y_Normal
-
- mov.l &0x00003FFE,%d3 # $3FFD + 1
- tst.l %d4
- bne.b HiY_not0
-
-HiY_0:
- mov.l %d5,%d4
- clr.l %d5
- sub.l &32,%d3
- clr.l %d6
- bfffo %d4{&0:&32},%d6
- lsl.l %d6,%d4
- sub.l %d6,%d3 # (D3,D4,D5) is normalized
-# ...with bias $7FFD
- bra.b Chk_X
-
-HiY_not0:
- clr.l %d6
- bfffo %d4{&0:&32},%d6
- sub.l %d6,%d3
- lsl.l %d6,%d4
- mov.l %d5,%d7 # a copy of D5
- lsl.l %d6,%d5
- neg.l %d6
- add.l &32,%d6
- lsr.l %d6,%d7
- or.l %d7,%d4 # (D3,D4,D5) normalized
-# ...with bias $7FFD
- bra.b Chk_X
-
-Y_Normal:
- add.l &0x00003FFE,%d3 # (D3,D4,D5) normalized
-# ...with bias $7FFD
-
-Chk_X:
- mov.w DST_EX(%a1),%d0
- mov.w %d0,SignX(%a6)
- mov.w SignY(%a6),%d1
- eor.l %d0,%d1
- and.l &0x00008000,%d1
- mov.w %d1,SignQ(%a6) # sign(Q) obtained
- and.l &0x00007FFF,%d0
- mov.l DST_HI(%a1),%d1
- mov.l DST_LO(%a1),%d2 # (D0,D1,D2) is |X|
- tst.l %d0
- bne.b X_Normal
- mov.l &0x00003FFE,%d0
- tst.l %d1
- bne.b HiX_not0
-
-HiX_0:
- mov.l %d2,%d1
- clr.l %d2
- sub.l &32,%d0
- clr.l %d6
- bfffo %d1{&0:&32},%d6
- lsl.l %d6,%d1
- sub.l %d6,%d0 # (D0,D1,D2) is normalized
-# ...with bias $7FFD
- bra.b Init
-
-HiX_not0:
- clr.l %d6
- bfffo %d1{&0:&32},%d6
- sub.l %d6,%d0
- lsl.l %d6,%d1
- mov.l %d2,%d7 # a copy of D2
- lsl.l %d6,%d2
- neg.l %d6
- add.l &32,%d6
- lsr.l %d6,%d7
- or.l %d7,%d1 # (D0,D1,D2) normalized
-# ...with bias $7FFD
- bra.b Init
-
-X_Normal:
- add.l &0x00003FFE,%d0 # (D0,D1,D2) normalized
-# ...with bias $7FFD
-
-Init:
-#
- mov.l %d3,L_SCR1(%a6) # save biased exp(Y)
- mov.l %d0,-(%sp) # save biased exp(X)
- sub.l %d3,%d0 # L := expo(X)-expo(Y)
-
- clr.l %d6 # D6 := carry <- 0
- clr.l %d3 # D3 is Q
- mov.l &0,%a1 # A1 is k; j+k=L, Q=0
-
-#..(Carry,D1,D2) is R
- tst.l %d0
- bge.b Mod_Loop_pre
-
-#..expo(X) < expo(Y). Thus X = mod(X,Y)
-#
- mov.l (%sp)+,%d0 # restore d0
- bra.w Get_Mod
-
-Mod_Loop_pre:
- addq.l &0x4,%sp # erase exp(X)
-#..At this point R = 2^(-L)X; Q = 0; k = 0; and k+j = L
-Mod_Loop:
- tst.l %d6 # test carry bit
- bgt.b R_GT_Y
-
-#..At this point carry = 0, R = (D1,D2), Y = (D4,D5)
- cmp.l %d1,%d4 # compare hi(R) and hi(Y)
- bne.b R_NE_Y
- cmp.l %d2,%d5 # compare lo(R) and lo(Y)
- bne.b R_NE_Y
-
-#..At this point, R = Y
- bra.w Rem_is_0
-
-R_NE_Y:
-#..use the borrow of the previous compare
- bcs.b R_LT_Y # borrow is set iff R < Y
-
-R_GT_Y:
-#..If Carry is set, then Y < (Carry,D1,D2) < 2Y. Otherwise, Carry = 0
-#..and Y < (D1,D2) < 2Y. Either way, perform R - Y
- sub.l %d5,%d2 # lo(R) - lo(Y)
- subx.l %d4,%d1 # hi(R) - hi(Y)
- clr.l %d6 # clear carry
- addq.l &1,%d3 # Q := Q + 1
-
-R_LT_Y:
-#..At this point, Carry=0, R < Y. R = 2^(k-L)X - QY; k+j = L; j >= 0.
- tst.l %d0 # see if j = 0.
- beq.b PostLoop
-
- add.l %d3,%d3 # Q := 2Q
- add.l %d2,%d2 # lo(R) = 2lo(R)
- roxl.l &1,%d1 # hi(R) = 2hi(R) + carry
- scs %d6 # set Carry if 2(R) overflows
- addq.l &1,%a1 # k := k+1
- subq.l &1,%d0 # j := j - 1
-#..At this point, R=(Carry,D1,D2) = 2^(k-L)X - QY, j+k=L, j >= 0, R < 2Y.
-
- bra.b Mod_Loop
-
-PostLoop:
-#..k = L, j = 0, Carry = 0, R = (D1,D2) = X - QY, R < Y.
-
-#..normalize R.
- mov.l L_SCR1(%a6),%d0 # new biased expo of R
- tst.l %d1
- bne.b HiR_not0
-
-HiR_0:
- mov.l %d2,%d1
- clr.l %d2
- sub.l &32,%d0
- clr.l %d6
- bfffo %d1{&0:&32},%d6
- lsl.l %d6,%d1
- sub.l %d6,%d0 # (D0,D1,D2) is normalized
-# ...with bias $7FFD
- bra.b Get_Mod
-
-HiR_not0:
- clr.l %d6
- bfffo %d1{&0:&32},%d6
- bmi.b Get_Mod # already normalized
- sub.l %d6,%d0
- lsl.l %d6,%d1
- mov.l %d2,%d7 # a copy of D2
- lsl.l %d6,%d2
- neg.l %d6
- add.l &32,%d6
- lsr.l %d6,%d7
- or.l %d7,%d1 # (D0,D1,D2) normalized
-
-#
-Get_Mod:
- cmp.l %d0,&0x000041FE
- bge.b No_Scale
-Do_Scale:
- mov.w %d0,R(%a6)
- mov.l %d1,R_Hi(%a6)
- mov.l %d2,R_Lo(%a6)
- mov.l L_SCR1(%a6),%d6
- mov.w %d6,Y(%a6)
- mov.l %d4,Y_Hi(%a6)
- mov.l %d5,Y_Lo(%a6)
- fmov.x R(%a6),%fp0 # no exception
- mov.b &1,Sc_Flag(%a6)
- bra.b ModOrRem
-No_Scale:
- mov.l %d1,R_Hi(%a6)
- mov.l %d2,R_Lo(%a6)
- sub.l &0x3FFE,%d0
- mov.w %d0,R(%a6)
- mov.l L_SCR1(%a6),%d6
- sub.l &0x3FFE,%d6
- mov.l %d6,L_SCR1(%a6)
- fmov.x R(%a6),%fp0
- mov.w %d6,Y(%a6)
- mov.l %d4,Y_Hi(%a6)
- mov.l %d5,Y_Lo(%a6)
- clr.b Sc_Flag(%a6)
-
-#
-ModOrRem:
- tst.b Mod_Flag(%a6)
- beq.b Fix_Sign
-
- mov.l L_SCR1(%a6),%d6 # new biased expo(Y)
- subq.l &1,%d6 # biased expo(Y/2)
- cmp.l %d0,%d6
- blt.b Fix_Sign
- bgt.b Last_Sub
-
- cmp.l %d1,%d4
- bne.b Not_EQ
- cmp.l %d2,%d5
- bne.b Not_EQ
- bra.w Tie_Case
-
-Not_EQ:
- bcs.b Fix_Sign
-
-Last_Sub:
-#
- fsub.x Y(%a6),%fp0 # no exceptions
- addq.l &1,%d3 # Q := Q + 1
-
-#
-Fix_Sign:
-#..Get sign of X
- mov.w SignX(%a6),%d6
- bge.b Get_Q
- fneg.x %fp0
-
-#..Get Q
-#
-Get_Q:
- clr.l %d6
- mov.w SignQ(%a6),%d6 # D6 is sign(Q)
- mov.l &8,%d7
- lsr.l %d7,%d6
- and.l &0x0000007F,%d3 # 7 bits of Q
- or.l %d6,%d3 # sign and bits of Q
-# swap %d3
-# fmov.l %fpsr,%d6
-# and.l &0xFF00FFFF,%d6
-# or.l %d3,%d6
-# fmov.l %d6,%fpsr # put Q in fpsr
- mov.b %d3,FPSR_QBYTE(%a6) # put Q in fpsr
-
-#
-Restore:
- movm.l (%sp)+,&0xfc # {%d2-%d7}
- mov.l (%sp)+,%d0
- fmov.l %d0,%fpcr
- tst.b Sc_Flag(%a6)
- beq.b Finish
- mov.b &FMUL_OP,%d1 # last inst is MUL
- fmul.x Scale(%pc),%fp0 # may cause underflow
- bra t_catch2
-# the '040 package did this apparently to see if the dst operand for the
-# preceding fmul was a denorm. but, it better not have been since the
-# algorithm just got done playing with fp0 and expected no exceptions
-# as a result. trust me...
-# bra t_avoid_unsupp # check for denorm as a
-# ;result of the scaling
-
-Finish:
- mov.b &FMOV_OP,%d1 # last inst is MOVE
- fmov.x %fp0,%fp0 # capture exceptions & round
- bra t_catch2
-
-Rem_is_0:
-#..R = 2^(-j)X - Q Y = Y, thus R = 0 and quotient = 2^j (Q+1)
- addq.l &1,%d3
- cmp.l %d0,&8 # D0 is j
- bge.b Q_Big
-
- lsl.l %d0,%d3
- bra.b Set_R_0
-
-Q_Big:
- clr.l %d3
-
-Set_R_0:
- fmov.s &0x00000000,%fp0
- clr.b Sc_Flag(%a6)
- bra.w Fix_Sign
-
-Tie_Case:
-#..Check parity of Q
- mov.l %d3,%d6
- and.l &0x00000001,%d6
- tst.l %d6
- beq.w Fix_Sign # Q is even
-
-#..Q is odd, Q := Q + 1, signX := -signX
- addq.l &1,%d3
- mov.w SignX(%a6),%d6
- eor.l &0x00008000,%d6
- mov.w %d6,SignX(%a6)
- bra.w Fix_Sign
-
-#########################################################################
-# XDEF **************************************************************** #
-# tag(): return the optype of the input ext fp number #
-# #
-# This routine is used by the 060FPLSP. #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision operand #
-# #
-# OUTPUT ************************************************************** #
-# d0 = value of type tag #
-# one of: NORM, INF, QNAN, SNAN, DENORM, ZERO #
-# #
-# ALGORITHM *********************************************************** #
-# Simply test the exponent, j-bit, and mantissa values to #
-# determine the type of operand. #
-# If it's an unnormalized zero, alter the operand and force it #
-# to be a normal zero. #
-# #
-#########################################################################
-
- global tag
-tag:
- mov.w FTEMP_EX(%a0), %d0 # extract exponent
- andi.w &0x7fff, %d0 # strip off sign
- cmpi.w %d0, &0x7fff # is (EXP == MAX)?
- beq.b inf_or_nan_x
-not_inf_or_nan_x:
- btst &0x7,FTEMP_HI(%a0)
- beq.b not_norm_x
-is_norm_x:
- mov.b &NORM, %d0
- rts
-not_norm_x:
- tst.w %d0 # is exponent = 0?
- bne.b is_unnorm_x
-not_unnorm_x:
- tst.l FTEMP_HI(%a0)
- bne.b is_denorm_x
- tst.l FTEMP_LO(%a0)
- bne.b is_denorm_x
-is_zero_x:
- mov.b &ZERO, %d0
- rts
-is_denorm_x:
- mov.b &DENORM, %d0
- rts
-is_unnorm_x:
- bsr.l unnorm_fix # convert to norm,denorm,or zero
- rts
-is_unnorm_reg_x:
- mov.b &UNNORM, %d0
- rts
-inf_or_nan_x:
- tst.l FTEMP_LO(%a0)
- bne.b is_nan_x
- mov.l FTEMP_HI(%a0), %d0
- and.l &0x7fffffff, %d0 # msb is a don't care!
- bne.b is_nan_x
-is_inf_x:
- mov.b &INF, %d0
- rts
-is_nan_x:
- mov.b &QNAN, %d0
- rts
-
-#############################################################
-
-qnan: long 0x7fff0000, 0xffffffff, 0xffffffff
-
-#########################################################################
-# XDEF **************************************************************** #
-# t_dz(): Handle 060FPLSP dz exception for "flogn" emulation. #
-# t_dz2(): Handle 060FPLSP dz exception for "fatanh" emulation. #
-# #
-# These rouitnes are used by the 060FPLSP package. #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand. #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = default DZ result. #
-# #
-# ALGORITHM *********************************************************** #
-# Transcendental emulation for the 060FPLSP has detected that #
-# a DZ exception should occur for the instruction. If DZ is disabled, #
-# return the default result. #
-# If DZ is enabled, the dst operand should be returned unscathed #
-# in fp0 while fp1 is used to create a DZ exception so that the #
-# operating system can log that such an event occurred. #
-# #
-#########################################################################
-
- global t_dz
-t_dz:
- tst.b SRC_EX(%a0) # check sign for neg or pos
- bpl.b dz_pinf # branch if pos sign
-
- global t_dz2
-t_dz2:
- ori.l &dzinf_mask+neg_mask,USER_FPSR(%a6) # set N/I/DZ/ADZ
-
- btst &dz_bit,FPCR_ENABLE(%a6)
- bne.b dz_minf_ena
-
-# dz is disabled. return a -INF.
- fmov.s &0xff800000,%fp0 # return -INF
- rts
-
-# dz is enabled. create a dz exception so the user can record it
-# but use fp1 instead. return the dst operand unscathed in fp0.
-dz_minf_ena:
- fmovm.x EXC_FP0(%a6),&0x80 # return fp0 unscathed
- fmov.l USER_FPCR(%a6),%fpcr
- fmov.s &0xbf800000,%fp1 # load -1
- fdiv.s &0x00000000,%fp1 # -1 / 0
- rts
-
-dz_pinf:
- ori.l &dzinf_mask,USER_FPSR(%a6) # set I/DZ/ADZ
-
- btst &dz_bit,FPCR_ENABLE(%a6)
- bne.b dz_pinf_ena
-
-# dz is disabled. return a +INF.
- fmov.s &0x7f800000,%fp0 # return +INF
- rts
-
-# dz is enabled. create a dz exception so the user can record it
-# but use fp1 instead. return the dst operand unscathed in fp0.
-dz_pinf_ena:
- fmovm.x EXC_FP0(%a6),&0x80 # return fp0 unscathed
- fmov.l USER_FPCR(%a6),%fpcr
- fmov.s &0x3f800000,%fp1 # load +1
- fdiv.s &0x00000000,%fp1 # +1 / 0
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# t_operr(): Handle 060FPLSP OPERR exception during emulation. #
-# #
-# This routine is used by the 060FPLSP package. #
-# #
-# XREF **************************************************************** #
-# None. #
-# #
-# INPUT *************************************************************** #
-# fp1 = source operand #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = default result #
-# fp1 = unchanged #
-# #
-# ALGORITHM *********************************************************** #
-# An operand error should occur as the result of transcendental #
-# emulation in the 060FPLSP. If OPERR is disabled, just return a NAN #
-# in fp0. If OPERR is enabled, return the dst operand unscathed in fp0 #
-# and the source operand in fp1. Use fp2 to create an OPERR exception #
-# so that the operating system can log the event. #
-# #
-#########################################################################
-
- global t_operr
-t_operr:
- ori.l &opnan_mask,USER_FPSR(%a6) # set NAN/OPERR/AIOP
-
- btst &operr_bit,FPCR_ENABLE(%a6)
- bne.b operr_ena
-
-# operr is disabled. return a QNAN in fp0
- fmovm.x qnan(%pc),&0x80 # return QNAN
- rts
-
-# operr is enabled. create an operr exception so the user can record it
-# but use fp2 instead. return the dst operand unscathed in fp0.
-operr_ena:
- fmovm.x EXC_FP0(%a6),&0x80 # return fp0 unscathed
- fmov.l USER_FPCR(%a6),%fpcr
- fmovm.x &0x04,-(%sp) # save fp2
- fmov.s &0x7f800000,%fp2 # load +INF
- fmul.s &0x00000000,%fp2 # +INF x 0
- fmovm.x (%sp)+,&0x20 # restore fp2
- rts
-
-pls_huge:
- long 0x7ffe0000,0xffffffff,0xffffffff
-mns_huge:
- long 0xfffe0000,0xffffffff,0xffffffff
-pls_tiny:
- long 0x00000000,0x80000000,0x00000000
-mns_tiny:
- long 0x80000000,0x80000000,0x00000000
-
-#########################################################################
-# XDEF **************************************************************** #
-# t_unfl(): Handle 060FPLSP underflow exception during emulation. #
-# t_unfl2(): Handle 060FPLSP underflow exception during #
-# emulation. result always positive. #
-# #
-# This routine is used by the 060FPLSP package. #
-# #
-# XREF **************************************************************** #
-# None. #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = default underflow result #
-# #
-# ALGORITHM *********************************************************** #
-# An underflow should occur as the result of transcendental #
-# emulation in the 060FPLSP. Create an underflow by using "fmul" #
-# and two very small numbers of appropriate sign so the operating #
-# system can log the event. #
-# #
-#########################################################################
-
- global t_unfl
-t_unfl:
- tst.b SRC_EX(%a0)
- bpl.b unf_pos
-
- global t_unfl2
-t_unfl2:
- ori.l &unfinx_mask+neg_mask,USER_FPSR(%a6) # set N/UNFL/INEX2/AUNFL/AINEX
-
- fmov.l USER_FPCR(%a6),%fpcr
- fmovm.x mns_tiny(%pc),&0x80
- fmul.x pls_tiny(%pc),%fp0
-
- fmov.l %fpsr,%d0
- rol.l &0x8,%d0
- mov.b %d0,FPSR_CC(%a6)
- rts
-unf_pos:
- ori.w &unfinx_mask,FPSR_EXCEPT(%a6) # set UNFL/INEX2/AUNFL/AINEX
-
- fmov.l USER_FPCR(%a6),%fpcr
- fmovm.x pls_tiny(%pc),&0x80
- fmul.x %fp0,%fp0
-
- fmov.l %fpsr,%d0
- rol.l &0x8,%d0
- mov.b %d0,FPSR_CC(%a6)
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# t_ovfl(): Handle 060FPLSP overflow exception during emulation. #
-# (monadic) #
-# t_ovfl2(): Handle 060FPLSP overflow exception during #
-# emulation. result always positive. (dyadic) #
-# t_ovfl_sc(): Handle 060FPLSP overflow exception during #
-# emulation for "fscale". #
-# #
-# This routine is used by the 060FPLSP package. #
-# #
-# XREF **************************************************************** #
-# None. #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = default underflow result #
-# #
-# ALGORITHM *********************************************************** #
-# An overflow should occur as the result of transcendental #
-# emulation in the 060FPLSP. Create an overflow by using "fmul" #
-# and two very lareg numbers of appropriate sign so the operating #
-# system can log the event. #
-# For t_ovfl_sc() we take special care not to lose the INEX2 bit. #
-# #
-#########################################################################
-
- global t_ovfl_sc
-t_ovfl_sc:
- ori.l &ovfl_inx_mask,USER_FPSR(%a6) # set OVFL/AOVFL/AINEX
-
- mov.b %d0,%d1 # fetch rnd prec,mode
- andi.b &0xc0,%d1 # extract prec
- beq.w ovfl_work
-
-# dst op is a DENORM. we have to normalize the mantissa to see if the
-# result would be inexact for the given precision. make a copy of the
-# dst so we don't screw up the version passed to us.
- mov.w LOCAL_EX(%a0),FP_SCR0_EX(%a6)
- mov.l LOCAL_HI(%a0),FP_SCR0_HI(%a6)
- mov.l LOCAL_LO(%a0),FP_SCR0_LO(%a6)
- lea FP_SCR0(%a6),%a0 # pass ptr to FP_SCR0
- movm.l &0xc080,-(%sp) # save d0-d1/a0
- bsr.l norm # normalize mantissa
- movm.l (%sp)+,&0x0103 # restore d0-d1/a0
-
- cmpi.b %d1,&0x40 # is precision sgl?
- bne.b ovfl_sc_dbl # no; dbl
-ovfl_sc_sgl:
- tst.l LOCAL_LO(%a0) # is lo lw of sgl set?
- bne.b ovfl_sc_inx # yes
- tst.b 3+LOCAL_HI(%a0) # is lo byte of hi lw set?
- bne.b ovfl_sc_inx # yes
- bra.w ovfl_work # don't set INEX2
-ovfl_sc_dbl:
- mov.l LOCAL_LO(%a0),%d1 # are any of lo 11 bits of
- andi.l &0x7ff,%d1 # dbl mantissa set?
- beq.w ovfl_work # no; don't set INEX2
-ovfl_sc_inx:
- ori.l &inex2_mask,USER_FPSR(%a6) # set INEX2
- bra.b ovfl_work # continue
-
- global t_ovfl
-t_ovfl:
- ori.w &ovfinx_mask,FPSR_EXCEPT(%a6) # set OVFL/INEX2/AOVFL/AINEX
-ovfl_work:
- tst.b SRC_EX(%a0)
- bpl.b ovfl_p
-ovfl_m:
- fmov.l USER_FPCR(%a6),%fpcr
- fmovm.x mns_huge(%pc),&0x80
- fmul.x pls_huge(%pc),%fp0
-
- fmov.l %fpsr,%d0
- rol.l &0x8,%d0
- ori.b &neg_mask,%d0
- mov.b %d0,FPSR_CC(%a6)
- rts
-ovfl_p:
- fmov.l USER_FPCR(%a6),%fpcr
- fmovm.x pls_huge(%pc),&0x80
- fmul.x pls_huge(%pc),%fp0
-
- fmov.l %fpsr,%d0
- rol.l &0x8,%d0
- mov.b %d0,FPSR_CC(%a6)
- rts
-
- global t_ovfl2
-t_ovfl2:
- ori.w &ovfinx_mask,FPSR_EXCEPT(%a6) # set OVFL/INEX2/AOVFL/AINEX
- fmov.l USER_FPCR(%a6),%fpcr
- fmovm.x pls_huge(%pc),&0x80
- fmul.x pls_huge(%pc),%fp0
-
- fmov.l %fpsr,%d0
- rol.l &0x8,%d0
- mov.b %d0,FPSR_CC(%a6)
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# t_catch(): Handle 060FPLSP OVFL,UNFL,or INEX2 exception during #
-# emulation. #
-# t_catch2(): Handle 060FPLSP OVFL,UNFL,or INEX2 exception during #
-# emulation. #
-# #
-# These routines are used by the 060FPLSP package. #
-# #
-# XREF **************************************************************** #
-# None. #
-# #
-# INPUT *************************************************************** #
-# fp0 = default underflow or overflow result #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = default result #
-# #
-# ALGORITHM *********************************************************** #
-# If an overflow or underflow occurred during the last #
-# instruction of transcendental 060FPLSP emulation, then it has already #
-# occurred and has been logged. Now we need to see if an inexact #
-# exception should occur. #
-# #
-#########################################################################
-
- global t_catch2
-t_catch2:
- fmov.l %fpsr,%d0
- or.l %d0,USER_FPSR(%a6)
- bra.b inx2_work
-
- global t_catch
-t_catch:
- fmov.l %fpsr,%d0
- or.l %d0,USER_FPSR(%a6)
-
-#########################################################################
-# XDEF **************************************************************** #
-# t_inx2(): Handle inexact 060FPLSP exception during emulation. #
-# t_pinx2(): Handle inexact 060FPLSP exception for "+" results. #
-# t_minx2(): Handle inexact 060FPLSP exception for "-" results. #
-# #
-# XREF **************************************************************** #
-# None. #
-# #
-# INPUT *************************************************************** #
-# fp0 = default result #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = default result #
-# #
-# ALGORITHM *********************************************************** #
-# The last instruction of transcendental emulation for the #
-# 060FPLSP should be inexact. So, if inexact is enabled, then we create #
-# the event here by adding a large and very small number together #
-# so that the operating system can log the event. #
-# Must check, too, if the result was zero, in which case we just #
-# set the FPSR bits and return. #
-# #
-#########################################################################
-
- global t_inx2
-t_inx2:
- fblt.w t_minx2
- fbeq.w inx2_zero
-
- global t_pinx2
-t_pinx2:
- ori.w &inx2a_mask,FPSR_EXCEPT(%a6) # set INEX2/AINEX
- bra.b inx2_work
-
- global t_minx2
-t_minx2:
- ori.l &inx2a_mask+neg_mask,USER_FPSR(%a6)
-
-inx2_work:
- btst &inex2_bit,FPCR_ENABLE(%a6) # is inexact enabled?
- bne.b inx2_work_ena # yes
- rts
-inx2_work_ena:
- fmov.l USER_FPCR(%a6),%fpcr # insert user's exceptions
- fmov.s &0x3f800000,%fp1 # load +1
- fadd.x pls_tiny(%pc),%fp1 # cause exception
- rts
-
-inx2_zero:
- mov.b &z_bmask,FPSR_CC(%a6)
- ori.w &inx2a_mask,2+USER_FPSR(%a6) # set INEX/AINEX
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# t_extdnrm(): Handle DENORM inputs in 060FPLSP. #
-# t_resdnrm(): Handle DENORM inputs in 060FPLSP for "fscale". #
-# #
-# This routine is used by the 060FPLSP package. #
-# #
-# XREF **************************************************************** #
-# None. #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input operand #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = default result #
-# #
-# ALGORITHM *********************************************************** #
-# For all functions that have a denormalized input and that #
-# f(x)=x, this is the entry point. #
-# DENORM value is moved using "fmove" which triggers an exception #
-# if enabled so the operating system can log the event. #
-# #
-#########################################################################
-
- global t_extdnrm
-t_extdnrm:
- fmov.l USER_FPCR(%a6),%fpcr
- fmov.x SRC_EX(%a0),%fp0
- fmov.l %fpsr,%d0
- ori.l &unfinx_mask,%d0
- or.l %d0,USER_FPSR(%a6)
- rts
-
- global t_resdnrm
-t_resdnrm:
- fmov.l USER_FPCR(%a6),%fpcr
- fmov.x SRC_EX(%a0),%fp0
- fmov.l %fpsr,%d0
- or.l %d0,USER_FPSR(%a6)
- rts
-
-##########################################
-
-#
-# sto_cos:
-# This is used by fsincos library emulation. The correct
-# values are already in fp0 and fp1 so we do nothing here.
-#
- global sto_cos
-sto_cos:
- rts
-
-##########################################
-
-#
-# dst_qnan --- force result when destination is a NaN
-#
- global dst_qnan
-dst_qnan:
- fmov.x DST(%a1),%fp0
- tst.b DST_EX(%a1)
- bmi.b dst_qnan_m
-dst_qnan_p:
- mov.b &nan_bmask,FPSR_CC(%a6)
- rts
-dst_qnan_m:
- mov.b &nan_bmask+neg_bmask,FPSR_CC(%a6)
- rts
-
-#
-# src_qnan --- force result when source is a NaN
-#
- global src_qnan
-src_qnan:
- fmov.x SRC(%a0),%fp0
- tst.b SRC_EX(%a0)
- bmi.b src_qnan_m
-src_qnan_p:
- mov.b &nan_bmask,FPSR_CC(%a6)
- rts
-src_qnan_m:
- mov.b &nan_bmask+neg_bmask,FPSR_CC(%a6)
- rts
-
-##########################################
-
-#
-# Native instruction support
-#
-# Some systems may need entry points even for 68060 native
-# instructions. These routines are provided for
-# convenience.
-#
- global _fadds_
-_fadds_:
- fmov.l %fpcr,-(%sp) # save fpcr
- fmov.l &0x00000000,%fpcr # clear fpcr for load
- fmov.s 0x8(%sp),%fp0 # load sgl dst
- fmov.l (%sp)+,%fpcr # restore fpcr
- fadd.s 0x8(%sp),%fp0 # fadd w/ sgl src
- rts
-
- global _faddd_
-_faddd_:
- fmov.l %fpcr,-(%sp) # save fpcr
- fmov.l &0x00000000,%fpcr # clear fpcr for load
- fmov.d 0x8(%sp),%fp0 # load dbl dst
- fmov.l (%sp)+,%fpcr # restore fpcr
- fadd.d 0xc(%sp),%fp0 # fadd w/ dbl src
- rts
-
- global _faddx_
-_faddx_:
- fmovm.x 0x4(%sp),&0x80 # load ext dst
- fadd.x 0x10(%sp),%fp0 # fadd w/ ext src
- rts
-
- global _fsubs_
-_fsubs_:
- fmov.l %fpcr,-(%sp) # save fpcr
- fmov.l &0x00000000,%fpcr # clear fpcr for load
- fmov.s 0x8(%sp),%fp0 # load sgl dst
- fmov.l (%sp)+,%fpcr # restore fpcr
- fsub.s 0x8(%sp),%fp0 # fsub w/ sgl src
- rts
-
- global _fsubd_
-_fsubd_:
- fmov.l %fpcr,-(%sp) # save fpcr
- fmov.l &0x00000000,%fpcr # clear fpcr for load
- fmov.d 0x8(%sp),%fp0 # load dbl dst
- fmov.l (%sp)+,%fpcr # restore fpcr
- fsub.d 0xc(%sp),%fp0 # fsub w/ dbl src
- rts
-
- global _fsubx_
-_fsubx_:
- fmovm.x 0x4(%sp),&0x80 # load ext dst
- fsub.x 0x10(%sp),%fp0 # fsub w/ ext src
- rts
-
- global _fmuls_
-_fmuls_:
- fmov.l %fpcr,-(%sp) # save fpcr
- fmov.l &0x00000000,%fpcr # clear fpcr for load
- fmov.s 0x8(%sp),%fp0 # load sgl dst
- fmov.l (%sp)+,%fpcr # restore fpcr
- fmul.s 0x8(%sp),%fp0 # fmul w/ sgl src
- rts
-
- global _fmuld_
-_fmuld_:
- fmov.l %fpcr,-(%sp) # save fpcr
- fmov.l &0x00000000,%fpcr # clear fpcr for load
- fmov.d 0x8(%sp),%fp0 # load dbl dst
- fmov.l (%sp)+,%fpcr # restore fpcr
- fmul.d 0xc(%sp),%fp0 # fmul w/ dbl src
- rts
-
- global _fmulx_
-_fmulx_:
- fmovm.x 0x4(%sp),&0x80 # load ext dst
- fmul.x 0x10(%sp),%fp0 # fmul w/ ext src
- rts
-
- global _fdivs_
-_fdivs_:
- fmov.l %fpcr,-(%sp) # save fpcr
- fmov.l &0x00000000,%fpcr # clear fpcr for load
- fmov.s 0x8(%sp),%fp0 # load sgl dst
- fmov.l (%sp)+,%fpcr # restore fpcr
- fdiv.s 0x8(%sp),%fp0 # fdiv w/ sgl src
- rts
-
- global _fdivd_
-_fdivd_:
- fmov.l %fpcr,-(%sp) # save fpcr
- fmov.l &0x00000000,%fpcr # clear fpcr for load
- fmov.d 0x8(%sp),%fp0 # load dbl dst
- fmov.l (%sp)+,%fpcr # restore fpcr
- fdiv.d 0xc(%sp),%fp0 # fdiv w/ dbl src
- rts
-
- global _fdivx_
-_fdivx_:
- fmovm.x 0x4(%sp),&0x80 # load ext dst
- fdiv.x 0x10(%sp),%fp0 # fdiv w/ ext src
- rts
-
- global _fabss_
-_fabss_:
- fabs.s 0x4(%sp),%fp0 # fabs w/ sgl src
- rts
-
- global _fabsd_
-_fabsd_:
- fabs.d 0x4(%sp),%fp0 # fabs w/ dbl src
- rts
-
- global _fabsx_
-_fabsx_:
- fabs.x 0x4(%sp),%fp0 # fabs w/ ext src
- rts
-
- global _fnegs_
-_fnegs_:
- fneg.s 0x4(%sp),%fp0 # fneg w/ sgl src
- rts
-
- global _fnegd_
-_fnegd_:
- fneg.d 0x4(%sp),%fp0 # fneg w/ dbl src
- rts
-
- global _fnegx_
-_fnegx_:
- fneg.x 0x4(%sp),%fp0 # fneg w/ ext src
- rts
-
- global _fsqrts_
-_fsqrts_:
- fsqrt.s 0x4(%sp),%fp0 # fsqrt w/ sgl src
- rts
-
- global _fsqrtd_
-_fsqrtd_:
- fsqrt.d 0x4(%sp),%fp0 # fsqrt w/ dbl src
- rts
-
- global _fsqrtx_
-_fsqrtx_:
- fsqrt.x 0x4(%sp),%fp0 # fsqrt w/ ext src
- rts
-
- global _fints_
-_fints_:
- fint.s 0x4(%sp),%fp0 # fint w/ sgl src
- rts
-
- global _fintd_
-_fintd_:
- fint.d 0x4(%sp),%fp0 # fint w/ dbl src
- rts
-
- global _fintx_
-_fintx_:
- fint.x 0x4(%sp),%fp0 # fint w/ ext src
- rts
-
- global _fintrzs_
-_fintrzs_:
- fintrz.s 0x4(%sp),%fp0 # fintrz w/ sgl src
- rts
-
- global _fintrzd_
-_fintrzd_:
- fintrz.d 0x4(%sp),%fp0 # fintrx w/ dbl src
- rts
-
- global _fintrzx_
-_fintrzx_:
- fintrz.x 0x4(%sp),%fp0 # fintrz w/ ext src
- rts
-
-########################################################################
-
-#########################################################################
-# src_zero(): Return signed zero according to sign of src operand. #
-#########################################################################
- global src_zero
-src_zero:
- tst.b SRC_EX(%a0) # get sign of src operand
- bmi.b ld_mzero # if neg, load neg zero
-
-#
-# ld_pzero(): return a positive zero.
-#
- global ld_pzero
-ld_pzero:
- fmov.s &0x00000000,%fp0 # load +0
- mov.b &z_bmask,FPSR_CC(%a6) # set 'Z' ccode bit
- rts
-
-# ld_mzero(): return a negative zero.
- global ld_mzero
-ld_mzero:
- fmov.s &0x80000000,%fp0 # load -0
- mov.b &neg_bmask+z_bmask,FPSR_CC(%a6) # set 'N','Z' ccode bits
- rts
-
-#########################################################################
-# dst_zero(): Return signed zero according to sign of dst operand. #
-#########################################################################
- global dst_zero
-dst_zero:
- tst.b DST_EX(%a1) # get sign of dst operand
- bmi.b ld_mzero # if neg, load neg zero
- bra.b ld_pzero # load positive zero
-
-#########################################################################
-# src_inf(): Return signed inf according to sign of src operand. #
-#########################################################################
- global src_inf
-src_inf:
- tst.b SRC_EX(%a0) # get sign of src operand
- bmi.b ld_minf # if negative branch
-
-#
-# ld_pinf(): return a positive infinity.
-#
- global ld_pinf
-ld_pinf:
- fmov.s &0x7f800000,%fp0 # load +INF
- mov.b &inf_bmask,FPSR_CC(%a6) # set 'INF' ccode bit
- rts
-
-#
-# ld_minf():return a negative infinity.
-#
- global ld_minf
-ld_minf:
- fmov.s &0xff800000,%fp0 # load -INF
- mov.b &neg_bmask+inf_bmask,FPSR_CC(%a6) # set 'N','I' ccode bits
- rts
-
-#########################################################################
-# dst_inf(): Return signed inf according to sign of dst operand. #
-#########################################################################
- global dst_inf
-dst_inf:
- tst.b DST_EX(%a1) # get sign of dst operand
- bmi.b ld_minf # if negative branch
- bra.b ld_pinf
-
- global szr_inf
-#################################################################
-# szr_inf(): Return +ZERO for a negative src operand or #
-# +INF for a positive src operand. #
-# Routine used for fetox, ftwotox, and ftentox. #
-#################################################################
-szr_inf:
- tst.b SRC_EX(%a0) # check sign of source
- bmi.b ld_pzero
- bra.b ld_pinf
-
-#########################################################################
-# sopr_inf(): Return +INF for a positive src operand or #
-# jump to operand error routine for a negative src operand. #
-# Routine used for flogn, flognp1, flog10, and flog2. #
-#########################################################################
- global sopr_inf
-sopr_inf:
- tst.b SRC_EX(%a0) # check sign of source
- bmi.w t_operr
- bra.b ld_pinf
-
-#################################################################
-# setoxm1i(): Return minus one for a negative src operand or #
-# positive infinity for a positive src operand. #
-# Routine used for fetoxm1. #
-#################################################################
- global setoxm1i
-setoxm1i:
- tst.b SRC_EX(%a0) # check sign of source
- bmi.b ld_mone
- bra.b ld_pinf
-
-#########################################################################
-# src_one(): Return signed one according to sign of src operand. #
-#########################################################################
- global src_one
-src_one:
- tst.b SRC_EX(%a0) # check sign of source
- bmi.b ld_mone
-
-#
-# ld_pone(): return positive one.
-#
- global ld_pone
-ld_pone:
- fmov.s &0x3f800000,%fp0 # load +1
- clr.b FPSR_CC(%a6)
- rts
-
-#
-# ld_mone(): return negative one.
-#
- global ld_mone
-ld_mone:
- fmov.s &0xbf800000,%fp0 # load -1
- mov.b &neg_bmask,FPSR_CC(%a6) # set 'N' ccode bit
- rts
-
-ppiby2: long 0x3fff0000, 0xc90fdaa2, 0x2168c235
-mpiby2: long 0xbfff0000, 0xc90fdaa2, 0x2168c235
-
-#################################################################
-# spi_2(): Return signed PI/2 according to sign of src operand. #
-#################################################################
- global spi_2
-spi_2:
- tst.b SRC_EX(%a0) # check sign of source
- bmi.b ld_mpi2
-
-#
-# ld_ppi2(): return positive PI/2.
-#
- global ld_ppi2
-ld_ppi2:
- fmov.l %d0,%fpcr
- fmov.x ppiby2(%pc),%fp0 # load +pi/2
- bra.w t_pinx2 # set INEX2
-
-#
-# ld_mpi2(): return negative PI/2.
-#
- global ld_mpi2
-ld_mpi2:
- fmov.l %d0,%fpcr
- fmov.x mpiby2(%pc),%fp0 # load -pi/2
- bra.w t_minx2 # set INEX2
-
-####################################################
-# The following routines give support for fsincos. #
-####################################################
-
-#
-# ssincosz(): When the src operand is ZERO, store a one in the
-# cosine register and return a ZERO in fp0 w/ the same sign
-# as the src operand.
-#
- global ssincosz
-ssincosz:
- fmov.s &0x3f800000,%fp1
- tst.b SRC_EX(%a0) # test sign
- bpl.b sincoszp
- fmov.s &0x80000000,%fp0 # return sin result in fp0
- mov.b &z_bmask+neg_bmask,FPSR_CC(%a6)
- rts
-sincoszp:
- fmov.s &0x00000000,%fp0 # return sin result in fp0
- mov.b &z_bmask,FPSR_CC(%a6)
- rts
-
-#
-# ssincosi(): When the src operand is INF, store a QNAN in the cosine
-# register and jump to the operand error routine for negative
-# src operands.
-#
- global ssincosi
-ssincosi:
- fmov.x qnan(%pc),%fp1 # load NAN
- bra.w t_operr
-
-#
-# ssincosqnan(): When the src operand is a QNAN, store the QNAN in the cosine
-# register and branch to the src QNAN routine.
-#
- global ssincosqnan
-ssincosqnan:
- fmov.x LOCAL_EX(%a0),%fp1
- bra.w src_qnan
-
-########################################################################
-
- global smod_sdnrm
- global smod_snorm
-smod_sdnrm:
-smod_snorm:
- mov.b DTAG(%a6),%d1
- beq.l smod
- cmpi.b %d1,&ZERO
- beq.w smod_zro
- cmpi.b %d1,&INF
- beq.l t_operr
- cmpi.b %d1,&DENORM
- beq.l smod
- bra.l dst_qnan
-
- global smod_szero
-smod_szero:
- mov.b DTAG(%a6),%d1
- beq.l t_operr
- cmpi.b %d1,&ZERO
- beq.l t_operr
- cmpi.b %d1,&INF
- beq.l t_operr
- cmpi.b %d1,&DENORM
- beq.l t_operr
- bra.l dst_qnan
-
- global smod_sinf
-smod_sinf:
- mov.b DTAG(%a6),%d1
- beq.l smod_fpn
- cmpi.b %d1,&ZERO
- beq.l smod_zro
- cmpi.b %d1,&INF
- beq.l t_operr
- cmpi.b %d1,&DENORM
- beq.l smod_fpn
- bra.l dst_qnan
-
-smod_zro:
-srem_zro:
- mov.b SRC_EX(%a0),%d1 # get src sign
- mov.b DST_EX(%a1),%d0 # get dst sign
- eor.b %d0,%d1 # get qbyte sign
- andi.b &0x80,%d1
- mov.b %d1,FPSR_QBYTE(%a6)
- tst.b %d0
- bpl.w ld_pzero
- bra.w ld_mzero
-
-smod_fpn:
-srem_fpn:
- clr.b FPSR_QBYTE(%a6)
- mov.l %d0,-(%sp)
- mov.b SRC_EX(%a0),%d1 # get src sign
- mov.b DST_EX(%a1),%d0 # get dst sign
- eor.b %d0,%d1 # get qbyte sign
- andi.b &0x80,%d1
- mov.b %d1,FPSR_QBYTE(%a6)
- cmpi.b DTAG(%a6),&DENORM
- bne.b smod_nrm
- lea DST(%a1),%a0
- mov.l (%sp)+,%d0
- bra t_resdnrm
-smod_nrm:
- fmov.l (%sp)+,%fpcr
- fmov.x DST(%a1),%fp0
- tst.b DST_EX(%a1)
- bmi.b smod_nrm_neg
- rts
-
-smod_nrm_neg:
- mov.b &neg_bmask,FPSR_CC(%a6) # set 'N' code
- rts
-
-#########################################################################
- global srem_snorm
- global srem_sdnrm
-srem_sdnrm:
-srem_snorm:
- mov.b DTAG(%a6),%d1
- beq.l srem
- cmpi.b %d1,&ZERO
- beq.w srem_zro
- cmpi.b %d1,&INF
- beq.l t_operr
- cmpi.b %d1,&DENORM
- beq.l srem
- bra.l dst_qnan
-
- global srem_szero
-srem_szero:
- mov.b DTAG(%a6),%d1
- beq.l t_operr
- cmpi.b %d1,&ZERO
- beq.l t_operr
- cmpi.b %d1,&INF
- beq.l t_operr
- cmpi.b %d1,&DENORM
- beq.l t_operr
- bra.l dst_qnan
-
- global srem_sinf
-srem_sinf:
- mov.b DTAG(%a6),%d1
- beq.w srem_fpn
- cmpi.b %d1,&ZERO
- beq.w srem_zro
- cmpi.b %d1,&INF
- beq.l t_operr
- cmpi.b %d1,&DENORM
- beq.l srem_fpn
- bra.l dst_qnan
-
-#########################################################################
-
- global sscale_snorm
- global sscale_sdnrm
-sscale_snorm:
-sscale_sdnrm:
- mov.b DTAG(%a6),%d1
- beq.l sscale
- cmpi.b %d1,&ZERO
- beq.l dst_zero
- cmpi.b %d1,&INF
- beq.l dst_inf
- cmpi.b %d1,&DENORM
- beq.l sscale
- bra.l dst_qnan
-
- global sscale_szero
-sscale_szero:
- mov.b DTAG(%a6),%d1
- beq.l sscale
- cmpi.b %d1,&ZERO
- beq.l dst_zero
- cmpi.b %d1,&INF
- beq.l dst_inf
- cmpi.b %d1,&DENORM
- beq.l sscale
- bra.l dst_qnan
-
- global sscale_sinf
-sscale_sinf:
- mov.b DTAG(%a6),%d1
- beq.l t_operr
- cmpi.b %d1,&QNAN
- beq.l dst_qnan
- bra.l t_operr
-
-########################################################################
-
- global sop_sqnan
-sop_sqnan:
- mov.b DTAG(%a6),%d1
- cmpi.b %d1,&QNAN
- beq.l dst_qnan
- bra.l src_qnan
-
-#########################################################################
-# norm(): normalize the mantissa of an extended precision input. the #
-# input operand should not be normalized already. #
-# #
-# XDEF **************************************************************** #
-# norm() #
-# #
-# XREF **************************************************************** #
-# none #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer fp extended precision operand to normalize #
-# #
-# OUTPUT ************************************************************** #
-# d0 = number of bit positions the mantissa was shifted #
-# a0 = the input operand's mantissa is normalized; the exponent #
-# is unchanged. #
-# #
-#########################################################################
- global norm
-norm:
- mov.l %d2, -(%sp) # create some temp regs
- mov.l %d3, -(%sp)
-
- mov.l FTEMP_HI(%a0), %d0 # load hi(mantissa)
- mov.l FTEMP_LO(%a0), %d1 # load lo(mantissa)
-
- bfffo %d0{&0:&32}, %d2 # how many places to shift?
- beq.b norm_lo # hi(man) is all zeroes!
-
-norm_hi:
- lsl.l %d2, %d0 # left shift hi(man)
- bfextu %d1{&0:%d2}, %d3 # extract lo bits
-
- or.l %d3, %d0 # create hi(man)
- lsl.l %d2, %d1 # create lo(man)
-
- mov.l %d0, FTEMP_HI(%a0) # store new hi(man)
- mov.l %d1, FTEMP_LO(%a0) # store new lo(man)
-
- mov.l %d2, %d0 # return shift amount
-
- mov.l (%sp)+, %d3 # restore temp regs
- mov.l (%sp)+, %d2
-
- rts
-
-norm_lo:
- bfffo %d1{&0:&32}, %d2 # how many places to shift?
- lsl.l %d2, %d1 # shift lo(man)
- add.l &32, %d2 # add 32 to shft amount
-
- mov.l %d1, FTEMP_HI(%a0) # store hi(man)
- clr.l FTEMP_LO(%a0) # lo(man) is now zero
-
- mov.l %d2, %d0 # return shift amount
-
- mov.l (%sp)+, %d3 # restore temp regs
- mov.l (%sp)+, %d2
-
- rts
-
-#########################################################################
-# unnorm_fix(): - changes an UNNORM to one of NORM, DENORM, or ZERO #
-# - returns corresponding optype tag #
-# #
-# XDEF **************************************************************** #
-# unnorm_fix() #
-# #
-# XREF **************************************************************** #
-# norm() - normalize the mantissa #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to unnormalized extended precision number #
-# #
-# OUTPUT ************************************************************** #
-# d0 = optype tag - is corrected to one of NORM, DENORM, or ZERO #
-# a0 = input operand has been converted to a norm, denorm, or #
-# zero; both the exponent and mantissa are changed. #
-# #
-#########################################################################
-
- global unnorm_fix
-unnorm_fix:
- bfffo FTEMP_HI(%a0){&0:&32}, %d0 # how many shifts are needed?
- bne.b unnorm_shift # hi(man) is not all zeroes
-
-#
-# hi(man) is all zeroes so see if any bits in lo(man) are set
-#
-unnorm_chk_lo:
- bfffo FTEMP_LO(%a0){&0:&32}, %d0 # is operand really a zero?
- beq.w unnorm_zero # yes
-
- add.w &32, %d0 # no; fix shift distance
-
-#
-# d0 = # shifts needed for complete normalization
-#
-unnorm_shift:
- clr.l %d1 # clear top word
- mov.w FTEMP_EX(%a0), %d1 # extract exponent
- and.w &0x7fff, %d1 # strip off sgn
-
- cmp.w %d0, %d1 # will denorm push exp < 0?
- bgt.b unnorm_nrm_zero # yes; denorm only until exp = 0
-
-#
-# exponent would not go < 0. therefore, number stays normalized
-#
- sub.w %d0, %d1 # shift exponent value
- mov.w FTEMP_EX(%a0), %d0 # load old exponent
- and.w &0x8000, %d0 # save old sign
- or.w %d0, %d1 # {sgn,new exp}
- mov.w %d1, FTEMP_EX(%a0) # insert new exponent
-
- bsr.l norm # normalize UNNORM
-
- mov.b &NORM, %d0 # return new optype tag
- rts
-
-#
-# exponent would go < 0, so only denormalize until exp = 0
-#
-unnorm_nrm_zero:
- cmp.b %d1, &32 # is exp <= 32?
- bgt.b unnorm_nrm_zero_lrg # no; go handle large exponent
-
- bfextu FTEMP_HI(%a0){%d1:&32}, %d0 # extract new hi(man)
- mov.l %d0, FTEMP_HI(%a0) # save new hi(man)
-
- mov.l FTEMP_LO(%a0), %d0 # fetch old lo(man)
- lsl.l %d1, %d0 # extract new lo(man)
- mov.l %d0, FTEMP_LO(%a0) # save new lo(man)
-
- and.w &0x8000, FTEMP_EX(%a0) # set exp = 0
-
- mov.b &DENORM, %d0 # return new optype tag
- rts
-
-#
-# only mantissa bits set are in lo(man)
-#
-unnorm_nrm_zero_lrg:
- sub.w &32, %d1 # adjust shft amt by 32
-
- mov.l FTEMP_LO(%a0), %d0 # fetch old lo(man)
- lsl.l %d1, %d0 # left shift lo(man)
-
- mov.l %d0, FTEMP_HI(%a0) # store new hi(man)
- clr.l FTEMP_LO(%a0) # lo(man) = 0
-
- and.w &0x8000, FTEMP_EX(%a0) # set exp = 0
-
- mov.b &DENORM, %d0 # return new optype tag
- rts
-
-#
-# whole mantissa is zero so this UNNORM is actually a zero
-#
-unnorm_zero:
- and.w &0x8000, FTEMP_EX(%a0) # force exponent to zero
-
- mov.b &ZERO, %d0 # fix optype tag
- rts
diff --git a/sys/arch/m68k/060sp/fplsp.sa b/sys/arch/m68k/060sp/fplsp.sa
deleted file mode 100644
index 712a55fb84a..00000000000
--- a/sys/arch/m68k/060sp/fplsp.sa
+++ /dev/null
@@ -1,1984 +0,0 @@
-#
-# $OpenBSD: fplsp.sa,v 1.2 1996/05/30 22:14:14 niklas Exp $
-# $NetBSD: fplsp.sa,v 1.2 1996/05/15 19:47:48 is Exp $
-#
-
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-# M68000 Hi-Performance Microprocessor Division
-# M68060 Software Package Production Release
-#
-# M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
-# All rights reserved.
-#
-# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-# To the maximum extent permitted by applicable law,
-# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
-# FOR A PARTICULAR PURPOSE and any warranty against infringement with
-# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-# and any accompanying written materials.
-#
-# To the maximum extent permitted by applicable law,
-# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
-# BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
-# ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
-#
-# Motorola assumes no responsibility for the maintenance and support
-# of the SOFTWARE.
-#
-# You are hereby granted a copyright license to use, modify, and distribute the
-# SOFTWARE so long as this entire notice is retained without alteration
-# in any modified and/or redistributed versions, and that such modified
-# versions are clearly identified as such.
-# No licenses are granted by implication, estoppel or otherwise under any
-# patents or trademarks of Motorola, Inc.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- dc.l $60ff0000,$238e0000,$60ff0000,$24200000
- dc.l $60ff0000,$24b60000,$60ff0000,$11060000
- dc.l $60ff0000,$11980000,$60ff0000,$122e0000
- dc.l $60ff0000,$0f160000,$60ff0000,$0fa80000
- dc.l $60ff0000,$103e0000,$60ff0000,$12ae0000
- dc.l $60ff0000,$13400000,$60ff0000,$13d60000
- dc.l $60ff0000,$05ae0000,$60ff0000,$06400000
- dc.l $60ff0000,$06d60000,$60ff0000,$213e0000
- dc.l $60ff0000,$21d00000,$60ff0000,$22660000
- dc.l $60ff0000,$16160000,$60ff0000,$16a80000
- dc.l $60ff0000,$173e0000,$60ff0000,$0aee0000
- dc.l $60ff0000,$0b800000,$60ff0000,$0c160000
- dc.l $60ff0000,$24a60000,$60ff0000,$25380000
- dc.l $60ff0000,$25ce0000,$60ff0000,$26660000
- dc.l $60ff0000,$26f80000,$60ff0000,$278e0000
- dc.l $60ff0000,$1d160000,$60ff0000,$1da80000
- dc.l $60ff0000,$1e3e0000,$60ff0000,$1ed60000
- dc.l $60ff0000,$1f680000,$60ff0000,$1ffe0000
- dc.l $60ff0000,$1b0e0000,$60ff0000,$1ba00000
- dc.l $60ff0000,$1c360000,$60ff0000,$08860000
- dc.l $60ff0000,$09180000,$60ff0000,$09ae0000
- dc.l $60ff0000,$2bf00000,$60ff0000,$2ca40000
- dc.l $60ff0000,$2d580000,$60ff0000,$29980000
- dc.l $60ff0000,$2a4c0000,$60ff0000,$2b000000
- dc.l $60ff0000,$2e000000,$60ff0000,$2eb40000
- dc.l $60ff0000,$2f680000,$60ff0000,$029e0000
- dc.l $60ff0000,$03300000,$60ff0000,$03c60000
- dc.l $60ff0000,$27660000,$60ff0000,$27fe0000
- dc.l $60ff0000,$289a0000,$60ff0000,$061e0000
- dc.l $60ff0000,$06b00000,$60ff0000,$07460000
- dc.l $60ff0000,$12ee0000,$60ff0000,$13800000
- dc.l $60ff0000,$14160000,$60ff0000,$0b760000
- dc.l $60ff0000,$0c080000,$60ff0000,$0c9e0000
- dc.l $60ff0000,$18460000,$60ff0000,$18d80000
- dc.l $60ff0000,$196e0000,$60ff0000,$16560000
- dc.l $60ff0000,$16e80000,$60ff0000,$177e0000
- dc.l $60ff0000,$72fe0000,$60ff0000,$72fe0000
- dc.l $60ff0000,$72fe0000,$60ff0000,$71be0000
- dc.l $60ff0000,$71d40000,$60ff0000,$71ea0000
- dc.l $60ff0000,$72840000,$60ff0000,$729a0000
- dc.l $60ff0000,$72b00000,$60ff0000,$72fe0000
- dc.l $60ff0000,$72fe0000,$60ff0000,$72fe0000
- dc.l $60ff0000,$72fe0000,$60ff0000,$72fe0000
- dc.l $60ff0000,$72fe0000,$60ff0000,$71f20000
- dc.l $60ff0000,$72080000,$60ff0000,$721e0000
- dc.l $60ff0000,$72860000,$60ff0000,$72860000
- dc.l $60ff0000,$72860000,$60ff0000,$72860000
- dc.l $60ff0000,$72860000,$60ff0000,$72860000
- dc.l $60ff0000,$71600000,$60ff0000,$71760000
- dc.l $60ff0000,$718c0000,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $40c62d38,$d3d64634,$3d6f90ae,$b1e75cc7
- dc.l $40000000,$c90fdaa2,$2168c235,$00000000
- dc.l $3fff0000,$c90fdaa2,$2168c235,$00000000
- dc.l $3fe45f30,$6dc9c883,$4e56ff40,$48ee0303
- dc.l $ff9cf22e,$b800ff60,$f22ef0c0,$ffdcf23c
- dc.l $90000000,$0000f22e,$44000008,$f22e6800
- dc.l $ff6c41ee,$ff6c61ff,$00006c76,$1d40ff4e
- dc.l $120002ae,$00ff00ff,$ff644280,$102eff63
- dc.l $4a016608,$61ff0000,$2ddc6030,$0c010001
- dc.l $660861ff,$00007124,$60220c01,$00026608
- dc.l $61ff0000,$6d226014,$0c010003,$660861ff
- dc.l $00006f4c,$600661ff,$00002f8e,$4cee0303
- dc.l $ff9cf22e,$9800ff60,$f22ed040,$ffe84e5e
- dc.l $4e754e56,$ff4048ee,$0303ff9c,$f22eb800
- dc.l $ff60f22e,$f0c0ffdc,$f23c9000,$00000000
- dc.l $f22e5400,$0008f22e,$6800ff6c,$41eeff6c
- dc.l $61ff0000,$6bdc1d40,$ff4e1200,$02ae00ff
- dc.l $00ffff64,$4280102e,$ff631d41,$ff4e4a01
- dc.l $660861ff,$00002d3e,$60300c01,$00016608
- dc.l $61ff0000,$70866022,$0c010002,$660861ff
- dc.l $00006c84,$60140c01,$00036608,$61ff0000
- dc.l $6eae6006,$61ff0000,$2ef04cee,$0303ff9c
- dc.l $f22e9800,$ff60f22e,$d040ffe8,$4e5e4e75
- dc.l $4e56ff40,$48ee0303,$ff9cf22e,$b800ff60
- dc.l $f22ef0c0,$ffdcf23c,$90000000,$000041ee
- dc.l $ff6c216e,$00080000,$216e000c,$0004216e
- dc.l $00100008,$61ff0000,$6b381d40,$ff4e1200
- dc.l $02ae00ff,$00ffff64,$4280102e,$ff634a01
- dc.l $660861ff,$00002c9e,$60300c01,$00016608
- dc.l $61ff0000,$6fe66022,$0c010002,$660861ff
- dc.l $00006be4,$60140c01,$00036608,$61ff0000
- dc.l $6e0e6006,$61ff0000,$2e504cee,$0303ff9c
- dc.l $f22e9800,$ff60f22e,$d040ffe8,$4e5e4e75
- dc.l $4e56ff40,$48ee0303,$ff9cf22e,$b800ff60
- dc.l $f22ef0c0,$ffdcf23c,$90000000,$0000f22e
- dc.l $44000008,$f22e6800,$ff6c41ee,$ff6c61ff
- dc.l $00006a9e,$1d40ff4e,$120002ae,$00ff00ff
- dc.l $ff644280,$102eff63,$4a016608,$61ff0000
- dc.l $2c0e6030,$0c010001,$660861ff,$00006fc8
- dc.l $60220c01,$00026608,$61ff0000,$6b4a6014
- dc.l $0c010003,$660861ff,$00006d74,$600661ff
- dc.l $00002dbc,$4cee0303,$ff9cf22e,$9800ff60
- dc.l $f22ed040,$ffe84e5e,$4e754e56,$ff4048ee
- dc.l $0303ff9c,$f22eb800,$ff60f22e,$f0c0ffdc
- dc.l $f23c9000,$00000000,$f22e5400,$0008f22e
- dc.l $6800ff6c,$41eeff6c,$61ff0000,$6a041d40
- dc.l $ff4e1200,$02ae00ff,$00ffff64,$4280102e
- dc.l $ff631d41,$ff4e4a01,$660861ff,$00002b70
- dc.l $60300c01,$00016608,$61ff0000,$6f2a6022
- dc.l $0c010002,$660861ff,$00006aac,$60140c01
- dc.l $00036608,$61ff0000,$6cd66006,$61ff0000
- dc.l $2d1e4cee,$0303ff9c,$f22e9800,$ff60f22e
- dc.l $d040ffe8,$4e5e4e75,$4e56ff40,$48ee0303
- dc.l $ff9cf22e,$b800ff60,$f22ef0c0,$ffdcf23c
- dc.l $90000000,$000041ee,$ff6c216e,$00080000
- dc.l $216e000c,$0004216e,$00100008,$61ff0000
- dc.l $69601d40,$ff4e1200,$02ae00ff,$00ffff64
- dc.l $4280102e,$ff634a01,$660861ff,$00002ad0
- dc.l $60300c01,$00016608,$61ff0000,$6e8a6022
- dc.l $0c010002,$660861ff,$00006a0c,$60140c01
- dc.l $00036608,$61ff0000,$6c366006,$61ff0000
- dc.l $2c7e4cee,$0303ff9c,$f22e9800,$ff60f22e
- dc.l $d040ffe8,$4e5e4e75,$4e56ff40,$48ee0303
- dc.l $ff9cf22e,$b800ff60,$f22ef0c0,$ffdcf23c
- dc.l $90000000,$0000f22e,$44000008,$f22e6800
- dc.l $ff6c41ee,$ff6c61ff,$000068c6,$1d40ff4e
- dc.l $120002ae,$00ff00ff,$ff644280,$102eff63
- dc.l $4a016608,$61ff0000,$4e686030,$0c010001
- dc.l $660861ff,$00006d74,$60220c01,$00026608
- dc.l $61ff0000,$6d946014,$0c010003,$660861ff
- dc.l $00006b9c,$600661ff,$00004f14,$4cee0303
- dc.l $ff9cf22e,$9800ff60,$f22ed040,$ffe84e5e
- dc.l $4e754e56,$ff4048ee,$0303ff9c,$f22eb800
- dc.l $ff60f22e,$f0c0ffdc,$f23c9000,$00000000
- dc.l $f22e5400,$0008f22e,$6800ff6c,$41eeff6c
- dc.l $61ff0000,$682c1d40,$ff4e1200,$02ae00ff
- dc.l $00ffff64,$4280102e,$ff631d41,$ff4e4a01
- dc.l $660861ff,$00004dca,$60300c01,$00016608
- dc.l $61ff0000,$6cd66022,$0c010002,$660861ff
- dc.l $00006cf6,$60140c01,$00036608,$61ff0000
- dc.l $6afe6006,$61ff0000,$4e764cee,$0303ff9c
- dc.l $f22e9800,$ff60f22e,$d040ffe8,$4e5e4e75
- dc.l $4e56ff40,$48ee0303,$ff9cf22e,$b800ff60
- dc.l $f22ef0c0,$ffdcf23c,$90000000,$000041ee
- dc.l $ff6c216e,$00080000,$216e000c,$0004216e
- dc.l $00100008,$61ff0000,$67881d40,$ff4e1200
- dc.l $02ae00ff,$00ffff64,$4280102e,$ff634a01
- dc.l $660861ff,$00004d2a,$60300c01,$00016608
- dc.l $61ff0000,$6c366022,$0c010002,$660861ff
- dc.l $00006c56,$60140c01,$00036608,$61ff0000
- dc.l $6a5e6006,$61ff0000,$4dd64cee,$0303ff9c
- dc.l $f22e9800,$ff60f22e,$d040ffe8,$4e5e4e75
- dc.l $4e56ff40,$48ee0303,$ff9cf22e,$b800ff60
- dc.l $f22ef0c0,$ffdcf23c,$90000000,$0000f22e
- dc.l $44000008,$f22e6800,$ff6c41ee,$ff6c61ff
- dc.l $000066ee,$1d40ff4e,$120002ae,$00ff00ff
- dc.l $ff644280,$102eff63,$4a016608,$61ff0000
- dc.l $59b26030,$0c010001,$660861ff,$00006b9c
- dc.l $60220c01,$00026608,$61ff0000,$6bf26014
- dc.l $0c010003,$660861ff,$000069c4,$600661ff
- dc.l $00005ad4,$4cee0303,$ff9cf22e,$9800ff60
- dc.l $f22ed040,$ffe84e5e,$4e754e56,$ff4048ee
- dc.l $0303ff9c,$f22eb800,$ff60f22e,$f0c0ffdc
- dc.l $f23c9000,$00000000,$f22e5400,$0008f22e
- dc.l $6800ff6c,$41eeff6c,$61ff0000,$66541d40
- dc.l $ff4e1200,$02ae00ff,$00ffff64,$4280102e
- dc.l $ff631d41,$ff4e4a01,$660861ff,$00005914
- dc.l $60300c01,$00016608,$61ff0000,$6afe6022
- dc.l $0c010002,$660861ff,$00006b54,$60140c01
- dc.l $00036608,$61ff0000,$69266006,$61ff0000
- dc.l $5a364cee,$0303ff9c,$f22e9800,$ff60f22e
- dc.l $d040ffe8,$4e5e4e75,$4e56ff40,$48ee0303
- dc.l $ff9cf22e,$b800ff60,$f22ef0c0,$ffdcf23c
- dc.l $90000000,$000041ee,$ff6c216e,$00080000
- dc.l $216e000c,$0004216e,$00100008,$61ff0000
- dc.l $65b01d40,$ff4e1200,$02ae00ff,$00ffff64
- dc.l $4280102e,$ff634a01,$660861ff,$00005874
- dc.l $60300c01,$00016608,$61ff0000,$6a5e6022
- dc.l $0c010002,$660861ff,$00006ab4,$60140c01
- dc.l $00036608,$61ff0000,$68866006,$61ff0000
- dc.l $59964cee,$0303ff9c,$f22e9800,$ff60f22e
- dc.l $d040ffe8,$4e5e4e75,$4e56ff40,$48ee0303
- dc.l $ff9cf22e,$b800ff60,$f22ef0c0,$ffdcf23c
- dc.l $90000000,$0000f22e,$44000008,$f22e6800
- dc.l $ff6c41ee,$ff6c61ff,$00006516,$1d40ff4e
- dc.l $120002ae,$00ff00ff,$ff644280,$102eff63
- dc.l $4a016608,$61ff0000,$46c46030,$0c010001
- dc.l $660861ff,$000069c4,$60220c01,$00026608
- dc.l $61ff0000,$6a246014,$0c010003,$660861ff
- dc.l $000067ec,$600661ff,$00004948,$4cee0303
- dc.l $ff9cf22e,$9800ff60,$f22ed040,$ffe84e5e
- dc.l $4e754e56,$ff4048ee,$0303ff9c,$f22eb800
- dc.l $ff60f22e,$f0c0ffdc,$f23c9000,$00000000
- dc.l $f22e5400,$0008f22e,$6800ff6c,$41eeff6c
- dc.l $61ff0000,$647c1d40,$ff4e1200,$02ae00ff
- dc.l $00ffff64,$4280102e,$ff631d41,$ff4e4a01
- dc.l $660861ff,$00004626,$60300c01,$00016608
- dc.l $61ff0000,$69266022,$0c010002,$660861ff
- dc.l $00006986,$60140c01,$00036608,$61ff0000
- dc.l $674e6006,$61ff0000,$48aa4cee,$0303ff9c
- dc.l $f22e9800,$ff60f22e,$d040ffe8,$4e5e4e75
- dc.l $4e56ff40,$48ee0303,$ff9cf22e,$b800ff60
- dc.l $f22ef0c0,$ffdcf23c,$90000000,$000041ee
- dc.l $ff6c216e,$00080000,$216e000c,$0004216e
- dc.l $00100008,$61ff0000,$63d81d40,$ff4e1200
- dc.l $02ae00ff,$00ffff64,$4280102e,$ff634a01
- dc.l $660861ff,$00004586,$60300c01,$00016608
- dc.l $61ff0000,$68866022,$0c010002,$660861ff
- dc.l $000068e6,$60140c01,$00036608,$61ff0000
- dc.l $66ae6006,$61ff0000,$480a4cee,$0303ff9c
- dc.l $f22e9800,$ff60f22e,$d040ffe8,$4e5e4e75
- dc.l $4e56ff40,$48ee0303,$ff9cf22e,$b800ff60
- dc.l $f22ef0c0,$ffdcf23c,$90000000,$0000f22e
- dc.l $44000008,$f22e6800,$ff6c41ee,$ff6c61ff
- dc.l $0000633e,$1d40ff4e,$120002ae,$00ff00ff
- dc.l $ff644280,$102eff63,$4a016608,$61ff0000
- dc.l $49c46030,$0c010001,$660861ff,$000067ec
- dc.l $60220c01,$00026608,$61ff0000,$68546014
- dc.l $0c010003,$660861ff,$00006614,$600661ff
- dc.l $00004afa,$4cee0303,$ff9cf22e,$9800ff60
- dc.l $f22ed040,$ffe84e5e,$4e754e56,$ff4048ee
- dc.l $0303ff9c,$f22eb800,$ff60f22e,$f0c0ffdc
- dc.l $f23c9000,$00000000,$f22e5400,$0008f22e
- dc.l $6800ff6c,$41eeff6c,$61ff0000,$62a41d40
- dc.l $ff4e1200,$02ae00ff,$00ffff64,$4280102e
- dc.l $ff631d41,$ff4e4a01,$660861ff,$00004926
- dc.l $60300c01,$00016608,$61ff0000,$674e6022
- dc.l $0c010002,$660861ff,$000067b6,$60140c01
- dc.l $00036608,$61ff0000,$65766006,$61ff0000
- dc.l $4a5c4cee,$0303ff9c,$f22e9800,$ff60f22e
- dc.l $d040ffe8,$4e5e4e75,$4e56ff40,$48ee0303
- dc.l $ff9cf22e,$b800ff60,$f22ef0c0,$ffdcf23c
- dc.l $90000000,$000041ee,$ff6c216e,$00080000
- dc.l $216e000c,$0004216e,$00100008,$61ff0000
- dc.l $62001d40,$ff4e1200,$02ae00ff,$00ffff64
- dc.l $4280102e,$ff634a01,$660861ff,$00004886
- dc.l $60300c01,$00016608,$61ff0000,$66ae6022
- dc.l $0c010002,$660861ff,$00006716,$60140c01
- dc.l $00036608,$61ff0000,$64d66006,$61ff0000
- dc.l $49bc4cee,$0303ff9c,$f22e9800,$ff60f22e
- dc.l $d040ffe8,$4e5e4e75,$4e56ff40,$48ee0303
- dc.l $ff9cf22e,$b800ff60,$f22ef0c0,$ffdcf23c
- dc.l $90000000,$0000f22e,$44000008,$f22e6800
- dc.l $ff6c41ee,$ff6c61ff,$00006166,$1d40ff4e
- dc.l $120002ae,$00ff00ff,$ff644280,$102eff63
- dc.l $4a016608,$61ff0000,$391c6030,$0c010001
- dc.l $660861ff,$00006614,$60220c01,$00026608
- dc.l $61ff0000,$66b86014,$0c010003,$660861ff
- dc.l $0000643c,$600661ff,$00003b28,$4cee0303
- dc.l $ff9cf22e,$9800ff60,$f22ed040,$ffe84e5e
- dc.l $4e754e56,$ff4048ee,$0303ff9c,$f22eb800
- dc.l $ff60f22e,$f0c0ffdc,$f23c9000,$00000000
- dc.l $f22e5400,$0008f22e,$6800ff6c,$41eeff6c
- dc.l $61ff0000,$60cc1d40,$ff4e1200,$02ae00ff
- dc.l $00ffff64,$4280102e,$ff631d41,$ff4e4a01
- dc.l $660861ff,$0000387e,$60300c01,$00016608
- dc.l $61ff0000,$65766022,$0c010002,$660861ff
- dc.l $0000661a,$60140c01,$00036608,$61ff0000
- dc.l $639e6006,$61ff0000,$3a8a4cee,$0303ff9c
- dc.l $f22e9800,$ff60f22e,$d040ffe8,$4e5e4e75
- dc.l $4e56ff40,$48ee0303,$ff9cf22e,$b800ff60
- dc.l $f22ef0c0,$ffdcf23c,$90000000,$000041ee
- dc.l $ff6c216e,$00080000,$216e000c,$0004216e
- dc.l $00100008,$61ff0000,$60281d40,$ff4e1200
- dc.l $02ae00ff,$00ffff64,$4280102e,$ff634a01
- dc.l $660861ff,$000037de,$60300c01,$00016608
- dc.l $61ff0000,$64d66022,$0c010002,$660861ff
- dc.l $0000657a,$60140c01,$00036608,$61ff0000
- dc.l $62fe6006,$61ff0000,$39ea4cee,$0303ff9c
- dc.l $f22e9800,$ff60f22e,$d040ffe8,$4e5e4e75
- dc.l $4e56ff40,$48ee0303,$ff9cf22e,$b800ff60
- dc.l $f22ef0c0,$ffdcf23c,$90000000,$0000f22e
- dc.l $44000008,$f22e6800,$ff6c41ee,$ff6c61ff
- dc.l $00005f8e,$1d40ff4e,$120002ae,$00ff00ff
- dc.l $ff644280,$102eff63,$4a016608,$61ff0000
- dc.l $39886030,$0c010001,$660861ff,$0000643c
- dc.l $60220c01,$00026608,$61ff0000,$603a6014
- dc.l $0c010003,$660861ff,$00006264,$600661ff
- dc.l $00003a04,$4cee0303,$ff9cf22e,$9800ff60
- dc.l $f22ed040,$ffe84e5e,$4e754e56,$ff4048ee
- dc.l $0303ff9c,$f22eb800,$ff60f22e,$f0c0ffdc
- dc.l $f23c9000,$00000000,$f22e5400,$0008f22e
- dc.l $6800ff6c,$41eeff6c,$61ff0000,$5ef41d40
- dc.l $ff4e1200,$02ae00ff,$00ffff64,$4280102e
- dc.l $ff631d41,$ff4e4a01,$660861ff,$000038ea
- dc.l $60300c01,$00016608,$61ff0000,$639e6022
- dc.l $0c010002,$660861ff,$00005f9c,$60140c01
- dc.l $00036608,$61ff0000,$61c66006,$61ff0000
- dc.l $39664cee,$0303ff9c,$f22e9800,$ff60f22e
- dc.l $d040ffe8,$4e5e4e75,$4e56ff40,$48ee0303
- dc.l $ff9cf22e,$b800ff60,$f22ef0c0,$ffdcf23c
- dc.l $90000000,$000041ee,$ff6c216e,$00080000
- dc.l $216e000c,$0004216e,$00100008,$61ff0000
- dc.l $5e501d40,$ff4e1200,$02ae00ff,$00ffff64
- dc.l $4280102e,$ff634a01,$660861ff,$0000384a
- dc.l $60300c01,$00016608,$61ff0000,$62fe6022
- dc.l $0c010002,$660861ff,$00005efc,$60140c01
- dc.l $00036608,$61ff0000,$61266006,$61ff0000
- dc.l $38c64cee,$0303ff9c,$f22e9800,$ff60f22e
- dc.l $d040ffe8,$4e5e4e75,$4e56ff40,$48ee0303
- dc.l $ff9cf22e,$b800ff60,$f22ef0c0,$ffdcf23c
- dc.l $90000000,$0000f22e,$44000008,$f22e6800
- dc.l $ff6c41ee,$ff6c61ff,$00005db6,$1d40ff4e
- dc.l $120002ae,$00ff00ff,$ff644280,$102eff63
- dc.l $4a016608,$61ff0000,$51d46030,$0c010001
- dc.l $660861ff,$00006264,$60220c01,$00026608
- dc.l $61ff0000,$5e626014,$0c010003,$660861ff
- dc.l $0000608c,$600661ff,$00005224,$4cee0303
- dc.l $ff9cf22e,$9800ff60,$f22ed040,$ffe84e5e
- dc.l $4e754e56,$ff4048ee,$0303ff9c,$f22eb800
- dc.l $ff60f22e,$f0c0ffdc,$f23c9000,$00000000
- dc.l $f22e5400,$0008f22e,$6800ff6c,$41eeff6c
- dc.l $61ff0000,$5d1c1d40,$ff4e1200,$02ae00ff
- dc.l $00ffff64,$4280102e,$ff631d41,$ff4e4a01
- dc.l $660861ff,$00005136,$60300c01,$00016608
- dc.l $61ff0000,$61c66022,$0c010002,$660861ff
- dc.l $00005dc4,$60140c01,$00036608,$61ff0000
- dc.l $5fee6006,$61ff0000,$51864cee,$0303ff9c
- dc.l $f22e9800,$ff60f22e,$d040ffe8,$4e5e4e75
- dc.l $4e56ff40,$48ee0303,$ff9cf22e,$b800ff60
- dc.l $f22ef0c0,$ffdcf23c,$90000000,$000041ee
- dc.l $ff6c216e,$00080000,$216e000c,$0004216e
- dc.l $00100008,$61ff0000,$5c781d40,$ff4e1200
- dc.l $02ae00ff,$00ffff64,$4280102e,$ff634a01
- dc.l $660861ff,$00005096,$60300c01,$00016608
- dc.l $61ff0000,$61266022,$0c010002,$660861ff
- dc.l $00005d24,$60140c01,$00036608,$61ff0000
- dc.l $5f4e6006,$61ff0000,$50e64cee,$0303ff9c
- dc.l $f22e9800,$ff60f22e,$d040ffe8,$4e5e4e75
- dc.l $4e56ff40,$48ee0303,$ff9cf22e,$b800ff60
- dc.l $f22ef0c0,$ffdcf23c,$90000000,$0000f22e
- dc.l $44000008,$f22e6800,$ff6c41ee,$ff6c61ff
- dc.l $00005bde,$1d40ff4e,$120002ae,$00ff00ff
- dc.l $ff644280,$102eff63,$4a016608,$61ff0000
- dc.l $28066030,$0c010001,$660861ff,$0000608c
- dc.l $60220c01,$00026608,$61ff0000,$5c8a6014
- dc.l $0c010003,$660861ff,$00005eb4,$600661ff
- dc.l $00002938,$4cee0303,$ff9cf22e,$9800ff60
- dc.l $f22ed040,$ffe84e5e,$4e754e56,$ff4048ee
- dc.l $0303ff9c,$f22eb800,$ff60f22e,$f0c0ffdc
- dc.l $f23c9000,$00000000,$f22e5400,$0008f22e
- dc.l $6800ff6c,$41eeff6c,$61ff0000,$5b441d40
- dc.l $ff4e1200,$02ae00ff,$00ffff64,$4280102e
- dc.l $ff631d41,$ff4e4a01,$660861ff,$00002768
- dc.l $60300c01,$00016608,$61ff0000,$5fee6022
- dc.l $0c010002,$660861ff,$00005bec,$60140c01
- dc.l $00036608,$61ff0000,$5e166006,$61ff0000
- dc.l $289a4cee,$0303ff9c,$f22e9800,$ff60f22e
- dc.l $d040ffe8,$4e5e4e75,$4e56ff40,$48ee0303
- dc.l $ff9cf22e,$b800ff60,$f22ef0c0,$ffdcf23c
- dc.l $90000000,$000041ee,$ff6c216e,$00080000
- dc.l $216e000c,$0004216e,$00100008,$61ff0000
- dc.l $5aa01d40,$ff4e1200,$02ae00ff,$00ffff64
- dc.l $4280102e,$ff634a01,$660861ff,$000026c8
- dc.l $60300c01,$00016608,$61ff0000,$5f4e6022
- dc.l $0c010002,$660861ff,$00005b4c,$60140c01
- dc.l $00036608,$61ff0000,$5d766006,$61ff0000
- dc.l $27fa4cee,$0303ff9c,$f22e9800,$ff60f22e
- dc.l $d040ffe8,$4e5e4e75,$4e56ff40,$48ee0303
- dc.l $ff9cf22e,$b800ff60,$f22ef0c0,$ffdcf23c
- dc.l $90000000,$0000f22e,$44000008,$f22e6800
- dc.l $ff6c41ee,$ff6c61ff,$00005a06,$1d40ff4e
- dc.l $120002ae,$00ff00ff,$ff644280,$102eff63
- dc.l $4a016608,$61ff0000,$39e46030,$0c010001
- dc.l $660861ff,$00005f30,$60220c01,$00026608
- dc.l $61ff0000,$5f026014,$0c010003,$660861ff
- dc.l $00005cdc,$600661ff,$00003b5e,$4cee0303
- dc.l $ff9cf22e,$9800ff60,$f22ed040,$ffe84e5e
- dc.l $4e754e56,$ff4048ee,$0303ff9c,$f22eb800
- dc.l $ff60f22e,$f0c0ffdc,$f23c9000,$00000000
- dc.l $f22e5400,$0008f22e,$6800ff6c,$41eeff6c
- dc.l $61ff0000,$596c1d40,$ff4e1200,$02ae00ff
- dc.l $00ffff64,$4280102e,$ff631d41,$ff4e4a01
- dc.l $660861ff,$00003946,$60300c01,$00016608
- dc.l $61ff0000,$5e926022,$0c010002,$660861ff
- dc.l $00005e64,$60140c01,$00036608,$61ff0000
- dc.l $5c3e6006,$61ff0000,$3ac04cee,$0303ff9c
- dc.l $f22e9800,$ff60f22e,$d040ffe8,$4e5e4e75
- dc.l $4e56ff40,$48ee0303,$ff9cf22e,$b800ff60
- dc.l $f22ef0c0,$ffdcf23c,$90000000,$000041ee
- dc.l $ff6c216e,$00080000,$216e000c,$0004216e
- dc.l $00100008,$61ff0000,$58c81d40,$ff4e1200
- dc.l $02ae00ff,$00ffff64,$4280102e,$ff634a01
- dc.l $660861ff,$000038a6,$60300c01,$00016608
- dc.l $61ff0000,$5df26022,$0c010002,$660861ff
- dc.l $00005dc4,$60140c01,$00036608,$61ff0000
- dc.l $5b9e6006,$61ff0000,$3a204cee,$0303ff9c
- dc.l $f22e9800,$ff60f22e,$d040ffe8,$4e5e4e75
- dc.l $4e56ff40,$48ee0303,$ff9cf22e,$b800ff60
- dc.l $f22ef0c0,$ffdcf23c,$90000000,$0000f22e
- dc.l $44000008,$f22e6800,$ff6c41ee,$ff6c61ff
- dc.l $0000582e,$1d40ff4e,$120002ae,$00ff00ff
- dc.l $ff644280,$102eff63,$4a016608,$61ff0000
- dc.l $522e6030,$0c010001,$660861ff,$00005d58
- dc.l $60220c01,$00026608,$61ff0000,$5d2a6014
- dc.l $0c010003,$660861ff,$00005b04,$600661ff
- dc.l $000052d6,$4cee0303,$ff9cf22e,$9800ff60
- dc.l $f22ed040,$ffe84e5e,$4e754e56,$ff4048ee
- dc.l $0303ff9c,$f22eb800,$ff60f22e,$f0c0ffdc
- dc.l $f23c9000,$00000000,$f22e5400,$0008f22e
- dc.l $6800ff6c,$41eeff6c,$61ff0000,$57941d40
- dc.l $ff4e1200,$02ae00ff,$00ffff64,$4280102e
- dc.l $ff631d41,$ff4e4a01,$660861ff,$00005190
- dc.l $60300c01,$00016608,$61ff0000,$5cba6022
- dc.l $0c010002,$660861ff,$00005c8c,$60140c01
- dc.l $00036608,$61ff0000,$5a666006,$61ff0000
- dc.l $52384cee,$0303ff9c,$f22e9800,$ff60f22e
- dc.l $d040ffe8,$4e5e4e75,$4e56ff40,$48ee0303
- dc.l $ff9cf22e,$b800ff60,$f22ef0c0,$ffdcf23c
- dc.l $90000000,$000041ee,$ff6c216e,$00080000
- dc.l $216e000c,$0004216e,$00100008,$61ff0000
- dc.l $56f01d40,$ff4e1200,$02ae00ff,$00ffff64
- dc.l $4280102e,$ff634a01,$660861ff,$000050f0
- dc.l $60300c01,$00016608,$61ff0000,$5c1a6022
- dc.l $0c010002,$660861ff,$00005bec,$60140c01
- dc.l $00036608,$61ff0000,$59c66006,$61ff0000
- dc.l $51984cee,$0303ff9c,$f22e9800,$ff60f22e
- dc.l $d040ffe8,$4e5e4e75,$4e56ff40,$48ee0303
- dc.l $ff9cf22e,$b800ff60,$f22ef0c0,$ffdcf23c
- dc.l $90000000,$0000f22e,$44000008,$f22e6800
- dc.l $ff6c41ee,$ff6c61ff,$00005656,$1d40ff4e
- dc.l $120002ae,$00ff00ff,$ff644280,$102eff63
- dc.l $4a016608,$61ff0000,$514e6030,$0c010001
- dc.l $660861ff,$00005b80,$60220c01,$00026608
- dc.l $61ff0000,$5b526014,$0c010003,$660861ff
- dc.l $0000592c,$600661ff,$0000524c,$4cee0303
- dc.l $ff9cf22e,$9800ff60,$f22ed040,$ffe84e5e
- dc.l $4e754e56,$ff4048ee,$0303ff9c,$f22eb800
- dc.l $ff60f22e,$f0c0ffdc,$f23c9000,$00000000
- dc.l $f22e5400,$0008f22e,$6800ff6c,$41eeff6c
- dc.l $61ff0000,$55bc1d40,$ff4e1200,$02ae00ff
- dc.l $00ffff64,$4280102e,$ff631d41,$ff4e4a01
- dc.l $660861ff,$000050b0,$60300c01,$00016608
- dc.l $61ff0000,$5ae26022,$0c010002,$660861ff
- dc.l $00005ab4,$60140c01,$00036608,$61ff0000
- dc.l $588e6006,$61ff0000,$51ae4cee,$0303ff9c
- dc.l $f22e9800,$ff60f22e,$d040ffe8,$4e5e4e75
- dc.l $4e56ff40,$48ee0303,$ff9cf22e,$b800ff60
- dc.l $f22ef0c0,$ffdcf23c,$90000000,$000041ee
- dc.l $ff6c216e,$00080000,$216e000c,$0004216e
- dc.l $00100008,$61ff0000,$55181d40,$ff4e1200
- dc.l $02ae00ff,$00ffff64,$4280102e,$ff634a01
- dc.l $660861ff,$00005010,$60300c01,$00016608
- dc.l $61ff0000,$5a426022,$0c010002,$660861ff
- dc.l $00005a14,$60140c01,$00036608,$61ff0000
- dc.l $57ee6006,$61ff0000,$510e4cee,$0303ff9c
- dc.l $f22e9800,$ff60f22e,$d040ffe8,$4e5e4e75
- dc.l $4e56ff40,$48ee0303,$ff9cf22e,$b800ff60
- dc.l $f22ef0c0,$ffdcf23c,$90000000,$0000f22e
- dc.l $44000008,$f22e6800,$ff6c41ee,$ff6c61ff
- dc.l $0000547e,$1d40ff4e,$120002ae,$00ff00ff
- dc.l $ff644280,$102eff63,$4a016608,$61ff0000
- dc.l $45026030,$0c010001,$660861ff,$000054c8
- dc.l $60220c01,$00026608,$61ff0000,$59826014
- dc.l $0c010003,$660861ff,$00005754,$600661ff
- dc.l $00004682,$4cee0303,$ff9cf22e,$9800ff60
- dc.l $f22ed040,$ffe84e5e,$4e754e56,$ff4048ee
- dc.l $0303ff9c,$f22eb800,$ff60f22e,$f0c0ffdc
- dc.l $f23c9000,$00000000,$f22e5400,$0008f22e
- dc.l $6800ff6c,$41eeff6c,$61ff0000,$53e41d40
- dc.l $ff4e1200,$02ae00ff,$00ffff64,$4280102e
- dc.l $ff631d41,$ff4e4a01,$660861ff,$00004464
- dc.l $60300c01,$00016608,$61ff0000,$542a6022
- dc.l $0c010002,$660861ff,$000058e4,$60140c01
- dc.l $00036608,$61ff0000,$56b66006,$61ff0000
- dc.l $45e44cee,$0303ff9c,$f22e9800,$ff60f22e
- dc.l $d040ffe8,$4e5e4e75,$4e56ff40,$48ee0303
- dc.l $ff9cf22e,$b800ff60,$f22ef0c0,$ffdcf23c
- dc.l $90000000,$000041ee,$ff6c216e,$00080000
- dc.l $216e000c,$0004216e,$00100008,$61ff0000
- dc.l $53401d40,$ff4e1200,$02ae00ff,$00ffff64
- dc.l $4280102e,$ff634a01,$660861ff,$000043c4
- dc.l $60300c01,$00016608,$61ff0000,$538a6022
- dc.l $0c010002,$660861ff,$00005844,$60140c01
- dc.l $00036608,$61ff0000,$56166006,$61ff0000
- dc.l $45444cee,$0303ff9c,$f22e9800,$ff60f22e
- dc.l $d040ffe8,$4e5e4e75,$4e56ff40,$48ee0303
- dc.l $ff9cf22e,$b800ff60,$f22ef0c0,$ffdcf23c
- dc.l $90000000,$0000f22e,$44000008,$f22e6800
- dc.l $ff6c41ee,$ff6c61ff,$000052a6,$1d40ff4e
- dc.l $120002ae,$00ff00ff,$ff644280,$102eff63
- dc.l $4a016608,$61ff0000,$476c6030,$0c010001
- dc.l $660861ff,$000052f0,$60220c01,$00026608
- dc.l $61ff0000,$57aa6014,$0c010003,$660861ff
- dc.l $0000557c,$600661ff,$0000476a,$4cee0303
- dc.l $ff9cf22e,$9800ff60,$f22ed040,$ffe84e5e
- dc.l $4e754e56,$ff4048ee,$0303ff9c,$f22eb800
- dc.l $ff60f22e,$f0c0ffdc,$f23c9000,$00000000
- dc.l $f22e5400,$0008f22e,$6800ff6c,$41eeff6c
- dc.l $61ff0000,$520c1d40,$ff4e1200,$02ae00ff
- dc.l $00ffff64,$4280102e,$ff631d41,$ff4e4a01
- dc.l $660861ff,$000046ce,$60300c01,$00016608
- dc.l $61ff0000,$52526022,$0c010002,$660861ff
- dc.l $0000570c,$60140c01,$00036608,$61ff0000
- dc.l $54de6006,$61ff0000,$46cc4cee,$0303ff9c
- dc.l $f22e9800,$ff60f22e,$d040ffe8,$4e5e4e75
- dc.l $4e56ff40,$48ee0303,$ff9cf22e,$b800ff60
- dc.l $f22ef0c0,$ffdcf23c,$90000000,$000041ee
- dc.l $ff6c216e,$00080000,$216e000c,$0004216e
- dc.l $00100008,$61ff0000,$51681d40,$ff4e1200
- dc.l $02ae00ff,$00ffff64,$4280102e,$ff634a01
- dc.l $660861ff,$0000462e,$60300c01,$00016608
- dc.l $61ff0000,$51b26022,$0c010002,$660861ff
- dc.l $0000566c,$60140c01,$00036608,$61ff0000
- dc.l $543e6006,$61ff0000,$462c4cee,$0303ff9c
- dc.l $f22e9800,$ff60f22e,$d040ffe8,$4e5e4e75
- dc.l $4e56ff40,$48ee0303,$ff9cf22e,$b800ff60
- dc.l $f22ef0c0,$ffdcf23c,$90000000,$0000f22e
- dc.l $44000008,$f22e6800,$ff6c41ee,$ff6c61ff
- dc.l $000050ce,$1d40ff4e,$120002ae,$00ff00ff
- dc.l $ff644280,$102eff63,$4a016608,$61ff0000
- dc.l $45e46030,$0c010001,$660861ff,$00005118
- dc.l $60220c01,$00026608,$61ff0000,$55d26014
- dc.l $0c010003,$660861ff,$000053a4,$600661ff
- dc.l $0000460c,$4cee0303,$ff9cf22e,$9800ff60
- dc.l $f22ed040,$ffe84e5e,$4e754e56,$ff4048ee
- dc.l $0303ff9c,$f22eb800,$ff60f22e,$f0c0ffdc
- dc.l $f23c9000,$00000000,$f22e5400,$0008f22e
- dc.l $6800ff6c,$41eeff6c,$61ff0000,$50341d40
- dc.l $ff4e1200,$02ae00ff,$00ffff64,$4280102e
- dc.l $ff631d41,$ff4e4a01,$660861ff,$00004546
- dc.l $60300c01,$00016608,$61ff0000,$507a6022
- dc.l $0c010002,$660861ff,$00005534,$60140c01
- dc.l $00036608,$61ff0000,$53066006,$61ff0000
- dc.l $456e4cee,$0303ff9c,$f22e9800,$ff60f22e
- dc.l $d040ffe8,$4e5e4e75,$4e56ff40,$48ee0303
- dc.l $ff9cf22e,$b800ff60,$f22ef0c0,$ffdcf23c
- dc.l $90000000,$000041ee,$ff6c216e,$00080000
- dc.l $216e000c,$0004216e,$00100008,$61ff0000
- dc.l $4f901d40,$ff4e1200,$02ae00ff,$00ffff64
- dc.l $4280102e,$ff634a01,$660861ff,$000044a6
- dc.l $60300c01,$00016608,$61ff0000,$4fda6022
- dc.l $0c010002,$660861ff,$00005494,$60140c01
- dc.l $00036608,$61ff0000,$52666006,$61ff0000
- dc.l $44ce4cee,$0303ff9c,$f22e9800,$ff60f22e
- dc.l $d040ffe8,$4e5e4e75,$4e56ff40,$48ee0303
- dc.l $ff9cf22e,$b800ff60,$f22ef0c0,$ffdcf23c
- dc.l $90000000,$0000f22e,$44000008,$f22e6800
- dc.l $ff6c41ee,$ff6c61ff,$00004ef6,$1d40ff4e
- dc.l $120002ae,$00ff00ff,$ff644280,$102eff63
- dc.l $4a016608,$61ff0000,$33da6030,$0c010001
- dc.l $660861ff,$00005420,$60220c01,$00026608
- dc.l $61ff0000,$53ca6014,$0c010003,$660861ff
- dc.l $000051cc,$600661ff,$0000344c,$4cee0303
- dc.l $ff9cf22e,$9800ff60,$f22ed040,$ffe84e5e
- dc.l $4e754e56,$ff4048ee,$0303ff9c,$f22eb800
- dc.l $ff60f22e,$f0c0ffdc,$f23c9000,$00000000
- dc.l $f22e5400,$0008f22e,$6800ff6c,$41eeff6c
- dc.l $61ff0000,$4e5c1d40,$ff4e1200,$02ae00ff
- dc.l $00ffff64,$4280102e,$ff631d41,$ff4e4a01
- dc.l $660861ff,$0000333c,$60300c01,$00016608
- dc.l $61ff0000,$53826022,$0c010002,$660861ff
- dc.l $0000532c,$60140c01,$00036608,$61ff0000
- dc.l $512e6006,$61ff0000,$33ae4cee,$0303ff9c
- dc.l $f22e9800,$ff60f22e,$d040ffe8,$4e5e4e75
- dc.l $4e56ff40,$48ee0303,$ff9cf22e,$b800ff60
- dc.l $f22ef0c0,$ffdcf23c,$90000000,$000041ee
- dc.l $ff6c216e,$00080000,$216e000c,$0004216e
- dc.l $00100008,$61ff0000,$4db81d40,$ff4e1200
- dc.l $02ae00ff,$00ffff64,$4280102e,$ff634a01
- dc.l $660861ff,$0000329c,$60300c01,$00016608
- dc.l $61ff0000,$52e26022,$0c010002,$660861ff
- dc.l $0000528c,$60140c01,$00036608,$61ff0000
- dc.l $508e6006,$61ff0000,$330e4cee,$0303ff9c
- dc.l $f22e9800,$ff60f22e,$d040ffe8,$4e5e4e75
- dc.l $4e56ff40,$48ee0303,$ff9cf22e,$b800ff60
- dc.l $f22ef0c0,$ffdcf23c,$90000000,$0000f22e
- dc.l $44000008,$f22e6800,$ff6c41ee,$ff6c61ff
- dc.l $00004d1e,$1d40ff4e,$120002ae,$00ff00ff
- dc.l $ff644280,$102eff63,$4a016608,$61ff0000
- dc.l $27cc6030,$0c010001,$660861ff,$00005284
- dc.l $60220c01,$00026608,$61ff0000,$4dca6014
- dc.l $0c010003,$660861ff,$00004ff4,$600661ff
- dc.l $0000282a,$4cee0303,$ff9cf22e,$9800ff60
- dc.l $f22ed040,$ffe84e5e,$4e754e56,$ff4048ee
- dc.l $0303ff9c,$f22eb800,$ff60f22e,$f0c0ffdc
- dc.l $f23c9000,$00000000,$f22e5400,$0008f22e
- dc.l $6800ff6c,$41eeff6c,$61ff0000,$4c841d40
- dc.l $ff4e1200,$02ae00ff,$00ffff64,$4280102e
- dc.l $ff631d41,$ff4e4a01,$660861ff,$0000272e
- dc.l $60300c01,$00016608,$61ff0000,$51e66022
- dc.l $0c010002,$660861ff,$00004d2c,$60140c01
- dc.l $00036608,$61ff0000,$4f566006,$61ff0000
- dc.l $278c4cee,$0303ff9c,$f22e9800,$ff60f22e
- dc.l $d040ffe8,$4e5e4e75,$4e56ff40,$48ee0303
- dc.l $ff9cf22e,$b800ff60,$f22ef0c0,$ffdcf23c
- dc.l $90000000,$000041ee,$ff6c216e,$00080000
- dc.l $216e000c,$0004216e,$00100008,$61ff0000
- dc.l $4be01d40,$ff4e1200,$02ae00ff,$00ffff64
- dc.l $4280102e,$ff634a01,$660861ff,$0000268e
- dc.l $60300c01,$00016608,$61ff0000,$51466022
- dc.l $0c010002,$660861ff,$00004c8c,$60140c01
- dc.l $00036608,$61ff0000,$4eb66006,$61ff0000
- dc.l $26ec4cee,$0303ff9c,$f22e9800,$ff60f22e
- dc.l $d040ffe8,$4e5e4e75,$4e56ff40,$48ee0303
- dc.l $ff9cf22e,$b800ff60,$f22ef0c0,$ffdcf23c
- dc.l $90000000,$0000f22e,$44000008,$f22e6800
- dc.l $ff6c41ee,$ff6c61ff,$00004b46,$1d40ff4e
- dc.l $120002ae,$00ff00ff,$ff644280,$102eff63
- dc.l $4a016608,$61ff0000,$2fb06030,$0c010001
- dc.l $660861ff,$00004ff4,$60220c01,$00026608
- dc.l $61ff0000,$4bf26014,$0c010003,$660861ff
- dc.l $00004e1c,$600661ff,$00002f9a,$4cee0303
- dc.l $ff9cf22e,$9800ff60,$f22ed040,$ffe84e5e
- dc.l $4e754e56,$ff4048ee,$0303ff9c,$f22eb800
- dc.l $ff60f22e,$f0c0ffdc,$f23c9000,$00000000
- dc.l $f22e5400,$0008f22e,$6800ff6c,$41eeff6c
- dc.l $61ff0000,$4aac1d40,$ff4e1200,$02ae00ff
- dc.l $00ffff64,$4280102e,$ff631d41,$ff4e4a01
- dc.l $660861ff,$00002f12,$60300c01,$00016608
- dc.l $61ff0000,$4f566022,$0c010002,$660861ff
- dc.l $00004b54,$60140c01,$00036608,$61ff0000
- dc.l $4d7e6006,$61ff0000,$2efc4cee,$0303ff9c
- dc.l $f22e9800,$ff60f22e,$d040ffe8,$4e5e4e75
- dc.l $4e56ff40,$48ee0303,$ff9cf22e,$b800ff60
- dc.l $f22ef0c0,$ffdcf23c,$90000000,$000041ee
- dc.l $ff6c216e,$00080000,$216e000c,$0004216e
- dc.l $00100008,$61ff0000,$4a081d40,$ff4e1200
- dc.l $02ae00ff,$00ffff64,$4280102e,$ff634a01
- dc.l $660861ff,$00002e72,$60300c01,$00016608
- dc.l $61ff0000,$4eb66022,$0c010002,$660861ff
- dc.l $00004ab4,$60140c01,$00036608,$61ff0000
- dc.l $4cde6006,$61ff0000,$2e5c4cee,$0303ff9c
- dc.l $f22e9800,$ff60f22e,$d040ffe8,$4e5e4e75
- dc.l $4e56ff40,$48ee0303,$ff9cf22e,$b800ff60
- dc.l $f22ef0c0,$ffdcf23c,$90000000,$0000f22e
- dc.l $44000008,$f22e6800,$ff6c41ee,$ff6c61ff
- dc.l $0000496e,$1d40ff4e,$120002ae,$00ff00ff
- dc.l $ff644280,$102eff63,$4a016608,$61ff0000
- dc.l $2e0c6030,$0c010001,$660861ff,$00004e1c
- dc.l $60220c01,$00026608,$61ff0000,$4a1a6014
- dc.l $0c010003,$660861ff,$00004c44,$600661ff
- dc.l $00002e08,$4cee0303,$ff9cf22e,$9800ff60
- dc.l $f22ed040,$ffe84e5e,$4e754e56,$ff4048ee
- dc.l $0303ff9c,$f22eb800,$ff60f22e,$f0c0ffdc
- dc.l $f23c9000,$00000000,$f22e5400,$0008f22e
- dc.l $6800ff6c,$41eeff6c,$61ff0000,$48d41d40
- dc.l $ff4e1200,$02ae00ff,$00ffff64,$4280102e
- dc.l $ff631d41,$ff4e4a01,$660861ff,$00002d6e
- dc.l $60300c01,$00016608,$61ff0000,$4d7e6022
- dc.l $0c010002,$660861ff,$0000497c,$60140c01
- dc.l $00036608,$61ff0000,$4ba66006,$61ff0000
- dc.l $2d6a4cee,$0303ff9c,$f22e9800,$ff60f22e
- dc.l $d040ffe8,$4e5e4e75,$4e56ff40,$48ee0303
- dc.l $ff9cf22e,$b800ff60,$f22ef0c0,$ffdcf23c
- dc.l $90000000,$000041ee,$ff6c216e,$00080000
- dc.l $216e000c,$0004216e,$00100008,$61ff0000
- dc.l $48301d40,$ff4e1200,$02ae00ff,$00ffff64
- dc.l $4280102e,$ff634a01,$660861ff,$00002cce
- dc.l $60300c01,$00016608,$61ff0000,$4cde6022
- dc.l $0c010002,$660861ff,$000048dc,$60140c01
- dc.l $00036608,$61ff0000,$4b066006,$61ff0000
- dc.l $2cca4cee,$0303ff9c,$f22e9800,$ff60f22e
- dc.l $d040ffe8,$4e5e4e75,$4e56ff40,$48ee0303
- dc.l $ff9cf22e,$b800ff60,$f22ef0c0,$ffdcf23c
- dc.l $90000000,$0000f22e,$44000008,$f22e6800
- dc.l $ff6c41ee,$ff6c61ff,$00004796,$1d40ff4e
- dc.l $120002ae,$00ff00ff,$ff644280,$102eff63
- dc.l $4a016608,$61ff0000,$0af46030,$0c010001
- dc.l $660861ff,$00004d18,$60220c01,$00026608
- dc.l $61ff0000,$4d386014,$0c010003,$660861ff
- dc.l $00004d34,$600661ff,$00000d58,$4cee0303
- dc.l $ff9cf22e,$9800ff60,$f227e003,$f21fd040
- dc.l $f21fd080,$4e5e4e75,$4e56ff40,$48ee0303
- dc.l $ff9cf22e,$b800ff60,$f22ef0c0,$ffdcf23c
- dc.l $90000000,$0000f22e,$54000008,$f22e6800
- dc.l $ff6c41ee,$ff6c61ff,$000046f6,$1d40ff4e
- dc.l $120002ae,$00ff00ff,$ff644280,$102eff63
- dc.l $1d41ff4e,$4a016608,$61ff0000,$0a506030
- dc.l $0c010001,$660861ff,$00004c74,$60220c01
- dc.l $00026608,$61ff0000,$4c946014,$0c010003
- dc.l $660861ff,$00004c90,$600661ff,$00000cb4
- dc.l $4cee0303,$ff9cf22e,$9800ff60,$f227e003
- dc.l $f21fd040,$f21fd080,$4e5e4e75,$4e56ff40
- dc.l $48ee0303,$ff9cf22e,$b800ff60,$f22ef0c0
- dc.l $ffdcf23c,$90000000,$000041ee,$ff6c216e
- dc.l $00080000,$216e000c,$0004216e,$00100008
- dc.l $61ff0000,$464c1d40,$ff4e1200,$02ae00ff
- dc.l $00ffff64,$4280102e,$ff634a01,$660861ff
- dc.l $000009aa,$60300c01,$00016608,$61ff0000
- dc.l $4bce6022,$0c010002,$660861ff,$00004bee
- dc.l $60140c01,$00036608,$61ff0000,$4bea6006
- dc.l $61ff0000,$0c0e4cee,$0303ff9c,$f22e9800
- dc.l $ff60f227,$e003f21f,$d040f21f,$d0804e5e
- dc.l $4e754e56,$ff4048ee,$0303ff9c,$f22eb800
- dc.l $ff60f22e,$f0c0ffdc,$f23c9000,$00000000
- dc.l $f22e4400,$0008f22e,$6800ff78,$41eeff78
- dc.l $61ff0000,$45ac1d40,$ff4ff22e,$4400000c
- dc.l $f22e6800,$ff6c41ee,$ff6c61ff,$00004592
- dc.l $1d40ff4e,$220002ae,$00ff00ff,$ff644280
- dc.l $102eff63,$41eeff6c,$43eeff78,$4a016608
- dc.l $61ff0000,$4c466030,$0c010001,$660861ff
- dc.l $00004c64,$60220c01,$00026608,$61ff0000
- dc.l $4c846014,$0c010003,$660861ff,$00004d16
- dc.l $600661ff,$00004c14,$4cee0303,$ff9cf22e
- dc.l $9800ff60,$f22ed040,$ffe84e5e,$4e754e56
- dc.l $ff4048ee,$0303ff9c,$f22eb800,$ff60f22e
- dc.l $f0c0ffdc,$f23c9000,$00000000,$f22e5400
- dc.l $0008f22e,$6800ff78,$41eeff78,$61ff0000
- dc.l $44f01d40,$ff4ff22e,$54000010,$f22e6800
- dc.l $ff6c41ee,$ff6c61ff,$000044d6,$1d40ff4e
- dc.l $220002ae,$00ff00ff,$ff644280,$102eff63
- dc.l $41eeff6c,$43eeff78,$4a016608,$61ff0000
- dc.l $4b8a6030,$0c010001,$660861ff,$00004ba8
- dc.l $60220c01,$00026608,$61ff0000,$4bc86014
- dc.l $0c010003,$660861ff,$00004c5a,$600661ff
- dc.l $00004b58,$4cee0303,$ff9cf22e,$9800ff60
- dc.l $f22ed040,$ffe84e5e,$4e754e56,$ff4048ee
- dc.l $0303ff9c,$f22eb800,$ff60f22e,$f0c0ffdc
- dc.l $f23c9000,$00000000,$41eeff78,$216e0008
- dc.l $0000216e,$000c0004,$216e0010,$000861ff
- dc.l $0000442e,$1d40ff4f,$41eeff6c,$216e0014
- dc.l $0000216e,$00180004,$216e001c,$000861ff
- dc.l $0000440e,$1d40ff4e,$220002ae,$00ff00ff
- dc.l $ff644280,$102eff63,$41eeff6c,$43eeff78
- dc.l $4a016608,$61ff0000,$4ac26030,$0c010001
- dc.l $660861ff,$00004ae0,$60220c01,$00026608
- dc.l $61ff0000,$4b006014,$0c010003,$660861ff
- dc.l $00004b92,$600661ff,$00004a90,$4cee0303
- dc.l $ff9cf22e,$9800ff60,$f22ed040,$ffe84e5e
- dc.l $4e754e56,$ff4048ee,$0303ff9c,$f22eb800
- dc.l $ff60f22e,$f0c0ffdc,$f23c9000,$00000000
- dc.l $f22e4400,$0008f22e,$6800ff78,$41eeff78
- dc.l $61ff0000,$436c1d40,$ff4ff22e,$4400000c
- dc.l $f22e6800,$ff6c41ee,$ff6c61ff,$00004352
- dc.l $1d40ff4e,$220002ae,$00ff00ff,$ff644280
- dc.l $102eff63,$41eeff6c,$43eeff78,$4a016608
- dc.l $61ff0000,$491c6030,$0c010001,$660861ff
- dc.l $0000493a,$60220c01,$00026608,$61ff0000
- dc.l $495a6014,$0c010003,$660861ff,$00004ad6
- dc.l $600661ff,$000048ea,$4cee0303,$ff9cf22e
- dc.l $9800ff60,$f22ed040,$ffe84e5e,$4e754e56
- dc.l $ff4048ee,$0303ff9c,$f22eb800,$ff60f22e
- dc.l $f0c0ffdc,$f23c9000,$00000000,$f22e5400
- dc.l $0008f22e,$6800ff78,$41eeff78,$61ff0000
- dc.l $42b01d40,$ff4ff22e,$54000010,$f22e6800
- dc.l $ff6c41ee,$ff6c61ff,$00004296,$1d40ff4e
- dc.l $220002ae,$00ff00ff,$ff644280,$102eff63
- dc.l $41eeff6c,$43eeff78,$4a016608,$61ff0000
- dc.l $48606030,$0c010001,$660861ff,$0000487e
- dc.l $60220c01,$00026608,$61ff0000,$489e6014
- dc.l $0c010003,$660861ff,$00004a1a,$600661ff
- dc.l $0000482e,$4cee0303,$ff9cf22e,$9800ff60
- dc.l $f22ed040,$ffe84e5e,$4e754e56,$ff4048ee
- dc.l $0303ff9c,$f22eb800,$ff60f22e,$f0c0ffdc
- dc.l $f23c9000,$00000000,$41eeff78,$216e0008
- dc.l $0000216e,$000c0004,$216e0010,$000861ff
- dc.l $000041ee,$1d40ff4f,$41eeff6c,$216e0014
- dc.l $0000216e,$00180004,$216e001c,$000861ff
- dc.l $000041ce,$1d40ff4e,$220002ae,$00ff00ff
- dc.l $ff644280,$102eff63,$41eeff6c,$43eeff78
- dc.l $4a016608,$61ff0000,$47986030,$0c010001
- dc.l $660861ff,$000047b6,$60220c01,$00026608
- dc.l $61ff0000,$47d66014,$0c010003,$660861ff
- dc.l $00004952,$600661ff,$00004766,$4cee0303
- dc.l $ff9cf22e,$9800ff60,$f22ed040,$ffe84e5e
- dc.l $4e754e56,$ff4048ee,$0303ff9c,$f22eb800
- dc.l $ff60f22e,$f0c0ffdc,$f23c9000,$00000000
- dc.l $f22e4400,$0008f22e,$6800ff78,$41eeff78
- dc.l $61ff0000,$412c1d40,$ff4ff22e,$4400000c
- dc.l $f22e6800,$ff6c41ee,$ff6c61ff,$00004112
- dc.l $1d40ff4e,$220002ae,$00ff00ff,$ff644280
- dc.l $102eff63,$41eeff6c,$43eeff78,$4a016608
- dc.l $61ff0000,$484a6030,$0c010001,$660861ff
- dc.l $0000486a,$60220c01,$00026608,$61ff0000
- dc.l $488a6014,$0c010003,$660861ff,$00004896
- dc.l $600661ff,$00004818,$4cee0303,$ff9cf22e
- dc.l $9800ff60,$f22ed040,$ffe84e5e,$4e754e56
- dc.l $ff4048ee,$0303ff9c,$f22eb800,$ff60f22e
- dc.l $f0c0ffdc,$f23c9000,$00000000,$f22e5400
- dc.l $0008f22e,$6800ff78,$41eeff78,$61ff0000
- dc.l $40701d40,$ff4ff22e,$54000010,$f22e6800
- dc.l $ff6c41ee,$ff6c61ff,$00004056,$1d40ff4e
- dc.l $220002ae,$00ff00ff,$ff644280,$102eff63
- dc.l $41eeff6c,$43eeff78,$4a016608,$61ff0000
- dc.l $478e6030,$0c010001,$660861ff,$000047ae
- dc.l $60220c01,$00026608,$61ff0000,$47ce6014
- dc.l $0c010003,$660861ff,$000047da,$600661ff
- dc.l $0000475c,$4cee0303,$ff9cf22e,$9800ff60
- dc.l $f22ed040,$ffe84e5e,$4e754e56,$ff4048ee
- dc.l $0303ff9c,$f22eb800,$ff60f22e,$f0c0ffdc
- dc.l $f23c9000,$00000000,$41eeff78,$216e0008
- dc.l $0000216e,$000c0004,$216e0010,$000861ff
- dc.l $00003fae,$1d40ff4f,$41eeff6c,$216e0014
- dc.l $0000216e,$00180004,$216e001c,$000861ff
- dc.l $00003f8e,$1d40ff4e,$220002ae,$00ff00ff
- dc.l $ff644280,$102eff63,$41eeff6c,$43eeff78
- dc.l $4a016608,$61ff0000,$46c66030,$0c010001
- dc.l $660861ff,$000046e6,$60220c01,$00026608
- dc.l $61ff0000,$47066014,$0c010003,$660861ff
- dc.l $00004712,$600661ff,$00004694,$4cee0303
- dc.l $ff9cf22e,$9800ff60,$f22ed040,$ffe84e5e
- dc.l $4e75bd6a,$aa77ccc9,$94f53de6,$12097aae
- dc.l $8da1be5a,$e6452a11,$8ae43ec7,$1de3a534
- dc.l $1531bf2a,$01a01a01,$8b590000,$00000000
- dc.l $00003ff8,$00008888,$88888888,$59af0000
- dc.l $0000bffc,$0000aaaa,$aaaaaaaa,$aa990000
- dc.l $00003d2a,$c4d0d601,$1ee3bda9,$396f9f45
- dc.l $ac193e21,$eed90612,$c972be92,$7e4fb79d
- dc.l $9fcf3efa,$01a01a01,$d4230000,$00000000
- dc.l $0000bff5,$0000b60b,$60b60b61,$d4380000
- dc.l $00003ffa,$0000aaaa,$aaaaaaaa,$ab5ebf00
- dc.l $00002d7c,$00000000,$ff5c6008,$2d7c0000
- dc.l $0001ff5c,$f2104800,$f22e6800,$ff842210
- dc.l $32280004,$02817fff,$ffff0c81,$3fd78000
- dc.l $6c046000,$01780c81,$4004bc7e,$6d046000
- dc.l $0468f200,$0080f23a,$54a3d186,$43fb0170
- dc.l $00000866,$f22e6080,$ff58222e,$ff58e981
- dc.l $d3c1f219,$4828f211,$4428222e,$ff58d2ae
- dc.l $ff5ce299,$0c810000,$00006d00,$0088f227
- dc.l $e00cf22e,$6800ff84,$f2000023,$f23a5580
- dc.l $fed2f23a,$5500fed4,$f2000080,$f20004a3
- dc.l $e2990281,$80000000,$b3aeff84,$f20005a3
- dc.l $f2000523,$f23a55a2,$febaf23a,$5522febc
- dc.l $f20005a3,$f2000523,$f23a55a2,$feb6f23a
- dc.l $4922fec0,$f2000ca3,$f2000123,$f23a48a2
- dc.l $fec2f22e,$4823ff84,$f20008a2,$f2000423
- dc.l $f21fd030,$f2009000,$f22e4822,$ff8460ff
- dc.l $00004006,$f227e00c,$f2000023,$f23a5500
- dc.l $fea2f23a,$5580fea4,$f2000080,$f20004a3
- dc.l $f22e6800,$ff84e299,$02818000,$0000f200
- dc.l $0523b3ae,$ff840281,$80000000,$f20005a3
- dc.l $00813f80,$00002d41,$ff54f23a,$5522fe74
- dc.l $f23a55a2,$fe76f200,$0523f200,$05a3f23a
- dc.l $5522fe70,$f23a49a2,$fe7af200,$0523f200
- dc.l $0ca3f23a,$4922fe7c,$f23a44a2,$fe82f200
- dc.l $0823f200,$0422f22e,$4823ff84,$f21fd030
- dc.l $f2009000,$f22e4422,$ff5460ff,$00003f6a
- dc.l $0c813fff,$80006eff,$00000300,$222eff5c
- dc.l $0c810000,$00006e14,$f2009000,$123c0003
- dc.l $f22e4800,$ff8460ff,$00003f36,$f23c4400
- dc.l $3f800000,$f2009000,$f23c4422,$80800000
- dc.l $60ff0000,$3f2c60ff,$00003f64,$f23c4400
- dc.l $3f800000,$60ff0000,$3f182d7c,$00000004
- dc.l $ff5cf210,$4800f22e,$6800ff84,$22103228
- dc.l $00040281,$7fffffff,$0c813fd7,$80006c04
- dc.l $60000240,$0c814004,$bc7e6d04,$6000027a
- dc.l $f2000080,$f23a54a3,$cf9843fb,$01700000
- dc.l $0678f22e,$6080ff58,$222eff58,$e981d3c1
- dc.l $f2194828,$f2114428,$222eff58,$e2990c81
- dc.l $00000000,$6c000106,$f227e004,$f22e6800
- dc.l $ff84f200,$0023f23a,$5480fce8,$f23a5500
- dc.l $fd32f200,$00a3f200,$01232f02,$2401e29a
- dc.l $02828000,$0000b382,$02828000,$0000f23a
- dc.l $54a2fcc8,$f23a5522,$fd12f200,$00a3b5ae
- dc.l $ff84241f,$f2000123,$e2990281,$80000000
- dc.l $2d7c3f80,$0000ff54,$b3aeff54,$f23a54a2
- dc.l $fca2f23a,$5522fcec,$f20000a3,$f2000123
- dc.l $f22e6800,$ff90f23a,$54a2fc90,$b3aeff90
- dc.l $f23a5522,$fcd6f200,$00a3f200,$0123f23a
- dc.l $54a2fc80,$f23a5522,$fccaf200,$00a3f200
- dc.l $0123f23a,$48a2fc7c,$f23a4922,$fcc6f200
- dc.l $00a3f200,$0123f23a,$48a2fc78,$f23a4922
- dc.l $fcc2f200,$00a3f200,$0823f22e,$48a3ff84
- dc.l $f23a4422,$fcbaf22e,$4823ff90,$f21fd020
- dc.l $f2009000,$f22e48a2,$ff8461ff,$00003e22
- dc.l $f22e4422,$ff5460ff,$00003d9e,$f227e004
- dc.l $f22e6800,$ff84f200,$0023f23a,$5480fc34
- dc.l $f23a5500,$fbdef200,$00a3f22e,$6800ff90
- dc.l $f2000123,$e2990281,$80000000,$f23a54a2
- dc.l $fc1af23a,$5522fbc4,$b3aeff84,$b3aeff90
- dc.l $f20000a3,$00813f80,$00002d41,$ff54f200
- dc.l $0123f23a,$54a2fbfc,$f23a5522,$fba6f200
- dc.l $00a3f200,$0123f23a,$54a2fbf0,$f23a5522
- dc.l $fb9af200,$00a3f200,$0123f23a,$54a2fbe4
- dc.l $f23a5522,$fb8ef200,$00a3f200,$0123f23a
- dc.l $48a2fbe0,$f23a4922,$fb8af200,$00a3f200
- dc.l $0123f23a,$48a2fbdc,$f23a4922,$fb86f200
- dc.l $00a3f200,$0823f23a,$44a2fbd4,$f22e4823
- dc.l $ff84f22e,$48a3ff90,$f21fd020,$f2009000
- dc.l $f22e44a2,$ff5461ff,$00003d36,$f22e4822
- dc.l $ff8460ff,$00003cb2,$0c813fff,$80006e00
- dc.l $0048f23c,$44803f80,$0000f200,$9000f23c
- dc.l $44a80080,$000061ff,$00003d06,$f200b000
- dc.l $123c0003,$f22e4800,$ff8460ff,$00003c72
- dc.l $2f00f23c,$44803f80,$000061ff,$00003ce2
- dc.l $201f60ff,$00003ca8,$f227e03c,$2f02f23c
- dc.l $44800000,$00000c81,$7ffeffff,$66523d7c
- dc.l $7ffeff84,$2d7cc90f,$daa2ff88,$42aeff8c
- dc.l $3d7c7fdc,$ff902d7c,$85a308d3,$ff9442ae
- dc.l $ff98f200,$003af294,$000e002e,$0080ff84
- dc.l $002e0080,$ff90f22e,$4822ff84,$f2000080
- dc.l $f22e4822,$ff90f200,$00a8f22e,$48a2ff90
- dc.l $f22e6800,$ff84322e,$ff842241,$02810000
- dc.l $7fff0481,$00003fff,$0c810000,$001c6f0e
- dc.l $04810000,$001b1d7c,$0000ff58,$60084281
- dc.l $1d7c0001,$ff58243c,$00003ffe,$94812d7c
- dc.l $a2f9836e,$ff882d7c,$4e44152a,$ff8c3d42
- dc.l $ff84f200,$0100f22e,$4923ff84,$24094842
- dc.l $02828000,$00000082,$5f000000,$2d42ff54
- dc.l $f22e4522,$ff54f22e,$4528ff54,$24010682
- dc.l $00003fff,$3d42ff84,$2d7cc90f,$daa2ff88
- dc.l $42aeff8c,$06810000,$3fdd3d41,$ff902d7c
- dc.l $85a308d3,$ff9442ae,$ff98122e,$ff58f200
- dc.l $0a00f22e,$4a23ff84,$f2000a80,$f22e4aa3
- dc.l $ff90f200,$1180f200,$15a2f200,$0e28f200
- dc.l $0c28f200,$1622f200,$0180f200,$10a8f200
- dc.l $04220c01,$00006e00,$000ef200,$01a8f200
- dc.l $0ca26000,$ff0cf22e,$6100ff58,$241ff21f
- dc.l $d03c222e,$ff5c0c81,$00000004,$6d00fa4c
- dc.l $6000fc36,$3ea0b759,$f50f8688,$bef2baa5
- dc.l $a8924f04,$bf346f59,$b39ba65f,$00000000
- dc.l $00000000,$3ff60000,$e073d3fc,$199c4a00
- dc.l $00000000,$3ff90000,$d23cd684,$15d95fa1
- dc.l $00000000,$bffc0000,$8895a6c5,$fb423bca
- dc.l $00000000,$bffd0000,$eef57e0d,$a84bc8ce
- dc.l $00000000,$3ffc0000,$a2f9836e,$4e44152a
- dc.l $00000000,$40010000,$c90fdaa2,$00000000
- dc.l $00000000,$3fdf0000,$85a308d4,$00000000
- dc.l $00000000,$c0040000,$c90fdaa2,$2168c235
- dc.l $21800000,$c0040000,$c2c75bcd,$105d7c23
- dc.l $a0d00000,$c0040000,$bc7edcf7,$ff523611
- dc.l $a1e80000,$c0040000,$b6365e22,$ee46f000
- dc.l $21480000,$c0040000,$afeddf4d,$dd3ba9ee
- dc.l $a1200000,$c0040000,$a9a56078,$cc3063dd
- dc.l $21fc0000,$c0040000,$a35ce1a3,$bb251dcb
- dc.l $21100000,$c0040000,$9d1462ce,$aa19d7b9
- dc.l $a1580000,$c0040000,$96cbe3f9,$990e91a8
- dc.l $21e00000,$c0040000,$90836524,$88034b96
- dc.l $20b00000,$c0040000,$8a3ae64f,$76f80584
- dc.l $a1880000,$c0040000,$83f2677a,$65ecbf73
- dc.l $21c40000,$c0030000,$fb53d14a,$a9c2f2c2
- dc.l $20000000,$c0030000,$eec2d3a0,$87ac669f
- dc.l $21380000,$c0030000,$e231d5f6,$6595da7b
- dc.l $a1300000,$c0030000,$d5a0d84c,$437f4e58
- dc.l $9fc00000,$c0030000,$c90fdaa2,$2168c235
- dc.l $21000000,$c0030000,$bc7edcf7,$ff523611
- dc.l $a1680000,$c0030000,$afeddf4d,$dd3ba9ee
- dc.l $a0a00000,$c0030000,$a35ce1a3,$bb251dcb
- dc.l $20900000,$c0030000,$96cbe3f9,$990e91a8
- dc.l $21600000,$c0030000,$8a3ae64f,$76f80584
- dc.l $a1080000,$c0020000,$fb53d14a,$a9c2f2c2
- dc.l $1f800000,$c0020000,$e231d5f6,$6595da7b
- dc.l $a0b00000,$c0020000,$c90fdaa2,$2168c235
- dc.l $20800000,$c0020000,$afeddf4d,$dd3ba9ee
- dc.l $a0200000,$c0020000,$96cbe3f9,$990e91a8
- dc.l $20e00000,$c0010000,$fb53d14a,$a9c2f2c2
- dc.l $1f000000,$c0010000,$c90fdaa2,$2168c235
- dc.l $20000000,$c0010000,$96cbe3f9,$990e91a8
- dc.l $20600000,$c0000000,$c90fdaa2,$2168c235
- dc.l $1f800000,$bfff0000,$c90fdaa2,$2168c235
- dc.l $1f000000,$00000000,$00000000,$00000000
- dc.l $00000000,$3fff0000,$c90fdaa2,$2168c235
- dc.l $9f000000,$40000000,$c90fdaa2,$2168c235
- dc.l $9f800000,$40010000,$96cbe3f9,$990e91a8
- dc.l $a0600000,$40010000,$c90fdaa2,$2168c235
- dc.l $a0000000,$40010000,$fb53d14a,$a9c2f2c2
- dc.l $9f000000,$40020000,$96cbe3f9,$990e91a8
- dc.l $a0e00000,$40020000,$afeddf4d,$dd3ba9ee
- dc.l $20200000,$40020000,$c90fdaa2,$2168c235
- dc.l $a0800000,$40020000,$e231d5f6,$6595da7b
- dc.l $20b00000,$40020000,$fb53d14a,$a9c2f2c2
- dc.l $9f800000,$40030000,$8a3ae64f,$76f80584
- dc.l $21080000,$40030000,$96cbe3f9,$990e91a8
- dc.l $a1600000,$40030000,$a35ce1a3,$bb251dcb
- dc.l $a0900000,$40030000,$afeddf4d,$dd3ba9ee
- dc.l $20a00000,$40030000,$bc7edcf7,$ff523611
- dc.l $21680000,$40030000,$c90fdaa2,$2168c235
- dc.l $a1000000,$40030000,$d5a0d84c,$437f4e58
- dc.l $1fc00000,$40030000,$e231d5f6,$6595da7b
- dc.l $21300000,$40030000,$eec2d3a0,$87ac669f
- dc.l $a1380000,$40030000,$fb53d14a,$a9c2f2c2
- dc.l $a0000000,$40040000,$83f2677a,$65ecbf73
- dc.l $a1c40000,$40040000,$8a3ae64f,$76f80584
- dc.l $21880000,$40040000,$90836524,$88034b96
- dc.l $a0b00000,$40040000,$96cbe3f9,$990e91a8
- dc.l $a1e00000,$40040000,$9d1462ce,$aa19d7b9
- dc.l $21580000,$40040000,$a35ce1a3,$bb251dcb
- dc.l $a1100000,$40040000,$a9a56078,$cc3063dd
- dc.l $a1fc0000,$40040000,$afeddf4d,$dd3ba9ee
- dc.l $21200000,$40040000,$b6365e22,$ee46f000
- dc.l $a1480000,$40040000,$bc7edcf7,$ff523611
- dc.l $21e80000,$40040000,$c2c75bcd,$105d7c23
- dc.l $20d00000,$40040000,$c90fdaa2,$2168c235
- dc.l $a1800000,$f2104800,$22103228,$00040281
- dc.l $7fffffff,$0c813fd7,$80006c04,$60000134
- dc.l $0c814004,$bc7e6d04,$60000144,$f2000080
- dc.l $f23a54a3,$c6dc43fa,$fdbcf201,$6080e981
- dc.l $d3c1f219,$4828f211,$4428ea99,$02818000
- dc.l $0000f227,$e00c0c81,$00000000,$6d000072
- dc.l $f2000080,$f20004a3,$f23a5580,$faf8f23a
- dc.l $5500fafa,$f20005a3,$f2000523,$f23a55a2
- dc.l $faf4f23a,$4922fafe,$f20005a3,$f2000523
- dc.l $f23a49a2,$fb00f23a,$4922fb0a,$f20005a3
- dc.l $f2000523,$f23a49a2,$fb0cf200,$0123f200
- dc.l $0ca3f200,$0822f23c,$44a23f80,$0000f21f
- dc.l $d030f200,$9000f200,$042060ff,$0000357a
- dc.l $f2000080,$f2000023,$f23a5580,$fa88f23a
- dc.l $5500fa8a,$f20001a3,$f2000123,$f23a55a2
- dc.l $fa84f23a,$4922fa8e,$f20001a3,$f2000123
- dc.l $f23a49a2,$fa90f23a,$4922fa9a,$f20001a3
- dc.l $f2000123,$f23a49a2,$fa9cf200,$0523f200
- dc.l $0c23f200,$08a2f23c,$44223f80,$0000f21f
- dc.l $d030f227,$68800a97,$80000000,$f2009000
- dc.l $f21f4820,$60ff0000,$35000c81,$3fff8000
- dc.l $6e1cf227,$6800f200,$9000123c,$0003f21f
- dc.l $480060ff,$000034da,$60ff0000,$3522f227
- dc.l $e03c2f02,$f23c4480,$00000000,$0c817ffe
- dc.l $ffff6652,$3d7c7ffe,$ff842d7c,$c90fdaa2
- dc.l $ff8842ae,$ff8c3d7c,$7fdcff90,$2d7c85a3
- dc.l $08d3ff94,$42aeff98,$f200003a,$f294000e
- dc.l $002e0080,$ff84002e,$0080ff90,$f22e4822
- dc.l $ff84f200,$0080f22e,$4822ff90,$f20000a8
- dc.l $f22e48a2,$ff90f22e,$6800ff84,$322eff84
- dc.l $22410281,$00007fff,$04810000,$3fff0c81
- dc.l $0000001c,$6f0e0481,$0000001b,$1d7c0000
- dc.l $ff586008,$42811d7c,$0001ff58,$243c0000
- dc.l $3ffe9481,$2d7ca2f9,$836eff88,$2d7c4e44
- dc.l $152aff8c,$3d42ff84,$f2000100,$f22e4923
- dc.l $ff842409,$48420282,$80000000,$00825f00
- dc.l $00002d42,$ff54f22e,$4522ff54,$f22e4528
- dc.l $ff542401,$06820000,$3fff3d42,$ff842d7c
- dc.l $c90fdaa2,$ff8842ae,$ff8c0681,$00003fdd
- dc.l $3d41ff90,$2d7c85a3,$08d3ff94,$42aeff98
- dc.l $122eff58,$f2000a00,$f22e4a23,$ff84f200
- dc.l $0a80f22e,$4aa3ff90,$f2001180,$f20015a2
- dc.l $f2000e28,$f2000c28,$f2001622,$f2000180
- dc.l $f20010a8,$f2000422,$0c010000,$6e00000e
- dc.l $f20001a8,$f2000ca2,$6000ff0c,$f22e6100
- dc.l $ff54241f,$f21fd03c,$222eff54,$e2996000
- dc.l $fd72bff6,$687e3149,$87d84002,$ac6934a2
- dc.l $6db3bfc2,$476f4e1d,$a28e3fb3,$44447f87
- dc.l $6989bfb7,$44ee7faf,$45db3fbc,$71c64694
- dc.l $0220bfc2,$49249218,$72f93fc9,$99999999
- dc.l $8fa9bfd5,$55555555,$5555bfb7,$0bf39853
- dc.l $9e6a3fbc,$7187962d,$1d7dbfc2,$49248271
- dc.l $07b83fc9,$99999996,$263ebfd5,$55555555
- dc.l $55363fff,$0000c90f,$daa22168,$c2350000
- dc.l $0000bfff,$0000c90f,$daa22168,$c2350000
- dc.l $00000001,$00008000,$00000000,$00000000
- dc.l $00008001,$00008000,$00000000,$00000000
- dc.l $00003ffb,$000083d1,$52c5060b,$7a510000
- dc.l $00003ffb,$00008bc8,$54456549,$8b8b0000
- dc.l $00003ffb,$000093be,$40601762,$6b0d0000
- dc.l $00003ffb,$00009bb3,$078d35ae,$c2020000
- dc.l $00003ffb,$0000a3a6,$9a525ddc,$e7de0000
- dc.l $00003ffb,$0000ab98,$e9436276,$56190000
- dc.l $00003ffb,$0000b389,$e502f9c5,$98620000
- dc.l $00003ffb,$0000bb79,$7e436b09,$e6fb0000
- dc.l $00003ffb,$0000c367,$a5c739e5,$f4460000
- dc.l $00003ffb,$0000cb54,$4c61cff7,$d5c60000
- dc.l $00003ffb,$0000d33f,$62f82488,$533e0000
- dc.l $00003ffb,$0000db28,$da816240,$4c770000
- dc.l $00003ffb,$0000e310,$a4078ad3,$4f180000
- dc.l $00003ffb,$0000eaf6,$b0a8188e,$e1eb0000
- dc.l $00003ffb,$0000f2da,$f1949dbe,$79d50000
- dc.l $00003ffb,$0000fabd,$581361d4,$7e3e0000
- dc.l $00003ffc,$00008346,$ac210959,$ecc40000
- dc.l $00003ffc,$00008b23,$2a083042,$82d80000
- dc.l $00003ffc,$000092fb,$70b8d29a,$e2f90000
- dc.l $00003ffc,$00009acf,$476f5ccd,$1cb40000
- dc.l $00003ffc,$0000a29e,$76304954,$f23f0000
- dc.l $00003ffc,$0000aa68,$c5d08ab8,$52300000
- dc.l $00003ffc,$0000b22d,$fffd9d53,$9f830000
- dc.l $00003ffc,$0000b9ed,$ef453e90,$0ea50000
- dc.l $00003ffc,$0000c1a8,$5f1cc75e,$3ea50000
- dc.l $00003ffc,$0000c95d,$1be82813,$8de60000
- dc.l $00003ffc,$0000d10b,$f300840d,$2de40000
- dc.l $00003ffc,$0000d8b4,$b2ba6bc0,$5e7a0000
- dc.l $00003ffc,$0000e057,$2a6bb423,$35f60000
- dc.l $00003ffc,$0000e7f3,$2a70ea9c,$aa8f0000
- dc.l $00003ffc,$0000ef88,$843264ec,$efaa0000
- dc.l $00003ffc,$0000f717,$0a28ecc0,$66660000
- dc.l $00003ffd,$0000812f,$d288332d,$ad320000
- dc.l $00003ffd,$000088a8,$d1b1218e,$4d640000
- dc.l $00003ffd,$00009012,$ab3f23e4,$aee80000
- dc.l $00003ffd,$0000976c,$c3d411e7,$f1b90000
- dc.l $00003ffd,$00009eb6,$89493889,$a2270000
- dc.l $00003ffd,$0000a5ef,$72c34487,$361b0000
- dc.l $00003ffd,$0000ad17,$00baf07a,$72270000
- dc.l $00003ffd,$0000b42c,$bcfafd37,$efb70000
- dc.l $00003ffd,$0000bb30,$3a940ba8,$0f890000
- dc.l $00003ffd,$0000c221,$15c6fcae,$bbaf0000
- dc.l $00003ffd,$0000c8fe,$f3e68633,$12210000
- dc.l $00003ffd,$0000cfc9,$8330b400,$0c700000
- dc.l $00003ffd,$0000d680,$7aa1102c,$5bf90000
- dc.l $00003ffd,$0000dd23,$99bc3125,$2aa30000
- dc.l $00003ffd,$0000e3b2,$a8556b8f,$c5170000
- dc.l $00003ffd,$0000ea2d,$764f6431,$59890000
- dc.l $00003ffd,$0000f3bf,$5bf8bad1,$a21d0000
- dc.l $00003ffe,$0000801c,$e39e0d20,$5c9a0000
- dc.l $00003ffe,$00008630,$a2dada1e,$d0660000
- dc.l $00003ffe,$00008c1a,$d445f3e0,$9b8c0000
- dc.l $00003ffe,$000091db,$8f1664f3,$50e20000
- dc.l $00003ffe,$00009773,$1420365e,$538c0000
- dc.l $00003ffe,$00009ce1,$c8e6a0b8,$cdba0000
- dc.l $00003ffe,$0000a228,$32dbcada,$ae090000
- dc.l $00003ffe,$0000a746,$f2ddb760,$22940000
- dc.l $00003ffe,$0000ac3e,$c0fb997d,$d6a20000
- dc.l $00003ffe,$0000b110,$688aebdc,$6f6a0000
- dc.l $00003ffe,$0000b5bc,$c49059ec,$c4b00000
- dc.l $00003ffe,$0000ba44,$bc7dd470,$782f0000
- dc.l $00003ffe,$0000bea9,$4144fd04,$9aac0000
- dc.l $00003ffe,$0000c2eb,$4abb6616,$28b60000
- dc.l $00003ffe,$0000c70b,$d54ce602,$ee140000
- dc.l $00003ffe,$0000cd00,$0549adec,$71590000
- dc.l $00003ffe,$0000d484,$57d2d8ea,$4ea30000
- dc.l $00003ffe,$0000db94,$8da712de,$ce3b0000
- dc.l $00003ffe,$0000e238,$55f969e8,$096a0000
- dc.l $00003ffe,$0000e877,$1129c435,$32590000
- dc.l $00003ffe,$0000ee57,$c16e0d37,$9c0d0000
- dc.l $00003ffe,$0000f3e1,$0211a87c,$37790000
- dc.l $00003ffe,$0000f919,$039d758b,$8d410000
- dc.l $00003ffe,$0000fe05,$8b8f6493,$5fb30000
- dc.l $00003fff,$00008155,$fb497b68,$5d040000
- dc.l $00003fff,$00008388,$9e3549d1,$08e10000
- dc.l $00003fff,$0000859c,$fa76511d,$724b0000
- dc.l $00003fff,$00008795,$2ecfff81,$31e70000
- dc.l $00003fff,$00008973,$2fd19557,$641b0000
- dc.l $00003fff,$00008b38,$cad10193,$2a350000
- dc.l $00003fff,$00008ce7,$a8d8301e,$e6b50000
- dc.l $00003fff,$00008f46,$a39e2eae,$52810000
- dc.l $00003fff,$0000922d,$a7d79188,$84870000
- dc.l $00003fff,$000094d1,$9fcbdedf,$52410000
- dc.l $00003fff,$0000973a,$b94419d2,$a08b0000
- dc.l $00003fff,$0000996f,$f00e08e1,$0b960000
- dc.l $00003fff,$00009b77,$3f951232,$1da70000
- dc.l $00003fff,$00009d55,$cc320f93,$56240000
- dc.l $00003fff,$00009f10,$0575006c,$c5710000
- dc.l $00003fff,$0000a0a9,$c290d97c,$c06c0000
- dc.l $00003fff,$0000a226,$59ebebc0,$630a0000
- dc.l $00003fff,$0000a388,$b4aff6ef,$0ec90000
- dc.l $00003fff,$0000a4d3,$5f1061d2,$92c40000
- dc.l $00003fff,$0000a608,$95dcfbe3,$187e0000
- dc.l $00003fff,$0000a72a,$51dc7367,$beac0000
- dc.l $00003fff,$0000a83a,$51530956,$168f0000
- dc.l $00003fff,$0000a93a,$20077539,$546e0000
- dc.l $00003fff,$0000aa9e,$7245023b,$26050000
- dc.l $00003fff,$0000ac4c,$84ba6fe4,$d58f0000
- dc.l $00003fff,$0000adce,$4a4a606b,$97120000
- dc.l $00003fff,$0000af2a,$2dcd8d26,$3c9c0000
- dc.l $00003fff,$0000b065,$6f81f222,$65c70000
- dc.l $00003fff,$0000b184,$65150f71,$496a0000
- dc.l $00003fff,$0000b28a,$aa156f9a,$da350000
- dc.l $00003fff,$0000b37b,$44ff3766,$b8950000
- dc.l $00003fff,$0000b458,$c3dce963,$04330000
- dc.l $00003fff,$0000b525,$529d5622,$46bd0000
- dc.l $00003fff,$0000b5e2,$cca95f9d,$88cc0000
- dc.l $00003fff,$0000b692,$cada7aca,$1ada0000
- dc.l $00003fff,$0000b736,$aea7a692,$58380000
- dc.l $00003fff,$0000b7cf,$ab287e9f,$7b360000
- dc.l $00003fff,$0000b85e,$cc66cb21,$98350000
- dc.l $00003fff,$0000b8e4,$fd5a20a5,$93da0000
- dc.l $00003fff,$0000b99f,$41f64aff,$9bb50000
- dc.l $00003fff,$0000ba7f,$1e17842b,$be7b0000
- dc.l $00003fff,$0000bb47,$12857637,$e17d0000
- dc.l $00003fff,$0000bbfa,$be8a4788,$df6f0000
- dc.l $00003fff,$0000bc9d,$0fad2b68,$9d790000
- dc.l $00003fff,$0000bd30,$6a39471e,$cd860000
- dc.l $00003fff,$0000bdb6,$c731856a,$f18a0000
- dc.l $00003fff,$0000be31,$cac502e8,$0d700000
- dc.l $00003fff,$0000bea2,$d55ce331,$94e20000
- dc.l $00003fff,$0000bf0b,$10b7c031,$28f00000
- dc.l $00003fff,$0000bf6b,$7a18dacb,$778d0000
- dc.l $00003fff,$0000bfc4,$ea4663fa,$18f60000
- dc.l $00003fff,$0000c018,$1bde8b89,$a4540000
- dc.l $00003fff,$0000c065,$b066cfbf,$64390000
- dc.l $00003fff,$0000c0ae,$345f5634,$0ae60000
- dc.l $00003fff,$0000c0f2,$22919cb9,$e6a70000
- dc.l $0000f210,$48002210,$32280004,$f22e6800
- dc.l $ff840281,$7fffffff,$0c813ffb,$80006c04
- dc.l $600000d0,$0c814002,$ffff6f04,$6000014c
- dc.l $02aef800,$0000ff88,$00ae0400,$0000ff88
- dc.l $2d7c0000,$0000ff8c,$f2000080,$f22e48a3
- dc.l $ff84f22e,$4828ff84,$f23c44a2,$3f800000
- dc.l $f2000420,$2f022401,$02810000,$78000282
- dc.l $7fff0000,$04823ffb,$0000e282,$d282ee81
- dc.l $43faf780,$d3c12d59,$ff902d59,$ff942d59
- dc.l $ff98222e,$ff840281,$80000000,$83aeff90
- dc.l $241ff227,$e004f200,$0080f200,$04a3f23a
- dc.l $5500f6a0,$f2000522,$f2000523,$f20000a3
- dc.l $f23a5522,$f696f23a,$54a3f698,$f20008a3
- dc.l $f2000422,$f21fd020,$f2009000,$f22e4822
- dc.l $ff9060ff,$000029d2,$0c813fff,$80006e00
- dc.l $008a0c81,$3fd78000,$6d00006c,$f227e00c
- dc.l $f2000023,$f2000080,$f20004a3,$f23a5500
- dc.l $f65af23a,$5580f65c,$f2000523,$f20005a3
- dc.l $f23a5522,$f656f23a,$55a2f658,$f2000523
- dc.l $f2000ca3,$f23a5522,$f652f23a,$54a2f654
- dc.l $f2000123,$f22e4823,$ff84f200,$08a2f200
- dc.l $0423f21f,$d030f200,$9000f22e,$4822ff84
- dc.l $60ff0000,$2954f200,$9000123c,$0003f22e
- dc.l $4800ff84,$60ff0000,$29380c81,$40638000
- dc.l $6e00008e,$f227e00c,$f23c4480,$bf800000
- dc.l $f20000a0,$f2000400,$f2000023,$f22e6880
- dc.l $ff84f200,$0080f200,$04a3f23a,$5580f5ec
- dc.l $f23a5500,$f5eef200,$05a3f200,$0523f23a
- dc.l $55a2f5e8,$f23a5522,$f5eaf200,$0ca3f200
- dc.l $0123f23a,$54a2f5e4,$f22e4823,$ff84f200
- dc.l $08a2f200,$0423f22e,$4822ff84,$f21fd030
- dc.l $f2009000,$4a106a0c,$f23a4822,$f5d660ff
- dc.l $000028c6,$f23a4822,$f5ba60ff,$000028b2
- dc.l $4a106a16,$f23a4800,$f5baf200,$9000f23a
- dc.l $4822f5c0,$60ff0000,$28a0f23a,$4800f594
- dc.l $f2009000,$f23a4822,$f5ba60ff,$00002882
- dc.l $60ff0000,$28baf210,$48002210,$32280004
- dc.l $02817fff,$ffff0c81,$3fff8000,$6c4e0c81
- dc.l $3fd78000,$6d00007c,$f23c4480,$3f800000
- dc.l $f20000a8,$f227e004,$f23c4500,$3f800000
- dc.l $f2000122,$f20008a3,$f21fd020,$f2000484
- dc.l $f2000420,$f227e001,$41d761ff,$fffffd66
- dc.l $dffc0000,$000c60ff,$0000280e,$f2000018
- dc.l $f23c4438,$3f800000,$f2d20000,$265af23a
- dc.l $4800b8ae,$22100281,$80000000,$00813f80
- dc.l $00002f01,$f2009000,$f21f4423,$60ff0000
- dc.l $27d8f200,$9000123c,$0003f210,$480060ff
- dc.l $000027be,$60ff0000,$2806f210,$48002210
- dc.l $32280004,$02817fff,$ffff0c81,$3fff8000
- dc.l $6c44f23c,$44803f80,$0000f200,$00a2f200
- dc.l $001af23c,$44223f80,$0000f200,$0420f200
- dc.l $00042f00,$4280f227,$e00141d7,$61ffffff
- dc.l $fcc4dffc,$0000000c,$f21f9000,$f2000022
- dc.l $60ff0000,$276cf200,$0018f23c,$44383f80
- dc.l $0000f2d2,$000025b0,$4a106a18,$f23a4800
- dc.l $b7f0f200,$9000f23c,$44220080,$000060ff
- dc.l $0000273e,$60ff0000,$2988f200,$9000f23a
- dc.l $4800b7de,$60ff0000,$27283fdc,$000082e3
- dc.l $08654361,$c4c60000,$00003fa5,$55555555
- dc.l $4cc13fc5,$55555555,$4a543f81,$11111117
- dc.l $43853fa5,$55555555,$4f5a3fc5,$55555555
- dc.l $55550000,$00000000,$00003ec7,$1de3a577
- dc.l $46823efa,$01a019d7,$cb683f2a,$01a01a01
- dc.l $9df33f56,$c16c16c1,$70e23f81,$11111111
- dc.l $11113fa5,$55555555,$55553ffc,$0000aaaa
- dc.l $aaaaaaaa,$aaab0000,$000048b0,$00000000
- dc.l $00003730,$00000000,$00003fff,$00008000
- dc.l $00000000,$00000000,$00003fff,$00008164
- dc.l $d1f3bc03,$07749f84,$1a9b3fff,$000082cd
- dc.l $8698ac2b,$a1d89fc1,$d5b93fff,$0000843a
- dc.l $28c3acde,$4048a072,$83693fff,$000085aa
- dc.l $c367cc48,$7b141fc5,$c95c3fff,$0000871f
- dc.l $61969e8d,$10101ee8,$5c9f3fff,$00008898
- dc.l $0e8092da,$85289fa2,$07293fff,$00008a14
- dc.l $d575496e,$fd9ca07b,$f9af3fff,$00008b95
- dc.l $c1e3ea8b,$d6e8a002,$0dcf3fff,$00008d1a
- dc.l $df5b7e5b,$a9e4205a,$63da3fff,$00008ea4
- dc.l $398b45cd,$53c01eb7,$00513fff,$00009031
- dc.l $dc431466,$b1dc1f6e,$b0293fff,$000091c3
- dc.l $d373ab11,$c338a078,$14943fff,$0000935a
- dc.l $2b2f13e6,$e92c9eb3,$19b03fff,$000094f4
- dc.l $efa8fef7,$09602017,$457d3fff,$00009694
- dc.l $2d372018,$5a001f11,$d5373fff,$00009837
- dc.l $f0518db8,$a9709fb9,$52dd3fff,$000099e0
- dc.l $459320b7,$fa641fe4,$30873fff,$00009b8d
- dc.l $39b9d54e,$55381fa2,$a8183fff,$00009d3e
- dc.l $d9a72cff,$b7501fde,$494d3fff,$00009ef5
- dc.l $326091a1,$11ac2050,$48903fff,$0000a0b0
- dc.l $510fb971,$4fc4a073,$691c3fff,$0000a270
- dc.l $43030c49,$68181f9b,$7a053fff,$0000a435
- dc.l $15ae09e6,$80a0a079,$71263fff,$0000a5fe
- dc.l $d6a9b151,$38eca071,$a1403fff,$0000a7cd
- dc.l $93b4e965,$3568204f,$62da3fff,$0000a9a1
- dc.l $5ab4ea7c,$0ef81f28,$3c4a3fff,$0000ab7a
- dc.l $39b5a93e,$d3389f9a,$7fdc3fff,$0000ad58
- dc.l $3eea42a1,$4ac8a05b,$3fac3fff,$0000af3b
- dc.l $78ad690a,$43741fdf,$26103fff,$0000b123
- dc.l $f581d2ac,$25909f70,$5f903fff,$0000b311
- dc.l $c412a911,$2488201f,$678a3fff,$0000b504
- dc.l $f333f9de,$64841f32,$fb133fff,$0000b6fd
- dc.l $91e328d1,$77902003,$8b303fff,$0000b8fb
- dc.l $af4762fb,$9ee8200d,$c3cc3fff,$0000baff
- dc.l $5ab2133e,$45fc9f8b,$2ae63fff,$0000bd08
- dc.l $a39f580c,$36c0a02b,$bf703fff,$0000bf17
- dc.l $99b67a73,$1084a00b,$f5183fff,$0000c12c
- dc.l $4cca6670,$9458a041,$dd413fff,$0000c346
- dc.l $ccda2497,$64089fdf,$137b3fff,$0000c567
- dc.l $2a115506,$dadc201f,$15683fff,$0000c78d
- dc.l $74c8abb9,$b15c1fc1,$3a2e3fff,$0000c9b9
- dc.l $bd866e2f,$27a4a03f,$8f033fff,$0000cbec
- dc.l $14fef272,$7c5c1ff4,$907d3fff,$0000ce24
- dc.l $8c151f84,$80e49e6e,$53e43fff,$0000d063
- dc.l $33daef2b,$25941fd6,$d45c3fff,$0000d2a8
- dc.l $1d91f12a,$e45ca076,$edb93fff,$0000d4f3
- dc.l $5aabcfed,$fa209fa6,$de213fff,$0000d744
- dc.l $fccad69d,$6af41ee6,$9a2f3fff,$0000d99d
- dc.l $15c278af,$d7b4207f,$439f3fff,$0000dbfb
- dc.l $b797daf2,$3754201e,$c2073fff,$0000de60
- dc.l $f4825e0e,$91249e8b,$e1753fff,$0000e0cc
- dc.l $deec2a94,$e1102003,$2c4b3fff,$0000e33f
- dc.l $8972be8a,$5a502004,$dff53fff,$0000e5b9
- dc.l $06e77c83,$48a81e72,$f47a3fff,$0000e839
- dc.l $6a503c4b,$dc681f72,$2f223fff,$0000eac0
- dc.l $c6e7dd24,$3930a017,$e9453fff,$0000ed4f
- dc.l $301ed994,$2b841f40,$1a5b3fff,$0000efe4
- dc.l $b99bdcda,$f5cc9fb9,$a9e33fff,$0000f281
- dc.l $773c59ff,$b1382074,$4c053fff,$0000f525
- dc.l $7d152486,$cc2c1f77,$3a193fff,$0000f7d0
- dc.l $df730ad1,$3bb81ffe,$90d53fff,$0000fa83
- dc.l $b2db722a,$033ca041,$ed223fff,$0000fd3e
- dc.l $0c0cf486,$c1741f85,$3f3a2210,$02817fff
- dc.l $00000c81,$3fbe0000,$6c0660ff,$00000108
- dc.l $32280004,$0c81400c,$b1676d06,$60ff0000
- dc.l $010cf210,$4800f200,$0080f23c,$442342b8
- dc.l $aa3bf227,$e00c2d7c,$00000000,$ff58f201
- dc.l $600043fa,$fbb6f201,$40002d41,$ff540281
- dc.l $0000003f,$e989d3c1,$222eff54,$ec810641
- dc.l $3fff3d7a,$fb06ff54,$f2000100,$f23c4423
- dc.l $bc317218,$f23a4923,$faf2f200,$0422f200
- dc.l $0822f200,$0080f200,$04a3f23c,$45003ab6
- dc.l $0b70f200,$0523f200,$0580f23c,$45a33c08
- dc.l $8895f23a,$5522fad4,$f23a55a2,$fad6f200
- dc.l $05233d41,$ff842d7c,$80000000,$ff8842ae
- dc.l $ff8cf200,$05a3f23c,$45223f00,$0000f200
- dc.l $01a3f200,$0523f200,$0c22f219,$4880f200
- dc.l $0822f200,$0423f21f,$d030f211,$4422f200
- dc.l $0422222e,$ff584a81,$6706f22e,$4823ff90
- dc.l $f2009000,$123c0000,$f22e4823,$ff8460ff
- dc.l $0000216e,$f210d080,$f2009000,$f23c4422
- dc.l $3f800000,$60ff0000,$21680c81,$400cb27c
- dc.l $6e66f210,$4800f200,$0080f23c,$442342b8
- dc.l $aa3bf227,$e00c2d7c,$00000001,$ff58f201
- dc.l $600043fa,$faa6f201,$40002d41,$ff540281
- dc.l $0000003f,$e989d3c1,$222eff54,$ec812d41
- dc.l $ff54e281,$93aeff54,$06413fff,$3d41ff90
- dc.l $2d7c8000,$0000ff94,$42aeff98,$222eff54
- dc.l $06413fff,$6000fed2,$4a106bff,$00001fbc
- dc.l $60ff0000,$20ae2f10,$02978000,$00000097
- dc.l $00800000,$f23c4400,$3f800000,$f2009000
- dc.l $f21f4422,$60ff0000,$20c82210,$02817fff
- dc.l $00000c81,$3ffd0000,$6c0660ff,$0000015e
- dc.l $32280004,$0c814004,$c2156f06,$60ff0000
- dc.l $026cf210,$4800f200,$0080f23c,$442342b8
- dc.l $aa3bf227,$e00cf201,$600043fa,$f9eef201
- dc.l $40002d41,$ff540281,$0000003f,$e989d3c1
- dc.l $222eff54,$ec812d41,$ff54f200,$0100f23c
- dc.l $4423bc31,$7218f23a,$4923f930,$f2000422
- dc.l $f2000822,$06413fff,$f2000080,$f20004a3
- dc.l $f23c4500,$3950097b,$f2000523,$f2000580
- dc.l $f23c45a3,$3ab60b6a,$f23a5522,$f91ef23a
- dc.l $55a2f920,$3d41ff84,$2d7c8000,$0000ff88
- dc.l $42aeff8c,$f2000523,$222eff54,$4441f200
- dc.l $05a30641,$3ffff23a,$5522f900,$f23c45a2
- dc.l $3f000000,$f2000523,$00418000,$3d41ff90
- dc.l $2d7c8000,$0000ff94,$42aeff98,$f2000ca3
- dc.l $f2000123,$f2000422,$f2000822,$f21fd030
- dc.l $f2114823,$222eff54,$0c810000,$003f6f1a
- dc.l $f2294480,$000cf22e,$48a2ff90,$f2000422
- dc.l $f2114822,$60ff0000,$00340c81,$fffffffd
- dc.l $6c16f229,$4422000c,$f2114822,$f22e4822
- dc.l $ff9060ff,$00000016,$f2194880,$f2114422
- dc.l $f22e48a2,$ff90f200,$0422f200,$9000f22e
- dc.l $4823ff84,$60ff0000,$1f500c81,$3fbe0000
- dc.l $6c6c0c81,$00330000,$6d2c2d7c,$80010000
- dc.l $ff842d7c,$80000000,$ff8842ae,$ff8cf210
- dc.l $4800f200,$9000123c,$0002f22e,$4822ff84
- dc.l $60ff0000,$1f0cf210,$4800f23a,$5423f86c
- dc.l $2d7c8001,$0000ff84,$2d7c8000,$0000ff88
- dc.l $42aeff8c,$f22e4822,$ff84f200,$9000123c
- dc.l $0000f23a,$5423f84c,$60ff0000,$1ed4f210
- dc.l $4800f200,$0023f227,$e00cf23c,$44802f30
- dc.l $caa8f200,$00a3f23c,$4500310f,$8290f23c
- dc.l $44a232d7,$3220f200,$0123f200,$00a3f23c
- dc.l $45223493,$f281f23a,$54a2f7c0,$f2000123
- dc.l $f20000a3,$f23a5522,$f7baf23a,$54a2f7bc
- dc.l $f2000123,$f20000a3,$f23a5522,$f7b6f23a
- dc.l $54a2f7b8,$f2000123,$f20000a3,$f23a5522
- dc.l $f7b2f23a,$48a2f7b4,$f2000123,$f20000a3
- dc.l $f2000123,$f21048a3,$f23c4423,$3f000000
- dc.l $f20008a2,$f21fd030,$f2000422,$f2009000
- dc.l $f2104822,$60ff0000,$1e302210,$0c810000
- dc.l $00006e00,$fbacf23c,$4400bf80,$0000f200
- dc.l $9000f23c,$44220080,$000060ff,$00001e1a
- dc.l $60ff0000,$1e4a3028,$00000880,$000f0440
- dc.l $3ffff200,$50006d02,$4e751d7c,$0008ff64
- dc.l $4e7561ff,$00002342,$44400440,$3ffff200
- dc.l $50001d7c,$0008ff64,$4e753028,$00000040
- dc.l $7fff0880,$000e2d68,$0004ff88,$2d680008
- dc.l $ff8c3d40,$ff84f22e,$4800ff84,$6b024e75
- dc.l $1d7c0008,$ff644e75,$61ff0000,$22fc60ca
- dc.l $7ffb0000,$80000000,$00000000,$00000000
- dc.l $f2104800,$22103228,$00040281,$7fffffff
- dc.l $0c81400c,$b1676e42,$f2000018,$2f004280
- dc.l $f227e001,$41d761ff,$fffffad2,$dffc0000
- dc.l $000cf23c,$44233f00,$0000201f,$f23c4480
- dc.l $3e800000,$f20000a0,$f2009000,$123c0002
- dc.l $f2000422,$60ff0000,$1d280c81,$400cb2b3
- dc.l $6e3cf200,$0018f23a,$5428adb6,$f23a5428
- dc.l $adb82f00,$4280f227,$e00141d7,$61ffffff
- dc.l $fa7cdffc,$0000000c,$201ff200,$9000123c
- dc.l $0000f23a,$4823ff5a,$60ff0000,$1ce460ff
- dc.l $00001cb0,$f23c4400,$3f800000,$f2009000
- dc.l $f23c4422,$00800000,$60ff0000,$1cd4f210
- dc.l $48002210,$32280004,$22410281,$7fffffff
- dc.l $0c81400c,$b1676e62,$f2000018,$48e78040
- dc.l $f227e001,$41d74280,$61ffffff,$fbe0dffc
- dc.l $0000000c,$f23c9000,$00000000,$4cdf0201
- dc.l $f2000080,$f23c44a2,$3f800000,$f2276800
- dc.l $f2000420,$22090281,$80000000,$00813f00
- dc.l $0000f21f,$48222f01,$f2009000,$123c0000
- dc.l $f21f4423,$60ff0000,$1c480c81,$400cb2b3
- dc.l $6eff0000,$1bc2f200,$0018f23a,$5428acd2
- dc.l $2f3c0000,$00002f3c,$80000000,$22090281
- dc.l $80000000,$00817ffb,$00002f01,$f23a5428
- dc.l $acb82f00,$4280f227,$e00141d7,$61ffffff
- dc.l $f97cdffc,$0000000c,$201ff200,$9000123c
- dc.l $0000f21f,$482360ff,$00001be6,$60ff0000
- dc.l $1c2ef210,$4800f22e,$6800ff84,$22103228
- dc.l $00042d41,$ff840281,$7fffffff,$0c813fd7
- dc.l $80006d00,$00740c81,$3fffddce,$6e00006a
- dc.l $222eff84,$2d41ff5c,$02817fff,$00000681
- dc.l $00010000,$2d41ff84,$02ae8000,$0000ff5c
- dc.l $f22e4800,$ff842f00,$4280f227,$e00141d7
- dc.l $61ffffff,$fac8dffc,$0000000c,$201ff200
- dc.l $0080f23c,$44a24000,$0000222e,$ff5cf22e
- dc.l $6880ff84,$b3aeff84,$f2009000,$f22e4820
- dc.l $ff8460ff,$00001b52,$0c813fff,$80006d00
- dc.l $00880c81,$40048aa1,$6e000092,$222eff84
- dc.l $2d41ff5c,$02817fff,$00000681,$00010000
- dc.l $2d41ff84,$02ae8000,$0000ff5c,$222eff5c
- dc.l $f22e4800,$ff842f00,$4280f227,$e00141d7
- dc.l $61ffffff,$f878dffc,$0000000c,$201f222e
- dc.l $ff5cf23c,$44223f80,$00000a81,$c0000000
- dc.l $f2014480,$f20000a0,$222eff5c,$00813f80
- dc.l $0000f201,$4400f200,$9000123c,$0002f200
- dc.l $042260ff,$00001ac2,$f2009000,$123c0003
- dc.l $f22e4800,$ff8460ff,$00001aa6,$222eff84
- dc.l $02818000,$00000081,$3f800000,$f2014400
- dc.l $02818000,$00000a81,$80800000,$f2009000
- dc.l $f2014422,$60ff0000,$1a8060ff,$00001ac0
- dc.l $3ffe0000,$b17217f7,$d1cf79ac,$00000000
- dc.l $3f800000,$00000000,$7f800000,$bf800000
- dc.l $3fc2499a,$b5e4040b,$bfc555b5,$848cb7db
- dc.l $3fc99999,$987d8730,$bfcfffff,$ff6f7e97
- dc.l $3fd55555,$555555a4,$bfe00000,$00000008
- dc.l $3f175496,$add7dad6,$3f3c71c2,$fe80c7e0
- dc.l $3f624924,$928bccff,$3f899999,$999995ec
- dc.l $3fb55555,$55555555,$40000000,$00000000
- dc.l $3f990000,$80000000,$00000000,$00000000
- dc.l $3ffe0000,$fe03f80f,$e03f80fe,$00000000
- dc.l $3ff70000,$ff015358,$833c47e2,$00000000
- dc.l $3ffe0000,$fa232cf2,$52138ac0,$00000000
- dc.l $3ff90000,$bdc8d83e,$ad88d549,$00000000
- dc.l $3ffe0000,$f6603d98,$0f6603da,$00000000
- dc.l $3ffa0000,$9cf43dcf,$f5eafd48,$00000000
- dc.l $3ffe0000,$f2b9d648,$0f2b9d65,$00000000
- dc.l $3ffa0000,$da16eb88,$cb8df614,$00000000
- dc.l $3ffe0000,$ef2eb71f,$c4345238,$00000000
- dc.l $3ffb0000,$8b29b775,$1bd70743,$00000000
- dc.l $3ffe0000,$ebbdb2a5,$c1619c8c,$00000000
- dc.l $3ffb0000,$a8d839f8,$30c1fb49,$00000000
- dc.l $3ffe0000,$e865ac7b,$7603a197,$00000000
- dc.l $3ffb0000,$c61a2eb1,$8cd907ad,$00000000
- dc.l $3ffe0000,$e525982a,$f70c880e,$00000000
- dc.l $3ffb0000,$e2f2a47a,$de3a18af,$00000000
- dc.l $3ffe0000,$e1fc780e,$1fc780e2,$00000000
- dc.l $3ffb0000,$ff64898e,$df55d551,$00000000
- dc.l $3ffe0000,$dee95c4c,$a037ba57,$00000000
- dc.l $3ffc0000,$8db956a9,$7b3d0148,$00000000
- dc.l $3ffe0000,$dbeb61ee,$d19c5958,$00000000
- dc.l $3ffc0000,$9b8fe100,$f47ba1de,$00000000
- dc.l $3ffe0000,$d901b203,$6406c80e,$00000000
- dc.l $3ffc0000,$a9372f1d,$0da1bd17,$00000000
- dc.l $3ffe0000,$d62b80d6,$2b80d62c,$00000000
- dc.l $3ffc0000,$b6b07f38,$ce90e46b,$00000000
- dc.l $3ffe0000,$d3680d36,$80d3680d,$00000000
- dc.l $3ffc0000,$c3fd0329,$06488481,$00000000
- dc.l $3ffe0000,$d0b69fcb,$d2580d0b,$00000000
- dc.l $3ffc0000,$d11de0ff,$15ab18ca,$00000000
- dc.l $3ffe0000,$ce168a77,$25080ce1,$00000000
- dc.l $3ffc0000,$de1433a1,$6c66b150,$00000000
- dc.l $3ffe0000,$cb8727c0,$65c393e0,$00000000
- dc.l $3ffc0000,$eae10b5a,$7ddc8add,$00000000
- dc.l $3ffe0000,$c907da4e,$871146ad,$00000000
- dc.l $3ffc0000,$f7856e5e,$e2c9b291,$00000000
- dc.l $3ffe0000,$c6980c69,$80c6980c,$00000000
- dc.l $3ffd0000,$82012ca5,$a68206d7,$00000000
- dc.l $3ffe0000,$c4372f85,$5d824ca6,$00000000
- dc.l $3ffd0000,$882c5fcd,$7256a8c5,$00000000
- dc.l $3ffe0000,$c1e4bbd5,$95f6e947,$00000000
- dc.l $3ffd0000,$8e44c60b,$4ccfd7de,$00000000
- dc.l $3ffe0000,$bfa02fe8,$0bfa02ff,$00000000
- dc.l $3ffd0000,$944ad09e,$f4351af6,$00000000
- dc.l $3ffe0000,$bd691047,$07661aa3,$00000000
- dc.l $3ffd0000,$9a3eecd4,$c3eaa6b2,$00000000
- dc.l $3ffe0000,$bb3ee721,$a54d880c,$00000000
- dc.l $3ffd0000,$a0218434,$353f1de8,$00000000
- dc.l $3ffe0000,$b92143fa,$36f5e02e,$00000000
- dc.l $3ffd0000,$a5f2fcab,$bbc506da,$00000000
- dc.l $3ffe0000,$b70fbb5a,$19be3659,$00000000
- dc.l $3ffd0000,$abb3b8ba,$2ad362a5,$00000000
- dc.l $3ffe0000,$b509e68a,$9b94821f,$00000000
- dc.l $3ffd0000,$b1641795,$ce3ca97b,$00000000
- dc.l $3ffe0000,$b30f6352,$8917c80b,$00000000
- dc.l $3ffd0000,$b7047551,$5d0f1c61,$00000000
- dc.l $3ffe0000,$b11fd3b8,$0b11fd3c,$00000000
- dc.l $3ffd0000,$bc952afe,$ea3d13e1,$00000000
- dc.l $3ffe0000,$af3addc6,$80af3ade,$00000000
- dc.l $3ffd0000,$c2168ed0,$f458ba4a,$00000000
- dc.l $3ffe0000,$ad602b58,$0ad602b6,$00000000
- dc.l $3ffd0000,$c788f439,$b3163bf1,$00000000
- dc.l $3ffe0000,$ab8f69e2,$8359cd11,$00000000
- dc.l $3ffd0000,$ccecac08,$bf04565d,$00000000
- dc.l $3ffe0000,$a9c84a47,$a07f5638,$00000000
- dc.l $3ffd0000,$d2420487,$2dd85160,$00000000
- dc.l $3ffe0000,$a80a80a8,$0a80a80b,$00000000
- dc.l $3ffd0000,$d7894992,$3bc3588a,$00000000
- dc.l $3ffe0000,$a655c439,$2d7b73a8,$00000000
- dc.l $3ffd0000,$dcc2c4b4,$9887dacc,$00000000
- dc.l $3ffe0000,$a4a9cf1d,$96833751,$00000000
- dc.l $3ffd0000,$e1eebd3e,$6d6a6b9e,$00000000
- dc.l $3ffe0000,$a3065e3f,$ae7cd0e0,$00000000
- dc.l $3ffd0000,$e70d785c,$2f9f5bdc,$00000000
- dc.l $3ffe0000,$a16b312e,$a8fc377d,$00000000
- dc.l $3ffd0000,$ec1f392c,$5179f283,$00000000
- dc.l $3ffe0000,$9fd809fd,$809fd80a,$00000000
- dc.l $3ffd0000,$f12440d3,$e36130e6,$00000000
- dc.l $3ffe0000,$9e4cad23,$dd5f3a20,$00000000
- dc.l $3ffd0000,$f61cce92,$346600bb,$00000000
- dc.l $3ffe0000,$9cc8e160,$c3fb19b9,$00000000
- dc.l $3ffd0000,$fb091fd3,$8145630a,$00000000
- dc.l $3ffe0000,$9b4c6f9e,$f03a3caa,$00000000
- dc.l $3ffd0000,$ffe97042,$bfa4c2ad,$00000000
- dc.l $3ffe0000,$99d722da,$bde58f06,$00000000
- dc.l $3ffe0000,$825efced,$49369330,$00000000
- dc.l $3ffe0000,$9868c809,$868c8098,$00000000
- dc.l $3ffe0000,$84c37a7a,$b9a905c9,$00000000
- dc.l $3ffe0000,$97012e02,$5c04b809,$00000000
- dc.l $3ffe0000,$87224c2e,$8e645fb7,$00000000
- dc.l $3ffe0000,$95a02568,$095a0257,$00000000
- dc.l $3ffe0000,$897b8cac,$9f7de298,$00000000
- dc.l $3ffe0000,$94458094,$45809446,$00000000
- dc.l $3ffe0000,$8bcf55de,$c4cd05fe,$00000000
- dc.l $3ffe0000,$92f11384,$0497889c,$00000000
- dc.l $3ffe0000,$8e1dc0fb,$89e125e5,$00000000
- dc.l $3ffe0000,$91a2b3c4,$d5e6f809,$00000000
- dc.l $3ffe0000,$9066e68c,$955b6c9b,$00000000
- dc.l $3ffe0000,$905a3863,$3e06c43b,$00000000
- dc.l $3ffe0000,$92aade74,$c7be59e0,$00000000
- dc.l $3ffe0000,$8f1779d9,$fdc3a219,$00000000
- dc.l $3ffe0000,$94e9bff6,$15845643,$00000000
- dc.l $3ffe0000,$8dda5202,$37694809,$00000000
- dc.l $3ffe0000,$9723a1b7,$20134203,$00000000
- dc.l $3ffe0000,$8ca29c04,$6514e023,$00000000
- dc.l $3ffe0000,$995899c8,$90eb8990,$00000000
- dc.l $3ffe0000,$8b70344a,$139bc75a,$00000000
- dc.l $3ffe0000,$9b88bdaa,$3a3dae2f,$00000000
- dc.l $3ffe0000,$8a42f870,$5669db46,$00000000
- dc.l $3ffe0000,$9db4224f,$ffe1157c,$00000000
- dc.l $3ffe0000,$891ac73a,$e9819b50,$00000000
- dc.l $3ffe0000,$9fdadc26,$8b7a12da,$00000000
- dc.l $3ffe0000,$87f78087,$f78087f8,$00000000
- dc.l $3ffe0000,$a1fcff17,$ce733bd4,$00000000
- dc.l $3ffe0000,$86d90544,$7a34acc6,$00000000
- dc.l $3ffe0000,$a41a9e8f,$5446fb9f,$00000000
- dc.l $3ffe0000,$85bf3761,$2cee3c9b,$00000000
- dc.l $3ffe0000,$a633cd7e,$6771cd8b,$00000000
- dc.l $3ffe0000,$84a9f9c8,$084a9f9d,$00000000
- dc.l $3ffe0000,$a8489e60,$0b435a5e,$00000000
- dc.l $3ffe0000,$83993052,$3fbe3368,$00000000
- dc.l $3ffe0000,$aa59233c,$cca4bd49,$00000000
- dc.l $3ffe0000,$828cbfbe,$b9a020a3,$00000000
- dc.l $3ffe0000,$ac656dae,$6bcc4985,$00000000
- dc.l $3ffe0000,$81848da8,$faf0d277,$00000000
- dc.l $3ffe0000,$ae6d8ee3,$60bb2468,$00000000
- dc.l $3ffe0000,$80808080,$80808081,$00000000
- dc.l $3ffe0000,$b07197a2,$3c46c654,$00000000
- dc.l $f2104800,$2d7c0000,$0000ff54,$22103228
- dc.l $00042d50,$ff842d68,$0004ff88,$2d680008
- dc.l $ff8c0c81,$00000000,$6d000182,$0c813ffe
- dc.l $f07d6d0a,$0c813fff,$88416f00,$00e2e081
- dc.l $e0810481,$00003fff,$d2aeff54,$41faf7b2
- dc.l $f2014080,$2d7c3fff,$0000ff84,$2d6eff88
- dc.l $ff9402ae,$fe000000,$ff9400ae,$01000000
- dc.l $ff94222e,$ff940281,$7e000000,$e081e081
- dc.l $e881d1c1,$f22e4800,$ff842d7c,$3fff0000
- dc.l $ff9042ae,$ff98f22e,$4828ff90,$f227e00c
- dc.l $f2104823,$f23a48a3,$f6c8f200,$0100f200
- dc.l $0923f22e,$6880ff84,$f2000980,$f2000880
- dc.l $f23a54a3,$f6ccf23a,$5523f6ce,$f23a54a2
- dc.l $f6d0f23a,$5522f6d2,$f2000ca3,$f2000d23
- dc.l $f23a54a2,$f6ccf23a,$5522f6ce,$f2000ca3
- dc.l $d1fc0000,$0010f200,$0d23f200,$00a3f200
- dc.l $0822f210,$48a2f21f,$d030f200,$0422f200
- dc.l $9000f22e,$4822ff84,$60ff0000,$10ccf23c
- dc.l $58380001,$f2c10000,$1318f200,$0080f23a
- dc.l $44a8f64e,$f23a4422,$f648f200,$04a2f200
- dc.l $00a0f227,$e00cf200,$0400f200,$0023f22e
- dc.l $6880ff84,$f2000080,$f20004a3,$f23a5580
- dc.l $f660f23a,$5500f662,$f20005a3,$f2000523
- dc.l $f23a55a2,$f65cf23a,$5522f65e,$f2000ca3
- dc.l $f2000123,$f23a54a2,$f658f22e,$4823ff84
- dc.l $f20008a2,$f21fd030,$f2000423,$f2009000
- dc.l $f22e4822,$ff8460ff,$0000103e,$60ff0000
- dc.l $0e962d7c,$ffffff9c,$ff5448e7,$3f002610
- dc.l $28280004,$2a280008,$42824a84,$66342805
- dc.l $42857420,$4286edc4,$6000edac,$d4862d43
- dc.l $ff842d44,$ff882d45,$ff8c4482,$2d42ff54
- dc.l $f22e4800,$ff844cdf,$00fc41ee,$ff846000
- dc.l $fe0c4286,$edc46000,$2406edac,$2e05edad
- dc.l $44860686,$00000020,$ecaf8887,$2d43ff84
- dc.l $2d44ff88,$2d45ff8c,$44822d42,$ff54f22e
- dc.l $4800ff84,$4cdf00fc,$41eeff84,$6000fdce
- dc.l $f2104800,$f2000018,$f23a4838,$f5a4f292
- dc.l $0014f200,$9000123c,$0003f210,$480060ff
- dc.l $00000f7e,$f2104800,$2d7c0000,$0000ff54
- dc.l $f2000080,$f23a4422,$f508f22e,$6800ff84
- dc.l $3d6eff88,$ff86222e,$ff840c81,$00000000
- dc.l $6f0000da,$0c813ffe,$80006d00,$fda20c81
- dc.l $3fffc000,$6e00fd98,$0c813ffe,$f07d6d00
- dc.l $001a0c81,$3fff8841,$6e000010,$f20004a2
- dc.l $f23a4422,$f4bc6000,$fe762d6e,$ff88ff94
- dc.l $02aefe00,$0000ff94,$00ae0100,$0000ff94
- dc.l $0c813fff,$80006c44,$f23a4400,$f4fc2d7c
- dc.l $3fff0000,$ff9042ae,$ff98f22e,$4828ff90
- dc.l $222eff94,$02817e00,$0000e081,$e081e881
- dc.l $f20004a2,$f227e00c,$f2000422,$41faf4e2
- dc.l $d1c1f23a,$4480f466,$6000fd76,$f23a4400
- dc.l $f4502d7c,$3fff0000,$ff9042ae,$ff98f22e
- dc.l $4828ff90,$222eff94,$02817e00,$0000e081
- dc.l $e081e881,$f2000422,$f227e00c,$41faf4a2
- dc.l $d1c1f23a,$4480f41e,$6000fd36,$0c810000
- dc.l $00006d10,$f23a4400,$f414f200,$900060ff
- dc.l $00000c4e,$f23a4400,$f3fcf200,$900060ff
- dc.l $00000cb4,$60ff0000,$0e962210,$32280004
- dc.l $02817fff,$ffff0c81,$3fff8000,$6c56f210
- dc.l $4818f200,$0080f200,$049af200,$0022f23c
- dc.l $44a23f80,$0000f200,$04202210,$02818000
- dc.l $00000081,$3f000000,$2f012f00,$4280f227
- dc.l $e00141d7,$61ffffff,$fe5adffc,$0000000c
- dc.l $201ff200,$9000123c,$0000f21f,$442360ff
- dc.l $00000dde,$f2104818,$f23c4438,$3f800000
- dc.l $f2d20000,$0c3260ff,$00000bb6,$60ff0000
- dc.l $0e0e3ffd,$0000de5b,$d8a93728,$71950000
- dc.l $00003fff,$0000b8aa,$3b295c17,$f0bc0000
- dc.l $0000f23c,$58000001,$f2104838,$f2c10000
- dc.l $0ff02210,$6d000090,$2f004280,$61ffffff
- dc.l $fba2f21f,$9000f23a,$4823ffb8,$60ff0000
- dc.l $0d782210,$6d000070,$2f004280,$61ffffff
- dc.l $fd34f21f,$9000f23a,$4823ff98,$60ff0000
- dc.l $0d682210,$6d000050,$22280008,$662e2228
- dc.l $00040281,$7fffffff,$66223210,$02810000
- dc.l $7fff0481,$00003fff,$67ff0000,$0f84f200
- dc.l $9000f201,$400060ff,$00000d1e,$2f004280
- dc.l $61ffffff,$fb2ef21f,$9000f23a,$4823ff54
- dc.l $60ff0000,$0d0460ff,$00000b5c,$22106d00
- dc.l $fff62f00,$428061ff,$fffffcba,$f21f9000
- dc.l $f23a4823,$ff2e60ff,$00000cee,$406a934f
- dc.l $0979a371,$3f734413,$509f8000,$bfcd0000
- dc.l $c0219dc1,$da994fd2,$00000000,$40000000
- dc.l $935d8ddd,$aaa8ac17,$00000000,$3ffe0000
- dc.l $b17217f7,$d1cf79ac,$00000000,$3f56c16d
- dc.l $6f7bd0b2,$3f811112,$302c712c,$3fa55555
- dc.l $55554cc1,$3fc55555,$55554a54,$3fe00000
- dc.l $00000000,$00000000,$00000000,$3fff0000
- dc.l $80000000,$00000000,$3f738000,$3fff0000
- dc.l $8164d1f3,$bc030773,$3fbef7ca,$3fff0000
- dc.l $82cd8698,$ac2ba1d7,$3fbdf8a9,$3fff0000
- dc.l $843a28c3,$acde4046,$3fbcd7c9,$3fff0000
- dc.l $85aac367,$cc487b15,$bfbde8da,$3fff0000
- dc.l $871f6196,$9e8d1010,$3fbde85c,$3fff0000
- dc.l $88980e80,$92da8527,$3fbebbf1,$3fff0000
- dc.l $8a14d575,$496efd9a,$3fbb80ca,$3fff0000
- dc.l $8b95c1e3,$ea8bd6e7,$bfba8373,$3fff0000
- dc.l $8d1adf5b,$7e5ba9e6,$bfbe9670,$3fff0000
- dc.l $8ea4398b,$45cd53c0,$3fbdb700,$3fff0000
- dc.l $9031dc43,$1466b1dc,$3fbeeeb0,$3fff0000
- dc.l $91c3d373,$ab11c336,$3fbbfd6d,$3fff0000
- dc.l $935a2b2f,$13e6e92c,$bfbdb319,$3fff0000
- dc.l $94f4efa8,$fef70961,$3fbdba2b,$3fff0000
- dc.l $96942d37,$20185a00,$3fbe91d5,$3fff0000
- dc.l $9837f051,$8db8a96f,$3fbe8d5a,$3fff0000
- dc.l $99e04593,$20b7fa65,$bfbcde7b,$3fff0000
- dc.l $9b8d39b9,$d54e5539,$bfbebaaf,$3fff0000
- dc.l $9d3ed9a7,$2cffb751,$bfbd86da,$3fff0000
- dc.l $9ef53260,$91a111ae,$bfbebedd,$3fff0000
- dc.l $a0b0510f,$b9714fc2,$3fbcc96e,$3fff0000
- dc.l $a2704303,$0c496819,$bfbec90b,$3fff0000
- dc.l $a43515ae,$09e6809e,$3fbbd1db,$3fff0000
- dc.l $a5fed6a9,$b15138ea,$3fbce5eb,$3fff0000
- dc.l $a7cd93b4,$e965356a,$bfbec274,$3fff0000
- dc.l $a9a15ab4,$ea7c0ef8,$3fbea83c,$3fff0000
- dc.l $ab7a39b5,$a93ed337,$3fbecb00,$3fff0000
- dc.l $ad583eea,$42a14ac6,$3fbe9301,$3fff0000
- dc.l $af3b78ad,$690a4375,$bfbd8367,$3fff0000
- dc.l $b123f581,$d2ac2590,$bfbef05f,$3fff0000
- dc.l $b311c412,$a9112489,$3fbdfb3c,$3fff0000
- dc.l $b504f333,$f9de6484,$3fbeb2fb,$3fff0000
- dc.l $b6fd91e3,$28d17791,$3fbae2cb,$3fff0000
- dc.l $b8fbaf47,$62fb9ee9,$3fbcdc3c,$3fff0000
- dc.l $baff5ab2,$133e45fb,$3fbee9aa,$3fff0000
- dc.l $bd08a39f,$580c36bf,$bfbeaefd,$3fff0000
- dc.l $bf1799b6,$7a731083,$bfbcbf51,$3fff0000
- dc.l $c12c4cca,$66709456,$3fbef88a,$3fff0000
- dc.l $c346ccda,$24976407,$3fbd83b2,$3fff0000
- dc.l $c5672a11,$5506dadd,$3fbdf8ab,$3fff0000
- dc.l $c78d74c8,$abb9b15d,$bfbdfb17,$3fff0000
- dc.l $c9b9bd86,$6e2f27a3,$bfbefe3c,$3fff0000
- dc.l $cbec14fe,$f2727c5d,$bfbbb6f8,$3fff0000
- dc.l $ce248c15,$1f8480e4,$bfbcee53,$3fff0000
- dc.l $d06333da,$ef2b2595,$bfbda4ae,$3fff0000
- dc.l $d2a81d91,$f12ae45a,$3fbc9124,$3fff0000
- dc.l $d4f35aab,$cfedfa1f,$3fbeb243,$3fff0000
- dc.l $d744fcca,$d69d6af4,$3fbde69a,$3fff0000
- dc.l $d99d15c2,$78afd7b6,$bfb8bc61,$3fff0000
- dc.l $dbfbb797,$daf23755,$3fbdf610,$3fff0000
- dc.l $de60f482,$5e0e9124,$bfbd8be1,$3fff0000
- dc.l $e0ccdeec,$2a94e111,$3fbacb12,$3fff0000
- dc.l $e33f8972,$be8a5a51,$3fbb9bfe,$3fff0000
- dc.l $e5b906e7,$7c8348a8,$3fbcf2f4,$3fff0000
- dc.l $e8396a50,$3c4bdc68,$3fbef22f,$3fff0000
- dc.l $eac0c6e7,$dd24392f,$bfbdbf4a,$3fff0000
- dc.l $ed4f301e,$d9942b84,$3fbec01a,$3fff0000
- dc.l $efe4b99b,$dcdaf5cb,$3fbe8cac,$3fff0000
- dc.l $f281773c,$59ffb13a,$bfbcbb3f,$3fff0000
- dc.l $f5257d15,$2486cc2c,$3fbef73a,$3fff0000
- dc.l $f7d0df73,$0ad13bb9,$bfb8b795,$3fff0000
- dc.l $fa83b2db,$722a033a,$3fbef84b,$3fff0000
- dc.l $fd3e0c0c,$f486c175,$bfbef581,$f210d080
- dc.l $22103228,$0004f22e,$6800ff84,$02817fff
- dc.l $ffff0c81,$3fb98000,$6c046000,$00880c81
- dc.l $400d80c0,$6f046000,$007cf200,$0080f23c
- dc.l $44a34280,$0000f22e,$6080ff54,$2f0243fa
- dc.l $fbbcf22e,$4080ff54,$222eff54,$24010281
- dc.l $0000003f,$e981d3c1,$ec822202,$e2819481
- dc.l $06820000,$3ffff227,$e00cf23c,$44a33c80
- dc.l $00002d59,$ff842d59,$ff882d59,$ff8c3d59
- dc.l $ff90f200,$04283d59,$ff94426e,$ff9642ae
- dc.l $ff98d36e,$ff84f23a,$4823fb22,$d36eff90
- dc.l $60000100,$0c813fff,$80006e12,$f2009000
- dc.l $f23c4422,$3f800000,$60ff0000,$07b4222e
- dc.l $ff840c81,$00000000,$6d0660ff,$00000764
- dc.l $60ff0000,$0666f200,$9000f23c,$44003f80
- dc.l $00002210,$00810080,$0001f201,$442260ff
- dc.l $0000077e,$f210d080,$22103228,$0004f22e
- dc.l $6800ff84,$02817fff,$ffff0c81,$3fb98000
- dc.l $6c046000,$ff900c81,$400b9b07,$6f046000
- dc.l $ff84f200,$0080f23a,$54a3fa62,$f22e6080
- dc.l $ff542f02,$43fafac6,$f22e4080,$ff54222e
- dc.l $ff542401,$02810000,$003fe981,$d3c1ec82
- dc.l $2202e281,$94810682,$00003fff,$f227e00c
- dc.l $f2000500,$f23a54a3,$fa2c2d59,$ff84f23a
- dc.l $4923fa2a,$2d59ff88,$2d59ff8c,$f2000428
- dc.l $3d59ff90,$f2000828,$3d59ff94,$426eff96
- dc.l $42aeff98,$f23a4823,$fa14d36e,$ff84d36e
- dc.l $ff90f200,$0080f200,$04a3f23a,$5500fa1e
- dc.l $f23a5580,$fa20f200,$0523f200,$05a3f23a
- dc.l $5522fa1a,$f23a55a2,$fa1cf200,$0523f200
- dc.l $05a3f23a,$5522fa16,$f20001a3,$f2000523
- dc.l $f2000c22,$f2000822,$f21fd030,$f22e4823
- dc.l $ff84f22e,$4822ff90,$f22e4822,$ff84f200
- dc.l $90003d42,$ff84241f,$2d7c8000,$0000ff88
- dc.l $42aeff8c,$123c0000,$f22e4823,$ff8460ff
- dc.l $0000063e,$f2009000,$f23c4400,$3f800000
- dc.l $22100081,$00800001,$f2014422,$60ff0000
- dc.l $06302f00,$32290000,$5beeff54,$02810000
- dc.l $7fff3028,$00000240,$7fff0c40,$3fff6d00
- dc.l $00c00c40,$400c6e00,$00a4f228,$48030000
- dc.l $f2006000,$f23c8800,$00000000,$4a290004
- dc.l $6b5e2f00,$3d690000,$ff842d69,$0004ff88
- dc.l $2d690008,$ff8c41ee,$ff8461ff,$00000b2a
- dc.l $4480d09f,$f22ed080,$ff840c40,$c0016c36
- dc.l $f21f9000,$223c8000,$00000480,$ffffc001
- dc.l $44800c00,$00206c0a,$e0a942a7,$2f0142a7
- dc.l $60280400,$0020e0a9,$2f0142a7,$42a7601a
- dc.l $f229d080,$0000f21f,$90000640,$3fff4840
- dc.l $42a72f3c,$80000000,$2f00f200,$b000123c
- dc.l $0000f21f,$482360ff,$0000054c,$201fc149
- dc.l $4a290000,$6bff0000,$041c60ff,$00000464
- dc.l $4a290004,$6a16201f,$f2009000,$123c0003
- dc.l $f2294800,$000060ff,$0000051c,$201f2049
- dc.l $60ff0000,$05860001,$00008000,$00000000
- dc.l $00000000,$0000422e,$ff652f00,$422eff5c
- dc.l $600c422e,$ff652f00,$1d7c0001,$ff5c48e7
- dc.l $3f003628,$00003d43,$ff580283,$00007fff
- dc.l $28280004,$2a280008,$4a83663c,$263c0000
- dc.l $3ffe4a84,$66162805,$42850483,$00000020
- dc.l $4286edc4,$6000edac,$96866022,$4286edc4
- dc.l $60009686,$edac2e05,$edad4486,$06860000
- dc.l $0020ecaf,$88876006,$06830000,$3ffe3029
- dc.l $00003d40,$ff5a322e,$ff58b181,$02810000
- dc.l $80003d41,$ff5e0280,$00007fff,$22290004
- dc.l $24290008,$4a80663c,$203c0000,$3ffe4a81
- dc.l $66162202,$42820480,$00000020,$4286edc1
- dc.l $6000eda9,$90866022,$4286edc1,$60009086
- dc.l $eda92e02,$edaa4486,$06860000,$0020ecaf
- dc.l $82876006,$06800000,$3ffe2d43,$ff542f00
- dc.l $90834286,$4283227c,$00000000,$4a806c06
- dc.l $201f6000,$006a588f,$4a866e0e,$b2846608
- dc.l $b4856604,$60000136,$65089485,$93844286
- dc.l $52834a80,$670ed683,$d482e391,$55c65289
- dc.l $538060d4,$202eff54,$4a816616,$22024282
- dc.l $04800000,$00204286,$edc16000,$eda99086
- dc.l $601c4286,$edc16000,$6b149086,$eda92e02
- dc.l $edaa4486,$06860000,$0020ecaf,$82870c80
- dc.l $000041fe,$6c2a3d40,$ff902d41,$ff942d42
- dc.l $ff982c2e,$ff543d46,$ff842d44,$ff882d45
- dc.l $ff8cf22e,$4800ff90,$1d7c0001,$ff5d6036
- dc.l $2d41ff94,$2d42ff98,$04800000,$3ffe3d40
- dc.l $ff902c2e,$ff540486,$00003ffe,$2d46ff54
- dc.l $f22e4800,$ff903d46,$ff842d44,$ff882d45
- dc.l $ff8c422e,$ff5d4a2e,$ff5c6722,$2c2eff54
- dc.l $5386b086,$6d186e0e,$b2846608,$b4856604
- dc.l $6000007a,$6508f22e,$4828ff84,$52833c2e
- dc.l $ff5a6c04,$f200001a,$42863c2e,$ff5e7e08
- dc.l $eeae0283,$0000007f,$86861d43,$ff654cdf
- dc.l $00fc201f,$f2009000,$4a2eff5d,$6710123c
- dc.l $0000f23a,$4823fdc0,$60ff0000,$02ca123c
- dc.l $0003f200,$000060ff,$000002bc,$52830c80
- dc.l $00000008,$6c04e1ab,$60024283,$f23c4400
- dc.l $00000000,$422eff5d,$6000ff94,$2c030286
- dc.l $00000001,$4a866700,$ff865283,$3c2eff5a
- dc.l $0a860000,$80003d46,$ff5a6000,$ff723028
- dc.l $00000240,$7fff0c40,$7fff6738,$08280007
- dc.l $00046706,$103c0000,$4e754a40,$66184aa8
- dc.l $0004660c,$4aa80008,$6606103c,$00014e75
- dc.l $103c0004,$4e7561ff,$000007f6,$4e75103c
- dc.l $00064e75,$4aa80008,$66122028,$00040280
- dc.l $7fffffff,$6606103c,$00024e75,$103c0003
- dc.l $4e757fff,$0000ffff,$ffffffff,$ffff4a28
- dc.l $00006a38,$00ae0a00,$0410ff64,$082e0002
- dc.l $ff62660a,$f23c4400,$ff800000,$4e75f22e
- dc.l $d080ffdc,$f22e9000,$ff60f23c,$4480bf80
- dc.l $0000f23c,$44a00000,$00004e75,$00ae0200
- dc.l $0410ff64,$082e0002,$ff62660a,$f23c4400
- dc.l $7f800000,$4e75f22e,$d080ffdc,$f22e9000
- dc.l $ff60f23c,$44803f80,$0000f23c,$44a00000
- dc.l $00004e75,$00ae0100,$2080ff64,$082e0005
- dc.l $ff626608,$f23ad080,$ff6a4e75,$f22ed080
- dc.l $ffdcf22e,$9000ff60,$f227e004,$f23c4500
- dc.l $7f800000,$f23c4523,$00000000,$f21fd020
- dc.l $4e757ffe,$0000ffff,$ffffffff,$fffffffe
- dc.l $0000ffff,$ffffffff,$ffff0000,$00008000
- dc.l $00000000,$00008000,$00008000,$00000000
- dc.l $00004a28,$00006a26,$00ae0800,$0a28ff64
- dc.l $f22e9000,$ff60f23a,$d080ffdc,$f23a4823
- dc.l $ffcaf200,$a800e198,$1d40ff64,$4e75006e
- dc.l $0a28ff66,$f22e9000,$ff60f23a,$d080ffac
- dc.l $f2000023,$f200a800,$e1981d40,$ff644e75
- dc.l $00ae0000,$1048ff64,$12000201,$00c06700
- dc.l $005a3d68,$0000ff84,$2d680004,$ff882d68
- dc.l $0008ff8c,$41eeff84,$48e7c080,$61ff0000
- dc.l $06184cdf,$01030c01,$00406610,$4aa80008
- dc.l $66184a28,$00076612,$60000020,$22280008
- dc.l $02810000,$07ff6700,$001200ae,$00000200
- dc.l $ff646006,$006e1248,$ff664a28,$00006a22
- dc.l $f22e9000,$ff60f23a,$d080ff14,$f23a4823
- dc.l $ff02f200,$a800e198,$00000000,$1d40ff64
- dc.l $4e75f22e,$9000ff60,$f23ad080,$fee6f23a
- dc.l $4823fee0,$f200a800,$e1981d40,$ff644e75
- dc.l $006e1248,$ff66f22e,$9000ff60,$f23ad080
- dc.l $fec2f23a,$4823febc,$f200a800,$e1981d40
- dc.l $ff644e75,$f200a800,$81aeff64,$6020f200
- dc.l $a80081ae,$ff64f294,$000ef281,$0032006e
- dc.l $0208ff66,$600800ae,$08000208,$ff64082e
- dc.l $0001ff62,$66024e75,$f22e9000,$ff60f23c
- dc.l $44803f80,$0000f23a,$48a2fe80,$4e751d7c
- dc.l $0004ff64,$006e0208,$ff664e75,$f22e9000
- dc.l $ff60f228,$48000000,$f200a800,$00800000
- dc.l $0a2881ae,$ff644e75,$f22e9000,$ff60f228
- dc.l $48000000,$f200a800,$81aeff64,$4e754e75
- dc.l $f2294800,$00004a29,$00006b08,$1d7c0001
- dc.l $ff644e75,$1d7c0009,$ff644e75,$f2284800
- dc.l $00004a28,$00006b08,$1d7c0001,$ff644e75
- dc.l $1d7c0009,$ff644e75,$f227b000,$f23c9000
- dc.l $00000000,$f22f4400,$0008f21f,$9000f22f
- dc.l $44220008,$4e75f227,$b000f23c,$90000000
- dc.l $0000f22f,$54000008,$f21f9000,$f22f5422
- dc.l $000c4e75,$f22fd080,$0004f22f,$48220010
- dc.l $4e75f227,$b000f23c,$90000000,$0000f22f
- dc.l $44000008,$f21f9000,$f22f4428,$00084e75
- dc.l $f227b000,$f23c9000,$00000000,$f22f5400
- dc.l $0008f21f,$9000f22f,$5428000c,$4e75f22f
- dc.l $d0800004,$f22f4828,$00104e75,$f227b000
- dc.l $f23c9000,$00000000,$f22f4400,$0008f21f
- dc.l $9000f22f,$44230008,$4e75f227,$b000f23c
- dc.l $90000000,$0000f22f,$54000008,$f21f9000
- dc.l $f22f5423,$000c4e75,$f22fd080,$0004f22f
- dc.l $48230010,$4e75f227,$b000f23c,$90000000
- dc.l $0000f22f,$44000008,$f21f9000,$f22f4420
- dc.l $00084e75,$f227b000,$f23c9000,$00000000
- dc.l $f22f5400,$0008f21f,$9000f22f,$5420000c
- dc.l $4e75f22f,$d0800004,$f22f4820,$00104e75
- dc.l $f22f4418,$00044e75,$f22f5418,$00044e75
- dc.l $f22f4818,$00044e75,$f22f441a,$00044e75
- dc.l $f22f541a,$00044e75,$f22f481a,$00044e75
- dc.l $f22f4404,$00044e75,$f22f5404,$00044e75
- dc.l $f22f4804,$00044e75,$f22f4401,$00044e75
- dc.l $f22f5401,$00044e75,$f22f4801,$00044e75
- dc.l $f22f4403,$00044e75,$f22f5403,$00044e75
- dc.l $f22f4803,$00044e75,$4a280000,$6b10f23c
- dc.l $44000000,$00001d7c,$0004ff64,$4e75f23c
- dc.l $44008000,$00001d7c,$000cff64,$4e754a29
- dc.l $00006bea,$60d84a28,$00006b10,$f23c4400
- dc.l $7f800000,$1d7c0002,$ff644e75,$f23c4400
- dc.l $ff800000,$1d7c000a,$ff644e75,$4a290000
- dc.l $6bea60d8,$4a280000,$6ba460d0,$4a280000
- dc.l $6b00fba2,$60c64a28,$00006b16,$60be4a28
- dc.l $00006b0e,$f23c4400,$3f800000,$422eff64
- dc.l $4e75f23c,$4400bf80,$00001d7c,$0008ff64
- dc.l $4e753fff,$0000c90f,$daa22168,$c235bfff
- dc.l $0000c90f,$daa22168,$c2354a28,$00006b0e
- dc.l $f2009000,$f23a4800,$ffda6000,$fcf2f200
- dc.l $9000f23a,$4800ffd8,$6000fcec,$f23c4480
- dc.l $3f800000,$4a280000,$6a10f23c,$44008000
- dc.l $00001d7c,$000cff64,$4e75f23c,$44000000
- dc.l $00001d7c,$0004ff64,$4e75f23a,$4880fa84
- dc.l $6000fb02,$f2284880,$00006000,$fd30122e
- dc.l $ff4f67ff,$fffff782,$0c010001,$67000078
- dc.l $0c010002,$67ffffff,$fade0c01,$000467ff
- dc.l $fffff766,$60ffffff,$fcea122e,$ff4f67ff
- dc.l $fffffac4,$0c010001,$67ffffff,$faba0c01
- dc.l $000267ff,$fffffab0,$0c010004,$67ffffff
- dc.l $faa660ff,$fffffcbc,$122eff4f,$67ff0000
- dc.l $00440c01,$000167ff,$0000001e,$0c010002
- dc.l $67ffffff,$fa820c01,$000467ff,$00000026
- dc.l $60ffffff,$fc8e1228,$00001029,$0000b101
- dc.l $02010080,$1d41ff65,$4a006a00,$fe526000
- dc.l $fe5e422e,$ff652f00,$12280000,$10290000
- dc.l $b1010201,$00801d41,$ff650c2e,$0004ff4f
- dc.l $660c41e9,$0000201f,$60ffffff,$fc2ef21f
- dc.l $9000f229,$48000000,$4a290000,$6b024e75
- dc.l $1d7c0008,$ff644e75,$122eff4f,$67ffffff
- dc.l $f6a40c01,$00016700,$ff8e0c01,$000267ff
- dc.l $fffff9f4,$0c010004,$67ffffff,$f68860ff
- dc.l $fffffc00,$122eff4f,$67ffffff,$f9da0c01
- dc.l $000167ff,$fffff9d0,$0c010002,$67ffffff
- dc.l $f9c60c01,$000467ff,$fffff9bc,$60ffffff
- dc.l $fbd2122e,$ff4f6700,$ff5a0c01,$00016700
- dc.l $ff360c01,$000267ff,$fffff99c,$0c010004
- dc.l $67ffffff,$ff4060ff,$fffffba8,$122eff4f
- dc.l $67ffffff,$f5000c01,$000167ff,$fffffd92
- dc.l $0c010002,$67ffffff,$fdb60c01,$000467ff
- dc.l $fffff4e2,$60ffffff,$fb7a122e,$ff4f67ff
- dc.l $fffff4d2,$0c010001,$67ffffff,$fd640c01
- dc.l $000267ff,$fffffd88,$0c010004,$67ffffff
- dc.l $f4b460ff,$fffffb4c,$122eff4f,$67ffffff
- dc.l $f9260c01,$000367ff,$fffffb38,$60ffffff
- dc.l $f916122e,$ff4f0c01,$000367ff,$fffffb24
- dc.l $60ffffff,$fb3a2f02,$2f032028,$00042228
- dc.l $0008edc0,$2000671a,$e5a8e9c1,$30228083
- dc.l $e5a92140,$00042141,$00082002,$261f241f
- dc.l $4e75edc1,$2000e5a9,$06820000,$00202141
- dc.l $000442a8,$00082002,$261f241f,$4e75ede8
- dc.l $00000004,$660eede8,$00000008,$67000074
- dc.l $06400020,$42813228,$00000241,$7fffb041
- dc.l $6e1c9240,$30280000,$02408000,$82403141
- dc.l $000061ff,$ffffff82,$103c0000,$4e750c01
- dc.l $00206e20,$e9e80840,$00042140,$00042028
- dc.l $0008e3a8,$21400008,$02688000,$0000103c
- dc.l $00044e75,$04410020,$20280008,$e3a82140
- dc.l $000442a8,$00080268,$80000000,$103c0004
- dc.l $4e750268,$80000000,$103c0001,$4e7551fc
diff --git a/sys/arch/m68k/060sp/fpsp.doc b/sys/arch/m68k/060sp/fpsp.doc
deleted file mode 100644
index de26c359fec..00000000000
--- a/sys/arch/m68k/060sp/fpsp.doc
+++ /dev/null
@@ -1,300 +0,0 @@
-#
-# $OpenBSD: fpsp.doc,v 1.2 1996/05/30 22:14:16 niklas Exp $
-# $NetBSD: fpsp.doc,v 1.2 1996/05/15 19:47:51 is Exp $
-#
-
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-# M68000 Hi-Performance Microprocessor Division
-# M68060 Software Package Production Release
-#
-# M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
-# All rights reserved.
-#
-# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-# To the maximum extent permitted by applicable law,
-# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
-# FOR A PARTICULAR PURPOSE and any warranty against infringement with
-# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-# and any accompanying written materials.
-#
-# To the maximum extent permitted by applicable law,
-# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
-# BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
-# ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
-#
-# Motorola assumes no responsibility for the maintenance and support
-# of the SOFTWARE.
-#
-# You are hereby granted a copyright license to use, modify, and distribute the
-# SOFTWARE so long as this entire notice is retained without alteration
-# in any modified and/or redistributed versions, and that such modified
-# versions are clearly identified as such.
-# No licenses are granted by implication, estoppel or otherwise under any
-# patents or trademarks of Motorola, Inc.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-68060 FLOATING-POINT SOFTWARE PACKAGE (Kernel version)
--------------------------------------------------------
-
-The file fpsp.sa contains the 68060 Floating-Point Software
-Package. This package is essentially a set of exception handlers
-that can be integrated into an operating system.
-These exception handlers emulate Unimplemented FP instructions,
-instructions using unimplemented data types, and instructions
-using unimplemented addressing modes. In addition, this package
-includes exception handlers to provide full IEEE-754 compliant
-exception handling.
-
-Release file format:
---------------------
-The file fpsp.sa is essentially a hexadecimal image of the
-release package. This is the ONLY format which will be supported.
-The hex image was created by assembling the source code and
-then converting the resulting binary output image into an
-ASCII text file. The hexadecimal numbers are listed
-using the Motorola Assembly Syntax assembler directive "dc.l"
-(define constant longword). The file can be converted to other
-assembly syntaxes by using any word processor with a global
-search and replace function.
-
-To assist in assembling and linking this module with other modules,
-the installer should add a symbolic label to the top of the file.
-This will allow calling routines to access the entry points
-of this package.
-
-The source code fpsp.s has also been included but only for
-documentation purposes.
-
-Release file structure:
------------------------
-
-(top of module)
- -----------------
- | | - 128 byte-sized section
- (1) | Call-Out | - 4 bytes per entry (user fills these in)
- | | - example routines in fskeleton.s
- -----------------
- | | - 8 bytes per entry
- (2) | Entry Point | - user does "bra" or "jmp" to this address
- | |
- -----------------
- | | - code section
- (3) ~ ~
- | |
- -----------------
-(bottom of module)
-
-The first section of this module is the "Call-out" section. This section
-is NOT INCLUDED in fpsp.sa (an example "Call-out" section is provided at
-the end of the file fskeleton.s). The purpose of this section is to allow
-the FPSP routines to reference external functions that must be provided
-by the host operating system. This section MUST be exactly 128 bytes in
-size. There are 32 fields, each 4 bytes in size. Each field corresponds
-to a function required by the FPSP (these functions and their location are
-listed in "68060FPSP call-outs" below). Each field entry should contain
-the address of the corresponding function RELATIVE to the starting address
-of the "call-out" section. The "Call-out" section must sit adjacent to the
-fpsp.sa image in memory.
-
-The second section, the "Entry-point" section, is used by external routines
-to access the functions within the FPSP. Since the fpsp.sa hex file contains
-no symbol names, this section contains function entry points that are fixed
-with respect to the top of the package. The currently defined entry-points
-are listed in section "68060 FPSP entry points" below. A calling routine
-would simply execute a "bra" or "jmp" that jumped to the selected function
-entry-point.
-
-For example, if the 68060 hardware took a "Line-F Emulator" exception
-(vector #11), the operating system should execute something similar to:
-
- bra _060FPSP_TOP+128+48
-
-(_060FPSP_TOP is the starting address of the "Call-out" section; the "Call-out"
-section is 128 bytes long; and the F-Line FPSP handler entry point is located
-48 bytes from the top of the "Entry-point" section.)
-
-The third section is the code section. After entering through an "Entry-point",
-the entry code jumps to the appropriate emulation code within the code section.
-
-68060FPSP call-outs: (details in fskeleton.s)
---------------------
-0x000: _060_real_bsun
-0x004: _060_real_snan
-0x008: _060_real_operr
-0x00c: _060_real_ovfl
-0x010: _060_real_unfl
-0x014: _060_real_dz
-0x018: _060_real_inex
-0x01c: _060_real_fline
-0x020: _060_real_fpu_disabled
-0x024: _060_real_trap
-0x028: _060_real_trace
-0x02c: _060_real_access
-0x030: _060_fpsp_done
-
-0x034: (Motorola reserved)
-0x038: (Motorola reserved)
-0x03c: (Motorola reserved)
-
-0x040: _060_imem_read
-0x044: _060_dmem_read
-0x048: _060_dmem_write
-0x04c: _060_imem_read_word
-0x050: _060_imem_read_long
-0x054: _060_dmem_read_byte
-0x058: _060_dmem_read_word
-0x05c: _060_dmem_read_long
-0x060: _060_dmem_write_byte
-0x064: _060_dmem_write_word
-0x068: _060_dmem_write_long
-
-0x06c: (Motorola reserved)
-0x070: (Motorola reserved)
-0x074: (Motorola reserved)
-0x078: (Motorola reserved)
-0x07c: (Motorola reserved)
-
-68060FPSP entry points:
------------------------
-0x000: _060_fpsp_snan
-0x008: _060_fpsp_operr
-0x010: _060_fpsp_ovfl
-0x018: _060_fpsp_unfl
-0x020: _060_fpsp_dz
-0x028: _060_fpsp_inex
-0x030: _060_fpsp_fline
-0x038: _060_fpsp_unsupp
-0x040: _060_fpsp_effadd
-
-
-Miscellaneous:
---------------
-
-_060_fpsp_snan:
-----------------
-- documented in 3.5 of 060SP spec.
-- Basic flow:
- exception taken ---> enter _060_fpsp_snan --|
- |
- always exits through _060_real_snan <----
-
-_060_fpsp_operr:
-----------------
-- documented in 3.5 of 060SP spec.
-- Basic flow:
- exception taken ---> enter _060_fpsp_operr --|
- |
- always exits through _060_real_operr <-----
-
-_060_fpsp_dz:
-----------------
-- documented in 3.7 of 060SP spec.
-- Basic flow:
- exception taken ---> enter _060_fpsp_dz --|
- |
- always exits through _060_real_dz <----
-
-_060_fpsp_inex:
-----------------
-- documented in 3.6 of 060SP spec.
-- Basic flow:
- exception taken ---> enter _060_fpsp_inex --|
- |
- always exits through _060_real_inex <----
-
-_060_fpsp_ovfl:
-----------------
-- documented in 3.4 of 060SP spec.
-- Basic flow:
- exception taken ---> enter _060_fpsp_ovfl --|
- |
- may exit through _060_real_inex <---|
- or |
- may exit through _060_real_ovfl <---|
- or |
- may exit through _060_fpsp_done <---|
-
-_060_fpsp_unfl:
-----------------
-- documented in 3.4 of 060SP spec.
-- Basic flow:
- exception taken ---> enter _060_fpsp_unfl --|
- |
- may exit through _060_real_inex <---|
- or |
- may exit through _060_real_unfl <---|
- or |
- may exit through _060_fpsp_done <---|
-
-_060_fpsp_fline:
------------------
-- not fully documented in 060SP spec.
-- Basic flow:
- exception taken ---> enter _060_fpsp_fline --|
- |
- -------------------------------------------
- | | |
- v v v
- (unimplemented (fpu disabled) (possible F-line illegal)
- stack frame) | v
- | v special case "fmovecr"?
- | exit through |
- | _060_real_fpu_disabled -------------
- | | |
- | ^ v v
- | | (yes) (no)
- | | v v
- | | fpu disabled? exit through
- | | | _060_real_fline
- v | -------------
- | | | |
- | | v v
- | |-----------(yes) (no)
- | |
- |----<------------------------------------|
- |
- |
- |----> may exit through _060_real_trace
- |
- |----> may exit through _060_real_trap
- |
- |----> may exit thorugh _060_real_bsun
- |
- |----> may exit through _060_fpsp_done
-
-_060_fpsp_unsupp:
-------------------
-- documented in 3.1 of 060SP spec.
-- Basic flow:
- exception taken ---> enter _060_fpsp_unsupp --|
- |
- |
- may exit through _060_real_snan <----|
- or |
- may exit through _060_real_operr <----|
- or |
- may exit through _060_real_ovfl <----|
- or |
- may exit through _060_real_unfl <----|
- or |
- may exit through _060_real_inex <----|
- or |
- may exit through _060_real_trace <----|
- or |
- may exit through _060_fpsp_done <----|
-
-_060_fpsp_effadd:
-------------------
-- documented in 3.3 of 060 spec.
-- Basic flow:
- exception taken ---> enter _060_fpsp_effadd --|
- |
- |
- may exit through _060_real_trace <----|
- or |
- may exit through _060_real_fpu_disabled <----|
- or |
- may exit through _060_fpsp_done <----|
diff --git a/sys/arch/m68k/060sp/fpsp.s b/sys/arch/m68k/060sp/fpsp.s
deleted file mode 100644
index 39e5029c157..00000000000
--- a/sys/arch/m68k/060sp/fpsp.s
+++ /dev/null
@@ -1,24795 +0,0 @@
-#
-# $OpenBSD: fpsp.s,v 1.9 2007/04/10 17:47:54 miod Exp $
-# $NetBSD: fpsp.s,v 1.2 1996/05/15 19:48:03 is Exp $
-#
-
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-# M68000 Hi-Performance Microprocessor Division
-# M68060 Software Package Production Release
-#
-# M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
-# All rights reserved.
-#
-# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-# To the maximum extent permitted by applicable law,
-# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
-# FOR A PARTICULAR PURPOSE and any warranty against infringement with
-# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-# and any accompanying written materials.
-#
-# To the maximum extent permitted by applicable law,
-# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
-# BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
-# ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
-#
-# Motorola assumes no responsibility for the maintenance and support
-# of the SOFTWARE.
-#
-# You are hereby granted a copyright license to use, modify, and distribute the
-# SOFTWARE so long as this entire notice is retained without alteration
-# in any modified and/or redistributed versions, and that such modified
-# versions are clearly identified as such.
-# No licenses are granted by implication, estoppel or otherwise under any
-# patents or trademarks of Motorola, Inc.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-#
-# freal.s:
-# This file is appended to the top of the 060FPSP package
-# and contains the entry points into the package. The user, in
-# effect, branches to one of the branch table entries located
-# after _060FPSP_TABLE.
-# Also, subroutine stubs exist in this file (_fpsp_done for
-# example) that are referenced by the FPSP package itself in order
-# to call a given routine. The stub routine actually performs the
-# callout. The FPSP code does a "bsr" to the stub routine. This
-# extra layer of hierarchy adds a slight performance penalty but
-# it makes the FPSP code easier to read and more mainatinable.
-#
-
-set _off_bsun, 0x00
-set _off_snan, 0x04
-set _off_operr, 0x08
-set _off_ovfl, 0x0c
-set _off_unfl, 0x10
-set _off_dz, 0x14
-set _off_inex, 0x18
-set _off_fline, 0x1c
-set _off_fpu_dis, 0x20
-set _off_trap, 0x24
-set _off_trace, 0x28
-set _off_access, 0x2c
-set _off_done, 0x30
-
-set _off_imr, 0x40
-set _off_dmr, 0x44
-set _off_dmw, 0x48
-set _off_irw, 0x4c
-set _off_irl, 0x50
-set _off_drb, 0x54
-set _off_drw, 0x58
-set _off_drl, 0x5c
-set _off_dwb, 0x60
-set _off_dww, 0x64
-set _off_dwl, 0x68
-
-_060FPSP_TABLE:
-
-###############################################################
-
-# Here's the table of ENTRY POINTS for those linking the package.
- bra.l _fpsp_snan
- short 0x0000
- bra.l _fpsp_operr
- short 0x0000
- bra.l _fpsp_ovfl
- short 0x0000
- bra.l _fpsp_unfl
- short 0x0000
- bra.l _fpsp_dz
- short 0x0000
- bra.l _fpsp_inex
- short 0x0000
- bra.l _fpsp_fline
- short 0x0000
- bra.l _fpsp_unsupp
- short 0x0000
- bra.l _fpsp_effadd
- short 0x0000
-
- space 56
-
-###############################################################
- global _fpsp_done
-_fpsp_done:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_done,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_ovfl
-_real_ovfl:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_ovfl,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_unfl
-_real_unfl:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_unfl,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_inex
-_real_inex:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_inex,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_bsun
-_real_bsun:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_bsun,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_operr
-_real_operr:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_operr,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_snan
-_real_snan:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_snan,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_dz
-_real_dz:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_dz,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_fline
-_real_fline:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_fline,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_fpu_disabled
-_real_fpu_disabled:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_fpu_dis,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_trap
-_real_trap:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_trap,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_trace
-_real_trace:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_trace,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_access
-_real_access:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_access,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
-#######################################
-
- global _imem_read
-_imem_read:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_imr,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _dmem_read
-_dmem_read:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_dmr,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _dmem_write
-_dmem_write:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_dmw,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _imem_read_word
-_imem_read_word:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_irw,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _imem_read_long
-_imem_read_long:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_irl,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _dmem_read_byte
-_dmem_read_byte:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_drb,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _dmem_read_word
-_dmem_read_word:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_drw,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _dmem_read_long
-_dmem_read_long:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_drl,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _dmem_write_byte
-_dmem_write_byte:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_dwb,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _dmem_write_word
-_dmem_write_word:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_dww,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _dmem_write_long
-_dmem_write_long:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_dwl,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
-#
-# This file contains a set of define statements for constants
-# in order to promote readability within the corecode itself.
-#
-
-set LOCAL_SIZE, 192 # stack frame size(bytes)
-set LV, -LOCAL_SIZE # stack offset
-
-set EXC_SR, 0x4 # stack status register
-set EXC_PC, 0x6 # stack pc
-set EXC_VOFF, 0xa # stacked vector offset
-set EXC_EA, 0xc # stacked <ea>
-
-set EXC_FP, 0x0 # frame pointer
-
-set EXC_AREGS, -68 # offset of all address regs
-set EXC_DREGS, -100 # offset of all data regs
-set EXC_FPREGS, -36 # offset of all fp regs
-
-set EXC_A7, EXC_AREGS+(7*4) # offset of saved a7
-set OLD_A7, EXC_AREGS+(6*4) # extra copy of saved a7
-set EXC_A6, EXC_AREGS+(6*4) # offset of saved a6
-set EXC_A5, EXC_AREGS+(5*4)
-set EXC_A4, EXC_AREGS+(4*4)
-set EXC_A3, EXC_AREGS+(3*4)
-set EXC_A2, EXC_AREGS+(2*4)
-set EXC_A1, EXC_AREGS+(1*4)
-set EXC_A0, EXC_AREGS+(0*4)
-set EXC_D7, EXC_DREGS+(7*4)
-set EXC_D6, EXC_DREGS+(6*4)
-set EXC_D5, EXC_DREGS+(5*4)
-set EXC_D4, EXC_DREGS+(4*4)
-set EXC_D3, EXC_DREGS+(3*4)
-set EXC_D2, EXC_DREGS+(2*4)
-set EXC_D1, EXC_DREGS+(1*4)
-set EXC_D0, EXC_DREGS+(0*4)
-
-set EXC_FP0, EXC_FPREGS+(0*12) # offset of saved fp0
-set EXC_FP1, EXC_FPREGS+(1*12) # offset of saved fp1
-set EXC_FP2, EXC_FPREGS+(2*12) # offset of saved fp2 (not used)
-
-set FP_SCR1, LV+80 # fp scratch 1
-set FP_SCR1_EX, FP_SCR1+0
-set FP_SCR1_SGN, FP_SCR1+2
-set FP_SCR1_HI, FP_SCR1+4
-set FP_SCR1_LO, FP_SCR1+8
-
-set FP_SCR0, LV+68 # fp scratch 0
-set FP_SCR0_EX, FP_SCR0+0
-set FP_SCR0_SGN, FP_SCR0+2
-set FP_SCR0_HI, FP_SCR0+4
-set FP_SCR0_LO, FP_SCR0+8
-
-set FP_DST, LV+56 # fp destination operand
-set FP_DST_EX, FP_DST+0
-set FP_DST_SGN, FP_DST+2
-set FP_DST_HI, FP_DST+4
-set FP_DST_LO, FP_DST+8
-
-set FP_SRC, LV+44 # fp source operand
-set FP_SRC_EX, FP_SRC+0
-set FP_SRC_SGN, FP_SRC+2
-set FP_SRC_HI, FP_SRC+4
-set FP_SRC_LO, FP_SRC+8
-
-set USER_FPIAR, LV+40 # FP instr address register
-
-set USER_FPSR, LV+36 # FP status register
-set FPSR_CC, USER_FPSR+0 # FPSR condition codes
-set FPSR_QBYTE, USER_FPSR+1 # FPSR qoutient byte
-set FPSR_EXCEPT, USER_FPSR+2 # FPSR exception status byte
-set FPSR_AEXCEPT, USER_FPSR+3 # FPSR accrued exception byte
-
-set USER_FPCR, LV+32 # FP control register
-set FPCR_ENABLE, USER_FPCR+2 # FPCR exception enable
-set FPCR_MODE, USER_FPCR+3 # FPCR rounding mode control
-
-set L_SCR3, LV+28 # integer scratch 3
-set L_SCR2, LV+24 # integer scratch 2
-set L_SCR1, LV+20 # integer scratch 1
-
-set STORE_FLG, LV+19 # flag: operand store (ie. not fcmp/ftst)
-
-set EXC_TEMP2, LV+24 # temporary space
-set EXC_TEMP, LV+16 # temporary space
-
-set DTAG, LV+15 # destination operand type
-set STAG, LV+14 # source operand type
-
-set SPCOND_FLG, LV+10 # flag: special case (see below)
-
-set EXC_CC, LV+8 # saved condition codes
-set EXC_EXTWPTR, LV+4 # saved current PC (active)
-set EXC_EXTWORD, LV+2 # saved extension word
-set EXC_CMDREG, LV+2 # saved extension word
-set EXC_OPWORD, LV+0 # saved operation word
-
-################################
-
-# Helpful macros
-
-set FTEMP, 0 # offsets within an
-set FTEMP_EX, 0 # extended precision
-set FTEMP_SGN, 2 # value saved in memory.
-set FTEMP_HI, 4
-set FTEMP_LO, 8
-set FTEMP_GRS, 12
-
-set LOCAL, 0 # offsets within an
-set LOCAL_EX, 0 # extended precision
-set LOCAL_SGN, 2 # value saved in memory.
-set LOCAL_HI, 4
-set LOCAL_LO, 8
-set LOCAL_GRS, 12
-
-set DST, 0 # offsets within an
-set DST_EX, 0 # extended precision
-set DST_HI, 4 # value saved in memory.
-set DST_LO, 8
-
-set SRC, 0 # offsets within an
-set SRC_EX, 0 # extended precision
-set SRC_HI, 4 # value saved in memory.
-set SRC_LO, 8
-
-set SGL_LO, 0x3f81 # min sgl prec exponent
-set SGL_HI, 0x407e # max sgl prec exponent
-set DBL_LO, 0x3c01 # min dbl prec exponent
-set DBL_HI, 0x43fe # max dbl prec exponent
-set EXT_LO, 0x0 # min ext prec exponent
-set EXT_HI, 0x7ffe # max ext prec exponent
-
-set EXT_BIAS, 0x3fff # extended precision bias
-set SGL_BIAS, 0x007f # single precision bias
-set DBL_BIAS, 0x03ff # double precision bias
-
-set NORM, 0x00 # operand type for STAG/DTAG
-set ZERO, 0x01 # operand type for STAG/DTAG
-set INF, 0x02 # operand type for STAG/DTAG
-set QNAN, 0x03 # operand type for STAG/DTAG
-set DENORM, 0x04 # operand type for STAG/DTAG
-set SNAN, 0x05 # operand type for STAG/DTAG
-set UNNORM, 0x06 # operand type for STAG/DTAG
-
-##################
-# FPSR/FPCR bits #
-##################
-set neg_bit, 0x3 # negative result
-set z_bit, 0x2 # zero result
-set inf_bit, 0x1 # infinite result
-set nan_bit, 0x0 # NAN result
-
-set q_sn_bit, 0x7 # sign bit of quotient byte
-
-set bsun_bit, 7 # branch on unordered
-set snan_bit, 6 # signalling NAN
-set operr_bit, 5 # operand error
-set ovfl_bit, 4 # overflow
-set unfl_bit, 3 # underflow
-set dz_bit, 2 # divide by zero
-set inex2_bit, 1 # inexact result 2
-set inex1_bit, 0 # inexact result 1
-
-set aiop_bit, 7 # accrued inexact operation bit
-set aovfl_bit, 6 # accrued overflow bit
-set aunfl_bit, 5 # accrued underflow bit
-set adz_bit, 4 # accrued dz bit
-set ainex_bit, 3 # accrued inexact bit
-
-#############################
-# FPSR individual bit masks #
-#############################
-set neg_mask, 0x08000000 # negative bit mask (lw)
-set inf_mask, 0x02000000 # infinity bit mask (lw)
-set z_mask, 0x04000000 # zero bit mask (lw)
-set nan_mask, 0x01000000 # nan bit mask (lw)
-
-set neg_bmask, 0x08 # negative bit mask (byte)
-set inf_bmask, 0x02 # infinity bit mask (byte)
-set z_bmask, 0x04 # zero bit mask (byte)
-set nan_bmask, 0x01 # nan bit mask (byte)
-
-set bsun_mask, 0x00008000 # bsun exception mask
-set snan_mask, 0x00004000 # snan exception mask
-set operr_mask, 0x00002000 # operr exception mask
-set ovfl_mask, 0x00001000 # overflow exception mask
-set unfl_mask, 0x00000800 # underflow exception mask
-set dz_mask, 0x00000400 # dz exception mask
-set inex2_mask, 0x00000200 # inex2 exception mask
-set inex1_mask, 0x00000100 # inex1 exception mask
-
-set aiop_mask, 0x00000080 # accrued illegal operation
-set aovfl_mask, 0x00000040 # accrued overflow
-set aunfl_mask, 0x00000020 # accrued underflow
-set adz_mask, 0x00000010 # accrued divide by zero
-set ainex_mask, 0x00000008 # accrued inexact
-
-######################################
-# FPSR combinations used in the FPSP #
-######################################
-set dzinf_mask, inf_mask+dz_mask+adz_mask
-set opnan_mask, nan_mask+operr_mask+aiop_mask
-set nzi_mask, 0x01ffffff #clears N, Z, and I
-set unfinx_mask, unfl_mask+inex2_mask+aunfl_mask+ainex_mask
-set unf2inx_mask, unfl_mask+inex2_mask+ainex_mask
-set ovfinx_mask, ovfl_mask+inex2_mask+aovfl_mask+ainex_mask
-set inx1a_mask, inex1_mask+ainex_mask
-set inx2a_mask, inex2_mask+ainex_mask
-set snaniop_mask, nan_mask+snan_mask+aiop_mask
-set snaniop2_mask, snan_mask+aiop_mask
-set naniop_mask, nan_mask+aiop_mask
-set neginf_mask, neg_mask+inf_mask
-set infaiop_mask, inf_mask+aiop_mask
-set negz_mask, neg_mask+z_mask
-set opaop_mask, operr_mask+aiop_mask
-set unfl_inx_mask, unfl_mask+aunfl_mask+ainex_mask
-set ovfl_inx_mask, ovfl_mask+aovfl_mask+ainex_mask
-
-#########
-# misc. #
-#########
-set rnd_stky_bit, 29 # stky bit pos in longword
-
-set sign_bit, 0x7 # sign bit
-set signan_bit, 0x6 # signalling nan bit
-
-set sgl_thresh, 0x3f81 # minimum sgl exponent
-set dbl_thresh, 0x3c01 # minimum dbl exponent
-
-set x_mode, 0x0 # extended precision
-set s_mode, 0x4 # single precision
-set d_mode, 0x8 # double precision
-
-set rn_mode, 0x0 # round-to-nearest
-set rz_mode, 0x1 # round-to-zero
-set rm_mode, 0x2 # round-tp-minus-infinity
-set rp_mode, 0x3 # round-to-plus-infinity
-
-set mantissalen, 64 # length of mantissa in bits
-
-set BYTE, 1 # len(byte) == 1 byte
-set WORD, 2 # len(word) == 2 bytes
-set LONG, 4 # len(longword) == 2 bytes
-
-set BSUN_VEC, 0xc0 # bsun vector offset
-set INEX_VEC, 0xc4 # inexact vector offset
-set DZ_VEC, 0xc8 # dz vector offset
-set UNFL_VEC, 0xcc # unfl vector offset
-set OPERR_VEC, 0xd0 # operr vector offset
-set OVFL_VEC, 0xd4 # ovfl vector offset
-set SNAN_VEC, 0xd8 # snan vector offset
-
-###########################
-# SPecial CONDition FLaGs #
-###########################
-set ftrapcc_flg, 0x01 # flag bit: ftrapcc exception
-set fbsun_flg, 0x02 # flag bit: bsun exception
-set mia7_flg, 0x04 # flag bit: (a7)+ <ea>
-set mda7_flg, 0x08 # flag bit: -(a7) <ea>
-set fmovm_flg, 0x40 # flag bit: fmovm instruction
-set immed_flg, 0x80 # flag bit: &<data> <ea>
-
-set ftrapcc_bit, 0x0
-set fbsun_bit, 0x1
-set mia7_bit, 0x2
-set mda7_bit, 0x3
-set immed_bit, 0x7
-
-##################################
-# TRANSCENDENTAL "LAST-OP" FLAGS #
-##################################
-set FMUL_OP, 0x0 # fmul instr performed last
-set FDIV_OP, 0x1 # fdiv performed last
-set FADD_OP, 0x2 # fadd performed last
-set FMOV_OP, 0x3 # fmov performed last
-
-#############
-# CONSTANTS #
-#############
-T1: long 0x40C62D38,0xD3D64634 # 16381 LOG2 LEAD
-T2: long 0x3D6F90AE,0xB1E75CC7 # 16381 LOG2 TRAIL
-
-PI: long 0x40000000,0xC90FDAA2,0x2168C235,0x00000000
-PIBY2: long 0x3FFF0000,0xC90FDAA2,0x2168C235,0x00000000
-
-TWOBYPI:
- long 0x3FE45F30,0x6DC9C883
-
-#########################################################################
-# XDEF **************************************************************** #
-# _fpsp_ovfl(): 060FPSP entry point for FP Overflow exception. #
-# #
-# This handler should be the first code executed upon taking the #
-# FP Overflow exception in an operating system. #
-# #
-# XREF **************************************************************** #
-# _imem_read_long() - read instruction longword #
-# fix_skewed_ops() - adjust src operand in fsave frame #
-# set_tag_x() - determine optype of src/dst operands #
-# store_fpreg() - store opclass 0 or 2 result to FP regfile #
-# unnorm_fix() - change UNNORM operands to NORM or ZERO #
-# load_fpn2() - load dst operand from FP regfile #
-# fout() - emulate an opclass 3 instruction #
-# tbl_unsupp - add of table of emulation routines for opclass 0,2 #
-# _fpsp_done() - "callout" for 060FPSP exit (all work done!) #
-# _real_ovfl() - "callout" for Overflow exception enabled code #
-# _real_inex() - "callout" for Inexact exception enabled code #
-# _real_trace() - "callout" for Trace exception code #
-# #
-# INPUT *************************************************************** #
-# - The system stack contains the FP Ovfl exception stack frame #
-# - The fsave frame contains the source operand #
-# #
-# OUTPUT ************************************************************** #
-# Overflow Exception enabled: #
-# - The system stack is unchanged #
-# - The fsave frame contains the adjusted src op for opclass 0,2 #
-# Overflow Exception disabled: #
-# - The system stack is unchanged #
-# - The "exception present" flag in the fsave frame is cleared #
-# #
-# ALGORITHM *********************************************************** #
-# On the 060, if an FP overflow is present as the result of any #
-# instruction, the 060 will take an overflow exception whether the #
-# exception is enabled or disabled in the FPCR. For the disabled case, #
-# This handler emulates the instruction to determine what the correct #
-# default result should be for the operation. This default result is #
-# then stored in either the FP regfile, data regfile, or memory. #
-# Finally, the handler exits through the "callout" _fpsp_done() #
-# denoting that no exceptional conditions exist within the machine. #
-# If the exception is enabled, then this handler must create the #
-# exceptional operand and plave it in the fsave state frame, and store #
-# the default result (only if the instruction is opclass 3). For #
-# exceptions enabled, this handler must exit through the "callout" #
-# _real_ovfl() so that the operating system enabled overflow handler #
-# can handle this case. #
-# Two other conditions exist. First, if overflow was disabled #
-# but the inexact exception was enabled, this handler must exit #
-# through the "callout" _real_inex() regardless of whether the result #
-# was inexact. #
-# Also, in the case of an opclass three instruction where #
-# overflow was disabled and the trace exception was enabled, this #
-# handler must exit through the "callout" _real_trace(). #
-# #
-#########################################################################
-
- global _fpsp_ovfl
-_fpsp_ovfl:
-
-#$# sub.l &24,%sp # make room for src/dst
-
- link.w %a6,&-LOCAL_SIZE # init stack frame
-
- fsave FP_SRC(%a6) # grab the "busy" frame
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FPREGS(%a6) # save fp0-fp1 on stack
-
-# the FPIAR holds the "current PC" of the faulting instruction
- mov.l USER_FPIAR(%a6),EXC_EXTWPTR(%a6)
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch the instruction words
- mov.l %d0,EXC_OPWORD(%a6)
-
-##############################################################################
-
- btst &0x5,EXC_CMDREG(%a6) # is instr an fmove out?
- bne.w fovfl_out
-
-
- lea FP_SRC(%a6),%a0 # pass: ptr to src op
- bsr.l fix_skewed_ops # fix src op
-
-# since, I believe, only NORMs and DENORMs can come through here,
-# maybe we can avoid the subroutine call.
- lea FP_SRC(%a6),%a0 # pass: ptr to src op
- bsr.l set_tag_x # tag the operand type
- mov.b %d0,STAG(%a6) # maybe NORM,DENORM
-
-# bit five of the fp extension word separates the monadic and dyadic operations
-# that can pass through fpsp_ovfl(). remember that fcmp, ftst, and fsincos
-# will never take this exception.
- btst &0x5,1+EXC_CMDREG(%a6) # is operation monadic or dyadic?
- beq.b fovfl_extract # monadic
-
- bfextu EXC_CMDREG(%a6){&6:&3},%d0 # dyadic; load dst reg
- bsr.l load_fpn2 # load dst into FP_DST
-
- lea FP_DST(%a6),%a0 # pass: ptr to dst op
- bsr.l set_tag_x # tag the operand type
- cmpi.b %d0,&UNNORM # is operand an UNNORM?
- bne.b fovfl_op2_done # no
- bsr.l unnorm_fix # yes; convert to NORM,DENORM,or ZERO
-fovfl_op2_done:
- mov.b %d0,DTAG(%a6) # save dst optype tag
-
-fovfl_extract:
-
-#$# mov.l FP_SRC_EX(%a6),TRAP_SRCOP_EX(%a6)
-#$# mov.l FP_SRC_HI(%a6),TRAP_SRCOP_HI(%a6)
-#$# mov.l FP_SRC_LO(%a6),TRAP_SRCOP_LO(%a6)
-#$# mov.l FP_DST_EX(%a6),TRAP_DSTOP_EX(%a6)
-#$# mov.l FP_DST_HI(%a6),TRAP_DSTOP_HI(%a6)
-#$# mov.l FP_DST_LO(%a6),TRAP_DSTOP_LO(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd prec/mode
-
- mov.b 1+EXC_CMDREG(%a6),%d1
- andi.w &0x007f,%d1 # extract extension
-
- andi.l &0x00ff01ff,USER_FPSR(%a6) # zero all but accured field
-
- fmov.l &0x0,%fpcr # zero current control regs
- fmov.l &0x0,%fpsr
-
- lea FP_SRC(%a6),%a0
- lea FP_DST(%a6),%a1
-
-# maybe we can make these entry points ONLY the OVFL entry points of each routine.
- mov.l (tbl_unsupp.l,%pc,%d1.w*4),%d1 # fetch routine addr
- jsr (tbl_unsupp.l,%pc,%d1.l*1)
-
-# the operation has been emulated. the result is in fp0.
-# the EXOP, if an exception occurred, is in fp1.
-# we must save the default result regardless of whether
-# traps are enabled or disabled.
- bfextu EXC_CMDREG(%a6){&6:&3},%d0
- bsr.l store_fpreg
-
-# the exceptional possibilities we have left ourselves with are ONLY overflow
-# and inexact. and, the inexact is such that overflow occurred and was disabled
-# but inexact was enabled.
- btst &ovfl_bit,FPCR_ENABLE(%a6)
- bne.b fovfl_ovfl_on
-
- btst &inex2_bit,FPCR_ENABLE(%a6)
- bne.b fovfl_inex_on
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6
-#$# add.l &24,%sp
- bra.l _fpsp_done
-
-# overflow is enabled AND overflow, of course, occurred. so, we have the EXOP
-# in fp1. now, simply jump to _real_ovfl()!
-fovfl_ovfl_on:
- fmovm.x &0x40,FP_SRC(%a6) # save EXOP (fp1) to stack
-
- mov.w &0xe005,2+FP_SRC(%a6) # save exc status
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- frestore FP_SRC(%a6) # do this after fmovm,other f<op>s!
-
- unlk %a6
-
- bra.l _real_ovfl
-
-# overflow occurred but is disabled. meanwhile, inexact is enabled. therefore,
-# we must jump to real_inex().
-fovfl_inex_on:
-
- fmovm.x &0x40,FP_SRC(%a6) # save EXOP (fp1) to stack
-
- mov.b &0xc4,1+EXC_VOFF(%a6) # vector offset = 0xc4
- mov.w &0xe001,2+FP_SRC(%a6) # save exc status
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- frestore FP_SRC(%a6) # do this after fmovm,other f<op>s!
-
- unlk %a6
-
- bra.l _real_inex
-
-########################################################################
-fovfl_out:
-
-
-#$# mov.l FP_SRC_EX(%a6),TRAP_SRCOP_EX(%a6)
-#$# mov.l FP_SRC_HI(%a6),TRAP_SRCOP_HI(%a6)
-#$# mov.l FP_SRC_LO(%a6),TRAP_SRCOP_LO(%a6)
-
-# the src operand is definitely a NORM(!), so tag it as such
- mov.b &NORM,STAG(%a6) # set src optype tag
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd prec/mode
-
- and.l &0xffff00ff,USER_FPSR(%a6) # zero all but accured field
-
- fmov.l &0x0,%fpcr # zero current control regs
- fmov.l &0x0,%fpsr
-
- lea FP_SRC(%a6),%a0 # pass ptr to src operand
-
- bsr.l fout
-
- btst &ovfl_bit,FPCR_ENABLE(%a6)
- bne.w fovfl_ovfl_on
-
- btst &inex2_bit,FPCR_ENABLE(%a6)
- bne.w fovfl_inex_on
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6
-#$# add.l &24,%sp
-
- btst &0x7,(%sp) # is trace on?
- beq.l _fpsp_done # no
-
- fmov.l %fpiar,0x8(%sp) # "Current PC" is in FPIAR
- mov.w &0x2024,0x6(%sp) # stk fmt = 0x2; voff = 0x024
- bra.l _real_trace
-
-#########################################################################
-# XDEF **************************************************************** #
-# _fpsp_unfl(): 060FPSP entry point for FP Underflow exception. #
-# #
-# This handler should be the first code executed upon taking the #
-# FP Underflow exception in an operating system. #
-# #
-# XREF **************************************************************** #
-# _imem_read_long() - read instruction longword #
-# fix_skewed_ops() - adjust src operand in fsave frame #
-# set_tag_x() - determine optype of src/dst operands #
-# store_fpreg() - store opclass 0 or 2 result to FP regfile #
-# unnorm_fix() - change UNNORM operands to NORM or ZERO #
-# load_fpn2() - load dst operand from FP regfile #
-# fout() - emulate an opclass 3 instruction #
-# tbl_unsupp - add of table of emulation routines for opclass 0,2 #
-# _fpsp_done() - "callout" for 060FPSP exit (all work done!) #
-# _real_ovfl() - "callout" for Overflow exception enabled code #
-# _real_inex() - "callout" for Inexact exception enabled code #
-# _real_trace() - "callout" for Trace exception code #
-# #
-# INPUT *************************************************************** #
-# - The system stack contains the FP Unfl exception stack frame #
-# - The fsave frame contains the source operand #
-# #
-# OUTPUT ************************************************************** #
-# Underflow Exception enabled: #
-# - The system stack is unchanged #
-# - The fsave frame contains the adjusted src op for opclass 0,2 #
-# Underflow Exception disabled: #
-# - The system stack is unchanged #
-# - The "exception present" flag in the fsave frame is cleared #
-# #
-# ALGORITHM *********************************************************** #
-# On the 060, if an FP underflow is present as the result of any #
-# instruction, the 060 will take an underflow exception whether the #
-# exception is enabled or disabled in the FPCR. For the disabled case, #
-# This handler emulates the instruction to determine what the correct #
-# default result should be for the operation. This default result is #
-# then stored in either the FP regfile, data regfile, or memory. #
-# Finally, the handler exits through the "callout" _fpsp_done() #
-# denoting that no exceptional conditions exist within the machine. #
-# If the exception is enabled, then this handler must create the #
-# exceptional operand and plave it in the fsave state frame, and store #
-# the default result (only if the instruction is opclass 3). For #
-# exceptions enabled, this handler must exit through the "callout" #
-# _real_unfl() so that the operating system enabled overflow handler #
-# can handle this case. #
-# Two other conditions exist. First, if underflow was disabled #
-# but the inexact exception was enabled and the result was inexact, #
-# this handler must exit through the "callout" _real_inex(). #
-# was inexact. #
-# Also, in the case of an opclass three instruction where #
-# underflow was disabled and the trace exception was enabled, this #
-# handler must exit through the "callout" _real_trace(). #
-# #
-#########################################################################
-
- global _fpsp_unfl
-_fpsp_unfl:
-
-#$# sub.l &24,%sp # make room for src/dst
-
- link.w %a6,&-LOCAL_SIZE # init stack frame
-
- fsave FP_SRC(%a6) # grab the "busy" frame
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FPREGS(%a6) # save fp0-fp1 on stack
-
-# the FPIAR holds the "current PC" of the faulting instruction
- mov.l USER_FPIAR(%a6),EXC_EXTWPTR(%a6)
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch the instruction words
- mov.l %d0,EXC_OPWORD(%a6)
-
-##############################################################################
-
- btst &0x5,EXC_CMDREG(%a6) # is instr an fmove out?
- bne.w funfl_out
-
-
- lea FP_SRC(%a6),%a0 # pass: ptr to src op
- bsr.l fix_skewed_ops # fix src op
-
- lea FP_SRC(%a6),%a0 # pass: ptr to src op
- bsr.l set_tag_x # tag the operand type
- mov.b %d0,STAG(%a6) # maybe NORM,DENORM
-
-# bit five of the fp ext word separates the monadic and dyadic operations
-# that can pass through fpsp_unfl(). remember that fcmp, and ftst
-# will never take this exception.
- btst &0x5,1+EXC_CMDREG(%a6) # is op monadic or dyadic?
- beq.b funfl_extract # monadic
-
-# now, what's left that's not dyadic is fsincos. we can distinguish it
-# from all dyadics by the '0110xxx pattern
- btst &0x4,1+EXC_CMDREG(%a6) # is op an fsincos?
- bne.b funfl_extract # yes
-
- bfextu EXC_CMDREG(%a6){&6:&3},%d0 # dyadic; load dst reg
- bsr.l load_fpn2 # load dst into FP_DST
-
- lea FP_DST(%a6),%a0 # pass: ptr to dst op
- bsr.l set_tag_x # tag the operand type
- cmpi.b %d0,&UNNORM # is operand an UNNORM?
- bne.b funfl_op2_done # no
- bsr.l unnorm_fix # yes; convert to NORM,DENORM,or ZERO
-funfl_op2_done:
- mov.b %d0,DTAG(%a6) # save dst optype tag
-
-funfl_extract:
-
-#$# mov.l FP_SRC_EX(%a6),TRAP_SRCOP_EX(%a6)
-#$# mov.l FP_SRC_HI(%a6),TRAP_SRCOP_HI(%a6)
-#$# mov.l FP_SRC_LO(%a6),TRAP_SRCOP_LO(%a6)
-#$# mov.l FP_DST_EX(%a6),TRAP_DSTOP_EX(%a6)
-#$# mov.l FP_DST_HI(%a6),TRAP_DSTOP_HI(%a6)
-#$# mov.l FP_DST_LO(%a6),TRAP_DSTOP_LO(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd prec/mode
-
- mov.b 1+EXC_CMDREG(%a6),%d1
- andi.w &0x007f,%d1 # extract extension
-
- andi.l &0x00ff01ff,USER_FPSR(%a6)
-
- fmov.l &0x0,%fpcr # zero current control regs
- fmov.l &0x0,%fpsr
-
- lea FP_SRC(%a6),%a0
- lea FP_DST(%a6),%a1
-
-# maybe we can make these entry points ONLY the OVFL entry points of each routine.
- mov.l (tbl_unsupp.l,%pc,%d1.w*4),%d1 # fetch routine addr
- jsr (tbl_unsupp.l,%pc,%d1.l*1)
-
- bfextu EXC_CMDREG(%a6){&6:&3},%d0
- bsr.l store_fpreg
-
-# The `060 FPU multiplier hardware is such that if the result of a
-# multiply operation is the smallest possible normalized number
-# (0x00000000_80000000_00000000), then the machine will take an
-# underflow exception. Since this is incorrect, we need to check
-# if our emulation, after re-doing the operation, decided that
-# no underflow was called for. We do these checks only in
-# funfl_{unfl,inex}_on() because w/ both exceptions disabled, this
-# special case will simply exit gracefully with the correct result.
-
-# the exceptional possibilities we have left ourselves with are ONLY overflow
-# and inexact. and, the inexact is such that overflow occurred and was disabled
-# but inexact was enabled.
- btst &unfl_bit,FPCR_ENABLE(%a6)
- bne.b funfl_unfl_on
-
-funfl_chkinex:
- btst &inex2_bit,FPCR_ENABLE(%a6)
- bne.b funfl_inex_on
-
-funfl_exit:
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6
-#$# add.l &24,%sp
- bra.l _fpsp_done
-
-# overflow is enabled AND overflow, of course, occurred. so, we have the EXOP
-# in fp1 (don't forget to save fp0). what to do now?
-# well, we simply have to get to go to _real_unfl()!
-funfl_unfl_on:
-
-# The `060 FPU multiplier hardware is such that if the result of a
-# multiply operation is the smallest possible normalized number
-# (0x00000000_80000000_00000000), then the machine will take an
-# underflow exception. Since this is incorrect, we check here to see
-# if our emulation, after re-doing the operation, decided that
-# no underflow was called for.
- btst &unfl_bit,FPSR_EXCEPT(%a6)
- beq.w funfl_chkinex
-
-funfl_unfl_on2:
- fmovm.x &0x40,FP_SRC(%a6) # save EXOP (fp1) to stack
-
- mov.w &0xe003,2+FP_SRC(%a6) # save exc status
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- frestore FP_SRC(%a6) # do this after fmovm,other f<op>s!
-
- unlk %a6
-
- bra.l _real_unfl
-
-# undeflow occurred but is disabled. meanwhile, inexact is enabled. therefore,
-# we must jump to real_inex().
-funfl_inex_on:
-
-# The `060 FPU multiplier hardware is such that if the result of a
-# multiply operation is the smallest possible normalized number
-# (0x00000000_80000000_00000000), then the machine will take an
-# underflow exception.
-# But, whether bogus or not, if inexact is enabled AND it occurred,
-# then we have to branch to real_inex.
-
- btst &inex2_bit,FPSR_EXCEPT(%a6)
- beq.w funfl_exit
-
-funfl_inex_on2:
-
- fmovm.x &0x40,FP_SRC(%a6) # save EXOP to stack
-
- mov.b &0xc4,1+EXC_VOFF(%a6) # vector offset = 0xc4
- mov.w &0xe001,2+FP_SRC(%a6) # save exc status
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- frestore FP_SRC(%a6) # do this after fmovm,other f<op>s!
-
- unlk %a6
-
- bra.l _real_inex
-
-#######################################################################
-funfl_out:
-
-
-#$# mov.l FP_SRC_EX(%a6),TRAP_SRCOP_EX(%a6)
-#$# mov.l FP_SRC_HI(%a6),TRAP_SRCOP_HI(%a6)
-#$# mov.l FP_SRC_LO(%a6),TRAP_SRCOP_LO(%a6)
-
-# the src operand is definitely a NORM(!), so tag it as such
- mov.b &NORM,STAG(%a6) # set src optype tag
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd prec/mode
-
- and.l &0xffff00ff,USER_FPSR(%a6) # zero all but accured field
-
- fmov.l &0x0,%fpcr # zero current control regs
- fmov.l &0x0,%fpsr
-
- lea FP_SRC(%a6),%a0 # pass ptr to src operand
-
- bsr.l fout
-
- btst &unfl_bit,FPCR_ENABLE(%a6)
- bne.w funfl_unfl_on2
-
- btst &inex2_bit,FPCR_ENABLE(%a6)
- bne.w funfl_inex_on2
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6
-#$# add.l &24,%sp
-
- btst &0x7,(%sp) # is trace on?
- beq.l _fpsp_done # no
-
- fmov.l %fpiar,0x8(%sp) # "Current PC" is in FPIAR
- mov.w &0x2024,0x6(%sp) # stk fmt = 0x2; voff = 0x024
- bra.l _real_trace
-
-#########################################################################
-# XDEF **************************************************************** #
-# _fpsp_unsupp(): 060FPSP entry point for FP "Unimplemented #
-# Data Type" exception. #
-# #
-# This handler should be the first code executed upon taking the #
-# FP Unimplemented Data Type exception in an operating system. #
-# #
-# XREF **************************************************************** #
-# _imem_read_{word,long}() - read instruction word/longword #
-# fix_skewed_ops() - adjust src operand in fsave frame #
-# set_tag_x() - determine optype of src/dst operands #
-# store_fpreg() - store opclass 0 or 2 result to FP regfile #
-# unnorm_fix() - change UNNORM operands to NORM or ZERO #
-# load_fpn2() - load dst operand from FP regfile #
-# load_fpn1() - load src operand from FP regfile #
-# fout() - emulate an opclass 3 instruction #
-# tbl_unsupp - add of table of emulation routines for opclass 0,2 #
-# _real_inex() - "callout" to operating system inexact handler #
-# _fpsp_done() - "callout" for exit; work all done #
-# _real_trace() - "callout" for Trace enabled exception #
-# funimp_skew() - adjust fsave src ops to "incorrect" value #
-# _real_snan() - "callout" for SNAN exception #
-# _real_operr() - "callout" for OPERR exception #
-# _real_ovfl() - "callout" for OVFL exception #
-# _real_unfl() - "callout" for UNFL exception #
-# get_packed() - fetch packed operand from memory #
-# #
-# INPUT *************************************************************** #
-# - The system stack contains the "Unimp Data Type" stk frame #
-# - The fsave frame contains the ssrc op (for UNNORM/DENORM) #
-# #
-# OUTPUT ************************************************************** #
-# If Inexact exception (opclass 3): #
-# - The system stack is changed to an Inexact exception stk frame #
-# If SNAN exception (opclass 3): #
-# - The system stack is changed to an SNAN exception stk frame #
-# If OPERR exception (opclass 3): #
-# - The system stack is changed to an OPERR exception stk frame #
-# If OVFL exception (opclass 3): #
-# - The system stack is changed to an OVFL exception stk frame #
-# If UNFL exception (opclass 3): #
-# - The system stack is changed to an UNFL exception stack frame #
-# If Trace exception enabled: #
-# - The system stack is changed to a Trace exception stack frame #
-# Else: (normal case) #
-# - Correct result has been stored as appropriate #
-# #
-# ALGORITHM *********************************************************** #
-# Two main instruction types can enter here: (1) DENORM or UNNORM #
-# unimplemented data types. These can be either opclass 0,2 or 3 #
-# instructions, and (2) PACKED unimplemented data format instructions #
-# also of opclasses 0,2, or 3. #
-# For UNNORM/DENORM opclass 0 and 2, the handler fetches the src #
-# operand from the fsave state frame and the dst operand (if dyadic) #
-# from the FP register file. The instruction is then emulated by #
-# choosing an emulation routine from a table of routines indexed by #
-# instruction type. Once the instruction has been emulated and result #
-# saved, then we check to see if any enabled exceptions resulted from #
-# instruction emulation. If none, then we exit through the "callout" #
-# _fpsp_done(). If there is an enabled FP exception, then we insert #
-# this exception into the FPU in the fsave state frame and then exit #
-# through _fpsp_done(). #
-# PACKED opclass 0 and 2 is similar in how the instruction is #
-# emulated and exceptions handled. The differences occur in how the #
-# handler loads the packed op (by calling get_packed() routine) and #
-# by the fact that a Trace exception could be pending for PACKED ops. #
-# If a Trace exception is pending, then the current exception stack #
-# frame is changed to a Trace exception stack frame and an exit is #
-# made through _real_trace(). #
-# For UNNORM/DENORM opclass 3, the actual move out to memory is #
-# performed by calling the routine fout(). If no exception should occur #
-# as the result of emulation, then an exit either occurs through #
-# _fpsp_done() or through _real_trace() if a Trace exception is pending #
-# (a Trace stack frame must be created here, too). If an FP exception #
-# should occur, then we must create an exception stack frame of that #
-# type and jump to either _real_snan(), _real_operr(), _real_inex(), #
-# _real_unfl(), or _real_ovfl() as appropriate. PACKED opclass 3 #
-# emulation is performed in a similar manner. #
-# #
-#########################################################################
-
-#
-# (1) DENORM and UNNORM (unimplemented) data types:
-#
-# post-instruction
-# *****************
-# * EA *
-# pre-instruction * *
-# ***************** *****************
-# * 0x0 * 0x0dc * * 0x3 * 0x0dc *
-# ***************** *****************
-# * Next * * Next *
-# * PC * * PC *
-# ***************** *****************
-# * SR * * SR *
-# ***************** *****************
-#
-# (2) PACKED format (unsupported) opclasses two and three:
-# *****************
-# * EA *
-# * *
-# *****************
-# * 0x2 * 0x0dc *
-# *****************
-# * Next *
-# * PC *
-# *****************
-# * SR *
-# *****************
-#
- global _fpsp_unsupp
-_fpsp_unsupp:
-
- link.w %a6,&-LOCAL_SIZE # init stack frame
-
- fsave FP_SRC(%a6) # save fp state
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FPREGS(%a6) # save fp0-fp1 on stack
-
- btst &0x5,EXC_SR(%a6) # user or supervisor mode?
- bne.b fu_s
-fu_u:
- mov.l %usp,%a0 # fetch user stack pointer
- mov.l %a0,EXC_A7(%a6) # save on stack
- bra.b fu_cont
-# if the exception is an opclass zero or two unimplemented data type
-# exception, then the a7' calculated here is wrong since it doesn't
-# stack an ea. however, we don't need an a7' for this case anyways.
-fu_s:
- lea 0x4+EXC_EA(%a6),%a0 # load old a7'
- mov.l %a0,EXC_A7(%a6) # save on stack
-
-fu_cont:
-
-# the FPIAR holds the "current PC" of the faulting instruction
-# the FPIAR should be set correctly for ALL exceptions passing through
-# this point.
- mov.l USER_FPIAR(%a6),EXC_EXTWPTR(%a6)
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch the instruction words
- mov.l %d0,EXC_OPWORD(%a6) # store OPWORD and EXTWORD
-
-############################
-
- clr.b SPCOND_FLG(%a6) # clear special condition flag
-
-# Separate opclass three (fpn-to-mem) ops since they have a different
-# stack frame and protocol.
- btst &0x5,EXC_CMDREG(%a6) # is it an fmove out?
- bne.w fu_out # yes
-
-# Separate packed opclass two instructions.
- bfextu EXC_CMDREG(%a6){&0:&6},%d0
- cmpi.b %d0,&0x13
- beq.w fu_in_pack
-
-
-# I'm not sure at this point what FPSR bits are valid for this instruction.
-# so, since the emulation routines re-create them anyways, zero exception field
- andi.l &0x00ff00ff,USER_FPSR(%a6) # zero exception field
-
- fmov.l &0x0,%fpcr # zero current control regs
- fmov.l &0x0,%fpsr
-
-# Opclass two w/ memory-to-fpn operation will have an incorrect extended
-# precision format if the src format was single or double and the
-# source data type was an INF, NAN, DENORM, or UNNORM
- lea FP_SRC(%a6),%a0 # pass ptr to input
- bsr.l fix_skewed_ops
-
-# we don't know whether the src operand or the dst operand (or both) is the
-# UNNORM or DENORM. call the function that tags the operand type. if the
-# input is an UNNORM, then convert it to a NORM, DENORM, or ZERO.
- lea FP_SRC(%a6),%a0 # pass: ptr to src op
- bsr.l set_tag_x # tag the operand type
- cmpi.b %d0,&UNNORM # is operand an UNNORM?
- bne.b fu_op2 # no
- bsr.l unnorm_fix # yes; convert to NORM,DENORM,or ZERO
-
-fu_op2:
- mov.b %d0,STAG(%a6) # save src optype tag
-
- bfextu EXC_CMDREG(%a6){&6:&3},%d0 # dyadic; load dst reg
-
-# bit five of the fp extension word separates the monadic and dyadic operations
-# at this point
- btst &0x5,1+EXC_CMDREG(%a6) # is operation monadic or dyadic?
- beq.b fu_extract # monadic
- cmpi.b 1+EXC_CMDREG(%a6),&0x3a # is operation an ftst?
- beq.b fu_extract # yes, so it's monadic, too
-
- bsr.l load_fpn2 # load dst into FP_DST
-
- lea FP_DST(%a6),%a0 # pass: ptr to dst op
- bsr.l set_tag_x # tag the operand type
- cmpi.b %d0,&UNNORM # is operand an UNNORM?
- bne.b fu_op2_done # no
- bsr.l unnorm_fix # yes; convert to NORM,DENORM,or ZERO
-fu_op2_done:
- mov.b %d0,DTAG(%a6) # save dst optype tag
-
-fu_extract:
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # fetch rnd mode/prec
-
- bfextu 1+EXC_CMDREG(%a6){&1:&7},%d1 # extract extension
-
- lea FP_SRC(%a6),%a0
- lea FP_DST(%a6),%a1
-
- mov.l (tbl_unsupp.l,%pc,%d1.l*4),%d1 # fetch routine addr
- jsr (tbl_unsupp.l,%pc,%d1.l*1)
-
-#
-# Exceptions in order of precedence:
-# BSUN : none
-# SNAN : all dyadic ops
-# OPERR : fsqrt(-NORM)
-# OVFL : all except ftst,fcmp
-# UNFL : all except ftst,fcmp
-# DZ : fdiv
-# INEX2 : all except ftst,fcmp
-# INEX1 : none (packed doesn't go through here)
-#
-
-# we determine the highest priority exception(if any) set by the
-# emulation routine that has also been enabled by the user.
- mov.b FPCR_ENABLE(%a6),%d0 # fetch exceptions set
- bne.b fu_in_ena # some are enabled
-
-fu_in_cont:
-# fcmp and ftst do not store any result.
- mov.b 1+EXC_CMDREG(%a6),%d0 # fetch extension
- andi.b &0x38,%d0 # extract bits 3-5
- cmpi.b %d0,&0x38 # is instr fcmp or ftst?
- beq.b fu_in_exit # yes
-
- bfextu EXC_CMDREG(%a6){&6:&3},%d0 # dyadic; load dst reg
- bsr.l store_fpreg # store the result
-
-fu_in_exit:
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6
-
- bra.l _fpsp_done
-
-fu_in_ena:
- and.b FPSR_EXCEPT(%a6),%d0 # keep only ones enabled
- bfffo %d0{&24:&8},%d0 # find highest priority exception
- bne.b fu_in_exc # there is at least one set
-
-#
-# No exceptions occurred that were also enabled. Now:
-#
-# if (OVFL && ovfl_disabled && inexact_enabled) {
-# branch to _real_inex() (even if the result was exact!);
-# } else {
-# save the result in the proper fp reg (unless the op is fcmp or ftst);
-# return;
-# }
-#
- btst &ovfl_bit,FPSR_EXCEPT(%a6) # was overflow set?
- beq.b fu_in_cont # no
-
-fu_in_ovflchk:
- btst &inex2_bit,FPCR_ENABLE(%a6) # was inexact enabled?
- beq.b fu_in_cont # no
- bra.w fu_in_exc_ovfl # go insert overflow frame
-
-#
-# An exception occurred and that exception was enabled:
-#
-# shift enabled exception field into lo byte of d0;
-# if (((INEX2 || INEX1) && inex_enabled && OVFL && ovfl_disabled) ||
-# ((INEX2 || INEX1) && inex_enabled && UNFL && unfl_disabled)) {
-# /*
-# * this is the case where we must call _real_inex() now or else
-# * there will be no other way to pass it the exceptional operand
-# */
-# call _real_inex();
-# } else {
-# restore exc state (SNAN||OPERR||OVFL||UNFL||DZ||INEX) into the FPU;
-# }
-#
-fu_in_exc:
- subi.l &24,%d0 # fix offset to be 0-8
- cmpi.b %d0,&0x6 # is exception INEX? (6)
- bne.b fu_in_exc_exit # no
-
-# the enabled exception was inexact
- btst &unfl_bit,FPSR_EXCEPT(%a6) # did disabled underflow occur?
- bne.w fu_in_exc_unfl # yes
- btst &ovfl_bit,FPSR_EXCEPT(%a6) # did disabled overflow occur?
- bne.w fu_in_exc_ovfl # yes
-
-# here, we insert the correct fsave status value into the fsave frame for the
-# corresponding exception. the operand in the fsave frame should be the original
-# src operand.
-fu_in_exc_exit:
- mov.l %d0,-(%sp) # save d0
- bsr.l funimp_skew # skew sgl or dbl inputs
- mov.l (%sp)+,%d0 # restore d0
-
- mov.w (tbl_except.b,%pc,%d0.w*2),2+FP_SRC(%a6) # create exc status
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- frestore FP_SRC(%a6) # restore src op
-
- unlk %a6
-
- bra.l _fpsp_done
-
-tbl_except:
- short 0xe000,0xe006,0xe004,0xe005
- short 0xe003,0xe002,0xe001,0xe001
-
-fu_in_exc_unfl:
- mov.w &0x4,%d0
- bra.b fu_in_exc_exit
-fu_in_exc_ovfl:
- mov.w &0x03,%d0
- bra.b fu_in_exc_exit
-
-# If the input operand to this operation was opclass two and a single
-# or double precision denorm, inf, or nan, the operand needs to be
-# "corrected" in order to have the proper equivalent extended precision
-# number.
- global fix_skewed_ops
-fix_skewed_ops:
- bfextu EXC_CMDREG(%a6){&0:&6},%d0 # extract opclass,src fmt
- cmpi.b %d0,&0x11 # is class = 2 & fmt = sgl?
- beq.b fso_sgl # yes
- cmpi.b %d0,&0x15 # is class = 2 & fmt = dbl?
- beq.b fso_dbl # yes
- rts # no
-
-fso_sgl:
- mov.w LOCAL_EX(%a0),%d0 # fetch src exponent
- andi.w &0x7fff,%d0 # strip sign
- cmpi.w %d0,&0x3f80 # is |exp| == $3f80?
- beq.b fso_sgl_dnrm_zero # yes
- cmpi.w %d0,&0x407f # no; is |exp| == $407f?
- beq.b fso_infnan # yes
- rts # no
-
-fso_sgl_dnrm_zero:
- andi.l &0x7fffffff,LOCAL_HI(%a0) # clear j-bit
- beq.b fso_zero # it's a skewed zero
-fso_sgl_dnrm:
-# here, we count on norm not to alter a0...
- bsr.l norm # normalize mantissa
- neg.w %d0 # -shft amt
- addi.w &0x3f81,%d0 # adjust new exponent
- andi.w &0x8000,LOCAL_EX(%a0) # clear old exponent
- or.w %d0,LOCAL_EX(%a0) # insert new exponent
- rts
-
-fso_zero:
- andi.w &0x8000,LOCAL_EX(%a0) # clear bogus exponent
- rts
-
-fso_infnan:
- andi.b &0x7f,LOCAL_HI(%a0) # clear j-bit
- ori.w &0x7fff,LOCAL_EX(%a0) # make exponent = $7fff
- rts
-
-fso_dbl:
- mov.w LOCAL_EX(%a0),%d0 # fetch src exponent
- andi.w &0x7fff,%d0 # strip sign
- cmpi.w %d0,&0x3c00 # is |exp| == $3c00?
- beq.b fso_dbl_dnrm_zero # yes
- cmpi.w %d0,&0x43ff # no; is |exp| == $43ff?
- beq.b fso_infnan # yes
- rts # no
-
-fso_dbl_dnrm_zero:
- andi.l &0x7fffffff,LOCAL_HI(%a0) # clear j-bit
- bne.b fso_dbl_dnrm # it's a skewed denorm
- tst.l LOCAL_LO(%a0) # is it a zero?
- beq.b fso_zero # yes
-fso_dbl_dnrm:
-# here, we count on norm not to alter a0...
- bsr.l norm # normalize mantissa
- neg.w %d0 # -shft amt
- addi.w &0x3c01,%d0 # adjust new exponent
- andi.w &0x8000,LOCAL_EX(%a0) # clear old exponent
- or.w %d0,LOCAL_EX(%a0) # insert new exponent
- rts
-
-#################################################################
-
-# fmove out took an unimplemented data type exception.
-# the src operand is in FP_SRC. Call _fout() to write out the result and
-# to determine which exceptions, if any, to take.
-fu_out:
-
-# Separate packed move outs from the UNNORM and DENORM move outs.
- bfextu EXC_CMDREG(%a6){&3:&3},%d0
- cmpi.b %d0,&0x3
- beq.w fu_out_pack
- cmpi.b %d0,&0x7
- beq.w fu_out_pack
-
-
-# I'm not sure at this point what FPSR bits are valid for this instruction.
-# so, since the emulation routines re-create them anyways, zero exception field.
-# fmove out doesn't affect ccodes.
- and.l &0xffff00ff,USER_FPSR(%a6) # zero exception field
-
- fmov.l &0x0,%fpcr # zero current control regs
- fmov.l &0x0,%fpsr
-
-# the src can ONLY be a DENORM or an UNNORM! so, don't make any big subroutine
-# call here. just figure out what it is...
- mov.w FP_SRC_EX(%a6),%d0 # get exponent
- andi.w &0x7fff,%d0 # strip sign
- beq.b fu_out_denorm # it's a DENORM
-
- lea FP_SRC(%a6),%a0
- bsr.l unnorm_fix # yes; fix it
-
- mov.b %d0,STAG(%a6)
-
- bra.b fu_out_cont
-fu_out_denorm:
- mov.b &DENORM,STAG(%a6)
-fu_out_cont:
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # fetch rnd mode/prec
-
- lea FP_SRC(%a6),%a0 # pass ptr to src operand
-
- mov.l (%a6),EXC_A6(%a6) # in case a6 changes
- bsr.l fout # call fmove out routine
-
-# Exceptions in order of precedence:
-# BSUN : none
-# SNAN : none
-# OPERR : fmove.{b,w,l} out of large UNNORM
-# OVFL : fmove.{s,d}
-# UNFL : fmove.{s,d,x}
-# DZ : none
-# INEX2 : all
-# INEX1 : none (packed doesn't travel through here)
-
-# determine the highest priority exception(if any) set by the
-# emulation routine that has also been enabled by the user.
- mov.b FPCR_ENABLE(%a6),%d0 # fetch exceptions enabled
- bne.w fu_out_ena # some are enabled
-
-fu_out_done:
-
- mov.l EXC_A6(%a6),(%a6) # in case a6 changed
-
-# on extended precision opclass three instructions using pre-decrement or
-# post-increment addressing mode, the address register is not updated. is the
-# address register was the stack pointer used from user mode, then let's update
-# it here. if it was used from supervisor mode, then we have to handle this
-# as a special case.
- btst &0x5,EXC_SR(%a6)
- bne.b fu_out_done_s
-
- mov.l EXC_A7(%a6),%a0 # restore a7
- mov.l %a0,%usp
-
-fu_out_done_cont:
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6
-
- btst &0x7,(%sp) # is trace on?
- bne.b fu_out_trace # yes
-
- bra.l _fpsp_done
-
-# is the ea mode pre-decrement of the stack pointer from supervisor mode?
-# ("fmov.x fpm,-(a7)") if so,
-fu_out_done_s:
- cmpi.b SPCOND_FLG(%a6),&mda7_flg
- bne.b fu_out_done_cont
-
-# the extended precision result is still in fp0. but, we need to save it
-# somewhere on the stack until we can copy it to its final resting place.
-# here, we're counting on the top of the stack to be the old place-holders
-# for fp0/fp1 which have already been restored. that way, we can write
-# over those destinations with the shifted stack frame.
- fmovm.x &0x80,FP_SRC(%a6) # put answer on stack
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- mov.l (%a6),%a6 # restore frame pointer
-
- mov.l LOCAL_SIZE+EXC_SR(%sp),LOCAL_SIZE+EXC_SR-0xc(%sp)
- mov.l LOCAL_SIZE+2+EXC_PC(%sp),LOCAL_SIZE+2+EXC_PC-0xc(%sp)
-
-# now, copy the result to the proper place on the stack
- mov.l LOCAL_SIZE+FP_SRC_EX(%sp),LOCAL_SIZE+EXC_SR+0x0(%sp)
- mov.l LOCAL_SIZE+FP_SRC_HI(%sp),LOCAL_SIZE+EXC_SR+0x4(%sp)
- mov.l LOCAL_SIZE+FP_SRC_LO(%sp),LOCAL_SIZE+EXC_SR+0x8(%sp)
-
- add.l &LOCAL_SIZE-0x8,%sp
-
- btst &0x7,(%sp)
- bne.b fu_out_trace
-
- bra.l _fpsp_done
-
-fu_out_ena:
- and.b FPSR_EXCEPT(%a6),%d0 # keep only ones enabled
- bfffo %d0{&24:&8},%d0 # find highest priority exception
- bne.b fu_out_exc # there is at least one set
-
-# no exceptions were set.
-# if a disabled overflow occurred and inexact was enabled but the result
-# was exact, then a branch to _real_inex() is made.
- btst &ovfl_bit,FPSR_EXCEPT(%a6) # was overflow set?
- beq.w fu_out_done # no
-
-fu_out_ovflchk:
- btst &inex2_bit,FPCR_ENABLE(%a6) # was inexact enabled?
- beq.w fu_out_done # no
- bra.w fu_inex # yes
-
-#
-# The fp move out that took the "Unimplemented Data Type" exception was
-# being traced. Since the stack frames are similar, get the "current" PC
-# from FPIAR and put it in the trace stack frame then jump to _real_trace().
-#
-# UNSUPP FRAME TRACE FRAME
-# ***************** *****************
-# * EA * * Current *
-# * * * PC *
-# ***************** *****************
-# * 0x3 * 0x0dc * * 0x2 * 0x024 *
-# ***************** *****************
-# * Next * * Next *
-# * PC * * PC *
-# ***************** *****************
-# * SR * * SR *
-# ***************** *****************
-#
-fu_out_trace:
- mov.w &0x2024,0x6(%sp)
- fmov.l %fpiar,0x8(%sp)
- bra.l _real_trace
-
-# an exception occurred and that exception was enabled.
-fu_out_exc:
- subi.l &24,%d0 # fix offset to be 0-8
-
-# we don't mess with the existing fsave frame. just re-insert it and
-# jump to the "_real_{}()" handler...
- mov.w (tbl_fu_out.b,%pc,%d0.w*2),%d0
- jmp (tbl_fu_out.b,%pc,%d0.w*1)
-
- swbeg &0x8
-tbl_fu_out:
- short tbl_fu_out - tbl_fu_out # BSUN can't happen
- short tbl_fu_out - tbl_fu_out # SNAN can't happen
- short fu_operr - tbl_fu_out # OPERR
- short fu_ovfl - tbl_fu_out # OVFL
- short fu_unfl - tbl_fu_out # UNFL
- short tbl_fu_out - tbl_fu_out # DZ can't happen
- short fu_inex - tbl_fu_out # INEX2
- short tbl_fu_out - tbl_fu_out # INEX1 won't make it here
-
-# for snan,operr,ovfl,unfl, src op is still in FP_SRC so just
-# frestore it.
-fu_snan:
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- mov.w &0x30d8,EXC_VOFF(%a6) # vector offset = 0xd8
- mov.w &0xe006,2+FP_SRC(%a6)
-
- frestore FP_SRC(%a6)
-
- unlk %a6
-
-
- bra.l _real_snan
-
-fu_operr:
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- mov.w &0x30d0,EXC_VOFF(%a6) # vector offset = 0xd0
- mov.w &0xe004,2+FP_SRC(%a6)
-
- frestore FP_SRC(%a6)
-
- unlk %a6
-
-
- bra.l _real_operr
-
-fu_ovfl:
- fmovm.x &0x40,FP_SRC(%a6) # save EXOP to the stack
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- mov.w &0x30d4,EXC_VOFF(%a6) # vector offset = 0xd4
- mov.w &0xe005,2+FP_SRC(%a6)
-
- frestore FP_SRC(%a6) # restore EXOP
-
- unlk %a6
-
- bra.l _real_ovfl
-
-# underflow can happen for extended precision. extended precision opclass
-# three instruction exceptions don't update the stack pointer. so, if the
-# exception occurred from user mode, then simply update a7 and exit normally.
-# if the exception occurred from supervisor mode, check if
-fu_unfl:
- mov.l EXC_A6(%a6),(%a6) # restore a6
-
- btst &0x5,EXC_SR(%a6)
- bne.w fu_unfl_s
-
- mov.l EXC_A7(%a6),%a0 # restore a7 whether we need
- mov.l %a0,%usp # to or not...
-
-fu_unfl_cont:
- fmovm.x &0x40,FP_SRC(%a6) # save EXOP to the stack
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- mov.w &0x30cc,EXC_VOFF(%a6) # vector offset = 0xcc
- mov.w &0xe003,2+FP_SRC(%a6)
-
- frestore FP_SRC(%a6) # restore EXOP
-
- unlk %a6
-
- bra.l _real_unfl
-
-fu_unfl_s:
- cmpi.b SPCOND_FLG(%a6),&mda7_flg # was the <ea> mode -(sp)?
- bne.b fu_unfl_cont
-
-# the extended precision result is still in fp0. but, we need to save it
-# somewhere on the stack until we can copy it to its final resting place
-# (where the exc frame is currently). make sure it's not at the top of the
-# frame or it will get overwritten when the exc stack frame is shifted "down".
- fmovm.x &0x80,FP_SRC(%a6) # put answer on stack
- fmovm.x &0x40,FP_DST(%a6) # put EXOP on stack
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- mov.w &0x30cc,EXC_VOFF(%a6) # vector offset = 0xcc
- mov.w &0xe003,2+FP_DST(%a6)
-
- frestore FP_DST(%a6) # restore EXOP
-
- mov.l (%a6),%a6 # restore frame pointer
-
- mov.l LOCAL_SIZE+EXC_SR(%sp),LOCAL_SIZE+EXC_SR-0xc(%sp)
- mov.l LOCAL_SIZE+2+EXC_PC(%sp),LOCAL_SIZE+2+EXC_PC-0xc(%sp)
- mov.l LOCAL_SIZE+EXC_EA(%sp),LOCAL_SIZE+EXC_EA-0xc(%sp)
-
-# now, copy the result to the proper place on the stack
- mov.l LOCAL_SIZE+FP_SRC_EX(%sp),LOCAL_SIZE+EXC_SR+0x0(%sp)
- mov.l LOCAL_SIZE+FP_SRC_HI(%sp),LOCAL_SIZE+EXC_SR+0x4(%sp)
- mov.l LOCAL_SIZE+FP_SRC_LO(%sp),LOCAL_SIZE+EXC_SR+0x8(%sp)
-
- add.l &LOCAL_SIZE-0x8,%sp
-
- bra.l _real_unfl
-
-# fmove in and out enter here.
-fu_inex:
- fmovm.x &0x40,FP_SRC(%a6) # save EXOP to the stack
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- mov.w &0x30c4,EXC_VOFF(%a6) # vector offset = 0xc4
- mov.w &0xe001,2+FP_SRC(%a6)
-
- frestore FP_SRC(%a6) # restore EXOP
-
- unlk %a6
-
-
- bra.l _real_inex
-
-#########################################################################
-#########################################################################
-fu_in_pack:
-
-
-# I'm not sure at this point what FPSR bits are valid for this instruction.
-# so, since the emulation routines re-create them anyways, zero exception field
- andi.l &0x0ff00ff,USER_FPSR(%a6) # zero exception field
-
- fmov.l &0x0,%fpcr # zero current control regs
- fmov.l &0x0,%fpsr
-
- bsr.l get_packed # fetch packed src operand
-
- lea FP_SRC(%a6),%a0 # pass ptr to src
- bsr.l set_tag_x # set src optype tag
-
- mov.b %d0,STAG(%a6) # save src optype tag
-
- bfextu EXC_CMDREG(%a6){&6:&3},%d0 # dyadic; load dst reg
-
-# bit five of the fp extension word separates the monadic and dyadic operations
-# at this point
- btst &0x5,1+EXC_CMDREG(%a6) # is operation monadic or dyadic?
- beq.b fu_extract_p # monadic
- cmpi.b 1+EXC_CMDREG(%a6),&0x3a # is operation an ftst?
- beq.b fu_extract_p # yes, so it's monadic, too
-
- bsr.l load_fpn2 # load dst into FP_DST
-
- lea FP_DST(%a6),%a0 # pass: ptr to dst op
- bsr.l set_tag_x # tag the operand type
- cmpi.b %d0,&UNNORM # is operand an UNNORM?
- bne.b fu_op2_done_p # no
- bsr.l unnorm_fix # yes; convert to NORM,DENORM,or ZERO
-fu_op2_done_p:
- mov.b %d0,DTAG(%a6) # save dst optype tag
-
-fu_extract_p:
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # fetch rnd mode/prec
-
- bfextu 1+EXC_CMDREG(%a6){&1:&7},%d1 # extract extension
-
- lea FP_SRC(%a6),%a0
- lea FP_DST(%a6),%a1
-
- mov.l (tbl_unsupp.l,%pc,%d1.l*4),%d1 # fetch routine addr
- jsr (tbl_unsupp.l,%pc,%d1.l*1)
-
-#
-# Exceptions in order of precedence:
-# BSUN : none
-# SNAN : all dyadic ops
-# OPERR : fsqrt(-NORM)
-# OVFL : all except ftst,fcmp
-# UNFL : all except ftst,fcmp
-# DZ : fdiv
-# INEX2 : all except ftst,fcmp
-# INEX1 : all
-#
-
-# we determine the highest priority exception(if any) set by the
-# emulation routine that has also been enabled by the user.
- mov.b FPCR_ENABLE(%a6),%d0 # fetch exceptions enabled
- bne.w fu_in_ena_p # some are enabled
-
-fu_in_cont_p:
-# fcmp and ftst do not store any result.
- mov.b 1+EXC_CMDREG(%a6),%d0 # fetch extension
- andi.b &0x38,%d0 # extract bits 3-5
- cmpi.b %d0,&0x38 # is instr fcmp or ftst?
- beq.b fu_in_exit_p # yes
-
- bfextu EXC_CMDREG(%a6){&6:&3},%d0 # dyadic; load dst reg
- bsr.l store_fpreg # store the result
-
-fu_in_exit_p:
-
- btst &0x5,EXC_SR(%a6) # user or supervisor?
- bne.w fu_in_exit_s_p # supervisor
-
- mov.l EXC_A7(%a6),%a0 # update user a7
- mov.l %a0,%usp
-
-fu_in_exit_cont_p:
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6 # unravel stack frame
-
- btst &0x7,(%sp) # is trace on?
- bne.w fu_trace_p # yes
-
- bra.l _fpsp_done # exit to os
-
-# the exception occurred in supervisor mode. check to see if the
-# addressing mode was (a7)+. if so, we'll need to shift the
-# stack frame "up".
-fu_in_exit_s_p:
- btst &mia7_bit,SPCOND_FLG(%a6) # was ea mode (a7)+
- beq.b fu_in_exit_cont_p # no
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6 # unravel stack frame
-
-# shift the stack frame "up". we don't really care about the <ea> field.
- mov.l 0x4(%sp),0x10(%sp)
- mov.l 0x0(%sp),0xc(%sp)
- add.l &0xc,%sp
-
- btst &0x7,(%sp) # is trace on?
- bne.w fu_trace_p # yes
-
- bra.l _fpsp_done # exit to os
-
-fu_in_ena_p:
- and.b FPSR_EXCEPT(%a6),%d0 # keep only ones enabled & set
- bfffo %d0{&24:&8},%d0 # find highest priority exception
- bne.b fu_in_exc_p # at least one was set
-
-#
-# No exceptions occurred that were also enabled. Now:
-#
-# if (OVFL && ovfl_disabled && inexact_enabled) {
-# branch to _real_inex() (even if the result was exact!);
-# } else {
-# save the result in the proper fp reg (unless the op is fcmp or ftst);
-# return;
-# }
-#
- btst &ovfl_bit,FPSR_EXCEPT(%a6) # was overflow set?
- beq.w fu_in_cont_p # no
-
-fu_in_ovflchk_p:
- btst &inex2_bit,FPCR_ENABLE(%a6) # was inexact enabled?
- beq.w fu_in_cont_p # no
- bra.w fu_in_exc_ovfl_p # do _real_inex() now
-
-#
-# An exception occurred and that exception was enabled:
-#
-# shift enabled exception field into lo byte of d0;
-# if (((INEX2 || INEX1) && inex_enabled && OVFL && ovfl_disabled) ||
-# ((INEX2 || INEX1) && inex_enabled && UNFL && unfl_disabled)) {
-# /*
-# * this is the case where we must call _real_inex() now or else
-# * there will be no other way to pass it the exceptional operand
-# */
-# call _real_inex();
-# } else {
-# restore exc state (SNAN||OPERR||OVFL||UNFL||DZ||INEX) into the FPU;
-# }
-#
-fu_in_exc_p:
- subi.l &24,%d0 # fix offset to be 0-8
- cmpi.b %d0,&0x6 # is exception INEX? (6 or 7)
- blt.b fu_in_exc_exit_p # no
-
-# the enabled exception was inexact
- btst &unfl_bit,FPSR_EXCEPT(%a6) # did disabled underflow occur?
- bne.w fu_in_exc_unfl_p # yes
- btst &ovfl_bit,FPSR_EXCEPT(%a6) # did disabled overflow occur?
- bne.w fu_in_exc_ovfl_p # yes
-
-# here, we insert the correct fsave status value into the fsave frame for the
-# corresponding exception. the operand in the fsave frame should be the original
-# src operand.
-# as a reminder for future predicted pain and agony, we are passing in fsave the
-# "non-skewed" operand for cases of sgl and dbl src INFs,NANs, and DENORMs.
-# this is INCORRECT for enabled SNAN which would give to the user the skewed SNAN!!!
-fu_in_exc_exit_p:
- btst &0x5,EXC_SR(%a6) # user or supervisor?
- bne.w fu_in_exc_exit_s_p # supervisor
-
- mov.l EXC_A7(%a6),%a0 # update user a7
- mov.l %a0,%usp
-
-fu_in_exc_exit_cont_p:
- mov.w (tbl_except_p.b,%pc,%d0.w*2),2+FP_SRC(%a6)
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- frestore FP_SRC(%a6) # restore src op
-
- unlk %a6
-
- btst &0x7,(%sp) # is trace enabled?
- bne.w fu_trace_p # yes
-
- bra.l _fpsp_done
-
-tbl_except_p:
- short 0xe000,0xe006,0xe004,0xe005
- short 0xe003,0xe002,0xe001,0xe001
-
-fu_in_exc_ovfl_p:
- mov.w &0x3,%d0
- bra.w fu_in_exc_exit_p
-
-fu_in_exc_unfl_p:
- mov.w &0x4,%d0
- bra.w fu_in_exc_exit_p
-
-fu_in_exc_exit_s_p:
- btst &mia7_bit,SPCOND_FLG(%a6)
- beq.b fu_in_exc_exit_cont_p
-
- mov.w (tbl_except_p.b,%pc,%d0.w*2),2+FP_SRC(%a6)
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- frestore FP_SRC(%a6) # restore src op
-
- unlk %a6 # unravel stack frame
-
-# shift stack frame "up". who cares about <ea> field.
- mov.l 0x4(%sp),0x10(%sp)
- mov.l 0x0(%sp),0xc(%sp)
- add.l &0xc,%sp
-
- btst &0x7,(%sp) # is trace on?
- bne.b fu_trace_p # yes
-
- bra.l _fpsp_done # exit to os
-
-#
-# The opclass two PACKED instruction that took an "Unimplemented Data Type"
-# exception was being traced. Make the "current" PC the FPIAR and put it in the
-# trace stack frame then jump to _real_trace().
-#
-# UNSUPP FRAME TRACE FRAME
-# ***************** *****************
-# * EA * * Current *
-# * * * PC *
-# ***************** *****************
-# * 0x2 * 0x0dc * * 0x2 * 0x024 *
-# ***************** *****************
-# * Next * * Next *
-# * PC * * PC *
-# ***************** *****************
-# * SR * * SR *
-# ***************** *****************
-fu_trace_p:
- mov.w &0x2024,0x6(%sp)
- fmov.l %fpiar,0x8(%sp)
-
- bra.l _real_trace
-
-#########################################################
-#########################################################
-fu_out_pack:
-
-
-# I'm not sure at this point what FPSR bits are valid for this instruction.
-# so, since the emulation routines re-create them anyways, zero exception field.
-# fmove out doesn't affect ccodes.
- and.l &0xffff00ff,USER_FPSR(%a6) # zero exception field
-
- fmov.l &0x0,%fpcr # zero current control regs
- fmov.l &0x0,%fpsr
-
- bfextu EXC_CMDREG(%a6){&6:&3},%d0
- bsr.l load_fpn1
-
-# unlike other opclass 3, unimplemented data type exceptions, packed must be
-# able to detect all operand types.
- lea FP_SRC(%a6),%a0
- bsr.l set_tag_x # tag the operand type
- cmpi.b %d0,&UNNORM # is operand an UNNORM?
- bne.b fu_op2_p # no
- bsr.l unnorm_fix # yes; convert to NORM,DENORM,or ZERO
-
-fu_op2_p:
- mov.b %d0,STAG(%a6) # save src optype tag
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # fetch rnd mode/prec
-
- lea FP_SRC(%a6),%a0 # pass ptr to src operand
-
- mov.l (%a6),EXC_A6(%a6) # in case a6 changes
- bsr.l fout # call fmove out routine
-
-# Exceptions in order of precedence:
-# BSUN : no
-# SNAN : yes
-# OPERR : if ((k_factor > +17) || (dec. exp exceeds 3 digits))
-# OVFL : no
-# UNFL : no
-# DZ : no
-# INEX2 : yes
-# INEX1 : no
-
-# determine the highest priority exception(if any) set by the
-# emulation routine that has also been enabled by the user.
- mov.b FPCR_ENABLE(%a6),%d0 # fetch exceptions enabled
- bne.w fu_out_ena_p # some are enabled
-
-fu_out_exit_p:
- mov.l EXC_A6(%a6),(%a6) # restore a6
-
- btst &0x5,EXC_SR(%a6) # user or supervisor?
- bne.b fu_out_exit_s_p # supervisor
-
- mov.l EXC_A7(%a6),%a0 # update user a7
- mov.l %a0,%usp
-
-fu_out_exit_cont_p:
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6 # unravel stack frame
-
- btst &0x7,(%sp) # is trace on?
- bne.w fu_trace_p # yes
-
- bra.l _fpsp_done # exit to os
-
-# the exception occurred in supervisor mode. check to see if the
-# addressing mode was -(a7). if so, we'll need to shift the
-# stack frame "down".
-fu_out_exit_s_p:
- btst &mda7_bit,SPCOND_FLG(%a6) # was ea mode -(a7)
- beq.b fu_out_exit_cont_p # no
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- mov.l (%a6),%a6 # restore frame pointer
-
- mov.l LOCAL_SIZE+EXC_SR(%sp),LOCAL_SIZE+EXC_SR-0xc(%sp)
- mov.l LOCAL_SIZE+2+EXC_PC(%sp),LOCAL_SIZE+2+EXC_PC-0xc(%sp)
-
-# now, copy the result to the proper place on the stack
- mov.l LOCAL_SIZE+FP_DST_EX(%sp),LOCAL_SIZE+EXC_SR+0x0(%sp)
- mov.l LOCAL_SIZE+FP_DST_HI(%sp),LOCAL_SIZE+EXC_SR+0x4(%sp)
- mov.l LOCAL_SIZE+FP_DST_LO(%sp),LOCAL_SIZE+EXC_SR+0x8(%sp)
-
- add.l &LOCAL_SIZE-0x8,%sp
-
- btst &0x7,(%sp)
- bne.w fu_trace_p
-
- bra.l _fpsp_done
-
-fu_out_ena_p:
- and.b FPSR_EXCEPT(%a6),%d0 # keep only ones enabled
- bfffo %d0{&24:&8},%d0 # find highest priority exception
- beq.w fu_out_exit_p
-
- mov.l EXC_A6(%a6),(%a6) # restore a6
-
-# an exception occurred and that exception was enabled.
-# the only exception possible on packed move out are INEX, OPERR, and SNAN.
-fu_out_exc_p:
- cmpi.b %d0,&0x1a
- bgt.w fu_inex_p2
- beq.w fu_operr_p
-
-fu_snan_p:
- btst &0x5,EXC_SR(%a6)
- bne.b fu_snan_s_p
-
- mov.l EXC_A7(%a6),%a0
- mov.l %a0,%usp
- bra.w fu_snan
-
-fu_snan_s_p:
- cmpi.b SPCOND_FLG(%a6),&mda7_flg
- bne.w fu_snan
-
-# the instruction was "fmove.p fpn,-(a7)" from supervisor mode.
-# the strategy is to move the exception frame "down" 12 bytes. then, we
-# can store the default result where the exception frame was.
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- mov.w &0x30d8,EXC_VOFF(%a6) # vector offset = 0xd0
- mov.w &0xe006,2+FP_SRC(%a6) # set fsave status
-
- frestore FP_SRC(%a6) # restore src operand
-
- mov.l (%a6),%a6 # restore frame pointer
-
- mov.l LOCAL_SIZE+EXC_SR(%sp),LOCAL_SIZE+EXC_SR-0xc(%sp)
- mov.l LOCAL_SIZE+2+EXC_PC(%sp),LOCAL_SIZE+2+EXC_PC-0xc(%sp)
- mov.l LOCAL_SIZE+EXC_EA(%sp),LOCAL_SIZE+EXC_EA-0xc(%sp)
-
-# now, we copy the default result to its proper location
- mov.l LOCAL_SIZE+FP_DST_EX(%sp),LOCAL_SIZE+0x4(%sp)
- mov.l LOCAL_SIZE+FP_DST_HI(%sp),LOCAL_SIZE+0x8(%sp)
- mov.l LOCAL_SIZE+FP_DST_LO(%sp),LOCAL_SIZE+0xc(%sp)
-
- add.l &LOCAL_SIZE-0x8,%sp
-
-
- bra.l _real_snan
-
-fu_operr_p:
- btst &0x5,EXC_SR(%a6)
- bne.w fu_operr_p_s
-
- mov.l EXC_A7(%a6),%a0
- mov.l %a0,%usp
- bra.w fu_operr
-
-fu_operr_p_s:
- cmpi.b SPCOND_FLG(%a6),&mda7_flg
- bne.w fu_operr
-
-# the instruction was "fmove.p fpn,-(a7)" from supervisor mode.
-# the strategy is to move the exception frame "down" 12 bytes. then, we
-# can store the default result where the exception frame was.
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- mov.w &0x30d0,EXC_VOFF(%a6) # vector offset = 0xd0
- mov.w &0xe004,2+FP_SRC(%a6) # set fsave status
-
- frestore FP_SRC(%a6) # restore src operand
-
- mov.l (%a6),%a6 # restore frame pointer
-
- mov.l LOCAL_SIZE+EXC_SR(%sp),LOCAL_SIZE+EXC_SR-0xc(%sp)
- mov.l LOCAL_SIZE+2+EXC_PC(%sp),LOCAL_SIZE+2+EXC_PC-0xc(%sp)
- mov.l LOCAL_SIZE+EXC_EA(%sp),LOCAL_SIZE+EXC_EA-0xc(%sp)
-
-# now, we copy the default result to its proper location
- mov.l LOCAL_SIZE+FP_DST_EX(%sp),LOCAL_SIZE+0x4(%sp)
- mov.l LOCAL_SIZE+FP_DST_HI(%sp),LOCAL_SIZE+0x8(%sp)
- mov.l LOCAL_SIZE+FP_DST_LO(%sp),LOCAL_SIZE+0xc(%sp)
-
- add.l &LOCAL_SIZE-0x8,%sp
-
-
- bra.l _real_operr
-
-fu_inex_p2:
- btst &0x5,EXC_SR(%a6)
- bne.w fu_inex_s_p2
-
- mov.l EXC_A7(%a6),%a0
- mov.l %a0,%usp
- bra.w fu_inex
-
-fu_inex_s_p2:
- cmpi.b SPCOND_FLG(%a6),&mda7_flg
- bne.w fu_inex
-
-# the instruction was "fmove.p fpn,-(a7)" from supervisor mode.
-# the strategy is to move the exception frame "down" 12 bytes. then, we
-# can store the default result where the exception frame was.
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- mov.w &0x30c4,EXC_VOFF(%a6) # vector offset = 0xc4
- mov.w &0xe001,2+FP_SRC(%a6) # set fsave status
-
- frestore FP_SRC(%a6) # restore src operand
-
- mov.l (%a6),%a6 # restore frame pointer
-
- mov.l LOCAL_SIZE+EXC_SR(%sp),LOCAL_SIZE+EXC_SR-0xc(%sp)
- mov.l LOCAL_SIZE+2+EXC_PC(%sp),LOCAL_SIZE+2+EXC_PC-0xc(%sp)
- mov.l LOCAL_SIZE+EXC_EA(%sp),LOCAL_SIZE+EXC_EA-0xc(%sp)
-
-# now, we copy the default result to its proper location
- mov.l LOCAL_SIZE+FP_DST_EX(%sp),LOCAL_SIZE+0x4(%sp)
- mov.l LOCAL_SIZE+FP_DST_HI(%sp),LOCAL_SIZE+0x8(%sp)
- mov.l LOCAL_SIZE+FP_DST_LO(%sp),LOCAL_SIZE+0xc(%sp)
-
- add.l &LOCAL_SIZE-0x8,%sp
-
-
- bra.l _real_inex
-
-#########################################################################
-
-#
-# if we're stuffing a source operand back into an fsave frame then we
-# have to make sure that for single or double source operands that the
-# format stuffed is as weird as the hardware usually makes it.
-#
- global funimp_skew
-funimp_skew:
- bfextu EXC_EXTWORD(%a6){&3:&3},%d0 # extract src specifier
- cmpi.b %d0,&0x1 # was src sgl?
- beq.b funimp_skew_sgl # yes
- cmpi.b %d0,&0x5 # was src dbl?
- beq.b funimp_skew_dbl # yes
- rts
-
-funimp_skew_sgl:
- mov.w FP_SRC_EX(%a6),%d0 # fetch DENORM exponent
- andi.w &0x7fff,%d0 # strip sign
- beq.b funimp_skew_sgl_not
- cmpi.w %d0,&0x3f80
- bgt.b funimp_skew_sgl_not
- neg.w %d0 # make exponent negative
- addi.w &0x3f81,%d0 # find amt to shift
- mov.l FP_SRC_HI(%a6),%d1 # fetch DENORM hi(man)
- lsr.l %d0,%d1 # shift it
- bset &31,%d1 # set j-bit
- mov.l %d1,FP_SRC_HI(%a6) # insert new hi(man)
- andi.w &0x8000,FP_SRC_EX(%a6) # clear old exponent
- ori.w &0x3f80,FP_SRC_EX(%a6) # insert new "skewed" exponent
-funimp_skew_sgl_not:
- rts
-
-funimp_skew_dbl:
- mov.w FP_SRC_EX(%a6),%d0 # fetch DENORM exponent
- andi.w &0x7fff,%d0 # strip sign
- beq.b funimp_skew_dbl_not
- cmpi.w %d0,&0x3c00
- bgt.b funimp_skew_dbl_not
-
- tst.b FP_SRC_EX(%a6) # make "internal format"
- smi.b 0x2+FP_SRC(%a6)
- mov.w %d0,FP_SRC_EX(%a6) # insert exponent with cleared sign
- clr.l %d0 # clear g,r,s
- lea FP_SRC(%a6),%a0 # pass ptr to src op
- mov.w &0x3c01,%d1 # pass denorm threshold
- bsr.l dnrm_lp # denorm it
- mov.w &0x3c00,%d0 # new exponent
- tst.b 0x2+FP_SRC(%a6) # is sign set?
- beq.b fss_dbl_denorm_done # no
- bset &15,%d0 # set sign
-fss_dbl_denorm_done:
- bset &0x7,FP_SRC_HI(%a6) # set j-bit
- mov.w %d0,FP_SRC_EX(%a6) # insert new exponent
-funimp_skew_dbl_not:
- rts
-
-#########################################################################
- global _mem_write2
-_mem_write2:
- btst &0x5,EXC_SR(%a6)
- beq.l _dmem_write
- mov.l 0x0(%a0),FP_DST_EX(%a6)
- mov.l 0x4(%a0),FP_DST_HI(%a6)
- mov.l 0x8(%a0),FP_DST_LO(%a6)
- clr.l %d1
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# _fpsp_effadd(): 060FPSP entry point for FP "Unimplemented #
-# effective address" exception. #
-# #
-# This handler should be the first code executed upon taking the #
-# FP Unimplemented Effective Address exception in an operating #
-# system. #
-# #
-# XREF **************************************************************** #
-# _imem_read_long() - read instruction longword #
-# fix_skewed_ops() - adjust src operand in fsave frame #
-# set_tag_x() - determine optype of src/dst operands #
-# store_fpreg() - store opclass 0 or 2 result to FP regfile #
-# unnorm_fix() - change UNNORM operands to NORM or ZERO #
-# load_fpn2() - load dst operand from FP regfile #
-# tbl_unsupp - add of table of emulation routines for opclass 0,2 #
-# decbin() - convert packed data to FP binary data #
-# _real_fpu_disabled() - "callout" for "FPU disabled" exception #
-# _real_access() - "callout" for access error exception #
-# _mem_read() - read extended immediate operand from memory #
-# _fpsp_done() - "callout" for exit; work all done #
-# _real_trace() - "callout" for Trace enabled exception #
-# fmovm_dynamic() - emulate dynamic fmovm instruction #
-# fmovm_ctrl() - emulate fmovm control instruction #
-# #
-# INPUT *************************************************************** #
-# - The system stack contains the "Unimplemented <ea>" stk frame #
-# #
-# OUTPUT ************************************************************** #
-# If access error: #
-# - The system stack is changed to an access error stack frame #
-# If FPU disabled: #
-# - The system stack is changed to an FPU disabled stack frame #
-# If Trace exception enabled: #
-# - The system stack is changed to a Trace exception stack frame #
-# Else: (normal case) #
-# - None (correct result has been stored as appropriate) #
-# #
-# ALGORITHM *********************************************************** #
-# This exception handles 3 types of operations: #
-# (1) FP Instructions using extended precision or packed immediate #
-# addressing mode. #
-# (2) The "fmovm.x" instruction w/ dynamic register specification. #
-# (3) The "fmovm.l" instruction w/ 2 or 3 control registers. #
-# #
-# For immediate data operations, the data is read in w/ a #
-# _mem_read() "callout", converted to FP binary (if packed), and used #
-# as the source operand to the instruction specified by the instruction #
-# word. If no FP exception should be reported ads a result of the #
-# emulation, then the result is stored to the destination register and #
-# the handler exits through _fpsp_done(). If an enabled exc has been #
-# signalled as a result of emulation, then an fsave state frame #
-# corresponding to the FP exception type must be entered into the 060 #
-# FPU before exiting. In either the enabled or disabled cases, we #
-# must also check if a Trace exception is pending, in which case, we #
-# must create a Trace exception stack frame from the current exception #
-# stack frame. If no Trace is pending, we simply exit through #
-# _fpsp_done(). #
-# For "fmovm.x", call the routine fmovm_dynamic() which will #
-# decode and emulate the instruction. No FP exceptions can be pending #
-# as a result of this operation emulation. A Trace exception can be #
-# pending, though, which means the current stack frame must be changed #
-# to a Trace stack frame and an exit made through _real_trace(). #
-# For the case of "fmovm.x Dn,-(a7)", where the offending instruction #
-# was executed from supervisor mode, this handler must store the FP #
-# register file values to the system stack by itself since #
-# fmovm_dynamic() can't handle this. A normal exit is made through #
-# fpsp_done(). #
-# For "fmovm.l", fmovm_ctrl() is used to emulate the instruction. #
-# Again, a Trace exception may be pending and an exit made through #
-# _real_trace(). Else, a normal exit is made through _fpsp_done(). #
-# #
-# Before any of the above is attempted, it must be checked to #
-# see if the FPU is disabled. Since the "Unimp <ea>" exception is taken #
-# before the "FPU disabled" exception, but the "FPU disabled" exception #
-# has higher priority, we check the disabled bit in the PCR. If set, #
-# then we must create an 8 word "FPU disabled" exception stack frame #
-# from the current 4 word exception stack frame. This includes #
-# reproducing the effective address of the instruction to put on the #
-# new stack frame. #
-# #
-# In the process of all emulation work, if a _mem_read() #
-# "callout" returns a failing result indicating an access error, then #
-# we must create an access error stack frame from the current stack #
-# frame. This information includes a faulting address and a fault- #
-# status-longword. These are created within this handler. #
-# #
-#########################################################################
-
- global _fpsp_effadd
-_fpsp_effadd:
-
-# This exception type takes priority over the "Line F Emulator"
-# exception. Therefore, the FPU could be disabled when entering here.
-# So, we must check to see if it's disabled and handle that case separately.
- mov.l %d0,-(%sp) # save d0
- movc %pcr,%d0 # load proc cr
- btst &0x1,%d0 # is FPU disabled?
- bne.w iea_disabled # yes
- mov.l (%sp)+,%d0 # restore d0
-
- link %a6,&-LOCAL_SIZE # init stack frame
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FPREGS(%a6) # save fp0-fp1 on stack
-
-# PC of instruction that took the exception is the PC in the frame
- mov.l EXC_PC(%a6),EXC_EXTWPTR(%a6)
-
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch the instruction words
- mov.l %d0,EXC_OPWORD(%a6) # store OPWORD and EXTWORD
-
-#########################################################################
-
- tst.w %d0 # is operation fmovem?
- bmi.w iea_fmovm # yes
-
-#
-# here, we will have:
-# fabs fdabs fsabs facos fmod
-# fadd fdadd fsadd fasin frem
-# fcmp fatan fscale
-# fdiv fddiv fsdiv fatanh fsin
-# fint fcos fsincos
-# fintrz fcosh fsinh
-# fmove fdmove fsmove fetox ftan
-# fmul fdmul fsmul fetoxm1 ftanh
-# fneg fdneg fsneg fgetexp ftentox
-# fsgldiv fgetman ftwotox
-# fsglmul flog10
-# fsqrt flog2
-# fsub fdsub fssub flogn
-# ftst flognp1
-# which can all use f<op>.{x,p}
-# so, now it's immediate data extended precision AND PACKED FORMAT!
-#
-iea_op:
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- btst &0xa,%d0 # is src fmt x or p?
- bne.b iea_op_pack # packed
-
-
- mov.l EXC_EXTWPTR(%a6),%a0 # pass: ptr to #<data>
- lea FP_SRC(%a6),%a1 # pass: ptr to super addr
- mov.l &0xc,%d0 # pass: 12 bytes
- bsr.l _imem_read # read extended immediate
-
- tst.l %d1 # did ifetch fail?
- bne.w iea_iacc # yes
-
- bra.b iea_op_setsrc
-
-iea_op_pack:
-
- mov.l EXC_EXTWPTR(%a6),%a0 # pass: ptr to #<data>
- lea FP_SRC(%a6),%a1 # pass: ptr to super dst
- mov.l &0xc,%d0 # pass: 12 bytes
- bsr.l _imem_read # read packed operand
-
- tst.l %d1 # did ifetch fail?
- bne.w iea_iacc # yes
-
-# The packed operand is an INF or a NAN if the exponent field is all ones.
- bfextu FP_SRC(%a6){&1:&15},%d0 # get exp
- cmpi.w %d0,&0x7fff # INF or NAN?
- beq.b iea_op_setsrc # operand is an INF or NAN
-
-# The packed operand is a zero if the mantissa is all zero, else it's
-# a normal packed op.
- mov.b 3+FP_SRC(%a6),%d0 # get byte 4
- andi.b &0x0f,%d0 # clear all but last nybble
- bne.b iea_op_gp_not_spec # not a zero
- tst.l FP_SRC_HI(%a6) # is lw 2 zero?
- bne.b iea_op_gp_not_spec # not a zero
- tst.l FP_SRC_LO(%a6) # is lw 3 zero?
- beq.b iea_op_setsrc # operand is a ZERO
-iea_op_gp_not_spec:
- lea FP_SRC(%a6),%a0 # pass: ptr to packed op
- bsr.l decbin # convert to extended
- fmovm.x &0x80,FP_SRC(%a6) # make this the srcop
-
-iea_op_setsrc:
- addi.l &0xc,EXC_EXTWPTR(%a6) # update extension word pointer
-
-# FP_SRC now holds the src operand.
- lea FP_SRC(%a6),%a0 # pass: ptr to src op
- bsr.l set_tag_x # tag the operand type
- mov.b %d0,STAG(%a6) # could be ANYTHING!!!
- cmpi.b %d0,&UNNORM # is operand an UNNORM?
- bne.b iea_op_getdst # no
- bsr.l unnorm_fix # yes; convert to NORM/DENORM/ZERO
- mov.b %d0,STAG(%a6) # set new optype tag
-iea_op_getdst:
- clr.b STORE_FLG(%a6) # clear "store result" boolean
-
- btst &0x5,1+EXC_CMDREG(%a6) # is operation monadic or dyadic?
- beq.b iea_op_extract # monadic
- btst &0x4,1+EXC_CMDREG(%a6) # is operation fsincos,ftst,fcmp?
- bne.b iea_op_spec # yes
-
-iea_op_loaddst:
- bfextu EXC_CMDREG(%a6){&6:&3},%d0 # fetch dst regno
- bsr.l load_fpn2 # load dst operand
-
- lea FP_DST(%a6),%a0 # pass: ptr to dst op
- bsr.l set_tag_x # tag the operand type
- mov.b %d0,DTAG(%a6) # could be ANYTHING!!!
- cmpi.b %d0,&UNNORM # is operand an UNNORM?
- bne.b iea_op_extract # no
- bsr.l unnorm_fix # yes; convert to NORM/DENORM/ZERO
- mov.b %d0,DTAG(%a6) # set new optype tag
- bra.b iea_op_extract
-
-# the operation is fsincos, ftst, or fcmp. only fcmp is dyadic
-iea_op_spec:
- btst &0x3,1+EXC_CMDREG(%a6) # is operation fsincos?
- beq.b iea_op_extract # yes
-# now, we're left with ftst and fcmp. so, first let's tag them so that they don't
-# store a result. then, only fcmp will branch back and pick up a dst operand.
- st STORE_FLG(%a6) # don't store a final result
- btst &0x1,1+EXC_CMDREG(%a6) # is operation fcmp?
- beq.b iea_op_loaddst # yes
-
-iea_op_extract:
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass: rnd mode,prec
-
- mov.b 1+EXC_CMDREG(%a6),%d1
- andi.w &0x007f,%d1 # extract extension
-
- fmov.l &0x0,%fpcr
- fmov.l &0x0,%fpsr
-
- lea FP_SRC(%a6),%a0
- lea FP_DST(%a6),%a1
-
- mov.l (tbl_unsupp.l,%pc,%d1.w*4),%d1 # fetch routine addr
- jsr (tbl_unsupp.l,%pc,%d1.l*1)
-
-#
-# Exceptions in order of precedence:
-# BSUN : none
-# SNAN : all operations
-# OPERR : all reg-reg or mem-reg operations that can normally operr
-# OVFL : same as OPERR
-# UNFL : same as OPERR
-# DZ : same as OPERR
-# INEX2 : same as OPERR
-# INEX1 : all packed immediate operations
-#
-
-# we determine the highest priority exception(if any) set by the
-# emulation routine that has also been enabled by the user.
- mov.b FPCR_ENABLE(%a6),%d0 # fetch exceptions enabled
- bne.b iea_op_ena # some are enabled
-
-# now, we save the result, unless, of course, the operation was ftst or fcmp.
-# these don't save results.
-iea_op_save:
- tst.b STORE_FLG(%a6) # does this op store a result?
- bne.b iea_op_exit1 # exit with no frestore
-
-iea_op_store:
- bfextu EXC_CMDREG(%a6){&6:&3},%d0 # fetch dst regno
- bsr.l store_fpreg # store the result
-
-iea_op_exit1:
- mov.l EXC_PC(%a6),USER_FPIAR(%a6) # set FPIAR to "Current PC"
- mov.l EXC_EXTWPTR(%a6),EXC_PC(%a6) # set "Next PC" in exc frame
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6 # unravel the frame
-
- btst &0x7,(%sp) # is trace on?
- bne.w iea_op_trace # yes
-
- bra.l _fpsp_done # exit to os
-
-iea_op_ena:
- and.b FPSR_EXCEPT(%a6),%d0 # keep only ones enable and set
- bfffo %d0{&24:&8},%d0 # find highest priority exception
- bne.b iea_op_exc # at least one was set
-
-# no exception occurred. now, did a disabled, exact overflow occur with inexact
-# enabled? if so, then we have to stuff an overflow frame into the FPU.
- btst &ovfl_bit,FPSR_EXCEPT(%a6) # did overflow occur?
- beq.b iea_op_save
-
-iea_op_ovfl:
- btst &inex2_bit,FPCR_ENABLE(%a6) # is inexact enabled?
- beq.b iea_op_store # no
- bra.b iea_op_exc_ovfl # yes
-
-# an enabled exception occurred. we have to insert the exception type back into
-# the machine.
-iea_op_exc:
- subi.l &24,%d0 # fix offset to be 0-8
- cmpi.b %d0,&0x6 # is exception INEX?
- bne.b iea_op_exc_force # no
-
-# the enabled exception was inexact. so, if it occurs with an overflow
-# or underflow that was disabled, then we have to force an overflow or
-# underflow frame.
- btst &ovfl_bit,FPSR_EXCEPT(%a6) # did overflow occur?
- bne.b iea_op_exc_ovfl # yes
- btst &unfl_bit,FPSR_EXCEPT(%a6) # did underflow occur?
- bne.b iea_op_exc_unfl # yes
-
-iea_op_exc_force:
- mov.w (tbl_iea_except.b,%pc,%d0.w*2),2+FP_SRC(%a6)
- bra.b iea_op_exit2 # exit with frestore
-
-tbl_iea_except:
- short 0xe002, 0xe006, 0xe004, 0xe005
- short 0xe003, 0xe002, 0xe001, 0xe001
-
-iea_op_exc_ovfl:
- mov.w &0xe005,2+FP_SRC(%a6)
- bra.b iea_op_exit2
-
-iea_op_exc_unfl:
- mov.w &0xe003,2+FP_SRC(%a6)
-
-iea_op_exit2:
- mov.l EXC_PC(%a6),USER_FPIAR(%a6) # set FPIAR to "Current PC"
- mov.l EXC_EXTWPTR(%a6),EXC_PC(%a6) # set "Next PC" in exc frame
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- frestore FP_SRC(%a6) # restore exceptional state
-
- unlk %a6 # unravel the frame
-
- btst &0x7,(%sp) # is trace on?
- bne.b iea_op_trace # yes
-
- bra.l _fpsp_done # exit to os
-
-#
-# The opclass two instruction that took an "Unimplemented Effective Address"
-# exception was being traced. Make the "current" PC the FPIAR and put it in
-# the trace stack frame then jump to _real_trace().
-#
-# UNIMP EA FRAME TRACE FRAME
-# ***************** *****************
-# * 0x0 * 0x0f0 * * Current *
-# ***************** * PC *
-# * Current * *****************
-# * PC * * 0x2 * 0x024 *
-# ***************** *****************
-# * SR * * Next *
-# ***************** * PC *
-# *****************
-# * SR *
-# *****************
-iea_op_trace:
- mov.l (%sp),-(%sp) # shift stack frame "down"
- mov.w 0x8(%sp),0x4(%sp)
- mov.w &0x2024,0x6(%sp) # stk fmt = 0x2; voff = 0x024
- fmov.l %fpiar,0x8(%sp) # "Current PC" is in FPIAR
-
- bra.l _real_trace
-
-#########################################################################
-iea_fmovm:
- btst &14,%d0 # ctrl or data reg
- beq.w iea_fmovm_ctrl
-
-iea_fmovm_data:
-
- btst &0x5,EXC_SR(%a6) # user or supervisor mode
- bne.b iea_fmovm_data_s
-
-iea_fmovm_data_u:
- mov.l %usp,%a0
- mov.l %a0,EXC_A7(%a6) # store current a7
- bsr.l fmovm_dynamic # do dynamic fmovm
- mov.l EXC_A7(%a6),%a0 # load possibly new a7
- mov.l %a0,%usp # update usp
- bra.w iea_fmovm_exit
-
-iea_fmovm_data_s:
- clr.b SPCOND_FLG(%a6)
- lea 0x2+EXC_VOFF(%a6),%a0
- mov.l %a0,EXC_A7(%a6)
- bsr.l fmovm_dynamic # do dynamic fmovm
-
- cmpi.b SPCOND_FLG(%a6),&mda7_flg
- beq.w iea_fmovm_data_predec
- cmpi.b SPCOND_FLG(%a6),&mia7_flg
- bne.w iea_fmovm_exit
-
-# right now, d0 = the size.
-# the data has been fetched from the supervisor stack, but we have not
-# incremented the stack pointer by the appropriate number of bytes.
-# do it here.
-iea_fmovm_data_postinc:
- btst &0x7,EXC_SR(%a6)
- bne.b iea_fmovm_data_pi_trace
-
- mov.w EXC_SR(%a6),(EXC_SR,%a6,%d0)
- mov.l EXC_EXTWPTR(%a6),(EXC_PC,%a6,%d0)
- mov.w &0x00f0,(EXC_VOFF,%a6,%d0)
-
- lea (EXC_SR,%a6,%d0),%a0
- mov.l %a0,EXC_SR(%a6)
-
- fmovm.x EXC_FP0(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6
- mov.l (%sp)+,%sp
- bra.l _fpsp_done
-
-iea_fmovm_data_pi_trace:
- mov.w EXC_SR(%a6),(EXC_SR-0x4,%a6,%d0)
- mov.l EXC_EXTWPTR(%a6),(EXC_PC-0x4,%a6,%d0)
- mov.w &0x2024,(EXC_VOFF-0x4,%a6,%d0)
- mov.l EXC_PC(%a6),(EXC_VOFF+0x2-0x4,%a6,%d0)
-
- lea (EXC_SR-0x4,%a6,%d0),%a0
- mov.l %a0,EXC_SR(%a6)
-
- fmovm.x EXC_FP0(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6
- mov.l (%sp)+,%sp
- bra.l _real_trace
-
-# right now, d1 = size and d0 = the strg.
-iea_fmovm_data_predec:
- mov.b %d1,EXC_VOFF(%a6) # store strg
- mov.b %d0,0x1+EXC_VOFF(%a6) # store size
-
- fmovm.x EXC_FP0(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- mov.l (%a6),-(%sp) # make a copy of a6
- mov.l %d0,-(%sp) # save d0
- mov.l %d1,-(%sp) # save d1
- mov.l EXC_EXTWPTR(%a6),-(%sp) # make a copy of Next PC
-
- clr.l %d0
- mov.b 0x1+EXC_VOFF(%a6),%d0 # fetch size
- neg.l %d0 # get negative of size
-
- btst &0x7,EXC_SR(%a6) # is trace enabled?
- beq.b iea_fmovm_data_p2
-
- mov.w EXC_SR(%a6),(EXC_SR-0x4,%a6,%d0)
- mov.l EXC_PC(%a6),(EXC_VOFF-0x2,%a6,%d0)
- mov.l (%sp)+,(EXC_PC-0x4,%a6,%d0)
- mov.w &0x2024,(EXC_VOFF-0x4,%a6,%d0)
-
- pea (%a6,%d0) # create final sp
- bra.b iea_fmovm_data_p3
-
-iea_fmovm_data_p2:
- mov.w EXC_SR(%a6),(EXC_SR,%a6,%d0)
- mov.l (%sp)+,(EXC_PC,%a6,%d0)
- mov.w &0x00f0,(EXC_VOFF,%a6,%d0)
-
- pea (0x4,%a6,%d0) # create final sp
-
-iea_fmovm_data_p3:
- clr.l %d1
- mov.b EXC_VOFF(%a6),%d1 # fetch strg
-
- tst.b %d1
- bpl.b fm_1
- fmovm.x &0x80,(0x4+0x8,%a6,%d0)
- addi.l &0xc,%d0
-fm_1:
- lsl.b &0x1,%d1
- bpl.b fm_2
- fmovm.x &0x40,(0x4+0x8,%a6,%d0)
- addi.l &0xc,%d0
-fm_2:
- lsl.b &0x1,%d1
- bpl.b fm_3
- fmovm.x &0x20,(0x4+0x8,%a6,%d0)
- addi.l &0xc,%d0
-fm_3:
- lsl.b &0x1,%d1
- bpl.b fm_4
- fmovm.x &0x10,(0x4+0x8,%a6,%d0)
- addi.l &0xc,%d0
-fm_4:
- lsl.b &0x1,%d1
- bpl.b fm_5
- fmovm.x &0x08,(0x4+0x8,%a6,%d0)
- addi.l &0xc,%d0
-fm_5:
- lsl.b &0x1,%d1
- bpl.b fm_6
- fmovm.x &0x04,(0x4+0x8,%a6,%d0)
- addi.l &0xc,%d0
-fm_6:
- lsl.b &0x1,%d1
- bpl.b fm_7
- fmovm.x &0x02,(0x4+0x8,%a6,%d0)
- addi.l &0xc,%d0
-fm_7:
- lsl.b &0x1,%d1
- bpl.b fm_end
- fmovm.x &0x01,(0x4+0x8,%a6,%d0)
-fm_end:
- mov.l 0x4(%sp),%d1
- mov.l 0x8(%sp),%d0
- mov.l 0xc(%sp),%a6
- mov.l (%sp)+,%sp
-
- btst &0x7,(%sp) # is trace enabled?
- beq.l _fpsp_done
- bra.l _real_trace
-
-#########################################################################
-iea_fmovm_ctrl:
-
- bsr.l fmovm_ctrl # load ctrl regs
-
-iea_fmovm_exit:
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- btst &0x7,EXC_SR(%a6) # is trace on?
- bne.b iea_fmovm_trace # yes
-
- mov.l EXC_EXTWPTR(%a6),EXC_PC(%a6) # set Next PC
-
- unlk %a6 # unravel the frame
-
- bra.l _fpsp_done # exit to os
-
-#
-# The control reg instruction that took an "Unimplemented Effective Address"
-# exception was being traced. The "Current PC" for the trace frame is the
-# PC stacked for Unimp EA. The "Next PC" is in EXC_EXTWPTR.
-# After fixing the stack frame, jump to _real_trace().
-#
-# UNIMP EA FRAME TRACE FRAME
-# ***************** *****************
-# * 0x0 * 0x0f0 * * Current *
-# ***************** * PC *
-# * Current * *****************
-# * PC * * 0x2 * 0x024 *
-# ***************** *****************
-# * SR * * Next *
-# ***************** * PC *
-# *****************
-# * SR *
-# *****************
-# this ain't a pretty solution, but it works:
-# -restore a6 (not with unlk)
-# -shift stack frame down over where old a6 used to be
-# -add LOCAL_SIZE to stack pointer
-iea_fmovm_trace:
- mov.l (%a6),%a6 # restore frame pointer
- mov.w EXC_SR+LOCAL_SIZE(%sp),0x0+LOCAL_SIZE(%sp)
- mov.l EXC_PC+LOCAL_SIZE(%sp),0x8+LOCAL_SIZE(%sp)
- mov.l EXC_EXTWPTR+LOCAL_SIZE(%sp),0x2+LOCAL_SIZE(%sp)
- mov.w &0x2024,0x6+LOCAL_SIZE(%sp) # stk fmt = 0x2; voff = 0x024
- add.l &LOCAL_SIZE,%sp # clear stack frame
-
- bra.l _real_trace
-
-#########################################################################
-# The FPU is disabled and so we should really have taken the "Line
-# F Emulator" exception. So, here we create an 8-word stack frame
-# from our 4-word stack frame. This means we must calculate the length
-# of the faulting instruction to get the "next PC". This is trivial for
-# immediate operands but requires some extra work for fmovm dynamic
-# which can use most addressing modes.
-iea_disabled:
- mov.l (%sp)+,%d0 # restore d0
-
- link %a6,&-LOCAL_SIZE # init stack frame
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
-
-# PC of instruction that took the exception is the PC in the frame
- mov.l EXC_PC(%a6),EXC_EXTWPTR(%a6)
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch the instruction words
- mov.l %d0,EXC_OPWORD(%a6) # store OPWORD and EXTWORD
-
- tst.w %d0 # is instr fmovm?
- bmi.b iea_dis_fmovm # yes
-# instruction is using an extended precision immediate operand. therefore,
-# the total instruction length is 16 bytes.
-iea_dis_immed:
- mov.l &0x10,%d0 # 16 bytes of instruction
- bra.b iea_dis_cont
-iea_dis_fmovm:
- btst &0xe,%d0 # is instr fmovm ctrl
- bne.b iea_dis_fmovm_data # no
-# the instruction is a fmovm.l with 2 or 3 registers.
- bfextu %d0{&19:&3},%d1
- mov.l &0xc,%d0
- cmpi.b %d1,&0x7 # move all regs?
- bne.b iea_dis_cont
- addq.l &0x4,%d0
- bra.b iea_dis_cont
-# the instruction is an fmovm.x dynamic which can use many addressing
-# modes and thus can have several different total instruction lengths.
-# call fmovm_calc_ea which will go through the ea calc process and,
-# as a by-product, will tell us how long the instruction is.
-iea_dis_fmovm_data:
- clr.l %d0
- bsr.l fmovm_calc_ea
- mov.l EXC_EXTWPTR(%a6),%d0
- sub.l EXC_PC(%a6),%d0
-iea_dis_cont:
- mov.w %d0,EXC_VOFF(%a6) # store stack shift value
-
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6
-
-# here, we actually create the 8-word frame from the 4-word frame,
-# with the "next PC" as additional info.
-# the <ea> field is let as undefined.
- subq.l &0x8,%sp # make room for new stack
- mov.l %d0,-(%sp) # save d0
- mov.w 0xc(%sp),0x4(%sp) # move SR
- mov.l 0xe(%sp),0x6(%sp) # move Current PC
- clr.l %d0
- mov.w 0x12(%sp),%d0
- mov.l 0x6(%sp),0x10(%sp) # move Current PC
- add.l %d0,0x6(%sp) # make Next PC
- mov.w &0x402c,0xa(%sp) # insert offset,frame format
- mov.l (%sp)+,%d0 # restore d0
-
- bra.l _real_fpu_disabled
-
-##########
-
-iea_iacc:
- movc %pcr,%d0
- btst &0x1,%d0
- bne.b iea_iacc_cont
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1 on stack
-iea_iacc_cont:
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6
-
- subq.w &0x8,%sp # make stack frame bigger
- mov.l 0x8(%sp),(%sp) # store SR,hi(PC)
- mov.w 0xc(%sp),0x4(%sp) # store lo(PC)
- mov.w &0x4008,0x6(%sp) # store voff
- mov.l 0x2(%sp),0x8(%sp) # store ea
- mov.l &0x09428001,0xc(%sp) # store fslw
-
-iea_acc_done:
- btst &0x5,(%sp) # user or supervisor mode?
- beq.b iea_acc_done2 # user
- bset &0x2,0xd(%sp) # set supervisor TM bit
-
-iea_acc_done2:
- bra.l _real_access
-
-iea_dacc:
- lea -LOCAL_SIZE(%a6),%sp
-
- movc %pcr,%d1
- btst &0x1,%d1
- bne.b iea_dacc_cont
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1 on stack
- fmovm.l LOCAL_SIZE+USER_FPCR(%sp),%fpcr,%fpsr,%fpiar # restore ctrl regs
-iea_dacc_cont:
- mov.l (%a6),%a6
-
- mov.l 0x4+LOCAL_SIZE(%sp),-0x8+0x4+LOCAL_SIZE(%sp)
- mov.w 0x8+LOCAL_SIZE(%sp),-0x8+0x8+LOCAL_SIZE(%sp)
- mov.w &0x4008,-0x8+0xa+LOCAL_SIZE(%sp)
- mov.l %a0,-0x8+0xc+LOCAL_SIZE(%sp)
- mov.w %d0,-0x8+0x10+LOCAL_SIZE(%sp)
- mov.w &0x0001,-0x8+0x12+LOCAL_SIZE(%sp)
-
- movm.l LOCAL_SIZE+EXC_DREGS(%sp),&0x0303 # restore d0-d1/a0-a1
- add.w &LOCAL_SIZE-0x4,%sp
-
- bra.b iea_acc_done
-
-#########################################################################
-# XDEF **************************************************************** #
-# _fpsp_operr(): 060FPSP entry point for FP Operr exception. #
-# #
-# This handler should be the first code executed upon taking the #
-# FP Operand Error exception in an operating system. #
-# #
-# XREF **************************************************************** #
-# _imem_read_long() - read instruction longword #
-# fix_skewed_ops() - adjust src operand in fsave frame #
-# _real_operr() - "callout" to operating system operr handler #
-# _dmem_write_{byte,word,long}() - store data to mem (opclass 3) #
-# store_dreg_{b,w,l}() - store data to data regfile (opclass 3) #
-# facc_out_{b,w,l}() - store to memory took access error (opcl 3) #
-# #
-# INPUT *************************************************************** #
-# - The system stack contains the FP Operr exception frame #
-# - The fsave frame contains the source operand #
-# #
-# OUTPUT ************************************************************** #
-# No access error: #
-# - The system stack is unchanged #
-# - The fsave frame contains the adjusted src op for opclass 0,2 #
-# #
-# ALGORITHM *********************************************************** #
-# In a system where the FP Operr exception is enabled, the goal #
-# is to get to the handler specified at _real_operr(). But, on the 060, #
-# for opclass zero and two instruction taking this exception, the #
-# input operand in the fsave frame may be incorrect for some cases #
-# and needs to be corrected. This handler calls fix_skewed_ops() to #
-# do just this and then exits through _real_operr(). #
-# For opclass 3 instructions, the 060 doesn't store the default #
-# operr result out to memory or data register file as it should. #
-# This code must emulate the move out before finally exiting through #
-# _real_inex(). The move out, if to memory, is performed using #
-# _mem_write() "callout" routines that may return a failing result. #
-# In this special case, the handler must exit through facc_out() #
-# which creates an access error stack frame from the current operr #
-# stack frame. #
-# #
-#########################################################################
-
- global _fpsp_operr
-_fpsp_operr:
-
- link.w %a6,&-LOCAL_SIZE # init stack frame
-
- fsave FP_SRC(%a6) # grab the "busy" frame
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FPREGS(%a6) # save fp0-fp1 on stack
-
-# the FPIAR holds the "current PC" of the faulting instruction
- mov.l USER_FPIAR(%a6),EXC_EXTWPTR(%a6)
-
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch the instruction words
- mov.l %d0,EXC_OPWORD(%a6)
-
-##############################################################################
-
- btst &13,%d0 # is instr an fmove out?
- bne.b foperr_out # fmove out
-
-
-# here, we simply see if the operand in the fsave frame needs to be "unskewed".
-# this would be the case for opclass two operations with a source infinity or
-# denorm operand in the sgl or dbl format. NANs also become skewed, but can't
-# cause an operr so we don't need to check for them here.
- lea FP_SRC(%a6),%a0 # pass: ptr to src op
- bsr.l fix_skewed_ops # fix src op
-
-foperr_exit:
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- frestore FP_SRC(%a6)
-
- unlk %a6
- bra.l _real_operr
-
-########################################################################
-
-#
-# the hardware does not save the default result to memory on enabled
-# operand error exceptions. we do this here before passing control to
-# the user operand error handler.
-#
-# byte, word, and long destination format operations can pass
-# through here. we simply need to test the sign of the src
-# operand and save the appropriate minimum or maximum integer value
-# to the effective address as pointed to by the stacked effective address.
-#
-# although packed opclass three operations can take operand error
-# exceptions, they won't pass through here since they are caught
-# first by the unsupported data format exception handler. that handler
-# sends them directly to _real_operr() if necessary.
-#
-foperr_out:
-
- mov.w FP_SRC_EX(%a6),%d1 # fetch exponent
- andi.w &0x7fff,%d1
- cmpi.w %d1,&0x7fff
- bne.b foperr_out_not_qnan
-# the operand is either an infinity or a QNAN.
- tst.l FP_SRC_LO(%a6)
- bne.b foperr_out_qnan
- mov.l FP_SRC_HI(%a6),%d1
- andi.l &0x7fffffff,%d1
- beq.b foperr_out_not_qnan
-foperr_out_qnan:
- mov.l FP_SRC_HI(%a6),L_SCR1(%a6)
- bra.b foperr_out_jmp
-
-foperr_out_not_qnan:
- mov.l &0x7fffffff,%d1
- tst.b FP_SRC_EX(%a6)
- bpl.b foperr_out_not_qnan2
- addq.l &0x1,%d1
-foperr_out_not_qnan2:
- mov.l %d1,L_SCR1(%a6)
-
-foperr_out_jmp:
- bfextu %d0{&19:&3},%d0 # extract dst format field
- mov.b 1+EXC_OPWORD(%a6),%d1 # extract <ea> mode,reg
- mov.w (tbl_operr.b,%pc,%d0.w*2),%a0
- jmp (tbl_operr.b,%pc,%a0)
-
-tbl_operr:
- short foperr_out_l - tbl_operr # long word integer
- short tbl_operr - tbl_operr # sgl prec shouldn't happen
- short tbl_operr - tbl_operr # ext prec shouldn't happen
- short foperr_exit - tbl_operr # packed won't enter here
- short foperr_out_w - tbl_operr # word integer
- short tbl_operr - tbl_operr # dbl prec shouldn't happen
- short foperr_out_b - tbl_operr # byte integer
- short tbl_operr - tbl_operr # packed won't enter here
-
-foperr_out_b:
- mov.b L_SCR1(%a6),%d0 # load positive default result
- cmpi.b %d1,&0x7 # is <ea> mode a data reg?
- ble.b foperr_out_b_save_dn # yes
- mov.l EXC_EA(%a6),%a0 # pass: <ea> of default result
- bsr.l _dmem_write_byte # write the default result
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_b # yes
-
- bra.w foperr_exit
-foperr_out_b_save_dn:
- andi.w &0x0007,%d1
- bsr.l store_dreg_b # store result to regfile
- bra.w foperr_exit
-
-foperr_out_w:
- mov.w L_SCR1(%a6),%d0 # load positive default result
- cmpi.b %d1,&0x7 # is <ea> mode a data reg?
- ble.b foperr_out_w_save_dn # yes
- mov.l EXC_EA(%a6),%a0 # pass: <ea> of default result
- bsr.l _dmem_write_word # write the default result
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_w # yes
-
- bra.w foperr_exit
-foperr_out_w_save_dn:
- andi.w &0x0007,%d1
- bsr.l store_dreg_w # store result to regfile
- bra.w foperr_exit
-
-foperr_out_l:
- mov.l L_SCR1(%a6),%d0 # load positive default result
- cmpi.b %d1,&0x7 # is <ea> mode a data reg?
- ble.b foperr_out_l_save_dn # yes
- mov.l EXC_EA(%a6),%a0 # pass: <ea> of default result
- bsr.l _dmem_write_long # write the default result
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_l # yes
-
- bra.w foperr_exit
-foperr_out_l_save_dn:
- andi.w &0x0007,%d1
- bsr.l store_dreg_l # store result to regfile
- bra.w foperr_exit
-
-#########################################################################
-# XDEF **************************************************************** #
-# _fpsp_snan(): 060FPSP entry point for FP SNAN exception. #
-# #
-# This handler should be the first code executed upon taking the #
-# FP Signalling NAN exception in an operating system. #
-# #
-# XREF **************************************************************** #
-# _imem_read_long() - read instruction longword #
-# fix_skewed_ops() - adjust src operand in fsave frame #
-# _real_snan() - "callout" to operating system SNAN handler #
-# _dmem_write_{byte,word,long}() - store data to mem (opclass 3) #
-# store_dreg_{b,w,l}() - store data to data regfile (opclass 3) #
-# facc_out_{b,w,l,d,x}() - store to mem took acc error (opcl 3) #
-# _calc_ea_fout() - fix An if <ea> is -() or ()+; also get <ea> #
-# #
-# INPUT *************************************************************** #
-# - The system stack contains the FP SNAN exception frame #
-# - The fsave frame contains the source operand #
-# #
-# OUTPUT ************************************************************** #
-# No access error: #
-# - The system stack is unchanged #
-# - The fsave frame contains the adjusted src op for opclass 0,2 #
-# #
-# ALGORITHM *********************************************************** #
-# In a system where the FP SNAN exception is enabled, the goal #
-# is to get to the handler specified at _real_snan(). But, on the 060, #
-# for opclass zero and two instructions taking this exception, the #
-# input operand in the fsave frame may be incorrect for some cases #
-# and needs to be corrected. This handler calls fix_skewed_ops() to #
-# do just this and then exits through _real_snan(). #
-# For opclass 3 instructions, the 060 doesn't store the default #
-# SNAN result out to memory or data register file as it should. #
-# This code must emulate the move out before finally exiting through #
-# _real_snan(). The move out, if to memory, is performed using #
-# _mem_write() "callout" routines that may return a failing result. #
-# In this special case, the handler must exit through facc_out() #
-# which creates an access error stack frame from the current SNAN #
-# stack frame. #
-# For the case of an extended precision opclass 3 instruction, #
-# if the effective addressing mode was -() or ()+, then the address #
-# register must get updated by calling _calc_ea_fout(). If the <ea> #
-# was -(a7) from supervisor mode, then the exception frame currently #
-# on the system stack must be carefully moved "down" to make room #
-# for the operand being moved. #
-# #
-#########################################################################
-
- global _fpsp_snan
-_fpsp_snan:
-
- link.w %a6,&-LOCAL_SIZE # init stack frame
-
- fsave FP_SRC(%a6) # grab the "busy" frame
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FPREGS(%a6) # save fp0-fp1 on stack
-
-# the FPIAR holds the "current PC" of the faulting instruction
- mov.l USER_FPIAR(%a6),EXC_EXTWPTR(%a6)
-
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch the instruction words
- mov.l %d0,EXC_OPWORD(%a6)
-
-##############################################################################
-
- btst &13,%d0 # is instr an fmove out?
- bne.w fsnan_out # fmove out
-
-
-# here, we simply see if the operand in the fsave frame needs to be "unskewed".
-# this would be the case for opclass two operations with a source infinity or
-# denorm operand in the sgl or dbl format. NANs also become skewed and must be
-# fixed here.
- lea FP_SRC(%a6),%a0 # pass: ptr to src op
- bsr.l fix_skewed_ops # fix src op
-
-fsnan_exit:
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- frestore FP_SRC(%a6)
-
- unlk %a6
- bra.l _real_snan
-
-########################################################################
-
-#
-# the hardware does not save the default result to memory on enabled
-# snan exceptions. we do this here before passing control to
-# the user snan handler.
-#
-# byte, word, long, and packed destination format operations can pass
-# through here. since packed format operations already were handled by
-# fpsp_unsupp(), then we need to do nothing else for them here.
-# for byte, word, and long, we simply need to test the sign of the src
-# operand and save the appropriate minimum or maximum integer value
-# to the effective address as pointed to by the stacked effective address.
-#
-fsnan_out:
-
- bfextu %d0{&19:&3},%d0 # extract dst format field
- mov.b 1+EXC_OPWORD(%a6),%d1 # extract <ea> mode,reg
- mov.w (tbl_snan.b,%pc,%d0.w*2),%a0
- jmp (tbl_snan.b,%pc,%a0)
-
-tbl_snan:
- short fsnan_out_l - tbl_snan # long word integer
- short fsnan_out_s - tbl_snan # sgl prec shouldn't happen
- short fsnan_out_x - tbl_snan # ext prec shouldn't happen
- short tbl_snan - tbl_snan # packed needs no help
- short fsnan_out_w - tbl_snan # word integer
- short fsnan_out_d - tbl_snan # dbl prec shouldn't happen
- short fsnan_out_b - tbl_snan # byte integer
- short tbl_snan - tbl_snan # packed needs no help
-
-fsnan_out_b:
- mov.b FP_SRC_HI(%a6),%d0 # load upper byte of SNAN
- bset &6,%d0 # set SNAN bit
- cmpi.b %d1,&0x7 # is <ea> mode a data reg?
- ble.b fsnan_out_b_dn # yes
- mov.l EXC_EA(%a6),%a0 # pass: <ea> of default result
- bsr.l _dmem_write_byte # write the default result
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_b # yes
-
- bra.w fsnan_exit
-fsnan_out_b_dn:
- andi.w &0x0007,%d1
- bsr.l store_dreg_b # store result to regfile
- bra.w fsnan_exit
-
-fsnan_out_w:
- mov.w FP_SRC_HI(%a6),%d0 # load upper word of SNAN
- bset &14,%d0 # set SNAN bit
- cmpi.b %d1,&0x7 # is <ea> mode a data reg?
- ble.b fsnan_out_w_dn # yes
- mov.l EXC_EA(%a6),%a0 # pass: <ea> of default result
- bsr.l _dmem_write_word # write the default result
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_w # yes
-
- bra.w fsnan_exit
-fsnan_out_w_dn:
- andi.w &0x0007,%d1
- bsr.l store_dreg_w # store result to regfile
- bra.w fsnan_exit
-
-fsnan_out_l:
- mov.l FP_SRC_HI(%a6),%d0 # load upper longword of SNAN
- bset &30,%d0 # set SNAN bit
- cmpi.b %d1,&0x7 # is <ea> mode a data reg?
- ble.b fsnan_out_l_dn # yes
- mov.l EXC_EA(%a6),%a0 # pass: <ea> of default result
- bsr.l _dmem_write_long # write the default result
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_l # yes
-
- bra.w fsnan_exit
-fsnan_out_l_dn:
- andi.w &0x0007,%d1
- bsr.l store_dreg_l # store result to regfile
- bra.w fsnan_exit
-
-fsnan_out_s:
- cmpi.b %d1,&0x7 # is <ea> mode a data reg?
- ble.b fsnan_out_d_dn # yes
- mov.l FP_SRC_EX(%a6),%d0 # fetch SNAN sign
- andi.l &0x80000000,%d0 # keep sign
- ori.l &0x7fc00000,%d0 # insert new exponent,SNAN bit
- mov.l FP_SRC_HI(%a6),%d1 # load mantissa
- lsr.l &0x8,%d1 # shift mantissa for sgl
- or.l %d1,%d0 # create sgl SNAN
- mov.l EXC_EA(%a6),%a0 # pass: <ea> of default result
- bsr.l _dmem_write_long # write the default result
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_l # yes
-
- bra.w fsnan_exit
-fsnan_out_d_dn:
- mov.l FP_SRC_EX(%a6),%d0 # fetch SNAN sign
- andi.l &0x80000000,%d0 # keep sign
- ori.l &0x7fc00000,%d0 # insert new exponent,SNAN bit
- mov.l %d1,-(%sp)
- mov.l FP_SRC_HI(%a6),%d1 # load mantissa
- lsr.l &0x8,%d1 # shift mantissa for sgl
- or.l %d1,%d0 # create sgl SNAN
- mov.l (%sp)+,%d1
- andi.w &0x0007,%d1
- bsr.l store_dreg_l # store result to regfile
- bra.w fsnan_exit
-
-fsnan_out_d:
- mov.l FP_SRC_EX(%a6),%d0 # fetch SNAN sign
- andi.l &0x80000000,%d0 # keep sign
- ori.l &0x7ff80000,%d0 # insert new exponent,SNAN bit
- mov.l FP_SRC_HI(%a6),%d1 # load hi mantissa
- mov.l %d0,FP_SCR0_EX(%a6) # store to temp space
- mov.l &11,%d0 # load shift amt
- lsr.l %d0,%d1
- or.l %d1,FP_SCR0_EX(%a6) # create dbl hi
- mov.l FP_SRC_HI(%a6),%d1 # load hi mantissa
- andi.l &0x000007ff,%d1
- ror.l %d0,%d1
- mov.l %d1,FP_SCR0_HI(%a6) # store to temp space
- mov.l FP_SRC_LO(%a6),%d1 # load lo mantissa
- lsr.l %d0,%d1
- or.l %d1,FP_SCR0_HI(%a6) # create dbl lo
- lea FP_SCR0(%a6),%a0 # pass: ptr to operand
- mov.l EXC_EA(%a6),%a1 # pass: dst addr
- movq.l &0x8,%d0 # pass: size of 8 bytes
- bsr.l _dmem_write # write the default result
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_d # yes
-
- bra.w fsnan_exit
-
-# for extended precision, if the addressing mode is pre-decrement or
-# post-increment, then the address register did not get updated.
-# in addition, for pre-decrement, the stacked <ea> is incorrect.
-fsnan_out_x:
- clr.b SPCOND_FLG(%a6) # clear special case flag
-
- mov.w FP_SRC_EX(%a6),FP_SCR0_EX(%a6)
- clr.w 2+FP_SCR0(%a6)
- mov.l FP_SRC_HI(%a6),%d0
- bset &30,%d0
- mov.l %d0,FP_SCR0_HI(%a6)
- mov.l FP_SRC_LO(%a6),FP_SCR0_LO(%a6)
-
- btst &0x5,EXC_SR(%a6) # supervisor mode exception?
- bne.b fsnan_out_x_s # yes
-
- mov.l %usp,%a0 # fetch user stack pointer
- mov.l %a0,EXC_A7(%a6) # save on stack for calc_ea()
- mov.l (%a6),EXC_A6(%a6)
-
- bsr.l _calc_ea_fout # find the correct ea,update An
- mov.l %a0,%a1
- mov.l %a0,EXC_EA(%a6) # stack correct <ea>
-
- mov.l EXC_A7(%a6),%a0
- mov.l %a0,%usp # restore user stack pointer
- mov.l EXC_A6(%a6),(%a6)
-
-fsnan_out_x_save:
- lea FP_SCR0(%a6),%a0 # pass: ptr to operand
- movq.l &0xc,%d0 # pass: size of extended
- bsr.l _dmem_write # write the default result
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_x # yes
-
- bra.w fsnan_exit
-
-fsnan_out_x_s:
- mov.l (%a6),EXC_A6(%a6)
-
- bsr.l _calc_ea_fout # find the correct ea,update An
- mov.l %a0,%a1
- mov.l %a0,EXC_EA(%a6) # stack correct <ea>
-
- mov.l EXC_A6(%a6),(%a6)
-
- cmpi.b SPCOND_FLG(%a6),&mda7_flg # is <ea> mode -(a7)?
- bne.b fsnan_out_x_save # no
-
-# the operation was "fmove.x SNAN,-(a7)" from supervisor mode.
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- frestore FP_SRC(%a6)
-
- mov.l EXC_A6(%a6),%a6 # restore frame pointer
-
- mov.l LOCAL_SIZE+EXC_SR(%sp),LOCAL_SIZE+EXC_SR-0xc(%sp)
- mov.l LOCAL_SIZE+EXC_PC+0x2(%sp),LOCAL_SIZE+EXC_PC+0x2-0xc(%sp)
- mov.l LOCAL_SIZE+EXC_EA(%sp),LOCAL_SIZE+EXC_EA-0xc(%sp)
-
- mov.l LOCAL_SIZE+FP_SCR0_EX(%sp),LOCAL_SIZE+EXC_SR(%sp)
- mov.l LOCAL_SIZE+FP_SCR0_HI(%sp),LOCAL_SIZE+EXC_PC+0x2(%sp)
- mov.l LOCAL_SIZE+FP_SCR0_LO(%sp),LOCAL_SIZE+EXC_EA(%sp)
-
- add.l &LOCAL_SIZE-0x8,%sp
-
- bra.l _real_snan
-
-#########################################################################
-# XDEF **************************************************************** #
-# _fpsp_inex(): 060FPSP entry point for FP Inexact exception. #
-# #
-# This handler should be the first code executed upon taking the #
-# FP Inexact exception in an operating system. #
-# #
-# XREF **************************************************************** #
-# _imem_read_long() - read instruction longword #
-# fix_skewed_ops() - adjust src operand in fsave frame #
-# set_tag_x() - determine optype of src/dst operands #
-# store_fpreg() - store opclass 0 or 2 result to FP regfile #
-# unnorm_fix() - change UNNORM operands to NORM or ZERO #
-# load_fpn2() - load dst operand from FP regfile #
-# smovcr() - emulate an "fmovcr" instruction #
-# fout() - emulate an opclass 3 instruction #
-# tbl_unsupp - add of table of emulation routines for opclass 0,2 #
-# _real_inex() - "callout" to operating system inexact handler #
-# #
-# INPUT *************************************************************** #
-# - The system stack contains the FP Inexact exception frame #
-# - The fsave frame contains the source operand #
-# #
-# OUTPUT ************************************************************** #
-# - The system stack is unchanged #
-# - The fsave frame contains the adjusted src op for opclass 0,2 #
-# #
-# ALGORITHM *********************************************************** #
-# In a system where the FP Inexact exception is enabled, the goal #
-# is to get to the handler specified at _real_inex(). But, on the 060, #
-# for opclass zero and two instruction taking this exception, the #
-# hardware doesn't store the correct result to the destination FP #
-# register as did the '040 and '881/2. This handler must emulate the #
-# instruction in order to get this value and then store it to the #
-# correct register before calling _real_inex(). #
-# For opclass 3 instructions, the 060 doesn't store the default #
-# inexact result out to memory or data register file as it should. #
-# This code must emulate the move out by calling fout() before finally #
-# exiting through _real_inex(). #
-# #
-#########################################################################
-
- global _fpsp_inex
-_fpsp_inex:
-
- link.w %a6,&-LOCAL_SIZE # init stack frame
-
- fsave FP_SRC(%a6) # grab the "busy" frame
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FPREGS(%a6) # save fp0-fp1 on stack
-
-# the FPIAR holds the "current PC" of the faulting instruction
- mov.l USER_FPIAR(%a6),EXC_EXTWPTR(%a6)
-
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch the instruction words
- mov.l %d0,EXC_OPWORD(%a6)
-
-##############################################################################
-
- btst &13,%d0 # is instr an fmove out?
- bne.w finex_out # fmove out
-
-
-# the hardware, for "fabs" and "fneg" w/ a long source format, puts the
-# longword integer directly into the upper longword of the mantissa along
-# w/ an exponent value of 0x401e. we convert this to extended precision here.
- bfextu %d0{&19:&3},%d0 # fetch instr size
- bne.b finex_cont # instr size is not long
- cmpi.w FP_SRC_EX(%a6),&0x401e # is exponent 0x401e?
- bne.b finex_cont # no
- fmov.l &0x0,%fpcr
- fmov.l FP_SRC_HI(%a6),%fp0 # load integer src
- fmov.x %fp0,FP_SRC(%a6) # store integer as extended precision
- mov.w &0xe001,0x2+FP_SRC(%a6)
-
-finex_cont:
- lea FP_SRC(%a6),%a0 # pass: ptr to src op
- bsr.l fix_skewed_ops # fix src op
-
-# Here, we zero the ccode and exception byte field since we're going to
-# emulate the whole instruction. Notice, though, that we don't kill the
-# INEX1 bit. This is because a packed op has long since been converted
-# to extended before arriving here. Therefore, we need to retain the
-# INEX1 bit from when the operand was first converted.
- andi.l &0x00ff01ff,USER_FPSR(%a6) # zero all but accured field
-
- fmov.l &0x0,%fpcr # zero current control regs
- fmov.l &0x0,%fpsr
-
- bfextu EXC_EXTWORD(%a6){&0:&6},%d1 # extract upper 6 of cmdreg
- cmpi.b %d1,&0x17 # is op an fmovecr?
- beq.w finex_fmovcr # yes
-
- lea FP_SRC(%a6),%a0 # pass: ptr to src op
- bsr.l set_tag_x # tag the operand type
- mov.b %d0,STAG(%a6) # maybe NORM,DENORM
-
-# bits four and five of the fp extension word separate the monadic and dyadic
-# operations that can pass through fpsp_inex(). remember that fcmp and ftst
-# will never take this exception, but fsincos will.
- btst &0x5,1+EXC_CMDREG(%a6) # is operation monadic or dyadic?
- beq.b finex_extract # monadic
-
- btst &0x4,1+EXC_CMDREG(%a6) # is operation an fsincos?
- bne.b finex_extract # yes
-
- bfextu EXC_CMDREG(%a6){&6:&3},%d0 # dyadic; load dst reg
- bsr.l load_fpn2 # load dst into FP_DST
-
- lea FP_DST(%a6),%a0 # pass: ptr to dst op
- bsr.l set_tag_x # tag the operand type
- cmpi.b %d0,&UNNORM # is operand an UNNORM?
- bne.b finex_op2_done # no
- bsr.l unnorm_fix # yes; convert to NORM,DENORM,or ZERO
-finex_op2_done:
- mov.b %d0,DTAG(%a6) # save dst optype tag
-
-finex_extract:
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd prec/mode
-
- mov.b 1+EXC_CMDREG(%a6),%d1
- andi.w &0x007f,%d1 # extract extension
-
- lea FP_SRC(%a6),%a0
- lea FP_DST(%a6),%a1
-
- mov.l (tbl_unsupp.l,%pc,%d1.w*4),%d1 # fetch routine addr
- jsr (tbl_unsupp.l,%pc,%d1.l*1)
-
-# the operation has been emulated. the result is in fp0.
-finex_save:
- bfextu EXC_CMDREG(%a6){&6:&3},%d0
- bsr.l store_fpreg
-
-finex_exit:
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- frestore FP_SRC(%a6)
-
- unlk %a6
- bra.l _real_inex
-
-finex_fmovcr:
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd prec,mode
- mov.b 1+EXC_CMDREG(%a6),%d1
- andi.l &0x0000007f,%d1 # pass rom offset
- bsr.l smovcr
- bra.b finex_save
-
-########################################################################
-
-#
-# the hardware does not save the default result to memory on enabled
-# inexact exceptions. we do this here before passing control to
-# the user inexact handler.
-#
-# byte, word, and long destination format operations can pass
-# through here. so can double and single precision.
-# although packed opclass three operations can take inexact
-# exceptions, they won't pass through here since they are caught
-# first by the unsupported data format exception handler. that handler
-# sends them directly to _real_inex() if necessary.
-#
-finex_out:
-
- mov.b &NORM,STAG(%a6) # src is a NORM
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd prec,mode
-
- andi.l &0xffff00ff,USER_FPSR(%a6) # zero exception field
-
- lea FP_SRC(%a6),%a0 # pass ptr to src operand
-
- bsr.l fout # store the default result
-
- bra.b finex_exit
-
-#########################################################################
-# XDEF **************************************************************** #
-# _fpsp_dz(): 060FPSP entry point for FP DZ exception. #
-# #
-# This handler should be the first code executed upon taking #
-# the FP DZ exception in an operating system. #
-# #
-# XREF **************************************************************** #
-# _imem_read_long() - read instruction longword from memory #
-# fix_skewed_ops() - adjust fsave operand #
-# _real_dz() - "callout" exit point from FP DZ handler #
-# #
-# INPUT *************************************************************** #
-# - The system stack contains the FP DZ exception stack. #
-# - The fsave frame contains the source operand. #
-# #
-# OUTPUT ************************************************************** #
-# - The system stack contains the FP DZ exception stack. #
-# - The fsave frame contains the adjusted source operand. #
-# #
-# ALGORITHM *********************************************************** #
-# In a system where the DZ exception is enabled, the goal is to #
-# get to the handler specified at _real_dz(). But, on the 060, when the #
-# exception is taken, the input operand in the fsave state frame may #
-# be incorrect for some cases and need to be adjusted. So, this package #
-# adjusts the operand using fix_skewed_ops() and then branches to #
-# _real_dz(). #
-# #
-#########################################################################
-
- global _fpsp_dz
-_fpsp_dz:
-
- link.w %a6,&-LOCAL_SIZE # init stack frame
-
- fsave FP_SRC(%a6) # grab the "busy" frame
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FPREGS(%a6) # save fp0-fp1 on stack
-
-# the FPIAR holds the "current PC" of the faulting instruction
- mov.l USER_FPIAR(%a6),EXC_EXTWPTR(%a6)
-
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch the instruction words
- mov.l %d0,EXC_OPWORD(%a6)
-
-##############################################################################
-
-
-# here, we simply see if the operand in the fsave frame needs to be "unskewed".
-# this would be the case for opclass two operations with a source zero
-# in the sgl or dbl format.
- lea FP_SRC(%a6),%a0 # pass: ptr to src op
- bsr.l fix_skewed_ops # fix src op
-
-fdz_exit:
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- frestore FP_SRC(%a6)
-
- unlk %a6
- bra.l _real_dz
-
-#########################################################################
-# XDEF **************************************************************** #
-# _fpsp_fline(): 060FPSP entry point for "Line F emulator" exc. #
-# #
-# This handler should be the first code executed upon taking the #
-# "Line F Emulator" exception in an operating system. #
-# #
-# XREF **************************************************************** #
-# _fpsp_unimp() - handle "FP Unimplemented" exceptions #
-# _real_fpu_disabled() - handle "FPU disabled" exceptions #
-# _real_fline() - handle "FLINE" exceptions #
-# _imem_read_long() - read instruction longword #
-# #
-# INPUT *************************************************************** #
-# - The system stack contains a "Line F Emulator" exception #
-# stack frame. #
-# #
-# OUTPUT ************************************************************** #
-# - The system stack is unchanged #
-# #
-# ALGORITHM *********************************************************** #
-# When a "Line F Emulator" exception occurs, there are 3 possible #
-# exception types, denoted by the exception stack frame format number: #
-# (1) FPU unimplemented instruction (6 word stack frame) #
-# (2) FPU disabled (8 word stack frame) #
-# (3) Line F (4 word stack frame) #
-# #
-# This module determines which and forks the flow off to the #
-# appropriate "callout" (for "disabled" and "Line F") or to the #
-# correct emulation code (for "FPU unimplemented"). #
-# This code also must check for "fmovecr" instructions w/ a #
-# non-zero <ea> field. These may get flagged as "Line F" but should #
-# really be flagged as "FPU Unimplemented". (This is a "feature" on #
-# the '060. #
-# #
-#########################################################################
-
- global _fpsp_fline
-_fpsp_fline:
-
-# check to see if this exception is a "FP Unimplemented Instruction"
-# exception. if so, branch directly to that handler's entry point.
- cmpi.w 0x6(%sp),&0x202c
- beq.l _fpsp_unimp
-
-# check to see if the FPU is disabled. if so, jump to the OS entry
-# point for that condition.
- cmpi.w 0x6(%sp),&0x402c
- beq.l _real_fpu_disabled
-
-# the exception was an "F-Line Illegal" exception. we check to see
-# if the F-Line instruction is an "fmovecr" w/ a non-zero <ea>. if
-# so, convert the F-Line exception stack frame to an FP Unimplemented
-# Instruction exception stack frame else branch to the OS entry
-# point for the F-Line exception handler.
- link.w %a6,&-LOCAL_SIZE # init stack frame
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
-
- mov.l EXC_PC(%a6),EXC_EXTWPTR(%a6)
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch instruction words
-
- bfextu %d0{&0:&10},%d1 # is it an fmovecr?
- cmpi.w %d1,&0x03c8
- bne.b fline_fline # no
-
- bfextu %d0{&16:&6},%d1 # is it an fmovecr?
- cmpi.b %d1,&0x17
- bne.b fline_fline # no
-
-# it's an fmovecr w/ a non-zero <ea> that has entered through
-# the F-Line Illegal exception.
-# so, we need to convert the F-Line exception stack frame into an
-# FP Unimplemented Instruction stack frame and jump to that entry
-# point.
-#
-# but, if the FPU is disabled, then we need to jump to the FPU disabled
-# entry point.
- movc %pcr,%d0
- btst &0x1,%d0
- beq.b fline_fmovcr
-
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6
-
- sub.l &0x8,%sp # make room for "Next PC", <ea>
- mov.w 0x8(%sp),(%sp)
- mov.l 0xa(%sp),0x2(%sp) # move "Current PC"
- mov.w &0x402c,0x6(%sp)
- mov.l 0x2(%sp),0xc(%sp)
- addq.l &0x4,0x2(%sp) # set "Next PC"
-
- bra.l _real_fpu_disabled
-
-fline_fmovcr:
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6
-
- fmov.l 0x2(%sp),%fpiar # set current PC
- addq.l &0x4,0x2(%sp) # set Next PC
-
- mov.l (%sp),-(%sp)
- mov.l 0x8(%sp),0x4(%sp)
- mov.b &0x20,0x6(%sp)
-
- bra.l _fpsp_unimp
-
-fline_fline:
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6
-
- bra.l _real_fline
-
-#########################################################################
-# XDEF **************************************************************** #
-# _fpsp_unimp(): 060FPSP entry point for FP "Unimplemented #
-# Instruction" exception. #
-# #
-# This handler should be the first code executed upon taking the #
-# FP Unimplemented Instruction exception in an operating system. #
-# #
-# XREF **************************************************************** #
-# _imem_read_{word,long}() - read instruction word/longword #
-# load_fop() - load src/dst ops from memory and/or FP regfile #
-# store_fpreg() - store opclass 0 or 2 result to FP regfile #
-# tbl_trans - addr of table of emulation routines for trnscndls #
-# _real_access() - "callout" for access error exception #
-# _fpsp_done() - "callout" for exit; work all done #
-# _real_trace() - "callout" for Trace enabled exception #
-# smovcr() - emulate "fmovecr" instruction #
-# funimp_skew() - adjust fsave src ops to "incorrect" value #
-# _ftrapcc() - emulate an "ftrapcc" instruction #
-# _fdbcc() - emulate an "fdbcc" instruction #
-# _fscc() - emulate an "fscc" instruction #
-# _real_trap() - "callout" for Trap exception #
-# _real_bsun() - "callout" for enabled Bsun exception #
-# #
-# INPUT *************************************************************** #
-# - The system stack contains the "Unimplemented Instr" stk frame #
-# #
-# OUTPUT ************************************************************** #
-# If access error: #
-# - The system stack is changed to an access error stack frame #
-# If Trace exception enabled: #
-# - The system stack is changed to a Trace exception stack frame #
-# Else: (normal case) #
-# - Correct result has been stored as appropriate #
-# #
-# ALGORITHM *********************************************************** #
-# There are two main cases of instructions that may enter here to #
-# be emulated: (1) the FPgen instructions, most of which were also #
-# unimplemented on the 040, and (2) "ftrapcc", "fscc", and "fdbcc". #
-# For the first set, this handler calls the routine load_fop() #
-# to load the source and destination (for dyadic) operands to be used #
-# for instruction emulation. The correct emulation routine is then #
-# chosen by decoding the instruction type and indexing into an #
-# emulation subroutine index table. After emulation returns, this #
-# handler checks to see if an exception should occur as a result of the #
-# FP instruction emulation. If so, then an FP exception of the correct #
-# type is inserted into the FPU state frame using the "frestore" #
-# instruction before exiting through _fpsp_done(). In either the #
-# exceptional or non-exceptional cases, we must check to see if the #
-# Trace exception is enabled. If so, then we must create a Trace #
-# exception frame from the current exception frame and exit through #
-# _real_trace(). #
-# For "fdbcc", "ftrapcc", and "fscc", the emulation subroutines #
-# _fdbcc(), _ftrapcc(), and _fscc() respectively are used. All three #
-# may flag that a BSUN exception should be taken. If so, then the #
-# current exception stack frame is converted into a BSUN exception #
-# stack frame and an exit is made through _real_bsun(). If the #
-# instruction was "ftrapcc" and a Trap exception should result, a Trap #
-# exception stack frame is created from the current frame and an exit #
-# is made through _real_trap(). If a Trace exception is pending, then #
-# a Trace exception frame is created from the current frame and a jump #
-# is made to _real_trace(). Finally, if none of these conditions exist, #
-# then the handler exits though the callout _fpsp_done(). #
-# #
-# In any of the above scenarios, if a _mem_read() or _mem_write() #
-# "callout" returns a failing value, then an access error stack frame #
-# is created from the current stack frame and an exit is made through #
-# _real_access(). #
-# #
-#########################################################################
-
-#
-# FP UNIMPLEMENTED INSTRUCTION STACK FRAME:
-#
-# *****************
-# * * => <ea> of fp unimp instr.
-# - EA -
-# * *
-# *****************
-# * 0x2 * 0x02c * => frame format and vector offset(vector #11)
-# *****************
-# * *
-# - Next PC - => PC of instr to execute after exc handling
-# * *
-# *****************
-# * SR * => SR at the time the exception was taken
-# *****************
-#
-# Note: the !NULL bit does not get set in the fsave frame when the
-# machine encounters an fp unimp exception. Therefore, it must be set
-# before leaving this handler.
-#
- global _fpsp_unimp
-_fpsp_unimp:
-
- link.w %a6,&-LOCAL_SIZE # init stack frame
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FPREGS(%a6) # save fp0-fp1
-
- btst &0x5,EXC_SR(%a6) # user mode exception?
- bne.b funimp_s # no; supervisor mode
-
-# save the value of the user stack pointer onto the stack frame
-funimp_u:
- mov.l %usp,%a0 # fetch user stack pointer
- mov.l %a0,EXC_A7(%a6) # store in stack frame
- bra.b funimp_cont
-
-# store the value of the supervisor stack pointer BEFORE the exc occurred.
-# old_sp is address just above stacked effective address.
-funimp_s:
- lea 4+EXC_EA(%a6),%a0 # load old a7'
- mov.l %a0,EXC_A7(%a6) # store a7'
- mov.l %a0,OLD_A7(%a6) # make a copy
-
-funimp_cont:
-
-# the FPIAR holds the "current PC" of the faulting instruction.
- mov.l USER_FPIAR(%a6),EXC_EXTWPTR(%a6)
-
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch the instruction words
- mov.l %d0,EXC_OPWORD(%a6)
-
-############################################################################
-
- fmov.l &0x0,%fpcr # clear FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- clr.b SPCOND_FLG(%a6) # clear "special case" flag
-
-# Divide the fp instructions into 8 types based on the TYPE field in
-# bits 6-8 of the opword(classes 6,7 are undefined).
-# (for the '060, only two types can take this exception)
-# bftst %d0{&7:&3} # test TYPE
- btst &22,%d0 # type 0 or 1 ?
- bne.w funimp_misc # type 1
-
-#########################################
-# TYPE == 0: General instructions #
-#########################################
-funimp_gen:
-
- clr.b STORE_FLG(%a6) # clear "store result" flag
-
-# clear the ccode byte and exception status byte
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- bfextu %d0{&16:&6},%d1 # extract upper 6 of cmdreg
- cmpi.b %d1,&0x17 # is op an fmovecr?
- beq.w funimp_fmovcr # yes
-
-funimp_gen_op:
- bsr.l _load_fop # load
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # fetch rnd mode
-
- mov.b 1+EXC_CMDREG(%a6),%d1
- andi.w &0x003f,%d1 # extract extension bits
- lsl.w &0x3,%d1 # shift right 3 bits
- or.b STAG(%a6),%d1 # insert src optag bits
-
- lea FP_DST(%a6),%a1 # pass dst ptr in a1
- lea FP_SRC(%a6),%a0 # pass src ptr in a0
-
- mov.w (tbl_trans.w,%pc,%d1.w*2),%d1
- jsr (tbl_trans.w,%pc,%d1.w*1) # emulate
-
-funimp_fsave:
- mov.b FPCR_ENABLE(%a6),%d0 # fetch exceptions enabled
- bne.w funimp_ena # some are enabled
-
-funimp_store:
- bfextu EXC_CMDREG(%a6){&6:&3},%d0 # fetch Dn
- bsr.l store_fpreg # store result to fp regfile
-
-funimp_gen_exit:
- fmovm.x EXC_FP0(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
-funimp_gen_exit_cmp:
- cmpi.b SPCOND_FLG(%a6),&mia7_flg # was the ea mode (sp)+ ?
- beq.b funimp_gen_exit_a7 # yes
-
- cmpi.b SPCOND_FLG(%a6),&mda7_flg # was the ea mode -(sp) ?
- beq.b funimp_gen_exit_a7 # yes
-
-funimp_gen_exit_cont:
- unlk %a6
-
-funimp_gen_exit_cont2:
- btst &0x7,(%sp) # is trace on?
- beq.l _fpsp_done # no
-
-# this catches a problem with the case where an exception will be re-inserted
-# into the machine. the frestore has already been executed...so, the fmov.l
-# alone of the control register would trigger an unwanted exception.
-# until I feel like fixing this, we'll sidestep the exception.
- fsave -(%sp)
- fmov.l %fpiar,0x14(%sp) # "Current PC" is in FPIAR
- frestore (%sp)+
- mov.w &0x2024,0x6(%sp) # stk fmt = 0x2; voff = 0x24
- bra.l _real_trace
-
-funimp_gen_exit_a7:
- btst &0x5,EXC_SR(%a6) # supervisor or user mode?
- bne.b funimp_gen_exit_a7_s # supervisor
-
- mov.l %a0,-(%sp)
- mov.l EXC_A7(%a6),%a0
- mov.l %a0,%usp
- mov.l (%sp)+,%a0
- bra.b funimp_gen_exit_cont
-
-# if the instruction was executed from supervisor mode and the addressing
-# mode was (a7)+, then the stack frame for the rte must be shifted "up"
-# "n" bytes where "n" is the size of the src operand type.
-# f<op>.{b,w,l,s,d,x,p}
-funimp_gen_exit_a7_s:
- mov.l %d0,-(%sp) # save d0
- mov.l EXC_A7(%a6),%d0 # load new a7'
- sub.l OLD_A7(%a6),%d0 # subtract old a7'
- mov.l 0x2+EXC_PC(%a6),(0x2+EXC_PC,%a6,%d0) # shift stack frame
- mov.l EXC_SR(%a6),(EXC_SR,%a6,%d0) # shift stack frame
- mov.w %d0,EXC_SR(%a6) # store incr number
- mov.l (%sp)+,%d0 # restore d0
-
- unlk %a6
-
- add.w (%sp),%sp # stack frame shifted
- bra.b funimp_gen_exit_cont2
-
-######################
-# fmovecr.x #ccc,fpn #
-######################
-funimp_fmovcr:
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0
- mov.b 1+EXC_CMDREG(%a6),%d1
- andi.l &0x0000007f,%d1 # pass rom offset in d1
- bsr.l smovcr
- bra.w funimp_fsave
-
-#########################################################################
-
-#
-# the user has enabled some exceptions. we figure not to see this too
-# often so that's why it gets lower priority.
-#
-funimp_ena:
-
-# was an exception set that was also enabled?
- and.b FPSR_EXCEPT(%a6),%d0 # keep only ones enabled and set
- bfffo %d0{&24:&8},%d0 # find highest priority exception
- bne.b funimp_exc # at least one was set
-
-# no exception that was enabled was set BUT if we got an exact overflow
-# and overflow wasn't enabled but inexact was (yech!) then this is
-# an inexact exception; otherwise, return to normal non-exception flow.
- btst &ovfl_bit,FPSR_EXCEPT(%a6) # did overflow occur?
- beq.w funimp_store # no; return to normal flow
-
-# the overflow w/ exact result happened but was inexact set in the FPCR?
-funimp_ovfl:
- btst &inex2_bit,FPCR_ENABLE(%a6) # is inexact enabled?
- beq.w funimp_store # no; return to normal flow
- bra.b funimp_exc_ovfl # yes
-
-# some exception happened that was actually enabled.
-# we'll insert this new exception into the FPU and then return.
-funimp_exc:
- subi.l &24,%d0 # fix offset to be 0-8
- cmpi.b %d0,&0x6 # is exception INEX?
- bne.b funimp_exc_force # no
-
-# the enabled exception was inexact. so, if it occurs with an overflow
-# or underflow that was disabled, then we have to force an overflow or
-# underflow frame. the eventual overflow or underflow handler will see that
-# it's actually an inexact and act appropriately. this is the only easy
-# way to have the EXOP available for the enabled inexact handler when
-# a disabled overflow or underflow has also happened.
- btst &ovfl_bit,FPSR_EXCEPT(%a6) # did overflow occur?
- bne.b funimp_exc_ovfl # yes
- btst &unfl_bit,FPSR_EXCEPT(%a6) # did underflow occur?
- bne.b funimp_exc_unfl # yes
-
-# force the fsave exception status bits to signal an exception of the
-# appropriate type. don't forget to "skew" the source operand in case we
-# "unskewed" the one the hardware initially gave us.
-funimp_exc_force:
- mov.l %d0,-(%sp) # save d0
- bsr.l funimp_skew # check for special case
- mov.l (%sp)+,%d0 # restore d0
- mov.w (tbl_funimp_except.b,%pc,%d0.w*2),2+FP_SRC(%a6)
- bra.b funimp_gen_exit2 # exit with frestore
-
-tbl_funimp_except:
- short 0xe002, 0xe006, 0xe004, 0xe005
- short 0xe003, 0xe002, 0xe001, 0xe001
-
-# insert an overflow frame
-funimp_exc_ovfl:
- bsr.l funimp_skew # check for special case
- mov.w &0xe005,2+FP_SRC(%a6)
- bra.b funimp_gen_exit2
-
-# insert an underflow frame
-funimp_exc_unfl:
- bsr.l funimp_skew # check for special case
- mov.w &0xe003,2+FP_SRC(%a6)
-
-# this is the general exit point for an enabled exception that will be
-# restored into the machine for the instruction just emulated.
-funimp_gen_exit2:
- fmovm.x EXC_FP0(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- frestore FP_SRC(%a6) # insert exceptional status
-
- bra.w funimp_gen_exit_cmp
-
-############################################################################
-
-#
-# TYPE == 1: FDB<cc>, FS<cc>, FTRAP<cc>
-#
-# These instructions were implemented on the '881/2 and '040 in hardware but
-# are emulated in software on the '060.
-#
-funimp_misc:
- bfextu %d0{&10:&3},%d1 # extract mode field
- cmpi.b %d1,&0x1 # is it an fdb<cc>?
- beq.w funimp_fdbcc # yes
- cmpi.b %d1,&0x7 # is it an fs<cc>?
- bne.w funimp_fscc # yes
- bfextu %d0{&13:&3},%d1
- cmpi.b %d1,&0x2 # is it an fs<cc>?
- blt.w funimp_fscc # yes
-
-#########################
-# ftrap<cc> #
-# ftrap<cc>.w #<data> #
-# ftrap<cc>.l #<data> #
-#########################
-funimp_ftrapcc:
-
- bsr.l _ftrapcc # FTRAP<cc>()
-
- cmpi.b SPCOND_FLG(%a6),&fbsun_flg # is enabled bsun occurring?
- beq.w funimp_bsun # yes
-
- cmpi.b SPCOND_FLG(%a6),&ftrapcc_flg # should a trap occur?
- bne.w funimp_done # no
-
-# FP UNIMP FRAME TRAP FRAME
-# ***************** *****************
-# ** <EA> ** ** Current PC **
-# ***************** *****************
-# * 0x2 * 0x02c * * 0x2 * 0x01c *
-# ***************** *****************
-# ** Next PC ** ** Next PC **
-# ***************** *****************
-# * SR * * SR *
-# ***************** *****************
-# (6 words) (6 words)
-#
-# the ftrapcc instruction should take a trap. so, here we must create a
-# trap stack frame from an unimplemented fp instruction stack frame and
-# jump to the user supplied entry point for the trap exception
-funimp_ftrapcc_tp:
- mov.l USER_FPIAR(%a6),EXC_EA(%a6) # Address = Current PC
- mov.w &0x201c,EXC_VOFF(%a6) # Vector Offset = 0x01c
-
- fmovm.x EXC_FP0(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6
- bra.l _real_trap
-
-#########################
-# fdb<cc> Dn,<label> #
-#########################
-funimp_fdbcc:
-
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word # read displacement
-
- tst.l %d1 # did ifetch fail?
- bne.w funimp_iacc # yes
-
- ext.l %d0 # sign extend displacement
-
- bsr.l _fdbcc # FDB<cc>()
-
- cmpi.b SPCOND_FLG(%a6),&fbsun_flg # is enabled bsun occurring?
- beq.w funimp_bsun
-
- bra.w funimp_done # branch to finish
-
-#################
-# fs<cc>.b <ea> #
-#################
-funimp_fscc:
-
- bsr.l _fscc # FS<cc>()
-
-# I am assuming here that an "fs<cc>.b -(An)" or "fs<cc>.b (An)+" instruction
-# does not need to update "An" before taking a bsun exception.
- cmpi.b SPCOND_FLG(%a6),&fbsun_flg # is enabled bsun occurring?
- beq.w funimp_bsun
-
- btst &0x5,EXC_SR(%a6) # yes; is it a user mode exception?
- bne.b funimp_fscc_s # no
-
-funimp_fscc_u:
- mov.l EXC_A7(%a6),%a0 # yes; set new USP
- mov.l %a0,%usp
- bra.w funimp_done # branch to finish
-
-# remember, I'm assuming that post-increment is bogus...(it IS!!!)
-# so, the least significant WORD of the stacked effective address got
-# overwritten by the "fs<cc> -(An)". We must shift the stack frame "down"
-# so that the rte will work correctly without destroying the result.
-# even though the operation size is byte, the stack ptr is decr by 2.
-#
-# remember, also, this instruction may be traced.
-funimp_fscc_s:
- cmpi.b SPCOND_FLG(%a6),&mda7_flg # was a7 modified?
- bne.w funimp_done # no
-
- fmovm.x EXC_FP0(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6
-
- btst &0x7,(%sp) # is trace enabled?
- bne.b funimp_fscc_s_trace # yes
-
- subq.l &0x2,%sp
- mov.l 0x2(%sp),(%sp) # shift SR,hi(PC) "down"
- mov.l 0x6(%sp),0x4(%sp) # shift lo(PC),voff "down"
- bra.l _fpsp_done
-
-funimp_fscc_s_trace:
- subq.l &0x2,%sp
- mov.l 0x2(%sp),(%sp) # shift SR,hi(PC) "down"
- mov.w 0x6(%sp),0x4(%sp) # shift lo(PC)
- mov.w &0x2024,0x6(%sp) # fmt/voff = $2024
- fmov.l %fpiar,0x8(%sp) # insert "current PC"
-
- bra.l _real_trace
-
-#
-# The ftrap<cc>, fs<cc>, or fdb<cc> is to take an enabled bsun. we must convert
-# the fp unimplemented instruction exception stack frame into a bsun stack frame,
-# restore a bsun exception into the machine, and branch to the user
-# supplied bsun hook.
-#
-# FP UNIMP FRAME BSUN FRAME
-# ***************** *****************
-# ** <EA> ** * 0x0 * 0x0c0 *
-# ***************** *****************
-# * 0x2 * 0x02c * ** Current PC **
-# ***************** *****************
-# ** Next PC ** * SR *
-# ***************** *****************
-# * SR * (4 words)
-# *****************
-# (6 words)
-#
-funimp_bsun:
- mov.w &0x00c0,2+EXC_EA(%a6) # Fmt = 0x0; Vector Offset = 0x0c0
- mov.l USER_FPIAR(%a6),EXC_VOFF(%a6) # PC = Current PC
- mov.w EXC_SR(%a6),2+EXC_PC(%a6) # shift SR "up"
-
- mov.w &0xe000,2+FP_SRC(%a6) # bsun exception enabled
-
- fmovm.x EXC_FP0(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- frestore FP_SRC(%a6) # restore bsun exception
-
- unlk %a6
-
- addq.l &0x4,%sp # erase sludge
-
- bra.l _real_bsun # branch to user bsun hook
-
-#
-# all ftrapcc/fscc/fdbcc processing has been completed. unwind the stack frame
-# and return.
-#
-# as usual, we have to check for trace mode being on here. since instructions
-# modifying the supervisor stack frame don't pass through here, this is a
-# relatively easy task.
-#
-funimp_done:
- fmovm.x EXC_FP0(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6
-
- btst &0x7,(%sp) # is trace enabled?
- bne.b funimp_trace # yes
-
- bra.l _fpsp_done
-
-# FP UNIMP FRAME TRACE FRAME
-# ***************** *****************
-# ** <EA> ** ** Current PC **
-# ***************** *****************
-# * 0x2 * 0x02c * * 0x2 * 0x024 *
-# ***************** *****************
-# ** Next PC ** ** Next PC **
-# ***************** *****************
-# * SR * * SR *
-# ***************** *****************
-# (6 words) (6 words)
-#
-# the fscc instruction should take a trace trap. so, here we must create a
-# trace stack frame from an unimplemented fp instruction stack frame and
-# jump to the user supplied entry point for the trace exception
-funimp_trace:
- fmov.l %fpiar,0x8(%sp) # current PC is in fpiar
- mov.b &0x24,0x7(%sp) # vector offset = 0x024
-
- bra.l _real_trace
-
-################################################################
-
- global tbl_trans
- swbeg &0x1c0
-tbl_trans:
- short tbl_trans - tbl_trans # $00-0 fmovecr all
- short tbl_trans - tbl_trans # $00-1 fmovecr all
- short tbl_trans - tbl_trans # $00-2 fmovecr all
- short tbl_trans - tbl_trans # $00-3 fmovecr all
- short tbl_trans - tbl_trans # $00-4 fmovecr all
- short tbl_trans - tbl_trans # $00-5 fmovecr all
- short tbl_trans - tbl_trans # $00-6 fmovecr all
- short tbl_trans - tbl_trans # $00-7 fmovecr all
-
- short tbl_trans - tbl_trans # $01-0 fint norm
- short tbl_trans - tbl_trans # $01-1 fint zero
- short tbl_trans - tbl_trans # $01-2 fint inf
- short tbl_trans - tbl_trans # $01-3 fint qnan
- short tbl_trans - tbl_trans # $01-5 fint denorm
- short tbl_trans - tbl_trans # $01-4 fint snan
- short tbl_trans - tbl_trans # $01-6 fint unnorm
- short tbl_trans - tbl_trans # $01-7 ERROR
-
- short ssinh - tbl_trans # $02-0 fsinh norm
- short src_zero - tbl_trans # $02-1 fsinh zero
- short src_inf - tbl_trans # $02-2 fsinh inf
- short src_qnan - tbl_trans # $02-3 fsinh qnan
- short ssinhd - tbl_trans # $02-5 fsinh denorm
- short src_snan - tbl_trans # $02-4 fsinh snan
- short tbl_trans - tbl_trans # $02-6 fsinh unnorm
- short tbl_trans - tbl_trans # $02-7 ERROR
-
- short tbl_trans - tbl_trans # $03-0 fintrz norm
- short tbl_trans - tbl_trans # $03-1 fintrz zero
- short tbl_trans - tbl_trans # $03-2 fintrz inf
- short tbl_trans - tbl_trans # $03-3 fintrz qnan
- short tbl_trans - tbl_trans # $03-5 fintrz denorm
- short tbl_trans - tbl_trans # $03-4 fintrz snan
- short tbl_trans - tbl_trans # $03-6 fintrz unnorm
- short tbl_trans - tbl_trans # $03-7 ERROR
-
- short tbl_trans - tbl_trans # $04-0 fsqrt norm
- short tbl_trans - tbl_trans # $04-1 fsqrt zero
- short tbl_trans - tbl_trans # $04-2 fsqrt inf
- short tbl_trans - tbl_trans # $04-3 fsqrt qnan
- short tbl_trans - tbl_trans # $04-5 fsqrt denorm
- short tbl_trans - tbl_trans # $04-4 fsqrt snan
- short tbl_trans - tbl_trans # $04-6 fsqrt unnorm
- short tbl_trans - tbl_trans # $04-7 ERROR
-
- short tbl_trans - tbl_trans # $05-0 ERROR
- short tbl_trans - tbl_trans # $05-1 ERROR
- short tbl_trans - tbl_trans # $05-2 ERROR
- short tbl_trans - tbl_trans # $05-3 ERROR
- short tbl_trans - tbl_trans # $05-4 ERROR
- short tbl_trans - tbl_trans # $05-5 ERROR
- short tbl_trans - tbl_trans # $05-6 ERROR
- short tbl_trans - tbl_trans # $05-7 ERROR
-
- short slognp1 - tbl_trans # $06-0 flognp1 norm
- short src_zero - tbl_trans # $06-1 flognp1 zero
- short sopr_inf - tbl_trans # $06-2 flognp1 inf
- short src_qnan - tbl_trans # $06-3 flognp1 qnan
- short slognp1d - tbl_trans # $06-5 flognp1 denorm
- short src_snan - tbl_trans # $06-4 flognp1 snan
- short tbl_trans - tbl_trans # $06-6 flognp1 unnorm
- short tbl_trans - tbl_trans # $06-7 ERROR
-
- short tbl_trans - tbl_trans # $07-0 ERROR
- short tbl_trans - tbl_trans # $07-1 ERROR
- short tbl_trans - tbl_trans # $07-2 ERROR
- short tbl_trans - tbl_trans # $07-3 ERROR
- short tbl_trans - tbl_trans # $07-4 ERROR
- short tbl_trans - tbl_trans # $07-5 ERROR
- short tbl_trans - tbl_trans # $07-6 ERROR
- short tbl_trans - tbl_trans # $07-7 ERROR
-
- short setoxm1 - tbl_trans # $08-0 fetoxm1 norm
- short src_zero - tbl_trans # $08-1 fetoxm1 zero
- short setoxm1i - tbl_trans # $08-2 fetoxm1 inf
- short src_qnan - tbl_trans # $08-3 fetoxm1 qnan
- short setoxm1d - tbl_trans # $08-5 fetoxm1 denorm
- short src_snan - tbl_trans # $08-4 fetoxm1 snan
- short tbl_trans - tbl_trans # $08-6 fetoxm1 unnorm
- short tbl_trans - tbl_trans # $08-7 ERROR
-
- short stanh - tbl_trans # $09-0 ftanh norm
- short src_zero - tbl_trans # $09-1 ftanh zero
- short src_one - tbl_trans # $09-2 ftanh inf
- short src_qnan - tbl_trans # $09-3 ftanh qnan
- short stanhd - tbl_trans # $09-5 ftanh denorm
- short src_snan - tbl_trans # $09-4 ftanh snan
- short tbl_trans - tbl_trans # $09-6 ftanh unnorm
- short tbl_trans - tbl_trans # $09-7 ERROR
-
- short satan - tbl_trans # $0a-0 fatan norm
- short src_zero - tbl_trans # $0a-1 fatan zero
- short spi_2 - tbl_trans # $0a-2 fatan inf
- short src_qnan - tbl_trans # $0a-3 fatan qnan
- short satand - tbl_trans # $0a-5 fatan denorm
- short src_snan - tbl_trans # $0a-4 fatan snan
- short tbl_trans - tbl_trans # $0a-6 fatan unnorm
- short tbl_trans - tbl_trans # $0a-7 ERROR
-
- short tbl_trans - tbl_trans # $0b-0 ERROR
- short tbl_trans - tbl_trans # $0b-1 ERROR
- short tbl_trans - tbl_trans # $0b-2 ERROR
- short tbl_trans - tbl_trans # $0b-3 ERROR
- short tbl_trans - tbl_trans # $0b-4 ERROR
- short tbl_trans - tbl_trans # $0b-5 ERROR
- short tbl_trans - tbl_trans # $0b-6 ERROR
- short tbl_trans - tbl_trans # $0b-7 ERROR
-
- short sasin - tbl_trans # $0c-0 fasin norm
- short src_zero - tbl_trans # $0c-1 fasin zero
- short t_operr - tbl_trans # $0c-2 fasin inf
- short src_qnan - tbl_trans # $0c-3 fasin qnan
- short sasind - tbl_trans # $0c-5 fasin denorm
- short src_snan - tbl_trans # $0c-4 fasin snan
- short tbl_trans - tbl_trans # $0c-6 fasin unnorm
- short tbl_trans - tbl_trans # $0c-7 ERROR
-
- short satanh - tbl_trans # $0d-0 fatanh norm
- short src_zero - tbl_trans # $0d-1 fatanh zero
- short t_operr - tbl_trans # $0d-2 fatanh inf
- short src_qnan - tbl_trans # $0d-3 fatanh qnan
- short satanhd - tbl_trans # $0d-5 fatanh denorm
- short src_snan - tbl_trans # $0d-4 fatanh snan
- short tbl_trans - tbl_trans # $0d-6 fatanh unnorm
- short tbl_trans - tbl_trans # $0d-7 ERROR
-
- short ssin - tbl_trans # $0e-0 fsin norm
- short src_zero - tbl_trans # $0e-1 fsin zero
- short t_operr - tbl_trans # $0e-2 fsin inf
- short src_qnan - tbl_trans # $0e-3 fsin qnan
- short ssind - tbl_trans # $0e-5 fsin denorm
- short src_snan - tbl_trans # $0e-4 fsin snan
- short tbl_trans - tbl_trans # $0e-6 fsin unnorm
- short tbl_trans - tbl_trans # $0e-7 ERROR
-
- short stan - tbl_trans # $0f-0 ftan norm
- short src_zero - tbl_trans # $0f-1 ftan zero
- short t_operr - tbl_trans # $0f-2 ftan inf
- short src_qnan - tbl_trans # $0f-3 ftan qnan
- short stand - tbl_trans # $0f-5 ftan denorm
- short src_snan - tbl_trans # $0f-4 ftan snan
- short tbl_trans - tbl_trans # $0f-6 ftan unnorm
- short tbl_trans - tbl_trans # $0f-7 ERROR
-
- short setox - tbl_trans # $10-0 fetox norm
- short ld_pone - tbl_trans # $10-1 fetox zero
- short szr_inf - tbl_trans # $10-2 fetox inf
- short src_qnan - tbl_trans # $10-3 fetox qnan
- short setoxd - tbl_trans # $10-5 fetox denorm
- short src_snan - tbl_trans # $10-4 fetox snan
- short tbl_trans - tbl_trans # $10-6 fetox unnorm
- short tbl_trans - tbl_trans # $10-7 ERROR
-
- short stwotox - tbl_trans # $11-0 ftwotox norm
- short ld_pone - tbl_trans # $11-1 ftwotox zero
- short szr_inf - tbl_trans # $11-2 ftwotox inf
- short src_qnan - tbl_trans # $11-3 ftwotox qnan
- short stwotoxd - tbl_trans # $11-5 ftwotox denorm
- short src_snan - tbl_trans # $11-4 ftwotox snan
- short tbl_trans - tbl_trans # $11-6 ftwotox unnorm
- short tbl_trans - tbl_trans # $11-7 ERROR
-
- short stentox - tbl_trans # $12-0 ftentox norm
- short ld_pone - tbl_trans # $12-1 ftentox zero
- short szr_inf - tbl_trans # $12-2 ftentox inf
- short src_qnan - tbl_trans # $12-3 ftentox qnan
- short stentoxd - tbl_trans # $12-5 ftentox denorm
- short src_snan - tbl_trans # $12-4 ftentox snan
- short tbl_trans - tbl_trans # $12-6 ftentox unnorm
- short tbl_trans - tbl_trans # $12-7 ERROR
-
- short tbl_trans - tbl_trans # $13-0 ERROR
- short tbl_trans - tbl_trans # $13-1 ERROR
- short tbl_trans - tbl_trans # $13-2 ERROR
- short tbl_trans - tbl_trans # $13-3 ERROR
- short tbl_trans - tbl_trans # $13-4 ERROR
- short tbl_trans - tbl_trans # $13-5 ERROR
- short tbl_trans - tbl_trans # $13-6 ERROR
- short tbl_trans - tbl_trans # $13-7 ERROR
-
- short slogn - tbl_trans # $14-0 flogn norm
- short t_dz2 - tbl_trans # $14-1 flogn zero
- short sopr_inf - tbl_trans # $14-2 flogn inf
- short src_qnan - tbl_trans # $14-3 flogn qnan
- short slognd - tbl_trans # $14-5 flogn denorm
- short src_snan - tbl_trans # $14-4 flogn snan
- short tbl_trans - tbl_trans # $14-6 flogn unnorm
- short tbl_trans - tbl_trans # $14-7 ERROR
-
- short slog10 - tbl_trans # $15-0 flog10 norm
- short t_dz2 - tbl_trans # $15-1 flog10 zero
- short sopr_inf - tbl_trans # $15-2 flog10 inf
- short src_qnan - tbl_trans # $15-3 flog10 qnan
- short slog10d - tbl_trans # $15-5 flog10 denorm
- short src_snan - tbl_trans # $15-4 flog10 snan
- short tbl_trans - tbl_trans # $15-6 flog10 unnorm
- short tbl_trans - tbl_trans # $15-7 ERROR
-
- short slog2 - tbl_trans # $16-0 flog2 norm
- short t_dz2 - tbl_trans # $16-1 flog2 zero
- short sopr_inf - tbl_trans # $16-2 flog2 inf
- short src_qnan - tbl_trans # $16-3 flog2 qnan
- short slog2d - tbl_trans # $16-5 flog2 denorm
- short src_snan - tbl_trans # $16-4 flog2 snan
- short tbl_trans - tbl_trans # $16-6 flog2 unnorm
- short tbl_trans - tbl_trans # $16-7 ERROR
-
- short tbl_trans - tbl_trans # $17-0 ERROR
- short tbl_trans - tbl_trans # $17-1 ERROR
- short tbl_trans - tbl_trans # $17-2 ERROR
- short tbl_trans - tbl_trans # $17-3 ERROR
- short tbl_trans - tbl_trans # $17-4 ERROR
- short tbl_trans - tbl_trans # $17-5 ERROR
- short tbl_trans - tbl_trans # $17-6 ERROR
- short tbl_trans - tbl_trans # $17-7 ERROR
-
- short tbl_trans - tbl_trans # $18-0 fabs norm
- short tbl_trans - tbl_trans # $18-1 fabs zero
- short tbl_trans - tbl_trans # $18-2 fabs inf
- short tbl_trans - tbl_trans # $18-3 fabs qnan
- short tbl_trans - tbl_trans # $18-5 fabs denorm
- short tbl_trans - tbl_trans # $18-4 fabs snan
- short tbl_trans - tbl_trans # $18-6 fabs unnorm
- short tbl_trans - tbl_trans # $18-7 ERROR
-
- short scosh - tbl_trans # $19-0 fcosh norm
- short ld_pone - tbl_trans # $19-1 fcosh zero
- short ld_pinf - tbl_trans # $19-2 fcosh inf
- short src_qnan - tbl_trans # $19-3 fcosh qnan
- short scoshd - tbl_trans # $19-5 fcosh denorm
- short src_snan - tbl_trans # $19-4 fcosh snan
- short tbl_trans - tbl_trans # $19-6 fcosh unnorm
- short tbl_trans - tbl_trans # $19-7 ERROR
-
- short tbl_trans - tbl_trans # $1a-0 fneg norm
- short tbl_trans - tbl_trans # $1a-1 fneg zero
- short tbl_trans - tbl_trans # $1a-2 fneg inf
- short tbl_trans - tbl_trans # $1a-3 fneg qnan
- short tbl_trans - tbl_trans # $1a-5 fneg denorm
- short tbl_trans - tbl_trans # $1a-4 fneg snan
- short tbl_trans - tbl_trans # $1a-6 fneg unnorm
- short tbl_trans - tbl_trans # $1a-7 ERROR
-
- short tbl_trans - tbl_trans # $1b-0 ERROR
- short tbl_trans - tbl_trans # $1b-1 ERROR
- short tbl_trans - tbl_trans # $1b-2 ERROR
- short tbl_trans - tbl_trans # $1b-3 ERROR
- short tbl_trans - tbl_trans # $1b-4 ERROR
- short tbl_trans - tbl_trans # $1b-5 ERROR
- short tbl_trans - tbl_trans # $1b-6 ERROR
- short tbl_trans - tbl_trans # $1b-7 ERROR
-
- short sacos - tbl_trans # $1c-0 facos norm
- short ld_ppi2 - tbl_trans # $1c-1 facos zero
- short t_operr - tbl_trans # $1c-2 facos inf
- short src_qnan - tbl_trans # $1c-3 facos qnan
- short sacosd - tbl_trans # $1c-5 facos denorm
- short src_snan - tbl_trans # $1c-4 facos snan
- short tbl_trans - tbl_trans # $1c-6 facos unnorm
- short tbl_trans - tbl_trans # $1c-7 ERROR
-
- short scos - tbl_trans # $1d-0 fcos norm
- short ld_pone - tbl_trans # $1d-1 fcos zero
- short t_operr - tbl_trans # $1d-2 fcos inf
- short src_qnan - tbl_trans # $1d-3 fcos qnan
- short scosd - tbl_trans # $1d-5 fcos denorm
- short src_snan - tbl_trans # $1d-4 fcos snan
- short tbl_trans - tbl_trans # $1d-6 fcos unnorm
- short tbl_trans - tbl_trans # $1d-7 ERROR
-
- short sgetexp - tbl_trans # $1e-0 fgetexp norm
- short src_zero - tbl_trans # $1e-1 fgetexp zero
- short t_operr - tbl_trans # $1e-2 fgetexp inf
- short src_qnan - tbl_trans # $1e-3 fgetexp qnan
- short sgetexpd - tbl_trans # $1e-5 fgetexp denorm
- short src_snan - tbl_trans # $1e-4 fgetexp snan
- short tbl_trans - tbl_trans # $1e-6 fgetexp unnorm
- short tbl_trans - tbl_trans # $1e-7 ERROR
-
- short sgetman - tbl_trans # $1f-0 fgetman norm
- short src_zero - tbl_trans # $1f-1 fgetman zero
- short t_operr - tbl_trans # $1f-2 fgetman inf
- short src_qnan - tbl_trans # $1f-3 fgetman qnan
- short sgetmand - tbl_trans # $1f-5 fgetman denorm
- short src_snan - tbl_trans # $1f-4 fgetman snan
- short tbl_trans - tbl_trans # $1f-6 fgetman unnorm
- short tbl_trans - tbl_trans # $1f-7 ERROR
-
- short tbl_trans - tbl_trans # $20-0 fdiv norm
- short tbl_trans - tbl_trans # $20-1 fdiv zero
- short tbl_trans - tbl_trans # $20-2 fdiv inf
- short tbl_trans - tbl_trans # $20-3 fdiv qnan
- short tbl_trans - tbl_trans # $20-5 fdiv denorm
- short tbl_trans - tbl_trans # $20-4 fdiv snan
- short tbl_trans - tbl_trans # $20-6 fdiv unnorm
- short tbl_trans - tbl_trans # $20-7 ERROR
-
- short smod_snorm - tbl_trans # $21-0 fmod norm
- short smod_szero - tbl_trans # $21-1 fmod zero
- short smod_sinf - tbl_trans # $21-2 fmod inf
- short sop_sqnan - tbl_trans # $21-3 fmod qnan
- short smod_sdnrm - tbl_trans # $21-5 fmod denorm
- short sop_ssnan - tbl_trans # $21-4 fmod snan
- short tbl_trans - tbl_trans # $21-6 fmod unnorm
- short tbl_trans - tbl_trans # $21-7 ERROR
-
- short tbl_trans - tbl_trans # $22-0 fadd norm
- short tbl_trans - tbl_trans # $22-1 fadd zero
- short tbl_trans - tbl_trans # $22-2 fadd inf
- short tbl_trans - tbl_trans # $22-3 fadd qnan
- short tbl_trans - tbl_trans # $22-5 fadd denorm
- short tbl_trans - tbl_trans # $22-4 fadd snan
- short tbl_trans - tbl_trans # $22-6 fadd unnorm
- short tbl_trans - tbl_trans # $22-7 ERROR
-
- short tbl_trans - tbl_trans # $23-0 fmul norm
- short tbl_trans - tbl_trans # $23-1 fmul zero
- short tbl_trans - tbl_trans # $23-2 fmul inf
- short tbl_trans - tbl_trans # $23-3 fmul qnan
- short tbl_trans - tbl_trans # $23-5 fmul denorm
- short tbl_trans - tbl_trans # $23-4 fmul snan
- short tbl_trans - tbl_trans # $23-6 fmul unnorm
- short tbl_trans - tbl_trans # $23-7 ERROR
-
- short tbl_trans - tbl_trans # $24-0 fsgldiv norm
- short tbl_trans - tbl_trans # $24-1 fsgldiv zero
- short tbl_trans - tbl_trans # $24-2 fsgldiv inf
- short tbl_trans - tbl_trans # $24-3 fsgldiv qnan
- short tbl_trans - tbl_trans # $24-5 fsgldiv denorm
- short tbl_trans - tbl_trans # $24-4 fsgldiv snan
- short tbl_trans - tbl_trans # $24-6 fsgldiv unnorm
- short tbl_trans - tbl_trans # $24-7 ERROR
-
- short srem_snorm - tbl_trans # $25-0 frem norm
- short srem_szero - tbl_trans # $25-1 frem zero
- short srem_sinf - tbl_trans # $25-2 frem inf
- short sop_sqnan - tbl_trans # $25-3 frem qnan
- short srem_sdnrm - tbl_trans # $25-5 frem denorm
- short sop_ssnan - tbl_trans # $25-4 frem snan
- short tbl_trans - tbl_trans # $25-6 frem unnorm
- short tbl_trans - tbl_trans # $25-7 ERROR
-
- short sscale_snorm - tbl_trans # $26-0 fscale norm
- short sscale_szero - tbl_trans # $26-1 fscale zero
- short sscale_sinf - tbl_trans # $26-2 fscale inf
- short sop_sqnan - tbl_trans # $26-3 fscale qnan
- short sscale_sdnrm - tbl_trans # $26-5 fscale denorm
- short sop_ssnan - tbl_trans # $26-4 fscale snan
- short tbl_trans - tbl_trans # $26-6 fscale unnorm
- short tbl_trans - tbl_trans # $26-7 ERROR
-
- short tbl_trans - tbl_trans # $27-0 fsglmul norm
- short tbl_trans - tbl_trans # $27-1 fsglmul zero
- short tbl_trans - tbl_trans # $27-2 fsglmul inf
- short tbl_trans - tbl_trans # $27-3 fsglmul qnan
- short tbl_trans - tbl_trans # $27-5 fsglmul denorm
- short tbl_trans - tbl_trans # $27-4 fsglmul snan
- short tbl_trans - tbl_trans # $27-6 fsglmul unnorm
- short tbl_trans - tbl_trans # $27-7 ERROR
-
- short tbl_trans - tbl_trans # $28-0 fsub norm
- short tbl_trans - tbl_trans # $28-1 fsub zero
- short tbl_trans - tbl_trans # $28-2 fsub inf
- short tbl_trans - tbl_trans # $28-3 fsub qnan
- short tbl_trans - tbl_trans # $28-5 fsub denorm
- short tbl_trans - tbl_trans # $28-4 fsub snan
- short tbl_trans - tbl_trans # $28-6 fsub unnorm
- short tbl_trans - tbl_trans # $28-7 ERROR
-
- short tbl_trans - tbl_trans # $29-0 ERROR
- short tbl_trans - tbl_trans # $29-1 ERROR
- short tbl_trans - tbl_trans # $29-2 ERROR
- short tbl_trans - tbl_trans # $29-3 ERROR
- short tbl_trans - tbl_trans # $29-4 ERROR
- short tbl_trans - tbl_trans # $29-5 ERROR
- short tbl_trans - tbl_trans # $29-6 ERROR
- short tbl_trans - tbl_trans # $29-7 ERROR
-
- short tbl_trans - tbl_trans # $2a-0 ERROR
- short tbl_trans - tbl_trans # $2a-1 ERROR
- short tbl_trans - tbl_trans # $2a-2 ERROR
- short tbl_trans - tbl_trans # $2a-3 ERROR
- short tbl_trans - tbl_trans # $2a-4 ERROR
- short tbl_trans - tbl_trans # $2a-5 ERROR
- short tbl_trans - tbl_trans # $2a-6 ERROR
- short tbl_trans - tbl_trans # $2a-7 ERROR
-
- short tbl_trans - tbl_trans # $2b-0 ERROR
- short tbl_trans - tbl_trans # $2b-1 ERROR
- short tbl_trans - tbl_trans # $2b-2 ERROR
- short tbl_trans - tbl_trans # $2b-3 ERROR
- short tbl_trans - tbl_trans # $2b-4 ERROR
- short tbl_trans - tbl_trans # $2b-5 ERROR
- short tbl_trans - tbl_trans # $2b-6 ERROR
- short tbl_trans - tbl_trans # $2b-7 ERROR
-
- short tbl_trans - tbl_trans # $2c-0 ERROR
- short tbl_trans - tbl_trans # $2c-1 ERROR
- short tbl_trans - tbl_trans # $2c-2 ERROR
- short tbl_trans - tbl_trans # $2c-3 ERROR
- short tbl_trans - tbl_trans # $2c-4 ERROR
- short tbl_trans - tbl_trans # $2c-5 ERROR
- short tbl_trans - tbl_trans # $2c-6 ERROR
- short tbl_trans - tbl_trans # $2c-7 ERROR
-
- short tbl_trans - tbl_trans # $2d-0 ERROR
- short tbl_trans - tbl_trans # $2d-1 ERROR
- short tbl_trans - tbl_trans # $2d-2 ERROR
- short tbl_trans - tbl_trans # $2d-3 ERROR
- short tbl_trans - tbl_trans # $2d-4 ERROR
- short tbl_trans - tbl_trans # $2d-5 ERROR
- short tbl_trans - tbl_trans # $2d-6 ERROR
- short tbl_trans - tbl_trans # $2d-7 ERROR
-
- short tbl_trans - tbl_trans # $2e-0 ERROR
- short tbl_trans - tbl_trans # $2e-1 ERROR
- short tbl_trans - tbl_trans # $2e-2 ERROR
- short tbl_trans - tbl_trans # $2e-3 ERROR
- short tbl_trans - tbl_trans # $2e-4 ERROR
- short tbl_trans - tbl_trans # $2e-5 ERROR
- short tbl_trans - tbl_trans # $2e-6 ERROR
- short tbl_trans - tbl_trans # $2e-7 ERROR
-
- short tbl_trans - tbl_trans # $2f-0 ERROR
- short tbl_trans - tbl_trans # $2f-1 ERROR
- short tbl_trans - tbl_trans # $2f-2 ERROR
- short tbl_trans - tbl_trans # $2f-3 ERROR
- short tbl_trans - tbl_trans # $2f-4 ERROR
- short tbl_trans - tbl_trans # $2f-5 ERROR
- short tbl_trans - tbl_trans # $2f-6 ERROR
- short tbl_trans - tbl_trans # $2f-7 ERROR
-
- short ssincos - tbl_trans # $30-0 fsincos norm
- short ssincosz - tbl_trans # $30-1 fsincos zero
- short ssincosi - tbl_trans # $30-2 fsincos inf
- short ssincosqnan - tbl_trans # $30-3 fsincos qnan
- short ssincosd - tbl_trans # $30-5 fsincos denorm
- short ssincossnan - tbl_trans # $30-4 fsincos snan
- short tbl_trans - tbl_trans # $30-6 fsincos unnorm
- short tbl_trans - tbl_trans # $30-7 ERROR
-
- short ssincos - tbl_trans # $31-0 fsincos norm
- short ssincosz - tbl_trans # $31-1 fsincos zero
- short ssincosi - tbl_trans # $31-2 fsincos inf
- short ssincosqnan - tbl_trans # $31-3 fsincos qnan
- short ssincosd - tbl_trans # $31-5 fsincos denorm
- short ssincossnan - tbl_trans # $31-4 fsincos snan
- short tbl_trans - tbl_trans # $31-6 fsincos unnorm
- short tbl_trans - tbl_trans # $31-7 ERROR
-
- short ssincos - tbl_trans # $32-0 fsincos norm
- short ssincosz - tbl_trans # $32-1 fsincos zero
- short ssincosi - tbl_trans # $32-2 fsincos inf
- short ssincosqnan - tbl_trans # $32-3 fsincos qnan
- short ssincosd - tbl_trans # $32-5 fsincos denorm
- short ssincossnan - tbl_trans # $32-4 fsincos snan
- short tbl_trans - tbl_trans # $32-6 fsincos unnorm
- short tbl_trans - tbl_trans # $32-7 ERROR
-
- short ssincos - tbl_trans # $33-0 fsincos norm
- short ssincosz - tbl_trans # $33-1 fsincos zero
- short ssincosi - tbl_trans # $33-2 fsincos inf
- short ssincosqnan - tbl_trans # $33-3 fsincos qnan
- short ssincosd - tbl_trans # $33-5 fsincos denorm
- short ssincossnan - tbl_trans # $33-4 fsincos snan
- short tbl_trans - tbl_trans # $33-6 fsincos unnorm
- short tbl_trans - tbl_trans # $33-7 ERROR
-
- short ssincos - tbl_trans # $34-0 fsincos norm
- short ssincosz - tbl_trans # $34-1 fsincos zero
- short ssincosi - tbl_trans # $34-2 fsincos inf
- short ssincosqnan - tbl_trans # $34-3 fsincos qnan
- short ssincosd - tbl_trans # $34-5 fsincos denorm
- short ssincossnan - tbl_trans # $34-4 fsincos snan
- short tbl_trans - tbl_trans # $34-6 fsincos unnorm
- short tbl_trans - tbl_trans # $34-7 ERROR
-
- short ssincos - tbl_trans # $35-0 fsincos norm
- short ssincosz - tbl_trans # $35-1 fsincos zero
- short ssincosi - tbl_trans # $35-2 fsincos inf
- short ssincosqnan - tbl_trans # $35-3 fsincos qnan
- short ssincosd - tbl_trans # $35-5 fsincos denorm
- short ssincossnan - tbl_trans # $35-4 fsincos snan
- short tbl_trans - tbl_trans # $35-6 fsincos unnorm
- short tbl_trans - tbl_trans # $35-7 ERROR
-
- short ssincos - tbl_trans # $36-0 fsincos norm
- short ssincosz - tbl_trans # $36-1 fsincos zero
- short ssincosi - tbl_trans # $36-2 fsincos inf
- short ssincosqnan - tbl_trans # $36-3 fsincos qnan
- short ssincosd - tbl_trans # $36-5 fsincos denorm
- short ssincossnan - tbl_trans # $36-4 fsincos snan
- short tbl_trans - tbl_trans # $36-6 fsincos unnorm
- short tbl_trans - tbl_trans # $36-7 ERROR
-
- short ssincos - tbl_trans # $37-0 fsincos norm
- short ssincosz - tbl_trans # $37-1 fsincos zero
- short ssincosi - tbl_trans # $37-2 fsincos inf
- short ssincosqnan - tbl_trans # $37-3 fsincos qnan
- short ssincosd - tbl_trans # $37-5 fsincos denorm
- short ssincossnan - tbl_trans # $37-4 fsincos snan
- short tbl_trans - tbl_trans # $37-6 fsincos unnorm
- short tbl_trans - tbl_trans # $37-7 ERROR
-
-##########
-
-# the instruction fetch access for the displacement word for the
-# fdbcc emulation failed. here, we create an access error frame
-# from the current frame and branch to _real_access().
-funimp_iacc:
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
-
- mov.l USER_FPIAR(%a6),EXC_PC(%a6) # store current PC
-
- unlk %a6
-
- mov.l (%sp),-(%sp) # store SR,hi(PC)
- mov.w 0x8(%sp),0x4(%sp) # store lo(PC)
- mov.w &0x4008,0x6(%sp) # store voff
- mov.l 0x2(%sp),0x8(%sp) # store EA
- mov.l &0x09428001,0xc(%sp) # store FSLW
-
- btst &0x5,(%sp) # user or supervisor mode?
- beq.b funimp_iacc_end # user
- bset &0x2,0xd(%sp) # set supervisor TM bit
-
-funimp_iacc_end:
- bra.l _real_access
-
-#########################################################################
-# ssin(): computes the sine of a normalized input #
-# ssind(): computes the sine of a denormalized input #
-# scos(): computes the cosine of a normalized input #
-# scosd(): computes the cosine of a denormalized input #
-# ssincos(): computes the sine and cosine of a normalized input #
-# ssincosd(): computes the sine and cosine of a denormalized input #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input #
-# d0 = round precision,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = sin(X) or cos(X) #
-# #
-# For ssincos(X): #
-# fp0 = sin(X) #
-# fp1 = cos(X) #
-# #
-# ACCURACY and MONOTONICITY ******************************************* #
-# The returned result is within 1 ulp in 64 significant bit, i.e. #
-# within 0.5001 ulp to 53 bits if the result is subsequently #
-# rounded to double precision. The result is provably monotonic #
-# in double precision. #
-# #
-# ALGORITHM *********************************************************** #
-# #
-# SIN and COS: #
-# 1. If SIN is invoked, set AdjN := 0; otherwise, set AdjN := 1. #
-# #
-# 2. If |X| >= 15Pi or |X| < 2**(-40), go to 7. #
-# #
-# 3. Decompose X as X = N(Pi/2) + r where |r| <= Pi/4. Let #
-# k = N mod 4, so in particular, k = 0,1,2,or 3. #
-# Overwrite k by k := k + AdjN. #
-# #
-# 4. If k is even, go to 6. #
-# #
-# 5. (k is odd) Set j := (k-1)/2, sgn := (-1)**j. #
-# Return sgn*cos(r) where cos(r) is approximated by an #
-# even polynomial in r, 1 + r*r*(B1+s*(B2+ ... + s*B8)), #
-# s = r*r. #
-# Exit. #
-# #
-# 6. (k is even) Set j := k/2, sgn := (-1)**j. Return sgn*sin(r) #
-# where sin(r) is approximated by an odd polynomial in r #
-# r + r*s*(A1+s*(A2+ ... + s*A7)), s = r*r. #
-# Exit. #
-# #
-# 7. If |X| > 1, go to 9. #
-# #
-# 8. (|X|<2**(-40)) If SIN is invoked, return X; #
-# otherwise return 1. #
-# #
-# 9. Overwrite X by X := X rem 2Pi. Now that |X| <= Pi, #
-# go back to 3. #
-# #
-# SINCOS: #
-# 1. If |X| >= 15Pi or |X| < 2**(-40), go to 6. #
-# #
-# 2. Decompose X as X = N(Pi/2) + r where |r| <= Pi/4. Let #
-# k = N mod 4, so in particular, k = 0,1,2,or 3. #
-# #
-# 3. If k is even, go to 5. #
-# #
-# 4. (k is odd) Set j1 := (k-1)/2, j2 := j1 (EOR) (k mod 2), ie. #
-# j1 exclusive or with the l.s.b. of k. #
-# sgn1 := (-1)**j1, sgn2 := (-1)**j2. #
-# SIN(X) = sgn1 * cos(r) and COS(X) = sgn2*sin(r) where #
-# sin(r) and cos(r) are computed as odd and even #
-# polynomials in r, respectively. Exit #
-# #
-# 5. (k is even) Set j1 := k/2, sgn1 := (-1)**j1. #
-# SIN(X) = sgn1 * sin(r) and COS(X) = sgn1*cos(r) where #
-# sin(r) and cos(r) are computed as odd and even #
-# polynomials in r, respectively. Exit #
-# #
-# 6. If |X| > 1, go to 8. #
-# #
-# 7. (|X|<2**(-40)) SIN(X) = X and COS(X) = 1. Exit. #
-# #
-# 8. Overwrite X by X := X rem 2Pi. Now that |X| <= Pi, #
-# go back to 2. #
-# #
-#########################################################################
-
-SINA7: long 0xBD6AAA77,0xCCC994F5
-SINA6: long 0x3DE61209,0x7AAE8DA1
-SINA5: long 0xBE5AE645,0x2A118AE4
-SINA4: long 0x3EC71DE3,0xA5341531
-SINA3: long 0xBF2A01A0,0x1A018B59,0x00000000,0x00000000
-SINA2: long 0x3FF80000,0x88888888,0x888859AF,0x00000000
-SINA1: long 0xBFFC0000,0xAAAAAAAA,0xAAAAAA99,0x00000000
-
-COSB8: long 0x3D2AC4D0,0xD6011EE3
-COSB7: long 0xBDA9396F,0x9F45AC19
-COSB6: long 0x3E21EED9,0x0612C972
-COSB5: long 0xBE927E4F,0xB79D9FCF
-COSB4: long 0x3EFA01A0,0x1A01D423,0x00000000,0x00000000
-COSB3: long 0xBFF50000,0xB60B60B6,0x0B61D438,0x00000000
-COSB2: long 0x3FFA0000,0xAAAAAAAA,0xAAAAAB5E
-COSB1: long 0xBF000000
-
- set INARG,FP_SCR0
-
- set X,FP_SCR0
-# set XDCARE,X+2
- set XFRAC,X+4
-
- set RPRIME,FP_SCR0
- set SPRIME,FP_SCR1
-
- set POSNEG1,L_SCR1
- set TWOTO63,L_SCR1
-
- set ENDFLAG,L_SCR2
- set INT,L_SCR2
-
- set ADJN,L_SCR3
-
-############################################
- global ssin
-ssin:
- mov.l &0,ADJN(%a6) # yes; SET ADJN TO 0
- bra.b SINBGN
-
-############################################
- global scos
-scos:
- mov.l &1,ADJN(%a6) # yes; SET ADJN TO 1
-
-############################################
-SINBGN:
-#--SAVE FPCR, FP1. CHECK IF |X| IS TOO SMALL OR LARGE
-
- fmov.x (%a0),%fp0 # LOAD INPUT
- fmov.x %fp0,X(%a6) # save input at X
-
-# "COMPACTIFY" X
- mov.l (%a0),%d1 # put exp in hi word
- mov.w 4(%a0),%d1 # fetch hi(man)
- and.l &0x7FFFFFFF,%d1 # strip sign
-
- cmpi.l %d1,&0x3FD78000 # is |X| >= 2**(-40)?
- bge.b SOK1 # no
- bra.w SINSM # yes; input is very small
-
-SOK1:
- cmp.l %d1,&0x4004BC7E # is |X| < 15 PI?
- blt.b SINMAIN # no
- bra.w SREDUCEX # yes; input is very large
-
-#--THIS IS THE USUAL CASE, |X| <= 15 PI.
-#--THE ARGUMENT REDUCTION IS DONE BY TABLE LOOK UP.
-SINMAIN:
- fmov.x %fp0,%fp1
- fmul.d TWOBYPI(%pc),%fp1 # X*2/PI
-
- lea PITBL+0x200(%pc),%a1 # TABLE OF N*PI/2, N = -32,...,32
-
- fmov.l %fp1,INT(%a6) # CONVERT TO INTEGER
-
- mov.l INT(%a6),%d1 # make a copy of N
- asl.l &4,%d1 # N *= 16
- add.l %d1,%a1 # tbl_addr = a1 + (N*16)
-
-# A1 IS THE ADDRESS OF N*PIBY2
-# ...WHICH IS IN TWO PIECES Y1 & Y2
- fsub.x (%a1)+,%fp0 # X-Y1
- fsub.s (%a1),%fp0 # fp0 = R = (X-Y1)-Y2
-
-SINCONT:
-#--continuation from REDUCEX
-
-#--GET N+ADJN AND SEE IF SIN(R) OR COS(R) IS NEEDED
- mov.l INT(%a6),%d1
- add.l ADJN(%a6),%d1 # SEE IF D0 IS ODD OR EVEN
- ror.l &1,%d1 # D0 WAS ODD IFF D0 IS NEGATIVE
- cmp.l %d1,&0
- blt.w COSPOLY
-
-#--LET J BE THE LEAST SIG. BIT OF D0, LET SGN := (-1)**J.
-#--THEN WE RETURN SGN*SIN(R). SGN*SIN(R) IS COMPUTED BY
-#--R' + R'*S*(A1 + S(A2 + S(A3 + S(A4 + ... + SA7)))), WHERE
-#--R' = SGN*R, S=R*R. THIS CAN BE REWRITTEN AS
-#--R' + R'*S*( [A1+T(A3+T(A5+TA7))] + [S(A2+T(A4+TA6))])
-#--WHERE T=S*S.
-#--NOTE THAT A3 THROUGH A7 ARE STORED IN DOUBLE PRECISION
-#--WHILE A1 AND A2 ARE IN DOUBLE-EXTENDED FORMAT.
-SINPOLY:
- fmovm.x &0x0c,-(%sp) # save fp2/fp3
-
- fmov.x %fp0,X(%a6) # X IS R
- fmul.x %fp0,%fp0 # FP0 IS S
-
- fmov.d SINA7(%pc),%fp3
- fmov.d SINA6(%pc),%fp2
-
- fmov.x %fp0,%fp1
- fmul.x %fp1,%fp1 # FP1 IS T
-
- ror.l &1,%d1
- and.l &0x80000000,%d1
-# ...LEAST SIG. BIT OF D0 IN SIGN POSITION
- eor.l %d1,X(%a6) # X IS NOW R'= SGN*R
-
- fmul.x %fp1,%fp3 # TA7
- fmul.x %fp1,%fp2 # TA6
-
- fadd.d SINA5(%pc),%fp3 # A5+TA7
- fadd.d SINA4(%pc),%fp2 # A4+TA6
-
- fmul.x %fp1,%fp3 # T(A5+TA7)
- fmul.x %fp1,%fp2 # T(A4+TA6)
-
- fadd.d SINA3(%pc),%fp3 # A3+T(A5+TA7)
- fadd.x SINA2(%pc),%fp2 # A2+T(A4+TA6)
-
- fmul.x %fp3,%fp1 # T(A3+T(A5+TA7))
-
- fmul.x %fp0,%fp2 # S(A2+T(A4+TA6))
- fadd.x SINA1(%pc),%fp1 # A1+T(A3+T(A5+TA7))
- fmul.x X(%a6),%fp0 # R'*S
-
- fadd.x %fp2,%fp1 # [A1+T(A3+T(A5+TA7))]+[S(A2+T(A4+TA6))]
-
- fmul.x %fp1,%fp0 # SIN(R')-R'
-
- fmovm.x (%sp)+,&0x30 # restore fp2/fp3
-
- fmov.l %d0,%fpcr # restore users round mode,prec
- fadd.x X(%a6),%fp0 # last inst - possible exception set
- bra t_inx2
-
-#--LET J BE THE LEAST SIG. BIT OF D0, LET SGN := (-1)**J.
-#--THEN WE RETURN SGN*COS(R). SGN*COS(R) IS COMPUTED BY
-#--SGN + S'*(B1 + S(B2 + S(B3 + S(B4 + ... + SB8)))), WHERE
-#--S=R*R AND S'=SGN*S. THIS CAN BE REWRITTEN AS
-#--SGN + S'*([B1+T(B3+T(B5+TB7))] + [S(B2+T(B4+T(B6+TB8)))])
-#--WHERE T=S*S.
-#--NOTE THAT B4 THROUGH B8 ARE STORED IN DOUBLE PRECISION
-#--WHILE B2 AND B3 ARE IN DOUBLE-EXTENDED FORMAT, B1 IS -1/2
-#--AND IS THEREFORE STORED AS SINGLE PRECISION.
-COSPOLY:
- fmovm.x &0x0c,-(%sp) # save fp2/fp3
-
- fmul.x %fp0,%fp0 # FP0 IS S
-
- fmov.d COSB8(%pc),%fp2
- fmov.d COSB7(%pc),%fp3
-
- fmov.x %fp0,%fp1
- fmul.x %fp1,%fp1 # FP1 IS T
-
- fmov.x %fp0,X(%a6) # X IS S
- ror.l &1,%d1
- and.l &0x80000000,%d1
-# ...LEAST SIG. BIT OF D0 IN SIGN POSITION
-
- fmul.x %fp1,%fp2 # TB8
-
- eor.l %d1,X(%a6) # X IS NOW S'= SGN*S
- and.l &0x80000000,%d1
-
- fmul.x %fp1,%fp3 # TB7
-
- or.l &0x3F800000,%d1 # D0 IS SGN IN SINGLE
- mov.l %d1,POSNEG1(%a6)
-
- fadd.d COSB6(%pc),%fp2 # B6+TB8
- fadd.d COSB5(%pc),%fp3 # B5+TB7
-
- fmul.x %fp1,%fp2 # T(B6+TB8)
- fmul.x %fp1,%fp3 # T(B5+TB7)
-
- fadd.d COSB4(%pc),%fp2 # B4+T(B6+TB8)
- fadd.x COSB3(%pc),%fp3 # B3+T(B5+TB7)
-
- fmul.x %fp1,%fp2 # T(B4+T(B6+TB8))
- fmul.x %fp3,%fp1 # T(B3+T(B5+TB7))
-
- fadd.x COSB2(%pc),%fp2 # B2+T(B4+T(B6+TB8))
- fadd.s COSB1(%pc),%fp1 # B1+T(B3+T(B5+TB7))
-
- fmul.x %fp2,%fp0 # S(B2+T(B4+T(B6+TB8)))
-
- fadd.x %fp1,%fp0
-
- fmul.x X(%a6),%fp0
-
- fmovm.x (%sp)+,&0x30 # restore fp2/fp3
-
- fmov.l %d0,%fpcr # restore users round mode,prec
- fadd.s POSNEG1(%a6),%fp0 # last inst - possible exception set
- bra t_inx2
-
-##############################################
-
-# SINe: Big OR Small?
-#--IF |X| > 15PI, WE USE THE GENERAL ARGUMENT REDUCTION.
-#--IF |X| < 2**(-40), RETURN X OR 1.
-SINBORS:
- cmp.l %d1,&0x3FFF8000
- bgt.l SREDUCEX
-
-SINSM:
- mov.l ADJN(%a6),%d1
- cmp.l %d1,&0
- bgt.b COSTINY
-
-# here, the operation may underflow iff the precision is sgl or dbl.
-# extended denorms are handled through another entry point.
-SINTINY:
-# mov.w &0x0000,XDCARE(%a6) # JUST IN CASE
-
- fmov.l %d0,%fpcr # restore users round mode,prec
- mov.b &FMOV_OP,%d1 # last inst is MOVE
- fmov.x X(%a6),%fp0 # last inst - possible exception set
- bra t_catch
-
-COSTINY:
- fmov.s &0x3F800000,%fp0 # fp0 = 1.0
- fmov.l %d0,%fpcr # restore users round mode,prec
- fadd.s &0x80800000,%fp0 # last inst - possible exception set
- bra t_pinx2
-
-################################################
- global ssind
-#--SIN(X) = X FOR DENORMALIZED X
-ssind:
- bra t_extdnrm
-
-############################################
- global scosd
-#--COS(X) = 1 FOR DENORMALIZED X
-scosd:
- fmov.s &0x3F800000,%fp0 # fp0 = 1.0
- bra t_pinx2
-
-##################################################
-
- global ssincos
-ssincos:
-#--SET ADJN TO 4
- mov.l &4,ADJN(%a6)
-
- fmov.x (%a0),%fp0 # LOAD INPUT
- fmov.x %fp0,X(%a6)
-
- mov.l (%a0),%d1
- mov.w 4(%a0),%d1
- and.l &0x7FFFFFFF,%d1 # COMPACTIFY X
-
- cmp.l %d1,&0x3FD78000 # |X| >= 2**(-40)?
- bge.b SCOK1
- bra.w SCSM
-
-SCOK1:
- cmp.l %d1,&0x4004BC7E # |X| < 15 PI?
- blt.b SCMAIN
- bra.w SREDUCEX
-
-
-#--THIS IS THE USUAL CASE, |X| <= 15 PI.
-#--THE ARGUMENT REDUCTION IS DONE BY TABLE LOOK UP.
-SCMAIN:
- fmov.x %fp0,%fp1
-
- fmul.d TWOBYPI(%pc),%fp1 # X*2/PI
-
- lea PITBL+0x200(%pc),%a1 # TABLE OF N*PI/2, N = -32,...,32
-
- fmov.l %fp1,INT(%a6) # CONVERT TO INTEGER
-
- mov.l INT(%a6),%d1
- asl.l &4,%d1
- add.l %d1,%a1 # ADDRESS OF N*PIBY2, IN Y1, Y2
-
- fsub.x (%a1)+,%fp0 # X-Y1
- fsub.s (%a1),%fp0 # FP0 IS R = (X-Y1)-Y2
-
-SCCONT:
-#--continuation point from REDUCEX
-
- mov.l INT(%a6),%d1
- ror.l &1,%d1
- cmp.l %d1,&0 # D0 < 0 IFF N IS ODD
- bge.w NEVEN
-
-SNODD:
-#--REGISTERS SAVED SO FAR: D0, A0, FP2.
- fmovm.x &0x04,-(%sp) # save fp2
-
- fmov.x %fp0,RPRIME(%a6)
- fmul.x %fp0,%fp0 # FP0 IS S = R*R
- fmov.d SINA7(%pc),%fp1 # A7
- fmov.d COSB8(%pc),%fp2 # B8
- fmul.x %fp0,%fp1 # SA7
- fmul.x %fp0,%fp2 # SB8
-
- mov.l %d2,-(%sp)
- mov.l %d1,%d2
- ror.l &1,%d2
- and.l &0x80000000,%d2
- eor.l %d1,%d2
- and.l &0x80000000,%d2
-
- fadd.d SINA6(%pc),%fp1 # A6+SA7
- fadd.d COSB7(%pc),%fp2 # B7+SB8
-
- fmul.x %fp0,%fp1 # S(A6+SA7)
- eor.l %d2,RPRIME(%a6)
- mov.l (%sp)+,%d2
- fmul.x %fp0,%fp2 # S(B7+SB8)
- ror.l &1,%d1
- and.l &0x80000000,%d1
- mov.l &0x3F800000,POSNEG1(%a6)
- eor.l %d1,POSNEG1(%a6)
-
- fadd.d SINA5(%pc),%fp1 # A5+S(A6+SA7)
- fadd.d COSB6(%pc),%fp2 # B6+S(B7+SB8)
-
- fmul.x %fp0,%fp1 # S(A5+S(A6+SA7))
- fmul.x %fp0,%fp2 # S(B6+S(B7+SB8))
- fmov.x %fp0,SPRIME(%a6)
-
- fadd.d SINA4(%pc),%fp1 # A4+S(A5+S(A6+SA7))
- eor.l %d1,SPRIME(%a6)
- fadd.d COSB5(%pc),%fp2 # B5+S(B6+S(B7+SB8))
-
- fmul.x %fp0,%fp1 # S(A4+...)
- fmul.x %fp0,%fp2 # S(B5+...)
-
- fadd.d SINA3(%pc),%fp1 # A3+S(A4+...)
- fadd.d COSB4(%pc),%fp2 # B4+S(B5+...)
-
- fmul.x %fp0,%fp1 # S(A3+...)
- fmul.x %fp0,%fp2 # S(B4+...)
-
- fadd.x SINA2(%pc),%fp1 # A2+S(A3+...)
- fadd.x COSB3(%pc),%fp2 # B3+S(B4+...)
-
- fmul.x %fp0,%fp1 # S(A2+...)
- fmul.x %fp0,%fp2 # S(B3+...)
-
- fadd.x SINA1(%pc),%fp1 # A1+S(A2+...)
- fadd.x COSB2(%pc),%fp2 # B2+S(B3+...)
-
- fmul.x %fp0,%fp1 # S(A1+...)
- fmul.x %fp2,%fp0 # S(B2+...)
-
- fmul.x RPRIME(%a6),%fp1 # R'S(A1+...)
- fadd.s COSB1(%pc),%fp0 # B1+S(B2...)
- fmul.x SPRIME(%a6),%fp0 # S'(B1+S(B2+...))
-
- fmovm.x (%sp)+,&0x20 # restore fp2
-
- fmov.l %d0,%fpcr
- fadd.x RPRIME(%a6),%fp1 # COS(X)
- bsr sto_cos # store cosine result
- fadd.s POSNEG1(%a6),%fp0 # SIN(X)
- bra t_inx2
-
-NEVEN:
-#--REGISTERS SAVED SO FAR: FP2.
- fmovm.x &0x04,-(%sp) # save fp2
-
- fmov.x %fp0,RPRIME(%a6)
- fmul.x %fp0,%fp0 # FP0 IS S = R*R
-
- fmov.d COSB8(%pc),%fp1 # B8
- fmov.d SINA7(%pc),%fp2 # A7
-
- fmul.x %fp0,%fp1 # SB8
- fmov.x %fp0,SPRIME(%a6)
- fmul.x %fp0,%fp2 # SA7
-
- ror.l &1,%d1
- and.l &0x80000000,%d1
-
- fadd.d COSB7(%pc),%fp1 # B7+SB8
- fadd.d SINA6(%pc),%fp2 # A6+SA7
-
- eor.l %d1,RPRIME(%a6)
- eor.l %d1,SPRIME(%a6)
-
- fmul.x %fp0,%fp1 # S(B7+SB8)
-
- or.l &0x3F800000,%d1
- mov.l %d1,POSNEG1(%a6)
-
- fmul.x %fp0,%fp2 # S(A6+SA7)
-
- fadd.d COSB6(%pc),%fp1 # B6+S(B7+SB8)
- fadd.d SINA5(%pc),%fp2 # A5+S(A6+SA7)
-
- fmul.x %fp0,%fp1 # S(B6+S(B7+SB8))
- fmul.x %fp0,%fp2 # S(A5+S(A6+SA7))
-
- fadd.d COSB5(%pc),%fp1 # B5+S(B6+S(B7+SB8))
- fadd.d SINA4(%pc),%fp2 # A4+S(A5+S(A6+SA7))
-
- fmul.x %fp0,%fp1 # S(B5+...)
- fmul.x %fp0,%fp2 # S(A4+...)
-
- fadd.d COSB4(%pc),%fp1 # B4+S(B5+...)
- fadd.d SINA3(%pc),%fp2 # A3+S(A4+...)
-
- fmul.x %fp0,%fp1 # S(B4+...)
- fmul.x %fp0,%fp2 # S(A3+...)
-
- fadd.x COSB3(%pc),%fp1 # B3+S(B4+...)
- fadd.x SINA2(%pc),%fp2 # A2+S(A3+...)
-
- fmul.x %fp0,%fp1 # S(B3+...)
- fmul.x %fp0,%fp2 # S(A2+...)
-
- fadd.x COSB2(%pc),%fp1 # B2+S(B3+...)
- fadd.x SINA1(%pc),%fp2 # A1+S(A2+...)
-
- fmul.x %fp0,%fp1 # S(B2+...)
- fmul.x %fp2,%fp0 # s(a1+...)
-
-
- fadd.s COSB1(%pc),%fp1 # B1+S(B2...)
- fmul.x RPRIME(%a6),%fp0 # R'S(A1+...)
- fmul.x SPRIME(%a6),%fp1 # S'(B1+S(B2+...))
-
- fmovm.x (%sp)+,&0x20 # restore fp2
-
- fmov.l %d0,%fpcr
- fadd.s POSNEG1(%a6),%fp1 # COS(X)
- bsr sto_cos # store cosine result
- fadd.x RPRIME(%a6),%fp0 # SIN(X)
- bra t_inx2
-
-################################################
-
-SCBORS:
- cmp.l %d1,&0x3FFF8000
- bgt.w SREDUCEX
-
-################################################
-
-SCSM:
-# mov.w &0x0000,XDCARE(%a6)
- fmov.s &0x3F800000,%fp1
-
- fmov.l %d0,%fpcr
- fsub.s &0x00800000,%fp1
- bsr sto_cos # store cosine result
- fmov.l %fpcr,%d0 # d0 must have fpcr,too
- mov.b &FMOV_OP,%d1 # last inst is MOVE
- fmov.x X(%a6),%fp0
- bra t_catch
-
-##############################################
-
- global ssincosd
-#--SIN AND COS OF X FOR DENORMALIZED X
-ssincosd:
- mov.l %d0,-(%sp) # save d0
- fmov.s &0x3F800000,%fp1
- bsr sto_cos # store cosine result
- mov.l (%sp)+,%d0 # restore d0
- bra t_extdnrm
-
-############################################
-
-#--WHEN REDUCEX IS USED, THE CODE WILL INEVITABLY BE SLOW.
-#--THIS REDUCTION METHOD, HOWEVER, IS MUCH FASTER THAN USING
-#--THE REMAINDER INSTRUCTION WHICH IS NOW IN SOFTWARE.
-SREDUCEX:
- fmovm.x &0x3c,-(%sp) # save {fp2-fp5}
- mov.l %d2,-(%sp) # save d2
- fmov.s &0x00000000,%fp1 # fp1 = 0
-
-#--If compact form of abs(arg) in d0=$7ffeffff, argument is so large that
-#--there is a danger of unwanted overflow in first LOOP iteration. In this
-#--case, reduce argument by one remainder step to make subsequent reduction
-#--safe.
- cmp.l %d1,&0x7ffeffff # is arg dangerously large?
- bne.b SLOOP # no
-
-# yes; create 2**16383*PI/2
- mov.w &0x7ffe,FP_SCR0_EX(%a6)
- mov.l &0xc90fdaa2,FP_SCR0_HI(%a6)
- clr.l FP_SCR0_LO(%a6)
-
-# create low half of 2**16383*PI/2 at FP_SCR1
- mov.w &0x7fdc,FP_SCR1_EX(%a6)
- mov.l &0x85a308d3,FP_SCR1_HI(%a6)
- clr.l FP_SCR1_LO(%a6)
-
- ftest.x %fp0 # test sign of argument
- fblt.w sred_neg
-
- or.b &0x80,FP_SCR0_EX(%a6) # positive arg
- or.b &0x80,FP_SCR1_EX(%a6)
-sred_neg:
- fadd.x FP_SCR0(%a6),%fp0 # high part of reduction is exact
- fmov.x %fp0,%fp1 # save high result in fp1
- fadd.x FP_SCR1(%a6),%fp0 # low part of reduction
- fsub.x %fp0,%fp1 # determine low component of result
- fadd.x FP_SCR1(%a6),%fp1 # fp0/fp1 are reduced argument.
-
-#--ON ENTRY, FP0 IS X, ON RETURN, FP0 IS X REM PI/2, |X| <= PI/4.
-#--integer quotient will be stored in N
-#--Intermeditate remainder is 66-bit long; (R,r) in (FP0,FP1)
-SLOOP:
- fmov.x %fp0,INARG(%a6) # +-2**K * F, 1 <= F < 2
- mov.w INARG(%a6),%d1
- mov.l %d1,%a1 # save a copy of D0
- and.l &0x00007FFF,%d1
- sub.l &0x00003FFF,%d1 # d0 = K
- cmp.l %d1,&28
- ble.b SLASTLOOP
-SCONTLOOP:
- sub.l &27,%d1 # d0 = L := K-27
- mov.b &0,ENDFLAG(%a6)
- bra.b SWORK
-SLASTLOOP:
- clr.l %d1 # d0 = L := 0
- mov.b &1,ENDFLAG(%a6)
-
-SWORK:
-#--FIND THE REMAINDER OF (R,r) W.R.T. 2**L * (PI/2). L IS SO CHOSEN
-#--THAT INT( X * (2/PI) / 2**(L) ) < 2**29.
-
-#--CREATE 2**(-L) * (2/PI), SIGN(INARG)*2**(63),
-#--2**L * (PIby2_1), 2**L * (PIby2_2)
-
- mov.l &0x00003FFE,%d2 # BIASED EXP OF 2/PI
- sub.l %d1,%d2 # BIASED EXP OF 2**(-L)*(2/PI)
-
- mov.l &0xA2F9836E,FP_SCR0_HI(%a6)
- mov.l &0x4E44152A,FP_SCR0_LO(%a6)
- mov.w %d2,FP_SCR0_EX(%a6) # FP_SCR0 = 2**(-L)*(2/PI)
-
- fmov.x %fp0,%fp2
- fmul.x FP_SCR0(%a6),%fp2 # fp2 = X * 2**(-L)*(2/PI)
-
-#--WE MUST NOW FIND INT(FP2). SINCE WE NEED THIS VALUE IN
-#--FLOATING POINT FORMAT, THE TWO FMOVE'S FMOVE.L FP <--> N
-#--WILL BE TOO INEFFICIENT. THE WAY AROUND IT IS THAT
-#--(SIGN(INARG)*2**63 + FP2) - SIGN(INARG)*2**63 WILL GIVE
-#--US THE DESIRED VALUE IN FLOATING POINT.
- mov.l %a1,%d2
- swap %d2
- and.l &0x80000000,%d2
- or.l &0x5F000000,%d2 # d2 = SIGN(INARG)*2**63 IN SGL
- mov.l %d2,TWOTO63(%a6)
- fadd.s TWOTO63(%a6),%fp2 # THE FRACTIONAL PART OF FP1 IS ROUNDED
- fsub.s TWOTO63(%a6),%fp2 # fp2 = N
-# fint.x %fp2
-
-#--CREATING 2**(L)*Piby2_1 and 2**(L)*Piby2_2
- mov.l %d1,%d2 # d2 = L
-
- add.l &0x00003FFF,%d2 # BIASED EXP OF 2**L * (PI/2)
- mov.w %d2,FP_SCR0_EX(%a6)
- mov.l &0xC90FDAA2,FP_SCR0_HI(%a6)
- clr.l FP_SCR0_LO(%a6) # FP_SCR0 = 2**(L) * Piby2_1
-
- add.l &0x00003FDD,%d1
- mov.w %d1,FP_SCR1_EX(%a6)
- mov.l &0x85A308D3,FP_SCR1_HI(%a6)
- clr.l FP_SCR1_LO(%a6) # FP_SCR1 = 2**(L) * Piby2_2
-
- mov.b ENDFLAG(%a6),%d1
-
-#--We are now ready to perform (R+r) - N*P1 - N*P2, P1 = 2**(L) * Piby2_1 and
-#--P2 = 2**(L) * Piby2_2
- fmov.x %fp2,%fp4 # fp4 = N
- fmul.x FP_SCR0(%a6),%fp4 # fp4 = W = N*P1
- fmov.x %fp2,%fp5 # fp5 = N
- fmul.x FP_SCR1(%a6),%fp5 # fp5 = w = N*P2
- fmov.x %fp4,%fp3 # fp3 = W = N*P1
-
-#--we want P+p = W+w but |p| <= half ulp of P
-#--Then, we need to compute A := R-P and a := r-p
- fadd.x %fp5,%fp3 # fp3 = P
- fsub.x %fp3,%fp4 # fp4 = W-P
-
- fsub.x %fp3,%fp0 # fp0 = A := R - P
- fadd.x %fp5,%fp4 # fp4 = p = (W-P)+w
-
- fmov.x %fp0,%fp3 # fp3 = A
- fsub.x %fp4,%fp1 # fp1 = a := r - p
-
-#--Now we need to normalize (A,a) to "new (R,r)" where R+r = A+a but
-#--|r| <= half ulp of R.
- fadd.x %fp1,%fp0 # fp0 = R := A+a
-#--No need to calculate r if this is the last loop
- cmp.b %d1,&0
- bgt.w SRESTORE
-
-#--Need to calculate r
- fsub.x %fp0,%fp3 # fp3 = A-R
- fadd.x %fp3,%fp1 # fp1 = r := (A-R)+a
- bra.w SLOOP
-
-SRESTORE:
- fmov.l %fp2,INT(%a6)
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x (%sp)+,&0x3c # restore {fp2-fp5}
-
- mov.l ADJN(%a6),%d1
- cmp.l %d1,&4
-
- blt.w SINCONT
- bra.w SCCONT
-
-#########################################################################
-# stan(): computes the tangent of a normalized input #
-# stand(): computes the tangent of a denormalized input #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input #
-# d0 = round precision,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = tan(X) #
-# #
-# ACCURACY and MONOTONICITY ******************************************* #
-# The returned result is within 3 ulp in 64 significant bit, i.e. #
-# within 0.5001 ulp to 53 bits if the result is subsequently #
-# rounded to double precision. The result is provably monotonic #
-# in double precision. #
-# #
-# ALGORITHM *********************************************************** #
-# #
-# 1. If |X| >= 15Pi or |X| < 2**(-40), go to 6. #
-# #
-# 2. Decompose X as X = N(Pi/2) + r where |r| <= Pi/4. Let #
-# k = N mod 2, so in particular, k = 0 or 1. #
-# #
-# 3. If k is odd, go to 5. #
-# #
-# 4. (k is even) Tan(X) = tan(r) and tan(r) is approximated by a #
-# rational function U/V where #
-# U = r + r*s*(P1 + s*(P2 + s*P3)), and #
-# V = 1 + s*(Q1 + s*(Q2 + s*(Q3 + s*Q4))), s = r*r. #
-# Exit. #
-# #
-# 4. (k is odd) Tan(X) = -cot(r). Since tan(r) is approximated by #
-# a rational function U/V where #
-# U = r + r*s*(P1 + s*(P2 + s*P3)), and #
-# V = 1 + s*(Q1 + s*(Q2 + s*(Q3 + s*Q4))), s = r*r, #
-# -Cot(r) = -V/U. Exit. #
-# #
-# 6. If |X| > 1, go to 8. #
-# #
-# 7. (|X|<2**(-40)) Tan(X) = X. Exit. #
-# #
-# 8. Overwrite X by X := X rem 2Pi. Now that |X| <= Pi, go back #
-# to 2. #
-# #
-#########################################################################
-
-TANQ4:
- long 0x3EA0B759,0xF50F8688
-TANP3:
- long 0xBEF2BAA5,0xA8924F04
-
-TANQ3:
- long 0xBF346F59,0xB39BA65F,0x00000000,0x00000000
-
-TANP2:
- long 0x3FF60000,0xE073D3FC,0x199C4A00,0x00000000
-
-TANQ2:
- long 0x3FF90000,0xD23CD684,0x15D95FA1,0x00000000
-
-TANP1:
- long 0xBFFC0000,0x8895A6C5,0xFB423BCA,0x00000000
-
-TANQ1:
- long 0xBFFD0000,0xEEF57E0D,0xA84BC8CE,0x00000000
-
-INVTWOPI:
- long 0x3FFC0000,0xA2F9836E,0x4E44152A,0x00000000
-
-TWOPI1:
- long 0x40010000,0xC90FDAA2,0x00000000,0x00000000
-TWOPI2:
- long 0x3FDF0000,0x85A308D4,0x00000000,0x00000000
-
-#--N*PI/2, -32 <= N <= 32, IN A LEADING TERM IN EXT. AND TRAILING
-#--TERM IN SGL. NOTE THAT PI IS 64-BIT LONG, THUS N*PI/2 IS AT
-#--MOST 69 BITS LONG.
-# global PITBL
-PITBL:
- long 0xC0040000,0xC90FDAA2,0x2168C235,0x21800000
- long 0xC0040000,0xC2C75BCD,0x105D7C23,0xA0D00000
- long 0xC0040000,0xBC7EDCF7,0xFF523611,0xA1E80000
- long 0xC0040000,0xB6365E22,0xEE46F000,0x21480000
- long 0xC0040000,0xAFEDDF4D,0xDD3BA9EE,0xA1200000
- long 0xC0040000,0xA9A56078,0xCC3063DD,0x21FC0000
- long 0xC0040000,0xA35CE1A3,0xBB251DCB,0x21100000
- long 0xC0040000,0x9D1462CE,0xAA19D7B9,0xA1580000
- long 0xC0040000,0x96CBE3F9,0x990E91A8,0x21E00000
- long 0xC0040000,0x90836524,0x88034B96,0x20B00000
- long 0xC0040000,0x8A3AE64F,0x76F80584,0xA1880000
- long 0xC0040000,0x83F2677A,0x65ECBF73,0x21C40000
- long 0xC0030000,0xFB53D14A,0xA9C2F2C2,0x20000000
- long 0xC0030000,0xEEC2D3A0,0x87AC669F,0x21380000
- long 0xC0030000,0xE231D5F6,0x6595DA7B,0xA1300000
- long 0xC0030000,0xD5A0D84C,0x437F4E58,0x9FC00000
- long 0xC0030000,0xC90FDAA2,0x2168C235,0x21000000
- long 0xC0030000,0xBC7EDCF7,0xFF523611,0xA1680000
- long 0xC0030000,0xAFEDDF4D,0xDD3BA9EE,0xA0A00000
- long 0xC0030000,0xA35CE1A3,0xBB251DCB,0x20900000
- long 0xC0030000,0x96CBE3F9,0x990E91A8,0x21600000
- long 0xC0030000,0x8A3AE64F,0x76F80584,0xA1080000
- long 0xC0020000,0xFB53D14A,0xA9C2F2C2,0x1F800000
- long 0xC0020000,0xE231D5F6,0x6595DA7B,0xA0B00000
- long 0xC0020000,0xC90FDAA2,0x2168C235,0x20800000
- long 0xC0020000,0xAFEDDF4D,0xDD3BA9EE,0xA0200000
- long 0xC0020000,0x96CBE3F9,0x990E91A8,0x20E00000
- long 0xC0010000,0xFB53D14A,0xA9C2F2C2,0x1F000000
- long 0xC0010000,0xC90FDAA2,0x2168C235,0x20000000
- long 0xC0010000,0x96CBE3F9,0x990E91A8,0x20600000
- long 0xC0000000,0xC90FDAA2,0x2168C235,0x1F800000
- long 0xBFFF0000,0xC90FDAA2,0x2168C235,0x1F000000
- long 0x00000000,0x00000000,0x00000000,0x00000000
- long 0x3FFF0000,0xC90FDAA2,0x2168C235,0x9F000000
- long 0x40000000,0xC90FDAA2,0x2168C235,0x9F800000
- long 0x40010000,0x96CBE3F9,0x990E91A8,0xA0600000
- long 0x40010000,0xC90FDAA2,0x2168C235,0xA0000000
- long 0x40010000,0xFB53D14A,0xA9C2F2C2,0x9F000000
- long 0x40020000,0x96CBE3F9,0x990E91A8,0xA0E00000
- long 0x40020000,0xAFEDDF4D,0xDD3BA9EE,0x20200000
- long 0x40020000,0xC90FDAA2,0x2168C235,0xA0800000
- long 0x40020000,0xE231D5F6,0x6595DA7B,0x20B00000
- long 0x40020000,0xFB53D14A,0xA9C2F2C2,0x9F800000
- long 0x40030000,0x8A3AE64F,0x76F80584,0x21080000
- long 0x40030000,0x96CBE3F9,0x990E91A8,0xA1600000
- long 0x40030000,0xA35CE1A3,0xBB251DCB,0xA0900000
- long 0x40030000,0xAFEDDF4D,0xDD3BA9EE,0x20A00000
- long 0x40030000,0xBC7EDCF7,0xFF523611,0x21680000
- long 0x40030000,0xC90FDAA2,0x2168C235,0xA1000000
- long 0x40030000,0xD5A0D84C,0x437F4E58,0x1FC00000
- long 0x40030000,0xE231D5F6,0x6595DA7B,0x21300000
- long 0x40030000,0xEEC2D3A0,0x87AC669F,0xA1380000
- long 0x40030000,0xFB53D14A,0xA9C2F2C2,0xA0000000
- long 0x40040000,0x83F2677A,0x65ECBF73,0xA1C40000
- long 0x40040000,0x8A3AE64F,0x76F80584,0x21880000
- long 0x40040000,0x90836524,0x88034B96,0xA0B00000
- long 0x40040000,0x96CBE3F9,0x990E91A8,0xA1E00000
- long 0x40040000,0x9D1462CE,0xAA19D7B9,0x21580000
- long 0x40040000,0xA35CE1A3,0xBB251DCB,0xA1100000
- long 0x40040000,0xA9A56078,0xCC3063DD,0xA1FC0000
- long 0x40040000,0xAFEDDF4D,0xDD3BA9EE,0x21200000
- long 0x40040000,0xB6365E22,0xEE46F000,0xA1480000
- long 0x40040000,0xBC7EDCF7,0xFF523611,0x21E80000
- long 0x40040000,0xC2C75BCD,0x105D7C23,0x20D00000
- long 0x40040000,0xC90FDAA2,0x2168C235,0xA1800000
-
- set INARG,FP_SCR0
-
- set TWOTO63,L_SCR1
- set INT,L_SCR1
- set ENDFLAG,L_SCR2
-
- global stan
-stan:
- fmov.x (%a0),%fp0 # LOAD INPUT
-
- mov.l (%a0),%d1
- mov.w 4(%a0),%d1
- and.l &0x7FFFFFFF,%d1
-
- cmp.l %d1,&0x3FD78000 # |X| >= 2**(-40)?
- bge.b TANOK1
- bra.w TANSM
-TANOK1:
- cmp.l %d1,&0x4004BC7E # |X| < 15 PI?
- blt.b TANMAIN
- bra.w REDUCEX
-
-TANMAIN:
-#--THIS IS THE USUAL CASE, |X| <= 15 PI.
-#--THE ARGUMENT REDUCTION IS DONE BY TABLE LOOK UP.
- fmov.x %fp0,%fp1
- fmul.d TWOBYPI(%pc),%fp1 # X*2/PI
-
- lea.l PITBL+0x200(%pc),%a1 # TABLE OF N*PI/2, N = -32,...,32
-
- fmov.l %fp1,%d1 # CONVERT TO INTEGER
-
- asl.l &4,%d1
- add.l %d1,%a1 # ADDRESS N*PIBY2 IN Y1, Y2
-
- fsub.x (%a1)+,%fp0 # X-Y1
-
- fsub.s (%a1),%fp0 # FP0 IS R = (X-Y1)-Y2
-
- ror.l &5,%d1
- and.l &0x80000000,%d1 # D0 WAS ODD IFF D0 < 0
-
-TANCONT:
- fmovm.x &0x0c,-(%sp) # save fp2,fp3
-
- cmp.l %d1,&0
- blt.w NODD
-
- fmov.x %fp0,%fp1
- fmul.x %fp1,%fp1 # S = R*R
-
- fmov.d TANQ4(%pc),%fp3
- fmov.d TANP3(%pc),%fp2
-
- fmul.x %fp1,%fp3 # SQ4
- fmul.x %fp1,%fp2 # SP3
-
- fadd.d TANQ3(%pc),%fp3 # Q3+SQ4
- fadd.x TANP2(%pc),%fp2 # P2+SP3
-
- fmul.x %fp1,%fp3 # S(Q3+SQ4)
- fmul.x %fp1,%fp2 # S(P2+SP3)
-
- fadd.x TANQ2(%pc),%fp3 # Q2+S(Q3+SQ4)
- fadd.x TANP1(%pc),%fp2 # P1+S(P2+SP3)
-
- fmul.x %fp1,%fp3 # S(Q2+S(Q3+SQ4))
- fmul.x %fp1,%fp2 # S(P1+S(P2+SP3))
-
- fadd.x TANQ1(%pc),%fp3 # Q1+S(Q2+S(Q3+SQ4))
- fmul.x %fp0,%fp2 # RS(P1+S(P2+SP3))
-
- fmul.x %fp3,%fp1 # S(Q1+S(Q2+S(Q3+SQ4)))
-
- fadd.x %fp2,%fp0 # R+RS(P1+S(P2+SP3))
-
- fadd.s &0x3F800000,%fp1 # 1+S(Q1+...)
-
- fmovm.x (%sp)+,&0x30 # restore fp2,fp3
-
- fmov.l %d0,%fpcr # restore users round mode,prec
- fdiv.x %fp1,%fp0 # last inst - possible exception set
- bra t_inx2
-
-NODD:
- fmov.x %fp0,%fp1
- fmul.x %fp0,%fp0 # S = R*R
-
- fmov.d TANQ4(%pc),%fp3
- fmov.d TANP3(%pc),%fp2
-
- fmul.x %fp0,%fp3 # SQ4
- fmul.x %fp0,%fp2 # SP3
-
- fadd.d TANQ3(%pc),%fp3 # Q3+SQ4
- fadd.x TANP2(%pc),%fp2 # P2+SP3
-
- fmul.x %fp0,%fp3 # S(Q3+SQ4)
- fmul.x %fp0,%fp2 # S(P2+SP3)
-
- fadd.x TANQ2(%pc),%fp3 # Q2+S(Q3+SQ4)
- fadd.x TANP1(%pc),%fp2 # P1+S(P2+SP3)
-
- fmul.x %fp0,%fp3 # S(Q2+S(Q3+SQ4))
- fmul.x %fp0,%fp2 # S(P1+S(P2+SP3))
-
- fadd.x TANQ1(%pc),%fp3 # Q1+S(Q2+S(Q3+SQ4))
- fmul.x %fp1,%fp2 # RS(P1+S(P2+SP3))
-
- fmul.x %fp3,%fp0 # S(Q1+S(Q2+S(Q3+SQ4)))
-
- fadd.x %fp2,%fp1 # R+RS(P1+S(P2+SP3))
- fadd.s &0x3F800000,%fp0 # 1+S(Q1+...)
-
- fmovm.x (%sp)+,&0x30 # restore fp2,fp3
-
- fmov.x %fp1,-(%sp)
- eor.l &0x80000000,(%sp)
-
- fmov.l %d0,%fpcr # restore users round mode,prec
- fdiv.x (%sp)+,%fp0 # last inst - possible exception set
- bra t_inx2
-
-TANBORS:
-#--IF |X| > 15PI, WE USE THE GENERAL ARGUMENT REDUCTION.
-#--IF |X| < 2**(-40), RETURN X OR 1.
- cmp.l %d1,&0x3FFF8000
- bgt.b REDUCEX
-
-TANSM:
- fmov.x %fp0,-(%sp)
- fmov.l %d0,%fpcr # restore users round mode,prec
- mov.b &FMOV_OP,%d1 # last inst is MOVE
- fmov.x (%sp)+,%fp0 # last inst - posibble exception set
- bra t_catch
-
- global stand
-#--TAN(X) = X FOR DENORMALIZED X
-stand:
- bra t_extdnrm
-
-#--WHEN REDUCEX IS USED, THE CODE WILL INEVITABLY BE SLOW.
-#--THIS REDUCTION METHOD, HOWEVER, IS MUCH FASTER THAN USING
-#--THE REMAINDER INSTRUCTION WHICH IS NOW IN SOFTWARE.
-REDUCEX:
- fmovm.x &0x3c,-(%sp) # save {fp2-fp5}
- mov.l %d2,-(%sp) # save d2
- fmov.s &0x00000000,%fp1 # fp1 = 0
-
-#--If compact form of abs(arg) in d0=$7ffeffff, argument is so large that
-#--there is a danger of unwanted overflow in first LOOP iteration. In this
-#--case, reduce argument by one remainder step to make subsequent reduction
-#--safe.
- cmp.l %d1,&0x7ffeffff # is arg dangerously large?
- bne.b LOOP # no
-
-# yes; create 2**16383*PI/2
- mov.w &0x7ffe,FP_SCR0_EX(%a6)
- mov.l &0xc90fdaa2,FP_SCR0_HI(%a6)
- clr.l FP_SCR0_LO(%a6)
-
-# create low half of 2**16383*PI/2 at FP_SCR1
- mov.w &0x7fdc,FP_SCR1_EX(%a6)
- mov.l &0x85a308d3,FP_SCR1_HI(%a6)
- clr.l FP_SCR1_LO(%a6)
-
- ftest.x %fp0 # test sign of argument
- fblt.w red_neg
-
- or.b &0x80,FP_SCR0_EX(%a6) # positive arg
- or.b &0x80,FP_SCR1_EX(%a6)
-red_neg:
- fadd.x FP_SCR0(%a6),%fp0 # high part of reduction is exact
- fmov.x %fp0,%fp1 # save high result in fp1
- fadd.x FP_SCR1(%a6),%fp0 # low part of reduction
- fsub.x %fp0,%fp1 # determine low component of result
- fadd.x FP_SCR1(%a6),%fp1 # fp0/fp1 are reduced argument.
-
-#--ON ENTRY, FP0 IS X, ON RETURN, FP0 IS X REM PI/2, |X| <= PI/4.
-#--integer quotient will be stored in N
-#--Intermeditate remainder is 66-bit long; (R,r) in (FP0,FP1)
-LOOP:
- fmov.x %fp0,INARG(%a6) # +-2**K * F, 1 <= F < 2
- mov.w INARG(%a6),%d1
- mov.l %d1,%a1 # save a copy of D0
- and.l &0x00007FFF,%d1
- sub.l &0x00003FFF,%d1 # d0 = K
- cmp.l %d1,&28
- ble.b LASTLOOP
-CONTLOOP:
- sub.l &27,%d1 # d0 = L := K-27
- mov.b &0,ENDFLAG(%a6)
- bra.b WORK
-LASTLOOP:
- clr.l %d1 # d0 = L := 0
- mov.b &1,ENDFLAG(%a6)
-
-WORK:
-#--FIND THE REMAINDER OF (R,r) W.R.T. 2**L * (PI/2). L IS SO CHOSEN
-#--THAT INT( X * (2/PI) / 2**(L) ) < 2**29.
-
-#--CREATE 2**(-L) * (2/PI), SIGN(INARG)*2**(63),
-#--2**L * (PIby2_1), 2**L * (PIby2_2)
-
- mov.l &0x00003FFE,%d2 # BIASED EXP OF 2/PI
- sub.l %d1,%d2 # BIASED EXP OF 2**(-L)*(2/PI)
-
- mov.l &0xA2F9836E,FP_SCR0_HI(%a6)
- mov.l &0x4E44152A,FP_SCR0_LO(%a6)
- mov.w %d2,FP_SCR0_EX(%a6) # FP_SCR0 = 2**(-L)*(2/PI)
-
- fmov.x %fp0,%fp2
- fmul.x FP_SCR0(%a6),%fp2 # fp2 = X * 2**(-L)*(2/PI)
-
-#--WE MUST NOW FIND INT(FP2). SINCE WE NEED THIS VALUE IN
-#--FLOATING POINT FORMAT, THE TWO FMOVE'S FMOVE.L FP <--> N
-#--WILL BE TOO INEFFICIENT. THE WAY AROUND IT IS THAT
-#--(SIGN(INARG)*2**63 + FP2) - SIGN(INARG)*2**63 WILL GIVE
-#--US THE DESIRED VALUE IN FLOATING POINT.
- mov.l %a1,%d2
- swap %d2
- and.l &0x80000000,%d2
- or.l &0x5F000000,%d2 # d2 = SIGN(INARG)*2**63 IN SGL
- mov.l %d2,TWOTO63(%a6)
- fadd.s TWOTO63(%a6),%fp2 # THE FRACTIONAL PART OF FP1 IS ROUNDED
- fsub.s TWOTO63(%a6),%fp2 # fp2 = N
-# fintrz.x %fp2,%fp2
-
-#--CREATING 2**(L)*Piby2_1 and 2**(L)*Piby2_2
- mov.l %d1,%d2 # d2 = L
-
- add.l &0x00003FFF,%d2 # BIASED EXP OF 2**L * (PI/2)
- mov.w %d2,FP_SCR0_EX(%a6)
- mov.l &0xC90FDAA2,FP_SCR0_HI(%a6)
- clr.l FP_SCR0_LO(%a6) # FP_SCR0 = 2**(L) * Piby2_1
-
- add.l &0x00003FDD,%d1
- mov.w %d1,FP_SCR1_EX(%a6)
- mov.l &0x85A308D3,FP_SCR1_HI(%a6)
- clr.l FP_SCR1_LO(%a6) # FP_SCR1 = 2**(L) * Piby2_2
-
- mov.b ENDFLAG(%a6),%d1
-
-#--We are now ready to perform (R+r) - N*P1 - N*P2, P1 = 2**(L) * Piby2_1 and
-#--P2 = 2**(L) * Piby2_2
- fmov.x %fp2,%fp4 # fp4 = N
- fmul.x FP_SCR0(%a6),%fp4 # fp4 = W = N*P1
- fmov.x %fp2,%fp5 # fp5 = N
- fmul.x FP_SCR1(%a6),%fp5 # fp5 = w = N*P2
- fmov.x %fp4,%fp3 # fp3 = W = N*P1
-
-#--we want P+p = W+w but |p| <= half ulp of P
-#--Then, we need to compute A := R-P and a := r-p
- fadd.x %fp5,%fp3 # fp3 = P
- fsub.x %fp3,%fp4 # fp4 = W-P
-
- fsub.x %fp3,%fp0 # fp0 = A := R - P
- fadd.x %fp5,%fp4 # fp4 = p = (W-P)+w
-
- fmov.x %fp0,%fp3 # fp3 = A
- fsub.x %fp4,%fp1 # fp1 = a := r - p
-
-#--Now we need to normalize (A,a) to "new (R,r)" where R+r = A+a but
-#--|r| <= half ulp of R.
- fadd.x %fp1,%fp0 # fp0 = R := A+a
-#--No need to calculate r if this is the last loop
- cmp.b %d1,&0
- bgt.w RESTORE
-
-#--Need to calculate r
- fsub.x %fp0,%fp3 # fp3 = A-R
- fadd.x %fp3,%fp1 # fp1 = r := (A-R)+a
- bra.w LOOP
-
-RESTORE:
- fmov.l %fp2,INT(%a6)
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x (%sp)+,&0x3c # restore {fp2-fp5}
-
- mov.l INT(%a6),%d1
- ror.l &1,%d1
-
- bra.w TANCONT
-
-#########################################################################
-# satan(): computes the arctangent of a normalized number #
-# satand(): computes the arctangent of a denormalized number #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input #
-# d0 = round precision,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = arctan(X) #
-# #
-# ACCURACY and MONOTONICITY ******************************************* #
-# The returned result is within 2 ulps in 64 significant bit, #
-# i.e. within 0.5001 ulp to 53 bits if the result is subsequently #
-# rounded to double precision. The result is provably monotonic #
-# in double precision. #
-# #
-# ALGORITHM *********************************************************** #
-# Step 1. If |X| >= 16 or |X| < 1/16, go to Step 5. #
-# #
-# Step 2. Let X = sgn * 2**k * 1.xxxxxxxx...x. #
-# Note that k = -4, -3,..., or 3. #
-# Define F = sgn * 2**k * 1.xxxx1, i.e. the first 5 #
-# significant bits of X with a bit-1 attached at the 6-th #
-# bit position. Define u to be u = (X-F) / (1 + X*F). #
-# #
-# Step 3. Approximate arctan(u) by a polynomial poly. #
-# #
-# Step 4. Return arctan(F) + poly, arctan(F) is fetched from a #
-# table of values calculated beforehand. Exit. #
-# #
-# Step 5. If |X| >= 16, go to Step 7. #
-# #
-# Step 6. Approximate arctan(X) by an odd polynomial in X. Exit. #
-# #
-# Step 7. Define X' = -1/X. Approximate arctan(X') by an odd #
-# polynomial in X'. #
-# Arctan(X) = sign(X)*Pi/2 + arctan(X'). Exit. #
-# #
-#########################################################################
-
-ATANA3: long 0xBFF6687E,0x314987D8
-ATANA2: long 0x4002AC69,0x34A26DB3
-ATANA1: long 0xBFC2476F,0x4E1DA28E
-
-ATANB6: long 0x3FB34444,0x7F876989
-ATANB5: long 0xBFB744EE,0x7FAF45DB
-ATANB4: long 0x3FBC71C6,0x46940220
-ATANB3: long 0xBFC24924,0x921872F9
-ATANB2: long 0x3FC99999,0x99998FA9
-ATANB1: long 0xBFD55555,0x55555555
-
-ATANC5: long 0xBFB70BF3,0x98539E6A
-ATANC4: long 0x3FBC7187,0x962D1D7D
-ATANC3: long 0xBFC24924,0x827107B8
-ATANC2: long 0x3FC99999,0x9996263E
-ATANC1: long 0xBFD55555,0x55555536
-
-PPIBY2: long 0x3FFF0000,0xC90FDAA2,0x2168C235,0x00000000
-NPIBY2: long 0xBFFF0000,0xC90FDAA2,0x2168C235,0x00000000
-
-PTINY: long 0x00010000,0x80000000,0x00000000,0x00000000
-NTINY: long 0x80010000,0x80000000,0x00000000,0x00000000
-
-ATANTBL:
- long 0x3FFB0000,0x83D152C5,0x060B7A51,0x00000000
- long 0x3FFB0000,0x8BC85445,0x65498B8B,0x00000000
- long 0x3FFB0000,0x93BE4060,0x17626B0D,0x00000000
- long 0x3FFB0000,0x9BB3078D,0x35AEC202,0x00000000
- long 0x3FFB0000,0xA3A69A52,0x5DDCE7DE,0x00000000
- long 0x3FFB0000,0xAB98E943,0x62765619,0x00000000
- long 0x3FFB0000,0xB389E502,0xF9C59862,0x00000000
- long 0x3FFB0000,0xBB797E43,0x6B09E6FB,0x00000000
- long 0x3FFB0000,0xC367A5C7,0x39E5F446,0x00000000
- long 0x3FFB0000,0xCB544C61,0xCFF7D5C6,0x00000000
- long 0x3FFB0000,0xD33F62F8,0x2488533E,0x00000000
- long 0x3FFB0000,0xDB28DA81,0x62404C77,0x00000000
- long 0x3FFB0000,0xE310A407,0x8AD34F18,0x00000000
- long 0x3FFB0000,0xEAF6B0A8,0x188EE1EB,0x00000000
- long 0x3FFB0000,0xF2DAF194,0x9DBE79D5,0x00000000
- long 0x3FFB0000,0xFABD5813,0x61D47E3E,0x00000000
- long 0x3FFC0000,0x8346AC21,0x0959ECC4,0x00000000
- long 0x3FFC0000,0x8B232A08,0x304282D8,0x00000000
- long 0x3FFC0000,0x92FB70B8,0xD29AE2F9,0x00000000
- long 0x3FFC0000,0x9ACF476F,0x5CCD1CB4,0x00000000
- long 0x3FFC0000,0xA29E7630,0x4954F23F,0x00000000
- long 0x3FFC0000,0xAA68C5D0,0x8AB85230,0x00000000
- long 0x3FFC0000,0xB22DFFFD,0x9D539F83,0x00000000
- long 0x3FFC0000,0xB9EDEF45,0x3E900EA5,0x00000000
- long 0x3FFC0000,0xC1A85F1C,0xC75E3EA5,0x00000000
- long 0x3FFC0000,0xC95D1BE8,0x28138DE6,0x00000000
- long 0x3FFC0000,0xD10BF300,0x840D2DE4,0x00000000
- long 0x3FFC0000,0xD8B4B2BA,0x6BC05E7A,0x00000000
- long 0x3FFC0000,0xE0572A6B,0xB42335F6,0x00000000
- long 0x3FFC0000,0xE7F32A70,0xEA9CAA8F,0x00000000
- long 0x3FFC0000,0xEF888432,0x64ECEFAA,0x00000000
- long 0x3FFC0000,0xF7170A28,0xECC06666,0x00000000
- long 0x3FFD0000,0x812FD288,0x332DAD32,0x00000000
- long 0x3FFD0000,0x88A8D1B1,0x218E4D64,0x00000000
- long 0x3FFD0000,0x9012AB3F,0x23E4AEE8,0x00000000
- long 0x3FFD0000,0x976CC3D4,0x11E7F1B9,0x00000000
- long 0x3FFD0000,0x9EB68949,0x3889A227,0x00000000
- long 0x3FFD0000,0xA5EF72C3,0x4487361B,0x00000000
- long 0x3FFD0000,0xAD1700BA,0xF07A7227,0x00000000
- long 0x3FFD0000,0xB42CBCFA,0xFD37EFB7,0x00000000
- long 0x3FFD0000,0xBB303A94,0x0BA80F89,0x00000000
- long 0x3FFD0000,0xC22115C6,0xFCAEBBAF,0x00000000
- long 0x3FFD0000,0xC8FEF3E6,0x86331221,0x00000000
- long 0x3FFD0000,0xCFC98330,0xB4000C70,0x00000000
- long 0x3FFD0000,0xD6807AA1,0x102C5BF9,0x00000000
- long 0x3FFD0000,0xDD2399BC,0x31252AA3,0x00000000
- long 0x3FFD0000,0xE3B2A855,0x6B8FC517,0x00000000
- long 0x3FFD0000,0xEA2D764F,0x64315989,0x00000000
- long 0x3FFD0000,0xF3BF5BF8,0xBAD1A21D,0x00000000
- long 0x3FFE0000,0x801CE39E,0x0D205C9A,0x00000000
- long 0x3FFE0000,0x8630A2DA,0xDA1ED066,0x00000000
- long 0x3FFE0000,0x8C1AD445,0xF3E09B8C,0x00000000
- long 0x3FFE0000,0x91DB8F16,0x64F350E2,0x00000000
- long 0x3FFE0000,0x97731420,0x365E538C,0x00000000
- long 0x3FFE0000,0x9CE1C8E6,0xA0B8CDBA,0x00000000
- long 0x3FFE0000,0xA22832DB,0xCADAAE09,0x00000000
- long 0x3FFE0000,0xA746F2DD,0xB7602294,0x00000000
- long 0x3FFE0000,0xAC3EC0FB,0x997DD6A2,0x00000000
- long 0x3FFE0000,0xB110688A,0xEBDC6F6A,0x00000000
- long 0x3FFE0000,0xB5BCC490,0x59ECC4B0,0x00000000
- long 0x3FFE0000,0xBA44BC7D,0xD470782F,0x00000000
- long 0x3FFE0000,0xBEA94144,0xFD049AAC,0x00000000
- long 0x3FFE0000,0xC2EB4ABB,0x661628B6,0x00000000
- long 0x3FFE0000,0xC70BD54C,0xE602EE14,0x00000000
- long 0x3FFE0000,0xCD000549,0xADEC7159,0x00000000
- long 0x3FFE0000,0xD48457D2,0xD8EA4EA3,0x00000000
- long 0x3FFE0000,0xDB948DA7,0x12DECE3B,0x00000000
- long 0x3FFE0000,0xE23855F9,0x69E8096A,0x00000000
- long 0x3FFE0000,0xE8771129,0xC4353259,0x00000000
- long 0x3FFE0000,0xEE57C16E,0x0D379C0D,0x00000000
- long 0x3FFE0000,0xF3E10211,0xA87C3779,0x00000000
- long 0x3FFE0000,0xF919039D,0x758B8D41,0x00000000
- long 0x3FFE0000,0xFE058B8F,0x64935FB3,0x00000000
- long 0x3FFF0000,0x8155FB49,0x7B685D04,0x00000000
- long 0x3FFF0000,0x83889E35,0x49D108E1,0x00000000
- long 0x3FFF0000,0x859CFA76,0x511D724B,0x00000000
- long 0x3FFF0000,0x87952ECF,0xFF8131E7,0x00000000
- long 0x3FFF0000,0x89732FD1,0x9557641B,0x00000000
- long 0x3FFF0000,0x8B38CAD1,0x01932A35,0x00000000
- long 0x3FFF0000,0x8CE7A8D8,0x301EE6B5,0x00000000
- long 0x3FFF0000,0x8F46A39E,0x2EAE5281,0x00000000
- long 0x3FFF0000,0x922DA7D7,0x91888487,0x00000000
- long 0x3FFF0000,0x94D19FCB,0xDEDF5241,0x00000000
- long 0x3FFF0000,0x973AB944,0x19D2A08B,0x00000000
- long 0x3FFF0000,0x996FF00E,0x08E10B96,0x00000000
- long 0x3FFF0000,0x9B773F95,0x12321DA7,0x00000000
- long 0x3FFF0000,0x9D55CC32,0x0F935624,0x00000000
- long 0x3FFF0000,0x9F100575,0x006CC571,0x00000000
- long 0x3FFF0000,0xA0A9C290,0xD97CC06C,0x00000000
- long 0x3FFF0000,0xA22659EB,0xEBC0630A,0x00000000
- long 0x3FFF0000,0xA388B4AF,0xF6EF0EC9,0x00000000
- long 0x3FFF0000,0xA4D35F10,0x61D292C4,0x00000000
- long 0x3FFF0000,0xA60895DC,0xFBE3187E,0x00000000
- long 0x3FFF0000,0xA72A51DC,0x7367BEAC,0x00000000
- long 0x3FFF0000,0xA83A5153,0x0956168F,0x00000000
- long 0x3FFF0000,0xA93A2007,0x7539546E,0x00000000
- long 0x3FFF0000,0xAA9E7245,0x023B2605,0x00000000
- long 0x3FFF0000,0xAC4C84BA,0x6FE4D58F,0x00000000
- long 0x3FFF0000,0xADCE4A4A,0x606B9712,0x00000000
- long 0x3FFF0000,0xAF2A2DCD,0x8D263C9C,0x00000000
- long 0x3FFF0000,0xB0656F81,0xF22265C7,0x00000000
- long 0x3FFF0000,0xB1846515,0x0F71496A,0x00000000
- long 0x3FFF0000,0xB28AAA15,0x6F9ADA35,0x00000000
- long 0x3FFF0000,0xB37B44FF,0x3766B895,0x00000000
- long 0x3FFF0000,0xB458C3DC,0xE9630433,0x00000000
- long 0x3FFF0000,0xB525529D,0x562246BD,0x00000000
- long 0x3FFF0000,0xB5E2CCA9,0x5F9D88CC,0x00000000
- long 0x3FFF0000,0xB692CADA,0x7ACA1ADA,0x00000000
- long 0x3FFF0000,0xB736AEA7,0xA6925838,0x00000000
- long 0x3FFF0000,0xB7CFAB28,0x7E9F7B36,0x00000000
- long 0x3FFF0000,0xB85ECC66,0xCB219835,0x00000000
- long 0x3FFF0000,0xB8E4FD5A,0x20A593DA,0x00000000
- long 0x3FFF0000,0xB99F41F6,0x4AFF9BB5,0x00000000
- long 0x3FFF0000,0xBA7F1E17,0x842BBE7B,0x00000000
- long 0x3FFF0000,0xBB471285,0x7637E17D,0x00000000
- long 0x3FFF0000,0xBBFABE8A,0x4788DF6F,0x00000000
- long 0x3FFF0000,0xBC9D0FAD,0x2B689D79,0x00000000
- long 0x3FFF0000,0xBD306A39,0x471ECD86,0x00000000
- long 0x3FFF0000,0xBDB6C731,0x856AF18A,0x00000000
- long 0x3FFF0000,0xBE31CAC5,0x02E80D70,0x00000000
- long 0x3FFF0000,0xBEA2D55C,0xE33194E2,0x00000000
- long 0x3FFF0000,0xBF0B10B7,0xC03128F0,0x00000000
- long 0x3FFF0000,0xBF6B7A18,0xDACB778D,0x00000000
- long 0x3FFF0000,0xBFC4EA46,0x63FA18F6,0x00000000
- long 0x3FFF0000,0xC0181BDE,0x8B89A454,0x00000000
- long 0x3FFF0000,0xC065B066,0xCFBF6439,0x00000000
- long 0x3FFF0000,0xC0AE345F,0x56340AE6,0x00000000
- long 0x3FFF0000,0xC0F22291,0x9CB9E6A7,0x00000000
-
- set X,FP_SCR0
- set XDCARE,X+2
- set XFRAC,X+4
- set XFRACLO,X+8
-
- set ATANF,FP_SCR1
- set ATANFHI,ATANF+4
- set ATANFLO,ATANF+8
-
- global satan
-#--ENTRY POINT FOR ATAN(X), HERE X IS FINITE, NON-ZERO, AND NOT NAN'S
-satan:
- fmov.x (%a0),%fp0 # LOAD INPUT
-
- mov.l (%a0),%d1
- mov.w 4(%a0),%d1
- fmov.x %fp0,X(%a6)
- and.l &0x7FFFFFFF,%d1
-
- cmp.l %d1,&0x3FFB8000 # |X| >= 1/16?
- bge.b ATANOK1
- bra.w ATANSM
-
-ATANOK1:
- cmp.l %d1,&0x4002FFFF # |X| < 16 ?
- ble.b ATANMAIN
- bra.w ATANBIG
-
-#--THE MOST LIKELY CASE, |X| IN [1/16, 16). WE USE TABLE TECHNIQUE
-#--THE IDEA IS ATAN(X) = ATAN(F) + ATAN( [X-F] / [1+XF] ).
-#--SO IF F IS CHOSEN TO BE CLOSE TO X AND ATAN(F) IS STORED IN
-#--A TABLE, ALL WE NEED IS TO APPROXIMATE ATAN(U) WHERE
-#--U = (X-F)/(1+XF) IS SMALL (REMEMBER F IS CLOSE TO X). IT IS
-#--TRUE THAT A DIVIDE IS NOW NEEDED, BUT THE APPROXIMATION FOR
-#--ATAN(U) IS A VERY SHORT POLYNOMIAL AND THE INDEXING TO
-#--FETCH F AND SAVING OF REGISTERS CAN BE ALL HIDED UNDER THE
-#--DIVIDE. IN THE END THIS METHOD IS MUCH FASTER THAN A TRADITIONAL
-#--ONE. NOTE ALSO THAT THE TRADITIONAL SCHEME THAT APPROXIMATE
-#--ATAN(X) DIRECTLY WILL NEED TO USE A RATIONAL APPROXIMATION
-#--(DIVISION NEEDED) ANYWAY BECAUSE A POLYNOMIAL APPROXIMATION
-#--WILL INVOLVE A VERY LONG POLYNOMIAL.
-
-#--NOW WE SEE X AS +-2^K * 1.BBBBBBB....B <- 1. + 63 BITS
-#--WE CHOSE F TO BE +-2^K * 1.BBBB1
-#--THAT IS IT MATCHES THE EXPONENT AND FIRST 5 BITS OF X, THE
-#--SIXTH BITS IS SET TO BE 1. SINCE K = -4, -3, ..., 3, THERE
-#--ARE ONLY 8 TIMES 16 = 2^7 = 128 |F|'S. SINCE ATAN(-|F|) IS
-#-- -ATAN(|F|), WE NEED TO STORE ONLY ATAN(|F|).
-
-ATANMAIN:
-
- and.l &0xF8000000,XFRAC(%a6) # FIRST 5 BITS
- or.l &0x04000000,XFRAC(%a6) # SET 6-TH BIT TO 1
- mov.l &0x00000000,XFRACLO(%a6) # LOCATION OF X IS NOW F
-
- fmov.x %fp0,%fp1 # FP1 IS X
- fmul.x X(%a6),%fp1 # FP1 IS X*F, NOTE THAT X*F > 0
- fsub.x X(%a6),%fp0 # FP0 IS X-F
- fadd.s &0x3F800000,%fp1 # FP1 IS 1 + X*F
- fdiv.x %fp1,%fp0 # FP0 IS U = (X-F)/(1+X*F)
-
-#--WHILE THE DIVISION IS TAKING ITS TIME, WE FETCH ATAN(|F|)
-#--CREATE ATAN(F) AND STORE IT IN ATANF, AND
-#--SAVE REGISTERS FP2.
-
- mov.l %d2,-(%sp) # SAVE d2 TEMPORARILY
- mov.l %d1,%d2 # THE EXP AND 16 BITS OF X
- and.l &0x00007800,%d1 # 4 VARYING BITS OF F'S FRACTION
- and.l &0x7FFF0000,%d2 # EXPONENT OF F
- sub.l &0x3FFB0000,%d2 # K+4
- asr.l &1,%d2
- add.l %d2,%d1 # THE 7 BITS IDENTIFYING F
- asr.l &7,%d1 # INDEX INTO TBL OF ATAN(|F|)
- lea ATANTBL(%pc),%a1
- add.l %d1,%a1 # ADDRESS OF ATAN(|F|)
- mov.l (%a1)+,ATANF(%a6)
- mov.l (%a1)+,ATANFHI(%a6)
- mov.l (%a1)+,ATANFLO(%a6) # ATANF IS NOW ATAN(|F|)
- mov.l X(%a6),%d1 # LOAD SIGN AND EXPO. AGAIN
- and.l &0x80000000,%d1 # SIGN(F)
- or.l %d1,ATANF(%a6) # ATANF IS NOW SIGN(F)*ATAN(|F|)
- mov.l (%sp)+,%d2 # RESTORE d2
-
-#--THAT'S ALL I HAVE TO DO FOR NOW,
-#--BUT ALAS, THE DIVIDE IS STILL CRANKING!
-
-#--U IN FP0, WE ARE NOW READY TO COMPUTE ATAN(U) AS
-#--U + A1*U*V*(A2 + V*(A3 + V)), V = U*U
-#--THE POLYNOMIAL MAY LOOK STRANGE, BUT IS NEVERTHELESS CORRECT.
-#--THE NATURAL FORM IS U + U*V*(A1 + V*(A2 + V*A3))
-#--WHAT WE HAVE HERE IS MERELY A1 = A3, A2 = A1/A3, A3 = A2/A3.
-#--THE REASON FOR THIS REARRANGEMENT IS TO MAKE THE INDEPENDENT
-#--PARTS A1*U*V AND (A2 + ... STUFF) MORE LOAD-BALANCED
-
- fmovm.x &0x04,-(%sp) # save fp2
-
- fmov.x %fp0,%fp1
- fmul.x %fp1,%fp1
- fmov.d ATANA3(%pc),%fp2
- fadd.x %fp1,%fp2 # A3+V
- fmul.x %fp1,%fp2 # V*(A3+V)
- fmul.x %fp0,%fp1 # U*V
- fadd.d ATANA2(%pc),%fp2 # A2+V*(A3+V)
- fmul.d ATANA1(%pc),%fp1 # A1*U*V
- fmul.x %fp2,%fp1 # A1*U*V*(A2+V*(A3+V))
- fadd.x %fp1,%fp0 # ATAN(U), FP1 RELEASED
-
- fmovm.x (%sp)+,&0x20 # restore fp2
-
- fmov.l %d0,%fpcr # restore users rnd mode,prec
- fadd.x ATANF(%a6),%fp0 # ATAN(X)
- bra t_inx2
-
-ATANBORS:
-#--|X| IS IN d0 IN COMPACT FORM. FP1, d0 SAVED.
-#--FP0 IS X AND |X| <= 1/16 OR |X| >= 16.
- cmp.l %d1,&0x3FFF8000
- bgt.w ATANBIG # I.E. |X| >= 16
-
-ATANSM:
-#--|X| <= 1/16
-#--IF |X| < 2^(-40), RETURN X AS ANSWER. OTHERWISE, APPROXIMATE
-#--ATAN(X) BY X + X*Y*(B1+Y*(B2+Y*(B3+Y*(B4+Y*(B5+Y*B6)))))
-#--WHICH IS X + X*Y*( [B1+Z*(B3+Z*B5)] + [Y*(B2+Z*(B4+Z*B6)] )
-#--WHERE Y = X*X, AND Z = Y*Y.
-
- cmp.l %d1,&0x3FD78000
- blt.w ATANTINY
-
-#--COMPUTE POLYNOMIAL
- fmovm.x &0x0c,-(%sp) # save fp2/fp3
-
- fmul.x %fp0,%fp0 # FPO IS Y = X*X
-
- fmov.x %fp0,%fp1
- fmul.x %fp1,%fp1 # FP1 IS Z = Y*Y
-
- fmov.d ATANB6(%pc),%fp2
- fmov.d ATANB5(%pc),%fp3
-
- fmul.x %fp1,%fp2 # Z*B6
- fmul.x %fp1,%fp3 # Z*B5
-
- fadd.d ATANB4(%pc),%fp2 # B4+Z*B6
- fadd.d ATANB3(%pc),%fp3 # B3+Z*B5
-
- fmul.x %fp1,%fp2 # Z*(B4+Z*B6)
- fmul.x %fp3,%fp1 # Z*(B3+Z*B5)
-
- fadd.d ATANB2(%pc),%fp2 # B2+Z*(B4+Z*B6)
- fadd.d ATANB1(%pc),%fp1 # B1+Z*(B3+Z*B5)
-
- fmul.x %fp0,%fp2 # Y*(B2+Z*(B4+Z*B6))
- fmul.x X(%a6),%fp0 # X*Y
-
- fadd.x %fp2,%fp1 # [B1+Z*(B3+Z*B5)]+[Y*(B2+Z*(B4+Z*B6))]
-
- fmul.x %fp1,%fp0 # X*Y*([B1+Z*(B3+Z*B5)]+[Y*(B2+Z*(B4+Z*B6))])
-
- fmovm.x (%sp)+,&0x30 # restore fp2/fp3
-
- fmov.l %d0,%fpcr # restore users rnd mode,prec
- fadd.x X(%a6),%fp0
- bra t_inx2
-
-ATANTINY:
-#--|X| < 2^(-40), ATAN(X) = X
-
- fmov.l %d0,%fpcr # restore users rnd mode,prec
- mov.b &FMOV_OP,%d1 # last inst is MOVE
- fmov.x X(%a6),%fp0 # last inst - possible exception set
-
- bra t_catch
-
-ATANBIG:
-#--IF |X| > 2^(100), RETURN SIGN(X)*(PI/2 - TINY). OTHERWISE,
-#--RETURN SIGN(X)*PI/2 + ATAN(-1/X).
- cmp.l %d1,&0x40638000
- bgt.w ATANHUGE
-
-#--APPROXIMATE ATAN(-1/X) BY
-#--X'+X'*Y*(C1+Y*(C2+Y*(C3+Y*(C4+Y*C5)))), X' = -1/X, Y = X'*X'
-#--THIS CAN BE RE-WRITTEN AS
-#--X'+X'*Y*( [C1+Z*(C3+Z*C5)] + [Y*(C2+Z*C4)] ), Z = Y*Y.
-
- fmovm.x &0x0c,-(%sp) # save fp2/fp3
-
- fmov.s &0xBF800000,%fp1 # LOAD -1
- fdiv.x %fp0,%fp1 # FP1 IS -1/X
-
-#--DIVIDE IS STILL CRANKING
-
- fmov.x %fp1,%fp0 # FP0 IS X'
- fmul.x %fp0,%fp0 # FP0 IS Y = X'*X'
- fmov.x %fp1,X(%a6) # X IS REALLY X'
-
- fmov.x %fp0,%fp1
- fmul.x %fp1,%fp1 # FP1 IS Z = Y*Y
-
- fmov.d ATANC5(%pc),%fp3
- fmov.d ATANC4(%pc),%fp2
-
- fmul.x %fp1,%fp3 # Z*C5
- fmul.x %fp1,%fp2 # Z*B4
-
- fadd.d ATANC3(%pc),%fp3 # C3+Z*C5
- fadd.d ATANC2(%pc),%fp2 # C2+Z*C4
-
- fmul.x %fp3,%fp1 # Z*(C3+Z*C5), FP3 RELEASED
- fmul.x %fp0,%fp2 # Y*(C2+Z*C4)
-
- fadd.d ATANC1(%pc),%fp1 # C1+Z*(C3+Z*C5)
- fmul.x X(%a6),%fp0 # X'*Y
-
- fadd.x %fp2,%fp1 # [Y*(C2+Z*C4)]+[C1+Z*(C3+Z*C5)]
-
- fmul.x %fp1,%fp0 # X'*Y*([B1+Z*(B3+Z*B5)]
-# ... +[Y*(B2+Z*(B4+Z*B6))])
- fadd.x X(%a6),%fp0
-
- fmovm.x (%sp)+,&0x30 # restore fp2/fp3
-
- fmov.l %d0,%fpcr # restore users rnd mode,prec
- tst.b (%a0)
- bpl.b pos_big
-
-neg_big:
- fadd.x NPIBY2(%pc),%fp0
- bra t_minx2
-
-pos_big:
- fadd.x PPIBY2(%pc),%fp0
- bra t_pinx2
-
-ATANHUGE:
-#--RETURN SIGN(X)*(PIBY2 - TINY) = SIGN(X)*PIBY2 - SIGN(X)*TINY
- tst.b (%a0)
- bpl.b pos_huge
-
-neg_huge:
- fmov.x NPIBY2(%pc),%fp0
- fmov.l %d0,%fpcr
- fadd.x PTINY(%pc),%fp0
- bra t_minx2
-
-pos_huge:
- fmov.x PPIBY2(%pc),%fp0
- fmov.l %d0,%fpcr
- fadd.x NTINY(%pc),%fp0
- bra t_pinx2
-
- global satand
-#--ENTRY POINT FOR ATAN(X) FOR DENORMALIZED ARGUMENT
-satand:
- bra t_extdnrm
-
-#########################################################################
-# sasin(): computes the inverse sine of a normalized input #
-# sasind(): computes the inverse sine of a denormalized input #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input #
-# d0 = round precision,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = arcsin(X) #
-# #
-# ACCURACY and MONOTONICITY ******************************************* #
-# The returned result is within 3 ulps in 64 significant bit, #
-# i.e. within 0.5001 ulp to 53 bits if the result is subsequently #
-# rounded to double precision. The result is provably monotonic #
-# in double precision. #
-# #
-# ALGORITHM *********************************************************** #
-# #
-# ASIN #
-# 1. If |X| >= 1, go to 3. #
-# #
-# 2. (|X| < 1) Calculate asin(X) by #
-# z := sqrt( [1-X][1+X] ) #
-# asin(X) = atan( x / z ). #
-# Exit. #
-# #
-# 3. If |X| > 1, go to 5. #
-# #
-# 4. (|X| = 1) sgn := sign(X), return asin(X) := sgn * Pi/2. Exit.#
-# #
-# 5. (|X| > 1) Generate an invalid operation by 0 * infinity. #
-# Exit. #
-# #
-#########################################################################
-
- global sasin
-sasin:
- fmov.x (%a0),%fp0 # LOAD INPUT
-
- mov.l (%a0),%d1
- mov.w 4(%a0),%d1
- and.l &0x7FFFFFFF,%d1
- cmp.l %d1,&0x3FFF8000
- bge.b ASINBIG
-
-# This catch is added here for the '060 QSP. Originally, the call to
-# satan() would handle this case by causing the exception which would
-# not be caught until gen_except(). Now, with the exceptions being
-# detected inside of satan(), the exception would have been handled there
-# instead of inside sasin() as expected.
- cmp.l %d1,&0x3FD78000
- blt.w ASINTINY
-
-#--THIS IS THE USUAL CASE, |X| < 1
-#--ASIN(X) = ATAN( X / SQRT( (1-X)(1+X) ) )
-
-ASINMAIN:
- fmov.s &0x3F800000,%fp1
- fsub.x %fp0,%fp1 # 1-X
- fmovm.x &0x4,-(%sp) # {fp2}
- fmov.s &0x3F800000,%fp2
- fadd.x %fp0,%fp2 # 1+X
- fmul.x %fp2,%fp1 # (1+X)(1-X)
- fmovm.x (%sp)+,&0x20 # {fp2}
- fsqrt.x %fp1 # SQRT([1-X][1+X])
- fdiv.x %fp1,%fp0 # X/SQRT([1-X][1+X])
- fmovm.x &0x01,-(%sp) # save X/SQRT(...)
- lea (%sp),%a0 # pass ptr to X/SQRT(...)
- bsr satan
- add.l &0xc,%sp # clear X/SQRT(...) from stack
- bra t_inx2
-
-ASINBIG:
- fabs.x %fp0 # |X|
- fcmp.s %fp0,&0x3F800000
- fbgt t_operr # cause an operr exception
-
-#--|X| = 1, ASIN(X) = +- PI/2.
-ASINONE:
- fmov.x PIBY2(%pc),%fp0
- mov.l (%a0),%d1
- and.l &0x80000000,%d1 # SIGN BIT OF X
- or.l &0x3F800000,%d1 # +-1 IN SGL FORMAT
- mov.l %d1,-(%sp) # push SIGN(X) IN SGL-FMT
- fmov.l %d0,%fpcr
- fmul.s (%sp)+,%fp0
- bra t_inx2
-
-#--|X| < 2^(-40), ATAN(X) = X
-ASINTINY:
- fmov.l %d0,%fpcr # restore users rnd mode,prec
- mov.b &FMOV_OP,%d1 # last inst is MOVE
- fmov.x (%a0),%fp0 # last inst - possible exception
- bra t_catch
-
- global sasind
-#--ASIN(X) = X FOR DENORMALIZED X
-sasind:
- bra t_extdnrm
-
-#########################################################################
-# sacos(): computes the inverse cosine of a normalized input #
-# sacosd(): computes the inverse cosine of a denormalized input #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input #
-# d0 = round precision,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = arccos(X) #
-# #
-# ACCURACY and MONOTONICITY ******************************************* #
-# The returned result is within 3 ulps in 64 significant bit, #
-# i.e. within 0.5001 ulp to 53 bits if the result is subsequently #
-# rounded to double precision. The result is provably monotonic #
-# in double precision. #
-# #
-# ALGORITHM *********************************************************** #
-# #
-# ACOS #
-# 1. If |X| >= 1, go to 3. #
-# #
-# 2. (|X| < 1) Calculate acos(X) by #
-# z := (1-X) / (1+X) #
-# acos(X) = 2 * atan( sqrt(z) ). #
-# Exit. #
-# #
-# 3. If |X| > 1, go to 5. #
-# #
-# 4. (|X| = 1) If X > 0, return 0. Otherwise, return Pi. Exit. #
-# #
-# 5. (|X| > 1) Generate an invalid operation by 0 * infinity. #
-# Exit. #
-# #
-#########################################################################
-
- global sacos
-sacos:
- fmov.x (%a0),%fp0 # LOAD INPUT
-
- mov.l (%a0),%d1 # pack exp w/ upper 16 fraction
- mov.w 4(%a0),%d1
- and.l &0x7FFFFFFF,%d1
- cmp.l %d1,&0x3FFF8000
- bge.b ACOSBIG
-
-#--THIS IS THE USUAL CASE, |X| < 1
-#--ACOS(X) = 2 * ATAN( SQRT( (1-X)/(1+X) ) )
-
-ACOSMAIN:
- fmov.s &0x3F800000,%fp1
- fadd.x %fp0,%fp1 # 1+X
- fneg.x %fp0 # -X
- fadd.s &0x3F800000,%fp0 # 1-X
- fdiv.x %fp1,%fp0 # (1-X)/(1+X)
- fsqrt.x %fp0 # SQRT((1-X)/(1+X))
- mov.l %d0,-(%sp) # save original users fpcr
- clr.l %d0
- fmovm.x &0x01,-(%sp) # save SQRT(...) to stack
- lea (%sp),%a0 # pass ptr to sqrt
- bsr satan # ATAN(SQRT([1-X]/[1+X]))
- add.l &0xc,%sp # clear SQRT(...) from stack
-
- fmov.l (%sp)+,%fpcr # restore users round prec,mode
- fadd.x %fp0,%fp0 # 2 * ATAN( STUFF )
- bra t_pinx2
-
-ACOSBIG:
- fabs.x %fp0
- fcmp.s %fp0,&0x3F800000
- fbgt t_operr # cause an operr exception
-
-#--|X| = 1, ACOS(X) = 0 OR PI
- tst.b (%a0) # is X positive or negative?
- bpl.b ACOSP1
-
-#--X = -1
-#Returns PI and inexact exception
-ACOSM1:
- fmov.x PI(%pc),%fp0 # load PI
- fmov.l %d0,%fpcr # load round mode,prec
- fadd.s &0x00800000,%fp0 # add a small value
- bra t_pinx2
-
-ACOSP1:
- bra ld_pzero # answer is positive zero
-
- global sacosd
-#--ACOS(X) = PI/2 FOR DENORMALIZED X
-sacosd:
- fmov.l %d0,%fpcr # load user's rnd mode/prec
- fmov.x PIBY2(%pc),%fp0
- bra t_pinx2
-
-#########################################################################
-# setox(): computes the exponential for a normalized input #
-# setoxd(): computes the exponential for a denormalized input #
-# setoxm1(): computes the exponential minus 1 for a normalized input #
-# setoxm1d(): computes the exponential minus 1 for a denormalized input #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input #
-# d0 = round precision,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = exp(X) or exp(X)-1 #
-# #
-# ACCURACY and MONOTONICITY ******************************************* #
-# The returned result is within 0.85 ulps in 64 significant bit, #
-# i.e. within 0.5001 ulp to 53 bits if the result is subsequently #
-# rounded to double precision. The result is provably monotonic #
-# in double precision. #
-# #
-# ALGORITHM and IMPLEMENTATION **************************************** #
-# #
-# setoxd #
-# ------ #
-# Step 1. Set ans := 1.0 #
-# #
-# Step 2. Return ans := ans + sign(X)*2^(-126). Exit. #
-# Notes: This will always generate one exception -- inexact. #
-# #
-# #
-# setox #
-# ----- #
-# #
-# Step 1. Filter out extreme cases of input argument. #
-# 1.1 If |X| >= 2^(-65), go to Step 1.3. #
-# 1.2 Go to Step 7. #
-# 1.3 If |X| < 16380 log(2), go to Step 2. #
-# 1.4 Go to Step 8. #
-# Notes: The usual case should take the branches 1.1 -> 1.3 -> 2.#
-# To avoid the use of floating-point comparisons, a #
-# compact representation of |X| is used. This format is a #
-# 32-bit integer, the upper (more significant) 16 bits #
-# are the sign and biased exponent field of |X|; the #
-# lower 16 bits are the 16 most significant fraction #
-# (including the explicit bit) bits of |X|. Consequently, #
-# the comparisons in Steps 1.1 and 1.3 can be performed #
-# by integer comparison. Note also that the constant #
-# 16380 log(2) used in Step 1.3 is also in the compact #
-# form. Thus taking the branch to Step 2 guarantees #
-# |X| < 16380 log(2). There is no harm to have a small #
-# number of cases where |X| is less than, but close to, #
-# 16380 log(2) and the branch to Step 9 is taken. #
-# #
-# Step 2. Calculate N = round-to-nearest-int( X * 64/log2 ). #
-# 2.1 Set AdjFlag := 0 (indicates the branch 1.3 -> 2 #
-# was taken) #
-# 2.2 N := round-to-nearest-integer( X * 64/log2 ). #
-# 2.3 Calculate J = N mod 64; so J = 0,1,2,..., #
-# or 63. #
-# 2.4 Calculate M = (N - J)/64; so N = 64M + J. #
-# 2.5 Calculate the address of the stored value of #
-# 2^(J/64). #
-# 2.6 Create the value Scale = 2^M. #
-# Notes: The calculation in 2.2 is really performed by #
-# Z := X * constant #
-# N := round-to-nearest-integer(Z) #
-# where #
-# constant := single-precision( 64/log 2 ). #
-# #
-# Using a single-precision constant avoids memory #
-# access. Another effect of using a single-precision #
-# "constant" is that the calculated value Z is #
-# #
-# Z = X*(64/log2)*(1+eps), |eps| <= 2^(-24). #
-# #
-# This error has to be considered later in Steps 3 and 4. #
-# #
-# Step 3. Calculate X - N*log2/64. #
-# 3.1 R := X + N*L1, #
-# where L1 := single-precision(-log2/64). #
-# 3.2 R := R + N*L2, #
-# L2 := extended-precision(-log2/64 - L1).#
-# Notes: a) The way L1 and L2 are chosen ensures L1+L2 #
-# approximate the value -log2/64 to 88 bits of accuracy. #
-# b) N*L1 is exact because N is no longer than 22 bits #
-# and L1 is no longer than 24 bits. #
-# c) The calculation X+N*L1 is also exact due to #
-# cancellation. Thus, R is practically X+N(L1+L2) to full #
-# 64 bits. #
-# d) It is important to estimate how large can |R| be #
-# after Step 3.2. #
-# #
-# N = rnd-to-int( X*64/log2 (1+eps) ), |eps|<=2^(-24) #
-# X*64/log2 (1+eps) = N + f, |f| <= 0.5 #
-# X*64/log2 - N = f - eps*X 64/log2 #
-# X - N*log2/64 = f*log2/64 - eps*X #
-# #
-# #
-# Now |X| <= 16446 log2, thus #
-# #
-# |X - N*log2/64| <= (0.5 + 16446/2^(18))*log2/64 #
-# <= 0.57 log2/64. #
-# This bound will be used in Step 4. #
-# #
-# Step 4. Approximate exp(R)-1 by a polynomial #
-# p = R + R*R*(A1 + R*(A2 + R*(A3 + R*(A4 + R*A5)))) #
-# Notes: a) In order to reduce memory access, the coefficients #
-# are made as "short" as possible: A1 (which is 1/2), A4 #
-# and A5 are single precision; A2 and A3 are double #
-# precision. #
-# b) Even with the restrictions above, #
-# |p - (exp(R)-1)| < 2^(-68.8) for all |R| <= 0.0062. #
-# Note that 0.0062 is slightly bigger than 0.57 log2/64. #
-# c) To fully utilize the pipeline, p is separated into #
-# two independent pieces of roughly equal complexities #
-# p = [ R + R*S*(A2 + S*A4) ] + #
-# [ S*(A1 + S*(A3 + S*A5)) ] #
-# where S = R*R. #
-# #
-# Step 5. Compute 2^(J/64)*exp(R) = 2^(J/64)*(1+p) by #
-# ans := T + ( T*p + t) #
-# where T and t are the stored values for 2^(J/64). #
-# Notes: 2^(J/64) is stored as T and t where T+t approximates #
-# 2^(J/64) to roughly 85 bits; T is in extended precision #
-# and t is in single precision. Note also that T is #
-# rounded to 62 bits so that the last two bits of T are #
-# zero. The reason for such a special form is that T-1, #
-# T-2, and T-8 will all be exact --- a property that will #
-# give much more accurate computation of the function #
-# EXPM1. #
-# #
-# Step 6. Reconstruction of exp(X) #
-# exp(X) = 2^M * 2^(J/64) * exp(R). #
-# 6.1 If AdjFlag = 0, go to 6.3 #
-# 6.2 ans := ans * AdjScale #
-# 6.3 Restore the user FPCR #
-# 6.4 Return ans := ans * Scale. Exit. #
-# Notes: If AdjFlag = 0, we have X = Mlog2 + Jlog2/64 + R, #
-# |M| <= 16380, and Scale = 2^M. Moreover, exp(X) will #
-# neither overflow nor underflow. If AdjFlag = 1, that #
-# means that #
-# X = (M1+M)log2 + Jlog2/64 + R, |M1+M| >= 16380. #
-# Hence, exp(X) may overflow or underflow or neither. #
-# When that is the case, AdjScale = 2^(M1) where M1 is #
-# approximately M. Thus 6.2 will never cause #
-# over/underflow. Possible exception in 6.4 is overflow #
-# or underflow. The inexact exception is not generated in #
-# 6.4. Although one can argue that the inexact flag #
-# should always be raised, to simulate that exception #
-# cost to much than the flag is worth in practical uses. #
-# #
-# Step 7. Return 1 + X. #
-# 7.1 ans := X #
-# 7.2 Restore user FPCR. #
-# 7.3 Return ans := 1 + ans. Exit #
-# Notes: For non-zero X, the inexact exception will always be #
-# raised by 7.3. That is the only exception raised by 7.3.#
-# Note also that we use the FMOVEM instruction to move X #
-# in Step 7.1 to avoid unnecessary trapping. (Although #
-# the FMOVEM may not seem relevant since X is normalized, #
-# the precaution will be useful in the library version of #
-# this code where the separate entry for denormalized #
-# inputs will be done away with.) #
-# #
-# Step 8. Handle exp(X) where |X| >= 16380log2. #
-# 8.1 If |X| > 16480 log2, go to Step 9. #
-# (mimic 2.2 - 2.6) #
-# 8.2 N := round-to-integer( X * 64/log2 ) #
-# 8.3 Calculate J = N mod 64, J = 0,1,...,63 #
-# 8.4 K := (N-J)/64, M1 := truncate(K/2), M = K-M1, #
-# AdjFlag := 1. #
-# 8.5 Calculate the address of the stored value #
-# 2^(J/64). #
-# 8.6 Create the values Scale = 2^M, AdjScale = 2^M1. #
-# 8.7 Go to Step 3. #
-# Notes: Refer to notes for 2.2 - 2.6. #
-# #
-# Step 9. Handle exp(X), |X| > 16480 log2. #
-# 9.1 If X < 0, go to 9.3 #
-# 9.2 ans := Huge, go to 9.4 #
-# 9.3 ans := Tiny. #
-# 9.4 Restore user FPCR. #
-# 9.5 Return ans := ans * ans. Exit. #
-# Notes: Exp(X) will surely overflow or underflow, depending on #
-# X's sign. "Huge" and "Tiny" are respectively large/tiny #
-# extended-precision numbers whose square over/underflow #
-# with an inexact result. Thus, 9.5 always raises the #
-# inexact together with either overflow or underflow. #
-# #
-# setoxm1d #
-# -------- #
-# #
-# Step 1. Set ans := 0 #
-# #
-# Step 2. Return ans := X + ans. Exit. #
-# Notes: This will return X with the appropriate rounding #
-# precision prescribed by the user FPCR. #
-# #
-# setoxm1 #
-# ------- #
-# #
-# Step 1. Check |X| #
-# 1.1 If |X| >= 1/4, go to Step 1.3. #
-# 1.2 Go to Step 7. #
-# 1.3 If |X| < 70 log(2), go to Step 2. #
-# 1.4 Go to Step 10. #
-# Notes: The usual case should take the branches 1.1 -> 1.3 -> 2.#
-# However, it is conceivable |X| can be small very often #
-# because EXPM1 is intended to evaluate exp(X)-1 #
-# accurately when |X| is small. For further details on #
-# the comparisons, see the notes on Step 1 of setox. #
-# #
-# Step 2. Calculate N = round-to-nearest-int( X * 64/log2 ). #
-# 2.1 N := round-to-nearest-integer( X * 64/log2 ). #
-# 2.2 Calculate J = N mod 64; so J = 0,1,2,..., #
-# or 63. #
-# 2.3 Calculate M = (N - J)/64; so N = 64M + J. #
-# 2.4 Calculate the address of the stored value of #
-# 2^(J/64). #
-# 2.5 Create the values Sc = 2^M and #
-# OnebySc := -2^(-M). #
-# Notes: See the notes on Step 2 of setox. #
-# #
-# Step 3. Calculate X - N*log2/64. #
-# 3.1 R := X + N*L1, #
-# where L1 := single-precision(-log2/64). #
-# 3.2 R := R + N*L2, #
-# L2 := extended-precision(-log2/64 - L1).#
-# Notes: Applying the analysis of Step 3 of setox in this case #
-# shows that |R| <= 0.0055 (note that |X| <= 70 log2 in #
-# this case). #
-# #
-# Step 4. Approximate exp(R)-1 by a polynomial #
-# p = R+R*R*(A1+R*(A2+R*(A3+R*(A4+R*(A5+R*A6))))) #
-# Notes: a) In order to reduce memory access, the coefficients #
-# are made as "short" as possible: A1 (which is 1/2), A5 #
-# and A6 are single precision; A2, A3 and A4 are double #
-# precision. #
-# b) Even with the restriction above, #
-# |p - (exp(R)-1)| < |R| * 2^(-72.7) #
-# for all |R| <= 0.0055. #
-# c) To fully utilize the pipeline, p is separated into #
-# two independent pieces of roughly equal complexity #
-# p = [ R*S*(A2 + S*(A4 + S*A6)) ] + #
-# [ R + S*(A1 + S*(A3 + S*A5)) ] #
-# where S = R*R. #
-# #
-# Step 5. Compute 2^(J/64)*p by #
-# p := T*p #
-# where T and t are the stored values for 2^(J/64). #
-# Notes: 2^(J/64) is stored as T and t where T+t approximates #
-# 2^(J/64) to roughly 85 bits; T is in extended precision #
-# and t is in single precision. Note also that T is #
-# rounded to 62 bits so that the last two bits of T are #
-# zero. The reason for such a special form is that T-1, #
-# T-2, and T-8 will all be exact --- a property that will #
-# be exploited in Step 6 below. The total relative error #
-# in p is no bigger than 2^(-67.7) compared to the final #
-# result. #
-# #
-# Step 6. Reconstruction of exp(X)-1 #
-# exp(X)-1 = 2^M * ( 2^(J/64) + p - 2^(-M) ). #
-# 6.1 If M <= 63, go to Step 6.3. #
-# 6.2 ans := T + (p + (t + OnebySc)). Go to 6.6 #
-# 6.3 If M >= -3, go to 6.5. #
-# 6.4 ans := (T + (p + t)) + OnebySc. Go to 6.6 #
-# 6.5 ans := (T + OnebySc) + (p + t). #
-# 6.6 Restore user FPCR. #
-# 6.7 Return ans := Sc * ans. Exit. #
-# Notes: The various arrangements of the expressions give #
-# accurate evaluations. #
-# #
-# Step 7. exp(X)-1 for |X| < 1/4. #
-# 7.1 If |X| >= 2^(-65), go to Step 9. #
-# 7.2 Go to Step 8. #
-# #
-# Step 8. Calculate exp(X)-1, |X| < 2^(-65). #
-# 8.1 If |X| < 2^(-16312), goto 8.3 #
-# 8.2 Restore FPCR; return ans := X - 2^(-16382). #
-# Exit. #
-# 8.3 X := X * 2^(140). #
-# 8.4 Restore FPCR; ans := ans - 2^(-16382). #
-# Return ans := ans*2^(140). Exit #
-# Notes: The idea is to return "X - tiny" under the user #
-# precision and rounding modes. To avoid unnecessary #
-# inefficiency, we stay away from denormalized numbers #
-# the best we can. For |X| >= 2^(-16312), the #
-# straightforward 8.2 generates the inexact exception as #
-# the case warrants. #
-# #
-# Step 9. Calculate exp(X)-1, |X| < 1/4, by a polynomial #
-# p = X + X*X*(B1 + X*(B2 + ... + X*B12)) #
-# Notes: a) In order to reduce memory access, the coefficients #
-# are made as "short" as possible: B1 (which is 1/2), B9 #
-# to B12 are single precision; B3 to B8 are double #
-# precision; and B2 is double extended. #
-# b) Even with the restriction above, #
-# |p - (exp(X)-1)| < |X| 2^(-70.6) #
-# for all |X| <= 0.251. #
-# Note that 0.251 is slightly bigger than 1/4. #
-# c) To fully preserve accuracy, the polynomial is #
-# computed as #
-# X + ( S*B1 + Q ) where S = X*X and #
-# Q = X*S*(B2 + X*(B3 + ... + X*B12)) #
-# d) To fully utilize the pipeline, Q is separated into #
-# two independent pieces of roughly equal complexity #
-# Q = [ X*S*(B2 + S*(B4 + ... + S*B12)) ] + #
-# [ S*S*(B3 + S*(B5 + ... + S*B11)) ] #
-# #
-# Step 10. Calculate exp(X)-1 for |X| >= 70 log 2. #
-# 10.1 If X >= 70log2 , exp(X) - 1 = exp(X) for all #
-# practical purposes. Therefore, go to Step 1 of setox. #
-# 10.2 If X <= -70log2, exp(X) - 1 = -1 for all practical #
-# purposes. #
-# ans := -1 #
-# Restore user FPCR #
-# Return ans := ans + 2^(-126). Exit. #
-# Notes: 10.2 will always create an inexact and return -1 + tiny #
-# in the user rounding precision and mode. #
-# #
-#########################################################################
-
-L2: long 0x3FDC0000,0x82E30865,0x4361C4C6,0x00000000
-
-EEXPA3: long 0x3FA55555,0x55554CC1
-EEXPA2: long 0x3FC55555,0x55554A54
-
-EM1A4: long 0x3F811111,0x11174385
-EM1A3: long 0x3FA55555,0x55554F5A
-
-EM1A2: long 0x3FC55555,0x55555555,0x00000000,0x00000000
-
-EM1B8: long 0x3EC71DE3,0xA5774682
-EM1B7: long 0x3EFA01A0,0x19D7CB68
-
-EM1B6: long 0x3F2A01A0,0x1A019DF3
-EM1B5: long 0x3F56C16C,0x16C170E2
-
-EM1B4: long 0x3F811111,0x11111111
-EM1B3: long 0x3FA55555,0x55555555
-
-EM1B2: long 0x3FFC0000,0xAAAAAAAA,0xAAAAAAAB
- long 0x00000000
-
-TWO140: long 0x48B00000,0x00000000
-TWON140:
- long 0x37300000,0x00000000
-
-EEXPTBL:
- long 0x3FFF0000,0x80000000,0x00000000,0x00000000
- long 0x3FFF0000,0x8164D1F3,0xBC030774,0x9F841A9B
- long 0x3FFF0000,0x82CD8698,0xAC2BA1D8,0x9FC1D5B9
- long 0x3FFF0000,0x843A28C3,0xACDE4048,0xA0728369
- long 0x3FFF0000,0x85AAC367,0xCC487B14,0x1FC5C95C
- long 0x3FFF0000,0x871F6196,0x9E8D1010,0x1EE85C9F
- long 0x3FFF0000,0x88980E80,0x92DA8528,0x9FA20729
- long 0x3FFF0000,0x8A14D575,0x496EFD9C,0xA07BF9AF
- long 0x3FFF0000,0x8B95C1E3,0xEA8BD6E8,0xA0020DCF
- long 0x3FFF0000,0x8D1ADF5B,0x7E5BA9E4,0x205A63DA
- long 0x3FFF0000,0x8EA4398B,0x45CD53C0,0x1EB70051
- long 0x3FFF0000,0x9031DC43,0x1466B1DC,0x1F6EB029
- long 0x3FFF0000,0x91C3D373,0xAB11C338,0xA0781494
- long 0x3FFF0000,0x935A2B2F,0x13E6E92C,0x9EB319B0
- long 0x3FFF0000,0x94F4EFA8,0xFEF70960,0x2017457D
- long 0x3FFF0000,0x96942D37,0x20185A00,0x1F11D537
- long 0x3FFF0000,0x9837F051,0x8DB8A970,0x9FB952DD
- long 0x3FFF0000,0x99E04593,0x20B7FA64,0x1FE43087
- long 0x3FFF0000,0x9B8D39B9,0xD54E5538,0x1FA2A818
- long 0x3FFF0000,0x9D3ED9A7,0x2CFFB750,0x1FDE494D
- long 0x3FFF0000,0x9EF53260,0x91A111AC,0x20504890
- long 0x3FFF0000,0xA0B0510F,0xB9714FC4,0xA073691C
- long 0x3FFF0000,0xA2704303,0x0C496818,0x1F9B7A05
- long 0x3FFF0000,0xA43515AE,0x09E680A0,0xA0797126
- long 0x3FFF0000,0xA5FED6A9,0xB15138EC,0xA071A140
- long 0x3FFF0000,0xA7CD93B4,0xE9653568,0x204F62DA
- long 0x3FFF0000,0xA9A15AB4,0xEA7C0EF8,0x1F283C4A
- long 0x3FFF0000,0xAB7A39B5,0xA93ED338,0x9F9A7FDC
- long 0x3FFF0000,0xAD583EEA,0x42A14AC8,0xA05B3FAC
- long 0x3FFF0000,0xAF3B78AD,0x690A4374,0x1FDF2610
- long 0x3FFF0000,0xB123F581,0xD2AC2590,0x9F705F90
- long 0x3FFF0000,0xB311C412,0xA9112488,0x201F678A
- long 0x3FFF0000,0xB504F333,0xF9DE6484,0x1F32FB13
- long 0x3FFF0000,0xB6FD91E3,0x28D17790,0x20038B30
- long 0x3FFF0000,0xB8FBAF47,0x62FB9EE8,0x200DC3CC
- long 0x3FFF0000,0xBAFF5AB2,0x133E45FC,0x9F8B2AE6
- long 0x3FFF0000,0xBD08A39F,0x580C36C0,0xA02BBF70
- long 0x3FFF0000,0xBF1799B6,0x7A731084,0xA00BF518
- long 0x3FFF0000,0xC12C4CCA,0x66709458,0xA041DD41
- long 0x3FFF0000,0xC346CCDA,0x24976408,0x9FDF137B
- long 0x3FFF0000,0xC5672A11,0x5506DADC,0x201F1568
- long 0x3FFF0000,0xC78D74C8,0xABB9B15C,0x1FC13A2E
- long 0x3FFF0000,0xC9B9BD86,0x6E2F27A4,0xA03F8F03
- long 0x3FFF0000,0xCBEC14FE,0xF2727C5C,0x1FF4907D
- long 0x3FFF0000,0xCE248C15,0x1F8480E4,0x9E6E53E4
- long 0x3FFF0000,0xD06333DA,0xEF2B2594,0x1FD6D45C
- long 0x3FFF0000,0xD2A81D91,0xF12AE45C,0xA076EDB9
- long 0x3FFF0000,0xD4F35AAB,0xCFEDFA20,0x9FA6DE21
- long 0x3FFF0000,0xD744FCCA,0xD69D6AF4,0x1EE69A2F
- long 0x3FFF0000,0xD99D15C2,0x78AFD7B4,0x207F439F
- long 0x3FFF0000,0xDBFBB797,0xDAF23754,0x201EC207
- long 0x3FFF0000,0xDE60F482,0x5E0E9124,0x9E8BE175
- long 0x3FFF0000,0xE0CCDEEC,0x2A94E110,0x20032C4B
- long 0x3FFF0000,0xE33F8972,0xBE8A5A50,0x2004DFF5
- long 0x3FFF0000,0xE5B906E7,0x7C8348A8,0x1E72F47A
- long 0x3FFF0000,0xE8396A50,0x3C4BDC68,0x1F722F22
- long 0x3FFF0000,0xEAC0C6E7,0xDD243930,0xA017E945
- long 0x3FFF0000,0xED4F301E,0xD9942B84,0x1F401A5B
- long 0x3FFF0000,0xEFE4B99B,0xDCDAF5CC,0x9FB9A9E3
- long 0x3FFF0000,0xF281773C,0x59FFB138,0x20744C05
- long 0x3FFF0000,0xF5257D15,0x2486CC2C,0x1F773A19
- long 0x3FFF0000,0xF7D0DF73,0x0AD13BB8,0x1FFE90D5
- long 0x3FFF0000,0xFA83B2DB,0x722A033C,0xA041ED22
- long 0x3FFF0000,0xFD3E0C0C,0xF486C174,0x1F853F3A
-
- set ADJFLAG,L_SCR2
- set SCALE,FP_SCR0
- set ADJSCALE,FP_SCR1
- set SC,FP_SCR0
- set ONEBYSC,FP_SCR1
-
- global setox
-setox:
-#--entry point for EXP(X), here X is finite, non-zero, and not NaN's
-
-#--Step 1.
- mov.l (%a0),%d1 # load part of input X
- and.l &0x7FFF0000,%d1 # biased expo. of X
- cmp.l %d1,&0x3FBE0000 # 2^(-65)
- bge.b EXPC1 # normal case
- bra EXPSM
-
-EXPC1:
-#--The case |X| >= 2^(-65)
- mov.w 4(%a0),%d1 # expo. and partial sig. of |X|
- cmp.l %d1,&0x400CB167 # 16380 log2 trunc. 16 bits
- blt.b EXPMAIN # normal case
- bra EEXPBIG
-
-EXPMAIN:
-#--Step 2.
-#--This is the normal branch: 2^(-65) <= |X| < 16380 log2.
- fmov.x (%a0),%fp0 # load input from (a0)
-
- fmov.x %fp0,%fp1
- fmul.s &0x42B8AA3B,%fp0 # 64/log2 * X
- fmovm.x &0xc,-(%sp) # save fp2 {%fp2/%fp3}
- mov.l &0,ADJFLAG(%a6)
- fmov.l %fp0,%d1 # N = int( X * 64/log2 )
- lea EEXPTBL(%pc),%a1
- fmov.l %d1,%fp0 # convert to floating-format
-
- mov.l %d1,L_SCR1(%a6) # save N temporarily
- and.l &0x3F,%d1 # D0 is J = N mod 64
- lsl.l &4,%d1
- add.l %d1,%a1 # address of 2^(J/64)
- mov.l L_SCR1(%a6),%d1
- asr.l &6,%d1 # D0 is M
- add.w &0x3FFF,%d1 # biased expo. of 2^(M)
- mov.w L2(%pc),L_SCR1(%a6) # prefetch L2, no need in CB
-
-EXPCONT1:
-#--Step 3.
-#--fp1,fp2 saved on the stack. fp0 is N, fp1 is X,
-#--a0 points to 2^(J/64), D0 is biased expo. of 2^(M)
- fmov.x %fp0,%fp2
- fmul.s &0xBC317218,%fp0 # N * L1, L1 = lead(-log2/64)
- fmul.x L2(%pc),%fp2 # N * L2, L1+L2 = -log2/64
- fadd.x %fp1,%fp0 # X + N*L1
- fadd.x %fp2,%fp0 # fp0 is R, reduced arg.
-
-#--Step 4.
-#--WE NOW COMPUTE EXP(R)-1 BY A POLYNOMIAL
-#-- R + R*R*(A1 + R*(A2 + R*(A3 + R*(A4 + R*A5))))
-#--TO FULLY UTILIZE THE PIPELINE, WE COMPUTE S = R*R
-#--[R+R*S*(A2+S*A4)] + [S*(A1+S*(A3+S*A5))]
-
- fmov.x %fp0,%fp1
- fmul.x %fp1,%fp1 # fp1 IS S = R*R
-
- fmov.s &0x3AB60B70,%fp2 # fp2 IS A5
-
- fmul.x %fp1,%fp2 # fp2 IS S*A5
- fmov.x %fp1,%fp3
- fmul.s &0x3C088895,%fp3 # fp3 IS S*A4
-
- fadd.d EEXPA3(%pc),%fp2 # fp2 IS A3+S*A5
- fadd.d EEXPA2(%pc),%fp3 # fp3 IS A2+S*A4
-
- fmul.x %fp1,%fp2 # fp2 IS S*(A3+S*A5)
- mov.w %d1,SCALE(%a6) # SCALE is 2^(M) in extended
- mov.l &0x80000000,SCALE+4(%a6)
- clr.l SCALE+8(%a6)
-
- fmul.x %fp1,%fp3 # fp3 IS S*(A2+S*A4)
-
- fadd.s &0x3F000000,%fp2 # fp2 IS A1+S*(A3+S*A5)
- fmul.x %fp0,%fp3 # fp3 IS R*S*(A2+S*A4)
-
- fmul.x %fp1,%fp2 # fp2 IS S*(A1+S*(A3+S*A5))
- fadd.x %fp3,%fp0 # fp0 IS R+R*S*(A2+S*A4),
-
- fmov.x (%a1)+,%fp1 # fp1 is lead. pt. of 2^(J/64)
- fadd.x %fp2,%fp0 # fp0 is EXP(R) - 1
-
-#--Step 5
-#--final reconstruction process
-#--EXP(X) = 2^M * ( 2^(J/64) + 2^(J/64)*(EXP(R)-1) )
-
- fmul.x %fp1,%fp0 # 2^(J/64)*(Exp(R)-1)
- fmovm.x (%sp)+,&0x30 # fp2 restored {%fp2/%fp3}
- fadd.s (%a1),%fp0 # accurate 2^(J/64)
-
- fadd.x %fp1,%fp0 # 2^(J/64) + 2^(J/64)*...
- mov.l ADJFLAG(%a6),%d1
-
-#--Step 6
- tst.l %d1
- beq.b NORMAL
-ADJUST:
- fmul.x ADJSCALE(%a6),%fp0
-NORMAL:
- fmov.l %d0,%fpcr # restore user FPCR
- mov.b &FMUL_OP,%d1 # last inst is MUL
- fmul.x SCALE(%a6),%fp0 # multiply 2^(M)
- bra t_catch
-
-EXPSM:
-#--Step 7
- fmovm.x (%a0),&0x80 # load X
- fmov.l %d0,%fpcr
- fadd.s &0x3F800000,%fp0 # 1+X in user mode
- bra t_pinx2
-
-EEXPBIG:
-#--Step 8
- cmp.l %d1,&0x400CB27C # 16480 log2
- bgt.b EXP2BIG
-#--Steps 8.2 -- 8.6
- fmov.x (%a0),%fp0 # load input from (a0)
-
- fmov.x %fp0,%fp1
- fmul.s &0x42B8AA3B,%fp0 # 64/log2 * X
- fmovm.x &0xc,-(%sp) # save fp2 {%fp2/%fp3}
- mov.l &1,ADJFLAG(%a6)
- fmov.l %fp0,%d1 # N = int( X * 64/log2 )
- lea EEXPTBL(%pc),%a1
- fmov.l %d1,%fp0 # convert to floating-format
- mov.l %d1,L_SCR1(%a6) # save N temporarily
- and.l &0x3F,%d1 # D0 is J = N mod 64
- lsl.l &4,%d1
- add.l %d1,%a1 # address of 2^(J/64)
- mov.l L_SCR1(%a6),%d1
- asr.l &6,%d1 # D0 is K
- mov.l %d1,L_SCR1(%a6) # save K temporarily
- asr.l &1,%d1 # D0 is M1
- sub.l %d1,L_SCR1(%a6) # a1 is M
- add.w &0x3FFF,%d1 # biased expo. of 2^(M1)
- mov.w %d1,ADJSCALE(%a6) # ADJSCALE := 2^(M1)
- mov.l &0x80000000,ADJSCALE+4(%a6)
- clr.l ADJSCALE+8(%a6)
- mov.l L_SCR1(%a6),%d1 # D0 is M
- add.w &0x3FFF,%d1 # biased expo. of 2^(M)
- bra.w EXPCONT1 # go back to Step 3
-
-EXP2BIG:
-#--Step 9
- tst.b (%a0) # is X positive or negative?
- bmi t_unfl2
- bra t_ovfl2
-
- global setoxd
-setoxd:
-#--entry point for EXP(X), X is denormalized
- mov.l (%a0),-(%sp)
- andi.l &0x80000000,(%sp)
- ori.l &0x00800000,(%sp) # sign(X)*2^(-126)
-
- fmov.s &0x3F800000,%fp0
-
- fmov.l %d0,%fpcr
- fadd.s (%sp)+,%fp0
- bra t_pinx2
-
- global setoxm1
-setoxm1:
-#--entry point for EXPM1(X), here X is finite, non-zero, non-NaN
-
-#--Step 1.
-#--Step 1.1
- mov.l (%a0),%d1 # load part of input X
- and.l &0x7FFF0000,%d1 # biased expo. of X
- cmp.l %d1,&0x3FFD0000 # 1/4
- bge.b EM1CON1 # |X| >= 1/4
- bra EM1SM
-
-EM1CON1:
-#--Step 1.3
-#--The case |X| >= 1/4
- mov.w 4(%a0),%d1 # expo. and partial sig. of |X|
- cmp.l %d1,&0x4004C215 # 70log2 rounded up to 16 bits
- ble.b EM1MAIN # 1/4 <= |X| <= 70log2
- bra EM1BIG
-
-EM1MAIN:
-#--Step 2.
-#--This is the case: 1/4 <= |X| <= 70 log2.
- fmov.x (%a0),%fp0 # load input from (a0)
-
- fmov.x %fp0,%fp1
- fmul.s &0x42B8AA3B,%fp0 # 64/log2 * X
- fmovm.x &0xc,-(%sp) # save fp2 {%fp2/%fp3}
- fmov.l %fp0,%d1 # N = int( X * 64/log2 )
- lea EEXPTBL(%pc),%a1
- fmov.l %d1,%fp0 # convert to floating-format
-
- mov.l %d1,L_SCR1(%a6) # save N temporarily
- and.l &0x3F,%d1 # D0 is J = N mod 64
- lsl.l &4,%d1
- add.l %d1,%a1 # address of 2^(J/64)
- mov.l L_SCR1(%a6),%d1
- asr.l &6,%d1 # D0 is M
- mov.l %d1,L_SCR1(%a6) # save a copy of M
-
-#--Step 3.
-#--fp1,fp2 saved on the stack. fp0 is N, fp1 is X,
-#--a0 points to 2^(J/64), D0 and a1 both contain M
- fmov.x %fp0,%fp2
- fmul.s &0xBC317218,%fp0 # N * L1, L1 = lead(-log2/64)
- fmul.x L2(%pc),%fp2 # N * L2, L1+L2 = -log2/64
- fadd.x %fp1,%fp0 # X + N*L1
- fadd.x %fp2,%fp0 # fp0 is R, reduced arg.
- add.w &0x3FFF,%d1 # D0 is biased expo. of 2^M
-
-#--Step 4.
-#--WE NOW COMPUTE EXP(R)-1 BY A POLYNOMIAL
-#-- R + R*R*(A1 + R*(A2 + R*(A3 + R*(A4 + R*(A5 + R*A6)))))
-#--TO FULLY UTILIZE THE PIPELINE, WE COMPUTE S = R*R
-#--[R*S*(A2+S*(A4+S*A6))] + [R+S*(A1+S*(A3+S*A5))]
-
- fmov.x %fp0,%fp1
- fmul.x %fp1,%fp1 # fp1 IS S = R*R
-
- fmov.s &0x3950097B,%fp2 # fp2 IS a6
-
- fmul.x %fp1,%fp2 # fp2 IS S*A6
- fmov.x %fp1,%fp3
- fmul.s &0x3AB60B6A,%fp3 # fp3 IS S*A5
-
- fadd.d EM1A4(%pc),%fp2 # fp2 IS A4+S*A6
- fadd.d EM1A3(%pc),%fp3 # fp3 IS A3+S*A5
- mov.w %d1,SC(%a6) # SC is 2^(M) in extended
- mov.l &0x80000000,SC+4(%a6)
- clr.l SC+8(%a6)
-
- fmul.x %fp1,%fp2 # fp2 IS S*(A4+S*A6)
- mov.l L_SCR1(%a6),%d1 # D0 is M
- neg.w %d1 # D0 is -M
- fmul.x %fp1,%fp3 # fp3 IS S*(A3+S*A5)
- add.w &0x3FFF,%d1 # biased expo. of 2^(-M)
- fadd.d EM1A2(%pc),%fp2 # fp2 IS A2+S*(A4+S*A6)
- fadd.s &0x3F000000,%fp3 # fp3 IS A1+S*(A3+S*A5)
-
- fmul.x %fp1,%fp2 # fp2 IS S*(A2+S*(A4+S*A6))
- or.w &0x8000,%d1 # signed/expo. of -2^(-M)
- mov.w %d1,ONEBYSC(%a6) # OnebySc is -2^(-M)
- mov.l &0x80000000,ONEBYSC+4(%a6)
- clr.l ONEBYSC+8(%a6)
- fmul.x %fp3,%fp1 # fp1 IS S*(A1+S*(A3+S*A5))
-
- fmul.x %fp0,%fp2 # fp2 IS R*S*(A2+S*(A4+S*A6))
- fadd.x %fp1,%fp0 # fp0 IS R+S*(A1+S*(A3+S*A5))
-
- fadd.x %fp2,%fp0 # fp0 IS EXP(R)-1
-
- fmovm.x (%sp)+,&0x30 # fp2 restored {%fp2/%fp3}
-
-#--Step 5
-#--Compute 2^(J/64)*p
-
- fmul.x (%a1),%fp0 # 2^(J/64)*(Exp(R)-1)
-
-#--Step 6
-#--Step 6.1
- mov.l L_SCR1(%a6),%d1 # retrieve M
- cmp.l %d1,&63
- ble.b MLE63
-#--Step 6.2 M >= 64
- fmov.s 12(%a1),%fp1 # fp1 is t
- fadd.x ONEBYSC(%a6),%fp1 # fp1 is t+OnebySc
- fadd.x %fp1,%fp0 # p+(t+OnebySc), fp1 released
- fadd.x (%a1),%fp0 # T+(p+(t+OnebySc))
- bra EM1SCALE
-MLE63:
-#--Step 6.3 M <= 63
- cmp.l %d1,&-3
- bge.b MGEN3
-MLTN3:
-#--Step 6.4 M <= -4
- fadd.s 12(%a1),%fp0 # p+t
- fadd.x (%a1),%fp0 # T+(p+t)
- fadd.x ONEBYSC(%a6),%fp0 # OnebySc + (T+(p+t))
- bra EM1SCALE
-MGEN3:
-#--Step 6.5 -3 <= M <= 63
- fmov.x (%a1)+,%fp1 # fp1 is T
- fadd.s (%a1),%fp0 # fp0 is p+t
- fadd.x ONEBYSC(%a6),%fp1 # fp1 is T+OnebySc
- fadd.x %fp1,%fp0 # (T+OnebySc)+(p+t)
-
-EM1SCALE:
-#--Step 6.6
- fmov.l %d0,%fpcr
- fmul.x SC(%a6),%fp0
- bra t_inx2
-
-EM1SM:
-#--Step 7 |X| < 1/4.
- cmp.l %d1,&0x3FBE0000 # 2^(-65)
- bge.b EM1POLY
-
-EM1TINY:
-#--Step 8 |X| < 2^(-65)
- cmp.l %d1,&0x00330000 # 2^(-16312)
- blt.b EM12TINY
-#--Step 8.2
- mov.l &0x80010000,SC(%a6) # SC is -2^(-16382)
- mov.l &0x80000000,SC+4(%a6)
- clr.l SC+8(%a6)
- fmov.x (%a0),%fp0
- fmov.l %d0,%fpcr
- mov.b &FADD_OP,%d1 # last inst is ADD
- fadd.x SC(%a6),%fp0
- bra t_catch
-
-EM12TINY:
-#--Step 8.3
- fmov.x (%a0),%fp0
- fmul.d TWO140(%pc),%fp0
- mov.l &0x80010000,SC(%a6)
- mov.l &0x80000000,SC+4(%a6)
- clr.l SC+8(%a6)
- fadd.x SC(%a6),%fp0
- fmov.l %d0,%fpcr
- mov.b &FMUL_OP,%d1 # last inst is MUL
- fmul.d TWON140(%pc),%fp0
- bra t_catch
-
-EM1POLY:
-#--Step 9 exp(X)-1 by a simple polynomial
- fmov.x (%a0),%fp0 # fp0 is X
- fmul.x %fp0,%fp0 # fp0 is S := X*X
- fmovm.x &0xc,-(%sp) # save fp2 {%fp2/%fp3}
- fmov.s &0x2F30CAA8,%fp1 # fp1 is B12
- fmul.x %fp0,%fp1 # fp1 is S*B12
- fmov.s &0x310F8290,%fp2 # fp2 is B11
- fadd.s &0x32D73220,%fp1 # fp1 is B10+S*B12
-
- fmul.x %fp0,%fp2 # fp2 is S*B11
- fmul.x %fp0,%fp1 # fp1 is S*(B10 + ...
-
- fadd.s &0x3493F281,%fp2 # fp2 is B9+S*...
- fadd.d EM1B8(%pc),%fp1 # fp1 is B8+S*...
-
- fmul.x %fp0,%fp2 # fp2 is S*(B9+...
- fmul.x %fp0,%fp1 # fp1 is S*(B8+...
-
- fadd.d EM1B7(%pc),%fp2 # fp2 is B7+S*...
- fadd.d EM1B6(%pc),%fp1 # fp1 is B6+S*...
-
- fmul.x %fp0,%fp2 # fp2 is S*(B7+...
- fmul.x %fp0,%fp1 # fp1 is S*(B6+...
-
- fadd.d EM1B5(%pc),%fp2 # fp2 is B5+S*...
- fadd.d EM1B4(%pc),%fp1 # fp1 is B4+S*...
-
- fmul.x %fp0,%fp2 # fp2 is S*(B5+...
- fmul.x %fp0,%fp1 # fp1 is S*(B4+...
-
- fadd.d EM1B3(%pc),%fp2 # fp2 is B3+S*...
- fadd.x EM1B2(%pc),%fp1 # fp1 is B2+S*...
-
- fmul.x %fp0,%fp2 # fp2 is S*(B3+...
- fmul.x %fp0,%fp1 # fp1 is S*(B2+...
-
- fmul.x %fp0,%fp2 # fp2 is S*S*(B3+...)
- fmul.x (%a0),%fp1 # fp1 is X*S*(B2...
-
- fmul.s &0x3F000000,%fp0 # fp0 is S*B1
- fadd.x %fp2,%fp1 # fp1 is Q
-
- fmovm.x (%sp)+,&0x30 # fp2 restored {%fp2/%fp3}
-
- fadd.x %fp1,%fp0 # fp0 is S*B1+Q
-
- fmov.l %d0,%fpcr
- fadd.x (%a0),%fp0
- bra t_inx2
-
-EM1BIG:
-#--Step 10 |X| > 70 log2
- mov.l (%a0),%d1
- cmp.l %d1,&0
- bgt.w EXPC1
-#--Step 10.2
- fmov.s &0xBF800000,%fp0 # fp0 is -1
- fmov.l %d0,%fpcr
- fadd.s &0x00800000,%fp0 # -1 + 2^(-126)
- bra t_minx2
-
- global setoxm1d
-setoxm1d:
-#--entry point for EXPM1(X), here X is denormalized
-#--Step 0.
- bra t_extdnrm
-
-#########################################################################
-# sgetexp(): returns the exponent portion of the input argument. #
-# The exponent bias is removed and the exponent value is #
-# returned as an extended precision number in fp0. #
-# sgetexpd(): handles denormalized numbers. #
-# #
-# sgetman(): extracts the mantissa of the input argument. The #
-# mantissa is converted to an extended precision number w/ #
-# an exponent of $3fff and is returned in fp0. The range of #
-# the result is [1.0 - 2.0). #
-# sgetmand(): handles denormalized numbers. #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = exponent(X) or mantissa(X) #
-# #
-#########################################################################
-
- global sgetexp
-sgetexp:
- mov.w SRC_EX(%a0),%d0 # get the exponent
- bclr &0xf,%d0 # clear the sign bit
- subi.w &0x3fff,%d0 # subtract off the bias
- fmov.w %d0,%fp0 # return exp in fp0
- blt.b sgetexpn # it's negative
- rts
-
-sgetexpn:
- mov.b &neg_bmask,FPSR_CC(%a6) # set 'N' ccode bit
- rts
-
- global sgetexpd
-sgetexpd:
- bsr.l norm # normalize
- neg.w %d0 # new exp = -(shft amt)
- subi.w &0x3fff,%d0 # subtract off the bias
- fmov.w %d0,%fp0 # return exp in fp0
- mov.b &neg_bmask,FPSR_CC(%a6) # set 'N' ccode bit
- rts
-
- global sgetman
-sgetman:
- mov.w SRC_EX(%a0),%d0 # get the exp
- ori.w &0x7fff,%d0 # clear old exp
- bclr &0xe,%d0 # make it the new exp +-3fff
-
-# here, we build the result in a tmp location so as not to disturb the input
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6) # copy to tmp loc
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6) # copy to tmp loc
- mov.w %d0,FP_SCR0_EX(%a6) # insert new exponent
- fmov.x FP_SCR0(%a6),%fp0 # put new value back in fp0
- bmi.b sgetmann # it's negative
- rts
-
-sgetmann:
- mov.b &neg_bmask,FPSR_CC(%a6) # set 'N' ccode bit
- rts
-
-#
-# For denormalized numbers, shift the mantissa until the j-bit = 1,
-# then load the exponent with +/1 $3fff.
-#
- global sgetmand
-sgetmand:
- bsr.l norm # normalize exponent
- bra.b sgetman
-
-#########################################################################
-# scosh(): computes the hyperbolic cosine of a normalized input #
-# scoshd(): computes the hyperbolic cosine of a denormalized input #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input #
-# d0 = round precision,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = cosh(X) #
-# #
-# ACCURACY and MONOTONICITY ******************************************* #
-# The returned result is within 3 ulps in 64 significant bit, #
-# i.e. within 0.5001 ulp to 53 bits if the result is subsequently #
-# rounded to double precision. The result is provably monotonic #
-# in double precision. #
-# #
-# ALGORITHM *********************************************************** #
-# #
-# COSH #
-# 1. If |X| > 16380 log2, go to 3. #
-# #
-# 2. (|X| <= 16380 log2) Cosh(X) is obtained by the formulae #
-# y = |X|, z = exp(Y), and #
-# cosh(X) = (1/2)*( z + 1/z ). #
-# Exit. #
-# #
-# 3. (|X| > 16380 log2). If |X| > 16480 log2, go to 5. #
-# #
-# 4. (16380 log2 < |X| <= 16480 log2) #
-# cosh(X) = sign(X) * exp(|X|)/2. #
-# However, invoking exp(|X|) may cause premature #
-# overflow. Thus, we calculate sinh(X) as follows: #
-# Y := |X| #
-# Fact := 2**(16380) #
-# Y' := Y - 16381 log2 #
-# cosh(X) := Fact * exp(Y'). #
-# Exit. #
-# #
-# 5. (|X| > 16480 log2) sinh(X) must overflow. Return #
-# Huge*Huge to generate overflow and an infinity with #
-# the appropriate sign. Huge is the largest finite number #
-# in extended format. Exit. #
-# #
-#########################################################################
-
-TWO16380:
- long 0x7FFB0000,0x80000000,0x00000000,0x00000000
-
- global scosh
-scosh:
- fmov.x (%a0),%fp0 # LOAD INPUT
-
- mov.l (%a0),%d1
- mov.w 4(%a0),%d1
- and.l &0x7FFFFFFF,%d1
- cmp.l %d1,&0x400CB167
- bgt.b COSHBIG
-
-#--THIS IS THE USUAL CASE, |X| < 16380 LOG2
-#--COSH(X) = (1/2) * ( EXP(X) + 1/EXP(X) )
-
- fabs.x %fp0 # |X|
-
- mov.l %d0,-(%sp)
- clr.l %d0
- fmovm.x &0x01,-(%sp) # save |X| to stack
- lea (%sp),%a0 # pass ptr to |X|
- bsr setox # FP0 IS EXP(|X|)
- add.l &0xc,%sp # erase |X| from stack
- fmul.s &0x3F000000,%fp0 # (1/2)EXP(|X|)
- mov.l (%sp)+,%d0
-
- fmov.s &0x3E800000,%fp1 # (1/4)
- fdiv.x %fp0,%fp1 # 1/(2 EXP(|X|))
-
- fmov.l %d0,%fpcr
- mov.b &FADD_OP,%d1 # last inst is ADD
- fadd.x %fp1,%fp0
- bra t_catch
-
-COSHBIG:
- cmp.l %d1,&0x400CB2B3
- bgt.b COSHHUGE
-
- fabs.x %fp0
- fsub.d T1(%pc),%fp0 # (|X|-16381LOG2_LEAD)
- fsub.d T2(%pc),%fp0 # |X| - 16381 LOG2, ACCURATE
-
- mov.l %d0,-(%sp)
- clr.l %d0
- fmovm.x &0x01,-(%sp) # save fp0 to stack
- lea (%sp),%a0 # pass ptr to fp0
- bsr setox
- add.l &0xc,%sp # clear fp0 from stack
- mov.l (%sp)+,%d0
-
- fmov.l %d0,%fpcr
- mov.b &FMUL_OP,%d1 # last inst is MUL
- fmul.x TWO16380(%pc),%fp0
- bra t_catch
-
-COSHHUGE:
- bra t_ovfl2
-
- global scoshd
-#--COSH(X) = 1 FOR DENORMALIZED X
-scoshd:
- fmov.s &0x3F800000,%fp0
-
- fmov.l %d0,%fpcr
- fadd.s &0x00800000,%fp0
- bra t_pinx2
-
-#########################################################################
-# ssinh(): computes the hyperbolic sine of a normalized input #
-# ssinhd(): computes the hyperbolic sine of a denormalized input #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input #
-# d0 = round precision,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = sinh(X) #
-# #
-# ACCURACY and MONOTONICITY ******************************************* #
-# The returned result is within 3 ulps in 64 significant bit, #
-# i.e. within 0.5001 ulp to 53 bits if the result is subsequently #
-# rounded to double precision. The result is provably monotonic #
-# in double precision. #
-# #
-# ALGORITHM *********************************************************** #
-# #
-# SINH #
-# 1. If |X| > 16380 log2, go to 3. #
-# #
-# 2. (|X| <= 16380 log2) Sinh(X) is obtained by the formula #
-# y = |X|, sgn = sign(X), and z = expm1(Y), #
-# sinh(X) = sgn*(1/2)*( z + z/(1+z) ). #
-# Exit. #
-# #
-# 3. If |X| > 16480 log2, go to 5. #
-# #
-# 4. (16380 log2 < |X| <= 16480 log2) #
-# sinh(X) = sign(X) * exp(|X|)/2. #
-# However, invoking exp(|X|) may cause premature overflow. #
-# Thus, we calculate sinh(X) as follows: #
-# Y := |X| #
-# sgn := sign(X) #
-# sgnFact := sgn * 2**(16380) #
-# Y' := Y - 16381 log2 #
-# sinh(X) := sgnFact * exp(Y'). #
-# Exit. #
-# #
-# 5. (|X| > 16480 log2) sinh(X) must overflow. Return #
-# sign(X)*Huge*Huge to generate overflow and an infinity with #
-# the appropriate sign. Huge is the largest finite number in #
-# extended format. Exit. #
-# #
-#########################################################################
-
- global ssinh
-ssinh:
- fmov.x (%a0),%fp0 # LOAD INPUT
-
- mov.l (%a0),%d1
- mov.w 4(%a0),%d1
- mov.l %d1,%a1 # save (compacted) operand
- and.l &0x7FFFFFFF,%d1
- cmp.l %d1,&0x400CB167
- bgt.b SINHBIG
-
-#--THIS IS THE USUAL CASE, |X| < 16380 LOG2
-#--Y = |X|, Z = EXPM1(Y), SINH(X) = SIGN(X)*(1/2)*( Z + Z/(1+Z) )
-
- fabs.x %fp0 # Y = |X|
-
- movm.l &0x8040,-(%sp) # {a1/d0}
- fmovm.x &0x01,-(%sp) # save Y on stack
- lea (%sp),%a0 # pass ptr to Y
- clr.l %d0
- bsr setoxm1 # FP0 IS Z = EXPM1(Y)
- add.l &0xc,%sp # clear Y from stack
- fmov.l &0,%fpcr
- movm.l (%sp)+,&0x0201 # {a1/d0}
-
- fmov.x %fp0,%fp1
- fadd.s &0x3F800000,%fp1 # 1+Z
- fmov.x %fp0,-(%sp)
- fdiv.x %fp1,%fp0 # Z/(1+Z)
- mov.l %a1,%d1
- and.l &0x80000000,%d1
- or.l &0x3F000000,%d1
- fadd.x (%sp)+,%fp0
- mov.l %d1,-(%sp)
-
- fmov.l %d0,%fpcr
- mov.b &FMUL_OP,%d1 # last inst is MUL
- fmul.s (%sp)+,%fp0 # last fp inst - possible exceptions set
- bra t_catch
-
-SINHBIG:
- cmp.l %d1,&0x400CB2B3
- bgt t_ovfl
- fabs.x %fp0
- fsub.d T1(%pc),%fp0 # (|X|-16381LOG2_LEAD)
- mov.l &0,-(%sp)
- mov.l &0x80000000,-(%sp)
- mov.l %a1,%d1
- and.l &0x80000000,%d1
- or.l &0x7FFB0000,%d1
- mov.l %d1,-(%sp) # EXTENDED FMT
- fsub.d T2(%pc),%fp0 # |X| - 16381 LOG2, ACCURATE
-
- mov.l %d0,-(%sp)
- clr.l %d0
- fmovm.x &0x01,-(%sp) # save fp0 on stack
- lea (%sp),%a0 # pass ptr to fp0
- bsr setox
- add.l &0xc,%sp # clear fp0 from stack
-
- mov.l (%sp)+,%d0
- fmov.l %d0,%fpcr
- mov.b &FMUL_OP,%d1 # last inst is MUL
- fmul.x (%sp)+,%fp0 # possible exception
- bra t_catch
-
- global ssinhd
-#--SINH(X) = X FOR DENORMALIZED X
-ssinhd:
- bra t_extdnrm
-
-#########################################################################
-# stanh(): computes the hyperbolic tangent of a normalized input #
-# stanhd(): computes the hyperbolic tangent of a denormalized input #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input #
-# d0 = round precision,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = tanh(X) #
-# #
-# ACCURACY and MONOTONICITY ******************************************* #
-# The returned result is within 3 ulps in 64 significant bit, #
-# i.e. within 0.5001 ulp to 53 bits if the result is subsequently #
-# rounded to double precision. The result is provably monotonic #
-# in double precision. #
-# #
-# ALGORITHM *********************************************************** #
-# #
-# TANH #
-# 1. If |X| >= (5/2) log2 or |X| <= 2**(-40), go to 3. #
-# #
-# 2. (2**(-40) < |X| < (5/2) log2) Calculate tanh(X) by #
-# sgn := sign(X), y := 2|X|, z := expm1(Y), and #
-# tanh(X) = sgn*( z/(2+z) ). #
-# Exit. #
-# #
-# 3. (|X| <= 2**(-40) or |X| >= (5/2) log2). If |X| < 1, #
-# go to 7. #
-# #
-# 4. (|X| >= (5/2) log2) If |X| >= 50 log2, go to 6. #
-# #
-# 5. ((5/2) log2 <= |X| < 50 log2) Calculate tanh(X) by #
-# sgn := sign(X), y := 2|X|, z := exp(Y), #
-# tanh(X) = sgn - [ sgn*2/(1+z) ]. #
-# Exit. #
-# #
-# 6. (|X| >= 50 log2) Tanh(X) = +-1 (round to nearest). Thus, we #
-# calculate Tanh(X) by #
-# sgn := sign(X), Tiny := 2**(-126), #
-# tanh(X) := sgn - sgn*Tiny. #
-# Exit. #
-# #
-# 7. (|X| < 2**(-40)). Tanh(X) = X. Exit. #
-# #
-#########################################################################
-
- set X,FP_SCR0
- set XFRAC,X+4
-
- set SGN,L_SCR3
-
- set V,FP_SCR0
-
- global stanh
-stanh:
- fmov.x (%a0),%fp0 # LOAD INPUT
-
- fmov.x %fp0,X(%a6)
- mov.l (%a0),%d1
- mov.w 4(%a0),%d1
- mov.l %d1,X(%a6)
- and.l &0x7FFFFFFF,%d1
- cmp.l %d1, &0x3fd78000 # is |X| < 2^(-40)?
- blt.w TANHBORS # yes
- cmp.l %d1, &0x3fffddce # is |X| > (5/2)LOG2?
- bgt.w TANHBORS # yes
-
-#--THIS IS THE USUAL CASE
-#--Y = 2|X|, Z = EXPM1(Y), TANH(X) = SIGN(X) * Z / (Z+2).
-
- mov.l X(%a6),%d1
- mov.l %d1,SGN(%a6)
- and.l &0x7FFF0000,%d1
- add.l &0x00010000,%d1 # EXPONENT OF 2|X|
- mov.l %d1,X(%a6)
- and.l &0x80000000,SGN(%a6)
- fmov.x X(%a6),%fp0 # FP0 IS Y = 2|X|
-
- mov.l %d0,-(%sp)
- clr.l %d0
- fmovm.x &0x1,-(%sp) # save Y on stack
- lea (%sp),%a0 # pass ptr to Y
- bsr setoxm1 # FP0 IS Z = EXPM1(Y)
- add.l &0xc,%sp # clear Y from stack
- mov.l (%sp)+,%d0
-
- fmov.x %fp0,%fp1
- fadd.s &0x40000000,%fp1 # Z+2
- mov.l SGN(%a6),%d1
- fmov.x %fp1,V(%a6)
- eor.l %d1,V(%a6)
-
- fmov.l %d0,%fpcr # restore users round prec,mode
- fdiv.x V(%a6),%fp0
- bra t_inx2
-
-TANHBORS:
- cmp.l %d1,&0x3FFF8000
- blt.w TANHSM
-
- cmp.l %d1,&0x40048AA1
- bgt.w TANHHUGE
-
-#-- (5/2) LOG2 < |X| < 50 LOG2,
-#--TANH(X) = 1 - (2/[EXP(2X)+1]). LET Y = 2|X|, SGN = SIGN(X),
-#--TANH(X) = SGN - SGN*2/[EXP(Y)+1].
-
- mov.l X(%a6),%d1
- mov.l %d1,SGN(%a6)
- and.l &0x7FFF0000,%d1
- add.l &0x00010000,%d1 # EXPO OF 2|X|
- mov.l %d1,X(%a6) # Y = 2|X|
- and.l &0x80000000,SGN(%a6)
- mov.l SGN(%a6),%d1
- fmov.x X(%a6),%fp0 # Y = 2|X|
-
- mov.l %d0,-(%sp)
- clr.l %d0
- fmovm.x &0x01,-(%sp) # save Y on stack
- lea (%sp),%a0 # pass ptr to Y
- bsr setox # FP0 IS EXP(Y)
- add.l &0xc,%sp # clear Y from stack
- mov.l (%sp)+,%d0
- mov.l SGN(%a6),%d1
- fadd.s &0x3F800000,%fp0 # EXP(Y)+1
-
- eor.l &0xC0000000,%d1 # -SIGN(X)*2
- fmov.s %d1,%fp1 # -SIGN(X)*2 IN SGL FMT
- fdiv.x %fp0,%fp1 # -SIGN(X)2 / [EXP(Y)+1 ]
-
- mov.l SGN(%a6),%d1
- or.l &0x3F800000,%d1 # SGN
- fmov.s %d1,%fp0 # SGN IN SGL FMT
-
- fmov.l %d0,%fpcr # restore users round prec,mode
- mov.b &FADD_OP,%d1 # last inst is ADD
- fadd.x %fp1,%fp0
- bra t_inx2
-
-TANHSM:
- fmov.l %d0,%fpcr # restore users round prec,mode
- mov.b &FMOV_OP,%d1 # last inst is MOVE
- fmov.x X(%a6),%fp0 # last inst - possible exception set
- bra t_catch
-
-#---RETURN SGN(X) - SGN(X)EPS
-TANHHUGE:
- mov.l X(%a6),%d1
- and.l &0x80000000,%d1
- or.l &0x3F800000,%d1
- fmov.s %d1,%fp0
- and.l &0x80000000,%d1
- eor.l &0x80800000,%d1 # -SIGN(X)*EPS
-
- fmov.l %d0,%fpcr # restore users round prec,mode
- fadd.s %d1,%fp0
- bra t_inx2
-
- global stanhd
-#--TANH(X) = X FOR DENORMALIZED X
-stanhd:
- bra t_extdnrm
-
-#########################################################################
-# slogn(): computes the natural logarithm of a normalized input #
-# slognd(): computes the natural logarithm of a denormalized input #
-# slognp1(): computes the log(1+X) of a normalized input #
-# slognp1d(): computes the log(1+X) of a denormalized input #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input #
-# d0 = round precision,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = log(X) or log(1+X) #
-# #
-# ACCURACY and MONOTONICITY ******************************************* #
-# The returned result is within 2 ulps in 64 significant bit, #
-# i.e. within 0.5001 ulp to 53 bits if the result is subsequently #
-# rounded to double precision. The result is provably monotonic #
-# in double precision. #
-# #
-# ALGORITHM *********************************************************** #
-# LOGN: #
-# Step 1. If |X-1| < 1/16, approximate log(X) by an odd #
-# polynomial in u, where u = 2(X-1)/(X+1). Otherwise, #
-# move on to Step 2. #
-# #
-# Step 2. X = 2**k * Y where 1 <= Y < 2. Define F to be the first #
-# seven significant bits of Y plus 2**(-7), i.e. #
-# F = 1.xxxxxx1 in base 2 where the six "x" match those #
-# of Y. Note that |Y-F| <= 2**(-7). #
-# #
-# Step 3. Define u = (Y-F)/F. Approximate log(1+u) by a #
-# polynomial in u, log(1+u) = poly. #
-# #
-# Step 4. Reconstruct #
-# log(X) = log( 2**k * Y ) = k*log(2) + log(F) + log(1+u) #
-# by k*log(2) + (log(F) + poly). The values of log(F) are #
-# calculated beforehand and stored in the program. #
-# #
-# lognp1: #
-# Step 1: If |X| < 1/16, approximate log(1+X) by an odd #
-# polynomial in u where u = 2X/(2+X). Otherwise, move on #
-# to Step 2. #
-# #
-# Step 2: Let 1+X = 2**k * Y, where 1 <= Y < 2. Define F as done #
-# in Step 2 of the algorithm for LOGN and compute #
-# log(1+X) as k*log(2) + log(F) + poly where poly #
-# approximates log(1+u), u = (Y-F)/F. #
-# #
-# Implementation Notes: #
-# Note 1. There are 64 different possible values for F, thus 64 #
-# log(F)'s need to be tabulated. Moreover, the values of #
-# 1/F are also tabulated so that the division in (Y-F)/F #
-# can be performed by a multiplication. #
-# #
-# Note 2. In Step 2 of lognp1, in order to preserved accuracy, #
-# the value Y-F has to be calculated carefully when #
-# 1/2 <= X < 3/2. #
-# #
-# Note 3. To fully exploit the pipeline, polynomials are usually #
-# separated into two parts evaluated independently before #
-# being added up. #
-# #
-#########################################################################
-LOGOF2:
- long 0x3FFE0000,0xB17217F7,0xD1CF79AC,0x00000000
-
-one:
- long 0x3F800000
-zero:
- long 0x00000000
-infty:
- long 0x7F800000
-negone:
- long 0xBF800000
-
-LOGA6:
- long 0x3FC2499A,0xB5E4040B
-LOGA5:
- long 0xBFC555B5,0x848CB7DB
-
-LOGA4:
- long 0x3FC99999,0x987D8730
-LOGA3:
- long 0xBFCFFFFF,0xFF6F7E97
-
-LOGA2:
- long 0x3FD55555,0x555555A4
-LOGA1:
- long 0xBFE00000,0x00000008
-
-LOGB5:
- long 0x3F175496,0xADD7DAD6
-LOGB4:
- long 0x3F3C71C2,0xFE80C7E0
-
-LOGB3:
- long 0x3F624924,0x928BCCFF
-LOGB2:
- long 0x3F899999,0x999995EC
-
-LOGB1:
- long 0x3FB55555,0x55555555
-TWO:
- long 0x40000000,0x00000000
-
-LTHOLD:
- long 0x3f990000,0x80000000,0x00000000,0x00000000
-
-LOGTBL:
- long 0x3FFE0000,0xFE03F80F,0xE03F80FE,0x00000000
- long 0x3FF70000,0xFF015358,0x833C47E2,0x00000000
- long 0x3FFE0000,0xFA232CF2,0x52138AC0,0x00000000
- long 0x3FF90000,0xBDC8D83E,0xAD88D549,0x00000000
- long 0x3FFE0000,0xF6603D98,0x0F6603DA,0x00000000
- long 0x3FFA0000,0x9CF43DCF,0xF5EAFD48,0x00000000
- long 0x3FFE0000,0xF2B9D648,0x0F2B9D65,0x00000000
- long 0x3FFA0000,0xDA16EB88,0xCB8DF614,0x00000000
- long 0x3FFE0000,0xEF2EB71F,0xC4345238,0x00000000
- long 0x3FFB0000,0x8B29B775,0x1BD70743,0x00000000
- long 0x3FFE0000,0xEBBDB2A5,0xC1619C8C,0x00000000
- long 0x3FFB0000,0xA8D839F8,0x30C1FB49,0x00000000
- long 0x3FFE0000,0xE865AC7B,0x7603A197,0x00000000
- long 0x3FFB0000,0xC61A2EB1,0x8CD907AD,0x00000000
- long 0x3FFE0000,0xE525982A,0xF70C880E,0x00000000
- long 0x3FFB0000,0xE2F2A47A,0xDE3A18AF,0x00000000
- long 0x3FFE0000,0xE1FC780E,0x1FC780E2,0x00000000
- long 0x3FFB0000,0xFF64898E,0xDF55D551,0x00000000
- long 0x3FFE0000,0xDEE95C4C,0xA037BA57,0x00000000
- long 0x3FFC0000,0x8DB956A9,0x7B3D0148,0x00000000
- long 0x3FFE0000,0xDBEB61EE,0xD19C5958,0x00000000
- long 0x3FFC0000,0x9B8FE100,0xF47BA1DE,0x00000000
- long 0x3FFE0000,0xD901B203,0x6406C80E,0x00000000
- long 0x3FFC0000,0xA9372F1D,0x0DA1BD17,0x00000000
- long 0x3FFE0000,0xD62B80D6,0x2B80D62C,0x00000000
- long 0x3FFC0000,0xB6B07F38,0xCE90E46B,0x00000000
- long 0x3FFE0000,0xD3680D36,0x80D3680D,0x00000000
- long 0x3FFC0000,0xC3FD0329,0x06488481,0x00000000
- long 0x3FFE0000,0xD0B69FCB,0xD2580D0B,0x00000000
- long 0x3FFC0000,0xD11DE0FF,0x15AB18CA,0x00000000
- long 0x3FFE0000,0xCE168A77,0x25080CE1,0x00000000
- long 0x3FFC0000,0xDE1433A1,0x6C66B150,0x00000000
- long 0x3FFE0000,0xCB8727C0,0x65C393E0,0x00000000
- long 0x3FFC0000,0xEAE10B5A,0x7DDC8ADD,0x00000000
- long 0x3FFE0000,0xC907DA4E,0x871146AD,0x00000000
- long 0x3FFC0000,0xF7856E5E,0xE2C9B291,0x00000000
- long 0x3FFE0000,0xC6980C69,0x80C6980C,0x00000000
- long 0x3FFD0000,0x82012CA5,0xA68206D7,0x00000000
- long 0x3FFE0000,0xC4372F85,0x5D824CA6,0x00000000
- long 0x3FFD0000,0x882C5FCD,0x7256A8C5,0x00000000
- long 0x3FFE0000,0xC1E4BBD5,0x95F6E947,0x00000000
- long 0x3FFD0000,0x8E44C60B,0x4CCFD7DE,0x00000000
- long 0x3FFE0000,0xBFA02FE8,0x0BFA02FF,0x00000000
- long 0x3FFD0000,0x944AD09E,0xF4351AF6,0x00000000
- long 0x3FFE0000,0xBD691047,0x07661AA3,0x00000000
- long 0x3FFD0000,0x9A3EECD4,0xC3EAA6B2,0x00000000
- long 0x3FFE0000,0xBB3EE721,0xA54D880C,0x00000000
- long 0x3FFD0000,0xA0218434,0x353F1DE8,0x00000000
- long 0x3FFE0000,0xB92143FA,0x36F5E02E,0x00000000
- long 0x3FFD0000,0xA5F2FCAB,0xBBC506DA,0x00000000
- long 0x3FFE0000,0xB70FBB5A,0x19BE3659,0x00000000
- long 0x3FFD0000,0xABB3B8BA,0x2AD362A5,0x00000000
- long 0x3FFE0000,0xB509E68A,0x9B94821F,0x00000000
- long 0x3FFD0000,0xB1641795,0xCE3CA97B,0x00000000
- long 0x3FFE0000,0xB30F6352,0x8917C80B,0x00000000
- long 0x3FFD0000,0xB7047551,0x5D0F1C61,0x00000000
- long 0x3FFE0000,0xB11FD3B8,0x0B11FD3C,0x00000000
- long 0x3FFD0000,0xBC952AFE,0xEA3D13E1,0x00000000
- long 0x3FFE0000,0xAF3ADDC6,0x80AF3ADE,0x00000000
- long 0x3FFD0000,0xC2168ED0,0xF458BA4A,0x00000000
- long 0x3FFE0000,0xAD602B58,0x0AD602B6,0x00000000
- long 0x3FFD0000,0xC788F439,0xB3163BF1,0x00000000
- long 0x3FFE0000,0xAB8F69E2,0x8359CD11,0x00000000
- long 0x3FFD0000,0xCCECAC08,0xBF04565D,0x00000000
- long 0x3FFE0000,0xA9C84A47,0xA07F5638,0x00000000
- long 0x3FFD0000,0xD2420487,0x2DD85160,0x00000000
- long 0x3FFE0000,0xA80A80A8,0x0A80A80B,0x00000000
- long 0x3FFD0000,0xD7894992,0x3BC3588A,0x00000000
- long 0x3FFE0000,0xA655C439,0x2D7B73A8,0x00000000
- long 0x3FFD0000,0xDCC2C4B4,0x9887DACC,0x00000000
- long 0x3FFE0000,0xA4A9CF1D,0x96833751,0x00000000
- long 0x3FFD0000,0xE1EEBD3E,0x6D6A6B9E,0x00000000
- long 0x3FFE0000,0xA3065E3F,0xAE7CD0E0,0x00000000
- long 0x3FFD0000,0xE70D785C,0x2F9F5BDC,0x00000000
- long 0x3FFE0000,0xA16B312E,0xA8FC377D,0x00000000
- long 0x3FFD0000,0xEC1F392C,0x5179F283,0x00000000
- long 0x3FFE0000,0x9FD809FD,0x809FD80A,0x00000000
- long 0x3FFD0000,0xF12440D3,0xE36130E6,0x00000000
- long 0x3FFE0000,0x9E4CAD23,0xDD5F3A20,0x00000000
- long 0x3FFD0000,0xF61CCE92,0x346600BB,0x00000000
- long 0x3FFE0000,0x9CC8E160,0xC3FB19B9,0x00000000
- long 0x3FFD0000,0xFB091FD3,0x8145630A,0x00000000
- long 0x3FFE0000,0x9B4C6F9E,0xF03A3CAA,0x00000000
- long 0x3FFD0000,0xFFE97042,0xBFA4C2AD,0x00000000
- long 0x3FFE0000,0x99D722DA,0xBDE58F06,0x00000000
- long 0x3FFE0000,0x825EFCED,0x49369330,0x00000000
- long 0x3FFE0000,0x9868C809,0x868C8098,0x00000000
- long 0x3FFE0000,0x84C37A7A,0xB9A905C9,0x00000000
- long 0x3FFE0000,0x97012E02,0x5C04B809,0x00000000
- long 0x3FFE0000,0x87224C2E,0x8E645FB7,0x00000000
- long 0x3FFE0000,0x95A02568,0x095A0257,0x00000000
- long 0x3FFE0000,0x897B8CAC,0x9F7DE298,0x00000000
- long 0x3FFE0000,0x94458094,0x45809446,0x00000000
- long 0x3FFE0000,0x8BCF55DE,0xC4CD05FE,0x00000000
- long 0x3FFE0000,0x92F11384,0x0497889C,0x00000000
- long 0x3FFE0000,0x8E1DC0FB,0x89E125E5,0x00000000
- long 0x3FFE0000,0x91A2B3C4,0xD5E6F809,0x00000000
- long 0x3FFE0000,0x9066E68C,0x955B6C9B,0x00000000
- long 0x3FFE0000,0x905A3863,0x3E06C43B,0x00000000
- long 0x3FFE0000,0x92AADE74,0xC7BE59E0,0x00000000
- long 0x3FFE0000,0x8F1779D9,0xFDC3A219,0x00000000
- long 0x3FFE0000,0x94E9BFF6,0x15845643,0x00000000
- long 0x3FFE0000,0x8DDA5202,0x37694809,0x00000000
- long 0x3FFE0000,0x9723A1B7,0x20134203,0x00000000
- long 0x3FFE0000,0x8CA29C04,0x6514E023,0x00000000
- long 0x3FFE0000,0x995899C8,0x90EB8990,0x00000000
- long 0x3FFE0000,0x8B70344A,0x139BC75A,0x00000000
- long 0x3FFE0000,0x9B88BDAA,0x3A3DAE2F,0x00000000
- long 0x3FFE0000,0x8A42F870,0x5669DB46,0x00000000
- long 0x3FFE0000,0x9DB4224F,0xFFE1157C,0x00000000
- long 0x3FFE0000,0x891AC73A,0xE9819B50,0x00000000
- long 0x3FFE0000,0x9FDADC26,0x8B7A12DA,0x00000000
- long 0x3FFE0000,0x87F78087,0xF78087F8,0x00000000
- long 0x3FFE0000,0xA1FCFF17,0xCE733BD4,0x00000000
- long 0x3FFE0000,0x86D90544,0x7A34ACC6,0x00000000
- long 0x3FFE0000,0xA41A9E8F,0x5446FB9F,0x00000000
- long 0x3FFE0000,0x85BF3761,0x2CEE3C9B,0x00000000
- long 0x3FFE0000,0xA633CD7E,0x6771CD8B,0x00000000
- long 0x3FFE0000,0x84A9F9C8,0x084A9F9D,0x00000000
- long 0x3FFE0000,0xA8489E60,0x0B435A5E,0x00000000
- long 0x3FFE0000,0x83993052,0x3FBE3368,0x00000000
- long 0x3FFE0000,0xAA59233C,0xCCA4BD49,0x00000000
- long 0x3FFE0000,0x828CBFBE,0xB9A020A3,0x00000000
- long 0x3FFE0000,0xAC656DAE,0x6BCC4985,0x00000000
- long 0x3FFE0000,0x81848DA8,0xFAF0D277,0x00000000
- long 0x3FFE0000,0xAE6D8EE3,0x60BB2468,0x00000000
- long 0x3FFE0000,0x80808080,0x80808081,0x00000000
- long 0x3FFE0000,0xB07197A2,0x3C46C654,0x00000000
-
- set ADJK,L_SCR1
-
- set X,FP_SCR0
- set XDCARE,X+2
- set XFRAC,X+4
-
- set F,FP_SCR1
- set FFRAC,F+4
-
- set KLOG2,FP_SCR0
-
- set SAVEU,FP_SCR0
-
- global slogn
-#--ENTRY POINT FOR LOG(X) FOR X FINITE, NON-ZERO, NOT NAN'S
-slogn:
- fmov.x (%a0),%fp0 # LOAD INPUT
- mov.l &0x00000000,ADJK(%a6)
-
-LOGBGN:
-#--FPCR SAVED AND CLEARED, INPUT IS 2^(ADJK)*FP0, FP0 CONTAINS
-#--A FINITE, NON-ZERO, NORMALIZED NUMBER.
-
- mov.l (%a0),%d1
- mov.w 4(%a0),%d1
-
- mov.l (%a0),X(%a6)
- mov.l 4(%a0),X+4(%a6)
- mov.l 8(%a0),X+8(%a6)
-
- cmp.l %d1,&0 # CHECK IF X IS NEGATIVE
- blt.w LOGNEG # LOG OF NEGATIVE ARGUMENT IS INVALID
-# X IS POSITIVE, CHECK IF X IS NEAR 1
- cmp.l %d1,&0x3ffef07d # IS X < 15/16?
- blt.b LOGMAIN # YES
- cmp.l %d1,&0x3fff8841 # IS X > 17/16?
- ble.w LOGNEAR1 # NO
-
-LOGMAIN:
-#--THIS SHOULD BE THE USUAL CASE, X NOT VERY CLOSE TO 1
-
-#--X = 2^(K) * Y, 1 <= Y < 2. THUS, Y = 1.XXXXXXXX....XX IN BINARY.
-#--WE DEFINE F = 1.XXXXXX1, I.E. FIRST 7 BITS OF Y AND ATTACH A 1.
-#--THE IDEA IS THAT LOG(X) = K*LOG2 + LOG(Y)
-#-- = K*LOG2 + LOG(F) + LOG(1 + (Y-F)/F).
-#--NOTE THAT U = (Y-F)/F IS VERY SMALL AND THUS APPROXIMATING
-#--LOG(1+U) CAN BE VERY EFFICIENT.
-#--ALSO NOTE THAT THE VALUE 1/F IS STORED IN A TABLE SO THAT NO
-#--DIVISION IS NEEDED TO CALCULATE (Y-F)/F.
-
-#--GET K, Y, F, AND ADDRESS OF 1/F.
- asr.l &8,%d1
- asr.l &8,%d1 # SHIFTED 16 BITS, BIASED EXPO. OF X
- sub.l &0x3FFF,%d1 # THIS IS K
- add.l ADJK(%a6),%d1 # ADJUST K, ORIGINAL INPUT MAY BE DENORM.
- lea LOGTBL(%pc),%a0 # BASE ADDRESS OF 1/F AND LOG(F)
- fmov.l %d1,%fp1 # CONVERT K TO FLOATING-POINT FORMAT
-
-#--WHILE THE CONVERSION IS GOING ON, WE GET F AND ADDRESS OF 1/F
- mov.l &0x3FFF0000,X(%a6) # X IS NOW Y, I.E. 2^(-K)*X
- mov.l XFRAC(%a6),FFRAC(%a6)
- and.l &0xFE000000,FFRAC(%a6) # FIRST 7 BITS OF Y
- or.l &0x01000000,FFRAC(%a6) # GET F: ATTACH A 1 AT THE EIGHTH BIT
- mov.l FFRAC(%a6),%d1 # READY TO GET ADDRESS OF 1/F
- and.l &0x7E000000,%d1
- asr.l &8,%d1
- asr.l &8,%d1
- asr.l &4,%d1 # SHIFTED 20, D0 IS THE DISPLACEMENT
- add.l %d1,%a0 # A0 IS THE ADDRESS FOR 1/F
-
- fmov.x X(%a6),%fp0
- mov.l &0x3fff0000,F(%a6)
- clr.l F+8(%a6)
- fsub.x F(%a6),%fp0 # Y-F
- fmovm.x &0xc,-(%sp) # SAVE FP2-3 WHILE FP0 IS NOT READY
-#--SUMMARY: FP0 IS Y-F, A0 IS ADDRESS OF 1/F, FP1 IS K
-#--REGISTERS SAVED: FPCR, FP1, FP2
-
-LP1CONT1:
-#--AN RE-ENTRY POINT FOR LOGNP1
- fmul.x (%a0),%fp0 # FP0 IS U = (Y-F)/F
- fmul.x LOGOF2(%pc),%fp1 # GET K*LOG2 WHILE FP0 IS NOT READY
- fmov.x %fp0,%fp2
- fmul.x %fp2,%fp2 # FP2 IS V=U*U
- fmov.x %fp1,KLOG2(%a6) # PUT K*LOG2 IN MEMEORY, FREE FP1
-
-#--LOG(1+U) IS APPROXIMATED BY
-#--U + V*(A1+U*(A2+U*(A3+U*(A4+U*(A5+U*A6))))) WHICH IS
-#--[U + V*(A1+V*(A3+V*A5))] + [U*V*(A2+V*(A4+V*A6))]
-
- fmov.x %fp2,%fp3
- fmov.x %fp2,%fp1
-
- fmul.d LOGA6(%pc),%fp1 # V*A6
- fmul.d LOGA5(%pc),%fp2 # V*A5
-
- fadd.d LOGA4(%pc),%fp1 # A4+V*A6
- fadd.d LOGA3(%pc),%fp2 # A3+V*A5
-
- fmul.x %fp3,%fp1 # V*(A4+V*A6)
- fmul.x %fp3,%fp2 # V*(A3+V*A5)
-
- fadd.d LOGA2(%pc),%fp1 # A2+V*(A4+V*A6)
- fadd.d LOGA1(%pc),%fp2 # A1+V*(A3+V*A5)
-
- fmul.x %fp3,%fp1 # V*(A2+V*(A4+V*A6))
- add.l &16,%a0 # ADDRESS OF LOG(F)
- fmul.x %fp3,%fp2 # V*(A1+V*(A3+V*A5))
-
- fmul.x %fp0,%fp1 # U*V*(A2+V*(A4+V*A6))
- fadd.x %fp2,%fp0 # U+V*(A1+V*(A3+V*A5))
-
- fadd.x (%a0),%fp1 # LOG(F)+U*V*(A2+V*(A4+V*A6))
- fmovm.x (%sp)+,&0x30 # RESTORE FP2-3
- fadd.x %fp1,%fp0 # FP0 IS LOG(F) + LOG(1+U)
-
- fmov.l %d0,%fpcr
- fadd.x KLOG2(%a6),%fp0 # FINAL ADD
- bra t_inx2
-
-
-LOGNEAR1:
-
-# if the input is exactly equal to one, then exit through ld_pzero.
-# if these 2 lines weren't here, the correct answer would be returned
-# but the INEX2 bit would be set.
- fcmp.b %fp0,&0x1 # is it equal to one?
- fbeq.l ld_pzero # yes
-
-#--REGISTERS SAVED: FPCR, FP1. FP0 CONTAINS THE INPUT.
- fmov.x %fp0,%fp1
- fsub.s one(%pc),%fp1 # FP1 IS X-1
- fadd.s one(%pc),%fp0 # FP0 IS X+1
- fadd.x %fp1,%fp1 # FP1 IS 2(X-1)
-#--LOG(X) = LOG(1+U/2)-LOG(1-U/2) WHICH IS AN ODD POLYNOMIAL
-#--IN U, U = 2(X-1)/(X+1) = FP1/FP0
-
-LP1CONT2:
-#--THIS IS AN RE-ENTRY POINT FOR LOGNP1
- fdiv.x %fp0,%fp1 # FP1 IS U
- fmovm.x &0xc,-(%sp) # SAVE FP2-3
-#--REGISTERS SAVED ARE NOW FPCR,FP1,FP2,FP3
-#--LET V=U*U, W=V*V, CALCULATE
-#--U + U*V*(B1 + V*(B2 + V*(B3 + V*(B4 + V*B5)))) BY
-#--U + U*V*( [B1 + W*(B3 + W*B5)] + [V*(B2 + W*B4)] )
- fmov.x %fp1,%fp0
- fmul.x %fp0,%fp0 # FP0 IS V
- fmov.x %fp1,SAVEU(%a6) # STORE U IN MEMORY, FREE FP1
- fmov.x %fp0,%fp1
- fmul.x %fp1,%fp1 # FP1 IS W
-
- fmov.d LOGB5(%pc),%fp3
- fmov.d LOGB4(%pc),%fp2
-
- fmul.x %fp1,%fp3 # W*B5
- fmul.x %fp1,%fp2 # W*B4
-
- fadd.d LOGB3(%pc),%fp3 # B3+W*B5
- fadd.d LOGB2(%pc),%fp2 # B2+W*B4
-
- fmul.x %fp3,%fp1 # W*(B3+W*B5), FP3 RELEASED
-
- fmul.x %fp0,%fp2 # V*(B2+W*B4)
-
- fadd.d LOGB1(%pc),%fp1 # B1+W*(B3+W*B5)
- fmul.x SAVEU(%a6),%fp0 # FP0 IS U*V
-
- fadd.x %fp2,%fp1 # B1+W*(B3+W*B5) + V*(B2+W*B4), FP2 RELEASED
- fmovm.x (%sp)+,&0x30 # FP2-3 RESTORED
-
- fmul.x %fp1,%fp0 # U*V*( [B1+W*(B3+W*B5)] + [V*(B2+W*B4)] )
-
- fmov.l %d0,%fpcr
- fadd.x SAVEU(%a6),%fp0
- bra t_inx2
-
-#--REGISTERS SAVED FPCR. LOG(-VE) IS INVALID
-LOGNEG:
- bra t_operr
-
- global slognd
-slognd:
-#--ENTRY POINT FOR LOG(X) FOR DENORMALIZED INPUT
-
- mov.l &-100,ADJK(%a6) # INPUT = 2^(ADJK) * FP0
-
-#----normalize the input value by left shifting k bits (k to be determined
-#----below), adjusting exponent and storing -k to ADJK
-#----the value TWOTO100 is no longer needed.
-#----Note that this code assumes the denormalized input is NON-ZERO.
-
- movm.l &0x3f00,-(%sp) # save some registers {d2-d7}
- mov.l (%a0),%d3 # D3 is exponent of smallest norm. #
- mov.l 4(%a0),%d4
- mov.l 8(%a0),%d5 # (D4,D5) is (Hi_X,Lo_X)
- clr.l %d2 # D2 used for holding K
-
- tst.l %d4
- bne.b Hi_not0
-
-Hi_0:
- mov.l %d5,%d4
- clr.l %d5
- mov.l &32,%d2
- clr.l %d6
- bfffo %d4{&0:&32},%d6
- lsl.l %d6,%d4
- add.l %d6,%d2 # (D3,D4,D5) is normalized
-
- mov.l %d3,X(%a6)
- mov.l %d4,XFRAC(%a6)
- mov.l %d5,XFRAC+4(%a6)
- neg.l %d2
- mov.l %d2,ADJK(%a6)
- fmov.x X(%a6),%fp0
- movm.l (%sp)+,&0xfc # restore registers {d2-d7}
- lea X(%a6),%a0
- bra.w LOGBGN # begin regular log(X)
-
-Hi_not0:
- clr.l %d6
- bfffo %d4{&0:&32},%d6 # find first 1
- mov.l %d6,%d2 # get k
- lsl.l %d6,%d4
- mov.l %d5,%d7 # a copy of D5
- lsl.l %d6,%d5
- neg.l %d6
- add.l &32,%d6
- lsr.l %d6,%d7
- or.l %d7,%d4 # (D3,D4,D5) normalized
-
- mov.l %d3,X(%a6)
- mov.l %d4,XFRAC(%a6)
- mov.l %d5,XFRAC+4(%a6)
- neg.l %d2
- mov.l %d2,ADJK(%a6)
- fmov.x X(%a6),%fp0
- movm.l (%sp)+,&0xfc # restore registers {d2-d7}
- lea X(%a6),%a0
- bra.w LOGBGN # begin regular log(X)
-
- global slognp1
-#--ENTRY POINT FOR LOG(1+X) FOR X FINITE, NON-ZERO, NOT NAN'S
-slognp1:
- fmov.x (%a0),%fp0 # LOAD INPUT
- fabs.x %fp0 # test magnitude
- fcmp.x %fp0,LTHOLD(%pc) # compare with min threshold
- fbgt.w LP1REAL # if greater, continue
- fmov.l %d0,%fpcr
- mov.b &FMOV_OP,%d1 # last inst is MOVE
- fmov.x (%a0),%fp0 # return signed argument
- bra t_catch
-
-LP1REAL:
- fmov.x (%a0),%fp0 # LOAD INPUT
- mov.l &0x00000000,ADJK(%a6)
- fmov.x %fp0,%fp1 # FP1 IS INPUT Z
- fadd.s one(%pc),%fp0 # X := ROUND(1+Z)
- fmov.x %fp0,X(%a6)
- mov.w XFRAC(%a6),XDCARE(%a6)
- mov.l X(%a6),%d1
- cmp.l %d1,&0
- ble.w LP1NEG0 # LOG OF ZERO OR -VE
- cmp.l %d1,&0x3ffe8000 # IS BOUNDS [1/2,3/2]?
- blt.w LOGMAIN
- cmp.l %d1,&0x3fffc000
- bgt.w LOGMAIN
-#--IF 1+Z > 3/2 OR 1+Z < 1/2, THEN X, WHICH IS ROUNDING 1+Z,
-#--CONTAINS AT LEAST 63 BITS OF INFORMATION OF Z. IN THAT CASE,
-#--SIMPLY INVOKE LOG(X) FOR LOG(1+Z).
-
-LP1NEAR1:
-#--NEXT SEE IF EXP(-1/16) < X < EXP(1/16)
- cmp.l %d1,&0x3ffef07d
- blt.w LP1CARE
- cmp.l %d1,&0x3fff8841
- bgt.w LP1CARE
-
-LP1ONE16:
-#--EXP(-1/16) < X < EXP(1/16). LOG(1+Z) = LOG(1+U/2) - LOG(1-U/2)
-#--WHERE U = 2Z/(2+Z) = 2Z/(1+X).
- fadd.x %fp1,%fp1 # FP1 IS 2Z
- fadd.s one(%pc),%fp0 # FP0 IS 1+X
-#--U = FP1/FP0
- bra.w LP1CONT2
-
-LP1CARE:
-#--HERE WE USE THE USUAL TABLE DRIVEN APPROACH. CARE HAS TO BE
-#--TAKEN BECAUSE 1+Z CAN HAVE 67 BITS OF INFORMATION AND WE MUST
-#--PRESERVE ALL THE INFORMATION. BECAUSE 1+Z IS IN [1/2,3/2],
-#--THERE ARE ONLY TWO CASES.
-#--CASE 1: 1+Z < 1, THEN K = -1 AND Y-F = (2-F) + 2Z
-#--CASE 2: 1+Z > 1, THEN K = 0 AND Y-F = (1-F) + Z
-#--ON RETURNING TO LP1CONT1, WE MUST HAVE K IN FP1, ADDRESS OF
-#--(1/F) IN A0, Y-F IN FP0, AND FP2 SAVED.
-
- mov.l XFRAC(%a6),FFRAC(%a6)
- and.l &0xFE000000,FFRAC(%a6)
- or.l &0x01000000,FFRAC(%a6) # F OBTAINED
- cmp.l %d1,&0x3FFF8000 # SEE IF 1+Z > 1
- bge.b KISZERO
-
-KISNEG1:
- fmov.s TWO(%pc),%fp0
- mov.l &0x3fff0000,F(%a6)
- clr.l F+8(%a6)
- fsub.x F(%a6),%fp0 # 2-F
- mov.l FFRAC(%a6),%d1
- and.l &0x7E000000,%d1
- asr.l &8,%d1
- asr.l &8,%d1
- asr.l &4,%d1 # D0 CONTAINS DISPLACEMENT FOR 1/F
- fadd.x %fp1,%fp1 # GET 2Z
- fmovm.x &0xc,-(%sp) # SAVE FP2 {%fp2/%fp3}
- fadd.x %fp1,%fp0 # FP0 IS Y-F = (2-F)+2Z
- lea LOGTBL(%pc),%a0 # A0 IS ADDRESS OF 1/F
- add.l %d1,%a0
- fmov.s negone(%pc),%fp1 # FP1 IS K = -1
- bra.w LP1CONT1
-
-KISZERO:
- fmov.s one(%pc),%fp0
- mov.l &0x3fff0000,F(%a6)
- clr.l F+8(%a6)
- fsub.x F(%a6),%fp0 # 1-F
- mov.l FFRAC(%a6),%d1
- and.l &0x7E000000,%d1
- asr.l &8,%d1
- asr.l &8,%d1
- asr.l &4,%d1
- fadd.x %fp1,%fp0 # FP0 IS Y-F
- fmovm.x &0xc,-(%sp) # FP2 SAVED {%fp2/%fp3}
- lea LOGTBL(%pc),%a0
- add.l %d1,%a0 # A0 IS ADDRESS OF 1/F
- fmov.s zero(%pc),%fp1 # FP1 IS K = 0
- bra.w LP1CONT1
-
-LP1NEG0:
-#--FPCR SAVED. D0 IS X IN COMPACT FORM.
- cmp.l %d1,&0
- blt.b LP1NEG
-LP1ZERO:
- fmov.s negone(%pc),%fp0
-
- fmov.l %d0,%fpcr
- bra t_dz
-
-LP1NEG:
- fmov.s zero(%pc),%fp0
-
- fmov.l %d0,%fpcr
- bra t_operr
-
- global slognp1d
-#--ENTRY POINT FOR LOG(1+Z) FOR DENORMALIZED INPUT
-# Simply return the denorm
-slognp1d:
- bra t_extdnrm
-
-#########################################################################
-# satanh(): computes the inverse hyperbolic tangent of a norm input #
-# satanhd(): computes the inverse hyperbolic tangent of a denorm input #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input #
-# d0 = round precision,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = arctanh(X) #
-# #
-# ACCURACY and MONOTONICITY ******************************************* #
-# The returned result is within 3 ulps in 64 significant bit, #
-# i.e. within 0.5001 ulp to 53 bits if the result is subsequently #
-# rounded to double precision. The result is provably monotonic #
-# in double precision. #
-# #
-# ALGORITHM *********************************************************** #
-# #
-# ATANH #
-# 1. If |X| >= 1, go to 3. #
-# #
-# 2. (|X| < 1) Calculate atanh(X) by #
-# sgn := sign(X) #
-# y := |X| #
-# z := 2y/(1-y) #
-# atanh(X) := sgn * (1/2) * logp1(z) #
-# Exit. #
-# #
-# 3. If |X| > 1, go to 5. #
-# #
-# 4. (|X| = 1) Generate infinity with an appropriate sign and #
-# divide-by-zero by #
-# sgn := sign(X) #
-# atan(X) := sgn / (+0). #
-# Exit. #
-# #
-# 5. (|X| > 1) Generate an invalid operation by 0 * infinity. #
-# Exit. #
-# #
-#########################################################################
-
- global satanh
-satanh:
- mov.l (%a0),%d1
- mov.w 4(%a0),%d1
- and.l &0x7FFFFFFF,%d1
- cmp.l %d1,&0x3FFF8000
- bge.b ATANHBIG
-
-#--THIS IS THE USUAL CASE, |X| < 1
-#--Y = |X|, Z = 2Y/(1-Y), ATANH(X) = SIGN(X) * (1/2) * LOG1P(Z).
-
- fabs.x (%a0),%fp0 # Y = |X|
- fmov.x %fp0,%fp1
- fneg.x %fp1 # -Y
- fadd.x %fp0,%fp0 # 2Y
- fadd.s &0x3F800000,%fp1 # 1-Y
- fdiv.x %fp1,%fp0 # 2Y/(1-Y)
- mov.l (%a0),%d1
- and.l &0x80000000,%d1
- or.l &0x3F000000,%d1 # SIGN(X)*HALF
- mov.l %d1,-(%sp)
-
- mov.l %d0,-(%sp) # save rnd prec,mode
- clr.l %d0 # pass ext prec,RN
- fmovm.x &0x01,-(%sp) # save Z on stack
- lea (%sp),%a0 # pass ptr to Z
- bsr slognp1 # LOG1P(Z)
- add.l &0xc,%sp # clear Z from stack
-
- mov.l (%sp)+,%d0 # fetch old prec,mode
- fmov.l %d0,%fpcr # load it
- mov.b &FMUL_OP,%d1 # last inst is MUL
- fmul.s (%sp)+,%fp0
- bra t_catch
-
-ATANHBIG:
- fabs.x (%a0),%fp0 # |X|
- fcmp.s %fp0,&0x3F800000
- fbgt t_operr
- bra t_dz
-
- global satanhd
-#--ATANH(X) = X FOR DENORMALIZED X
-satanhd:
- bra t_extdnrm
-
-#########################################################################
-# slog10(): computes the base-10 logarithm of a normalized input #
-# slog10d(): computes the base-10 logarithm of a denormalized input #
-# slog2(): computes the base-2 logarithm of a normalized input #
-# slog2d(): computes the base-2 logarithm of a denormalized input #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input #
-# d0 = round precision,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = log_10(X) or log_2(X) #
-# #
-# ACCURACY and MONOTONICITY ******************************************* #
-# The returned result is within 1.7 ulps in 64 significant bit, #
-# i.e. within 0.5003 ulp to 53 bits if the result is subsequently #
-# rounded to double precision. The result is provably monotonic #
-# in double precision. #
-# #
-# ALGORITHM *********************************************************** #
-# #
-# slog10d: #
-# #
-# Step 0. If X < 0, create a NaN and raise the invalid operation #
-# flag. Otherwise, save FPCR in D1; set FpCR to default. #
-# Notes: Default means round-to-nearest mode, no floating-point #
-# traps, and precision control = double extended. #
-# #
-# Step 1. Call slognd to obtain Y = log(X), the natural log of X. #
-# Notes: Even if X is denormalized, log(X) is always normalized. #
-# #
-# Step 2. Compute log_10(X) = log(X) * (1/log(10)). #
-# 2.1 Restore the user FPCR #
-# 2.2 Return ans := Y * INV_L10. #
-# #
-# slog10: #
-# #
-# Step 0. If X < 0, create a NaN and raise the invalid operation #
-# flag. Otherwise, save FPCR in D1; set FpCR to default. #
-# Notes: Default means round-to-nearest mode, no floating-point #
-# traps, and precision control = double extended. #
-# #
-# Step 1. Call sLogN to obtain Y = log(X), the natural log of X. #
-# #
-# Step 2. Compute log_10(X) = log(X) * (1/log(10)). #
-# 2.1 Restore the user FPCR #
-# 2.2 Return ans := Y * INV_L10. #
-# #
-# sLog2d: #
-# #
-# Step 0. If X < 0, create a NaN and raise the invalid operation #
-# flag. Otherwise, save FPCR in D1; set FpCR to default. #
-# Notes: Default means round-to-nearest mode, no floating-point #
-# traps, and precision control = double extended. #
-# #
-# Step 1. Call slognd to obtain Y = log(X), the natural log of X. #
-# Notes: Even if X is denormalized, log(X) is always normalized. #
-# #
-# Step 2. Compute log_10(X) = log(X) * (1/log(2)). #
-# 2.1 Restore the user FPCR #
-# 2.2 Return ans := Y * INV_L2. #
-# #
-# sLog2: #
-# #
-# Step 0. If X < 0, create a NaN and raise the invalid operation #
-# flag. Otherwise, save FPCR in D1; set FpCR to default. #
-# Notes: Default means round-to-nearest mode, no floating-point #
-# traps, and precision control = double extended. #
-# #
-# Step 1. If X is not an integer power of two, i.e., X != 2^k, #
-# go to Step 3. #
-# #
-# Step 2. Return k. #
-# 2.1 Get integer k, X = 2^k. #
-# 2.2 Restore the user FPCR. #
-# 2.3 Return ans := convert-to-double-extended(k). #
-# #
-# Step 3. Call sLogN to obtain Y = log(X), the natural log of X. #
-# #
-# Step 4. Compute log_2(X) = log(X) * (1/log(2)). #
-# 4.1 Restore the user FPCR #
-# 4.2 Return ans := Y * INV_L2. #
-# #
-#########################################################################
-
-INV_L10:
- long 0x3FFD0000,0xDE5BD8A9,0x37287195,0x00000000
-
-INV_L2:
- long 0x3FFF0000,0xB8AA3B29,0x5C17F0BC,0x00000000
-
- global slog10
-#--entry point for Log10(X), X is normalized
-slog10:
- fmov.b &0x1,%fp0
- fcmp.x %fp0,(%a0) # if operand == 1,
- fbeq.l ld_pzero # return an EXACT zero
-
- mov.l (%a0),%d1
- blt.w invalid
- mov.l %d0,-(%sp)
- clr.l %d0
- bsr slogn # log(X), X normal.
- fmov.l (%sp)+,%fpcr
- fmul.x INV_L10(%pc),%fp0
- bra t_inx2
-
- global slog10d
-#--entry point for Log10(X), X is denormalized
-slog10d:
- mov.l (%a0),%d1
- blt.w invalid
- mov.l %d0,-(%sp)
- clr.l %d0
- bsr slognd # log(X), X denorm.
- fmov.l (%sp)+,%fpcr
- fmul.x INV_L10(%pc),%fp0
- bra t_minx2
-
- global slog2
-#--entry point for Log2(X), X is normalized
-slog2:
- mov.l (%a0),%d1
- blt.w invalid
-
- mov.l 8(%a0),%d1
- bne.b continue # X is not 2^k
-
- mov.l 4(%a0),%d1
- and.l &0x7FFFFFFF,%d1
- bne.b continue
-
-#--X = 2^k.
- mov.w (%a0),%d1
- and.l &0x00007FFF,%d1
- sub.l &0x3FFF,%d1
- beq.l ld_pzero
- fmov.l %d0,%fpcr
- fmov.l %d1,%fp0
- bra t_inx2
-
-continue:
- mov.l %d0,-(%sp)
- clr.l %d0
- bsr slogn # log(X), X normal.
- fmov.l (%sp)+,%fpcr
- fmul.x INV_L2(%pc),%fp0
- bra t_inx2
-
-invalid:
- bra t_operr
-
- global slog2d
-#--entry point for Log2(X), X is denormalized
-slog2d:
- mov.l (%a0),%d1
- blt.w invalid
- mov.l %d0,-(%sp)
- clr.l %d0
- bsr slognd # log(X), X denorm.
- fmov.l (%sp)+,%fpcr
- fmul.x INV_L2(%pc),%fp0
- bra t_minx2
-
-#########################################################################
-# stwotox(): computes 2**X for a normalized input #
-# stwotoxd(): computes 2**X for a denormalized input #
-# stentox(): computes 10**X for a normalized input #
-# stentoxd(): computes 10**X for a denormalized input #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input #
-# d0 = round precision,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = 2**X or 10**X #
-# #
-# ACCURACY and MONOTONICITY ******************************************* #
-# The returned result is within 2 ulps in 64 significant bit, #
-# i.e. within 0.5001 ulp to 53 bits if the result is subsequently #
-# rounded to double precision. The result is provably monotonic #
-# in double precision. #
-# #
-# ALGORITHM *********************************************************** #
-# #
-# twotox #
-# 1. If |X| > 16480, go to ExpBig. #
-# #
-# 2. If |X| < 2**(-70), go to ExpSm. #
-# #
-# 3. Decompose X as X = N/64 + r where |r| <= 1/128. Furthermore #
-# decompose N as #
-# N = 64(M + M') + j, j = 0,1,2,...,63. #
-# #
-# 4. Overwrite r := r * log2. Then #
-# 2**X = 2**(M') * 2**(M) * 2**(j/64) * exp(r). #
-# Go to expr to compute that expression. #
-# #
-# tentox #
-# 1. If |X| > 16480*log_10(2) (base 10 log of 2), go to ExpBig. #
-# #
-# 2. If |X| < 2**(-70), go to ExpSm. #
-# #
-# 3. Set y := X*log_2(10)*64 (base 2 log of 10). Set #
-# N := round-to-int(y). Decompose N as #
-# N = 64(M + M') + j, j = 0,1,2,...,63. #
-# #
-# 4. Define r as #
-# r := ((X - N*L1)-N*L2) * L10 #
-# where L1, L2 are the leading and trailing parts of #
-# log_10(2)/64 and L10 is the natural log of 10. Then #
-# 10**X = 2**(M') * 2**(M) * 2**(j/64) * exp(r). #
-# Go to expr to compute that expression. #
-# #
-# expr #
-# 1. Fetch 2**(j/64) from table as Fact1 and Fact2. #
-# #
-# 2. Overwrite Fact1 and Fact2 by #
-# Fact1 := 2**(M) * Fact1 #
-# Fact2 := 2**(M) * Fact2 #
-# Thus Fact1 + Fact2 = 2**(M) * 2**(j/64). #
-# #
-# 3. Calculate P where 1 + P approximates exp(r): #
-# P = r + r*r*(A1+r*(A2+...+r*A5)). #
-# #
-# 4. Let AdjFact := 2**(M'). Return #
-# AdjFact * ( Fact1 + ((Fact1*P) + Fact2) ). #
-# Exit. #
-# #
-# ExpBig #
-# 1. Generate overflow by Huge * Huge if X > 0; otherwise, #
-# generate underflow by Tiny * Tiny. #
-# #
-# ExpSm #
-# 1. Return 1 + X. #
-# #
-#########################################################################
-
-L2TEN64:
- long 0x406A934F,0x0979A371 # 64LOG10/LOG2
-L10TWO1:
- long 0x3F734413,0x509F8000 # LOG2/64LOG10
-
-L10TWO2:
- long 0xBFCD0000,0xC0219DC1,0xDA994FD2,0x00000000
-
-LOG10: long 0x40000000,0x935D8DDD,0xAAA8AC17,0x00000000
-
-LOG2: long 0x3FFE0000,0xB17217F7,0xD1CF79AC,0x00000000
-
-EXPA5: long 0x3F56C16D,0x6F7BD0B2
-EXPA4: long 0x3F811112,0x302C712C
-EXPA3: long 0x3FA55555,0x55554CC1
-EXPA2: long 0x3FC55555,0x55554A54
-EXPA1: long 0x3FE00000,0x00000000,0x00000000,0x00000000
-
-TEXPTBL:
- long 0x3FFF0000,0x80000000,0x00000000,0x3F738000
- long 0x3FFF0000,0x8164D1F3,0xBC030773,0x3FBEF7CA
- long 0x3FFF0000,0x82CD8698,0xAC2BA1D7,0x3FBDF8A9
- long 0x3FFF0000,0x843A28C3,0xACDE4046,0x3FBCD7C9
- long 0x3FFF0000,0x85AAC367,0xCC487B15,0xBFBDE8DA
- long 0x3FFF0000,0x871F6196,0x9E8D1010,0x3FBDE85C
- long 0x3FFF0000,0x88980E80,0x92DA8527,0x3FBEBBF1
- long 0x3FFF0000,0x8A14D575,0x496EFD9A,0x3FBB80CA
- long 0x3FFF0000,0x8B95C1E3,0xEA8BD6E7,0xBFBA8373
- long 0x3FFF0000,0x8D1ADF5B,0x7E5BA9E6,0xBFBE9670
- long 0x3FFF0000,0x8EA4398B,0x45CD53C0,0x3FBDB700
- long 0x3FFF0000,0x9031DC43,0x1466B1DC,0x3FBEEEB0
- long 0x3FFF0000,0x91C3D373,0xAB11C336,0x3FBBFD6D
- long 0x3FFF0000,0x935A2B2F,0x13E6E92C,0xBFBDB319
- long 0x3FFF0000,0x94F4EFA8,0xFEF70961,0x3FBDBA2B
- long 0x3FFF0000,0x96942D37,0x20185A00,0x3FBE91D5
- long 0x3FFF0000,0x9837F051,0x8DB8A96F,0x3FBE8D5A
- long 0x3FFF0000,0x99E04593,0x20B7FA65,0xBFBCDE7B
- long 0x3FFF0000,0x9B8D39B9,0xD54E5539,0xBFBEBAAF
- long 0x3FFF0000,0x9D3ED9A7,0x2CFFB751,0xBFBD86DA
- long 0x3FFF0000,0x9EF53260,0x91A111AE,0xBFBEBEDD
- long 0x3FFF0000,0xA0B0510F,0xB9714FC2,0x3FBCC96E
- long 0x3FFF0000,0xA2704303,0x0C496819,0xBFBEC90B
- long 0x3FFF0000,0xA43515AE,0x09E6809E,0x3FBBD1DB
- long 0x3FFF0000,0xA5FED6A9,0xB15138EA,0x3FBCE5EB
- long 0x3FFF0000,0xA7CD93B4,0xE965356A,0xBFBEC274
- long 0x3FFF0000,0xA9A15AB4,0xEA7C0EF8,0x3FBEA83C
- long 0x3FFF0000,0xAB7A39B5,0xA93ED337,0x3FBECB00
- long 0x3FFF0000,0xAD583EEA,0x42A14AC6,0x3FBE9301
- long 0x3FFF0000,0xAF3B78AD,0x690A4375,0xBFBD8367
- long 0x3FFF0000,0xB123F581,0xD2AC2590,0xBFBEF05F
- long 0x3FFF0000,0xB311C412,0xA9112489,0x3FBDFB3C
- long 0x3FFF0000,0xB504F333,0xF9DE6484,0x3FBEB2FB
- long 0x3FFF0000,0xB6FD91E3,0x28D17791,0x3FBAE2CB
- long 0x3FFF0000,0xB8FBAF47,0x62FB9EE9,0x3FBCDC3C
- long 0x3FFF0000,0xBAFF5AB2,0x133E45FB,0x3FBEE9AA
- long 0x3FFF0000,0xBD08A39F,0x580C36BF,0xBFBEAEFD
- long 0x3FFF0000,0xBF1799B6,0x7A731083,0xBFBCBF51
- long 0x3FFF0000,0xC12C4CCA,0x66709456,0x3FBEF88A
- long 0x3FFF0000,0xC346CCDA,0x24976407,0x3FBD83B2
- long 0x3FFF0000,0xC5672A11,0x5506DADD,0x3FBDF8AB
- long 0x3FFF0000,0xC78D74C8,0xABB9B15D,0xBFBDFB17
- long 0x3FFF0000,0xC9B9BD86,0x6E2F27A3,0xBFBEFE3C
- long 0x3FFF0000,0xCBEC14FE,0xF2727C5D,0xBFBBB6F8
- long 0x3FFF0000,0xCE248C15,0x1F8480E4,0xBFBCEE53
- long 0x3FFF0000,0xD06333DA,0xEF2B2595,0xBFBDA4AE
- long 0x3FFF0000,0xD2A81D91,0xF12AE45A,0x3FBC9124
- long 0x3FFF0000,0xD4F35AAB,0xCFEDFA1F,0x3FBEB243
- long 0x3FFF0000,0xD744FCCA,0xD69D6AF4,0x3FBDE69A
- long 0x3FFF0000,0xD99D15C2,0x78AFD7B6,0xBFB8BC61
- long 0x3FFF0000,0xDBFBB797,0xDAF23755,0x3FBDF610
- long 0x3FFF0000,0xDE60F482,0x5E0E9124,0xBFBD8BE1
- long 0x3FFF0000,0xE0CCDEEC,0x2A94E111,0x3FBACB12
- long 0x3FFF0000,0xE33F8972,0xBE8A5A51,0x3FBB9BFE
- long 0x3FFF0000,0xE5B906E7,0x7C8348A8,0x3FBCF2F4
- long 0x3FFF0000,0xE8396A50,0x3C4BDC68,0x3FBEF22F
- long 0x3FFF0000,0xEAC0C6E7,0xDD24392F,0xBFBDBF4A
- long 0x3FFF0000,0xED4F301E,0xD9942B84,0x3FBEC01A
- long 0x3FFF0000,0xEFE4B99B,0xDCDAF5CB,0x3FBE8CAC
- long 0x3FFF0000,0xF281773C,0x59FFB13A,0xBFBCBB3F
- long 0x3FFF0000,0xF5257D15,0x2486CC2C,0x3FBEF73A
- long 0x3FFF0000,0xF7D0DF73,0x0AD13BB9,0xBFB8B795
- long 0x3FFF0000,0xFA83B2DB,0x722A033A,0x3FBEF84B
- long 0x3FFF0000,0xFD3E0C0C,0xF486C175,0xBFBEF581
-
- set INT,L_SCR1
-
- set X,FP_SCR0
- set XDCARE,X+2
- set XFRAC,X+4
-
- set ADJFACT,FP_SCR0
-
- set FACT1,FP_SCR0
- set FACT1HI,FACT1+4
- set FACT1LOW,FACT1+8
-
- set FACT2,FP_SCR1
- set FACT2HI,FACT2+4
- set FACT2LOW,FACT2+8
-
- global stwotox
-#--ENTRY POINT FOR 2**(X), HERE X IS FINITE, NON-ZERO, AND NOT NAN'S
-stwotox:
- fmovm.x (%a0),&0x80 # LOAD INPUT
-
- mov.l (%a0),%d1
- mov.w 4(%a0),%d1
- fmov.x %fp0,X(%a6)
- and.l &0x7FFFFFFF,%d1
-
- cmp.l %d1,&0x3FB98000 # |X| >= 2**(-70)?
- bge.b TWOOK1
- bra.w EXPBORS
-
-TWOOK1:
- cmp.l %d1,&0x400D80C0 # |X| > 16480?
- ble.b TWOMAIN
- bra.w EXPBORS
-
-TWOMAIN:
-#--USUAL CASE, 2^(-70) <= |X| <= 16480
-
- fmov.x %fp0,%fp1
- fmul.s &0x42800000,%fp1 # 64 * X
- fmov.l %fp1,INT(%a6) # N = ROUND-TO-INT(64 X)
- mov.l %d2,-(%sp)
- lea TEXPTBL(%pc),%a1 # LOAD ADDRESS OF TABLE OF 2^(J/64)
- fmov.l INT(%a6),%fp1 # N --> FLOATING FMT
- mov.l INT(%a6),%d1
- mov.l %d1,%d2
- and.l &0x3F,%d1 # D0 IS J
- asl.l &4,%d1 # DISPLACEMENT FOR 2^(J/64)
- add.l %d1,%a1 # ADDRESS FOR 2^(J/64)
- asr.l &6,%d2 # d2 IS L, N = 64L + J
- mov.l %d2,%d1
- asr.l &1,%d1 # D0 IS M
- sub.l %d1,%d2 # d2 IS M', N = 64(M+M') + J
- add.l &0x3FFF,%d2
-
-#--SUMMARY: a1 IS ADDRESS FOR THE LEADING PORTION OF 2^(J/64),
-#--D0 IS M WHERE N = 64(M+M') + J. NOTE THAT |M| <= 16140 BY DESIGN.
-#--ADJFACT = 2^(M').
-#--REGISTERS SAVED SO FAR ARE (IN ORDER) FPCR, D0, FP1, a1, AND FP2.
-
- fmovm.x &0x0c,-(%sp) # save fp2/fp3
-
- fmul.s &0x3C800000,%fp1 # (1/64)*N
- mov.l (%a1)+,FACT1(%a6)
- mov.l (%a1)+,FACT1HI(%a6)
- mov.l (%a1)+,FACT1LOW(%a6)
- mov.w (%a1)+,FACT2(%a6)
-
- fsub.x %fp1,%fp0 # X - (1/64)*INT(64 X)
-
- mov.w (%a1)+,FACT2HI(%a6)
- clr.w FACT2HI+2(%a6)
- clr.l FACT2LOW(%a6)
- add.w %d1,FACT1(%a6)
- fmul.x LOG2(%pc),%fp0 # FP0 IS R
- add.w %d1,FACT2(%a6)
-
- bra.w expr
-
-EXPBORS:
-#--FPCR, D0 SAVED
- cmp.l %d1,&0x3FFF8000
- bgt.b TEXPBIG
-
-#--|X| IS SMALL, RETURN 1 + X
-
- fmov.l %d0,%fpcr # restore users round prec,mode
- fadd.s &0x3F800000,%fp0 # RETURN 1 + X
- bra t_pinx2
-
-TEXPBIG:
-#--|X| IS LARGE, GENERATE OVERFLOW IF X > 0; ELSE GENERATE UNDERFLOW
-#--REGISTERS SAVE SO FAR ARE FPCR AND D0
- mov.l X(%a6),%d1
- cmp.l %d1,&0
- blt.b EXPNEG
-
- bra t_ovfl2 # t_ovfl expects positive value
-
-EXPNEG:
- bra t_unfl2 # t_unfl expects positive value
-
- global stwotoxd
-stwotoxd:
-#--ENTRY POINT FOR 2**(X) FOR DENORMALIZED ARGUMENT
-
- fmov.l %d0,%fpcr # set user's rounding mode/precision
- fmov.s &0x3F800000,%fp0 # RETURN 1 + X
- mov.l (%a0),%d1
- or.l &0x00800001,%d1
- fadd.s %d1,%fp0
- bra t_pinx2
-
- global stentox
-#--ENTRY POINT FOR 10**(X), HERE X IS FINITE, NON-ZERO, AND NOT NAN'S
-stentox:
- fmovm.x (%a0),&0x80 # LOAD INPUT
-
- mov.l (%a0),%d1
- mov.w 4(%a0),%d1
- fmov.x %fp0,X(%a6)
- and.l &0x7FFFFFFF,%d1
-
- cmp.l %d1,&0x3FB98000 # |X| >= 2**(-70)?
- bge.b TENOK1
- bra.w EXPBORS
-
-TENOK1:
- cmp.l %d1,&0x400B9B07 # |X| <= 16480*log2/log10 ?
- ble.b TENMAIN
- bra.w EXPBORS
-
-TENMAIN:
-#--USUAL CASE, 2^(-70) <= |X| <= 16480 LOG 2 / LOG 10
-
- fmov.x %fp0,%fp1
- fmul.d L2TEN64(%pc),%fp1 # X*64*LOG10/LOG2
- fmov.l %fp1,INT(%a6) # N=INT(X*64*LOG10/LOG2)
- mov.l %d2,-(%sp)
- lea TEXPTBL(%pc),%a1 # LOAD ADDRESS OF TABLE OF 2^(J/64)
- fmov.l INT(%a6),%fp1 # N --> FLOATING FMT
- mov.l INT(%a6),%d1
- mov.l %d1,%d2
- and.l &0x3F,%d1 # D0 IS J
- asl.l &4,%d1 # DISPLACEMENT FOR 2^(J/64)
- add.l %d1,%a1 # ADDRESS FOR 2^(J/64)
- asr.l &6,%d2 # d2 IS L, N = 64L + J
- mov.l %d2,%d1
- asr.l &1,%d1 # D0 IS M
- sub.l %d1,%d2 # d2 IS M', N = 64(M+M') + J
- add.l &0x3FFF,%d2
-
-#--SUMMARY: a1 IS ADDRESS FOR THE LEADING PORTION OF 2^(J/64),
-#--D0 IS M WHERE N = 64(M+M') + J. NOTE THAT |M| <= 16140 BY DESIGN.
-#--ADJFACT = 2^(M').
-#--REGISTERS SAVED SO FAR ARE (IN ORDER) FPCR, D0, FP1, a1, AND FP2.
- fmovm.x &0x0c,-(%sp) # save fp2/fp3
-
- fmov.x %fp1,%fp2
-
- fmul.d L10TWO1(%pc),%fp1 # N*(LOG2/64LOG10)_LEAD
- mov.l (%a1)+,FACT1(%a6)
-
- fmul.x L10TWO2(%pc),%fp2 # N*(LOG2/64LOG10)_TRAIL
-
- mov.l (%a1)+,FACT1HI(%a6)
- mov.l (%a1)+,FACT1LOW(%a6)
- fsub.x %fp1,%fp0 # X - N L_LEAD
- mov.w (%a1)+,FACT2(%a6)
-
- fsub.x %fp2,%fp0 # X - N L_TRAIL
-
- mov.w (%a1)+,FACT2HI(%a6)
- clr.w FACT2HI+2(%a6)
- clr.l FACT2LOW(%a6)
-
- fmul.x LOG10(%pc),%fp0 # FP0 IS R
- add.w %d1,FACT1(%a6)
- add.w %d1,FACT2(%a6)
-
-expr:
-#--FPCR, FP2, FP3 ARE SAVED IN ORDER AS SHOWN.
-#--ADJFACT CONTAINS 2**(M'), FACT1 + FACT2 = 2**(M) * 2**(J/64).
-#--FP0 IS R. THE FOLLOWING CODE COMPUTES
-#-- 2**(M'+M) * 2**(J/64) * EXP(R)
-
- fmov.x %fp0,%fp1
- fmul.x %fp1,%fp1 # FP1 IS S = R*R
-
- fmov.d EXPA5(%pc),%fp2 # FP2 IS A5
- fmov.d EXPA4(%pc),%fp3 # FP3 IS A4
-
- fmul.x %fp1,%fp2 # FP2 IS S*A5
- fmul.x %fp1,%fp3 # FP3 IS S*A4
-
- fadd.d EXPA3(%pc),%fp2 # FP2 IS A3+S*A5
- fadd.d EXPA2(%pc),%fp3 # FP3 IS A2+S*A4
-
- fmul.x %fp1,%fp2 # FP2 IS S*(A3+S*A5)
- fmul.x %fp1,%fp3 # FP3 IS S*(A2+S*A4)
-
- fadd.d EXPA1(%pc),%fp2 # FP2 IS A1+S*(A3+S*A5)
- fmul.x %fp0,%fp3 # FP3 IS R*S*(A2+S*A4)
-
- fmul.x %fp1,%fp2 # FP2 IS S*(A1+S*(A3+S*A5))
- fadd.x %fp3,%fp0 # FP0 IS R+R*S*(A2+S*A4)
- fadd.x %fp2,%fp0 # FP0 IS EXP(R) - 1
-
- fmovm.x (%sp)+,&0x30 # restore fp2/fp3
-
-#--FINAL RECONSTRUCTION PROCESS
-#--EXP(X) = 2^M*2^(J/64) + 2^M*2^(J/64)*(EXP(R)-1) - (1 OR 0)
-
- fmul.x FACT1(%a6),%fp0
- fadd.x FACT2(%a6),%fp0
- fadd.x FACT1(%a6),%fp0
-
- fmov.l %d0,%fpcr # restore users round prec,mode
- mov.w %d2,ADJFACT(%a6) # INSERT EXPONENT
- mov.l (%sp)+,%d2
- mov.l &0x80000000,ADJFACT+4(%a6)
- clr.l ADJFACT+8(%a6)
- mov.b &FMUL_OP,%d1 # last inst is MUL
- fmul.x ADJFACT(%a6),%fp0 # FINAL ADJUSTMENT
- bra t_catch
-
- global stentoxd
-stentoxd:
-#--ENTRY POINT FOR 10**(X) FOR DENORMALIZED ARGUMENT
-
- fmov.l %d0,%fpcr # set user's rounding mode/precision
- fmov.s &0x3F800000,%fp0 # RETURN 1 + X
- mov.l (%a0),%d1
- or.l &0x00800001,%d1
- fadd.s %d1,%fp0
- bra t_pinx2
-
-#########################################################################
-# smovcr(): returns the ROM constant at the offset specified in d1 #
-# rounded to the mode and precision specified in d0. #
-# #
-# INPUT *************************************************************** #
-# d0 = rnd prec,mode #
-# d1 = ROM offset #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = the ROM constant rounded to the user's rounding mode,prec #
-# #
-#########################################################################
-
- global smovcr
-smovcr:
- mov.l %d1,-(%sp) # save rom offset for a sec
-
- lsr.b &0x4,%d0 # shift ctrl bits to lo
- mov.l %d0,%d1 # make a copy
- andi.w &0x3,%d1 # extract rnd mode
- andi.w &0xc,%d0 # extract rnd prec
- swap %d0 # put rnd prec in hi
- mov.w %d1,%d0 # put rnd mode in lo
-
- mov.l (%sp)+,%d1 # get rom offset
-
-#
-# check range of offset
-#
- tst.b %d1 # if zero, offset is to pi
- beq.b pi_tbl # it is pi
- cmpi.b %d1,&0x0a # check range $01 - $0a
- ble.b z_val # if in this range, return zero
- cmpi.b %d1,&0x0e # check range $0b - $0e
- ble.b sm_tbl # valid constants in this range
- cmpi.b %d1,&0x2f # check range $10 - $2f
- ble.b z_val # if in this range, return zero
- cmpi.b %d1,&0x3f # check range $30 - $3f
- ble.b bg_tbl # valid constants in this range
-
-z_val:
- bra.l ld_pzero # return a zero
-
-#
-# the answer is PI rounded to the proper precision.
-#
-# fetch a pointer to the answer table relating to the proper rounding
-# precision.
-#
-pi_tbl:
- tst.b %d0 # is rmode RN?
- bne.b pi_not_rn # no
-pi_rn:
- lea.l PIRN(%pc),%a0 # yes; load PI RN table addr
- bra.w set_finx
-pi_not_rn:
- cmpi.b %d0,&rp_mode # is rmode RP?
- beq.b pi_rp # yes
-pi_rzrm:
- lea.l PIRZRM(%pc),%a0 # no; load PI RZ,RM table addr
- bra.b set_finx
-pi_rp:
- lea.l PIRP(%pc),%a0 # load PI RP table addr
- bra.b set_finx
-
-#
-# the answer is one of:
-# $0B log10(2) (inexact)
-# $0C e (inexact)
-# $0D log2(e) (inexact)
-# $0E log10(e) (exact)
-#
-# fetch a pointer to the answer table relating to the proper rounding
-# precision.
-#
-sm_tbl:
- subi.b &0xb,%d1 # make offset in 0-4 range
- tst.b %d0 # is rmode RN?
- bne.b sm_not_rn # no
-sm_rn:
- lea.l SMALRN(%pc),%a0 # yes; load RN table addr
-sm_tbl_cont:
- cmpi.b %d1,&0x2 # is result log10(e)?
- ble.b set_finx # no; answer is inexact
- bra.b no_finx # yes; answer is exact
-sm_not_rn:
- cmpi.b %d0,&rp_mode # is rmode RP?
- beq.b sm_rp # yes
-sm_rzrm:
- lea.l SMALRZRM(%pc),%a0 # no; load RZ,RM table addr
- bra.b sm_tbl_cont
-sm_rp:
- lea.l SMALRP(%pc),%a0 # load RP table addr
- bra.b sm_tbl_cont
-
-#
-# the answer is one of:
-# $30 ln(2) (inexact)
-# $31 ln(10) (inexact)
-# $32 10^0 (exact)
-# $33 10^1 (exact)
-# $34 10^2 (exact)
-# $35 10^4 (exact)
-# $36 10^8 (exact)
-# $37 10^16 (exact)
-# $38 10^32 (inexact)
-# $39 10^64 (inexact)
-# $3A 10^128 (inexact)
-# $3B 10^256 (inexact)
-# $3C 10^512 (inexact)
-# $3D 10^1024 (inexact)
-# $3E 10^2048 (inexact)
-# $3F 10^4096 (inexact)
-#
-# fetch a pointer to the answer table relating to the proper rounding
-# precision.
-#
-bg_tbl:
- subi.b &0x30,%d1 # make offset in 0-f range
- tst.b %d0 # is rmode RN?
- bne.b bg_not_rn # no
-bg_rn:
- lea.l BIGRN(%pc),%a0 # yes; load RN table addr
-bg_tbl_cont:
- cmpi.b %d1,&0x1 # is offset <= $31?
- ble.b set_finx # yes; answer is inexact
- cmpi.b %d1,&0x7 # is $32 <= offset <= $37?
- ble.b no_finx # yes; answer is exact
- bra.b set_finx # no; answer is inexact
-bg_not_rn:
- cmpi.b %d0,&rp_mode # is rmode RP?
- beq.b bg_rp # yes
-bg_rzrm:
- lea.l BIGRZRM(%pc),%a0 # no; load RZ,RM table addr
- bra.b bg_tbl_cont
-bg_rp:
- lea.l BIGRP(%pc),%a0 # load RP table addr
- bra.b bg_tbl_cont
-
-# answer is inexact, so set INEX2 and AINEX in the user's FPSR.
-set_finx:
- ori.l &inx2a_mask,USER_FPSR(%a6) # set INEX2/AINEX
-no_finx:
- mulu.w &0xc,%d1 # offset points into tables
- swap %d0 # put rnd prec in lo word
- tst.b %d0 # is precision extended?
-
- bne.b not_ext # if xprec, do not call round
-
-# Precision is extended
- fmovm.x (%a0,%d1.w),&0x80 # return result in fp0
- rts
-
-# Precision is single or double
-not_ext:
- swap %d0 # rnd prec in upper word
-
-# call round() to round the answer to the proper precision.
-# exponents out of range for single or double DO NOT cause underflow
-# or overflow.
- mov.w 0x0(%a0,%d1.w),FP_SCR1_EX(%a6) # load first word
- mov.l 0x4(%a0,%d1.w),FP_SCR1_HI(%a6) # load second word
- mov.l 0x8(%a0,%d1.w),FP_SCR1_LO(%a6) # load third word
- mov.l %d0,%d1
- clr.l %d0 # clear g,r,s
- lea FP_SCR1(%a6),%a0 # pass ptr to answer
- clr.w LOCAL_SGN(%a0) # sign always positive
- bsr.l _round # round the mantissa
-
- fmovm.x (%a0),&0x80 # return rounded result in fp0
- rts
-
- align 0x4
-
-PIRN: long 0x40000000,0xc90fdaa2,0x2168c235 # pi
-PIRZRM: long 0x40000000,0xc90fdaa2,0x2168c234 # pi
-PIRP: long 0x40000000,0xc90fdaa2,0x2168c235 # pi
-
-SMALRN: long 0x3ffd0000,0x9a209a84,0xfbcff798 # log10(2)
- long 0x40000000,0xadf85458,0xa2bb4a9a # e
- long 0x3fff0000,0xb8aa3b29,0x5c17f0bc # log2(e)
- long 0x3ffd0000,0xde5bd8a9,0x37287195 # log10(e)
- long 0x00000000,0x00000000,0x00000000 # 0.0
-
-SMALRZRM:
- long 0x3ffd0000,0x9a209a84,0xfbcff798 # log10(2)
- long 0x40000000,0xadf85458,0xa2bb4a9a # e
- long 0x3fff0000,0xb8aa3b29,0x5c17f0bb # log2(e)
- long 0x3ffd0000,0xde5bd8a9,0x37287195 # log10(e)
- long 0x00000000,0x00000000,0x00000000 # 0.0
-
-SMALRP: long 0x3ffd0000,0x9a209a84,0xfbcff799 # log10(2)
- long 0x40000000,0xadf85458,0xa2bb4a9b # e
- long 0x3fff0000,0xb8aa3b29,0x5c17f0bc # log2(e)
- long 0x3ffd0000,0xde5bd8a9,0x37287195 # log10(e)
- long 0x00000000,0x00000000,0x00000000 # 0.0
-
-BIGRN: long 0x3ffe0000,0xb17217f7,0xd1cf79ac # ln(2)
- long 0x40000000,0x935d8ddd,0xaaa8ac17 # ln(10)
-
- long 0x3fff0000,0x80000000,0x00000000 # 10 ^ 0
- long 0x40020000,0xA0000000,0x00000000 # 10 ^ 1
- long 0x40050000,0xC8000000,0x00000000 # 10 ^ 2
- long 0x400C0000,0x9C400000,0x00000000 # 10 ^ 4
- long 0x40190000,0xBEBC2000,0x00000000 # 10 ^ 8
- long 0x40340000,0x8E1BC9BF,0x04000000 # 10 ^ 16
- long 0x40690000,0x9DC5ADA8,0x2B70B59E # 10 ^ 32
- long 0x40D30000,0xC2781F49,0xFFCFA6D5 # 10 ^ 64
- long 0x41A80000,0x93BA47C9,0x80E98CE0 # 10 ^ 128
- long 0x43510000,0xAA7EEBFB,0x9DF9DE8E # 10 ^ 256
- long 0x46A30000,0xE319A0AE,0xA60E91C7 # 10 ^ 512
- long 0x4D480000,0xC9767586,0x81750C17 # 10 ^ 1024
- long 0x5A920000,0x9E8B3B5D,0xC53D5DE5 # 10 ^ 2048
- long 0x75250000,0xC4605202,0x8A20979B # 10 ^ 4096
-
-BIGRZRM:
- long 0x3ffe0000,0xb17217f7,0xd1cf79ab # ln(2)
- long 0x40000000,0x935d8ddd,0xaaa8ac16 # ln(10)
-
- long 0x3fff0000,0x80000000,0x00000000 # 10 ^ 0
- long 0x40020000,0xA0000000,0x00000000 # 10 ^ 1
- long 0x40050000,0xC8000000,0x00000000 # 10 ^ 2
- long 0x400C0000,0x9C400000,0x00000000 # 10 ^ 4
- long 0x40190000,0xBEBC2000,0x00000000 # 10 ^ 8
- long 0x40340000,0x8E1BC9BF,0x04000000 # 10 ^ 16
- long 0x40690000,0x9DC5ADA8,0x2B70B59D # 10 ^ 32
- long 0x40D30000,0xC2781F49,0xFFCFA6D5 # 10 ^ 64
- long 0x41A80000,0x93BA47C9,0x80E98CDF # 10 ^ 128
- long 0x43510000,0xAA7EEBFB,0x9DF9DE8D # 10 ^ 256
- long 0x46A30000,0xE319A0AE,0xA60E91C6 # 10 ^ 512
- long 0x4D480000,0xC9767586,0x81750C17 # 10 ^ 1024
- long 0x5A920000,0x9E8B3B5D,0xC53D5DE4 # 10 ^ 2048
- long 0x75250000,0xC4605202,0x8A20979A # 10 ^ 4096
-
-BIGRP:
- long 0x3ffe0000,0xb17217f7,0xd1cf79ac # ln(2)
- long 0x40000000,0x935d8ddd,0xaaa8ac17 # ln(10)
-
- long 0x3fff0000,0x80000000,0x00000000 # 10 ^ 0
- long 0x40020000,0xA0000000,0x00000000 # 10 ^ 1
- long 0x40050000,0xC8000000,0x00000000 # 10 ^ 2
- long 0x400C0000,0x9C400000,0x00000000 # 10 ^ 4
- long 0x40190000,0xBEBC2000,0x00000000 # 10 ^ 8
- long 0x40340000,0x8E1BC9BF,0x04000000 # 10 ^ 16
- long 0x40690000,0x9DC5ADA8,0x2B70B59E # 10 ^ 32
- long 0x40D30000,0xC2781F49,0xFFCFA6D6 # 10 ^ 64
- long 0x41A80000,0x93BA47C9,0x80E98CE0 # 10 ^ 128
- long 0x43510000,0xAA7EEBFB,0x9DF9DE8E # 10 ^ 256
- long 0x46A30000,0xE319A0AE,0xA60E91C7 # 10 ^ 512
- long 0x4D480000,0xC9767586,0x81750C18 # 10 ^ 1024
- long 0x5A920000,0x9E8B3B5D,0xC53D5DE5 # 10 ^ 2048
- long 0x75250000,0xC4605202,0x8A20979B # 10 ^ 4096
-
-#########################################################################
-# sscale(): computes the destination operand scaled by the source #
-# operand. If the absoulute value of the source operand is #
-# >= 2^14, an overflow or underflow is returned. #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to double-extended source operand X #
-# a1 = pointer to double-extended destination operand Y #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = scale(X,Y) #
-# #
-#########################################################################
-
-set SIGN, L_SCR1
-
- global sscale
-sscale:
- mov.l %d0,-(%sp) # store off ctrl bits for now
-
- mov.w DST_EX(%a1),%d1 # get dst exponent
- smi.b SIGN(%a6) # use SIGN to hold dst sign
- andi.l &0x00007fff,%d1 # strip sign from dst exp
-
- mov.w SRC_EX(%a0),%d0 # check src bounds
- andi.w &0x7fff,%d0 # clr src sign bit
- cmpi.w %d0,&0x3fff # is src ~ ZERO?
- blt.w src_small # yes
- cmpi.w %d0,&0x400c # no; is src too big?
- bgt.w src_out # yes
-
-#
-# Source is within 2^14 range.
-#
-src_ok:
- fintrz.x SRC(%a0),%fp0 # calc int of src
- fmov.l %fp0,%d0 # int src to d0
-# don't want any accrued bits from the fintrz showing up later since
-# we may need to read the fpsr for the last fp op in t_catch2().
- fmov.l &0x0,%fpsr
-
- tst.b DST_HI(%a1) # is dst denormalized?
- bmi.b sok_norm
-
-# the dst is a DENORM. normalize the DENORM and add the adjustment to
-# the src value. then, jump to the norm part of the routine.
-sok_dnrm:
- mov.l %d0,-(%sp) # save src for now
-
- mov.w DST_EX(%a1),FP_SCR0_EX(%a6) # make a copy
- mov.l DST_HI(%a1),FP_SCR0_HI(%a6)
- mov.l DST_LO(%a1),FP_SCR0_LO(%a6)
-
- lea FP_SCR0(%a6),%a0 # pass ptr to DENORM
- bsr.l norm # normalize the DENORM
- neg.l %d0
- add.l (%sp)+,%d0 # add adjustment to src
-
- fmovm.x FP_SCR0(%a6),&0x80 # load normalized DENORM
-
- cmpi.w %d0,&-0x3fff # is the shft amt really low?
- bge.b sok_norm2 # thank goodness no
-
-# the multiply factor that we're trying to create should be a denorm
-# for the multiply to work. therefore, we're going to actually do a
-# multiply with a denorm which will cause an unimplemented data type
-# exception to be put into the machine which will be caught and corrected
-# later. we don't do this with the DENORMs above because this method
-# is slower. but, don't fret, I don't see it being used much either.
- fmov.l (%sp)+,%fpcr # restore user fpcr
- mov.l &0x80000000,%d1 # load normalized mantissa
- subi.l &-0x3fff,%d0 # how many should we shift?
- neg.l %d0 # make it positive
- cmpi.b %d0,&0x20 # is it > 32?
- bge.b sok_dnrm_32 # yes
- lsr.l %d0,%d1 # no; bit stays in upper lw
- clr.l -(%sp) # insert zero low mantissa
- mov.l %d1,-(%sp) # insert new high mantissa
- clr.l -(%sp) # make zero exponent
- bra.b sok_norm_cont
-sok_dnrm_32:
- subi.b &0x20,%d0 # get shift count
- lsr.l %d0,%d1 # make low mantissa longword
- mov.l %d1,-(%sp) # insert new low mantissa
- clr.l -(%sp) # insert zero high mantissa
- clr.l -(%sp) # make zero exponent
- bra.b sok_norm_cont
-
-# the src will force the dst to a DENORM value or worse. so, let's
-# create an fp multiply that will create the result.
-sok_norm:
- fmovm.x DST(%a1),&0x80 # load fp0 with normalized src
-sok_norm2:
- fmov.l (%sp)+,%fpcr # restore user fpcr
-
- addi.w &0x3fff,%d0 # turn src amt into exp value
- swap %d0 # put exponent in high word
- clr.l -(%sp) # insert new exponent
- mov.l &0x80000000,-(%sp) # insert new high mantissa
- mov.l %d0,-(%sp) # insert new lo mantissa
-
-sok_norm_cont:
- fmov.l %fpcr,%d0 # d0 needs fpcr for t_catch2
- mov.b &FMUL_OP,%d1 # last inst is MUL
- fmul.x (%sp)+,%fp0 # do the multiply
- bra t_catch2 # catch any exceptions
-
-#
-# Source is outside of 2^14 range. Test the sign and branch
-# to the appropriate exception handler.
-#
-src_out:
- mov.l (%sp)+,%d0 # restore ctrl bits
- exg %a0,%a1 # swap src,dst ptrs
- tst.b SRC_EX(%a1) # is src negative?
- bmi t_unfl # yes; underflow
- bra t_ovfl_sc # no; overflow
-
-#
-# The source input is below 1, so we check for denormalized numbers
-# and set unfl.
-#
-src_small:
- tst.b DST_HI(%a1) # is dst denormalized?
- bpl.b ssmall_done # yes
-
- mov.l (%sp)+,%d0
- fmov.l %d0,%fpcr # no; load control bits
- mov.b &FMOV_OP,%d1 # last inst is MOVE
- fmov.x DST(%a1),%fp0 # simply return dest
- bra t_catch2
-ssmall_done:
- mov.l (%sp)+,%d0 # load control bits into d1
- mov.l %a1,%a0 # pass ptr to dst
- bra t_resdnrm
-
-#########################################################################
-# smod(): computes the fp MOD of the input values X,Y. #
-# srem(): computes the fp (IEEE) REM of the input values X,Y. #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision input X #
-# a1 = pointer to extended precision input Y #
-# d0 = round precision,mode #
-# #
-# The input operands X and Y can be either normalized or #
-# denormalized. #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = FREM(X,Y) or FMOD(X,Y) #
-# #
-# ALGORITHM *********************************************************** #
-# #
-# Step 1. Save and strip signs of X and Y: signX := sign(X), #
-# signY := sign(Y), X := |X|, Y := |Y|, #
-# signQ := signX EOR signY. Record whether MOD or REM #
-# is requested. #
-# #
-# Step 2. Set L := expo(X)-expo(Y), k := 0, Q := 0. #
-# If (L < 0) then #
-# R := X, go to Step 4. #
-# else #
-# R := 2^(-L)X, j := L. #
-# endif #
-# #
-# Step 3. Perform MOD(X,Y) #
-# 3.1 If R = Y, go to Step 9. #
-# 3.2 If R > Y, then { R := R - Y, Q := Q + 1} #
-# 3.3 If j = 0, go to Step 4. #
-# 3.4 k := k + 1, j := j - 1, Q := 2Q, R := 2R. Go to #
-# Step 3.1. #
-# #
-# Step 4. At this point, R = X - QY = MOD(X,Y). Set #
-# Last_Subtract := false (used in Step 7 below). If #
-# MOD is requested, go to Step 6. #
-# #
-# Step 5. R = MOD(X,Y), but REM(X,Y) is requested. #
-# 5.1 If R < Y/2, then R = MOD(X,Y) = REM(X,Y). Go to #
-# Step 6. #
-# 5.2 If R > Y/2, then { set Last_Subtract := true, #
-# Q := Q + 1, Y := signY*Y }. Go to Step 6. #
-# 5.3 This is the tricky case of R = Y/2. If Q is odd, #
-# then { Q := Q + 1, signX := -signX }. #
-# #
-# Step 6. R := signX*R. #
-# #
-# Step 7. If Last_Subtract = true, R := R - Y. #
-# #
-# Step 8. Return signQ, last 7 bits of Q, and R as required. #
-# #
-# Step 9. At this point, R = 2^(-j)*X - Q Y = Y. Thus, #
-# X = 2^(j)*(Q+1)Y. set Q := 2^(j)*(Q+1), #
-# R := 0. Return signQ, last 7 bits of Q, and R. #
-# #
-#########################################################################
-
- set Mod_Flag,L_SCR3
- set Sc_Flag,L_SCR3+1
-
- set SignY,L_SCR2
- set SignX,L_SCR2+2
- set SignQ,L_SCR3+2
-
- set Y,FP_SCR0
- set Y_Hi,Y+4
- set Y_Lo,Y+8
-
- set R,FP_SCR1
- set R_Hi,R+4
- set R_Lo,R+8
-
-Scale:
- long 0x00010000,0x80000000,0x00000000,0x00000000
-
- global smod
-smod:
- clr.b FPSR_QBYTE(%a6)
- mov.l %d0,-(%sp) # save ctrl bits
- clr.b Mod_Flag(%a6)
- bra.b Mod_Rem
-
- global srem
-srem:
- clr.b FPSR_QBYTE(%a6)
- mov.l %d0,-(%sp) # save ctrl bits
- mov.b &0x1,Mod_Flag(%a6)
-
-Mod_Rem:
-#..Save sign of X and Y
- movm.l &0x3f00,-(%sp) # save data registers
- mov.w SRC_EX(%a0),%d3
- mov.w %d3,SignY(%a6)
- and.l &0x00007FFF,%d3 # Y := |Y|
-
-#
- mov.l SRC_HI(%a0),%d4
- mov.l SRC_LO(%a0),%d5 # (D3,D4,D5) is |Y|
-
- tst.l %d3
- bne.b Y_Normal
-
- mov.l &0x00003FFE,%d3 # $3FFD + 1
- tst.l %d4
- bne.b HiY_not0
-
-HiY_0:
- mov.l %d5,%d4
- clr.l %d5
- sub.l &32,%d3
- clr.l %d6
- bfffo %d4{&0:&32},%d6
- lsl.l %d6,%d4
- sub.l %d6,%d3 # (D3,D4,D5) is normalized
-# ...with bias $7FFD
- bra.b Chk_X
-
-HiY_not0:
- clr.l %d6
- bfffo %d4{&0:&32},%d6
- sub.l %d6,%d3
- lsl.l %d6,%d4
- mov.l %d5,%d7 # a copy of D5
- lsl.l %d6,%d5
- neg.l %d6
- add.l &32,%d6
- lsr.l %d6,%d7
- or.l %d7,%d4 # (D3,D4,D5) normalized
-# ...with bias $7FFD
- bra.b Chk_X
-
-Y_Normal:
- add.l &0x00003FFE,%d3 # (D3,D4,D5) normalized
-# ...with bias $7FFD
-
-Chk_X:
- mov.w DST_EX(%a1),%d0
- mov.w %d0,SignX(%a6)
- mov.w SignY(%a6),%d1
- eor.l %d0,%d1
- and.l &0x00008000,%d1
- mov.w %d1,SignQ(%a6) # sign(Q) obtained
- and.l &0x00007FFF,%d0
- mov.l DST_HI(%a1),%d1
- mov.l DST_LO(%a1),%d2 # (D0,D1,D2) is |X|
- tst.l %d0
- bne.b X_Normal
- mov.l &0x00003FFE,%d0
- tst.l %d1
- bne.b HiX_not0
-
-HiX_0:
- mov.l %d2,%d1
- clr.l %d2
- sub.l &32,%d0
- clr.l %d6
- bfffo %d1{&0:&32},%d6
- lsl.l %d6,%d1
- sub.l %d6,%d0 # (D0,D1,D2) is normalized
-# ...with bias $7FFD
- bra.b Init
-
-HiX_not0:
- clr.l %d6
- bfffo %d1{&0:&32},%d6
- sub.l %d6,%d0
- lsl.l %d6,%d1
- mov.l %d2,%d7 # a copy of D2
- lsl.l %d6,%d2
- neg.l %d6
- add.l &32,%d6
- lsr.l %d6,%d7
- or.l %d7,%d1 # (D0,D1,D2) normalized
-# ...with bias $7FFD
- bra.b Init
-
-X_Normal:
- add.l &0x00003FFE,%d0 # (D0,D1,D2) normalized
-# ...with bias $7FFD
-
-Init:
-#
- mov.l %d3,L_SCR1(%a6) # save biased exp(Y)
- mov.l %d0,-(%sp) # save biased exp(X)
- sub.l %d3,%d0 # L := expo(X)-expo(Y)
-
- clr.l %d6 # D6 := carry <- 0
- clr.l %d3 # D3 is Q
- mov.l &0,%a1 # A1 is k; j+k=L, Q=0
-
-#..(Carry,D1,D2) is R
- tst.l %d0
- bge.b Mod_Loop_pre
-
-#..expo(X) < expo(Y). Thus X = mod(X,Y)
-#
- mov.l (%sp)+,%d0 # restore d0
- bra.w Get_Mod
-
-Mod_Loop_pre:
- addq.l &0x4,%sp # erase exp(X)
-#..At this point R = 2^(-L)X; Q = 0; k = 0; and k+j = L
-Mod_Loop:
- tst.l %d6 # test carry bit
- bgt.b R_GT_Y
-
-#..At this point carry = 0, R = (D1,D2), Y = (D4,D5)
- cmp.l %d1,%d4 # compare hi(R) and hi(Y)
- bne.b R_NE_Y
- cmp.l %d2,%d5 # compare lo(R) and lo(Y)
- bne.b R_NE_Y
-
-#..At this point, R = Y
- bra.w Rem_is_0
-
-R_NE_Y:
-#..use the borrow of the previous compare
- bcs.b R_LT_Y # borrow is set iff R < Y
-
-R_GT_Y:
-#..If Carry is set, then Y < (Carry,D1,D2) < 2Y. Otherwise, Carry = 0
-#..and Y < (D1,D2) < 2Y. Either way, perform R - Y
- sub.l %d5,%d2 # lo(R) - lo(Y)
- subx.l %d4,%d1 # hi(R) - hi(Y)
- clr.l %d6 # clear carry
- addq.l &1,%d3 # Q := Q + 1
-
-R_LT_Y:
-#..At this point, Carry=0, R < Y. R = 2^(k-L)X - QY; k+j = L; j >= 0.
- tst.l %d0 # see if j = 0.
- beq.b PostLoop
-
- add.l %d3,%d3 # Q := 2Q
- add.l %d2,%d2 # lo(R) = 2lo(R)
- roxl.l &1,%d1 # hi(R) = 2hi(R) + carry
- scs %d6 # set Carry if 2(R) overflows
- addq.l &1,%a1 # k := k+1
- subq.l &1,%d0 # j := j - 1
-#..At this point, R=(Carry,D1,D2) = 2^(k-L)X - QY, j+k=L, j >= 0, R < 2Y.
-
- bra.b Mod_Loop
-
-PostLoop:
-#..k = L, j = 0, Carry = 0, R = (D1,D2) = X - QY, R < Y.
-
-#..normalize R.
- mov.l L_SCR1(%a6),%d0 # new biased expo of R
- tst.l %d1
- bne.b HiR_not0
-
-HiR_0:
- mov.l %d2,%d1
- clr.l %d2
- sub.l &32,%d0
- clr.l %d6
- bfffo %d1{&0:&32},%d6
- lsl.l %d6,%d1
- sub.l %d6,%d0 # (D0,D1,D2) is normalized
-# ...with bias $7FFD
- bra.b Get_Mod
-
-HiR_not0:
- clr.l %d6
- bfffo %d1{&0:&32},%d6
- bmi.b Get_Mod # already normalized
- sub.l %d6,%d0
- lsl.l %d6,%d1
- mov.l %d2,%d7 # a copy of D2
- lsl.l %d6,%d2
- neg.l %d6
- add.l &32,%d6
- lsr.l %d6,%d7
- or.l %d7,%d1 # (D0,D1,D2) normalized
-
-#
-Get_Mod:
- cmp.l %d0,&0x000041FE
- bge.b No_Scale
-Do_Scale:
- mov.w %d0,R(%a6)
- mov.l %d1,R_Hi(%a6)
- mov.l %d2,R_Lo(%a6)
- mov.l L_SCR1(%a6),%d6
- mov.w %d6,Y(%a6)
- mov.l %d4,Y_Hi(%a6)
- mov.l %d5,Y_Lo(%a6)
- fmov.x R(%a6),%fp0 # no exception
- mov.b &1,Sc_Flag(%a6)
- bra.b ModOrRem
-No_Scale:
- mov.l %d1,R_Hi(%a6)
- mov.l %d2,R_Lo(%a6)
- sub.l &0x3FFE,%d0
- mov.w %d0,R(%a6)
- mov.l L_SCR1(%a6),%d6
- sub.l &0x3FFE,%d6
- mov.l %d6,L_SCR1(%a6)
- fmov.x R(%a6),%fp0
- mov.w %d6,Y(%a6)
- mov.l %d4,Y_Hi(%a6)
- mov.l %d5,Y_Lo(%a6)
- clr.b Sc_Flag(%a6)
-
-#
-ModOrRem:
- tst.b Mod_Flag(%a6)
- beq.b Fix_Sign
-
- mov.l L_SCR1(%a6),%d6 # new biased expo(Y)
- subq.l &1,%d6 # biased expo(Y/2)
- cmp.l %d0,%d6
- blt.b Fix_Sign
- bgt.b Last_Sub
-
- cmp.l %d1,%d4
- bne.b Not_EQ
- cmp.l %d2,%d5
- bne.b Not_EQ
- bra.w Tie_Case
-
-Not_EQ:
- bcs.b Fix_Sign
-
-Last_Sub:
-#
- fsub.x Y(%a6),%fp0 # no exceptions
- addq.l &1,%d3 # Q := Q + 1
-
-#
-Fix_Sign:
-#..Get sign of X
- mov.w SignX(%a6),%d6
- bge.b Get_Q
- fneg.x %fp0
-
-#..Get Q
-#
-Get_Q:
- clr.l %d6
- mov.w SignQ(%a6),%d6 # D6 is sign(Q)
- mov.l &8,%d7
- lsr.l %d7,%d6
- and.l &0x0000007F,%d3 # 7 bits of Q
- or.l %d6,%d3 # sign and bits of Q
-# swap %d3
-# fmov.l %fpsr,%d6
-# and.l &0xFF00FFFF,%d6
-# or.l %d3,%d6
-# fmov.l %d6,%fpsr # put Q in fpsr
- mov.b %d3,FPSR_QBYTE(%a6) # put Q in fpsr
-
-#
-Restore:
- movm.l (%sp)+,&0xfc # {%d2-%d7}
- mov.l (%sp)+,%d0
- fmov.l %d0,%fpcr
- tst.b Sc_Flag(%a6)
- beq.b Finish
- mov.b &FMUL_OP,%d1 # last inst is MUL
- fmul.x Scale(%pc),%fp0 # may cause underflow
- bra t_catch2
-# the '040 package did this apparently to see if the dst operand for the
-# preceding fmul was a denorm. but, it better not have been since the
-# algorithm just got done playing with fp0 and expected no exceptions
-# as a result. trust me...
-# bra t_avoid_unsupp # check for denorm as a
-# ;result of the scaling
-
-Finish:
- mov.b &FMOV_OP,%d1 # last inst is MOVE
- fmov.x %fp0,%fp0 # capture exceptions & round
- bra t_catch2
-
-Rem_is_0:
-#..R = 2^(-j)X - Q Y = Y, thus R = 0 and quotient = 2^j (Q+1)
- addq.l &1,%d3
- cmp.l %d0,&8 # D0 is j
- bge.b Q_Big
-
- lsl.l %d0,%d3
- bra.b Set_R_0
-
-Q_Big:
- clr.l %d3
-
-Set_R_0:
- fmov.s &0x00000000,%fp0
- clr.b Sc_Flag(%a6)
- bra.w Fix_Sign
-
-Tie_Case:
-#..Check parity of Q
- mov.l %d3,%d6
- and.l &0x00000001,%d6
- tst.l %d6
- beq.w Fix_Sign # Q is even
-
-#..Q is odd, Q := Q + 1, signX := -signX
- addq.l &1,%d3
- mov.w SignX(%a6),%d6
- eor.l &0x00008000,%d6
- mov.w %d6,SignX(%a6)
- bra.w Fix_Sign
-
-qnan: long 0x7fff0000, 0xffffffff, 0xffffffff
-
-#########################################################################
-# XDEF **************************************************************** #
-# t_dz(): Handle DZ exception during transcendental emulation. #
-# Sets N bit according to sign of source operand. #
-# t_dz2(): Handle DZ exception during transcendental emulation. #
-# Sets N bit always. #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to source operand #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = default result #
-# #
-# ALGORITHM *********************************************************** #
-# - Store properly signed INF into fp0. #
-# - Set FPSR exception status dz bit, ccode inf bit, and #
-# accrued dz bit. #
-# #
-#########################################################################
-
- global t_dz
-t_dz:
- tst.b SRC_EX(%a0) # no; is src negative?
- bmi.b t_dz2 # yes
-
-dz_pinf:
- fmov.s &0x7f800000,%fp0 # return +INF in fp0
- ori.l &dzinf_mask,USER_FPSR(%a6) # set I/DZ/ADZ
- rts
-
- global t_dz2
-t_dz2:
- fmov.s &0xff800000,%fp0 # return -INF in fp0
- ori.l &dzinf_mask+neg_mask,USER_FPSR(%a6) # set N/I/DZ/ADZ
- rts
-
-#################################################################
-# OPERR exception: #
-# - set FPSR exception status operr bit, condition code #
-# nan bit; Store default NAN into fp0 #
-#################################################################
- global t_operr
-t_operr:
- ori.l &opnan_mask,USER_FPSR(%a6) # set NaN/OPERR/AIOP
- fmovm.x qnan(%pc),&0x80 # return default NAN in fp0
- rts
-
-#################################################################
-# Extended DENORM: #
-# - For all functions that have a denormalized input and #
-# that f(x)=x, this is the entry point. #
-# - we only return the EXOP here if either underflow or #
-# inexact is enabled. #
-#################################################################
-
-# Entry point for scale w/ extended denorm. The function does
-# NOT set INEX2/AUNFL/AINEX.
- global t_resdnrm
-t_resdnrm:
- ori.l &unfl_mask,USER_FPSR(%a6) # set UNFL
- bra.b xdnrm_con
-
- global t_extdnrm
-t_extdnrm:
- ori.l &unfinx_mask,USER_FPSR(%a6) # set UNFL/INEX2/AUNFL/AINEX
-
-xdnrm_con:
- mov.l %a0,%a1 # make copy of src ptr
- mov.l %d0,%d1 # make copy of rnd prec,mode
- andi.b &0xc0,%d1 # extended precision?
- bne.b xdnrm_sd # no
-
-# result precision is extended.
- tst.b LOCAL_EX(%a0) # is denorm negative?
- bpl.b xdnrm_exit # no
-
- bset &neg_bit,FPSR_CC(%a6) # yes; set 'N' ccode bit
- bra.b xdnrm_exit
-
-# result precision is single or double
-xdnrm_sd:
- mov.l %a1,-(%sp)
- tst.b LOCAL_EX(%a0) # is denorm pos or neg?
- smi.b %d1 # set d0 accodingly
- bsr.l unf_sub
- mov.l (%sp)+,%a1
-xdnrm_exit:
- fmovm.x (%a0),&0x80 # return default result in fp0
-
- mov.b FPCR_ENABLE(%a6),%d0
- andi.b &0x0a,%d0 # is UNFL or INEX enabled?
- bne.b xdnrm_ena # yes
- rts
-
-################
-# unfl enabled #
-################
-# we have a DENORM that needs to be converted into an EXOP.
-# so, normalize the mantissa, add 0x6000 to the new exponent,
-# and return the result in fp1.
-xdnrm_ena:
- mov.w LOCAL_EX(%a1),FP_SCR0_EX(%a6)
- mov.l LOCAL_HI(%a1),FP_SCR0_HI(%a6)
- mov.l LOCAL_LO(%a1),FP_SCR0_LO(%a6)
-
- lea FP_SCR0(%a6),%a0
- bsr.l norm # normalize mantissa
- addi.l &0x6000,%d0 # add extra bias
- andi.w &0x8000,FP_SCR0_EX(%a6) # keep old sign
- or.w %d0,FP_SCR0_EX(%a6) # insert new exponent
-
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- rts
-
-#################################################################
-# UNFL exception: #
-# - This routine is for cases where even an EXOP isn't #
-# large enough to hold the range of this result. #
-# In such a case, the EXOP equals zero. #
-# - Return the default result to the proper precision #
-# with the sign of this result being the same as that #
-# of the src operand. #
-# - t_unfl2() is provided to force the result sign to #
-# positive which is the desired result for fetox(). #
-#################################################################
- global t_unfl
-t_unfl:
- ori.l &unfinx_mask,USER_FPSR(%a6) # set UNFL/INEX2/AUNFL/AINEX
-
- tst.b (%a0) # is result pos or neg?
- smi.b %d1 # set d1 accordingly
- bsr.l unf_sub # calc default unfl result
- fmovm.x (%a0),&0x80 # return default result in fp0
-
- fmov.s &0x00000000,%fp1 # return EXOP in fp1
- rts
-
-# t_unfl2 ALWAYS tells unf_sub to create a positive result
- global t_unfl2
-t_unfl2:
- ori.l &unfinx_mask,USER_FPSR(%a6) # set UNFL/INEX2/AUNFL/AINEX
-
- sf.b %d1 # set d0 to represent positive
- bsr.l unf_sub # calc default unfl result
- fmovm.x (%a0),&0x80 # return default result in fp0
-
- fmov.s &0x0000000,%fp1 # return EXOP in fp1
- rts
-
-#################################################################
-# OVFL exception: #
-# - This routine is for cases where even an EXOP isn't #
-# large enough to hold the range of this result. #
-# - Return the default result to the proper precision #
-# with the sign of this result being the same as that #
-# of the src operand. #
-# - t_ovfl2() is provided to force the result sign to #
-# positive which is the desired result for fcosh(). #
-# - t_ovfl_sc() is provided for scale() which only sets #
-# the inexact bits if the number is inexact for the #
-# precision indicated. #
-#################################################################
-
- global t_ovfl_sc
-t_ovfl_sc:
- ori.l &ovfl_inx_mask,USER_FPSR(%a6) # set OVFL/AOVFL/AINEX
-
- mov.b %d0,%d1 # fetch rnd mode/prec
- andi.b &0xc0,%d1 # extract rnd prec
- beq.b ovfl_work # prec is extended
-
- tst.b LOCAL_HI(%a0) # is dst a DENORM?
- bmi.b ovfl_sc_norm # no
-
-# dst op is a DENORM. we have to normalize the mantissa to see if the
-# result would be inexact for the given precision. make a copy of the
-# dst so we don't screw up the version passed to us.
- mov.w LOCAL_EX(%a0),FP_SCR0_EX(%a6)
- mov.l LOCAL_HI(%a0),FP_SCR0_HI(%a6)
- mov.l LOCAL_LO(%a0),FP_SCR0_LO(%a6)
- lea FP_SCR0(%a6),%a0 # pass ptr to FP_SCR0
- movm.l &0xc080,-(%sp) # save d0-d1/a0
- bsr.l norm # normalize mantissa
- movm.l (%sp)+,&0x0103 # restore d0-d1/a0
-
-ovfl_sc_norm:
- cmpi.b %d1,&0x40 # is prec dbl?
- bne.b ovfl_sc_dbl # no; sgl
-ovfl_sc_sgl:
- tst.l LOCAL_LO(%a0) # is lo lw of sgl set?
- bne.b ovfl_sc_inx # yes
- tst.b 3+LOCAL_HI(%a0) # is lo byte of hi lw set?
- bne.b ovfl_sc_inx # yes
- bra.b ovfl_work # don't set INEX2
-ovfl_sc_dbl:
- mov.l LOCAL_LO(%a0),%d1 # are any of lo 11 bits of
- andi.l &0x7ff,%d1 # dbl mantissa set?
- beq.b ovfl_work # no; don't set INEX2
-ovfl_sc_inx:
- ori.l &inex2_mask,USER_FPSR(%a6) # set INEX2
- bra.b ovfl_work # continue
-
- global t_ovfl
-t_ovfl:
- ori.l &ovfinx_mask,USER_FPSR(%a6) # set OVFL/INEX2/AOVFL/AINEX
-
-ovfl_work:
- tst.b LOCAL_EX(%a0) # what is the sign?
- smi.b %d1 # set d1 accordingly
- bsr.l ovf_res # calc default ovfl result
- mov.b %d0,FPSR_CC(%a6) # insert new ccodes
- fmovm.x (%a0),&0x80 # return default result in fp0
-
- fmov.s &0x00000000,%fp1 # return EXOP in fp1
- rts
-
-# t_ovfl2 ALWAYS tells ovf_res to create a positive result
- global t_ovfl2
-t_ovfl2:
- ori.l &ovfinx_mask,USER_FPSR(%a6) # set OVFL/INEX2/AOVFL/AINEX
-
- sf.b %d1 # clear sign flag for positive
- bsr.l ovf_res # calc default ovfl result
- mov.b %d0,FPSR_CC(%a6) # insert new ccodes
- fmovm.x (%a0),&0x80 # return default result in fp0
-
- fmov.s &0x00000000,%fp1 # return EXOP in fp1
- rts
-
-#################################################################
-# t_catch(): #
-# - the last operation of a transcendental emulation #
-# routine may have caused an underflow or overflow. #
-# we find out if this occurred by doing an fsave and #
-# checking the exception bit. if one did occur, then we #
-# jump to fgen_except() which creates the default #
-# result and EXOP for us. #
-#################################################################
- global t_catch
-t_catch:
-
- fsave -(%sp)
- tst.b 0x2(%sp)
- bmi.b catch
- add.l &0xc,%sp
-
-#################################################################
-# INEX2 exception: #
-# - The inex2 and ainex bits are set. #
-#################################################################
- global t_inx2
-t_inx2:
- fblt.w t_minx2
- fbeq.w inx2_zero
-
- global t_pinx2
-t_pinx2:
- ori.w &inx2a_mask,2+USER_FPSR(%a6) # set INEX2/AINEX
- rts
-
- global t_minx2
-t_minx2:
- ori.l &inx2a_mask+neg_mask,USER_FPSR(%a6) # set N/INEX2/AINEX
- rts
-
-inx2_zero:
- mov.b &z_bmask,FPSR_CC(%a6)
- ori.w &inx2a_mask,2+USER_FPSR(%a6) # set INEX2/AINEX
- rts
-
-# an underflow or overflow exception occurred.
-# we must set INEX/AINEX since the fmul/fdiv/fmov emulation may not!
-catch:
- ori.w &inx2a_mask,FPSR_EXCEPT(%a6)
-catch2:
- bsr.l fgen_except
- add.l &0xc,%sp
- rts
-
- global t_catch2
-t_catch2:
-
- fsave -(%sp)
-
- tst.b 0x2(%sp)
- bmi.b catch2
- add.l &0xc,%sp
-
- fmov.l %fpsr,%d0
- or.l %d0,USER_FPSR(%a6)
-
- rts
-
-#########################################################################
-
-#########################################################################
-# unf_res(): underflow default result calculation for transcendentals #
-# #
-# INPUT: #
-# d0 : rnd mode,precision #
-# d1.b : sign bit of result ('11111111 = (-) ; '00000000 = (+)) #
-# OUTPUT: #
-# a0 : points to result (in instruction memory) #
-#########################################################################
-unf_sub:
- ori.l &unfinx_mask,USER_FPSR(%a6)
-
- andi.w &0x10,%d1 # keep sign bit in 4th spot
-
- lsr.b &0x4,%d0 # shift rnd prec,mode to lo bits
- andi.b &0xf,%d0 # strip hi rnd mode bit
- or.b %d1,%d0 # concat {sgn,mode,prec}
-
- mov.l %d0,%d1 # make a copy
- lsl.b &0x1,%d1 # mult index 2 by 2
-
- mov.b (tbl_unf_cc.b,%pc,%d0.w*1),FPSR_CC(%a6) # insert ccode bits
- lea (tbl_unf_result.b,%pc,%d1.w*8),%a0 # grab result ptr
- rts
-
-tbl_unf_cc:
- byte 0x4, 0x4, 0x4, 0x0
- byte 0x4, 0x4, 0x4, 0x0
- byte 0x4, 0x4, 0x4, 0x0
- byte 0x0, 0x0, 0x0, 0x0
- byte 0x8+0x4, 0x8+0x4, 0x8, 0x8+0x4
- byte 0x8+0x4, 0x8+0x4, 0x8, 0x8+0x4
- byte 0x8+0x4, 0x8+0x4, 0x8, 0x8+0x4
-
-tbl_unf_result:
- long 0x00000000, 0x00000000, 0x00000000, 0x0 # ZERO;ext
- long 0x00000000, 0x00000000, 0x00000000, 0x0 # ZERO;ext
- long 0x00000000, 0x00000000, 0x00000000, 0x0 # ZERO;ext
- long 0x00000000, 0x00000000, 0x00000001, 0x0 # MIN; ext
-
- long 0x3f810000, 0x00000000, 0x00000000, 0x0 # ZERO;sgl
- long 0x3f810000, 0x00000000, 0x00000000, 0x0 # ZERO;sgl
- long 0x3f810000, 0x00000000, 0x00000000, 0x0 # ZERO;sgl
- long 0x3f810000, 0x00000100, 0x00000000, 0x0 # MIN; sgl
-
- long 0x3c010000, 0x00000000, 0x00000000, 0x0 # ZERO;dbl
- long 0x3c010000, 0x00000000, 0x00000000, 0x0 # ZER0;dbl
- long 0x3c010000, 0x00000000, 0x00000000, 0x0 # ZERO;dbl
- long 0x3c010000, 0x00000000, 0x00000800, 0x0 # MIN; dbl
-
- long 0x0,0x0,0x0,0x0
- long 0x0,0x0,0x0,0x0
- long 0x0,0x0,0x0,0x0
- long 0x0,0x0,0x0,0x0
-
- long 0x80000000, 0x00000000, 0x00000000, 0x0 # ZERO;ext
- long 0x80000000, 0x00000000, 0x00000000, 0x0 # ZERO;ext
- long 0x80000000, 0x00000000, 0x00000001, 0x0 # MIN; ext
- long 0x80000000, 0x00000000, 0x00000000, 0x0 # ZERO;ext
-
- long 0xbf810000, 0x00000000, 0x00000000, 0x0 # ZERO;sgl
- long 0xbf810000, 0x00000000, 0x00000000, 0x0 # ZERO;sgl
- long 0xbf810000, 0x00000100, 0x00000000, 0x0 # MIN; sgl
- long 0xbf810000, 0x00000000, 0x00000000, 0x0 # ZERO;sgl
-
- long 0xbc010000, 0x00000000, 0x00000000, 0x0 # ZERO;dbl
- long 0xbc010000, 0x00000000, 0x00000000, 0x0 # ZERO;dbl
- long 0xbc010000, 0x00000000, 0x00000800, 0x0 # MIN; dbl
- long 0xbc010000, 0x00000000, 0x00000000, 0x0 # ZERO;dbl
-
-############################################################
-
-#########################################################################
-# src_zero(): Return signed zero according to sign of src operand. #
-#########################################################################
- global src_zero
-src_zero:
- tst.b SRC_EX(%a0) # get sign of src operand
- bmi.b ld_mzero # if neg, load neg zero
-
-#
-# ld_pzero(): return a positive zero.
-#
- global ld_pzero
-ld_pzero:
- fmov.s &0x00000000,%fp0 # load +0
- mov.b &z_bmask,FPSR_CC(%a6) # set 'Z' ccode bit
- rts
-
-# ld_mzero(): return a negative zero.
- global ld_mzero
-ld_mzero:
- fmov.s &0x80000000,%fp0 # load -0
- mov.b &neg_bmask+z_bmask,FPSR_CC(%a6) # set 'N','Z' ccode bits
- rts
-
-#########################################################################
-# dst_zero(): Return signed zero according to sign of dst operand. #
-#########################################################################
- global dst_zero
-dst_zero:
- tst.b DST_EX(%a1) # get sign of dst operand
- bmi.b ld_mzero # if neg, load neg zero
- bra.b ld_pzero # load positive zero
-
-#########################################################################
-# src_inf(): Return signed inf according to sign of src operand. #
-#########################################################################
- global src_inf
-src_inf:
- tst.b SRC_EX(%a0) # get sign of src operand
- bmi.b ld_minf # if negative branch
-
-#
-# ld_pinf(): return a positive infinity.
-#
- global ld_pinf
-ld_pinf:
- fmov.s &0x7f800000,%fp0 # load +INF
- mov.b &inf_bmask,FPSR_CC(%a6) # set 'INF' ccode bit
- rts
-
-#
-# ld_minf():return a negative infinity.
-#
- global ld_minf
-ld_minf:
- fmov.s &0xff800000,%fp0 # load -INF
- mov.b &neg_bmask+inf_bmask,FPSR_CC(%a6) # set 'N','I' ccode bits
- rts
-
-#########################################################################
-# dst_inf(): Return signed inf according to sign of dst operand. #
-#########################################################################
- global dst_inf
-dst_inf:
- tst.b DST_EX(%a1) # get sign of dst operand
- bmi.b ld_minf # if negative branch
- bra.b ld_pinf
-
- global szr_inf
-#################################################################
-# szr_inf(): Return +ZERO for a negative src operand or #
-# +INF for a positive src operand. #
-# Routine used for fetox, ftwotox, and ftentox. #
-#################################################################
-szr_inf:
- tst.b SRC_EX(%a0) # check sign of source
- bmi.b ld_pzero
- bra.b ld_pinf
-
-#########################################################################
-# sopr_inf(): Return +INF for a positive src operand or #
-# jump to operand error routine for a negative src operand. #
-# Routine used for flogn, flognp1, flog10, and flog2. #
-#########################################################################
- global sopr_inf
-sopr_inf:
- tst.b SRC_EX(%a0) # check sign of source
- bmi.w t_operr
- bra.b ld_pinf
-
-#################################################################
-# setoxm1i(): Return minus one for a negative src operand or #
-# positive infinity for a positive src operand. #
-# Routine used for fetoxm1. #
-#################################################################
- global setoxm1i
-setoxm1i:
- tst.b SRC_EX(%a0) # check sign of source
- bmi.b ld_mone
- bra.b ld_pinf
-
-#########################################################################
-# src_one(): Return signed one according to sign of src operand. #
-#########################################################################
- global src_one
-src_one:
- tst.b SRC_EX(%a0) # check sign of source
- bmi.b ld_mone
-
-#
-# ld_pone(): return positive one.
-#
- global ld_pone
-ld_pone:
- fmov.s &0x3f800000,%fp0 # load +1
- clr.b FPSR_CC(%a6)
- rts
-
-#
-# ld_mone(): return negative one.
-#
- global ld_mone
-ld_mone:
- fmov.s &0xbf800000,%fp0 # load -1
- mov.b &neg_bmask,FPSR_CC(%a6) # set 'N' ccode bit
- rts
-
-ppiby2: long 0x3fff0000, 0xc90fdaa2, 0x2168c235
-mpiby2: long 0xbfff0000, 0xc90fdaa2, 0x2168c235
-
-#################################################################
-# spi_2(): Return signed PI/2 according to sign of src operand. #
-#################################################################
- global spi_2
-spi_2:
- tst.b SRC_EX(%a0) # check sign of source
- bmi.b ld_mpi2
-
-#
-# ld_ppi2(): return positive PI/2.
-#
- global ld_ppi2
-ld_ppi2:
- fmov.l %d0,%fpcr
- fmov.x ppiby2(%pc),%fp0 # load +pi/2
- bra.w t_pinx2 # set INEX2
-
-#
-# ld_mpi2(): return negative PI/2.
-#
- global ld_mpi2
-ld_mpi2:
- fmov.l %d0,%fpcr
- fmov.x mpiby2(%pc),%fp0 # load -pi/2
- bra.w t_minx2 # set INEX2
-
-####################################################
-# The following routines give support for fsincos. #
-####################################################
-
-#
-# ssincosz(): When the src operand is ZERO, store a one in the
-# cosine register and return a ZERO in fp0 w/ the same sign
-# as the src operand.
-#
- global ssincosz
-ssincosz:
- fmov.s &0x3f800000,%fp1
- tst.b SRC_EX(%a0) # test sign
- bpl.b sincoszp
- fmov.s &0x80000000,%fp0 # return sin result in fp0
- mov.b &z_bmask+neg_bmask,FPSR_CC(%a6)
- bra.b sto_cos # store cosine result
-sincoszp:
- fmov.s &0x00000000,%fp0 # return sin result in fp0
- mov.b &z_bmask,FPSR_CC(%a6)
- bra.b sto_cos # store cosine result
-
-#
-# ssincosi(): When the src operand is INF, store a QNAN in the cosine
-# register and jump to the operand error routine for negative
-# src operands.
-#
- global ssincosi
-ssincosi:
- fmov.x qnan(%pc),%fp1 # load NAN
- bsr.l sto_cos # store cosine result
- bra.w t_operr
-
-#
-# ssincosqnan(): When the src operand is a QNAN, store the QNAN in the cosine
-# register and branch to the src QNAN routine.
-#
- global ssincosqnan
-ssincosqnan:
- fmov.x LOCAL_EX(%a0),%fp1
- bsr.l sto_cos
- bra.w src_qnan
-
-#
-# ssincossnan(): When the src operand is an SNAN, store the SNAN w/ the SNAN bit set
-# in the cosine register and branch to the src SNAN routine.
-#
- global ssincossnan
-ssincossnan:
- fmov.x LOCAL_EX(%a0),%fp1
- bsr.l sto_cos
- bra.w src_snan
-
-########################################################################
-
-#########################################################################
-# sto_cos(): store fp1 to the fpreg designated by the CMDREG dst field. #
-# fp1 holds the result of the cosine portion of ssincos(). #
-# the value in fp1 will not take any exceptions when moved. #
-# INPUT: #
-# fp1 : fp value to store #
-# MODIFIED: #
-# d0 #
-#########################################################################
- global sto_cos
-sto_cos:
- mov.b 1+EXC_CMDREG(%a6),%d0
- andi.w &0x7,%d0
- mov.w (tbl_sto_cos.b,%pc,%d0.w*2),%d0
- jmp (tbl_sto_cos.b,%pc,%d0.w*1)
-
-tbl_sto_cos:
- short sto_cos_0 - tbl_sto_cos
- short sto_cos_1 - tbl_sto_cos
- short sto_cos_2 - tbl_sto_cos
- short sto_cos_3 - tbl_sto_cos
- short sto_cos_4 - tbl_sto_cos
- short sto_cos_5 - tbl_sto_cos
- short sto_cos_6 - tbl_sto_cos
- short sto_cos_7 - tbl_sto_cos
-
-sto_cos_0:
- fmovm.x &0x40,EXC_FP0(%a6)
- rts
-sto_cos_1:
- fmovm.x &0x40,EXC_FP1(%a6)
- rts
-sto_cos_2:
- fmov.x %fp1,%fp2
- rts
-sto_cos_3:
- fmov.x %fp1,%fp3
- rts
-sto_cos_4:
- fmov.x %fp1,%fp4
- rts
-sto_cos_5:
- fmov.x %fp1,%fp5
- rts
-sto_cos_6:
- fmov.x %fp1,%fp6
- rts
-sto_cos_7:
- fmov.x %fp1,%fp7
- rts
-
-##################################################################
- global smod_sdnrm
- global smod_snorm
-smod_sdnrm:
-smod_snorm:
- mov.b DTAG(%a6),%d1
- beq.l smod
- cmpi.b %d1,&ZERO
- beq.w smod_zro
- cmpi.b %d1,&INF
- beq.l t_operr
- cmpi.b %d1,&DENORM
- beq.l smod
- cmpi.b %d1,&SNAN
- beq.l dst_snan
- bra.l dst_qnan
-
- global smod_szero
-smod_szero:
- mov.b DTAG(%a6),%d1
- beq.l t_operr
- cmpi.b %d1,&ZERO
- beq.l t_operr
- cmpi.b %d1,&INF
- beq.l t_operr
- cmpi.b %d1,&DENORM
- beq.l t_operr
- cmpi.b %d1,&QNAN
- beq.l dst_qnan
- bra.l dst_snan
-
- global smod_sinf
-smod_sinf:
- mov.b DTAG(%a6),%d1
- beq.l smod_fpn
- cmpi.b %d1,&ZERO
- beq.l smod_zro
- cmpi.b %d1,&INF
- beq.l t_operr
- cmpi.b %d1,&DENORM
- beq.l smod_fpn
- cmpi.b %d1,&QNAN
- beq.l dst_qnan
- bra.l dst_snan
-
-smod_zro:
-srem_zro:
- mov.b SRC_EX(%a0),%d1 # get src sign
- mov.b DST_EX(%a1),%d0 # get dst sign
- eor.b %d0,%d1 # get qbyte sign
- andi.b &0x80,%d1
- mov.b %d1,FPSR_QBYTE(%a6)
- tst.b %d0
- bpl.w ld_pzero
- bra.w ld_mzero
-
-smod_fpn:
-srem_fpn:
- clr.b FPSR_QBYTE(%a6)
- mov.l %d0,-(%sp)
- mov.b SRC_EX(%a0),%d1 # get src sign
- mov.b DST_EX(%a1),%d0 # get dst sign
- eor.b %d0,%d1 # get qbyte sign
- andi.b &0x80,%d1
- mov.b %d1,FPSR_QBYTE(%a6)
- cmpi.b DTAG(%a6),&DENORM
- bne.b smod_nrm
- lea DST(%a1),%a0
- mov.l (%sp)+,%d0
- bra t_resdnrm
-smod_nrm:
- fmov.l (%sp)+,%fpcr
- fmov.x DST(%a1),%fp0
- tst.b DST_EX(%a1)
- bmi.b smod_nrm_neg
- rts
-
-smod_nrm_neg:
- mov.b &neg_bmask,FPSR_CC(%a6) # set 'N' ccode
- rts
-
-#########################################################################
- global srem_snorm
- global srem_sdnrm
-srem_sdnrm:
-srem_snorm:
- mov.b DTAG(%a6),%d1
- beq.l srem
- cmpi.b %d1,&ZERO
- beq.w srem_zro
- cmpi.b %d1,&INF
- beq.l t_operr
- cmpi.b %d1,&DENORM
- beq.l srem
- cmpi.b %d1,&QNAN
- beq.l dst_qnan
- bra.l dst_snan
-
- global srem_szero
-srem_szero:
- mov.b DTAG(%a6),%d1
- beq.l t_operr
- cmpi.b %d1,&ZERO
- beq.l t_operr
- cmpi.b %d1,&INF
- beq.l t_operr
- cmpi.b %d1,&DENORM
- beq.l t_operr
- cmpi.b %d1,&QNAN
- beq.l dst_qnan
- bra.l dst_snan
-
- global srem_sinf
-srem_sinf:
- mov.b DTAG(%a6),%d1
- beq.w srem_fpn
- cmpi.b %d1,&ZERO
- beq.w srem_zro
- cmpi.b %d1,&INF
- beq.l t_operr
- cmpi.b %d1,&DENORM
- beq.l srem_fpn
- cmpi.b %d1,&QNAN
- beq.l dst_qnan
- bra.l dst_snan
-
-#########################################################################
- global sscale_snorm
- global sscale_sdnrm
-sscale_snorm:
-sscale_sdnrm:
- mov.b DTAG(%a6),%d1
- beq.l sscale
- cmpi.b %d1,&ZERO
- beq.l dst_zero
- cmpi.b %d1,&INF
- beq.l dst_inf
- cmpi.b %d1,&DENORM
- beq.l sscale
- cmpi.b %d1,&QNAN
- beq.l dst_qnan
- bra.l dst_snan
-
- global sscale_szero
-sscale_szero:
- mov.b DTAG(%a6),%d1
- beq.l sscale
- cmpi.b %d1,&ZERO
- beq.l dst_zero
- cmpi.b %d1,&INF
- beq.l dst_inf
- cmpi.b %d1,&DENORM
- beq.l sscale
- cmpi.b %d1,&QNAN
- beq.l dst_qnan
- bra.l dst_snan
-
- global sscale_sinf
-sscale_sinf:
- mov.b DTAG(%a6),%d1
- beq.l t_operr
- cmpi.b %d1,&QNAN
- beq.l dst_qnan
- cmpi.b %d1,&SNAN
- beq.l dst_snan
- bra.l t_operr
-
-########################################################################
-
-#
-# sop_sqnan(): The src op for frem/fmod/fscale was a QNAN.
-#
- global sop_sqnan
-sop_sqnan:
- mov.b DTAG(%a6),%d1
- cmpi.b %d1,&QNAN
- beq.b dst_qnan
- cmpi.b %d1,&SNAN
- beq.b dst_snan
- bra.b src_qnan
-
-#
-# sop_ssnan(): The src op for frem/fmod/fscale was an SNAN.
-#
- global sop_ssnan
-sop_ssnan:
- mov.b DTAG(%a6),%d1
- cmpi.b %d1,&QNAN
- beq.b dst_qnan_src_snan
- cmpi.b %d1,&SNAN
- beq.b dst_snan
- bra.b src_snan
-
-dst_qnan_src_snan:
- ori.l &snaniop_mask,USER_FPSR(%a6) # set NAN/SNAN/AIOP
- bra.b dst_qnan
-
-#
-# dst_qnan(): Return the dst SNAN w/ the SNAN bit set.
-#
- global dst_snan
-dst_snan:
- fmov.x DST(%a1),%fp0 # the fmove sets the SNAN bit
- fmov.l %fpsr,%d0 # catch resulting status
- or.l %d0,USER_FPSR(%a6) # store status
- rts
-
-#
-# dst_qnan(): Return the dst QNAN.
-#
- global dst_qnan
-dst_qnan:
- fmov.x DST(%a1),%fp0 # return the non-signalling nan
- tst.b DST_EX(%a1) # set ccodes according to QNAN sign
- bmi.b dst_qnan_m
-dst_qnan_p:
- mov.b &nan_bmask,FPSR_CC(%a6)
- rts
-dst_qnan_m:
- mov.b &neg_bmask+nan_bmask,FPSR_CC(%a6)
- rts
-
-#
-# src_snan(): Return the src SNAN w/ the SNAN bit set.
-#
- global src_snan
-src_snan:
- fmov.x SRC(%a0),%fp0 # the fmove sets the SNAN bit
- fmov.l %fpsr,%d0 # catch resulting status
- or.l %d0,USER_FPSR(%a6) # store status
- rts
-
-#
-# src_qnan(): Return the src QNAN.
-#
- global src_qnan
-src_qnan:
- fmov.x SRC(%a0),%fp0 # return the non-signalling nan
- tst.b SRC_EX(%a0) # set ccodes according to QNAN sign
- bmi.b dst_qnan_m
-src_qnan_p:
- mov.b &nan_bmask,FPSR_CC(%a6)
- rts
-src_qnan_m:
- mov.b &neg_bmask+nan_bmask,FPSR_CC(%a6)
- rts
-
-#
-# fkern2.s:
-# These entry points are used by the exception handler
-# routines where an instruction is selected by an index into
-# a large jump table corresponding to a given instruction which
-# has been decoded. Flow continues here where we now decode
-# further accoding to the source operand type.
-#
-
- global fsinh
-fsinh:
- mov.b STAG(%a6),%d1
- beq.l ssinh
- cmpi.b %d1,&ZERO
- beq.l src_zero
- cmpi.b %d1,&INF
- beq.l src_inf
- cmpi.b %d1,&DENORM
- beq.l ssinhd
- cmpi.b %d1,&QNAN
- beq.l src_qnan
- bra.l src_snan
-
- global flognp1
-flognp1:
- mov.b STAG(%a6),%d1
- beq.l slognp1
- cmpi.b %d1,&ZERO
- beq.l src_zero
- cmpi.b %d1,&INF
- beq.l sopr_inf
- cmpi.b %d1,&DENORM
- beq.l slognp1d
- cmpi.b %d1,&QNAN
- beq.l src_qnan
- bra.l src_snan
-
- global fetoxm1
-fetoxm1:
- mov.b STAG(%a6),%d1
- beq.l setoxm1
- cmpi.b %d1,&ZERO
- beq.l src_zero
- cmpi.b %d1,&INF
- beq.l setoxm1i
- cmpi.b %d1,&DENORM
- beq.l setoxm1d
- cmpi.b %d1,&QNAN
- beq.l src_qnan
- bra.l src_snan
-
- global ftanh
-ftanh:
- mov.b STAG(%a6),%d1
- beq.l stanh
- cmpi.b %d1,&ZERO
- beq.l src_zero
- cmpi.b %d1,&INF
- beq.l src_one
- cmpi.b %d1,&DENORM
- beq.l stanhd
- cmpi.b %d1,&QNAN
- beq.l src_qnan
- bra.l src_snan
-
- global fatan
-fatan:
- mov.b STAG(%a6),%d1
- beq.l satan
- cmpi.b %d1,&ZERO
- beq.l src_zero
- cmpi.b %d1,&INF
- beq.l spi_2
- cmpi.b %d1,&DENORM
- beq.l satand
- cmpi.b %d1,&QNAN
- beq.l src_qnan
- bra.l src_snan
-
- global fasin
-fasin:
- mov.b STAG(%a6),%d1
- beq.l sasin
- cmpi.b %d1,&ZERO
- beq.l src_zero
- cmpi.b %d1,&INF
- beq.l t_operr
- cmpi.b %d1,&DENORM
- beq.l sasind
- cmpi.b %d1,&QNAN
- beq.l src_qnan
- bra.l src_snan
-
- global fatanh
-fatanh:
- mov.b STAG(%a6),%d1
- beq.l satanh
- cmpi.b %d1,&ZERO
- beq.l src_zero
- cmpi.b %d1,&INF
- beq.l t_operr
- cmpi.b %d1,&DENORM
- beq.l satanhd
- cmpi.b %d1,&QNAN
- beq.l src_qnan
- bra.l src_snan
-
- global fsine
-fsine:
- mov.b STAG(%a6),%d1
- beq.l ssin
- cmpi.b %d1,&ZERO
- beq.l src_zero
- cmpi.b %d1,&INF
- beq.l t_operr
- cmpi.b %d1,&DENORM
- beq.l ssind
- cmpi.b %d1,&QNAN
- beq.l src_qnan
- bra.l src_snan
-
- global ftan
-ftan:
- mov.b STAG(%a6),%d1
- beq.l stan
- cmpi.b %d1,&ZERO
- beq.l src_zero
- cmpi.b %d1,&INF
- beq.l t_operr
- cmpi.b %d1,&DENORM
- beq.l stand
- cmpi.b %d1,&QNAN
- beq.l src_qnan
- bra.l src_snan
-
- global fetox
-fetox:
- mov.b STAG(%a6),%d1
- beq.l setox
- cmpi.b %d1,&ZERO
- beq.l ld_pone
- cmpi.b %d1,&INF
- beq.l szr_inf
- cmpi.b %d1,&DENORM
- beq.l setoxd
- cmpi.b %d1,&QNAN
- beq.l src_qnan
- bra.l src_snan
-
- global ftwotox
-ftwotox:
- mov.b STAG(%a6),%d1
- beq.l stwotox
- cmpi.b %d1,&ZERO
- beq.l ld_pone
- cmpi.b %d1,&INF
- beq.l szr_inf
- cmpi.b %d1,&DENORM
- beq.l stwotoxd
- cmpi.b %d1,&QNAN
- beq.l src_qnan
- bra.l src_snan
-
- global ftentox
-ftentox:
- mov.b STAG(%a6),%d1
- beq.l stentox
- cmpi.b %d1,&ZERO
- beq.l ld_pone
- cmpi.b %d1,&INF
- beq.l szr_inf
- cmpi.b %d1,&DENORM
- beq.l stentoxd
- cmpi.b %d1,&QNAN
- beq.l src_qnan
- bra.l src_snan
-
- global flogn
-flogn:
- mov.b STAG(%a6),%d1
- beq.l slogn
- cmpi.b %d1,&ZERO
- beq.l t_dz2
- cmpi.b %d1,&INF
- beq.l sopr_inf
- cmpi.b %d1,&DENORM
- beq.l slognd
- cmpi.b %d1,&QNAN
- beq.l src_qnan
- bra.l src_snan
-
- global flog10
-flog10:
- mov.b STAG(%a6),%d1
- beq.l slog10
- cmpi.b %d1,&ZERO
- beq.l t_dz2
- cmpi.b %d1,&INF
- beq.l sopr_inf
- cmpi.b %d1,&DENORM
- beq.l slog10d
- cmpi.b %d1,&QNAN
- beq.l src_qnan
- bra.l src_snan
-
- global flog2
-flog2:
- mov.b STAG(%a6),%d1
- beq.l slog2
- cmpi.b %d1,&ZERO
- beq.l t_dz2
- cmpi.b %d1,&INF
- beq.l sopr_inf
- cmpi.b %d1,&DENORM
- beq.l slog2d
- cmpi.b %d1,&QNAN
- beq.l src_qnan
- bra.l src_snan
-
- global fcosh
-fcosh:
- mov.b STAG(%a6),%d1
- beq.l scosh
- cmpi.b %d1,&ZERO
- beq.l ld_pone
- cmpi.b %d1,&INF
- beq.l ld_pinf
- cmpi.b %d1,&DENORM
- beq.l scoshd
- cmpi.b %d1,&QNAN
- beq.l src_qnan
- bra.l src_snan
-
- global facos
-facos:
- mov.b STAG(%a6),%d1
- beq.l sacos
- cmpi.b %d1,&ZERO
- beq.l ld_ppi2
- cmpi.b %d1,&INF
- beq.l t_operr
- cmpi.b %d1,&DENORM
- beq.l sacosd
- cmpi.b %d1,&QNAN
- beq.l src_qnan
- bra.l src_snan
-
- global fcos
-fcos:
- mov.b STAG(%a6),%d1
- beq.l scos
- cmpi.b %d1,&ZERO
- beq.l ld_pone
- cmpi.b %d1,&INF
- beq.l t_operr
- cmpi.b %d1,&DENORM
- beq.l scosd
- cmpi.b %d1,&QNAN
- beq.l src_qnan
- bra.l src_snan
-
- global fgetexp
-fgetexp:
- mov.b STAG(%a6),%d1
- beq.l sgetexp
- cmpi.b %d1,&ZERO
- beq.l src_zero
- cmpi.b %d1,&INF
- beq.l t_operr
- cmpi.b %d1,&DENORM
- beq.l sgetexpd
- cmpi.b %d1,&QNAN
- beq.l src_qnan
- bra.l src_snan
-
- global fgetman
-fgetman:
- mov.b STAG(%a6),%d1
- beq.l sgetman
- cmpi.b %d1,&ZERO
- beq.l src_zero
- cmpi.b %d1,&INF
- beq.l t_operr
- cmpi.b %d1,&DENORM
- beq.l sgetmand
- cmpi.b %d1,&QNAN
- beq.l src_qnan
- bra.l src_snan
-
- global fsincos
-fsincos:
- mov.b STAG(%a6),%d1
- beq.l ssincos
- cmpi.b %d1,&ZERO
- beq.l ssincosz
- cmpi.b %d1,&INF
- beq.l ssincosi
- cmpi.b %d1,&DENORM
- beq.l ssincosd
- cmpi.b %d1,&QNAN
- beq.l ssincosqnan
- bra.l ssincossnan
-
- global fmod
-fmod:
- mov.b STAG(%a6),%d1
- beq.l smod_snorm
- cmpi.b %d1,&ZERO
- beq.l smod_szero
- cmpi.b %d1,&INF
- beq.l smod_sinf
- cmpi.b %d1,&DENORM
- beq.l smod_sdnrm
- cmpi.b %d1,&QNAN
- beq.l sop_sqnan
- bra.l sop_ssnan
-
- global frem
-frem:
- mov.b STAG(%a6),%d1
- beq.l srem_snorm
- cmpi.b %d1,&ZERO
- beq.l srem_szero
- cmpi.b %d1,&INF
- beq.l srem_sinf
- cmpi.b %d1,&DENORM
- beq.l srem_sdnrm
- cmpi.b %d1,&QNAN
- beq.l sop_sqnan
- bra.l sop_ssnan
-
- global fscale
-fscale:
- mov.b STAG(%a6),%d1
- beq.l sscale_snorm
- cmpi.b %d1,&ZERO
- beq.l sscale_szero
- cmpi.b %d1,&INF
- beq.l sscale_sinf
- cmpi.b %d1,&DENORM
- beq.l sscale_sdnrm
- cmpi.b %d1,&QNAN
- beq.l sop_sqnan
- bra.l sop_ssnan
-
-#########################################################################
-# XDEF **************************************************************** #
-# fgen_except(): catch an exception during transcendental #
-# emulation #
-# #
-# XREF **************************************************************** #
-# fmul() - emulate a multiply instruction #
-# fadd() - emulate an add instruction #
-# fin() - emulate an fmove instruction #
-# #
-# INPUT *************************************************************** #
-# fp0 = destination operand #
-# d0 = type of instruction that took exception #
-# fsave frame = source operand #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = result #
-# fp1 = EXOP #
-# #
-# ALGORITHM *********************************************************** #
-# An exception occurred on the last instruction of the #
-# transcendental emulation. hopefully, this won't be happening much #
-# because it will be VERY slow. #
-# The only exceptions capable of passing through here are #
-# Overflow, Underflow, and Unsupported Data Type. #
-# #
-#########################################################################
-
- global fgen_except
-fgen_except:
- cmpi.b 0x3(%sp),&0x7 # is exception UNSUPP?
- beq.b fge_unsupp # yes
-
- mov.b &NORM,STAG(%a6)
-
-fge_cont:
- mov.b &NORM,DTAG(%a6)
-
-# ok, I have a problem with putting the dst op at FP_DST. the emulation
-# routines aren't supposed to alter the operands but we've just squashed
-# FP_DST here...
-
-# 8/17/93 - this turns out to be more of a "cleanliness" standpoint
-# then a potential bug. to begin with, only the dyadic functions
-# frem,fmod, and fscale would get the dst trashed here. But, for
-# the 060SP, the FP_DST is never used again anyways.
- fmovm.x &0x80,FP_DST(%a6) # dst op is in fp0
-
- lea 0x4(%sp),%a0 # pass: ptr to src op
- lea FP_DST(%a6),%a1 # pass: ptr to dst op
-
- cmpi.b %d1,&FMOV_OP
- beq.b fge_fin # it was an "fmov"
- cmpi.b %d1,&FADD_OP
- beq.b fge_fadd # it was an "fadd"
-fge_fmul:
- bsr.l fmul
- rts
-fge_fadd:
- bsr.l fadd
- rts
-fge_fin:
- bsr.l fin
- rts
-
-fge_unsupp:
- mov.b &DENORM,STAG(%a6)
- bra.b fge_cont
-
-#
-# This table holds the offsets of the emulation routines for each individual
-# math operation relative to the address of this table. Included are
-# routines like fadd/fmul/fabs as well as the transcendentals.
-# The location within the table is determined by the extension bits of the
-# operation longword.
-#
-
- swbeg &109
-tbl_unsupp:
- long fin - tbl_unsupp # 00: fmove
- long fint - tbl_unsupp # 01: fint
- long fsinh - tbl_unsupp # 02: fsinh
- long fintrz - tbl_unsupp # 03: fintrz
- long fsqrt - tbl_unsupp # 04: fsqrt
- long tbl_unsupp - tbl_unsupp
- long flognp1 - tbl_unsupp # 06: flognp1
- long tbl_unsupp - tbl_unsupp
- long fetoxm1 - tbl_unsupp # 08: fetoxm1
- long ftanh - tbl_unsupp # 09: ftanh
- long fatan - tbl_unsupp # 0a: fatan
- long tbl_unsupp - tbl_unsupp
- long fasin - tbl_unsupp # 0c: fasin
- long fatanh - tbl_unsupp # 0d: fatanh
- long fsine - tbl_unsupp # 0e: fsin
- long ftan - tbl_unsupp # 0f: ftan
- long fetox - tbl_unsupp # 10: fetox
- long ftwotox - tbl_unsupp # 11: ftwotox
- long ftentox - tbl_unsupp # 12: ftentox
- long tbl_unsupp - tbl_unsupp
- long flogn - tbl_unsupp # 14: flogn
- long flog10 - tbl_unsupp # 15: flog10
- long flog2 - tbl_unsupp # 16: flog2
- long tbl_unsupp - tbl_unsupp
- long fabs - tbl_unsupp # 18: fabs
- long fcosh - tbl_unsupp # 19: fcosh
- long fneg - tbl_unsupp # 1a: fneg
- long tbl_unsupp - tbl_unsupp
- long facos - tbl_unsupp # 1c: facos
- long fcos - tbl_unsupp # 1d: fcos
- long fgetexp - tbl_unsupp # 1e: fgetexp
- long fgetman - tbl_unsupp # 1f: fgetman
- long fdiv - tbl_unsupp # 20: fdiv
- long fmod - tbl_unsupp # 21: fmod
- long fadd - tbl_unsupp # 22: fadd
- long fmul - tbl_unsupp # 23: fmul
- long fsgldiv - tbl_unsupp # 24: fsgldiv
- long frem - tbl_unsupp # 25: frem
- long fscale - tbl_unsupp # 26: fscale
- long fsglmul - tbl_unsupp # 27: fsglmul
- long fsub - tbl_unsupp # 28: fsub
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long fsincos - tbl_unsupp # 30: fsincos
- long fsincos - tbl_unsupp # 31: fsincos
- long fsincos - tbl_unsupp # 32: fsincos
- long fsincos - tbl_unsupp # 33: fsincos
- long fsincos - tbl_unsupp # 34: fsincos
- long fsincos - tbl_unsupp # 35: fsincos
- long fsincos - tbl_unsupp # 36: fsincos
- long fsincos - tbl_unsupp # 37: fsincos
- long fcmp - tbl_unsupp # 38: fcmp
- long tbl_unsupp - tbl_unsupp
- long ftst - tbl_unsupp # 3a: ftst
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long fsin - tbl_unsupp # 40: fsmove
- long fssqrt - tbl_unsupp # 41: fssqrt
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long fdin - tbl_unsupp # 44: fdmove
- long fdsqrt - tbl_unsupp # 45: fdsqrt
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long fsabs - tbl_unsupp # 58: fsabs
- long tbl_unsupp - tbl_unsupp
- long fsneg - tbl_unsupp # 5a: fsneg
- long tbl_unsupp - tbl_unsupp
- long fdabs - tbl_unsupp # 5c: fdabs
- long tbl_unsupp - tbl_unsupp
- long fdneg - tbl_unsupp # 5e: fdneg
- long tbl_unsupp - tbl_unsupp
- long fsdiv - tbl_unsupp # 60: fsdiv
- long tbl_unsupp - tbl_unsupp
- long fsadd - tbl_unsupp # 62: fsadd
- long fsmul - tbl_unsupp # 63: fsmul
- long fddiv - tbl_unsupp # 64: fddiv
- long tbl_unsupp - tbl_unsupp
- long fdadd - tbl_unsupp # 66: fdadd
- long fdmul - tbl_unsupp # 67: fdmul
- long fssub - tbl_unsupp # 68: fssub
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long fdsub - tbl_unsupp # 6c: fdsub
-
-#########################################################################
-# XDEF **************************************************************** #
-# fmul(): emulates the fmul instruction #
-# fsmul(): emulates the fsmul instruction #
-# fdmul(): emulates the fdmul instruction #
-# #
-# XREF **************************************************************** #
-# scale_to_zero_src() - scale src exponent to zero #
-# scale_to_zero_dst() - scale dst exponent to zero #
-# unf_res() - return default underflow result #
-# ovf_res() - return default overflow result #
-# res_qnan() - return QNAN result #
-# res_snan() - return SNAN result #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# a1 = pointer to extended precision destination operand #
-# d0 rnd prec,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = result #
-# fp1 = EXOP (if exception occurred) #
-# #
-# ALGORITHM *********************************************************** #
-# Handle NANs, infinities, and zeroes as special cases. Divide #
-# norms/denorms into ext/sgl/dbl precision. #
-# For norms/denorms, scale the exponents such that a multiply #
-# instruction won't cause an exception. Use the regular fmul to #
-# compute a result. Check if the regular operands would have taken #
-# an exception. If so, return the default overflow/underflow result #
-# and return the EXOP if exceptions are enabled. Else, scale the #
-# result operand to the proper exponent. #
-# #
-#########################################################################
-
- align 0x10
-tbl_fmul_ovfl:
- long 0x3fff - 0x7ffe # ext_max
- long 0x3fff - 0x407e # sgl_max
- long 0x3fff - 0x43fe # dbl_max
-tbl_fmul_unfl:
- long 0x3fff + 0x0001 # ext_unfl
- long 0x3fff - 0x3f80 # sgl_unfl
- long 0x3fff - 0x3c00 # dbl_unfl
-
- global fsmul
-fsmul:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &s_mode*0x10,%d0 # insert sgl prec
- bra.b fmul
-
- global fdmul
-fdmul:
- andi.b &0x30,%d0
- ori.b &d_mode*0x10,%d0 # insert dbl prec
-
- global fmul
-fmul:
- mov.l %d0,L_SCR3(%a6) # store rnd info
-
- clr.w %d1
- mov.b DTAG(%a6),%d1
- lsl.b &0x3,%d1
- or.b STAG(%a6),%d1 # combine src tags
- bne.w fmul_not_norm # optimize on non-norm input
-
-fmul_norm:
- mov.w DST_EX(%a1),FP_SCR1_EX(%a6)
- mov.l DST_HI(%a1),FP_SCR1_HI(%a6)
- mov.l DST_LO(%a1),FP_SCR1_LO(%a6)
-
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
-
- bsr.l scale_to_zero_src # scale src exponent
- mov.l %d0,-(%sp) # save scale factor 1
-
- bsr.l scale_to_zero_dst # scale dst exponent
-
- add.l %d0,(%sp) # SCALE_FACTOR = scale1 + scale2
-
- mov.w 2+L_SCR3(%a6),%d1 # fetch precision
- lsr.b &0x6,%d1 # shift to lo bits
- mov.l (%sp)+,%d0 # load S.F.
- cmp.l %d0,(tbl_fmul_ovfl.w,%pc,%d1.w*4) # would result ovfl?
- beq.w fmul_may_ovfl # result may rnd to overflow
- blt.w fmul_ovfl # result will overflow
-
- cmp.l %d0,(tbl_fmul_unfl.w,%pc,%d1.w*4) # would result unfl?
- beq.w fmul_may_unfl # result may rnd to no unfl
- bgt.w fmul_unfl # result will underflow
-
-#
-# NORMAL:
-# - the result of the multiply operation will neither overflow nor underflow.
-# - do the multiply to the proper precision and rounding mode.
-# - scale the result exponent using the scale factor. if both operands were
-# normalized then we really don't need to go through this scaling. but for now,
-# this will do.
-#
-fmul_normal:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst operand
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fmul.x FP_SCR0(%a6),%fp0 # execute multiply
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-fmul_normal_exit:
- fmovm.x &0x80,FP_SCR0(%a6) # store out result
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # load {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- or.w %d2,%d1 # concat old sign,new exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x80 # return default result in fp0
- rts
-
-#
-# OVERFLOW:
-# - the result of the multiply operation is an overflow.
-# - do the multiply to the proper precision and rounding mode in order to
-# set the inexact bits.
-# - calculate the default result and return it in fp0.
-# - if overflow or inexact is enabled, we need a multiply result rounded to
-# extended precision. if the original operation was extended, then we have this
-# result. if the original operation was single or double, we have to do another
-# multiply using extended precision and the correct rounding mode. the result
-# of this operation then has its exponent scaled by -0x6000 to create the
-# exceptional operand.
-#
-fmul_ovfl:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst operand
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fmul.x FP_SCR0(%a6),%fp0 # execute multiply
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-# save setting this until now because this is where fmul_may_ovfl may jump in
-fmul_ovfl_tst:
- or.l &ovfl_inx_mask,USER_FPSR(%a6) # set ovfl/aovfl/ainex
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x13,%d1 # is OVFL or INEX enabled?
- bne.b fmul_ovfl_ena # yes
-
-# calculate the default result
-fmul_ovfl_dis:
- btst &neg_bit,FPSR_CC(%a6) # is result negative?
- sne %d1 # set sign param accordingly
- mov.l L_SCR3(%a6),%d0 # pass rnd prec,mode
- bsr.l ovf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # set INF,N if applicable
- fmovm.x (%a0),&0x80 # return default result in fp0
- rts
-
-#
-# OVFL is enabled; Create EXOP:
-# - if precision is extended, then we have the EXOP. simply bias the exponent
-# with an extra -0x6000. if the precision is single or double, we need to
-# calculate a result rounded to extended precision.
-#
-fmul_ovfl_ena:
- mov.l L_SCR3(%a6),%d1
- andi.b &0xc0,%d1 # test the rnd prec
- bne.b fmul_ovfl_ena_sd # it's sgl or dbl
-
-fmul_ovfl_ena_cont:
- fmovm.x &0x80,FP_SCR0(%a6) # move result to stack
-
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # fetch {sgn,exp}
- mov.w %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- sub.l %d0,%d1 # add scale factor
- subi.l &0x6000,%d1 # subtract bias
- andi.w &0x7fff,%d1 # clear sign bit
- andi.w &0x8000,%d2 # keep old sign
- or.w %d2,%d1 # concat old sign,new exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- bra.b fmul_ovfl_dis
-
-fmul_ovfl_ena_sd:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst operand
-
- mov.l L_SCR3(%a6),%d1
- andi.b &0x30,%d1 # keep rnd mode only
- fmov.l %d1,%fpcr # set FPCR
-
- fmul.x FP_SCR0(%a6),%fp0 # execute multiply
-
- fmov.l &0x0,%fpcr # clear FPCR
- bra.b fmul_ovfl_ena_cont
-
-#
-# may OVERFLOW:
-# - the result of the multiply operation MAY overflow.
-# - do the multiply to the proper precision and rounding mode in order to
-# set the inexact bits.
-# - calculate the default result and return it in fp0.
-#
-fmul_may_ovfl:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fmul.x FP_SCR0(%a6),%fp0 # execute multiply
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
- fabs.x %fp0,%fp1 # make a copy of result
- fcmp.b %fp1,&0x2 # is |result| >= 2.b?
- fbge.w fmul_ovfl_tst # yes; overflow has occurred
-
-# no, it didn't overflow; we have correct result
- bra.w fmul_normal_exit
-
-#
-# UNDERFLOW:
-# - the result of the multiply operation is an underflow.
-# - do the multiply to the proper precision and rounding mode in order to
-# set the inexact bits.
-# - calculate the default result and return it in fp0.
-# - if overflow or inexact is enabled, we need a multiply result rounded to
-# extended precision. if the original operation was extended, then we have this
-# result. if the original operation was single or double, we have to do another
-# multiply using extended precision and the correct rounding mode. the result
-# of this operation then has its exponent scaled by -0x6000 to create the
-# exceptional operand.
-#
-fmul_unfl:
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
-
-# for fun, let's use only extended precision, round to zero. then, let
-# the unf_res() routine figure out all the rest.
-# will we get the correct answer.
- fmovm.x FP_SCR1(%a6),&0x80 # load dst operand
-
- fmov.l &rz_mode*0x10,%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fmul.x FP_SCR0(%a6),%fp0 # execute multiply
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x0b,%d1 # is UNFL or INEX enabled?
- bne.b fmul_unfl_ena # yes
-
-fmul_unfl_dis:
- fmovm.x &0x80,FP_SCR0(%a6) # store out result
-
- lea FP_SCR0(%a6),%a0 # pass: result addr
- mov.l L_SCR3(%a6),%d1 # pass: rnd prec,mode
- bsr.l unf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # unf_res2 may have set 'Z'
- fmovm.x FP_SCR0(%a6),&0x80 # return default result in fp0
- rts
-
-#
-# UNFL is enabled.
-#
-fmul_unfl_ena:
- fmovm.x FP_SCR1(%a6),&0x40 # load dst op
-
- mov.l L_SCR3(%a6),%d1
- andi.b &0xc0,%d1 # is precision extended?
- bne.b fmul_unfl_ena_sd # no, sgl or dbl
-
-# if the rnd mode is anything but RZ, then we have to re-do the above
-# multiplication because we used RZ for all.
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
-fmul_unfl_ena_cont:
- fmov.l &0x0,%fpsr # clear FPSR
-
- fmul.x FP_SCR0(%a6),%fp1 # execute multiply
-
- fmov.l &0x0,%fpcr # clear FPCR
-
- fmovm.x &0x40,FP_SCR0(%a6) # save result to stack
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # fetch {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- addi.l &0x6000,%d1 # add bias
- andi.w &0x7fff,%d1
- or.w %d2,%d1 # concat old sign,new exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- bra.w fmul_unfl_dis
-
-fmul_unfl_ena_sd:
- mov.l L_SCR3(%a6),%d1
- andi.b &0x30,%d1 # use only rnd mode
- fmov.l %d1,%fpcr # set FPCR
-
- bra.b fmul_unfl_ena_cont
-
-# MAY UNDERFLOW:
-# -use the correct rounding mode and precision. this code favors operations
-# that do not underflow.
-fmul_may_unfl:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst operand
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fmul.x FP_SCR0(%a6),%fp0 # execute multiply
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
- fabs.x %fp0,%fp1 # make a copy of result
- fcmp.b %fp1,&0x2 # is |result| > 2.b?
- fbgt.w fmul_normal_exit # no; no underflow occurred
- fblt.w fmul_unfl # yes; underflow occurred
-
-#
-# we still don't know if underflow occurred. result is ~ equal to 2. but,
-# we don't know if the result was an underflow that rounded up to a 2 or
-# a normalized number that rounded down to a 2. so, redo the entire operation
-# using RZ as the rounding mode to see what the pre-rounded result is.
-# this case should be relatively rare.
-#
- fmovm.x FP_SCR1(%a6),&0x40 # load dst operand
-
- mov.l L_SCR3(%a6),%d1
- andi.b &0xc0,%d1 # keep rnd prec
- ori.b &rz_mode*0x10,%d1 # insert RZ
-
- fmov.l %d1,%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fmul.x FP_SCR0(%a6),%fp1 # execute multiply
-
- fmov.l &0x0,%fpcr # clear FPCR
- fabs.x %fp1 # make absolute value
- fcmp.b %fp1,&0x2 # is |result| < 2.b?
- fbge.w fmul_normal_exit # no; no underflow occurred
- bra.w fmul_unfl # yes, underflow occurred
-
-################################################################################
-
-#
-# Multiply: inputs are not both normalized; what are they?
-#
-fmul_not_norm:
- mov.w (tbl_fmul_op.b,%pc,%d1.w*2),%d1
- jmp (tbl_fmul_op.b,%pc,%d1.w)
-
- swbeg &48
-tbl_fmul_op:
- short fmul_norm - tbl_fmul_op # NORM x NORM
- short fmul_zero - tbl_fmul_op # NORM x ZERO
- short fmul_inf_src - tbl_fmul_op # NORM x INF
- short fmul_res_qnan - tbl_fmul_op # NORM x QNAN
- short fmul_norm - tbl_fmul_op # NORM x DENORM
- short fmul_res_snan - tbl_fmul_op # NORM x SNAN
- short tbl_fmul_op - tbl_fmul_op #
- short tbl_fmul_op - tbl_fmul_op #
-
- short fmul_zero - tbl_fmul_op # ZERO x NORM
- short fmul_zero - tbl_fmul_op # ZERO x ZERO
- short fmul_res_operr - tbl_fmul_op # ZERO x INF
- short fmul_res_qnan - tbl_fmul_op # ZERO x QNAN
- short fmul_zero - tbl_fmul_op # ZERO x DENORM
- short fmul_res_snan - tbl_fmul_op # ZERO x SNAN
- short tbl_fmul_op - tbl_fmul_op #
- short tbl_fmul_op - tbl_fmul_op #
-
- short fmul_inf_dst - tbl_fmul_op # INF x NORM
- short fmul_res_operr - tbl_fmul_op # INF x ZERO
- short fmul_inf_dst - tbl_fmul_op # INF x INF
- short fmul_res_qnan - tbl_fmul_op # INF x QNAN
- short fmul_inf_dst - tbl_fmul_op # INF x DENORM
- short fmul_res_snan - tbl_fmul_op # INF x SNAN
- short tbl_fmul_op - tbl_fmul_op #
- short tbl_fmul_op - tbl_fmul_op #
-
- short fmul_res_qnan - tbl_fmul_op # QNAN x NORM
- short fmul_res_qnan - tbl_fmul_op # QNAN x ZERO
- short fmul_res_qnan - tbl_fmul_op # QNAN x INF
- short fmul_res_qnan - tbl_fmul_op # QNAN x QNAN
- short fmul_res_qnan - tbl_fmul_op # QNAN x DENORM
- short fmul_res_snan - tbl_fmul_op # QNAN x SNAN
- short tbl_fmul_op - tbl_fmul_op #
- short tbl_fmul_op - tbl_fmul_op #
-
- short fmul_norm - tbl_fmul_op # NORM x NORM
- short fmul_zero - tbl_fmul_op # NORM x ZERO
- short fmul_inf_src - tbl_fmul_op # NORM x INF
- short fmul_res_qnan - tbl_fmul_op # NORM x QNAN
- short fmul_norm - tbl_fmul_op # NORM x DENORM
- short fmul_res_snan - tbl_fmul_op # NORM x SNAN
- short tbl_fmul_op - tbl_fmul_op #
- short tbl_fmul_op - tbl_fmul_op #
-
- short fmul_res_snan - tbl_fmul_op # SNAN x NORM
- short fmul_res_snan - tbl_fmul_op # SNAN x ZERO
- short fmul_res_snan - tbl_fmul_op # SNAN x INF
- short fmul_res_snan - tbl_fmul_op # SNAN x QNAN
- short fmul_res_snan - tbl_fmul_op # SNAN x DENORM
- short fmul_res_snan - tbl_fmul_op # SNAN x SNAN
- short tbl_fmul_op - tbl_fmul_op #
- short tbl_fmul_op - tbl_fmul_op #
-
-fmul_res_operr:
- bra.l res_operr
-fmul_res_snan:
- bra.l res_snan
-fmul_res_qnan:
- bra.l res_qnan
-
-#
-# Multiply: (Zero x Zero) || (Zero x norm) || (Zero x denorm)
-#
- global fmul_zero # global for fsglmul
-fmul_zero:
- mov.b SRC_EX(%a0),%d0 # exclusive or the signs
- mov.b DST_EX(%a1),%d1
- eor.b %d0,%d1
- bpl.b fmul_zero_p # result ZERO is pos.
-fmul_zero_n:
- fmov.s &0x80000000,%fp0 # load -ZERO
- mov.b &z_bmask+neg_bmask,FPSR_CC(%a6) # set Z/N
- rts
-fmul_zero_p:
- fmov.s &0x00000000,%fp0 # load +ZERO
- mov.b &z_bmask,FPSR_CC(%a6) # set Z
- rts
-
-#
-# Multiply: (inf x inf) || (inf x norm) || (inf x denorm)
-#
-# Note: The j-bit for an infinity is a don't-care. However, to be
-# strictly compatible w/ the 68881/882, we make sure to return an
-# INF w/ the j-bit set if the input INF j-bit was set. Destination
-# INFs take priority.
-#
- global fmul_inf_dst # global for fsglmul
-fmul_inf_dst:
- fmovm.x DST(%a1),&0x80 # return INF result in fp0
- mov.b SRC_EX(%a0),%d0 # exclusive or the signs
- mov.b DST_EX(%a1),%d1
- eor.b %d0,%d1
- bpl.b fmul_inf_dst_p # result INF is pos.
-fmul_inf_dst_n:
- fabs.x %fp0 # clear result sign
- fneg.x %fp0 # set result sign
- mov.b &inf_bmask+neg_bmask,FPSR_CC(%a6) # set INF/N
- rts
-fmul_inf_dst_p:
- fabs.x %fp0 # clear result sign
- mov.b &inf_bmask,FPSR_CC(%a6) # set INF
- rts
-
- global fmul_inf_src # global for fsglmul
-fmul_inf_src:
- fmovm.x SRC(%a0),&0x80 # return INF result in fp0
- mov.b SRC_EX(%a0),%d0 # exclusive or the signs
- mov.b DST_EX(%a1),%d1
- eor.b %d0,%d1
- bpl.b fmul_inf_dst_p # result INF is pos.
- bra.b fmul_inf_dst_n
-
-#########################################################################
-# XDEF **************************************************************** #
-# fin(): emulates the fmove instruction #
-# fsin(): emulates the fsmove instruction #
-# fdin(): emulates the fdmove instruction #
-# #
-# XREF **************************************************************** #
-# norm() - normalize mantissa for EXOP on denorm #
-# scale_to_zero_src() - scale src exponent to zero #
-# ovf_res() - return default overflow result #
-# unf_res() - return default underflow result #
-# res_qnan_1op() - return QNAN result #
-# res_snan_1op() - return SNAN result #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# d0 = round prec/mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = result #
-# fp1 = EXOP (if exception occurred) #
-# #
-# ALGORITHM *********************************************************** #
-# Handle NANs, infinities, and zeroes as special cases. Divide #
-# norms into extended, single, and double precision. #
-# Norms can be emulated w/ a regular fmove instruction. For #
-# sgl/dbl, must scale exponent and perform an "fmove". Check to see #
-# if the result would have overflowed/underflowed. If so, use unf_res() #
-# or ovf_res() to return the default result. Also return EXOP if #
-# exception is enabled. If no exception, return the default result. #
-# Unnorms don't pass through here. #
-# #
-#########################################################################
-
- global fsin
-fsin:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &s_mode*0x10,%d0 # insert sgl precision
- bra.b fin
-
- global fdin
-fdin:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &d_mode*0x10,%d0 # insert dbl precision
-
- global fin
-fin:
- mov.l %d0,L_SCR3(%a6) # store rnd info
-
- mov.b STAG(%a6),%d1 # fetch src optype tag
- bne.w fin_not_norm # optimize on non-norm input
-
-#
-# FP MOVE IN: NORMs and DENORMs ONLY!
-#
-fin_norm:
- andi.b &0xc0,%d0 # is precision extended?
- bne.w fin_not_ext # no, so go handle dbl or sgl
-
-#
-# precision selected is extended. so...we cannot get an underflow
-# or overflow because of rounding to the correct precision. so...
-# skip the scaling and unscaling...
-#
- tst.b SRC_EX(%a0) # is the operand negative?
- bpl.b fin_norm_done # no
- bset &neg_bit,FPSR_CC(%a6) # yes, so set 'N' ccode bit
-fin_norm_done:
- fmovm.x SRC(%a0),&0x80 # return result in fp0
- rts
-
-#
-# for an extended precision DENORM, the UNFL exception bit is set
-# the accrued bit is NOT set in this instance(no inexactness!)
-#
-fin_denorm:
- andi.b &0xc0,%d0 # is precision extended?
- bne.w fin_not_ext # no, so go handle dbl or sgl
-
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
- tst.b SRC_EX(%a0) # is the operand negative?
- bpl.b fin_denorm_done # no
- bset &neg_bit,FPSR_CC(%a6) # yes, so set 'N' ccode bit
-fin_denorm_done:
- fmovm.x SRC(%a0),&0x80 # return result in fp0
- btst &unfl_bit,FPCR_ENABLE(%a6) # is UNFL enabled?
- bne.b fin_denorm_unfl_ena # yes
- rts
-
-#
-# the input is an extended DENORM and underflow is enabled in the FPCR.
-# normalize the mantissa and add the bias of 0x6000 to the resulting negative
-# exponent and insert back into the operand.
-#
-fin_denorm_unfl_ena:
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- lea FP_SCR0(%a6),%a0 # pass: ptr to operand
- bsr.l norm # normalize result
- neg.w %d0 # new exponent = -(shft val)
- addi.w &0x6000,%d0 # add new bias to exponent
- mov.w FP_SCR0_EX(%a6),%d1 # fetch old sign,exp
- andi.w &0x8000,%d1 # keep old sign
- andi.w &0x7fff,%d0 # clear sign position
- or.w %d1,%d0 # concat new exo,old sign
- mov.w %d0,FP_SCR0_EX(%a6) # insert new exponent
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- rts
-
-#
-# operand is to be rounded to single or double precision
-#
-fin_not_ext:
- cmpi.b %d0,&s_mode*0x10 # separate sgl/dbl prec
- bne.b fin_dbl
-
-#
-# operand is to be rounded to single precision
-#
-fin_sgl:
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- bsr.l scale_to_zero_src # calculate scale factor
-
- cmpi.l %d0,&0x3fff-0x3f80 # will move in underflow?
- bge.w fin_sd_unfl # yes; go handle underflow
- cmpi.l %d0,&0x3fff-0x407e # will move in overflow?
- beq.w fin_sd_may_ovfl # maybe; go check
- blt.w fin_sd_ovfl # yes; go handle overflow
-
-#
-# operand will NOT overflow or underflow when moved into the fp reg file
-#
-fin_sd_normal:
- fmov.l &0x0,%fpsr # clear FPSR
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fmov.x FP_SCR0(%a6),%fp0 # perform move
-
- fmov.l %fpsr,%d1 # save FPSR
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-fin_sd_normal_exit:
- mov.l %d2,-(%sp) # save d2
- fmovm.x &0x80,FP_SCR0(%a6) # store out result
- mov.w FP_SCR0_EX(%a6),%d1 # load {sgn,exp}
- mov.w %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- sub.l %d0,%d1 # add scale factor
- andi.w &0x8000,%d2 # keep old sign
- or.w %d1,%d2 # concat old sign,new exponent
- mov.w %d2,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x80 # return result in fp0
- rts
-
-#
-# operand is to be rounded to double precision
-#
-fin_dbl:
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- bsr.l scale_to_zero_src # calculate scale factor
-
- cmpi.l %d0,&0x3fff-0x3c00 # will move in underflow?
- bge.w fin_sd_unfl # yes; go handle underflow
- cmpi.l %d0,&0x3fff-0x43fe # will move in overflow?
- beq.w fin_sd_may_ovfl # maybe; go check
- blt.w fin_sd_ovfl # yes; go handle overflow
- bra.w fin_sd_normal # no; ho handle normalized op
-
-#
-# operand WILL underflow when moved in to the fp register file
-#
-fin_sd_unfl:
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
-
- tst.b FP_SCR0_EX(%a6) # is operand negative?
- bpl.b fin_sd_unfl_tst
- bset &neg_bit,FPSR_CC(%a6) # set 'N' ccode bit
-
-# if underflow or inexact is enabled, then go calculate the EXOP first.
-fin_sd_unfl_tst:
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x0b,%d1 # is UNFL or INEX enabled?
- bne.b fin_sd_unfl_ena # yes
-
-fin_sd_unfl_dis:
- lea FP_SCR0(%a6),%a0 # pass: result addr
- mov.l L_SCR3(%a6),%d1 # pass: rnd prec,mode
- bsr.l unf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # unf_res may have set 'Z'
- fmovm.x FP_SCR0(%a6),&0x80 # return default result in fp0
- rts
-
-#
-# operand will underflow AND underflow or inexact is enabled.
-# therefore, we must return the result rounded to extended precision.
-#
-fin_sd_unfl_ena:
- mov.l FP_SCR0_HI(%a6),FP_SCR1_HI(%a6)
- mov.l FP_SCR0_LO(%a6),FP_SCR1_LO(%a6)
- mov.w FP_SCR0_EX(%a6),%d1 # load current exponent
-
- mov.l %d2,-(%sp) # save d2
- mov.w %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- sub.l %d0,%d1 # subtract scale factor
- andi.w &0x8000,%d2 # extract old sign
- addi.l &0x6000,%d1 # add new bias
- andi.w &0x7fff,%d1
- or.w %d1,%d2 # concat old sign,new exp
- mov.w %d2,FP_SCR1_EX(%a6) # insert new exponent
- fmovm.x FP_SCR1(%a6),&0x40 # return EXOP in fp1
- mov.l (%sp)+,%d2 # restore d2
- bra.b fin_sd_unfl_dis
-
-#
-# operand WILL overflow.
-#
-fin_sd_ovfl:
- fmov.l &0x0,%fpsr # clear FPSR
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fmov.x FP_SCR0(%a6),%fp0 # perform move
-
- fmov.l &0x0,%fpcr # clear FPCR
- fmov.l %fpsr,%d1 # save FPSR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-fin_sd_ovfl_tst:
- or.l &ovfl_inx_mask,USER_FPSR(%a6) # set ovfl/aovfl/ainex
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x13,%d1 # is OVFL or INEX enabled?
- bne.b fin_sd_ovfl_ena # yes
-
-#
-# OVFL is not enabled; therefore, we must create the default result by
-# calling ovf_res().
-#
-fin_sd_ovfl_dis:
- btst &neg_bit,FPSR_CC(%a6) # is result negative?
- sne %d1 # set sign param accordingly
- mov.l L_SCR3(%a6),%d0 # pass: prec,mode
- bsr.l ovf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # set INF,N if applicable
- fmovm.x (%a0),&0x80 # return default result in fp0
- rts
-
-#
-# OVFL is enabled.
-# the INEX2 bit has already been updated by the round to the correct precision.
-# now, round to extended(and don't alter the FPSR).
-#
-fin_sd_ovfl_ena:
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # fetch {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- sub.l &0x6000,%d1 # subtract bias
- andi.w &0x7fff,%d1
- or.w %d2,%d1
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- bra.b fin_sd_ovfl_dis
-
-#
-# the move in MAY overflow. so...
-#
-fin_sd_may_ovfl:
- fmov.l &0x0,%fpsr # clear FPSR
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fmov.x FP_SCR0(%a6),%fp0 # perform the move
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
- fabs.x %fp0,%fp1 # make a copy of result
- fcmp.b %fp1,&0x2 # is |result| >= 2.b?
- fbge.w fin_sd_ovfl_tst # yes; overflow has occurred
-
-# no, it didn't overflow; we have correct result
- bra.w fin_sd_normal_exit
-
-##########################################################################
-
-#
-# operand is not a NORM: check its optype and branch accordingly
-#
-fin_not_norm:
- cmpi.b %d1,&DENORM # weed out DENORM
- beq.w fin_denorm
- cmpi.b %d1,&SNAN # weed out SNANs
- beq.l res_snan_1op
- cmpi.b %d1,&QNAN # weed out QNANs
- beq.l res_qnan_1op
-
-#
-# do the fmove in; at this point, only possible ops are ZERO and INF.
-# use fmov to determine ccodes.
-# prec:mode should be zero at this point but it won't affect answer anyways.
-#
- fmov.x SRC(%a0),%fp0 # do fmove in
- fmov.l %fpsr,%d0 # no exceptions possible
- rol.l &0x8,%d0 # put ccodes in lo byte
- mov.b %d0,FPSR_CC(%a6) # insert correct ccodes
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# fdiv(): emulates the fdiv instruction #
-# fsdiv(): emulates the fsdiv instruction #
-# fddiv(): emulates the fddiv instruction #
-# #
-# XREF **************************************************************** #
-# scale_to_zero_src() - scale src exponent to zero #
-# scale_to_zero_dst() - scale dst exponent to zero #
-# unf_res() - return default underflow result #
-# ovf_res() - return default overflow result #
-# res_qnan() - return QNAN result #
-# res_snan() - return SNAN result #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# a1 = pointer to extended precision destination operand #
-# d0 rnd prec,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = result #
-# fp1 = EXOP (if exception occurred) #
-# #
-# ALGORITHM *********************************************************** #
-# Handle NANs, infinities, and zeroes as special cases. Divide #
-# norms/denorms into ext/sgl/dbl precision. #
-# For norms/denorms, scale the exponents such that a divide #
-# instruction won't cause an exception. Use the regular fdiv to #
-# compute a result. Check if the regular operands would have taken #
-# an exception. If so, return the default overflow/underflow result #
-# and return the EXOP if exceptions are enabled. Else, scale the #
-# result operand to the proper exponent. #
-# #
-#########################################################################
-
- align 0x10
-tbl_fdiv_unfl:
- long 0x3fff - 0x0000 # ext_unfl
- long 0x3fff - 0x3f81 # sgl_unfl
- long 0x3fff - 0x3c01 # dbl_unfl
-
-tbl_fdiv_ovfl:
- long 0x3fff - 0x7ffe # ext overflow exponent
- long 0x3fff - 0x407e # sgl overflow exponent
- long 0x3fff - 0x43fe # dbl overflow exponent
-
- global fsdiv
-fsdiv:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &s_mode*0x10,%d0 # insert sgl prec
- bra.b fdiv
-
- global fddiv
-fddiv:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &d_mode*0x10,%d0 # insert dbl prec
-
- global fdiv
-fdiv:
- mov.l %d0,L_SCR3(%a6) # store rnd info
-
- clr.w %d1
- mov.b DTAG(%a6),%d1
- lsl.b &0x3,%d1
- or.b STAG(%a6),%d1 # combine src tags
-
- bne.w fdiv_not_norm # optimize on non-norm input
-
-#
-# DIVIDE: NORMs and DENORMs ONLY!
-#
-fdiv_norm:
- mov.w DST_EX(%a1),FP_SCR1_EX(%a6)
- mov.l DST_HI(%a1),FP_SCR1_HI(%a6)
- mov.l DST_LO(%a1),FP_SCR1_LO(%a6)
-
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
-
- bsr.l scale_to_zero_src # scale src exponent
- mov.l %d0,-(%sp) # save scale factor 1
-
- bsr.l scale_to_zero_dst # scale dst exponent
-
- neg.l (%sp) # SCALE FACTOR = scale1 - scale2
- add.l %d0,(%sp)
-
- mov.w 2+L_SCR3(%a6),%d1 # fetch precision
- lsr.b &0x6,%d1 # shift to lo bits
- mov.l (%sp)+,%d0 # load S.F.
- cmp.l %d0,(tbl_fdiv_ovfl.b,%pc,%d1.w*4) # will result overflow?
- ble.w fdiv_may_ovfl # result will overflow
-
- cmp.l %d0,(tbl_fdiv_unfl.w,%pc,%d1.w*4) # will result underflow?
- beq.w fdiv_may_unfl # maybe
- bgt.w fdiv_unfl # yes; go handle underflow
-
-fdiv_normal:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l L_SCR3(%a6),%fpcr # save FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fdiv.x FP_SCR0(%a6),%fp0 # perform divide
-
- fmov.l %fpsr,%d1 # save FPSR
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-fdiv_normal_exit:
- fmovm.x &0x80,FP_SCR0(%a6) # store result on stack
- mov.l %d2,-(%sp) # store d2
- mov.w FP_SCR0_EX(%a6),%d1 # load {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- or.w %d2,%d1 # concat old sign,new exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x80 # return result in fp0
- rts
-
-tbl_fdiv_ovfl2:
- long 0x7fff
- long 0x407f
- long 0x43ff
-
-fdiv_no_ovfl:
- mov.l (%sp)+,%d0 # restore scale factor
- bra.b fdiv_normal_exit
-
-fdiv_may_ovfl:
- mov.l %d0,-(%sp) # save scale factor
-
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # set FPSR
-
- fdiv.x FP_SCR0(%a6),%fp0 # execute divide
-
- fmov.l %fpsr,%d0
- fmov.l &0x0,%fpcr
-
- or.l %d0,USER_FPSR(%a6) # save INEX,N
-
- fmovm.x &0x01,-(%sp) # save result to stack
- mov.w (%sp),%d0 # fetch new exponent
- add.l &0xc,%sp # clear result from stack
- andi.l &0x7fff,%d0 # strip sign
- sub.l (%sp),%d0 # add scale factor
- cmp.l %d0,(tbl_fdiv_ovfl2.b,%pc,%d1.w*4)
- blt.b fdiv_no_ovfl
- mov.l (%sp)+,%d0
-
-fdiv_ovfl_tst:
- or.l &ovfl_inx_mask,USER_FPSR(%a6) # set ovfl/aovfl/ainex
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x13,%d1 # is OVFL or INEX enabled?
- bne.b fdiv_ovfl_ena # yes
-
-fdiv_ovfl_dis:
- btst &neg_bit,FPSR_CC(%a6) # is result negative?
- sne %d1 # set sign param accordingly
- mov.l L_SCR3(%a6),%d0 # pass prec:rnd
- bsr.l ovf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # set INF if applicable
- fmovm.x (%a0),&0x80 # return default result in fp0
- rts
-
-fdiv_ovfl_ena:
- mov.l L_SCR3(%a6),%d1
- andi.b &0xc0,%d1 # is precision extended?
- bne.b fdiv_ovfl_ena_sd # no, do sgl or dbl
-
-fdiv_ovfl_ena_cont:
- fmovm.x &0x80,FP_SCR0(%a6) # move result to stack
-
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # fetch {sgn,exp}
- mov.w %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- sub.l %d0,%d1 # add scale factor
- subi.l &0x6000,%d1 # subtract bias
- andi.w &0x7fff,%d1 # clear sign bit
- andi.w &0x8000,%d2 # keep old sign
- or.w %d2,%d1 # concat old sign,new exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- bra.b fdiv_ovfl_dis
-
-fdiv_ovfl_ena_sd:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst operand
-
- mov.l L_SCR3(%a6),%d1
- andi.b &0x30,%d1 # keep rnd mode
- fmov.l %d1,%fpcr # set FPCR
-
- fdiv.x FP_SCR0(%a6),%fp0 # execute divide
-
- fmov.l &0x0,%fpcr # clear FPCR
- bra.b fdiv_ovfl_ena_cont
-
-fdiv_unfl:
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
-
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l &rz_mode*0x10,%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fdiv.x FP_SCR0(%a6),%fp0 # execute divide
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x0b,%d1 # is UNFL or INEX enabled?
- bne.b fdiv_unfl_ena # yes
-
-fdiv_unfl_dis:
- fmovm.x &0x80,FP_SCR0(%a6) # store out result
-
- lea FP_SCR0(%a6),%a0 # pass: result addr
- mov.l L_SCR3(%a6),%d1 # pass: rnd prec,mode
- bsr.l unf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # 'Z' may have been set
- fmovm.x FP_SCR0(%a6),&0x80 # return default result in fp0
- rts
-
-#
-# UNFL is enabled.
-#
-fdiv_unfl_ena:
- fmovm.x FP_SCR1(%a6),&0x40 # load dst op
-
- mov.l L_SCR3(%a6),%d1
- andi.b &0xc0,%d1 # is precision extended?
- bne.b fdiv_unfl_ena_sd # no, sgl or dbl
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
-fdiv_unfl_ena_cont:
- fmov.l &0x0,%fpsr # clear FPSR
-
- fdiv.x FP_SCR0(%a6),%fp1 # execute divide
-
- fmov.l &0x0,%fpcr # clear FPCR
-
- fmovm.x &0x40,FP_SCR0(%a6) # save result to stack
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # fetch {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- addi.l &0x6000,%d1 # add bias
- andi.w &0x7fff,%d1
- or.w %d2,%d1 # concat old sign,new exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exp
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- bra.w fdiv_unfl_dis
-
-fdiv_unfl_ena_sd:
- mov.l L_SCR3(%a6),%d1
- andi.b &0x30,%d1 # use only rnd mode
- fmov.l %d1,%fpcr # set FPCR
-
- bra.b fdiv_unfl_ena_cont
-
-#
-# the divide operation MAY underflow:
-#
-fdiv_may_unfl:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fdiv.x FP_SCR0(%a6),%fp0 # execute divide
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
- fabs.x %fp0,%fp1 # make a copy of result
- fcmp.b %fp1,&0x1 # is |result| > 1.b?
- fbgt.w fdiv_normal_exit # no; no underflow occurred
- fblt.w fdiv_unfl # yes; underflow occurred
-
-#
-# we still don't know if underflow occurred. result is ~ equal to 1. but,
-# we don't know if the result was an underflow that rounded up to a 1
-# or a normalized number that rounded down to a 1. so, redo the entire
-# operation using RZ as the rounding mode to see what the pre-rounded
-# result is. this case should be relatively rare.
-#
- fmovm.x FP_SCR1(%a6),&0x40 # load dst op into fp1
-
- mov.l L_SCR3(%a6),%d1
- andi.b &0xc0,%d1 # keep rnd prec
- ori.b &rz_mode*0x10,%d1 # insert RZ
-
- fmov.l %d1,%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fdiv.x FP_SCR0(%a6),%fp1 # execute divide
-
- fmov.l &0x0,%fpcr # clear FPCR
- fabs.x %fp1 # make absolute value
- fcmp.b %fp1,&0x1 # is |result| < 1.b?
- fbge.w fdiv_normal_exit # no; no underflow occurred
- bra.w fdiv_unfl # yes; underflow occurred
-
-############################################################################
-
-#
-# Divide: inputs are not both normalized; what are they?
-#
-fdiv_not_norm:
- mov.w (tbl_fdiv_op.b,%pc,%d1.w*2),%d1
- jmp (tbl_fdiv_op.b,%pc,%d1.w*1)
-
- swbeg &48
-tbl_fdiv_op:
- short fdiv_norm - tbl_fdiv_op # NORM / NORM
- short fdiv_inf_load - tbl_fdiv_op # NORM / ZERO
- short fdiv_zero_load - tbl_fdiv_op # NORM / INF
- short fdiv_res_qnan - tbl_fdiv_op # NORM / QNAN
- short fdiv_norm - tbl_fdiv_op # NORM / DENORM
- short fdiv_res_snan - tbl_fdiv_op # NORM / SNAN
- short tbl_fdiv_op - tbl_fdiv_op #
- short tbl_fdiv_op - tbl_fdiv_op #
-
- short fdiv_zero_load - tbl_fdiv_op # ZERO / NORM
- short fdiv_res_operr - tbl_fdiv_op # ZERO / ZERO
- short fdiv_zero_load - tbl_fdiv_op # ZERO / INF
- short fdiv_res_qnan - tbl_fdiv_op # ZERO / QNAN
- short fdiv_zero_load - tbl_fdiv_op # ZERO / DENORM
- short fdiv_res_snan - tbl_fdiv_op # ZERO / SNAN
- short tbl_fdiv_op - tbl_fdiv_op #
- short tbl_fdiv_op - tbl_fdiv_op #
-
- short fdiv_inf_dst - tbl_fdiv_op # INF / NORM
- short fdiv_inf_dst - tbl_fdiv_op # INF / ZERO
- short fdiv_res_operr - tbl_fdiv_op # INF / INF
- short fdiv_res_qnan - tbl_fdiv_op # INF / QNAN
- short fdiv_inf_dst - tbl_fdiv_op # INF / DENORM
- short fdiv_res_snan - tbl_fdiv_op # INF / SNAN
- short tbl_fdiv_op - tbl_fdiv_op #
- short tbl_fdiv_op - tbl_fdiv_op #
-
- short fdiv_res_qnan - tbl_fdiv_op # QNAN / NORM
- short fdiv_res_qnan - tbl_fdiv_op # QNAN / ZERO
- short fdiv_res_qnan - tbl_fdiv_op # QNAN / INF
- short fdiv_res_qnan - tbl_fdiv_op # QNAN / QNAN
- short fdiv_res_qnan - tbl_fdiv_op # QNAN / DENORM
- short fdiv_res_snan - tbl_fdiv_op # QNAN / SNAN
- short tbl_fdiv_op - tbl_fdiv_op #
- short tbl_fdiv_op - tbl_fdiv_op #
-
- short fdiv_norm - tbl_fdiv_op # DENORM / NORM
- short fdiv_inf_load - tbl_fdiv_op # DENORM / ZERO
- short fdiv_zero_load - tbl_fdiv_op # DENORM / INF
- short fdiv_res_qnan - tbl_fdiv_op # DENORM / QNAN
- short fdiv_norm - tbl_fdiv_op # DENORM / DENORM
- short fdiv_res_snan - tbl_fdiv_op # DENORM / SNAN
- short tbl_fdiv_op - tbl_fdiv_op #
- short tbl_fdiv_op - tbl_fdiv_op #
-
- short fdiv_res_snan - tbl_fdiv_op # SNAN / NORM
- short fdiv_res_snan - tbl_fdiv_op # SNAN / ZERO
- short fdiv_res_snan - tbl_fdiv_op # SNAN / INF
- short fdiv_res_snan - tbl_fdiv_op # SNAN / QNAN
- short fdiv_res_snan - tbl_fdiv_op # SNAN / DENORM
- short fdiv_res_snan - tbl_fdiv_op # SNAN / SNAN
- short tbl_fdiv_op - tbl_fdiv_op #
- short tbl_fdiv_op - tbl_fdiv_op #
-
-fdiv_res_qnan:
- bra.l res_qnan
-fdiv_res_snan:
- bra.l res_snan
-fdiv_res_operr:
- bra.l res_operr
-
- global fdiv_zero_load # global for fsgldiv
-fdiv_zero_load:
- mov.b SRC_EX(%a0),%d0 # result sign is exclusive
- mov.b DST_EX(%a1),%d1 # or of input signs.
- eor.b %d0,%d1
- bpl.b fdiv_zero_load_p # result is positive
- fmov.s &0x80000000,%fp0 # load a -ZERO
- mov.b &z_bmask+neg_bmask,FPSR_CC(%a6) # set Z/N
- rts
-fdiv_zero_load_p:
- fmov.s &0x00000000,%fp0 # load a +ZERO
- mov.b &z_bmask,FPSR_CC(%a6) # set Z
- rts
-
-#
-# The destination was In Range and the source was a ZERO. The result,
-# therefore, is an INF w/ the proper sign.
-# So, determine the sign and return a new INF (w/ the j-bit cleared).
-#
- global fdiv_inf_load # global for fsgldiv
-fdiv_inf_load:
- ori.w &dz_mask+adz_mask,2+USER_FPSR(%a6) # no; set DZ/ADZ
- mov.b SRC_EX(%a0),%d0 # load both signs
- mov.b DST_EX(%a1),%d1
- eor.b %d0,%d1
- bpl.b fdiv_inf_load_p # result is positive
- fmov.s &0xff800000,%fp0 # make result -INF
- mov.b &inf_bmask+neg_bmask,FPSR_CC(%a6) # set INF/N
- rts
-fdiv_inf_load_p:
- fmov.s &0x7f800000,%fp0 # make result +INF
- mov.b &inf_bmask,FPSR_CC(%a6) # set INF
- rts
-
-#
-# The destination was an INF w/ an In Range or ZERO source, the result is
-# an INF w/ the proper sign.
-# The 68881/882 returns the destination INF w/ the new sign(if the j-bit of the
-# dst INF is set, then then j-bit of the result INF is also set).
-#
- global fdiv_inf_dst # global for fsgldiv
-fdiv_inf_dst:
- mov.b DST_EX(%a1),%d0 # load both signs
- mov.b SRC_EX(%a0),%d1
- eor.b %d0,%d1
- bpl.b fdiv_inf_dst_p # result is positive
-
- fmovm.x DST(%a1),&0x80 # return result in fp0
- fabs.x %fp0 # clear sign bit
- fneg.x %fp0 # set sign bit
- mov.b &inf_bmask+neg_bmask,FPSR_CC(%a6) # set INF/NEG
- rts
-
-fdiv_inf_dst_p:
- fmovm.x DST(%a1),&0x80 # return result in fp0
- fabs.x %fp0 # return positive INF
- mov.b &inf_bmask,FPSR_CC(%a6) # set INF
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# fneg(): emulates the fneg instruction #
-# fsneg(): emulates the fsneg instruction #
-# fdneg(): emulates the fdneg instruction #
-# #
-# XREF **************************************************************** #
-# norm() - normalize a denorm to provide EXOP #
-# scale_to_zero_src() - scale sgl/dbl source exponent #
-# ovf_res() - return default overflow result #
-# unf_res() - return default underflow result #
-# res_qnan_1op() - return QNAN result #
-# res_snan_1op() - return SNAN result #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# d0 = rnd prec,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = result #
-# fp1 = EXOP (if exception occurred) #
-# #
-# ALGORITHM *********************************************************** #
-# Handle NANs, zeroes, and infinities as special cases. Separate #
-# norms/denorms into ext/sgl/dbl precisions. Extended precision can be #
-# emulated by simply setting sign bit. Sgl/dbl operands must be scaled #
-# and an actual fneg performed to see if overflow/underflow would have #
-# occurred. If so, return default underflow/overflow result. Else, #
-# scale the result exponent and return result. FPSR gets set based on #
-# the result value. #
-# #
-#########################################################################
-
- global fsneg
-fsneg:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &s_mode*0x10,%d0 # insert sgl precision
- bra.b fneg
-
- global fdneg
-fdneg:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &d_mode*0x10,%d0 # insert dbl prec
-
- global fneg
-fneg:
- mov.l %d0,L_SCR3(%a6) # store rnd info
- mov.b STAG(%a6),%d1
- bne.w fneg_not_norm # optimize on non-norm input
-
-#
-# NEGATE SIGN : norms and denorms ONLY!
-#
-fneg_norm:
- andi.b &0xc0,%d0 # is precision extended?
- bne.w fneg_not_ext # no; go handle sgl or dbl
-
-#
-# precision selected is extended. so...we can not get an underflow
-# or overflow because of rounding to the correct precision. so...
-# skip the scaling and unscaling...
-#
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- mov.w SRC_EX(%a0),%d0
- eori.w &0x8000,%d0 # negate sign
- bpl.b fneg_norm_load # sign is positive
- mov.b &neg_bmask,FPSR_CC(%a6) # set 'N' ccode bit
-fneg_norm_load:
- mov.w %d0,FP_SCR0_EX(%a6)
- fmovm.x FP_SCR0(%a6),&0x80 # return result in fp0
- rts
-
-#
-# for an extended precision DENORM, the UNFL exception bit is set
-# the accrued bit is NOT set in this instance(no inexactness!)
-#
-fneg_denorm:
- andi.b &0xc0,%d0 # is precision extended?
- bne.b fneg_not_ext # no; go handle sgl or dbl
-
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
-
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- mov.w SRC_EX(%a0),%d0
- eori.w &0x8000,%d0 # negate sign
- bpl.b fneg_denorm_done # no
- mov.b &neg_bmask,FPSR_CC(%a6) # yes, set 'N' ccode bit
-fneg_denorm_done:
- mov.w %d0,FP_SCR0_EX(%a6)
- fmovm.x FP_SCR0(%a6),&0x80 # return default result in fp0
-
- btst &unfl_bit,FPCR_ENABLE(%a6) # is UNFL enabled?
- bne.b fneg_ext_unfl_ena # yes
- rts
-
-#
-# the input is an extended DENORM and underflow is enabled in the FPCR.
-# normalize the mantissa and add the bias of 0x6000 to the resulting negative
-# exponent and insert back into the operand.
-#
-fneg_ext_unfl_ena:
- lea FP_SCR0(%a6),%a0 # pass: ptr to operand
- bsr.l norm # normalize result
- neg.w %d0 # new exponent = -(shft val)
- addi.w &0x6000,%d0 # add new bias to exponent
- mov.w FP_SCR0_EX(%a6),%d1 # fetch old sign,exp
- andi.w &0x8000,%d1 # keep old sign
- andi.w &0x7fff,%d0 # clear sign position
- or.w %d1,%d0 # concat old sign, new exponent
- mov.w %d0,FP_SCR0_EX(%a6) # insert new exponent
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- rts
-
-#
-# operand is either single or double
-#
-fneg_not_ext:
- cmpi.b %d0,&s_mode*0x10 # separate sgl/dbl prec
- bne.b fneg_dbl
-
-#
-# operand is to be rounded to single precision
-#
-fneg_sgl:
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- bsr.l scale_to_zero_src # calculate scale factor
-
- cmpi.l %d0,&0x3fff-0x3f80 # will move in underflow?
- bge.w fneg_sd_unfl # yes; go handle underflow
- cmpi.l %d0,&0x3fff-0x407e # will move in overflow?
- beq.w fneg_sd_may_ovfl # maybe; go check
- blt.w fneg_sd_ovfl # yes; go handle overflow
-
-#
-# operand will NOT overflow or underflow when moved in to the fp reg file
-#
-fneg_sd_normal:
- fmov.l &0x0,%fpsr # clear FPSR
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fneg.x FP_SCR0(%a6),%fp0 # perform negation
-
- fmov.l %fpsr,%d1 # save FPSR
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-fneg_sd_normal_exit:
- mov.l %d2,-(%sp) # save d2
- fmovm.x &0x80,FP_SCR0(%a6) # store out result
- mov.w FP_SCR0_EX(%a6),%d1 # load sgn,exp
- mov.w %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- sub.l %d0,%d1 # add scale factor
- andi.w &0x8000,%d2 # keep old sign
- or.w %d1,%d2 # concat old sign,new exp
- mov.w %d2,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x80 # return result in fp0
- rts
-
-#
-# operand is to be rounded to double precision
-#
-fneg_dbl:
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- bsr.l scale_to_zero_src # calculate scale factor
-
- cmpi.l %d0,&0x3fff-0x3c00 # will move in underflow?
- bge.b fneg_sd_unfl # yes; go handle underflow
- cmpi.l %d0,&0x3fff-0x43fe # will move in overflow?
- beq.w fneg_sd_may_ovfl # maybe; go check
- blt.w fneg_sd_ovfl # yes; go handle overflow
- bra.w fneg_sd_normal # no; ho handle normalized op
-
-#
-# operand WILL underflow when moved in to the fp register file
-#
-fneg_sd_unfl:
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
-
- eori.b &0x80,FP_SCR0_EX(%a6) # negate sign
- bpl.b fneg_sd_unfl_tst
- bset &neg_bit,FPSR_CC(%a6) # set 'N' ccode bit
-
-# if underflow or inexact is enabled, go calculate EXOP first.
-fneg_sd_unfl_tst:
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x0b,%d1 # is UNFL or INEX enabled?
- bne.b fneg_sd_unfl_ena # yes
-
-fneg_sd_unfl_dis:
- lea FP_SCR0(%a6),%a0 # pass: result addr
- mov.l L_SCR3(%a6),%d1 # pass: rnd prec,mode
- bsr.l unf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # unf_res may have set 'Z'
- fmovm.x FP_SCR0(%a6),&0x80 # return default result in fp0
- rts
-
-#
-# operand will underflow AND underflow is enabled.
-# therefore, we must return the result rounded to extended precision.
-#
-fneg_sd_unfl_ena:
- mov.l FP_SCR0_HI(%a6),FP_SCR1_HI(%a6)
- mov.l FP_SCR0_LO(%a6),FP_SCR1_LO(%a6)
- mov.w FP_SCR0_EX(%a6),%d1 # load current exponent
-
- mov.l %d2,-(%sp) # save d2
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # subtract scale factor
- addi.l &0x6000,%d1 # add new bias
- andi.w &0x7fff,%d1
- or.w %d2,%d1 # concat new sign,new exp
- mov.w %d1,FP_SCR1_EX(%a6) # insert new exp
- fmovm.x FP_SCR1(%a6),&0x40 # return EXOP in fp1
- mov.l (%sp)+,%d2 # restore d2
- bra.b fneg_sd_unfl_dis
-
-#
-# operand WILL overflow.
-#
-fneg_sd_ovfl:
- fmov.l &0x0,%fpsr # clear FPSR
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fneg.x FP_SCR0(%a6),%fp0 # perform negation
-
- fmov.l &0x0,%fpcr # clear FPCR
- fmov.l %fpsr,%d1 # save FPSR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-fneg_sd_ovfl_tst:
- or.l &ovfl_inx_mask,USER_FPSR(%a6) # set ovfl/aovfl/ainex
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x13,%d1 # is OVFL or INEX enabled?
- bne.b fneg_sd_ovfl_ena # yes
-
-#
-# OVFL is not enabled; therefore, we must create the default result by
-# calling ovf_res().
-#
-fneg_sd_ovfl_dis:
- btst &neg_bit,FPSR_CC(%a6) # is result negative?
- sne %d1 # set sign param accordingly
- mov.l L_SCR3(%a6),%d0 # pass: prec,mode
- bsr.l ovf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # set INF,N if applicable
- fmovm.x (%a0),&0x80 # return default result in fp0
- rts
-
-#
-# OVFL is enabled.
-# the INEX2 bit has already been updated by the round to the correct precision.
-# now, round to extended(and don't alter the FPSR).
-#
-fneg_sd_ovfl_ena:
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # fetch {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- subi.l &0x6000,%d1 # subtract bias
- andi.w &0x7fff,%d1
- or.w %d2,%d1 # concat sign,exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- mov.l (%sp)+,%d2 # restore d2
- bra.b fneg_sd_ovfl_dis
-
-#
-# the move in MAY underflow. so...
-#
-fneg_sd_may_ovfl:
- fmov.l &0x0,%fpsr # clear FPSR
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fneg.x FP_SCR0(%a6),%fp0 # perform negation
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
- fabs.x %fp0,%fp1 # make a copy of result
- fcmp.b %fp1,&0x2 # is |result| >= 2.b?
- fbge.w fneg_sd_ovfl_tst # yes; overflow has occurred
-
-# no, it didn't overflow; we have correct result
- bra.w fneg_sd_normal_exit
-
-##########################################################################
-
-#
-# input is not normalized; what is it?
-#
-fneg_not_norm:
- cmpi.b %d1,&DENORM # weed out DENORM
- beq.w fneg_denorm
- cmpi.b %d1,&SNAN # weed out SNAN
- beq.l res_snan_1op
- cmpi.b %d1,&QNAN # weed out QNAN
- beq.l res_qnan_1op
-
-#
-# do the fneg; at this point, only possible ops are ZERO and INF.
-# use fneg to determine ccodes.
-# prec:mode should be zero at this point but it won't affect answer anyways.
-#
- fneg.x SRC_EX(%a0),%fp0 # do fneg
- fmov.l %fpsr,%d0
- rol.l &0x8,%d0 # put ccodes in lo byte
- mov.b %d0,FPSR_CC(%a6) # insert correct ccodes
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# ftst(): emulates the ftest instruction #
-# #
-# XREF **************************************************************** #
-# res{s,q}nan_1op() - set NAN result for monadic instruction #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# #
-# OUTPUT ************************************************************** #
-# none #
-# #
-# ALGORITHM *********************************************************** #
-# Check the source operand tag (STAG) and set the FPCR according #
-# to the operand type and sign. #
-# #
-#########################################################################
-
- global ftst
-ftst:
- mov.b STAG(%a6),%d1
- bne.b ftst_not_norm # optimize on non-norm input
-
-#
-# Norm:
-#
-ftst_norm:
- tst.b SRC_EX(%a0) # is operand negative?
- bmi.b ftst_norm_m # yes
- rts
-ftst_norm_m:
- mov.b &neg_bmask,FPSR_CC(%a6) # set 'N' ccode bit
- rts
-
-#
-# input is not normalized; what is it?
-#
-ftst_not_norm:
- cmpi.b %d1,&ZERO # weed out ZERO
- beq.b ftst_zero
- cmpi.b %d1,&INF # weed out INF
- beq.b ftst_inf
- cmpi.b %d1,&SNAN # weed out SNAN
- beq.l res_snan_1op
- cmpi.b %d1,&QNAN # weed out QNAN
- beq.l res_qnan_1op
-
-#
-# Denorm:
-#
-ftst_denorm:
- tst.b SRC_EX(%a0) # is operand negative?
- bmi.b ftst_denorm_m # yes
- rts
-ftst_denorm_m:
- mov.b &neg_bmask,FPSR_CC(%a6) # set 'N' ccode bit
- rts
-
-#
-# Infinity:
-#
-ftst_inf:
- tst.b SRC_EX(%a0) # is operand negative?
- bmi.b ftst_inf_m # yes
-ftst_inf_p:
- mov.b &inf_bmask,FPSR_CC(%a6) # set 'I' ccode bit
- rts
-ftst_inf_m:
- mov.b &inf_bmask+neg_bmask,FPSR_CC(%a6) # set 'I','N' ccode bits
- rts
-
-#
-# Zero:
-#
-ftst_zero:
- tst.b SRC_EX(%a0) # is operand negative?
- bmi.b ftst_zero_m # yes
-ftst_zero_p:
- mov.b &z_bmask,FPSR_CC(%a6) # set 'N' ccode bit
- rts
-ftst_zero_m:
- mov.b &z_bmask+neg_bmask,FPSR_CC(%a6) # set 'Z','N' ccode bits
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# fint(): emulates the fint instruction #
-# #
-# XREF **************************************************************** #
-# res_{s,q}nan_1op() - set NAN result for monadic operation #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# d0 = round precision/mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = result #
-# #
-# ALGORITHM *********************************************************** #
-# Separate according to operand type. Unnorms don't pass through #
-# here. For norms, load the rounding mode/prec, execute a "fint", then #
-# store the resulting FPSR bits. #
-# For denorms, force the j-bit to a one and do the same as for #
-# norms. Denorms are so low that the answer will either be a zero or a #
-# one. #
-# For zeroes/infs/NANs, return the same while setting the FPSR #
-# as appropriate. #
-# #
-#########################################################################
-
- global fint
-fint:
- mov.b STAG(%a6),%d1
- bne.b fint_not_norm # optimize on non-norm input
-
-#
-# Norm:
-#
-fint_norm:
- andi.b &0x30,%d0 # set prec = ext
-
- fmov.l %d0,%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fint.x SRC(%a0),%fp0 # execute fint
-
- fmov.l &0x0,%fpcr # clear FPCR
- fmov.l %fpsr,%d0 # save FPSR
- or.l %d0,USER_FPSR(%a6) # set exception bits
-
- rts
-
-#
-# input is not normalized; what is it?
-#
-fint_not_norm:
- cmpi.b %d1,&ZERO # weed out ZERO
- beq.b fint_zero
- cmpi.b %d1,&INF # weed out INF
- beq.b fint_inf
- cmpi.b %d1,&DENORM # weed out DENORM
- beq.b fint_denorm
- cmpi.b %d1,&SNAN # weed out SNAN
- beq.l res_snan_1op
- bra.l res_qnan_1op # weed out QNAN
-
-#
-# Denorm:
-#
-# for DENORMs, the result will be either (+/-)ZERO or (+/-)1.
-# also, the INEX2 and AINEX exception bits will be set.
-# so, we could either set these manually or force the DENORM
-# to a very small NORM and ship it to the NORM routine.
-# I do the latter.
-#
-fint_denorm:
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6) # copy sign, zero exp
- mov.b &0x80,FP_SCR0_HI(%a6) # force DENORM ==> small NORM
- lea FP_SCR0(%a6),%a0
- bra.b fint_norm
-
-#
-# Zero:
-#
-fint_zero:
- tst.b SRC_EX(%a0) # is ZERO negative?
- bmi.b fint_zero_m # yes
-fint_zero_p:
- fmov.s &0x00000000,%fp0 # return +ZERO in fp0
- mov.b &z_bmask,FPSR_CC(%a6) # set 'Z' ccode bit
- rts
-fint_zero_m:
- fmov.s &0x80000000,%fp0 # return -ZERO in fp0
- mov.b &z_bmask+neg_bmask,FPSR_CC(%a6) # set 'Z','N' ccode bits
- rts
-
-#
-# Infinity:
-#
-fint_inf:
- fmovm.x SRC(%a0),&0x80 # return result in fp0
- tst.b SRC_EX(%a0) # is INF negative?
- bmi.b fint_inf_m # yes
-fint_inf_p:
- mov.b &inf_bmask,FPSR_CC(%a6) # set 'I' ccode bit
- rts
-fint_inf_m:
- mov.b &inf_bmask+neg_bmask,FPSR_CC(%a6) # set 'N','I' ccode bits
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# fintrz(): emulates the fintrz instruction #
-# #
-# XREF **************************************************************** #
-# res_{s,q}nan_1op() - set NAN result for monadic operation #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# d0 = round precision/mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = result #
-# #
-# ALGORITHM *********************************************************** #
-# Separate according to operand type. Unnorms don't pass through #
-# here. For norms, load the rounding mode/prec, execute a "fintrz", #
-# then store the resulting FPSR bits. #
-# For denorms, force the j-bit to a one and do the same as for #
-# norms. Denorms are so low that the answer will either be a zero or a #
-# one. #
-# For zeroes/infs/NANs, return the same while setting the FPSR #
-# as appropriate. #
-# #
-#########################################################################
-
- global fintrz
-fintrz:
- mov.b STAG(%a6),%d1
- bne.b fintrz_not_norm # optimize on non-norm input
-
-#
-# Norm:
-#
-fintrz_norm:
- fmov.l &0x0,%fpsr # clear FPSR
-
- fintrz.x SRC(%a0),%fp0 # execute fintrz
-
- fmov.l %fpsr,%d0 # save FPSR
- or.l %d0,USER_FPSR(%a6) # set exception bits
-
- rts
-
-#
-# input is not normalized; what is it?
-#
-fintrz_not_norm:
- cmpi.b %d1,&ZERO # weed out ZERO
- beq.b fintrz_zero
- cmpi.b %d1,&INF # weed out INF
- beq.b fintrz_inf
- cmpi.b %d1,&DENORM # weed out DENORM
- beq.b fintrz_denorm
- cmpi.b %d1,&SNAN # weed out SNAN
- beq.l res_snan_1op
- bra.l res_qnan_1op # weed out QNAN
-
-#
-# Denorm:
-#
-# for DENORMs, the result will be (+/-)ZERO.
-# also, the INEX2 and AINEX exception bits will be set.
-# so, we could either set these manually or force the DENORM
-# to a very small NORM and ship it to the NORM routine.
-# I do the latter.
-#
-fintrz_denorm:
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6) # copy sign, zero exp
- mov.b &0x80,FP_SCR0_HI(%a6) # force DENORM ==> small NORM
- lea FP_SCR0(%a6),%a0
- bra.b fintrz_norm
-
-#
-# Zero:
-#
-fintrz_zero:
- tst.b SRC_EX(%a0) # is ZERO negative?
- bmi.b fintrz_zero_m # yes
-fintrz_zero_p:
- fmov.s &0x00000000,%fp0 # return +ZERO in fp0
- mov.b &z_bmask,FPSR_CC(%a6) # set 'Z' ccode bit
- rts
-fintrz_zero_m:
- fmov.s &0x80000000,%fp0 # return -ZERO in fp0
- mov.b &z_bmask+neg_bmask,FPSR_CC(%a6) # set 'Z','N' ccode bits
- rts
-
-#
-# Infinity:
-#
-fintrz_inf:
- fmovm.x SRC(%a0),&0x80 # return result in fp0
- tst.b SRC_EX(%a0) # is INF negative?
- bmi.b fintrz_inf_m # yes
-fintrz_inf_p:
- mov.b &inf_bmask,FPSR_CC(%a6) # set 'I' ccode bit
- rts
-fintrz_inf_m:
- mov.b &inf_bmask+neg_bmask,FPSR_CC(%a6) # set 'N','I' ccode bits
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# fabs(): emulates the fabs instruction #
-# fsabs(): emulates the fsabs instruction #
-# fdabs(): emulates the fdabs instruction #
-# #
-# XREF **************************************************************** #
-# norm() - normalize denorm mantissa to provide EXOP #
-# scale_to_zero_src() - make exponent. = 0; get scale factor #
-# unf_res() - calculate underflow result #
-# ovf_res() - calculate overflow result #
-# res_{s,q}nan_1op() - set NAN result for monadic operation #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# d0 = rnd precision/mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = result #
-# fp1 = EXOP (if exception occurred) #
-# #
-# ALGORITHM *********************************************************** #
-# Handle NANs, infinities, and zeroes as special cases. Divide #
-# norms into extended, single, and double precision. #
-# Simply clear sign for extended precision norm. Ext prec denorm #
-# gets an EXOP created for it since it's an underflow. #
-# Double and single precision can overflow and underflow. First, #
-# scale the operand such that the exponent is zero. Perform an "fabs" #
-# using the correct rnd mode/prec. Check to see if the original #
-# exponent would take an exception. If so, use unf_res() or ovf_res() #
-# to calculate the default result. Also, create the EXOP for the #
-# exceptional case. If no exception should occur, insert the correct #
-# result exponent and return. #
-# Unnorms don't pass through here. #
-# #
-#########################################################################
-
- global fsabs
-fsabs:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &s_mode*0x10,%d0 # insert sgl precision
- bra.b fabs
-
- global fdabs
-fdabs:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &d_mode*0x10,%d0 # insert dbl precision
-
- global fabs
-fabs:
- mov.l %d0,L_SCR3(%a6) # store rnd info
- mov.b STAG(%a6),%d1
- bne.w fabs_not_norm # optimize on non-norm input
-
-#
-# ABSOLUTE VALUE: norms and denorms ONLY!
-#
-fabs_norm:
- andi.b &0xc0,%d0 # is precision extended?
- bne.b fabs_not_ext # no; go handle sgl or dbl
-
-#
-# precision selected is extended. so...we can not get an underflow
-# or overflow because of rounding to the correct precision. so...
-# skip the scaling and unscaling...
-#
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- mov.w SRC_EX(%a0),%d1
- bclr &15,%d1 # force absolute value
- mov.w %d1,FP_SCR0_EX(%a6) # insert exponent
- fmovm.x FP_SCR0(%a6),&0x80 # return result in fp0
- rts
-
-#
-# for an extended precision DENORM, the UNFL exception bit is set
-# the accrued bit is NOT set in this instance(no inexactness!)
-#
-fabs_denorm:
- andi.b &0xc0,%d0 # is precision extended?
- bne.b fabs_not_ext # no
-
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
-
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- mov.w SRC_EX(%a0),%d0
- bclr &15,%d0 # clear sign
- mov.w %d0,FP_SCR0_EX(%a6) # insert exponent
-
- fmovm.x FP_SCR0(%a6),&0x80 # return default result in fp0
-
- btst &unfl_bit,FPCR_ENABLE(%a6) # is UNFL enabled?
- bne.b fabs_ext_unfl_ena
- rts
-
-#
-# the input is an extended DENORM and underflow is enabled in the FPCR.
-# normalize the mantissa and add the bias of 0x6000 to the resulting negative
-# exponent and insert back into the operand.
-#
-fabs_ext_unfl_ena:
- lea FP_SCR0(%a6),%a0 # pass: ptr to operand
- bsr.l norm # normalize result
- neg.w %d0 # new exponent = -(shft val)
- addi.w &0x6000,%d0 # add new bias to exponent
- mov.w FP_SCR0_EX(%a6),%d1 # fetch old sign,exp
- andi.w &0x8000,%d1 # keep old sign
- andi.w &0x7fff,%d0 # clear sign position
- or.w %d1,%d0 # concat old sign, new exponent
- mov.w %d0,FP_SCR0_EX(%a6) # insert new exponent
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- rts
-
-#
-# operand is either single or double
-#
-fabs_not_ext:
- cmpi.b %d0,&s_mode*0x10 # separate sgl/dbl prec
- bne.b fabs_dbl
-
-#
-# operand is to be rounded to single precision
-#
-fabs_sgl:
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- bsr.l scale_to_zero_src # calculate scale factor
-
- cmpi.l %d0,&0x3fff-0x3f80 # will move in underflow?
- bge.w fabs_sd_unfl # yes; go handle underflow
- cmpi.l %d0,&0x3fff-0x407e # will move in overflow?
- beq.w fabs_sd_may_ovfl # maybe; go check
- blt.w fabs_sd_ovfl # yes; go handle overflow
-
-#
-# operand will NOT overflow or underflow when moved in to the fp reg file
-#
-fabs_sd_normal:
- fmov.l &0x0,%fpsr # clear FPSR
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fabs.x FP_SCR0(%a6),%fp0 # perform absolute
-
- fmov.l %fpsr,%d1 # save FPSR
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-fabs_sd_normal_exit:
- mov.l %d2,-(%sp) # save d2
- fmovm.x &0x80,FP_SCR0(%a6) # store out result
- mov.w FP_SCR0_EX(%a6),%d1 # load sgn,exp
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- sub.l %d0,%d1 # add scale factor
- andi.w &0x8000,%d2 # keep old sign
- or.w %d1,%d2 # concat old sign,new exp
- mov.w %d2,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x80 # return result in fp0
- rts
-
-#
-# operand is to be rounded to double precision
-#
-fabs_dbl:
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- bsr.l scale_to_zero_src # calculate scale factor
-
- cmpi.l %d0,&0x3fff-0x3c00 # will move in underflow?
- bge.b fabs_sd_unfl # yes; go handle underflow
- cmpi.l %d0,&0x3fff-0x43fe # will move in overflow?
- beq.w fabs_sd_may_ovfl # maybe; go check
- blt.w fabs_sd_ovfl # yes; go handle overflow
- bra.w fabs_sd_normal # no; ho handle normalized op
-
-#
-# operand WILL underflow when moved in to the fp register file
-#
-fabs_sd_unfl:
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
-
- bclr &0x7,FP_SCR0_EX(%a6) # force absolute value
-
-# if underflow or inexact is enabled, go calculate EXOP first.
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x0b,%d1 # is UNFL or INEX enabled?
- bne.b fabs_sd_unfl_ena # yes
-
-fabs_sd_unfl_dis:
- lea FP_SCR0(%a6),%a0 # pass: result addr
- mov.l L_SCR3(%a6),%d1 # pass: rnd prec,mode
- bsr.l unf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # set possible 'Z' ccode
- fmovm.x FP_SCR0(%a6),&0x80 # return default result in fp0
- rts
-
-#
-# operand will underflow AND underflow is enabled.
-# therefore, we must return the result rounded to extended precision.
-#
-fabs_sd_unfl_ena:
- mov.l FP_SCR0_HI(%a6),FP_SCR1_HI(%a6)
- mov.l FP_SCR0_LO(%a6),FP_SCR1_LO(%a6)
- mov.w FP_SCR0_EX(%a6),%d1 # load current exponent
-
- mov.l %d2,-(%sp) # save d2
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # subtract scale factor
- addi.l &0x6000,%d1 # add new bias
- andi.w &0x7fff,%d1
- or.w %d2,%d1 # concat new sign,new exp
- mov.w %d1,FP_SCR1_EX(%a6) # insert new exp
- fmovm.x FP_SCR1(%a6),&0x40 # return EXOP in fp1
- mov.l (%sp)+,%d2 # restore d2
- bra.b fabs_sd_unfl_dis
-
-#
-# operand WILL overflow.
-#
-fabs_sd_ovfl:
- fmov.l &0x0,%fpsr # clear FPSR
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fabs.x FP_SCR0(%a6),%fp0 # perform absolute
-
- fmov.l &0x0,%fpcr # clear FPCR
- fmov.l %fpsr,%d1 # save FPSR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-fabs_sd_ovfl_tst:
- or.l &ovfl_inx_mask,USER_FPSR(%a6) # set ovfl/aovfl/ainex
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x13,%d1 # is OVFL or INEX enabled?
- bne.b fabs_sd_ovfl_ena # yes
-
-#
-# OVFL is not enabled; therefore, we must create the default result by
-# calling ovf_res().
-#
-fabs_sd_ovfl_dis:
- btst &neg_bit,FPSR_CC(%a6) # is result negative?
- sne %d1 # set sign param accordingly
- mov.l L_SCR3(%a6),%d0 # pass: prec,mode
- bsr.l ovf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # set INF,N if applicable
- fmovm.x (%a0),&0x80 # return default result in fp0
- rts
-
-#
-# OVFL is enabled.
-# the INEX2 bit has already been updated by the round to the correct precision.
-# now, round to extended(and don't alter the FPSR).
-#
-fabs_sd_ovfl_ena:
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # fetch {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- subi.l &0x6000,%d1 # subtract bias
- andi.w &0x7fff,%d1
- or.w %d2,%d1 # concat sign,exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- mov.l (%sp)+,%d2 # restore d2
- bra.b fabs_sd_ovfl_dis
-
-#
-# the move in MAY underflow. so...
-#
-fabs_sd_may_ovfl:
- fmov.l &0x0,%fpsr # clear FPSR
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fabs.x FP_SCR0(%a6),%fp0 # perform absolute
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
- fabs.x %fp0,%fp1 # make a copy of result
- fcmp.b %fp1,&0x2 # is |result| >= 2.b?
- fbge.w fabs_sd_ovfl_tst # yes; overflow has occurred
-
-# no, it didn't overflow; we have correct result
- bra.w fabs_sd_normal_exit
-
-##########################################################################
-
-#
-# input is not normalized; what is it?
-#
-fabs_not_norm:
- cmpi.b %d1,&DENORM # weed out DENORM
- beq.w fabs_denorm
- cmpi.b %d1,&SNAN # weed out SNAN
- beq.l res_snan_1op
- cmpi.b %d1,&QNAN # weed out QNAN
- beq.l res_qnan_1op
-
- fabs.x SRC(%a0),%fp0 # force absolute value
-
- cmpi.b %d1,&INF # weed out INF
- beq.b fabs_inf
-fabs_zero:
- mov.b &z_bmask,FPSR_CC(%a6) # set 'Z' ccode bit
- rts
-fabs_inf:
- mov.b &inf_bmask,FPSR_CC(%a6) # set 'I' ccode bit
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# fcmp(): fp compare op routine #
-# #
-# XREF **************************************************************** #
-# res_qnan() - return QNAN result #
-# res_snan() - return SNAN result #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# a1 = pointer to extended precision destination operand #
-# d0 = round prec/mode #
-# #
-# OUTPUT ************************************************************** #
-# None #
-# #
-# ALGORITHM *********************************************************** #
-# Handle NANs and denorms as special cases. For everything else, #
-# just use the actual fcmp instruction to produce the correct condition #
-# codes. #
-# #
-#########################################################################
-
- global fcmp
-fcmp:
- clr.w %d1
- mov.b DTAG(%a6),%d1
- lsl.b &0x3,%d1
- or.b STAG(%a6),%d1
- bne.b fcmp_not_norm # optimize on non-norm input
-
-#
-# COMPARE FP OPs : NORMs, ZEROs, INFs, and "corrected" DENORMs
-#
-fcmp_norm:
- fmovm.x DST(%a1),&0x80 # load dst op
-
- fcmp.x %fp0,SRC(%a0) # do compare
-
- fmov.l %fpsr,%d0 # save FPSR
- rol.l &0x8,%d0 # extract ccode bits
- mov.b %d0,FPSR_CC(%a6) # set ccode bits(no exc bits are set)
-
- rts
-
-#
-# fcmp: inputs are not both normalized; what are they?
-#
-fcmp_not_norm:
- mov.w (tbl_fcmp_op.b,%pc,%d1.w*2),%d1
- jmp (tbl_fcmp_op.b,%pc,%d1.w*1)
-
- swbeg &48
-tbl_fcmp_op:
- short fcmp_norm - tbl_fcmp_op # NORM - NORM
- short fcmp_norm - tbl_fcmp_op # NORM - ZERO
- short fcmp_norm - tbl_fcmp_op # NORM - INF
- short fcmp_res_qnan - tbl_fcmp_op # NORM - QNAN
- short fcmp_nrm_dnrm - tbl_fcmp_op # NORM - DENORM
- short fcmp_res_snan - tbl_fcmp_op # NORM - SNAN
- short tbl_fcmp_op - tbl_fcmp_op #
- short tbl_fcmp_op - tbl_fcmp_op #
-
- short fcmp_norm - tbl_fcmp_op # ZERO - NORM
- short fcmp_norm - tbl_fcmp_op # ZERO - ZERO
- short fcmp_norm - tbl_fcmp_op # ZERO - INF
- short fcmp_res_qnan - tbl_fcmp_op # ZERO - QNAN
- short fcmp_dnrm_s - tbl_fcmp_op # ZERO - DENORM
- short fcmp_res_snan - tbl_fcmp_op # ZERO - SNAN
- short tbl_fcmp_op - tbl_fcmp_op #
- short tbl_fcmp_op - tbl_fcmp_op #
-
- short fcmp_norm - tbl_fcmp_op # INF - NORM
- short fcmp_norm - tbl_fcmp_op # INF - ZERO
- short fcmp_norm - tbl_fcmp_op # INF - INF
- short fcmp_res_qnan - tbl_fcmp_op # INF - QNAN
- short fcmp_dnrm_s - tbl_fcmp_op # INF - DENORM
- short fcmp_res_snan - tbl_fcmp_op # INF - SNAN
- short tbl_fcmp_op - tbl_fcmp_op #
- short tbl_fcmp_op - tbl_fcmp_op #
-
- short fcmp_res_qnan - tbl_fcmp_op # QNAN - NORM
- short fcmp_res_qnan - tbl_fcmp_op # QNAN - ZERO
- short fcmp_res_qnan - tbl_fcmp_op # QNAN - INF
- short fcmp_res_qnan - tbl_fcmp_op # QNAN - QNAN
- short fcmp_res_qnan - tbl_fcmp_op # QNAN - DENORM
- short fcmp_res_snan - tbl_fcmp_op # QNAN - SNAN
- short tbl_fcmp_op - tbl_fcmp_op #
- short tbl_fcmp_op - tbl_fcmp_op #
-
- short fcmp_dnrm_nrm - tbl_fcmp_op # DENORM - NORM
- short fcmp_dnrm_d - tbl_fcmp_op # DENORM - ZERO
- short fcmp_dnrm_d - tbl_fcmp_op # DENORM - INF
- short fcmp_res_qnan - tbl_fcmp_op # DENORM - QNAN
- short fcmp_dnrm_sd - tbl_fcmp_op # DENORM - DENORM
- short fcmp_res_snan - tbl_fcmp_op # DENORM - SNAN
- short tbl_fcmp_op - tbl_fcmp_op #
- short tbl_fcmp_op - tbl_fcmp_op #
-
- short fcmp_res_snan - tbl_fcmp_op # SNAN - NORM
- short fcmp_res_snan - tbl_fcmp_op # SNAN - ZERO
- short fcmp_res_snan - tbl_fcmp_op # SNAN - INF
- short fcmp_res_snan - tbl_fcmp_op # SNAN - QNAN
- short fcmp_res_snan - tbl_fcmp_op # SNAN - DENORM
- short fcmp_res_snan - tbl_fcmp_op # SNAN - SNAN
- short tbl_fcmp_op - tbl_fcmp_op #
- short tbl_fcmp_op - tbl_fcmp_op #
-
-# unlike all other functions for QNAN and SNAN, fcmp does NOT set the
-# 'N' bit for a negative QNAN or SNAN input so we must squelch it here.
-fcmp_res_qnan:
- bsr.l res_qnan
- andi.b &0xf7,FPSR_CC(%a6)
- rts
-fcmp_res_snan:
- bsr.l res_snan
- andi.b &0xf7,FPSR_CC(%a6)
- rts
-
-#
-# DENORMs are a little more difficult.
-# If you have a 2 DENORMs, then you can just force the j-bit to a one
-# and use the fcmp_norm routine.
-# If you have a DENORM and an INF or ZERO, just force the DENORM's j-bit to a one
-# and use the fcmp_norm routine.
-# If you have a DENORM and a NORM with opposite signs, then use fcmp_norm, also.
-# But with a DENORM and a NORM of the same sign, the neg bit is set if the
-# (1) signs are (+) and the DENORM is the dst or
-# (2) signs are (-) and the DENORM is the src
-#
-
-fcmp_dnrm_s:
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),%d0
- bset &31,%d0 # DENORM src; make into small norm
- mov.l %d0,FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- lea FP_SCR0(%a6),%a0
- bra.w fcmp_norm
-
-fcmp_dnrm_d:
- mov.l DST_EX(%a1),FP_SCR0_EX(%a6)
- mov.l DST_HI(%a1),%d0
- bset &31,%d0 # DENORM src; make into small norm
- mov.l %d0,FP_SCR0_HI(%a6)
- mov.l DST_LO(%a1),FP_SCR0_LO(%a6)
- lea FP_SCR0(%a6),%a1
- bra.w fcmp_norm
-
-fcmp_dnrm_sd:
- mov.w DST_EX(%a1),FP_SCR1_EX(%a6)
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l DST_HI(%a1),%d0
- bset &31,%d0 # DENORM dst; make into small norm
- mov.l %d0,FP_SCR1_HI(%a6)
- mov.l SRC_HI(%a0),%d0
- bset &31,%d0 # DENORM dst; make into small norm
- mov.l %d0,FP_SCR0_HI(%a6)
- mov.l DST_LO(%a1),FP_SCR1_LO(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- lea FP_SCR1(%a6),%a1
- lea FP_SCR0(%a6),%a0
- bra.w fcmp_norm
-
-fcmp_nrm_dnrm:
- mov.b SRC_EX(%a0),%d0 # determine if like signs
- mov.b DST_EX(%a1),%d1
- eor.b %d0,%d1
- bmi.w fcmp_dnrm_s
-
-# signs are the same, so must determine the answer ourselves.
- tst.b %d0 # is src op negative?
- bmi.b fcmp_nrm_dnrm_m # yes
- rts
-fcmp_nrm_dnrm_m:
- mov.b &neg_bmask,FPSR_CC(%a6) # set 'Z' ccode bit
- rts
-
-fcmp_dnrm_nrm:
- mov.b SRC_EX(%a0),%d0 # determine if like signs
- mov.b DST_EX(%a1),%d1
- eor.b %d0,%d1
- bmi.w fcmp_dnrm_d
-
-# signs are the same, so must determine the answer ourselves.
- tst.b %d0 # is src op negative?
- bpl.b fcmp_dnrm_nrm_m # no
- rts
-fcmp_dnrm_nrm_m:
- mov.b &neg_bmask,FPSR_CC(%a6) # set 'Z' ccode bit
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# fsglmul(): emulates the fsglmul instruction #
-# #
-# XREF **************************************************************** #
-# scale_to_zero_src() - scale src exponent to zero #
-# scale_to_zero_dst() - scale dst exponent to zero #
-# unf_res4() - return default underflow result for sglop #
-# ovf_res() - return default overflow result #
-# res_qnan() - return QNAN result #
-# res_snan() - return SNAN result #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# a1 = pointer to extended precision destination operand #
-# d0 rnd prec,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = result #
-# fp1 = EXOP (if exception occurred) #
-# #
-# ALGORITHM *********************************************************** #
-# Handle NANs, infinities, and zeroes as special cases. Divide #
-# norms/denorms into ext/sgl/dbl precision. #
-# For norms/denorms, scale the exponents such that a multiply #
-# instruction won't cause an exception. Use the regular fsglmul to #
-# compute a result. Check if the regular operands would have taken #
-# an exception. If so, return the default overflow/underflow result #
-# and return the EXOP if exceptions are enabled. Else, scale the #
-# result operand to the proper exponent. #
-# #
-#########################################################################
-
- global fsglmul
-fsglmul:
- mov.l %d0,L_SCR3(%a6) # store rnd info
-
- clr.w %d1
- mov.b DTAG(%a6),%d1
- lsl.b &0x3,%d1
- or.b STAG(%a6),%d1
-
- bne.w fsglmul_not_norm # optimize on non-norm input
-
-fsglmul_norm:
- mov.w DST_EX(%a1),FP_SCR1_EX(%a6)
- mov.l DST_HI(%a1),FP_SCR1_HI(%a6)
- mov.l DST_LO(%a1),FP_SCR1_LO(%a6)
-
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
-
- bsr.l scale_to_zero_src # scale exponent
- mov.l %d0,-(%sp) # save scale factor 1
-
- bsr.l scale_to_zero_dst # scale dst exponent
-
- add.l (%sp)+,%d0 # SCALE_FACTOR = scale1 + scale2
-
- cmpi.l %d0,&0x3fff-0x7ffe # would result ovfl?
- beq.w fsglmul_may_ovfl # result may rnd to overflow
- blt.w fsglmul_ovfl # result will overflow
-
- cmpi.l %d0,&0x3fff+0x0001 # would result unfl?
- beq.w fsglmul_may_unfl # result may rnd to no unfl
- bgt.w fsglmul_unfl # result will underflow
-
-fsglmul_normal:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsglmul.x FP_SCR0(%a6),%fp0 # execute sgl multiply
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-fsglmul_normal_exit:
- fmovm.x &0x80,FP_SCR0(%a6) # store out result
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # load {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- or.w %d2,%d1 # concat old sign,new exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x80 # return result in fp0
- rts
-
-fsglmul_ovfl:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsglmul.x FP_SCR0(%a6),%fp0 # execute sgl multiply
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-fsglmul_ovfl_tst:
-
-# save setting this until now because this is where fsglmul_may_ovfl may jump in
- or.l &ovfl_inx_mask, USER_FPSR(%a6) # set ovfl/aovfl/ainex
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x13,%d1 # is OVFL or INEX enabled?
- bne.b fsglmul_ovfl_ena # yes
-
-fsglmul_ovfl_dis:
- btst &neg_bit,FPSR_CC(%a6) # is result negative?
- sne %d1 # set sign param accordingly
- mov.l L_SCR3(%a6),%d0 # pass prec:rnd
- andi.b &0x30,%d0 # force prec = ext
- bsr.l ovf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # set INF,N if applicable
- fmovm.x (%a0),&0x80 # return default result in fp0
- rts
-
-fsglmul_ovfl_ena:
- fmovm.x &0x80,FP_SCR0(%a6) # move result to stack
-
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # fetch {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- sub.l %d0,%d1 # add scale factor
- subi.l &0x6000,%d1 # subtract bias
- andi.w &0x7fff,%d1
- andi.w &0x8000,%d2 # keep old sign
- or.w %d2,%d1 # concat old sign,new exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- bra.b fsglmul_ovfl_dis
-
-fsglmul_may_ovfl:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsglmul.x FP_SCR0(%a6),%fp0 # execute sgl multiply
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
- fabs.x %fp0,%fp1 # make a copy of result
- fcmp.b %fp1,&0x2 # is |result| >= 2.b?
- fbge.w fsglmul_ovfl_tst # yes; overflow has occurred
-
-# no, it didn't overflow; we have correct result
- bra.w fsglmul_normal_exit
-
-fsglmul_unfl:
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
-
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l &rz_mode*0x10,%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsglmul.x FP_SCR0(%a6),%fp0 # execute sgl multiply
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x0b,%d1 # is UNFL or INEX enabled?
- bne.b fsglmul_unfl_ena # yes
-
-fsglmul_unfl_dis:
- fmovm.x &0x80,FP_SCR0(%a6) # store out result
-
- lea FP_SCR0(%a6),%a0 # pass: result addr
- mov.l L_SCR3(%a6),%d1 # pass: rnd prec,mode
- bsr.l unf_res4 # calculate default result
- or.b %d0,FPSR_CC(%a6) # 'Z' bit may have been set
- fmovm.x FP_SCR0(%a6),&0x80 # return default result in fp0
- rts
-
-#
-# UNFL is enabled.
-#
-fsglmul_unfl_ena:
- fmovm.x FP_SCR1(%a6),&0x40 # load dst op
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsglmul.x FP_SCR0(%a6),%fp1 # execute sgl multiply
-
- fmov.l &0x0,%fpcr # clear FPCR
-
- fmovm.x &0x40,FP_SCR0(%a6) # save result to stack
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # fetch {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- addi.l &0x6000,%d1 # add bias
- andi.w &0x7fff,%d1
- or.w %d2,%d1 # concat old sign,new exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- bra.w fsglmul_unfl_dis
-
-fsglmul_may_unfl:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsglmul.x FP_SCR0(%a6),%fp0 # execute sgl multiply
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
- fabs.x %fp0,%fp1 # make a copy of result
- fcmp.b %fp1,&0x2 # is |result| > 2.b?
- fbgt.w fsglmul_normal_exit # no; no underflow occurred
- fblt.w fsglmul_unfl # yes; underflow occurred
-
-#
-# we still don't know if underflow occurred. result is ~ equal to 2. but,
-# we don't know if the result was an underflow that rounded up to a 2 or
-# a normalized number that rounded down to a 2. so, redo the entire operation
-# using RZ as the rounding mode to see what the pre-rounded result is.
-# this case should be relatively rare.
-#
- fmovm.x FP_SCR1(%a6),&0x40 # load dst op into fp1
-
- mov.l L_SCR3(%a6),%d1
- andi.b &0xc0,%d1 # keep rnd prec
- ori.b &rz_mode*0x10,%d1 # insert RZ
-
- fmov.l %d1,%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsglmul.x FP_SCR0(%a6),%fp1 # execute sgl multiply
-
- fmov.l &0x0,%fpcr # clear FPCR
- fabs.x %fp1 # make absolute value
- fcmp.b %fp1,&0x2 # is |result| < 2.b?
- fbge.w fsglmul_normal_exit # no; no underflow occurred
- bra.w fsglmul_unfl # yes, underflow occurred
-
-##############################################################################
-
-#
-# Single Precision Multiply: inputs are not both normalized; what are they?
-#
-fsglmul_not_norm:
- mov.w (tbl_fsglmul_op.b,%pc,%d1.w*2),%d1
- jmp (tbl_fsglmul_op.b,%pc,%d1.w*1)
-
- swbeg &48
-tbl_fsglmul_op:
- short fsglmul_norm - tbl_fsglmul_op # NORM x NORM
- short fsglmul_zero - tbl_fsglmul_op # NORM x ZERO
- short fsglmul_inf_src - tbl_fsglmul_op # NORM x INF
- short fsglmul_res_qnan - tbl_fsglmul_op # NORM x QNAN
- short fsglmul_norm - tbl_fsglmul_op # NORM x DENORM
- short fsglmul_res_snan - tbl_fsglmul_op # NORM x SNAN
- short tbl_fsglmul_op - tbl_fsglmul_op #
- short tbl_fsglmul_op - tbl_fsglmul_op #
-
- short fsglmul_zero - tbl_fsglmul_op # ZERO x NORM
- short fsglmul_zero - tbl_fsglmul_op # ZERO x ZERO
- short fsglmul_res_operr - tbl_fsglmul_op # ZERO x INF
- short fsglmul_res_qnan - tbl_fsglmul_op # ZERO x QNAN
- short fsglmul_zero - tbl_fsglmul_op # ZERO x DENORM
- short fsglmul_res_snan - tbl_fsglmul_op # ZERO x SNAN
- short tbl_fsglmul_op - tbl_fsglmul_op #
- short tbl_fsglmul_op - tbl_fsglmul_op #
-
- short fsglmul_inf_dst - tbl_fsglmul_op # INF x NORM
- short fsglmul_res_operr - tbl_fsglmul_op # INF x ZERO
- short fsglmul_inf_dst - tbl_fsglmul_op # INF x INF
- short fsglmul_res_qnan - tbl_fsglmul_op # INF x QNAN
- short fsglmul_inf_dst - tbl_fsglmul_op # INF x DENORM
- short fsglmul_res_snan - tbl_fsglmul_op # INF x SNAN
- short tbl_fsglmul_op - tbl_fsglmul_op #
- short tbl_fsglmul_op - tbl_fsglmul_op #
-
- short fsglmul_res_qnan - tbl_fsglmul_op # QNAN x NORM
- short fsglmul_res_qnan - tbl_fsglmul_op # QNAN x ZERO
- short fsglmul_res_qnan - tbl_fsglmul_op # QNAN x INF
- short fsglmul_res_qnan - tbl_fsglmul_op # QNAN x QNAN
- short fsglmul_res_qnan - tbl_fsglmul_op # QNAN x DENORM
- short fsglmul_res_snan - tbl_fsglmul_op # QNAN x SNAN
- short tbl_fsglmul_op - tbl_fsglmul_op #
- short tbl_fsglmul_op - tbl_fsglmul_op #
-
- short fsglmul_norm - tbl_fsglmul_op # NORM x NORM
- short fsglmul_zero - tbl_fsglmul_op # NORM x ZERO
- short fsglmul_inf_src - tbl_fsglmul_op # NORM x INF
- short fsglmul_res_qnan - tbl_fsglmul_op # NORM x QNAN
- short fsglmul_norm - tbl_fsglmul_op # NORM x DENORM
- short fsglmul_res_snan - tbl_fsglmul_op # NORM x SNAN
- short tbl_fsglmul_op - tbl_fsglmul_op #
- short tbl_fsglmul_op - tbl_fsglmul_op #
-
- short fsglmul_res_snan - tbl_fsglmul_op # SNAN x NORM
- short fsglmul_res_snan - tbl_fsglmul_op # SNAN x ZERO
- short fsglmul_res_snan - tbl_fsglmul_op # SNAN x INF
- short fsglmul_res_snan - tbl_fsglmul_op # SNAN x QNAN
- short fsglmul_res_snan - tbl_fsglmul_op # SNAN x DENORM
- short fsglmul_res_snan - tbl_fsglmul_op # SNAN x SNAN
- short tbl_fsglmul_op - tbl_fsglmul_op #
- short tbl_fsglmul_op - tbl_fsglmul_op #
-
-fsglmul_res_operr:
- bra.l res_operr
-fsglmul_res_snan:
- bra.l res_snan
-fsglmul_res_qnan:
- bra.l res_qnan
-fsglmul_zero:
- bra.l fmul_zero
-fsglmul_inf_src:
- bra.l fmul_inf_src
-fsglmul_inf_dst:
- bra.l fmul_inf_dst
-
-#########################################################################
-# XDEF **************************************************************** #
-# fsgldiv(): emulates the fsgldiv instruction #
-# #
-# XREF **************************************************************** #
-# scale_to_zero_src() - scale src exponent to zero #
-# scale_to_zero_dst() - scale dst exponent to zero #
-# unf_res4() - return default underflow result for sglop #
-# ovf_res() - return default overflow result #
-# res_qnan() - return QNAN result #
-# res_snan() - return SNAN result #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# a1 = pointer to extended precision destination operand #
-# d0 rnd prec,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = result #
-# fp1 = EXOP (if exception occurred) #
-# #
-# ALGORITHM *********************************************************** #
-# Handle NANs, infinities, and zeroes as special cases. Divide #
-# norms/denorms into ext/sgl/dbl precision. #
-# For norms/denorms, scale the exponents such that a divide #
-# instruction won't cause an exception. Use the regular fsgldiv to #
-# compute a result. Check if the regular operands would have taken #
-# an exception. If so, return the default overflow/underflow result #
-# and return the EXOP if exceptions are enabled. Else, scale the #
-# result operand to the proper exponent. #
-# #
-#########################################################################
-
- global fsgldiv
-fsgldiv:
- mov.l %d0,L_SCR3(%a6) # store rnd info
-
- clr.w %d1
- mov.b DTAG(%a6),%d1
- lsl.b &0x3,%d1
- or.b STAG(%a6),%d1 # combine src tags
-
- bne.w fsgldiv_not_norm # optimize on non-norm input
-
-#
-# DIVIDE: NORMs and DENORMs ONLY!
-#
-fsgldiv_norm:
- mov.w DST_EX(%a1),FP_SCR1_EX(%a6)
- mov.l DST_HI(%a1),FP_SCR1_HI(%a6)
- mov.l DST_LO(%a1),FP_SCR1_LO(%a6)
-
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
-
- bsr.l scale_to_zero_src # calculate scale factor 1
- mov.l %d0,-(%sp) # save scale factor 1
-
- bsr.l scale_to_zero_dst # calculate scale factor 2
-
- neg.l (%sp) # S.F. = scale1 - scale2
- add.l %d0,(%sp)
-
- mov.w 2+L_SCR3(%a6),%d1 # fetch precision,mode
- lsr.b &0x6,%d1
- mov.l (%sp)+,%d0
- cmpi.l %d0,&0x3fff-0x7ffe
- ble.w fsgldiv_may_ovfl
-
- cmpi.l %d0,&0x3fff-0x0000 # will result underflow?
- beq.w fsgldiv_may_unfl # maybe
- bgt.w fsgldiv_unfl # yes; go handle underflow
-
-fsgldiv_normal:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l L_SCR3(%a6),%fpcr # save FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsgldiv.x FP_SCR0(%a6),%fp0 # perform sgl divide
-
- fmov.l %fpsr,%d1 # save FPSR
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-fsgldiv_normal_exit:
- fmovm.x &0x80,FP_SCR0(%a6) # store result on stack
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # load {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- or.w %d2,%d1 # concat old sign,new exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x80 # return result in fp0
- rts
-
-fsgldiv_may_ovfl:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # set FPSR
-
- fsgldiv.x FP_SCR0(%a6),%fp0 # execute divide
-
- fmov.l %fpsr,%d1
- fmov.l &0x0,%fpcr
-
- or.l %d1,USER_FPSR(%a6) # save INEX,N
-
- fmovm.x &0x01,-(%sp) # save result to stack
- mov.w (%sp),%d1 # fetch new exponent
- add.l &0xc,%sp # clear result
- andi.l &0x7fff,%d1 # strip sign
- sub.l %d0,%d1 # add scale factor
- cmp.l %d1,&0x7fff # did divide overflow?
- blt.b fsgldiv_normal_exit
-
-fsgldiv_ovfl_tst:
- or.w &ovfl_inx_mask,2+USER_FPSR(%a6) # set ovfl/aovfl/ainex
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x13,%d1 # is OVFL or INEX enabled?
- bne.b fsgldiv_ovfl_ena # yes
-
-fsgldiv_ovfl_dis:
- btst &neg_bit,FPSR_CC(%a6) # is result negative
- sne %d1 # set sign param accordingly
- mov.l L_SCR3(%a6),%d0 # pass prec:rnd
- andi.b &0x30,%d0 # kill precision
- bsr.l ovf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # set INF if applicable
- fmovm.x (%a0),&0x80 # return default result in fp0
- rts
-
-fsgldiv_ovfl_ena:
- fmovm.x &0x80,FP_SCR0(%a6) # move result to stack
-
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # fetch {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- subi.l &0x6000,%d1 # subtract new bias
- andi.w &0x7fff,%d1 # clear ms bit
- or.w %d2,%d1 # concat old sign,new exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- bra.b fsgldiv_ovfl_dis
-
-fsgldiv_unfl:
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
-
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l &rz_mode*0x10,%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsgldiv.x FP_SCR0(%a6),%fp0 # execute sgl divide
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x0b,%d1 # is UNFL or INEX enabled?
- bne.b fsgldiv_unfl_ena # yes
-
-fsgldiv_unfl_dis:
- fmovm.x &0x80,FP_SCR0(%a6) # store out result
-
- lea FP_SCR0(%a6),%a0 # pass: result addr
- mov.l L_SCR3(%a6),%d1 # pass: rnd prec,mode
- bsr.l unf_res4 # calculate default result
- or.b %d0,FPSR_CC(%a6) # 'Z' bit may have been set
- fmovm.x FP_SCR0(%a6),&0x80 # return default result in fp0
- rts
-
-#
-# UNFL is enabled.
-#
-fsgldiv_unfl_ena:
- fmovm.x FP_SCR1(%a6),&0x40 # load dst op
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsgldiv.x FP_SCR0(%a6),%fp1 # execute sgl divide
-
- fmov.l &0x0,%fpcr # clear FPCR
-
- fmovm.x &0x40,FP_SCR0(%a6) # save result to stack
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # fetch {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- addi.l &0x6000,%d1 # add bias
- andi.w &0x7fff,%d1 # clear top bit
- or.w %d2,%d1 # concat old sign, new exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- bra.b fsgldiv_unfl_dis
-
-#
-# the divide operation MAY underflow:
-#
-fsgldiv_may_unfl:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsgldiv.x FP_SCR0(%a6),%fp0 # execute sgl divide
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
- fabs.x %fp0,%fp1 # make a copy of result
- fcmp.b %fp1,&0x1 # is |result| > 1.b?
- fbgt.w fsgldiv_normal_exit # no; no underflow occurred
- fblt.w fsgldiv_unfl # yes; underflow occurred
-
-#
-# we still don't know if underflow occurred. result is ~ equal to 1. but,
-# we don't know if the result was an underflow that rounded up to a 1
-# or a normalized number that rounded down to a 1. so, redo the entire
-# operation using RZ as the rounding mode to see what the pre-rounded
-# result is. this case should be relatively rare.
-#
- fmovm.x FP_SCR1(%a6),&0x40 # load dst op into %fp1
-
- clr.l %d1 # clear scratch register
- ori.b &rz_mode*0x10,%d1 # force RZ rnd mode
-
- fmov.l %d1,%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsgldiv.x FP_SCR0(%a6),%fp1 # execute sgl divide
-
- fmov.l &0x0,%fpcr # clear FPCR
- fabs.x %fp1 # make absolute value
- fcmp.b %fp1,&0x1 # is |result| < 1.b?
- fbge.w fsgldiv_normal_exit # no; no underflow occurred
- bra.w fsgldiv_unfl # yes; underflow occurred
-
-############################################################################
-
-#
-# Divide: inputs are not both normalized; what are they?
-#
-fsgldiv_not_norm:
- mov.w (tbl_fsgldiv_op.b,%pc,%d1.w*2),%d1
- jmp (tbl_fsgldiv_op.b,%pc,%d1.w*1)
-
- swbeg &48
-tbl_fsgldiv_op:
- short fsgldiv_norm - tbl_fsgldiv_op # NORM / NORM
- short fsgldiv_inf_load - tbl_fsgldiv_op # NORM / ZERO
- short fsgldiv_zero_load - tbl_fsgldiv_op # NORM / INF
- short fsgldiv_res_qnan - tbl_fsgldiv_op # NORM / QNAN
- short fsgldiv_norm - tbl_fsgldiv_op # NORM / DENORM
- short fsgldiv_res_snan - tbl_fsgldiv_op # NORM / SNAN
- short tbl_fsgldiv_op - tbl_fsgldiv_op #
- short tbl_fsgldiv_op - tbl_fsgldiv_op #
-
- short fsgldiv_zero_load - tbl_fsgldiv_op # ZERO / NORM
- short fsgldiv_res_operr - tbl_fsgldiv_op # ZERO / ZERO
- short fsgldiv_zero_load - tbl_fsgldiv_op # ZERO / INF
- short fsgldiv_res_qnan - tbl_fsgldiv_op # ZERO / QNAN
- short fsgldiv_zero_load - tbl_fsgldiv_op # ZERO / DENORM
- short fsgldiv_res_snan - tbl_fsgldiv_op # ZERO / SNAN
- short tbl_fsgldiv_op - tbl_fsgldiv_op #
- short tbl_fsgldiv_op - tbl_fsgldiv_op #
-
- short fsgldiv_inf_dst - tbl_fsgldiv_op # INF / NORM
- short fsgldiv_inf_dst - tbl_fsgldiv_op # INF / ZERO
- short fsgldiv_res_operr - tbl_fsgldiv_op # INF / INF
- short fsgldiv_res_qnan - tbl_fsgldiv_op # INF / QNAN
- short fsgldiv_inf_dst - tbl_fsgldiv_op # INF / DENORM
- short fsgldiv_res_snan - tbl_fsgldiv_op # INF / SNAN
- short tbl_fsgldiv_op - tbl_fsgldiv_op #
- short tbl_fsgldiv_op - tbl_fsgldiv_op #
-
- short fsgldiv_res_qnan - tbl_fsgldiv_op # QNAN / NORM
- short fsgldiv_res_qnan - tbl_fsgldiv_op # QNAN / ZERO
- short fsgldiv_res_qnan - tbl_fsgldiv_op # QNAN / INF
- short fsgldiv_res_qnan - tbl_fsgldiv_op # QNAN / QNAN
- short fsgldiv_res_qnan - tbl_fsgldiv_op # QNAN / DENORM
- short fsgldiv_res_snan - tbl_fsgldiv_op # QNAN / SNAN
- short tbl_fsgldiv_op - tbl_fsgldiv_op #
- short tbl_fsgldiv_op - tbl_fsgldiv_op #
-
- short fsgldiv_norm - tbl_fsgldiv_op # DENORM / NORM
- short fsgldiv_inf_load - tbl_fsgldiv_op # DENORM / ZERO
- short fsgldiv_zero_load - tbl_fsgldiv_op # DENORM / INF
- short fsgldiv_res_qnan - tbl_fsgldiv_op # DENORM / QNAN
- short fsgldiv_norm - tbl_fsgldiv_op # DENORM / DENORM
- short fsgldiv_res_snan - tbl_fsgldiv_op # DENORM / SNAN
- short tbl_fsgldiv_op - tbl_fsgldiv_op #
- short tbl_fsgldiv_op - tbl_fsgldiv_op #
-
- short fsgldiv_res_snan - tbl_fsgldiv_op # SNAN / NORM
- short fsgldiv_res_snan - tbl_fsgldiv_op # SNAN / ZERO
- short fsgldiv_res_snan - tbl_fsgldiv_op # SNAN / INF
- short fsgldiv_res_snan - tbl_fsgldiv_op # SNAN / QNAN
- short fsgldiv_res_snan - tbl_fsgldiv_op # SNAN / DENORM
- short fsgldiv_res_snan - tbl_fsgldiv_op # SNAN / SNAN
- short tbl_fsgldiv_op - tbl_fsgldiv_op #
- short tbl_fsgldiv_op - tbl_fsgldiv_op #
-
-fsgldiv_res_qnan:
- bra.l res_qnan
-fsgldiv_res_snan:
- bra.l res_snan
-fsgldiv_res_operr:
- bra.l res_operr
-fsgldiv_inf_load:
- bra.l fdiv_inf_load
-fsgldiv_zero_load:
- bra.l fdiv_zero_load
-fsgldiv_inf_dst:
- bra.l fdiv_inf_dst
-
-#########################################################################
-# XDEF **************************************************************** #
-# fadd(): emulates the fadd instruction #
-# fsadd(): emulates the fadd instruction #
-# fdadd(): emulates the fdadd instruction #
-# #
-# XREF **************************************************************** #
-# addsub_scaler2() - scale the operands so they won't take exc #
-# ovf_res() - return default overflow result #
-# unf_res() - return default underflow result #
-# res_qnan() - set QNAN result #
-# res_snan() - set SNAN result #
-# res_operr() - set OPERR result #
-# scale_to_zero_src() - set src operand exponent equal to zero #
-# scale_to_zero_dst() - set dst operand exponent equal to zero #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# a1 = pointer to extended precision destination operand #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = result #
-# fp1 = EXOP (if exception occurred) #
-# #
-# ALGORITHM *********************************************************** #
-# Handle NANs, infinities, and zeroes as special cases. Divide #
-# norms into extended, single, and double precision. #
-# Do addition after scaling exponents such that exception won't #
-# occur. Then, check result exponent to see if exception would have #
-# occurred. If so, return default result and maybe EXOP. Else, insert #
-# the correct result exponent and return. Set FPSR bits as appropriate. #
-# #
-#########################################################################
-
- global fsadd
-fsadd:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &s_mode*0x10,%d0 # insert sgl prec
- bra.b fadd
-
- global fdadd
-fdadd:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &d_mode*0x10,%d0 # insert dbl prec
-
- global fadd
-fadd:
- mov.l %d0,L_SCR3(%a6) # store rnd info
-
- clr.w %d1
- mov.b DTAG(%a6),%d1
- lsl.b &0x3,%d1
- or.b STAG(%a6),%d1 # combine src tags
-
- bne.w fadd_not_norm # optimize on non-norm input
-
-#
-# ADD: norms and denorms
-#
-fadd_norm:
- bsr.l addsub_scaler2 # scale exponents
-
-fadd_zero_entry:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l &0x0,%fpsr # clear FPSR
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fadd.x FP_SCR0(%a6),%fp0 # execute add
-
- fmov.l &0x0,%fpcr # clear FPCR
- fmov.l %fpsr,%d1 # fetch INEX2,N,Z
-
- or.l %d1,USER_FPSR(%a6) # save exc and ccode bits
-
- fbeq.w fadd_zero_exit # if result is zero, end now
-
- mov.l %d2,-(%sp) # save d2
-
- fmovm.x &0x01,-(%sp) # save result to stack
-
- mov.w 2+L_SCR3(%a6),%d1
- lsr.b &0x6,%d1
-
- mov.w (%sp),%d2 # fetch new sign, exp
- andi.l &0x7fff,%d2 # strip sign
- sub.l %d0,%d2 # add scale factor
-
- cmp.l %d2,(tbl_fadd_ovfl.b,%pc,%d1.w*4) # is it an overflow?
- bge.b fadd_ovfl # yes
-
- cmp.l %d2,(tbl_fadd_unfl.b,%pc,%d1.w*4) # is it an underflow?
- blt.w fadd_unfl # yes
- beq.w fadd_may_unfl # maybe; go find out
-
-fadd_normal:
- mov.w (%sp),%d1
- andi.w &0x8000,%d1 # keep sign
- or.w %d2,%d1 # concat sign,new exp
- mov.w %d1,(%sp) # insert new exponent
-
- fmovm.x (%sp)+,&0x80 # return result in fp0
-
- mov.l (%sp)+,%d2 # restore d2
- rts
-
-fadd_zero_exit:
-# fmov.s &0x00000000,%fp0 # return zero in fp0
- rts
-
-tbl_fadd_ovfl:
- long 0x7fff # ext ovfl
- long 0x407f # sgl ovfl
- long 0x43ff # dbl ovfl
-
-tbl_fadd_unfl:
- long 0x0000 # ext unfl
- long 0x3f81 # sgl unfl
- long 0x3c01 # dbl unfl
-
-fadd_ovfl:
- or.l &ovfl_inx_mask,USER_FPSR(%a6) # set ovfl/aovfl/ainex
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x13,%d1 # is OVFL or INEX enabled?
- bne.b fadd_ovfl_ena # yes
-
- add.l &0xc,%sp
-fadd_ovfl_dis:
- btst &neg_bit,FPSR_CC(%a6) # is result negative?
- sne %d1 # set sign param accordingly
- mov.l L_SCR3(%a6),%d0 # pass prec:rnd
- bsr.l ovf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # set INF,N if applicable
- fmovm.x (%a0),&0x80 # return default result in fp0
- mov.l (%sp)+,%d2 # restore d2
- rts
-
-fadd_ovfl_ena:
- mov.b L_SCR3(%a6),%d1
- andi.b &0xc0,%d1 # is precision extended?
- bne.b fadd_ovfl_ena_sd # no; prec = sgl or dbl
-
-fadd_ovfl_ena_cont:
- mov.w (%sp),%d1
- andi.w &0x8000,%d1 # keep sign
- subi.l &0x6000,%d2 # add extra bias
- andi.w &0x7fff,%d2
- or.w %d2,%d1 # concat sign,new exp
- mov.w %d1,(%sp) # insert new exponent
-
- fmovm.x (%sp)+,&0x40 # return EXOP in fp1
- bra.b fadd_ovfl_dis
-
-fadd_ovfl_ena_sd:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- mov.l L_SCR3(%a6),%d1
- andi.b &0x30,%d1 # keep rnd mode
- fmov.l %d1,%fpcr # set FPCR
-
- fadd.x FP_SCR0(%a6),%fp0 # execute add
-
- fmov.l &0x0,%fpcr # clear FPCR
-
- add.l &0xc,%sp
- fmovm.x &0x01,-(%sp)
- bra.b fadd_ovfl_ena_cont
-
-fadd_unfl:
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
-
- add.l &0xc,%sp
-
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l &rz_mode*0x10,%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fadd.x FP_SCR0(%a6),%fp0 # execute add
-
- fmov.l &0x0,%fpcr # clear FPCR
- fmov.l %fpsr,%d1 # save status
-
- or.l %d1,USER_FPSR(%a6) # save INEX,N
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x0b,%d1 # is UNFL or INEX enabled?
- bne.b fadd_unfl_ena # yes
-
-fadd_unfl_dis:
- fmovm.x &0x80,FP_SCR0(%a6) # store out result
-
- lea FP_SCR0(%a6),%a0 # pass: result addr
- mov.l L_SCR3(%a6),%d1 # pass: rnd prec,mode
- bsr.l unf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # 'Z' bit may have been set
- fmovm.x FP_SCR0(%a6),&0x80 # return default result in fp0
- mov.l (%sp)+,%d2 # restore d2
- rts
-
-fadd_unfl_ena:
- fmovm.x FP_SCR1(%a6),&0x40 # load dst op
-
- mov.l L_SCR3(%a6),%d1
- andi.b &0xc0,%d1 # is precision extended?
- bne.b fadd_unfl_ena_sd # no; sgl or dbl
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
-fadd_unfl_ena_cont:
- fmov.l &0x0,%fpsr # clear FPSR
-
- fadd.x FP_SCR0(%a6),%fp1 # execute multiply
-
- fmov.l &0x0,%fpcr # clear FPCR
-
- fmovm.x &0x40,FP_SCR0(%a6) # save result to stack
- mov.w FP_SCR0_EX(%a6),%d1 # fetch {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- addi.l &0x6000,%d1 # add new bias
- andi.w &0x7fff,%d1 # clear top bit
- or.w %d2,%d1 # concat sign,new exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- bra.w fadd_unfl_dis
-
-fadd_unfl_ena_sd:
- mov.l L_SCR3(%a6),%d1
- andi.b &0x30,%d1 # use only rnd mode
- fmov.l %d1,%fpcr # set FPCR
-
- bra.b fadd_unfl_ena_cont
-
-#
-# result is equal to the smallest normalized number in the selected precision
-# if the precision is extended, this result could not have come from an
-# underflow that rounded up.
-#
-fadd_may_unfl:
- mov.l L_SCR3(%a6),%d1
- andi.b &0xc0,%d1
- beq.w fadd_normal # yes; no underflow occurred
-
- mov.l 0x4(%sp),%d1 # extract hi(man)
- cmpi.l %d1,&0x80000000 # is hi(man) = 0x80000000?
- bne.w fadd_normal # no; no underflow occurred
-
- tst.l 0x8(%sp) # is lo(man) = 0x0?
- bne.w fadd_normal # no; no underflow occurred
-
- btst &inex2_bit,FPSR_EXCEPT(%a6) # is INEX2 set?
- beq.w fadd_normal # no; no underflow occurred
-
-#
-# ok, so now the result has a exponent equal to the smallest normalized
-# exponent for the selected precision. also, the mantissa is equal to
-# 0x8000000000000000 and this mantissa is the result of rounding non-zero
-# g,r,s.
-# now, we must determine whether the pre-rounded result was an underflow
-# rounded "up" or a normalized number rounded "down".
-# so, we do this be re-executing the add using RZ as the rounding mode and
-# seeing if the new result is smaller or equal to the current result.
-#
- fmovm.x FP_SCR1(%a6),&0x40 # load dst op into fp1
-
- mov.l L_SCR3(%a6),%d1
- andi.b &0xc0,%d1 # keep rnd prec
- ori.b &rz_mode*0x10,%d1 # insert rnd mode
- fmov.l %d1,%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fadd.x FP_SCR0(%a6),%fp1 # execute add
-
- fmov.l &0x0,%fpcr # clear FPCR
-
- fabs.x %fp0 # compare absolute values
- fabs.x %fp1
- fcmp.x %fp0,%fp1 # is first result > second?
-
- fbgt.w fadd_unfl # yes; it's an underflow
- bra.w fadd_normal # no; it's not an underflow
-
-##########################################################################
-
-#
-# Add: inputs are not both normalized; what are they?
-#
-fadd_not_norm:
- mov.w (tbl_fadd_op.b,%pc,%d1.w*2),%d1
- jmp (tbl_fadd_op.b,%pc,%d1.w*1)
-
- swbeg &48
-tbl_fadd_op:
- short fadd_norm - tbl_fadd_op # NORM + NORM
- short fadd_zero_src - tbl_fadd_op # NORM + ZERO
- short fadd_inf_src - tbl_fadd_op # NORM + INF
- short fadd_res_qnan - tbl_fadd_op # NORM + QNAN
- short fadd_norm - tbl_fadd_op # NORM + DENORM
- short fadd_res_snan - tbl_fadd_op # NORM + SNAN
- short tbl_fadd_op - tbl_fadd_op #
- short tbl_fadd_op - tbl_fadd_op #
-
- short fadd_zero_dst - tbl_fadd_op # ZERO + NORM
- short fadd_zero_2 - tbl_fadd_op # ZERO + ZERO
- short fadd_inf_src - tbl_fadd_op # ZERO + INF
- short fadd_res_qnan - tbl_fadd_op # NORM + QNAN
- short fadd_zero_dst - tbl_fadd_op # ZERO + DENORM
- short fadd_res_snan - tbl_fadd_op # NORM + SNAN
- short tbl_fadd_op - tbl_fadd_op #
- short tbl_fadd_op - tbl_fadd_op #
-
- short fadd_inf_dst - tbl_fadd_op # INF + NORM
- short fadd_inf_dst - tbl_fadd_op # INF + ZERO
- short fadd_inf_2 - tbl_fadd_op # INF + INF
- short fadd_res_qnan - tbl_fadd_op # NORM + QNAN
- short fadd_inf_dst - tbl_fadd_op # INF + DENORM
- short fadd_res_snan - tbl_fadd_op # NORM + SNAN
- short tbl_fadd_op - tbl_fadd_op #
- short tbl_fadd_op - tbl_fadd_op #
-
- short fadd_res_qnan - tbl_fadd_op # QNAN + NORM
- short fadd_res_qnan - tbl_fadd_op # QNAN + ZERO
- short fadd_res_qnan - tbl_fadd_op # QNAN + INF
- short fadd_res_qnan - tbl_fadd_op # QNAN + QNAN
- short fadd_res_qnan - tbl_fadd_op # QNAN + DENORM
- short fadd_res_snan - tbl_fadd_op # QNAN + SNAN
- short tbl_fadd_op - tbl_fadd_op #
- short tbl_fadd_op - tbl_fadd_op #
-
- short fadd_norm - tbl_fadd_op # DENORM + NORM
- short fadd_zero_src - tbl_fadd_op # DENORM + ZERO
- short fadd_inf_src - tbl_fadd_op # DENORM + INF
- short fadd_res_qnan - tbl_fadd_op # NORM + QNAN
- short fadd_norm - tbl_fadd_op # DENORM + DENORM
- short fadd_res_snan - tbl_fadd_op # NORM + SNAN
- short tbl_fadd_op - tbl_fadd_op #
- short tbl_fadd_op - tbl_fadd_op #
-
- short fadd_res_snan - tbl_fadd_op # SNAN + NORM
- short fadd_res_snan - tbl_fadd_op # SNAN + ZERO
- short fadd_res_snan - tbl_fadd_op # SNAN + INF
- short fadd_res_snan - tbl_fadd_op # SNAN + QNAN
- short fadd_res_snan - tbl_fadd_op # SNAN + DENORM
- short fadd_res_snan - tbl_fadd_op # SNAN + SNAN
- short tbl_fadd_op - tbl_fadd_op #
- short tbl_fadd_op - tbl_fadd_op #
-
-fadd_res_qnan:
- bra.l res_qnan
-fadd_res_snan:
- bra.l res_snan
-
-#
-# both operands are ZEROes
-#
-fadd_zero_2:
- mov.b SRC_EX(%a0),%d0 # are the signs opposite
- mov.b DST_EX(%a1),%d1
- eor.b %d0,%d1
- bmi.w fadd_zero_2_chk_rm # weed out (-ZERO)+(+ZERO)
-
-# the signs are the same. so determine whether they are positive or negative
-# and return the appropriately signed zero.
- tst.b %d0 # are ZEROes positive or negative?
- bmi.b fadd_zero_rm # negative
- fmov.s &0x00000000,%fp0 # return +ZERO
- mov.b &z_bmask,FPSR_CC(%a6) # set Z
- rts
-
-#
-# the ZEROes have opposite signs:
-# - therefore, we return +ZERO if the rounding modes are RN,RZ, or RP.
-# - -ZERO is returned in the case of RM.
-#
-fadd_zero_2_chk_rm:
- mov.b 3+L_SCR3(%a6),%d1
- andi.b &0x30,%d1 # extract rnd mode
- cmpi.b %d1,&rm_mode*0x10 # is rnd mode == RM?
- beq.b fadd_zero_rm # yes
- fmov.s &0x00000000,%fp0 # return +ZERO
- mov.b &z_bmask,FPSR_CC(%a6) # set Z
- rts
-
-fadd_zero_rm:
- fmov.s &0x80000000,%fp0 # return -ZERO
- mov.b &neg_bmask+z_bmask,FPSR_CC(%a6) # set NEG/Z
- rts
-
-#
-# one operand is a ZERO and the other is a DENORM or NORM. scale
-# the DENORM or NORM and jump to the regular fadd routine.
-#
-fadd_zero_dst:
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- bsr.l scale_to_zero_src # scale the operand
- clr.w FP_SCR1_EX(%a6)
- clr.l FP_SCR1_HI(%a6)
- clr.l FP_SCR1_LO(%a6)
- bra.w fadd_zero_entry # go execute fadd
-
-fadd_zero_src:
- mov.w DST_EX(%a1),FP_SCR1_EX(%a6)
- mov.l DST_HI(%a1),FP_SCR1_HI(%a6)
- mov.l DST_LO(%a1),FP_SCR1_LO(%a6)
- bsr.l scale_to_zero_dst # scale the operand
- clr.w FP_SCR0_EX(%a6)
- clr.l FP_SCR0_HI(%a6)
- clr.l FP_SCR0_LO(%a6)
- bra.w fadd_zero_entry # go execute fadd
-
-#
-# both operands are INFs. an OPERR will result if the INFs have
-# different signs. else, an INF of the same sign is returned
-#
-fadd_inf_2:
- mov.b SRC_EX(%a0),%d0 # exclusive or the signs
- mov.b DST_EX(%a1),%d1
- eor.b %d1,%d0
- bmi.l res_operr # weed out (-INF)+(+INF)
-
-# ok, so it's not an OPERR. but, we do have to remember to return the
-# src INF since that's where the 881/882 gets the j-bit from...
-
-#
-# operands are INF and one of {ZERO, INF, DENORM, NORM}
-#
-fadd_inf_src:
- fmovm.x SRC(%a0),&0x80 # return src INF
- tst.b SRC_EX(%a0) # is INF positive?
- bpl.b fadd_inf_done # yes; we're done
- mov.b &neg_bmask+inf_bmask,FPSR_CC(%a6) # set INF/NEG
- rts
-
-#
-# operands are INF and one of {ZERO, INF, DENORM, NORM}
-#
-fadd_inf_dst:
- fmovm.x DST(%a1),&0x80 # return dst INF
- tst.b DST_EX(%a1) # is INF positive?
- bpl.b fadd_inf_done # yes; we're done
- mov.b &neg_bmask+inf_bmask,FPSR_CC(%a6) # set INF/NEG
- rts
-
-fadd_inf_done:
- mov.b &inf_bmask,FPSR_CC(%a6) # set INF
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# fsub(): emulates the fsub instruction #
-# fssub(): emulates the fssub instruction #
-# fdsub(): emulates the fdsub instruction #
-# #
-# XREF **************************************************************** #
-# addsub_scaler2() - scale the operands so they won't take exc #
-# ovf_res() - return default overflow result #
-# unf_res() - return default underflow result #
-# res_qnan() - set QNAN result #
-# res_snan() - set SNAN result #
-# res_operr() - set OPERR result #
-# scale_to_zero_src() - set src operand exponent equal to zero #
-# scale_to_zero_dst() - set dst operand exponent equal to zero #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# a1 = pointer to extended precision destination operand #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = result #
-# fp1 = EXOP (if exception occurred) #
-# #
-# ALGORITHM *********************************************************** #
-# Handle NANs, infinities, and zeroes as special cases. Divide #
-# norms into extended, single, and double precision. #
-# Do subtraction after scaling exponents such that exception won't#
-# occur. Then, check result exponent to see if exception would have #
-# occurred. If so, return default result and maybe EXOP. Else, insert #
-# the correct result exponent and return. Set FPSR bits as appropriate. #
-# #
-#########################################################################
-
- global fssub
-fssub:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &s_mode*0x10,%d0 # insert sgl prec
- bra.b fsub
-
- global fdsub
-fdsub:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &d_mode*0x10,%d0 # insert dbl prec
-
- global fsub
-fsub:
- mov.l %d0,L_SCR3(%a6) # store rnd info
-
- clr.w %d1
- mov.b DTAG(%a6),%d1
- lsl.b &0x3,%d1
- or.b STAG(%a6),%d1 # combine src tags
-
- bne.w fsub_not_norm # optimize on non-norm input
-
-#
-# SUB: norms and denorms
-#
-fsub_norm:
- bsr.l addsub_scaler2 # scale exponents
-
-fsub_zero_entry:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l &0x0,%fpsr # clear FPSR
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fsub.x FP_SCR0(%a6),%fp0 # execute subtract
-
- fmov.l &0x0,%fpcr # clear FPCR
- fmov.l %fpsr,%d1 # fetch INEX2, N, Z
-
- or.l %d1,USER_FPSR(%a6) # save exc and ccode bits
-
- fbeq.w fsub_zero_exit # if result zero, end now
-
- mov.l %d2,-(%sp) # save d2
-
- fmovm.x &0x01,-(%sp) # save result to stack
-
- mov.w 2+L_SCR3(%a6),%d1
- lsr.b &0x6,%d1
-
- mov.w (%sp),%d2 # fetch new exponent
- andi.l &0x7fff,%d2 # strip sign
- sub.l %d0,%d2 # add scale factor
-
- cmp.l %d2,(tbl_fsub_ovfl.b,%pc,%d1.w*4) # is it an overflow?
- bge.b fsub_ovfl # yes
-
- cmp.l %d2,(tbl_fsub_unfl.b,%pc,%d1.w*4) # is it an underflow?
- blt.w fsub_unfl # yes
- beq.w fsub_may_unfl # maybe; go find out
-
-fsub_normal:
- mov.w (%sp),%d1
- andi.w &0x8000,%d1 # keep sign
- or.w %d2,%d1 # insert new exponent
- mov.w %d1,(%sp) # insert new exponent
-
- fmovm.x (%sp)+,&0x80 # return result in fp0
-
- mov.l (%sp)+,%d2 # restore d2
- rts
-
-fsub_zero_exit:
-# fmov.s &0x00000000,%fp0 # return zero in fp0
- rts
-
-tbl_fsub_ovfl:
- long 0x7fff # ext ovfl
- long 0x407f # sgl ovfl
- long 0x43ff # dbl ovfl
-
-tbl_fsub_unfl:
- long 0x0000 # ext unfl
- long 0x3f81 # sgl unfl
- long 0x3c01 # dbl unfl
-
-fsub_ovfl:
- or.l &ovfl_inx_mask,USER_FPSR(%a6) # set ovfl/aovfl/ainex
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x13,%d1 # is OVFL or INEX enabled?
- bne.b fsub_ovfl_ena # yes
-
- add.l &0xc,%sp
-fsub_ovfl_dis:
- btst &neg_bit,FPSR_CC(%a6) # is result negative?
- sne %d1 # set sign param accordingly
- mov.l L_SCR3(%a6),%d0 # pass prec:rnd
- bsr.l ovf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # set INF,N if applicable
- fmovm.x (%a0),&0x80 # return default result in fp0
- mov.l (%sp)+,%d2 # restore d2
- rts
-
-fsub_ovfl_ena:
- mov.b L_SCR3(%a6),%d1
- andi.b &0xc0,%d1 # is precision extended?
- bne.b fsub_ovfl_ena_sd # no
-
-fsub_ovfl_ena_cont:
- mov.w (%sp),%d1 # fetch {sgn,exp}
- andi.w &0x8000,%d1 # keep sign
- subi.l &0x6000,%d2 # subtract new bias
- andi.w &0x7fff,%d2 # clear top bit
- or.w %d2,%d1 # concat sign,exp
- mov.w %d1,(%sp) # insert new exponent
-
- fmovm.x (%sp)+,&0x40 # return EXOP in fp1
- bra.b fsub_ovfl_dis
-
-fsub_ovfl_ena_sd:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- mov.l L_SCR3(%a6),%d1
- andi.b &0x30,%d1 # clear rnd prec
- fmov.l %d1,%fpcr # set FPCR
-
- fsub.x FP_SCR0(%a6),%fp0 # execute subtract
-
- fmov.l &0x0,%fpcr # clear FPCR
-
- add.l &0xc,%sp
- fmovm.x &0x01,-(%sp)
- bra.b fsub_ovfl_ena_cont
-
-fsub_unfl:
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
-
- add.l &0xc,%sp
-
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l &rz_mode*0x10,%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsub.x FP_SCR0(%a6),%fp0 # execute subtract
-
- fmov.l &0x0,%fpcr # clear FPCR
- fmov.l %fpsr,%d1 # save status
-
- or.l %d1,USER_FPSR(%a6)
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x0b,%d1 # is UNFL or INEX enabled?
- bne.b fsub_unfl_ena # yes
-
-fsub_unfl_dis:
- fmovm.x &0x80,FP_SCR0(%a6) # store out result
-
- lea FP_SCR0(%a6),%a0 # pass: result addr
- mov.l L_SCR3(%a6),%d1 # pass: rnd prec,mode
- bsr.l unf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # 'Z' may have been set
- fmovm.x FP_SCR0(%a6),&0x80 # return default result in fp0
- mov.l (%sp)+,%d2 # restore d2
- rts
-
-fsub_unfl_ena:
- fmovm.x FP_SCR1(%a6),&0x40
-
- mov.l L_SCR3(%a6),%d1
- andi.b &0xc0,%d1 # is precision extended?
- bne.b fsub_unfl_ena_sd # no
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
-fsub_unfl_ena_cont:
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsub.x FP_SCR0(%a6),%fp1 # execute subtract
-
- fmov.l &0x0,%fpcr # clear FPCR
-
- fmovm.x &0x40,FP_SCR0(%a6) # store result to stack
- mov.w FP_SCR0_EX(%a6),%d1 # fetch {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- addi.l &0x6000,%d1 # subtract new bias
- andi.w &0x7fff,%d1 # clear top bit
- or.w %d2,%d1 # concat sgn,exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- bra.w fsub_unfl_dis
-
-fsub_unfl_ena_sd:
- mov.l L_SCR3(%a6),%d1
- andi.b &0x30,%d1 # clear rnd prec
- fmov.l %d1,%fpcr # set FPCR
-
- bra.b fsub_unfl_ena_cont
-
-#
-# result is equal to the smallest normalized number in the selected precision
-# if the precision is extended, this result could not have come from an
-# underflow that rounded up.
-#
-fsub_may_unfl:
- mov.l L_SCR3(%a6),%d1
- andi.b &0xc0,%d1 # fetch rnd prec
- beq.w fsub_normal # yes; no underflow occurred
-
- mov.l 0x4(%sp),%d1
- cmpi.l %d1,&0x80000000 # is hi(man) = 0x80000000?
- bne.w fsub_normal # no; no underflow occurred
-
- tst.l 0x8(%sp) # is lo(man) = 0x0?
- bne.w fsub_normal # no; no underflow occurred
-
- btst &inex2_bit,FPSR_EXCEPT(%a6) # is INEX2 set?
- beq.w fsub_normal # no; no underflow occurred
-
-#
-# ok, so now the result has a exponent equal to the smallest normalized
-# exponent for the selected precision. also, the mantissa is equal to
-# 0x8000000000000000 and this mantissa is the result of rounding non-zero
-# g,r,s.
-# now, we must determine whether the pre-rounded result was an underflow
-# rounded "up" or a normalized number rounded "down".
-# so, we do this be re-executing the add using RZ as the rounding mode and
-# seeing if the new result is smaller or equal to the current result.
-#
- fmovm.x FP_SCR1(%a6),&0x40 # load dst op into fp1
-
- mov.l L_SCR3(%a6),%d1
- andi.b &0xc0,%d1 # keep rnd prec
- ori.b &rz_mode*0x10,%d1 # insert rnd mode
- fmov.l %d1,%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsub.x FP_SCR0(%a6),%fp1 # execute subtract
-
- fmov.l &0x0,%fpcr # clear FPCR
-
- fabs.x %fp0 # compare absolute values
- fabs.x %fp1
- fcmp.x %fp0,%fp1 # is first result > second?
-
- fbgt.w fsub_unfl # yes; it's an underflow
- bra.w fsub_normal # no; it's not an underflow
-
-##########################################################################
-
-#
-# Sub: inputs are not both normalized; what are they?
-#
-fsub_not_norm:
- mov.w (tbl_fsub_op.b,%pc,%d1.w*2),%d1
- jmp (tbl_fsub_op.b,%pc,%d1.w*1)
-
- swbeg &48
-tbl_fsub_op:
- short fsub_norm - tbl_fsub_op # NORM - NORM
- short fsub_zero_src - tbl_fsub_op # NORM - ZERO
- short fsub_inf_src - tbl_fsub_op # NORM - INF
- short fsub_res_qnan - tbl_fsub_op # NORM - QNAN
- short fsub_norm - tbl_fsub_op # NORM - DENORM
- short fsub_res_snan - tbl_fsub_op # NORM - SNAN
- short tbl_fsub_op - tbl_fsub_op #
- short tbl_fsub_op - tbl_fsub_op #
-
- short fsub_zero_dst - tbl_fsub_op # ZERO - NORM
- short fsub_zero_2 - tbl_fsub_op # ZERO - ZERO
- short fsub_inf_src - tbl_fsub_op # ZERO - INF
- short fsub_res_qnan - tbl_fsub_op # NORM - QNAN
- short fsub_zero_dst - tbl_fsub_op # ZERO - DENORM
- short fsub_res_snan - tbl_fsub_op # NORM - SNAN
- short tbl_fsub_op - tbl_fsub_op #
- short tbl_fsub_op - tbl_fsub_op #
-
- short fsub_inf_dst - tbl_fsub_op # INF - NORM
- short fsub_inf_dst - tbl_fsub_op # INF - ZERO
- short fsub_inf_2 - tbl_fsub_op # INF - INF
- short fsub_res_qnan - tbl_fsub_op # NORM - QNAN
- short fsub_inf_dst - tbl_fsub_op # INF - DENORM
- short fsub_res_snan - tbl_fsub_op # NORM - SNAN
- short tbl_fsub_op - tbl_fsub_op #
- short tbl_fsub_op - tbl_fsub_op #
-
- short fsub_res_qnan - tbl_fsub_op # QNAN - NORM
- short fsub_res_qnan - tbl_fsub_op # QNAN - ZERO
- short fsub_res_qnan - tbl_fsub_op # QNAN - INF
- short fsub_res_qnan - tbl_fsub_op # QNAN - QNAN
- short fsub_res_qnan - tbl_fsub_op # QNAN - DENORM
- short fsub_res_snan - tbl_fsub_op # QNAN - SNAN
- short tbl_fsub_op - tbl_fsub_op #
- short tbl_fsub_op - tbl_fsub_op #
-
- short fsub_norm - tbl_fsub_op # DENORM - NORM
- short fsub_zero_src - tbl_fsub_op # DENORM - ZERO
- short fsub_inf_src - tbl_fsub_op # DENORM - INF
- short fsub_res_qnan - tbl_fsub_op # NORM - QNAN
- short fsub_norm - tbl_fsub_op # DENORM - DENORM
- short fsub_res_snan - tbl_fsub_op # NORM - SNAN
- short tbl_fsub_op - tbl_fsub_op #
- short tbl_fsub_op - tbl_fsub_op #
-
- short fsub_res_snan - tbl_fsub_op # SNAN - NORM
- short fsub_res_snan - tbl_fsub_op # SNAN - ZERO
- short fsub_res_snan - tbl_fsub_op # SNAN - INF
- short fsub_res_snan - tbl_fsub_op # SNAN - QNAN
- short fsub_res_snan - tbl_fsub_op # SNAN - DENORM
- short fsub_res_snan - tbl_fsub_op # SNAN - SNAN
- short tbl_fsub_op - tbl_fsub_op #
- short tbl_fsub_op - tbl_fsub_op #
-
-fsub_res_qnan:
- bra.l res_qnan
-fsub_res_snan:
- bra.l res_snan
-
-#
-# both operands are ZEROes
-#
-fsub_zero_2:
- mov.b SRC_EX(%a0),%d0
- mov.b DST_EX(%a1),%d1
- eor.b %d1,%d0
- bpl.b fsub_zero_2_chk_rm
-
-# the signs are opposite, so, return a ZERO w/ the sign of the dst ZERO
- tst.b %d0 # is dst negative?
- bmi.b fsub_zero_2_rm # yes
- fmov.s &0x00000000,%fp0 # no; return +ZERO
- mov.b &z_bmask,FPSR_CC(%a6) # set Z
- rts
-
-#
-# the ZEROes have the same signs:
-# - therefore, we return +ZERO if the rounding mode is RN,RZ, or RP
-# - -ZERO is returned in the case of RM.
-#
-fsub_zero_2_chk_rm:
- mov.b 3+L_SCR3(%a6),%d1
- andi.b &0x30,%d1 # extract rnd mode
- cmpi.b %d1,&rm_mode*0x10 # is rnd mode = RM?
- beq.b fsub_zero_2_rm # yes
- fmov.s &0x00000000,%fp0 # no; return +ZERO
- mov.b &z_bmask,FPSR_CC(%a6) # set Z
- rts
-
-fsub_zero_2_rm:
- fmov.s &0x80000000,%fp0 # return -ZERO
- mov.b &z_bmask+neg_bmask,FPSR_CC(%a6) # set Z/NEG
- rts
-
-#
-# one operand is a ZERO and the other is a DENORM or a NORM.
-# scale the DENORM or NORM and jump to the regular fsub routine.
-#
-fsub_zero_dst:
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- bsr.l scale_to_zero_src # scale the operand
- clr.w FP_SCR1_EX(%a6)
- clr.l FP_SCR1_HI(%a6)
- clr.l FP_SCR1_LO(%a6)
- bra.w fsub_zero_entry # go execute fsub
-
-fsub_zero_src:
- mov.w DST_EX(%a1),FP_SCR1_EX(%a6)
- mov.l DST_HI(%a1),FP_SCR1_HI(%a6)
- mov.l DST_LO(%a1),FP_SCR1_LO(%a6)
- bsr.l scale_to_zero_dst # scale the operand
- clr.w FP_SCR0_EX(%a6)
- clr.l FP_SCR0_HI(%a6)
- clr.l FP_SCR0_LO(%a6)
- bra.w fsub_zero_entry # go execute fsub
-
-#
-# both operands are INFs. an OPERR will result if the INFs have the
-# same signs. else,
-#
-fsub_inf_2:
- mov.b SRC_EX(%a0),%d0 # exclusive or the signs
- mov.b DST_EX(%a1),%d1
- eor.b %d1,%d0
- bpl.l res_operr # weed out (-INF)+(+INF)
-
-# ok, so it's not an OPERR. but we do have to remember to return
-# the src INF since that's where the 881/882 gets the j-bit.
-
-fsub_inf_src:
- fmovm.x SRC(%a0),&0x80 # return src INF
- fneg.x %fp0 # invert sign
- fbge.w fsub_inf_done # sign is now positive
- mov.b &neg_bmask+inf_bmask,FPSR_CC(%a6) # set INF/NEG
- rts
-
-fsub_inf_dst:
- fmovm.x DST(%a1),&0x80 # return dst INF
- tst.b DST_EX(%a1) # is INF negative?
- bpl.b fsub_inf_done # no
- mov.b &neg_bmask+inf_bmask,FPSR_CC(%a6) # set INF/NEG
- rts
-
-fsub_inf_done:
- mov.b &inf_bmask,FPSR_CC(%a6) # set INF
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# fsqrt(): emulates the fsqrt instruction #
-# fssqrt(): emulates the fssqrt instruction #
-# fdsqrt(): emulates the fdsqrt instruction #
-# #
-# XREF **************************************************************** #
-# scale_sqrt() - scale the source operand #
-# unf_res() - return default underflow result #
-# ovf_res() - return default overflow result #
-# res_qnan_1op() - return QNAN result #
-# res_snan_1op() - return SNAN result #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# d0 rnd prec,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = result #
-# fp1 = EXOP (if exception occurred) #
-# #
-# ALGORITHM *********************************************************** #
-# Handle NANs, infinities, and zeroes as special cases. Divide #
-# norms/denorms into ext/sgl/dbl precision. #
-# For norms/denorms, scale the exponents such that a sqrt #
-# instruction won't cause an exception. Use the regular fsqrt to #
-# compute a result. Check if the regular operands would have taken #
-# an exception. If so, return the default overflow/underflow result #
-# and return the EXOP if exceptions are enabled. Else, scale the #
-# result operand to the proper exponent. #
-# #
-#########################################################################
-
- global fssqrt
-fssqrt:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &s_mode*0x10,%d0 # insert sgl precision
- bra.b fsqrt
-
- global fdsqrt
-fdsqrt:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &d_mode*0x10,%d0 # insert dbl precision
-
- global fsqrt
-fsqrt:
- mov.l %d0,L_SCR3(%a6) # store rnd info
- clr.w %d1
- mov.b STAG(%a6),%d1
- bne.w fsqrt_not_norm # optimize on non-norm input
-
-#
-# SQUARE ROOT: norms and denorms ONLY!
-#
-fsqrt_norm:
- tst.b SRC_EX(%a0) # is operand negative?
- bmi.l res_operr # yes
-
- andi.b &0xc0,%d0 # is precision extended?
- bne.b fsqrt_not_ext # no; go handle sgl or dbl
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsqrt.x (%a0),%fp0 # execute square root
-
- fmov.l %fpsr,%d1
- or.l %d1,USER_FPSR(%a6) # set N,INEX
-
- rts
-
-fsqrt_denorm:
- tst.b SRC_EX(%a0) # is operand negative?
- bmi.l res_operr # yes
-
- andi.b &0xc0,%d0 # is precision extended?
- bne.b fsqrt_not_ext # no; go handle sgl or dbl
-
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
-
- bsr.l scale_sqrt # calculate scale factor
-
- bra.w fsqrt_sd_normal
-
-#
-# operand is either single or double
-#
-fsqrt_not_ext:
- cmpi.b %d0,&s_mode*0x10 # separate sgl/dbl prec
- bne.w fsqrt_dbl
-
-#
-# operand is to be rounded to single precision
-#
-fsqrt_sgl:
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
-
- bsr.l scale_sqrt # calculate scale factor
-
- cmpi.l %d0,&0x3fff-0x3f81 # will move in underflow?
- beq.w fsqrt_sd_may_unfl
- bgt.w fsqrt_sd_unfl # yes; go handle underflow
- cmpi.l %d0,&0x3fff-0x407f # will move in overflow?
- beq.w fsqrt_sd_may_ovfl # maybe; go check
- blt.w fsqrt_sd_ovfl # yes; go handle overflow
-
-#
-# operand will NOT overflow or underflow when moved in to the fp reg file
-#
-fsqrt_sd_normal:
- fmov.l &0x0,%fpsr # clear FPSR
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fsqrt.x FP_SCR0(%a6),%fp0 # perform absolute
-
- fmov.l %fpsr,%d1 # save FPSR
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-fsqrt_sd_normal_exit:
- mov.l %d2,-(%sp) # save d2
- fmovm.x &0x80,FP_SCR0(%a6) # store out result
- mov.w FP_SCR0_EX(%a6),%d1 # load sgn,exp
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- sub.l %d0,%d1 # add scale factor
- andi.w &0x8000,%d2 # keep old sign
- or.w %d1,%d2 # concat old sign,new exp
- mov.w %d2,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x80 # return result in fp0
- rts
-
-#
-# operand is to be rounded to double precision
-#
-fsqrt_dbl:
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
-
- bsr.l scale_sqrt # calculate scale factor
-
- cmpi.l %d0,&0x3fff-0x3c01 # will move in underflow?
- beq.w fsqrt_sd_may_unfl
- bgt.b fsqrt_sd_unfl # yes; go handle underflow
- cmpi.l %d0,&0x3fff-0x43ff # will move in overflow?
- beq.w fsqrt_sd_may_ovfl # maybe; go check
- blt.w fsqrt_sd_ovfl # yes; go handle overflow
- bra.w fsqrt_sd_normal # no; ho handle normalized op
-
-# we're on the line here and the distinguishing characteristic is whether
-# the exponent is 3fff or 3ffe. if it's 3ffe, then it's a safe number
-# elsewise fall through to underflow.
-fsqrt_sd_may_unfl:
- btst &0x0,1+FP_SCR0_EX(%a6) # is exponent 0x3fff?
- bne.w fsqrt_sd_normal # yes, so no underflow
-
-#
-# operand WILL underflow when moved in to the fp register file
-#
-fsqrt_sd_unfl:
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
-
- fmov.l &rz_mode*0x10,%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsqrt.x FP_SCR0(%a6),%fp0 # execute square root
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-# if underflow or inexact is enabled, go calculate EXOP first.
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x0b,%d1 # is UNFL or INEX enabled?
- bne.b fsqrt_sd_unfl_ena # yes
-
-fsqrt_sd_unfl_dis:
- fmovm.x &0x80,FP_SCR0(%a6) # store out result
-
- lea FP_SCR0(%a6),%a0 # pass: result addr
- mov.l L_SCR3(%a6),%d1 # pass: rnd prec,mode
- bsr.l unf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # set possible 'Z' ccode
- fmovm.x FP_SCR0(%a6),&0x80 # return default result in fp0
- rts
-
-#
-# operand will underflow AND underflow is enabled.
-# therefore, we must return the result rounded to extended precision.
-#
-fsqrt_sd_unfl_ena:
- mov.l FP_SCR0_HI(%a6),FP_SCR1_HI(%a6)
- mov.l FP_SCR0_LO(%a6),FP_SCR1_LO(%a6)
- mov.w FP_SCR0_EX(%a6),%d1 # load current exponent
-
- mov.l %d2,-(%sp) # save d2
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # subtract scale factor
- addi.l &0x6000,%d1 # add new bias
- andi.w &0x7fff,%d1
- or.w %d2,%d1 # concat new sign,new exp
- mov.w %d1,FP_SCR1_EX(%a6) # insert new exp
- fmovm.x FP_SCR1(%a6),&0x40 # return EXOP in fp1
- mov.l (%sp)+,%d2 # restore d2
- bra.b fsqrt_sd_unfl_dis
-
-#
-# operand WILL overflow.
-#
-fsqrt_sd_ovfl:
- fmov.l &0x0,%fpsr # clear FPSR
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fsqrt.x FP_SCR0(%a6),%fp0 # perform square root
-
- fmov.l &0x0,%fpcr # clear FPCR
- fmov.l %fpsr,%d1 # save FPSR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-fsqrt_sd_ovfl_tst:
- or.l &ovfl_inx_mask,USER_FPSR(%a6) # set ovfl/aovfl/ainex
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x13,%d1 # is OVFL or INEX enabled?
- bne.b fsqrt_sd_ovfl_ena # yes
-
-#
-# OVFL is not enabled; therefore, we must create the default result by
-# calling ovf_res().
-#
-fsqrt_sd_ovfl_dis:
- btst &neg_bit,FPSR_CC(%a6) # is result negative?
- sne %d1 # set sign param accordingly
- mov.l L_SCR3(%a6),%d0 # pass: prec,mode
- bsr.l ovf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # set INF,N if applicable
- fmovm.x (%a0),&0x80 # return default result in fp0
- rts
-
-#
-# OVFL is enabled.
-# the INEX2 bit has already been updated by the round to the correct precision.
-# now, round to extended(and don't alter the FPSR).
-#
-fsqrt_sd_ovfl_ena:
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # fetch {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- subi.l &0x6000,%d1 # subtract bias
- andi.w &0x7fff,%d1
- or.w %d2,%d1 # concat sign,exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- mov.l (%sp)+,%d2 # restore d2
- bra.b fsqrt_sd_ovfl_dis
-
-#
-# the move in MAY underflow. so...
-#
-fsqrt_sd_may_ovfl:
- btst &0x0,1+FP_SCR0_EX(%a6) # is exponent 0x3fff?
- bne.w fsqrt_sd_ovfl # yes, so overflow
-
- fmov.l &0x0,%fpsr # clear FPSR
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fsqrt.x FP_SCR0(%a6),%fp0 # perform absolute
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
- fmov.x %fp0,%fp1 # make a copy of result
- fcmp.b %fp1,&0x1 # is |result| >= 1.b?
- fbge.w fsqrt_sd_ovfl_tst # yes; overflow has occurred
-
-# no, it didn't overflow; we have correct result
- bra.w fsqrt_sd_normal_exit
-
-##########################################################################
-
-#
-# input is not normalized; what is it?
-#
-fsqrt_not_norm:
- cmpi.b %d1,&DENORM # weed out DENORM
- beq.w fsqrt_denorm
- cmpi.b %d1,&ZERO # weed out ZERO
- beq.b fsqrt_zero
- cmpi.b %d1,&INF # weed out INF
- beq.b fsqrt_inf
- cmpi.b %d1,&SNAN # weed out SNAN
- beq.l res_snan_1op
- bra.l res_qnan_1op
-
-#
-# fsqrt(+0) = +0
-# fsqrt(-0) = -0
-# fsqrt(+INF) = +INF
-# fsqrt(-INF) = OPERR
-#
-fsqrt_zero:
- tst.b SRC_EX(%a0) # is ZERO positive or negative?
- bmi.b fsqrt_zero_m # negative
-fsqrt_zero_p:
- fmov.s &0x00000000,%fp0 # return +ZERO
- mov.b &z_bmask,FPSR_CC(%a6) # set 'Z' ccode bit
- rts
-fsqrt_zero_m:
- fmov.s &0x80000000,%fp0 # return -ZERO
- mov.b &z_bmask+neg_bmask,FPSR_CC(%a6) # set 'Z','N' ccode bits
- rts
-
-fsqrt_inf:
- tst.b SRC_EX(%a0) # is INF positive or negative?
- bmi.l res_operr # negative
-fsqrt_inf_p:
- fmovm.x SRC(%a0),&0x80 # return +INF in fp0
- mov.b &inf_bmask,FPSR_CC(%a6) # set 'I' ccode bit
- rts
-
-##########################################################################
-
-#########################################################################
-# XDEF **************************************************************** #
-# addsub_scaler2(): scale inputs to fadd/fsub such that no #
-# OVFL/UNFL exceptions will result #
-# #
-# XREF **************************************************************** #
-# norm() - normalize mantissa after adjusting exponent #
-# #
-# INPUT *************************************************************** #
-# FP_SRC(a6) = fp op1(src) #
-# FP_DST(a6) = fp op2(dst) #
-# #
-# OUTPUT ************************************************************** #
-# FP_SRC(a6) = fp op1 scaled(src) #
-# FP_DST(a6) = fp op2 scaled(dst) #
-# d0 = scale amount #
-# #
-# ALGORITHM *********************************************************** #
-# If the DST exponent is > the SRC exponent, set the DST exponent #
-# equal to 0x3fff and scale the SRC exponent by the value that the #
-# DST exponent was scaled by. If the SRC exponent is greater or equal, #
-# do the opposite. Return this scale factor in d0. #
-# If the two exponents differ by > the number of mantissa bits #
-# plus two, then set the smallest exponent to a very small value as a #
-# quick shortcut. #
-# #
-#########################################################################
-
- global addsub_scaler2
-addsub_scaler2:
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l DST_HI(%a1),FP_SCR1_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- mov.l DST_LO(%a1),FP_SCR1_LO(%a6)
- mov.w SRC_EX(%a0),%d0
- mov.w DST_EX(%a1),%d1
- mov.w %d0,FP_SCR0_EX(%a6)
- mov.w %d1,FP_SCR1_EX(%a6)
-
- andi.w &0x7fff,%d0
- andi.w &0x7fff,%d1
- mov.w %d0,L_SCR1(%a6) # store src exponent
- mov.w %d1,2+L_SCR1(%a6) # store dst exponent
-
- cmp.w %d0, %d1 # is src exp >= dst exp?
- bge.l src_exp_ge2
-
-# dst exp is > src exp; scale dst to exp = 0x3fff
-dst_exp_gt2:
- bsr.l scale_to_zero_dst
- mov.l %d0,-(%sp) # save scale factor
-
- cmpi.b STAG(%a6),&DENORM # is dst denormalized?
- bne.b cmpexp12
-
- lea FP_SCR0(%a6),%a0
- bsr.l norm # normalize the denorm; result is new exp
- neg.w %d0 # new exp = -(shft val)
- mov.w %d0,L_SCR1(%a6) # inset new exp
-
-cmpexp12:
- mov.w 2+L_SCR1(%a6),%d0
- subi.w &mantissalen+2,%d0 # subtract mantissalen+2 from larger exp
-
- cmp.w %d0,L_SCR1(%a6) # is difference >= len(mantissa)+2?
- bge.b quick_scale12
-
- mov.w L_SCR1(%a6),%d0
- add.w 0x2(%sp),%d0 # scale src exponent by scale factor
- mov.w FP_SCR0_EX(%a6),%d1
- and.w &0x8000,%d1
- or.w %d1,%d0 # concat {sgn,new exp}
- mov.w %d0,FP_SCR0_EX(%a6) # insert new dst exponent
-
- mov.l (%sp)+,%d0 # return SCALE factor
- rts
-
-quick_scale12:
- andi.w &0x8000,FP_SCR0_EX(%a6) # zero src exponent
- bset &0x0,1+FP_SCR0_EX(%a6) # set exp = 1
-
- mov.l (%sp)+,%d0 # return SCALE factor
- rts
-
-# src exp is >= dst exp; scale src to exp = 0x3fff
-src_exp_ge2:
- bsr.l scale_to_zero_src
- mov.l %d0,-(%sp) # save scale factor
-
- cmpi.b DTAG(%a6),&DENORM # is dst denormalized?
- bne.b cmpexp22
- lea FP_SCR1(%a6),%a0
- bsr.l norm # normalize the denorm; result is new exp
- neg.w %d0 # new exp = -(shft val)
- mov.w %d0,2+L_SCR1(%a6) # inset new exp
-
-cmpexp22:
- mov.w L_SCR1(%a6),%d0
- subi.w &mantissalen+2,%d0 # subtract mantissalen+2 from larger exp
-
- cmp.w %d0,2+L_SCR1(%a6) # is difference >= len(mantissa)+2?
- bge.b quick_scale22
-
- mov.w 2+L_SCR1(%a6),%d0
- add.w 0x2(%sp),%d0 # scale dst exponent by scale factor
- mov.w FP_SCR1_EX(%a6),%d1
- andi.w &0x8000,%d1
- or.w %d1,%d0 # concat {sgn,new exp}
- mov.w %d0,FP_SCR1_EX(%a6) # insert new dst exponent
-
- mov.l (%sp)+,%d0 # return SCALE factor
- rts
-
-quick_scale22:
- andi.w &0x8000,FP_SCR1_EX(%a6) # zero dst exponent
- bset &0x0,1+FP_SCR1_EX(%a6) # set exp = 1
-
- mov.l (%sp)+,%d0 # return SCALE factor
- rts
-
-##########################################################################
-
-#########################################################################
-# XDEF **************************************************************** #
-# scale_to_zero_src(): scale the exponent of extended precision #
-# value at FP_SCR0(a6). #
-# #
-# XREF **************************************************************** #
-# norm() - normalize the mantissa if the operand was a DENORM #
-# #
-# INPUT *************************************************************** #
-# FP_SCR0(a6) = extended precision operand to be scaled #
-# #
-# OUTPUT ************************************************************** #
-# FP_SCR0(a6) = scaled extended precision operand #
-# d0 = scale value #
-# #
-# ALGORITHM *********************************************************** #
-# Set the exponent of the input operand to 0x3fff. Save the value #
-# of the difference between the original and new exponent. Then, #
-# normalize the operand if it was a DENORM. Add this normalization #
-# value to the previous value. Return the result. #
-# #
-#########################################################################
-
- global scale_to_zero_src
-scale_to_zero_src:
- mov.w FP_SCR0_EX(%a6),%d1 # extract operand's {sgn,exp}
- mov.w %d1,%d0 # make a copy
-
- andi.l &0x7fff,%d1 # extract operand's exponent
-
- andi.w &0x8000,%d0 # extract operand's sgn
- or.w &0x3fff,%d0 # insert new operand's exponent(=0)
-
- mov.w %d0,FP_SCR0_EX(%a6) # insert biased exponent
-
- cmpi.b STAG(%a6),&DENORM # is operand normalized?
- beq.b stzs_denorm # normalize the DENORM
-
-stzs_norm:
- mov.l &0x3fff,%d0
- sub.l %d1,%d0 # scale = BIAS + (-exp)
-
- rts
-
-stzs_denorm:
- lea FP_SCR0(%a6),%a0 # pass ptr to src op
- bsr.l norm # normalize denorm
- neg.l %d0 # new exponent = -(shft val)
- mov.l %d0,%d1 # prepare for op_norm call
- bra.b stzs_norm # finish scaling
-
-###
-
-#########################################################################
-# XDEF **************************************************************** #
-# scale_sqrt(): scale the input operand exponent so a subsequent #
-# fsqrt operation won't take an exception. #
-# #
-# XREF **************************************************************** #
-# norm() - normalize the mantissa if the operand was a DENORM #
-# #
-# INPUT *************************************************************** #
-# FP_SCR0(a6) = extended precision operand to be scaled #
-# #
-# OUTPUT ************************************************************** #
-# FP_SCR0(a6) = scaled extended precision operand #
-# d0 = scale value #
-# #
-# ALGORITHM *********************************************************** #
-# If the input operand is a DENORM, normalize it. #
-# If the exponent of the input operand is even, set the exponent #
-# to 0x3ffe and return a scale factor of "(exp-0x3ffe)/2". If the #
-# exponent of the input operand is off, set the exponent to ox3fff and #
-# return a scale factor of "(exp-0x3fff)/2". #
-# #
-#########################################################################
-
- global scale_sqrt
-scale_sqrt:
- cmpi.b STAG(%a6),&DENORM # is operand normalized?
- beq.b ss_denorm # normalize the DENORM
-
- mov.w FP_SCR0_EX(%a6),%d1 # extract operand's {sgn,exp}
- andi.l &0x7fff,%d1 # extract operand's exponent
-
- andi.w &0x8000,FP_SCR0_EX(%a6) # extract operand's sgn
-
- btst &0x0,%d1 # is exp even or odd?
- beq.b ss_norm_even
-
- ori.w &0x3fff,FP_SCR0_EX(%a6) # insert new operand's exponent(=0)
-
- mov.l &0x3fff,%d0
- sub.l %d1,%d0 # scale = BIAS + (-exp)
- asr.l &0x1,%d0 # divide scale factor by 2
- rts
-
-ss_norm_even:
- ori.w &0x3ffe,FP_SCR0_EX(%a6) # insert new operand's exponent(=0)
-
- mov.l &0x3ffe,%d0
- sub.l %d1,%d0 # scale = BIAS + (-exp)
- asr.l &0x1,%d0 # divide scale factor by 2
- rts
-
-ss_denorm:
- lea FP_SCR0(%a6),%a0 # pass ptr to src op
- bsr.l norm # normalize denorm
-
- btst &0x0,%d0 # is exp even or odd?
- beq.b ss_denorm_even
-
- ori.w &0x3fff,FP_SCR0_EX(%a6) # insert new operand's exponent(=0)
-
- add.l &0x3fff,%d0
- asr.l &0x1,%d0 # divide scale factor by 2
- rts
-
-ss_denorm_even:
- ori.w &0x3ffe,FP_SCR0_EX(%a6) # insert new operand's exponent(=0)
-
- add.l &0x3ffe,%d0
- asr.l &0x1,%d0 # divide scale factor by 2
- rts
-
-###
-
-#########################################################################
-# XDEF **************************************************************** #
-# scale_to_zero_dst(): scale the exponent of extended precision #
-# value at FP_SCR1(a6). #
-# #
-# XREF **************************************************************** #
-# norm() - normalize the mantissa if the operand was a DENORM #
-# #
-# INPUT *************************************************************** #
-# FP_SCR1(a6) = extended precision operand to be scaled #
-# #
-# OUTPUT ************************************************************** #
-# FP_SCR1(a6) = scaled extended precision operand #
-# d0 = scale value #
-# #
-# ALGORITHM *********************************************************** #
-# Set the exponent of the input operand to 0x3fff. Save the value #
-# of the difference between the original and new exponent. Then, #
-# normalize the operand if it was a DENORM. Add this normalization #
-# value to the previous value. Return the result. #
-# #
-#########################################################################
-
- global scale_to_zero_dst
-scale_to_zero_dst:
- mov.w FP_SCR1_EX(%a6),%d1 # extract operand's {sgn,exp}
- mov.w %d1,%d0 # make a copy
-
- andi.l &0x7fff,%d1 # extract operand's exponent
-
- andi.w &0x8000,%d0 # extract operand's sgn
- or.w &0x3fff,%d0 # insert new operand's exponent(=0)
-
- mov.w %d0,FP_SCR1_EX(%a6) # insert biased exponent
-
- cmpi.b DTAG(%a6),&DENORM # is operand normalized?
- beq.b stzd_denorm # normalize the DENORM
-
-stzd_norm:
- mov.l &0x3fff,%d0
- sub.l %d1,%d0 # scale = BIAS + (-exp)
- rts
-
-stzd_denorm:
- lea FP_SCR1(%a6),%a0 # pass ptr to dst op
- bsr.l norm # normalize denorm
- neg.l %d0 # new exponent = -(shft val)
- mov.l %d0,%d1 # prepare for op_norm call
- bra.b stzd_norm # finish scaling
-
-##########################################################################
-
-#########################################################################
-# XDEF **************************************************************** #
-# res_qnan(): return default result w/ QNAN operand for dyadic #
-# res_snan(): return default result w/ SNAN operand for dyadic #
-# res_qnan_1op(): return dflt result w/ QNAN operand for monadic #
-# res_snan_1op(): return dflt result w/ SNAN operand for monadic #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# FP_SRC(a6) = pointer to extended precision src operand #
-# FP_DST(a6) = pointer to extended precision dst operand #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = default result #
-# #
-# ALGORITHM *********************************************************** #
-# If either operand (but not both operands) of an operation is a #
-# nonsignalling NAN, then that NAN is returned as the result. If both #
-# operands are nonsignalling NANs, then the destination operand #
-# nonsignalling NAN is returned as the result. #
-# If either operand to an operation is a signalling NAN (SNAN), #
-# then, the SNAN bit is set in the FPSR EXC byte. If the SNAN trap #
-# enable bit is set in the FPCR, then the trap is taken and the #
-# destination is not modified. If the SNAN trap enable bit is not set, #
-# then the SNAN is converted to a nonsignalling NAN (by setting the #
-# SNAN bit in the operand to one), and the operation continues as #
-# described in the preceding paragraph, for nonsignalling NANs. #
-# Make sure the appropriate FPSR bits are set before exiting. #
-# #
-#########################################################################
-
- global res_qnan
- global res_snan
-res_qnan:
-res_snan:
- cmp.b DTAG(%a6), &SNAN # is the dst an SNAN?
- beq.b dst_snan2
- cmp.b DTAG(%a6), &QNAN # is the dst a QNAN?
- beq.b dst_qnan2
-src_nan:
- cmp.b STAG(%a6), &QNAN
- beq.b src_qnan2
- global res_snan_1op
-res_snan_1op:
-src_snan2:
- bset &0x6, FP_SRC_HI(%a6) # set SNAN bit
- or.l &nan_mask+aiop_mask+snan_mask, USER_FPSR(%a6)
- lea FP_SRC(%a6), %a0
- bra.b nan_comp
- global res_qnan_1op
-res_qnan_1op:
-src_qnan2:
- or.l &nan_mask, USER_FPSR(%a6)
- lea FP_SRC(%a6), %a0
- bra.b nan_comp
-dst_snan2:
- or.l &nan_mask+aiop_mask+snan_mask, USER_FPSR(%a6)
- bset &0x6, FP_DST_HI(%a6) # set SNAN bit
- lea FP_DST(%a6), %a0
- bra.b nan_comp
-dst_qnan2:
- lea FP_DST(%a6), %a0
- cmp.b STAG(%a6), &SNAN
- bne nan_done
- or.l &aiop_mask+snan_mask, USER_FPSR(%a6)
-nan_done:
- or.l &nan_mask, USER_FPSR(%a6)
-nan_comp:
- btst &0x7, FTEMP_EX(%a0) # is NAN neg?
- beq.b nan_not_neg
- or.l &neg_mask, USER_FPSR(%a6)
-nan_not_neg:
- fmovm.x (%a0), &0x80
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# res_operr(): return default result during operand error #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# None #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = default operand error result #
-# #
-# ALGORITHM *********************************************************** #
-# An nonsignalling NAN is returned as the default result when #
-# an operand error occurs for the following cases: #
-# #
-# Multiply: (Infinity x Zero) #
-# Divide : (Zero / Zero) || (Infinity / Infinity) #
-# #
-#########################################################################
-
- global res_operr
-res_operr:
- or.l &nan_mask+operr_mask+aiop_mask, USER_FPSR(%a6)
- fmovm.x nan_return(%pc), &0x80
- rts
-
-nan_return:
- long 0x7fff0000, 0xffffffff, 0xffffffff
-
-#########################################################################
-# fdbcc(): routine to emulate the fdbcc instruction #
-# #
-# XDEF **************************************************************** #
-# _fdbcc() #
-# #
-# XREF **************************************************************** #
-# fetch_dreg() - fetch Dn value #
-# store_dreg_l() - store updated Dn value #
-# #
-# INPUT *************************************************************** #
-# d0 = displacement #
-# #
-# OUTPUT ************************************************************** #
-# none #
-# #
-# ALGORITHM *********************************************************** #
-# This routine checks which conditional predicate is specified by #
-# the stacked fdbcc instruction opcode and then branches to a routine #
-# for that predicate. The corresponding fbcc instruction is then used #
-# to see whether the condition (specified by the stacked FPSR) is true #
-# or false. #
-# If a BSUN exception should be indicated, the BSUN and ABSUN #
-# bits are set in the stacked FPSR. If the BSUN exception is enabled, #
-# the fbsun_flg is set in the SPCOND_FLG location on the stack. If an #
-# enabled BSUN should not be flagged and the predicate is true, then #
-# Dn is fetched and decremented by one. If Dn is not equal to -1, add #
-# the displacement value to the stacked PC so that when an "rte" is #
-# finally executed, the branch occurs. #
-# #
-#########################################################################
- global _fdbcc
-_fdbcc:
- mov.l %d0,L_SCR1(%a6) # save displacement
-
- mov.w EXC_CMDREG(%a6),%d0 # fetch predicate
-
- clr.l %d1 # clear scratch reg
- mov.b FPSR_CC(%a6),%d1 # fetch fp ccodes
- ror.l &0x8,%d1 # rotate to top byte
- fmov.l %d1,%fpsr # insert into FPSR
-
- mov.w (tbl_fdbcc.b,%pc,%d0.w*2),%d1 # load table
- jmp (tbl_fdbcc.b,%pc,%d1.w) # jump to fdbcc routine
-
-tbl_fdbcc:
- short fdbcc_f - tbl_fdbcc # 00
- short fdbcc_eq - tbl_fdbcc # 01
- short fdbcc_ogt - tbl_fdbcc # 02
- short fdbcc_oge - tbl_fdbcc # 03
- short fdbcc_olt - tbl_fdbcc # 04
- short fdbcc_ole - tbl_fdbcc # 05
- short fdbcc_ogl - tbl_fdbcc # 06
- short fdbcc_or - tbl_fdbcc # 07
- short fdbcc_un - tbl_fdbcc # 08
- short fdbcc_ueq - tbl_fdbcc # 09
- short fdbcc_ugt - tbl_fdbcc # 10
- short fdbcc_uge - tbl_fdbcc # 11
- short fdbcc_ult - tbl_fdbcc # 12
- short fdbcc_ule - tbl_fdbcc # 13
- short fdbcc_neq - tbl_fdbcc # 14
- short fdbcc_t - tbl_fdbcc # 15
- short fdbcc_sf - tbl_fdbcc # 16
- short fdbcc_seq - tbl_fdbcc # 17
- short fdbcc_gt - tbl_fdbcc # 18
- short fdbcc_ge - tbl_fdbcc # 19
- short fdbcc_lt - tbl_fdbcc # 20
- short fdbcc_le - tbl_fdbcc # 21
- short fdbcc_gl - tbl_fdbcc # 22
- short fdbcc_gle - tbl_fdbcc # 23
- short fdbcc_ngle - tbl_fdbcc # 24
- short fdbcc_ngl - tbl_fdbcc # 25
- short fdbcc_nle - tbl_fdbcc # 26
- short fdbcc_nlt - tbl_fdbcc # 27
- short fdbcc_nge - tbl_fdbcc # 28
- short fdbcc_ngt - tbl_fdbcc # 29
- short fdbcc_sneq - tbl_fdbcc # 30
- short fdbcc_st - tbl_fdbcc # 31
-
-#########################################################################
-# #
-# IEEE Nonaware tests #
-# #
-# For the IEEE nonaware tests, only the false branch changes the #
-# counter. However, the true branch may set bsun so we check to see #
-# if the NAN bit is set, in which case BSUN and AIOP will be set. #
-# #
-# The cases EQ and NE are shared by the Aware and Nonaware groups #
-# and are incapable of setting the BSUN exception bit. #
-# #
-# Typically, only one of the two possible branch directions could #
-# have the NAN bit set. #
-# (This is assuming the mutual exclusiveness of FPSR cc bit groupings #
-# is preserved.) #
-# #
-#########################################################################
-
-#
-# equal:
-#
-# Z
-#
-fdbcc_eq:
- fbeq.w fdbcc_eq_yes # equal?
-fdbcc_eq_no:
- bra.w fdbcc_false # no; go handle counter
-fdbcc_eq_yes:
- rts
-
-#
-# not equal:
-# _
-# Z
-#
-fdbcc_neq:
- fbneq.w fdbcc_neq_yes # not equal?
-fdbcc_neq_no:
- bra.w fdbcc_false # no; go handle counter
-fdbcc_neq_yes:
- rts
-
-#
-# greater than:
-# _______
-# NANvZvN
-#
-fdbcc_gt:
- fbgt.w fdbcc_gt_yes # greater than?
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.w fdbcc_false # no;go handle counter
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
- bne.w fdbcc_bsun # yes; we have an exception
- bra.w fdbcc_false # no; go handle counter
-fdbcc_gt_yes:
- rts # do nothing
-
-#
-# not greater than:
-#
-# NANvZvN
-#
-fdbcc_ngt:
- fbngt.w fdbcc_ngt_yes # not greater than?
-fdbcc_ngt_no:
- bra.w fdbcc_false # no; go handle counter
-fdbcc_ngt_yes:
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.b fdbcc_ngt_done # no;go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
- bne.w fdbcc_bsun # yes; we have an exception
-fdbcc_ngt_done:
- rts # no; do nothing
-
-#
-# greater than or equal:
-# _____
-# Zv(NANvN)
-#
-fdbcc_ge:
- fbge.w fdbcc_ge_yes # greater than or equal?
-fdbcc_ge_no:
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.w fdbcc_false # no;go handle counter
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
- bne.w fdbcc_bsun # yes; we have an exception
- bra.w fdbcc_false # no; go handle counter
-fdbcc_ge_yes:
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.b fdbcc_ge_yes_done # no;go do nothing
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
- bne.w fdbcc_bsun # yes; we have an exception
-fdbcc_ge_yes_done:
- rts # do nothing
-
-#
-# not (greater than or equal):
-# _
-# NANv(N^Z)
-#
-fdbcc_nge:
- fbnge.w fdbcc_nge_yes # not (greater than or equal)?
-fdbcc_nge_no:
- bra.w fdbcc_false # no; go handle counter
-fdbcc_nge_yes:
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.b fdbcc_nge_done # no;go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
- bne.w fdbcc_bsun # yes; we have an exception
-fdbcc_nge_done:
- rts # no; do nothing
-
-#
-# less than:
-# _____
-# N^(NANvZ)
-#
-fdbcc_lt:
- fblt.w fdbcc_lt_yes # less than?
-fdbcc_lt_no:
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.w fdbcc_false # no; go handle counter
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
- bne.w fdbcc_bsun # yes; we have an exception
- bra.w fdbcc_false # no; go handle counter
-fdbcc_lt_yes:
- rts # do nothing
-
-#
-# not less than:
-# _
-# NANv(ZvN)
-#
-fdbcc_nlt:
- fbnlt.w fdbcc_nlt_yes # not less than?
-fdbcc_nlt_no:
- bra.w fdbcc_false # no; go handle counter
-fdbcc_nlt_yes:
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.b fdbcc_nlt_done # no;go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
- bne.w fdbcc_bsun # yes; we have an exception
-fdbcc_nlt_done:
- rts # no; do nothing
-
-#
-# less than or equal:
-# ___
-# Zv(N^NAN)
-#
-fdbcc_le:
- fble.w fdbcc_le_yes # less than or equal?
-fdbcc_le_no:
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.w fdbcc_false # no; go handle counter
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
- bne.w fdbcc_bsun # yes; we have an exception
- bra.w fdbcc_false # no; go handle counter
-fdbcc_le_yes:
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.b fdbcc_le_yes_done # no; go do nothing
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
- bne.w fdbcc_bsun # yes; we have an exception
-fdbcc_le_yes_done:
- rts # do nothing
-
-#
-# not (less than or equal):
-# ___
-# NANv(NvZ)
-#
-fdbcc_nle:
- fbnle.w fdbcc_nle_yes # not (less than or equal)?
-fdbcc_nle_no:
- bra.w fdbcc_false # no; go handle counter
-fdbcc_nle_yes:
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.w fdbcc_nle_done # no; go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
- bne.w fdbcc_bsun # yes; we have an exception
-fdbcc_nle_done:
- rts # no; do nothing
-
-#
-# greater or less than:
-# _____
-# NANvZ
-#
-fdbcc_gl:
- fbgl.w fdbcc_gl_yes # greater or less than?
-fdbcc_gl_no:
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.w fdbcc_false # no; handle counter
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
- bne.w fdbcc_bsun # yes; we have an exception
- bra.w fdbcc_false # no; go handle counter
-fdbcc_gl_yes:
- rts # do nothing
-
-#
-# not (greater or less than):
-#
-# NANvZ
-#
-fdbcc_ngl:
- fbngl.w fdbcc_ngl_yes # not (greater or less than)?
-fdbcc_ngl_no:
- bra.w fdbcc_false # no; go handle counter
-fdbcc_ngl_yes:
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.b fdbcc_ngl_done # no; go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
- bne.w fdbcc_bsun # yes; we have an exception
-fdbcc_ngl_done:
- rts # no; do nothing
-
-#
-# greater, less, or equal:
-# ___
-# NAN
-#
-fdbcc_gle:
- fbgle.w fdbcc_gle_yes # greater, less, or equal?
-fdbcc_gle_no:
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
- bne.w fdbcc_bsun # yes; we have an exception
- bra.w fdbcc_false # no; go handle counter
-fdbcc_gle_yes:
- rts # do nothing
-
-#
-# not (greater, less, or equal):
-#
-# NAN
-#
-fdbcc_ngle:
- fbngle.w fdbcc_ngle_yes # not (greater, less, or equal)?
-fdbcc_ngle_no:
- bra.w fdbcc_false # no; go handle counter
-fdbcc_ngle_yes:
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
- bne.w fdbcc_bsun # yes; we have an exception
- rts # no; do nothing
-
-#########################################################################
-# #
-# Miscellaneous tests #
-# #
-# For the IEEE miscellaneous tests, all but fdbf and fdbt can set bsun. #
-# #
-#########################################################################
-
-#
-# false:
-#
-# False
-#
-fdbcc_f: # no bsun possible
- bra.w fdbcc_false # go handle counter
-
-#
-# true:
-#
-# True
-#
-fdbcc_t: # no bsun possible
- rts # do nothing
-
-#
-# signalling false:
-#
-# False
-#
-fdbcc_sf:
- btst &nan_bit, FPSR_CC(%a6) # is NAN set?
- beq.w fdbcc_false # no;go handle counter
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
- bne.w fdbcc_bsun # yes; we have an exception
- bra.w fdbcc_false # go handle counter
-
-#
-# signalling true:
-#
-# True
-#
-fdbcc_st:
- btst &nan_bit, FPSR_CC(%a6) # is NAN set?
- beq.b fdbcc_st_done # no;go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
- bne.w fdbcc_bsun # yes; we have an exception
-fdbcc_st_done:
- rts
-
-#
-# signalling equal:
-#
-# Z
-#
-fdbcc_seq:
- fbseq.w fdbcc_seq_yes # signalling equal?
-fdbcc_seq_no:
- btst &nan_bit, FPSR_CC(%a6) # is NAN set?
- beq.w fdbcc_false # no;go handle counter
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
- bne.w fdbcc_bsun # yes; we have an exception
- bra.w fdbcc_false # go handle counter
-fdbcc_seq_yes:
- btst &nan_bit, FPSR_CC(%a6) # is NAN set?
- beq.b fdbcc_seq_yes_done # no;go do nothing
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
- bne.w fdbcc_bsun # yes; we have an exception
-fdbcc_seq_yes_done:
- rts # yes; do nothing
-
-#
-# signalling not equal:
-# _
-# Z
-#
-fdbcc_sneq:
- fbsneq.w fdbcc_sneq_yes # signalling not equal?
-fdbcc_sneq_no:
- btst &nan_bit, FPSR_CC(%a6) # is NAN set?
- beq.w fdbcc_false # no;go handle counter
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
- bne.w fdbcc_bsun # yes; we have an exception
- bra.w fdbcc_false # go handle counter
-fdbcc_sneq_yes:
- btst &nan_bit, FPSR_CC(%a6) # set BSUN exc bit
- beq.w fdbcc_sneq_done # no;go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # is BSUN enabled?
- bne.w fdbcc_bsun # yes; we have an exception
-fdbcc_sneq_done:
- rts
-
-#########################################################################
-# #
-# IEEE Aware tests #
-# #
-# For the IEEE aware tests, action is only taken if the result is false.#
-# Therefore, the opposite branch type is used to jump to the decrement #
-# routine. #
-# The BSUN exception will not be set for any of these tests. #
-# #
-#########################################################################
-
-#
-# ordered greater than:
-# _______
-# NANvZvN
-#
-fdbcc_ogt:
- fbogt.w fdbcc_ogt_yes # ordered greater than?
-fdbcc_ogt_no:
- bra.w fdbcc_false # no; go handle counter
-fdbcc_ogt_yes:
- rts # yes; do nothing
-
-#
-# unordered or less or equal:
-# _______
-# NANvZvN
-#
-fdbcc_ule:
- fbule.w fdbcc_ule_yes # unordered or less or equal?
-fdbcc_ule_no:
- bra.w fdbcc_false # no; go handle counter
-fdbcc_ule_yes:
- rts # yes; do nothing
-
-#
-# ordered greater than or equal:
-# _____
-# Zv(NANvN)
-#
-fdbcc_oge:
- fboge.w fdbcc_oge_yes # ordered greater than or equal?
-fdbcc_oge_no:
- bra.w fdbcc_false # no; go handle counter
-fdbcc_oge_yes:
- rts # yes; do nothing
-
-#
-# unordered or less than:
-# _
-# NANv(N^Z)
-#
-fdbcc_ult:
- fbult.w fdbcc_ult_yes # unordered or less than?
-fdbcc_ult_no:
- bra.w fdbcc_false # no; go handle counter
-fdbcc_ult_yes:
- rts # yes; do nothing
-
-#
-# ordered less than:
-# _____
-# N^(NANvZ)
-#
-fdbcc_olt:
- fbolt.w fdbcc_olt_yes # ordered less than?
-fdbcc_olt_no:
- bra.w fdbcc_false # no; go handle counter
-fdbcc_olt_yes:
- rts # yes; do nothing
-
-#
-# unordered or greater or equal:
-#
-# NANvZvN
-#
-fdbcc_uge:
- fbuge.w fdbcc_uge_yes # unordered or greater than?
-fdbcc_uge_no:
- bra.w fdbcc_false # no; go handle counter
-fdbcc_uge_yes:
- rts # yes; do nothing
-
-#
-# ordered less than or equal:
-# ___
-# Zv(N^NAN)
-#
-fdbcc_ole:
- fbole.w fdbcc_ole_yes # ordered greater or less than?
-fdbcc_ole_no:
- bra.w fdbcc_false # no; go handle counter
-fdbcc_ole_yes:
- rts # yes; do nothing
-
-#
-# unordered or greater than:
-# ___
-# NANv(NvZ)
-#
-fdbcc_ugt:
- fbugt.w fdbcc_ugt_yes # unordered or greater than?
-fdbcc_ugt_no:
- bra.w fdbcc_false # no; go handle counter
-fdbcc_ugt_yes:
- rts # yes; do nothing
-
-#
-# ordered greater or less than:
-# _____
-# NANvZ
-#
-fdbcc_ogl:
- fbogl.w fdbcc_ogl_yes # ordered greater or less than?
-fdbcc_ogl_no:
- bra.w fdbcc_false # no; go handle counter
-fdbcc_ogl_yes:
- rts # yes; do nothing
-
-#
-# unordered or equal:
-#
-# NANvZ
-#
-fdbcc_ueq:
- fbueq.w fdbcc_ueq_yes # unordered or equal?
-fdbcc_ueq_no:
- bra.w fdbcc_false # no; go handle counter
-fdbcc_ueq_yes:
- rts # yes; do nothing
-
-#
-# ordered:
-# ___
-# NAN
-#
-fdbcc_or:
- fbor.w fdbcc_or_yes # ordered?
-fdbcc_or_no:
- bra.w fdbcc_false # no; go handle counter
-fdbcc_or_yes:
- rts # yes; do nothing
-
-#
-# unordered:
-#
-# NAN
-#
-fdbcc_un:
- fbun.w fdbcc_un_yes # unordered?
-fdbcc_un_no:
- bra.w fdbcc_false # no; go handle counter
-fdbcc_un_yes:
- rts # yes; do nothing
-
-#######################################################################
-
-#
-# the bsun exception bit was not set.
-#
-# (1) subtract 1 from the count register
-# (2) if (cr == -1) then
-# pc = pc of next instruction
-# else
-# pc += sign_ext(16-bit displacement)
-#
-fdbcc_false:
- mov.b 1+EXC_OPWORD(%a6), %d1 # fetch lo opword
- andi.w &0x7, %d1 # extract count register
-
- bsr.l fetch_dreg # fetch count value
-# make sure that d0 isn't corrupted between calls...
-
- subq.w &0x1, %d0 # Dn - 1 -> Dn
-
- bsr.l store_dreg_l # store new count value
-
- cmpi.w %d0, &-0x1 # is (Dn == -1)?
- bne.b fdbcc_false_cont # no;
- rts
-
-fdbcc_false_cont:
- mov.l L_SCR1(%a6),%d0 # fetch displacement
- add.l USER_FPIAR(%a6),%d0 # add instruction PC
- addq.l &0x4,%d0 # add instruction length
- mov.l %d0,EXC_PC(%a6) # set new PC
- rts
-
-# the emulation routine set bsun and BSUN was enabled. have to
-# fix stack and jump to the bsun handler.
-# let the caller of this routine shift the stack frame up to
-# eliminate the effective address field.
-fdbcc_bsun:
- mov.b &fbsun_flg,SPCOND_FLG(%a6)
- rts
-
-#########################################################################
-# ftrapcc(): routine to emulate the ftrapcc instruction #
-# #
-# XDEF **************************************************************** #
-# _ftrapcc() #
-# #
-# XREF **************************************************************** #
-# none #
-# #
-# INPUT *************************************************************** #
-# none #
-# #
-# OUTPUT ************************************************************** #
-# none #
-# #
-# ALGORITHM *********************************************************** #
-# This routine checks which conditional predicate is specified by #
-# the stacked ftrapcc instruction opcode and then branches to a routine #
-# for that predicate. The corresponding fbcc instruction is then used #
-# to see whether the condition (specified by the stacked FPSR) is true #
-# or false. #
-# If a BSUN exception should be indicated, the BSUN and ABSUN #
-# bits are set in the stacked FPSR. If the BSUN exception is enabled, #
-# the fbsun_flg is set in the SPCOND_FLG location on the stack. If an #
-# enabled BSUN should not be flagged and the predicate is true, then #
-# the ftrapcc_flg is set in the SPCOND_FLG location. These special #
-# flags indicate to the calling routine to emulate the exceptional #
-# condition. #
-# #
-#########################################################################
-
- global _ftrapcc
-_ftrapcc:
- mov.w EXC_CMDREG(%a6),%d0 # fetch predicate
-
- clr.l %d1 # clear scratch reg
- mov.b FPSR_CC(%a6),%d1 # fetch fp ccodes
- ror.l &0x8,%d1 # rotate to top byte
- fmov.l %d1,%fpsr # insert into FPSR
-
- mov.w (tbl_ftrapcc.b,%pc,%d0.w*2), %d1 # load table
- jmp (tbl_ftrapcc.b,%pc,%d1.w) # jump to ftrapcc routine
-
-tbl_ftrapcc:
- short ftrapcc_f - tbl_ftrapcc # 00
- short ftrapcc_eq - tbl_ftrapcc # 01
- short ftrapcc_ogt - tbl_ftrapcc # 02
- short ftrapcc_oge - tbl_ftrapcc # 03
- short ftrapcc_olt - tbl_ftrapcc # 04
- short ftrapcc_ole - tbl_ftrapcc # 05
- short ftrapcc_ogl - tbl_ftrapcc # 06
- short ftrapcc_or - tbl_ftrapcc # 07
- short ftrapcc_un - tbl_ftrapcc # 08
- short ftrapcc_ueq - tbl_ftrapcc # 09
- short ftrapcc_ugt - tbl_ftrapcc # 10
- short ftrapcc_uge - tbl_ftrapcc # 11
- short ftrapcc_ult - tbl_ftrapcc # 12
- short ftrapcc_ule - tbl_ftrapcc # 13
- short ftrapcc_neq - tbl_ftrapcc # 14
- short ftrapcc_t - tbl_ftrapcc # 15
- short ftrapcc_sf - tbl_ftrapcc # 16
- short ftrapcc_seq - tbl_ftrapcc # 17
- short ftrapcc_gt - tbl_ftrapcc # 18
- short ftrapcc_ge - tbl_ftrapcc # 19
- short ftrapcc_lt - tbl_ftrapcc # 20
- short ftrapcc_le - tbl_ftrapcc # 21
- short ftrapcc_gl - tbl_ftrapcc # 22
- short ftrapcc_gle - tbl_ftrapcc # 23
- short ftrapcc_ngle - tbl_ftrapcc # 24
- short ftrapcc_ngl - tbl_ftrapcc # 25
- short ftrapcc_nle - tbl_ftrapcc # 26
- short ftrapcc_nlt - tbl_ftrapcc # 27
- short ftrapcc_nge - tbl_ftrapcc # 28
- short ftrapcc_ngt - tbl_ftrapcc # 29
- short ftrapcc_sneq - tbl_ftrapcc # 30
- short ftrapcc_st - tbl_ftrapcc # 31
-
-#########################################################################
-# #
-# IEEE Nonaware tests #
-# #
-# For the IEEE nonaware tests, we set the result based on the #
-# floating point condition codes. In addition, we check to see #
-# if the NAN bit is set, in which case BSUN and AIOP will be set. #
-# #
-# The cases EQ and NE are shared by the Aware and Nonaware groups #
-# and are incapable of setting the BSUN exception bit. #
-# #
-# Typically, only one of the two possible branch directions could #
-# have the NAN bit set. #
-# #
-#########################################################################
-
-#
-# equal:
-#
-# Z
-#
-ftrapcc_eq:
- fbeq.w ftrapcc_trap # equal?
-ftrapcc_eq_no:
- rts # do nothing
-
-#
-# not equal:
-# _
-# Z
-#
-ftrapcc_neq:
- fbneq.w ftrapcc_trap # not equal?
-ftrapcc_neq_no:
- rts # do nothing
-
-#
-# greater than:
-# _______
-# NANvZvN
-#
-ftrapcc_gt:
- fbgt.w ftrapcc_trap # greater than?
-ftrapcc_gt_no:
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.b ftrapcc_gt_done # no
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # was BSUN set?
- bne.w ftrapcc_bsun # yes
-ftrapcc_gt_done:
- rts # no; do nothing
-
-#
-# not greater than:
-#
-# NANvZvN
-#
-ftrapcc_ngt:
- fbngt.w ftrapcc_ngt_yes # not greater than?
-ftrapcc_ngt_no:
- rts # do nothing
-ftrapcc_ngt_yes:
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.w ftrapcc_trap # no; go take trap
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # was BSUN set?
- bne.w ftrapcc_bsun # yes
- bra.w ftrapcc_trap # no; go take trap
-
-#
-# greater than or equal:
-# _____
-# Zv(NANvN)
-#
-ftrapcc_ge:
- fbge.w ftrapcc_ge_yes # greater than or equal?
-ftrapcc_ge_no:
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.b ftrapcc_ge_done # no; go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # was BSUN set?
- bne.w ftrapcc_bsun # yes
-ftrapcc_ge_done:
- rts # no; do nothing
-ftrapcc_ge_yes:
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.w ftrapcc_trap # no; go take trap
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # was BSUN set?
- bne.w ftrapcc_bsun # yes
- bra.w ftrapcc_trap # no; go take trap
-
-#
-# not (greater than or equal):
-# _
-# NANv(N^Z)
-#
-ftrapcc_nge:
- fbnge.w ftrapcc_nge_yes # not (greater than or equal)?
-ftrapcc_nge_no:
- rts # do nothing
-ftrapcc_nge_yes:
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.w ftrapcc_trap # no; go take trap
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # was BSUN set?
- bne.w ftrapcc_bsun # yes
- bra.w ftrapcc_trap # no; go take trap
-
-#
-# less than:
-# _____
-# N^(NANvZ)
-#
-ftrapcc_lt:
- fblt.w ftrapcc_trap # less than?
-ftrapcc_lt_no:
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.b ftrapcc_lt_done # no; go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # was BSUN set?
- bne.w ftrapcc_bsun # yes
-ftrapcc_lt_done:
- rts # no; do nothing
-
-#
-# not less than:
-# _
-# NANv(ZvN)
-#
-ftrapcc_nlt:
- fbnlt.w ftrapcc_nlt_yes # not less than?
-ftrapcc_nlt_no:
- rts # do nothing
-ftrapcc_nlt_yes:
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.w ftrapcc_trap # no; go take trap
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # was BSUN set?
- bne.w ftrapcc_bsun # yes
- bra.w ftrapcc_trap # no; go take trap
-
-#
-# less than or equal:
-# ___
-# Zv(N^NAN)
-#
-ftrapcc_le:
- fble.w ftrapcc_le_yes # less than or equal?
-ftrapcc_le_no:
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.b ftrapcc_le_done # no; go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # was BSUN set?
- bne.w ftrapcc_bsun # yes
-ftrapcc_le_done:
- rts # no; do nothing
-ftrapcc_le_yes:
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.w ftrapcc_trap # no; go take trap
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # was BSUN set?
- bne.w ftrapcc_bsun # yes
- bra.w ftrapcc_trap # no; go take trap
-
-#
-# not (less than or equal):
-# ___
-# NANv(NvZ)
-#
-ftrapcc_nle:
- fbnle.w ftrapcc_nle_yes # not (less than or equal)?
-ftrapcc_nle_no:
- rts # do nothing
-ftrapcc_nle_yes:
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.w ftrapcc_trap # no; go take trap
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # was BSUN set?
- bne.w ftrapcc_bsun # yes
- bra.w ftrapcc_trap # no; go take trap
-
-#
-# greater or less than:
-# _____
-# NANvZ
-#
-ftrapcc_gl:
- fbgl.w ftrapcc_trap # greater or less than?
-ftrapcc_gl_no:
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.b ftrapcc_gl_done # no; go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # was BSUN set?
- bne.w ftrapcc_bsun # yes
-ftrapcc_gl_done:
- rts # no; do nothing
-
-#
-# not (greater or less than):
-#
-# NANvZ
-#
-ftrapcc_ngl:
- fbngl.w ftrapcc_ngl_yes # not (greater or less than)?
-ftrapcc_ngl_no:
- rts # do nothing
-ftrapcc_ngl_yes:
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.w ftrapcc_trap # no; go take trap
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # was BSUN set?
- bne.w ftrapcc_bsun # yes
- bra.w ftrapcc_trap # no; go take trap
-
-#
-# greater, less, or equal:
-# ___
-# NAN
-#
-ftrapcc_gle:
- fbgle.w ftrapcc_trap # greater, less, or equal?
-ftrapcc_gle_no:
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # was BSUN set?
- bne.w ftrapcc_bsun # yes
- rts # no; do nothing
-
-#
-# not (greater, less, or equal):
-#
-# NAN
-#
-ftrapcc_ngle:
- fbngle.w ftrapcc_ngle_yes # not (greater, less, or equal)?
-ftrapcc_ngle_no:
- rts # do nothing
-ftrapcc_ngle_yes:
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # was BSUN set?
- bne.w ftrapcc_bsun # yes
- bra.w ftrapcc_trap # no; go take trap
-
-#########################################################################
-# #
-# Miscellaneous tests #
-# #
-# For the IEEE aware tests, we only have to set the result based on the #
-# floating point condition codes. The BSUN exception will not be #
-# set for any of these tests. #
-# #
-#########################################################################
-
-#
-# false:
-#
-# False
-#
-ftrapcc_f:
- rts # do nothing
-
-#
-# true:
-#
-# True
-#
-ftrapcc_t:
- bra.w ftrapcc_trap # go take trap
-
-#
-# signalling false:
-#
-# False
-#
-ftrapcc_sf:
- btst &nan_bit, FPSR_CC(%a6) # set BSUN exc bit
- beq.b ftrapcc_sf_done # no; go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # was BSUN set?
- bne.w ftrapcc_bsun # yes
-ftrapcc_sf_done:
- rts # no; do nothing
-
-#
-# signalling true:
-#
-# True
-#
-ftrapcc_st:
- btst &nan_bit, FPSR_CC(%a6) # set BSUN exc bit
- beq.w ftrapcc_trap # no; go take trap
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # was BSUN set?
- bne.w ftrapcc_bsun # yes
- bra.w ftrapcc_trap # no; go take trap
-
-#
-# signalling equal:
-#
-# Z
-#
-ftrapcc_seq:
- fbseq.w ftrapcc_seq_yes # signalling equal?
-ftrapcc_seq_no:
- btst &nan_bit, FPSR_CC(%a6) # set BSUN exc bit
- beq.w ftrapcc_seq_done # no; go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # was BSUN set?
- bne.w ftrapcc_bsun # yes
-ftrapcc_seq_done:
- rts # no; do nothing
-ftrapcc_seq_yes:
- btst &nan_bit, FPSR_CC(%a6) # set BSUN exc bit
- beq.w ftrapcc_trap # no; go take trap
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # was BSUN set?
- bne.w ftrapcc_bsun # yes
- bra.w ftrapcc_trap # no; go take trap
-
-#
-# signalling not equal:
-# _
-# Z
-#
-ftrapcc_sneq:
- fbsneq.w ftrapcc_sneq_yes # signalling equal?
-ftrapcc_sneq_no:
- btst &nan_bit, FPSR_CC(%a6) # set BSUN exc bit
- beq.w ftrapcc_sneq_no_done # no; go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # was BSUN set?
- bne.w ftrapcc_bsun # yes
-ftrapcc_sneq_no_done:
- rts # do nothing
-ftrapcc_sneq_yes:
- btst &nan_bit, FPSR_CC(%a6) # set BSUN exc bit
- beq.w ftrapcc_trap # no; go take trap
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- btst &bsun_bit, FPCR_ENABLE(%a6) # was BSUN set?
- bne.w ftrapcc_bsun # yes
- bra.w ftrapcc_trap # no; go take trap
-
-#########################################################################
-# #
-# IEEE Aware tests #
-# #
-# For the IEEE aware tests, we only have to set the result based on the #
-# floating point condition codes. The BSUN exception will not be #
-# set for any of these tests. #
-# #
-#########################################################################
-
-#
-# ordered greater than:
-# _______
-# NANvZvN
-#
-ftrapcc_ogt:
- fbogt.w ftrapcc_trap # ordered greater than?
-ftrapcc_ogt_no:
- rts # do nothing
-
-#
-# unordered or less or equal:
-# _______
-# NANvZvN
-#
-ftrapcc_ule:
- fbule.w ftrapcc_trap # unordered or less or equal?
-ftrapcc_ule_no:
- rts # do nothing
-
-#
-# ordered greater than or equal:
-# _____
-# Zv(NANvN)
-#
-ftrapcc_oge:
- fboge.w ftrapcc_trap # ordered greater than or equal?
-ftrapcc_oge_no:
- rts # do nothing
-
-#
-# unordered or less than:
-# _
-# NANv(N^Z)
-#
-ftrapcc_ult:
- fbult.w ftrapcc_trap # unordered or less than?
-ftrapcc_ult_no:
- rts # do nothing
-
-#
-# ordered less than:
-# _____
-# N^(NANvZ)
-#
-ftrapcc_olt:
- fbolt.w ftrapcc_trap # ordered less than?
-ftrapcc_olt_no:
- rts # do nothing
-
-#
-# unordered or greater or equal:
-#
-# NANvZvN
-#
-ftrapcc_uge:
- fbuge.w ftrapcc_trap # unordered or greater than?
-ftrapcc_uge_no:
- rts # do nothing
-
-#
-# ordered less than or equal:
-# ___
-# Zv(N^NAN)
-#
-ftrapcc_ole:
- fbole.w ftrapcc_trap # ordered greater or less than?
-ftrapcc_ole_no:
- rts # do nothing
-
-#
-# unordered or greater than:
-# ___
-# NANv(NvZ)
-#
-ftrapcc_ugt:
- fbugt.w ftrapcc_trap # unordered or greater than?
-ftrapcc_ugt_no:
- rts # do nothing
-
-#
-# ordered greater or less than:
-# _____
-# NANvZ
-#
-ftrapcc_ogl:
- fbogl.w ftrapcc_trap # ordered greater or less than?
-ftrapcc_ogl_no:
- rts # do nothing
-
-#
-# unordered or equal:
-#
-# NANvZ
-#
-ftrapcc_ueq:
- fbueq.w ftrapcc_trap # unordered or equal?
-ftrapcc_ueq_no:
- rts # do nothing
-
-#
-# ordered:
-# ___
-# NAN
-#
-ftrapcc_or:
- fbor.w ftrapcc_trap # ordered?
-ftrapcc_or_no:
- rts # do nothing
-
-#
-# unordered:
-#
-# NAN
-#
-ftrapcc_un:
- fbun.w ftrapcc_trap # unordered?
-ftrapcc_un_no:
- rts # do nothing
-
-#######################################################################
-
-# the bsun exception bit was not set.
-# we will need to jump to the ftrapcc vector. the stack frame
-# is the same size as that of the fp unimp instruction. the
-# only difference is that the <ea> field should hold the PC
-# of the ftrapcc instruction and the vector offset field
-# should denote the ftrapcc trap.
-ftrapcc_trap:
- mov.b &ftrapcc_flg,SPCOND_FLG(%a6)
- rts
-
-# the emulation routine set bsun and BSUN was enabled. have to
-# fix stack and jump to the bsun handler.
-# let the caller of this routine shift the stack frame up to
-# eliminate the effective address field.
-ftrapcc_bsun:
- mov.b &fbsun_flg,SPCOND_FLG(%a6)
- rts
-
-#########################################################################
-# fscc(): routine to emulate the fscc instruction #
-# #
-# XDEF **************************************************************** #
-# _fscc() #
-# #
-# XREF **************************************************************** #
-# store_dreg_b() - store result to data register file #
-# dec_areg() - decrement an areg for -(an) mode #
-# inc_areg() - increment an areg for (an)+ mode #
-# _dmem_write_byte() - store result to memory #
-# #
-# INPUT *************************************************************** #
-# none #
-# #
-# OUTPUT ************************************************************** #
-# none #
-# #
-# ALGORITHM *********************************************************** #
-# This routine checks which conditional predicate is specified by #
-# the stacked fscc instruction opcode and then branches to a routine #
-# for that predicate. The corresponding fbcc instruction is then used #
-# to see whether the condition (specified by the stacked FPSR) is true #
-# or false. #
-# If a BSUN exception should be indicated, the BSUN and ABSUN #
-# bits are set in the stacked FPSR. If the BSUN exception is enabled, #
-# the fbsun_flg is set in the SPCOND_FLG location on the stack. If an #
-# enabled BSUN should not be flagged and the predicate is true, then #
-# the result is stored to the data register file or memory #
-# #
-#########################################################################
-
- global _fscc
-_fscc:
- mov.w EXC_CMDREG(%a6),%d0 # fetch predicate
-
- clr.l %d1 # clear scratch reg
- mov.b FPSR_CC(%a6),%d1 # fetch fp ccodes
- ror.l &0x8,%d1 # rotate to top byte
- fmov.l %d1,%fpsr # insert into FPSR
-
- mov.w (tbl_fscc.b,%pc,%d0.w*2),%d1 # load table
- jmp (tbl_fscc.b,%pc,%d1.w) # jump to fscc routine
-
-tbl_fscc:
- short fscc_f - tbl_fscc # 00
- short fscc_eq - tbl_fscc # 01
- short fscc_ogt - tbl_fscc # 02
- short fscc_oge - tbl_fscc # 03
- short fscc_olt - tbl_fscc # 04
- short fscc_ole - tbl_fscc # 05
- short fscc_ogl - tbl_fscc # 06
- short fscc_or - tbl_fscc # 07
- short fscc_un - tbl_fscc # 08
- short fscc_ueq - tbl_fscc # 09
- short fscc_ugt - tbl_fscc # 10
- short fscc_uge - tbl_fscc # 11
- short fscc_ult - tbl_fscc # 12
- short fscc_ule - tbl_fscc # 13
- short fscc_neq - tbl_fscc # 14
- short fscc_t - tbl_fscc # 15
- short fscc_sf - tbl_fscc # 16
- short fscc_seq - tbl_fscc # 17
- short fscc_gt - tbl_fscc # 18
- short fscc_ge - tbl_fscc # 19
- short fscc_lt - tbl_fscc # 20
- short fscc_le - tbl_fscc # 21
- short fscc_gl - tbl_fscc # 22
- short fscc_gle - tbl_fscc # 23
- short fscc_ngle - tbl_fscc # 24
- short fscc_ngl - tbl_fscc # 25
- short fscc_nle - tbl_fscc # 26
- short fscc_nlt - tbl_fscc # 27
- short fscc_nge - tbl_fscc # 28
- short fscc_ngt - tbl_fscc # 29
- short fscc_sneq - tbl_fscc # 30
- short fscc_st - tbl_fscc # 31
-
-#########################################################################
-# #
-# IEEE Nonaware tests #
-# #
-# For the IEEE nonaware tests, we set the result based on the #
-# floating point condition codes. In addition, we check to see #
-# if the NAN bit is set, in which case BSUN and AIOP will be set. #
-# #
-# The cases EQ and NE are shared by the Aware and Nonaware groups #
-# and are incapable of setting the BSUN exception bit. #
-# #
-# Typically, only one of the two possible branch directions could #
-# have the NAN bit set. #
-# #
-#########################################################################
-
-#
-# equal:
-#
-# Z
-#
-fscc_eq:
- fbeq.w fscc_eq_yes # equal?
-fscc_eq_no:
- clr.b %d0 # set false
- bra.w fscc_done # go finish
-fscc_eq_yes:
- st %d0 # set true
- bra.w fscc_done # go finish
-
-#
-# not equal:
-# _
-# Z
-#
-fscc_neq:
- fbneq.w fscc_neq_yes # not equal?
-fscc_neq_no:
- clr.b %d0 # set false
- bra.w fscc_done # go finish
-fscc_neq_yes:
- st %d0 # set true
- bra.w fscc_done # go finish
-
-#
-# greater than:
-# _______
-# NANvZvN
-#
-fscc_gt:
- fbgt.w fscc_gt_yes # greater than?
-fscc_gt_no:
- clr.b %d0 # set false
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.w fscc_done # no;go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- bra.w fscc_chk_bsun # go finish
-fscc_gt_yes:
- st %d0 # set true
- bra.w fscc_done # go finish
-
-#
-# not greater than:
-#
-# NANvZvN
-#
-fscc_ngt:
- fbngt.w fscc_ngt_yes # not greater than?
-fscc_ngt_no:
- clr.b %d0 # set false
- bra.w fscc_done # go finish
-fscc_ngt_yes:
- st %d0 # set true
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.w fscc_done # no;go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- bra.w fscc_chk_bsun # go finish
-
-#
-# greater than or equal:
-# _____
-# Zv(NANvN)
-#
-fscc_ge:
- fbge.w fscc_ge_yes # greater than or equal?
-fscc_ge_no:
- clr.b %d0 # set false
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.w fscc_done # no;go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- bra.w fscc_chk_bsun # go finish
-fscc_ge_yes:
- st %d0 # set true
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.w fscc_done # no;go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- bra.w fscc_chk_bsun # go finish
-
-#
-# not (greater than or equal):
-# _
-# NANv(N^Z)
-#
-fscc_nge:
- fbnge.w fscc_nge_yes # not (greater than or equal)?
-fscc_nge_no:
- clr.b %d0 # set false
- bra.w fscc_done # go finish
-fscc_nge_yes:
- st %d0 # set true
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.w fscc_done # no;go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- bra.w fscc_chk_bsun # go finish
-
-#
-# less than:
-# _____
-# N^(NANvZ)
-#
-fscc_lt:
- fblt.w fscc_lt_yes # less than?
-fscc_lt_no:
- clr.b %d0 # set false
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.w fscc_done # no;go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- bra.w fscc_chk_bsun # go finish
-fscc_lt_yes:
- st %d0 # set true
- bra.w fscc_done # go finish
-
-#
-# not less than:
-# _
-# NANv(ZvN)
-#
-fscc_nlt:
- fbnlt.w fscc_nlt_yes # not less than?
-fscc_nlt_no:
- clr.b %d0 # set false
- bra.w fscc_done # go finish
-fscc_nlt_yes:
- st %d0 # set true
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.w fscc_done # no;go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- bra.w fscc_chk_bsun # go finish
-
-#
-# less than or equal:
-# ___
-# Zv(N^NAN)
-#
-fscc_le:
- fble.w fscc_le_yes # less than or equal?
-fscc_le_no:
- clr.b %d0 # set false
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.w fscc_done # no;go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- bra.w fscc_chk_bsun # go finish
-fscc_le_yes:
- st %d0 # set true
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.w fscc_done # no;go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- bra.w fscc_chk_bsun # go finish
-
-#
-# not (less than or equal):
-# ___
-# NANv(NvZ)
-#
-fscc_nle:
- fbnle.w fscc_nle_yes # not (less than or equal)?
-fscc_nle_no:
- clr.b %d0 # set false
- bra.w fscc_done # go finish
-fscc_nle_yes:
- st %d0 # set true
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.w fscc_done # no;go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- bra.w fscc_chk_bsun # go finish
-
-#
-# greater or less than:
-# _____
-# NANvZ
-#
-fscc_gl:
- fbgl.w fscc_gl_yes # greater or less than?
-fscc_gl_no:
- clr.b %d0 # set false
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.w fscc_done # no;go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- bra.w fscc_chk_bsun # go finish
-fscc_gl_yes:
- st %d0 # set true
- bra.w fscc_done # go finish
-
-#
-# not (greater or less than):
-#
-# NANvZ
-#
-fscc_ngl:
- fbngl.w fscc_ngl_yes # not (greater or less than)?
-fscc_ngl_no:
- clr.b %d0 # set false
- bra.w fscc_done # go finish
-fscc_ngl_yes:
- st %d0 # set true
- btst &nan_bit, FPSR_CC(%a6) # is NAN set in cc?
- beq.w fscc_done # no;go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- bra.w fscc_chk_bsun # go finish
-
-#
-# greater, less, or equal:
-# ___
-# NAN
-#
-fscc_gle:
- fbgle.w fscc_gle_yes # greater, less, or equal?
-fscc_gle_no:
- clr.b %d0 # set false
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- bra.w fscc_chk_bsun # go finish
-fscc_gle_yes:
- st %d0 # set true
- bra.w fscc_done # go finish
-
-#
-# not (greater, less, or equal):
-#
-# NAN
-#
-fscc_ngle:
- fbngle.w fscc_ngle_yes # not (greater, less, or equal)?
-fscc_ngle_no:
- clr.b %d0 # set false
- bra.w fscc_done # go finish
-fscc_ngle_yes:
- st %d0 # set true
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- bra.w fscc_chk_bsun # go finish
-
-#########################################################################
-# #
-# Miscellaneous tests #
-# #
-# For the IEEE aware tests, we only have to set the result based on the #
-# floating point condition codes. The BSUN exception will not be #
-# set for any of these tests. #
-# #
-#########################################################################
-
-#
-# false:
-#
-# False
-#
-fscc_f:
- clr.b %d0 # set false
- bra.w fscc_done # go finish
-
-#
-# true:
-#
-# True
-#
-fscc_t:
- st %d0 # set true
- bra.w fscc_done # go finish
-
-#
-# signalling false:
-#
-# False
-#
-fscc_sf:
- clr.b %d0 # set false
- btst &nan_bit, FPSR_CC(%a6) # set BSUN exc bit
- beq.w fscc_done # no;go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- bra.w fscc_chk_bsun # go finish
-
-#
-# signalling true:
-#
-# True
-#
-fscc_st:
- st %d0 # set false
- btst &nan_bit, FPSR_CC(%a6) # set BSUN exc bit
- beq.w fscc_done # no;go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- bra.w fscc_chk_bsun # go finish
-
-#
-# signalling equal:
-#
-# Z
-#
-fscc_seq:
- fbseq.w fscc_seq_yes # signalling equal?
-fscc_seq_no:
- clr.b %d0 # set false
- btst &nan_bit, FPSR_CC(%a6) # set BSUN exc bit
- beq.w fscc_done # no;go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- bra.w fscc_chk_bsun # go finish
-fscc_seq_yes:
- st %d0 # set true
- btst &nan_bit, FPSR_CC(%a6) # set BSUN exc bit
- beq.w fscc_done # no;go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- bra.w fscc_chk_bsun # go finish
-
-#
-# signalling not equal:
-# _
-# Z
-#
-fscc_sneq:
- fbsneq.w fscc_sneq_yes # signalling equal?
-fscc_sneq_no:
- clr.b %d0 # set false
- btst &nan_bit, FPSR_CC(%a6) # set BSUN exc bit
- beq.w fscc_done # no;go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- bra.w fscc_chk_bsun # go finish
-fscc_sneq_yes:
- st %d0 # set true
- btst &nan_bit, FPSR_CC(%a6) # set BSUN exc bit
- beq.w fscc_done # no;go finish
- ori.l &bsun_mask+aiop_mask, USER_FPSR(%a6) # set BSUN exc bit
- bra.w fscc_chk_bsun # go finish
-
-#########################################################################
-# #
-# IEEE Aware tests #
-# #
-# For the IEEE aware tests, we only have to set the result based on the #
-# floating point condition codes. The BSUN exception will not be #
-# set for any of these tests. #
-# #
-#########################################################################
-
-#
-# ordered greater than:
-# _______
-# NANvZvN
-#
-fscc_ogt:
- fbogt.w fscc_ogt_yes # ordered greater than?
-fscc_ogt_no:
- clr.b %d0 # set false
- bra.w fscc_done # go finish
-fscc_ogt_yes:
- st %d0 # set true
- bra.w fscc_done # go finish
-
-#
-# unordered or less or equal:
-# _______
-# NANvZvN
-#
-fscc_ule:
- fbule.w fscc_ule_yes # unordered or less or equal?
-fscc_ule_no:
- clr.b %d0 # set false
- bra.w fscc_done # go finish
-fscc_ule_yes:
- st %d0 # set true
- bra.w fscc_done # go finish
-
-#
-# ordered greater than or equal:
-# _____
-# Zv(NANvN)
-#
-fscc_oge:
- fboge.w fscc_oge_yes # ordered greater than or equal?
-fscc_oge_no:
- clr.b %d0 # set false
- bra.w fscc_done # go finish
-fscc_oge_yes:
- st %d0 # set true
- bra.w fscc_done # go finish
-
-#
-# unordered or less than:
-# _
-# NANv(N^Z)
-#
-fscc_ult:
- fbult.w fscc_ult_yes # unordered or less than?
-fscc_ult_no:
- clr.b %d0 # set false
- bra.w fscc_done # go finish
-fscc_ult_yes:
- st %d0 # set true
- bra.w fscc_done # go finish
-
-#
-# ordered less than:
-# _____
-# N^(NANvZ)
-#
-fscc_olt:
- fbolt.w fscc_olt_yes # ordered less than?
-fscc_olt_no:
- clr.b %d0 # set false
- bra.w fscc_done # go finish
-fscc_olt_yes:
- st %d0 # set true
- bra.w fscc_done # go finish
-
-#
-# unordered or greater or equal:
-#
-# NANvZvN
-#
-fscc_uge:
- fbuge.w fscc_uge_yes # unordered or greater than?
-fscc_uge_no:
- clr.b %d0 # set false
- bra.w fscc_done # go finish
-fscc_uge_yes:
- st %d0 # set true
- bra.w fscc_done # go finish
-
-#
-# ordered less than or equal:
-# ___
-# Zv(N^NAN)
-#
-fscc_ole:
- fbole.w fscc_ole_yes # ordered greater or less than?
-fscc_ole_no:
- clr.b %d0 # set false
- bra.w fscc_done # go finish
-fscc_ole_yes:
- st %d0 # set true
- bra.w fscc_done # go finish
-
-#
-# unordered or greater than:
-# ___
-# NANv(NvZ)
-#
-fscc_ugt:
- fbugt.w fscc_ugt_yes # unordered or greater than?
-fscc_ugt_no:
- clr.b %d0 # set false
- bra.w fscc_done # go finish
-fscc_ugt_yes:
- st %d0 # set true
- bra.w fscc_done # go finish
-
-#
-# ordered greater or less than:
-# _____
-# NANvZ
-#
-fscc_ogl:
- fbogl.w fscc_ogl_yes # ordered greater or less than?
-fscc_ogl_no:
- clr.b %d0 # set false
- bra.w fscc_done # go finish
-fscc_ogl_yes:
- st %d0 # set true
- bra.w fscc_done # go finish
-
-#
-# unordered or equal:
-#
-# NANvZ
-#
-fscc_ueq:
- fbueq.w fscc_ueq_yes # unordered or equal?
-fscc_ueq_no:
- clr.b %d0 # set false
- bra.w fscc_done # go finish
-fscc_ueq_yes:
- st %d0 # set true
- bra.w fscc_done # go finish
-
-#
-# ordered:
-# ___
-# NAN
-#
-fscc_or:
- fbor.w fscc_or_yes # ordered?
-fscc_or_no:
- clr.b %d0 # set false
- bra.w fscc_done # go finish
-fscc_or_yes:
- st %d0 # set true
- bra.w fscc_done # go finish
-
-#
-# unordered:
-#
-# NAN
-#
-fscc_un:
- fbun.w fscc_un_yes # unordered?
-fscc_un_no:
- clr.b %d0 # set false
- bra.w fscc_done # go finish
-fscc_un_yes:
- st %d0 # set true
- bra.w fscc_done # go finish
-
-#######################################################################
-
-#
-# the bsun exception bit was set. now, check to see is BSUN
-# is enabled. if so, don't store result and correct stack frame
-# for a bsun exception.
-#
-fscc_chk_bsun:
- btst &bsun_bit,FPCR_ENABLE(%a6) # was BSUN set?
- bne.w fscc_bsun
-
-#
-# the bsun exception bit was not set.
-# the result has been selected.
-# now, check to see if the result is to be stored in the data register
-# file or in memory.
-#
-fscc_done:
- mov.l %d0,%a0 # save result for a moment
-
- mov.b 1+EXC_OPWORD(%a6),%d1 # fetch lo opword
- mov.l %d1,%d0 # make a copy
- andi.b &0x38,%d1 # extract src mode
-
- bne.b fscc_mem_op # it's a memory operation
-
- mov.l %d0,%d1
- andi.w &0x7,%d1 # pass index in d1
- mov.l %a0,%d0 # pass result in d0
- bsr.l store_dreg_b # save result in regfile
- rts
-
-#
-# the stacked <ea> is correct with the exception of:
-# -> Dn : <ea> is garbage
-#
-# if the addressing mode is post-increment or pre-decrement,
-# then the address registers have not been updated.
-#
-fscc_mem_op:
- cmpi.b %d1,&0x18 # is <ea> (An)+ ?
- beq.b fscc_mem_inc # yes
- cmpi.b %d1,&0x20 # is <ea> -(An) ?
- beq.b fscc_mem_dec # yes
-
- mov.l %a0,%d0 # pass result in d0
- mov.l EXC_EA(%a6),%a0 # fetch <ea>
- bsr.l _dmem_write_byte # write result byte
-
- tst.l %d1 # did dstore fail?
- bne.w fscc_err # yes
-
- rts
-
-# addresing mode is post-increment. write the result byte. if the write
-# fails then don't update the address register. if write passes then
-# call inc_areg() to update the address register.
-fscc_mem_inc:
- mov.l %a0,%d0 # pass result in d0
- mov.l EXC_EA(%a6),%a0 # fetch <ea>
- bsr.l _dmem_write_byte # write result byte
-
- tst.l %d1 # did dstore fail?
- bne.w fscc_err # yes
-
- mov.b 0x1+EXC_OPWORD(%a6),%d1 # fetch opword
- andi.w &0x7,%d1 # pass index in d1
- movq.l &0x1,%d0 # pass amt to inc by
- bsr.l inc_areg # increment address register
-
- rts
-
-# addressing mode is pre-decrement. write the result byte. if the write
-# fails then don't update the address register. if the write passes then
-# call dec_areg() to update the address register.
-fscc_mem_dec:
- mov.l %a0,%d0 # pass result in d0
- mov.l EXC_EA(%a6),%a0 # fetch <ea>
- bsr.l _dmem_write_byte # write result byte
-
- tst.l %d1 # did dstore fail?
- bne.w fscc_err # yes
-
- mov.b 0x1+EXC_OPWORD(%a6),%d1 # fetch opword
- andi.w &0x7,%d1 # pass index in d1
- movq.l &0x1,%d0 # pass amt to dec by
- bsr.l dec_areg # decrement address register
-
- rts
-
-# the emulation routine set bsun and BSUN was enabled. have to
-# fix stack and jump to the bsun handler.
-# let the caller of this routine shift the stack frame up to
-# eliminate the effective address field.
-fscc_bsun:
- mov.b &fbsun_flg,SPCOND_FLG(%a6)
- rts
-
-# the byte write to memory has failed. pass the failing effective address
-# and a FSLW to funimp_dacc().
-fscc_err:
- mov.w &0x00a1,EXC_VOFF(%a6)
- bra.l facc_finish
-
-#########################################################################
-# XDEF **************************************************************** #
-# fmovm_dynamic(): emulate "fmovm" dynamic instruction #
-# #
-# XREF **************************************************************** #
-# fetch_dreg() - fetch data register #
-# {i,d,}mem_read() - fetch data from memory #
-# _mem_write() - write data to memory #
-# iea_iacc() - instruction memory access error occurred #
-# iea_dacc() - data memory access error occurred #
-# restore() - restore An index regs if access error occurred #
-# #
-# INPUT *************************************************************** #
-# None #
-# #
-# OUTPUT ************************************************************** #
-# If instr is "fmovm Dn,-(A7)" from supervisor mode, #
-# d0 = size of dump #
-# d1 = Dn #
-# Else if instruction access error, #
-# d0 = FSLW #
-# Else if data access error, #
-# d0 = FSLW #
-# a0 = address of fault #
-# Else #
-# none. #
-# #
-# ALGORITHM *********************************************************** #
-# The effective address must be calculated since this is entered #
-# from an "Unimplemented Effective Address" exception handler. So, we #
-# have our own fcalc_ea() routine here. If an access error is flagged #
-# by a _{i,d,}mem_read() call, we must exit through the special #
-# handler. #
-# The data register is determined and its value loaded to get the #
-# string of FP registers affected. This value is used as an index into #
-# a lookup table such that we can determine the number of bytes #
-# involved. #
-# If the instruction is "fmovm.x <ea>,Dn", a _mem_read() is used #
-# to read in all FP values. Again, _mem_read() may fail and require a #
-# special exit. #
-# If the instruction is "fmovm.x DN,<ea>", a _mem_write() is used #
-# to write all FP values. _mem_write() may also fail. #
-# If the instruction is "fmovm.x DN,-(a7)" from supervisor mode, #
-# then we return the size of the dump and the string to the caller #
-# so that the move can occur outside of this routine. This special #
-# case is required so that moves to the system stack are handled #
-# correctly. #
-# #
-# DYNAMIC: #
-# fmovm.x dn, <ea> #
-# fmovm.x <ea>, dn #
-# #
-# <WORD 1> <WORD2> #
-# 1111 0010 00 |<ea>| 11@& 1000 0$$$ 0000 #
-# #
-# & = (0): predecrement addressing mode #
-# (1): postincrement or control addressing mode #
-# @ = (0): move listed regs from memory to the FPU #
-# (1): move listed regs from the FPU to memory #
-# $$$ : index of data register holding reg select mask #
-# #
-# NOTES: #
-# If the data register holds a zero, then the #
-# instruction is a nop. #
-# #
-#########################################################################
-
- global fmovm_dynamic
-fmovm_dynamic:
-
-# extract the data register in which the bit string resides...
- mov.b 1+EXC_EXTWORD(%a6),%d1 # fetch extword
- andi.w &0x70,%d1 # extract reg bits
- lsr.b &0x4,%d1 # shift into lo bits
-
-# fetch the bit string into d0...
- bsr.l fetch_dreg # fetch reg string
-
- andi.l &0x000000ff,%d0 # keep only lo byte
-
- mov.l %d0,-(%sp) # save strg
- mov.b (tbl_fmovm_size.w,%pc,%d0),%d0
- mov.l %d0,-(%sp) # save size
- bsr.l fmovm_calc_ea # calculate <ea>
- mov.l (%sp)+,%d0 # restore size
- mov.l (%sp)+,%d1 # restore strg
-
-# if the bit string is a zero, then the operation is a no-op
-# but, make sure that we've calculated ea and advanced the opword pointer
- beq.w fmovm_data_done
-
-# separate move ins from move outs...
- btst &0x5,EXC_EXTWORD(%a6) # is it a move in or out?
- beq.w fmovm_data_in # it's a move out
-
-#############
-# MOVE OUT: #
-#############
-fmovm_data_out:
- btst &0x4,EXC_EXTWORD(%a6) # control or predecrement?
- bne.w fmovm_out_ctrl # control
-
-############################
-fmovm_out_predec:
-# for predecrement mode, the bit string is the opposite of both control
-# operations and postincrement mode. (bit7 = FP7 ... bit0 = FP0)
-# here, we convert it to be just like the others...
- mov.b (tbl_fmovm_convert.w,%pc,%d1.w*1),%d1
-
- btst &0x5,EXC_SR(%a6) # user or supervisor mode?
- beq.b fmovm_out_ctrl # user
-
-fmovm_out_predec_s:
- cmpi.b SPCOND_FLG(%a6),&mda7_flg # is <ea> mode -(a7)?
- bne.b fmovm_out_ctrl
-
-# the operation was unfortunately an: fmovm.x dn,-(sp)
-# called from supervisor mode.
-# we're also passing "size" and "strg" back to the calling routine
- rts
-
-############################
-fmovm_out_ctrl:
- mov.l %a0,%a1 # move <ea> to a1
-
- sub.l %d0,%sp # subtract size of dump
- lea (%sp),%a0
-
- tst.b %d1 # should FP0 be moved?
- bpl.b fmovm_out_ctrl_fp1 # no
-
- mov.l 0x0+EXC_FP0(%a6),(%a0)+ # yes
- mov.l 0x4+EXC_FP0(%a6),(%a0)+
- mov.l 0x8+EXC_FP0(%a6),(%a0)+
-
-fmovm_out_ctrl_fp1:
- lsl.b &0x1,%d1 # should FP1 be moved?
- bpl.b fmovm_out_ctrl_fp2 # no
-
- mov.l 0x0+EXC_FP1(%a6),(%a0)+ # yes
- mov.l 0x4+EXC_FP1(%a6),(%a0)+
- mov.l 0x8+EXC_FP1(%a6),(%a0)+
-
-fmovm_out_ctrl_fp2:
- lsl.b &0x1,%d1 # should FP2 be moved?
- bpl.b fmovm_out_ctrl_fp3 # no
-
- fmovm.x &0x20,(%a0) # yes
- add.l &0xc,%a0
-
-fmovm_out_ctrl_fp3:
- lsl.b &0x1,%d1 # should FP3 be moved?
- bpl.b fmovm_out_ctrl_fp4 # no
-
- fmovm.x &0x10,(%a0) # yes
- add.l &0xc,%a0
-
-fmovm_out_ctrl_fp4:
- lsl.b &0x1,%d1 # should FP4 be moved?
- bpl.b fmovm_out_ctrl_fp5 # no
-
- fmovm.x &0x08,(%a0) # yes
- add.l &0xc,%a0
-
-fmovm_out_ctrl_fp5:
- lsl.b &0x1,%d1 # should FP5 be moved?
- bpl.b fmovm_out_ctrl_fp6 # no
-
- fmovm.x &0x04,(%a0) # yes
- add.l &0xc,%a0
-
-fmovm_out_ctrl_fp6:
- lsl.b &0x1,%d1 # should FP6 be moved?
- bpl.b fmovm_out_ctrl_fp7 # no
-
- fmovm.x &0x02,(%a0) # yes
- add.l &0xc,%a0
-
-fmovm_out_ctrl_fp7:
- lsl.b &0x1,%d1 # should FP7 be moved?
- bpl.b fmovm_out_ctrl_done # no
-
- fmovm.x &0x01,(%a0) # yes
- add.l &0xc,%a0
-
-fmovm_out_ctrl_done:
- mov.l %a1,L_SCR1(%a6)
-
- lea (%sp),%a0 # pass: supervisor src
- mov.l %d0,-(%sp) # save size
- bsr.l _dmem_write # copy data to user mem
-
- mov.l (%sp)+,%d0
- add.l %d0,%sp # clear fpreg data from stack
-
- tst.l %d1 # did dstore err?
- bne.w fmovm_out_err # yes
-
- rts
-
-############
-# MOVE IN: #
-############
-fmovm_data_in:
- mov.l %a0,L_SCR1(%a6)
-
- sub.l %d0,%sp # make room for fpregs
- lea (%sp),%a1
-
- mov.l %d1,-(%sp) # save bit string for later
- mov.l %d0,-(%sp) # save # of bytes
-
- bsr.l _dmem_read # copy data from user mem
-
- mov.l (%sp)+,%d0 # retrieve # of bytes
-
- tst.l %d1 # did dfetch fail?
- bne.w fmovm_in_err # yes
-
- mov.l (%sp)+,%d1 # load bit string
-
- lea (%sp),%a0 # addr of stack
-
- tst.b %d1 # should FP0 be moved?
- bpl.b fmovm_data_in_fp1 # no
-
- mov.l (%a0)+,0x0+EXC_FP0(%a6) # yes
- mov.l (%a0)+,0x4+EXC_FP0(%a6)
- mov.l (%a0)+,0x8+EXC_FP0(%a6)
-
-fmovm_data_in_fp1:
- lsl.b &0x1,%d1 # should FP1 be moved?
- bpl.b fmovm_data_in_fp2 # no
-
- mov.l (%a0)+,0x0+EXC_FP1(%a6) # yes
- mov.l (%a0)+,0x4+EXC_FP1(%a6)
- mov.l (%a0)+,0x8+EXC_FP1(%a6)
-
-fmovm_data_in_fp2:
- lsl.b &0x1,%d1 # should FP2 be moved?
- bpl.b fmovm_data_in_fp3 # no
-
- fmovm.x (%a0)+,&0x20 # yes
-
-fmovm_data_in_fp3:
- lsl.b &0x1,%d1 # should FP3 be moved?
- bpl.b fmovm_data_in_fp4 # no
-
- fmovm.x (%a0)+,&0x10 # yes
-
-fmovm_data_in_fp4:
- lsl.b &0x1,%d1 # should FP4 be moved?
- bpl.b fmovm_data_in_fp5 # no
-
- fmovm.x (%a0)+,&0x08 # yes
-
-fmovm_data_in_fp5:
- lsl.b &0x1,%d1 # should FP5 be moved?
- bpl.b fmovm_data_in_fp6 # no
-
- fmovm.x (%a0)+,&0x04 # yes
-
-fmovm_data_in_fp6:
- lsl.b &0x1,%d1 # should FP6 be moved?
- bpl.b fmovm_data_in_fp7 # no
-
- fmovm.x (%a0)+,&0x02 # yes
-
-fmovm_data_in_fp7:
- lsl.b &0x1,%d1 # should FP7 be moved?
- bpl.b fmovm_data_in_done # no
-
- fmovm.x (%a0)+,&0x01 # yes
-
-fmovm_data_in_done:
- add.l %d0,%sp # remove fpregs from stack
- rts
-
-#####################################
-
-fmovm_data_done:
- rts
-
-##############################################################################
-
-#
-# table indexed by the operation's bit string that gives the number
-# of bytes that will be moved.
-#
-# number of bytes = (# of 1's in bit string) * 12(bytes/fpreg)
-#
-tbl_fmovm_size:
- byte 0x00,0x0c,0x0c,0x18,0x0c,0x18,0x18,0x24
- byte 0x0c,0x18,0x18,0x24,0x18,0x24,0x24,0x30
- byte 0x0c,0x18,0x18,0x24,0x18,0x24,0x24,0x30
- byte 0x18,0x24,0x24,0x30,0x24,0x30,0x30,0x3c
- byte 0x0c,0x18,0x18,0x24,0x18,0x24,0x24,0x30
- byte 0x18,0x24,0x24,0x30,0x24,0x30,0x30,0x3c
- byte 0x18,0x24,0x24,0x30,0x24,0x30,0x30,0x3c
- byte 0x24,0x30,0x30,0x3c,0x30,0x3c,0x3c,0x48
- byte 0x0c,0x18,0x18,0x24,0x18,0x24,0x24,0x30
- byte 0x18,0x24,0x24,0x30,0x24,0x30,0x30,0x3c
- byte 0x18,0x24,0x24,0x30,0x24,0x30,0x30,0x3c
- byte 0x24,0x30,0x30,0x3c,0x30,0x3c,0x3c,0x48
- byte 0x18,0x24,0x24,0x30,0x24,0x30,0x30,0x3c
- byte 0x24,0x30,0x30,0x3c,0x30,0x3c,0x3c,0x48
- byte 0x24,0x30,0x30,0x3c,0x30,0x3c,0x3c,0x48
- byte 0x30,0x3c,0x3c,0x48,0x3c,0x48,0x48,0x54
- byte 0x0c,0x18,0x18,0x24,0x18,0x24,0x24,0x30
- byte 0x18,0x24,0x24,0x30,0x24,0x30,0x30,0x3c
- byte 0x18,0x24,0x24,0x30,0x24,0x30,0x30,0x3c
- byte 0x24,0x30,0x30,0x3c,0x30,0x3c,0x3c,0x48
- byte 0x18,0x24,0x24,0x30,0x24,0x30,0x30,0x3c
- byte 0x24,0x30,0x30,0x3c,0x30,0x3c,0x3c,0x48
- byte 0x24,0x30,0x30,0x3c,0x30,0x3c,0x3c,0x48
- byte 0x30,0x3c,0x3c,0x48,0x3c,0x48,0x48,0x54
- byte 0x18,0x24,0x24,0x30,0x24,0x30,0x30,0x3c
- byte 0x24,0x30,0x30,0x3c,0x30,0x3c,0x3c,0x48
- byte 0x24,0x30,0x30,0x3c,0x30,0x3c,0x3c,0x48
- byte 0x30,0x3c,0x3c,0x48,0x3c,0x48,0x48,0x54
- byte 0x24,0x30,0x30,0x3c,0x30,0x3c,0x3c,0x48
- byte 0x30,0x3c,0x3c,0x48,0x3c,0x48,0x48,0x54
- byte 0x30,0x3c,0x3c,0x48,0x3c,0x48,0x48,0x54
- byte 0x3c,0x48,0x48,0x54,0x48,0x54,0x54,0x60
-
-#
-# table to convert a pre-decrement bit string into a post-increment
-# or control bit string.
-# ex: 0x00 ==> 0x00
-# 0x01 ==> 0x80
-# 0x02 ==> 0x40
-# .
-# .
-# 0xfd ==> 0xbf
-# 0xfe ==> 0x7f
-# 0xff ==> 0xff
-#
-tbl_fmovm_convert:
- byte 0x00,0x80,0x40,0xc0,0x20,0xa0,0x60,0xe0
- byte 0x10,0x90,0x50,0xd0,0x30,0xb0,0x70,0xf0
- byte 0x08,0x88,0x48,0xc8,0x28,0xa8,0x68,0xe8
- byte 0x18,0x98,0x58,0xd8,0x38,0xb8,0x78,0xf8
- byte 0x04,0x84,0x44,0xc4,0x24,0xa4,0x64,0xe4
- byte 0x14,0x94,0x54,0xd4,0x34,0xb4,0x74,0xf4
- byte 0x0c,0x8c,0x4c,0xcc,0x2c,0xac,0x6c,0xec
- byte 0x1c,0x9c,0x5c,0xdc,0x3c,0xbc,0x7c,0xfc
- byte 0x02,0x82,0x42,0xc2,0x22,0xa2,0x62,0xe2
- byte 0x12,0x92,0x52,0xd2,0x32,0xb2,0x72,0xf2
- byte 0x0a,0x8a,0x4a,0xca,0x2a,0xaa,0x6a,0xea
- byte 0x1a,0x9a,0x5a,0xda,0x3a,0xba,0x7a,0xfa
- byte 0x06,0x86,0x46,0xc6,0x26,0xa6,0x66,0xe6
- byte 0x16,0x96,0x56,0xd6,0x36,0xb6,0x76,0xf6
- byte 0x0e,0x8e,0x4e,0xce,0x2e,0xae,0x6e,0xee
- byte 0x1e,0x9e,0x5e,0xde,0x3e,0xbe,0x7e,0xfe
- byte 0x01,0x81,0x41,0xc1,0x21,0xa1,0x61,0xe1
- byte 0x11,0x91,0x51,0xd1,0x31,0xb1,0x71,0xf1
- byte 0x09,0x89,0x49,0xc9,0x29,0xa9,0x69,0xe9
- byte 0x19,0x99,0x59,0xd9,0x39,0xb9,0x79,0xf9
- byte 0x05,0x85,0x45,0xc5,0x25,0xa5,0x65,0xe5
- byte 0x15,0x95,0x55,0xd5,0x35,0xb5,0x75,0xf5
- byte 0x0d,0x8d,0x4d,0xcd,0x2d,0xad,0x6d,0xed
- byte 0x1d,0x9d,0x5d,0xdd,0x3d,0xbd,0x7d,0xfd
- byte 0x03,0x83,0x43,0xc3,0x23,0xa3,0x63,0xe3
- byte 0x13,0x93,0x53,0xd3,0x33,0xb3,0x73,0xf3
- byte 0x0b,0x8b,0x4b,0xcb,0x2b,0xab,0x6b,0xeb
- byte 0x1b,0x9b,0x5b,0xdb,0x3b,0xbb,0x7b,0xfb
- byte 0x07,0x87,0x47,0xc7,0x27,0xa7,0x67,0xe7
- byte 0x17,0x97,0x57,0xd7,0x37,0xb7,0x77,0xf7
- byte 0x0f,0x8f,0x4f,0xcf,0x2f,0xaf,0x6f,0xef
- byte 0x1f,0x9f,0x5f,0xdf,0x3f,0xbf,0x7f,0xff
-
- global fmovm_calc_ea
-###############################################
-# _fmovm_calc_ea: calculate effective address #
-###############################################
-fmovm_calc_ea:
- mov.l %d0,%a0 # move # bytes to a0
-
-# currently, MODE and REG are taken from the EXC_OPWORD. this could be
-# easily changed if they were inputs passed in registers.
- mov.w EXC_OPWORD(%a6),%d0 # fetch opcode word
- mov.w %d0,%d1 # make a copy
-
- andi.w &0x3f,%d0 # extract mode field
- andi.l &0x7,%d1 # extract reg field
-
-# jump to the corresponding function for each {MODE,REG} pair.
- mov.w (tbl_fea_mode.b,%pc,%d0.w*2),%d0 # fetch jmp distance
- jmp (tbl_fea_mode.b,%pc,%d0.w*1) # jmp to correct ea mode
-
- swbeg &64
-tbl_fea_mode:
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
-
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
-
- short faddr_ind_a0 - tbl_fea_mode
- short faddr_ind_a1 - tbl_fea_mode
- short faddr_ind_a2 - tbl_fea_mode
- short faddr_ind_a3 - tbl_fea_mode
- short faddr_ind_a4 - tbl_fea_mode
- short faddr_ind_a5 - tbl_fea_mode
- short faddr_ind_a6 - tbl_fea_mode
- short faddr_ind_a7 - tbl_fea_mode
-
- short faddr_ind_p_a0 - tbl_fea_mode
- short faddr_ind_p_a1 - tbl_fea_mode
- short faddr_ind_p_a2 - tbl_fea_mode
- short faddr_ind_p_a3 - tbl_fea_mode
- short faddr_ind_p_a4 - tbl_fea_mode
- short faddr_ind_p_a5 - tbl_fea_mode
- short faddr_ind_p_a6 - tbl_fea_mode
- short faddr_ind_p_a7 - tbl_fea_mode
-
- short faddr_ind_m_a0 - tbl_fea_mode
- short faddr_ind_m_a1 - tbl_fea_mode
- short faddr_ind_m_a2 - tbl_fea_mode
- short faddr_ind_m_a3 - tbl_fea_mode
- short faddr_ind_m_a4 - tbl_fea_mode
- short faddr_ind_m_a5 - tbl_fea_mode
- short faddr_ind_m_a6 - tbl_fea_mode
- short faddr_ind_m_a7 - tbl_fea_mode
-
- short faddr_ind_disp_a0 - tbl_fea_mode
- short faddr_ind_disp_a1 - tbl_fea_mode
- short faddr_ind_disp_a2 - tbl_fea_mode
- short faddr_ind_disp_a3 - tbl_fea_mode
- short faddr_ind_disp_a4 - tbl_fea_mode
- short faddr_ind_disp_a5 - tbl_fea_mode
- short faddr_ind_disp_a6 - tbl_fea_mode
- short faddr_ind_disp_a7 - tbl_fea_mode
-
- short faddr_ind_ext - tbl_fea_mode
- short faddr_ind_ext - tbl_fea_mode
- short faddr_ind_ext - tbl_fea_mode
- short faddr_ind_ext - tbl_fea_mode
- short faddr_ind_ext - tbl_fea_mode
- short faddr_ind_ext - tbl_fea_mode
- short faddr_ind_ext - tbl_fea_mode
- short faddr_ind_ext - tbl_fea_mode
-
- short fabs_short - tbl_fea_mode
- short fabs_long - tbl_fea_mode
- short fpc_ind - tbl_fea_mode
- short fpc_ind_ext - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
-
-###################################
-# Address register indirect: (An) #
-###################################
-faddr_ind_a0:
- mov.l EXC_DREGS+0x8(%a6),%a0 # Get current a0
- rts
-
-faddr_ind_a1:
- mov.l EXC_DREGS+0xc(%a6),%a0 # Get current a1
- rts
-
-faddr_ind_a2:
- mov.l %a2,%a0 # Get current a2
- rts
-
-faddr_ind_a3:
- mov.l %a3,%a0 # Get current a3
- rts
-
-faddr_ind_a4:
- mov.l %a4,%a0 # Get current a4
- rts
-
-faddr_ind_a5:
- mov.l %a5,%a0 # Get current a5
- rts
-
-faddr_ind_a6:
- mov.l (%a6),%a0 # Get current a6
- rts
-
-faddr_ind_a7:
- mov.l EXC_A7(%a6),%a0 # Get current a7
- rts
-
-#####################################################
-# Address register indirect w/ postincrement: (An)+ #
-#####################################################
-faddr_ind_p_a0:
- mov.l EXC_DREGS+0x8(%a6),%d0 # Get current a0
- mov.l %d0,%d1
- add.l %a0,%d1 # Increment
- mov.l %d1,EXC_DREGS+0x8(%a6) # Save incr value
- mov.l %d0,%a0
- rts
-
-faddr_ind_p_a1:
- mov.l EXC_DREGS+0xc(%a6),%d0 # Get current a1
- mov.l %d0,%d1
- add.l %a0,%d1 # Increment
- mov.l %d1,EXC_DREGS+0xc(%a6) # Save incr value
- mov.l %d0,%a0
- rts
-
-faddr_ind_p_a2:
- mov.l %a2,%d0 # Get current a2
- mov.l %d0,%d1
- add.l %a0,%d1 # Increment
- mov.l %d1,%a2 # Save incr value
- mov.l %d0,%a0
- rts
-
-faddr_ind_p_a3:
- mov.l %a3,%d0 # Get current a3
- mov.l %d0,%d1
- add.l %a0,%d1 # Increment
- mov.l %d1,%a3 # Save incr value
- mov.l %d0,%a0
- rts
-
-faddr_ind_p_a4:
- mov.l %a4,%d0 # Get current a4
- mov.l %d0,%d1
- add.l %a0,%d1 # Increment
- mov.l %d1,%a4 # Save incr value
- mov.l %d0,%a0
- rts
-
-faddr_ind_p_a5:
- mov.l %a5,%d0 # Get current a5
- mov.l %d0,%d1
- add.l %a0,%d1 # Increment
- mov.l %d1,%a5 # Save incr value
- mov.l %d0,%a0
- rts
-
-faddr_ind_p_a6:
- mov.l (%a6),%d0 # Get current a6
- mov.l %d0,%d1
- add.l %a0,%d1 # Increment
- mov.l %d1,(%a6) # Save incr value
- mov.l %d0,%a0
- rts
-
-faddr_ind_p_a7:
- mov.b &mia7_flg,SPCOND_FLG(%a6) # set "special case" flag
-
- mov.l EXC_A7(%a6),%d0 # Get current a7
- mov.l %d0,%d1
- add.l %a0,%d1 # Increment
- mov.l %d1,EXC_A7(%a6) # Save incr value
- mov.l %d0,%a0
- rts
-
-####################################################
-# Address register indirect w/ predecrement: -(An) #
-####################################################
-faddr_ind_m_a0:
- mov.l EXC_DREGS+0x8(%a6),%d0 # Get current a0
- sub.l %a0,%d0 # Decrement
- mov.l %d0,EXC_DREGS+0x8(%a6) # Save decr value
- mov.l %d0,%a0
- rts
-
-faddr_ind_m_a1:
- mov.l EXC_DREGS+0xc(%a6),%d0 # Get current a1
- sub.l %a0,%d0 # Decrement
- mov.l %d0,EXC_DREGS+0xc(%a6) # Save decr value
- mov.l %d0,%a0
- rts
-
-faddr_ind_m_a2:
- mov.l %a2,%d0 # Get current a2
- sub.l %a0,%d0 # Decrement
- mov.l %d0,%a2 # Save decr value
- mov.l %d0,%a0
- rts
-
-faddr_ind_m_a3:
- mov.l %a3,%d0 # Get current a3
- sub.l %a0,%d0 # Decrement
- mov.l %d0,%a3 # Save decr value
- mov.l %d0,%a0
- rts
-
-faddr_ind_m_a4:
- mov.l %a4,%d0 # Get current a4
- sub.l %a0,%d0 # Decrement
- mov.l %d0,%a4 # Save decr value
- mov.l %d0,%a0
- rts
-
-faddr_ind_m_a5:
- mov.l %a5,%d0 # Get current a5
- sub.l %a0,%d0 # Decrement
- mov.l %d0,%a5 # Save decr value
- mov.l %d0,%a0
- rts
-
-faddr_ind_m_a6:
- mov.l (%a6),%d0 # Get current a6
- sub.l %a0,%d0 # Decrement
- mov.l %d0,(%a6) # Save decr value
- mov.l %d0,%a0
- rts
-
-faddr_ind_m_a7:
- mov.b &mda7_flg,SPCOND_FLG(%a6) # set "special case" flag
-
- mov.l EXC_A7(%a6),%d0 # Get current a7
- sub.l %a0,%d0 # Decrement
- mov.l %d0,EXC_A7(%a6) # Save decr value
- mov.l %d0,%a0
- rts
-
-########################################################
-# Address register indirect w/ displacement: (d16, An) #
-########################################################
-faddr_ind_disp_a0:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.w %d0,%a0 # sign extend displacement
-
- add.l EXC_DREGS+0x8(%a6),%a0 # a0 + d16
- rts
-
-faddr_ind_disp_a1:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.w %d0,%a0 # sign extend displacement
-
- add.l EXC_DREGS+0xc(%a6),%a0 # a1 + d16
- rts
-
-faddr_ind_disp_a2:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.w %d0,%a0 # sign extend displacement
-
- add.l %a2,%a0 # a2 + d16
- rts
-
-faddr_ind_disp_a3:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.w %d0,%a0 # sign extend displacement
-
- add.l %a3,%a0 # a3 + d16
- rts
-
-faddr_ind_disp_a4:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.w %d0,%a0 # sign extend displacement
-
- add.l %a4,%a0 # a4 + d16
- rts
-
-faddr_ind_disp_a5:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.w %d0,%a0 # sign extend displacement
-
- add.l %a5,%a0 # a5 + d16
- rts
-
-faddr_ind_disp_a6:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.w %d0,%a0 # sign extend displacement
-
- add.l (%a6),%a0 # a6 + d16
- rts
-
-faddr_ind_disp_a7:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.w %d0,%a0 # sign extend displacement
-
- add.l EXC_A7(%a6),%a0 # a7 + d16
- rts
-
-########################################################################
-# Address register indirect w/ index(8-bit displacement): (d8, An, Xn) #
-# " " " w/ " (base displacement): (bd, An, Xn) #
-# Memory indirect postindexed: ([bd, An], Xn, od) #
-# Memory indirect preindexed: ([bd, An, Xn], od) #
-########################################################################
-faddr_ind_ext:
- addq.l &0x8,%d1
- bsr.l fetch_dreg # fetch base areg
- mov.l %d0,-(%sp)
-
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word # fetch extword in d0
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.l (%sp)+,%a0
-
- btst &0x8,%d0
- bne.w fcalc_mem_ind
-
- mov.l %d0,L_SCR1(%a6) # hold opword
-
- mov.l %d0,%d1
- rol.w &0x4,%d1
- andi.w &0xf,%d1 # extract index regno
-
-# count on fetch_dreg() not to alter a0...
- bsr.l fetch_dreg # fetch index
-
- mov.l %d2,-(%sp) # save d2
- mov.l L_SCR1(%a6),%d2 # fetch opword
-
- btst &0xb,%d2 # is it word or long?
- bne.b faii8_long
- ext.l %d0 # sign extend word index
-faii8_long:
- mov.l %d2,%d1
- rol.w &0x7,%d1
- andi.l &0x3,%d1 # extract scale value
-
- lsl.l %d1,%d0 # shift index by scale
-
- extb.l %d2 # sign extend displacement
- add.l %d2,%d0 # index + disp
- add.l %d0,%a0 # An + (index + disp)
-
- mov.l (%sp)+,%d2 # restore old d2
- rts
-
-###########################
-# Absolute short: (XXX).W #
-###########################
-fabs_short:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word # fetch short address
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.w %d0,%a0 # return <ea> in a0
- rts
-
-##########################
-# Absolute long: (XXX).L #
-##########################
-fabs_long:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch long address
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.l %d0,%a0 # return <ea> in a0
- rts
-
-#######################################################
-# Program counter indirect w/ displacement: (d16, PC) #
-#######################################################
-fpc_ind:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word # fetch word displacement
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.w %d0,%a0 # sign extend displacement
-
- add.l EXC_EXTWPTR(%a6),%a0 # pc + d16
-
-# _imem_read_word() increased the extwptr by 2. need to adjust here.
- subq.l &0x2,%a0 # adjust <ea>
- rts
-
-##########################################################
-# PC indirect w/ index(8-bit displacement): (d8, PC, An) #
-# " " w/ " (base displacement): (bd, PC, An) #
-# PC memory indirect postindexed: ([bd, PC], Xn, od) #
-# PC memory indirect preindexed: ([bd, PC, Xn], od) #
-##########################################################
-fpc_ind_ext:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word # fetch ext word
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.l EXC_EXTWPTR(%a6),%a0 # put base in a0
- subq.l &0x2,%a0 # adjust base
-
- btst &0x8,%d0 # is disp only 8 bits?
- bne.w fcalc_mem_ind # calc memory indirect
-
- mov.l %d0,L_SCR1(%a6) # store opword
-
- mov.l %d0,%d1 # make extword copy
- rol.w &0x4,%d1 # rotate reg num into place
- andi.w &0xf,%d1 # extract register number
-
-# count on fetch_dreg() not to alter a0...
- bsr.l fetch_dreg # fetch index
-
- mov.l %d2,-(%sp) # save d2
- mov.l L_SCR1(%a6),%d2 # fetch opword
-
- btst &0xb,%d2 # is index word or long?
- bne.b fpii8_long # long
- ext.l %d0 # sign extend word index
-fpii8_long:
- mov.l %d2,%d1
- rol.w &0x7,%d1 # rotate scale value into place
- andi.l &0x3,%d1 # extract scale value
-
- lsl.l %d1,%d0 # shift index by scale
-
- extb.l %d2 # sign extend displacement
- add.l %d2,%d0 # disp + index
- add.l %d0,%a0 # An + (index + disp)
-
- mov.l (%sp)+,%d2 # restore temp register
- rts
-
-# d2 = index
-# d3 = base
-# d4 = od
-# d5 = extword
-fcalc_mem_ind:
- btst &0x6,%d0 # is the index suppressed?
- beq.b fcalc_index
-
- movm.l &0x3c00,-(%sp) # save d2-d5
-
- mov.l %d0,%d5 # put extword in d5
- mov.l %a0,%d3 # put base in d3
-
- clr.l %d2 # yes, so index = 0
- bra.b fbase_supp_ck
-
-# index:
-fcalc_index:
- mov.l %d0,L_SCR1(%a6) # save d0 (opword)
- bfextu %d0{&16:&4},%d1 # fetch dreg index
- bsr.l fetch_dreg
-
- movm.l &0x3c00,-(%sp) # save d2-d5
- mov.l %d0,%d2 # put index in d2
- mov.l L_SCR1(%a6),%d5
- mov.l %a0,%d3
-
- btst &0xb,%d5 # is index word or long?
- bne.b fno_ext
- ext.l %d2
-
-fno_ext:
- bfextu %d5{&21:&2},%d0
- lsl.l %d0,%d2
-
-# base address (passed as parameter in d3):
-# we clear the value here if it should actually be suppressed.
-fbase_supp_ck:
- btst &0x7,%d5 # is the bd suppressed?
- beq.b fno_base_sup
- clr.l %d3
-
-# base displacement:
-fno_base_sup:
- bfextu %d5{&26:&2},%d0 # get bd size
-# beq.l fmovm_error # if (size == 0) it's reserved
-
- cmpi.b %d0,&0x2
- blt.b fno_bd
- beq.b fget_word_bd
-
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long
-
- tst.l %d1 # did ifetch fail?
- bne.l fcea_iacc # yes
-
- bra.b fchk_ind
-
-fget_word_bd:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # did ifetch fail?
- bne.l fcea_iacc # yes
-
- ext.l %d0 # sign extend bd
-
-fchk_ind:
- add.l %d0,%d3 # base += bd
-
-# outer displacement:
-fno_bd:
- bfextu %d5{&30:&2},%d0 # is od suppressed?
- beq.w faii_bd
-
- cmpi.b %d0,&0x2
- blt.b fnull_od
- beq.b fword_od
-
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long
-
- tst.l %d1 # did ifetch fail?
- bne.l fcea_iacc # yes
-
- bra.b fadd_them
-
-fword_od:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # did ifetch fail?
- bne.l fcea_iacc # yes
-
- ext.l %d0 # sign extend od
- bra.b fadd_them
-
-fnull_od:
- clr.l %d0
-
-fadd_them:
- mov.l %d0,%d4
-
- btst &0x2,%d5 # pre or post indexing?
- beq.b fpre_indexed
-
- mov.l %d3,%a0
- bsr.l _dmem_read_long
-
- tst.l %d1 # did dfetch fail?
- bne.w fcea_err # yes
-
- add.l %d2,%d0 # <ea> += index
- add.l %d4,%d0 # <ea> += od
- bra.b fdone_ea
-
-fpre_indexed:
- add.l %d2,%d3 # preindexing
- mov.l %d3,%a0
- bsr.l _dmem_read_long
-
- tst.l %d1 # did dfetch fail?
- bne.w fcea_err # yes
-
- add.l %d4,%d0 # ea += od
- bra.b fdone_ea
-
-faii_bd:
- add.l %d2,%d3 # ea = (base + bd) + index
- mov.l %d3,%d0
-fdone_ea:
- mov.l %d0,%a0
-
- movm.l (%sp)+,&0x003c # restore d2-d5
- rts
-
-#########################################################
-fcea_err:
- mov.l %d3,%a0
-
- movm.l (%sp)+,&0x003c # restore d2-d5
- mov.w &0x0101,%d0
- bra.l iea_dacc
-
-fcea_iacc:
- movm.l (%sp)+,&0x003c # restore d2-d5
- bra.l iea_iacc
-
-fmovm_out_err:
- bsr.l restore
- mov.w &0x00e1,%d0
- bra.b fmovm_err
-
-fmovm_in_err:
- bsr.l restore
- mov.w &0x0161,%d0
-
-fmovm_err:
- mov.l L_SCR1(%a6),%a0
- bra.l iea_dacc
-
-#########################################################################
-# XDEF **************************************************************** #
-# fmovm_ctrl(): emulate fmovm.l of control registers instr #
-# #
-# XREF **************************************************************** #
-# _imem_read_long() - read longword from memory #
-# iea_iacc() - _imem_read_long() failed; error recovery #
-# #
-# INPUT *************************************************************** #
-# None #
-# #
-# OUTPUT ************************************************************** #
-# If _imem_read_long() doesn't fail: #
-# USER_FPCR(a6) = new FPCR value #
-# USER_FPSR(a6) = new FPSR value #
-# USER_FPIAR(a6) = new FPIAR value #
-# #
-# ALGORITHM *********************************************************** #
-# Decode the instruction type by looking at the extension word #
-# in order to see how many control registers to fetch from memory. #
-# Fetch them using _imem_read_long(). If this fetch fails, exit through #
-# the special access error exit handler iea_iacc(). #
-# #
-# Instruction word decoding: #
-# #
-# fmovem.l #<data>, {FPIAR&|FPCR&|FPSR} #
-# #
-# WORD1 WORD2 #
-# 1111 0010 00 111100 100$ $$00 0000 0000 #
-# #
-# $$$ (100): FPCR #
-# (010): FPSR #
-# (001): FPIAR #
-# (000): FPIAR #
-# #
-#########################################################################
-
- global fmovm_ctrl
-fmovm_ctrl:
- mov.b EXC_EXTWORD(%a6),%d0 # fetch reg select bits
- cmpi.b %d0,&0x9c # fpcr & fpsr & fpiar ?
- beq.w fctrl_in_7 # yes
- cmpi.b %d0,&0x98 # fpcr & fpsr ?
- beq.w fctrl_in_6 # yes
- cmpi.b %d0,&0x94 # fpcr & fpiar ?
- beq.b fctrl_in_5 # yes
-
-# fmovem.l #<data>, fpsr/fpiar
-fctrl_in_3:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch FPSR from mem
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.l %d0,USER_FPSR(%a6) # store new FPSR to stack
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch FPIAR from mem
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.l %d0,USER_FPIAR(%a6) # store new FPIAR to stack
- rts
-
-# fmovem.l #<data>, fpcr/fpiar
-fctrl_in_5:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch FPCR from mem
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.l %d0,USER_FPCR(%a6) # store new FPCR to stack
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch FPIAR from mem
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.l %d0,USER_FPIAR(%a6) # store new FPIAR to stack
- rts
-
-# fmovem.l #<data>, fpcr/fpsr
-fctrl_in_6:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch FPCR from mem
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.l %d0,USER_FPCR(%a6) # store new FPCR to mem
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch FPSR from mem
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.l %d0,USER_FPSR(%a6) # store new FPSR to mem
- rts
-
-# fmovem.l #<data>, fpcr/fpsr/fpiar
-fctrl_in_7:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch FPCR from mem
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.l %d0,USER_FPCR(%a6) # store new FPCR to mem
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch FPSR from mem
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.l %d0,USER_FPSR(%a6) # store new FPSR to mem
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch FPIAR from mem
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.l %d0,USER_FPIAR(%a6) # store new FPIAR to mem
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# _dcalc_ea(): calc correct <ea> from <ea> stacked on exception #
-# #
-# XREF **************************************************************** #
-# inc_areg() - increment an address register #
-# dec_areg() - decrement an address register #
-# #
-# INPUT *************************************************************** #
-# d0 = number of bytes to adjust <ea> by #
-# #
-# OUTPUT ************************************************************** #
-# None #
-# #
-# ALGORITHM *********************************************************** #
-# "Dummy" CALCulate Effective Address: #
-# The stacked <ea> for FP unimplemented instructions and opclass #
-# two packed instructions is correct with the exception of... #
-# #
-# 1) -(An) : The register is not updated regardless of size. #
-# Also, for extended precision and packed, the #
-# stacked <ea> value is 8 bytes too big #
-# 2) (An)+ : The register is not updated. #
-# 3) #<data> : The upper longword of the immediate operand is #
-# stacked b,w,l and s sizes are completely stacked. #
-# d,x, and p are not. #
-# #
-#########################################################################
-
- global _dcalc_ea
-_dcalc_ea:
- mov.l %d0, %a0 # move # bytes to %a0
-
- mov.b 1+EXC_OPWORD(%a6), %d0 # fetch opcode word
- mov.l %d0, %d1 # make a copy
-
- andi.w &0x38, %d0 # extract mode field
- andi.l &0x7, %d1 # extract reg field
-
- cmpi.b %d0,&0x18 # is mode (An)+ ?
- beq.b dcea_pi # yes
-
- cmpi.b %d0,&0x20 # is mode -(An) ?
- beq.b dcea_pd # yes
-
- or.w %d1,%d0 # concat mode,reg
- cmpi.b %d0,&0x3c # is mode #<data>?
-
- beq.b dcea_imm # yes
-
- mov.l EXC_EA(%a6),%a0 # return <ea>
- rts
-
-# need to set immediate data flag here since we'll need to do
-# an imem_read to fetch this later.
-dcea_imm:
- mov.b &immed_flg,SPCOND_FLG(%a6)
- lea ([USER_FPIAR,%a6],0x4),%a0 # no; return <ea>
- rts
-
-# here, the <ea> is stacked correctly. however, we must update the
-# address register...
-dcea_pi:
- mov.l %a0,%d0 # pass amt to inc by
- bsr.l inc_areg # inc addr register
-
- mov.l EXC_EA(%a6),%a0 # stacked <ea> is correct
- rts
-
-# the <ea> is stacked correctly for all but extended and packed which
-# the <ea>s are 8 bytes too large.
-# it would make no sense to have a pre-decrement to a7 in supervisor
-# mode so we don't even worry about this tricky case here : )
-dcea_pd:
- mov.l %a0,%d0 # pass amt to dec by
- bsr.l dec_areg # dec addr register
-
- mov.l EXC_EA(%a6),%a0 # stacked <ea> is correct
-
- cmpi.b %d0,&0xc # is opsize ext or packed?
- beq.b dcea_pd2 # yes
- rts
-dcea_pd2:
- sub.l &0x8,%a0 # correct <ea>
- mov.l %a0,EXC_EA(%a6) # put correct <ea> on stack
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# _calc_ea_fout(): calculate correct stacked <ea> for extended #
-# and packed data opclass 3 operations. #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# None #
-# #
-# OUTPUT ************************************************************** #
-# a0 = return correct effective address #
-# #
-# ALGORITHM *********************************************************** #
-# For opclass 3 extended and packed data operations, the <ea> #
-# stacked for the exception is incorrect for -(an) and (an)+ addressing #
-# modes. Also, while we're at it, the index register itself must get #
-# updated. #
-# So, for -(an), we must subtract 8 off of the stacked <ea> value #
-# and return that value as the correct <ea> and store that value in An. #
-# For (an)+, the stacked <ea> is correct but we must adjust An by +12. #
-# #
-#########################################################################
-
-# This calc_ea is currently used to retrieve the correct <ea>
-# for fmove outs of type extended and packed.
- global _calc_ea_fout
-_calc_ea_fout:
- mov.b 1+EXC_OPWORD(%a6),%d0 # fetch opcode word
- mov.l %d0,%d1 # make a copy
-
- andi.w &0x38,%d0 # extract mode field
- andi.l &0x7,%d1 # extract reg field
-
- cmpi.b %d0,&0x18 # is mode (An)+ ?
- beq.b ceaf_pi # yes
-
- cmpi.b %d0,&0x20 # is mode -(An) ?
- beq.w ceaf_pd # yes
-
- mov.l EXC_EA(%a6),%a0 # stacked <ea> is correct
- rts
-
-# (An)+ : extended and packed fmove out
-# : stacked <ea> is correct
-# : "An" not updated
-ceaf_pi:
- mov.w (tbl_ceaf_pi.b,%pc,%d1.w*2),%d1
- mov.l EXC_EA(%a6),%a0
- jmp (tbl_ceaf_pi.b,%pc,%d1.w*1)
-
- swbeg &0x8
-tbl_ceaf_pi:
- short ceaf_pi0 - tbl_ceaf_pi
- short ceaf_pi1 - tbl_ceaf_pi
- short ceaf_pi2 - tbl_ceaf_pi
- short ceaf_pi3 - tbl_ceaf_pi
- short ceaf_pi4 - tbl_ceaf_pi
- short ceaf_pi5 - tbl_ceaf_pi
- short ceaf_pi6 - tbl_ceaf_pi
- short ceaf_pi7 - tbl_ceaf_pi
-
-ceaf_pi0:
- addi.l &0xc,EXC_DREGS+0x8(%a6)
- rts
-ceaf_pi1:
- addi.l &0xc,EXC_DREGS+0xc(%a6)
- rts
-ceaf_pi2:
- add.l &0xc,%a2
- rts
-ceaf_pi3:
- add.l &0xc,%a3
- rts
-ceaf_pi4:
- add.l &0xc,%a4
- rts
-ceaf_pi5:
- add.l &0xc,%a5
- rts
-ceaf_pi6:
- addi.l &0xc,EXC_A6(%a6)
- rts
-ceaf_pi7:
- mov.b &mia7_flg,SPCOND_FLG(%a6)
- addi.l &0xc,EXC_A7(%a6)
- rts
-
-# -(An) : extended and packed fmove out
-# : stacked <ea> = actual <ea> + 8
-# : "An" not updated
-ceaf_pd:
- mov.w (tbl_ceaf_pd.b,%pc,%d1.w*2),%d1
- mov.l EXC_EA(%a6),%a0
- sub.l &0x8,%a0
- sub.l &0x8,EXC_EA(%a6)
- jmp (tbl_ceaf_pd.b,%pc,%d1.w*1)
-
- swbeg &0x8
-tbl_ceaf_pd:
- short ceaf_pd0 - tbl_ceaf_pd
- short ceaf_pd1 - tbl_ceaf_pd
- short ceaf_pd2 - tbl_ceaf_pd
- short ceaf_pd3 - tbl_ceaf_pd
- short ceaf_pd4 - tbl_ceaf_pd
- short ceaf_pd5 - tbl_ceaf_pd
- short ceaf_pd6 - tbl_ceaf_pd
- short ceaf_pd7 - tbl_ceaf_pd
-
-ceaf_pd0:
- mov.l %a0,EXC_DREGS+0x8(%a6)
- rts
-ceaf_pd1:
- mov.l %a0,EXC_DREGS+0xc(%a6)
- rts
-ceaf_pd2:
- mov.l %a0,%a2
- rts
-ceaf_pd3:
- mov.l %a0,%a3
- rts
-ceaf_pd4:
- mov.l %a0,%a4
- rts
-ceaf_pd5:
- mov.l %a0,%a5
- rts
-ceaf_pd6:
- mov.l %a0,EXC_A6(%a6)
- rts
-ceaf_pd7:
- mov.l %a0,EXC_A7(%a6)
- mov.b &mda7_flg,SPCOND_FLG(%a6)
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# _load_fop(): load operand for unimplemented FP exception #
-# #
-# XREF **************************************************************** #
-# set_tag_x() - determine ext prec optype tag #
-# set_tag_s() - determine sgl prec optype tag #
-# set_tag_d() - determine dbl prec optype tag #
-# unnorm_fix() - convert normalized number to denorm or zero #
-# norm() - normalize a denormalized number #
-# get_packed() - fetch a packed operand from memory #
-# _dcalc_ea() - calculate <ea>, fixing An in process #
-# #
-# _imem_read_{word,long}() - read from instruction memory #
-# _dmem_read() - read from data memory #
-# _dmem_read_{byte,word,long}() - read from data memory #
-# #
-# facc_in_{b,w,l,d,x}() - mem read failed; special exit point #
-# #
-# INPUT *************************************************************** #
-# None #
-# #
-# OUTPUT ************************************************************** #
-# If memory access doesn't fail: #
-# FP_SRC(a6) = source operand in extended precision #
-# FP_DST(a6) = destination operand in extended precision #
-# #
-# ALGORITHM *********************************************************** #
-# This is called from the Unimplemented FP exception handler in #
-# order to load the source and maybe destination operand into #
-# FP_SRC(a6) and FP_DST(a6). If the instruction was opclass zero, load #
-# the source and destination from the FP register file. Set the optype #
-# tags for both if dyadic, one for monadic. If a number is an UNNORM, #
-# convert it to a DENORM or a ZERO. #
-# If the instruction is opclass two (memory->reg), then fetch #
-# the destination from the register file and the source operand from #
-# memory. Tag and fix both as above w/ opclass zero instructions. #
-# If the source operand is byte,word,long, or single, it may be #
-# in the data register file. If it's actually out in memory, use one of #
-# the mem_read() routines to fetch it. If the mem_read() access returns #
-# a failing value, exit through the special facc_in() routine which #
-# will create an acess error exception frame from the current exception #
-# frame. #
-# Immediate data and regular data accesses are separated because #
-# if an immediate data access fails, the resulting fault status #
-# longword stacked for the access error exception must have the #
-# instruction bit set. #
-# #
-#########################################################################
-
- global _load_fop
-_load_fop:
-
-# 15 13 12 10 9 7 6 0
-# / \ / \ / \ / \
-# ---------------------------------
-# | opclass | RX | RY | EXTENSION | (2nd word of general FP instruction)
-# ---------------------------------
-#
-
-# bfextu EXC_CMDREG(%a6){&0:&3}, %d0 # extract opclass
-# cmpi.b %d0, &0x2 # which class is it? ('000,'010,'011)
-# beq.w op010 # handle <ea> -> fpn
-# bgt.w op011 # handle fpn -> <ea>
-
-# we're not using op011 for now...
- btst &0x6,EXC_CMDREG(%a6)
- bne.b op010
-
-############################
-# OPCLASS '000: reg -> reg #
-############################
-op000:
- mov.b 1+EXC_CMDREG(%a6),%d0 # fetch extension word lo
- btst &0x5,%d0 # testing extension bits
- beq.b op000_src # (bit 5 == 0) => monadic
- btst &0x4,%d0 # (bit 5 == 1)
- beq.b op000_dst # (bit 4 == 0) => dyadic
- and.w &0x007f,%d0 # extract extension bits {6:0}
- cmpi.w %d0,&0x0038 # is it an fcmp (dyadic) ?
- bne.b op000_src # it's an fcmp
-
-op000_dst:
- bfextu EXC_CMDREG(%a6){&6:&3}, %d0 # extract dst field
- bsr.l load_fpn2 # fetch dst fpreg into FP_DST
-
- bsr.l set_tag_x # get dst optype tag
-
- cmpi.b %d0, &UNNORM # is dst fpreg an UNNORM?
- beq.b op000_dst_unnorm # yes
-op000_dst_cont:
- mov.b %d0, DTAG(%a6) # store the dst optype tag
-
-op000_src:
- bfextu EXC_CMDREG(%a6){&3:&3}, %d0 # extract src field
- bsr.l load_fpn1 # fetch src fpreg into FP_SRC
-
- bsr.l set_tag_x # get src optype tag
-
- cmpi.b %d0, &UNNORM # is src fpreg an UNNORM?
- beq.b op000_src_unnorm # yes
-op000_src_cont:
- mov.b %d0, STAG(%a6) # store the src optype tag
- rts
-
-op000_dst_unnorm:
- bsr.l unnorm_fix # fix the dst UNNORM
- bra.b op000_dst_cont
-op000_src_unnorm:
- bsr.l unnorm_fix # fix the src UNNORM
- bra.b op000_src_cont
-
-#############################
-# OPCLASS '010: <ea> -> reg #
-#############################
-op010:
- mov.w EXC_CMDREG(%a6),%d0 # fetch extension word
- btst &0x5,%d0 # testing extension bits
- beq.b op010_src # (bit 5 == 0) => monadic
- btst &0x4,%d0 # (bit 5 == 1)
- beq.b op010_dst # (bit 4 == 0) => dyadic
- and.w &0x007f,%d0 # extract extension bits {6:0}
- cmpi.w %d0,&0x0038 # is it an fcmp (dyadic) ?
- bne.b op010_src # it's an fcmp
-
-op010_dst:
- bfextu EXC_CMDREG(%a6){&6:&3}, %d0 # extract dst field
- bsr.l load_fpn2 # fetch dst fpreg ptr
-
- bsr.l set_tag_x # get dst type tag
-
- cmpi.b %d0, &UNNORM # is dst fpreg an UNNORM?
- beq.b op010_dst_unnorm # yes
-op010_dst_cont:
- mov.b %d0, DTAG(%a6) # store the dst optype tag
-
-op010_src:
- bfextu EXC_CMDREG(%a6){&3:&3}, %d0 # extract src type field
-
- bfextu EXC_OPWORD(%a6){&10:&3}, %d1 # extract <ea> mode field
- bne.w fetch_from_mem # src op is in memory
-
-op010_dreg:
- clr.b STAG(%a6) # either NORM or ZERO
- bfextu EXC_OPWORD(%a6){&13:&3}, %d1 # extract src reg field
-
- mov.w (tbl_op010_dreg.b,%pc,%d0.w*2), %d0 # jmp based on optype
- jmp (tbl_op010_dreg.b,%pc,%d0.w*1) # fetch src from dreg
-
-op010_dst_unnorm:
- bsr.l unnorm_fix # fix the dst UNNORM
- bra.b op010_dst_cont
-
- swbeg &0x8
-tbl_op010_dreg:
- short opd_long - tbl_op010_dreg
- short opd_sgl - tbl_op010_dreg
- short tbl_op010_dreg - tbl_op010_dreg
- short tbl_op010_dreg - tbl_op010_dreg
- short opd_word - tbl_op010_dreg
- short tbl_op010_dreg - tbl_op010_dreg
- short opd_byte - tbl_op010_dreg
- short tbl_op010_dreg - tbl_op010_dreg
-
-#
-# LONG: can be either NORM or ZERO...
-#
-opd_long:
- bsr.l fetch_dreg # fetch long in d0
- fmov.l %d0, %fp0 # load a long
- fmovm.x &0x80, FP_SRC(%a6) # return src op in FP_SRC
- fbeq.w opd_long_zero # long is a ZERO
- rts
-opd_long_zero:
- mov.b &ZERO, STAG(%a6) # set ZERO optype flag
- rts
-
-#
-# WORD: can be either NORM or ZERO...
-#
-opd_word:
- bsr.l fetch_dreg # fetch word in d0
- fmov.w %d0, %fp0 # load a word
- fmovm.x &0x80, FP_SRC(%a6) # return src op in FP_SRC
- fbeq.w opd_word_zero # WORD is a ZERO
- rts
-opd_word_zero:
- mov.b &ZERO, STAG(%a6) # set ZERO optype flag
- rts
-
-#
-# BYTE: can be either NORM or ZERO...
-#
-opd_byte:
- bsr.l fetch_dreg # fetch word in d0
- fmov.b %d0, %fp0 # load a byte
- fmovm.x &0x80, FP_SRC(%a6) # return src op in FP_SRC
- fbeq.w opd_byte_zero # byte is a ZERO
- rts
-opd_byte_zero:
- mov.b &ZERO, STAG(%a6) # set ZERO optype flag
- rts
-
-#
-# SGL: can be either NORM, DENORM, ZERO, INF, QNAN or SNAN but not UNNORM
-#
-# separate SNANs and DENORMs so they can be loaded w/ special care.
-# all others can simply be moved "in" using fmove.
-#
-opd_sgl:
- bsr.l fetch_dreg # fetch sgl in d0
- mov.l %d0,L_SCR1(%a6)
-
- lea L_SCR1(%a6), %a0 # pass: ptr to the sgl
- bsr.l set_tag_s # determine sgl type
- mov.b %d0, STAG(%a6) # save the src tag
-
- cmpi.b %d0, &SNAN # is it an SNAN?
- beq.w get_sgl_snan # yes
-
- cmpi.b %d0, &DENORM # is it a DENORM?
- beq.w get_sgl_denorm # yes
-
- fmov.s (%a0), %fp0 # no, so can load it regular
- fmovm.x &0x80, FP_SRC(%a6) # return src op in FP_SRC
- rts
-
-##############################################################################
-
-#########################################################################
-# fetch_from_mem(): #
-# - src is out in memory. must: #
-# (1) calc ea - must read AFTER you know the src type since #
-# if the ea is -() or ()+, need to know # of bytes. #
-# (2) read it in from either user or supervisor space #
-# (3) if (b || w || l) then simply read in #
-# if (s || d || x) then check for SNAN,UNNORM,DENORM #
-# if (packed) then punt for now #
-# INPUT: #
-# %d0 : src type field #
-#########################################################################
-fetch_from_mem:
- clr.b STAG(%a6) # either NORM or ZERO
-
- mov.w (tbl_fp_type.b,%pc,%d0.w*2), %d0 # index by src type field
- jmp (tbl_fp_type.b,%pc,%d0.w*1)
-
- swbeg &0x8
-tbl_fp_type:
- short load_long - tbl_fp_type
- short load_sgl - tbl_fp_type
- short load_ext - tbl_fp_type
- short load_packed - tbl_fp_type
- short load_word - tbl_fp_type
- short load_dbl - tbl_fp_type
- short load_byte - tbl_fp_type
- short tbl_fp_type - tbl_fp_type
-
-#########################################
-# load a LONG into %fp0: #
-# -number can't fault #
-# (1) calc ea #
-# (2) read 4 bytes into L_SCR1 #
-# (3) fmov.l into %fp0 #
-#########################################
-load_long:
- movq.l &0x4, %d0 # pass: 4 (bytes)
- bsr.l _dcalc_ea # calc <ea>; <ea> in %a0
-
- cmpi.b SPCOND_FLG(%a6),&immed_flg
- beq.b load_long_immed
-
- bsr.l _dmem_read_long # fetch src operand from memory
-
- tst.l %d1 # did dfetch fail?
- bne.l facc_in_l # yes
-
-load_long_cont:
- fmov.l %d0, %fp0 # read into %fp0;convert to xprec
- fmovm.x &0x80, FP_SRC(%a6) # return src op in FP_SRC
-
- fbeq.w load_long_zero # src op is a ZERO
- rts
-load_long_zero:
- mov.b &ZERO, STAG(%a6) # set optype tag to ZERO
- rts
-
-load_long_immed:
- bsr.l _imem_read_long # fetch src operand immed data
-
- tst.l %d1 # did ifetch fail?
- bne.l funimp_iacc # yes
- bra.b load_long_cont
-
-#########################################
-# load a WORD into %fp0: #
-# -number can't fault #
-# (1) calc ea #
-# (2) read 2 bytes into L_SCR1 #
-# (3) fmov.w into %fp0 #
-#########################################
-load_word:
- movq.l &0x2, %d0 # pass: 2 (bytes)
- bsr.l _dcalc_ea # calc <ea>; <ea> in %a0
-
- cmpi.b SPCOND_FLG(%a6),&immed_flg
- beq.b load_word_immed
-
- bsr.l _dmem_read_word # fetch src operand from memory
-
- tst.l %d1 # did dfetch fail?
- bne.l facc_in_w # yes
-
-load_word_cont:
- fmov.w %d0, %fp0 # read into %fp0;convert to xprec
- fmovm.x &0x80, FP_SRC(%a6) # return src op in FP_SRC
-
- fbeq.w load_word_zero # src op is a ZERO
- rts
-load_word_zero:
- mov.b &ZERO, STAG(%a6) # set optype tag to ZERO
- rts
-
-load_word_immed:
- bsr.l _imem_read_word # fetch src operand immed data
-
- tst.l %d1 # did ifetch fail?
- bne.l funimp_iacc # yes
- bra.b load_word_cont
-
-#########################################
-# load a BYTE into %fp0: #
-# -number can't fault #
-# (1) calc ea #
-# (2) read 1 byte into L_SCR1 #
-# (3) fmov.b into %fp0 #
-#########################################
-load_byte:
- movq.l &0x1, %d0 # pass: 1 (byte)
- bsr.l _dcalc_ea # calc <ea>; <ea> in %a0
-
- cmpi.b SPCOND_FLG(%a6),&immed_flg
- beq.b load_byte_immed
-
- bsr.l _dmem_read_byte # fetch src operand from memory
-
- tst.l %d1 # did dfetch fail?
- bne.l facc_in_b # yes
-
-load_byte_cont:
- fmov.b %d0, %fp0 # read into %fp0;convert to xprec
- fmovm.x &0x80, FP_SRC(%a6) # return src op in FP_SRC
-
- fbeq.w load_byte_zero # src op is a ZERO
- rts
-load_byte_zero:
- mov.b &ZERO, STAG(%a6) # set optype tag to ZERO
- rts
-
-load_byte_immed:
- bsr.l _imem_read_word # fetch src operand immed data
-
- tst.l %d1 # did ifetch fail?
- bne.l funimp_iacc # yes
- bra.b load_byte_cont
-
-#########################################
-# load a SGL into %fp0: #
-# -number can't fault #
-# (1) calc ea #
-# (2) read 4 bytes into L_SCR1 #
-# (3) fmov.s into %fp0 #
-#########################################
-load_sgl:
- movq.l &0x4, %d0 # pass: 4 (bytes)
- bsr.l _dcalc_ea # calc <ea>; <ea> in %a0
-
- cmpi.b SPCOND_FLG(%a6),&immed_flg
- beq.b load_sgl_immed
-
- bsr.l _dmem_read_long # fetch src operand from memory
- mov.l %d0, L_SCR1(%a6) # store src op on stack
-
- tst.l %d1 # did dfetch fail?
- bne.l facc_in_l # yes
-
-load_sgl_cont:
- lea L_SCR1(%a6), %a0 # pass: ptr to sgl src op
- bsr.l set_tag_s # determine src type tag
- mov.b %d0, STAG(%a6) # save src optype tag on stack
-
- cmpi.b %d0, &DENORM # is it a sgl DENORM?
- beq.w get_sgl_denorm # yes
-
- cmpi.b %d0, &SNAN # is it a sgl SNAN?
- beq.w get_sgl_snan # yes
-
- fmov.s L_SCR1(%a6), %fp0 # read into %fp0;convert to xprec
- fmovm.x &0x80, FP_SRC(%a6) # return src op in FP_SRC
- rts
-
-load_sgl_immed:
- bsr.l _imem_read_long # fetch src operand immed data
-
- tst.l %d1 # did ifetch fail?
- bne.l funimp_iacc # yes
- bra.b load_sgl_cont
-
-# must convert sgl denorm format to an Xprec denorm fmt suitable for
-# normalization...
-# %a0 : points to sgl denorm
-get_sgl_denorm:
- clr.w FP_SRC_EX(%a6)
- bfextu (%a0){&9:&23}, %d0 # fetch sgl hi(_mantissa)
- lsl.l &0x8, %d0
- mov.l %d0, FP_SRC_HI(%a6) # set ext hi(_mantissa)
- clr.l FP_SRC_LO(%a6) # set ext lo(_mantissa)
-
- clr.w FP_SRC_EX(%a6)
- btst &0x7, (%a0) # is sgn bit set?
- beq.b sgl_dnrm_norm
- bset &0x7, FP_SRC_EX(%a6) # set sgn of xprec value
-
-sgl_dnrm_norm:
- lea FP_SRC(%a6), %a0
- bsr.l norm # normalize number
- mov.w &0x3f81, %d1 # xprec exp = 0x3f81
- sub.w %d0, %d1 # exp = 0x3f81 - shft amt.
- or.w %d1, FP_SRC_EX(%a6) # {sgn,exp}
-
- mov.b &NORM, STAG(%a6) # fix src type tag
- rts
-
-# convert sgl to ext SNAN
-# %a0 : points to sgl SNAN
-get_sgl_snan:
- mov.w &0x7fff, FP_SRC_EX(%a6) # set exp of SNAN
- bfextu (%a0){&9:&23}, %d0
- lsl.l &0x8, %d0 # extract and insert hi(man)
- mov.l %d0, FP_SRC_HI(%a6)
- clr.l FP_SRC_LO(%a6)
-
- btst &0x7, (%a0) # see if sign of SNAN is set
- beq.b no_sgl_snan_sgn
- bset &0x7, FP_SRC_EX(%a6)
-no_sgl_snan_sgn:
- rts
-
-#########################################
-# load a DBL into %fp0: #
-# -number can't fault #
-# (1) calc ea #
-# (2) read 8 bytes into L_SCR(1,2)#
-# (3) fmov.d into %fp0 #
-#########################################
-load_dbl:
- movq.l &0x8, %d0 # pass: 8 (bytes)
- bsr.l _dcalc_ea # calc <ea>; <ea> in %a0
-
- cmpi.b SPCOND_FLG(%a6),&immed_flg
- beq.b load_dbl_immed
-
- lea L_SCR1(%a6), %a1 # pass: ptr to input dbl tmp space
- movq.l &0x8, %d0 # pass: # bytes to read
- bsr.l _dmem_read # fetch src operand from memory
-
- tst.l %d1 # did dfetch fail?
- bne.l facc_in_d # yes
-
-load_dbl_cont:
- lea L_SCR1(%a6), %a0 # pass: ptr to input dbl
- bsr.l set_tag_d # determine src type tag
- mov.b %d0, STAG(%a6) # set src optype tag
-
- cmpi.b %d0, &DENORM # is it a dbl DENORM?
- beq.w get_dbl_denorm # yes
-
- cmpi.b %d0, &SNAN # is it a dbl SNAN?
- beq.w get_dbl_snan # yes
-
- fmov.d L_SCR1(%a6), %fp0 # read into %fp0;convert to xprec
- fmovm.x &0x80, FP_SRC(%a6) # return src op in FP_SRC
- rts
-
-load_dbl_immed:
- lea L_SCR1(%a6), %a1 # pass: ptr to input dbl tmp space
- movq.l &0x8, %d0 # pass: # bytes to read
- bsr.l _imem_read # fetch src operand from memory
-
- tst.l %d1 # did ifetch fail?
- bne.l funimp_iacc # yes
- bra.b load_dbl_cont
-
-# must convert dbl denorm format to an Xprec denorm fmt suitable for
-# normalization...
-# %a0 : loc. of dbl denorm
-get_dbl_denorm:
- clr.w FP_SRC_EX(%a6)
- bfextu (%a0){&12:&31}, %d0 # fetch hi(_mantissa)
- mov.l %d0, FP_SRC_HI(%a6)
- bfextu 4(%a0){&11:&21}, %d0 # fetch lo(_mantissa)
- mov.l &0xb, %d1
- lsl.l %d1, %d0
- mov.l %d0, FP_SRC_LO(%a6)
-
- btst &0x7, (%a0) # is sgn bit set?
- beq.b dbl_dnrm_norm
- bset &0x7, FP_SRC_EX(%a6) # set sgn of xprec value
-
-dbl_dnrm_norm:
- lea FP_SRC(%a6), %a0
- bsr.l norm # normalize number
- mov.w &0x3c01, %d1 # xprec exp = 0x3c01
- sub.w %d0, %d1 # exp = 0x3c01 - shft amt.
- or.w %d1, FP_SRC_EX(%a6) # {sgn,exp}
-
- mov.b &NORM, STAG(%a6) # fix src type tag
- rts
-
-# convert dbl to ext SNAN
-# %a0 : points to dbl SNAN
-get_dbl_snan:
- mov.w &0x7fff, FP_SRC_EX(%a6) # set exp of SNAN
-
- bfextu (%a0){&12:&31}, %d0 # fetch hi(_mantissa)
- mov.l %d0, FP_SRC_HI(%a6)
- bfextu 4(%a0){&11:&21}, %d0 # fetch lo(_mantissa)
- mov.l &0xb, %d1
- lsl.l %d1, %d0
- mov.l %d0, FP_SRC_LO(%a6)
-
- btst &0x7, (%a0) # see if sign of SNAN is set
- beq.b no_dbl_snan_sgn
- bset &0x7, FP_SRC_EX(%a6)
-no_dbl_snan_sgn:
- rts
-
-#################################################
-# load a Xprec into %fp0: #
-# -number can't fault #
-# (1) calc ea #
-# (2) read 12 bytes into L_SCR(1,2) #
-# (3) fmov.x into %fp0 #
-#################################################
-load_ext:
- mov.l &0xc, %d0 # pass: 12 (bytes)
- bsr.l _dcalc_ea # calc <ea>
-
- lea FP_SRC(%a6), %a1 # pass: ptr to input ext tmp space
- mov.l &0xc, %d0 # pass: # of bytes to read
- bsr.l _dmem_read # fetch src operand from memory
-
- tst.l %d1 # did dfetch fail?
- bne.l facc_in_x # yes
-
- lea FP_SRC(%a6), %a0 # pass: ptr to src op
- bsr.l set_tag_x # determine src type tag
-
- cmpi.b %d0, &UNNORM # is the src op an UNNORM?
- beq.b load_ext_unnorm # yes
-
- mov.b %d0, STAG(%a6) # store the src optype tag
- rts
-
-load_ext_unnorm:
- bsr.l unnorm_fix # fix the src UNNORM
- mov.b %d0, STAG(%a6) # store the src optype tag
- rts
-
-#################################################
-# load a packed into %fp0: #
-# -number can't fault #
-# (1) calc ea #
-# (2) read 12 bytes into L_SCR(1,2,3) #
-# (3) fmov.x into %fp0 #
-#################################################
-load_packed:
- bsr.l get_packed
-
- lea FP_SRC(%a6),%a0 # pass ptr to src op
- bsr.l set_tag_x # determine src type tag
- cmpi.b %d0,&UNNORM # is the src op an UNNORM ZERO?
- beq.b load_packed_unnorm # yes
-
- mov.b %d0,STAG(%a6) # store the src optype tag
- rts
-
-load_packed_unnorm:
- bsr.l unnorm_fix # fix the UNNORM ZERO
- mov.b %d0,STAG(%a6) # store the src optype tag
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# fout(): move from fp register to memory or data register #
-# #
-# XREF **************************************************************** #
-# _round() - needed to create EXOP for sgl/dbl precision #
-# norm() - needed to create EXOP for extended precision #
-# ovf_res() - create default overflow result for sgl/dbl precision#
-# unf_res() - create default underflow result for sgl/dbl prec. #
-# dst_dbl() - create rounded dbl precision result. #
-# dst_sgl() - create rounded sgl precision result. #
-# fetch_dreg() - fetch dynamic k-factor reg for packed. #
-# bindec() - convert FP binary number to packed number. #
-# _mem_write() - write data to memory. #
-# _mem_write2() - write data to memory unless supv mode -(a7) exc.#
-# _dmem_write_{byte,word,long}() - write data to memory. #
-# store_dreg_{b,w,l}() - store data to data register file. #
-# facc_out_{b,w,l,d,x}() - data access error occurred. #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# d0 = round prec,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 : intermediate underflow or overflow result if #
-# OVFL/UNFL occurred for a sgl or dbl operand #
-# #
-# ALGORITHM *********************************************************** #
-# This routine is accessed by many handlers that need to do an #
-# opclass three move of an operand out to memory. #
-# Decode an fmove out (opclass 3) instruction to determine if #
-# it's b,w,l,s,d,x, or p in size. b,w,l can be stored to either a data #
-# register or memory. The algorithm uses a standard "fmove" to create #
-# the rounded result. Also, since exceptions are disabled, this also #
-# create the correct OPERR default result if appropriate. #
-# For sgl or dbl precision, overflow or underflow can occur. If #
-# either occurs and is enabled, the EXOP. #
-# For extended precision, the stacked <ea> must be fixed along #
-# w/ the address index register as appropriate w/ _calc_ea_fout(). If #
-# the source is a denorm and if underflow is enabled, an EXOP must be #
-# created. #
-# For packed, the k-factor must be fetched from the instruction #
-# word or a data register. The <ea> must be fixed as w/ extended #
-# precision. Then, bindec() is called to create the appropriate #
-# packed result. #
-# If at any time an access error is flagged by one of the move- #
-# to-memory routines, then a special exit must be made so that the #
-# access error can be handled properly. #
-# #
-#########################################################################
-
- global fout
-fout:
- bfextu EXC_CMDREG(%a6){&3:&3},%d1 # extract dst fmt
- mov.w (tbl_fout.b,%pc,%d1.w*2),%a1 # use as index
- jmp (tbl_fout.b,%pc,%a1) # jump to routine
-
- swbeg &0x8
-tbl_fout:
- short fout_long - tbl_fout
- short fout_sgl - tbl_fout
- short fout_ext - tbl_fout
- short fout_pack - tbl_fout
- short fout_word - tbl_fout
- short fout_dbl - tbl_fout
- short fout_byte - tbl_fout
- short fout_pack - tbl_fout
-
-#################################################################
-# fmove.b out ###################################################
-#################################################################
-
-# Only "Unimplemented Data Type" exceptions enter here. The operand
-# is either a DENORM or a NORM.
-fout_byte:
- tst.b STAG(%a6) # is operand normalized?
- bne.b fout_byte_denorm # no
-
- fmovm.x SRC(%a0),&0x80 # load value
-
-fout_byte_norm:
- fmov.l %d0,%fpcr # insert rnd prec,mode
-
- fmov.b %fp0,%d0 # exec move out w/ correct rnd mode
-
- fmov.l &0x0,%fpcr # clear FPCR
- fmov.l %fpsr,%d1 # fetch FPSR
- or.w %d1,2+USER_FPSR(%a6) # save new exc,accrued bits
-
- mov.b 1+EXC_OPWORD(%a6),%d1 # extract dst mode
- andi.b &0x38,%d1 # is mode == 0? (Dreg dst)
- beq.b fout_byte_dn # must save to integer regfile
-
- mov.l EXC_EA(%a6),%a0 # stacked <ea> is correct
- bsr.l _dmem_write_byte # write byte
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_b # yes
-
- rts
-
-fout_byte_dn:
- mov.b 1+EXC_OPWORD(%a6),%d1 # extract Dn
- andi.w &0x7,%d1
- bsr.l store_dreg_b
- rts
-
-fout_byte_denorm:
- mov.l SRC_EX(%a0),%d1
- andi.l &0x80000000,%d1 # keep DENORM sign
- ori.l &0x00800000,%d1 # make smallest sgl
- fmov.s %d1,%fp0
- bra.b fout_byte_norm
-
-#################################################################
-# fmove.w out ###################################################
-#################################################################
-
-# Only "Unimplemented Data Type" exceptions enter here. The operand
-# is either a DENORM or a NORM.
-fout_word:
- tst.b STAG(%a6) # is operand normalized?
- bne.b fout_word_denorm # no
-
- fmovm.x SRC(%a0),&0x80 # load value
-
-fout_word_norm:
- fmov.l %d0,%fpcr # insert rnd prec:mode
-
- fmov.w %fp0,%d0 # exec move out w/ correct rnd mode
-
- fmov.l &0x0,%fpcr # clear FPCR
- fmov.l %fpsr,%d1 # fetch FPSR
- or.w %d1,2+USER_FPSR(%a6) # save new exc,accrued bits
-
- mov.b 1+EXC_OPWORD(%a6),%d1 # extract dst mode
- andi.b &0x38,%d1 # is mode == 0? (Dreg dst)
- beq.b fout_word_dn # must save to integer regfile
-
- mov.l EXC_EA(%a6),%a0 # stacked <ea> is correct
- bsr.l _dmem_write_word # write word
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_w # yes
-
- rts
-
-fout_word_dn:
- mov.b 1+EXC_OPWORD(%a6),%d1 # extract Dn
- andi.w &0x7,%d1
- bsr.l store_dreg_w
- rts
-
-fout_word_denorm:
- mov.l SRC_EX(%a0),%d1
- andi.l &0x80000000,%d1 # keep DENORM sign
- ori.l &0x00800000,%d1 # make smallest sgl
- fmov.s %d1,%fp0
- bra.b fout_word_norm
-
-#################################################################
-# fmove.l out ###################################################
-#################################################################
-
-# Only "Unimplemented Data Type" exceptions enter here. The operand
-# is either a DENORM or a NORM.
-fout_long:
- tst.b STAG(%a6) # is operand normalized?
- bne.b fout_long_denorm # no
-
- fmovm.x SRC(%a0),&0x80 # load value
-
-fout_long_norm:
- fmov.l %d0,%fpcr # insert rnd prec:mode
-
- fmov.l %fp0,%d0 # exec move out w/ correct rnd mode
-
- fmov.l &0x0,%fpcr # clear FPCR
- fmov.l %fpsr,%d1 # fetch FPSR
- or.w %d1,2+USER_FPSR(%a6) # save new exc,accrued bits
-
-fout_long_write:
- mov.b 1+EXC_OPWORD(%a6),%d1 # extract dst mode
- andi.b &0x38,%d1 # is mode == 0? (Dreg dst)
- beq.b fout_long_dn # must save to integer regfile
-
- mov.l EXC_EA(%a6),%a0 # stacked <ea> is correct
- bsr.l _dmem_write_long # write long
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_l # yes
-
- rts
-
-fout_long_dn:
- mov.b 1+EXC_OPWORD(%a6),%d1 # extract Dn
- andi.w &0x7,%d1
- bsr.l store_dreg_l
- rts
-
-fout_long_denorm:
- mov.l SRC_EX(%a0),%d1
- andi.l &0x80000000,%d1 # keep DENORM sign
- ori.l &0x00800000,%d1 # make smallest sgl
- fmov.s %d1,%fp0
- bra.b fout_long_norm
-
-#################################################################
-# fmove.x out ###################################################
-#################################################################
-
-# Only "Unimplemented Data Type" exceptions enter here. The operand
-# is either a DENORM or a NORM.
-# The DENORM causes an Underflow exception.
-fout_ext:
-
-# we copy the extended precision result to FP_SCR0 so that the reserved
-# 16-bit field gets zeroed. we do this since we promise not to disturb
-# what's at SRC(a0).
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- clr.w 2+FP_SCR0_EX(%a6) # clear reserved field
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
-
- fmovm.x SRC(%a0),&0x80 # return result
-
- bsr.l _calc_ea_fout # fix stacked <ea>
-
- mov.l %a0,%a1 # pass: dst addr
- lea FP_SCR0(%a6),%a0 # pass: src addr
- mov.l &0xc,%d0 # pass: opsize is 12 bytes
-
-# we must not yet write the extended precision data to the stack
-# in the pre-decrement case from supervisor mode or else we'll corrupt
-# the stack frame. so, leave it in FP_SRC for now and deal with it later...
- cmpi.b SPCOND_FLG(%a6),&mda7_flg
- beq.b fout_ext_a7
-
- bsr.l _dmem_write # write ext prec number to memory
-
- tst.l %d1 # did dstore fail?
- bne.w fout_ext_err # yes
-
- tst.b STAG(%a6) # is operand normalized?
- bne.b fout_ext_denorm # no
- rts
-
-# the number is a DENORM. must set the underflow exception bit
-fout_ext_denorm:
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set underflow exc bit
-
- mov.b FPCR_ENABLE(%a6),%d0
- andi.b &0x0a,%d0 # is UNFL or INEX enabled?
- bne.b fout_ext_exc # yes
- rts
-
-# we don't want to do the write if the exception occurred in supervisor mode
-# so _mem_write2() handles this for us.
-fout_ext_a7:
- bsr.l _mem_write2 # write ext prec number to memory
-
- tst.l %d1 # did dstore fail?
- bne.w fout_ext_err # yes
-
- tst.b STAG(%a6) # is operand normalized?
- bne.b fout_ext_denorm # no
- rts
-
-fout_ext_exc:
- lea FP_SCR0(%a6),%a0
- bsr.l norm # normalize the mantissa
- neg.w %d0 # new exp = -(shft amt)
- andi.w &0x7fff,%d0
- andi.w &0x8000,FP_SCR0_EX(%a6) # keep only old sign
- or.w %d0,FP_SCR0_EX(%a6) # insert new exponent
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- rts
-
-fout_ext_err:
- mov.l EXC_A6(%a6),(%a6) # fix stacked a6
- bra.l facc_out_x
-
-#########################################################################
-# fmove.s out ###########################################################
-#########################################################################
-fout_sgl:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &s_mode*0x10,%d0 # insert sgl prec
- mov.l %d0,L_SCR3(%a6) # save rnd prec,mode on stack
-
-#
-# operand is a normalized number. first, we check to see if the move out
-# would cause either an underflow or overflow. these cases are handled
-# separately. otherwise, set the FPCR to the proper rounding mode and
-# execute the move.
-#
- mov.w SRC_EX(%a0),%d0 # extract exponent
- andi.w &0x7fff,%d0 # strip sign
-
- cmpi.w %d0,&SGL_HI # will operand overflow?
- bgt.w fout_sgl_ovfl # yes; go handle OVFL
- beq.w fout_sgl_may_ovfl # maybe; go handle possible OVFL
- cmpi.w %d0,&SGL_LO # will operand underflow?
- blt.w fout_sgl_unfl # yes; go handle underflow
-
-#
-# NORMs(in range) can be stored out by a simple "fmov.s"
-# Unnormalized inputs can come through this point.
-#
-fout_sgl_exg:
- fmovm.x SRC(%a0),&0x80 # fetch fop from stack
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fmov.s %fp0,%d0 # store does convert and round
-
- fmov.l &0x0,%fpcr # clear FPCR
- fmov.l %fpsr,%d1 # save FPSR
-
- or.w %d1,2+USER_FPSR(%a6) # set possible inex2/ainex
-
-fout_sgl_exg_write:
- mov.b 1+EXC_OPWORD(%a6),%d1 # extract dst mode
- andi.b &0x38,%d1 # is mode == 0? (Dreg dst)
- beq.b fout_sgl_exg_write_dn # must save to integer regfile
-
- mov.l EXC_EA(%a6),%a0 # stacked <ea> is correct
- bsr.l _dmem_write_long # write long
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_l # yes
-
- rts
-
-fout_sgl_exg_write_dn:
- mov.b 1+EXC_OPWORD(%a6),%d1 # extract Dn
- andi.w &0x7,%d1
- bsr.l store_dreg_l
- rts
-
-#
-# here, we know that the operand would UNFL if moved out to single prec,
-# so, denorm and round and then use generic store single routine to
-# write the value to memory.
-#
-fout_sgl_unfl:
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set UNFL
-
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- mov.l %a0,-(%sp)
-
- clr.l %d0 # pass: S.F. = 0
-
- cmpi.b STAG(%a6),&DENORM # fetch src optype tag
- bne.b fout_sgl_unfl_cont # let DENORMs fall through
-
- lea FP_SCR0(%a6),%a0
- bsr.l norm # normalize the DENORM
-
-fout_sgl_unfl_cont:
- lea FP_SCR0(%a6),%a0 # pass: ptr to operand
- mov.l L_SCR3(%a6),%d1 # pass: rnd prec,mode
- bsr.l unf_res # calc default underflow result
-
- lea FP_SCR0(%a6),%a0 # pass: ptr to fop
- bsr.l dst_sgl # convert to single prec
-
- mov.b 1+EXC_OPWORD(%a6),%d1 # extract dst mode
- andi.b &0x38,%d1 # is mode == 0? (Dreg dst)
- beq.b fout_sgl_unfl_dn # must save to integer regfile
-
- mov.l EXC_EA(%a6),%a0 # stacked <ea> is correct
- bsr.l _dmem_write_long # write long
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_l # yes
-
- bra.b fout_sgl_unfl_chkexc
-
-fout_sgl_unfl_dn:
- mov.b 1+EXC_OPWORD(%a6),%d1 # extract Dn
- andi.w &0x7,%d1
- bsr.l store_dreg_l
-
-fout_sgl_unfl_chkexc:
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x0a,%d1 # is UNFL or INEX enabled?
- bne.w fout_sd_exc_unfl # yes
- addq.l &0x4,%sp
- rts
-
-#
-# it's definitely an overflow so call ovf_res to get the correct answer
-#
-fout_sgl_ovfl:
- tst.b 3+SRC_HI(%a0) # is result inexact?
- bne.b fout_sgl_ovfl_inex2
- tst.l SRC_LO(%a0) # is result inexact?
- bne.b fout_sgl_ovfl_inex2
- ori.w &ovfl_inx_mask,2+USER_FPSR(%a6) # set ovfl/aovfl/ainex
- bra.b fout_sgl_ovfl_cont
-fout_sgl_ovfl_inex2:
- ori.w &ovfinx_mask,2+USER_FPSR(%a6) # set ovfl/aovfl/ainex/inex2
-
-fout_sgl_ovfl_cont:
- mov.l %a0,-(%sp)
-
-# call ovf_res() w/ sgl prec and the correct rnd mode to create the default
-# overflow result. DON'T save the returned ccodes from ovf_res() since
-# fmove out doesn't alter them.
- tst.b SRC_EX(%a0) # is operand negative?
- smi %d1 # set if so
- mov.l L_SCR3(%a6),%d0 # pass: sgl prec,rnd mode
- bsr.l ovf_res # calc OVFL result
- fmovm.x (%a0),&0x80 # load default overflow result
- fmov.s %fp0,%d0 # store to single
-
- mov.b 1+EXC_OPWORD(%a6),%d1 # extract dst mode
- andi.b &0x38,%d1 # is mode == 0? (Dreg dst)
- beq.b fout_sgl_ovfl_dn # must save to integer regfile
-
- mov.l EXC_EA(%a6),%a0 # stacked <ea> is correct
- bsr.l _dmem_write_long # write long
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_l # yes
-
- bra.b fout_sgl_ovfl_chkexc
-
-fout_sgl_ovfl_dn:
- mov.b 1+EXC_OPWORD(%a6),%d1 # extract Dn
- andi.w &0x7,%d1
- bsr.l store_dreg_l
-
-fout_sgl_ovfl_chkexc:
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x0a,%d1 # is UNFL or INEX enabled?
- bne.w fout_sd_exc_ovfl # yes
- addq.l &0x4,%sp
- rts
-
-#
-# move out MAY overflow:
-# (1) force the exp to 0x3fff
-# (2) do a move w/ appropriate rnd mode
-# (3) if exp still equals zero, then insert original exponent
-# for the correct result.
-# if exp now equals one, then it overflowed so call ovf_res.
-#
-fout_sgl_may_ovfl:
- mov.w SRC_EX(%a0),%d1 # fetch current sign
- andi.w &0x8000,%d1 # keep it,clear exp
- ori.w &0x3fff,%d1 # insert exp = 0
- mov.w %d1,FP_SCR0_EX(%a6) # insert scaled exp
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6) # copy hi(man)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6) # copy lo(man)
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fmov.x FP_SCR0(%a6),%fp0 # force fop to be rounded
- fmov.l &0x0,%fpcr # clear FPCR
-
- fabs.x %fp0 # need absolute value
- fcmp.b %fp0,&0x2 # did exponent increase?
- fblt.w fout_sgl_exg # no; go finish NORM
- bra.w fout_sgl_ovfl # yes; go handle overflow
-
-################
-
-fout_sd_exc_unfl:
- mov.l (%sp)+,%a0
-
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
-
- cmpi.b STAG(%a6),&DENORM # was src a DENORM?
- bne.b fout_sd_exc_cont # no
-
- lea FP_SCR0(%a6),%a0
- bsr.l norm
- neg.l %d0
- andi.w &0x7fff,%d0
- bfins %d0,FP_SCR0_EX(%a6){&1:&15}
- bra.b fout_sd_exc_cont
-
-fout_sd_exc:
-fout_sd_exc_ovfl:
- mov.l (%sp)+,%a0 # restore a0
-
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
-
-fout_sd_exc_cont:
- bclr &0x7,FP_SCR0_EX(%a6) # clear sign bit
- sne.b 2+FP_SCR0_EX(%a6) # set internal sign bit
- lea FP_SCR0(%a6),%a0 # pass: ptr to DENORM
-
- mov.b 3+L_SCR3(%a6),%d1
- lsr.b &0x4,%d1
- andi.w &0x0c,%d1
- swap %d1
- mov.b 3+L_SCR3(%a6),%d1
- lsr.b &0x4,%d1
- andi.w &0x03,%d1
- clr.l %d0 # pass: zero g,r,s
- bsr.l _round # round the DENORM
-
- tst.b 2+FP_SCR0_EX(%a6) # is EXOP negative?
- beq.b fout_sd_exc_done # no
- bset &0x7,FP_SCR0_EX(%a6) # yes
-
-fout_sd_exc_done:
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- rts
-
-#################################################################
-# fmove.d out ###################################################
-#################################################################
-fout_dbl:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &d_mode*0x10,%d0 # insert dbl prec
- mov.l %d0,L_SCR3(%a6) # save rnd prec,mode on stack
-
-#
-# operand is a normalized number. first, we check to see if the move out
-# would cause either an underflow or overflow. these cases are handled
-# separately. otherwise, set the FPCR to the proper rounding mode and
-# execute the move.
-#
- mov.w SRC_EX(%a0),%d0 # extract exponent
- andi.w &0x7fff,%d0 # strip sign
-
- cmpi.w %d0,&DBL_HI # will operand overflow?
- bgt.w fout_dbl_ovfl # yes; go handle OVFL
- beq.w fout_dbl_may_ovfl # maybe; go handle possible OVFL
- cmpi.w %d0,&DBL_LO # will operand underflow?
- blt.w fout_dbl_unfl # yes; go handle underflow
-
-#
-# NORMs(in range) can be stored out by a simple "fmov.d"
-# Unnormalized inputs can come through this point.
-#
-fout_dbl_exg:
- fmovm.x SRC(%a0),&0x80 # fetch fop from stack
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fmov.d %fp0,L_SCR1(%a6) # store does convert and round
-
- fmov.l &0x0,%fpcr # clear FPCR
- fmov.l %fpsr,%d0 # save FPSR
-
- or.w %d0,2+USER_FPSR(%a6) # set possible inex2/ainex
-
- mov.l EXC_EA(%a6),%a1 # pass: dst addr
- lea L_SCR1(%a6),%a0 # pass: src addr
- movq.l &0x8,%d0 # pass: opsize is 8 bytes
- bsr.l _dmem_write # store dbl fop to memory
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_d # yes
-
- rts # no; so we're finished
-
-#
-# here, we know that the operand would UNFL if moved out to double prec,
-# so, denorm and round and then use generic store double routine to
-# write the value to memory.
-#
-fout_dbl_unfl:
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set UNFL
-
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- mov.l %a0,-(%sp)
-
- clr.l %d0 # pass: S.F. = 0
-
- cmpi.b STAG(%a6),&DENORM # fetch src optype tag
- bne.b fout_dbl_unfl_cont # let DENORMs fall through
-
- lea FP_SCR0(%a6),%a0
- bsr.l norm # normalize the DENORM
-
-fout_dbl_unfl_cont:
- lea FP_SCR0(%a6),%a0 # pass: ptr to operand
- mov.l L_SCR3(%a6),%d1 # pass: rnd prec,mode
- bsr.l unf_res # calc default underflow result
-
- lea FP_SCR0(%a6),%a0 # pass: ptr to fop
- bsr.l dst_dbl # convert to single prec
- mov.l %d0,L_SCR1(%a6)
- mov.l %d1,L_SCR2(%a6)
-
- mov.l EXC_EA(%a6),%a1 # pass: dst addr
- lea L_SCR1(%a6),%a0 # pass: src addr
- movq.l &0x8,%d0 # pass: opsize is 8 bytes
- bsr.l _dmem_write # store dbl fop to memory
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_d # yes
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x0a,%d1 # is UNFL or INEX enabled?
- bne.w fout_sd_exc_unfl # yes
- addq.l &0x4,%sp
- rts
-
-#
-# it's definitely an overflow so call ovf_res to get the correct answer
-#
-fout_dbl_ovfl:
- mov.w 2+SRC_LO(%a0),%d0
- andi.w &0x7ff,%d0
- bne.b fout_dbl_ovfl_inex2
-
- ori.w &ovfl_inx_mask,2+USER_FPSR(%a6) # set ovfl/aovfl/ainex
- bra.b fout_dbl_ovfl_cont
-fout_dbl_ovfl_inex2:
- ori.w &ovfinx_mask,2+USER_FPSR(%a6) # set ovfl/aovfl/ainex/inex2
-
-fout_dbl_ovfl_cont:
- mov.l %a0,-(%sp)
-
-# call ovf_res() w/ dbl prec and the correct rnd mode to create the default
-# overflow result. DON'T save the returned ccodes from ovf_res() since
-# fmove out doesn't alter them.
- tst.b SRC_EX(%a0) # is operand negative?
- smi %d1 # set if so
- mov.l L_SCR3(%a6),%d0 # pass: dbl prec,rnd mode
- bsr.l ovf_res # calc OVFL result
- fmovm.x (%a0),&0x80 # load default overflow result
- fmov.d %fp0,L_SCR1(%a6) # store to double
-
- mov.l EXC_EA(%a6),%a1 # pass: dst addr
- lea L_SCR1(%a6),%a0 # pass: src addr
- movq.l &0x8,%d0 # pass: opsize is 8 bytes
- bsr.l _dmem_write # store dbl fop to memory
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_d # yes
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x0a,%d1 # is UNFL or INEX enabled?
- bne.w fout_sd_exc_ovfl # yes
- addq.l &0x4,%sp
- rts
-
-#
-# move out MAY overflow:
-# (1) force the exp to 0x3fff
-# (2) do a move w/ appropriate rnd mode
-# (3) if exp still equals zero, then insert original exponent
-# for the correct result.
-# if exp now equals one, then it overflowed so call ovf_res.
-#
-fout_dbl_may_ovfl:
- mov.w SRC_EX(%a0),%d1 # fetch current sign
- andi.w &0x8000,%d1 # keep it,clear exp
- ori.w &0x3fff,%d1 # insert exp = 0
- mov.w %d1,FP_SCR0_EX(%a6) # insert scaled exp
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6) # copy hi(man)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6) # copy lo(man)
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fmov.x FP_SCR0(%a6),%fp0 # force fop to be rounded
- fmov.l &0x0,%fpcr # clear FPCR
-
- fabs.x %fp0 # need absolute value
- fcmp.b %fp0,&0x2 # did exponent increase?
- fblt.w fout_dbl_exg # no; go finish NORM
- bra.w fout_dbl_ovfl # yes; go handle overflow
-
-#########################################################################
-# XDEF **************************************************************** #
-# dst_dbl(): create double precision value from extended prec. #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to source operand in extended precision #
-# #
-# OUTPUT ************************************************************** #
-# d0 = hi(double precision result) #
-# d1 = lo(double precision result) #
-# #
-# ALGORITHM *********************************************************** #
-# #
-# Changes extended precision to double precision. #
-# Note: no attempt is made to round the extended value to double. #
-# dbl_sign = ext_sign #
-# dbl_exp = ext_exp - $3fff(ext bias) + $7ff(dbl bias) #
-# get rid of ext integer bit #
-# dbl_mant = ext_mant{62:12} #
-# #
-# --------------- --------------- --------------- #
-# extended -> |s| exp | |1| ms mant | | ls mant | #
-# --------------- --------------- --------------- #
-# 95 64 63 62 32 31 11 0 #
-# | | #
-# | | #
-# | | #
-# v v #
-# --------------- --------------- #
-# double -> |s|exp| mant | | mant | #
-# --------------- --------------- #
-# 63 51 32 31 0 #
-# #
-#########################################################################
-
-dst_dbl:
- clr.l %d0 # clear d0
- mov.w FTEMP_EX(%a0),%d0 # get exponent
- subi.w &EXT_BIAS,%d0 # subtract extended precision bias
- addi.w &DBL_BIAS,%d0 # add double precision bias
- tst.b FTEMP_HI(%a0) # is number a denorm?
- bmi.b dst_get_dupper # no
- subq.w &0x1,%d0 # yes; denorm bias = DBL_BIAS - 1
-dst_get_dupper:
- swap %d0 # d0 now in upper word
- lsl.l &0x4,%d0 # d0 in proper place for dbl prec exp
- tst.b FTEMP_EX(%a0) # test sign
- bpl.b dst_get_dman # if positive, go process mantissa
- bset &0x1f,%d0 # if negative, set sign
-dst_get_dman:
- mov.l FTEMP_HI(%a0),%d1 # get ms mantissa
- bfextu %d1{&1:&20},%d1 # get upper 20 bits of ms
- or.l %d1,%d0 # put these bits in ms word of double
- mov.l %d0,L_SCR1(%a6) # put the new exp back on the stack
- mov.l FTEMP_HI(%a0),%d1 # get ms mantissa
- mov.l &21,%d0 # load shift count
- lsl.l %d0,%d1 # put lower 11 bits in upper bits
- mov.l %d1,L_SCR2(%a6) # build lower lword in memory
- mov.l FTEMP_LO(%a0),%d1 # get ls mantissa
- bfextu %d1{&0:&21},%d0 # get ls 21 bits of double
- mov.l L_SCR2(%a6),%d1
- or.l %d0,%d1 # put them in double result
- mov.l L_SCR1(%a6),%d0
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# dst_sgl(): create single precision value from extended prec #
-# #
-# XREF **************************************************************** #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to source operand in extended precision #
-# #
-# OUTPUT ************************************************************** #
-# d0 = single precision result #
-# #
-# ALGORITHM *********************************************************** #
-# #
-# Changes extended precision to single precision. #
-# sgl_sign = ext_sign #
-# sgl_exp = ext_exp - $3fff(ext bias) + $7f(sgl bias) #
-# get rid of ext integer bit #
-# sgl_mant = ext_mant{62:12} #
-# #
-# --------------- --------------- --------------- #
-# extended -> |s| exp | |1| ms mant | | ls mant | #
-# --------------- --------------- --------------- #
-# 95 64 63 62 40 32 31 12 0 #
-# | | #
-# | | #
-# | | #
-# v v #
-# --------------- #
-# single -> |s|exp| mant | #
-# --------------- #
-# 31 22 0 #
-# #
-#########################################################################
-
-dst_sgl:
- clr.l %d0
- mov.w FTEMP_EX(%a0),%d0 # get exponent
- subi.w &EXT_BIAS,%d0 # subtract extended precision bias
- addi.w &SGL_BIAS,%d0 # add single precision bias
- tst.b FTEMP_HI(%a0) # is number a denorm?
- bmi.b dst_get_supper # no
- subq.w &0x1,%d0 # yes; denorm bias = SGL_BIAS - 1
-dst_get_supper:
- swap %d0 # put exp in upper word of d0
- lsl.l &0x7,%d0 # shift it into single exp bits
- tst.b FTEMP_EX(%a0) # test sign
- bpl.b dst_get_sman # if positive, continue
- bset &0x1f,%d0 # if negative, put in sign first
-dst_get_sman:
- mov.l FTEMP_HI(%a0),%d1 # get ms mantissa
- andi.l &0x7fffff00,%d1 # get upper 23 bits of ms
- lsr.l &0x8,%d1 # and put them flush right
- or.l %d1,%d0 # put these bits in ms word of single
- rts
-
-##############################################################################
-fout_pack:
- bsr.l _calc_ea_fout # fetch the <ea>
- mov.l %a0,-(%sp)
-
- mov.b STAG(%a6),%d0 # fetch input type
- bne.w fout_pack_not_norm # input is not NORM
-
-fout_pack_norm:
- btst &0x4,EXC_CMDREG(%a6) # static or dynamic?
- beq.b fout_pack_s # static
-
-fout_pack_d:
- mov.b 1+EXC_CMDREG(%a6),%d1 # fetch dynamic reg
- lsr.b &0x4,%d1
- andi.w &0x7,%d1
-
- bsr.l fetch_dreg # fetch Dn w/ k-factor
-
- bra.b fout_pack_type
-fout_pack_s:
- mov.b 1+EXC_CMDREG(%a6),%d0 # fetch static field
-
-fout_pack_type:
- bfexts %d0{&25:&7},%d0 # extract k-factor
- mov.l %d0,-(%sp)
-
- lea FP_SRC(%a6),%a0 # pass: ptr to input
-
-# bindec is currently scrambling FP_SRC for denorm inputs.
-# we'll have to change this, but for now, tough luck!!!
- bsr.l bindec # convert xprec to packed
-
-# andi.l &0xcfff000f,FP_SCR0(%a6) # clear unused fields
- andi.l &0xcffff00f,FP_SCR0(%a6) # clear unused fields
-
- mov.l (%sp)+,%d0
-
- tst.b 3+FP_SCR0_EX(%a6)
- bne.b fout_pack_set
- tst.l FP_SCR0_HI(%a6)
- bne.b fout_pack_set
- tst.l FP_SCR0_LO(%a6)
- bne.b fout_pack_set
-
-# add the extra condition that only if the k-factor was zero, too, should
-# we zero the exponent
- tst.l %d0
- bne.b fout_pack_set
-# "mantissa" is all zero which means that the answer is zero. but, the '040
-# algorithm allows the exponent to be non-zero. the 881/2 do not. therefore,
-# if the mantissa is zero, I will zero the exponent, too.
-# the question now is whether the exponents sign bit is allowed to be non-zero
-# for a zero, also...
- andi.w &0xf000,FP_SCR0(%a6)
-
-fout_pack_set:
-
- lea FP_SCR0(%a6),%a0 # pass: src addr
-
-fout_pack_write:
- mov.l (%sp)+,%a1 # pass: dst addr
- mov.l &0xc,%d0 # pass: opsize is 12 bytes
-
- cmpi.b SPCOND_FLG(%a6),&mda7_flg
- beq.b fout_pack_a7
-
- bsr.l _dmem_write # write ext prec number to memory
-
- tst.l %d1 # did dstore fail?
- bne.w fout_ext_err # yes
-
- rts
-
-# we don't want to do the write if the exception occurred in supervisor mode
-# so _mem_write2() handles this for us.
-fout_pack_a7:
- bsr.l _mem_write2 # write ext prec number to memory
-
- tst.l %d1 # did dstore fail?
- bne.w fout_ext_err # yes
-
- rts
-
-fout_pack_not_norm:
- cmpi.b %d0,&DENORM # is it a DENORM?
- beq.w fout_pack_norm # yes
- lea FP_SRC(%a6),%a0
- clr.w 2+FP_SRC_EX(%a6)
- cmpi.b %d0,&SNAN # is it an SNAN?
- beq.b fout_pack_snan # yes
- bra.b fout_pack_write # no
-
-fout_pack_snan:
- ori.w &snaniop2_mask,FPSR_EXCEPT(%a6) # set SNAN/AIOP
- bset &0x6,FP_SRC_HI(%a6) # set snan bit
- bra.b fout_pack_write
-
-#########################################################################
-# XDEF **************************************************************** #
-# fetch_dreg(): fetch register according to index in d1 #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# d1 = index of register to fetch from #
-# #
-# OUTPUT ************************************************************** #
-# d0 = value of register fetched #
-# #
-# ALGORITHM *********************************************************** #
-# According to the index value in d1 which can range from zero #
-# to fifteen, load the corresponding register file value (where #
-# address register indexes start at 8). D0/D1/A0/A1/A6/A7 are on the #
-# stack. The rest should still be in their original places. #
-# #
-#########################################################################
-
-# this routine leaves d1 intact for subsequent store_dreg calls.
- global fetch_dreg
-fetch_dreg:
- mov.w (tbl_fdreg.b,%pc,%d1.w*2),%d0
- jmp (tbl_fdreg.b,%pc,%d0.w*1)
-
-tbl_fdreg:
- short fdreg0 - tbl_fdreg
- short fdreg1 - tbl_fdreg
- short fdreg2 - tbl_fdreg
- short fdreg3 - tbl_fdreg
- short fdreg4 - tbl_fdreg
- short fdreg5 - tbl_fdreg
- short fdreg6 - tbl_fdreg
- short fdreg7 - tbl_fdreg
- short fdreg8 - tbl_fdreg
- short fdreg9 - tbl_fdreg
- short fdrega - tbl_fdreg
- short fdregb - tbl_fdreg
- short fdregc - tbl_fdreg
- short fdregd - tbl_fdreg
- short fdrege - tbl_fdreg
- short fdregf - tbl_fdreg
-
-fdreg0:
- mov.l EXC_DREGS+0x0(%a6),%d0
- rts
-fdreg1:
- mov.l EXC_DREGS+0x4(%a6),%d0
- rts
-fdreg2:
- mov.l %d2,%d0
- rts
-fdreg3:
- mov.l %d3,%d0
- rts
-fdreg4:
- mov.l %d4,%d0
- rts
-fdreg5:
- mov.l %d5,%d0
- rts
-fdreg6:
- mov.l %d6,%d0
- rts
-fdreg7:
- mov.l %d7,%d0
- rts
-fdreg8:
- mov.l EXC_DREGS+0x8(%a6),%d0
- rts
-fdreg9:
- mov.l EXC_DREGS+0xc(%a6),%d0
- rts
-fdrega:
- mov.l %a2,%d0
- rts
-fdregb:
- mov.l %a3,%d0
- rts
-fdregc:
- mov.l %a4,%d0
- rts
-fdregd:
- mov.l %a5,%d0
- rts
-fdrege:
- mov.l (%a6),%d0
- rts
-fdregf:
- mov.l EXC_A7(%a6),%d0
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# store_dreg_l(): store longword to data register specified by d1 #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# d0 = longowrd value to store #
-# d1 = index of register to fetch from #
-# #
-# OUTPUT ************************************************************** #
-# (data register is updated) #
-# #
-# ALGORITHM *********************************************************** #
-# According to the index value in d1, store the longword value #
-# in d0 to the corresponding data register. D0/D1 are on the stack #
-# while the rest are in their initial places. #
-# #
-#########################################################################
-
- global store_dreg_l
-store_dreg_l:
- mov.w (tbl_sdregl.b,%pc,%d1.w*2),%d1
- jmp (tbl_sdregl.b,%pc,%d1.w*1)
-
-tbl_sdregl:
- short sdregl0 - tbl_sdregl
- short sdregl1 - tbl_sdregl
- short sdregl2 - tbl_sdregl
- short sdregl3 - tbl_sdregl
- short sdregl4 - tbl_sdregl
- short sdregl5 - tbl_sdregl
- short sdregl6 - tbl_sdregl
- short sdregl7 - tbl_sdregl
-
-sdregl0:
- mov.l %d0,EXC_DREGS+0x0(%a6)
- rts
-sdregl1:
- mov.l %d0,EXC_DREGS+0x4(%a6)
- rts
-sdregl2:
- mov.l %d0,%d2
- rts
-sdregl3:
- mov.l %d0,%d3
- rts
-sdregl4:
- mov.l %d0,%d4
- rts
-sdregl5:
- mov.l %d0,%d5
- rts
-sdregl6:
- mov.l %d0,%d6
- rts
-sdregl7:
- mov.l %d0,%d7
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# store_dreg_w(): store word to data register specified by d1 #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# d0 = word value to store #
-# d1 = index of register to fetch from #
-# #
-# OUTPUT ************************************************************** #
-# (data register is updated) #
-# #
-# ALGORITHM *********************************************************** #
-# According to the index value in d1, store the word value #
-# in d0 to the corresponding data register. D0/D1 are on the stack #
-# while the rest are in their initial places. #
-# #
-#########################################################################
-
- global store_dreg_w
-store_dreg_w:
- mov.w (tbl_sdregw.b,%pc,%d1.w*2),%d1
- jmp (tbl_sdregw.b,%pc,%d1.w*1)
-
-tbl_sdregw:
- short sdregw0 - tbl_sdregw
- short sdregw1 - tbl_sdregw
- short sdregw2 - tbl_sdregw
- short sdregw3 - tbl_sdregw
- short sdregw4 - tbl_sdregw
- short sdregw5 - tbl_sdregw
- short sdregw6 - tbl_sdregw
- short sdregw7 - tbl_sdregw
-
-sdregw0:
- mov.w %d0,2+EXC_DREGS+0x0(%a6)
- rts
-sdregw1:
- mov.w %d0,2+EXC_DREGS+0x4(%a6)
- rts
-sdregw2:
- mov.w %d0,%d2
- rts
-sdregw3:
- mov.w %d0,%d3
- rts
-sdregw4:
- mov.w %d0,%d4
- rts
-sdregw5:
- mov.w %d0,%d5
- rts
-sdregw6:
- mov.w %d0,%d6
- rts
-sdregw7:
- mov.w %d0,%d7
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# store_dreg_b(): store byte to data register specified by d1 #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# d0 = byte value to store #
-# d1 = index of register to fetch from #
-# #
-# OUTPUT ************************************************************** #
-# (data register is updated) #
-# #
-# ALGORITHM *********************************************************** #
-# According to the index value in d1, store the byte value #
-# in d0 to the corresponding data register. D0/D1 are on the stack #
-# while the rest are in their initial places. #
-# #
-#########################################################################
-
- global store_dreg_b
-store_dreg_b:
- mov.w (tbl_sdregb.b,%pc,%d1.w*2),%d1
- jmp (tbl_sdregb.b,%pc,%d1.w*1)
-
-tbl_sdregb:
- short sdregb0 - tbl_sdregb
- short sdregb1 - tbl_sdregb
- short sdregb2 - tbl_sdregb
- short sdregb3 - tbl_sdregb
- short sdregb4 - tbl_sdregb
- short sdregb5 - tbl_sdregb
- short sdregb6 - tbl_sdregb
- short sdregb7 - tbl_sdregb
-
-sdregb0:
- mov.b %d0,3+EXC_DREGS+0x0(%a6)
- rts
-sdregb1:
- mov.b %d0,3+EXC_DREGS+0x4(%a6)
- rts
-sdregb2:
- mov.b %d0,%d2
- rts
-sdregb3:
- mov.b %d0,%d3
- rts
-sdregb4:
- mov.b %d0,%d4
- rts
-sdregb5:
- mov.b %d0,%d5
- rts
-sdregb6:
- mov.b %d0,%d6
- rts
-sdregb7:
- mov.b %d0,%d7
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# inc_areg(): increment an address register by the value in d0 #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# d0 = amount to increment by #
-# d1 = index of address register to increment #
-# #
-# OUTPUT ************************************************************** #
-# (address register is updated) #
-# #
-# ALGORITHM *********************************************************** #
-# Typically used for an instruction w/ a post-increment <ea>, #
-# this routine adds the increment value in d0 to the address register #
-# specified by d1. A0/A1/A6/A7 reside on the stack. The rest reside #
-# in their original places. #
-# For a7, if the increment amount is one, then we have to #
-# increment by two. For any a7 update, set the mia7_flag so that if #
-# an access error exception occurs later in emulation, this address #
-# register update can be undone. #
-# #
-#########################################################################
-
- global inc_areg
-inc_areg:
- mov.w (tbl_iareg.b,%pc,%d1.w*2),%d1
- jmp (tbl_iareg.b,%pc,%d1.w*1)
-
-tbl_iareg:
- short iareg0 - tbl_iareg
- short iareg1 - tbl_iareg
- short iareg2 - tbl_iareg
- short iareg3 - tbl_iareg
- short iareg4 - tbl_iareg
- short iareg5 - tbl_iareg
- short iareg6 - tbl_iareg
- short iareg7 - tbl_iareg
-
-iareg0: add.l %d0,EXC_DREGS+0x8(%a6)
- rts
-iareg1: add.l %d0,EXC_DREGS+0xc(%a6)
- rts
-iareg2: add.l %d0,%a2
- rts
-iareg3: add.l %d0,%a3
- rts
-iareg4: add.l %d0,%a4
- rts
-iareg5: add.l %d0,%a5
- rts
-iareg6: add.l %d0,(%a6)
- rts
-iareg7: mov.b &mia7_flg,SPCOND_FLG(%a6)
- cmpi.b %d0,&0x1
- beq.b iareg7b
- add.l %d0,EXC_A7(%a6)
- rts
-iareg7b:
- addq.l &0x2,EXC_A7(%a6)
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# dec_areg(): decrement an address register by the value in d0 #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# d0 = amount to decrement by #
-# d1 = index of address register to decrement #
-# #
-# OUTPUT ************************************************************** #
-# (address register is updated) #
-# #
-# ALGORITHM *********************************************************** #
-# Typically used for an instruction w/ a pre-decrement <ea>, #
-# this routine adds the decrement value in d0 to the address register #
-# specified by d1. A0/A1/A6/A7 reside on the stack. The rest reside #
-# in their original places. #
-# For a7, if the decrement amount is one, then we have to #
-# decrement by two. For any a7 update, set the mda7_flag so that if #
-# an access error exception occurs later in emulation, this address #
-# register update can be undone. #
-# #
-#########################################################################
-
- global dec_areg
-dec_areg:
- mov.w (tbl_dareg.b,%pc,%d1.w*2),%d1
- jmp (tbl_dareg.b,%pc,%d1.w*1)
-
-tbl_dareg:
- short dareg0 - tbl_dareg
- short dareg1 - tbl_dareg
- short dareg2 - tbl_dareg
- short dareg3 - tbl_dareg
- short dareg4 - tbl_dareg
- short dareg5 - tbl_dareg
- short dareg6 - tbl_dareg
- short dareg7 - tbl_dareg
-
-dareg0: sub.l %d0,EXC_DREGS+0x8(%a6)
- rts
-dareg1: sub.l %d0,EXC_DREGS+0xc(%a6)
- rts
-dareg2: sub.l %d0,%a2
- rts
-dareg3: sub.l %d0,%a3
- rts
-dareg4: sub.l %d0,%a4
- rts
-dareg5: sub.l %d0,%a5
- rts
-dareg6: sub.l %d0,(%a6)
- rts
-dareg7: mov.b &mda7_flg,SPCOND_FLG(%a6)
- cmpi.b %d0,&0x1
- beq.b dareg7b
- sub.l %d0,EXC_A7(%a6)
- rts
-dareg7b:
- subq.l &0x2,EXC_A7(%a6)
- rts
-
-##############################################################################
-
-#########################################################################
-# XDEF **************************************************************** #
-# load_fpn1(): load FP register value into FP_SRC(a6). #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# d0 = index of FP register to load #
-# #
-# OUTPUT ************************************************************** #
-# FP_SRC(a6) = value loaded from FP register file #
-# #
-# ALGORITHM *********************************************************** #
-# Using the index in d0, load FP_SRC(a6) with a number from the #
-# FP register file. #
-# #
-#########################################################################
-
- global load_fpn1
-load_fpn1:
- mov.w (tbl_load_fpn1.b,%pc,%d0.w*2), %d0
- jmp (tbl_load_fpn1.b,%pc,%d0.w*1)
-
-tbl_load_fpn1:
- short load_fpn1_0 - tbl_load_fpn1
- short load_fpn1_1 - tbl_load_fpn1
- short load_fpn1_2 - tbl_load_fpn1
- short load_fpn1_3 - tbl_load_fpn1
- short load_fpn1_4 - tbl_load_fpn1
- short load_fpn1_5 - tbl_load_fpn1
- short load_fpn1_6 - tbl_load_fpn1
- short load_fpn1_7 - tbl_load_fpn1
-
-load_fpn1_0:
- mov.l 0+EXC_FP0(%a6), 0+FP_SRC(%a6)
- mov.l 4+EXC_FP0(%a6), 4+FP_SRC(%a6)
- mov.l 8+EXC_FP0(%a6), 8+FP_SRC(%a6)
- lea FP_SRC(%a6), %a0
- rts
-load_fpn1_1:
- mov.l 0+EXC_FP1(%a6), 0+FP_SRC(%a6)
- mov.l 4+EXC_FP1(%a6), 4+FP_SRC(%a6)
- mov.l 8+EXC_FP1(%a6), 8+FP_SRC(%a6)
- lea FP_SRC(%a6), %a0
- rts
-load_fpn1_2:
- fmovm.x &0x20, FP_SRC(%a6)
- lea FP_SRC(%a6), %a0
- rts
-load_fpn1_3:
- fmovm.x &0x10, FP_SRC(%a6)
- lea FP_SRC(%a6), %a0
- rts
-load_fpn1_4:
- fmovm.x &0x08, FP_SRC(%a6)
- lea FP_SRC(%a6), %a0
- rts
-load_fpn1_5:
- fmovm.x &0x04, FP_SRC(%a6)
- lea FP_SRC(%a6), %a0
- rts
-load_fpn1_6:
- fmovm.x &0x02, FP_SRC(%a6)
- lea FP_SRC(%a6), %a0
- rts
-load_fpn1_7:
- fmovm.x &0x01, FP_SRC(%a6)
- lea FP_SRC(%a6), %a0
- rts
-
-#############################################################################
-
-#########################################################################
-# XDEF **************************************************************** #
-# load_fpn2(): load FP register value into FP_DST(a6). #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# d0 = index of FP register to load #
-# #
-# OUTPUT ************************************************************** #
-# FP_DST(a6) = value loaded from FP register file #
-# #
-# ALGORITHM *********************************************************** #
-# Using the index in d0, load FP_DST(a6) with a number from the #
-# FP register file. #
-# #
-#########################################################################
-
- global load_fpn2
-load_fpn2:
- mov.w (tbl_load_fpn2.b,%pc,%d0.w*2), %d0
- jmp (tbl_load_fpn2.b,%pc,%d0.w*1)
-
-tbl_load_fpn2:
- short load_fpn2_0 - tbl_load_fpn2
- short load_fpn2_1 - tbl_load_fpn2
- short load_fpn2_2 - tbl_load_fpn2
- short load_fpn2_3 - tbl_load_fpn2
- short load_fpn2_4 - tbl_load_fpn2
- short load_fpn2_5 - tbl_load_fpn2
- short load_fpn2_6 - tbl_load_fpn2
- short load_fpn2_7 - tbl_load_fpn2
-
-load_fpn2_0:
- mov.l 0+EXC_FP0(%a6), 0+FP_DST(%a6)
- mov.l 4+EXC_FP0(%a6), 4+FP_DST(%a6)
- mov.l 8+EXC_FP0(%a6), 8+FP_DST(%a6)
- lea FP_DST(%a6), %a0
- rts
-load_fpn2_1:
- mov.l 0+EXC_FP1(%a6), 0+FP_DST(%a6)
- mov.l 4+EXC_FP1(%a6), 4+FP_DST(%a6)
- mov.l 8+EXC_FP1(%a6), 8+FP_DST(%a6)
- lea FP_DST(%a6), %a0
- rts
-load_fpn2_2:
- fmovm.x &0x20, FP_DST(%a6)
- lea FP_DST(%a6), %a0
- rts
-load_fpn2_3:
- fmovm.x &0x10, FP_DST(%a6)
- lea FP_DST(%a6), %a0
- rts
-load_fpn2_4:
- fmovm.x &0x08, FP_DST(%a6)
- lea FP_DST(%a6), %a0
- rts
-load_fpn2_5:
- fmovm.x &0x04, FP_DST(%a6)
- lea FP_DST(%a6), %a0
- rts
-load_fpn2_6:
- fmovm.x &0x02, FP_DST(%a6)
- lea FP_DST(%a6), %a0
- rts
-load_fpn2_7:
- fmovm.x &0x01, FP_DST(%a6)
- lea FP_DST(%a6), %a0
- rts
-
-#############################################################################
-
-#########################################################################
-# XDEF **************************************************************** #
-# store_fpreg(): store an fp value to the fpreg designated d0. #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# fp0 = extended precision value to store #
-# d0 = index of floating-point register #
-# #
-# OUTPUT ************************************************************** #
-# None #
-# #
-# ALGORITHM *********************************************************** #
-# Store the value in fp0 to the FP register designated by the #
-# value in d0. The FP number can be DENORM or SNAN so we have to be #
-# careful that we don't take an exception here. #
-# #
-#########################################################################
-
- global store_fpreg
-store_fpreg:
- mov.w (tbl_store_fpreg.b,%pc,%d0.w*2), %d0
- jmp (tbl_store_fpreg.b,%pc,%d0.w*1)
-
-tbl_store_fpreg:
- short store_fpreg_0 - tbl_store_fpreg
- short store_fpreg_1 - tbl_store_fpreg
- short store_fpreg_2 - tbl_store_fpreg
- short store_fpreg_3 - tbl_store_fpreg
- short store_fpreg_4 - tbl_store_fpreg
- short store_fpreg_5 - tbl_store_fpreg
- short store_fpreg_6 - tbl_store_fpreg
- short store_fpreg_7 - tbl_store_fpreg
-
-store_fpreg_0:
- fmovm.x &0x80, EXC_FP0(%a6)
- rts
-store_fpreg_1:
- fmovm.x &0x80, EXC_FP1(%a6)
- rts
-store_fpreg_2:
- fmovm.x &0x01, -(%sp)
- fmovm.x (%sp)+, &0x20
- rts
-store_fpreg_3:
- fmovm.x &0x01, -(%sp)
- fmovm.x (%sp)+, &0x10
- rts
-store_fpreg_4:
- fmovm.x &0x01, -(%sp)
- fmovm.x (%sp)+, &0x08
- rts
-store_fpreg_5:
- fmovm.x &0x01, -(%sp)
- fmovm.x (%sp)+, &0x04
- rts
-store_fpreg_6:
- fmovm.x &0x01, -(%sp)
- fmovm.x (%sp)+, &0x02
- rts
-store_fpreg_7:
- fmovm.x &0x01, -(%sp)
- fmovm.x (%sp)+, &0x01
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# _denorm(): denormalize an intermediate result #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# a0 = points to the operand to be denormalized #
-# (in the internal extended format) #
-# #
-# d0 = rounding precision #
-# #
-# OUTPUT ************************************************************** #
-# a0 = pointer to the denormalized result #
-# (in the internal extended format) #
-# #
-# d0 = guard,round,sticky #
-# #
-# ALGORITHM *********************************************************** #
-# According to the exponent underflow threshold for the given #
-# precision, shift the mantissa bits to the right in order raise the #
-# exponent of the operand to the threshold value. While shifting the #
-# mantissa bits right, maintain the value of the guard, round, and #
-# sticky bits. #
-# other notes: #
-# (1) _denorm() is called by the underflow routines #
-# (2) _denorm() does NOT affect the status register #
-# #
-#########################################################################
-
-#
-# table of exponent threshold values for each precision
-#
-tbl_thresh:
- short 0x0
- short sgl_thresh
- short dbl_thresh
-
- global _denorm
-_denorm:
-#
-# Load the exponent threshold for the precision selected and check
-# to see if (threshold - exponent) is > 65 in which case we can
-# simply calculate the sticky bit and zero the mantissa. otherwise
-# we have to call the denormalization routine.
-#
- lsr.b &0x2, %d0 # shift prec to lo bits
- mov.w (tbl_thresh.b,%pc,%d0.w*2), %d1 # load prec threshold
- mov.w %d1, %d0 # copy d1 into d0
- sub.w FTEMP_EX(%a0), %d0 # diff = threshold - exp
- cmpi.w %d0, &66 # is diff > 65? (mant + g,r bits)
- bpl.b denorm_set_stky # yes; just calc sticky
-
- clr.l %d0 # clear g,r,s
- btst &inex2_bit, FPSR_EXCEPT(%a6) # yes; was INEX2 set?
- beq.b denorm_call # no; don't change anything
- bset &29, %d0 # yes; set sticky bit
-
-denorm_call:
- bsr.l dnrm_lp # denormalize the number
- rts
-
-#
-# all bit would have been shifted off during the denorm so simply
-# calculate if the sticky should be set and clear the entire mantissa.
-#
-denorm_set_stky:
- mov.l &0x20000000, %d0 # set sticky bit in return value
- mov.w %d1, FTEMP_EX(%a0) # load exp with threshold
- clr.l FTEMP_HI(%a0) # set d1 = 0 (ms mantissa)
- clr.l FTEMP_LO(%a0) # set d2 = 0 (ms mantissa)
- rts
-
-# #
-# dnrm_lp(): normalize exponent/mantissa to specified threshold #
-# #
-# INPUT: #
-# %a0 : points to the operand to be denormalized #
-# %d0{31:29} : initial guard,round,sticky #
-# %d1{15:0} : denormalization threshold #
-# OUTPUT: #
-# %a0 : points to the denormalized operand #
-# %d0{31:29} : final guard,round,sticky #
-# #
-
-# *** Local Equates *** #
-set GRS, L_SCR2 # g,r,s temp storage
-set FTEMP_LO2, L_SCR1 # FTEMP_LO copy
-
- global dnrm_lp
-dnrm_lp:
-
-#
-# make a copy of FTEMP_LO and place the g,r,s bits directly after it
-# in memory so as to make the bitfield extraction for denormalization easier.
-#
- mov.l FTEMP_LO(%a0), FTEMP_LO2(%a6) # make FTEMP_LO copy
- mov.l %d0, GRS(%a6) # place g,r,s after it
-
-#
-# check to see how much less than the underflow threshold the operand
-# exponent is.
-#
- mov.l %d1, %d0 # copy the denorm threshold
- sub.w FTEMP_EX(%a0), %d1 # d1 = threshold - uns exponent
- ble.b dnrm_no_lp # d1 <= 0
- cmpi.w %d1, &0x20 # is ( 0 <= d1 < 32) ?
- blt.b case_1 # yes
- cmpi.w %d1, &0x40 # is (32 <= d1 < 64) ?
- blt.b case_2 # yes
- bra.w case_3 # (d1 >= 64)
-
-#
-# No normalization necessary
-#
-dnrm_no_lp:
- mov.l GRS(%a6), %d0 # restore original g,r,s
- rts
-
-#
-# case (0<d1<32)
-#
-# %d0 = denorm threshold
-# %d1 = "n" = amt to shift
-#
-# ---------------------------------------------------------
-# | FTEMP_HI | FTEMP_LO |grs000.........000|
-# ---------------------------------------------------------
-# <-(32 - n)-><-(n)-><-(32 - n)-><-(n)-><-(32 - n)-><-(n)->
-# \ \ \ \
-# \ \ \ \
-# \ \ \ \
-# \ \ \ \
-# \ \ \ \
-# \ \ \ \
-# \ \ \ \
-# \ \ \ \
-# <-(n)-><-(32 - n)-><------(32)-------><------(32)------->
-# ---------------------------------------------------------
-# |0.....0| NEW_HI | NEW_FTEMP_LO |grs |
-# ---------------------------------------------------------
-#
-case_1:
- mov.l %d2, -(%sp) # create temp storage
-
- mov.w %d0, FTEMP_EX(%a0) # exponent = denorm threshold
- mov.l &32, %d0
- sub.w %d1, %d0 # %d0 = 32 - %d1
-
- cmpi.w %d1, &29 # is shft amt >= 29
- blt.b case1_extract # no; no fix needed
- mov.b GRS(%a6), %d2
- or.b %d2, 3+FTEMP_LO2(%a6)
-
-case1_extract:
- bfextu FTEMP_HI(%a0){&0:%d0}, %d2 # %d2 = new FTEMP_HI
- bfextu FTEMP_HI(%a0){%d0:&32}, %d1 # %d1 = new FTEMP_LO
- bfextu FTEMP_LO2(%a6){%d0:&32}, %d0 # %d0 = new G,R,S
-
- mov.l %d2, FTEMP_HI(%a0) # store new FTEMP_HI
- mov.l %d1, FTEMP_LO(%a0) # store new FTEMP_LO
-
- bftst %d0{&2:&30} # were bits shifted off?
- beq.b case1_sticky_clear # no; go finish
- bset &rnd_stky_bit, %d0 # yes; set sticky bit
-
-case1_sticky_clear:
- and.l &0xe0000000, %d0 # clear all but G,R,S
- mov.l (%sp)+, %d2 # restore temp register
- rts
-
-#
-# case (32<=d1<64)
-#
-# %d0 = denorm threshold
-# %d1 = "n" = amt to shift
-#
-# ---------------------------------------------------------
-# | FTEMP_HI | FTEMP_LO |grs000.........000|
-# ---------------------------------------------------------
-# <-(32 - n)-><-(n)-><-(32 - n)-><-(n)-><-(32 - n)-><-(n)->
-# \ \ \
-# \ \ \
-# \ \ -------------------
-# \ -------------------- \
-# ------------------- \ \
-# \ \ \
-# \ \ \
-# \ \ \
-# <-------(32)------><-(n)-><-(32 - n)-><------(32)------->
-# ---------------------------------------------------------
-# |0...............0|0....0| NEW_LO |grs |
-# ---------------------------------------------------------
-#
-case_2:
- mov.l %d2, -(%sp) # create temp storage
-
- mov.w %d0, FTEMP_EX(%a0) # exponent = denorm threshold
- subi.w &0x20, %d1 # %d1 now between 0 and 32
- mov.l &0x20, %d0
- sub.w %d1, %d0 # %d0 = 32 - %d1
-
-# subtle step here; or in the g,r,s at the bottom of FTEMP_LO to minimize
-# the number of bits to check for the sticky detect.
-# it only plays a role in shift amounts of 61-63.
- mov.b GRS(%a6), %d2
- or.b %d2, 3+FTEMP_LO2(%a6)
-
- bfextu FTEMP_HI(%a0){&0:%d0}, %d2 # %d2 = new FTEMP_LO
- bfextu FTEMP_HI(%a0){%d0:&32}, %d1 # %d1 = new G,R,S
-
- bftst %d1{&2:&30} # were any bits shifted off?
- bne.b case2_set_sticky # yes; set sticky bit
- bftst FTEMP_LO2(%a6){%d0:&31} # were any bits shifted off?
- bne.b case2_set_sticky # yes; set sticky bit
-
- mov.l %d1, %d0 # move new G,R,S to %d0
- bra.b case2_end
-
-case2_set_sticky:
- mov.l %d1, %d0 # move new G,R,S to %d0
- bset &rnd_stky_bit, %d0 # set sticky bit
-
-case2_end:
- clr.l FTEMP_HI(%a0) # store FTEMP_HI = 0
- mov.l %d2, FTEMP_LO(%a0) # store FTEMP_LO
- and.l &0xe0000000, %d0 # clear all but G,R,S
-
- mov.l (%sp)+,%d2 # restore temp register
- rts
-
-#
-# case (d1>=64)
-#
-# %d0 = denorm threshold
-# %d1 = amt to shift
-#
-case_3:
- mov.w %d0, FTEMP_EX(%a0) # insert denorm threshold
-
- cmpi.w %d1, &65 # is shift amt > 65?
- blt.b case3_64 # no; it's == 64
- beq.b case3_65 # no; it's == 65
-
-#
-# case (d1>65)
-#
-# Shift value is > 65 and out of range. All bits are shifted off.
-# Return a zero mantissa with the sticky bit set
-#
- clr.l FTEMP_HI(%a0) # clear hi(mantissa)
- clr.l FTEMP_LO(%a0) # clear lo(mantissa)
- mov.l &0x20000000, %d0 # set sticky bit
- rts
-
-#
-# case (d1 == 64)
-#
-# ---------------------------------------------------------
-# | FTEMP_HI | FTEMP_LO |grs000.........000|
-# ---------------------------------------------------------
-# <-------(32)------>
-# \ \
-# \ \
-# \ \
-# \ ------------------------------
-# ------------------------------- \
-# \ \
-# \ \
-# \ \
-# <-------(32)------>
-# ---------------------------------------------------------
-# |0...............0|0................0|grs |
-# ---------------------------------------------------------
-#
-case3_64:
- mov.l FTEMP_HI(%a0), %d0 # fetch hi(mantissa)
- mov.l %d0, %d1 # make a copy
- and.l &0xc0000000, %d0 # extract G,R
- and.l &0x3fffffff, %d1 # extract other bits
-
- bra.b case3_complete
-
-#
-# case (d1 == 65)
-#
-# ---------------------------------------------------------
-# | FTEMP_HI | FTEMP_LO |grs000.........000|
-# ---------------------------------------------------------
-# <-------(32)------>
-# \ \
-# \ \
-# \ \
-# \ ------------------------------
-# -------------------------------- \
-# \ \
-# \ \
-# \ \
-# <-------(31)----->
-# ---------------------------------------------------------
-# |0...............0|0................0|0rs |
-# ---------------------------------------------------------
-#
-case3_65:
- mov.l FTEMP_HI(%a0), %d0 # fetch hi(mantissa)
- and.l &0x80000000, %d0 # extract R bit
- lsr.l &0x1, %d0 # shift high bit into R bit
- and.l &0x7fffffff, %d1 # extract other bits
-
-case3_complete:
-# last operation done was an "and" of the bits shifted off so the condition
-# codes are already set so branch accordingly.
- bne.b case3_set_sticky # yes; go set new sticky
- tst.l FTEMP_LO(%a0) # were any bits shifted off?
- bne.b case3_set_sticky # yes; go set new sticky
- tst.b GRS(%a6) # were any bits shifted off?
- bne.b case3_set_sticky # yes; go set new sticky
-
-#
-# no bits were shifted off so don't set the sticky bit.
-# the guard and
-# the entire mantissa is zero.
-#
- clr.l FTEMP_HI(%a0) # clear hi(mantissa)
- clr.l FTEMP_LO(%a0) # clear lo(mantissa)
- rts
-
-#
-# some bits were shifted off so set the sticky bit.
-# the entire mantissa is zero.
-#
-case3_set_sticky:
- bset &rnd_stky_bit,%d0 # set new sticky bit
- clr.l FTEMP_HI(%a0) # clear hi(mantissa)
- clr.l FTEMP_LO(%a0) # clear lo(mantissa)
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# _round(): round result according to precision/mode #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# a0 = ptr to input operand in internal extended format #
-# d1(hi) = contains rounding precision: #
-# ext = $0000xxxx #
-# sgl = $0004xxxx #
-# dbl = $0008xxxx #
-# d1(lo) = contains rounding mode: #
-# RN = $xxxx0000 #
-# RZ = $xxxx0001 #
-# RM = $xxxx0002 #
-# RP = $xxxx0003 #
-# d0{31:29} = contains the g,r,s bits (extended) #
-# #
-# OUTPUT ************************************************************** #
-# a0 = pointer to rounded result #
-# #
-# ALGORITHM *********************************************************** #
-# On return the value pointed to by a0 is correctly rounded, #
-# a0 is preserved and the g-r-s bits in d0 are cleared. #
-# The result is not typed - the tag field is invalid. The #
-# result is still in the internal extended format. #
-# #
-# The INEX bit of USER_FPSR will be set if the rounded result was #
-# inexact (i.e. if any of the g-r-s bits were set). #
-# #
-#########################################################################
-
- global _round
-_round:
-#
-# ext_grs() looks at the rounding precision and sets the appropriate
-# G,R,S bits.
-# If (G,R,S == 0) then result is exact and round is done, else set
-# the inex flag in status reg and continue.
-#
- bsr.l ext_grs # extract G,R,S
-
- tst.l %d0 # are G,R,S zero?
- beq.w truncate # yes; round is complete
-
- or.w &inx2a_mask, 2+USER_FPSR(%a6) # set inex2/ainex
-
-#
-# Use rounding mode as an index into a jump table for these modes.
-# All of the following assumes grs != 0.
-#
- mov.w (tbl_mode.b,%pc,%d1.w*2), %a1 # load jump offset
- jmp (tbl_mode.b,%pc,%a1) # jmp to rnd mode handler
-
-tbl_mode:
- short rnd_near - tbl_mode
- short truncate - tbl_mode # RZ always truncates
- short rnd_mnus - tbl_mode
- short rnd_plus - tbl_mode
-
-#################################################################
-# ROUND PLUS INFINITY #
-# #
-# If sign of fp number = 0 (positive), then add 1 to l. #
-#################################################################
-rnd_plus:
- tst.b FTEMP_SGN(%a0) # check for sign
- bmi.w truncate # if positive then truncate
-
- mov.l &0xffffffff, %d0 # force g,r,s to be all f's
- swap %d1 # set up d1 for round prec.
-
- cmpi.b %d1, &s_mode # is prec = sgl?
- beq.w add_sgl # yes
- bgt.w add_dbl # no; it's dbl
- bra.w add_ext # no; it's ext
-
-#################################################################
-# ROUND MINUS INFINITY #
-# #
-# If sign of fp number = 1 (negative), then add 1 to l. #
-#################################################################
-rnd_mnus:
- tst.b FTEMP_SGN(%a0) # check for sign
- bpl.w truncate # if negative then truncate
-
- mov.l &0xffffffff, %d0 # force g,r,s to be all f's
- swap %d1 # set up d1 for round prec.
-
- cmpi.b %d1, &s_mode # is prec = sgl?
- beq.w add_sgl # yes
- bgt.w add_dbl # no; it's dbl
- bra.w add_ext # no; it's ext
-
-#################################################################
-# ROUND NEAREST #
-# #
-# If (g=1), then add 1 to l and if (r=s=0), then clear l #
-# Note that this will round to even in case of a tie. #
-#################################################################
-rnd_near:
- asl.l &0x1, %d0 # shift g-bit to c-bit
- bcc.w truncate # if (g=1) then
-
- swap %d1 # set up d1 for round prec.
-
- cmpi.b %d1, &s_mode # is prec = sgl?
- beq.w add_sgl # yes
- bgt.w add_dbl # no; it's dbl
- bra.w add_ext # no; it's ext
-
-# *** LOCAL EQUATES ***
-set ad_1_sgl, 0x00000100 # constant to add 1 to l-bit in sgl prec
-set ad_1_dbl, 0x00000800 # constant to add 1 to l-bit in dbl prec
-
-#########################
-# ADD SINGLE #
-#########################
-add_sgl:
- add.l &ad_1_sgl, FTEMP_HI(%a0)
- bcc.b scc_clr # no mantissa overflow
- roxr.w FTEMP_HI(%a0) # shift v-bit back in
- roxr.w FTEMP_HI+2(%a0) # shift v-bit back in
- add.w &0x1, FTEMP_EX(%a0) # and incr exponent
-scc_clr:
- tst.l %d0 # test for rs = 0
- bne.b sgl_done
- and.w &0xfe00, FTEMP_HI+2(%a0) # clear the l-bit
-sgl_done:
- and.l &0xffffff00, FTEMP_HI(%a0) # truncate bits beyond sgl limit
- clr.l FTEMP_LO(%a0) # clear d2
- rts
-
-#########################
-# ADD EXTENDED #
-#########################
-add_ext:
- addq.l &1,FTEMP_LO(%a0) # add 1 to l-bit
- bcc.b xcc_clr # test for carry out
- addq.l &1,FTEMP_HI(%a0) # propagate carry
- bcc.b xcc_clr
- roxr.w FTEMP_HI(%a0) # mant is 0 so restore v-bit
- roxr.w FTEMP_HI+2(%a0) # mant is 0 so restore v-bit
- roxr.w FTEMP_LO(%a0)
- roxr.w FTEMP_LO+2(%a0)
- add.w &0x1,FTEMP_EX(%a0) # and inc exp
-xcc_clr:
- tst.l %d0 # test rs = 0
- bne.b add_ext_done
- and.b &0xfe,FTEMP_LO+3(%a0) # clear the l bit
-add_ext_done:
- rts
-
-#########################
-# ADD DOUBLE #
-#########################
-add_dbl:
- add.l &ad_1_dbl, FTEMP_LO(%a0) # add 1 to lsb
- bcc.b dcc_clr # no carry
- addq.l &0x1, FTEMP_HI(%a0) # propagate carry
- bcc.b dcc_clr # no carry
-
- roxr.w FTEMP_HI(%a0) # mant is 0 so restore v-bit
- roxr.w FTEMP_HI+2(%a0) # mant is 0 so restore v-bit
- roxr.w FTEMP_LO(%a0)
- roxr.w FTEMP_LO+2(%a0)
- addq.w &0x1, FTEMP_EX(%a0) # incr exponent
-dcc_clr:
- tst.l %d0 # test for rs = 0
- bne.b dbl_done
- and.w &0xf000, FTEMP_LO+2(%a0) # clear the l-bit
-
-dbl_done:
- and.l &0xfffff800,FTEMP_LO(%a0) # truncate bits beyond dbl limit
- rts
-
-###########################
-# Truncate all other bits #
-###########################
-truncate:
- swap %d1 # select rnd prec
-
- cmpi.b %d1, &s_mode # is prec sgl?
- beq.w sgl_done # yes
- bgt.b dbl_done # no; it's dbl
- rts # no; it's ext
-
-
-#
-# ext_grs(): extract guard, round and sticky bits according to
-# rounding precision.
-#
-# INPUT
-# d0 = extended precision g,r,s (in d0{31:29})
-# d1 = {PREC,ROUND}
-# OUTPUT
-# d0{31:29} = guard, round, sticky
-#
-# The ext_grs extract the guard/round/sticky bits according to the
-# selected rounding precision. It is called by the round subroutine
-# only. All registers except d0 are kept intact. d0 becomes an
-# updated guard,round,sticky in d0{31:29}
-#
-# Notes: the ext_grs uses the round PREC, and therefore has to swap d1
-# prior to usage, and needs to restore d1 to original. this
-# routine is tightly tied to the round routine and not meant to
-# uphold standard subroutine calling practices.
-#
-
-ext_grs:
- swap %d1 # have d1.w point to round precision
- tst.b %d1 # is rnd prec = extended?
- bne.b ext_grs_not_ext # no; go handle sgl or dbl
-
-#
-# %d0 actually already hold g,r,s since _round() had it before calling
-# this function. so, as long as we don't disturb it, we are "returning" it.
-#
-ext_grs_ext:
- swap %d1 # yes; return to correct positions
- rts
-
-ext_grs_not_ext:
- movm.l &0x3000, -(%sp) # make some temp registers {d2/d3}
-
- cmpi.b %d1, &s_mode # is rnd prec = sgl?
- bne.b ext_grs_dbl # no; go handle dbl
-
-#
-# sgl:
-# 96 64 40 32 0
-# -----------------------------------------------------
-# | EXP |XXXXXXX| |xx | |grs|
-# -----------------------------------------------------
-# <--(24)--->nn\ /
-# ee ---------------------
-# ww |
-# v
-# gr new sticky
-#
-ext_grs_sgl:
- bfextu FTEMP_HI(%a0){&24:&2}, %d3 # sgl prec. g-r are 2 bits right
- mov.l &30, %d2 # of the sgl prec. limits
- lsl.l %d2, %d3 # shift g-r bits to MSB of d3
- mov.l FTEMP_HI(%a0), %d2 # get word 2 for s-bit test
- and.l &0x0000003f, %d2 # s bit is the or of all other
- bne.b ext_grs_st_stky # bits to the right of g-r
- tst.l FTEMP_LO(%a0) # test lower mantissa
- bne.b ext_grs_st_stky # if any are set, set sticky
- tst.l %d0 # test original g,r,s
- bne.b ext_grs_st_stky # if any are set, set sticky
- bra.b ext_grs_end_sd # if words 3 and 4 are clr, exit
-
-#
-# dbl:
-# 96 64 32 11 0
-# -----------------------------------------------------
-# | EXP |XXXXXXX| | |xx |grs|
-# -----------------------------------------------------
-# nn\ /
-# ee -------
-# ww |
-# v
-# gr new sticky
-#
-ext_grs_dbl:
- bfextu FTEMP_LO(%a0){&21:&2}, %d3 # dbl-prec. g-r are 2 bits right
- mov.l &30, %d2 # of the dbl prec. limits
- lsl.l %d2, %d3 # shift g-r bits to the MSB of d3
- mov.l FTEMP_LO(%a0), %d2 # get lower mantissa for s-bit test
- and.l &0x000001ff, %d2 # s bit is the or-ing of all
- bne.b ext_grs_st_stky # other bits to the right of g-r
- tst.l %d0 # test word original g,r,s
- bne.b ext_grs_st_stky # if any are set, set sticky
- bra.b ext_grs_end_sd # if clear, exit
-
-ext_grs_st_stky:
- bset &rnd_stky_bit, %d3 # set sticky bit
-ext_grs_end_sd:
- mov.l %d3, %d0 # return grs to d0
-
- movm.l (%sp)+, &0xc # restore scratch registers {d2/d3}
-
- swap %d1 # restore d1 to original
- rts
-
-#########################################################################
-# norm(): normalize the mantissa of an extended precision input. the #
-# input operand should not be normalized already. #
-# #
-# XDEF **************************************************************** #
-# norm() #
-# #
-# XREF **************************************************************** #
-# none #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer fp extended precision operand to normalize #
-# #
-# OUTPUT ************************************************************** #
-# d0 = number of bit positions the mantissa was shifted #
-# a0 = the input operand's mantissa is normalized; the exponent #
-# is unchanged. #
-# #
-#########################################################################
- global norm
-norm:
- mov.l %d2, -(%sp) # create some temp regs
- mov.l %d3, -(%sp)
-
- mov.l FTEMP_HI(%a0), %d0 # load hi(mantissa)
- mov.l FTEMP_LO(%a0), %d1 # load lo(mantissa)
-
- bfffo %d0{&0:&32}, %d2 # how many places to shift?
- beq.b norm_lo # hi(man) is all zeroes!
-
-norm_hi:
- lsl.l %d2, %d0 # left shift hi(man)
- bfextu %d1{&0:%d2}, %d3 # extract lo bits
-
- or.l %d3, %d0 # create hi(man)
- lsl.l %d2, %d1 # create lo(man)
-
- mov.l %d0, FTEMP_HI(%a0) # store new hi(man)
- mov.l %d1, FTEMP_LO(%a0) # store new lo(man)
-
- mov.l %d2, %d0 # return shift amount
-
- mov.l (%sp)+, %d3 # restore temp regs
- mov.l (%sp)+, %d2
-
- rts
-
-norm_lo:
- bfffo %d1{&0:&32}, %d2 # how many places to shift?
- lsl.l %d2, %d1 # shift lo(man)
- add.l &32, %d2 # add 32 to shft amount
-
- mov.l %d1, FTEMP_HI(%a0) # store hi(man)
- clr.l FTEMP_LO(%a0) # lo(man) is now zero
-
- mov.l %d2, %d0 # return shift amount
-
- mov.l (%sp)+, %d3 # restore temp regs
- mov.l (%sp)+, %d2
-
- rts
-
-#########################################################################
-# unnorm_fix(): - changes an UNNORM to one of NORM, DENORM, or ZERO #
-# - returns corresponding optype tag #
-# #
-# XDEF **************************************************************** #
-# unnorm_fix() #
-# #
-# XREF **************************************************************** #
-# norm() - normalize the mantissa #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to unnormalized extended precision number #
-# #
-# OUTPUT ************************************************************** #
-# d0 = optype tag - is corrected to one of NORM, DENORM, or ZERO #
-# a0 = input operand has been converted to a norm, denorm, or #
-# zero; both the exponent and mantissa are changed. #
-# #
-#########################################################################
-
- global unnorm_fix
-unnorm_fix:
- bfffo FTEMP_HI(%a0){&0:&32}, %d0 # how many shifts are needed?
- bne.b unnorm_shift # hi(man) is not all zeroes
-
-#
-# hi(man) is all zeroes so see if any bits in lo(man) are set
-#
-unnorm_chk_lo:
- bfffo FTEMP_LO(%a0){&0:&32}, %d0 # is operand really a zero?
- beq.w unnorm_zero # yes
-
- add.w &32, %d0 # no; fix shift distance
-
-#
-# d0 = # shifts needed for complete normalization
-#
-unnorm_shift:
- clr.l %d1 # clear top word
- mov.w FTEMP_EX(%a0), %d1 # extract exponent
- and.w &0x7fff, %d1 # strip off sgn
-
- cmp.w %d0, %d1 # will denorm push exp < 0?
- bgt.b unnorm_nrm_zero # yes; denorm only until exp = 0
-
-#
-# exponent would not go < 0. therefore, number stays normalized
-#
- sub.w %d0, %d1 # shift exponent value
- mov.w FTEMP_EX(%a0), %d0 # load old exponent
- and.w &0x8000, %d0 # save old sign
- or.w %d0, %d1 # {sgn,new exp}
- mov.w %d1, FTEMP_EX(%a0) # insert new exponent
-
- bsr.l norm # normalize UNNORM
-
- mov.b &NORM, %d0 # return new optype tag
- rts
-
-#
-# exponent would go < 0, so only denormalize until exp = 0
-#
-unnorm_nrm_zero:
- cmp.b %d1, &32 # is exp <= 32?
- bgt.b unnorm_nrm_zero_lrg # no; go handle large exponent
-
- bfextu FTEMP_HI(%a0){%d1:&32}, %d0 # extract new hi(man)
- mov.l %d0, FTEMP_HI(%a0) # save new hi(man)
-
- mov.l FTEMP_LO(%a0), %d0 # fetch old lo(man)
- lsl.l %d1, %d0 # extract new lo(man)
- mov.l %d0, FTEMP_LO(%a0) # save new lo(man)
-
- and.w &0x8000, FTEMP_EX(%a0) # set exp = 0
-
- mov.b &DENORM, %d0 # return new optype tag
- rts
-
-#
-# only mantissa bits set are in lo(man)
-#
-unnorm_nrm_zero_lrg:
- sub.w &32, %d1 # adjust shft amt by 32
-
- mov.l FTEMP_LO(%a0), %d0 # fetch old lo(man)
- lsl.l %d1, %d0 # left shift lo(man)
-
- mov.l %d0, FTEMP_HI(%a0) # store new hi(man)
- clr.l FTEMP_LO(%a0) # lo(man) = 0
-
- and.w &0x8000, FTEMP_EX(%a0) # set exp = 0
-
- mov.b &DENORM, %d0 # return new optype tag
- rts
-
-#
-# whole mantissa is zero so this UNNORM is actually a zero
-#
-unnorm_zero:
- and.w &0x8000, FTEMP_EX(%a0) # force exponent to zero
-
- mov.b &ZERO, %d0 # fix optype tag
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# set_tag_x(): return the optype of the input ext fp number #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision operand #
-# #
-# OUTPUT ************************************************************** #
-# d0 = value of type tag #
-# one of: NORM, INF, QNAN, SNAN, DENORM, UNNORM, ZERO #
-# #
-# ALGORITHM *********************************************************** #
-# Simply test the exponent, j-bit, and mantissa values to #
-# determine the type of operand. #
-# If it's an unnormalized zero, alter the operand and force it #
-# to be a normal zero. #
-# #
-#########################################################################
-
- global set_tag_x
-set_tag_x:
- mov.w FTEMP_EX(%a0), %d0 # extract exponent
- andi.w &0x7fff, %d0 # strip off sign
- cmpi.w %d0, &0x7fff # is (EXP == MAX)?
- beq.b inf_or_nan_x
-not_inf_or_nan_x:
- btst &0x7,FTEMP_HI(%a0)
- beq.b not_norm_x
-is_norm_x:
- mov.b &NORM, %d0
- rts
-not_norm_x:
- tst.w %d0 # is exponent = 0?
- bne.b is_unnorm_x
-not_unnorm_x:
- tst.l FTEMP_HI(%a0)
- bne.b is_denorm_x
- tst.l FTEMP_LO(%a0)
- bne.b is_denorm_x
-is_zero_x:
- mov.b &ZERO, %d0
- rts
-is_denorm_x:
- mov.b &DENORM, %d0
- rts
-# must distinguish now "Unnormalized zeroes" which we
-# must convert to zero.
-is_unnorm_x:
- tst.l FTEMP_HI(%a0)
- bne.b is_unnorm_reg_x
- tst.l FTEMP_LO(%a0)
- bne.b is_unnorm_reg_x
-# it's an "unnormalized zero". let's convert it to an actual zero...
- andi.w &0x8000,FTEMP_EX(%a0) # clear exponent
- mov.b &ZERO, %d0
- rts
-is_unnorm_reg_x:
- mov.b &UNNORM, %d0
- rts
-inf_or_nan_x:
- tst.l FTEMP_LO(%a0)
- bne.b is_nan_x
- mov.l FTEMP_HI(%a0), %d0
- and.l &0x7fffffff, %d0 # msb is a don't care!
- bne.b is_nan_x
-is_inf_x:
- mov.b &INF, %d0
- rts
-is_nan_x:
- btst &0x6, FTEMP_HI(%a0)
- beq.b is_snan_x
- mov.b &QNAN, %d0
- rts
-is_snan_x:
- mov.b &SNAN, %d0
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# set_tag_d(): return the optype of the input dbl fp number #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# a0 = points to double precision operand #
-# #
-# OUTPUT ************************************************************** #
-# d0 = value of type tag #
-# one of: NORM, INF, QNAN, SNAN, DENORM, ZERO #
-# #
-# ALGORITHM *********************************************************** #
-# Simply test the exponent, j-bit, and mantissa values to #
-# determine the type of operand. #
-# #
-#########################################################################
-
- global set_tag_d
-set_tag_d:
- mov.l FTEMP(%a0), %d0
- mov.l %d0, %d1
-
- andi.l &0x7ff00000, %d0
- beq.b zero_or_denorm_d
-
- cmpi.l %d0, &0x7ff00000
- beq.b inf_or_nan_d
-
-is_norm_d:
- mov.b &NORM, %d0
- rts
-zero_or_denorm_d:
- and.l &0x000fffff, %d1
- bne is_denorm_d
- tst.l 4+FTEMP(%a0)
- bne is_denorm_d
-is_zero_d:
- mov.b &ZERO, %d0
- rts
-is_denorm_d:
- mov.b &DENORM, %d0
- rts
-inf_or_nan_d:
- and.l &0x000fffff, %d1
- bne is_nan_d
- tst.l 4+FTEMP(%a0)
- bne is_nan_d
-is_inf_d:
- mov.b &INF, %d0
- rts
-is_nan_d:
- btst &19, %d1
- bne is_qnan_d
-is_snan_d:
- mov.b &SNAN, %d0
- rts
-is_qnan_d:
- mov.b &QNAN, %d0
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# set_tag_s(): return the optype of the input sgl fp number #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to single precision operand #
-# #
-# OUTPUT ************************************************************** #
-# d0 = value of type tag #
-# one of: NORM, INF, QNAN, SNAN, DENORM, ZERO #
-# #
-# ALGORITHM *********************************************************** #
-# Simply test the exponent, j-bit, and mantissa values to #
-# determine the type of operand. #
-# #
-#########################################################################
-
- global set_tag_s
-set_tag_s:
- mov.l FTEMP(%a0), %d0
- mov.l %d0, %d1
-
- andi.l &0x7f800000, %d0
- beq.b zero_or_denorm_s
-
- cmpi.l %d0, &0x7f800000
- beq.b inf_or_nan_s
-
-is_norm_s:
- mov.b &NORM, %d0
- rts
-zero_or_denorm_s:
- and.l &0x007fffff, %d1
- bne is_denorm_s
-is_zero_s:
- mov.b &ZERO, %d0
- rts
-is_denorm_s:
- mov.b &DENORM, %d0
- rts
-inf_or_nan_s:
- and.l &0x007fffff, %d1
- bne is_nan_s
-is_inf_s:
- mov.b &INF, %d0
- rts
-is_nan_s:
- btst &22, %d1
- bne is_qnan_s
-is_snan_s:
- mov.b &SNAN, %d0
- rts
-is_qnan_s:
- mov.b &QNAN, %d0
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# unf_res(): routine to produce default underflow result of a #
-# scaled extended precision number; this is used by #
-# fadd/fdiv/fmul/etc. emulation routines. #
-# unf_res4(): same as above but for fsglmul/fsgldiv which use #
-# single round prec and extended prec mode. #
-# #
-# XREF **************************************************************** #
-# _denorm() - denormalize according to scale factor #
-# _round() - round denormalized number according to rnd prec #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision operand #
-# d0 = scale factor #
-# d1 = rounding precision/mode #
-# #
-# OUTPUT ************************************************************** #
-# a0 = pointer to default underflow result in extended precision #
-# d0.b = result FPSR_cc which caller may or may not want to save #
-# #
-# ALGORITHM *********************************************************** #
-# Convert the input operand to "internal format" which means the #
-# exponent is extended to 16 bits and the sign is stored in the unused #
-# portion of the extended precision operand. Denormalize the number #
-# according to the scale factor passed in d0. Then, round the #
-# denormalized result. #
-# Set the FPSR_exc bits as appropriate but return the cc bits in #
-# d0 in case the caller doesn't want to save them (as is the case for #
-# fmove out). #
-# unf_res4() for fsglmul/fsgldiv forces the denorm to extended #
-# precision and the rounding mode to single. #
-# #
-#########################################################################
- global unf_res
-unf_res:
- mov.l %d1, -(%sp) # save rnd prec,mode on stack
-
- btst &0x7, FTEMP_EX(%a0) # make "internal" format
- sne FTEMP_SGN(%a0)
-
- mov.w FTEMP_EX(%a0), %d1 # extract exponent
- and.w &0x7fff, %d1
- sub.w %d0, %d1
- mov.w %d1, FTEMP_EX(%a0) # insert 16 bit exponent
-
- mov.l %a0, -(%sp) # save operand ptr during calls
-
- mov.l 0x4(%sp),%d0 # pass rnd prec.
- andi.w &0x00c0,%d0
- lsr.w &0x4,%d0
- bsr.l _denorm # denorm result
-
- mov.l (%sp),%a0
- mov.w 0x6(%sp),%d1 # load prec:mode into %d1
- andi.w &0xc0,%d1 # extract rnd prec
- lsr.w &0x4,%d1
- swap %d1
- mov.w 0x6(%sp),%d1
- andi.w &0x30,%d1
- lsr.w &0x4,%d1
- bsr.l _round # round the denorm
-
- mov.l (%sp)+, %a0
-
-# result is now rounded properly. convert back to normal format
- bclr &0x7, FTEMP_EX(%a0) # clear sgn first; may have residue
- tst.b FTEMP_SGN(%a0) # is "internal result" sign set?
- beq.b unf_res_chkifzero # no; result is positive
- bset &0x7, FTEMP_EX(%a0) # set result sgn
- clr.b FTEMP_SGN(%a0) # clear temp sign
-
-# the number may have become zero after rounding. set ccodes accordingly.
-unf_res_chkifzero:
- clr.l %d0
- tst.l FTEMP_HI(%a0) # is value now a zero?
- bne.b unf_res_cont # no
- tst.l FTEMP_LO(%a0)
- bne.b unf_res_cont # no
-# bset &z_bit, FPSR_CC(%a6) # yes; set zero ccode bit
- bset &z_bit, %d0 # yes; set zero ccode bit
-
-unf_res_cont:
-
-#
-# can inex1 also be set along with unfl and inex2???
-#
-# we know that underflow has occurred. aunfl should be set if INEX2 is also set.
-#
- btst &inex2_bit, FPSR_EXCEPT(%a6) # is INEX2 set?
- beq.b unf_res_end # no
- bset &aunfl_bit, FPSR_AEXCEPT(%a6) # yes; set aunfl
-
-unf_res_end:
- add.l &0x4, %sp # clear stack
- rts
-
-# unf_res() for fsglmul() and fsgldiv().
- global unf_res4
-unf_res4:
- mov.l %d1,-(%sp) # save rnd prec,mode on stack
-
- btst &0x7,FTEMP_EX(%a0) # make "internal" format
- sne FTEMP_SGN(%a0)
-
- mov.w FTEMP_EX(%a0),%d1 # extract exponent
- and.w &0x7fff,%d1
- sub.w %d0,%d1
- mov.w %d1,FTEMP_EX(%a0) # insert 16 bit exponent
-
- mov.l %a0,-(%sp) # save operand ptr during calls
-
- clr.l %d0 # force rnd prec = ext
- bsr.l _denorm # denorm result
-
- mov.l (%sp),%a0
- mov.w &s_mode,%d1 # force rnd prec = sgl
- swap %d1
- mov.w 0x6(%sp),%d1 # load rnd mode
- andi.w &0x30,%d1 # extract rnd prec
- lsr.w &0x4,%d1
- bsr.l _round # round the denorm
-
- mov.l (%sp)+,%a0
-
-# result is now rounded properly. convert back to normal format
- bclr &0x7,FTEMP_EX(%a0) # clear sgn first; may have residue
- tst.b FTEMP_SGN(%a0) # is "internal result" sign set?
- beq.b unf_res4_chkifzero # no; result is positive
- bset &0x7,FTEMP_EX(%a0) # set result sgn
- clr.b FTEMP_SGN(%a0) # clear temp sign
-
-# the number may have become zero after rounding. set ccodes accordingly.
-unf_res4_chkifzero:
- clr.l %d0
- tst.l FTEMP_HI(%a0) # is value now a zero?
- bne.b unf_res4_cont # no
- tst.l FTEMP_LO(%a0)
- bne.b unf_res4_cont # no
-# bset &z_bit,FPSR_CC(%a6) # yes; set zero ccode bit
- bset &z_bit,%d0 # yes; set zero ccode bit
-
-unf_res4_cont:
-
-#
-# can inex1 also be set along with unfl and inex2???
-#
-# we know that underflow has occurred. aunfl should be set if INEX2 is also set.
-#
- btst &inex2_bit,FPSR_EXCEPT(%a6) # is INEX2 set?
- beq.b unf_res4_end # no
- bset &aunfl_bit,FPSR_AEXCEPT(%a6) # yes; set aunfl
-
-unf_res4_end:
- add.l &0x4,%sp # clear stack
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# ovf_res(): routine to produce the default overflow result of #
-# an overflowing number. #
-# ovf_res2(): same as above but the rnd mode/prec are passed #
-# differently. #
-# #
-# XREF **************************************************************** #
-# none #
-# #
-# INPUT *************************************************************** #
-# d1.b = '-1' => (-); '0' => (+) #
-# ovf_res(): #
-# d0 = rnd mode/prec #
-# ovf_res2(): #
-# hi(d0) = rnd prec #
-# lo(d0) = rnd mode #
-# #
-# OUTPUT ************************************************************** #
-# a0 = points to extended precision result #
-# d0.b = condition code bits #
-# #
-# ALGORITHM *********************************************************** #
-# The default overflow result can be determined by the sign of #
-# the result and the rounding mode/prec in effect. These bits are #
-# concatenated together to create an index into the default result #
-# table. A pointer to the correct result is returned in a0. The #
-# resulting condition codes are returned in d0 in case the caller #
-# doesn't want FPSR_cc altered (as is the case for fmove out). #
-# #
-#########################################################################
-
- global ovf_res
-ovf_res:
- andi.w &0x10,%d1 # keep result sign
- lsr.b &0x4,%d0 # shift prec/mode
- or.b %d0,%d1 # concat the two
- mov.w %d1,%d0 # make a copy
- lsl.b &0x1,%d1 # multiply d1 by 2
- bra.b ovf_res_load
-
- global ovf_res2
-ovf_res2:
- and.w &0x10, %d1 # keep result sign
- or.b %d0, %d1 # insert rnd mode
- swap %d0
- or.b %d0, %d1 # insert rnd prec
- mov.w %d1, %d0 # make a copy
- lsl.b &0x1, %d1 # shift left by 1
-
-#
-# use the rounding mode, precision, and result sign as in index into the
-# two tables below to fetch the default result and the result ccodes.
-#
-ovf_res_load:
- mov.b (tbl_ovfl_cc.b,%pc,%d0.w*1), %d0 # fetch result ccodes
- lea (tbl_ovfl_result.b,%pc,%d1.w*8), %a0 # return result ptr
-
- rts
-
-tbl_ovfl_cc:
- byte 0x2, 0x0, 0x0, 0x2
- byte 0x2, 0x0, 0x0, 0x2
- byte 0x2, 0x0, 0x0, 0x2
- byte 0x0, 0x0, 0x0, 0x0
- byte 0x2+0x8, 0x8, 0x2+0x8, 0x8
- byte 0x2+0x8, 0x8, 0x2+0x8, 0x8
- byte 0x2+0x8, 0x8, 0x2+0x8, 0x8
-
-tbl_ovfl_result:
- long 0x7fff0000,0x00000000,0x00000000,0x00000000 # +INF; RN
- long 0x7ffe0000,0xffffffff,0xffffffff,0x00000000 # +EXT; RZ
- long 0x7ffe0000,0xffffffff,0xffffffff,0x00000000 # +EXT; RM
- long 0x7fff0000,0x00000000,0x00000000,0x00000000 # +INF; RP
-
- long 0x7fff0000,0x00000000,0x00000000,0x00000000 # +INF; RN
- long 0x407e0000,0xffffff00,0x00000000,0x00000000 # +SGL; RZ
- long 0x407e0000,0xffffff00,0x00000000,0x00000000 # +SGL; RM
- long 0x7fff0000,0x00000000,0x00000000,0x00000000 # +INF; RP
-
- long 0x7fff0000,0x00000000,0x00000000,0x00000000 # +INF; RN
- long 0x43fe0000,0xffffffff,0xfffff800,0x00000000 # +DBL; RZ
- long 0x43fe0000,0xffffffff,0xfffff800,0x00000000 # +DBL; RM
- long 0x7fff0000,0x00000000,0x00000000,0x00000000 # +INF; RP
-
- long 0x00000000,0x00000000,0x00000000,0x00000000
- long 0x00000000,0x00000000,0x00000000,0x00000000
- long 0x00000000,0x00000000,0x00000000,0x00000000
- long 0x00000000,0x00000000,0x00000000,0x00000000
-
- long 0xffff0000,0x00000000,0x00000000,0x00000000 # -INF; RN
- long 0xfffe0000,0xffffffff,0xffffffff,0x00000000 # -EXT; RZ
- long 0xffff0000,0x00000000,0x00000000,0x00000000 # -INF; RM
- long 0xfffe0000,0xffffffff,0xffffffff,0x00000000 # -EXT; RP
-
- long 0xffff0000,0x00000000,0x00000000,0x00000000 # -INF; RN
- long 0xc07e0000,0xffffff00,0x00000000,0x00000000 # -SGL; RZ
- long 0xffff0000,0x00000000,0x00000000,0x00000000 # -INF; RM
- long 0xc07e0000,0xffffff00,0x00000000,0x00000000 # -SGL; RP
-
- long 0xffff0000,0x00000000,0x00000000,0x00000000 # -INF; RN
- long 0xc3fe0000,0xffffffff,0xfffff800,0x00000000 # -DBL; RZ
- long 0xffff0000,0x00000000,0x00000000,0x00000000 # -INF; RM
- long 0xc3fe0000,0xffffffff,0xfffff800,0x00000000 # -DBL; RP
-
-#########################################################################
-# XDEF **************************************************************** #
-# get_packed(): fetch a packed operand from memory and then #
-# convert it to a floating-point binary number. #
-# #
-# XREF **************************************************************** #
-# _dcalc_ea() - calculate the correct <ea> #
-# _mem_read() - fetch the packed operand from memory #
-# facc_in_x() - the fetch failed so jump to special exit code #
-# decbin() - convert packed to binary extended precision #
-# #
-# INPUT *************************************************************** #
-# None #
-# #
-# OUTPUT ************************************************************** #
-# If no failure on _mem_read(): #
-# FP_SRC(a6) = packed operand now as a binary FP number #
-# #
-# ALGORITHM *********************************************************** #
-# Get the correct <ea> which is the value on the exception stack #
-# frame w/ maybe a correction factor if the <ea> is -(an) or (an)+. #
-# Then, fetch the operand from memory. If the fetch fails, exit #
-# through facc_in_x(). #
-# If the packed operand is a ZERO,NAN, or INF, convert it to #
-# its binary representation here. Else, call decbin() which will #
-# convert the packed value to an extended precision binary value. #
-# #
-#########################################################################
-
-# the stacked <ea> for packed is correct except for -(An).
-# the base reg must be updated for both -(An) and (An)+.
- global get_packed
-get_packed:
- mov.l &0xc,%d0 # packed is 12 bytes
- bsr.l _dcalc_ea # fetch <ea>; correct An
-
- lea FP_SRC(%a6),%a1 # pass: ptr to super dst
- mov.l &0xc,%d0 # pass: 12 bytes
- bsr.l _dmem_read # read packed operand
-
- tst.l %d1 # did dfetch fail?
- bne.l facc_in_x # yes
-
-# The packed operand is an INF or a NAN if the exponent field is all ones.
- bfextu FP_SRC(%a6){&1:&15},%d0 # get exp
- cmpi.w %d0,&0x7fff # INF or NAN?
- bne.b gp_try_zero # no
- rts # operand is an INF or NAN
-
-# The packed operand is a zero if the mantissa is all zero, else it's
-# a normal packed op.
-gp_try_zero:
- mov.b 3+FP_SRC(%a6),%d0 # get byte 4
- andi.b &0x0f,%d0 # clear all but last nybble
- bne.b gp_not_spec # not a zero
- tst.l FP_SRC_HI(%a6) # is lw 2 zero?
- bne.b gp_not_spec # not a zero
- tst.l FP_SRC_LO(%a6) # is lw 3 zero?
- bne.b gp_not_spec # not a zero
- rts # operand is a ZERO
-gp_not_spec:
- lea FP_SRC(%a6),%a0 # pass: ptr to packed op
- bsr.l decbin # convert to extended
- fmovm.x &0x80,FP_SRC(%a6) # make this the srcop
- rts
-
-#########################################################################
-# decbin(): Converts normalized packed bcd value pointed to by register #
-# a0 to extended-precision value in fp0. #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to normalized packed bcd value #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = exact fp representation of the packed bcd value. #
-# #
-# ALGORITHM *********************************************************** #
-# Expected is a normal bcd (i.e. non-exceptional; all inf, zero, #
-# and NaN operands are dispatched without entering this routine) #
-# value in 68881/882 format at location (a0). #
-# #
-# A1. Convert the bcd exponent to binary by successive adds and #
-# muls. Set the sign according to SE. Subtract 16 to compensate #
-# for the mantissa which is to be interpreted as 17 integer #
-# digits, rather than 1 integer and 16 fraction digits. #
-# Note: this operation can never overflow. #
-# #
-# A2. Convert the bcd mantissa to binary by successive #
-# adds and muls in FP0. Set the sign according to SM. #
-# The mantissa digits will be converted with the decimal point #
-# assumed following the least-significant digit. #
-# Note: this operation can never overflow. #
-# #
-# A3. Count the number of leading/trailing zeros in the #
-# bcd string. If SE is positive, count the leading zeros; #
-# if negative, count the trailing zeros. Set the adjusted #
-# exponent equal to the exponent from A1 and the zero count #
-# added if SM = 1 and subtracted if SM = 0. Scale the #
-# mantissa the equivalent of forcing in the bcd value: #
-# #
-# SM = 0 a non-zero digit in the integer position #
-# SM = 1 a non-zero digit in Mant0, lsd of the fraction #
-# #
-# this will insure that any value, regardless of its #
-# representation (ex. 0.1E2, 1E1, 10E0, 100E-1), is converted #
-# consistently. #
-# #
-# A4. Calculate the factor 10^exp in FP1 using a table of #
-# 10^(2^n) values. To reduce the error in forming factors #
-# greater than 10^27, a directed rounding scheme is used with #
-# tables rounded to RN, RM, and RP, according to the table #
-# in the comments of the pwrten section. #
-# #
-# A5. Form the final binary number by scaling the mantissa by #
-# the exponent factor. This is done by multiplying the #
-# mantissa in FP0 by the factor in FP1 if the adjusted #
-# exponent sign is positive, and dividing FP0 by FP1 if #
-# it is negative. #
-# #
-# Clean up and return. Check if the final mul or div was inexact. #
-# If so, set INEX1 in USER_FPSR. #
-# #
-#########################################################################
-
-#
-# PTENRN, PTENRM, and PTENRP are arrays of powers of 10 rounded
-# to nearest, minus, and plus, respectively. The tables include
-# 10**{1,2,4,8,16,32,64,128,256,512,1024,2048,4096}. No rounding
-# is required until the power is greater than 27, however, all
-# tables include the first 5 for ease of indexing.
-#
-RTABLE:
- byte 0,0,0,0
- byte 2,3,2,3
- byte 2,3,3,2
- byte 3,2,2,3
-
- set FNIBS,7
- set FSTRT,0
-
- set ESTRT,4
- set EDIGITS,2
-
- global decbin
-decbin:
- mov.l 0x0(%a0),FP_SCR0_EX(%a6) # make a copy of input
- mov.l 0x4(%a0),FP_SCR0_HI(%a6) # so we don't alter it
- mov.l 0x8(%a0),FP_SCR0_LO(%a6)
-
- lea FP_SCR0(%a6),%a0
-
- movm.l &0x3c00,-(%sp) # save d2-d5
- fmovm.x &0x1,-(%sp) # save fp1
-#
-# Calculate exponent:
-# 1. Copy bcd value in memory for use as a working copy.
-# 2. Calculate absolute value of exponent in d1 by mul and add.
-# 3. Correct for exponent sign.
-# 4. Subtract 16 to compensate for interpreting the mant as all integer digits.
-# (i.e., all digits assumed left of the decimal point.)
-#
-# Register usage:
-#
-# calc_e:
-# (*) d0: temp digit storage
-# (*) d1: accumulator for binary exponent
-# (*) d2: digit count
-# (*) d3: offset pointer
-# ( ) d4: first word of bcd
-# ( ) a0: pointer to working bcd value
-# ( ) a6: pointer to original bcd value
-# (*) FP_SCR1: working copy of original bcd value
-# (*) L_SCR1: copy of original exponent word
-#
-calc_e:
- mov.l &EDIGITS,%d2 # # of nibbles (digits) in fraction part
- mov.l &ESTRT,%d3 # counter to pick up digits
- mov.l (%a0),%d4 # get first word of bcd
- clr.l %d1 # zero d1 for accumulator
-e_gd:
- mulu.l &0xa,%d1 # mul partial product by one digit place
- bfextu %d4{%d3:&4},%d0 # get the digit and zero extend into d0
- add.l %d0,%d1 # d1 = d1 + d0
- addq.b &4,%d3 # advance d3 to the next digit
- dbf.w %d2,e_gd # if we have used all 3 digits, exit loop
- btst &30,%d4 # get SE
- beq.b e_pos # don't negate if pos
- neg.l %d1 # negate before subtracting
-e_pos:
- sub.l &16,%d1 # sub to compensate for shift of mant
- bge.b e_save # if still pos, do not neg
- neg.l %d1 # now negative, make pos and set SE
- or.l &0x40000000,%d4 # set SE in d4,
- or.l &0x40000000,(%a0) # and in working bcd
-e_save:
- mov.l %d1,-(%sp) # save exp on stack
-#
-#
-# Calculate mantissa:
-# 1. Calculate absolute value of mantissa in fp0 by mul and add.
-# 2. Correct for mantissa sign.
-# (i.e., all digits assumed left of the decimal point.)
-#
-# Register usage:
-#
-# calc_m:
-# (*) d0: temp digit storage
-# (*) d1: lword counter
-# (*) d2: digit count
-# (*) d3: offset pointer
-# ( ) d4: words 2 and 3 of bcd
-# ( ) a0: pointer to working bcd value
-# ( ) a6: pointer to original bcd value
-# (*) fp0: mantissa accumulator
-# ( ) FP_SCR1: working copy of original bcd value
-# ( ) L_SCR1: copy of original exponent word
-#
-calc_m:
- mov.l &1,%d1 # word counter, init to 1
- fmov.s &0x00000000,%fp0 # accumulator
-#
-#
-# Since the packed number has a long word between the first & second parts,
-# get the integer digit then skip down & get the rest of the
-# mantissa. We will unroll the loop once.
-#
- bfextu (%a0){&28:&4},%d0 # integer part is ls digit in long word
- fadd.b %d0,%fp0 # add digit to sum in fp0
-#
-#
-# Get the rest of the mantissa.
-#
-loadlw:
- mov.l (%a0,%d1.L*4),%d4 # load mantissa lonqword into d4
- mov.l &FSTRT,%d3 # counter to pick up digits
- mov.l &FNIBS,%d2 # reset number of digits per a0 ptr
-md2b:
- fmul.s &0x41200000,%fp0 # fp0 = fp0 * 10
- bfextu %d4{%d3:&4},%d0 # get the digit and zero extend
- fadd.b %d0,%fp0 # fp0 = fp0 + digit
-#
-#
-# If all the digits (8) in that long word have been converted (d2=0),
-# then inc d1 (=2) to point to the next long word and reset d3 to 0
-# to initialize the digit offset, and set d2 to 7 for the digit count;
-# else continue with this long word.
-#
- addq.b &4,%d3 # advance d3 to the next digit
- dbf.w %d2,md2b # check for last digit in this lw
-nextlw:
- addq.l &1,%d1 # inc lw pointer in mantissa
- cmp.l %d1,&2 # test for last lw
- ble.b loadlw # if not, get last one
-#
-# Check the sign of the mant and make the value in fp0 the same sign.
-#
-m_sign:
- btst &31,(%a0) # test sign of the mantissa
- beq.b ap_st_z # if clear, go to append/strip zeros
- fneg.x %fp0 # if set, negate fp0
-#
-# Append/strip zeros:
-#
-# For adjusted exponents which have an absolute value greater than 27*,
-# this routine calculates the amount needed to normalize the mantissa
-# for the adjusted exponent. That number is subtracted from the exp
-# if the exp was positive, and added if it was negative. The purpose
-# of this is to reduce the value of the exponent and the possibility
-# of error in calculation of pwrten.
-#
-# 1. Branch on the sign of the adjusted exponent.
-# 2p.(positive exp)
-# 2. Check M16 and the digits in lwords 2 and 3 in descending order.
-# 3. Add one for each zero encountered until a non-zero digit.
-# 4. Subtract the count from the exp.
-# 5. Check if the exp has crossed zero in #3 above; make the exp abs
-# and set SE.
-# 6. Multiply the mantissa by 10**count.
-# 2n.(negative exp)
-# 2. Check the digits in lwords 3 and 2 in descending order.
-# 3. Add one for each zero encountered until a non-zero digit.
-# 4. Add the count to the exp.
-# 5. Check if the exp has crossed zero in #3 above; clear SE.
-# 6. Divide the mantissa by 10**count.
-#
-# *Why 27? If the adjusted exponent is within -28 < expA < 28, than
-# any adjustment due to append/strip zeros will drive the resultane
-# exponent towards zero. Since all pwrten constants with a power
-# of 27 or less are exact, there is no need to use this routine to
-# attempt to lessen the resultant exponent.
-#
-# Register usage:
-#
-# ap_st_z:
-# (*) d0: temp digit storage
-# (*) d1: zero count
-# (*) d2: digit count
-# (*) d3: offset pointer
-# ( ) d4: first word of bcd
-# (*) d5: lword counter
-# ( ) a0: pointer to working bcd value
-# ( ) FP_SCR1: working copy of original bcd value
-# ( ) L_SCR1: copy of original exponent word
-#
-#
-# First check the absolute value of the exponent to see if this
-# routine is necessary. If so, then check the sign of the exponent
-# and do append (+) or strip (-) zeros accordingly.
-# This section handles a positive adjusted exponent.
-#
-ap_st_z:
- mov.l (%sp),%d1 # load expA for range test
- cmp.l %d1,&27 # test is with 27
- ble.w pwrten # if abs(expA) <28, skip ap/st zeros
- btst &30,(%a0) # check sign of exp
- bne.b ap_st_n # if neg, go to neg side
- clr.l %d1 # zero count reg
- mov.l (%a0),%d4 # load lword 1 to d4
- bfextu %d4{&28:&4},%d0 # get M16 in d0
- bne.b ap_p_fx # if M16 is non-zero, go fix exp
- addq.l &1,%d1 # inc zero count
- mov.l &1,%d5 # init lword counter
- mov.l (%a0,%d5.L*4),%d4 # get lword 2 to d4
- bne.b ap_p_cl # if lw 2 is zero, skip it
- addq.l &8,%d1 # and inc count by 8
- addq.l &1,%d5 # inc lword counter
- mov.l (%a0,%d5.L*4),%d4 # get lword 3 to d4
-ap_p_cl:
- clr.l %d3 # init offset reg
- mov.l &7,%d2 # init digit counter
-ap_p_gd:
- bfextu %d4{%d3:&4},%d0 # get digit
- bne.b ap_p_fx # if non-zero, go to fix exp
- addq.l &4,%d3 # point to next digit
- addq.l &1,%d1 # inc digit counter
- dbf.w %d2,ap_p_gd # get next digit
-ap_p_fx:
- mov.l %d1,%d0 # copy counter to d2
- mov.l (%sp),%d1 # get adjusted exp from memory
- sub.l %d0,%d1 # subtract count from exp
- bge.b ap_p_fm # if still pos, go to pwrten
- neg.l %d1 # now its neg; get abs
- mov.l (%a0),%d4 # load lword 1 to d4
- or.l &0x40000000,%d4 # and set SE in d4
- or.l &0x40000000,(%a0) # and in memory
-#
-# Calculate the mantissa multiplier to compensate for the striping of
-# zeros from the mantissa.
-#
-ap_p_fm:
- lea.l PTENRN(%pc),%a1 # get address of power-of-ten table
- clr.l %d3 # init table index
- fmov.s &0x3f800000,%fp1 # init fp1 to 1
- mov.l &3,%d2 # init d2 to count bits in counter
-ap_p_el:
- asr.l &1,%d0 # shift lsb into carry
- bcc.b ap_p_en # if 1, mul fp1 by pwrten factor
- fmul.x (%a1,%d3),%fp1 # mul by 10**(d3_bit_no)
-ap_p_en:
- add.l &12,%d3 # inc d3 to next rtable entry
- tst.l %d0 # check if d0 is zero
- bne.b ap_p_el # if not, get next bit
- fmul.x %fp1,%fp0 # mul mantissa by 10**(no_bits_shifted)
- bra.b pwrten # go calc pwrten
-#
-# This section handles a negative adjusted exponent.
-#
-ap_st_n:
- clr.l %d1 # clr counter
- mov.l &2,%d5 # set up d5 to point to lword 3
- mov.l (%a0,%d5.L*4),%d4 # get lword 3
- bne.b ap_n_cl # if not zero, check digits
- sub.l &1,%d5 # dec d5 to point to lword 2
- addq.l &8,%d1 # inc counter by 8
- mov.l (%a0,%d5.L*4),%d4 # get lword 2
-ap_n_cl:
- mov.l &28,%d3 # point to last digit
- mov.l &7,%d2 # init digit counter
-ap_n_gd:
- bfextu %d4{%d3:&4},%d0 # get digit
- bne.b ap_n_fx # if non-zero, go to exp fix
- subq.l &4,%d3 # point to previous digit
- addq.l &1,%d1 # inc digit counter
- dbf.w %d2,ap_n_gd # get next digit
-ap_n_fx:
- mov.l %d1,%d0 # copy counter to d0
- mov.l (%sp),%d1 # get adjusted exp from memory
- sub.l %d0,%d1 # subtract count from exp
- bgt.b ap_n_fm # if still pos, go fix mantissa
- neg.l %d1 # take abs of exp and clr SE
- mov.l (%a0),%d4 # load lword 1 to d4
- and.l &0xbfffffff,%d4 # and clr SE in d4
- and.l &0xbfffffff,(%a0) # and in memory
-#
-# Calculate the mantissa multiplier to compensate for the appending of
-# zeros to the mantissa.
-#
-ap_n_fm:
- lea.l PTENRN(%pc),%a1 # get address of power-of-ten table
- clr.l %d3 # init table index
- fmov.s &0x3f800000,%fp1 # init fp1 to 1
- mov.l &3,%d2 # init d2 to count bits in counter
-ap_n_el:
- asr.l &1,%d0 # shift lsb into carry
- bcc.b ap_n_en # if 1, mul fp1 by pwrten factor
- fmul.x (%a1,%d3),%fp1 # mul by 10**(d3_bit_no)
-ap_n_en:
- add.l &12,%d3 # inc d3 to next rtable entry
- tst.l %d0 # check if d0 is zero
- bne.b ap_n_el # if not, get next bit
- fdiv.x %fp1,%fp0 # div mantissa by 10**(no_bits_shifted)
-#
-#
-# Calculate power-of-ten factor from adjusted and shifted exponent.
-#
-# Register usage:
-#
-# pwrten:
-# (*) d0: temp
-# ( ) d1: exponent
-# (*) d2: {FPCR[6:5],SM,SE} as index in RTABLE; temp
-# (*) d3: FPCR work copy
-# ( ) d4: first word of bcd
-# (*) a1: RTABLE pointer
-# calc_p:
-# (*) d0: temp
-# ( ) d1: exponent
-# (*) d3: PWRTxx table index
-# ( ) a0: pointer to working copy of bcd
-# (*) a1: PWRTxx pointer
-# (*) fp1: power-of-ten accumulator
-#
-# Pwrten calculates the exponent factor in the selected rounding mode
-# according to the following table:
-#
-# Sign of Mant Sign of Exp Rounding Mode PWRTEN Rounding Mode
-#
-# ANY ANY RN RN
-#
-# + + RP RP
-# - + RP RM
-# + - RP RM
-# - - RP RP
-#
-# + + RM RM
-# - + RM RP
-# + - RM RP
-# - - RM RM
-#
-# + + RZ RM
-# - + RZ RM
-# + - RZ RP
-# - - RZ RP
-#
-#
-pwrten:
- mov.l USER_FPCR(%a6),%d3 # get user's FPCR
- bfextu %d3{&26:&2},%d2 # isolate rounding mode bits
- mov.l (%a0),%d4 # reload 1st bcd word to d4
- asl.l &2,%d2 # format d2 to be
- bfextu %d4{&0:&2},%d0 # {FPCR[6],FPCR[5],SM,SE}
- add.l %d0,%d2 # in d2 as index into RTABLE
- lea.l RTABLE(%pc),%a1 # load rtable base
- mov.b (%a1,%d2),%d0 # load new rounding bits from table
- clr.l %d3 # clear d3 to force no exc and extended
- bfins %d0,%d3{&26:&2} # stuff new rounding bits in FPCR
- fmov.l %d3,%fpcr # write new FPCR
- asr.l &1,%d0 # write correct PTENxx table
- bcc.b not_rp # to a1
- lea.l PTENRP(%pc),%a1 # it is RP
- bra.b calc_p # go to init section
-not_rp:
- asr.l &1,%d0 # keep checking
- bcc.b not_rm
- lea.l PTENRM(%pc),%a1 # it is RM
- bra.b calc_p # go to init section
-not_rm:
- lea.l PTENRN(%pc),%a1 # it is RN
-calc_p:
- mov.l %d1,%d0 # copy exp to d0;use d0
- bpl.b no_neg # if exp is negative,
- neg.l %d0 # invert it
- or.l &0x40000000,(%a0) # and set SE bit
-no_neg:
- clr.l %d3 # table index
- fmov.s &0x3f800000,%fp1 # init fp1 to 1
-e_loop:
- asr.l &1,%d0 # shift next bit into carry
- bcc.b e_next # if zero, skip the mul
- fmul.x (%a1,%d3),%fp1 # mul by 10**(d3_bit_no)
-e_next:
- add.l &12,%d3 # inc d3 to next rtable entry
- tst.l %d0 # check if d0 is zero
- bne.b e_loop # not zero, continue shifting
-#
-#
-# Check the sign of the adjusted exp and make the value in fp0 the
-# same sign. If the exp was pos then multiply fp1*fp0;
-# else divide fp0/fp1.
-#
-# Register Usage:
-# norm:
-# ( ) a0: pointer to working bcd value
-# (*) fp0: mantissa accumulator
-# ( ) fp1: scaling factor - 10**(abs(exp))
-#
-pnorm:
- btst &30,(%a0) # test the sign of the exponent
- beq.b mul # if clear, go to multiply
-div:
- fdiv.x %fp1,%fp0 # exp is negative, so divide mant by exp
- bra.b end_dec
-mul:
- fmul.x %fp1,%fp0 # exp is positive, so multiply by exp
-#
-#
-# Clean up and return with result in fp0.
-#
-# If the final mul/div in decbin incurred an inex exception,
-# it will be inex2, but will be reported as inex1 by get_op.
-#
-end_dec:
- fmov.l %fpsr,%d0 # get status register
- bclr &inex2_bit+8,%d0 # test for inex2 and clear it
- beq.b no_exc # skip this if no exc
- ori.w &inx1a_mask,2+USER_FPSR(%a6) # set INEX1/AINEX
-no_exc:
- add.l &0x4,%sp # clear 1 lw param
- fmovm.x (%sp)+,&0x40 # restore fp1
- movm.l (%sp)+,&0x3c # restore d2-d5
- fmov.l &0x0,%fpcr
- fmov.l &0x0,%fpsr
- rts
-
-#########################################################################
-# bindec(): Converts an input in extended precision format to bcd format#
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to the input extended precision value in memory. #
-# the input may be either normalized, unnormalized, or #
-# denormalized. #
-# d0 = contains the k-factor sign-extended to 32-bits. #
-# #
-# OUTPUT ************************************************************** #
-# FP_SCR0(a6) = bcd format result on the stack. #
-# #
-# ALGORITHM *********************************************************** #
-# #
-# A1. Set RM and size ext; Set SIGMA = sign of input. #
-# The k-factor is saved for use in d7. Clear the #
-# BINDEC_FLG for separating normalized/denormalized #
-# input. If input is unnormalized or denormalized, #
-# normalize it. #
-# #
-# A2. Set X = abs(input). #
-# #
-# A3. Compute ILOG. #
-# ILOG is the log base 10 of the input value. It is #
-# approximated by adding e + 0.f when the original #
-# value is viewed as 2^^e * 1.f in extended precision. #
-# This value is stored in d6. #
-# #
-# A4. Clr INEX bit. #
-# The operation in A3 above may have set INEX2. #
-# #
-# A5. Set ICTR = 0; #
-# ICTR is a flag used in A13. It must be set before the #
-# loop entry A6. #
-# #
-# A6. Calculate LEN. #
-# LEN is the number of digits to be displayed. The #
-# k-factor can dictate either the total number of digits, #
-# if it is a positive number, or the number of digits #
-# after the decimal point which are to be included as #
-# significant. See the 68882 manual for examples. #
-# If LEN is computed to be greater than 17, set OPERR in #
-# USER_FPSR. LEN is stored in d4. #
-# #
-# A7. Calculate SCALE. #
-# SCALE is equal to 10^ISCALE, where ISCALE is the number #
-# of decimal places needed to insure LEN integer digits #
-# in the output before conversion to bcd. LAMBDA is the #
-# sign of ISCALE, used in A9. Fp1 contains #
-# 10^^(abs(ISCALE)) using a rounding mode which is a #
-# function of the original rounding mode and the signs #
-# of ISCALE and X. A table is given in the code. #
-# #
-# A8. Clr INEX; Force RZ. #
-# The operation in A3 above may have set INEX2. #
-# RZ mode is forced for the scaling operation to insure #
-# only one rounding error. The grs bits are collected in #
-# the INEX flag for use in A10. #
-# #
-# A9. Scale X -> Y. #
-# The mantissa is scaled to the desired number of #
-# significant digits. The excess digits are collected #
-# in INEX2. #
-# #
-# A10. Or in INEX. #
-# If INEX is set, round error occurred. This is #
-# compensated for by 'or-ing' in the INEX2 flag to #
-# the lsb of Y. #
-# #
-# A11. Restore original FPCR; set size ext. #
-# Perform FINT operation in the user's rounding mode. #
-# Keep the size to extended. #
-# #
-# A12. Calculate YINT = FINT(Y) according to user's rounding #
-# mode. The FPSP routine sintd0 is used. The output #
-# is in fp0. #
-# #
-# A13. Check for LEN digits. #
-# If the int operation results in more than LEN digits, #
-# or less than LEN -1 digits, adjust ILOG and repeat from #
-# A6. This test occurs only on the first pass. If the #
-# result is exactly 10^LEN, decrement ILOG and divide #
-# the mantissa by 10. #
-# #
-# A14. Convert the mantissa to bcd. #
-# The binstr routine is used to convert the LEN digit #
-# mantissa to bcd in memory. The input to binstr is #
-# to be a fraction; i.e. (mantissa)/10^LEN and adjusted #
-# such that the decimal point is to the left of bit 63. #
-# The bcd digits are stored in the correct position in #
-# the final string area in memory. #
-# #
-# A15. Convert the exponent to bcd. #
-# As in A14 above, the exp is converted to bcd and the #
-# digits are stored in the final string. #
-# Test the length of the final exponent string. If the #
-# length is 4, set operr. #
-# #
-# A16. Write sign bits to final string. #
-# #
-#########################################################################
-
-set BINDEC_FLG, EXC_TEMP # DENORM flag
-
-# Constants in extended precision
-PLOG2:
- long 0x3FFD0000,0x9A209A84,0xFBCFF798,0x00000000
-PLOG2UP1:
- long 0x3FFD0000,0x9A209A84,0xFBCFF799,0x00000000
-
-# Constants in single precision
-FONE:
- long 0x3F800000,0x00000000,0x00000000,0x00000000
-FTWO:
- long 0x40000000,0x00000000,0x00000000,0x00000000
-FTEN:
- long 0x41200000,0x00000000,0x00000000,0x00000000
-F4933:
- long 0x459A2800,0x00000000,0x00000000,0x00000000
-
-RBDTBL:
- byte 0,0,0,0
- byte 3,3,2,2
- byte 3,2,2,3
- byte 2,3,3,2
-
-# Implementation Notes:
-#
-# The registers are used as follows:
-#
-# d0: scratch; LEN input to binstr
-# d1: scratch
-# d2: upper 32-bits of mantissa for binstr
-# d3: scratch;lower 32-bits of mantissa for binstr
-# d4: LEN
-# d5: LAMBDA/ICTR
-# d6: ILOG
-# d7: k-factor
-# a0: ptr for original operand/final result
-# a1: scratch pointer
-# a2: pointer to FP_X; abs(original value) in ext
-# fp0: scratch
-# fp1: scratch
-# fp2: scratch
-# F_SCR1:
-# F_SCR2:
-# L_SCR1:
-# L_SCR2:
-
- global bindec
-bindec:
- movm.l &0x3f20,-(%sp) # {%d2-%d7/%a2}
- fmovm.x &0x7,-(%sp) # {%fp0-%fp2}
-
-# A1. Set RM and size ext. Set SIGMA = sign input;
-# The k-factor is saved for use in d7. Clear BINDEC_FLG for
-# separating normalized/denormalized input. If the input
-# is a denormalized number, set the BINDEC_FLG memory word
-# to signal denorm. If the input is unnormalized, normalize
-# the input and test for denormalized result.
-#
- fmov.l &rm_mode*0x10,%fpcr # set RM and ext
- mov.l (%a0),L_SCR2(%a6) # save exponent for sign check
- mov.l %d0,%d7 # move k-factor to d7
-
- clr.b BINDEC_FLG(%a6) # clr norm/denorm flag
- cmpi.b STAG(%a6),&DENORM # is input a DENORM?
- bne.w A2_str # no; input is a NORM
-
-#
-# Normalize the denorm
-#
-un_de_norm:
- mov.w (%a0),%d0
- and.w &0x7fff,%d0 # strip sign of normalized exp
- mov.l 4(%a0),%d1
- mov.l 8(%a0),%d2
-norm_loop:
- sub.w &1,%d0
- lsl.l &1,%d2
- roxl.l &1,%d1
- tst.l %d1
- bge.b norm_loop
-#
-# Test if the normalized input is denormalized
-#
- tst.w %d0
- bgt.b pos_exp # if greater than zero, it is a norm
- st BINDEC_FLG(%a6) # set flag for denorm
-pos_exp:
- and.w &0x7fff,%d0 # strip sign of normalized exp
- mov.w %d0,(%a0)
- mov.l %d1,4(%a0)
- mov.l %d2,8(%a0)
-
-# A2. Set X = abs(input).
-#
-A2_str:
- mov.l (%a0),FP_SCR1(%a6) # move input to work space
- mov.l 4(%a0),FP_SCR1+4(%a6) # move input to work space
- mov.l 8(%a0),FP_SCR1+8(%a6) # move input to work space
- and.l &0x7fffffff,FP_SCR1(%a6) # create abs(X)
-
-# A3. Compute ILOG.
-# ILOG is the log base 10 of the input value. It is approx-
-# imated by adding e + 0.f when the original value is viewed
-# as 2^^e * 1.f in extended precision. This value is stored
-# in d6.
-#
-# Register usage:
-# Input/Output
-# d0: k-factor/exponent
-# d2: x/x
-# d3: x/x
-# d4: x/x
-# d5: x/x
-# d6: x/ILOG
-# d7: k-factor/Unchanged
-# a0: ptr for original operand/final result
-# a1: x/x
-# a2: x/x
-# fp0: x/float(ILOG)
-# fp1: x/x
-# fp2: x/x
-# F_SCR1:x/x
-# F_SCR2:Abs(X)/Abs(X) with $3fff exponent
-# L_SCR1:x/x
-# L_SCR2:first word of X packed/Unchanged
-
- tst.b BINDEC_FLG(%a6) # check for denorm
- beq.b A3_cont # if clr, continue with norm
- mov.l &-4933,%d6 # force ILOG = -4933
- bra.b A4_str
-A3_cont:
- mov.w FP_SCR1(%a6),%d0 # move exp to d0
- mov.w &0x3fff,FP_SCR1(%a6) # replace exponent with 0x3fff
- fmov.x FP_SCR1(%a6),%fp0 # now fp0 has 1.f
- sub.w &0x3fff,%d0 # strip off bias
- fadd.w %d0,%fp0 # add in exp
- fsub.s FONE(%pc),%fp0 # subtract off 1.0
- fbge.w pos_res # if pos, branch
- fmul.x PLOG2UP1(%pc),%fp0 # if neg, mul by LOG2UP1
- fmov.l %fp0,%d6 # put ILOG in d6 as a lword
- bra.b A4_str # go move out ILOG
-pos_res:
- fmul.x PLOG2(%pc),%fp0 # if pos, mul by LOG2
- fmov.l %fp0,%d6 # put ILOG in d6 as a lword
-
-
-# A4. Clr INEX bit.
-# The operation in A3 above may have set INEX2.
-
-A4_str:
- fmov.l &0,%fpsr # zero all of fpsr - nothing needed
-
-
-# A5. Set ICTR = 0;
-# ICTR is a flag used in A13. It must be set before the
-# loop entry A6. The lower word of d5 is used for ICTR.
-
- clr.w %d5 # clear ICTR
-
-# A6. Calculate LEN.
-# LEN is the number of digits to be displayed. The k-factor
-# can dictate either the total number of digits, if it is
-# a positive number, or the number of digits after the
-# original decimal point which are to be included as
-# significant. See the 68882 manual for examples.
-# If LEN is computed to be greater than 17, set OPERR in
-# USER_FPSR. LEN is stored in d4.
-#
-# Register usage:
-# Input/Output
-# d0: exponent/Unchanged
-# d2: x/x/scratch
-# d3: x/x
-# d4: exc picture/LEN
-# d5: ICTR/Unchanged
-# d6: ILOG/Unchanged
-# d7: k-factor/Unchanged
-# a0: ptr for original operand/final result
-# a1: x/x
-# a2: x/x
-# fp0: float(ILOG)/Unchanged
-# fp1: x/x
-# fp2: x/x
-# F_SCR1:x/x
-# F_SCR2:Abs(X) with $3fff exponent/Unchanged
-# L_SCR1:x/x
-# L_SCR2:first word of X packed/Unchanged
-
-A6_str:
- tst.l %d7 # branch on sign of k
- ble.b k_neg # if k <= 0, LEN = ILOG + 1 - k
- mov.l %d7,%d4 # if k > 0, LEN = k
- bra.b len_ck # skip to LEN check
-k_neg:
- mov.l %d6,%d4 # first load ILOG to d4
- sub.l %d7,%d4 # subtract off k
- addq.l &1,%d4 # add in the 1
-len_ck:
- tst.l %d4 # LEN check: branch on sign of LEN
- ble.b LEN_ng # if neg, set LEN = 1
- cmp.l %d4,&17 # test if LEN > 17
- ble.b A7_str # if not, forget it
- mov.l &17,%d4 # set max LEN = 17
- tst.l %d7 # if negative, never set OPERR
- ble.b A7_str # if positive, continue
- or.l &opaop_mask,USER_FPSR(%a6) # set OPERR & AIOP in USER_FPSR
- bra.b A7_str # finished here
-LEN_ng:
- mov.l &1,%d4 # min LEN is 1
-
-
-# A7. Calculate SCALE.
-# SCALE is equal to 10^ISCALE, where ISCALE is the number
-# of decimal places needed to insure LEN integer digits
-# in the output before conversion to bcd. LAMBDA is the sign
-# of ISCALE, used in A9. Fp1 contains 10^^(abs(ISCALE)) using
-# the rounding mode as given in the following table (see
-# Coonen, p. 7.23 as ref.; however, the SCALE variable is
-# of opposite sign in bindec.sa from Coonen).
-#
-# Initial USE
-# FPCR[6:5] LAMBDA SIGN(X) FPCR[6:5]
-# ----------------------------------------------
-# RN 00 0 0 00/0 RN
-# RN 00 0 1 00/0 RN
-# RN 00 1 0 00/0 RN
-# RN 00 1 1 00/0 RN
-# RZ 01 0 0 11/3 RP
-# RZ 01 0 1 11/3 RP
-# RZ 01 1 0 10/2 RM
-# RZ 01 1 1 10/2 RM
-# RM 10 0 0 11/3 RP
-# RM 10 0 1 10/2 RM
-# RM 10 1 0 10/2 RM
-# RM 10 1 1 11/3 RP
-# RP 11 0 0 10/2 RM
-# RP 11 0 1 11/3 RP
-# RP 11 1 0 11/3 RP
-# RP 11 1 1 10/2 RM
-#
-# Register usage:
-# Input/Output
-# d0: exponent/scratch - final is 0
-# d2: x/0 or 24 for A9
-# d3: x/scratch - offset ptr into PTENRM array
-# d4: LEN/Unchanged
-# d5: 0/ICTR:LAMBDA
-# d6: ILOG/ILOG or k if ((k<=0)&(ILOG<k))
-# d7: k-factor/Unchanged
-# a0: ptr for original operand/final result
-# a1: x/ptr to PTENRM array
-# a2: x/x
-# fp0: float(ILOG)/Unchanged
-# fp1: x/10^ISCALE
-# fp2: x/x
-# F_SCR1:x/x
-# F_SCR2:Abs(X) with $3fff exponent/Unchanged
-# L_SCR1:x/x
-# L_SCR2:first word of X packed/Unchanged
-
-A7_str:
- tst.l %d7 # test sign of k
- bgt.b k_pos # if pos and > 0, skip this
- cmp.l %d7,%d6 # test k - ILOG
- blt.b k_pos # if ILOG >= k, skip this
- mov.l %d7,%d6 # if ((k<0) & (ILOG < k)) ILOG = k
-k_pos:
- mov.l %d6,%d0 # calc ILOG + 1 - LEN in d0
- addq.l &1,%d0 # add the 1
- sub.l %d4,%d0 # sub off LEN
- swap %d5 # use upper word of d5 for LAMBDA
- clr.w %d5 # set it zero initially
- clr.w %d2 # set up d2 for very small case
- tst.l %d0 # test sign of ISCALE
- bge.b iscale # if pos, skip next inst
- addq.w &1,%d5 # if neg, set LAMBDA true
- cmp.l %d0,&0xffffecd4 # test iscale <= -4908
- bgt.b no_inf # if false, skip rest
- add.l &24,%d0 # add in 24 to iscale
- mov.l &24,%d2 # put 24 in d2 for A9
-no_inf:
- neg.l %d0 # and take abs of ISCALE
-iscale:
- fmov.s FONE(%pc),%fp1 # init fp1 to 1
- bfextu USER_FPCR(%a6){&26:&2},%d1 # get initial rmode bits
- lsl.w &1,%d1 # put them in bits 2:1
- add.w %d5,%d1 # add in LAMBDA
- lsl.w &1,%d1 # put them in bits 3:1
- tst.l L_SCR2(%a6) # test sign of original x
- bge.b x_pos # if pos, don't set bit 0
- addq.l &1,%d1 # if neg, set bit 0
-x_pos:
- lea.l RBDTBL(%pc),%a2 # load rbdtbl base
- mov.b (%a2,%d1),%d3 # load d3 with new rmode
- lsl.l &4,%d3 # put bits in proper position
- fmov.l %d3,%fpcr # load bits into fpu
- lsr.l &4,%d3 # put bits in proper position
- tst.b %d3 # decode new rmode for pten table
- bne.b not_rn # if zero, it is RN
- lea.l PTENRN(%pc),%a1 # load a1 with RN table base
- bra.b rmode # exit decode
-not_rn:
- lsr.b &1,%d3 # get lsb in carry
- bcc.b not_rp2 # if carry clear, it is RM
- lea.l PTENRP(%pc),%a1 # load a1 with RP table base
- bra.b rmode # exit decode
-not_rp2:
- lea.l PTENRM(%pc),%a1 # load a1 with RM table base
-rmode:
- clr.l %d3 # clr table index
-e_loop2:
- lsr.l &1,%d0 # shift next bit into carry
- bcc.b e_next2 # if zero, skip the mul
- fmul.x (%a1,%d3),%fp1 # mul by 10**(d3_bit_no)
-e_next2:
- add.l &12,%d3 # inc d3 to next pwrten table entry
- tst.l %d0 # test if ISCALE is zero
- bne.b e_loop2 # if not, loop
-
-# A8. Clr INEX; Force RZ.
-# The operation in A3 above may have set INEX2.
-# RZ mode is forced for the scaling operation to insure
-# only one rounding error. The grs bits are collected in
-# the INEX flag for use in A10.
-#
-# Register usage:
-# Input/Output
-
- fmov.l &0,%fpsr # clr INEX
- fmov.l &rz_mode*0x10,%fpcr # set RZ rounding mode
-
-# A9. Scale X -> Y.
-# The mantissa is scaled to the desired number of significant
-# digits. The excess digits are collected in INEX2. If mul,
-# Check d2 for excess 10 exponential value. If not zero,
-# the iscale value would have caused the pwrten calculation
-# to overflow. Only a negative iscale can cause this, so
-# multiply by 10^(d2), which is now only allowed to be 24,
-# with a multiply by 10^8 and 10^16, which is exact since
-# 10^24 is exact. If the input was denormalized, we must
-# create a busy stack frame with the mul command and the
-# two operands, and allow the fpu to complete the multiply.
-#
-# Register usage:
-# Input/Output
-# d0: FPCR with RZ mode/Unchanged
-# d2: 0 or 24/unchanged
-# d3: x/x
-# d4: LEN/Unchanged
-# d5: ICTR:LAMBDA
-# d6: ILOG/Unchanged
-# d7: k-factor/Unchanged
-# a0: ptr for original operand/final result
-# a1: ptr to PTENRM array/Unchanged
-# a2: x/x
-# fp0: float(ILOG)/X adjusted for SCALE (Y)
-# fp1: 10^ISCALE/Unchanged
-# fp2: x/x
-# F_SCR1:x/x
-# F_SCR2:Abs(X) with $3fff exponent/Unchanged
-# L_SCR1:x/x
-# L_SCR2:first word of X packed/Unchanged
-
-A9_str:
- fmov.x (%a0),%fp0 # load X from memory
- fabs.x %fp0 # use abs(X)
- tst.w %d5 # LAMBDA is in lower word of d5
- bne.b sc_mul # if neg (LAMBDA = 1), scale by mul
- fdiv.x %fp1,%fp0 # calculate X / SCALE -> Y to fp0
- bra.w A10_st # branch to A10
-
-sc_mul:
- tst.b BINDEC_FLG(%a6) # check for denorm
- beq.w A9_norm # if norm, continue with mul
-
-# for DENORM, we must calculate:
-# fp0 = input_op * 10^ISCALE * 10^24
-# since the input operand is a DENORM, we can't multiply it directly.
-# so, we do the multiplication of the exponents and mantissas separately.
-# in this way, we avoid underflow on intermediate stages of the
-# multiplication and guarantee a result without exception.
- fmovm.x &0x2,-(%sp) # save 10^ISCALE to stack
-
- mov.w (%sp),%d3 # grab exponent
- andi.w &0x7fff,%d3 # clear sign
- ori.w &0x8000,(%a0) # make DENORM exp negative
- add.w (%a0),%d3 # add DENORM exp to 10^ISCALE exp
- subi.w &0x3fff,%d3 # subtract BIAS
- add.w 36(%a1),%d3
- subi.w &0x3fff,%d3 # subtract BIAS
- add.w 48(%a1),%d3
- subi.w &0x3fff,%d3 # subtract BIAS
-
- bmi.w sc_mul_err # is result is DENORM, punt!!!
-
- andi.w &0x8000,(%sp) # keep sign
- or.w %d3,(%sp) # insert new exponent
- andi.w &0x7fff,(%a0) # clear sign bit on DENORM again
- mov.l 0x8(%a0),-(%sp) # put input op mantissa on stk
- mov.l 0x4(%a0),-(%sp)
- mov.l &0x3fff0000,-(%sp) # force exp to zero
- fmovm.x (%sp)+,&0x80 # load normalized DENORM into fp0
- fmul.x (%sp)+,%fp0
-
-# fmul.x 36(%a1),%fp0 # multiply fp0 by 10^8
-# fmul.x 48(%a1),%fp0 # multiply fp0 by 10^16
- mov.l 36+8(%a1),-(%sp) # get 10^8 mantissa
- mov.l 36+4(%a1),-(%sp)
- mov.l &0x3fff0000,-(%sp) # force exp to zero
- mov.l 48+8(%a1),-(%sp) # get 10^16 mantissa
- mov.l 48+4(%a1),-(%sp)
- mov.l &0x3fff0000,-(%sp)# force exp to zero
- fmul.x (%sp)+,%fp0 # multiply fp0 by 10^8
- fmul.x (%sp)+,%fp0 # multiply fp0 by 10^16
- bra.b A10_st
-
-sc_mul_err:
- bra.b sc_mul_err
-
-A9_norm:
- tst.w %d2 # test for small exp case
- beq.b A9_con # if zero, continue as normal
- fmul.x 36(%a1),%fp0 # multiply fp0 by 10^8
- fmul.x 48(%a1),%fp0 # multiply fp0 by 10^16
-A9_con:
- fmul.x %fp1,%fp0 # calculate X * SCALE -> Y to fp0
-
-# A10. Or in INEX.
-# If INEX is set, round error occurred. This is compensated
-# for by 'or-ing' in the INEX2 flag to the lsb of Y.
-#
-# Register usage:
-# Input/Output
-# d0: FPCR with RZ mode/FPSR with INEX2 isolated
-# d2: x/x
-# d3: x/x
-# d4: LEN/Unchanged
-# d5: ICTR:LAMBDA
-# d6: ILOG/Unchanged
-# d7: k-factor/Unchanged
-# a0: ptr for original operand/final result
-# a1: ptr to PTENxx array/Unchanged
-# a2: x/ptr to FP_SCR1(a6)
-# fp0: Y/Y with lsb adjusted
-# fp1: 10^ISCALE/Unchanged
-# fp2: x/x
-
-A10_st:
- fmov.l %fpsr,%d0 # get FPSR
- fmov.x %fp0,FP_SCR1(%a6) # move Y to memory
- lea.l FP_SCR1(%a6),%a2 # load a2 with ptr to FP_SCR1
- btst &9,%d0 # check if INEX2 set
- beq.b A11_st # if clear, skip rest
- or.l &1,8(%a2) # or in 1 to lsb of mantissa
- fmov.x FP_SCR1(%a6),%fp0 # write adjusted Y back to fpu
-
-
-# A11. Restore original FPCR; set size ext.
-# Perform FINT operation in the user's rounding mode. Keep
-# the size to extended. The sintdo entry point in the sint
-# routine expects the FPCR value to be in USER_FPCR for
-# mode and precision. The original FPCR is saved in L_SCR1.
-
-A11_st:
- mov.l USER_FPCR(%a6),L_SCR1(%a6) # save it for later
- and.l &0x00000030,USER_FPCR(%a6) # set size to ext,
-# ;block exceptions
-
-
-# A12. Calculate YINT = FINT(Y) according to user's rounding mode.
-# The FPSP routine sintd0 is used. The output is in fp0.
-#
-# Register usage:
-# Input/Output
-# d0: FPSR with AINEX cleared/FPCR with size set to ext
-# d2: x/x/scratch
-# d3: x/x
-# d4: LEN/Unchanged
-# d5: ICTR:LAMBDA/Unchanged
-# d6: ILOG/Unchanged
-# d7: k-factor/Unchanged
-# a0: ptr for original operand/src ptr for sintdo
-# a1: ptr to PTENxx array/Unchanged
-# a2: ptr to FP_SCR1(a6)/Unchanged
-# a6: temp pointer to FP_SCR1(a6) - orig value saved and restored
-# fp0: Y/YINT
-# fp1: 10^ISCALE/Unchanged
-# fp2: x/x
-# F_SCR1:x/x
-# F_SCR2:Y adjusted for inex/Y with original exponent
-# L_SCR1:x/original USER_FPCR
-# L_SCR2:first word of X packed/Unchanged
-
-A12_st:
- movm.l &0xc0c0,-(%sp) # save regs used by sintd0 {%d0-%d1/%a0-%a1}
- mov.l L_SCR1(%a6),-(%sp)
- mov.l L_SCR2(%a6),-(%sp)
-
- lea.l FP_SCR1(%a6),%a0 # a0 is ptr to FP_SCR1(a6)
- fmov.x %fp0,(%a0) # move Y to memory at FP_SCR1(a6)
- tst.l L_SCR2(%a6) # test sign of original operand
- bge.b do_fint12 # if pos, use Y
- or.l &0x80000000,(%a0) # if neg, use -Y
-do_fint12:
- mov.l USER_FPSR(%a6),-(%sp)
-# bsr sintdo # sint routine returns int in fp0
-
- fmov.l USER_FPCR(%a6),%fpcr
- fmov.l &0x0,%fpsr # clear the AEXC bits!!!
-## mov.l USER_FPCR(%a6),%d0 # ext prec/keep rnd mode
-## andi.l &0x00000030,%d0
-## fmov.l %d0,%fpcr
- fint.x FP_SCR1(%a6),%fp0 # do fint()
- fmov.l %fpsr,%d0
- or.w %d0,FPSR_EXCEPT(%a6)
-## fmov.l &0x0,%fpcr
-## fmov.l %fpsr,%d0 # don't keep ccodes
-## or.w %d0,FPSR_EXCEPT(%a6)
-
- mov.b (%sp),USER_FPSR(%a6)
- add.l &4,%sp
-
- mov.l (%sp)+,L_SCR2(%a6)
- mov.l (%sp)+,L_SCR1(%a6)
- movm.l (%sp)+,&0x303 # restore regs used by sint {%d0-%d1/%a0-%a1}
-
- mov.l L_SCR2(%a6),FP_SCR1(%a6) # restore original exponent
- mov.l L_SCR1(%a6),USER_FPCR(%a6) # restore user's FPCR
-
-# A13. Check for LEN digits.
-# If the int operation results in more than LEN digits,
-# or less than LEN -1 digits, adjust ILOG and repeat from
-# A6. This test occurs only on the first pass. If the
-# result is exactly 10^LEN, decrement ILOG and divide
-# the mantissa by 10. The calculation of 10^LEN cannot
-# be inexact, since all powers of ten upto 10^27 are exact
-# in extended precision, so the use of a previous power-of-ten
-# table will introduce no error.
-#
-#
-# Register usage:
-# Input/Output
-# d0: FPCR with size set to ext/scratch final = 0
-# d2: x/x
-# d3: x/scratch final = x
-# d4: LEN/LEN adjusted
-# d5: ICTR:LAMBDA/LAMBDA:ICTR
-# d6: ILOG/ILOG adjusted
-# d7: k-factor/Unchanged
-# a0: pointer into memory for packed bcd string formation
-# a1: ptr to PTENxx array/Unchanged
-# a2: ptr to FP_SCR1(a6)/Unchanged
-# fp0: int portion of Y/abs(YINT) adjusted
-# fp1: 10^ISCALE/Unchanged
-# fp2: x/10^LEN
-# F_SCR1:x/x
-# F_SCR2:Y with original exponent/Unchanged
-# L_SCR1:original USER_FPCR/Unchanged
-# L_SCR2:first word of X packed/Unchanged
-
-A13_st:
- swap %d5 # put ICTR in lower word of d5
- tst.w %d5 # check if ICTR = 0
- bne not_zr # if non-zero, go to second test
-#
-# Compute 10^(LEN-1)
-#
- fmov.s FONE(%pc),%fp2 # init fp2 to 1.0
- mov.l %d4,%d0 # put LEN in d0
- subq.l &1,%d0 # d0 = LEN -1
- clr.l %d3 # clr table index
-l_loop:
- lsr.l &1,%d0 # shift next bit into carry
- bcc.b l_next # if zero, skip the mul
- fmul.x (%a1,%d3),%fp2 # mul by 10**(d3_bit_no)
-l_next:
- add.l &12,%d3 # inc d3 to next pwrten table entry
- tst.l %d0 # test if LEN is zero
- bne.b l_loop # if not, loop
-#
-# 10^LEN-1 is computed for this test and A14. If the input was
-# denormalized, check only the case in which YINT > 10^LEN.
-#
- tst.b BINDEC_FLG(%a6) # check if input was norm
- beq.b A13_con # if norm, continue with checking
- fabs.x %fp0 # take abs of YINT
- bra test_2
-#
-# Compare abs(YINT) to 10^(LEN-1) and 10^LEN
-#
-A13_con:
- fabs.x %fp0 # take abs of YINT
- fcmp.x %fp0,%fp2 # compare abs(YINT) with 10^(LEN-1)
- fbge.w test_2 # if greater, do next test
- subq.l &1,%d6 # subtract 1 from ILOG
- mov.w &1,%d5 # set ICTR
- fmov.l &rm_mode*0x10,%fpcr # set rmode to RM
- fmul.s FTEN(%pc),%fp2 # compute 10^LEN
- bra.w A6_str # return to A6 and recompute YINT
-test_2:
- fmul.s FTEN(%pc),%fp2 # compute 10^LEN
- fcmp.x %fp0,%fp2 # compare abs(YINT) with 10^LEN
- fblt.w A14_st # if less, all is ok, go to A14
- fbgt.w fix_ex # if greater, fix and redo
- fdiv.s FTEN(%pc),%fp0 # if equal, divide by 10
- addq.l &1,%d6 # and inc ILOG
- bra.b A14_st # and continue elsewhere
-fix_ex:
- addq.l &1,%d6 # increment ILOG by 1
- mov.w &1,%d5 # set ICTR
- fmov.l &rm_mode*0x10,%fpcr # set rmode to RM
- bra.w A6_str # return to A6 and recompute YINT
-#
-# Since ICTR <> 0, we have already been through one adjustment,
-# and shouldn't have another; this is to check if abs(YINT) = 10^LEN
-# 10^LEN is again computed using whatever table is in a1 since the
-# value calculated cannot be inexact.
-#
-not_zr:
- fmov.s FONE(%pc),%fp2 # init fp2 to 1.0
- mov.l %d4,%d0 # put LEN in d0
- clr.l %d3 # clr table index
-z_loop:
- lsr.l &1,%d0 # shift next bit into carry
- bcc.b z_next # if zero, skip the mul
- fmul.x (%a1,%d3),%fp2 # mul by 10**(d3_bit_no)
-z_next:
- add.l &12,%d3 # inc d3 to next pwrten table entry
- tst.l %d0 # test if LEN is zero
- bne.b z_loop # if not, loop
- fabs.x %fp0 # get abs(YINT)
- fcmp.x %fp0,%fp2 # check if abs(YINT) = 10^LEN
- fbneq.w A14_st # if not, skip this
- fdiv.s FTEN(%pc),%fp0 # divide abs(YINT) by 10
- addq.l &1,%d6 # and inc ILOG by 1
- addq.l &1,%d4 # and inc LEN
- fmul.s FTEN(%pc),%fp2 # if LEN++, the get 10^^LEN
-
-# A14. Convert the mantissa to bcd.
-# The binstr routine is used to convert the LEN digit
-# mantissa to bcd in memory. The input to binstr is
-# to be a fraction; i.e. (mantissa)/10^LEN and adjusted
-# such that the decimal point is to the left of bit 63.
-# The bcd digits are stored in the correct position in
-# the final string area in memory.
-#
-#
-# Register usage:
-# Input/Output
-# d0: x/LEN call to binstr - final is 0
-# d1: x/0
-# d2: x/ms 32-bits of mant of abs(YINT)
-# d3: x/ls 32-bits of mant of abs(YINT)
-# d4: LEN/Unchanged
-# d5: ICTR:LAMBDA/LAMBDA:ICTR
-# d6: ILOG
-# d7: k-factor/Unchanged
-# a0: pointer into memory for packed bcd string formation
-# /ptr to first mantissa byte in result string
-# a1: ptr to PTENxx array/Unchanged
-# a2: ptr to FP_SCR1(a6)/Unchanged
-# fp0: int portion of Y/abs(YINT) adjusted
-# fp1: 10^ISCALE/Unchanged
-# fp2: 10^LEN/Unchanged
-# F_SCR1:x/Work area for final result
-# F_SCR2:Y with original exponent/Unchanged
-# L_SCR1:original USER_FPCR/Unchanged
-# L_SCR2:first word of X packed/Unchanged
-
-A14_st:
- fmov.l &rz_mode*0x10,%fpcr # force rz for conversion
- fdiv.x %fp2,%fp0 # divide abs(YINT) by 10^LEN
- lea.l FP_SCR0(%a6),%a0
- fmov.x %fp0,(%a0) # move abs(YINT)/10^LEN to memory
- mov.l 4(%a0),%d2 # move 2nd word of FP_RES to d2
- mov.l 8(%a0),%d3 # move 3rd word of FP_RES to d3
- clr.l 4(%a0) # zero word 2 of FP_RES
- clr.l 8(%a0) # zero word 3 of FP_RES
- mov.l (%a0),%d0 # move exponent to d0
- swap %d0 # put exponent in lower word
- beq.b no_sft # if zero, don't shift
- sub.l &0x3ffd,%d0 # sub bias less 2 to make fract
- tst.l %d0 # check if > 1
- bgt.b no_sft # if so, don't shift
- neg.l %d0 # make exp positive
-m_loop:
- lsr.l &1,%d2 # shift d2:d3 right, add 0s
- roxr.l &1,%d3 # the number of places
- dbf.w %d0,m_loop # given in d0
-no_sft:
- tst.l %d2 # check for mantissa of zero
- bne.b no_zr # if not, go on
- tst.l %d3 # continue zero check
- beq.b zer_m # if zero, go directly to binstr
-no_zr:
- clr.l %d1 # put zero in d1 for addx
- add.l &0x00000080,%d3 # inc at bit 7
- addx.l %d1,%d2 # continue inc
- and.l &0xffffff80,%d3 # strip off lsb not used by 882
-zer_m:
- mov.l %d4,%d0 # put LEN in d0 for binstr call
- addq.l &3,%a0 # a0 points to M16 byte in result
- bsr binstr # call binstr to convert mant
-
-
-# A15. Convert the exponent to bcd.
-# As in A14 above, the exp is converted to bcd and the
-# digits are stored in the final string.
-#
-# Digits are stored in L_SCR1(a6) on return from BINDEC as:
-#
-# 32 16 15 0
-# -----------------------------------------
-# | 0 | e3 | e2 | e1 | e4 | X | X | X |
-# -----------------------------------------
-#
-# And are moved into their proper places in FP_SCR0. If digit e4
-# is non-zero, OPERR is signaled. In all cases, all 4 digits are
-# written as specified in the 881/882 manual for packed decimal.
-#
-# Register usage:
-# Input/Output
-# d0: x/LEN call to binstr - final is 0
-# d1: x/scratch (0);shift count for final exponent packing
-# d2: x/ms 32-bits of exp fraction/scratch
-# d3: x/ls 32-bits of exp fraction
-# d4: LEN/Unchanged
-# d5: ICTR:LAMBDA/LAMBDA:ICTR
-# d6: ILOG
-# d7: k-factor/Unchanged
-# a0: ptr to result string/ptr to L_SCR1(a6)
-# a1: ptr to PTENxx array/Unchanged
-# a2: ptr to FP_SCR1(a6)/Unchanged
-# fp0: abs(YINT) adjusted/float(ILOG)
-# fp1: 10^ISCALE/Unchanged
-# fp2: 10^LEN/Unchanged
-# F_SCR1:Work area for final result/BCD result
-# F_SCR2:Y with original exponent/ILOG/10^4
-# L_SCR1:original USER_FPCR/Exponent digits on return from binstr
-# L_SCR2:first word of X packed/Unchanged
-
-A15_st:
- tst.b BINDEC_FLG(%a6) # check for denorm
- beq.b not_denorm
- ftest.x %fp0 # test for zero
- fbeq.w den_zero # if zero, use k-factor or 4933
- fmov.l %d6,%fp0 # float ILOG
- fabs.x %fp0 # get abs of ILOG
- bra.b convrt
-den_zero:
- tst.l %d7 # check sign of the k-factor
- blt.b use_ilog # if negative, use ILOG
- fmov.s F4933(%pc),%fp0 # force exponent to 4933
- bra.b convrt # do it
-use_ilog:
- fmov.l %d6,%fp0 # float ILOG
- fabs.x %fp0 # get abs of ILOG
- bra.b convrt
-not_denorm:
- ftest.x %fp0 # test for zero
- fbneq.w not_zero # if zero, force exponent
- fmov.s FONE(%pc),%fp0 # force exponent to 1
- bra.b convrt # do it
-not_zero:
- fmov.l %d6,%fp0 # float ILOG
- fabs.x %fp0 # get abs of ILOG
-convrt:
- fdiv.x 24(%a1),%fp0 # compute ILOG/10^4
- fmov.x %fp0,FP_SCR1(%a6) # store fp0 in memory
- mov.l 4(%a2),%d2 # move word 2 to d2
- mov.l 8(%a2),%d3 # move word 3 to d3
- mov.w (%a2),%d0 # move exp to d0
- beq.b x_loop_fin # if zero, skip the shift
- sub.w &0x3ffd,%d0 # subtract off bias
- neg.w %d0 # make exp positive
-x_loop:
- lsr.l &1,%d2 # shift d2:d3 right
- roxr.l &1,%d3 # the number of places
- dbf.w %d0,x_loop # given in d0
-x_loop_fin:
- clr.l %d1 # put zero in d1 for addx
- add.l &0x00000080,%d3 # inc at bit 6
- addx.l %d1,%d2 # continue inc
- and.l &0xffffff80,%d3 # strip off lsb not used by 882
- mov.l &4,%d0 # put 4 in d0 for binstr call
- lea.l L_SCR1(%a6),%a0 # a0 is ptr to L_SCR1 for exp digits
- bsr binstr # call binstr to convert exp
- mov.l L_SCR1(%a6),%d0 # load L_SCR1 lword to d0
- mov.l &12,%d1 # use d1 for shift count
- lsr.l %d1,%d0 # shift d0 right by 12
- bfins %d0,FP_SCR0(%a6){&4:&12} # put e3:e2:e1 in FP_SCR0
- lsr.l %d1,%d0 # shift d0 right by 12
- bfins %d0,FP_SCR0(%a6){&16:&4} # put e4 in FP_SCR0
- tst.b %d0 # check if e4 is zero
- beq.b A16_st # if zero, skip rest
- or.l &opaop_mask,USER_FPSR(%a6) # set OPERR & AIOP in USER_FPSR
-
-
-# A16. Write sign bits to final string.
-# Sigma is bit 31 of initial value; RHO is bit 31 of d6 (ILOG).
-#
-# Register usage:
-# Input/Output
-# d0: x/scratch - final is x
-# d2: x/x
-# d3: x/x
-# d4: LEN/Unchanged
-# d5: ICTR:LAMBDA/LAMBDA:ICTR
-# d6: ILOG/ILOG adjusted
-# d7: k-factor/Unchanged
-# a0: ptr to L_SCR1(a6)/Unchanged
-# a1: ptr to PTENxx array/Unchanged
-# a2: ptr to FP_SCR1(a6)/Unchanged
-# fp0: float(ILOG)/Unchanged
-# fp1: 10^ISCALE/Unchanged
-# fp2: 10^LEN/Unchanged
-# F_SCR1:BCD result with correct signs
-# F_SCR2:ILOG/10^4
-# L_SCR1:Exponent digits on return from binstr
-# L_SCR2:first word of X packed/Unchanged
-
-A16_st:
- clr.l %d0 # clr d0 for collection of signs
- and.b &0x0f,FP_SCR0(%a6) # clear first nibble of FP_SCR0
- tst.l L_SCR2(%a6) # check sign of original mantissa
- bge.b mant_p # if pos, don't set SM
- mov.l &2,%d0 # move 2 in to d0 for SM
-mant_p:
- tst.l %d6 # check sign of ILOG
- bge.b wr_sgn # if pos, don't set SE
- addq.l &1,%d0 # set bit 0 in d0 for SE
-wr_sgn:
- bfins %d0,FP_SCR0(%a6){&0:&2} # insert SM and SE into FP_SCR0
-
-# Clean up and restore all registers used.
-
- fmov.l &0,%fpsr # clear possible inex2/ainex bits
- fmovm.x (%sp)+,&0xe0 # {%fp0-%fp2}
- movm.l (%sp)+,&0x4fc # {%d2-%d7/%a2}
- rts
-
- global PTENRN
-PTENRN:
- long 0x40020000,0xA0000000,0x00000000 # 10 ^ 1
- long 0x40050000,0xC8000000,0x00000000 # 10 ^ 2
- long 0x400C0000,0x9C400000,0x00000000 # 10 ^ 4
- long 0x40190000,0xBEBC2000,0x00000000 # 10 ^ 8
- long 0x40340000,0x8E1BC9BF,0x04000000 # 10 ^ 16
- long 0x40690000,0x9DC5ADA8,0x2B70B59E # 10 ^ 32
- long 0x40D30000,0xC2781F49,0xFFCFA6D5 # 10 ^ 64
- long 0x41A80000,0x93BA47C9,0x80E98CE0 # 10 ^ 128
- long 0x43510000,0xAA7EEBFB,0x9DF9DE8E # 10 ^ 256
- long 0x46A30000,0xE319A0AE,0xA60E91C7 # 10 ^ 512
- long 0x4D480000,0xC9767586,0x81750C17 # 10 ^ 1024
- long 0x5A920000,0x9E8B3B5D,0xC53D5DE5 # 10 ^ 2048
- long 0x75250000,0xC4605202,0x8A20979B # 10 ^ 4096
-
- global PTENRP
-PTENRP:
- long 0x40020000,0xA0000000,0x00000000 # 10 ^ 1
- long 0x40050000,0xC8000000,0x00000000 # 10 ^ 2
- long 0x400C0000,0x9C400000,0x00000000 # 10 ^ 4
- long 0x40190000,0xBEBC2000,0x00000000 # 10 ^ 8
- long 0x40340000,0x8E1BC9BF,0x04000000 # 10 ^ 16
- long 0x40690000,0x9DC5ADA8,0x2B70B59E # 10 ^ 32
- long 0x40D30000,0xC2781F49,0xFFCFA6D6 # 10 ^ 64
- long 0x41A80000,0x93BA47C9,0x80E98CE0 # 10 ^ 128
- long 0x43510000,0xAA7EEBFB,0x9DF9DE8E # 10 ^ 256
- long 0x46A30000,0xE319A0AE,0xA60E91C7 # 10 ^ 512
- long 0x4D480000,0xC9767586,0x81750C18 # 10 ^ 1024
- long 0x5A920000,0x9E8B3B5D,0xC53D5DE5 # 10 ^ 2048
- long 0x75250000,0xC4605202,0x8A20979B # 10 ^ 4096
-
- global PTENRM
-PTENRM:
- long 0x40020000,0xA0000000,0x00000000 # 10 ^ 1
- long 0x40050000,0xC8000000,0x00000000 # 10 ^ 2
- long 0x400C0000,0x9C400000,0x00000000 # 10 ^ 4
- long 0x40190000,0xBEBC2000,0x00000000 # 10 ^ 8
- long 0x40340000,0x8E1BC9BF,0x04000000 # 10 ^ 16
- long 0x40690000,0x9DC5ADA8,0x2B70B59D # 10 ^ 32
- long 0x40D30000,0xC2781F49,0xFFCFA6D5 # 10 ^ 64
- long 0x41A80000,0x93BA47C9,0x80E98CDF # 10 ^ 128
- long 0x43510000,0xAA7EEBFB,0x9DF9DE8D # 10 ^ 256
- long 0x46A30000,0xE319A0AE,0xA60E91C6 # 10 ^ 512
- long 0x4D480000,0xC9767586,0x81750C17 # 10 ^ 1024
- long 0x5A920000,0x9E8B3B5D,0xC53D5DE4 # 10 ^ 2048
- long 0x75250000,0xC4605202,0x8A20979A # 10 ^ 4096
-
-#########################################################################
-# binstr(): Converts a 64-bit binary integer to bcd. #
-# #
-# INPUT *************************************************************** #
-# d2:d3 = 64-bit binary integer #
-# d0 = desired length (LEN) #
-# a0 = pointer to start in memory for bcd characters #
-# (This pointer must point to byte 4 of the first #
-# lword of the packed decimal memory string.) #
-# #
-# OUTPUT ************************************************************** #
-# a0 = pointer to LEN bcd digits representing the 64-bit integer. #
-# #
-# ALGORITHM *********************************************************** #
-# The 64-bit binary is assumed to have a decimal point before #
-# bit 63. The fraction is multiplied by 10 using a mul by 2 #
-# shift and a mul by 8 shift. The bits shifted out of the #
-# msb form a decimal digit. This process is iterated until #
-# LEN digits are formed. #
-# #
-# A1. Init d7 to 1. D7 is the byte digit counter, and if 1, the #
-# digit formed will be assumed the least significant. This is #
-# to force the first byte formed to have a 0 in the upper 4 bits. #
-# #
-# A2. Beginning of the loop: #
-# Copy the fraction in d2:d3 to d4:d5. #
-# #
-# A3. Multiply the fraction in d2:d3 by 8 using bit-field #
-# extracts and shifts. The three msbs from d2 will go into d1. #
-# #
-# A4. Multiply the fraction in d4:d5 by 2 using shifts. The msb #
-# will be collected by the carry. #
-# #
-# A5. Add using the carry the 64-bit quantities in d2:d3 and d4:d5 #
-# into d2:d3. D1 will contain the bcd digit formed. #
-# #
-# A6. Test d7. If zero, the digit formed is the ms digit. If non- #
-# zero, it is the ls digit. Put the digit in its place in the #
-# upper word of d0. If it is the ls digit, write the word #
-# from d0 to memory. #
-# #
-# A7. Decrement d6 (LEN counter) and repeat the loop until zero. #
-# #
-#########################################################################
-
-# Implementation Notes:
-#
-# The registers are used as follows:
-#
-# d0: LEN counter
-# d1: temp used to form the digit
-# d2: upper 32-bits of fraction for mul by 8
-# d3: lower 32-bits of fraction for mul by 8
-# d4: upper 32-bits of fraction for mul by 2
-# d5: lower 32-bits of fraction for mul by 2
-# d6: temp for bit-field extracts
-# d7: byte digit formation word;digit count {0,1}
-# a0: pointer into memory for packed bcd string formation
-#
-
- global binstr
-binstr:
- movm.l &0xff00,-(%sp) # {%d0-%d7}
-
-#
-# A1: Init d7
-#
- mov.l &1,%d7 # init d7 for second digit
- subq.l &1,%d0 # for dbf d0 would have LEN+1 passes
-#
-# A2. Copy d2:d3 to d4:d5. Start loop.
-#
-loop:
- mov.l %d2,%d4 # copy the fraction before muls
- mov.l %d3,%d5 # to d4:d5
-#
-# A3. Multiply d2:d3 by 8; extract msbs into d1.
-#
- bfextu %d2{&0:&3},%d1 # copy 3 msbs of d2 into d1
- asl.l &3,%d2 # shift d2 left by 3 places
- bfextu %d3{&0:&3},%d6 # copy 3 msbs of d3 into d6
- asl.l &3,%d3 # shift d3 left by 3 places
- or.l %d6,%d2 # or in msbs from d3 into d2
-#
-# A4. Multiply d4:d5 by 2; add carry out to d1.
-#
- asl.l &1,%d5 # mul d5 by 2
- roxl.l &1,%d4 # mul d4 by 2
- swap %d6 # put 0 in d6 lower word
- addx.w %d6,%d1 # add in extend from mul by 2
-#
-# A5. Add mul by 8 to mul by 2. D1 contains the digit formed.
-#
- add.l %d5,%d3 # add lower 32 bits
- nop # ERRATA FIX #13 (Rev. 1.2 6/6/90)
- addx.l %d4,%d2 # add with extend upper 32 bits
- nop # ERRATA FIX #13 (Rev. 1.2 6/6/90)
- addx.w %d6,%d1 # add in extend from add to d1
- swap %d6 # with d6 = 0; put 0 in upper word
-#
-# A6. Test d7 and branch.
-#
- tst.w %d7 # if zero, store digit & to loop
- beq.b first_d # if non-zero, form byte & write
-sec_d:
- swap %d7 # bring first digit to word d7b
- asl.w &4,%d7 # first digit in upper 4 bits d7b
- add.w %d1,%d7 # add in ls digit to d7b
- mov.b %d7,(%a0)+ # store d7b byte in memory
- swap %d7 # put LEN counter in word d7a
- clr.w %d7 # set d7a to signal no digits done
- dbf.w %d0,loop # do loop some more!
- bra.b end_bstr # finished, so exit
-first_d:
- swap %d7 # put digit word in d7b
- mov.w %d1,%d7 # put new digit in d7b
- swap %d7 # put LEN counter in word d7a
- addq.w &1,%d7 # set d7a to signal first digit done
- dbf.w %d0,loop # do loop some more!
- swap %d7 # put last digit in string
- lsl.w &4,%d7 # move it to upper 4 bits
- mov.b %d7,(%a0)+ # store it in memory string
-#
-# Clean up and return with result in fp0.
-#
-end_bstr:
- movm.l (%sp)+,&0xff # {%d0-%d7}
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# facc_in_b(): dmem_read_byte failed #
-# facc_in_w(): dmem_read_word failed #
-# facc_in_l(): dmem_read_long failed #
-# facc_in_d(): dmem_read of dbl prec failed #
-# facc_in_x(): dmem_read of ext prec failed #
-# #
-# facc_out_b(): dmem_write_byte failed #
-# facc_out_w(): dmem_write_word failed #
-# facc_out_l(): dmem_write_long failed #
-# facc_out_d(): dmem_write of dbl prec failed #
-# facc_out_x(): dmem_write of ext prec failed #
-# #
-# XREF **************************************************************** #
-# _real_access() - exit through access error handler #
-# #
-# INPUT *************************************************************** #
-# None #
-# #
-# OUTPUT ************************************************************** #
-# None #
-# #
-# ALGORITHM *********************************************************** #
-# Flow jumps here when an FP data fetch call gets an error #
-# result. This means the operating system wants an access error frame #
-# made out of the current exception stack frame. #
-# So, we first call restore() which makes sure that any updated #
-# -(an)+ register gets returned to its pre-exception value and then #
-# we change the stack to an access error stack frame. #
-# #
-#########################################################################
-
-facc_in_b:
- movq.l &0x1,%d0 # one byte
- bsr.w restore # fix An
-
- mov.w &0x0121,EXC_VOFF(%a6) # set FSLW
- bra.w facc_finish
-
-facc_in_w:
- movq.l &0x2,%d0 # two bytes
- bsr.w restore # fix An
-
- mov.w &0x0141,EXC_VOFF(%a6) # set FSLW
- bra.b facc_finish
-
-facc_in_l:
- movq.l &0x4,%d0 # four bytes
- bsr.w restore # fix An
-
- mov.w &0x0101,EXC_VOFF(%a6) # set FSLW
- bra.b facc_finish
-
-facc_in_d:
- movq.l &0x8,%d0 # eight bytes
- bsr.w restore # fix An
-
- mov.w &0x0161,EXC_VOFF(%a6) # set FSLW
- bra.b facc_finish
-
-facc_in_x:
- movq.l &0xc,%d0 # twelve bytes
- bsr.w restore # fix An
-
- mov.w &0x0161,EXC_VOFF(%a6) # set FSLW
- bra.b facc_finish
-
-################################################################
-
-facc_out_b:
- movq.l &0x1,%d0 # one byte
- bsr.w restore # restore An
-
- mov.w &0x00a1,EXC_VOFF(%a6) # set FSLW
- bra.b facc_finish
-
-facc_out_w:
- movq.l &0x2,%d0 # two bytes
- bsr.w restore # restore An
-
- mov.w &0x00c1,EXC_VOFF(%a6) # set FSLW
- bra.b facc_finish
-
-facc_out_l:
- movq.l &0x4,%d0 # four bytes
- bsr.w restore # restore An
-
- mov.w &0x0081,EXC_VOFF(%a6) # set FSLW
- bra.b facc_finish
-
-facc_out_d:
- movq.l &0x8,%d0 # eight bytes
- bsr.w restore # restore An
-
- mov.w &0x00e1,EXC_VOFF(%a6) # set FSLW
- bra.b facc_finish
-
-facc_out_x:
- mov.l &0xc,%d0 # twelve bytes
- bsr.w restore # restore An
-
- mov.w &0x00e1,EXC_VOFF(%a6) # set FSLW
-
-# here's where we actually create the access error frame from the
-# current exception stack frame.
-facc_finish:
- mov.l USER_FPIAR(%a6),EXC_PC(%a6) # store current PC
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6
-
- mov.l (%sp),-(%sp) # store SR, hi(PC)
- mov.l 0x8(%sp),0x4(%sp) # store lo(PC)
- mov.l 0xc(%sp),0x8(%sp) # store EA
- mov.l &0x00000001,0xc(%sp) # store FSLW
- mov.w 0x6(%sp),0xc(%sp) # fix FSLW (size)
- mov.w &0x4008,0x6(%sp) # store voff
-
- btst &0x5,(%sp) # supervisor or user mode?
- beq.b facc_out2 # user
- bset &0x2,0xd(%sp) # set supervisor TM bit
-
-facc_out2:
- bra.l _real_access
-
-##################################################################
-
-# if the effective addressing mode was predecrement or postincrement,
-# the emulation has already changed its value to the correct post-
-# instruction value. but since we're exiting to the access error
-# handler, then AN must be returned to its pre-instruction value.
-# we do that here.
-restore:
- mov.b EXC_OPWORD+0x1(%a6),%d1
- andi.b &0x38,%d1 # extract opmode
- cmpi.b %d1,&0x18 # postinc?
- beq.w rest_inc
- cmpi.b %d1,&0x20 # predec?
- beq.w rest_dec
- rts
-
-rest_inc:
- mov.b EXC_OPWORD+0x1(%a6),%d1
- andi.w &0x0007,%d1 # fetch An
-
- mov.w (tbl_rest_inc.b,%pc,%d1.w*2),%d1
- jmp (tbl_rest_inc.b,%pc,%d1.w*1)
-
-tbl_rest_inc:
- short ri_a0 - tbl_rest_inc
- short ri_a1 - tbl_rest_inc
- short ri_a2 - tbl_rest_inc
- short ri_a3 - tbl_rest_inc
- short ri_a4 - tbl_rest_inc
- short ri_a5 - tbl_rest_inc
- short ri_a6 - tbl_rest_inc
- short ri_a7 - tbl_rest_inc
-
-ri_a0:
- sub.l %d0,EXC_DREGS+0x8(%a6) # fix stacked a0
- rts
-ri_a1:
- sub.l %d0,EXC_DREGS+0xc(%a6) # fix stacked a1
- rts
-ri_a2:
- sub.l %d0,%a2 # fix a2
- rts
-ri_a3:
- sub.l %d0,%a3 # fix a3
- rts
-ri_a4:
- sub.l %d0,%a4 # fix a4
- rts
-ri_a5:
- sub.l %d0,%a5 # fix a5
- rts
-ri_a6:
- sub.l %d0,(%a6) # fix stacked a6
- rts
-# if it's a fmove out instruction, we don't have to fix a7
-# because we hadn't changed it yet. if it's an opclass two
-# instruction (data moved in) and the exception was in supervisor
-# mode, then also also wasn't updated. if it was user mode, then
-# restore the correct a7 which is in the USP currently.
-ri_a7:
- cmpi.b EXC_VOFF(%a6),&0x30 # move in or out?
- bne.b ri_a7_done # out
-
- btst &0x5,EXC_SR(%a6) # user or supervisor?
- bne.b ri_a7_done # supervisor
- movc %usp,%a0 # restore USP
- sub.l %d0,%a0
- movc %a0,%usp
-ri_a7_done:
- rts
-
-# need to invert adjustment value if the <ea> was predec
-rest_dec:
- neg.l %d0
- bra.b rest_inc
diff --git a/sys/arch/m68k/060sp/fpsp.sa b/sys/arch/m68k/060sp/fpsp.sa
deleted file mode 100644
index bbb331cdcb9..00000000000
--- a/sys/arch/m68k/060sp/fpsp.sa
+++ /dev/null
@@ -1,3439 +0,0 @@
-#
-# $OpenBSD: fpsp.sa,v 1.2 1996/05/30 22:14:29 niklas Exp $
-# $NetBSD: fpsp.sa,v 1.2 1996/05/15 19:48:25 is Exp $
-#
-
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-# M68000 Hi-Performance Microprocessor Division
-# M68060 Software Package Production Release
-#
-# M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
-# All rights reserved.
-#
-# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-# To the maximum extent permitted by applicable law,
-# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
-# FOR A PARTICULAR PURPOSE and any warranty against infringement with
-# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-# and any accompanying written materials.
-#
-# To the maximum extent permitted by applicable law,
-# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
-# BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
-# ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
-#
-# Motorola assumes no responsibility for the maintenance and support
-# of the SOFTWARE.
-#
-# You are hereby granted a copyright license to use, modify, and distribute the
-# SOFTWARE so long as this entire notice is retained without alteration
-# in any modified and/or redistributed versions, and that such modified
-# versions are clearly identified as such.
-# No licenses are granted by implication, estoppel or otherwise under any
-# patents or trademarks of Motorola, Inc.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- dc.l $60ff0000,$17400000,$60ff0000,$15f40000
- dc.l $60ff0000,$02b60000,$60ff0000,$04700000
- dc.l $60ff0000,$1b100000,$60ff0000,$19aa0000
- dc.l $60ff0000,$1b5a0000,$60ff0000,$062e0000
- dc.l $60ff0000,$102c0000,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $2f00203a,$ff2c487b,$0930ffff,$fef8202f
- dc.l $00044e74,$00042f00,$203afef2,$487b0930
- dc.l $fffffee2,$202f0004,$4e740004,$2f00203a
- dc.l $fee0487b,$0930ffff,$fecc202f,$00044e74
- dc.l $00042f00,$203afed2,$487b0930,$fffffeb6
- dc.l $202f0004,$4e740004,$2f00203a,$fea4487b
- dc.l $0930ffff,$fea0202f,$00044e74,$00042f00
- dc.l $203afe96,$487b0930,$fffffe8a,$202f0004
- dc.l $4e740004,$2f00203a,$fe7c487b,$0930ffff
- dc.l $fe74202f,$00044e74,$00042f00,$203afe76
- dc.l $487b0930,$fffffe5e,$202f0004,$4e740004
- dc.l $2f00203a,$fe68487b,$0930ffff,$fe48202f
- dc.l $00044e74,$00042f00,$203afe56,$487b0930
- dc.l $fffffe32,$202f0004,$4e740004,$2f00203a
- dc.l $fe44487b,$0930ffff,$fe1c202f,$00044e74
- dc.l $00042f00,$203afe32,$487b0930,$fffffe06
- dc.l $202f0004,$4e740004,$2f00203a,$fe20487b
- dc.l $0930ffff,$fdf0202f,$00044e74,$00042f00
- dc.l $203afe1e,$487b0930,$fffffdda,$202f0004
- dc.l $4e740004,$2f00203a,$fe0c487b,$0930ffff
- dc.l $fdc4202f,$00044e74,$00042f00,$203afdfa
- dc.l $487b0930,$fffffdae,$202f0004,$4e740004
- dc.l $2f00203a,$fde8487b,$0930ffff,$fd98202f
- dc.l $00044e74,$00042f00,$203afdd6,$487b0930
- dc.l $fffffd82,$202f0004,$4e740004,$2f00203a
- dc.l $fdc4487b,$0930ffff,$fd6c202f,$00044e74
- dc.l $00042f00,$203afdb2,$487b0930,$fffffd56
- dc.l $202f0004,$4e740004,$2f00203a,$fda0487b
- dc.l $0930ffff,$fd40202f,$00044e74,$00042f00
- dc.l $203afd8e,$487b0930,$fffffd2a,$202f0004
- dc.l $4e740004,$2f00203a,$fd7c487b,$0930ffff
- dc.l $fd14202f,$00044e74,$00042f00,$203afd6a
- dc.l $487b0930,$fffffcfe,$202f0004,$4e740004
- dc.l $40c62d38,$d3d64634,$3d6f90ae,$b1e75cc7
- dc.l $40000000,$c90fdaa2,$2168c235,$00000000
- dc.l $3fff0000,$c90fdaa2,$2168c235,$00000000
- dc.l $3fe45f30,$6dc9c883,$4e56ff40,$f32eff6c
- dc.l $48ee0303,$ff9cf22e,$bc00ff60,$f22ef0c0
- dc.l $ffdc2d6e,$ff68ff44,$206eff44,$58aeff44
- dc.l $61ffffff,$ff042d40,$ff40082e,$0005ff42
- dc.l $66000116,$41eeff6c,$61ff0000,$051c41ee
- dc.l $ff6c61ff,$0000c1dc,$1d40ff4e,$082e0005
- dc.l $ff436726,$e9ee0183,$ff4261ff,$0000bd22
- dc.l $41eeff78,$61ff0000,$c1ba0c00,$00066606
- dc.l $61ff0000,$c11e1d40,$ff4f4280,$102eff63
- dc.l $122eff43,$0241007f,$02ae00ff,$01ffff64
- dc.l $f23c9000,$00000000,$f23c8800,$00000000
- dc.l $41eeff6c,$43eeff78,$223b1530,$00007112
- dc.l $4ebb1930,$0000710a,$e9ee0183,$ff4261ff
- dc.l $0000bd4e,$082e0004,$ff626622,$082e0001
- dc.l $ff626644,$f22ed0c0,$ffdcf22e,$9c00ff60
- dc.l $4cee0303,$ff9c4e5e,$60ffffff,$fcc6f22e
- dc.l $f040ff6c,$3d7ce005,$ff6ef22e,$d0c0ffdc
- dc.l $f22e9c00,$ff604cee,$0303ff9c,$f36eff6c
- dc.l $4e5e60ff,$fffffcb2,$f22ef040,$ff6c1d7c
- dc.l $00c4000b,$3d7ce001,$ff6ef22e,$d0c0ffdc
- dc.l $f22e9c00,$ff604cee,$0303ff9c,$f36eff6c
- dc.l $4e5e60ff,$fffffcae,$1d7c0000,$ff4e4280
- dc.l $102eff63,$02aeffff,$00ffff64,$f23c9000
- dc.l $00000000,$f23c8800,$00000000,$41eeff6c
- dc.l $61ff0000,$b2ce082e,$0004ff62,$6600ff70
- dc.l $082e0001,$ff626600,$ff90f22e,$d0c0ffdc
- dc.l $f22e9c00,$ff604cee,$0303ff9c,$4e5e0817
- dc.l $000767ff,$fffffc0c,$f22fa400,$00083f7c
- dc.l $20240006,$60ffffff,$fcec4e56,$ff40f32e
- dc.l $ff6c48ee,$0303ff9c,$f22ebc00,$ff60f22e
- dc.l $f0c0ffdc,$2d6eff68,$ff44206e,$ff4458ae
- dc.l $ff4461ff,$fffffd42,$2d40ff40,$082e0005
- dc.l $ff426600,$013241ee,$ff6c61ff,$0000035a
- dc.l $41eeff6c,$61ff0000,$c01a1d40,$ff4e082e
- dc.l $0005ff43,$672e082e,$0004ff43,$6626e9ee
- dc.l $0183ff42,$61ff0000,$bb5841ee,$ff7861ff
- dc.l $0000bff0,$0c000006,$660661ff,$0000bf54
- dc.l $1d40ff4f,$4280102e,$ff63122e,$ff430241
- dc.l $007f02ae,$00ff01ff,$ff64f23c,$90000000
- dc.l $0000f23c,$88000000,$000041ee,$ff6c43ee
- dc.l $ff78223b,$15300000,$6f484ebb,$19300000
- dc.l $6f40e9ee,$0183ff42,$61ff0000,$bb84082e
- dc.l $0003ff62,$6622082e,$0001ff62,$664ef22e
- dc.l $d0c0ffdc,$f22e9c00,$ff604cee,$0303ff9c
- dc.l $4e5e60ff,$fffffafc,$082e0003,$ff666700
- dc.l $ffd6f22e,$f040ff6c,$3d7ce003,$ff6ef22e
- dc.l $d0c0ffdc,$f22e9c00,$ff604cee,$0303ff9c
- dc.l $f36eff6c,$4e5e60ff,$fffffaf4,$082e0001
- dc.l $ff666700,$ffaaf22e,$f040ff6c,$1d7c00c4
- dc.l $000b3d7c,$e001ff6e,$f22ed0c0,$ffdcf22e
- dc.l $9c00ff60,$4cee0303,$ff9cf36e,$ff6c4e5e
- dc.l $60ffffff,$fad01d7c,$0000ff4e,$4280102e
- dc.l $ff6302ae,$ffff00ff,$ff64f23c,$90000000
- dc.l $0000f23c,$88000000,$000041ee,$ff6c61ff
- dc.l $0000b0f0,$082e0003,$ff626600,$ff66082e
- dc.l $0001ff62,$6600ff90,$f22ed0c0,$ffdcf22e
- dc.l $9c00ff60,$4cee0303,$ff9c4e5e,$08170007
- dc.l $67ffffff,$fa2ef22f,$a4000008,$3f7c2024
- dc.l $000660ff,$fffffb0e,$4e56ff40,$f32eff6c
- dc.l $48ee0303,$ff9cf22e,$bc00ff60,$f22ef0c0
- dc.l $ffdc082e,$00050004,$66084e68,$2d48ffd8
- dc.l $600841ee,$00102d48,$ffd82d6e,$ff68ff44
- dc.l $206eff44,$58aeff44,$61ffffff,$fb4c2d40
- dc.l $ff40422e,$ff4a082e,$0005ff42,$66000208
- dc.l $e9ee0006,$ff420c00,$00136700,$049e02ae
- dc.l $00ff00ff,$ff64f23c,$90000000,$0000f23c
- dc.l $88000000,$000041ee,$ff6c61ff,$0000013a
- dc.l $41eeff6c,$61ff0000,$bdfa0c00,$00066606
- dc.l $61ff0000,$bd5e1d40,$ff4ee9ee,$0183ff42
- dc.l $082e0005,$ff436728,$0c2e003a,$ff436720
- dc.l $61ff0000,$b92c41ee,$ff7861ff,$0000bdc4
- dc.l $0c000006,$660661ff,$0000bd28,$1d40ff4f
- dc.l $4280102e,$ff63e9ee,$1047ff43,$41eeff6c
- dc.l $43eeff78,$223b1d30,$00006d36,$4ebb1930
- dc.l $00006d2e,$102eff62,$6634102e,$ff430200
- dc.l $00380c00,$0038670c,$e9ee0183,$ff4261ff
- dc.l $0000b95e,$f22ed0c0,$ffdcf22e,$9c00ff60
- dc.l $4cee0303,$ff9c4e5e,$60ffffff,$f8e6c02e
- dc.l $ff66edc0,$06086614,$082e0004,$ff6667ba
- dc.l $082e0001,$ff6267b2,$60000066,$04800000
- dc.l $00180c00,$00066614,$082e0003,$ff666600
- dc.l $004a082e,$0004ff66,$66000046,$2f0061ff
- dc.l $000007e0,$201f3d7b,$0222ff6e,$f22ed0c0
- dc.l $ffdcf22e,$9c00ff60,$4cee0303,$ff9cf36e
- dc.l $ff6c4e5e,$60ffffff,$f87ae000,$e006e004
- dc.l $e005e003,$e002e001,$e001303c,$000460bc
- dc.l $303c0003,$60b6e9ee,$0006ff42,$0c000011
- dc.l $67080c00,$00156750,$4e753028,$00000240
- dc.l $7fff0c40,$3f806708,$0c40407f,$672c4e75
- dc.l $02a87fff,$ffff0004,$671861ff,$0000bbbc
- dc.l $44400640,$3f810268,$80000000,$81680000
- dc.l $4e750268,$80000000,$4e750228,$007f0004
- dc.l $00687fff,$00004e75,$30280000,$02407fff
- dc.l $0c403c00,$67080c40,$43ff67de,$4e7502a8
- dc.l $7fffffff,$00046606,$4aa80008,$67c461ff
- dc.l $0000bb68,$44400640,$3c010268,$80000000
- dc.l $81680000,$4e75e9ee,$00c3ff42,$0c000003
- dc.l $670004a2,$0c000007,$6700049a,$02aeffff
- dc.l $00ffff64,$f23c9000,$00000000,$f23c8800
- dc.l $00000000,$302eff6c,$02407fff,$671041ee
- dc.l $ff6c61ff,$0000bb5c,$1d40ff4e,$60061d7c
- dc.l $0004ff4e,$4280102e,$ff6341ee,$ff6c2d56
- dc.l $ffd461ff,$0000adec,$102eff62,$66000086
- dc.l $2caeffd4,$082e0005,$00046626,$206effd8
- dc.l $4e60f22e,$d0c0ffdc,$f22e9c00,$ff604cee
- dc.l $0303ff9c,$4e5e0817,$0007667a,$60ffffff
- dc.l $f7220c2e,$0008ff4a,$66d8f22e,$f080ff6c
- dc.l $f22ed0c0,$ffdcf22e,$9c00ff60,$4cee0303
- dc.l $ff9c2c56,$2f6f00c4,$00b82f6f,$00c800bc
- dc.l $2f6f002c,$00c42f6f,$003000c8,$2f6f0034
- dc.l $00ccdffc,$000000b8,$08170007,$662860ff
- dc.l $fffff6d0,$c02eff66,$edc00608,$662a082e
- dc.l $0004ff66,$6700ff6a,$082e0001,$ff626700
- dc.l $ff606000,$01663f7c,$20240006,$f22fa400
- dc.l $000860ff,$fffff78e,$04800000,$0018303b
- dc.l $020a4efb,$00064afc,$00080000,$0000003a
- dc.l $00640094,$00000140,$0000f22e,$d0c0ffdc
- dc.l $f22e9c00,$ff604cee,$0303ff9c,$3d7c30d8
- dc.l $000a3d7c,$e006ff6e,$f36eff6c,$4e5e60ff
- dc.l $fffff6d4,$f22ed0c0,$ffdcf22e,$9c00ff60
- dc.l $4cee0303,$ff9c3d7c,$30d0000a,$3d7ce004
- dc.l $ff6ef36e,$ff6c4e5e,$60ffffff,$f694f22e
- dc.l $f040ff6c,$f22ed0c0,$ffdcf22e,$9c00ff60
- dc.l $4cee0303,$ff9c3d7c,$30d4000a,$3d7ce005
- dc.l $ff6ef36e,$ff6c4e5e,$60ffffff,$f60c2cae
- dc.l $ffd4082e,$00050004,$66000038,$206effd8
- dc.l $4e60f22e,$f040ff6c,$f22ed0c0,$ffdcf22e
- dc.l $9c00ff60,$4cee0303,$ff9c3d7c,$30cc000a
- dc.l $3d7ce003,$ff6ef36e,$ff6c4e5e,$60ffffff
- dc.l $f5de0c2e,$0008ff4a,$66c8f22e,$f080ff6c
- dc.l $f22ef040,$ff78f22e,$d0c0ffdc,$f22e9c00
- dc.l $ff604cee,$0303ff9c,$3d7c30cc,$000a3d7c
- dc.l $e003ff7a,$f36eff78,$2c562f6f,$00c400b8
- dc.l $2f6f00c8,$00bc2f6f,$00cc00c0,$2f6f002c
- dc.l $00c42f6f,$003000c8,$2f6f0034,$00ccdffc
- dc.l $000000b8,$60ffffff,$f576f22e,$f040ff6c
- dc.l $f22ed0c0,$ffdcf22e,$9c00ff60,$4cee0303
- dc.l $ff9c3d7c,$30c4000a,$3d7ce001,$ff6ef36e
- dc.l $ff6c4e5e,$60ffffff,$f55c02ae,$00ff00ff
- dc.l $ff64f23c,$90000000,$0000f23c,$88000000
- dc.l $000061ff,$0000bdba,$41eeff6c,$61ff0000
- dc.l $b9621d40,$ff4ee9ee,$0183ff42,$082e0005
- dc.l $ff436728,$0c2e003a,$ff436720,$61ff0000
- dc.l $b4a041ee,$ff7861ff,$0000b938,$0c000006
- dc.l $660661ff,$0000b89c,$1d40ff4f,$4280102e
- dc.l $ff63e9ee,$1047ff43,$41eeff6c,$43eeff78
- dc.l $223b1d30,$000068aa,$4ebb1930,$000068a2
- dc.l $102eff62,$6600008a,$102eff43,$02000038
- dc.l $0c000038,$670ce9ee,$0183ff42,$61ff0000
- dc.l $b4d0082e,$00050004,$6600002a,$206effd8
- dc.l $4e60f22e,$d0c0ffdc,$f22e9c00,$ff604cee
- dc.l $0303ff9c,$4e5e0817,$00076600,$012660ff
- dc.l $fffff440,$082e0002,$ff4a67d6,$f22ed0c0
- dc.l $ffdcf22e,$9c00ff60,$4cee0303,$ff9c4e5e
- dc.l $2f6f0004,$00102f6f,$0000000c,$dffc0000
- dc.l $000c0817,$00076600,$00ea60ff,$fffff404
- dc.l $c02eff66,$edc00608,$6618082e,$0004ff66
- dc.l $6700ff66,$082e0001,$ff626700,$ff5c6000
- dc.l $006e0480,$00000018,$0c000006,$6d14082e
- dc.l $0003ff66,$66000060,$082e0004,$ff666600
- dc.l $004e082e,$00050004,$66000054,$206effd8
- dc.l $4e603d7b,$022aff6e,$f22ed0c0,$ffdcf22e
- dc.l $9c00ff60,$4cee0303,$ff9cf36e,$ff6c4e5e
- dc.l $08170007,$6600006c,$60ffffff,$f386e000
- dc.l $e006e004,$e005e003,$e002e001,$e001303c
- dc.l $00036000,$ffae303c,$00046000,$ffa6082e
- dc.l $0002ff4a,$67ac3d7b,$02d6ff6e,$f22ed0c0
- dc.l $ffdcf22e,$9c00ff60,$4cee0303,$ff9cf36e
- dc.l $ff6c4e5e,$2f6f0004,$00102f6f,$0000000c
- dc.l $dffc0000,$000c0817,$00076606,$60ffffff
- dc.l $f3223f7c,$20240006,$f22fa400,$000860ff
- dc.l $fffff402,$02aeffff,$00ffff64,$f23c9000
- dc.l $00000000,$f23c8800,$00000000,$e9ee0183
- dc.l $ff4261ff,$0000b22a,$41eeff6c,$61ff0000
- dc.l $b7520c00,$00066606,$61ff0000,$b6b61d40
- dc.l $ff4e4280,$102eff63,$41eeff6c,$2d56ffd4
- dc.l $61ff0000,$a94e102e,$ff626600,$00842cae
- dc.l $ffd4082e,$00050004,$6628206e,$ffd84e60
- dc.l $f22ed0c0,$ffdcf22e,$9c00ff60,$4cee0303
- dc.l $ff9c4e5e,$08170007,$6600ff68,$60ffffff
- dc.l $f282082e,$0003ff4a,$67d6f22e,$d0c0ffdc
- dc.l $f22e9c00,$ff604cee,$0303ff9c,$2c562f6f
- dc.l $00c400b8,$2f6f00c8,$00bc2f6f,$003800c4
- dc.l $2f6f003c,$00c82f6f,$004000cc,$dffc0000
- dc.l $00b80817,$00076600,$ff1a60ff,$fffff234
- dc.l $c02eff66,$edc00608,$6700ff74,$2caeffd4
- dc.l $0c00001a,$6e0000e8,$67000072,$082e0005
- dc.l $0004660a,$206effd8,$4e606000,$fb8e0c2e
- dc.l $0008ff4a,$6600fb84,$f22ed0c0,$ffdcf22e
- dc.l $9c00ff60,$4cee0303,$ff9c3d7c,$30d8000a
- dc.l $3d7ce006,$ff6ef36e,$ff6c2c56,$2f6f00c4
- dc.l $00b82f6f,$00c800bc,$2f6f00cc,$00c02f6f
- dc.l $003800c4,$2f6f003c,$00c82f6f,$004000cc
- dc.l $dffc0000,$00b860ff,$fffff22c,$082e0005
- dc.l $00046600,$000c206e,$ffd84e60,$6000fb46
- dc.l $0c2e0008,$ff4a6600,$fb3cf22e,$d0c0ffdc
- dc.l $f22e9c00,$ff604cee,$0303ff9c,$3d7c30d0
- dc.l $000a3d7c,$e004ff6e,$f36eff6c,$2c562f6f
- dc.l $00c400b8,$2f6f00c8,$00bc2f6f,$00cc00c0
- dc.l $2f6f0038,$00c42f6f,$003c00c8,$2f6f0040
- dc.l $00ccdffc,$000000b8,$60ffffff,$f1a4082e
- dc.l $00050004,$6600000c,$206effd8,$4e606000
- dc.l $fbda0c2e,$0008ff4a,$6600fbd0,$f22ed0c0
- dc.l $ffdcf22e,$9c00ff60,$4cee0303,$ff9c3d7c
- dc.l $30c4000a,$3d7ce001,$ff6ef36e,$ff6c2c56
- dc.l $2f6f00c4,$00b82f6f,$00c800bc,$2f6f00cc
- dc.l $00c02f6f,$003800c4,$2f6f003c,$00c82f6f
- dc.l $004000cc,$dffc0000,$00b860ff,$fffff106
- dc.l $e9ee00c3,$ff420c00,$00016708,$0c000005
- dc.l $67344e75,$302eff6c,$02407fff,$67260c40
- dc.l $3f806e20,$44400640,$3f81222e,$ff70e0a9
- dc.l $08c1001f,$2d41ff70,$026e8000,$ff6c006e
- dc.l $3f80ff6c,$4e75302e,$ff6c0240,$7fff673a
- dc.l $0c403c00,$6e344a2e,$ff6c5bee,$ff6e3d40
- dc.l $ff6c4280,$41eeff6c,$323c3c01,$61ff0000
- dc.l $b156303c,$3c004a2e,$ff6e6704,$08c0000f
- dc.l $08ee0007,$ff703d40,$ff6c4e75,$082e0005
- dc.l $000467ff,$fffff176,$2d680000,$ff782d68
- dc.l $0004ff7c,$2d680008,$ff804281,$4e752f00
- dc.l $4e7a0808,$08000001,$66000460,$201f4e56
- dc.l $ff4048ee,$0303ff9c,$f22ebc00,$ff60f22e
- dc.l $f0c0ffdc,$2d6e0006,$ff44206e,$ff4458ae
- dc.l $ff4461ff,$fffff152,$2d40ff40,$4a406b00
- dc.l $020e02ae,$00ff00ff,$ff640800,$000a6618
- dc.l $206eff44,$43eeff6c,$700c61ff,$fffff0d2
- dc.l $4a816600,$04926048,$206eff44,$43eeff6c
- dc.l $700c61ff,$fffff0ba,$4a816600,$047ae9ee
- dc.l $004fff6c,$0c407fff,$6726102e,$ff6f0200
- dc.l $000f660c,$4aaeff70,$66064aae,$ff746710
- dc.l $41eeff6c,$61ff0000,$b88cf22e,$f080ff6c
- dc.l $06ae0000,$000cff44,$41eeff6c,$61ff0000
- dc.l $b3c21d40,$ff4e0c00,$0006660a,$61ff0000
- dc.l $b3221d40,$ff4e422e,$ff53082e,$0005ff43
- dc.l $6748082e,$0004ff43,$662ce9ee,$0183ff42
- dc.l $61ff0000,$aeec41ee,$ff7861ff,$0000b384
- dc.l $1d40ff4f,$0c000006,$662061ff,$0000b2e4
- dc.l $1d40ff4f,$6014082e,$0003ff43,$670c50ee
- dc.l $ff53082e,$0001ff43,$67c04280,$102eff63
- dc.l $122eff43,$0241007f,$f23c9000,$00000000
- dc.l $f23c8800,$00000000,$41eeff6c,$43eeff78
- dc.l $223b1530,$000062ca,$4ebb1930,$000062c2
- dc.l $102eff62,$66404a2e,$ff53660c,$e9ee0183
- dc.l $ff4261ff,$0000aefa,$2d6e0006,$ff682d6e
- dc.l $ff440006,$f22ed0c0,$ffdcf22e,$9c00ff60
- dc.l $4cee0303,$ff9c4e5e,$08170007,$66000096
- dc.l $60ffffff,$ee6ec02e,$ff66edc0,$06086612
- dc.l $082e0004,$ff6667ae,$082e0001,$ff6267ac
- dc.l $60340480,$00000018,$0c000006,$6610082e
- dc.l $0004ff66,$6620082e,$0003ff66,$66203d7b
- dc.l $0206ff6e,$601ee002,$e006e004,$e005e003
- dc.l $e002e001,$e0013d7c,$e005ff6e,$60063d7c
- dc.l $e003ff6e,$2d6e0006,$ff682d6e,$ff440006
- dc.l $f22ed0c0,$ffdcf22e,$9c00ff60,$4cee0303
- dc.l $ff9cf36e,$ff6c4e5e,$08170007,$660660ff
- dc.l $ffffede0,$2f173f6f,$00080004,$3f7c2024
- dc.l $0006f22f,$a4000008,$60ffffff,$eeb80800
- dc.l $000e6700,$01c2082e,$00050004,$66164e68
- dc.l $2d48ffd8,$61ff0000,$9564206e,$ffd84e60
- dc.l $600001aa,$422eff4a,$41ee000c,$2d48ffd8
- dc.l $61ff0000,$95480c2e,$0008ff4a,$67000086
- dc.l $0c2e0004,$ff4a6600,$0184082e,$00070004
- dc.l $66363dae,$00040804,$2daeff44,$08063dbc
- dc.l $00f0080a,$41f60804,$2d480004,$f22ed0c0
- dc.l $ffdcf22e,$9c00ff60,$4cee0303,$ff9c4e5e
- dc.l $2e5f60ff,$ffffed3c,$3dae0004,$08002dae
- dc.l $ff440802,$3dbc2024,$08062dae,$00060808
- dc.l $41f60800,$2d480004,$f22ed0c0,$ffdcf22e
- dc.l $9c00ff60,$4cee0303,$ff9c4e5e,$2e5f60ff
- dc.l $ffffedf2,$1d41000a,$1d40000b,$f22ed0c0
- dc.l $ffdcf22e,$9c00ff60,$4cee0303,$ff9c2f16
- dc.l $2f002f01,$2f2eff44,$4280102e,$000b4480
- dc.l $082e0007,$0004671c,$3dae0004,$08002dae
- dc.l $00060808,$2d9f0802,$3dbc2024,$08064876
- dc.l $08006014,$3dae0004,$08042d9f,$08063dbc
- dc.l $00f0080a,$48760804,$4281122e,$000a4a01
- dc.l $6a0cf236,$f080080c,$06800000,$000ce309
- dc.l $6a0cf236,$f040080c,$06800000,$000ce309
- dc.l $6a0cf236,$f020080c,$06800000,$000ce309
- dc.l $6a0cf236,$f010080c,$06800000,$000ce309
- dc.l $6a0cf236,$f008080c,$06800000,$000ce309
- dc.l $6a0cf236,$f004080c,$06800000,$000ce309
- dc.l $6a0cf236,$f002080c,$06800000,$000ce309
- dc.l $6a06f236,$f001080c,$222f0004,$202f0008
- dc.l $2c6f000c,$2e5f0817,$000767ff,$ffffec04
- dc.l $60ffffff,$ecf061ff,$00009bda,$f22ed0c0
- dc.l $ffdcf22e,$9c00ff60,$4cee0303,$ff9c082e
- dc.l $00070004,$660e2d6e,$ff440006,$4e5e60ff
- dc.l $ffffebd0,$2c563f6f,$00c400c0,$2f6f00c6
- dc.l $00c82f6f,$000400c2,$3f7c2024,$00c6dffc
- dc.l $000000c0,$60ffffff,$ec9c201f,$4e56ff40
- dc.l $48ee0303,$ff9c2d6e,$0006ff44,$206eff44
- dc.l $58aeff44,$61ffffff,$ed002d40,$ff404a40
- dc.l $6b047010,$60260800,$000e6610,$e9c014c3
- dc.l $700c0c01,$00076614,$58806010,$428061ff
- dc.l $0000967c,$202eff44,$90ae0006,$3d40000a
- dc.l $4cee0303,$ff9c4e5e,$518f2f00,$3f6f000c
- dc.l $00042f6f,$000e0006,$4280302f,$00122f6f
- dc.l $00060010,$d1af0006,$3f7c402c,$000a201f
- dc.l $60ffffff,$ebe44e7a,$08080800,$0001660c
- dc.l $f22e9c00,$ff60f22e,$d0c0ffdc,$4cee0303
- dc.l $ff9c4e5e,$514f2eaf,$00083f6f,$000c0004
- dc.l $3f7c4008,$00062f6f,$00020008,$2f7c0942
- dc.l $8001000c,$08170005,$670608ef,$0002000d
- dc.l $60ffffff,$ebd64fee,$ff404e7a,$18080801
- dc.l $0001660c,$f22ed0c0,$ffdcf22f,$9c000020
- dc.l $2c562f6f,$00c400bc,$3f6f00c8,$00c03f7c
- dc.l $400800c2,$2f4800c4,$3f4000c8,$3f7c0001
- dc.l $00ca4cef,$0303005c,$defc00bc,$60a64e56
- dc.l $ff40f32e,$ff6c48ee,$0303ff9c,$f22ebc00
- dc.l $ff60f22e,$f0c0ffdc,$2d6eff68,$ff44206e
- dc.l $ff4458ae,$ff4461ff,$ffffebce,$2d40ff40
- dc.l $0800000d,$662841ee,$ff6c61ff,$fffff1ea
- dc.l $f22ed0c0,$ffdcf22e,$9c00ff60,$4cee0303
- dc.l $ff9cf36e,$ff6c4e5e,$60ffffff,$ea94322e
- dc.l $ff6c0241,$7fff0c41,$7fff661a,$4aaeff74
- dc.l $660c222e,$ff700281,$7fffffff,$67082d6e
- dc.l $ff70ff54,$6012223c,$7fffffff,$4a2eff6c
- dc.l $6a025281,$2d41ff54,$e9c004c3,$122eff41
- dc.l $307b0206,$4efb8802,$006c0000,$0000ff98
- dc.l $003e0000,$00100000,$102eff54,$0c010007
- dc.l $6f16206e,$000c61ff,$ffffeb86,$4a8166ff
- dc.l $0000bca8,$6000ff6a,$02410007,$61ff0000
- dc.l $a8046000,$ff5c302e,$ff540c01,$00076f16
- dc.l $206e000c,$61ffffff,$eb6e4a81,$66ff0000
- dc.l $bc886000,$ff3c0241,$000761ff,$0000a79a
- dc.l $6000ff2e,$202eff54,$0c010007,$6f16206e
- dc.l $000c61ff,$ffffeb56,$4a8166ff,$0000bc68
- dc.l $6000ff0e,$02410007,$61ff0000,$a7306000
- dc.l $ff004e56,$ff40f32e,$ff6c48ee,$0303ff9c
- dc.l $f22ebc00,$ff60f22e,$f0c0ffdc,$2d6eff68
- dc.l $ff44206e,$ff4458ae,$ff4461ff,$ffffea8a
- dc.l $2d40ff40,$0800000d,$6600002a,$41eeff6c
- dc.l $61ffffff,$f0a4f22e,$d0c0ffdc,$f22e9c00
- dc.l $ff604cee,$0303ff9c,$f36eff6c,$4e5e60ff
- dc.l $ffffe964,$e9c004c3,$122eff41,$307b0206
- dc.l $4efb8802,$007400a6,$015a0000,$00420104
- dc.l $00100000,$102eff70,$08c00006,$0c010007
- dc.l $6f16206e,$000c61ff,$ffffea76,$4a8166ff
- dc.l $0000bb98,$6000ffa0,$02410007,$61ff0000
- dc.l $a6f46000,$ff92302e,$ff7008c0,$000e0c01
- dc.l $00076f16,$206e000c,$61ffffff,$ea5a4a81
- dc.l $66ff0000,$bb746000,$ff6e0241,$000761ff
- dc.l $0000a686,$6000ff60,$202eff70,$08c0001e
- dc.l $0c010007,$6f16206e,$000c61ff,$ffffea3e
- dc.l $4a8166ff,$0000bb50,$6000ff3c,$02410007
- dc.l $61ff0000,$a6186000,$ff2e0c01,$00076f2e
- dc.l $202eff6c,$02808000,$00000080,$7fc00000
- dc.l $222eff70,$e0898081,$206e000c,$61ffffff
- dc.l $e9fc4a81,$66ff0000,$bb0e6000,$fefa202e
- dc.l $ff6c0280,$80000000,$00807fc0,$00002f01
- dc.l $222eff70,$e0898081,$221f0241,$000761ff
- dc.l $0000a5ba,$6000fed0,$202eff6c,$02808000
- dc.l $00000080,$7ff80000,$222eff70,$2d40ff84
- dc.l $700be0a9,$83aeff84,$222eff70,$02810000
- dc.l $07ffe0b9,$2d41ff88,$222eff74,$e0a983ae
- dc.l $ff8841ee,$ff84226e,$000c7008,$61ffffff
- dc.l $e8cc4a81,$66ff0000,$ba9c6000,$fe7a422e
- dc.l $ff4a3d6e,$ff6cff84,$426eff86,$202eff70
- dc.l $08c0001e,$2d40ff88,$2d6eff74,$ff8c082e
- dc.l $00050004,$66384e68,$2d48ffd8,$2d56ffd4
- dc.l $61ff0000,$98922248,$2d48000c,$206effd8
- dc.l $4e602cae,$ffd441ee,$ff84700c,$61ffffff
- dc.l $e86c4a81,$66ff0000,$ba4a6000,$fe1a2d56
- dc.l $ffd461ff,$00009860,$22482d48,$000c2cae
- dc.l $ffd40c2e,$0008ff4a,$66ccf22e,$d0c0ffdc
- dc.l $f22e9c00,$ff604cee,$0303ff9c,$f36eff6c
- dc.l $2c6effd4,$2f6f00c4,$00b82f6f,$00c800bc
- dc.l $2f6f00cc,$00c02f6f,$004400c4,$2f6f0048
- dc.l $00c82f6f,$004c00cc,$dffc0000,$00b860ff
- dc.l $ffffe734,$4e56ff40,$f32eff6c,$48ee0303
- dc.l $ff9cf22e,$bc00ff60,$f22ef0c0,$ffdc2d6e
- dc.l $ff68ff44,$206eff44,$58aeff44,$61ffffff
- dc.l $e7f82d40,$ff400800,$000d6600,$0106e9c0
- dc.l $04c36622,$0c6e401e,$ff6c661a,$f23c9000
- dc.l $00000000,$f22e4000,$ff70f22e,$6800ff6c
- dc.l $3d7ce001,$ff6e41ee,$ff6c61ff,$ffffedea
- dc.l $02ae00ff,$01ffff64,$f23c9000,$00000000
- dc.l $f23c8800,$00000000,$e9ee1006,$ff420c01
- dc.l $00176700,$009641ee,$ff6c61ff,$0000aa84
- dc.l $1d40ff4e,$082e0005,$ff43672e,$082e0004
- dc.l $ff436626,$e9ee0183,$ff4261ff,$0000a5c2
- dc.l $41eeff78,$61ff0000,$aa5a0c00,$00066606
- dc.l $61ff0000,$a9be1d40,$ff4f4280,$102eff63
- dc.l $122eff43,$0241007f,$41eeff6c,$43eeff78
- dc.l $223b1530,$000059ca,$4ebb1930,$000059c2
- dc.l $e9ee0183,$ff4261ff,$0000a606,$f22ed0c0
- dc.l $ffdcf22e,$9c00ff60,$4cee0303,$ff9cf36e
- dc.l $ff6c4e5e,$60ffffff,$e5cc4280,$102eff63
- dc.l $122eff43,$02810000,$007f61ff,$000043ce
- dc.l $60be1d7c,$0000ff4e,$4280102e,$ff6302ae
- dc.l $ffff00ff,$ff6441ee,$ff6c61ff,$00009be4
- dc.l $60aa4e56,$ff40f32e,$ff6c48ee,$0303ff9c
- dc.l $f22ebc00,$ff60f22e,$f0c0ffdc,$2d6eff68
- dc.l $ff44206e,$ff4458ae,$ff4461ff,$ffffe69a
- dc.l $2d40ff40,$41eeff6c,$61ffffff,$ecbcf22e
- dc.l $d0c0ffdc,$f22e9c00,$ff604cee,$0303ff9c
- dc.l $f36eff6c,$4e5e60ff,$ffffe592,$0c6f202c
- dc.l $000667ff,$000000aa,$0c6f402c,$000667ff
- dc.l $ffffe5a6,$4e56ff40,$48ee0303,$ff9c2d6e
- dc.l $0006ff44,$206eff44,$58aeff44,$61ffffff
- dc.l $e638e9c0,$100a0c41,$03c86664,$e9c01406
- dc.l $0c010017,$665a4e7a,$08080800,$0001672a
- dc.l $4cee0303,$ff9c4e5e,$518f3eaf,$00082f6f
- dc.l $000a0002,$3f7c402c,$00062f6f,$0002000c
- dc.l $58af0002,$60ffffff,$e5404cee,$0303ff9c
- dc.l $4e5ef22f,$84000002,$58af0002,$2f172f6f
- dc.l $00080004,$1f7c0020,$000660ff,$00000012
- dc.l $4cee0303,$ff9c4e5e,$60ffffff,$e4f64e56
- dc.l $ff4048ee,$0303ff9c,$f22ebc00,$ff60f22e
- dc.l $f0c0ffdc,$082e0005,$00046608,$4e682d48
- dc.l $ffd8600c,$41ee0010,$2d48ffd8,$2d48ffd4
- dc.l $2d6eff68,$ff44206e,$ff4458ae,$ff4461ff
- dc.l $ffffe576,$2d40ff40,$f23c9000,$00000000
- dc.l $f23c8800,$00000000,$422eff4a,$08000016
- dc.l $66000182,$422eff53,$02ae00ff,$00ffff64
- dc.l $e9c01406,$0c010017,$670000be,$61ff0000
- dc.l $95fc4280,$102eff63,$122eff43,$0241003f
- dc.l $e749822e,$ff4e43ee,$ff7841ee,$ff6c323b
- dc.l $132002b2,$4ebb1120,$02ac102e,$ff626600
- dc.l $00a2e9ee,$0183ff42,$61ff0000,$a3e4f22e
- dc.l $d0c0ffdc,$f22e9c00,$ff604cee,$0303ff9c
- dc.l $0c2e0004,$ff4a672a,$0c2e0008,$ff4a6722
- dc.l $4e5e0817,$000767ff,$ffffe358,$f327f22f
- dc.l $a4000014,$f35f3f7c,$20240006,$60ffffff
- dc.l $e434082e,$00050004,$660c2f08,$206effd8
- dc.l $4e60205f,$60ca2f00,$202effd8,$90aeffd4
- dc.l $2dae0008,$08082dae,$00040804,$3d400004
- dc.l $201f4e5e,$ded760aa,$4280102e,$ff63122e
- dc.l $ff430281,$0000007f,$61ff0000,$41506000
- dc.l $ff5ac02e,$ff66edc0,$06086616,$082e0004
- dc.l $ff666700,$ff4e082e,$0001ff62,$6700ff44
- dc.l $603e0480,$00000018,$0c000006,$6610082e
- dc.l $0004ff66,$662a082e,$0003ff66,$66302f00
- dc.l $61ffffff,$f1ee201f,$3d7b0206,$ff6e602a
- dc.l $e002e006,$e004e005,$e003e002,$e001e001
- dc.l $61ffffff,$f1ce3d7c,$e005ff6e,$600c61ff
- dc.l $fffff1c0,$3d7ce003,$ff6ef22e,$d0c0ffdc
- dc.l $f22e9c00,$ff604cee,$0303ff9c,$f36eff6c
- dc.l $6000feee,$e9c01283,$0c010001,$67000056
- dc.l $0c010007,$66000078,$e9c01343,$0c010002
- dc.l $6d00006c,$61ff0000,$82780c2e,$0002ff4a
- dc.l $670000d2,$0c2e0001,$ff4a6600,$01002d6e
- dc.l $ff68000c,$3d7c201c,$000af22e,$d0c0ffdc
- dc.l $f22e9c00,$ff604cee,$0303ff9c,$4e5e60ff
- dc.l $ffffe2dc,$206eff44,$54aeff44,$61ffffff
- dc.l $e3524a81,$6600047c,$48c061ff,$00007e60
- dc.l $0c2e0002,$ff4a6700,$007c6000,$00b061ff
- dc.l $00008562,$0c2e0002,$ff4a6700,$0068082e
- dc.l $00050004,$660a206e,$ffd84e60,$6000008e
- dc.l $0c2e0008,$ff4a6600,$0084f22e,$d0c0ffdc
- dc.l $f22e9c00,$ff604cee,$0303ff9c,$4e5e0817
- dc.l $00076612,$558f2eaf,$00022f6f,$00060004
- dc.l $60ffffff,$e17e558f,$2eaf0002,$3f6f0006
- dc.l $00043f7c,$20240006,$f22fa400,$000860ff
- dc.l $ffffe252,$3d7c00c0,$000e2d6e,$ff68000a
- dc.l $3d6e0004,$00083d7c,$e000ff6e,$f22ed0c0
- dc.l $ffdcf22e,$9c00ff60,$4cee0303,$ff9cf36e
- dc.l $ff6c4e5e,$588f60ff,$ffffe180,$f22ed0c0
- dc.l $ffdcf22e,$9c00ff60,$4cee0303,$ff9c4e5e
- dc.l $08170007,$660660ff,$ffffe108,$f22fa400
- dc.l $00081f7c,$00240007,$60ffffff,$e1e84afc
- dc.l $01c00000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $000028a4,$4b1e4b4c,$4f4c2982,$4f3c0000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $000035c6,$4b1e4b82,$4f4c371a,$4f3c0000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $000024b0,$4b1e4b8c,$4f4c2766,$4f3c0000
- dc.l $00002988,$4b1e4b94,$4f4c2af0,$4f3c0000
- dc.l $00001ab8,$4b1e4bd0,$4f4c1cf6,$4f3c0000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00001cfc,$4b1e4744,$4f4c1daa,$4f3c0000
- dc.l $00003720,$4b1e4744,$4f4c37a2,$4f3c0000
- dc.l $00000468,$4b1e4744,$4f4c064c,$4f3c0000
- dc.l $00000f2a,$4b1e4744,$4f4c108e,$4f3c0000
- dc.l $000022e0,$4b9a4b7a,$4f4c248c,$4f3c0000
- dc.l $00003d02,$4b9a4b7a,$4f4c3ddc,$4f3c0000
- dc.l $00003dfa,$4b9a4b7a,$4f4c3f2a,$4f3c0000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00003386,$47324b82,$4f4c3538,$4f3c0000
- dc.l $000037c8,$47324b82,$4f4c37f8,$4f3c0000
- dc.l $00003818,$47324b82,$4f4c3872,$4f3c0000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $000027e6,$4b9a4b52,$4f4c288a,$4f3c0000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00001db0,$4bd64744,$4f4c1e40,$4f3c0000
- dc.l $00000472,$4b9a4744,$4f4c0652,$4f3c0000
- dc.l $0000276c,$4b1e4744,$4f4c2788,$4f3c0000
- dc.l $000027a0,$4b1e4744,$4f4c27ce,$4f3c0000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00004ca4,$4cda4d12,$4ee24ca4,$4ef40000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00004dac,$4de24e1a,$4ee24dac,$4ef40000
- dc.l $00004e4e,$4e864ebe,$4ee24e4e,$4ef40000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000660,$4bf24c20,$4c3008f6,$4c400000
- dc.l $00000660,$4bf24c20,$4c3008f6,$4c400000
- dc.l $00000660,$4bf24c20,$4c3008f6,$4c400000
- dc.l $00000660,$4bf24c20,$4c3008f6,$4c400000
- dc.l $00000660,$4bf24c20,$4c3008f6,$4c400000
- dc.l $00000660,$4bf24c20,$4c3008f6,$4c400000
- dc.l $00000660,$4bf24c20,$4c3008f6,$4c400000
- dc.l $00000660,$4bf24c20,$4c3008f6,$4c400000
- dc.l $00004cee,$0303ff9c,$f22e9c00,$ff60f22e
- dc.l $d0c0ffdc,$2d6eff68,$00064e5e,$2f173f6f
- dc.l $00080004,$3f7c4008,$00062f6f,$00020008
- dc.l $2f7c0942,$8001000c,$08170005,$670608ef
- dc.l $0002000d,$60ffffff,$de32bd6a,$aa77ccc9
- dc.l $94f53de6,$12097aae,$8da1be5a,$e6452a11
- dc.l $8ae43ec7,$1de3a534,$1531bf2a,$01a01a01
- dc.l $8b590000,$00000000,$00003ff8,$00008888
- dc.l $88888888,$59af0000,$0000bffc,$0000aaaa
- dc.l $aaaaaaaa,$aa990000,$00003d2a,$c4d0d601
- dc.l $1ee3bda9,$396f9f45,$ac193e21,$eed90612
- dc.l $c972be92,$7e4fb79d,$9fcf3efa,$01a01a01
- dc.l $d4230000,$00000000,$0000bff5,$0000b60b
- dc.l $60b60b61,$d4380000,$00003ffa,$0000aaaa
- dc.l $aaaaaaaa,$ab5ebf00,$00002d7c,$00000000
- dc.l $ff5c6008,$2d7c0000,$0001ff5c,$f2104800
- dc.l $f22e6800,$ff842210,$32280004,$02817fff
- dc.l $ffff0c81,$3fd78000,$6c046000,$01780c81
- dc.l $4004bc7e,$6d046000,$0468f200,$0080f23a
- dc.l $54a3de7e,$43fb0170,$00000866,$f22e6080
- dc.l $ff58222e,$ff58e981,$d3c1f219,$4828f211
- dc.l $4428222e,$ff58d2ae,$ff5ce299,$0c810000
- dc.l $00006d00,$0088f227,$e00cf22e,$6800ff84
- dc.l $f2000023,$f23a5580,$fed2f23a,$5500fed4
- dc.l $f2000080,$f20004a3,$e2990281,$80000000
- dc.l $b3aeff84,$f20005a3,$f2000523,$f23a55a2
- dc.l $febaf23a,$5522febc,$f20005a3,$f2000523
- dc.l $f23a55a2,$feb6f23a,$4922fec0,$f2000ca3
- dc.l $f2000123,$f23a48a2,$fec2f22e,$4823ff84
- dc.l $f20008a2,$f2000423,$f21fd030,$f2009000
- dc.l $f22e4822,$ff8460ff,$00004364,$f227e00c
- dc.l $f2000023,$f23a5500,$fea2f23a,$5580fea4
- dc.l $f2000080,$f20004a3,$f22e6800,$ff84e299
- dc.l $02818000,$0000f200,$0523b3ae,$ff840281
- dc.l $80000000,$f20005a3,$00813f80,$00002d41
- dc.l $ff54f23a,$5522fe74,$f23a55a2,$fe76f200
- dc.l $0523f200,$05a3f23a,$5522fe70,$f23a49a2
- dc.l $fe7af200,$0523f200,$0ca3f23a,$4922fe7c
- dc.l $f23a44a2,$fe82f200,$0823f200,$0422f22e
- dc.l $4823ff84,$f21fd030,$f2009000,$f22e4422
- dc.l $ff5460ff,$000042c8,$0c813fff,$80006eff
- dc.l $00000300,$222eff5c,$0c810000,$00006e14
- dc.l $f2009000,$123c0003,$f22e4800,$ff8460ff
- dc.l $0000428e,$f23c4400,$3f800000,$f2009000
- dc.l $f23c4422,$80800000,$60ff0000,$428a60ff
- dc.l $00004110,$f23c4400,$3f800000,$60ff0000
- dc.l $42762d7c,$00000004,$ff5cf210,$4800f22e
- dc.l $6800ff84,$22103228,$00040281,$7fffffff
- dc.l $0c813fd7,$80006c04,$60000240,$0c814004
- dc.l $bc7e6d04,$6000027a,$f2000080,$f23a54a3
- dc.l $dc9043fb,$01700000,$0678f22e,$6080ff58
- dc.l $222eff58,$e981d3c1,$f2194828,$f2114428
- dc.l $222eff58,$e2990c81,$00000000,$6c000106
- dc.l $f227e004,$f22e6800,$ff84f200,$0023f23a
- dc.l $5480fce8,$f23a5500,$fd32f200,$00a3f200
- dc.l $01232f02,$2401e29a,$02828000,$0000b382
- dc.l $02828000,$0000f23a,$54a2fcc8,$f23a5522
- dc.l $fd12f200,$00a3b5ae,$ff84241f,$f2000123
- dc.l $e2990281,$80000000,$2d7c3f80,$0000ff54
- dc.l $b3aeff54,$f23a54a2,$fca2f23a,$5522fcec
- dc.l $f20000a3,$f2000123,$f22e6800,$ff90f23a
- dc.l $54a2fc90,$b3aeff90,$f23a5522,$fcd6f200
- dc.l $00a3f200,$0123f23a,$54a2fc80,$f23a5522
- dc.l $fccaf200,$00a3f200,$0123f23a,$48a2fc7c
- dc.l $f23a4922,$fcc6f200,$00a3f200,$0123f23a
- dc.l $48a2fc78,$f23a4922,$fcc2f200,$00a3f200
- dc.l $0823f22e,$48a3ff84,$f23a4422,$fcbaf22e
- dc.l $4823ff90,$f21fd020,$f2009000,$f22e48a2
- dc.l $ff8461ff,$0000448e,$f22e4422,$ff5460ff
- dc.l $000040fc,$f227e004,$f22e6800,$ff84f200
- dc.l $0023f23a,$5480fc34,$f23a5500,$fbdef200
- dc.l $00a3f22e,$6800ff90,$f2000123,$e2990281
- dc.l $80000000,$f23a54a2,$fc1af23a,$5522fbc4
- dc.l $b3aeff84,$b3aeff90,$f20000a3,$00813f80
- dc.l $00002d41,$ff54f200,$0123f23a,$54a2fbfc
- dc.l $f23a5522,$fba6f200,$00a3f200,$0123f23a
- dc.l $54a2fbf0,$f23a5522,$fb9af200,$00a3f200
- dc.l $0123f23a,$54a2fbe4,$f23a5522,$fb8ef200
- dc.l $00a3f200,$0123f23a,$48a2fbe0,$f23a4922
- dc.l $fb8af200,$00a3f200,$0123f23a,$48a2fbdc
- dc.l $f23a4922,$fb86f200,$00a3f200,$0823f23a
- dc.l $44a2fbd4,$f22e4823,$ff84f22e,$48a3ff90
- dc.l $f21fd020,$f2009000,$f22e44a2,$ff5461ff
- dc.l $000043a2,$f22e4822,$ff8460ff,$00004010
- dc.l $0c813fff,$80006e00,$0048f23c,$44803f80
- dc.l $0000f200,$9000f23c,$44a80080,$000061ff
- dc.l $00004372,$f200b000,$123c0003,$f22e4800
- dc.l $ff8460ff,$00003fca,$2f00f23c,$44803f80
- dc.l $000061ff,$0000434e,$201f60ff,$00003e54
- dc.l $f227e03c,$2f02f23c,$44800000,$00000c81
- dc.l $7ffeffff,$66523d7c,$7ffeff84,$2d7cc90f
- dc.l $daa2ff88,$42aeff8c,$3d7c7fdc,$ff902d7c
- dc.l $85a308d3,$ff9442ae,$ff98f200,$003af294
- dc.l $000e002e,$0080ff84,$002e0080,$ff90f22e
- dc.l $4822ff84,$f2000080,$f22e4822,$ff90f200
- dc.l $00a8f22e,$48a2ff90,$f22e6800,$ff84322e
- dc.l $ff842241,$02810000,$7fff0481,$00003fff
- dc.l $0c810000,$001c6f0e,$04810000,$001b1d7c
- dc.l $0000ff58,$60084281,$1d7c0001,$ff58243c
- dc.l $00003ffe,$94812d7c,$a2f9836e,$ff882d7c
- dc.l $4e44152a,$ff8c3d42,$ff84f200,$0100f22e
- dc.l $4923ff84,$24094842,$02828000,$00000082
- dc.l $5f000000,$2d42ff54,$f22e4522,$ff54f22e
- dc.l $4528ff54,$24010682,$00003fff,$3d42ff84
- dc.l $2d7cc90f,$daa2ff88,$42aeff8c,$06810000
- dc.l $3fdd3d41,$ff902d7c,$85a308d3,$ff9442ae
- dc.l $ff98122e,$ff58f200,$0a00f22e,$4a23ff84
- dc.l $f2000a80,$f22e4aa3,$ff90f200,$1180f200
- dc.l $15a2f200,$0e28f200,$0c28f200,$1622f200
- dc.l $0180f200,$10a8f200,$04220c01,$00006e00
- dc.l $000ef200,$01a8f200,$0ca26000,$ff0cf22e
- dc.l $6100ff58,$241ff21f,$d03c222e,$ff5c0c81
- dc.l $00000004,$6d00fa4c,$6000fc36,$3ea0b759
- dc.l $f50f8688,$bef2baa5,$a8924f04,$bf346f59
- dc.l $b39ba65f,$00000000,$00000000,$3ff60000
- dc.l $e073d3fc,$199c4a00,$00000000,$3ff90000
- dc.l $d23cd684,$15d95fa1,$00000000,$bffc0000
- dc.l $8895a6c5,$fb423bca,$00000000,$bffd0000
- dc.l $eef57e0d,$a84bc8ce,$00000000,$3ffc0000
- dc.l $a2f9836e,$4e44152a,$00000000,$40010000
- dc.l $c90fdaa2,$00000000,$00000000,$3fdf0000
- dc.l $85a308d4,$00000000,$00000000,$c0040000
- dc.l $c90fdaa2,$2168c235,$21800000,$c0040000
- dc.l $c2c75bcd,$105d7c23,$a0d00000,$c0040000
- dc.l $bc7edcf7,$ff523611,$a1e80000,$c0040000
- dc.l $b6365e22,$ee46f000,$21480000,$c0040000
- dc.l $afeddf4d,$dd3ba9ee,$a1200000,$c0040000
- dc.l $a9a56078,$cc3063dd,$21fc0000,$c0040000
- dc.l $a35ce1a3,$bb251dcb,$21100000,$c0040000
- dc.l $9d1462ce,$aa19d7b9,$a1580000,$c0040000
- dc.l $96cbe3f9,$990e91a8,$21e00000,$c0040000
- dc.l $90836524,$88034b96,$20b00000,$c0040000
- dc.l $8a3ae64f,$76f80584,$a1880000,$c0040000
- dc.l $83f2677a,$65ecbf73,$21c40000,$c0030000
- dc.l $fb53d14a,$a9c2f2c2,$20000000,$c0030000
- dc.l $eec2d3a0,$87ac669f,$21380000,$c0030000
- dc.l $e231d5f6,$6595da7b,$a1300000,$c0030000
- dc.l $d5a0d84c,$437f4e58,$9fc00000,$c0030000
- dc.l $c90fdaa2,$2168c235,$21000000,$c0030000
- dc.l $bc7edcf7,$ff523611,$a1680000,$c0030000
- dc.l $afeddf4d,$dd3ba9ee,$a0a00000,$c0030000
- dc.l $a35ce1a3,$bb251dcb,$20900000,$c0030000
- dc.l $96cbe3f9,$990e91a8,$21600000,$c0030000
- dc.l $8a3ae64f,$76f80584,$a1080000,$c0020000
- dc.l $fb53d14a,$a9c2f2c2,$1f800000,$c0020000
- dc.l $e231d5f6,$6595da7b,$a0b00000,$c0020000
- dc.l $c90fdaa2,$2168c235,$20800000,$c0020000
- dc.l $afeddf4d,$dd3ba9ee,$a0200000,$c0020000
- dc.l $96cbe3f9,$990e91a8,$20e00000,$c0010000
- dc.l $fb53d14a,$a9c2f2c2,$1f000000,$c0010000
- dc.l $c90fdaa2,$2168c235,$20000000,$c0010000
- dc.l $96cbe3f9,$990e91a8,$20600000,$c0000000
- dc.l $c90fdaa2,$2168c235,$1f800000,$bfff0000
- dc.l $c90fdaa2,$2168c235,$1f000000,$00000000
- dc.l $00000000,$00000000,$00000000,$3fff0000
- dc.l $c90fdaa2,$2168c235,$9f000000,$40000000
- dc.l $c90fdaa2,$2168c235,$9f800000,$40010000
- dc.l $96cbe3f9,$990e91a8,$a0600000,$40010000
- dc.l $c90fdaa2,$2168c235,$a0000000,$40010000
- dc.l $fb53d14a,$a9c2f2c2,$9f000000,$40020000
- dc.l $96cbe3f9,$990e91a8,$a0e00000,$40020000
- dc.l $afeddf4d,$dd3ba9ee,$20200000,$40020000
- dc.l $c90fdaa2,$2168c235,$a0800000,$40020000
- dc.l $e231d5f6,$6595da7b,$20b00000,$40020000
- dc.l $fb53d14a,$a9c2f2c2,$9f800000,$40030000
- dc.l $8a3ae64f,$76f80584,$21080000,$40030000
- dc.l $96cbe3f9,$990e91a8,$a1600000,$40030000
- dc.l $a35ce1a3,$bb251dcb,$a0900000,$40030000
- dc.l $afeddf4d,$dd3ba9ee,$20a00000,$40030000
- dc.l $bc7edcf7,$ff523611,$21680000,$40030000
- dc.l $c90fdaa2,$2168c235,$a1000000,$40030000
- dc.l $d5a0d84c,$437f4e58,$1fc00000,$40030000
- dc.l $e231d5f6,$6595da7b,$21300000,$40030000
- dc.l $eec2d3a0,$87ac669f,$a1380000,$40030000
- dc.l $fb53d14a,$a9c2f2c2,$a0000000,$40040000
- dc.l $83f2677a,$65ecbf73,$a1c40000,$40040000
- dc.l $8a3ae64f,$76f80584,$21880000,$40040000
- dc.l $90836524,$88034b96,$a0b00000,$40040000
- dc.l $96cbe3f9,$990e91a8,$a1e00000,$40040000
- dc.l $9d1462ce,$aa19d7b9,$21580000,$40040000
- dc.l $a35ce1a3,$bb251dcb,$a1100000,$40040000
- dc.l $a9a56078,$cc3063dd,$a1fc0000,$40040000
- dc.l $afeddf4d,$dd3ba9ee,$21200000,$40040000
- dc.l $b6365e22,$ee46f000,$a1480000,$40040000
- dc.l $bc7edcf7,$ff523611,$21e80000,$40040000
- dc.l $c2c75bcd,$105d7c23,$20d00000,$40040000
- dc.l $c90fdaa2,$2168c235,$a1800000,$f2104800
- dc.l $22103228,$00040281,$7fffffff,$0c813fd7
- dc.l $80006c04,$60000134,$0c814004,$bc7e6d04
- dc.l $60000144,$f2000080,$f23a54a3,$d3d443fa
- dc.l $fdbcf201,$6080e981,$d3c1f219,$4828f211
- dc.l $4428ea99,$02818000,$0000f227,$e00c0c81
- dc.l $00000000,$6d000072,$f2000080,$f20004a3
- dc.l $f23a5580,$faf8f23a,$5500fafa,$f20005a3
- dc.l $f2000523,$f23a55a2,$faf4f23a,$4922fafe
- dc.l $f20005a3,$f2000523,$f23a49a2,$fb00f23a
- dc.l $4922fb0a,$f20005a3,$f2000523,$f23a49a2
- dc.l $fb0cf200,$0123f200,$0ca3f200,$0822f23c
- dc.l $44a23f80,$0000f21f,$d030f200,$9000f200
- dc.l $042060ff,$000038d8,$f2000080,$f2000023
- dc.l $f23a5580,$fa88f23a,$5500fa8a,$f20001a3
- dc.l $f2000123,$f23a55a2,$fa84f23a,$4922fa8e
- dc.l $f20001a3,$f2000123,$f23a49a2,$fa90f23a
- dc.l $4922fa9a,$f20001a3,$f2000123,$f23a49a2
- dc.l $fa9cf200,$0523f200,$0c23f200,$08a2f23c
- dc.l $44223f80,$0000f21f,$d030f227,$68800a97
- dc.l $80000000,$f2009000,$f21f4820,$60ff0000
- dc.l $385e0c81,$3fff8000,$6e1cf227,$6800f200
- dc.l $9000123c,$0003f21f,$480060ff,$00003832
- dc.l $60ff0000,$36cef227,$e03c2f02,$f23c4480
- dc.l $00000000,$0c817ffe,$ffff6652,$3d7c7ffe
- dc.l $ff842d7c,$c90fdaa2,$ff8842ae,$ff8c3d7c
- dc.l $7fdcff90,$2d7c85a3,$08d3ff94,$42aeff98
- dc.l $f200003a,$f294000e,$002e0080,$ff84002e
- dc.l $0080ff90,$f22e4822,$ff84f200,$0080f22e
- dc.l $4822ff90,$f20000a8,$f22e48a2,$ff90f22e
- dc.l $6800ff84,$322eff84,$22410281,$00007fff
- dc.l $04810000,$3fff0c81,$0000001c,$6f0e0481
- dc.l $0000001b,$1d7c0000,$ff586008,$42811d7c
- dc.l $0001ff58,$243c0000,$3ffe9481,$2d7ca2f9
- dc.l $836eff88,$2d7c4e44,$152aff8c,$3d42ff84
- dc.l $f2000100,$f22e4923,$ff842409,$48420282
- dc.l $80000000,$00825f00,$00002d42,$ff54f22e
- dc.l $4522ff54,$f22e4528,$ff542401,$06820000
- dc.l $3fff3d42,$ff842d7c,$c90fdaa2,$ff8842ae
- dc.l $ff8c0681,$00003fdd,$3d41ff90,$2d7c85a3
- dc.l $08d3ff94,$42aeff98,$122eff58,$f2000a00
- dc.l $f22e4a23,$ff84f200,$0a80f22e,$4aa3ff90
- dc.l $f2001180,$f20015a2,$f2000e28,$f2000c28
- dc.l $f2001622,$f2000180,$f20010a8,$f2000422
- dc.l $0c010000,$6e00000e,$f20001a8,$f2000ca2
- dc.l $6000ff0c,$f22e6100,$ff54241f,$f21fd03c
- dc.l $222eff54,$e2996000,$fd72bff6,$687e3149
- dc.l $87d84002,$ac6934a2,$6db3bfc2,$476f4e1d
- dc.l $a28e3fb3,$44447f87,$6989bfb7,$44ee7faf
- dc.l $45db3fbc,$71c64694,$0220bfc2,$49249218
- dc.l $72f93fc9,$99999999,$8fa9bfd5,$55555555
- dc.l $5555bfb7,$0bf39853,$9e6a3fbc,$7187962d
- dc.l $1d7dbfc2,$49248271,$07b83fc9,$99999996
- dc.l $263ebfd5,$55555555,$55363fff,$0000c90f
- dc.l $daa22168,$c2350000,$0000bfff,$0000c90f
- dc.l $daa22168,$c2350000,$00000001,$00008000
- dc.l $00000000,$00000000,$00008001,$00008000
- dc.l $00000000,$00000000,$00003ffb,$000083d1
- dc.l $52c5060b,$7a510000,$00003ffb,$00008bc8
- dc.l $54456549,$8b8b0000,$00003ffb,$000093be
- dc.l $40601762,$6b0d0000,$00003ffb,$00009bb3
- dc.l $078d35ae,$c2020000,$00003ffb,$0000a3a6
- dc.l $9a525ddc,$e7de0000,$00003ffb,$0000ab98
- dc.l $e9436276,$56190000,$00003ffb,$0000b389
- dc.l $e502f9c5,$98620000,$00003ffb,$0000bb79
- dc.l $7e436b09,$e6fb0000,$00003ffb,$0000c367
- dc.l $a5c739e5,$f4460000,$00003ffb,$0000cb54
- dc.l $4c61cff7,$d5c60000,$00003ffb,$0000d33f
- dc.l $62f82488,$533e0000,$00003ffb,$0000db28
- dc.l $da816240,$4c770000,$00003ffb,$0000e310
- dc.l $a4078ad3,$4f180000,$00003ffb,$0000eaf6
- dc.l $b0a8188e,$e1eb0000,$00003ffb,$0000f2da
- dc.l $f1949dbe,$79d50000,$00003ffb,$0000fabd
- dc.l $581361d4,$7e3e0000,$00003ffc,$00008346
- dc.l $ac210959,$ecc40000,$00003ffc,$00008b23
- dc.l $2a083042,$82d80000,$00003ffc,$000092fb
- dc.l $70b8d29a,$e2f90000,$00003ffc,$00009acf
- dc.l $476f5ccd,$1cb40000,$00003ffc,$0000a29e
- dc.l $76304954,$f23f0000,$00003ffc,$0000aa68
- dc.l $c5d08ab8,$52300000,$00003ffc,$0000b22d
- dc.l $fffd9d53,$9f830000,$00003ffc,$0000b9ed
- dc.l $ef453e90,$0ea50000,$00003ffc,$0000c1a8
- dc.l $5f1cc75e,$3ea50000,$00003ffc,$0000c95d
- dc.l $1be82813,$8de60000,$00003ffc,$0000d10b
- dc.l $f300840d,$2de40000,$00003ffc,$0000d8b4
- dc.l $b2ba6bc0,$5e7a0000,$00003ffc,$0000e057
- dc.l $2a6bb423,$35f60000,$00003ffc,$0000e7f3
- dc.l $2a70ea9c,$aa8f0000,$00003ffc,$0000ef88
- dc.l $843264ec,$efaa0000,$00003ffc,$0000f717
- dc.l $0a28ecc0,$66660000,$00003ffd,$0000812f
- dc.l $d288332d,$ad320000,$00003ffd,$000088a8
- dc.l $d1b1218e,$4d640000,$00003ffd,$00009012
- dc.l $ab3f23e4,$aee80000,$00003ffd,$0000976c
- dc.l $c3d411e7,$f1b90000,$00003ffd,$00009eb6
- dc.l $89493889,$a2270000,$00003ffd,$0000a5ef
- dc.l $72c34487,$361b0000,$00003ffd,$0000ad17
- dc.l $00baf07a,$72270000,$00003ffd,$0000b42c
- dc.l $bcfafd37,$efb70000,$00003ffd,$0000bb30
- dc.l $3a940ba8,$0f890000,$00003ffd,$0000c221
- dc.l $15c6fcae,$bbaf0000,$00003ffd,$0000c8fe
- dc.l $f3e68633,$12210000,$00003ffd,$0000cfc9
- dc.l $8330b400,$0c700000,$00003ffd,$0000d680
- dc.l $7aa1102c,$5bf90000,$00003ffd,$0000dd23
- dc.l $99bc3125,$2aa30000,$00003ffd,$0000e3b2
- dc.l $a8556b8f,$c5170000,$00003ffd,$0000ea2d
- dc.l $764f6431,$59890000,$00003ffd,$0000f3bf
- dc.l $5bf8bad1,$a21d0000,$00003ffe,$0000801c
- dc.l $e39e0d20,$5c9a0000,$00003ffe,$00008630
- dc.l $a2dada1e,$d0660000,$00003ffe,$00008c1a
- dc.l $d445f3e0,$9b8c0000,$00003ffe,$000091db
- dc.l $8f1664f3,$50e20000,$00003ffe,$00009773
- dc.l $1420365e,$538c0000,$00003ffe,$00009ce1
- dc.l $c8e6a0b8,$cdba0000,$00003ffe,$0000a228
- dc.l $32dbcada,$ae090000,$00003ffe,$0000a746
- dc.l $f2ddb760,$22940000,$00003ffe,$0000ac3e
- dc.l $c0fb997d,$d6a20000,$00003ffe,$0000b110
- dc.l $688aebdc,$6f6a0000,$00003ffe,$0000b5bc
- dc.l $c49059ec,$c4b00000,$00003ffe,$0000ba44
- dc.l $bc7dd470,$782f0000,$00003ffe,$0000bea9
- dc.l $4144fd04,$9aac0000,$00003ffe,$0000c2eb
- dc.l $4abb6616,$28b60000,$00003ffe,$0000c70b
- dc.l $d54ce602,$ee140000,$00003ffe,$0000cd00
- dc.l $0549adec,$71590000,$00003ffe,$0000d484
- dc.l $57d2d8ea,$4ea30000,$00003ffe,$0000db94
- dc.l $8da712de,$ce3b0000,$00003ffe,$0000e238
- dc.l $55f969e8,$096a0000,$00003ffe,$0000e877
- dc.l $1129c435,$32590000,$00003ffe,$0000ee57
- dc.l $c16e0d37,$9c0d0000,$00003ffe,$0000f3e1
- dc.l $0211a87c,$37790000,$00003ffe,$0000f919
- dc.l $039d758b,$8d410000,$00003ffe,$0000fe05
- dc.l $8b8f6493,$5fb30000,$00003fff,$00008155
- dc.l $fb497b68,$5d040000,$00003fff,$00008388
- dc.l $9e3549d1,$08e10000,$00003fff,$0000859c
- dc.l $fa76511d,$724b0000,$00003fff,$00008795
- dc.l $2ecfff81,$31e70000,$00003fff,$00008973
- dc.l $2fd19557,$641b0000,$00003fff,$00008b38
- dc.l $cad10193,$2a350000,$00003fff,$00008ce7
- dc.l $a8d8301e,$e6b50000,$00003fff,$00008f46
- dc.l $a39e2eae,$52810000,$00003fff,$0000922d
- dc.l $a7d79188,$84870000,$00003fff,$000094d1
- dc.l $9fcbdedf,$52410000,$00003fff,$0000973a
- dc.l $b94419d2,$a08b0000,$00003fff,$0000996f
- dc.l $f00e08e1,$0b960000,$00003fff,$00009b77
- dc.l $3f951232,$1da70000,$00003fff,$00009d55
- dc.l $cc320f93,$56240000,$00003fff,$00009f10
- dc.l $0575006c,$c5710000,$00003fff,$0000a0a9
- dc.l $c290d97c,$c06c0000,$00003fff,$0000a226
- dc.l $59ebebc0,$630a0000,$00003fff,$0000a388
- dc.l $b4aff6ef,$0ec90000,$00003fff,$0000a4d3
- dc.l $5f1061d2,$92c40000,$00003fff,$0000a608
- dc.l $95dcfbe3,$187e0000,$00003fff,$0000a72a
- dc.l $51dc7367,$beac0000,$00003fff,$0000a83a
- dc.l $51530956,$168f0000,$00003fff,$0000a93a
- dc.l $20077539,$546e0000,$00003fff,$0000aa9e
- dc.l $7245023b,$26050000,$00003fff,$0000ac4c
- dc.l $84ba6fe4,$d58f0000,$00003fff,$0000adce
- dc.l $4a4a606b,$97120000,$00003fff,$0000af2a
- dc.l $2dcd8d26,$3c9c0000,$00003fff,$0000b065
- dc.l $6f81f222,$65c70000,$00003fff,$0000b184
- dc.l $65150f71,$496a0000,$00003fff,$0000b28a
- dc.l $aa156f9a,$da350000,$00003fff,$0000b37b
- dc.l $44ff3766,$b8950000,$00003fff,$0000b458
- dc.l $c3dce963,$04330000,$00003fff,$0000b525
- dc.l $529d5622,$46bd0000,$00003fff,$0000b5e2
- dc.l $cca95f9d,$88cc0000,$00003fff,$0000b692
- dc.l $cada7aca,$1ada0000,$00003fff,$0000b736
- dc.l $aea7a692,$58380000,$00003fff,$0000b7cf
- dc.l $ab287e9f,$7b360000,$00003fff,$0000b85e
- dc.l $cc66cb21,$98350000,$00003fff,$0000b8e4
- dc.l $fd5a20a5,$93da0000,$00003fff,$0000b99f
- dc.l $41f64aff,$9bb50000,$00003fff,$0000ba7f
- dc.l $1e17842b,$be7b0000,$00003fff,$0000bb47
- dc.l $12857637,$e17d0000,$00003fff,$0000bbfa
- dc.l $be8a4788,$df6f0000,$00003fff,$0000bc9d
- dc.l $0fad2b68,$9d790000,$00003fff,$0000bd30
- dc.l $6a39471e,$cd860000,$00003fff,$0000bdb6
- dc.l $c731856a,$f18a0000,$00003fff,$0000be31
- dc.l $cac502e8,$0d700000,$00003fff,$0000bea2
- dc.l $d55ce331,$94e20000,$00003fff,$0000bf0b
- dc.l $10b7c031,$28f00000,$00003fff,$0000bf6b
- dc.l $7a18dacb,$778d0000,$00003fff,$0000bfc4
- dc.l $ea4663fa,$18f60000,$00003fff,$0000c018
- dc.l $1bde8b89,$a4540000,$00003fff,$0000c065
- dc.l $b066cfbf,$64390000,$00003fff,$0000c0ae
- dc.l $345f5634,$0ae60000,$00003fff,$0000c0f2
- dc.l $22919cb9,$e6a70000,$0000f210,$48002210
- dc.l $32280004,$f22e6800,$ff840281,$7fffffff
- dc.l $0c813ffb,$80006c04,$600000d0,$0c814002
- dc.l $ffff6f04,$6000014c,$02aef800,$0000ff88
- dc.l $00ae0400,$0000ff88,$2d7c0000,$0000ff8c
- dc.l $f2000080,$f22e48a3,$ff84f22e,$4828ff84
- dc.l $f23c44a2,$3f800000,$f2000420,$2f022401
- dc.l $02810000,$78000282,$7fff0000,$04823ffb
- dc.l $0000e282,$d282ee81,$43faf780,$d3c12d59
- dc.l $ff902d59,$ff942d59,$ff98222e,$ff840281
- dc.l $80000000,$83aeff90,$241ff227,$e004f200
- dc.l $0080f200,$04a3f23a,$5500f6a0,$f2000522
- dc.l $f2000523,$f20000a3,$f23a5522,$f696f23a
- dc.l $54a3f698,$f20008a3,$f2000422,$f21fd020
- dc.l $f2009000,$f22e4822,$ff9060ff,$00002d30
- dc.l $0c813fff,$80006e00,$008a0c81,$3fd78000
- dc.l $6d00006c,$f227e00c,$f2000023,$f2000080
- dc.l $f20004a3,$f23a5500,$f65af23a,$5580f65c
- dc.l $f2000523,$f20005a3,$f23a5522,$f656f23a
- dc.l $55a2f658,$f2000523,$f2000ca3,$f23a5522
- dc.l $f652f23a,$54a2f654,$f2000123,$f22e4823
- dc.l $ff84f200,$08a2f200,$0423f21f,$d030f200
- dc.l $9000f22e,$4822ff84,$60ff0000,$2cb2f200
- dc.l $9000123c,$0003f22e,$4800ff84,$60ff0000
- dc.l $2c900c81,$40638000,$6e00008e,$f227e00c
- dc.l $f23c4480,$bf800000,$f20000a0,$f2000400
- dc.l $f2000023,$f22e6880,$ff84f200,$0080f200
- dc.l $04a3f23a,$5580f5ec,$f23a5500,$f5eef200
- dc.l $05a3f200,$0523f23a,$55a2f5e8,$f23a5522
- dc.l $f5eaf200,$0ca3f200,$0123f23a,$54a2f5e4
- dc.l $f22e4823,$ff84f200,$08a2f200,$0423f22e
- dc.l $4822ff84,$f21fd030,$f2009000,$4a106a0c
- dc.l $f23a4822,$f5d660ff,$00002c24,$f23a4822
- dc.l $f5ba60ff,$00002c10,$4a106a16,$f23a4800
- dc.l $f5baf200,$9000f23a,$4822f5c0,$60ff0000
- dc.l $2bfef23a,$4800f594,$f2009000,$f23a4822
- dc.l $f5ba60ff,$00002be0,$60ff0000,$2a66f210
- dc.l $48002210,$32280004,$02817fff,$ffff0c81
- dc.l $3fff8000,$6c4e0c81,$3fd78000,$6d00007c
- dc.l $f23c4480,$3f800000,$f20000a8,$f227e004
- dc.l $f23c4500,$3f800000,$f2000122,$f20008a3
- dc.l $f21fd020,$f2000484,$f2000420,$f227e001
- dc.l $41d761ff,$fffffd66,$dffc0000,$000c60ff
- dc.l $00002b6c,$f2000018,$f23c4438,$3f800000
- dc.l $f2d20000,$29d4f23a,$4800c5a6,$22100281
- dc.l $80000000,$00813f80,$00002f01,$f2009000
- dc.l $f21f4423,$60ff0000,$2b36f200,$9000123c
- dc.l $0003f210,$480060ff,$00002b16,$60ff0000
- dc.l $29b2f210,$48002210,$32280004,$02817fff
- dc.l $ffff0c81,$3fff8000,$6c44f23c,$44803f80
- dc.l $0000f200,$00a2f200,$001af23c,$44223f80
- dc.l $0000f200,$0420f200,$00042f00,$4280f227
- dc.l $e00141d7,$61ffffff,$fcc4dffc,$0000000c
- dc.l $f21f9000,$f2000022,$60ff0000,$2acaf200
- dc.l $0018f23c,$44383f80,$0000f2d2,$0000292a
- dc.l $4a106a18,$f23a4800,$c4e8f200,$9000f23c
- dc.l $44220080,$000060ff,$00002a9c,$60ff0000
- dc.l $2ce8f200,$9000f23a,$4800c4d6,$60ff0000
- dc.l $2a863fdc,$000082e3,$08654361,$c4c60000
- dc.l $00003fa5,$55555555,$4cc13fc5,$55555555
- dc.l $4a543f81,$11111117,$43853fa5,$55555555
- dc.l $4f5a3fc5,$55555555,$55550000,$00000000
- dc.l $00003ec7,$1de3a577,$46823efa,$01a019d7
- dc.l $cb683f2a,$01a01a01,$9df33f56,$c16c16c1
- dc.l $70e23f81,$11111111,$11113fa5,$55555555
- dc.l $55553ffc,$0000aaaa,$aaaaaaaa,$aaab0000
- dc.l $000048b0,$00000000,$00003730,$00000000
- dc.l $00003fff,$00008000,$00000000,$00000000
- dc.l $00003fff,$00008164,$d1f3bc03,$07749f84
- dc.l $1a9b3fff,$000082cd,$8698ac2b,$a1d89fc1
- dc.l $d5b93fff,$0000843a,$28c3acde,$4048a072
- dc.l $83693fff,$000085aa,$c367cc48,$7b141fc5
- dc.l $c95c3fff,$0000871f,$61969e8d,$10101ee8
- dc.l $5c9f3fff,$00008898,$0e8092da,$85289fa2
- dc.l $07293fff,$00008a14,$d575496e,$fd9ca07b
- dc.l $f9af3fff,$00008b95,$c1e3ea8b,$d6e8a002
- dc.l $0dcf3fff,$00008d1a,$df5b7e5b,$a9e4205a
- dc.l $63da3fff,$00008ea4,$398b45cd,$53c01eb7
- dc.l $00513fff,$00009031,$dc431466,$b1dc1f6e
- dc.l $b0293fff,$000091c3,$d373ab11,$c338a078
- dc.l $14943fff,$0000935a,$2b2f13e6,$e92c9eb3
- dc.l $19b03fff,$000094f4,$efa8fef7,$09602017
- dc.l $457d3fff,$00009694,$2d372018,$5a001f11
- dc.l $d5373fff,$00009837,$f0518db8,$a9709fb9
- dc.l $52dd3fff,$000099e0,$459320b7,$fa641fe4
- dc.l $30873fff,$00009b8d,$39b9d54e,$55381fa2
- dc.l $a8183fff,$00009d3e,$d9a72cff,$b7501fde
- dc.l $494d3fff,$00009ef5,$326091a1,$11ac2050
- dc.l $48903fff,$0000a0b0,$510fb971,$4fc4a073
- dc.l $691c3fff,$0000a270,$43030c49,$68181f9b
- dc.l $7a053fff,$0000a435,$15ae09e6,$80a0a079
- dc.l $71263fff,$0000a5fe,$d6a9b151,$38eca071
- dc.l $a1403fff,$0000a7cd,$93b4e965,$3568204f
- dc.l $62da3fff,$0000a9a1,$5ab4ea7c,$0ef81f28
- dc.l $3c4a3fff,$0000ab7a,$39b5a93e,$d3389f9a
- dc.l $7fdc3fff,$0000ad58,$3eea42a1,$4ac8a05b
- dc.l $3fac3fff,$0000af3b,$78ad690a,$43741fdf
- dc.l $26103fff,$0000b123,$f581d2ac,$25909f70
- dc.l $5f903fff,$0000b311,$c412a911,$2488201f
- dc.l $678a3fff,$0000b504,$f333f9de,$64841f32
- dc.l $fb133fff,$0000b6fd,$91e328d1,$77902003
- dc.l $8b303fff,$0000b8fb,$af4762fb,$9ee8200d
- dc.l $c3cc3fff,$0000baff,$5ab2133e,$45fc9f8b
- dc.l $2ae63fff,$0000bd08,$a39f580c,$36c0a02b
- dc.l $bf703fff,$0000bf17,$99b67a73,$1084a00b
- dc.l $f5183fff,$0000c12c,$4cca6670,$9458a041
- dc.l $dd413fff,$0000c346,$ccda2497,$64089fdf
- dc.l $137b3fff,$0000c567,$2a115506,$dadc201f
- dc.l $15683fff,$0000c78d,$74c8abb9,$b15c1fc1
- dc.l $3a2e3fff,$0000c9b9,$bd866e2f,$27a4a03f
- dc.l $8f033fff,$0000cbec,$14fef272,$7c5c1ff4
- dc.l $907d3fff,$0000ce24,$8c151f84,$80e49e6e
- dc.l $53e43fff,$0000d063,$33daef2b,$25941fd6
- dc.l $d45c3fff,$0000d2a8,$1d91f12a,$e45ca076
- dc.l $edb93fff,$0000d4f3,$5aabcfed,$fa209fa6
- dc.l $de213fff,$0000d744,$fccad69d,$6af41ee6
- dc.l $9a2f3fff,$0000d99d,$15c278af,$d7b4207f
- dc.l $439f3fff,$0000dbfb,$b797daf2,$3754201e
- dc.l $c2073fff,$0000de60,$f4825e0e,$91249e8b
- dc.l $e1753fff,$0000e0cc,$deec2a94,$e1102003
- dc.l $2c4b3fff,$0000e33f,$8972be8a,$5a502004
- dc.l $dff53fff,$0000e5b9,$06e77c83,$48a81e72
- dc.l $f47a3fff,$0000e839,$6a503c4b,$dc681f72
- dc.l $2f223fff,$0000eac0,$c6e7dd24,$3930a017
- dc.l $e9453fff,$0000ed4f,$301ed994,$2b841f40
- dc.l $1a5b3fff,$0000efe4,$b99bdcda,$f5cc9fb9
- dc.l $a9e33fff,$0000f281,$773c59ff,$b1382074
- dc.l $4c053fff,$0000f525,$7d152486,$cc2c1f77
- dc.l $3a193fff,$0000f7d0,$df730ad1,$3bb81ffe
- dc.l $90d53fff,$0000fa83,$b2db722a,$033ca041
- dc.l $ed223fff,$0000fd3e,$0c0cf486,$c1741f85
- dc.l $3f3a2210,$02817fff,$00000c81,$3fbe0000
- dc.l $6c0660ff,$00000108,$32280004,$0c81400c
- dc.l $b1676d06,$60ff0000,$010cf210,$4800f200
- dc.l $0080f23c,$442342b8,$aa3bf227,$e00c2d7c
- dc.l $00000000,$ff58f201,$600043fa,$fbb6f201
- dc.l $40002d41,$ff540281,$0000003f,$e989d3c1
- dc.l $222eff54,$ec810641,$3fff3d7a,$fb06ff54
- dc.l $f2000100,$f23c4423,$bc317218,$f23a4923
- dc.l $faf2f200,$0422f200,$0822f200,$0080f200
- dc.l $04a3f23c,$45003ab6,$0b70f200,$0523f200
- dc.l $0580f23c,$45a33c08,$8895f23a,$5522fad4
- dc.l $f23a55a2,$fad6f200,$05233d41,$ff842d7c
- dc.l $80000000,$ff8842ae,$ff8cf200,$05a3f23c
- dc.l $45223f00,$0000f200,$01a3f200,$0523f200
- dc.l $0c22f219,$4880f200,$0822f200,$0423f21f
- dc.l $d030f211,$4422f200,$0422222e,$ff584a81
- dc.l $6706f22e,$4823ff90,$f2009000,$123c0000
- dc.l $f22e4823,$ff8460ff,$000024c6,$f210d080
- dc.l $f2009000,$f23c4422,$3f800000,$60ff0000
- dc.l $24c60c81,$400cb27c,$6e66f210,$4800f200
- dc.l $0080f23c,$442342b8,$aa3bf227,$e00c2d7c
- dc.l $00000001,$ff58f201,$600043fa,$faa6f201
- dc.l $40002d41,$ff540281,$0000003f,$e989d3c1
- dc.l $222eff54,$ec812d41,$ff54e281,$93aeff54
- dc.l $06413fff,$3d41ff90,$2d7c8000,$0000ff94
- dc.l $42aeff98,$222eff54,$06413fff,$6000fed2
- dc.l $4a106bff,$00002370,$60ff0000,$24122f10
- dc.l $02978000,$00000097,$00800000,$f23c4400
- dc.l $3f800000,$f2009000,$f21f4422,$60ff0000
- dc.l $24262210,$02817fff,$00000c81,$3ffd0000
- dc.l $6c0660ff,$0000015e,$32280004,$0c814004
- dc.l $c2156f06,$60ff0000,$026cf210,$4800f200
- dc.l $0080f23c,$442342b8,$aa3bf227,$e00cf201
- dc.l $600043fa,$f9eef201,$40002d41,$ff540281
- dc.l $0000003f,$e989d3c1,$222eff54,$ec812d41
- dc.l $ff54f200,$0100f23c,$4423bc31,$7218f23a
- dc.l $4923f930,$f2000422,$f2000822,$06413fff
- dc.l $f2000080,$f20004a3,$f23c4500,$3950097b
- dc.l $f2000523,$f2000580,$f23c45a3,$3ab60b6a
- dc.l $f23a5522,$f91ef23a,$55a2f920,$3d41ff84
- dc.l $2d7c8000,$0000ff88,$42aeff8c,$f2000523
- dc.l $222eff54,$4441f200,$05a30641,$3ffff23a
- dc.l $5522f900,$f23c45a2,$3f000000,$f2000523
- dc.l $00418000,$3d41ff90,$2d7c8000,$0000ff94
- dc.l $42aeff98,$f2000ca3,$f2000123,$f2000422
- dc.l $f2000822,$f21fd030,$f2114823,$222eff54
- dc.l $0c810000,$003f6f1a,$f2294480,$000cf22e
- dc.l $48a2ff90,$f2000422,$f2114822,$60ff0000
- dc.l $00340c81,$fffffffd,$6c16f229,$4422000c
- dc.l $f2114822,$f22e4822,$ff9060ff,$00000016
- dc.l $f2194880,$f2114422,$f22e48a2,$ff90f200
- dc.l $0422f200,$9000f22e,$4823ff84,$60ff0000
- dc.l $22ae0c81,$3fbe0000,$6c6c0c81,$00330000
- dc.l $6d2c2d7c,$80010000,$ff842d7c,$80000000
- dc.l $ff8842ae,$ff8cf210,$4800f200,$9000123c
- dc.l $0002f22e,$4822ff84,$60ff0000,$2264f210
- dc.l $4800f23a,$5423f86c,$2d7c8001,$0000ff84
- dc.l $2d7c8000,$0000ff88,$42aeff8c,$f22e4822
- dc.l $ff84f200,$9000123c,$0000f23a,$5423f84c
- dc.l $60ff0000,$222cf210,$4800f200,$0023f227
- dc.l $e00cf23c,$44802f30,$caa8f200,$00a3f23c
- dc.l $4500310f,$8290f23c,$44a232d7,$3220f200
- dc.l $0123f200,$00a3f23c,$45223493,$f281f23a
- dc.l $54a2f7c0,$f2000123,$f20000a3,$f23a5522
- dc.l $f7baf23a,$54a2f7bc,$f2000123,$f20000a3
- dc.l $f23a5522,$f7b6f23a,$54a2f7b8,$f2000123
- dc.l $f20000a3,$f23a5522,$f7b2f23a,$48a2f7b4
- dc.l $f2000123,$f20000a3,$f2000123,$f21048a3
- dc.l $f23c4423,$3f000000,$f20008a2,$f21fd030
- dc.l $f2000422,$f2009000,$f2104822,$60ff0000
- dc.l $218e2210,$0c810000,$00006e00,$fbacf23c
- dc.l $4400bf80,$0000f200,$9000f23c,$44220080
- dc.l $000060ff,$00002178,$60ff0000,$1ff63028
- dc.l $00000880,$000f0440,$3ffff200,$50006d02
- dc.l $4e751d7c,$0008ff64,$4e7561ff,$00007cfc
- dc.l $44400440,$3ffff200,$50001d7c,$0008ff64
- dc.l $4e753028,$00000040,$7fff0880,$000e2d68
- dc.l $0004ff88,$2d680008,$ff8c3d40,$ff84f22e
- dc.l $4800ff84,$6b024e75,$1d7c0008,$ff644e75
- dc.l $61ff0000,$7cb660ca,$7ffb0000,$80000000
- dc.l $00000000,$00000000,$f2104800,$22103228
- dc.l $00040281,$7fffffff,$0c81400c,$b1676e42
- dc.l $f2000018,$2f004280,$f227e001,$41d761ff
- dc.l $fffffad2,$dffc0000,$000cf23c,$44233f00
- dc.l $0000201f,$f23c4480,$3e800000,$f20000a0
- dc.l $f2009000,$123c0002,$f2000422,$60ff0000
- dc.l $20800c81,$400cb2b3,$6e3cf200,$0018f23a
- dc.l $5428baae,$f23a5428,$bab02f00,$4280f227
- dc.l $e00141d7,$61ffffff,$fa7cdffc,$0000000c
- dc.l $201ff200,$9000123c,$0000f23a,$4823ff5a
- dc.l $60ff0000,$203c60ff,$00002014,$f23c4400
- dc.l $3f800000,$f2009000,$f23c4422,$00800000
- dc.l $60ff0000,$2032f210,$48002210,$32280004
- dc.l $22410281,$7fffffff,$0c81400c,$b1676e62
- dc.l $f2000018,$48e78040,$f227e001,$41d74280
- dc.l $61ffffff,$fbe0dffc,$0000000c,$f23c9000
- dc.l $00000000,$4cdf0201,$f2000080,$f23c44a2
- dc.l $3f800000,$f2276800,$f2000420,$22090281
- dc.l $80000000,$00813f00,$0000f21f,$48222f01
- dc.l $f2009000,$123c0000,$f21f4423,$60ff0000
- dc.l $1fa00c81,$400cb2b3,$6eff0000,$1f4cf200
- dc.l $0018f23a,$5428b9ca,$2f3c0000,$00002f3c
- dc.l $80000000,$22090281,$80000000,$00817ffb
- dc.l $00002f01,$f23a5428,$b9b02f00,$4280f227
- dc.l $e00141d7,$61ffffff,$f97cdffc,$0000000c
- dc.l $201ff200,$9000123c,$0000f21f,$482360ff
- dc.l $00001f3e,$60ff0000,$1ddaf210,$4800f22e
- dc.l $6800ff84,$22103228,$00042d41,$ff840281
- dc.l $7fffffff,$0c813fd7,$80006d00,$00740c81
- dc.l $3fffddce,$6e00006a,$222eff84,$2d41ff5c
- dc.l $02817fff,$00000681,$00010000,$2d41ff84
- dc.l $02ae8000,$0000ff5c,$f22e4800,$ff842f00
- dc.l $4280f227,$e00141d7,$61ffffff,$fac8dffc
- dc.l $0000000c,$201ff200,$0080f23c,$44a24000
- dc.l $0000222e,$ff5cf22e,$6880ff84,$b3aeff84
- dc.l $f2009000,$f22e4820,$ff8460ff,$00001eb0
- dc.l $0c813fff,$80006d00,$00880c81,$40048aa1
- dc.l $6e000092,$222eff84,$2d41ff5c,$02817fff
- dc.l $00000681,$00010000,$2d41ff84,$02ae8000
- dc.l $0000ff5c,$222eff5c,$f22e4800,$ff842f00
- dc.l $4280f227,$e00141d7,$61ffffff,$f878dffc
- dc.l $0000000c,$201f222e,$ff5cf23c,$44223f80
- dc.l $00000a81,$c0000000,$f2014480,$f20000a0
- dc.l $222eff5c,$00813f80,$0000f201,$4400f200
- dc.l $9000123c,$0002f200,$042260ff,$00001e20
- dc.l $f2009000,$123c0003,$f22e4800,$ff8460ff
- dc.l $00001dfe,$222eff84,$02818000,$00000081
- dc.l $3f800000,$f2014400,$02818000,$00000a81
- dc.l $80800000,$f2009000,$f2014422,$60ff0000
- dc.l $1dde60ff,$00001c6c,$3ffe0000,$b17217f7
- dc.l $d1cf79ac,$00000000,$3f800000,$00000000
- dc.l $7f800000,$bf800000,$3fc2499a,$b5e4040b
- dc.l $bfc555b5,$848cb7db,$3fc99999,$987d8730
- dc.l $bfcfffff,$ff6f7e97,$3fd55555,$555555a4
- dc.l $bfe00000,$00000008,$3f175496,$add7dad6
- dc.l $3f3c71c2,$fe80c7e0,$3f624924,$928bccff
- dc.l $3f899999,$999995ec,$3fb55555,$55555555
- dc.l $40000000,$00000000,$3f990000,$80000000
- dc.l $00000000,$00000000,$3ffe0000,$fe03f80f
- dc.l $e03f80fe,$00000000,$3ff70000,$ff015358
- dc.l $833c47e2,$00000000,$3ffe0000,$fa232cf2
- dc.l $52138ac0,$00000000,$3ff90000,$bdc8d83e
- dc.l $ad88d549,$00000000,$3ffe0000,$f6603d98
- dc.l $0f6603da,$00000000,$3ffa0000,$9cf43dcf
- dc.l $f5eafd48,$00000000,$3ffe0000,$f2b9d648
- dc.l $0f2b9d65,$00000000,$3ffa0000,$da16eb88
- dc.l $cb8df614,$00000000,$3ffe0000,$ef2eb71f
- dc.l $c4345238,$00000000,$3ffb0000,$8b29b775
- dc.l $1bd70743,$00000000,$3ffe0000,$ebbdb2a5
- dc.l $c1619c8c,$00000000,$3ffb0000,$a8d839f8
- dc.l $30c1fb49,$00000000,$3ffe0000,$e865ac7b
- dc.l $7603a197,$00000000,$3ffb0000,$c61a2eb1
- dc.l $8cd907ad,$00000000,$3ffe0000,$e525982a
- dc.l $f70c880e,$00000000,$3ffb0000,$e2f2a47a
- dc.l $de3a18af,$00000000,$3ffe0000,$e1fc780e
- dc.l $1fc780e2,$00000000,$3ffb0000,$ff64898e
- dc.l $df55d551,$00000000,$3ffe0000,$dee95c4c
- dc.l $a037ba57,$00000000,$3ffc0000,$8db956a9
- dc.l $7b3d0148,$00000000,$3ffe0000,$dbeb61ee
- dc.l $d19c5958,$00000000,$3ffc0000,$9b8fe100
- dc.l $f47ba1de,$00000000,$3ffe0000,$d901b203
- dc.l $6406c80e,$00000000,$3ffc0000,$a9372f1d
- dc.l $0da1bd17,$00000000,$3ffe0000,$d62b80d6
- dc.l $2b80d62c,$00000000,$3ffc0000,$b6b07f38
- dc.l $ce90e46b,$00000000,$3ffe0000,$d3680d36
- dc.l $80d3680d,$00000000,$3ffc0000,$c3fd0329
- dc.l $06488481,$00000000,$3ffe0000,$d0b69fcb
- dc.l $d2580d0b,$00000000,$3ffc0000,$d11de0ff
- dc.l $15ab18ca,$00000000,$3ffe0000,$ce168a77
- dc.l $25080ce1,$00000000,$3ffc0000,$de1433a1
- dc.l $6c66b150,$00000000,$3ffe0000,$cb8727c0
- dc.l $65c393e0,$00000000,$3ffc0000,$eae10b5a
- dc.l $7ddc8add,$00000000,$3ffe0000,$c907da4e
- dc.l $871146ad,$00000000,$3ffc0000,$f7856e5e
- dc.l $e2c9b291,$00000000,$3ffe0000,$c6980c69
- dc.l $80c6980c,$00000000,$3ffd0000,$82012ca5
- dc.l $a68206d7,$00000000,$3ffe0000,$c4372f85
- dc.l $5d824ca6,$00000000,$3ffd0000,$882c5fcd
- dc.l $7256a8c5,$00000000,$3ffe0000,$c1e4bbd5
- dc.l $95f6e947,$00000000,$3ffd0000,$8e44c60b
- dc.l $4ccfd7de,$00000000,$3ffe0000,$bfa02fe8
- dc.l $0bfa02ff,$00000000,$3ffd0000,$944ad09e
- dc.l $f4351af6,$00000000,$3ffe0000,$bd691047
- dc.l $07661aa3,$00000000,$3ffd0000,$9a3eecd4
- dc.l $c3eaa6b2,$00000000,$3ffe0000,$bb3ee721
- dc.l $a54d880c,$00000000,$3ffd0000,$a0218434
- dc.l $353f1de8,$00000000,$3ffe0000,$b92143fa
- dc.l $36f5e02e,$00000000,$3ffd0000,$a5f2fcab
- dc.l $bbc506da,$00000000,$3ffe0000,$b70fbb5a
- dc.l $19be3659,$00000000,$3ffd0000,$abb3b8ba
- dc.l $2ad362a5,$00000000,$3ffe0000,$b509e68a
- dc.l $9b94821f,$00000000,$3ffd0000,$b1641795
- dc.l $ce3ca97b,$00000000,$3ffe0000,$b30f6352
- dc.l $8917c80b,$00000000,$3ffd0000,$b7047551
- dc.l $5d0f1c61,$00000000,$3ffe0000,$b11fd3b8
- dc.l $0b11fd3c,$00000000,$3ffd0000,$bc952afe
- dc.l $ea3d13e1,$00000000,$3ffe0000,$af3addc6
- dc.l $80af3ade,$00000000,$3ffd0000,$c2168ed0
- dc.l $f458ba4a,$00000000,$3ffe0000,$ad602b58
- dc.l $0ad602b6,$00000000,$3ffd0000,$c788f439
- dc.l $b3163bf1,$00000000,$3ffe0000,$ab8f69e2
- dc.l $8359cd11,$00000000,$3ffd0000,$ccecac08
- dc.l $bf04565d,$00000000,$3ffe0000,$a9c84a47
- dc.l $a07f5638,$00000000,$3ffd0000,$d2420487
- dc.l $2dd85160,$00000000,$3ffe0000,$a80a80a8
- dc.l $0a80a80b,$00000000,$3ffd0000,$d7894992
- dc.l $3bc3588a,$00000000,$3ffe0000,$a655c439
- dc.l $2d7b73a8,$00000000,$3ffd0000,$dcc2c4b4
- dc.l $9887dacc,$00000000,$3ffe0000,$a4a9cf1d
- dc.l $96833751,$00000000,$3ffd0000,$e1eebd3e
- dc.l $6d6a6b9e,$00000000,$3ffe0000,$a3065e3f
- dc.l $ae7cd0e0,$00000000,$3ffd0000,$e70d785c
- dc.l $2f9f5bdc,$00000000,$3ffe0000,$a16b312e
- dc.l $a8fc377d,$00000000,$3ffd0000,$ec1f392c
- dc.l $5179f283,$00000000,$3ffe0000,$9fd809fd
- dc.l $809fd80a,$00000000,$3ffd0000,$f12440d3
- dc.l $e36130e6,$00000000,$3ffe0000,$9e4cad23
- dc.l $dd5f3a20,$00000000,$3ffd0000,$f61cce92
- dc.l $346600bb,$00000000,$3ffe0000,$9cc8e160
- dc.l $c3fb19b9,$00000000,$3ffd0000,$fb091fd3
- dc.l $8145630a,$00000000,$3ffe0000,$9b4c6f9e
- dc.l $f03a3caa,$00000000,$3ffd0000,$ffe97042
- dc.l $bfa4c2ad,$00000000,$3ffe0000,$99d722da
- dc.l $bde58f06,$00000000,$3ffe0000,$825efced
- dc.l $49369330,$00000000,$3ffe0000,$9868c809
- dc.l $868c8098,$00000000,$3ffe0000,$84c37a7a
- dc.l $b9a905c9,$00000000,$3ffe0000,$97012e02
- dc.l $5c04b809,$00000000,$3ffe0000,$87224c2e
- dc.l $8e645fb7,$00000000,$3ffe0000,$95a02568
- dc.l $095a0257,$00000000,$3ffe0000,$897b8cac
- dc.l $9f7de298,$00000000,$3ffe0000,$94458094
- dc.l $45809446,$00000000,$3ffe0000,$8bcf55de
- dc.l $c4cd05fe,$00000000,$3ffe0000,$92f11384
- dc.l $0497889c,$00000000,$3ffe0000,$8e1dc0fb
- dc.l $89e125e5,$00000000,$3ffe0000,$91a2b3c4
- dc.l $d5e6f809,$00000000,$3ffe0000,$9066e68c
- dc.l $955b6c9b,$00000000,$3ffe0000,$905a3863
- dc.l $3e06c43b,$00000000,$3ffe0000,$92aade74
- dc.l $c7be59e0,$00000000,$3ffe0000,$8f1779d9
- dc.l $fdc3a219,$00000000,$3ffe0000,$94e9bff6
- dc.l $15845643,$00000000,$3ffe0000,$8dda5202
- dc.l $37694809,$00000000,$3ffe0000,$9723a1b7
- dc.l $20134203,$00000000,$3ffe0000,$8ca29c04
- dc.l $6514e023,$00000000,$3ffe0000,$995899c8
- dc.l $90eb8990,$00000000,$3ffe0000,$8b70344a
- dc.l $139bc75a,$00000000,$3ffe0000,$9b88bdaa
- dc.l $3a3dae2f,$00000000,$3ffe0000,$8a42f870
- dc.l $5669db46,$00000000,$3ffe0000,$9db4224f
- dc.l $ffe1157c,$00000000,$3ffe0000,$891ac73a
- dc.l $e9819b50,$00000000,$3ffe0000,$9fdadc26
- dc.l $8b7a12da,$00000000,$3ffe0000,$87f78087
- dc.l $f78087f8,$00000000,$3ffe0000,$a1fcff17
- dc.l $ce733bd4,$00000000,$3ffe0000,$86d90544
- dc.l $7a34acc6,$00000000,$3ffe0000,$a41a9e8f
- dc.l $5446fb9f,$00000000,$3ffe0000,$85bf3761
- dc.l $2cee3c9b,$00000000,$3ffe0000,$a633cd7e
- dc.l $6771cd8b,$00000000,$3ffe0000,$84a9f9c8
- dc.l $084a9f9d,$00000000,$3ffe0000,$a8489e60
- dc.l $0b435a5e,$00000000,$3ffe0000,$83993052
- dc.l $3fbe3368,$00000000,$3ffe0000,$aa59233c
- dc.l $cca4bd49,$00000000,$3ffe0000,$828cbfbe
- dc.l $b9a020a3,$00000000,$3ffe0000,$ac656dae
- dc.l $6bcc4985,$00000000,$3ffe0000,$81848da8
- dc.l $faf0d277,$00000000,$3ffe0000,$ae6d8ee3
- dc.l $60bb2468,$00000000,$3ffe0000,$80808080
- dc.l $80808081,$00000000,$3ffe0000,$b07197a2
- dc.l $3c46c654,$00000000,$f2104800,$2d7c0000
- dc.l $0000ff54,$22103228,$00042d50,$ff842d68
- dc.l $0004ff88,$2d680008,$ff8c0c81,$00000000
- dc.l $6d000182,$0c813ffe,$f07d6d0a,$0c813fff
- dc.l $88416f00,$00e2e081,$e0810481,$00003fff
- dc.l $d2aeff54,$41faf7b2,$f2014080,$2d7c3fff
- dc.l $0000ff84,$2d6eff88,$ff9402ae,$fe000000
- dc.l $ff9400ae,$01000000,$ff94222e,$ff940281
- dc.l $7e000000,$e081e081,$e881d1c1,$f22e4800
- dc.l $ff842d7c,$3fff0000,$ff9042ae,$ff98f22e
- dc.l $4828ff90,$f227e00c,$f2104823,$f23a48a3
- dc.l $f6c8f200,$0100f200,$0923f22e,$6880ff84
- dc.l $f2000980,$f2000880,$f23a54a3,$f6ccf23a
- dc.l $5523f6ce,$f23a54a2,$f6d0f23a,$5522f6d2
- dc.l $f2000ca3,$f2000d23,$f23a54a2,$f6ccf23a
- dc.l $5522f6ce,$f2000ca3,$d1fc0000,$0010f200
- dc.l $0d23f200,$00a3f200,$0822f210,$48a2f21f
- dc.l $d030f200,$0422f200,$9000f22e,$4822ff84
- dc.l $60ff0000,$142af23c,$58380001,$f2c10000
- dc.l $1678f200,$0080f23a,$44a8f64e,$f23a4422
- dc.l $f648f200,$04a2f200,$00a0f227,$e00cf200
- dc.l $0400f200,$0023f22e,$6880ff84,$f2000080
- dc.l $f20004a3,$f23a5580,$f660f23a,$5500f662
- dc.l $f20005a3,$f2000523,$f23a55a2,$f65cf23a
- dc.l $5522f65e,$f2000ca3,$f2000123,$f23a54a2
- dc.l $f658f22e,$4823ff84,$f20008a2,$f21fd030
- dc.l $f2000423,$f2009000,$f22e4822,$ff8460ff
- dc.l $0000139c,$60ff0000,$12102d7c,$ffffff9c
- dc.l $ff5448e7,$3f002610,$28280004,$2a280008
- dc.l $42824a84,$66342805,$42857420,$4286edc4
- dc.l $6000edac,$d4862d43,$ff842d44,$ff882d45
- dc.l $ff8c4482,$2d42ff54,$f22e4800,$ff844cdf
- dc.l $00fc41ee,$ff846000,$fe0c4286,$edc46000
- dc.l $2406edac,$2e05edad,$44860686,$00000020
- dc.l $ecaf8887,$2d43ff84,$2d44ff88,$2d45ff8c
- dc.l $44822d42,$ff54f22e,$4800ff84,$4cdf00fc
- dc.l $41eeff84,$6000fdce,$f2104800,$f2000018
- dc.l $f23a4838,$f5a4f292,$0014f200,$9000123c
- dc.l $0003f210,$480060ff,$000012d6,$f2104800
- dc.l $2d7c0000,$0000ff54,$f2000080,$f23a4422
- dc.l $f508f22e,$6800ff84,$3d6eff88,$ff86222e
- dc.l $ff840c81,$00000000,$6f0000da,$0c813ffe
- dc.l $80006d00,$fda20c81,$3fffc000,$6e00fd98
- dc.l $0c813ffe,$f07d6d00,$001a0c81,$3fff8841
- dc.l $6e000010,$f20004a2,$f23a4422,$f4bc6000
- dc.l $fe762d6e,$ff88ff94,$02aefe00,$0000ff94
- dc.l $00ae0100,$0000ff94,$0c813fff,$80006c44
- dc.l $f23a4400,$f4fc2d7c,$3fff0000,$ff9042ae
- dc.l $ff98f22e,$4828ff90,$222eff94,$02817e00
- dc.l $0000e081,$e081e881,$f20004a2,$f227e00c
- dc.l $f2000422,$41faf4e2,$d1c1f23a,$4480f466
- dc.l $6000fd76,$f23a4400,$f4502d7c,$3fff0000
- dc.l $ff9042ae,$ff98f22e,$4828ff90,$222eff94
- dc.l $02817e00,$0000e081,$e081e881,$f2000422
- dc.l $f227e00c,$41faf4a2,$d1c1f23a,$4480f41e
- dc.l $6000fd36,$0c810000,$00006d10,$f23a4400
- dc.l $f414f200,$900060ff,$00001014,$f23a4400
- dc.l $f3fcf200,$900060ff,$0000102e,$60ff0000
- dc.l $10422210,$32280004,$02817fff,$ffff0c81
- dc.l $3fff8000,$6c56f210,$4818f200,$0080f200
- dc.l $049af200,$0022f23c,$44a23f80,$0000f200
- dc.l $04202210,$02818000,$00000081,$3f000000
- dc.l $2f012f00,$4280f227,$e00141d7,$61ffffff
- dc.l $fe5adffc,$0000000c,$201ff200,$9000123c
- dc.l $0000f21f,$442360ff,$00001136,$f2104818
- dc.l $f23c4438,$3f800000,$f2d20000,$0fac60ff
- dc.l $00000f7c,$60ff0000,$0fba3ffd,$0000de5b
- dc.l $d8a93728,$71950000,$00003fff,$0000b8aa
- dc.l $3b295c17,$f0bc0000,$0000f23c,$58000001
- dc.l $f2104838,$f2c10000,$13502210,$6d000090
- dc.l $2f004280,$61ffffff,$fba2f21f,$9000f23a
- dc.l $4823ffb8,$60ff0000,$10d62210,$6d000070
- dc.l $2f004280,$61ffffff,$fd34f21f,$9000f23a
- dc.l $4823ff98,$60ff0000,$10c62210,$6d000050
- dc.l $22280008,$662e2228,$00040281,$7fffffff
- dc.l $66223210,$02810000,$7fff0481,$00003fff
- dc.l $67ff0000,$12e4f200,$9000f201,$400060ff
- dc.l $0000107c,$2f004280,$61ffffff,$fb2ef21f
- dc.l $9000f23a,$4823ff54,$60ff0000,$106260ff
- dc.l $00000ed6,$22106d00,$fff62f00,$428061ff
- dc.l $fffffcba,$f21f9000,$f23a4823,$ff2e60ff
- dc.l $0000104c,$406a934f,$0979a371,$3f734413
- dc.l $509f8000,$bfcd0000,$c0219dc1,$da994fd2
- dc.l $00000000,$40000000,$935d8ddd,$aaa8ac17
- dc.l $00000000,$3ffe0000,$b17217f7,$d1cf79ac
- dc.l $00000000,$3f56c16d,$6f7bd0b2,$3f811112
- dc.l $302c712c,$3fa55555,$55554cc1,$3fc55555
- dc.l $55554a54,$3fe00000,$00000000,$00000000
- dc.l $00000000,$3fff0000,$80000000,$00000000
- dc.l $3f738000,$3fff0000,$8164d1f3,$bc030773
- dc.l $3fbef7ca,$3fff0000,$82cd8698,$ac2ba1d7
- dc.l $3fbdf8a9,$3fff0000,$843a28c3,$acde4046
- dc.l $3fbcd7c9,$3fff0000,$85aac367,$cc487b15
- dc.l $bfbde8da,$3fff0000,$871f6196,$9e8d1010
- dc.l $3fbde85c,$3fff0000,$88980e80,$92da8527
- dc.l $3fbebbf1,$3fff0000,$8a14d575,$496efd9a
- dc.l $3fbb80ca,$3fff0000,$8b95c1e3,$ea8bd6e7
- dc.l $bfba8373,$3fff0000,$8d1adf5b,$7e5ba9e6
- dc.l $bfbe9670,$3fff0000,$8ea4398b,$45cd53c0
- dc.l $3fbdb700,$3fff0000,$9031dc43,$1466b1dc
- dc.l $3fbeeeb0,$3fff0000,$91c3d373,$ab11c336
- dc.l $3fbbfd6d,$3fff0000,$935a2b2f,$13e6e92c
- dc.l $bfbdb319,$3fff0000,$94f4efa8,$fef70961
- dc.l $3fbdba2b,$3fff0000,$96942d37,$20185a00
- dc.l $3fbe91d5,$3fff0000,$9837f051,$8db8a96f
- dc.l $3fbe8d5a,$3fff0000,$99e04593,$20b7fa65
- dc.l $bfbcde7b,$3fff0000,$9b8d39b9,$d54e5539
- dc.l $bfbebaaf,$3fff0000,$9d3ed9a7,$2cffb751
- dc.l $bfbd86da,$3fff0000,$9ef53260,$91a111ae
- dc.l $bfbebedd,$3fff0000,$a0b0510f,$b9714fc2
- dc.l $3fbcc96e,$3fff0000,$a2704303,$0c496819
- dc.l $bfbec90b,$3fff0000,$a43515ae,$09e6809e
- dc.l $3fbbd1db,$3fff0000,$a5fed6a9,$b15138ea
- dc.l $3fbce5eb,$3fff0000,$a7cd93b4,$e965356a
- dc.l $bfbec274,$3fff0000,$a9a15ab4,$ea7c0ef8
- dc.l $3fbea83c,$3fff0000,$ab7a39b5,$a93ed337
- dc.l $3fbecb00,$3fff0000,$ad583eea,$42a14ac6
- dc.l $3fbe9301,$3fff0000,$af3b78ad,$690a4375
- dc.l $bfbd8367,$3fff0000,$b123f581,$d2ac2590
- dc.l $bfbef05f,$3fff0000,$b311c412,$a9112489
- dc.l $3fbdfb3c,$3fff0000,$b504f333,$f9de6484
- dc.l $3fbeb2fb,$3fff0000,$b6fd91e3,$28d17791
- dc.l $3fbae2cb,$3fff0000,$b8fbaf47,$62fb9ee9
- dc.l $3fbcdc3c,$3fff0000,$baff5ab2,$133e45fb
- dc.l $3fbee9aa,$3fff0000,$bd08a39f,$580c36bf
- dc.l $bfbeaefd,$3fff0000,$bf1799b6,$7a731083
- dc.l $bfbcbf51,$3fff0000,$c12c4cca,$66709456
- dc.l $3fbef88a,$3fff0000,$c346ccda,$24976407
- dc.l $3fbd83b2,$3fff0000,$c5672a11,$5506dadd
- dc.l $3fbdf8ab,$3fff0000,$c78d74c8,$abb9b15d
- dc.l $bfbdfb17,$3fff0000,$c9b9bd86,$6e2f27a3
- dc.l $bfbefe3c,$3fff0000,$cbec14fe,$f2727c5d
- dc.l $bfbbb6f8,$3fff0000,$ce248c15,$1f8480e4
- dc.l $bfbcee53,$3fff0000,$d06333da,$ef2b2595
- dc.l $bfbda4ae,$3fff0000,$d2a81d91,$f12ae45a
- dc.l $3fbc9124,$3fff0000,$d4f35aab,$cfedfa1f
- dc.l $3fbeb243,$3fff0000,$d744fcca,$d69d6af4
- dc.l $3fbde69a,$3fff0000,$d99d15c2,$78afd7b6
- dc.l $bfb8bc61,$3fff0000,$dbfbb797,$daf23755
- dc.l $3fbdf610,$3fff0000,$de60f482,$5e0e9124
- dc.l $bfbd8be1,$3fff0000,$e0ccdeec,$2a94e111
- dc.l $3fbacb12,$3fff0000,$e33f8972,$be8a5a51
- dc.l $3fbb9bfe,$3fff0000,$e5b906e7,$7c8348a8
- dc.l $3fbcf2f4,$3fff0000,$e8396a50,$3c4bdc68
- dc.l $3fbef22f,$3fff0000,$eac0c6e7,$dd24392f
- dc.l $bfbdbf4a,$3fff0000,$ed4f301e,$d9942b84
- dc.l $3fbec01a,$3fff0000,$efe4b99b,$dcdaf5cb
- dc.l $3fbe8cac,$3fff0000,$f281773c,$59ffb13a
- dc.l $bfbcbb3f,$3fff0000,$f5257d15,$2486cc2c
- dc.l $3fbef73a,$3fff0000,$f7d0df73,$0ad13bb9
- dc.l $bfb8b795,$3fff0000,$fa83b2db,$722a033a
- dc.l $3fbef84b,$3fff0000,$fd3e0c0c,$f486c175
- dc.l $bfbef581,$f210d080,$22103228,$0004f22e
- dc.l $6800ff84,$02817fff,$ffff0c81,$3fb98000
- dc.l $6c046000,$00880c81,$400d80c0,$6f046000
- dc.l $007cf200,$0080f23c,$44a34280,$0000f22e
- dc.l $6080ff54,$2f0243fa,$fbbcf22e,$4080ff54
- dc.l $222eff54,$24010281,$0000003f,$e981d3c1
- dc.l $ec822202,$e2819481,$06820000,$3ffff227
- dc.l $e00cf23c,$44a33c80,$00002d59,$ff842d59
- dc.l $ff882d59,$ff8c3d59,$ff90f200,$04283d59
- dc.l $ff94426e,$ff9642ae,$ff98d36e,$ff84f23a
- dc.l $4823fb22,$d36eff90,$60000100,$0c813fff
- dc.l $80006e12,$f2009000,$f23c4422,$3f800000
- dc.l $60ff0000,$0b12222e,$ff840c81,$00000000
- dc.l $6d0660ff,$00000ac8,$60ff0000,$0a1af200
- dc.l $9000f23c,$44003f80,$00002210,$00810080
- dc.l $0001f201,$442260ff,$00000adc,$f210d080
- dc.l $22103228,$0004f22e,$6800ff84,$02817fff
- dc.l $ffff0c81,$3fb98000,$6c046000,$ff900c81
- dc.l $400b9b07,$6f046000,$ff84f200,$0080f23a
- dc.l $54a3fa62,$f22e6080,$ff542f02,$43fafac6
- dc.l $f22e4080,$ff54222e,$ff542401,$02810000
- dc.l $003fe981,$d3c1ec82,$2202e281,$94810682
- dc.l $00003fff,$f227e00c,$f2000500,$f23a54a3
- dc.l $fa2c2d59,$ff84f23a,$4923fa2a,$2d59ff88
- dc.l $2d59ff8c,$f2000428,$3d59ff90,$f2000828
- dc.l $3d59ff94,$426eff96,$42aeff98,$f23a4823
- dc.l $fa14d36e,$ff84d36e,$ff90f200,$0080f200
- dc.l $04a3f23a,$5500fa1e,$f23a5580,$fa20f200
- dc.l $0523f200,$05a3f23a,$5522fa1a,$f23a55a2
- dc.l $fa1cf200,$0523f200,$05a3f23a,$5522fa16
- dc.l $f20001a3,$f2000523,$f2000c22,$f2000822
- dc.l $f21fd030,$f22e4823,$ff84f22e,$4822ff90
- dc.l $f22e4822,$ff84f200,$90003d42,$ff84241f
- dc.l $2d7c8000,$0000ff88,$42aeff8c,$123c0000
- dc.l $f22e4823,$ff8460ff,$00000996,$f2009000
- dc.l $f23c4400,$3f800000,$22100081,$00800001
- dc.l $f2014422,$60ff0000,$098e2f01,$e8082200
- dc.l $02410003,$0240000c,$48403001,$221f4a01
- dc.l $671e0c01,$000a6f12,$0c01000e,$6f3c0c01
- dc.l $002f6f06,$0c01003f,$6f6260ff,$00000baa
- dc.l $4a00660c,$41fb0170,$000000d6,$60000086
- dc.l $0c000003,$670a41fb,$01700000,$00d06074
- dc.l $41fb0170,$000000d2,$606a0401,$000b4a00
- dc.l $661041fb,$01700000,$00cc0c01,$00026f54
- dc.l $605a0c00,$0003670a,$41fb0170,$000000f2
- dc.l $60e841fb,$01700000,$012460de,$04010030
- dc.l $4a006616,$41fb0170,$0000014e,$0c010001
- dc.l $6f220c01,$00076f24,$601a0c00,$0003670a
- dc.l $41fb0170,$000001f2,$60e241fb,$01700000
- dc.l $02a860d8,$00ae0000,$0208ff64,$c2fc000c
- dc.l $48404a00,$6608f230,$d0801000,$4e754840
- dc.l $3d701000,$ff902d70,$1004ff94,$2d701008
- dc.l $ff982200,$428041ee,$ff904268,$000261ff
- dc.l $000062c6,$f210d080,$4e7551fc,$40000000
- dc.l $c90fdaa2,$2168c235,$40000000,$c90fdaa2
- dc.l $2168c234,$40000000,$c90fdaa2,$2168c235
- dc.l $3ffd0000,$9a209a84,$fbcff798,$40000000
- dc.l $adf85458,$a2bb4a9a,$3fff0000,$b8aa3b29
- dc.l $5c17f0bc,$3ffd0000,$de5bd8a9,$37287195
- dc.l $00000000,$00000000,$00000000,$3ffd0000
- dc.l $9a209a84,$fbcff798,$40000000,$adf85458
- dc.l $a2bb4a9a,$3fff0000,$b8aa3b29,$5c17f0bb
- dc.l $3ffd0000,$de5bd8a9,$37287195,$00000000
- dc.l $00000000,$00000000,$3ffd0000,$9a209a84
- dc.l $fbcff799,$40000000,$adf85458,$a2bb4a9b
- dc.l $3fff0000,$b8aa3b29,$5c17f0bc,$3ffd0000
- dc.l $de5bd8a9,$37287195,$00000000,$00000000
- dc.l $00000000,$3ffe0000,$b17217f7,$d1cf79ac
- dc.l $40000000,$935d8ddd,$aaa8ac17,$3fff0000
- dc.l $80000000,$00000000,$40020000,$a0000000
- dc.l $00000000,$40050000,$c8000000,$00000000
- dc.l $400c0000,$9c400000,$00000000,$40190000
- dc.l $bebc2000,$00000000,$40340000,$8e1bc9bf
- dc.l $04000000,$40690000,$9dc5ada8,$2b70b59e
- dc.l $40d30000,$c2781f49,$ffcfa6d5,$41a80000
- dc.l $93ba47c9,$80e98ce0,$43510000,$aa7eebfb
- dc.l $9df9de8e,$46a30000,$e319a0ae,$a60e91c7
- dc.l $4d480000,$c9767586,$81750c17,$5a920000
- dc.l $9e8b3b5d,$c53d5de5,$75250000,$c4605202
- dc.l $8a20979b,$3ffe0000,$b17217f7,$d1cf79ab
- dc.l $40000000,$935d8ddd,$aaa8ac16,$3fff0000
- dc.l $80000000,$00000000,$40020000,$a0000000
- dc.l $00000000,$40050000,$c8000000,$00000000
- dc.l $400c0000,$9c400000,$00000000,$40190000
- dc.l $bebc2000,$00000000,$40340000,$8e1bc9bf
- dc.l $04000000,$40690000,$9dc5ada8,$2b70b59d
- dc.l $40d30000,$c2781f49,$ffcfa6d5,$41a80000
- dc.l $93ba47c9,$80e98cdf,$43510000,$aa7eebfb
- dc.l $9df9de8d,$46a30000,$e319a0ae,$a60e91c6
- dc.l $4d480000,$c9767586,$81750c17,$5a920000
- dc.l $9e8b3b5d,$c53d5de4,$75250000,$c4605202
- dc.l $8a20979a,$3ffe0000,$b17217f7,$d1cf79ac
- dc.l $40000000,$935d8ddd,$aaa8ac17,$3fff0000
- dc.l $80000000,$00000000,$40020000,$a0000000
- dc.l $00000000,$40050000,$c8000000,$00000000
- dc.l $400c0000,$9c400000,$00000000,$40190000
- dc.l $bebc2000,$00000000,$40340000,$8e1bc9bf
- dc.l $04000000,$40690000,$9dc5ada8,$2b70b59e
- dc.l $40d30000,$c2781f49,$ffcfa6d6,$41a80000
- dc.l $93ba47c9,$80e98ce0,$43510000,$aa7eebfb
- dc.l $9df9de8e,$46a30000,$e319a0ae,$a60e91c7
- dc.l $4d480000,$c9767586,$81750c18,$5a920000
- dc.l $9e8b3b5d,$c53d5de5,$75250000,$c4605202
- dc.l $8a20979b,$2f003229,$00005bee,$ff540281
- dc.l $00007fff,$30280000,$02407fff,$0c403fff
- dc.l $6d0000c0,$0c40400c,$6e0000a4,$f2284803
- dc.l $0000f200,$6000f23c,$88000000,$00004a29
- dc.l $00046b5e,$2f003d69,$0000ff84,$2d690004
- dc.l $ff882d69,$0008ff8c,$41eeff84,$61ff0000
- dc.l $60ba4480,$d09ff22e,$d080ff84,$0c40c001
- dc.l $6c36f21f,$9000223c,$80000000,$0480ffff
- dc.l $c0014480,$0c000020,$6c0ae0a9,$42a72f01
- dc.l $42a76028,$04000020,$e0a92f01,$42a742a7
- dc.l $601af229,$d0800000,$f21f9000,$06403fff
- dc.l $484042a7,$2f3c8000,$00002f00,$f200b000
- dc.l $123c0000,$f21f4823,$60ff0000,$04ce201f
- dc.l $c1494a29,$00006bff,$0000038c,$60ff0000
- dc.l $03c44a29,$00046a16,$201ff200,$9000123c
- dc.l $0003f229,$48000000,$60ff0000,$049e201f
- dc.l $204960ff,$000002e2,$00010000,$80000000
- dc.l $00000000,$00000000,$422eff65,$2f00422e
- dc.l $ff5c600c,$422eff65,$2f001d7c,$0001ff5c
- dc.l $48e73f00,$36280000,$3d43ff58,$02830000
- dc.l $7fff2828,$00042a28,$00084a83,$663c263c
- dc.l $00003ffe,$4a846616,$28054285,$04830000
- dc.l $00204286,$edc46000,$edac9686,$60224286
- dc.l $edc46000,$9686edac,$2e05edad,$44860686
- dc.l $00000020,$ecaf8887,$60060683,$00003ffe
- dc.l $30290000,$3d40ff5a,$322eff58,$b1810281
- dc.l $00008000,$3d41ff5e,$02800000,$7fff2229
- dc.l $00042429,$00084a80,$663c203c,$00003ffe
- dc.l $4a816616,$22024282,$04800000,$00204286
- dc.l $edc16000,$eda99086,$60224286,$edc16000
- dc.l $9086eda9,$2e02edaa,$44860686,$00000020
- dc.l $ecaf8287,$60060680,$00003ffe,$2d43ff54
- dc.l $2f009083,$42864283,$227c0000,$00004a80
- dc.l $6c06201f,$6000006a,$588f4a86,$6e0eb284
- dc.l $6608b485,$66046000,$01366508,$94859384
- dc.l $42865283,$4a80670e,$d683d482,$e39155c6
- dc.l $52895380,$60d4202e,$ff544a81,$66162202
- dc.l $42820480,$00000020,$4286edc1,$6000eda9
- dc.l $9086601c,$4286edc1,$60006b14,$9086eda9
- dc.l $2e02edaa,$44860686,$00000020,$ecaf8287
- dc.l $0c800000,$41fe6c2a,$3d40ff90,$2d41ff94
- dc.l $2d42ff98,$2c2eff54,$3d46ff84,$2d44ff88
- dc.l $2d45ff8c,$f22e4800,$ff901d7c,$0001ff5d
- dc.l $60362d41,$ff942d42,$ff980480,$00003ffe
- dc.l $3d40ff90,$2c2eff54,$04860000,$3ffe2d46
- dc.l $ff54f22e,$4800ff90,$3d46ff84,$2d44ff88
- dc.l $2d45ff8c,$422eff5d,$4a2eff5c,$67222c2e
- dc.l $ff545386,$b0866d18,$6e0eb284,$6608b485
- dc.l $66046000,$007a6508,$f22e4828,$ff845283
- dc.l $3c2eff5a,$6c04f200,$001a4286,$3c2eff5e
- dc.l $7e08eeae,$02830000,$007f8686,$1d43ff65
- dc.l $4cdf00fc,$201ff200,$90004a2e,$ff5d6710
- dc.l $123c0000,$f23a4823,$fdc060ff,$0000024c
- dc.l $123c0003,$f2000000,$60ff0000,$023e5283
- dc.l $0c800000,$00086c04,$e1ab6002,$4283f23c
- dc.l $44000000,$0000422e,$ff5d6000,$ff942c03
- dc.l $02860000,$00014a86,$6700ff86,$52833c2e
- dc.l $ff5a0a86,$00008000,$3d46ff5a,$6000ff72
- dc.l $7fff0000,$ffffffff,$ffffffff,$4a280000
- dc.l $6b12f23c,$44007f80,$000000ae,$02000410
- dc.l $ff644e75,$f23c4400,$ff800000,$00ae0a00
- dc.l $0410ff64,$4e7500ae,$01002080,$ff64f23a
- dc.l $d080ffbe,$4e7500ae,$00000800,$ff646008
- dc.l $00ae0000,$0a28ff64,$22482200,$020100c0
- dc.l $660e4a28,$00006a18,$08ee0003,$ff646010
- dc.l $2f094a28,$00005bc1,$61ff0000,$0196225f
- dc.l $f210d080,$102eff62,$0200000a,$66024e75
- dc.l $3d690000,$ff842d69,$0004ff88,$2d690008
- dc.l $ff8c41ee,$ff8461ff,$00005cd0,$06800000
- dc.l $6000026e,$8000ff84,$816eff84,$f22ed040
- dc.l $ff844e75,$00ae0000,$0a28ff64,$4a105bc1
- dc.l $61ff0000,$013ef210,$d080f23c,$44800000
- dc.l $00004e75,$00ae0000,$0a28ff64,$51c161ff
- dc.l $00000120,$f210d080,$f23c4480,$00000000
- dc.l $4e7500ae,$00001048,$ff641200,$020100c0
- dc.l $675c4a28,$00046b24,$3d680000,$ff842d68
- dc.l $0004ff88,$2d680008,$ff8c41ee,$ff8448e7
- dc.l $c08061ff,$00005c44,$4cdf0103,$0c010040
- dc.l $660e4aa8,$00086614,$4a280007,$660e601e
- dc.l $22280008,$02810000,$07ff6712,$00ae0000
- dc.l $0200ff64,$600800ae,$00001248,$ff644a28
- dc.l $00005bc1,$61ff0000,$5f261d40,$ff64f210
- dc.l $d080f23c,$44800000,$00004e75,$00ae0000
- dc.l $1248ff64,$51c161ff,$00005f04,$1d40ff64
- dc.l $f210d080,$f23c4480,$00000000,$4e75f327
- dc.l $4a2f0002,$6b2edffc,$0000000c,$f294000e
- dc.l $f2810014,$006e0208,$ff664e75,$00ae0800
- dc.l $0208ff64,$4e751d7c,$0004ff64,$006e0208
- dc.l $ff664e75,$006e0208,$ff6661ff,$00000bae
- dc.l $dffc0000,$000c4e75,$f3274a2f,$00026bea
- dc.l $dffc0000,$000cf200,$a80081ae,$ff644e75
- dc.l $00ae0000,$0a28ff64,$02410010,$e8080200
- dc.l $000f8001,$2200e309,$1d7b000a,$ff6441fb
- dc.l $16204e75,$04040400,$04040400,$04040400
- dc.l $00000000,$0c0c080c,$0c0c080c,$0c0c080c
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000001,$00000000
- dc.l $3f810000,$00000000,$00000000,$00000000
- dc.l $3f810000,$00000000,$00000000,$00000000
- dc.l $3f810000,$00000000,$00000000,$00000000
- dc.l $3f810000,$00000100,$00000000,$00000000
- dc.l $3c010000,$00000000,$00000000,$00000000
- dc.l $3c010000,$00000000,$00000000,$00000000
- dc.l $3c010000,$00000000,$00000000,$00000000
- dc.l $3c010000,$00000000,$00000800,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $80000000,$00000000,$00000000,$00000000
- dc.l $80000000,$00000000,$00000000,$00000000
- dc.l $80000000,$00000000,$00000001,$00000000
- dc.l $80000000,$00000000,$00000000,$00000000
- dc.l $bf810000,$00000000,$00000000,$00000000
- dc.l $bf810000,$00000000,$00000000,$00000000
- dc.l $bf810000,$00000100,$00000000,$00000000
- dc.l $bf810000,$00000000,$00000000,$00000000
- dc.l $bc010000,$00000000,$00000000,$00000000
- dc.l $bc010000,$00000000,$00000000,$00000000
- dc.l $bc010000,$00000000,$00000800,$00000000
- dc.l $bc010000,$00000000,$00000000,$00000000
- dc.l $4a280000,$6b10f23c,$44000000,$00001d7c
- dc.l $0004ff64,$4e75f23c,$44008000,$00001d7c
- dc.l $000cff64,$4e754a29,$00006bea,$60d84a28
- dc.l $00006b10,$f23c4400,$7f800000,$1d7c0002
- dc.l $ff644e75,$f23c4400,$ff800000,$1d7c000a
- dc.l $ff644e75,$4a290000,$6bea60d8,$4a280000
- dc.l $6ba460d0,$4a280000,$6b00fbbc,$60c64a28
- dc.l $00006b16,$60be4a28,$00006b0e,$f23c4400
- dc.l $3f800000,$422eff64,$4e75f23c,$4400bf80
- dc.l $00001d7c,$0008ff64,$4e753fff,$0000c90f
- dc.l $daa22168,$c235bfff,$0000c90f,$daa22168
- dc.l $c2354a28,$00006b0e,$f2009000,$f23a4800
- dc.l $ffda6000,$fcf0f200,$9000f23a,$4800ffd8
- dc.l $6000fcea,$f23c4480,$3f800000,$4a280000
- dc.l $6a10f23c,$44008000,$00001d7c,$000cff64
- dc.l $6040f23c,$44000000,$00001d7c,$0004ff64
- dc.l $6030f23a,$4880faea,$61ff0000,$00286000
- dc.l $fb16f228,$48800000,$61ff0000,$00186000
- dc.l $030ef228,$48800000,$61ff0000,$00086000
- dc.l $02ee102e,$ff430240,$0007303b,$02064efb
- dc.l $00020010,$00180020,$0026002c,$00320038
- dc.l $003ef22e,$f040ffdc,$4e75f22e,$f040ffe8
- dc.l $4e75f200,$05004e75,$f2000580,$4e75f200
- dc.l $06004e75,$f2000680,$4e75f200,$07004e75
- dc.l $f2000780,$4e75122e,$ff4f67ff,$fffff7dc
- dc.l $0c010001,$67000096,$0c010002,$67ffffff
- dc.l $fa880c01,$000467ff,$fffff7c0,$0c010005
- dc.l $67ff0000,$024060ff,$0000024a,$122eff4f
- dc.l $67ffffff,$fa640c01,$000167ff,$fffffa5a
- dc.l $0c010002,$67ffffff,$fa500c01,$000467ff
- dc.l $fffffa46,$0c010003,$67ff0000,$021860ff
- dc.l $00000202,$122eff4f,$67ff0000,$004e0c01
- dc.l $000167ff,$00000028,$0c010002,$67ffffff
- dc.l $fa180c01,$000467ff,$00000030,$0c010003
- dc.l $67ff0000,$01e060ff,$000001ca,$12280000
- dc.l $10290000,$b1010201,$00801d41,$ff654a00
- dc.l $6a00fdc4,$6000fdd0,$422eff65,$2f001228
- dc.l $00001029,$0000b101,$02010080,$1d41ff65
- dc.l $0c2e0004,$ff4f660c,$41e90000,$201f60ff
- dc.l $fffff9c6,$f21f9000,$f2294800,$00004a29
- dc.l $00006b02,$4e751d7c,$0008ff64,$4e75122e
- dc.l $ff4f67ff,$fffff6e0,$0c010001,$6700ff8e
- dc.l $0c010002,$67ffffff,$f9800c01,$000467ff
- dc.l $fffff6c4,$0c010003,$67ff0000,$014860ff
- dc.l $00000132,$122eff4f,$67ffffff,$f95c0c01
- dc.l $000167ff,$fffff952,$0c010002,$67ffffff
- dc.l $f9480c01,$000467ff,$fffff93e,$0c010003
- dc.l $67ff0000,$011060ff,$000000fa,$122eff4f
- dc.l $6700ff46,$0c010001,$6700ff22,$0c010002
- dc.l $67ffffff,$f9140c01,$000467ff,$ffffff2c
- dc.l $0c010003,$67ff0000,$00dc60ff,$000000c6
- dc.l $122eff4f,$67ffffff,$f51e0c01,$000167ff
- dc.l $fffffce6,$0c010002,$67ffffff,$fd0a0c01
- dc.l $000467ff,$fffff500,$0c010003,$67ff0000
- dc.l $00a460ff,$0000008e,$122eff4f,$67ffffff
- dc.l $f4e60c01,$000167ff,$fffffcae,$0c010002
- dc.l $67ffffff,$fcd20c01,$000467ff,$fffff4c8
- dc.l $0c010003,$67ff0000,$006c60ff,$00000056
- dc.l $122eff4f,$67ffffff,$f8800c01,$000367ff
- dc.l $00000052,$0c010005,$67ff0000,$003860ff
- dc.l $fffff866,$122eff4f,$0c010003,$67340c01
- dc.l $0005671e,$6058122e,$ff4f0c01,$00036708
- dc.l $0c010005,$670c6036,$00ae0100,$4080ff64
- dc.l $6010f229,$48000000,$f200a800,$81aeff64
- dc.l $4e75f229,$48000000,$4a290000,$6b081d7c
- dc.l $0001ff64,$4e751d7c,$0009ff64,$4e75f228
- dc.l $48000000,$f200a800,$81aeff64,$4e75f228
- dc.l $48000000,$4a280000,$6bdc1d7c,$0001ff64
- dc.l $4e751d7c,$0009ff64,$4e75122e,$ff4e67ff
- dc.l $ffffd936,$0c010001,$67ffffff,$fba60c01
- dc.l $000267ff,$fffffbca,$0c010004,$67ffffff
- dc.l $d9f60c01,$000367ff,$ffffffb6,$60ffffff
- dc.l $ffa0122e,$ff4e67ff,$ffffe620,$0c010001
- dc.l $67ffffff,$fb6e0c01,$000267ff,$fffffbc8
- dc.l $0c010004,$67ffffff,$e7560c01,$000367ff
- dc.l $ffffff7e,$60ffffff,$ff68122e,$ff4e67ff
- dc.l $ffffd4d2,$0c010001,$67ffffff,$fb360c01
- dc.l $000267ff,$fffffb9a,$0c010004,$67ffffff
- dc.l $d76a0c01,$000367ff,$ffffff46,$60ffffff
- dc.l $ff30122e,$ff4e67ff,$ffffd972,$0c010001
- dc.l $67ffffff,$fafe0c01,$000267ff,$fffffb6a
- dc.l $0c010004,$67ffffff,$dabc0c01,$000367ff
- dc.l $ffffff0e,$60ffffff,$fef8122e,$ff4e67ff
- dc.l $ffffca6a,$0c010001,$67ffffff,$fac60c01
- dc.l $000267ff,$fffffb6e,$0c010004,$67ffffff
- dc.l $cc8a0c01,$000367ff,$fffffed6,$60ffffff
- dc.l $fec0122e,$ff4e67ff,$ffffcc76,$0c010001
- dc.l $67ffffff,$fa8e0c01,$000267ff,$fffff6aa
- dc.l $0c010004,$67ffffff,$cd060c01,$000367ff
- dc.l $fffffe9e,$60ffffff,$fe88122e,$ff4e67ff
- dc.l $ffffe662,$0c010001,$67ffffff,$fa560c01
- dc.l $000267ff,$fffff672,$0c010004,$67ffffff
- dc.l $e6c60c01,$000367ff,$fffffe66,$60ffffff
- dc.l $fe50122e,$ff4e67ff,$ffffb372,$0c010001
- dc.l $67ffffff,$fa1e0c01,$000267ff,$fffff63a
- dc.l $0c010004,$67ffffff,$b5380c01,$000367ff
- dc.l $fffffe2e,$60ffffff,$fe18122e,$ff4e67ff
- dc.l $ffffbdfc,$0c010001,$67ffffff,$f9e60c01
- dc.l $000267ff,$fffff602,$0c010004,$67ffffff
- dc.l $bf420c01,$000367ff,$fffffdf6,$60ffffff
- dc.l $fde0122e,$ff4e67ff,$ffffd17a,$0c010001
- dc.l $67ffffff,$fa2a0c01,$000267ff,$fffffa00
- dc.l $0c010004,$67ffffff,$d3080c01,$000367ff
- dc.l $fffffdbe,$60ffffff,$fda8122e,$ff4e67ff
- dc.l $ffffeb64,$0c010001,$67ffffff,$f9f20c01
- dc.l $000267ff,$fffff9c8,$0c010004,$67ffffff
- dc.l $ec200c01,$000367ff,$fffffd86,$60ffffff
- dc.l $fd70122e,$ff4e67ff,$ffffec24,$0c010001
- dc.l $67ffffff,$f9ba0c01,$000267ff,$fffff990
- dc.l $0c010004,$67ffffff,$ed360c01,$000367ff
- dc.l $fffffd4e,$60ffffff,$fd38122e,$ff4e67ff
- dc.l $ffffe178,$0c010001,$67ffffff,$f51a0c01
- dc.l $000267ff,$fffff960,$0c010004,$67ffffff
- dc.l $e30c0c01,$000367ff,$fffffd16,$60ffffff
- dc.l $fd00122e,$ff4e67ff,$ffffe582,$0c010001
- dc.l $67ffffff,$f4e20c01,$000267ff,$fffff928
- dc.l $0c010004,$67ffffff,$e5940c01,$000367ff
- dc.l $fffffcde,$60ffffff,$fcc8122e,$ff4e67ff
- dc.l $ffffe59a,$0c010001,$67ffffff,$f4aa0c01
- dc.l $000267ff,$fffff8f0,$0c010004,$67ffffff
- dc.l $e5d60c01,$000367ff,$fffffca6,$60ffffff
- dc.l $fc90122e,$ff4e67ff,$ffffd530,$0c010001
- dc.l $67ffffff,$f8da0c01,$000267ff,$fffff888
- dc.l $0c010004,$67ffffff,$d5b60c01,$000367ff
- dc.l $fffffc6e,$60ffffff,$fc58122e,$ff4e67ff
- dc.l $ffffcac2,$0c010001,$67ffffff,$f8de0c01
- dc.l $000267ff,$fffff442,$0c010004,$67ffffff
- dc.l $cb340c01,$000367ff,$fffffc36,$60ffffff
- dc.l $fc20122e,$ff4e67ff,$ffffb14c,$0c010001
- dc.l $67ffffff,$f86a0c01,$000267ff,$fffff40a
- dc.l $0c010004,$67ffffff,$b30e0c01,$000367ff
- dc.l $fffffbfe,$60ffffff,$fbe8122e,$ff4e67ff
- dc.l $ffffd40e,$0c010001,$67ffffff,$f7b60c01
- dc.l $000267ff,$fffff3d2,$0c010004,$67ffffff
- dc.l $d40c0c01,$000367ff,$fffffbc6,$60ffffff
- dc.l $fbb0122e,$ff4e67ff,$ffffd40a,$0c010001
- dc.l $67ffffff,$f77e0c01,$000267ff,$fffff39a
- dc.l $0c010004,$67ffffff,$d41a0c01,$000367ff
- dc.l $fffffb8e,$60ffffff,$fb78122e,$ff4e67ff
- dc.l $ffffb292,$0c010001,$67ffffff,$f81a0c01
- dc.l $000267ff,$fffff83e,$0c010004,$67ffffff
- dc.l $b50a0c01,$000367ff,$fffff83a,$60ffffff
- dc.l $f844122e,$ff4e67ff,$fffff89e,$0c010001
- dc.l $67ffffff,$f8ca0c01,$000267ff,$fffff8f8
- dc.l $0c010004,$67ffffff,$f8800c01,$000367ff
- dc.l $fffffab4,$60ffffff,$fac0122e,$ff4e67ff
- dc.l $fffff96e,$0c010001,$67ffffff,$f99a0c01
- dc.l $000267ff,$fffff9c8,$0c010004,$67ffffff
- dc.l $f9500c01,$000367ff,$fffffa7c,$60ffffff
- dc.l $fa88122e,$ff4e67ff,$fffff9d8,$0c010001
- dc.l $67ffffff,$fa060c01,$000267ff,$fffffa34
- dc.l $0c010004,$67ffffff,$f9ba0c01,$000367ff
- dc.l $fffffa44,$60ffffff,$fa500c2f,$00070003
- dc.l $673e1d7c,$0000ff4e,$1d7c0000,$ff4ff22e
- dc.l $f080ff78,$41ef0004,$43eeff78,$0c010003
- dc.l $67160c01,$00026708,$61ff0000,$02004e75
- dc.l $61ff0000,$1b9e4e75,$61ff0000,$05e44e75
- dc.l $1d7c0004,$ff4e60c0,$4afc006d,$000005d2
- dc.l $00000fc8,$fffffa6e,$0000106c,$00002314
- dc.l $00000000,$fffffaa6,$00000000,$fffffade
- dc.l $fffffb16,$fffffb4e,$00000000,$fffffb86
- dc.l $fffffbbe,$fffffbf6,$fffffc2e,$fffffc66
- dc.l $fffffc9e,$fffffcd6,$00000000,$fffffd0e
- dc.l $fffffd46,$fffffd7e,$00000000,$00001112
- dc.l $fffffdb6,$00000ca8,$00000000,$fffffdee
- dc.l $fffffe26,$fffffe5e,$fffffe96,$0000089e
- dc.l $ffffff06,$00001b84,$000001de,$00001854
- dc.l $ffffff3e,$ffffff76,$00001512,$00001f4c
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$fffffece
- dc.l $fffffece,$fffffece,$fffffece,$fffffece
- dc.l $fffffece,$fffffece,$fffffece,$000013b0
- dc.l $00000000,$00000f56,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$000005c0
- dc.l $00002302,$00000000,$00000000,$000005ca
- dc.l $0000230c,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00001100
- dc.l $00000000,$00000c96,$00000000,$0000110a
- dc.l $00000000,$00000ca0,$00000000,$0000088c
- dc.l $00000000,$00001b72,$000001cc,$00000896
- dc.l $00000000,$00001b7c,$000001d6,$00001f3a
- dc.l $00000000,$00000000,$00000000,$00001f44
- dc.l $ffffc001,$ffffff81,$fffffc01,$00004000
- dc.l $0000007f,$000003ff,$02000030,$00000040
- dc.l $60080200,$00300000,$00802d40,$ff5c4241
- dc.l $122eff4f,$e709822e,$ff4e6600,$02e43d69
- dc.l $0000ff90,$2d690004,$ff942d69,$0008ff98
- dc.l $3d680000,$ff842d68,$0004ff88,$2d680008
- dc.l $ff8c61ff,$000024ce,$2f0061ff,$00002572
- dc.l $d197322e,$ff5eec09,$201fb0bb,$14846700
- dc.l $011e6d00,$0062b0bb,$14846700,$021a6e00
- dc.l $014af22e,$d080ff90,$f22e9000,$ff5cf23c
- dc.l $88000000,$0000f22e,$4823ff84,$f201a800
- dc.l $f23c9000,$00000000,$83aeff64,$f22ef080
- dc.l $ff842f02,$322eff84,$24010281,$00007fff
- dc.l $02428000,$92808242,$3d41ff84,$241ff22e
- dc.l $d080ff84,$4e75f22e,$d080ff90,$f22e9000
- dc.l $ff5cf23c,$88000000,$0000f22e,$4823ff84
- dc.l $f201a800,$f23c9000,$00000000,$83aeff64
- dc.l $00ae0000,$1048ff64,$122eff62,$02010013
- dc.l $661c082e,$0003ff64,$56c1202e,$ff5c61ff
- dc.l $00004fcc,$812eff64,$f210d080,$4e75222e
- dc.l $ff5c0201,$00c06634,$f22ef080,$ff842f02
- dc.l $322eff84,$34010281,$00007fff,$92800481
- dc.l $00006000,$02417fff,$02428000,$82423d41
- dc.l $ff84241f,$f22ed040,$ff8460a6,$f22ed080
- dc.l $ff90222e,$ff5c0201,$0030f201,$9000f22e
- dc.l $4823ff84,$f23c9000,$00000000,$60aaf22e
- dc.l $d080ff90,$f22e9000,$ff5cf23c,$88000000
- dc.l $0000f22e,$4823ff84,$f201a800,$f23c9000
- dc.l $00000000,$83aeff64,$f2000098,$f23c58b8
- dc.l $0002f293,$ff3c6000,$fee408ee,$0003ff66
- dc.l $f22ed080,$ff90f23c,$90000000,$0010f23c
- dc.l $88000000,$0000f22e,$4823ff84,$f201a800
- dc.l $f23c9000,$00000000,$83aeff64,$122eff62
- dc.l $0201000b,$6620f22e,$f080ff84,$41eeff84
- dc.l $222eff5c,$61ff0000,$4dd8812e,$ff64f22e
- dc.l $d080ff84,$4e75f22e,$d040ff90,$222eff5c
- dc.l $020100c0,$6652f22e,$9000ff5c,$f23c8800
- dc.l $00000000,$f22e48a3,$ff84f23c,$90000000
- dc.l $0000f22e,$f040ff84,$2f02322e,$ff842401
- dc.l $02810000,$7fff0242,$80009280,$06810000
- dc.l $60000241,$7fff8242,$3d41ff84,$241ff22e
- dc.l $d040ff84,$6000ff80,$222eff5c,$02010030
- dc.l $f2019000,$60a6f22e,$d080ff90,$f22e9000
- dc.l $ff5cf23c,$88000000,$0000f22e,$4823ff84
- dc.l $f201a800,$f23c9000,$00000000,$83aeff64
- dc.l $f2000098,$f23c58b8,$0002f292,$fde0f294
- dc.l $fefaf22e,$d040ff90,$222eff5c,$020100c0
- dc.l $00010010,$f2019000,$f23c8800,$00000000
- dc.l $f22e48a3,$ff84f23c,$90000000,$0000f200
- dc.l $0498f23c,$58b80002,$f293fda2,$6000febc
- dc.l $323b120a,$4efb1006,$4afc0030,$fd120072
- dc.l $00cc006c,$fd120066,$00000000,$00720072
- dc.l $0060006c,$00720066,$00000000,$009e0060
- dc.l $009e006c,$009e0066,$00000000,$006c006c
- dc.l $006c006c,$006c0066,$00000000,$fd120072
- dc.l $00cc006c,$fd120066,$00000000,$00660066
- dc.l $00660066,$00660066,$00000000,$60ff0000
- dc.l $230e60ff,$00002284,$60ff0000,$227e1028
- dc.l $00001229,$0000b101,$6a10f23c,$44008000
- dc.l $00001d7c,$000cff64,$4e75f23c,$44000000
- dc.l $00001d7c,$0004ff64,$4e75f229,$d0800000
- dc.l $10280000,$12290000,$b1016a10,$f2000018
- dc.l $f200001a,$1d7c000a,$ff644e75,$f2000018
- dc.l $1d7c0002,$ff644e75,$f228d080,$00001028
- dc.l $00001229,$0000b101,$6ae260d0,$02000030
- dc.l $00000040,$60080200,$00300000,$00802d40
- dc.l $ff5c122e,$ff4e6600,$02620200,$00c06600
- dc.l $007c4a28,$00006a06,$08ee0003,$ff64f228
- dc.l $d0800000,$4e750200,$00c06600,$006008ee
- dc.l $0003ff66,$4a280000,$6a0608ee,$0003ff64
- dc.l $f228d080,$0000082e,$0003ff62,$66024e75
- dc.l $3d680000,$ff842d68,$0004ff88,$2d680008
- dc.l $ff8c41ee,$ff8461ff,$00004950,$44400640
- dc.l $6000322e,$ff840241,$80000240,$7fff8041
- dc.l $3d40ff84,$f22ed040,$ff844e75,$0c000040
- dc.l $667e3d68,$0000ff84,$2d680004,$ff882d68
- dc.l $0008ff8c,$61ff0000,$206c0c80,$0000007f
- dc.l $6c000092,$0c80ffff,$ff816700,$01786d00
- dc.l $00f4f23c,$88000000,$0000f22e,$9000ff5c
- dc.l $f22e4800,$ff84f201,$a800f23c,$90000000
- dc.l $000083ae,$ff642f02,$f22ef080,$ff84322e
- dc.l $ff843401,$02810000,$7fff9280,$02428000
- dc.l $84413d42,$ff84241f,$f22ed080,$ff844e75
- dc.l $3d680000,$ff842d68,$0004ff88,$2d680008
- dc.l $ff8c61ff,$00001fee,$0c800000,$03ff6c00
- dc.l $00140c80,$fffffc01,$670000fa,$6d000076
- dc.l $6000ff80,$08ee0003,$ff664a2e,$ff846a06
- dc.l $08ee0003,$ff64122e,$ff620201,$000b661a
- dc.l $41eeff84,$222eff5c,$61ff0000,$4a74812e
- dc.l $ff64f22e,$d080ff84,$4e752d6e,$ff88ff94
- dc.l $2d6eff8c,$ff98322e,$ff842f02,$34010281
- dc.l $00007fff,$92800242,$80000681,$00006000
- dc.l $02417fff,$84413d42,$ff90f22e,$d040ff90
- dc.l $241f60ac,$f23c8800,$00000000,$f22e9000
- dc.l $ff5cf22e,$4800ff84,$f23c9000,$00000000
- dc.l $f201a800,$83aeff64,$00ae0000,$1048ff64
- dc.l $122eff62,$02010013,$661c082e,$0003ff64
- dc.l $56c1202e,$ff5c61ff,$00004ae4,$812eff64
- dc.l $f210d080,$4e752f02,$322eff84,$24010281
- dc.l $00007fff,$02428000,$92800481,$00006000
- dc.l $02417fff,$82423d41,$ff84241f,$f22ed040
- dc.l $ff8460b6,$f23c8800,$00000000,$f22e9000
- dc.l $ff5cf22e,$4800ff84,$f201a800,$f23c9000
- dc.l $00000000,$83aeff64,$f2000098,$f23c58b8
- dc.l $0002f293,$ff746000,$fe7e0c01,$00046700
- dc.l $fdb60c01,$000567ff,$00001f98,$0c010003
- dc.l $67ff0000,$1fa2f228,$48000000,$f200a800
- dc.l $e1981d40,$ff644e75,$51fc51fc,$51fc51fc
- dc.l $00003fff,$0000007e,$000003fe,$ffffc001
- dc.l $ffffff81,$fffffc01,$02000030,$00000040
- dc.l $60080200,$00300000,$00802d40,$ff5c4241
- dc.l $122eff4f,$e709822e,$ff4e6600,$02d63d69
- dc.l $0000ff90,$2d690004,$ff942d69,$0008ff98
- dc.l $3d680000,$ff842d68,$0004ff88,$2d680008
- dc.l $ff8c61ff,$00001e0e,$2f0061ff,$00001eb2
- dc.l $4497d197,$322eff5e,$ec09201f,$b0bb148e
- dc.l $6f000074,$b0bb1520,$ff7a6700,$020c6e00
- dc.l $013cf22e,$d080ff90,$f22e9000,$ff5cf23c
- dc.l $88000000,$0000f22e,$4820ff84,$f201a800
- dc.l $f23c9000,$00000000,$83aeff64,$f22ef080
- dc.l $ff842f02,$322eff84,$24010281,$00007fff
- dc.l $02428000,$92808242,$3d41ff84,$241ff22e
- dc.l $d080ff84,$4e750000,$7fff0000,$407f0000
- dc.l $43ff201f,$60c62f00,$f22ed080,$ff90f22e
- dc.l $9000ff5c,$f23c8800,$00000000,$f22e4820
- dc.l $ff84f200,$a800f23c,$90000000,$000081ae
- dc.l $ff64f227,$e0013017,$dffc0000,$000c0280
- dc.l $00007fff,$9097b0bb,$14ae6db6,$201f00ae
- dc.l $00001048,$ff64122e,$ff620201,$0013661c
- dc.l $082e0003,$ff6456c1,$202eff5c,$61ff0000
- dc.l $48de812e,$ff64f210,$d0804e75,$222eff5c
- dc.l $020100c0,$6634f22e,$f080ff84,$2f02322e
- dc.l $ff843401,$02810000,$7fff9280,$04810000
- dc.l $60000241,$7fff0242,$80008242,$3d41ff84
- dc.l $241ff22e,$d040ff84,$60a6f22e,$d080ff90
- dc.l $222eff5c,$02010030,$f2019000,$f22e4820
- dc.l $ff84f23c,$90000000,$000060aa,$08ee0003
- dc.l $ff66f22e,$d080ff90,$f23c9000,$00000010
- dc.l $f23c8800,$00000000,$f22e4820,$ff84f201
- dc.l $a800f23c,$90000000,$000083ae,$ff64122e
- dc.l $ff620201,$000b6620,$f22ef080,$ff8441ee
- dc.l $ff84222e,$ff5c61ff,$00004726,$812eff64
- dc.l $f22ed080,$ff844e75,$f22ed040,$ff90222e
- dc.l $ff5c0201,$00c06652,$f22e9000,$ff5cf23c
- dc.l $88000000,$0000f22e,$48a0ff84,$f23c9000
- dc.l $00000000,$f22ef040,$ff842f02,$322eff84
- dc.l $24010281,$00007fff,$02428000,$92800681
- dc.l $00006000,$02417fff,$82423d41,$ff84241f
- dc.l $f22ed040,$ff846000,$ff80222e,$ff5c0201
- dc.l $0030f201,$900060a6,$f22ed080,$ff90f22e
- dc.l $9000ff5c,$f23c8800,$00000000,$f22e4820
- dc.l $ff84f201,$a800f23c,$90000000,$000083ae
- dc.l $ff64f200,$0098f23c,$58b80001,$f292fdee
- dc.l $f294fefa,$f22ed040,$ff90222e,$ff5c0201
- dc.l $00c00001,$0010f201,$9000f23c,$88000000
- dc.l $0000f22e,$48a0ff84,$f23c9000,$00000000
- dc.l $f2000498,$f23c58b8,$0001f293,$fdb06000
- dc.l $febc323b,$120a4efb,$10064afc,$0030fd20
- dc.l $009e0072,$0060fd20,$00660000,$00000072
- dc.l $006c0072,$00600072,$00660000,$000000d0
- dc.l $00d0006c,$006000d0,$00660000,$00000060
- dc.l $00600060,$00600060,$00660000,$0000fd20
- dc.l $009e0072,$0060fd20,$00660000,$00000066
- dc.l $00660066,$00660066,$00660000,$000060ff
- dc.l $00001bd8,$60ff0000,$1bd260ff,$00001c50
- dc.l $10280000,$12290000,$b1016a10,$f23c4400
- dc.l $80000000,$1d7c000c,$ff644e75,$f23c4400
- dc.l $00000000,$1d7c0004,$ff644e75,$006e0410
- dc.l $ff661028,$00001229,$0000b101,$6a10f23c
- dc.l $4400ff80,$00001d7c,$000aff64,$4e75f23c
- dc.l $44007f80,$00001d7c,$0002ff64,$4e751029
- dc.l $00001228,$0000b101,$6a16f229,$d0800000
- dc.l $f2000018,$f200001a,$1d7c000a,$ff644e75
- dc.l $f229d080,$0000f200,$00181d7c,$0002ff64
- dc.l $4e750200,$00300000,$00406008,$02000030
- dc.l $00000080,$2d40ff5c,$122eff4e,$66000276
- dc.l $020000c0,$66000090,$2d680004,$ff882d68
- dc.l $0008ff8c,$30280000,$0a408000,$6a061d7c
- dc.l $0008ff64,$3d40ff84,$f22ed080,$ff844e75
- dc.l $020000c0,$666008ee,$0003ff66,$2d680004
- dc.l $ff882d68,$0008ff8c,$30280000,$0a408000
- dc.l $6a061d7c,$0008ff64,$3d40ff84,$f22ed080
- dc.l $ff84082e,$0003ff62,$66024e75,$41eeff84
- dc.l $61ff0000,$42664440,$06406000,$322eff84
- dc.l $02418000,$02407fff,$80413d40,$ff84f22e
- dc.l $d040ff84,$4e750c00,$0040667e,$3d680000
- dc.l $ff842d68,$0004ff88,$2d680008,$ff8c61ff
- dc.l $00001982,$0c800000,$007f6c00,$00900c80
- dc.l $ffffff81,$67000178,$6d0000f4,$f23c8800
- dc.l $00000000,$f22e9000,$ff5cf22e,$481aff84
- dc.l $f201a800,$f23c9000,$00000000,$83aeff64
- dc.l $2f02f22e,$f080ff84,$322eff84,$34010281
- dc.l $00007fff,$92800242,$80008441,$3d42ff84
- dc.l $241ff22e,$d080ff84,$4e753d68,$0000ff84
- dc.l $2d680004,$ff882d68,$0008ff8c,$61ff0000
- dc.l $19040c80,$000003ff,$6c120c80,$fffffc01
- dc.l $670000fc,$6d000078,$6000ff82,$08ee0003
- dc.l $ff660a2e,$0080ff84,$6a0608ee,$0003ff64
- dc.l $122eff62,$0201000b,$661a41ee,$ff84222e
- dc.l $ff5c61ff,$0000438a,$812eff64,$f22ed080
- dc.l $ff844e75,$2d6eff88,$ff942d6e,$ff8cff98
- dc.l $322eff84,$2f022401,$02810000,$7fff0242
- dc.l $80009280,$06810000,$60000241,$7fff8242
- dc.l $3d41ff90,$f22ed040,$ff90241f,$60acf23c
- dc.l $88000000,$0000f22e,$9000ff5c,$f22e481a
- dc.l $ff84f23c,$90000000,$0000f201,$a80083ae
- dc.l $ff6400ae,$00001048,$ff64122e,$ff620201
- dc.l $0013661c,$082e0003,$ff6456c1,$202eff5c
- dc.l $61ff0000,$43fa812e,$ff64f210,$d0804e75
- dc.l $2f02322e,$ff842401,$02810000,$7fff0242
- dc.l $80009280,$04810000,$60000241,$7fff8242
- dc.l $3d41ff84,$f22ed040,$ff84241f,$60b6f23c
- dc.l $88000000,$0000f22e,$9000ff5c,$f22e481a
- dc.l $ff84f201,$a800f23c,$90000000,$000083ae
- dc.l $ff64f200,$0098f23c,$58b80002,$f293ff74
- dc.l $6000fe7e,$0c010004,$6700fdb6,$0c010005
- dc.l $67ff0000,$18ae0c01,$000367ff,$000018b8
- dc.l $f228481a,$0000f200,$a800e198,$1d40ff64
- dc.l $4e75122e,$ff4e6610,$4a280000,$6b024e75
- dc.l $1d7c0008,$ff644e75,$0c010001,$67400c01
- dc.l $00026724,$0c010005,$67ff0000,$18660c01
- dc.l $000367ff,$00001870,$4a280000,$6b024e75
- dc.l $1d7c0008,$ff644e75,$4a280000,$6b081d7c
- dc.l $0002ff64,$4e751d7c,$000aff64,$4e754a28
- dc.l $00006b08,$1d7c0004,$ff644e75,$1d7c000c
- dc.l $ff644e75,$122eff4e,$66280200,$0030f200
- dc.l $9000f23c,$88000000,$0000f228,$48010000
- dc.l $f23c9000,$00000000,$f200a800,$81aeff64
- dc.l $4e750c01,$0001672e,$0c010002,$674e0c01
- dc.l $00046710,$0c010005,$67ff0000,$17d660ff
- dc.l $000017e4,$3d680000,$ff841d7c,$0080ff88
- dc.l $41eeff84,$60a44a28,$00006b10,$f23c4400
- dc.l $00000000,$1d7c0004,$ff644e75,$f23c4400
- dc.l $80000000,$1d7c000c,$ff644e75,$f228d080
- dc.l $00004a28,$00006b08,$1d7c0002,$ff644e75
- dc.l $1d7c000a,$ff644e75,$122eff4e,$6618f23c
- dc.l $88000000,$0000f228,$48030000,$f200a800
- dc.l $81aeff64,$4e750c01,$0001672e,$0c010002
- dc.l $674e0c01,$00046710,$0c010005,$67ff0000
- dc.l $174260ff,$00001750,$3d680000,$ff841d7c
- dc.l $0080ff88,$41eeff84,$60b44a28,$00006b10
- dc.l $f23c4400,$00000000,$1d7c0004,$ff644e75
- dc.l $f23c4400,$80000000,$1d7c000c,$ff644e75
- dc.l $f228d080,$00004a28,$00006b08,$1d7c0002
- dc.l $ff644e75,$1d7c000a,$ff644e75,$02000030
- dc.l $00000040,$60080200,$00300000,$00802d40
- dc.l $ff5c122e,$ff4e6600,$025c0200,$00c0667e
- dc.l $2d680004,$ff882d68,$0008ff8c,$32280000
- dc.l $0881000f,$3d41ff84,$f22ed080,$ff844e75
- dc.l $020000c0,$665808ee,$0003ff66,$2d680004
- dc.l $ff882d68,$0008ff8c,$30280000,$0880000f
- dc.l $3d40ff84,$f22ed080,$ff84082e,$0003ff62
- dc.l $66024e75,$41eeff84,$61ff0000,$3e0e4440
- dc.l $06406000,$322eff84,$02418000,$02407fff
- dc.l $80413d40,$ff84f22e,$d040ff84,$4e750c00
- dc.l $0040667e,$3d680000,$ff842d68,$0004ff88
- dc.l $2d680008,$ff8c61ff,$0000152a,$0c800000
- dc.l $007f6c00,$00900c80,$ffffff81,$67000170
- dc.l $6d0000ec,$f23c8800,$00000000,$f22e9000
- dc.l $ff5cf22e,$4818ff84,$f201a800,$f23c9000
- dc.l $00000000,$83aeff64,$2f02f22e,$f080ff84
- dc.l $322eff84,$24010281,$00007fff,$92800242
- dc.l $80008441,$3d42ff84,$241ff22e,$d080ff84
- dc.l $4e753d68,$0000ff84,$2d680004,$ff882d68
- dc.l $0008ff8c,$61ff0000,$14ac0c80,$000003ff
- dc.l $6c120c80,$fffffc01,$670000f4,$6d000070
- dc.l $6000ff82,$08ee0003,$ff6608ae,$0007ff84
- dc.l $122eff62,$0201000b,$661a41ee,$ff84222e
- dc.l $ff5c61ff,$00003f3a,$812eff64,$f22ed080
- dc.l $ff844e75,$2d6eff88,$ff942d6e,$ff8cff98
- dc.l $322eff84,$2f022401,$02810000,$7fff0242
- dc.l $80009280,$06810000,$60000241,$7fff8242
- dc.l $3d41ff90,$f22ed040,$ff90241f,$60acf23c
- dc.l $88000000,$0000f22e,$9000ff5c,$f22e4818
- dc.l $ff84f23c,$90000000,$0000f201,$a80083ae
- dc.l $ff6400ae,$00001048,$ff64122e,$ff620201
- dc.l $0013661c,$082e0003,$ff6456c1,$202eff5c
- dc.l $61ff0000,$3faa812e,$ff64f210,$d0804e75
- dc.l $2f02322e,$ff842401,$02810000,$7fff0242
- dc.l $80009280,$04810000,$60000241,$7fff8242
- dc.l $3d41ff84,$f22ed040,$ff84241f,$60b6f23c
- dc.l $88000000,$0000f22e,$9000ff5c,$f22e4818
- dc.l $ff84f201,$a800f23c,$90000000,$000083ae
- dc.l $ff64f200,$0098f23c,$58b80002,$f293ff74
- dc.l $6000fe86,$0c010004,$6700fdc6,$0c010005
- dc.l $67ff0000,$145e0c01,$000367ff,$00001468
- dc.l $f2284818,$00000c01,$00026708,$1d7c0004
- dc.l $ff644e75,$1d7c0002,$ff644e75,$4241122e
- dc.l $ff4fe709,$822eff4e,$6618f229,$d0800000
- dc.l $f2284838,$0000f200,$a800e198,$1d40ff64
- dc.l $4e75323b,$120a4efb,$10064afc,$0030ffdc
- dc.l $ffdcffdc,$006000f8,$006e0000,$0000ffdc
- dc.l $ffdcffdc,$0060007c,$006e0000,$0000ffdc
- dc.l $ffdcffdc,$0060007c,$006e0000,$00000060
- dc.l $00600060,$00600060,$006e0000,$00000114
- dc.l $009c009c,$006000bc,$006e0000,$0000006e
- dc.l $006e006e,$006e006e,$006e0000,$000061ff
- dc.l $00001388,$022e00f7,$ff644e75,$61ff0000
- dc.l $137a022e,$00f7ff64,$4e753d68,$0000ff84
- dc.l $20280004,$08c0001f,$2d40ff88,$2d680008
- dc.l $ff8c41ee,$ff846000,$ff422d69,$0000ff84
- dc.l $20290004,$08c0001f,$2d40ff88,$2d690008
- dc.l $ff8c43ee,$ff846000,$ff223d69,$0000ff90
- dc.l $3d680000,$ff842029,$000408c0,$001f2d40
- dc.l $ff942028,$000408c0,$001f2d40,$ff882d69
- dc.l $0008ff98,$2d680008,$ff8c43ee,$ff9041ee
- dc.l $ff846000,$fee61028,$00001229,$0000b101
- dc.l $6b00ff78,$4a006b02,$4e751d7c,$0008ff64
- dc.l $4e751028,$00001229,$0000b101,$6b00ff7c
- dc.l $4a006a02,$4e751d7c,$0008ff64,$4e752d40
- dc.l $ff5c4241,$122eff4f,$e709822e,$ff4e6600
- dc.l $02a03d69,$0000ff90,$2d690004,$ff942d69
- dc.l $0008ff98,$3d680000,$ff842d68,$0004ff88
- dc.l $2d680008,$ff8c61ff,$0000119a,$2f0061ff
- dc.l $0000123e,$d09f0c80,$ffffc001,$670000f8
- dc.l $6d000064,$0c800000,$40006700,$01da6e00
- dc.l $0122f22e,$d080ff90,$f22e9000,$ff5cf23c
- dc.l $88000000,$0000f22e,$4827ff84,$f201a800
- dc.l $f23c9000,$00000000,$83aeff64,$f22ef080
- dc.l $ff842f02,$322eff84,$24010281,$00007fff
- dc.l $02428000,$92808242,$3d41ff84,$241ff22e
- dc.l $d080ff84,$4e75f22e,$d080ff90,$f22e9000
- dc.l $ff5cf23c,$88000000,$0000f22e,$4827ff84
- dc.l $f201a800,$f23c9000,$00000000,$83aeff64
- dc.l $00ae0000,$1048ff64,$122eff62,$02010013
- dc.l $6620082e,$0003ff64,$56c1202e,$ff5c0200
- dc.l $003061ff,$00003c98,$812eff64,$f210d080
- dc.l $4e75f22e,$f080ff84,$2f02322e,$ff842401
- dc.l $02810000,$7fff9280,$04810000,$60000241
- dc.l $7fff0242,$80008242,$3d41ff84,$241ff22e
- dc.l $d040ff84,$60acf22e,$d080ff90,$f22e9000
- dc.l $ff5cf23c,$88000000,$0000f22e,$4827ff84
- dc.l $f201a800,$f23c9000,$00000000,$83aeff64
- dc.l $f2000098,$f23c58b8,$0002f293,$ff646000
- dc.l $ff0c08ee,$0003ff66,$f22ed080,$ff90f23c
- dc.l $90000000,$0010f23c,$88000000,$0000f22e
- dc.l $4827ff84,$f201a800,$f23c9000,$00000000
- dc.l $83aeff64,$122eff62,$0201000b,$6620f22e
- dc.l $f080ff84,$41eeff84,$222eff5c,$61ff0000
- dc.l $3b56812e,$ff64f22e,$d080ff84,$4e75f22e
- dc.l $d040ff90,$f22e9000,$ff5cf23c,$88000000
- dc.l $0000f22e,$48a7ff84,$f23c9000,$00000000
- dc.l $f22ef040,$ff842f02,$322eff84,$24010281
- dc.l $00007fff,$02428000,$92800681,$00006000
- dc.l $02417fff,$82423d41,$ff84241f,$f22ed040
- dc.l $ff846000,$ff8af22e,$d080ff90,$f22e9000
- dc.l $ff5cf23c,$88000000,$0000f22e,$4827ff84
- dc.l $f201a800,$f23c9000,$00000000,$83aeff64
- dc.l $f2000098,$f23c58b8,$0002f292,$fe20f294
- dc.l $ff12f22e,$d040ff90,$222eff5c,$020100c0
- dc.l $00010010,$f2019000,$f23c8800,$00000000
- dc.l $f22e48a7,$ff84f23c,$90000000,$0000f200
- dc.l $0498f23c,$58b80002,$f293fde2,$6000fed4
- dc.l $323b120a,$4efb1006,$4afc0030,$fd560072
- dc.l $0078006c,$fd560066,$00000000,$00720072
- dc.l $0060006c,$00720066,$00000000,$007e0060
- dc.l $007e006c,$007e0066,$00000000,$006c006c
- dc.l $006c006c,$006c0066,$00000000,$fd560072
- dc.l $0078006c,$fd560066,$00000000,$00660066
- dc.l $00660066,$00660066,$00000000,$60ff0000
- dc.l $101e60ff,$00000f94,$60ff0000,$0f8e60ff
- dc.l $ffffed0e,$60ffffff,$ed6260ff,$ffffed2e
- dc.l $2d40ff5c,$4241122e,$ff4fe709,$822eff4e
- dc.l $6600027c,$3d690000,$ff902d69,$0004ff94
- dc.l $2d690008,$ff983d68,$0000ff84,$2d680004
- dc.l $ff882d68,$0008ff8c,$61ff0000,$0e582f00
- dc.l $61ff0000,$0efc4497,$d197322e,$ff5eec09
- dc.l $201f0c80,$ffffc001,$6f000064,$0c800000
- dc.l $3fff6700,$01b66e00,$0100f22e,$d080ff90
- dc.l $f22e9000,$ff5cf23c,$88000000,$0000f22e
- dc.l $4824ff84,$f201a800,$f23c9000,$00000000
- dc.l $83aeff64,$f22ef080,$ff842f02,$322eff84
- dc.l $24010281,$00007fff,$02428000,$92808242
- dc.l $3d41ff84,$241ff22e,$d080ff84,$4e75f22e
- dc.l $d080ff90,$f22e9000,$ff5cf23c,$88000000
- dc.l $0000f22e,$4824ff84,$f201a800,$f23c9000
- dc.l $00000000,$83aeff64,$f227e001,$3217dffc
- dc.l $0000000c,$02810000,$7fff9280,$0c810000
- dc.l $7fff6d90,$006e1048,$ff66122e,$ff620201
- dc.l $00136620,$082e0003,$ff6456c1,$202eff5c
- dc.l $02000030,$61ff0000,$3936812e,$ff64f210
- dc.l $d0804e75,$f22ef080,$ff842f02,$322eff84
- dc.l $24010281,$00007fff,$02428000,$92800481
- dc.l $00006000,$02417fff,$82423d41,$ff84241f
- dc.l $f22ed040,$ff8460ac,$08ee0003,$ff66f22e
- dc.l $d080ff90,$f23c9000,$00000010,$f23c8800
- dc.l $00000000,$f22e4824,$ff84f201,$a800f23c
- dc.l $90000000,$000083ae,$ff64122e,$ff620201
- dc.l $000b6620,$f22ef080,$ff8441ee,$ff84222e
- dc.l $ff5c61ff,$00003830,$812eff64,$f22ed080
- dc.l $ff844e75,$f22ed040,$ff90f22e,$9000ff5c
- dc.l $f23c8800,$00000000,$f22e48a4,$ff84f23c
- dc.l $90000000,$0000f22e,$f040ff84,$2f02322e
- dc.l $ff842401,$02810000,$7fff0242,$80009280
- dc.l $06810000,$60000241,$7fff8242,$3d41ff84
- dc.l $241ff22e,$d040ff84,$608af22e,$d080ff90
- dc.l $f22e9000,$ff5cf23c,$88000000,$0000f22e
- dc.l $4824ff84,$f201a800,$f23c9000,$00000000
- dc.l $83aeff64,$f2000098,$f23c58b8,$0001f292
- dc.l $fe44f294,$ff14f22e,$d040ff90,$42810001
- dc.l $0010f201,$9000f23c,$88000000,$0000f22e
- dc.l $48a4ff84,$f23c9000,$00000000,$f2000498
- dc.l $f23c58b8,$0001f293,$fe0c6000,$fedc323b
- dc.l $120a4efb,$10064afc,$0030fd7a,$00720078
- dc.l $0060fd7a,$00660000,$00000078,$006c0078
- dc.l $00600078,$00660000,$0000007e,$007e006c
- dc.l $0060007e,$00660000,$00000060,$00600060
- dc.l $00600060,$00660000,$0000fd7a,$00720078
- dc.l $0060fd7a,$00660000,$00000066,$00660066
- dc.l $00660066,$00660000,$000060ff,$00000c7c
- dc.l $60ff0000,$0c7660ff,$00000cf4,$60ffffff
- dc.l $f0ce60ff,$fffff09c,$60ffffff,$f0f40200
- dc.l $00300000,$00406008,$02000030,$00000080
- dc.l $2d40ff5c,$4241122e,$ff4fe709,$822eff4e
- dc.l $6600024c,$61ff0000,$0a5cf22e,$d080ff90
- dc.l $f23c8800,$00000000,$f22e9000,$ff5cf22e
- dc.l $4822ff84,$f23c9000,$00000000,$f201a800
- dc.l $83aeff64,$f281003c,$2f02f227,$e001322e
- dc.l $ff5eec09,$34170282,$00007fff,$9480b4bb
- dc.l $14246c38,$b4bb142a,$6d0000b8,$67000184
- dc.l $32170241,$80008242,$3e81f21f,$d080241f
- dc.l $4e754e75,$00007fff,$0000407f,$000043ff
- dc.l $00000000,$00003f81,$00003c01,$00ae0000
- dc.l $1048ff64,$122eff62,$02010013,$6624dffc
- dc.l $0000000c,$082e0003,$ff6456c1,$202eff5c
- dc.l $61ff0000,$366a812e,$ff64f210,$d080241f
- dc.l $4e75122e,$ff5c0201,$00c0661a,$32170241
- dc.l $80000482,$00006000,$02427fff,$82423e81
- dc.l $f21fd040,$60bef22e,$d080ff90,$222eff5c
- dc.l $02010030,$f2019000,$f22e4822,$ff84f23c
- dc.l $90000000,$0000dffc,$0000000c,$f227e001
- dc.l $60ba08ee,$0003ff66,$dffc0000,$000cf22e
- dc.l $d080ff90,$f23c9000,$00000010,$f23c8800
- dc.l $00000000,$f22e4822,$ff84f23c,$90000000
- dc.l $0000f201,$a80083ae,$ff64122e,$ff620201
- dc.l $000b6622,$f22ef080,$ff8441ee,$ff84222e
- dc.l $ff5c61ff,$000034ba,$812eff64,$f22ed080
- dc.l $ff84241f,$4e75f22e,$d040ff90,$222eff5c
- dc.l $020100c0,$664ef22e,$9000ff5c,$f23c8800
- dc.l $00000000,$f22e48a2,$ff84f23c,$90000000
- dc.l $0000f22e,$f040ff84,$322eff84,$24010281
- dc.l $00007fff,$02428000,$92800681,$00006000
- dc.l $02417fff,$82423d41,$ff84f22e,$d040ff84
- dc.l $6000ff82,$222eff5c,$02010030,$f2019000
- dc.l $60aa222e,$ff5c0201,$00c06700,$fe74222f
- dc.l $00040c81,$80000000,$6600fe66,$4aaf0008
- dc.l $6600fe5e,$082e0001,$ff666700,$fe54f22e
- dc.l $d040ff90,$222eff5c,$020100c0,$00010010
- dc.l $f2019000,$f23c8800,$00000000,$f22e48a2
- dc.l $ff84f23c,$90000000,$0000f200,$0018f200
- dc.l $0498f200,$0438f292,$feca6000,$fe14323b
- dc.l $120a4efb,$10064afc,$0030fdaa,$00e4011c
- dc.l $0060fdaa,$00660000,$000000bc,$006c011c
- dc.l $006000bc,$00660000,$00000130,$0130010c
- dc.l $00600130,$00660000,$00000060,$00600060
- dc.l $00600060,$00660000,$0000fdaa,$00e4011c
- dc.l $0060fdaa,$00660000,$00000066,$00660066
- dc.l $00660066,$00660000,$000060ff,$0000097c
- dc.l $60ff0000,$09761028,$00001229,$0000b101
- dc.l $6b000016,$4a006b2e,$f23c4400,$00000000
- dc.l $1d7c0004,$ff644e75,$122eff5f,$02010030
- dc.l $0c010020,$6710f23c,$44000000,$00001d7c
- dc.l $0004ff64,$4e75f23c,$44008000,$00001d7c
- dc.l $000cff64,$4e753d68,$0000ff84,$2d680004
- dc.l $ff882d68,$0008ff8c,$61ff0000,$0828426e
- dc.l $ff9042ae,$ff9442ae,$ff986000,$fcce3d69
- dc.l $0000ff90,$2d690004,$ff942d69,$0008ff98
- dc.l $61ff0000,$08ac426e,$ff8442ae,$ff8842ae
- dc.l $ff8c6000,$fca61028,$00001229,$0000b300
- dc.l $6bff0000,$094af228,$d0800000,$4a280000
- dc.l $6a1c1d7c,$000aff64,$4e75f229,$d0800000
- dc.l $4a290000,$6a081d7c,$000aff64,$4e751d7c
- dc.l $0002ff64,$4e750200,$00300000,$00406008
- dc.l $02000030,$00000080,$2d40ff5c,$4241122e
- dc.l $ff4fe709,$822eff4e,$6600024c,$61ff0000
- dc.l $0694f22e,$d080ff90,$f23c8800,$00000000
- dc.l $f22e9000,$ff5cf22e,$4828ff84,$f23c9000
- dc.l $00000000,$f201a800,$83aeff64,$f281003c
- dc.l $2f02f227,$e001322e,$ff5eec09,$34170282
- dc.l $00007fff,$9480b4bb,$14246c38,$b4bb142a
- dc.l $6d0000b8,$67000184,$32170241,$80008242
- dc.l $3e81f21f,$d080241f,$4e754e75,$00007fff
- dc.l $0000407f,$000043ff,$00000000,$00003f81
- dc.l $00003c01,$00ae0000,$1048ff64,$122eff62
- dc.l $02010013,$6624dffc,$0000000c,$082e0003
- dc.l $ff6456c1,$202eff5c,$61ff0000,$32a2812e
- dc.l $ff64f210,$d080241f,$4e75122e,$ff5c0201
- dc.l $00c0661a,$32170241,$80000482,$00006000
- dc.l $02427fff,$82423e81,$f21fd040,$60bef22e
- dc.l $d080ff90,$222eff5c,$02010030,$f2019000
- dc.l $f22e4828,$ff84f23c,$90000000,$0000dffc
- dc.l $0000000c,$f227e001,$60ba08ee,$0003ff66
- dc.l $dffc0000,$000cf22e,$d080ff90,$f23c9000
- dc.l $00000010,$f23c8800,$00000000,$f22e4828
- dc.l $ff84f23c,$90000000,$0000f201,$a80083ae
- dc.l $ff64122e,$ff620201,$000b6622,$f22ef080
- dc.l $ff8441ee,$ff84222e,$ff5c61ff,$000030f2
- dc.l $812eff64,$f22ed080,$ff84241f,$4e75f22e
- dc.l $d040ff90,$222eff5c,$020100c0,$664ef22e
- dc.l $9000ff5c,$f23c8800,$00000000,$f22e48a8
- dc.l $ff84f23c,$90000000,$0000f22e,$f040ff84
- dc.l $322eff84,$24010281,$00007fff,$02428000
- dc.l $92800681,$00006000,$02417fff,$82423d41
- dc.l $ff84f22e,$d040ff84,$6000ff82,$222eff5c
- dc.l $02010030,$f2019000,$60aa222e,$ff5c0201
- dc.l $00c06700,$fe74222f,$00040c81,$80000000
- dc.l $6600fe66,$4aaf0008,$6600fe5e,$082e0001
- dc.l $ff666700,$fe54f22e,$d040ff90,$222eff5c
- dc.l $020100c0,$00010010,$f2019000,$f23c8800
- dc.l $00000000,$f22e48a8,$ff84f23c,$90000000
- dc.l $0000f200,$0018f200,$0498f200,$0438f292
- dc.l $feca6000,$fe14323b,$120a4efb,$10064afc
- dc.l $0030fdaa,$00e2011a,$0060fdaa,$00660000
- dc.l $000000ba,$006c011a,$006000ba,$00660000
- dc.l $00000130,$0130010a,$00600130,$00660000
- dc.l $00000060,$00600060,$00600060,$00660000
- dc.l $0000fdaa,$00e2011a,$0060fdaa,$00660000
- dc.l $00000066,$00660066,$00660066,$00660000
- dc.l $000060ff,$000005b4,$60ff0000,$05ae1028
- dc.l $00001229,$0000b300,$6a144a00,$6b2ef23c
- dc.l $44000000,$00001d7c,$0004ff64,$4e75122e
- dc.l $ff5f0201,$00300c01,$00206710,$f23c4400
- dc.l $00000000,$1d7c0004,$ff644e75,$f23c4400
- dc.l $80000000,$1d7c000c,$ff644e75,$3d680000
- dc.l $ff842d68,$0004ff88,$2d680008,$ff8c61ff
- dc.l $00000462,$426eff90,$42aeff94,$42aeff98
- dc.l $6000fcd0,$3d690000,$ff902d69,$0004ff94
- dc.l $2d690008,$ff9861ff,$000004e6,$426eff84
- dc.l $42aeff88,$42aeff8c,$6000fca8,$10280000
- dc.l $12290000,$b3006aff,$00000584,$f228d080
- dc.l $0000f200,$001af293,$001e1d7c,$000aff64
- dc.l $4e75f229,$d0800000,$4a290000,$6a081d7c
- dc.l $000aff64,$4e751d7c,$0002ff64,$4e750200
- dc.l $00300000,$00406008,$02000030,$00000080
- dc.l $2d40ff5c,$4241122e,$ff4e6600,$02744a28
- dc.l $00006bff,$00000528,$020000c0,$6648f22e
- dc.l $9000ff5c,$f23c8800,$00000000,$f2104804
- dc.l $f201a800,$83aeff64,$4e754a28,$00006bff
- dc.l $000004fc,$020000c0,$661c3d68,$0000ff84
- dc.l $2d680004,$ff882d68,$0008ff8c,$61ff0000
- dc.l $03ae6000,$003e0c00,$00406600,$00843d68
- dc.l $0000ff84,$2d680004,$ff882d68,$0008ff8c
- dc.l $61ff0000,$038a0c80,$0000007e,$67000098
- dc.l $6e00009e,$0c80ffff,$ff806700,$01a46d00
- dc.l $0120f23c,$88000000,$0000f22e,$9000ff5c
- dc.l $f22e4804,$ff84f201,$a800f23c,$90000000
- dc.l $000083ae,$ff642f02,$f22ef080,$ff84322e
- dc.l $ff842401,$02810000,$7fff9280,$02428000
- dc.l $84413d42,$ff84241f,$f22ed080,$ff844e75
- dc.l $3d680000,$ff842d68,$0004ff88,$2d680008
- dc.l $ff8c61ff,$00000308,$0c800000,$03fe6700
- dc.l $00166e1c,$0c80ffff,$fc006700,$01246d00
- dc.l $00a06000,$ff7e082e,$0000ff85,$6600ff74
- dc.l $08ee0003,$ff66f23c,$90000000,$0010f23c
- dc.l $88000000,$0000f22e,$4804ff84,$f201a800
- dc.l $f23c9000,$00000000,$83aeff64,$122eff62
- dc.l $0201000b,$6620f22e,$f080ff84,$41eeff84
- dc.l $222eff5c,$61ff0000,$2d28812e,$ff64f22e
- dc.l $d080ff84,$4e752d6e,$ff88ff94,$2d6eff8c
- dc.l $ff98322e,$ff842f02,$24010281,$00007fff
- dc.l $02428000,$92800681,$00006000,$02417fff
- dc.l $82423d41,$ff90f22e,$d040ff90,$241f60a6
- dc.l $f23c8800,$00000000,$f22e9000,$ff5cf22e
- dc.l $4804ff84,$f23c9000,$00000000,$f201a800
- dc.l $83aeff64,$00ae0000,$1048ff64,$122eff62
- dc.l $02010013,$661c082e,$0003ff64,$56c1202e
- dc.l $ff5c61ff,$00002d98,$812eff64,$f210d080
- dc.l $4e752f02,$322eff84,$24010281,$00007fff
- dc.l $02428000,$92800481,$00006000,$02417fff
- dc.l $82423d41,$ff84f22e,$d040ff84,$241f60b6
- dc.l $082e0000,$ff856600,$ff78f23c,$88000000
- dc.l $0000f22e,$9000ff5c,$f22e4804,$ff84f201
- dc.l $a800f23c,$90000000,$000083ae,$ff64f200
- dc.l $0080f23c,$58b80001,$f293ff6a,$6000fe48
- dc.l $0c010004,$6700fdb4,$0c010001,$67160c01
- dc.l $00026736,$0c010005,$67ff0000,$023660ff
- dc.l $00000244,$4a280000,$6b10f23c,$44000000
- dc.l $00001d7c,$0004ff64,$4e75f23c,$44008000
- dc.l $00001d7c,$000cff64,$4e754a28,$00006bff
- dc.l $0000026c,$f228d080,$00001d7c,$0002ff64
- dc.l $4e752d68,$0004ff88,$2d690004,$ff942d68
- dc.l $0008ff8c,$2d690008,$ff983028,$00003229
- dc.l $00003d40,$ff843d41,$ff900240,$7fff0241
- dc.l $7fff3d40,$ff543d41,$ff56b041,$6cff0000
- dc.l $005c61ff,$0000015a,$2f000c2e,$0004ff4e
- dc.l $661041ee,$ff8461ff,$00002940,$44403d40
- dc.l $ff54302e,$ff560440,$0042b06e,$ff546c1a
- dc.l $302eff54,$d06f0002,$322eff84,$02418000
- dc.l $80413d40,$ff84201f,$4e75026e,$8000ff84
- dc.l $08ee0000,$ff85201f,$4e7561ff,$00000056
- dc.l $2f000c2e,$0004ff4f,$661041ee,$ff9061ff
- dc.l $000028e8,$44403d40,$ff56302e,$ff540440
- dc.l $0042b06e,$ff566c1a,$302eff56,$d06f0002
- dc.l $322eff90,$02418000,$80413d40,$ff90201f
- dc.l $4e75026e,$8000ff90,$08ee0000,$ff91201f
- dc.l $4e75322e,$ff843001,$02810000,$7fff0240
- dc.l $80000040,$3fff3d40,$ff840c2e,$0004ff4e
- dc.l $670a203c,$00003fff,$90814e75,$41eeff84
- dc.l $61ff0000,$28764480,$220060e6,$0c2e0004
- dc.l $ff4e673a,$322eff84,$02810000,$7fff026e
- dc.l $8000ff84,$08010000,$6712006e,$3fffff84
- dc.l $203c0000,$3fff9081,$e2804e75,$006e3ffe
- dc.l $ff84203c,$00003ffe,$9081e280,$4e7541ee
- dc.l $ff8461ff,$00002824,$08000000,$6710006e
- dc.l $3fffff84,$06800000,$3fffe280,$4e75006e
- dc.l $3ffeff84,$06800000,$3ffee280,$4e75322e
- dc.l $ff903001,$02810000,$7fff0240,$80000040
- dc.l $3fff3d40,$ff900c2e,$0004ff4f,$670a203c
- dc.l $00003fff,$90814e75,$41eeff90,$61ff0000
- dc.l $27ca4480,$220060e6,$0c2e0005,$ff4f6732
- dc.l $0c2e0003,$ff4f673e,$0c2e0003,$ff4e6714
- dc.l $08ee0006,$ff7000ae,$01004080,$ff6441ee
- dc.l $ff6c6042,$00ae0100,$0000ff64,$41eeff6c
- dc.l $603400ae,$01004080,$ff6408ee,$0006ff7c
- dc.l $41eeff78,$602041ee,$ff780c2e,$0005ff4e
- dc.l $66ff0000,$000c00ae,$00004080,$ff6400ae
- dc.l $01000000,$ff640828,$00070000,$670800ae
- dc.l $08000000,$ff64f210,$d0804e75,$00ae0100
- dc.l $2080ff64,$f23bd080,$01700000,$00084e75
- dc.l $7fff0000,$ffffffff,$ffffffff,$2d40ff54
- dc.l $302eff42,$4281122e,$ff64e099,$f2018800
- dc.l $323b0206,$4efb1002,$02340040,$02f8030c
- dc.l $03200334,$0348035c,$03660352,$033e032a
- dc.l $03160302,$004a0238,$023a0276,$0054009e
- dc.l $0102014c,$01b201fc,$021801d8,$018c0128
- dc.l $00de007a,$02b6025a,$f2810006,$6000032a
- dc.l $4e75f28e,$00066000,$03204e75,$f2920022
- dc.l $082e0000,$ff646700,$031000ae,$00008080
- dc.l $ff64082e,$0007ff62,$6600032c,$600002fa
- dc.l $4e75f29d,$00066000,$02f0082e,$0000ff64
- dc.l $671200ae,$00008080,$ff64082e,$0007ff62
- dc.l $66000304,$4e75f293,$0022082e,$0000ff64
- dc.l $670002c6,$00ae0000,$8080ff64,$082e0007
- dc.l $ff626600,$02e26000,$02b0082e,$0000ff64
- dc.l $671200ae,$00008080,$ff64082e,$0007ff62
- dc.l $660002c4,$4e75f29c,$00066000,$028c082e
- dc.l $0000ff64,$671200ae,$00008080,$ff64082e
- dc.l $0007ff62,$660002a0,$4e75f294,$0022082e
- dc.l $0000ff64,$67000262,$00ae0000,$8080ff64
- dc.l $082e0007,$ff626600,$027e6000,$024c4e75
- dc.l $f29b0006,$60000242,$082e0000,$ff646712
- dc.l $00ae0000,$8080ff64,$082e0007,$ff626600
- dc.l $02564e75,$f2950022,$082e0000,$ff646700
- dc.l $021800ae,$00008080,$ff64082e,$0007ff62
- dc.l $66000234,$60000202,$082e0000,$ff646712
- dc.l $00ae0000,$8080ff64,$082e0007,$ff626600
- dc.l $02164e75,$f29a0006,$600001de,$082e0000
- dc.l $ff646700,$001400ae,$00008080,$ff64082e
- dc.l $0007ff62,$660001f0,$4e75f296,$0022082e
- dc.l $0000ff64,$670001b2,$00ae0000,$8080ff64
- dc.l $082e0007,$ff626600,$01ce6000,$019c4e75
- dc.l $f2990006,$60000192,$082e0000,$ff646712
- dc.l $00ae0000,$8080ff64,$082e0007,$ff626600
- dc.l $01a64e75,$f2970018,$00ae0000,$8080ff64
- dc.l $082e0007,$ff626600,$018e6000,$015c4e75
- dc.l $f2980006,$60000152,$00ae0000,$8080ff64
- dc.l $082e0007,$ff626600,$016e4e75,$6000013a
- dc.l $4e75082e,$0000ff64,$6700012e,$00ae0000
- dc.l $8080ff64,$082e0007,$ff626600,$014a6000
- dc.l $0118082e,$0000ff64,$671200ae,$00008080
- dc.l $ff64082e,$0007ff62,$6600012c,$4e75f291
- dc.l $0022082e,$0000ff64,$670000ee,$00ae0000
- dc.l $8080ff64,$082e0007,$ff626600,$010a6000
- dc.l $00d8082e,$0000ff64,$671200ae,$00008080
- dc.l $ff64082e,$0007ff62,$660000ec,$4e75f29e
- dc.l $0022082e,$0000ff64,$670000ae,$00ae0000
- dc.l $8080ff64,$082e0007,$ff626600,$00ca6000
- dc.l $0098082e,$0000ff64,$67000014,$00ae0000
- dc.l $8080ff64,$082e0007,$ff626600,$00aa4e75
- dc.l $f2820006,$60000072,$4e75f28d,$00066000
- dc.l $00684e75,$f2830006,$6000005e,$4e75f28c
- dc.l $00066000,$00544e75,$f2840006,$6000004a
- dc.l $4e75f28b,$00066000,$00404e75,$f2850006
- dc.l $60000036,$4e75f28a,$00066000,$002c4e75
- dc.l $f2860006,$60000022,$4e75f289,$00066000
- dc.l $00184e75,$f2870006,$6000000e,$4e75f288
- dc.l $00066000,$00044e75,$122eff41,$02410007
- dc.l $61ff0000,$1d665340,$61ff0000,$1dd00c40
- dc.l $ffff6602,$4e75202e,$ff54d0ae,$ff685880
- dc.l $2d400006,$4e751d7c,$0002ff4a,$4e75302e
- dc.l $ff424281,$122eff64,$e099f201,$8800323b
- dc.l $02064efb,$1002021e,$004002e4,$02f002fc
- dc.l $03080314,$03200326,$031a030e,$030202f6
- dc.l $02ea0046,$02200224,$0260004c,$009200f8
- dc.l $013e01a4,$01ea0202,$01c4017e,$011800d2
- dc.l $006c02a2,$0240f281,$02ea4e75,$f28e02e4
- dc.l $4e75f292,$02de082e,$0000ff64,$671200ae
- dc.l $00008080,$ff64082e,$0007ff62,$660002cc
- dc.l $4e75f29d,$00044e75,$082e0000,$ff646700
- dc.l $02b200ae,$00008080,$ff64082e,$0007ff62
- dc.l $660002a8,$6000029c,$f293001e,$082e0000
- dc.l $ff646712,$00ae0000,$8080ff64,$082e0007
- dc.l $ff626600,$02864e75,$082e0000,$ff646700
- dc.l $027200ae,$00008080,$ff64082e,$0007ff62
- dc.l $66000268,$6000025c,$f29c0004,$4e75082e
- dc.l $0000ff64,$6700024c,$00ae0000,$8080ff64
- dc.l $082e0007,$ff626600,$02426000,$0236f294
- dc.l $0232082e,$0000ff64,$671200ae,$00008080
- dc.l $ff64082e,$0007ff62,$66000220,$4e75f29b
- dc.l $00044e75,$082e0000,$ff646700,$020600ae
- dc.l $00008080,$ff64082e,$0007ff62,$660001fc
- dc.l $600001f0,$f295001e,$082e0000,$ff646712
- dc.l $00ae0000,$8080ff64,$082e0007,$ff626600
- dc.l $01da4e75,$082e0000,$ff646700,$01c600ae
- dc.l $00008080,$ff64082e,$0007ff62,$660001bc
- dc.l $600001b0,$f29a0004,$4e75082e,$0000ff64
- dc.l $670001a0,$00ae0000,$8080ff64,$082e0007
- dc.l $ff626600,$01966000,$018af296,$0186082e
- dc.l $0000ff64,$671200ae,$00008080,$ff64082e
- dc.l $0007ff62,$66000174,$4e75f299,$00044e75
- dc.l $082e0000,$ff646700,$015a00ae,$00008080
- dc.l $ff64082e,$0007ff62,$66000150,$60000144
- dc.l $f2970140,$00ae0000,$8080ff64,$082e0007
- dc.l $ff626600,$01364e75,$f2980004,$4e7500ae
- dc.l $00008080,$ff64082e,$0007ff62,$6600011c
- dc.l $60000110,$4e756000,$010a082e,$0000ff64
- dc.l $671200ae,$00008080,$ff64082e,$0007ff62
- dc.l $660000f8,$4e75082e,$0000ff64,$670000e4
- dc.l $00ae0000,$8080ff64,$082e0007,$ff626600
- dc.l $00da6000,$00cef291,$0020082e,$0000ff64
- dc.l $67000014,$00ae0000,$8080ff64,$082e0007
- dc.l $ff626600,$00b64e75,$082e0000,$ff646700
- dc.l $00a200ae,$00008080,$ff64082e,$0007ff62
- dc.l $66000098,$6000008c,$f29e0020,$082e0000
- dc.l $ff646700,$001400ae,$00008080,$ff64082e
- dc.l $0007ff62,$66000074,$4e75082e,$0000ff64
- dc.l $67000060,$00ae0000,$8080ff64,$082e0007
- dc.l $ff626600,$00566000,$004af282,$00464e75
- dc.l $f28d0040,$4e75f283,$003a4e75,$f28c0034
- dc.l $4e75f284,$002e4e75,$f28b0028,$4e75f285
- dc.l $00224e75,$f28a001c,$4e75f286,$00164e75
- dc.l $f2890010,$4e75f287,$000a4e75,$f2880004
- dc.l $4e751d7c,$0001ff4a,$4e751d7c,$0002ff4a
- dc.l $4e75302e,$ff424281,$122eff64,$e099f201
- dc.l $8800323b,$02064efb,$10020208,$004002ac
- dc.l $02cc02ec,$030c032c,$034c035c,$033c031c
- dc.l $02fc02dc,$02bc0050,$020e0214,$02440060
- dc.l $00a400fa,$013e0194,$01d801f0,$01b60172
- dc.l $011c00d8,$00820278,$022cf281,$00084200
- dc.l $6000032e,$50c06000,$0328f28e,$00084200
- dc.l $6000031e,$50c06000,$0318f292,$001a4200
- dc.l $082e0000,$ff646700,$030800ae,$00008080
- dc.l $ff646000,$02f250c0,$600002f6,$f29d0008
- dc.l $42006000,$02ec50c0,$082e0000,$ff646700
- dc.l $02e000ae,$00008080,$ff646000,$02caf293
- dc.l $001a4200,$082e0000,$ff646700,$02c400ae
- dc.l $00008080,$ff646000,$02ae50c0,$082e0000
- dc.l $ff646700,$02ac00ae,$00008080,$ff646000
- dc.l $0296f29c,$00084200,$60000296,$50c0082e
- dc.l $0000ff64,$6700028a,$00ae0000,$8080ff64
- dc.l $60000274,$f294001a,$4200082e,$0000ff64
- dc.l $6700026e,$00ae0000,$8080ff64,$60000258
- dc.l $50c06000,$025cf29b,$00084200,$60000252
- dc.l $50c0082e,$0000ff64,$67000246,$00ae0000
- dc.l $8080ff64,$60000230,$f295001a,$4200082e
- dc.l $0000ff64,$6700022a,$00ae0000,$8080ff64
- dc.l $60000214,$50c0082e,$0000ff64,$67000212
- dc.l $00ae0000,$8080ff64,$600001fc,$f29a0008
- dc.l $42006000,$01fc50c0,$082e0000,$ff646700
- dc.l $01f000ae,$00008080,$ff646000,$01daf296
- dc.l $001a4200,$082e0000,$ff646700,$01d400ae
- dc.l $00008080,$ff646000,$01be50c0,$600001c2
- dc.l $f2990008,$42006000,$01b850c0,$082e0000
- dc.l $ff646700,$01ac00ae,$00008080,$ff646000
- dc.l $0196f297,$00104200,$00ae0000,$8080ff64
- dc.l $60000184,$50c06000,$0188f298,$00084200
- dc.l $6000017e,$50c000ae,$00008080,$ff646000
- dc.l $01664200,$6000016a,$50c06000,$01644200
- dc.l $082e0000,$ff646700,$015800ae,$00008080
- dc.l $ff646000,$014250c0,$082e0000,$ff646700
- dc.l $014000ae,$00008080,$ff646000,$012af291
- dc.l $001a4200,$082e0000,$ff646700,$012400ae
- dc.l $00008080,$ff646000,$010e50c0,$082e0000
- dc.l $ff646700,$010c00ae,$00008080,$ff646000
- dc.l $00f6f29e,$001a4200,$082e0000,$ff646700
- dc.l $00f000ae,$00008080,$ff646000,$00da50c0
- dc.l $082e0000,$ff646700,$00d800ae,$00008080
- dc.l $ff646000,$00c2f282,$00084200,$600000c2
- dc.l $50c06000,$00bcf28d,$00084200,$600000b2
- dc.l $50c06000,$00acf283,$00084200,$600000a2
- dc.l $50c06000,$009cf28c,$00084200,$60000092
- dc.l $50c06000,$008cf284,$00084200,$60000082
- dc.l $50c06000,$007cf28b,$00084200,$60000072
- dc.l $50c06000,$006cf285,$00084200,$60000062
- dc.l $50c06000,$005cf28a,$00084200,$60000052
- dc.l $50c06000,$004cf286,$00084200,$60000042
- dc.l $50c06000,$003cf289,$00084200,$60000032
- dc.l $50c06000,$002cf287,$00084200,$60000022
- dc.l $50c06000,$001cf288,$00084200,$60000012
- dc.l $50c06000,$000c082e,$0007ff62,$66000088
- dc.l $2040122e,$ff412001,$02010038,$66102200
- dc.l $02410007,$200861ff,$0000172a,$4e750c01
- dc.l $0018671a,$0c010020,$67382008,$206e000c
- dc.l $61ffffff,$5a7c4a81,$66000054,$4e752008
- dc.l $206e000c,$61ffffff,$5a684a81,$66000040
- dc.l $122eff41,$02410007,$700161ff,$00001722
- dc.l $4e752008,$206e000c,$61ffffff,$5a444a81
- dc.l $6600001c,$122eff41,$02410007,$700161ff
- dc.l $0000174e,$4e751d7c,$0002ff4a,$4e753d7c
- dc.l $00a1000a,$60ff0000,$2b86122e,$ff430241
- dc.l $0070e809,$61ff0000,$15b20280,$000000ff
- dc.l $2f00103b,$09200148,$2f0061ff,$00000340
- dc.l $201f221f,$67000134,$082e0005,$ff426700
- dc.l $00b8082e,$0004ff42,$6600001a,$123b1120
- dc.l $021e082e,$00050004,$670a0c2e,$0008ff4a
- dc.l $66024e75,$22489fc0,$41d74a01,$6a0c20ee
- dc.l $ffdc20ee,$ffe020ee,$ffe4e309,$6a0c20ee
- dc.l $ffe820ee,$ffec20ee,$fff0e309,$6a0af210
- dc.l $f020d1fc,$0000000c,$e3096a0a,$f210f010
- dc.l $d1fc0000,$000ce309,$6a0af210,$f008d1fc
- dc.l $0000000c,$e3096a0a,$f210f004,$d1fc0000
- dc.l $000ce309,$6a0af210,$f002d1fc,$0000000c
- dc.l $e3096a0a,$f210f001,$d1fc0000,$000c2d49
- dc.l $ff5441d7,$2f0061ff,$ffff58b2,$201fdfc0
- dc.l $4a816600,$071e4e75,$2d48ff54,$9fc043d7
- dc.l $2f012f00,$61ffffff,$587e201f,$4a816600
- dc.l $070e221f,$41d74a01,$6a0c2d58,$ffdc2d58
- dc.l $ffe02d58,$ffe4e309,$6a0c2d58,$ffe82d58
- dc.l $ffec2d58,$fff0e309,$6a04f218,$d020e309
- dc.l $6a04f218,$d010e309,$6a04f218,$d008e309
- dc.l $6a04f218,$d004e309,$6a04f218,$d002e309
- dc.l $6a04f218,$d001dfc0,$4e754e75,$000c0c18
- dc.l $0c181824,$0c181824,$18242430,$0c181824
- dc.l $18242430,$18242430,$2430303c,$0c181824
- dc.l $18242430,$18242430,$2430303c,$18242430
- dc.l $2430303c,$2430303c,$303c3c48,$0c181824
- dc.l $18242430,$18242430,$2430303c,$18242430
- dc.l $2430303c,$2430303c,$303c3c48,$18242430
- dc.l $2430303c,$2430303c,$303c3c48,$2430303c
- dc.l $303c3c48,$303c3c48,$3c484854,$0c181824
- dc.l $18242430,$18242430,$2430303c,$18242430
- dc.l $2430303c,$2430303c,$303c3c48,$18242430
- dc.l $2430303c,$2430303c,$303c3c48,$2430303c
- dc.l $303c3c48,$303c3c48,$3c484854,$18242430
- dc.l $2430303c,$2430303c,$303c3c48,$2430303c
- dc.l $303c3c48,$303c3c48,$3c484854,$2430303c
- dc.l $303c3c48,$303c3c48,$3c484854,$303c3c48
- dc.l $3c484854,$3c484854,$48545460,$008040c0
- dc.l $20a060e0,$109050d0,$30b070f0,$088848c8
- dc.l $28a868e8,$189858d8,$38b878f8,$048444c4
- dc.l $24a464e4,$149454d4,$34b474f4,$0c8c4ccc
- dc.l $2cac6cec,$1c9c5cdc,$3cbc7cfc,$028242c2
- dc.l $22a262e2,$129252d2,$32b272f2,$0a8a4aca
- dc.l $2aaa6aea,$1a9a5ada,$3aba7afa,$068646c6
- dc.l $26a666e6,$169656d6,$36b676f6,$0e8e4ece
- dc.l $2eae6eee,$1e9e5ede,$3ebe7efe,$018141c1
- dc.l $21a161e1,$119151d1,$31b171f1,$098949c9
- dc.l $29a969e9,$199959d9,$39b979f9,$058545c5
- dc.l $25a565e5,$159555d5,$35b575f5,$0d8d4dcd
- dc.l $2dad6ded,$1d9d5ddd,$3dbd7dfd,$038343c3
- dc.l $23a363e3,$139353d3,$33b373f3,$0b8b4bcb
- dc.l $2bab6beb,$1b9b5bdb,$3bbb7bfb,$078747c7
- dc.l $27a767e7,$179757d7,$37b777f7,$0f8f4fcf
- dc.l $2faf6fef,$1f9f5fdf,$3fbf7fff,$2040302e
- dc.l $ff403200,$0240003f,$02810000,$0007303b
- dc.l $020a4efb,$00064afc,$00400000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000080,$0086008c
- dc.l $00900094,$0098009c,$00a000a6,$00b600c6
- dc.l $00d200de,$00ea00f6,$01020118,$01260134
- dc.l $013e0148,$0152015c,$0166017a,$019801b6
- dc.l $01d201ee,$020a0226,$02420260,$02600260
- dc.l $02600260,$02600260,$026002c0,$02da02f4
- dc.l $03140000,$00000000,$0000206e,$ffa44e75
- dc.l $206effa8,$4e75204a,$4e75204b,$4e75204c
- dc.l $4e75204d,$4e752056,$4e75206e,$ffd84e75
- dc.l $202effa4,$2200d288,$2d41ffa4,$20404e75
- dc.l $202effa8,$2200d288,$2d41ffa8,$20404e75
- dc.l $200a2200,$d2882441,$20404e75,$200b2200
- dc.l $d2882641,$20404e75,$200c2200,$d2882841
- dc.l $20404e75,$200d2200,$d2882a41,$20404e75
- dc.l $20162200,$d2882c81,$20404e75,$1d7c0004
- dc.l $ff4a202e,$ffd82200,$d2882d41,$ffd82040
- dc.l $4e75202e,$ffa49088,$2d40ffa4,$20404e75
- dc.l $202effa8,$90882d40,$ffa82040,$4e75200a
- dc.l $90882440,$20404e75,$200b9088,$26402040
- dc.l $4e75200c,$90882840,$20404e75,$200d9088
- dc.l $2a402040,$4e752016,$90882c80,$20404e75
- dc.l $1d7c0008,$ff4a202e,$ffd89088,$2d40ffd8
- dc.l $20404e75,$206eff44,$54aeff44,$61ffffff
- dc.l $54a24a81,$66ffffff,$68203040,$d1eeffa4
- dc.l $4e75206e,$ff4454ae,$ff4461ff,$ffff5484
- dc.l $4a8166ff,$ffff6802,$3040d1ee,$ffa84e75
- dc.l $206eff44,$54aeff44,$61ffffff,$54664a81
- dc.l $66ffffff,$67e43040,$d1ca4e75,$206eff44
- dc.l $54aeff44,$61ffffff,$544a4a81,$66ffffff
- dc.l $67c83040,$d1cb4e75,$206eff44,$54aeff44
- dc.l $61ffffff,$542e4a81,$66ffffff,$67ac3040
- dc.l $d1cc4e75,$206eff44,$54aeff44,$61ffffff
- dc.l $54124a81,$66ffffff,$67903040,$d1cd4e75
- dc.l $206eff44,$54aeff44,$61ffffff,$53f64a81
- dc.l $66ffffff,$67743040,$d1d64e75,$206eff44
- dc.l $54aeff44,$61ffffff,$53da4a81,$66ffffff
- dc.l $67583040,$d1eeffd8,$4e755081,$61ff0000
- dc.l $0fda2f00,$206eff44,$54aeff44,$61ffffff
- dc.l $53b24a81,$66ffffff,$6730205f,$08000008
- dc.l $660000e6,$2d40ff54,$2200e959,$0241000f
- dc.l $61ff0000,$0fa62f02,$242eff54,$0802000b
- dc.l $660248c0,$2202ef59,$02810000,$0003e3a8
- dc.l $49c2d082,$d1c0241f,$4e75206e,$ff4454ae
- dc.l $ff4461ff,$ffff535c,$4a8166ff,$ffff66da
- dc.l $30404e75,$206eff44,$58aeff44,$61ffffff
- dc.l $53584a81,$66ffffff,$66c02040,$4e75206e
- dc.l $ff4454ae,$ff4461ff,$ffff5328,$4a8166ff
- dc.l $ffff66a6,$3040d1ee,$ff445588,$4e75206e
- dc.l $ff4454ae,$ff4461ff,$ffff5308,$4a8166ff
- dc.l $ffff6686,$206eff44,$55880800,$00086600
- dc.l $00382d40,$ff542200,$e9590241,$000f61ff
- dc.l $00000ef8,$2f02242e,$ff540802,$000b6602
- dc.l $48c02202,$ef590281,$00000003,$e3a849c2
- dc.l $d082d1c0,$241f4e75,$08000006,$670c48e7
- dc.l $3c002a00,$26084282,$60282d40,$ff54e9c0
- dc.l $140461ff,$00000eb4,$48e73c00,$24002a2e
- dc.l $ff542608,$0805000b,$660248c2,$e9c50542
- dc.l $e1aa0805,$00076702,$4283e9c5,$06820c00
- dc.l $00026d34,$6718206e,$ff4458ae,$ff4461ff
- dc.l $ffff5276,$4a8166ff,$000000b0,$6018206e
- dc.l $ff4454ae,$ff4461ff,$ffff5248,$4a8166ff
- dc.l $00000098,$48c0d680,$e9c50782,$6700006e
- dc.l $0c000002,$6d346718,$206eff44,$58aeff44
- dc.l $61ffffff,$52344a81,$66ff0000,$006e601c
- dc.l $206eff44,$54aeff44,$61ffffff,$52064a81
- dc.l $66ff0000,$005648c0,$60024280,$28000805
- dc.l $00026714,$204361ff,$ffff5240,$4a816600
- dc.l $0028d082,$d0846018,$d6822043,$61ffffff
- dc.l $522a4a81,$66000012,$d0846004,$d6822003
- dc.l $20404cdf,$003c4e75,$20434cdf,$003c303c
- dc.l $010160ff,$ffff6582,$4cdf003c,$60ffffff
- dc.l $652861ff,$000023c6,$303c00e1,$600a61ff
- dc.l $000023ba,$303c0161,$206eff54,$60ffffff
- dc.l $6558102e,$ff420c00,$009c6700,$00b20c00
- dc.l $00986700,$00740c00,$00946736,$206eff44
- dc.l $58aeff44,$61ffffff,$51704a81,$66ffffff
- dc.l $64d82d40,$ff64206e,$ff4458ae,$ff4461ff
- dc.l $ffff5156,$4a8166ff,$ffff64be,$2d40ff68
- dc.l $4e75206e,$ff4458ae,$ff4461ff,$ffff513a
- dc.l $4a8166ff,$ffff64a2,$2d40ff60,$206eff44
- dc.l $58aeff44,$61ffffff,$51204a81,$66ffffff
- dc.l $64882d40,$ff684e75,$206eff44,$58aeff44
- dc.l $61ffffff,$51044a81,$66ffffff,$646c2d40
- dc.l $ff60206e,$ff4458ae,$ff4461ff,$ffff50ea
- dc.l $4a8166ff,$ffff6452,$2d40ff64,$4e75206e
- dc.l $ff4458ae,$ff4461ff,$ffff50ce,$4a8166ff
- dc.l $ffff6436,$2d40ff60,$206eff44,$58aeff44
- dc.l $61ffffff,$50b44a81,$66ffffff,$641c2d40
- dc.l $ff64206e,$ff4458ae,$ff4461ff,$ffff509a
- dc.l $4a8166ff,$ffff6402,$2d40ff68,$4e752040
- dc.l $102eff41,$22000240,$00380281,$00000007
- dc.l $0c000018,$67240c00,$0020672c,$80410c00
- dc.l $003c6706,$206e000c,$4e751d7c,$0080ff4a
- dc.l $41f60162,$ff680004,$4e752008,$61ff0000
- dc.l $0d70206e,$000c4e75,$200861ff,$00000db2
- dc.l $206e000c,$0c00000c,$67024e75,$51882d48
- dc.l $000c4e75,$102eff41,$22000240,$00380281
- dc.l $00000007,$0c000018,$670e0c00,$00206700
- dc.l $0076206e,$000c4e75,$323b120e,$206e000c
- dc.l $4efb1006,$4afc0008,$0010001a,$0024002c
- dc.l $0034003c,$0044004e,$06ae0000,$000cffa4
- dc.l $4e7506ae,$0000000c,$ffa84e75,$d5fc0000
- dc.l $000c4e75,$d7fc0000,$000c4e75,$d9fc0000
- dc.l $000c4e75,$dbfc0000,$000c4e75,$06ae0000
- dc.l $000cffd4,$4e751d7c,$0004ff4a,$06ae0000
- dc.l $000cffd8,$4e75323b,$1214206e,$000c5188
- dc.l $51ae000c,$4efb1006,$4afc0008,$00100016
- dc.l $001c0020,$00240028,$002c0032,$2d48ffa4
- dc.l $4e752d48,$ffa84e75,$24484e75,$26484e75
- dc.l $28484e75,$2a484e75,$2d48ffd4,$4e752d48
- dc.l $ffd81d7c,$0008ff4a,$4e75082e,$0006ff42
- dc.l $6664102e,$ff430800,$0005672c,$08000004
- dc.l $670a0240,$007f0c40,$0038661c,$e9ee0183
- dc.l $ff4261ff,$00000d6a,$61ff0000,$12060c00
- dc.l $00066722,$1d40ff4f,$e9ee00c3,$ff4261ff
- dc.l $00000cbe,$61ff0000,$11ea0c00,$0006670e
- dc.l $1d40ff4e,$4e7561ff,$00001148,$60d661ff
- dc.l $00001140,$60ea302e,$ff420800,$0005672c
- dc.l $08000004,$670a0240,$007f0c40,$0038661c
- dc.l $e9ee0183,$ff4261ff,$00000d06,$61ff0000
- dc.l $11a20c00,$00066726,$1d40ff4f,$e9ee00c3
- dc.l $ff42e9ee,$1283ff40,$660000be,$422eff4e
- dc.l $e9ee1343,$ff40303b,$02124efb,$000e61ff
- dc.l $000010e0,$60d24afc,$00080010,$006a0000
- dc.l $0000002e,$0000004c,$000061ff,$00000a5c
- dc.l $f2004000,$f22ef080,$ff6cf281,$00044e75
- dc.l $1d7c0001,$ff4e4e75,$61ff0000,$0a3ef200
- dc.l $5000f22e,$f080ff6c,$f2810004,$4e751d7c
- dc.l $0001ff4e,$4e7561ff,$00000a20,$f2005800
- dc.l $f22ef080,$ff6cf281,$00044e75,$1d7c0001
- dc.l $ff4e4e75,$61ff0000,$0a022d40,$ff5441ee
- dc.l $ff5461ff,$000011de,$1d40ff4e,$0c000005
- dc.l $670001a4,$0c000004,$6700015e,$f2104400
- dc.l $f22ef080,$ff6c4e75,$422eff4e,$303b020a
- dc.l $4efb0006,$4afc0008,$001000e2,$027202b0
- dc.l $005601a0,$009c0000,$700461ff,$fffffd22
- dc.l $0c2e0080,$ff4a6726,$61ffffff,$4dde4a81
- dc.l $66ff0000,$1eecf200,$4000f22e,$f080ff6c
- dc.l $f2810004,$4e751d7c,$0001ff4e,$4e7561ff
- dc.l $ffff4d76,$4a8166ff,$ffff6e8a,$60d87002
- dc.l $61ffffff,$fcdc0c2e,$0080ff4a,$672661ff
- dc.l $ffff4d82,$4a8166ff,$00001e98,$f2005000
- dc.l $f22ef080,$ff6cf281,$00044e75,$1d7c0001
- dc.l $ff4e4e75,$61ffffff,$4d1a4a81,$66ffffff
- dc.l $6e4460d8,$700161ff,$fffffc96,$0c2e0080
- dc.l $ff4a6726,$61ffffff,$4d264a81,$66ff0000
- dc.l $1e42f200,$5800f22e,$f080ff6c,$f2810004
- dc.l $4e751d7c,$0001ff4e,$4e7561ff,$ffff4cd4
- dc.l $4a8166ff,$ffff6dfe,$60d87004,$61ffffff
- dc.l $fc500c2e,$0080ff4a,$673e61ff,$ffff4d0c
- dc.l $2d40ff54,$4a8166ff,$00001e16,$41eeff54
- dc.l $61ff0000,$10a01d40,$ff4e0c00,$00046700
- dc.l $00280c00,$00056700,$005ef22e,$4400ff54
- dc.l $f22ef080,$ff6c4e75,$61ffffff,$4c8c4a81
- dc.l $66ffffff,$6da060c4,$426eff6c,$e9d00257
- dc.l $e1882d40,$ff7042ae,$ff74426e,$ff6c0810
- dc.l $00076706,$08ee0007,$ff6c41ee,$ff6c61ff
- dc.l $00000e78,$323c3f81,$9240836e,$ff6c1d7c
- dc.l $0000ff4e,$4e753d7c,$7fffff6c,$e9d00257
- dc.l $e1882d40,$ff7042ae,$ff740810,$00076706
- dc.l $08ee0007,$ff6c4e75,$700861ff,$fffffb92
- dc.l $0c2e0080,$ff4a6740,$43eeff54,$700861ff
- dc.l $ffff4bc4,$4a8166ff,$00001d64,$41eeff54
- dc.l $61ff0000,$0f701d40,$ff4e0c00,$00046700
- dc.l $002e0c00,$00056700,$0068f22e,$5400ff54
- dc.l $f22ef080,$ff6c4e75,$43eeff54,$700861ff
- dc.l $ffff4b6e,$4a8166ff,$ffff6cda,$60be426e
- dc.l $ff6ce9d0,$031f2d40,$ff70e9e8,$02d50004
- dc.l $720be3a8,$2d40ff74,$08100007,$670608ee
- dc.l $0007ff6c,$41eeff6c,$61ff0000,$0dae323c
- dc.l $3c019240,$836eff6c,$1d7c0000,$ff4e4e75
- dc.l $3d7c7fff,$ff6ce9d0,$031f2d40,$ff70e9e8
- dc.l $02d50004,$720be3a8,$2d40ff74,$08100007
- dc.l $670608ee,$0007ff6c,$4e75700c,$61ffffff
- dc.l $fac043ee,$ff6c700c,$61ffffff,$4afa4a81
- dc.l $66ff0000,$1ca841ee,$ff6c61ff,$00000e24
- dc.l $0c000006,$67061d40,$ff4e4e75,$61ff0000
- dc.l $0d821d40,$ff4e4e75,$61ff0000,$125441ee
- dc.l $ff6c61ff,$00000dfc,$0c000006,$67061d40
- dc.l $ff4e4e75,$61ff0000,$0d5a1d40,$ff4e4e75
- dc.l $e9ee10c3,$ff42327b,$120a4efb,$98064afc
- dc.l $000800e0,$01e00148,$06200078,$041a0010
- dc.l $06204a2e,$ff4e664c,$f228d080,$0000f200
- dc.l $9000f200,$7800f23c,$90000000,$0000f201
- dc.l $a800836e,$ff66122e,$ff410201,$00386714
- dc.l $206e000c,$61ffffff,$4ae84a81,$66ff0000
- dc.l $1c0a4e75,$122eff41,$02410007,$61ff0000
- dc.l $07644e75,$22280000,$02818000,$00000081
- dc.l $00800000,$f2014400,$60a44a2e,$ff4e664c
- dc.l $f228d080,$0000f200,$9000f200,$7000f23c
- dc.l $90000000,$0000f201,$a800836e,$ff66122e
- dc.l $ff410201,$00386714,$206e000c,$61ffffff
- dc.l $4a964a81,$66ff0000,$1bb04e75,$122eff41
- dc.l $02410007,$61ff0000,$06c04e75,$22280000
- dc.l $02818000,$00000081,$00800000,$f2014400
- dc.l $60a44a2e,$ff4e664c,$f228d080,$0000f200
- dc.l $9000f200,$6000f23c,$90000000,$0000f201
- dc.l $a800836e,$ff66122e,$ff410201,$00386714
- dc.l $206e000c,$61ffffff,$4a444a81,$66ff0000
- dc.l $1b564e75,$122eff41,$02410007,$61ff0000
- dc.l $061c4e75,$22280000,$02818000,$00000081
- dc.l $00800000,$f2014400,$60a43d68,$0000ff84
- dc.l $426eff86,$2d680004,$ff882d68,$0008ff8c
- dc.l $f228d080,$000061ff,$fffff94c,$224841ee
- dc.l $ff84700c,$0c2e0008,$ff4a6726,$61ffffff
- dc.l $492c4a81,$66000052,$4a2eff4e,$66024e75
- dc.l $08ee0003,$ff66102e,$ff620200,$000a6616
- dc.l $4e7561ff,$ffff5788,$4a816600,$002c4a2e
- dc.l $ff4e66dc,$4e7541ee,$ff8461ff,$00000b3c
- dc.l $44400240,$7fff026e,$8000ff84,$816eff84
- dc.l $f22ed040,$ff844e75,$2caeffd4,$60ff0000
- dc.l $1ab20200,$00300000,$00402d40,$ff5c3028
- dc.l $00000240,$7fff0c40,$407e6e00,$00e66700
- dc.l $01520c40,$3f816d00,$0058f228,$d0800000
- dc.l $f22e9000,$ff5cf23c,$88000000,$0000f200
- dc.l $6400f23c,$90000000,$0000f201,$a800836e
- dc.l $ff66122e,$ff410201,$00386714,$206e000c
- dc.l $61ffffff,$49184a81,$66ff0000,$1a2a4e75
- dc.l $122eff41,$02410007,$61ff0000,$04f04e75
- dc.l $08ee0003,$ff663d68,$0000ff84,$2d680004
- dc.l $ff882d68,$0008ff8c,$2f084280,$0c2e0004
- dc.l $ff4e660a,$41eeff84,$61ff0000,$0a6e41ee
- dc.l $ff84222e,$ff5c61ff,$00000c86,$41eeff84
- dc.l $61ff0000,$034c122e,$ff410201,$00386714
- dc.l $206e000c,$61ffffff,$48a44a81,$66ff0000
- dc.l $19b6600e,$122eff41,$02410007,$61ff0000
- dc.l $047c122e,$ff620201,$000a6600,$00b8588f
- dc.l $4e754a28,$0007660e,$4aa80008,$6608006e
- dc.l $1048ff66,$6006006e,$1248ff66,$2f084a28
- dc.l $00005bc1,$202eff5c,$61ff0000,$0d12f210
- dc.l $d080f200,$6400122e,$ff410201,$00386714
- dc.l $206e000c,$61ffffff,$48344a81,$66ff0000
- dc.l $1946600e,$122eff41,$02410007,$61ff0000
- dc.l $040c122e,$ff620201,$000a6600,$007c588f
- dc.l $4e753228,$00000241,$80000041,$3fff3d41
- dc.l $ff842d68,$0004ff88,$2d680008,$ff8cf22e
- dc.l $9000ff5c,$f22e4800,$ff84f23c,$90000000
- dc.l $0000f200,$0018f23c,$58380002,$f294fe7c
- dc.l $6000ff50,$205f3d68,$0000ff84,$2d680004
- dc.l $ff882d68,$0008ff8c,$0c2e0004,$ff4e662c
- dc.l $41eeff84,$61ff0000,$09424480,$02407fff
- dc.l $efee004f,$ff846014,$205f3d68,$0000ff84
- dc.l $2d680004,$ff882d68,$0008ff8c,$08ae0007
- dc.l $ff8456ee,$ff8641ee,$ff84122e,$ff5fe809
- dc.l $0241000c,$4841122e,$ff5fe809,$02410003
- dc.l $428061ff,$00000782,$4a2eff86,$670608ee
- dc.l $0007ff84,$f22ed040,$ff844e75,$02000030
- dc.l $00000080,$2d40ff5c,$30280000,$02407fff
- dc.l $0c4043fe,$6e0000c8,$67000120,$0c403c01
- dc.l $6d000046,$f228d080,$0000f22e,$9000ff5c
- dc.l $f23c8800,$00000000,$f22e7400,$ff54f23c
- dc.l $90000000,$0000f200,$a800816e,$ff66226e
- dc.l $000c41ee,$ff547008,$61ffffff,$46304a81
- dc.l $66ff0000,$18004e75,$08ee0003,$ff663d68
- dc.l $0000ff84,$2d680004,$ff882d68,$0008ff8c
- dc.l $2f084280,$0c2e0004,$ff4e660a,$41eeff84
- dc.l $61ff0000,$084641ee,$ff84222e,$ff5c61ff
- dc.l $00000a5e,$41eeff84,$61ff0000,$00d22d40
- dc.l $ff542d41,$ff58226e,$000c41ee,$ff547008
- dc.l $61ffffff,$45c84a81,$66ff0000,$1798122e
- dc.l $ff620201,$000a6600,$fe9c588f,$4e753028
- dc.l $000a0240,$07ff6608,$006e1048,$ff666006
- dc.l $006e1248,$ff662f08,$4a280000,$5bc1202e
- dc.l $ff5c61ff,$00000af8,$f210d080,$f22e7400
- dc.l $ff54226e,$000c41ee,$ff547008,$61ffffff
- dc.l $456c4a81,$66ff0000,$173c122e,$ff620201
- dc.l $000a6600,$fe74588f,$4e753228,$00000241
- dc.l $80000041,$3fff3d41,$ff842d68,$0004ff88
- dc.l $2d680008,$ff8cf22e,$9000ff5c,$f22e4800
- dc.l $ff84f23c,$90000000,$0000f200,$0018f23c
- dc.l $58380002,$f294feae,$6000ff64,$42803028
- dc.l $00000440,$3fff0640,$03ff4a28,$00046b02
- dc.l $53404840,$e9884a28,$00006a04,$08c0001f
- dc.l $22280004,$e9c11054,$80812d40,$ff542228
- dc.l $00047015,$e1a92d41,$ff582228,$0008e9c1
- dc.l $0015222e,$ff588280,$202eff54,$4e754280
- dc.l $30280000,$04403fff,$0640007f,$4a280004
- dc.l $6b025340,$4840ef88,$4a280000,$6a0408c0
- dc.l $001f2228,$00040281,$7fffff00,$e0898081
- dc.l $4e7561ff,$fffff490,$2f08102e,$ff4e6600
- dc.l $0082082e,$0004ff42,$6712122e,$ff43e809
- dc.l $02410007,$61ff0000,$00926004,$102eff43
- dc.l $ebc00647,$2f0041ee,$ff6c61ff,$00000ed0
- dc.l $02aecfff,$f00fff84,$201f4a2e,$ff876616
- dc.l $4aaeff88,$66104aae,$ff8c660a,$4a806606
- dc.l $026ef000,$ff8441ee,$ff84225f,$700c0c2e
- dc.l $0008ff4a,$670e61ff,$ffff4412,$4a816600
- dc.l $fb384e75,$61ffffff,$52864a81,$6600fb2a
- dc.l $4e750c00,$00046700,$ff7a41ee,$ff6c426e
- dc.l $ff6e0c00,$00056702,$60c0006e,$4080ff66
- dc.l $08ee0006,$ff7060b2,$303b1206,$4efb0002
- dc.l $00200026,$002c0030,$00340038,$003c0040
- dc.l $0044004a,$00500054,$0058005c,$00600064
- dc.l $202eff9c,$4e75202e,$ffa04e75,$20024e75
- dc.l $20034e75,$20044e75,$20054e75,$20064e75
- dc.l $20074e75,$202effa4,$4e75202e,$ffa84e75
- dc.l $200a4e75,$200b4e75,$200c4e75,$200d4e75
- dc.l $20164e75,$202effd8,$4e75323b,$12064efb
- dc.l $10020010,$0016001c,$00200024,$0028002c
- dc.l $00302d40,$ff9c4e75,$2d40ffa0,$4e752400
- dc.l $4e752600,$4e752800,$4e752a00,$4e752c00
- dc.l $4e752e00,$4e75323b,$12064efb,$10020010
- dc.l $0016001c,$00200024,$0028002c,$00303d40
- dc.l $ff9e4e75,$3d40ffa2,$4e753400,$4e753600
- dc.l $4e753800,$4e753a00,$4e753c00,$4e753e00
- dc.l $4e75323b,$12064efb,$10020010,$0016001c
- dc.l $00200024,$0028002c,$00301d40,$ff9f4e75
- dc.l $1d40ffa3,$4e751400,$4e751600,$4e751800
- dc.l $4e751a00,$4e751c00,$4e751e00,$4e75323b
- dc.l $12064efb,$10020010,$0016001c,$00200024
- dc.l $0028002c,$0030d1ae,$ffa44e75,$d1aeffa8
- dc.l $4e75d5c0,$4e75d7c0,$4e75d9c0,$4e75dbc0
- dc.l $4e75d196,$4e751d7c,$0004ff4a,$0c000001
- dc.l $6706d1ae,$ffd84e75,$54aeffd8,$4e75323b
- dc.l $12064efb,$10020010,$0016001c,$00200024
- dc.l $0028002c,$003091ae,$ffa44e75,$91aeffa8
- dc.l $4e7595c0,$4e7597c0,$4e7599c0,$4e759bc0
- dc.l $4e759196,$4e751d7c,$0008ff4a,$0c000001
- dc.l $670691ae,$ffd84e75,$55aeffd8,$4e75303b
- dc.l $02064efb,$00020010,$00280040,$004c0058
- dc.l $00640070,$007c2d6e,$ffdcff6c,$2d6effe0
- dc.l $ff702d6e,$ffe4ff74,$41eeff6c,$4e752d6e
- dc.l $ffe8ff6c,$2d6effec,$ff702d6e,$fff0ff74
- dc.l $41eeff6c,$4e75f22e,$f020ff6c,$41eeff6c
- dc.l $4e75f22e,$f010ff6c,$41eeff6c,$4e75f22e
- dc.l $f008ff6c,$41eeff6c,$4e75f22e,$f004ff6c
- dc.l $41eeff6c,$4e75f22e,$f002ff6c,$41eeff6c
- dc.l $4e75f22e,$f001ff6c,$41eeff6c,$4e75303b
- dc.l $02064efb,$00020010,$00280040,$004c0058
- dc.l $00640070,$007c2d6e,$ffdcff78,$2d6effe0
- dc.l $ff7c2d6e,$ffe4ff80,$41eeff78,$4e752d6e
- dc.l $ffe8ff78,$2d6effec,$ff7c2d6e,$fff0ff80
- dc.l $41eeff78,$4e75f22e,$f020ff78,$41eeff78
- dc.l $4e75f22e,$f010ff78,$41eeff78,$4e75f22e
- dc.l $f008ff78,$41eeff78,$4e75f22e,$f004ff78
- dc.l $41eeff78,$4e75f22e,$f002ff78,$41eeff78
- dc.l $4e75f22e,$f001ff78,$41eeff78,$4e75303b
- dc.l $02064efb,$00020010,$00180020,$002a0034
- dc.l $003e0048,$0052f22e,$f080ffdc,$4e75f22e
- dc.l $f080ffe8,$4e75f227,$e001f21f,$d0204e75
- dc.l $f227e001,$f21fd010,$4e75f227,$e001f21f
- dc.l $d0084e75,$f227e001,$f21fd004,$4e75f227
- dc.l $e001f21f,$d0024e75,$f227e001,$f21fd001
- dc.l $4e750000,$3f813c01,$e408323b,$02f63001
- dc.l $90680000,$0c400042,$6a164280,$082e0001
- dc.l $ff666704,$08c0001d,$61ff0000,$001a4e75
- dc.l $203c2000,$00003141,$000042a8,$000442a8
- dc.l $00084e75,$2d680008,$ff542d40,$ff582001
- dc.l $92680000,$6f100c41,$00206d10,$0c410040
- dc.l $6d506000,$009a202e,$ff584e75,$2f023140
- dc.l $00007020,$90410c41,$001d6d08,$142eff58
- dc.l $852eff57,$e9e82020,$0004e9e8,$18000004
- dc.l $e9ee0800,$ff542142,$00042141,$0008e8c0
- dc.l $009e6704,$08c0001d,$0280e000,$0000241f
- dc.l $4e752f02,$31400000,$04410020,$70209041
- dc.l $142eff58,$852eff57,$e9e82020,$0004e9e8
- dc.l $18000004,$e8c1009e,$660ce8ee,$081fff54
- dc.l $66042001,$60062001,$08c0001d,$42a80004
- dc.l $21420008,$0280e000,$0000241f,$4e753140
- dc.l $00000c41,$00416d12,$672442a8,$000442a8
- dc.l $0008203c,$20000000,$4e752028,$00042200
- dc.l $0280c000,$00000281,$3fffffff,$60122028
- dc.l $00040280,$80000000,$e2880281,$7fffffff
- dc.l $66164aa8,$00086610,$4a2eff58,$660a42a8
- dc.l $000442a8,$00084e75,$08c0001d,$42a80004
- dc.l $42a80008,$4e7561ff,$00000110,$4a806700
- dc.l $00fa006e,$0208ff66,$327b1206,$4efb9802
- dc.l $004000ea,$00240008,$4a280002,$6b0000dc
- dc.l $70ff4841,$0c010004,$6700003e,$6e000094
- dc.l $60000064,$4a280002,$6a0000c0,$70ff4841
- dc.l $0c010004,$67000022,$6e000078,$60000048
- dc.l $e3806400,$00a64841,$0c010004,$6700000a
- dc.l $6e000060,$60000030,$06a80000,$01000004
- dc.l $640ce4e8,$0004e4e8,$00065268,$00004a80
- dc.l $66060268,$fe000006,$02a8ffff,$ff000004
- dc.l $42a80008,$4e7552a8,$0008641a,$52a80004
- dc.l $6414e4e8,$0004e4e8,$0006e4e8,$0008e4e8
- dc.l $000a5268,$00004a80,$66060228,$00fe000b
- dc.l $4e7506a8,$00000800,$0008641a,$52a80004
- dc.l $6414e4e8,$0004e4e8,$0006e4e8,$0008e4e8
- dc.l $000a5268,$00004a80,$66060268,$f000000a
- dc.l $02a8ffff,$f8000008,$4e754841,$0c010004
- dc.l $6700ff86,$6eea4e75,$48414a01,$66044841
- dc.l $4e7548e7,$30000c01,$00046622,$e9e83602
- dc.l $0004741e,$e5ab2428,$00040282,$0000003f
- dc.l $66284aa8,$00086622,$4a80661e,$6020e9e8
- dc.l $35420008,$741ee5ab,$24280008,$02820000
- dc.l $01ff6606,$4a806602,$600408c3,$001d2003
- dc.l $4cdf000c,$48414e75,$2f022f03,$20280004
- dc.l $22280008,$edc02000,$671ae5a8,$e9c13022
- dc.l $8083e5a9,$21400004,$21410008,$2002261f
- dc.l $241f4e75,$edc12000,$e5a90682,$00000020
- dc.l $21410004,$42a80008,$2002261f,$241f4e75
- dc.l $ede80000,$0004660e,$ede80000,$00086700
- dc.l $00740640,$00204281,$32280000,$02417fff
- dc.l $b0416e1c,$92403028,$00000240,$80008240
- dc.l $31410000,$61ffffff,$ff82103c,$00004e75
- dc.l $0c010020,$6e20e9e8,$08400004,$21400004
- dc.l $20280008,$e3a82140,$00080268,$80000000
- dc.l $103c0004,$4e750441,$00202028,$0008e3a8
- dc.l $21400004,$42a80008,$02688000,$0000103c
- dc.l $00044e75,$02688000,$0000103c,$00014e75
- dc.l $30280000,$02407fff,$0c407fff,$67480828
- dc.l $00070004,$6706103c,$00004e75,$4a406618
- dc.l $4aa80004,$660c4aa8,$00086606,$103c0001
- dc.l $4e75103c,$00044e75,$4aa80004,$66124aa8
- dc.l $0008660c,$02688000,$0000103c,$00014e75
- dc.l $103c0006,$4e754aa8,$00086612,$20280004
- dc.l $02807fff,$ffff6606,$103c0002,$4e750828
- dc.l $00060004,$6706103c,$00034e75,$103c0005
- dc.l $4e752028,$00002200,$02807ff0,$0000670e
- dc.l $0c807ff0,$00006728,$103c0000,$4e750281
- dc.l $000fffff,$66ff0000,$00144aa8,$000466ff
- dc.l $0000000a,$103c0001,$4e75103c,$00044e75
- dc.l $0281000f,$ffff66ff,$00000014,$4aa80004
- dc.l $66ff0000,$000a103c,$00024e75,$08010013
- dc.l $66ff0000,$000a103c,$00054e75,$103c0003
- dc.l $4e752028,$00002200,$02807f80,$0000670e
- dc.l $0c807f80,$0000671e,$103c0000,$4e750281
- dc.l $007fffff,$66ff0000,$000a103c,$00014e75
- dc.l $103c0004,$4e750281,$007fffff,$66ff0000
- dc.l $000a103c,$00024e75,$08010016,$66ff0000
- dc.l $000a103c,$00054e75,$103c0003,$4e752f01
- dc.l $08280007,$000056e8,$00023228,$00000241
- dc.l $7fff9240,$31410000,$2f08202f,$00040240
- dc.l $00c0e848,$61ffffff,$fae22057,$322f0006
- dc.l $024100c0,$e8494841,$322f0006,$02410030
- dc.l $e84961ff,$fffffc22,$205f08a8,$00070000
- dc.l $4a280002,$670a08e8,$00070000,$42280002
- dc.l $42804aa8,$0004660a,$4aa80008,$660408c0
- dc.l $0002082e,$0001ff66,$670608ee,$0005ff67
- dc.l $588f4e75,$2f010828,$00070000,$56e80002
- dc.l $32280000,$02417fff,$92403141,$00002f08
- dc.l $428061ff,$fffffa64,$2057323c,$00044841
- dc.l $322f0006,$02410030,$e84961ff,$fffffbaa
- dc.l $205f08a8,$00070000,$4a280002,$670a08e8
- dc.l $00070000,$42280002,$42804aa8,$0004660a
- dc.l $4aa80008,$660408c0,$0002082e,$0001ff66
- dc.l $670608ee,$0005ff67,$588f4e75,$02410010
- dc.l $e8088200,$3001e309,$600e0241,$00108200
- dc.l $48408200,$3001e309,$103b0008,$41fb1620
- dc.l $4e750200,$00020200,$00020200,$00020000
- dc.l $00000a08,$0a080a08,$0a080a08,$0a087fff
- dc.l $00000000,$00000000,$00000000,$00007ffe
- dc.l $0000ffff,$ffffffff,$ffff0000,$00007ffe
- dc.l $0000ffff,$ffffffff,$ffff0000,$00007fff
- dc.l $00000000,$00000000,$00000000,$00007fff
- dc.l $00000000,$00000000,$00000000,$0000407e
- dc.l $0000ffff,$ff000000,$00000000,$0000407e
- dc.l $0000ffff,$ff000000,$00000000,$00007fff
- dc.l $00000000,$00000000,$00000000,$00007fff
- dc.l $00000000,$00000000,$00000000,$000043fe
- dc.l $0000ffff,$ffffffff,$f8000000,$000043fe
- dc.l $0000ffff,$ffffffff,$f8000000,$00007fff
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$0000ffff
- dc.l $00000000,$00000000,$00000000,$0000fffe
- dc.l $0000ffff,$ffffffff,$ffff0000,$0000ffff
- dc.l $00000000,$00000000,$00000000,$0000fffe
- dc.l $0000ffff,$ffffffff,$ffff0000,$0000ffff
- dc.l $00000000,$00000000,$00000000,$0000c07e
- dc.l $0000ffff,$ff000000,$00000000,$0000ffff
- dc.l $00000000,$00000000,$00000000,$0000c07e
- dc.l $0000ffff,$ff000000,$00000000,$0000ffff
- dc.l $00000000,$00000000,$00000000,$0000c3fe
- dc.l $0000ffff,$ffffffff,$f8000000,$0000ffff
- dc.l $00000000,$00000000,$00000000,$0000c3fe
- dc.l $0000ffff,$ffffffff,$f8000000,$0000700c
- dc.l $61ffffff,$e82c43ee,$ff6c700c,$61ffffff
- dc.l $38664a81,$66ff0000,$0a14e9ee,$004fff6c
- dc.l $0c407fff,$66024e75,$102eff6f,$0200000f
- dc.l $660e4aae,$ff706608,$4aaeff74,$66024e75
- dc.l $41eeff6c,$61ff0000,$001cf22e,$f080ff6c
- dc.l $4e750000,$00000203,$02030203,$03020302
- dc.l $02032d68,$0000ff84,$2d680004,$ff882d68
- dc.l $0008ff8c,$41eeff84,$48e73c00,$f227e001
- dc.l $74027604,$28104281,$4c3c1001,$0000000a
- dc.l $e9c408c4,$d2805803,$51caffee,$0804001e
- dc.l $67024481,$04810000,$00106c0e,$44810084
- dc.l $40000000,$00904000,$00002f01,$7201f23c
- dc.l $44000000,$0000e9d0,$0704f200,$58222830
- dc.l $1c007600,$7407f23c,$44234120,$0000e9c4
- dc.l $08c4f200,$58225803,$51caffec,$52810c81
- dc.l $00000002,$6fd80810,$001f6704,$f200001a
- dc.l $22170c81,$0000001b,$6f0000e4,$0810001e
- dc.l $66744281,$2810e9c4,$07046624,$52817a01
- dc.l $28305c00,$66085081,$52852830,$5c004283
- dc.l $7407e9c4,$08c46608,$58835281,$51cafff4
- dc.l $20012217,$92806c10,$44812810,$00844000
- dc.l $00000090,$40000000,$43fb0170,$00000666
- dc.l $4283f23c,$44803f80,$00007403,$e2806406
- dc.l $f23148a3,$38000683,$0000000c,$4a8066ec
- dc.l $f2000423,$60684281,$7a022830,$5c006608
- dc.l $53855081,$28305c00,$761c7407,$e9c408c4
- dc.l $66085983,$528151ca,$fff42001,$22179280
- dc.l $6e104481,$28100284,$bfffffff,$0290bfff
- dc.l $ffff43fb,$01700000,$05fc4283,$f23c4480
- dc.l $3f800000,$7403e280,$6406f231,$48a33800
- dc.l $06830000,$000c4a80,$66ecf200,$0420262e
- dc.l $ff60e9c3,$26822810,$e582e9c4,$0002d480
- dc.l $43fafe50,$10312800,$4283efc3,$0682f203
- dc.l $9000e280,$640a43fb,$01700000,$06446016
- dc.l $e280640a,$43fb0170,$000006d2,$600843fb
- dc.l $01700000,$05902001,$6a084480,$00904000
- dc.l $00004283,$f23c4480,$3f800000,$e2806406
- dc.l $f23148a3,$38000683,$0000000c,$4a8066ec
- dc.l $0810001e,$6706f200,$04206004,$f2000423
- dc.l $f200a800,$08800009,$6706006e,$0108ff66
- dc.l $588ff21f,$d0404cdf,$003cf23c,$90000000
- dc.l $0000f23c,$88000000,$00004e75,$3ffd0000
- dc.l $9a209a84,$fbcff798,$00000000,$3ffd0000
- dc.l $9a209a84,$fbcff799,$00000000,$3f800000
- dc.l $00000000,$00000000,$00000000,$40000000
- dc.l $00000000,$00000000,$00000000,$41200000
- dc.l $00000000,$00000000,$00000000,$459a2800
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $03030202,$03020203,$02030302,$48e73f20
- dc.l $f227e007,$f23c9000,$00000020,$2d50ff58
- dc.l $2e00422e,$ff500c2e,$0004ff4e,$66000030
- dc.l $30100240,$7fff2228,$00042428,$00085340
- dc.l $e38ae391,$4a816cf6,$4a406e04,$50eeff50
- dc.l $02407fff,$30802141,$00042142,$00082d50
- dc.l $ff902d68,$0004ff94,$2d680008,$ff9802ae
- dc.l $7fffffff,$ff904a2e,$ff506708,$2c3cffff
- dc.l $ecbb6038,$302eff90,$3d7c3fff,$ff90f22e
- dc.l $4800ff90,$04403fff,$f2005022,$f23a4428
- dc.l $ff1cf293,$000ef23a,$4823ff02,$f2066000
- dc.l $600af23a,$4823fee6,$f2066000,$f23c8800
- dc.l $00000000,$42454a87,$6f042807,$60062806
- dc.l $98875284,$4a846f18,$0c840000,$00116f12
- dc.l $78114a87,$6f0c00ae,$00002080,$ff646002
- dc.l $78014a87,$6e06be86,$6d022c07,$20065280
- dc.l $90844845,$42454242,$4a806c14,$52450c80
- dc.l $ffffecd4,$6e080680,$00000018,$74184480
- dc.l $f23a4480,$fe98e9ee,$1682ff60,$e349d245
- dc.l $e3494aae,$ff586c02,$528145fa,$fec01632
- dc.l $1800e98b,$f2039000,$e88b4a03,$660a43fb
- dc.l $01700000,$03706016,$e20b640a,$43fb0170
- dc.l $000003fe,$600843fb,$01700000,$04904283
- dc.l $e2886406,$f23148a3,$38000683,$0000000c
- dc.l $4a8066ec,$f23c8800,$00000000,$f23c9000
- dc.l $00000010,$f2104800,$f2000018,$4a456608
- dc.l $f2000420,$6000008e,$4a2eff50,$67000072
- dc.l $f227e002,$36170243,$7fff0050,$8000d650
- dc.l $04433fff,$d6690024,$04433fff,$d6690030
- dc.l $04433fff,$6b000048,$02578000,$87570250
- dc.l $7fff2f28,$00082f28,$00042f3c,$3fff0000
- dc.l $f21fd080,$f21f4823,$2f29002c,$2f290028
- dc.l $2f3c3fff,$00002f29,$00382f29,$00342f3c
- dc.l $3fff0000,$f21f4823,$f21f4823,$601660fe
- dc.l $4a42670c,$f2294823,$0024f229,$48230030
- dc.l $f2000423,$f200a800,$f22e6800,$ff9045ee
- dc.l $ff900800,$0009670e,$00aa0000,$00010008
- dc.l $f22e4800,$ff902d6e,$ff60ff54,$02ae0000
- dc.l $0030ff60,$48e7c0c0,$2f2eff54,$2f2eff58
- dc.l $41eeff90,$f2106800,$4aaeff58,$6c060090
- dc.l $80000000,$2f2eff64,$f22e9000,$ff60f23c
- dc.l $88000000,$0000f22e,$4801ff90,$f200a800
- dc.l $816eff66,$1d57ff64,$588f2d5f,$ff582d5f
- dc.l $ff544cdf,$03032d6e,$ff58ff90,$2d6eff54
- dc.l $ff604845,$4a4566ff,$00000086,$f23a4500
- dc.l $fcec2004,$53804283,$e2886406,$f2314923
- dc.l $38000683,$0000000c,$4a8066ec,$4a2eff50
- dc.l $670af200,$001860ff,$00000028,$f2000018
- dc.l $f2000838,$f293001a,$53863a3c,$0001f23c
- dc.l $90000000,$0020f23a,$4523fcc2,$6000fda8
- dc.l $f23a4523,$fcb8f200,$0838f294,$005cf292
- dc.l $000cf23a,$4420fca6,$5286604c,$52863a3c
- dc.l $0001f23c,$90000000,$00206000,$fd7af23a
- dc.l $4500fc6a,$20044283,$e2886406,$f2314923
- dc.l $38000683,$0000000c,$4a8066ec,$f2000018
- dc.l $f2000838,$f28e0012,$f23a4420,$fc605286
- dc.l $5284f23a,$4523fc56,$f23c9000,$00000010
- dc.l $f2000820,$41eeff84,$f2106800,$24280004
- dc.l $26280008,$42a80004,$42a80008,$20104840
- dc.l $67140480,$00003ffd,$4a806e0a,$4480e28a
- dc.l $e29351c8,$fffa4a82,$66044a83,$67104281
- dc.l $06830000,$0080d581,$0283ffff,$ff802004
- dc.l $568861ff,$000002b0,$4a2eff50,$6728f200
- dc.l $003af281,$000cf206,$4000f200,$0018602e
- dc.l $4a876d08,$f23a4400,$fbe46022,$f2064000
- dc.l $f2000018,$6018f200,$003af28e,$000af23a
- dc.l $4400fb9a,$6008f206,$4000f200,$0018f229
- dc.l $48200018,$f22e6800,$ff90242a,$0004262a
- dc.l $00083012,$670e0440,$3ffd4440,$e28ae293
- dc.l $51c8fffa,$42810683,$00000080,$d5810283
- dc.l $ffffff80,$700441ee,$ff5461ff,$00000228
- dc.l $202eff54,$720ce2a8,$efee010c,$ff84e2a8
- dc.l $efee0404,$ff844a00,$670800ae,$00002080
- dc.l $ff644280,$022e000f,$ff844aae,$ff586c02
- dc.l $70024a86,$6c025280,$efee0002,$ff84f23c
- dc.l $88000000,$0000f21f,$d0e04cdf,$04fc4e75
- dc.l $40020000,$a0000000,$00000000,$40050000
- dc.l $c8000000,$00000000,$400c0000,$9c400000
- dc.l $00000000,$40190000,$bebc2000,$00000000
- dc.l $40340000,$8e1bc9bf,$04000000,$40690000
- dc.l $9dc5ada8,$2b70b59e,$40d30000,$c2781f49
- dc.l $ffcfa6d5,$41a80000,$93ba47c9,$80e98ce0
- dc.l $43510000,$aa7eebfb,$9df9de8e,$46a30000
- dc.l $e319a0ae,$a60e91c7,$4d480000,$c9767586
- dc.l $81750c17,$5a920000,$9e8b3b5d,$c53d5de5
- dc.l $75250000,$c4605202,$8a20979b,$40020000
- dc.l $a0000000,$00000000,$40050000,$c8000000
- dc.l $00000000,$400c0000,$9c400000,$00000000
- dc.l $40190000,$bebc2000,$00000000,$40340000
- dc.l $8e1bc9bf,$04000000,$40690000,$9dc5ada8
- dc.l $2b70b59e,$40d30000,$c2781f49,$ffcfa6d6
- dc.l $41a80000,$93ba47c9,$80e98ce0,$43510000
- dc.l $aa7eebfb,$9df9de8e,$46a30000,$e319a0ae
- dc.l $a60e91c7,$4d480000,$c9767586,$81750c18
- dc.l $5a920000,$9e8b3b5d,$c53d5de5,$75250000
- dc.l $c4605202,$8a20979b,$40020000,$a0000000
- dc.l $00000000,$40050000,$c8000000,$00000000
- dc.l $400c0000,$9c400000,$00000000,$40190000
- dc.l $bebc2000,$00000000,$40340000,$8e1bc9bf
- dc.l $04000000,$40690000,$9dc5ada8,$2b70b59d
- dc.l $40d30000,$c2781f49,$ffcfa6d5,$41a80000
- dc.l $93ba47c9,$80e98cdf,$43510000,$aa7eebfb
- dc.l $9df9de8d,$46a30000,$e319a0ae,$a60e91c6
- dc.l $4d480000,$c9767586,$81750c17,$5a920000
- dc.l $9e8b3b5d,$c53d5de4,$75250000,$c4605202
- dc.l $8a20979a,$48e7ff00,$7e015380,$28022a03
- dc.l $e9c21003,$e782e9c3,$6003e783,$8486e385
- dc.l $e3944846,$d346d685,$4e71d584,$4e71d346
- dc.l $48464a47,$67124847,$e947de41,$10c74847
- dc.l $424751c8,$ffc86012,$48473e01,$48475247
- dc.l $51c8ffba,$4847e94f,$10c74cdf,$00ff4e75
- dc.l $70016100,$00d63d7c,$0121000a,$6000007e
- dc.l $70026100,$00c63d7c,$0141000a,$606e7004
- dc.l $610000b8,$3d7c0101,$000a6060,$70086100
- dc.l $00aa3d7c,$0161000a,$6052700c,$6100009c
- dc.l $3d7c0161,$000a6044,$70016100,$008e3d7c
- dc.l $00a1000a,$60367002,$61000080,$3d7c00c1
- dc.l $000a6028,$70046100,$00723d7c,$0081000a
- dc.l $601a7008,$61000064,$3d7c00e1,$000a600c
- dc.l $700c6100,$00563d7c,$00e1000a,$2d6eff68
- dc.l $0006f22e,$d0c0ffdc,$f22e9c00,$ff604cee
- dc.l $0303ff9c,$4e5e2f17,$2f6f0008,$00042f6f
- dc.l $000c0008,$2f7c0000,$0001000c,$3f6f0006
- dc.l $000c3f7c,$40080006,$08170005,$670608ef
- dc.l $0002000d,$60ffffff,$2d82122e,$ff410201
- dc.l $00380c01,$00186700,$000c0c01,$00206700
- dc.l $00604e75,$122eff41,$02410007,$323b1206
- dc.l $4efb1002,$00100016,$001c0020,$00240028
- dc.l $002c0030,$91aeffa4,$4e7591ae,$ffa84e75
- dc.l $95c04e75,$97c04e75,$99c04e75,$9bc04e75
- dc.l $91964e75,$0c2e0030,$000a6612,$082e0005
- dc.l $0004660a,$4e7a8800,$91c04e7b,$88004e75
- dc.l $448060a0,$00000000,$00000000,$00000000
diff --git a/sys/arch/m68k/060sp/fskeletn.s b/sys/arch/m68k/060sp/fskeletn.s
deleted file mode 100644
index e716dd1653d..00000000000
--- a/sys/arch/m68k/060sp/fskeletn.s
+++ /dev/null
@@ -1,351 +0,0 @@
-#
-# $OpenBSD: fskeletn.s,v 1.2 1996/05/30 22:14:31 niklas Exp $
-# $NetBSD: fskeletn.s,v 1.2 1996/05/15 19:48:30 is Exp $
-#
-
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-# M68000 Hi-Performance Microprocessor Division
-# M68060 Software Package Production Release
-#
-# M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
-# All rights reserved.
-#
-# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-# To the maximum extent permitted by applicable law,
-# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
-# FOR A PARTICULAR PURPOSE and any warranty against infringement with
-# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-# and any accompanying written materials.
-#
-# To the maximum extent permitted by applicable law,
-# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
-# BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
-# ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
-#
-# Motorola assumes no responsibility for the maintenance and support
-# of the SOFTWARE.
-#
-# You are hereby granted a copyright license to use, modify, and distribute the
-# SOFTWARE so long as this entire notice is retained without alteration
-# in any modified and/or redistributed versions, and that such modified
-# versions are clearly identified as such.
-# No licenses are granted by implication, estoppel or otherwise under any
-# patents or trademarks of Motorola, Inc.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-#
-# fskeleton.s
-#
-# This file contains:
-# (1) example "Call-out"s
-# (2) example package entry code
-# (3) example "Call-out" table
-#
-
-
-#################################
-# (1) EXAMPLE CALL-OUTS #
-# #
-# _060_fpsp_done() #
-# _060_real_ovfl() #
-# _060_real_unfl() #
-# _060_real_operr() #
-# _060_real_snan() #
-# _060_real_dz() #
-# _060_real_inex() #
-# _060_real_bsun() #
-# _060_real_fline() #
-# _060_real_fpu_disabled() #
-# _060_real_trap() #
-#################################
-
-#
-# _060_fpsp_done():
-#
-# This is the main exit point for the 68060 Floating-Point
-# Software Package. For a normal exit, all 060FPSP routines call this
-# routine. The operating system can do system dependent clean-up or
-# simply execute an "rte" as with the sample code below.
-#
- global _060_fpsp_done
-_060_fpsp_done:
- rte
-
-#
-# _060_real_ovfl():
-#
-# This is the exit point for the 060FPSP when an enabled overflow exception
-# is present. The routine below should point to the operating system handler
-# for enabled overflow conditions. The exception stack frame is an overflow
-# stack frame. The FP state frame holds the EXCEPTIONAL OPERAND.
-#
-# The sample routine below simply clears the exception status bit and
-# does an "rte".
-#
- global _060_real_ovfl
-_060_real_ovfl:
- fsave -(%sp)
- mov.w &0x6000,0x2(%sp)
- frestore (%sp)+
- rte
-
-#
-# _060_real_unfl():
-#
-# This is the exit point for the 060FPSP when an enabled underflow exception
-# is present. The routine below should point to the operating system handler
-# for enabled underflow conditions. The exception stack frame is an underflow
-# stack frame. The FP state frame holds the EXCEPTIONAL OPERAND.
-#
-# The sample routine below simply clears the exception status bit and
-# does an "rte".
-#
- global _060_real_unfl
-_060_real_unfl:
- fsave -(%sp)
- mov.w &0x6000,0x2(%sp)
- frestore (%sp)+
- rte
-
-#
-# _060_real_operr():
-#
-# This is the exit point for the 060FPSP when an enabled operand error exception
-# is present. The routine below should point to the operating system handler
-# for enabled operand error exceptions. The exception stack frame is an operand error
-# stack frame. The FP state frame holds the source operand of the faulting
-# instruction.
-#
-# The sample routine below simply clears the exception status bit and
-# does an "rte".
-#
- global _060_real_operr
-_060_real_operr:
- fsave -(%sp)
- mov.w &0x6000,0x2(%sp)
- frestore (%sp)+
- rte
-
-#
-# _060_real_snan():
-#
-# This is the exit point for the 060FPSP when an enabled signalling NaN exception
-# is present. The routine below should point to the operating system handler
-# for enabled signalling NaN exceptions. The exception stack frame is a signalling NaN
-# stack frame. The FP state frame holds the source operand of the faulting
-# instruction.
-#
-# The sample routine below simply clears the exception status bit and
-# does an "rte".
-#
- global _060_real_snan
-_060_real_snan:
- fsave -(%sp)
- mov.w &0x6000,0x2(%sp)
- frestore (%sp)+
- rte
-
-#
-# _060_real_dz():
-#
-# This is the exit point for the 060FPSP when an enabled divide-by-zero exception
-# is present. The routine below should point to the operating system handler
-# for enabled divide-by-zero exceptions. The exception stack frame is a divide-by-zero
-# stack frame. The FP state frame holds the source operand of the faulting
-# instruction.
-#
-# The sample routine below simply clears the exception status bit and
-# does an "rte".
-#
- global _060_real_dz
-_060_real_dz:
- fsave -(%sp)
- mov.w &0x6000,0x2(%sp)
- frestore (%sp)+
- rte
-
-#
-# _060_real_inex():
-#
-# This is the exit point for the 060FPSP when an enabled inexact exception
-# is present. The routine below should point to the operating system handler
-# for enabled inexact exceptions. The exception stack frame is an inexact
-# stack frame. The FP state frame holds the source operand of the faulting
-# instruction.
-#
-# The sample routine below simply clears the exception status bit and
-# does an "rte".
-#
- global _060_real_inex
-_060_real_inex:
- fsave -(%sp)
- mov.w &0x6000,0x2(%sp)
- frestore (%sp)+
- rte
-
-#
-# _060_real_bsun():
-#
-# This is the exit point for the 060FPSP when an enabled bsun exception
-# is present. The routine below should point to the operating system handler
-# for enabled bsun exceptions. The exception stack frame is a bsun
-# stack frame.
-#
-# The sample routine below clears the exception status bit, clears the NaN
-# bit in the FPSR, and does an "rte". The instruction that caused the
-# bsun will now be re-executed but with the NaN FPSR bit cleared.
-#
- global _060_real_bsun
-_060_real_bsun:
- fsave -(%sp)
-
- fmov.l %fpsr,-(%sp)
- andi.b &0xfe,(%sp)
- fmov.l (%sp)+,%fpsr
-
- add.l &0xc,%sp
- rte
-
-#
-# _060_real_fline():
-#
-# This is the exit point for the 060FPSP when an F-Line Illegal exception is
-# encountered. Three different types of exceptions can enter the F-Line exception
-# vector number 11: FP Unimplemented Instructions, FP implemented instructions when
-# the FPU is disabled, and F-Line Illegal instructions. The 060FPSP module
-# _fpsp_fline() distinguishes between the three and acts appropriately. F-Line
-# Illegals branch here.
-#
- global _060_real_fline
-_060_real_fline:
- bra.b _060_real_fline
-
-#
-# _060_real_fpu_disabled():
-#
-# This is the exit point for the 060FPSP when an FPU disabled exception is
-# encountered. Three different types of exceptions can enter the F-Line exception
-# vector number 11: FP Unimplemented Instructions, FP implemented instructions when
-# the FPU is disabled, and F-Line Illegal instructions. The 060FPSP module
-# _fpsp_fline() distinguishes between the three and acts appropriately. FPU disabled
-# exceptions branch here.
-#
-# The sample code below enables the FPU, sets the PC field in the exception stack
-# frame to the PC of the instruction causing the exception, and does an "rte".
-# The execution of the instruction then proceeds with an enabled floating-point
-# unit.
-#
- global _060_real_fpu_disabled
-_060_real_fpu_disabled:
- mov.l %d0,-(%sp) # enabled the fpu
- movc %pcr,%d0
- bclr &0x1,%d0
- movc %d0,%pcr
- mov.l (%sp)+,%d0
-
- mov.l 0xc(%sp),0x2(%sp) # set "Current PC"
- rte
-
-#
-# _060_real_trap():
-#
-# This is the exit point for the 060FPSP when an emulated "ftrapcc" instruction
-# discovers that the trap condition is true and it should branch to the operating
-# system handler for the trap exception vector number 7.
-#
-# The sample code below simply executes an "rte".
-#
- global _060_real_trap
-_060_real_trap:
- rte
-
-#############################################################################
-
-##################################
-# (2) EXAMPLE PACKAGE ENTRY CODE #
-##################################
-
- global _060_fpsp_snan
-_060_fpsp_snan:
- bra.l _FP_CALL_TOP+0x80+0x00
-
- global _060_fpsp_operr
-_060_fpsp_operr:
- bra.l _FP_CALL_TOP+0x80+0x08
-
- global _060_fpsp_ovfl
-_060_fpsp_ovfl:
- bra.l _FP_CALL_TOP+0x80+0x10
-
- global _060_fpsp_unfl
-_060_fpsp_unfl:
- bra.l _FP_CALL_TOP+0x80+0x18
-
- global _060_fpsp_dz
-_060_fpsp_dz:
- bra.l _FP_CALL_TOP+0x80+0x20
-
- global _060_fpsp_inex
-_060_fpsp_inex:
- bra.l _FP_CALL_TOP+0x80+0x28
-
- global _060_fpsp_fline
-_060_fpsp_fline:
- bra.l _FP_CALL_TOP+0x80+0x30
-
- global _060_fpsp_unsupp
-_060_fpsp_unsupp:
- bra.l _FP_CALL_TOP+0x80+0x38
-
- global _060_fpsp_effadd
-_060_fpsp_effadd:
- bra.l _FP_CALL_TOP+0x80+0x40
-
-#############################################################################
-
-################################
-# (3) EXAMPLE CALL-OUT SECTION #
-################################
-
-# The size of this section MUST be 128 bytes!!!
-
- global _FP_CALL_TOP
-_FP_CALL_TOP:
- long _060_real_bsun - _FP_CALL_TOP
- long _060_real_snan - _FP_CALL_TOP
- long _060_real_operr - _FP_CALL_TOP
- long _060_real_ovfl - _FP_CALL_TOP
- long _060_real_unfl - _FP_CALL_TOP
- long _060_real_dz - _FP_CALL_TOP
- long _060_real_inex - _FP_CALL_TOP
- long _060_real_fline - _FP_CALL_TOP
- long _060_real_fpu_disabled - _FP_CALL_TOP
- long _060_real_trap - _FP_CALL_TOP
- long _060_real_trace - _FP_CALL_TOP
- long _060_real_access - _FP_CALL_TOP
- long _060_fpsp_done - _FP_CALL_TOP
-
- long 0x00000000, 0x00000000, 0x00000000
-
- long _060_imem_read - _FP_CALL_TOP
- long _060_dmem_read - _FP_CALL_TOP
- long _060_dmem_write - _FP_CALL_TOP
- long _060_imem_read_word - _FP_CALL_TOP
- long _060_imem_read_long - _FP_CALL_TOP
- long _060_dmem_read_byte - _FP_CALL_TOP
- long _060_dmem_read_word - _FP_CALL_TOP
- long _060_dmem_read_long - _FP_CALL_TOP
- long _060_dmem_write_byte - _FP_CALL_TOP
- long _060_dmem_write_word - _FP_CALL_TOP
- long _060_dmem_write_long - _FP_CALL_TOP
-
- long 0x00000000
-
- long 0x00000000, 0x00000000, 0x00000000, 0x00000000
-
-#############################################################################
-
-# 060 FPSP KERNEL PACKAGE NEEDS TO GO HERE!!!
diff --git a/sys/arch/m68k/060sp/ftest.s b/sys/arch/m68k/060sp/ftest.s
deleted file mode 100644
index d07aebbfbe5..00000000000
--- a/sys/arch/m68k/060sp/ftest.s
+++ /dev/null
@@ -1,1466 +0,0 @@
-#
-# $OpenBSD: ftest.s,v 1.2 1996/05/30 22:14:33 niklas Exp $
-# $NetBSD: ftest.s,v 1.2 1996/05/15 19:48:32 is Exp $
-#
-
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-# M68000 Hi-Performance Microprocessor Division
-# M68060 Software Package Production Release
-#
-# M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
-# All rights reserved.
-#
-# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-# To the maximum extent permitted by applicable law,
-# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
-# FOR A PARTICULAR PURPOSE and any warranty against infringement with
-# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-# and any accompanying written materials.
-#
-# To the maximum extent permitted by applicable law,
-# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
-# BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
-# ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
-#
-# Motorola assumes no responsibility for the maintenance and support
-# of the SOFTWARE.
-#
-# You are hereby granted a copyright license to use, modify, and distribute the
-# SOFTWARE so long as this entire notice is retained without alteration
-# in any modified and/or redistributed versions, and that such modified
-# versions are clearly identified as such.
-# No licenses are granted by implication, estoppel or otherwise under any
-# patents or trademarks of Motorola, Inc.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-#############################################
-set SREGS, -64
-set IREGS, -128
-set IFPREGS, -224
-set SFPREGS, -320
-set IFPCREGS, -332
-set SFPCREGS, -344
-set ICCR, -346
-set SCCR, -348
-set TESTCTR, -352
-set DATA, -384
-
-#############################################
-TESTTOP:
- bra.l _060TESTS_
- short 0x0000
-
- bra.l _060TESTS_unimp
- short 0x0000
-
- bra.l _060TESTS_enable
- short 0x0000
-
-start_str:
- string "Testing 68060 FPSP started:\n"
-
-start_str_unimp:
- string "Testing 68060 FPSP unimplemented instruction started:\n"
-
-start_str_enable:
- string "Testing 68060 FPSP exception enabled started:\n"
-
-pass_str:
- string "passed\n"
-
-fail_str:
- string " failed\n"
-
- align 0x4
-chk_test:
- tst.l %d0
- bne.b test_fail
-test_pass:
- pea pass_str(%pc)
- bsr.l _print_str
- addq.l &0x4,%sp
- rts
-test_fail:
- mov.l %d1,-(%sp)
- bsr.l _print_num
- addq.l &0x4,%sp
-
- pea fail_str(%pc)
- bsr.l _print_str
- addq.l &0x4,%sp
- rts
-
-#############################################
-_060TESTS_:
- link %a6,&-384
-
- movm.l &0x3f3c,-(%sp)
- fmovm.x &0xff,-(%sp)
-
- pea start_str(%pc)
- bsr.l _print_str
- addq.l &0x4,%sp
-
-### effadd
- clr.l TESTCTR(%a6)
- pea effadd_str(%pc)
- bsr.l _print_str
- addq.l &0x4,%sp
-
- bsr.l effadd_0
-
- bsr.l chk_test
-
-### unsupp
- clr.l TESTCTR(%a6)
- pea unsupp_str(%pc)
- bsr.l _print_str
- addq.l &0x4,%sp
-
- bsr.l unsupp_0
-
- bsr.l chk_test
-
-### ovfl non-maskable
- clr.l TESTCTR(%a6)
- pea ovfl_nm_str(%pc)
- bsr.l _print_str
- bsr.l ovfl_nm_0
-
- bsr.l chk_test
-
-### unfl non-maskable
- clr.l TESTCTR(%a6)
- pea unfl_nm_str(%pc)
- bsr.l _print_str
- bsr.l unfl_nm_0
-
- bsr.l chk_test
-
- movm.l (%sp)+,&0x3cfc
- fmovm.x (%sp)+,&0xff
-
- unlk %a6
- rts
-
-_060TESTS_unimp:
- link %a6,&-384
-
- movm.l &0x3f3c,-(%sp)
- fmovm.x &0xff,-(%sp)
-
- pea start_str_unimp(%pc)
- bsr.l _print_str
- addq.l &0x4,%sp
-
-### unimp
- clr.l TESTCTR(%a6)
- pea unimp_str(%pc)
- bsr.l _print_str
- addq.l &0x4,%sp
-
- bsr.l unimp_0
-
- bsr.l chk_test
-
- movm.l (%sp)+,&0x3cfc
- fmovm.x (%sp)+,&0xff
-
- unlk %a6
- rts
-
-_060TESTS_enable:
- link %a6,&-384
-
- movm.l &0x3f3c,-(%sp)
- fmovm.x &0xff,-(%sp)
-
- pea start_str_enable(%pc)
- bsr.l _print_str
- addq.l &0x4,%sp
-
-### snan
- clr.l TESTCTR(%a6)
- pea snan_str(%pc)
- bsr.l _print_str
- bsr.l snan_0
-
- bsr.l chk_test
-
-### operr
- clr.l TESTCTR(%a6)
- pea operr_str(%pc)
- bsr.l _print_str
- bsr.l operr_0
-
- bsr.l chk_test
-
-### ovfl
- clr.l TESTCTR(%a6)
- pea ovfl_str(%pc)
- bsr.l _print_str
- bsr.l ovfl_0
-
- bsr.l chk_test
-
-### unfl
- clr.l TESTCTR(%a6)
- pea unfl_str(%pc)
- bsr.l _print_str
- bsr.l unfl_0
-
- bsr.l chk_test
-
-### dz
- clr.l TESTCTR(%a6)
- pea dz_str(%pc)
- bsr.l _print_str
- bsr.l dz_0
-
- bsr.l chk_test
-
-### inexact
- clr.l TESTCTR(%a6)
- pea inex_str(%pc)
- bsr.l _print_str
- bsr.l inex_0
-
- bsr.l chk_test
-
- movm.l (%sp)+,&0x3cfc
- fmovm.x (%sp)+,&0xff
-
- unlk %a6
- rts
-
-#############################################
-#############################################
-
-unimp_str:
- string "\tUnimplemented FP instructions..."
-
- align 0x4
-unimp_0:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- fmovm.x DEF_FPREGS(%pc),&0xff
- fmovm.l DEF_FPCREGS(%pc),%fpcr,%fpsr,%fpiar
-
- mov.w &0x0000,ICCR(%a6)
- movm.l &0x7fff,IREGS(%a6)
- fmovm.x &0xff,IFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,IFPCREGS(%a6)
-
- mov.l &0x40000000,DATA+0x0(%a6)
- mov.l &0xc90fdaa2,DATA+0x4(%a6)
- mov.l &0x2168c235,DATA+0x8(%a6)
-
- mov.w &0x0000,%cc
-unimp_0_pc:
- fsin.x DATA(%a6),%fp0
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- fmovm.x &0xff,SFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,SFPCREGS(%a6)
-
- mov.l &0xbfbf0000,IFPREGS+0x0(%a6)
- mov.l &0x80000000,IFPREGS+0x4(%a6)
- mov.l &0x00000000,IFPREGS+0x8(%a6)
- mov.l &0x08000208,IFPCREGS+0x4(%a6)
- lea unimp_0_pc(%pc),%a0
- mov.l %a0,IFPCREGS+0x8(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- bsr.l chkfpregs
- tst.b %d0
- bne.l error
-
-unimp_1:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- fmovm.x DEF_FPREGS(%pc),&0xff
- fmovm.l DEF_FPCREGS(%pc),%fpcr,%fpsr,%fpiar
-
- mov.w &0x0000,ICCR(%a6)
- movm.l &0x7fff,IREGS(%a6)
- fmovm.x &0xff,IFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,IFPCREGS(%a6)
-
- mov.l &0x3ffe0000,DATA+0x0(%a6)
- mov.l &0xc90fdaa2,DATA+0x4(%a6)
- mov.l &0x2168c235,DATA+0x8(%a6)
-
- mov.w &0x0000,%cc
-unimp_1_pc:
- ftan.x DATA(%a6),%fp0
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- fmovm.x &0xff,SFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,SFPCREGS(%a6)
-
- mov.l &0x3fff0000,IFPREGS+0x0(%a6)
- mov.l &0x80000000,IFPREGS+0x4(%a6)
- mov.l &0x00000000,IFPREGS+0x8(%a6)
- mov.l &0x00000208,IFPCREGS+0x4(%a6)
- lea unimp_1_pc(%pc),%a0
- mov.l %a0,IFPCREGS+0x8(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- bsr.l chkfpregs
- tst.b %d0
- bne.l error
-
-# fmovecr
-unimp_2:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- fmovm.x DEF_FPREGS(%pc),&0xff
- fmovm.l DEF_FPCREGS(%pc),%fpcr,%fpsr,%fpiar
-
- mov.w &0x0000,ICCR(%a6)
- movm.l &0x7fff,IREGS(%a6)
- fmovm.x &0xff,IFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,IFPCREGS(%a6)
-
- mov.w &0x0000,%cc
-unimp_2_pc:
- fmovcr.x &0x31,%fp0
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- fmovm.x &0xff,SFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,SFPCREGS(%a6)
-
- mov.l &0x40000000,IFPREGS+0x0(%a6)
- mov.l &0x935d8ddd,IFPREGS+0x4(%a6)
- mov.l &0xaaa8ac17,IFPREGS+0x8(%a6)
- mov.l &0x00000208,IFPCREGS+0x4(%a6)
- lea unimp_2_pc(%pc),%a0
- mov.l %a0,IFPCREGS+0x8(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- bsr.l chkfpregs
- tst.b %d0
- bne.l error
-
-# fscc
-unimp_3:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- fmovm.x DEF_FPREGS(%pc),&0xff
- fmovm.l DEF_FPCREGS(%pc),%fpcr,%fpsr,%fpiar
-
- fmov.l &0x0f000000,%fpsr
- mov.l &0x00,%d7
-
- mov.w &0x0000,ICCR(%a6)
- movm.l &0x7fff,IREGS(%a6)
- fmovm.x &0xff,IFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,IFPCREGS(%a6)
-
- mov.w &0x0000,%cc
-unimp_3_pc:
- fsgt %d7
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- fmovm.x &0xff,SFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,SFPCREGS(%a6)
- mov.l &0x0f008080,IFPCREGS+0x4(%a6)
- lea unimp_3_pc(%pc),%a0
- mov.l %a0,IFPCREGS+0x8(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- bsr.l chkfpregs
- tst.b %d0
- bne.l error
-
-# fdbcc
-unimp_4:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- fmovm.x DEF_FPREGS(%pc),&0xff
- fmovm.l DEF_FPCREGS(%pc),%fpcr,%fpsr,%fpiar
-
- fmov.l &0x0f000000,%fpsr
- mov.l &0x2,%d7
-
- mov.w &0x0000,ICCR(%a6)
- movm.l &0x7fff,IREGS(%a6)
- fmovm.x &0xff,IFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,IFPCREGS(%a6)
-
- mov.w &0x0000,%cc
-unimp_4_pc:
- fdbgt.w %d7,unimp_4_pc
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- fmovm.x &0xff,SFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,SFPCREGS(%a6)
- mov.w &0xffff,IREGS+28+2(%a6)
- mov.l &0x0f008080,IFPCREGS+0x4(%a6)
- lea unimp_4_pc(%pc),%a0
- mov.l %a0,IFPCREGS+0x8(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- bsr.l chkfpregs
- tst.b %d0
- bne.l error
-
-# ftrapcc
-unimp_5:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- fmovm.x DEF_FPREGS(%pc),&0xff
- fmovm.l DEF_FPCREGS(%pc),%fpcr,%fpsr,%fpiar
-
- fmov.l &0x0f000000,%fpsr
-
- mov.w &0x0000,ICCR(%a6)
- movm.l &0x7fff,IREGS(%a6)
- fmovm.x &0xff,IFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,IFPCREGS(%a6)
-
- mov.w &0x0000,%cc
-unimp_5_pc:
- ftpgt.l &0xabcdef01
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- fmovm.x &0xff,SFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,SFPCREGS(%a6)
- mov.l &0x0f008080,IFPCREGS+0x4(%a6)
- lea unimp_5_pc(%pc),%a0
- mov.l %a0,IFPCREGS+0x8(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- bsr.l chkfpregs
- tst.b %d0
- bne.l error
-
- clr.l %d0
- rts
-
-#############################################
-
-effadd_str:
- string "\tUnimplemented <ea>..."
-
- align 0x4
-effadd_0:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- fmovm.x DEF_FPREGS(%pc),&0xff
- fmovm.l DEF_FPCREGS(%pc),%fpcr,%fpsr,%fpiar
-
- mov.w &0x0000,ICCR(%a6)
- movm.l &0x7fff,IREGS(%a6)
- fmovm.x &0xff,IFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,IFPCREGS(%a6)
-
- fmov.b &0x2,%fp0
-
- mov.w &0x0000,%cc
-effadd_0_pc:
- fmul.x &0xc00000008000000000000000,%fp0
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- fmovm.x &0xff,SFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,SFPCREGS(%a6)
-
- mov.l &0xc0010000,IFPREGS+0x0(%a6)
- mov.l &0x80000000,IFPREGS+0x4(%a6)
- mov.l &0x00000000,IFPREGS+0x8(%a6)
- mov.l &0x08000000,IFPCREGS+0x4(%a6)
- lea effadd_0_pc(%pc),%a0
- mov.l %a0,IFPCREGS+0x8(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- bsr.l chkfpregs
- tst.b %d0
- bne.l error
-
-effadd_1:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- fmovm.x DEF_FPREGS(%pc),&0xff
- fmovm.l DEF_FPCREGS(%pc),%fpcr,%fpsr,%fpiar
-
- mov.w &0x0000,ICCR(%a6)
- movm.l &0x7fff,IREGS(%a6)
- fmovm.x &0xff,IFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,IFPCREGS(%a6)
-
- mov.w &0x0000,%cc
-effadd_1_pc:
- fabs.p &0xc12300012345678912345678,%fp0
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- fmovm.x &0xff,SFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,SFPCREGS(%a6)
-
- mov.l &0x3e660000,IFPREGS+0x0(%a6)
- mov.l &0xd0ed23e8,IFPREGS+0x4(%a6)
- mov.l &0xd14035bc,IFPREGS+0x8(%a6)
- mov.l &0x00000108,IFPCREGS+0x4(%a6)
- lea effadd_1_pc(%pc),%a0
- mov.l %a0,IFPCREGS+0x8(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- bsr.l chkfpregs
- tst.b %d0
- bne.l error
-
-fmovml_0:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- fmovm.x DEF_FPREGS(%pc),&0xff
- fmovm.l DEF_FPCREGS(%pc),%fpcr,%fpsr,%fpiar
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
- fmovm.x &0xff,IFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,IFPCREGS(%a6)
-
- fmovm.l &0xffffffffffffffff,%fpcr,%fpsr
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- fmovm.x &0xff,SFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,SFPCREGS(%a6)
- mov.l &0x0000fff0,IFPCREGS+0x0(%a6)
- mov.l &0x0ffffff8,IFPCREGS+0x4(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- bsr.l chkfpregs
- tst.b %d0
- bne.l error
-
-fmovml_1:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- fmovm.x DEF_FPREGS(%pc),&0xff
- fmovm.l DEF_FPCREGS(%pc),%fpcr,%fpsr,%fpiar
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
- fmovm.x &0xff,IFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,IFPCREGS(%a6)
-
- fmovm.l &0xffffffffffffffff,%fpcr,%fpiar
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- fmovm.x &0xff,SFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,SFPCREGS(%a6)
- mov.l &0x0000fff0,IFPCREGS+0x0(%a6)
- mov.l &0xffffffff,IFPCREGS+0x8(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- bsr.l chkfpregs
- tst.b %d0
- bne.l error
-
-fmovml_2:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- fmovm.x DEF_FPREGS(%pc),&0xff
- fmovm.l DEF_FPCREGS(%pc),%fpcr,%fpsr,%fpiar
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
- fmovm.x &0xff,IFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,IFPCREGS(%a6)
-
- fmovm.l &0xffffffffffffffff,%fpsr,%fpiar
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- fmovm.x &0xff,SFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,SFPCREGS(%a6)
- mov.l &0x0ffffff8,IFPCREGS+0x4(%a6)
- mov.l &0xffffffff,IFPCREGS+0x8(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- bsr.l chkfpregs
- tst.b %d0
- bne.l error
-
-fmovml_3:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- fmovm.x DEF_FPREGS(%pc),&0xff
- fmovm.l DEF_FPCREGS(%pc),%fpcr,%fpsr,%fpiar
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
- fmovm.x &0xff,IFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,IFPCREGS(%a6)
-
- fmovm.l &0xffffffffffffffffffffffff,%fpcr,%fpsr,%fpiar
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- fmovm.x &0xff,SFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,SFPCREGS(%a6)
- mov.l &0x0000fff0,IFPCREGS+0x0(%a6)
- mov.l &0x0ffffff8,IFPCREGS+0x4(%a6)
- mov.l &0xffffffff,IFPCREGS+0x8(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- bsr.l chkfpregs
- tst.b %d0
- bne.l error
-
-# fmovmx dynamic
-fmovmx_0:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- fmovm.x DEF_FPREGS(%pc),&0xff
- fmovm.l DEF_FPCREGS(%pc),%fpcr,%fpsr,%fpiar
-
- fmov.b &0x1,%fp0
- fmov.b &0x2,%fp1
- fmov.b &0x3,%fp2
- fmov.b &0x4,%fp3
- fmov.b &0x5,%fp4
- fmov.b &0x6,%fp5
- fmov.b &0x7,%fp6
- fmov.b &0x8,%fp7
-
- fmov.l &0x0,%fpiar
- mov.l &0xffffffaa,%d0
-
- mov.w &0x0000,ICCR(%a6)
- movm.l &0xffff,IREGS(%a6)
-
- fmovm.l %fpcr,%fpsr,%fpiar,IFPCREGS(%a6)
- fmovm.x &0xff,IFPREGS(%a6)
-
- mov.w &0x0000,%cc
-
- fmovm.x %d0,-(%sp)
-
- mov.w %cc,SCCR(%a6)
-
- fmovm.l %fpcr,%fpsr,%fpiar,SFPCREGS(%a6)
-
- fmov.s &0x7f800000,%fp1
- fmov.s &0x7f800000,%fp3
- fmov.s &0x7f800000,%fp5
- fmov.s &0x7f800000,%fp7
-
- fmov.x (%sp)+,%fp1
- fmov.x (%sp)+,%fp3
- fmov.x (%sp)+,%fp5
- fmov.x (%sp)+,%fp7
-
- movm.l &0xffff,SREGS(%a6)
- fmovm.x &0xff,SFPREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- bsr.l chkfpregs
- tst.b %d0
- bne.l error
-
-fmovmx_1:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- fmovm.x DEF_FPREGS(%pc),&0xff
- fmovm.l DEF_FPCREGS(%pc),%fpcr,%fpsr,%fpiar
-
- fmov.b &0x1,%fp0
- fmov.b &0x2,%fp1
- fmov.b &0x3,%fp2
- fmov.b &0x4,%fp3
- fmov.b &0x5,%fp4
- fmov.b &0x6,%fp5
- fmov.b &0x7,%fp6
- fmov.b &0x8,%fp7
-
- fmov.x %fp6,-(%sp)
- fmov.x %fp4,-(%sp)
- fmov.x %fp2,-(%sp)
- fmov.x %fp0,-(%sp)
-
- fmovm.x &0xff,IFPREGS(%a6)
-
- fmov.s &0x7f800000,%fp6
- fmov.s &0x7f800000,%fp4
- fmov.s &0x7f800000,%fp2
- fmov.s &0x7f800000,%fp0
-
- fmov.l &0x0,%fpiar
- fmov.l &0x0,%fpsr
- mov.l &0xffffffaa,%d0
-
- mov.w &0x0000,ICCR(%a6)
- movm.l &0xffff,IREGS(%a6)
-
- fmovm.l %fpcr,%fpsr,%fpiar,IFPCREGS(%a6)
-
- mov.w &0x0000,%cc
-
- fmovm.x (%sp)+,%d0
-
- mov.w %cc,SCCR(%a6)
-
- fmovm.l %fpcr,%fpsr,%fpiar,SFPCREGS(%a6)
-
- movm.l &0xffff,SREGS(%a6)
- fmovm.x &0xff,SFPREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- bsr.l chkfpregs
- tst.b %d0
- bne.l error
-
-fmovmx_2:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- fmovm.x DEF_FPREGS(%pc),&0xff
- fmovm.l DEF_FPCREGS(%pc),%fpcr,%fpsr,%fpiar
-
- fmov.b &0x1,%fp0
- fmov.b &0x2,%fp1
- fmov.b &0x3,%fp2
- fmov.b &0x4,%fp3
- fmov.b &0x5,%fp4
- fmov.b &0x6,%fp5
- fmov.b &0x7,%fp6
- fmov.b &0x8,%fp7
-
- fmov.l &0x0,%fpiar
- mov.l &0xffffff00,%d0
-
- mov.w &0x0000,ICCR(%a6)
- movm.l &0xffff,IREGS(%a6)
-
- fmovm.l %fpcr,%fpsr,%fpiar,IFPCREGS(%a6)
- fmovm.x &0xff,IFPREGS(%a6)
-
- mov.w &0x0000,%cc
-
- fmovm.x %d0,-(%sp)
-
- mov.w %cc,SCCR(%a6)
-
- fmovm.l %fpcr,%fpsr,%fpiar,SFPCREGS(%a6)
-
- movm.l &0xffff,SREGS(%a6)
- fmovm.x &0xff,SFPREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- bsr.l chkfpregs
- tst.b %d0
- bne.l error
-
- clr.l %d0
- rts
-
-###########################################################
-
-# This test will take a non-maskable overflow directly.
-ovfl_nm_str:
- string "\tNon-maskable overflow..."
-
- align 0x4
-ovfl_nm_0:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- fmovm.x DEF_FPREGS(%pc),&0xff
- fmovm.l DEF_FPCREGS(%pc),%fpcr,%fpsr,%fpiar
-
- mov.w &0x0000,ICCR(%a6)
- movm.l &0x7fff,IREGS(%a6)
- fmovm.x &0xff,IFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,IFPCREGS(%a6)
-
- fmov.b &0x2,%fp0
- mov.l &0x7ffe0000,DATA+0x0(%a6)
- mov.l &0x80000000,DATA+0x4(%a6)
- mov.l &0x00000000,DATA+0x8(%a6)
-
- mov.w &0x0000,%cc
-ovfl_nm_0_pc:
- fmul.x DATA(%a6),%fp0
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- fmovm.x &0xff,SFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,SFPCREGS(%a6)
-
- mov.l &0x7fff0000,IFPREGS+0x0(%a6)
- mov.l &0x00000000,IFPREGS+0x4(%a6)
- mov.l &0x00000000,IFPREGS+0x8(%a6)
- mov.l &0x02001048,IFPCREGS+0x4(%a6)
- lea ovfl_nm_0_pc(%pc),%a0
- mov.l %a0,IFPCREGS+0x8(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- bsr.l chkfpregs
- tst.b %d0
- bne.l error
-
- clr.l %d0
- rts
-
-###########################################################
-
-# This test will take an overflow directly.
-ovfl_str:
- string "\tEnabled overflow..."
-
- align 0x4
-ovfl_0:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- fmovm.x DEF_FPREGS(%pc),&0xff
- fmovm.l DEF_FPCREGS(%pc),%fpcr,%fpsr,%fpiar
-
- mov.w &0x0000,ICCR(%a6)
- movm.l &0x7fff,IREGS(%a6)
- fmovm.x &0xff,IFPREGS(%a6)
- fmov.l &0x00001000,%fpcr
- fmovm.l %fpcr,%fpsr,%fpiar,IFPCREGS(%a6)
-
- fmov.b &0x2,%fp0
- mov.l &0x7ffe0000,DATA+0x0(%a6)
- mov.l &0x80000000,DATA+0x4(%a6)
- mov.l &0x00000000,DATA+0x8(%a6)
-
- mov.w &0x0000,%cc
-ovfl_0_pc:
- fmul.x DATA(%a6),%fp0
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- fmovm.x &0xff,SFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,SFPCREGS(%a6)
-
- mov.l &0x7fff0000,IFPREGS+0x0(%a6)
- mov.l &0x00000000,IFPREGS+0x4(%a6)
- mov.l &0x00000000,IFPREGS+0x8(%a6)
- mov.l &0x02001048,IFPCREGS+0x4(%a6)
- lea ovfl_0_pc(%pc),%a0
- mov.l %a0,IFPCREGS+0x8(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- bsr.l chkfpregs
- tst.b %d0
- bne.l error
-
- clr.l %d0
- rts
-
-#####################################################################
-
-# This test will take an underflow directly.
-unfl_str:
- string "\tEnabled underflow..."
-
- align 0x4
-unfl_0:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- fmovm.x DEF_FPREGS(%pc),&0xff
- fmovm.l DEF_FPCREGS(%pc),%fpcr,%fpsr,%fpiar
-
- mov.w &0x0000,ICCR(%a6)
- movm.l &0x7fff,IREGS(%a6)
- fmovm.x &0xff,IFPREGS(%a6)
- fmov.l &0x00000800,%fpcr
- fmovm.l %fpcr,%fpsr,%fpiar,IFPCREGS(%a6)
-
- mov.l &0x00000000,DATA+0x0(%a6)
- mov.l &0x80000000,DATA+0x4(%a6)
- mov.l &0x00000000,DATA+0x8(%a6)
- fmovm.x DATA(%a6),&0x80
-
- mov.w &0x0000,%cc
-unfl_0_pc:
- fdiv.b &0x2,%fp0
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- fmovm.x &0xff,SFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,SFPCREGS(%a6)
-
- mov.l &0x00000000,IFPREGS+0x0(%a6)
- mov.l &0x40000000,IFPREGS+0x4(%a6)
- mov.l &0x00000000,IFPREGS+0x8(%a6)
- mov.l &0x00000800,IFPCREGS+0x4(%a6)
- lea unfl_0_pc(%pc),%a0
- mov.l %a0,IFPCREGS+0x8(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- bsr.l chkfpregs
- tst.b %d0
- bne.l error
-
- clr.l %d0
- rts
-
-#####################################################################
-
-# This test will take a non-maskable underflow directly.
-unfl_nm_str:
- string "\tNon-maskable underflow..."
-
- align 0x4
-unfl_nm_0:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- fmovm.x DEF_FPREGS(%pc),&0xff
- fmovm.l DEF_FPCREGS(%pc),%fpcr,%fpsr,%fpiar
-
- mov.w &0x0000,ICCR(%a6)
- movm.l &0x7fff,IREGS(%a6)
- fmovm.x &0xff,IFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,IFPCREGS(%a6)
-
- mov.l &0x00000000,DATA+0x0(%a6)
- mov.l &0x80000000,DATA+0x4(%a6)
- mov.l &0x00000000,DATA+0x8(%a6)
- fmovm.x DATA(%a6),&0x80
-
- mov.w &0x0000,%cc
-unfl_nm_0_pc:
- fdiv.b &0x2,%fp0
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- fmovm.x &0xff,SFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,SFPCREGS(%a6)
-
- mov.l &0x00000000,IFPREGS+0x0(%a6)
- mov.l &0x40000000,IFPREGS+0x4(%a6)
- mov.l &0x00000000,IFPREGS+0x8(%a6)
- mov.l &0x00000800,IFPCREGS+0x4(%a6)
- lea unfl_nm_0_pc(%pc),%a0
- mov.l %a0,IFPCREGS+0x8(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- bsr.l chkfpregs
- tst.b %d0
- bne.l error
-
- clr.l %d0
- rts
-
-#####################################################################
-
-inex_str:
- string "\tEnabled inexact..."
-
- align 0x4
-inex_0:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- fmovm.x DEF_FPREGS(%pc),&0xff
- fmovm.l DEF_FPCREGS(%pc),%fpcr,%fpsr,%fpiar
-
- mov.w &0x0000,ICCR(%a6)
- movm.l &0x7fff,IREGS(%a6)
- fmovm.x &0xff,IFPREGS(%a6)
- fmov.l &0x00000200,%fpcr # enable inexact
- fmovm.l %fpcr,%fpsr,%fpiar,IFPCREGS(%a6)
-
- mov.l &0x50000000,DATA+0x0(%a6)
- mov.l &0x80000000,DATA+0x4(%a6)
- mov.l &0x00000000,DATA+0x8(%a6)
- fmovm.x DATA(%a6),&0x80
-
- mov.w &0x0000,%cc
-inex_0_pc:
- fadd.b &0x2,%fp0
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- fmovm.x &0xff,SFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,SFPCREGS(%a6)
-
- mov.l &0x50000000,IFPREGS+0x0(%a6)
- mov.l &0x80000000,IFPREGS+0x4(%a6)
- mov.l &0x00000000,IFPREGS+0x8(%a6)
- mov.l &0x00000208,IFPCREGS+0x4(%a6)
- lea inex_0_pc(%pc),%a0
- mov.l %a0,IFPCREGS+0x8(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- bsr.l chkfpregs
- tst.b %d0
- bne.l error
-
- clr.l %d0
- rts
-
-#####################################################################
-
-snan_str:
- string "\tEnabled SNAN..."
-
- align 0x4
-snan_0:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- fmovm.x DEF_FPREGS(%pc),&0xff
- fmovm.l DEF_FPCREGS(%pc),%fpcr,%fpsr,%fpiar
-
- mov.w &0x0000,ICCR(%a6)
- movm.l &0x7fff,IREGS(%a6)
- fmovm.x &0xff,IFPREGS(%a6)
- fmov.l &0x00004000,%fpcr # enable SNAN
- fmovm.l %fpcr,%fpsr,%fpiar,IFPCREGS(%a6)
-
- mov.l &0xffff0000,DATA+0x0(%a6)
- mov.l &0x00000000,DATA+0x4(%a6)
- mov.l &0x00000001,DATA+0x8(%a6)
- fmovm.x DATA(%a6),&0x80
-
- mov.w &0x0000,%cc
-snan_0_pc:
- fadd.b &0x2,%fp0
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- fmovm.x &0xff,SFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,SFPCREGS(%a6)
-
- mov.l &0xffff0000,IFPREGS+0x0(%a6)
- mov.l &0x00000000,IFPREGS+0x4(%a6)
- mov.l &0x00000001,IFPREGS+0x8(%a6)
- mov.l &0x09004080,IFPCREGS+0x4(%a6)
- lea snan_0_pc(%pc),%a0
- mov.l %a0,IFPCREGS+0x8(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- bsr.l chkfpregs
- tst.b %d0
- bne.l error
-
- clr.l %d0
- rts
-
-#####################################################################
-
-operr_str:
- string "\tEnabled OPERR..."
-
- align 0x4
-operr_0:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- fmovm.x DEF_FPREGS(%pc),&0xff
- fmovm.l DEF_FPCREGS(%pc),%fpcr,%fpsr,%fpiar
-
- mov.w &0x0000,ICCR(%a6)
- movm.l &0x7fff,IREGS(%a6)
- fmovm.x &0xff,IFPREGS(%a6)
- fmov.l &0x00002000,%fpcr # enable OPERR
- fmovm.l %fpcr,%fpsr,%fpiar,IFPCREGS(%a6)
-
- mov.l &0xffff0000,DATA+0x0(%a6)
- mov.l &0x00000000,DATA+0x4(%a6)
- mov.l &0x00000000,DATA+0x8(%a6)
- fmovm.x DATA(%a6),&0x80
-
- mov.w &0x0000,%cc
-operr_0_pc:
- fadd.s &0x7f800000,%fp0
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- fmovm.x &0xff,SFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,SFPCREGS(%a6)
-
- mov.l &0xffff0000,IFPREGS+0x0(%a6)
- mov.l &0x00000000,IFPREGS+0x4(%a6)
- mov.l &0x00000000,IFPREGS+0x8(%a6)
- mov.l &0x01002080,IFPCREGS+0x4(%a6)
- lea operr_0_pc(%pc),%a0
- mov.l %a0,IFPCREGS+0x8(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- bsr.l chkfpregs
- tst.b %d0
- bne.l error
-
- clr.l %d0
- rts
-
-#####################################################################
-
-dz_str:
- string "\tEnabled DZ..."
-
- align 0x4
-dz_0:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- fmovm.x DEF_FPREGS(%pc),&0xff
- fmovm.l DEF_FPCREGS(%pc),%fpcr,%fpsr,%fpiar
-
- mov.w &0x0000,ICCR(%a6)
- movm.l &0x7fff,IREGS(%a6)
- fmovm.x &0xff,IFPREGS(%a6)
- fmov.l &0x00000400,%fpcr # enable DZ
- fmovm.l %fpcr,%fpsr,%fpiar,IFPCREGS(%a6)
-
- mov.l &0x40000000,DATA+0x0(%a6)
- mov.l &0x80000000,DATA+0x4(%a6)
- mov.l &0x00000000,DATA+0x8(%a6)
- fmovm.x DATA(%a6),&0x80
-
- mov.w &0x0000,%cc
-dz_0_pc:
- fdiv.b &0x0,%fp0
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- fmovm.x &0xff,SFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,SFPCREGS(%a6)
-
- mov.l &0x40000000,IFPREGS+0x0(%a6)
- mov.l &0x80000000,IFPREGS+0x4(%a6)
- mov.l &0x00000000,IFPREGS+0x8(%a6)
- mov.l &0x02000410,IFPCREGS+0x4(%a6)
- lea dz_0_pc(%pc),%a0
- mov.l %a0,IFPCREGS+0x8(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- bsr.l chkfpregs
- tst.b %d0
- bne.l error
-
- clr.l %d0
- rts
-
-#####################################################################
-
-unsupp_str:
- string "\tUnimplemented data type/format..."
-
-# an unnormalized number
- align 0x4
-unsupp_0:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- fmovm.x DEF_FPREGS(%pc),&0xff
- fmovm.l DEF_FPCREGS(%pc),%fpcr,%fpsr,%fpiar
-
- mov.w &0x0000,ICCR(%a6)
- movm.l &0x7fff,IREGS(%a6)
- fmovm.x &0xff,IFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,IFPCREGS(%a6)
-
- mov.l &0xc03f0000,DATA+0x0(%a6)
- mov.l &0x00000000,DATA+0x4(%a6)
- mov.l &0x00000001,DATA+0x8(%a6)
- fmov.b &0x2,%fp0
- mov.w &0x0000,%cc
-unsupp_0_pc:
- fmul.x DATA(%a6),%fp0
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- fmovm.x &0xff,SFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,SFPCREGS(%a6)
-
- mov.l &0xc0010000,IFPREGS+0x0(%a6)
- mov.l &0x80000000,IFPREGS+0x4(%a6)
- mov.l &0x00000000,IFPREGS+0x8(%a6)
- mov.l &0x08000000,IFPCREGS+0x4(%a6)
- lea unsupp_0_pc(%pc),%a0
- mov.l %a0,IFPCREGS+0x8(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- bsr.l chkfpregs
- tst.b %d0
- bne.l error
-
-# a denormalized number
-unsupp_1:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- fmovm.x DEF_FPREGS(%pc),&0xff
- fmovm.l DEF_FPCREGS(%pc),%fpcr,%fpsr,%fpiar
-
- mov.w &0x0000,ICCR(%a6)
- movm.l &0x7fff,IREGS(%a6)
- fmovm.x &0xff,IFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,IFPCREGS(%a6)
-
- mov.l &0x80000000,DATA+0x0(%a6)
- mov.l &0x01000000,DATA+0x4(%a6)
- mov.l &0x00000000,DATA+0x8(%a6)
- fmov.l &0x7fffffff,%fp0
-
- mov.w &0x0000,%cc
-unsupp_1_pc:
- fmul.x DATA(%a6),%fp0
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- fmovm.x &0xff,SFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,SFPCREGS(%a6)
-
- mov.l &0x80170000,IFPREGS+0x0(%a6)
- mov.l &0xfffffffe,IFPREGS+0x4(%a6)
- mov.l &0x00000000,IFPREGS+0x8(%a6)
- mov.l &0x08000000,IFPCREGS+0x4(%a6)
- lea unsupp_1_pc(%pc),%a0
- mov.l %a0,IFPCREGS+0x8(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- bsr.l chkfpregs
- tst.b %d0
- bne.l error
-
-# packed
-unsupp_2:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- fmovm.x DEF_FPREGS(%pc),&0xff
- fmovm.l DEF_FPCREGS(%pc),%fpcr,%fpsr,%fpiar
-
- mov.w &0x0000,ICCR(%a6)
- movm.l &0x7fff,IREGS(%a6)
- fmovm.x &0xff,IFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,IFPCREGS(%a6)
-
- mov.l &0xc1230001,DATA+0x0(%a6)
- mov.l &0x23456789,DATA+0x4(%a6)
- mov.l &0x12345678,DATA+0x8(%a6)
-
- mov.w &0x0000,%cc
-unsupp_2_pc:
- fabs.p DATA(%a6),%fp0
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- fmovm.x &0xff,SFPREGS(%a6)
- fmovm.l %fpcr,%fpsr,%fpiar,SFPCREGS(%a6)
-
- mov.l &0x3e660000,IFPREGS+0x0(%a6)
- mov.l &0xd0ed23e8,IFPREGS+0x4(%a6)
- mov.l &0xd14035bc,IFPREGS+0x8(%a6)
- mov.l &0x00000108,IFPCREGS+0x4(%a6)
- lea unsupp_2_pc(%pc),%a0
- mov.l %a0,IFPCREGS+0x8(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- bsr.l chkfpregs
- tst.b %d0
- bne.l error
-
- clr.l %d0
- rts
-
-###########################################################
-###########################################################
-
-chkregs:
- lea IREGS(%a6),%a0
- lea SREGS(%a6),%a1
- mov.l &14,%d0
-chkregs_loop:
- cmp.l (%a0)+,(%a1)+
- bne.l chkregs_error
- dbra.w %d0,chkregs_loop
-
- mov.w ICCR(%a6),%d0
- mov.w SCCR(%a6),%d1
- cmp.w %d0,%d1
- bne.l chkregs_error
-
- clr.l %d0
- rts
-
-chkregs_error:
- movq.l &0x1,%d0
- rts
-
-error:
- mov.l TESTCTR(%a6),%d1
- movq.l &0x1,%d0
- rts
-
-chkfpregs:
- lea IFPREGS(%a6),%a0
- lea SFPREGS(%a6),%a1
- mov.l &23,%d0
-chkfpregs_loop:
- cmp.l (%a0)+,(%a1)+
- bne.l chkfpregs_error
- dbra.w %d0,chkfpregs_loop
-
- lea IFPCREGS(%a6),%a0
- lea SFPCREGS(%a6),%a1
- cmp.l (%a0)+,(%a1)+
- bne.l chkfpregs_error
- cmp.l (%a0)+,(%a1)+
- bne.l chkfpregs_error
- cmp.l (%a0)+,(%a1)+
- bne.l chkfpregs_error
-
- clr.l %d0
- rts
-
-chkfpregs_error:
- movq.l &0x1,%d0
- rts
-
-DEF_REGS:
- long 0xacacacac, 0xacacacac, 0xacacacac, 0xacacacac
- long 0xacacacac, 0xacacacac, 0xacacacac, 0xacacacac
-
- long 0xacacacac, 0xacacacac, 0xacacacac, 0xacacacac
- long 0xacacacac, 0xacacacac, 0xacacacac, 0xacacacac
-
-DEF_FPREGS:
- long 0x7fff0000, 0xffffffff, 0xffffffff
- long 0x7fff0000, 0xffffffff, 0xffffffff
- long 0x7fff0000, 0xffffffff, 0xffffffff
- long 0x7fff0000, 0xffffffff, 0xffffffff
- long 0x7fff0000, 0xffffffff, 0xffffffff
- long 0x7fff0000, 0xffffffff, 0xffffffff
- long 0x7fff0000, 0xffffffff, 0xffffffff
- long 0x7fff0000, 0xffffffff, 0xffffffff
-
-DEF_FPCREGS:
- long 0x00000000, 0x00000000, 0x00000000
-
-############################################################
-
-_print_str:
- mov.l %d0,-(%sp)
- mov.l (TESTTOP-0x80+0x0,%pc),%d0
- pea (TESTTOP-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
-_print_num:
- mov.l %d0,-(%sp)
- mov.l (TESTTOP-0x80+0x4,%pc),%d0
- pea (TESTTOP-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
-############################################################
diff --git a/sys/arch/m68k/060sp/ftest.sa b/sys/arch/m68k/060sp/ftest.sa
deleted file mode 100644
index 61639b82b15..00000000000
--- a/sys/arch/m68k/060sp/ftest.sa
+++ /dev/null
@@ -1,409 +0,0 @@
-#
-# $OpenBSD: ftest.sa,v 1.2 1996/05/30 22:14:35 niklas Exp $
-# $NetBSD: ftest.sa,v 1.2 1996/05/15 19:48:34 is Exp $
-#
-
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-# M68000 Hi-Performance Microprocessor Division
-# M68060 Software Package Production Release
-#
-# M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
-# All rights reserved.
-#
-# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-# To the maximum extent permitted by applicable law,
-# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
-# FOR A PARTICULAR PURPOSE and any warranty against infringement with
-# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-# and any accompanying written materials.
-#
-# To the maximum extent permitted by applicable law,
-# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
-# BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
-# ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
-#
-# Motorola assumes no responsibility for the maintenance and support
-# of the SOFTWARE.
-#
-# You are hereby granted a copyright license to use, modify, and distribute the
-# SOFTWARE so long as this entire notice is retained without alteration
-# in any modified and/or redistributed versions, and that such modified
-# versions are clearly identified as such.
-# No licenses are granted by implication, estoppel or otherwise under any
-# patents or trademarks of Motorola, Inc.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- dc.l $60ff0000,$00d40000,$60ff0000,$016c0000
- dc.l $60ff0000,$01a80000,$54657374,$696e6720
- dc.l $36383036,$30204650,$53502073,$74617274
- dc.l $65643a0a,$00546573,$74696e67,$20363830
- dc.l $36302046,$50535020,$756e696d,$706c656d
- dc.l $656e7465,$6420696e,$73747275,$6374696f
- dc.l $6e207374,$61727465,$643a0a00,$54657374
- dc.l $696e6720,$36383036,$30204650,$53502065
- dc.l $78636570,$74696f6e,$20656e61,$626c6564
- dc.l $20737461,$72746564,$3a0a0070,$61737365
- dc.l $640a0020,$6661696c,$65640a00,$4a80660e
- dc.l $487affe9,$61ff0000,$1642588f,$4e752f01
- dc.l $61ff0000,$164c588f,$487affd9,$61ff0000
- dc.l $162a588f,$4e754e56,$fe8048e7,$3f3cf227
- dc.l $e0ff487a,$ff3461ff,$00001610,$588f42ae
- dc.l $fea0487b,$01700000,$058061ff,$000015fc
- dc.l $588f61ff,$00000588,$61ffffff,$ffa242ae
- dc.l $fea0487b,$01700000,$126c61ff,$000015dc
- dc.l $588f61ff,$00001280,$61ffffff,$ff8242ae
- dc.l $fea0487b,$01700000,$0b6461ff,$000015bc
- dc.l $61ff0000,$0b7261ff,$ffffff64,$42aefea0
- dc.l $487b0170,$00000de2,$61ff0000,$159e61ff
- dc.l $00000df0,$61ffffff,$ff464cdf,$3cfcf21f
- dc.l $d0ff4e5e,$4e754e56,$fe8048e7,$3f3cf227
- dc.l $e0ff487a,$feb161ff,$00001570,$588f42ae
- dc.l $fea0487b,$01700000,$00fe61ff,$0000155c
- dc.l $588f61ff,$00000110,$61ffffff,$ff024cdf
- dc.l $3cfcf21f,$d0ff4e5e,$4e754e56,$fe8048e7
- dc.l $3f3cf227,$e0ff487a,$fea461ff,$0000152c
- dc.l $588f42ae,$fea0487b,$01700000,$0f1461ff
- dc.l $00001518,$61ff0000,$0f1a61ff,$fffffec0
- dc.l $42aefea0,$487b0170,$00000fd2,$61ff0000
- dc.l $14fa61ff,$00000fd8,$61ffffff,$fea242ae
- dc.l $fea0487b,$01700000,$0b6061ff,$000014dc
- dc.l $61ff0000,$0b6a61ff,$fffffe84,$42aefea0
- dc.l $487b0170,$00000c22,$61ff0000,$14be61ff
- dc.l $00000c2c,$61ffffff,$fe6642ae,$fea0487b
- dc.l $01700000,$105661ff,$000014a0,$61ff0000
- dc.l $105a61ff,$fffffe48,$42aefea0,$487b0170
- dc.l $00000da2,$61ff0000,$148261ff,$00000da8
- dc.l $61ffffff,$fe2a4cdf,$3cfcf21f,$d0ff4e5e
- dc.l $4e750955,$6e696d70,$6c656d65,$6e746564
- dc.l $20465020,$696e7374,$72756374,$696f6e73
- dc.l $2e2e2e00,$52aefea0,$4cfb3fff,$01700000
- dc.l $1390f23b,$d0ff0170,$000013c6,$f23b9c00
- dc.l $01700000,$141c3d7c,$0000fea6,$48ee7fff
- dc.l $ff80f22e,$f0ffff20,$f22ebc00,$feb42d7c
- dc.l $40000000,$fe802d7c,$c90fdaa2,$fe842d7c
- dc.l $2168c235,$fe8844fc,$0000f22e,$480efe80
- dc.l $42eefea4,$48ee7fff,$ffc0f22e,$f0fffec0
- dc.l $f22ebc00,$fea82d7c,$bfbf0000,$ff202d7c
- dc.l $80000000,$ff242d7c,$00000000,$ff282d7c
- dc.l $08000208,$feb841fa,$ffc22d48,$febc61ff
- dc.l $00001288,$4a0066ff,$000012ae,$61ff0000
- dc.l $12b04a00,$66ff0000,$12a052ae,$fea04cfb
- dc.l $3fff0170,$000012da,$f23bd0ff,$01700000
- dc.l $1310f23b,$9c000170,$00001366,$3d7c0000
- dc.l $fea648ee,$7fffff80,$f22ef0ff,$ff20f22e
- dc.l $bc00feb4,$2d7c3ffe,$0000fe80,$2d7cc90f
- dc.l $daa2fe84,$2d7c2168,$c235fe88,$44fc0000
- dc.l $f22e480f,$fe8042ee,$fea448ee,$7fffffc0
- dc.l $f22ef0ff,$fec0f22e,$bc00fea8,$2d7c3fff
- dc.l $0000ff20,$2d7c8000,$0000ff24,$2d7c0000
- dc.l $0000ff28,$2d7c0000,$0208feb8,$41faffc2
- dc.l $2d48febc,$61ff0000,$11d24a00,$66ff0000
- dc.l $11f861ff,$000011fa,$4a0066ff,$000011ea
- dc.l $52aefea0,$4cfb3fff,$01700000,$1224f23b
- dc.l $d0ff0170,$0000125a,$f23b9c00,$01700000
- dc.l $12b03d7c,$0000fea6,$48ee7fff,$ff80f22e
- dc.l $f0ffff20,$f22ebc00,$feb444fc,$0000f200
- dc.l $5c3142ee,$fea448ee,$7fffffc0,$f22ef0ff
- dc.l $fec0f22e,$bc00fea8,$2d7c4000,$0000ff20
- dc.l $2d7c935d,$8dddff24,$2d7caaa8,$ac17ff28
- dc.l $2d7c0000,$0208feb8,$41faffc4,$2d48febc
- dc.l $61ff0000,$11364a00,$66ff0000,$115c61ff
- dc.l $0000115e,$4a0066ff,$0000114e,$52aefea0
- dc.l $4cfb3fff,$01700000,$1188f23b,$d0ff0170
- dc.l $000011be,$f23b9c00,$01700000,$1214f23c
- dc.l $88000f00,$00007e00,$3d7c0000,$fea648ee
- dc.l $7fffff80,$f22ef0ff,$ff20f22e,$bc00feb4
- dc.l $44fc0000,$f2470012,$42eefea4,$48ee7fff
- dc.l $ffc0f22e,$f0fffec0,$f22ebc00,$fea82d7c
- dc.l $0f008080,$feb841fa,$ffdc2d48,$febc61ff
- dc.l $000010a8,$4a0066ff,$000010ce,$61ff0000
- dc.l $10d04a00,$66ff0000,$10c052ae,$fea04cfb
- dc.l $3fff0170,$000010fa,$f23bd0ff,$01700000
- dc.l $1130f23b,$9c000170,$00001186,$f23c8800
- dc.l $0f000000,$7e023d7c,$0000fea6,$48ee7fff
- dc.l $ff80f22e,$f0ffff20,$f22ebc00,$feb444fc
- dc.l $0000f24f,$0012fffc,$42eefea4,$48ee7fff
- dc.l $ffc0f22e,$f0fffec0,$f22ebc00,$fea83d7c
- dc.l $ffffff9e,$2d7c0f00,$8080feb8,$41faffd4
- dc.l $2d48febc,$61ff0000,$10124a00,$66ff0000
- dc.l $103861ff,$0000103a,$4a0066ff,$0000102a
- dc.l $52aefea0,$4cfb3fff,$01700000,$1064f23b
- dc.l $d0ff0170,$0000109a,$f23b9c00,$01700000
- dc.l $10f0f23c,$88000f00,$00003d7c,$0000fea6
- dc.l $48ee7fff,$ff80f22e,$f0ffff20,$f22ebc00
- dc.l $feb444fc,$0000f27b,$0012abcd,$ef0142ee
- dc.l $fea448ee,$7fffffc0,$f22ef0ff,$fec0f22e
- dc.l $bc00fea8,$2d7c0f00,$8080feb8,$41faffd8
- dc.l $2d48febc,$61ff0000,$0f824a00,$66ff0000
- dc.l $0fa861ff,$00000faa,$4a0066ff,$00000f9a
- dc.l $42804e75,$09556e69,$6d706c65,$6d656e74
- dc.l $6564203c,$65613e2e,$2e2e0000,$52aefea0
- dc.l $4cfb3fff,$01700000,$0fb8f23b,$d0ff0170
- dc.l $00000fee,$f23b9c00,$01700000,$10443d7c
- dc.l $0000fea6,$48ee7fff,$ff80f22e,$f0ffff20
- dc.l $f22ebc00,$feb4f23c,$58000002,$44fc0000
- dc.l $f23c4823,$c0000000,$80000000,$00000000
- dc.l $42eefea4,$48ee7fff,$ffc0f22e,$f0fffec0
- dc.l $f22ebc00,$fea82d7c,$c0010000,$ff202d7c
- dc.l $80000000,$ff242d7c,$00000000,$ff282d7c
- dc.l $08000000,$feb841fa,$ffb82d48,$febc61ff
- dc.l $00000eb8,$4a0066ff,$00000ede,$61ff0000
- dc.l $0ee04a00,$66ff0000,$0ed052ae,$fea04cfb
- dc.l $3fff0170,$00000f0a,$f23bd0ff,$01700000
- dc.l $0f40f23b,$9c000170,$00000f96,$3d7c0000
- dc.l $fea648ee,$7fffff80,$f22ef0ff,$ff20f22e
- dc.l $bc00feb4,$44fc0000,$f23c4c18,$c1230001
- dc.l $23456789,$12345678,$42eefea4,$48ee7fff
- dc.l $ffc0f22e,$f0fffec0,$f22ebc00,$fea82d7c
- dc.l $3e660000,$ff202d7c,$d0ed23e8,$ff242d7c
- dc.l $d14035bc,$ff282d7c,$00000108,$feb841fa
- dc.l $ffb82d48,$febc61ff,$00000e10,$4a0066ff
- dc.l $00000e36,$61ff0000,$0e384a00,$66ff0000
- dc.l $0e2852ae,$fea04cfb,$3fff0170,$00000e62
- dc.l $f23bd0ff,$01700000,$0e98f23b,$9c000170
- dc.l $00000eee,$3d7c0000,$fea644fc,$000048ee
- dc.l $7fffff80,$f22ef0ff,$ff20f22e,$bc00feb4
- dc.l $f23c9800,$ffffffff,$ffffffff,$42eefea4
- dc.l $48ee7fff,$ffc0f22e,$f0fffec0,$f22ebc00
- dc.l $fea82d7c,$0000fff0,$feb42d7c,$0ffffff8
- dc.l $feb861ff,$00000d84,$4a0066ff,$00000daa
- dc.l $61ff0000,$0dac4a00,$66ff0000,$0d9c52ae
- dc.l $fea04cfb,$3fff0170,$00000dd6,$f23bd0ff
- dc.l $01700000,$0e0cf23b,$9c000170,$00000e62
- dc.l $3d7c0000,$fea644fc,$000048ee,$7fffff80
- dc.l $f22ef0ff,$ff20f22e,$bc00feb4,$f23c9400
- dc.l $ffffffff,$ffffffff,$42eefea4,$48ee7fff
- dc.l $ffc0f22e,$f0fffec0,$f22ebc00,$fea82d7c
- dc.l $0000fff0,$feb42d7c,$ffffffff,$febc61ff
- dc.l $00000cf8,$4a0066ff,$00000d1e,$61ff0000
- dc.l $0d204a00,$66ff0000,$0d1052ae,$fea04cfb
- dc.l $3fff0170,$00000d4a,$f23bd0ff,$01700000
- dc.l $0d80f23b,$9c000170,$00000dd6,$3d7c0000
- dc.l $fea644fc,$000048ee,$7fffff80,$f22ef0ff
- dc.l $ff20f22e,$bc00feb4,$f23c8c00,$ffffffff
- dc.l $ffffffff,$42eefea4,$48ee7fff,$ffc0f22e
- dc.l $f0fffec0,$f22ebc00,$fea82d7c,$0ffffff8
- dc.l $feb82d7c,$ffffffff,$febc61ff,$00000c6c
- dc.l $4a0066ff,$00000c92,$61ff0000,$0c944a00
- dc.l $66ff0000,$0c8452ae,$fea04cfb,$3fff0170
- dc.l $00000cbe,$f23bd0ff,$01700000,$0cf4f23b
- dc.l $9c000170,$00000d4a,$3d7c0000,$fea644fc
- dc.l $000048ee,$7fffff80,$f22ef0ff,$ff20f22e
- dc.l $bc00feb4,$f23c9c00,$ffffffff,$ffffffff
- dc.l $ffffffff,$42eefea4,$48ee7fff,$ffc0f22e
- dc.l $f0fffec0,$f22ebc00,$fea82d7c,$0000fff0
- dc.l $feb42d7c,$0ffffff8,$feb82d7c,$ffffffff
- dc.l $febc61ff,$00000bd4,$4a0066ff,$00000bfa
- dc.l $61ff0000,$0bfc4a00,$66ff0000,$0bec52ae
- dc.l $fea04cfb,$3fff0170,$00000c26,$f23bd0ff
- dc.l $01700000,$0c5cf23b,$9c000170,$00000cb2
- dc.l $f23c5800,$0001f23c,$58800002,$f23c5900
- dc.l $0003f23c,$59800004,$f23c5a00,$0005f23c
- dc.l $5a800006,$f23c5b00,$0007f23c,$5b800008
- dc.l $f23c8400,$00000000,$70aa3d7c,$0000fea6
- dc.l $48eeffff,$ff80f22e,$bc00feb4,$f22ef0ff
- dc.l $ff2044fc,$0000f227,$e80042ee,$fea4f22e
- dc.l $bc00fea8,$f23c4480,$7f800000,$f23c4580
- dc.l $7f800000,$f23c4680,$7f800000,$f23c4780
- dc.l $7f800000,$f21f4880,$f21f4980,$f21f4a80
- dc.l $f21f4b80,$48eeffff,$ffc0f22e,$f0fffec0
- dc.l $61ff0000,$0af64a00,$66ff0000,$0b1c61ff
- dc.l $00000b1e,$4a0066ff,$00000b0e,$52aefea0
- dc.l $4cfb3fff,$01700000,$0b48f23b,$d0ff0170
- dc.l $00000b7e,$f23b9c00,$01700000,$0bd4f23c
- dc.l $58000001,$f23c5880,$0002f23c,$59000003
- dc.l $f23c5980,$0004f23c,$5a000005,$f23c5a80
- dc.l $0006f23c,$5b000007,$f23c5b80,$0008f227
- dc.l $6b00f227,$6a00f227,$6900f227,$6800f22e
- dc.l $f0ffff20,$f23c4700,$7f800000,$f23c4600
- dc.l $7f800000,$f23c4500,$7f800000,$f23c4400
- dc.l $7f800000,$f23c8400,$00000000,$f23c8800
- dc.l $00000000,$70aa3d7c,$0000fea6,$48eeffff
- dc.l $ff80f22e,$bc00feb4,$44fc0000,$f21fd800
- dc.l $42eefea4,$f22ebc00,$fea848ee,$ffffffc0
- dc.l $f22ef0ff,$fec061ff,$00000a10,$4a0066ff
- dc.l $00000a36,$61ff0000,$0a384a00,$66ff0000
- dc.l $0a2852ae,$fea04cfb,$3fff0170,$00000a62
- dc.l $f23bd0ff,$01700000,$0a98f23b,$9c000170
- dc.l $00000aee,$f23c5800,$0001f23c,$58800002
- dc.l $f23c5900,$0003f23c,$59800004,$f23c5a00
- dc.l $0005f23c,$5a800006,$f23c5b00,$0007f23c
- dc.l $5b800008,$f23c8400,$00000000,$203cffff
- dc.l $ff003d7c,$0000fea6,$48eeffff,$ff80f22e
- dc.l $bc00feb4,$f22ef0ff,$ff2044fc,$0000f227
- dc.l $e80042ee,$fea4f22e,$bc00fea8,$48eeffff
- dc.l $ffc0f22e,$f0fffec0,$61ff0000,$095e4a00
- dc.l $66ff0000,$098461ff,$00000986,$4a0066ff
- dc.l $00000976,$42804e75,$094e6f6e,$2d6d6173
- dc.l $6b61626c,$65206f76,$6572666c,$6f772e2e
- dc.l $2e0051fc,$52aefea0,$4cfb3fff,$01700000
- dc.l $0990f23b,$d0ff0170,$000009c6,$f23b9c00
- dc.l $01700000,$0a1c3d7c,$0000fea6,$48ee7fff
- dc.l $ff80f22e,$f0ffff20,$f22ebc00,$feb4f23c
- dc.l $58000002,$2d7c7ffe,$0000fe80,$2d7c8000
- dc.l $0000fe84,$2d7c0000,$0000fe88,$44fc0000
- dc.l $f22e4823,$fe8042ee,$fea448ee,$7fffffc0
- dc.l $f22ef0ff,$fec0f22e,$bc00fea8,$2d7c7fff
- dc.l $0000ff20,$2d7c0000,$0000ff24,$2d7c0000
- dc.l $0000ff28,$2d7c0200,$1048feb8,$41faffc2
- dc.l $2d48febc,$61ff0000,$08824a00,$66ff0000
- dc.l $08a861ff,$000008aa,$4a0066ff,$0000089a
- dc.l $42804e75,$09456e61,$626c6564,$206f7665
- dc.l $72666c6f,$772e2e2e,$000051fc,$52aefea0
- dc.l $4cfb3fff,$01700000,$08b8f23b,$d0ff0170
- dc.l $000008ee,$f23b9c00,$01700000,$09443d7c
- dc.l $0000fea6,$48ee7fff,$ff80f22e,$f0ffff20
- dc.l $f23c9000,$00001000,$f22ebc00,$feb4f23c
- dc.l $58000002,$2d7c7ffe,$0000fe80,$2d7c8000
- dc.l $0000fe84,$2d7c0000,$0000fe88,$44fc0000
- dc.l $f22e4823,$fe8042ee,$fea448ee,$7fffffc0
- dc.l $f22ef0ff,$fec0f22e,$bc00fea8,$2d7c7fff
- dc.l $0000ff20,$2d7c0000,$0000ff24,$2d7c0000
- dc.l $0000ff28,$2d7c0200,$1048feb8,$41faffc2
- dc.l $2d48febc,$61ff0000,$07a24a00,$66ff0000
- dc.l $07c861ff,$000007ca,$4a0066ff,$000007ba
- dc.l $42804e75,$09456e61,$626c6564,$20756e64
- dc.l $6572666c,$6f772e2e,$2e0051fc,$52aefea0
- dc.l $4cfb3fff,$01700000,$07d8f23b,$d0ff0170
- dc.l $0000080e,$f23b9c00,$01700000,$08643d7c
- dc.l $0000fea6,$48ee7fff,$ff80f22e,$f0ffff20
- dc.l $f23c9000,$00000800,$f22ebc00,$feb42d7c
- dc.l $00000000,$fe802d7c,$80000000,$fe842d7c
- dc.l $00000000,$fe88f22e,$d080fe80,$44fc0000
- dc.l $f23c5820,$000242ee,$fea448ee,$7fffffc0
- dc.l $f22ef0ff,$fec0f22e,$bc00fea8,$2d7c0000
- dc.l $0000ff20,$2d7c4000,$0000ff24,$2d7c0000
- dc.l $0000ff28,$2d7c0000,$0800feb8,$41faffc2
- dc.l $2d48febc,$61ff0000,$06c24a00,$66ff0000
- dc.l $06e861ff,$000006ea,$4a0066ff,$000006da
- dc.l $42804e75,$094e6f6e,$2d6d6173,$6b61626c
- dc.l $6520756e,$64657266,$6c6f772e,$2e2e0000
- dc.l $52aefea0,$4cfb3fff,$01700000,$06f4f23b
- dc.l $d0ff0170,$0000072a,$f23b9c00,$01700000
- dc.l $07803d7c,$0000fea6,$48ee7fff,$ff80f22e
- dc.l $f0ffff20,$f22ebc00,$feb42d7c,$00000000
- dc.l $fe802d7c,$80000000,$fe842d7c,$00000000
- dc.l $fe88f22e,$d080fe80,$44fc0000,$f23c5820
- dc.l $000242ee,$fea448ee,$7fffffc0,$f22ef0ff
- dc.l $fec0f22e,$bc00fea8,$2d7c0000,$0000ff20
- dc.l $2d7c4000,$0000ff24,$2d7c0000,$0000ff28
- dc.l $2d7c0000,$0800feb8,$41faffc2,$2d48febc
- dc.l $61ff0000,$05e64a00,$66ff0000,$060c61ff
- dc.l $0000060e,$4a0066ff,$000005fe,$42804e75
- dc.l $09456e61,$626c6564,$20696e65,$78616374
- dc.l $2e2e2e00,$52aefea0,$4cfb3fff,$01700000
- dc.l $0620f23b,$d0ff0170,$00000656,$f23b9c00
- dc.l $01700000,$06ac3d7c,$0000fea6,$48ee7fff
- dc.l $ff80f22e,$f0ffff20,$f23c9000,$00000200
- dc.l $f22ebc00,$feb42d7c,$50000000,$fe802d7c
- dc.l $80000000,$fe842d7c,$00000000,$fe88f22e
- dc.l $d080fe80,$44fc0000,$f23c5822,$000242ee
- dc.l $fea448ee,$7fffffc0,$f22ef0ff,$fec0f22e
- dc.l $bc00fea8,$2d7c5000,$0000ff20,$2d7c8000
- dc.l $0000ff24,$2d7c0000,$0000ff28,$2d7c0000
- dc.l $0208feb8,$41faffc2,$2d48febc,$61ff0000
- dc.l $050a4a00,$66ff0000,$053061ff,$00000532
- dc.l $4a0066ff,$00000522,$42804e75,$09456e61
- dc.l $626c6564,$20534e41,$4e2e2e2e,$000051fc
- dc.l $52aefea0,$4cfb3fff,$01700000,$0544f23b
- dc.l $d0ff0170,$0000057a,$f23b9c00,$01700000
- dc.l $05d03d7c,$0000fea6,$48ee7fff,$ff80f22e
- dc.l $f0ffff20,$f23c9000,$00004000,$f22ebc00
- dc.l $feb42d7c,$ffff0000,$fe802d7c,$00000000
- dc.l $fe842d7c,$00000001,$fe88f22e,$d080fe80
- dc.l $44fc0000,$f23c5822,$000242ee,$fea448ee
- dc.l $7fffffc0,$f22ef0ff,$fec0f22e,$bc00fea8
- dc.l $2d7cffff,$0000ff20,$2d7c0000,$0000ff24
- dc.l $2d7c0000,$0001ff28,$2d7c0900,$4080feb8
- dc.l $41faffc2,$2d48febc,$61ff0000,$042e4a00
- dc.l $66ff0000,$045461ff,$00000456,$4a0066ff
- dc.l $00000446,$42804e75,$09456e61,$626c6564
- dc.l $204f5045,$52522e2e,$2e0051fc,$52aefea0
- dc.l $4cfb3fff,$01700000,$0468f23b,$d0ff0170
- dc.l $0000049e,$f23b9c00,$01700000,$04f43d7c
- dc.l $0000fea6,$48ee7fff,$ff80f22e,$f0ffff20
- dc.l $f23c9000,$00002000,$f22ebc00,$feb42d7c
- dc.l $ffff0000,$fe802d7c,$00000000,$fe842d7c
- dc.l $00000000,$fe88f22e,$d080fe80,$44fc0000
- dc.l $f23c4422,$7f800000,$42eefea4,$48ee7fff
- dc.l $ffc0f22e,$f0fffec0,$f22ebc00,$fea82d7c
- dc.l $ffff0000,$ff202d7c,$00000000,$ff242d7c
- dc.l $00000000,$ff282d7c,$01002080,$feb841fa
- dc.l $ffc02d48,$febc61ff,$00000350,$4a0066ff
- dc.l $00000376,$61ff0000,$03784a00,$66ff0000
- dc.l $03684280,$4e750945,$6e61626c,$65642044
- dc.l $5a2e2e2e,$000051fc,$52aefea0,$4cfb3fff
- dc.l $01700000,$038cf23b,$d0ff0170,$000003c2
- dc.l $f23b9c00,$01700000,$04183d7c,$0000fea6
- dc.l $48ee7fff,$ff80f22e,$f0ffff20,$f23c9000
- dc.l $00000400,$f22ebc00,$feb42d7c,$40000000
- dc.l $fe802d7c,$80000000,$fe842d7c,$00000000
- dc.l $fe88f22e,$d080fe80,$44fc0000,$f23c5820
- dc.l $000042ee,$fea448ee,$7fffffc0,$f22ef0ff
- dc.l $fec0f22e,$bc00fea8,$2d7c4000,$0000ff20
- dc.l $2d7c8000,$0000ff24,$2d7c0000,$0000ff28
- dc.l $2d7c0200,$0410feb8,$41faffc2,$2d48febc
- dc.l $61ff0000,$02764a00,$66ff0000,$029c61ff
- dc.l $0000029e,$4a0066ff,$0000028e,$42804e75
- dc.l $09556e69,$6d706c65,$6d656e74,$65642064
- dc.l $61746120,$74797065,$2f666f72,$6d61742e
- dc.l $2e2e0000,$52aefea0,$4cfb3fff,$01700000
- dc.l $02a0f23b,$d0ff0170,$000002d6,$f23b9c00
- dc.l $01700000,$032c3d7c,$0000fea6,$48ee7fff
- dc.l $ff80f22e,$f0ffff20,$f22ebc00,$feb42d7c
- dc.l $c03f0000,$fe802d7c,$00000000,$fe842d7c
- dc.l $00000001,$fe88f23c,$58000002,$44fc0000
- dc.l $f22e4823,$fe8042ee,$fea448ee,$7fffffc0
- dc.l $f22ef0ff,$fec0f22e,$bc00fea8,$2d7cc001
- dc.l $0000ff20,$2d7c8000,$0000ff24,$2d7c0000
- dc.l $0000ff28,$2d7c0800,$0000feb8,$41faffc2
- dc.l $2d48febc,$61ff0000,$01924a00,$66ff0000
- dc.l $01b861ff,$000001ba,$4a0066ff,$000001aa
- dc.l $52aefea0,$4cfb3fff,$01700000,$01e4f23b
- dc.l $d0ff0170,$0000021a,$f23b9c00,$01700000
- dc.l $02703d7c,$0000fea6,$48ee7fff,$ff80f22e
- dc.l $f0ffff20,$f22ebc00,$feb42d7c,$80000000
- dc.l $fe802d7c,$01000000,$fe842d7c,$00000000
- dc.l $fe88f23c,$40007fff,$ffff44fc,$0000f22e
- dc.l $4823fe80,$42eefea4,$48ee7fff,$ffc0f22e
- dc.l $f0fffec0,$f22ebc00,$fea82d7c,$80170000
- dc.l $ff202d7c,$fffffffe,$ff242d7c,$00000000
- dc.l $ff282d7c,$08000000,$feb841fa,$ffc22d48
- dc.l $febc61ff,$000000d4,$4a0066ff,$000000fa
- dc.l $61ff0000,$00fc4a00,$66ff0000,$00ec52ae
- dc.l $fea04cfb,$3fff0170,$00000126,$f23bd0ff
- dc.l $01700000,$015cf23b,$9c000170,$000001b2
- dc.l $3d7c0000,$fea648ee,$7fffff80,$f22ef0ff
- dc.l $ff20f22e,$bc00feb4,$2d7cc123,$0001fe80
- dc.l $2d7c2345,$6789fe84,$2d7c1234,$5678fe88
- dc.l $44fc0000,$f22e4c18,$fe8042ee,$fea448ee
- dc.l $7fffffc0,$f22ef0ff,$fec0f22e,$bc00fea8
- dc.l $2d7c3e66,$0000ff20,$2d7cd0ed,$23e8ff24
- dc.l $2d7cd140,$35bcff28,$2d7c0000,$0108feb8
- dc.l $41faffc2,$2d48febc,$61ff0000,$001e4a00
- dc.l $66ff0000,$004461ff,$00000046,$4a0066ff
- dc.l $00000036,$42804e75,$41eeff80,$43eeffc0
- dc.l $700eb189,$66ff0000,$001c51c8,$fff6302e
- dc.l $fea6322e,$fea4b041,$66ff0000,$00084280
- dc.l $4e757001,$4e75222e,$fea07001,$4e7541ee
- dc.l $ff2043ee,$fec07017,$b18966ff,$0000002c
- dc.l $51c8fff6,$41eefeb4,$43eefea8,$b18966ff
- dc.l $00000018,$b18966ff,$00000010,$b18966ff
- dc.l $00000008,$42804e75,$70014e75,$acacacac
- dc.l $acacacac,$acacacac,$acacacac,$acacacac
- dc.l $acacacac,$acacacac,$acacacac,$acacacac
- dc.l $acacacac,$acacacac,$acacacac,$acacacac
- dc.l $acacacac,$acacacac,$acacacac,$7fff0000
- dc.l $ffffffff,$ffffffff,$7fff0000,$ffffffff
- dc.l $ffffffff,$7fff0000,$ffffffff,$ffffffff
- dc.l $7fff0000,$ffffffff,$ffffffff,$7fff0000
- dc.l $ffffffff,$ffffffff,$7fff0000,$ffffffff
- dc.l $ffffffff,$7fff0000,$ffffffff,$ffffffff
- dc.l $7fff0000,$ffffffff,$ffffffff,$00000000
- dc.l $00000000,$00000000,$2f00203a,$e884487b
- dc.l $0930ffff,$e880202f,$00044e74,$00042f00
- dc.l $203ae872,$487b0930,$ffffe86a,$202f0004
- dc.l $4e740004,$00000000,$00000000,$00000000
diff --git a/sys/arch/m68k/060sp/ilsp.doc b/sys/arch/m68k/060sp/ilsp.doc
deleted file mode 100644
index 6eeb51328a6..00000000000
--- a/sys/arch/m68k/060sp/ilsp.doc
+++ /dev/null
@@ -1,160 +0,0 @@
-#
-# $OpenBSD: ilsp.doc,v 1.3 2007/04/10 17:47:54 miod Exp $
-# $NetBSD: ilsp.doc,v 1.2 1996/05/15 19:48:36 is Exp $
-#
-
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-# M68000 Hi-Performance Microprocessor Division
-# M68060 Software Package Production Release
-#
-# M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
-# All rights reserved.
-#
-# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-# To the maximum extent permitted by applicable law,
-# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
-# FOR A PARTICULAR PURPOSE and any warranty against infringement with
-# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-# and any accompanying written materials.
-#
-# To the maximum extent permitted by applicable law,
-# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
-# BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
-# ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
-#
-# Motorola assumes no responsibility for the maintenance and support
-# of the SOFTWARE.
-#
-# You are hereby granted a copyright license to use, modify, and distribute the
-# SOFTWARE so long as this entire notice is retained without alteration
-# in any modified and/or redistributed versions, and that such modified
-# versions are clearly identified as such.
-# No licenses are granted by implication, estoppel or otherwise under any
-# patents or trademarks of Motorola, Inc.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-68060 INTEGER SOFTWARE PACKAGE (Library version)
--------------------------------------------------
-
-The file ilsp.s contains the "Library version" of the
-68060 Integer Software Package. Routines included in this
-module can be used to emulate 64-bit divide and multiply,
-and the "cmp2" instruction. These instructions are not
-implemented in hardware on the 68060 and normally take
-exception vector #61 "Unimplemented Integer Instruction".
-
-By re-compiling a program that uses these instructions, and
-making subroutine calls in place of the unimplemented
-instructions, a program can avoid the overhead associated with
-taking the exception.
-
-Release file format:
---------------------
-The file ilsp.sa is essentially a hexadecimal image of the
-release package. This is the ONLY format which will be supported.
-The hex image was created by assembling the source code and
-then converting the resulting binary output image into an
-ASCII text file. The hexadecimal numbers are listed
-using the Motorola Assembly Syntax assembler directive "dc.l"
-(define constant longword). The file can be converted to other
-assembly syntaxes by using any word processor with a global
-search and replace function.
-
-To assist in assembling and linking this module with other modules,
-the installer should add a symbolic label to the top of the file.
-This will allow calling routines to access the entry points
-of this package.
-
-The source code ilsp.s has also been included but only for
-documentation purposes.
-
-Release file structure:
------------------------
-The file ilsp.sa contains an "Entry-Point" section and a
-code section. The ILSP has no "Call-Out" section. The first section
-is the "Entry-Point" section. In order to access a function in the
-package, a program must "bsr" or "jsr" to the location listed
-below in "68060ILSP Entry Points" that corresponds to the desired
-function. A branch instruction located at the selected entry point
-within the package will then enter the correct emulation code routine.
-
-The entry point addresses at the beginning of the package will remain
-fixed so that a program calling the routines will not have to be
-re-compiled with every new 68060ILSP release.
-
-For example, to use a 64-bit multiply instruction,
-do a "bsr" or "jsr" to the entry point defined by
-the 060ILSP entry table. A compiler generated code sequence
-for unsigned multiply could look like:
-
-# mulu.l <ea>,Dh:Dl
-# mulu.l _multiplier,%d1:%d0
-
- subq.l &0x8,%sp # make room for result on stack
- pea (%sp) # pass: result addr on stack
- mov.l %d0,-(%sp) # pass: multiplicand on stack
- mov.l _multiplier,-(%sp) # pass: multiplier on stack
- bsr.l _060LISP_TOP+0x18 # branch to multiply routine
- add.l &0xc,%sp # clear arguments from stack
- mov.l (%sp)+,%d1 # load result[63:32]
- mov.l (%sp)+,%d0 # load result[31:0]
-
-For a divide:
-
-# divu.l <ea>,Dr:Dq
-# divu.l _divisor,%d1:%d0
-
- subq.l &0x8,%sp # make room for result on stack
- pea (%sp) # pass: result addr on stack
- mov.l %d0,-(%sp) # pass: dividend hi on stack
- mov.l %d1,-(%sp) # pass: dividend hi on stack
- mov.l _divisor,-(%sp) # pass: divisor on stack
- bsr.l _060LISP_TOP+0x08 # branch to divide routine
- add.l &0xc,%sp # clear arguments from stack
- mov.l (%sp)+,%d1 # load remainder
- mov.l (%sp)+,%d0 # load quotient
-
-The library routines also return the correct condition code
-register value. If this is important, then the caller of the library
-routine must make sure that the value isn't lost while popping
-other items off of the stack.
-
-An example of using the "cmp2" instruction is as follows:
-
-# cmp2.l <ea>,Rn
-# cmp2.l _bounds,%d0
-
- pea _bounds # pass ptr to bounds
- mov.l %d0,-(%sp) # pass Rn
- bsr.l _060LSP_TOP_+0x48 # branch to "cmp2" routine
- mov.w %cc,_tmp # save off condition codes
- addq.l &0x8,%sp # clear arguments from stack
-
-Exception reporting:
---------------------
-If the instruction being emulated is a divide and the source
-operand is a zero, then the library routine, as its last
-instruction, executes an implemented divide using a zero
-source operand so that an "Integer Divide-by-Zero" exception
-will be taken. Although the exception stack frame will not
-point to the correct instruction, the user will at least be able
-to record that such an event occurred if desired.
-
-68060ILSP entry points:
------------------------
-_060ILSP_TOP:
-0x000: _060LSP__idivs64_
-0x008: _060LSP__idivu64_
-
-0x010: _060LSP__imuls64_
-0x018: _060LSP__imulu64_
-
-0x020: _060LSP__cmp2_Ab_
-0x028: _060LSP__cmp2_Aw_
-0x030: _060LSP__cmp2_Al_
-0x038: _060LSP__cmp2_Db_
-0x040: _060LSP__cmp2_Dw_
-0x048: _060LSP__cmp2_Dl_
diff --git a/sys/arch/m68k/060sp/ilsp.s b/sys/arch/m68k/060sp/ilsp.s
deleted file mode 100644
index 7c3c048e23b..00000000000
--- a/sys/arch/m68k/060sp/ilsp.s
+++ /dev/null
@@ -1,943 +0,0 @@
-#
-# $OpenBSD: ilsp.s,v 1.3 2010/05/01 08:14:26 mk Exp $
-# $NetBSD: ilsp.s,v 1.2 1996/05/15 19:48:37 is Exp $
-#
-
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-# M68000 Hi-Performance Microprocessor Division
-# M68060 Software Package Production Release
-#
-# M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
-# All rights reserved.
-#
-# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-# To the maximum extent permitted by applicable law,
-# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
-# FOR A PARTICULAR PURPOSE and any warranty against infringement with
-# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-# and any accompanying written materials.
-#
-# To the maximum extent permitted by applicable law,
-# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
-# BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
-# ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
-#
-# Motorola assumes no responsibility for the maintenance and support
-# of the SOFTWARE.
-#
-# You are hereby granted a copyright license to use, modify, and distribute the
-# SOFTWARE so long as this entire notice is retained without alteration
-# in any modified and/or redistributed versions, and that such modified
-# versions are clearly identified as such.
-# No licenses are granted by implication, estoppel or otherwise under any
-# patents or trademarks of Motorola, Inc.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-#
-# litop.s:
-# This file is appended to the top of the 060FPLSP package
-# and contains the entry points into the package. The user, in
-# effect, branches to one of the branch table entries located here.
-#
-
- bra.l _060LSP__idivs64_
- short 0x0000
- bra.l _060LSP__idivu64_
- short 0x0000
-
- bra.l _060LSP__imuls64_
- short 0x0000
- bra.l _060LSP__imulu64_
- short 0x0000
-
- bra.l _060LSP__cmp2_Ab_
- short 0x0000
- bra.l _060LSP__cmp2_Aw_
- short 0x0000
- bra.l _060LSP__cmp2_Al_
- short 0x0000
- bra.l _060LSP__cmp2_Db_
- short 0x0000
- bra.l _060LSP__cmp2_Dw_
- short 0x0000
- bra.l _060LSP__cmp2_Dl_
- short 0x0000
-
-# leave room for future possible aditions.
- align 0x200
-
-#########################################################################
-# XDEF **************************************************************** #
-# _060LSP__idivu64_(): Emulate 64-bit unsigned div instruction. #
-# _060LSP__idivs64_(): Emulate 64-bit signed div instruction. #
-# #
-# This is the library version which is accessed as a subroutine #
-# and therefore does not work exactly like the 680X0 div{s,u}.l #
-# 64-bit divide instruction. #
-# #
-# XREF **************************************************************** #
-# None. #
-# #
-# INPUT *************************************************************** #
-# 0x4(sp) = divisor #
-# 0x8(sp) = hi(dividend) #
-# 0xc(sp) = lo(dividend) #
-# 0x10(sp) = pointer to location to place quotient/remainder #
-# #
-# OUTPUT ************************************************************** #
-# 0x10(sp) = points to location of remainder/quotient. #
-# remainder is in first longword, quotient is in 2nd. #
-# #
-# ALGORITHM *********************************************************** #
-# If the operands are signed, make them unsigned and save the #
-# sign info for later. Separate out special cases like divide-by-zero #
-# or 32-bit divides if possible. Else, use a special math algorithm #
-# to calculate the result. #
-# Restore sign info if signed instruction. Set the condition #
-# codes before performing the final "rts". If the divisor was equal to #
-# zero, then perform a divide-by-zero using a 16-bit implemented #
-# divide instruction. This way, the operating system can record that #
-# the event occurred even though it may not point to the correct place. #
-# #
-#########################################################################
-
-set POSNEG, -1
-set NDIVISOR, -2
-set NDIVIDEND, -3
-set DDSECOND, -4
-set DDNORMAL, -8
-set DDQUOTIENT, -12
-set DIV64_CC, -16
-
-##########
-# divs.l #
-##########
- global _060LSP__idivs64_
-_060LSP__idivs64_:
-# PROLOGUE BEGIN ########################################################
- link.w %a6,&-16
- movm.l &0x3f00,-(%sp) # save d2-d7
-# fmovm.l &0x0,-(%sp) # save no fpregs
-# PROLOGUE END ##########################################################
-
- mov.w %cc,DIV64_CC(%a6)
- st POSNEG(%a6) # signed operation
- bra.b ldiv64_cont
-
-##########
-# divu.l #
-##########
- global _060LSP__idivu64_
-_060LSP__idivu64_:
-# PROLOGUE BEGIN ########################################################
- link.w %a6,&-16
- movm.l &0x3f00,-(%sp) # save d2-d7
-# fmovm.l &0x0,-(%sp) # save no fpregs
-# PROLOGUE END ##########################################################
-
- mov.w %cc,DIV64_CC(%a6)
- sf POSNEG(%a6) # unsigned operation
-
-ldiv64_cont:
- mov.l 0x8(%a6),%d7 # fetch divisor
-
- beq.w ldiv64eq0 # divisor is = 0!!!
-
- mov.l 0xc(%a6), %d5 # get dividend hi
- mov.l 0x10(%a6), %d6 # get dividend lo
-
-# separate signed and unsigned divide
- tst.b POSNEG(%a6) # signed or unsigned?
- beq.b ldspecialcases # use positive divide
-
-# save the sign of the divisor
-# make divisor unsigned if it's negative
- tst.l %d7 # chk sign of divisor
- slt NDIVISOR(%a6) # save sign of divisor
- bpl.b ldsgndividend
- neg.l %d7 # complement negative divisor
-
-# save the sign of the dividend
-# make dividend unsigned if it's negative
-ldsgndividend:
- tst.l %d5 # chk sign of hi(dividend)
- slt NDIVIDEND(%a6) # save sign of dividend
- bpl.b ldspecialcases
-
- mov.w &0x0, %cc # clear 'X' cc bit
- negx.l %d6 # complement signed dividend
- negx.l %d5
-
-# extract some special cases:
-# - is (dividend == 0) ?
-# - is (hi(dividend) == 0 && (divisor <= lo(dividend))) ? (32-bit div)
-ldspecialcases:
- tst.l %d5 # is (hi(dividend) == 0)
- bne.b ldnormaldivide # no, so try it the long way
-
- tst.l %d6 # is (lo(dividend) == 0), too
- beq.w lddone # yes, so (dividend == 0)
-
- cmp.l %d7,%d6 # is (divisor <= lo(dividend))
- bls.b ld32bitdivide # yes, so use 32 bit divide
-
- exg %d5,%d6 # q = 0, r = dividend
- bra.w ldivfinish # can't divide, we're done.
-
-ld32bitdivide:
- tdivu.l %d7, %d5:%d6 # it's only a 32/32 bit div!
-
- bra.b ldivfinish
-
-ldnormaldivide:
-# last special case:
-# - is hi(dividend) >= divisor ? if yes, then overflow
- cmp.l %d7,%d5
- bls.b lddovf # answer won't fit in 32 bits
-
-# perform the divide algorithm:
- bsr.l ldclassical # do int divide
-
-# separate into signed and unsigned finishes.
-ldivfinish:
- tst.b POSNEG(%a6) # do divs, divu separately
- beq.b lddone # divu has no processing!!!
-
-# it was a divs.l, so ccode setting is a little more complicated...
- tst.b NDIVIDEND(%a6) # remainder has same sign
- beq.b ldcc # as dividend.
- neg.l %d5 # sgn(rem) = sgn(dividend)
-ldcc:
- mov.b NDIVISOR(%a6), %d0
- eor.b %d0, NDIVIDEND(%a6) # chk if quotient is negative
- beq.b ldqpos # branch to quot positive
-
-# 0x80000000 is the largest number representable as a 32-bit negative
-# number. the negative of 0x80000000 is 0x80000000.
- cmpi.l %d6, &0x80000000 # will (-quot) fit in 32 bits?
- bhi.b lddovf
-
- neg.l %d6 # make (-quot) 2's comp
-
- bra.b lddone
-
-ldqpos:
- btst &0x1f, %d6 # will (+quot) fit in 32 bits?
- bne.b lddovf
-
-lddone:
-# if the register numbers are the same, only the quotient gets saved.
-# so, if we always save the quotient second, we save ourselves a cmp&beq
- andi.w &0x10,DIV64_CC(%a6)
- mov.w DIV64_CC(%a6),%cc
- tst.l %d6 # may set 'N' ccode bit
-
-# here, the result is in d1 and d0. the current strategy is to save
-# the values at the location pointed to by a0.
-# use movm here to not disturb the condition codes.
-ldexit:
- movm.l &0x0060,([0x14,%a6]) # save result
-
-# EPILOGUE BEGIN ########################################################
-# fmovm.l (%sp)+,&0x0 # restore no fpregs
- movm.l (%sp)+,&0x00fc # restore d2-d7
- unlk %a6
-# EPILOGUE END ##########################################################
-
- rts
-
-# the result should be the unchanged dividend
-lddovf:
- mov.l 0xc(%a6), %d5 # get dividend hi
- mov.l 0x10(%a6), %d6 # get dividend lo
-
- andi.w &0x1c,DIV64_CC(%a6)
- ori.w &0x02,DIV64_CC(%a6) # set 'V' ccode bit
- mov.w DIV64_CC(%a6),%cc
-
- bra.b ldexit
-
-ldiv64eq0:
- mov.l 0xc(%a6),([0x14,%a6])
- mov.l 0x10(%a6),([0x14,%a6],0x4)
-
- mov.w DIV64_CC(%a6),%cc
-
-# EPILOGUE BEGIN ########################################################
-# fmovm.l (%sp)+,&0x0 # restore no fpregs
- movm.l (%sp)+,&0x00fc # restore d2-d7
- unlk %a6
-# EPILOGUE END ##########################################################
-
- divu.w &0x0,%d0 # force a divbyzero exception
- rts
-
-###########################################################################
-#########################################################################
-# This routine uses the 'classical' Algorithm D from Donald Knuth's #
-# Art of Computer Programming, vol II, Seminumerical Algorithms. #
-# For this implementation b=2**16, and the target is U1U2U3U4/V1V2, #
-# where U,V are words of the quadword dividend and longword divisor, #
-# and U1, V1 are the most significant words. #
-# #
-# The most sig. longword of the 64 bit dividend must be in %d5, least #
-# in %d6. The divisor must be in the variable ddivisor, and the #
-# signed/unsigned flag ddusign must be set (0=unsigned,1=signed). #
-# The quotient is returned in %d6, remainder in %d5, unless the #
-# v (overflow) bit is set in the saved %ccr. If overflow, the dividend #
-# is unchanged. #
-#########################################################################
-ldclassical:
-# if the divisor msw is 0, use simpler algorithm then the full blown
-# one at ddknuth:
-
- cmpi.l %d7, &0xffff
- bhi.b lddknuth # go use D. Knuth algorithm
-
-# Since the divisor is only a word (and larger than the mslw of the dividend),
-# a simpler algorithm may be used :
-# In the general case, four quotient words would be created by
-# dividing the divisor word into each dividend word. In this case,
-# the first two quotient words must be zero, or overflow would occur.
-# Since we already checked this case above, we can treat the most significant
-# longword of the dividend as (0) remainder (see Knuth) and merely complete
-# the last two divisions to get a quotient longword and word remainder:
-
- clr.l %d1
- swap %d5 # same as r*b if previous step rqd
- swap %d6 # get u3 to lsw position
- mov.w %d6, %d5 # rb + u3
-
- divu.w %d7, %d5
-
- mov.w %d5, %d1 # first quotient word
- swap %d6 # get u4
- mov.w %d6, %d5 # rb + u4
-
- divu.w %d7, %d5
-
- swap %d1
- mov.w %d5, %d1 # 2nd quotient 'digit'
- clr.w %d5
- swap %d5 # now remainder
- mov.l %d1, %d6 # and quotient
-
- rts
-
-lddknuth:
-# In this algorithm, the divisor is treated as a 2 digit (word) number
-# which is divided into a 3 digit (word) dividend to get one quotient
-# digit (word). After subtraction, the dividend is shifted and the
-# process repeated. Before beginning, the divisor and quotient are
-# 'normalized' so that the process of estimating the quotient digit
-# will yield verifiably correct results..
-
- clr.l DDNORMAL(%a6) # count of shifts for normalization
- clr.b DDSECOND(%a6) # clear flag for quotient digits
- clr.l %d1 # %d1 will hold trial quotient
-lddnchk:
- btst &31, %d7 # must we normalize? first word of
- bne.b lddnormalized # divisor (V1) must be >= 65536/2
- addq.l &0x1, DDNORMAL(%a6) # count normalization shifts
- lsl.l &0x1, %d7 # shift the divisor
- lsl.l &0x1, %d6 # shift u4,u3 with overflow to u2
- roxl.l &0x1, %d5 # shift u1,u2
- bra.w lddnchk
-lddnormalized:
-
-# Now calculate an estimate of the quotient words (msw first, then lsw).
-# The comments use subscripts for the first quotient digit determination.
- mov.l %d7, %d3 # divisor
- mov.l %d5, %d2 # dividend mslw
- swap %d2
- swap %d3
- cmp.w %d2, %d3 # V1 = U1 ?
- bne.b lddqcalc1
- mov.w &0xffff, %d1 # use max trial quotient word
- bra.b lddadj0
-lddqcalc1:
- mov.l %d5, %d1
-
- divu.w %d3, %d1 # use quotient of mslw/msw
-
- andi.l &0x0000ffff, %d1 # zero any remainder
-lddadj0:
-
-# now test the trial quotient and adjust. This step plus the
-# normalization assures (according to Knuth) that the trial
-# quotient will be at worst 1 too large.
- mov.l %d6, -(%sp)
- clr.w %d6 # word u3 left
- swap %d6 # in lsw position
-lddadj1: mov.l %d7, %d3
- mov.l %d1, %d2
- mulu.w %d7, %d2 # V2q
- swap %d3
- mulu.w %d1, %d3 # V1q
- mov.l %d5, %d4 # U1U2
- sub.l %d3, %d4 # U1U2 - V1q
-
- swap %d4
-
- mov.w %d4,%d0
- mov.w %d6,%d4 # insert lower word (U3)
-
- tst.w %d0 # is upper word set?
- bne.w lddadjd1
-
-# add.l %d6, %d4 # (U1U2 - V1q) + U3
-
- cmp.l %d2, %d4
- bls.b lddadjd1 # is V2q > (U1U2-V1q) + U3 ?
- subq.l &0x1, %d1 # yes, decrement and recheck
- bra.b lddadj1
-lddadjd1:
-# now test the word by multiplying it by the divisor (V1V2) and comparing
-# the 3 digit (word) result with the current dividend words
- mov.l %d5, -(%sp) # save %d5 (%d6 already saved)
- mov.l %d1, %d6
- swap %d6 # shift answer to ms 3 words
- mov.l %d7, %d5
- bsr.l ldmm2
- mov.l %d5, %d2 # now %d2,%d3 are trial*divisor
- mov.l %d6, %d3
- mov.l (%sp)+, %d5 # restore dividend
- mov.l (%sp)+, %d6
- sub.l %d3, %d6
- subx.l %d2, %d5 # subtract double precision
- bcc ldd2nd # no carry, do next quotient digit
- subq.l &0x1, %d1 # q is one too large
-# need to add back divisor longword to current ms 3 digits of dividend
-# - according to Knuth, this is done only 2 out of 65536 times for random
-# divisor, dividend selection.
- clr.l %d2
- mov.l %d7, %d3
- swap %d3
- clr.w %d3 # %d3 now ls word of divisor
- add.l %d3, %d6 # aligned with 3rd word of dividend
- addx.l %d2, %d5
- mov.l %d7, %d3
- clr.w %d3 # %d3 now ms word of divisor
- swap %d3 # aligned with 2nd word of dividend
- add.l %d3, %d5
-ldd2nd:
- tst.b DDSECOND(%a6) # both q words done?
- bne.b lddremain
-# first quotient digit now correct. store digit and shift the
-# (subtracted) dividend
- mov.w %d1, DDQUOTIENT(%a6)
- clr.l %d1
- swap %d5
- swap %d6
- mov.w %d6, %d5
- clr.w %d6
- st DDSECOND(%a6) # second digit
- bra.w lddnormalized
-lddremain:
-# add 2nd word to quotient, get the remainder.
- mov.w %d1, DDQUOTIENT+2(%a6)
-# shift down one word/digit to renormalize remainder.
- mov.w %d5, %d6
- swap %d6
- swap %d5
- mov.l DDNORMAL(%a6), %d7 # get norm shift count
- beq.b lddrn
- subq.l &0x1, %d7 # set for loop count
-lddnlp:
- lsr.l &0x1, %d5 # shift into %d6
- roxr.l &0x1, %d6
- dbf %d7, lddnlp
-lddrn:
- mov.l %d6, %d5 # remainder
- mov.l DDQUOTIENT(%a6), %d6 # quotient
-
- rts
-ldmm2:
-# factors for the 32X32->64 multiplication are in %d5 and %d6.
-# returns 64 bit result in %d5 (hi) %d6(lo).
-# destroys %d2,%d3,%d4.
-
-# multiply hi,lo words of each factor to get 4 intermediate products
- mov.l %d6, %d2
- mov.l %d6, %d3
- mov.l %d5, %d4
- swap %d3
- swap %d4
- mulu.w %d5, %d6 # %d6 <- lsw*lsw
- mulu.w %d3, %d5 # %d5 <- msw-dest*lsw-source
- mulu.w %d4, %d2 # %d2 <- msw-source*lsw-dest
- mulu.w %d4, %d3 # %d3 <- msw*msw
-# now use swap and addx to consolidate to two longwords
- clr.l %d4
- swap %d6
- add.w %d5, %d6 # add msw of l*l to lsw of m*l product
- addx.w %d4, %d3 # add any carry to m*m product
- add.w %d2, %d6 # add in lsw of other m*l product
- addx.w %d4, %d3 # add any carry to m*m product
- swap %d6 # %d6 is low 32 bits of final product
- clr.w %d5
- clr.w %d2 # lsw of two mixed products used,
- swap %d5 # now use msws of longwords
- swap %d2
- add.l %d2, %d5
- add.l %d3, %d5 # %d5 now ms 32 bits of final product
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# _060LSP__imulu64_(): Emulate 64-bit unsigned mul instruction #
-# _060LSP__imuls64_(): Emulate 64-bit signed mul instruction. #
-# #
-# This is the library version which is accessed as a subroutine #
-# and therefore does not work exactly like the 680X0 mul{s,u}.l #
-# 64-bit multiply instruction. #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# 0x4(sp) = multiplier #
-# 0x8(sp) = multiplicand #
-# 0xc(sp) = pointer to location to place 64-bit result #
-# #
-# OUTPUT ************************************************************** #
-# 0xc(sp) = points to location of 64-bit result #
-# #
-# ALGORITHM *********************************************************** #
-# Perform the multiply in pieces using 16x16->32 unsigned #
-# multiplies and "add" instructions. #
-# Set the condition codes as appropriate before performing an #
-# "rts". #
-# #
-#########################################################################
-
-set MUL64_CC, -4
-
- global _060LSP__imulu64_
-_060LSP__imulu64_:
-
-# PROLOGUE BEGIN ########################################################
- link.w %a6,&-4
- movm.l &0x3800,-(%sp) # save d2-d4
-# fmovm.l &0x0,-(%sp) # save no fpregs
-# PROLOGUE END ##########################################################
-
- mov.w %cc,MUL64_CC(%a6) # save incoming ccodes
-
- mov.l 0x8(%a6),%d0 # store multiplier in d0
- beq.w mulu64_zero # handle zero separately
-
- mov.l 0xc(%a6),%d1 # get multiplicand in d1
- beq.w mulu64_zero # handle zero separately
-
-#########################################################################
-# 63 32 0 #
-# ---------------------------- #
-# | hi(mplier) * hi(mplicand)| #
-# ---------------------------- #
-# ----------------------------- #
-# | hi(mplier) * lo(mplicand) | #
-# ----------------------------- #
-# ----------------------------- #
-# | lo(mplier) * hi(mplicand) | #
-# ----------------------------- #
-# | ----------------------------- #
-# --|-- | lo(mplier) * lo(mplicand) | #
-# | ----------------------------- #
-# ======================================================== #
-# -------------------------------------------------------- #
-# | hi(result) | lo(result) | #
-# -------------------------------------------------------- #
-#########################################################################
-mulu64_alg:
-# load temp registers with operands
- mov.l %d0,%d2 # mr in d2
- mov.l %d0,%d3 # mr in d3
- mov.l %d1,%d4 # md in d4
- swap %d3 # hi(mr) in lo d3
- swap %d4 # hi(md) in lo d4
-
-# complete necessary multiplies:
- mulu.w %d1,%d0 # [1] lo(mr) * lo(md)
- mulu.w %d3,%d1 # [2] hi(mr) * lo(md)
- mulu.w %d4,%d2 # [3] lo(mr) * hi(md)
- mulu.w %d4,%d3 # [4] hi(mr) * hi(md)
-
-# add lo portions of [2],[3] to hi portion of [1].
-# add carries produced from these adds to [4].
-# lo([1]) is the final lo 16 bits of the result.
- clr.l %d4 # load d4 w/ zero value
- swap %d0 # hi([1]) <==> lo([1])
- add.w %d1,%d0 # hi([1]) + lo([2])
- addx.l %d4,%d3 # [4] + carry
- add.w %d2,%d0 # hi([1]) + lo([3])
- addx.l %d4,%d3 # [4] + carry
- swap %d0 # lo([1]) <==> hi([1])
-
-# lo portions of [2],[3] have been added in to final result.
-# now, clear lo, put hi in lo reg, and add to [4]
- clr.w %d1 # clear lo([2])
- clr.w %d2 # clear hi([3])
- swap %d1 # hi([2]) in lo d1
- swap %d2 # hi([3]) in lo d2
- add.l %d2,%d1 # [4] + hi([2])
- add.l %d3,%d1 # [4] + hi([3])
-
-# now, grab the condition codes. only one that can be set is 'N'.
-# 'N' CAN be set if the operation is unsigned if bit 63 is set.
- mov.w MUL64_CC(%a6),%d4
- andi.b &0x10,%d4 # keep old 'X' bit
- tst.l %d1 # may set 'N' bit
- bpl.b mulu64_ddone
- ori.b &0x8,%d4 # set 'N' bit
-mulu64_ddone:
- mov.w %d4,%cc
-
-# here, the result is in d1 and d0. the current strategy is to save
-# the values at the location pointed to by a0.
-# use movm here to not disturb the condition codes.
-mulu64_end:
- exg %d1,%d0
- movm.l &0x0003,([0x10,%a6]) # save result
-
-# EPILOGUE BEGIN ########################################################
-# fmovm.l (%sp)+,&0x0 # restore no fpregs
- movm.l (%sp)+,&0x001c # restore d2-d4
- unlk %a6
-# EPILOGUE END ##########################################################
-
- rts
-
-# one or both of the operands is zero so the result is also zero.
-# save the zero result to the register file and set the 'Z' ccode bit.
-mulu64_zero:
- clr.l %d0
- clr.l %d1
-
- mov.w MUL64_CC(%a6),%d4
- andi.b &0x10,%d4
- ori.b &0x4,%d4
- mov.w %d4,%cc # set 'Z' ccode bit
-
- bra.b mulu64_end
-
-##########
-# muls.l #
-##########
- global _060LSP__imuls64_
-_060LSP__imuls64_:
-
-# PROLOGUE BEGIN ########################################################
- link.w %a6,&-4
- movm.l &0x3c00,-(%sp) # save d2-d5
-# fmovm.l &0x0,-(%sp) # save no fpregs
-# PROLOGUE END ##########################################################
-
- mov.w %cc,MUL64_CC(%a6) # save incoming ccodes
-
- mov.l 0x8(%a6),%d0 # store multiplier in d0
- beq.b mulu64_zero # handle zero separately
-
- mov.l 0xc(%a6),%d1 # get multiplicand in d1
- beq.b mulu64_zero # handle zero separately
-
- clr.b %d5 # clear sign tag
- tst.l %d0 # is multiplier negative?
- bge.b muls64_chk_md_sgn # no
- neg.l %d0 # make multiplier positive
-
- ori.b &0x1,%d5 # save multiplier sgn
-
-# the result sign is the exclusive or of the operand sign bits.
-muls64_chk_md_sgn:
- tst.l %d1 # is multiplicand negative?
- bge.b muls64_alg # no
- neg.l %d1 # make multiplicand positive
-
- eori.b &0x1,%d5 # calculate correct sign
-
-#########################################################################
-# 63 32 0 #
-# ---------------------------- #
-# | hi(mplier) * hi(mplicand)| #
-# ---------------------------- #
-# ----------------------------- #
-# | hi(mplier) * lo(mplicand) | #
-# ----------------------------- #
-# ----------------------------- #
-# | lo(mplier) * hi(mplicand) | #
-# ----------------------------- #
-# | ----------------------------- #
-# --|-- | lo(mplier) * lo(mplicand) | #
-# | ----------------------------- #
-# ======================================================== #
-# -------------------------------------------------------- #
-# | hi(result) | lo(result) | #
-# -------------------------------------------------------- #
-#########################################################################
-muls64_alg:
-# load temp registers with operands
- mov.l %d0,%d2 # mr in d2
- mov.l %d0,%d3 # mr in d3
- mov.l %d1,%d4 # md in d4
- swap %d3 # hi(mr) in lo d3
- swap %d4 # hi(md) in lo d4
-
-# complete necessary multiplies:
- mulu.w %d1,%d0 # [1] lo(mr) * lo(md)
- mulu.w %d3,%d1 # [2] hi(mr) * lo(md)
- mulu.w %d4,%d2 # [3] lo(mr) * hi(md)
- mulu.w %d4,%d3 # [4] hi(mr) * hi(md)
-
-# add lo portions of [2],[3] to hi portion of [1].
-# add carries produced from these adds to [4].
-# lo([1]) is the final lo 16 bits of the result.
- clr.l %d4 # load d4 w/ zero value
- swap %d0 # hi([1]) <==> lo([1])
- add.w %d1,%d0 # hi([1]) + lo([2])
- addx.l %d4,%d3 # [4] + carry
- add.w %d2,%d0 # hi([1]) + lo([3])
- addx.l %d4,%d3 # [4] + carry
- swap %d0 # lo([1]) <==> hi([1])
-
-# lo portions of [2],[3] have been added in to final result.
-# now, clear lo, put hi in lo reg, and add to [4]
- clr.w %d1 # clear lo([2])
- clr.w %d2 # clear hi([3])
- swap %d1 # hi([2]) in lo d1
- swap %d2 # hi([3]) in lo d2
- add.l %d2,%d1 # [4] + hi([2])
- add.l %d3,%d1 # [4] + hi([3])
-
- tst.b %d5 # should result be signed?
- beq.b muls64_done # no
-
-# result should be a signed negative number.
-# compute 2's complement of the unsigned number:
-# -negate all bits and add 1
-muls64_neg:
- not.l %d0 # negate lo(result) bits
- not.l %d1 # negate hi(result) bits
- addq.l &1,%d0 # add 1 to lo(result)
- addx.l %d4,%d1 # add carry to hi(result)
-
-muls64_done:
- mov.w MUL64_CC(%a6),%d4
- andi.b &0x10,%d4 # keep old 'X' bit
- tst.l %d1 # may set 'N' bit
- bpl.b muls64_ddone
- ori.b &0x8,%d4 # set 'N' bit
-muls64_ddone:
- mov.w %d4,%cc
-
-# here, the result is in d1 and d0. the current strategy is to save
-# the values at the location pointed to by a0.
-# use movm here to not disturb the condition codes.
-muls64_end:
- exg %d1,%d0
- movm.l &0x0003,([0x10,%a6]) # save result at (a0)
-
-# EPILOGUE BEGIN ########################################################
-# fmovm.l (%sp)+,&0x0 # restore no fpregs
- movm.l (%sp)+,&0x003c # restore d2-d5
- unlk %a6
-# EPILOGUE END ##########################################################
-
- rts
-
-# one or both of the operands is zero so the result is also zero.
-# save the zero result to the register file and set the 'Z' ccode bit.
-muls64_zero:
- clr.l %d0
- clr.l %d1
-
- mov.w MUL64_CC(%a6),%d4
- andi.b &0x10,%d4
- ori.b &0x4,%d4
- mov.w %d4,%cc # set 'Z' ccode bit
-
- bra.b muls64_end
-
-#########################################################################
-# XDEF **************************************************************** #
-# _060LSP__cmp2_Ab_(): Emulate "cmp2.b An,<ea>". #
-# _060LSP__cmp2_Aw_(): Emulate "cmp2.w An,<ea>". #
-# _060LSP__cmp2_Al_(): Emulate "cmp2.l An,<ea>". #
-# _060LSP__cmp2_Db_(): Emulate "cmp2.b Dn,<ea>". #
-# _060LSP__cmp2_Dw_(): Emulate "cmp2.w Dn,<ea>". #
-# _060LSP__cmp2_Dl_(): Emulate "cmp2.l Dn,<ea>". #
-# #
-# This is the library version which is accessed as a subroutine #
-# and therefore does not work exactly like the 680X0 "cmp2" #
-# instruction. #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# 0x4(sp) = Rn #
-# 0x8(sp) = pointer to boundary pair #
-# #
-# OUTPUT ************************************************************** #
-# cc = condition codes are set correctly #
-# #
-# ALGORITHM *********************************************************** #
-# In the interest of simplicity, all operands are converted to #
-# longword size whether the operation is byte, word, or long. The #
-# bounds are sign extended accordingly. If Rn is a data regsiter, Rn is #
-# also sign extended. If Rn is an address register, it need not be sign #
-# extended since the full register is always used. #
-# The condition codes are set correctly before the final "rts". #
-# #
-#########################################################################
-
-set CMP2_CC, -4
-
- global _060LSP__cmp2_Ab_
-_060LSP__cmp2_Ab_:
-
-# PROLOGUE BEGIN ########################################################
- link.w %a6,&-4
- movm.l &0x3800,-(%sp) # save d2-d4
-# fmovm.l &0x0,-(%sp) # save no fpregs
-# PROLOGUE END ##########################################################
-
- mov.w %cc,CMP2_CC(%a6)
- mov.l 0x8(%a6), %d2 # get regval
-
- mov.b ([0xc,%a6],0x0),%d0
- mov.b ([0xc,%a6],0x1),%d1
-
- extb.l %d0 # sign extend lo bnd
- extb.l %d1 # sign extend hi bnd
- bra.w l_cmp2_cmp # go do the compare emulation
-
- global _060LSP__cmp2_Aw_
-_060LSP__cmp2_Aw_:
-
-# PROLOGUE BEGIN ########################################################
- link.w %a6,&-4
- movm.l &0x3800,-(%sp) # save d2-d4
-# fmovm.l &0x0,-(%sp) # save no fpregs
-# PROLOGUE END ##########################################################
-
- mov.w %cc,CMP2_CC(%a6)
- mov.l 0x8(%a6), %d2 # get regval
-
- mov.w ([0xc,%a6],0x0),%d0
- mov.w ([0xc,%a6],0x2),%d1
-
- ext.l %d0 # sign extend lo bnd
- ext.l %d1 # sign extend hi bnd
- bra.w l_cmp2_cmp # go do the compare emulation
-
- global _060LSP__cmp2_Al_
-_060LSP__cmp2_Al_:
-
-# PROLOGUE BEGIN ########################################################
- link.w %a6,&-4
- movm.l &0x3800,-(%sp) # save d2-d4
-# fmovm.l &0x0,-(%sp) # save no fpregs
-# PROLOGUE END ##########################################################
-
- mov.w %cc,CMP2_CC(%a6)
- mov.l 0x8(%a6), %d2 # get regval
-
- mov.l ([0xc,%a6],0x0),%d0
- mov.l ([0xc,%a6],0x4),%d1
- bra.w l_cmp2_cmp # go do the compare emulation
-
- global _060LSP__cmp2_Db_
-_060LSP__cmp2_Db_:
-
-# PROLOGUE BEGIN ########################################################
- link.w %a6,&-4
- movm.l &0x3800,-(%sp) # save d2-d4
-# fmovm.l &0x0,-(%sp) # save no fpregs
-# PROLOGUE END ##########################################################
-
- mov.w %cc,CMP2_CC(%a6)
- mov.l 0x8(%a6), %d2 # get regval
-
- mov.b ([0xc,%a6],0x0),%d0
- mov.b ([0xc,%a6],0x1),%d1
-
- extb.l %d0 # sign extend lo bnd
- extb.l %d1 # sign extend hi bnd
-
-# operation is a data register compare.
-# sign extend byte to long so we can do simple longword compares.
- extb.l %d2 # sign extend data byte
- bra.w l_cmp2_cmp # go do the compare emulation
-
- global _060LSP__cmp2_Dw_
-_060LSP__cmp2_Dw_:
-
-# PROLOGUE BEGIN ########################################################
- link.w %a6,&-4
- movm.l &0x3800,-(%sp) # save d2-d4
-# fmovm.l &0x0,-(%sp) # save no fpregs
-# PROLOGUE END ##########################################################
-
- mov.w %cc,CMP2_CC(%a6)
- mov.l 0x8(%a6), %d2 # get regval
-
- mov.w ([0xc,%a6],0x0),%d0
- mov.w ([0xc,%a6],0x2),%d1
-
- ext.l %d0 # sign extend lo bnd
- ext.l %d1 # sign extend hi bnd
-
-# operation is a data register compare.
-# sign extend word to long so we can do simple longword compares.
- ext.l %d2 # sign extend data word
- bra.w l_cmp2_cmp # go emulate compare
-
- global _060LSP__cmp2_Dl_
-_060LSP__cmp2_Dl_:
-
-# PROLOGUE BEGIN ########################################################
- link.w %a6,&-4
- movm.l &0x3800,-(%sp) # save d2-d4
-# fmovm.l &0x0,-(%sp) # save no fpregs
-# PROLOGUE END ##########################################################
-
- mov.w %cc,CMP2_CC(%a6)
- mov.l 0x8(%a6), %d2 # get regval
-
- mov.l ([0xc,%a6],0x0),%d0
- mov.l ([0xc,%a6],0x4),%d1
-
-#
-# To set the ccodes correctly:
-# (1) save 'Z' bit from (Rn - lo)
-# (2) save 'Z' and 'N' bits from ((hi - lo) - (Rn - hi))
-# (3) keep 'X', 'N', and 'V' from before instruction
-# (4) combine ccodes
-#
-l_cmp2_cmp:
- sub.l %d0, %d2 # (Rn - lo)
- mov.w %cc, %d3 # fetch resulting ccodes
- andi.b &0x4, %d3 # keep 'Z' bit
- sub.l %d0, %d1 # (hi - lo)
- cmp.l %d1,%d2 # ((hi - lo) - (Rn - hi))
-
- mov.w %cc, %d4 # fetch resulting ccodes
- or.b %d4, %d3 # combine w/ earlier ccodes
- andi.b &0x5, %d3 # keep 'Z' and 'N'
-
- mov.w CMP2_CC(%a6), %d4 # fetch old ccodes
- andi.b &0x1a, %d4 # keep 'X','N','V' bits
- or.b %d3, %d4 # insert new ccodes
- mov.w %d4,%cc # save new ccodes
-
-# EPILOGUE BEGIN ########################################################
-# fmovm.l (%sp)+,&0x0 # restore no fpregs
- movm.l (%sp)+,&0x001c # restore d2-d4
- unlk %a6
-# EPILOGUE END ##########################################################
-
- rts
diff --git a/sys/arch/m68k/060sp/ilsp.sa b/sys/arch/m68k/060sp/ilsp.sa
deleted file mode 100644
index fa6cd9dd07d..00000000000
--- a/sys/arch/m68k/060sp/ilsp.sa
+++ /dev/null
@@ -1,139 +0,0 @@
-#
-# $OpenBSD: ilsp.sa,v 1.2 1996/05/30 22:14:40 niklas Exp $
-# $NetBSD: ilsp.sa,v 1.2 1996/05/15 19:48:39 is Exp $
-#
-
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-# M68000 Hi-Performance Microprocessor Division
-# M68060 Software Package Production Release
-#
-# M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
-# All rights reserved.
-#
-# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-# To the maximum extent permitted by applicable law,
-# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
-# FOR A PARTICULAR PURPOSE and any warranty against infringement with
-# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-# and any accompanying written materials.
-#
-# To the maximum extent permitted by applicable law,
-# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
-# BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
-# ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
-#
-# Motorola assumes no responsibility for the maintenance and support
-# of the SOFTWARE.
-#
-# You are hereby granted a copyright license to use, modify, and distribute the
-# SOFTWARE so long as this entire notice is retained without alteration
-# in any modified and/or redistributed versions, and that such modified
-# versions are clearly identified as such.
-# No licenses are granted by implication, estoppel or otherwise under any
-# patents or trademarks of Motorola, Inc.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- dc.l $60ff0000,$01fe0000,$60ff0000,$02080000
- dc.l $60ff0000,$04900000,$60ff0000,$04080000
- dc.l $60ff0000,$051e0000,$60ff0000,$053c0000
- dc.l $60ff0000,$055a0000,$60ff0000,$05740000
- dc.l $60ff0000,$05940000,$60ff0000,$05b40000
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $4e56fff0,$48e73f00,$42eefff0,$50eeffff
- dc.l $60104e56,$fff048e7,$3f0042ee,$fff051ee
- dc.l $ffff2e2e,$00086700,$00ae2a2e,$000c2c2e
- dc.l $00104a2e,$ffff671a,$4a875dee,$fffe6a02
- dc.l $44874a85,$5deefffd,$6a0844fc,$00004086
- dc.l $40854a85,$66164a86,$67000046,$be866306
- dc.l $cb466000,$00124c47,$6005600a,$be85634c
- dc.l $61ff0000,$00864a2e,$ffff6724,$4a2efffd
- dc.l $67024485,$102efffe,$b12efffd,$670c0c86
- dc.l $80000000,$62264486,$60060806,$001f661c
- dc.l $026e0010,$fff044ee,$fff04a86,$48f60060
- dc.l $01610014,$4cdf00fc,$4e5e4e75,$2a2e000c
- dc.l $2c2e0010,$026e001c,$fff0006e,$0002fff0
- dc.l $44eefff0,$60d62dae,$000c0161,$00142dae
- dc.l $00100162,$00140004,$44eefff0,$4cdf00fc
- dc.l $4e5e80fc,$00004e75,$0c870000,$ffff621e
- dc.l $42814845,$48463a06,$8ac73205,$48463a06
- dc.l $8ac74841,$32054245,$48452c01,$4e7542ae
- dc.l $fff8422e,$fffc4281,$0807001f,$660e52ae
- dc.l $fff8e38f,$e38ee395,$6000ffee,$26072405
- dc.l $48424843,$b4436606,$323cffff,$600a2205
- dc.l $82c30281,$0000ffff,$2f064246,$48462607
- dc.l $2401c4c7,$4843c6c1,$28059883,$48443004
- dc.l $38064a40,$6600000a,$b4846304,$538160de
- dc.l $2f052c01,$48462a07,$61ff0000,$006a2405
- dc.l $26062a1f,$2c1f9c83,$9b8264ff,$0000001a
- dc.l $53814282,$26074843,$4243dc83,$db822607
- dc.l $42434843,$da834a2e,$fffc6616,$3d41fff4
- dc.l $42814845,$48463a06,$424650ee,$fffc6000
- dc.l $ff6c3d41,$fff63c05,$48464845,$2e2efff8
- dc.l $670a5387,$e28de296,$51cffffa,$2a062c2e
- dc.l $fff44e75,$24062606,$28054843,$4844ccc5
- dc.l $cac3c4c4,$c6c44284,$4846dc45,$d744dc42
- dc.l $d7444846,$42454242,$48454842,$da82da83
- dc.l $4e754e56,$fffc48e7,$380042ee,$fffc202e
- dc.l $00086700,$005a222e,$000c6700,$00522400
- dc.l $26002801,$48434844,$c0c1c2c3,$c4c4c6c4
- dc.l $42844840,$d041d784,$d042d784,$48404241
- dc.l $42424841,$4842d282,$d283382e,$fffc0204
- dc.l $00104a81,$6a040004,$000844c4,$c34048f6
- dc.l $00030161,$00104cdf,$001c4e5e,$4e754280
- dc.l $4281382e,$fffc0204,$00100004,$000444c4
- dc.l $60da4e56,$fffc48e7,$3c0042ee,$fffc202e
- dc.l $000867da,$222e000c,$67d44205,$4a806c06
- dc.l $44800005,$00014a81,$6c064481,$0a050001
- dc.l $24002600,$28014843,$4844c0c1,$c2c3c4c4
- dc.l $c6c44284,$4840d041,$d784d042,$d7844840
- dc.l $42414242,$48414842,$d282d283,$4a056708
- dc.l $46804681,$5280d384,$382efffc,$02040010
- dc.l $4a816a04,$00040008,$44c4c340,$48f60003
- dc.l $01610010,$4cdf003c,$4e5e4e75,$42804281
- dc.l $382efffc,$02040010,$00040004,$44c460da
- dc.l $4e56fffc,$48e73800,$42eefffc,$242e0008
- dc.l $10360161,$000c1236,$0162000c,$000149c0
- dc.l $49c16000,$00b84e56,$fffc48e7,$380042ee
- dc.l $fffc242e,$00083036,$0161000c,$32360162
- dc.l $000c0002,$48c048c1,$60000092,$4e56fffc
- dc.l $48e73800,$42eefffc,$242e0008,$20360161
- dc.l $000c2236,$0162000c,$00046000,$00704e56
- dc.l $fffc48e7,$380042ee,$fffc242e,$00081036
- dc.l $0161000c,$12360162,$000c0001,$49c049c1
- dc.l $49c26000,$00484e56,$fffc48e7,$380042ee
- dc.l $fffc242e,$00083036,$0161000c,$32360162
- dc.l $000c0002,$48c048c1,$48c26000,$00204e56
- dc.l $fffc48e7,$380042ee,$fffc242e,$00082036
- dc.l $0161000c,$22360162,$000c0004,$948042c3
- dc.l $02030004,$9280b282,$42c48604,$02030005
- dc.l $382efffc,$0204001a,$880344c4,$4cdf001c
- dc.l $4e5e4e75,$00000000,$00000000,$00000000
diff --git a/sys/arch/m68k/060sp/inetbsd.S b/sys/arch/m68k/060sp/inetbsd.S
deleted file mode 100644
index 272d8426c4a..00000000000
--- a/sys/arch/m68k/060sp/inetbsd.S
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- *$OpenBSD: inetbsd.S,v 1.3 2013/02/02 13:32:05 miod Exp $
- *$NetBSD: inetbsd.S,v 1.2 1996/05/15 21:16:44 is Exp $
- *
- *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
- *M68000 Hi-Performance Microprocessor Division
- *M68060 Software Package Production Release
- *
- *M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
- *All rights reserved.
- *
- *THE SOFTWARE is provided on an "AS IS" basis and without warranty.
- *To the maximum extent permitted by applicable law,
- *MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
- *INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
- *FOR A PARTICULAR PURPOSE and any warranty against infringement with
- *regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
- *and any accompanying written materials.
- *
- *To the maximum extent permitted by applicable law,
- *IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
- *(INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
- *BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
- *ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
- *
- *Motorola assumes no responsibility for the maintenance and support
- *of the SOFTWARE.
- *
- *You are hereby granted a copyright license to use, modify, and distribute the
- *SOFTWARE so long as this entire notice is retained without alteration
- *in any modified and/or redistributed versions, and that such modified
- *versions are clearly identified as such.
- *No licenses are granted by implication, estoppel or otherwise under any
- *patents or trademarks of Motorola, Inc.
- *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *Derived from:
- *iskeleton.s
- *
- *This file contains:
- * (1) example "Call-out"s
- * (2) example package entry code
- * (3) example "Call-out" table
- */
-
-
-/********************************
- *(1) EXAMPLE CALL-OUTS *
- * *
- *_060_isp_done() *
- *_060_real_chk() *
- *_060_real_divbyzero() *
- * *
- *_060_real_cas() *
- *_060_real_cas2() *
- *_060_real_lock_page() *
- *_060_real_unlock_page() *
- ********************************/
-
-/*
- *_060_isp_done():
- *
- *This is and example main exit point for the Unimplemented Integer
- *Instruction exception handler. For a normal exit, the
- *_isp_unimp() branches to here so that the operating system
- *can do any clean-up desired. The stack frame is the
- *Unimplemented Integer Instruction stack frame with
- *the PC pointing to the instruction following the instruction
- *just emulated.
- *To simply continue execution at the next instruction, just
- *do an "rte".
- */
-ASENTRY_NOPROFILE(_060_isp_done)
- rte
-
-/*
- *_060_real_chk():
- *
- *This is an alternate exit point for the Unimplemented Integer
- *Instruction exception handler. If the instruction was a "chk2"
- *and the operand was out of bounds, then _isp_unimp() creates
- *a CHK exception stack frame from the Unimplemented Integer Instrcution
- *stack frame and branches to this routine.
- */
-ASENTRY_NOPROFILE(_060_real_chk)
- tstb %sp@ |# is tracing enabled?
- bpls real_chk_end |# no
-
-/*
- * CHK FRAME TRACE FRAME
- * ***************** *****************
- * * Current PC * * Current PC *
- * ***************** *****************
- * * 0x2 * 0x018 * * 0x2 * 0x024 *
- * ***************** *****************
- * * Next * * Next *
- * * PC * * PC *
- * ***************** *****************
- * * SR * * SR *
- * ***************** *****************
- */
- moveb #0x24,%sp@(0x7) |# set trace vecno
- bral _ASM_LABEL(_060_real_trace)
-
-real_chk_end:
- jmp _C_LABEL(chkinst)
-
-/*
- *_060_real_divbyzero:
- *
- *This is an alternate exit point for the Unimplemented Integer
- *Instruction exception handler isp_unimp(). If the instruction is a 64-bit
- *integer divide where the source operand is a zero, then the _isp_unimp()
- *creates a Divide-by-zero exception stack frame from the Unimplemented
- *Integer Instruction stack frame and branches to this routine.
- *
- *Remember that a trace exception may be pending. The code below performs
- *no action associated with the "chk" exception. If tracing is enabled,
- *then it create a Trace exception stack frame from the "chk" exception
- *stack frame and branches to the _real_trace() entry point.
- */
-ASENTRY_NOPROFILE(_060_real_divbyzero)
- tstb %sp@ |# is tracing enabled?
- bpls real_divbyzero_end |# no
-
-/*
- * DIVBYZERO FRAME TRACE FRAME
- * ***************** *****************
- * * Current PC * * Current PC *
- * ***************** *****************
- * * 0x2 * 0x014 * * 0x2 * 0x024 *
- * ***************** *****************
- * * Next * * Next *
- * * PC * * PC *
- * ***************** *****************
- * * SR * * SR *
- * ***************** *****************
- */
- moveb #0x24,%sp@(0x7) |# set trace vecno
- bral _ASM_LABEL(_060_real_trace)
-
-real_divbyzero_end:
- jmp _C_LABEL(zerodiv)
-
-/***************************/
-
-/*
- *_060_real_cas():
- *
- *Entry point for the selected cas emulation code implementation.
- *If the implementation provided by the 68060ISP is sufficient,
- *then this routine simply re-enters the package through _isp_cas.
- */
-ASENTRY_NOPROFILE(_060_real_cas)
- bral _C_LABEL(I_CALL_TOP)+0x80+0x08
-
-/*
- *_060_real_cas2():
- *
- *Entry point for the selected cas2 emulation code implementation.
- *If the implementation provided by the 68060ISP is sufficient,
- *then this routine simply re-enters the package through _isp_cas2.
- */
-ASENTRY_NOPROFILE(_060_real_cas2)
- bral _C_LABEL(I_CALL_TOP)+0x80+0x10
-
-/*
- *_060_lock_page():
- *
- *Entry point for the operating system's routine to "lock" a page
- *from being paged out. This routine is needed by the cas/cas2
- *algorithms so that no page faults occur within the "core" code
- *region. Note: the routine must lock two pages if the operand
- *spans two pages.
- *NOTE: THE ROUTINE SHOULD RETURN AN FSLW VALUE IN D0 ON FAILURE
- *SO THAT THE 060SP CAN CREATE A PROPER ACCESS ERROR FRAME.
- *Arguments:
- * a0 = operand address
- * d0 = `xxxxxxff -> supervisor| `xxxxxx00 -> user
- * d1 = `xxxxxxff -> longword| `xxxxxx00 -> word
- *Expected outputs:
- * d0 = 0 -> success| non-zero -> failure
- */
-ASENTRY_NOPROFILE(_060_real_lock_page)
- clrl %d0
- rts
-
-/*
- *_060_unlock_page():
- *
- *Entry point for the operating system's routine to "unlock" a
- *page that has been "locked" previously with _real_lock_page.
- *Note: the routine must unlock two pages if the operand spans
- *two pages.
- *Arguments:
- * a0 = operand address
- * d0 = `xxxxxxff -> supervisor| `xxxxxx00 -> user
- * d1 = `xxxxxxff -> longword| `xxxxxx00 -> word
- */
-ASENTRY_NOPROFILE(_060_real_unlock_page)
- clrl %d0
- rts
-
-/****************************************************************************/
-
-/*********************************
- *(2) EXAMPLE PACKAGE ENTRY CODE *
- *********************************/
-
-ASENTRY_NOPROFILE(_060_isp_unimp)
- bral _C_LABEL(I_CALL_TOP)+0x80+0x00
-
-ASENTRY_NOPROFILE(_060_isp_cas)
- bral _C_LABEL(I_CALL_TOP)+0x80+0x08
-
-ASENTRY_NOPROFILE(_060_isp_cas2)
- bral _C_LABEL(I_CALL_TOP)+0x80+0x10
-
-ASENTRY_NOPROFILE(_060_isp_cas_finish)
- bral _C_LABEL(I_CALL_TOP)+0x80+0x18
-
-ASENTRY_NOPROFILE(_060_isp_cas2_finish)
- bral _C_LABEL(I_CALL_TOP)+0x80+0x20
-
-ASENTRY_NOPROFILE(_060_isp_cas_inrange)
- bral _C_LABEL(I_CALL_TOP)+0x80+0x28
-
-ASENTRY_NOPROFILE(_060_isp_cas_terminate)
- bral _C_LABEL(I_CALL_TOP)+0x80+0x30
-
-ASENTRY_NOPROFILE(_060_isp_cas_restart)
- bral _C_LABEL(I_CALL_TOP)+0x80+0x38
-
-/****************************************************************************/
-
-/*******************************
- *(3) EXAMPLE CALL-OUT SECTION *
- *******************************/
-
-/*
- *The size of this section MUST be 128 bytes!!!
- */
-
-GLOBAL(I_CALL_TOP)
- .long _ASM_LABEL(_060_real_chk)-_C_LABEL(I_CALL_TOP)
- .long _ASM_LABEL(_060_real_divbyzero)-_C_LABEL(I_CALL_TOP)
- .long _ASM_LABEL(_060_real_trace)-_C_LABEL(I_CALL_TOP)
- .long _ASM_LABEL(_060_real_access)-_C_LABEL(I_CALL_TOP)
- .long _ASM_LABEL(_060_isp_done)-_C_LABEL(I_CALL_TOP)
-
- .long _ASM_LABEL(_060_real_cas)-_C_LABEL(I_CALL_TOP)
- .long _ASM_LABEL(_060_real_cas2)-_C_LABEL(I_CALL_TOP)
- .long _ASM_LABEL(_060_real_lock_page)-_C_LABEL(I_CALL_TOP)
- .long _ASM_LABEL(_060_real_unlock_page)-_C_LABEL(I_CALL_TOP)
-
- .long 0x00000000,0x00000000,0x00000000,0x00000000
- .long 0x00000000,0x00000000,0x00000000
-
- .long _ASM_LABEL(_060_imem_read)-_C_LABEL(I_CALL_TOP)
- .long _ASM_LABEL(_060_dmem_read)-_C_LABEL(I_CALL_TOP)
- .long _ASM_LABEL(_060_dmem_write)-_C_LABEL(I_CALL_TOP)
- .long _ASM_LABEL(_060_imem_read_word)-_C_LABEL(I_CALL_TOP)
- .long _ASM_LABEL(_060_imem_read_long)-_C_LABEL(I_CALL_TOP)
- .long _ASM_LABEL(_060_dmem_read_byte)-_C_LABEL(I_CALL_TOP)
- .long _ASM_LABEL(_060_dmem_read_word)-_C_LABEL(I_CALL_TOP)
- .long _ASM_LABEL(_060_dmem_read_long)-_C_LABEL(I_CALL_TOP)
- .long _ASM_LABEL(_060_dmem_write_byte)-_C_LABEL(I_CALL_TOP)
- .long _ASM_LABEL(_060_dmem_write_word)-_C_LABEL(I_CALL_TOP)
- .long _ASM_LABEL(_060_dmem_write_long)-_C_LABEL(I_CALL_TOP)
-
- .long 0x00000000
- .long 0x00000000,0x00000000,0x00000000,0x00000000
-
-/****************************************************************************/
-
-/*
- *060 INTEGER KERNEL PACKAGE MUST GO HERE!!!
- */
-
-#include "isp.S"
diff --git a/sys/arch/m68k/060sp/iskeletn.s b/sys/arch/m68k/060sp/iskeletn.s
deleted file mode 100644
index b6ba19ec952..00000000000
--- a/sys/arch/m68k/060sp/iskeletn.s
+++ /dev/null
@@ -1,292 +0,0 @@
-#
-# $OpenBSD: iskeletn.s,v 1.2 1996/05/30 22:14:43 niklas Exp $
-# $NetBSD: iskeletn.s,v 1.2 1996/05/15 19:48:41 is Exp $
-#
-
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-# M68000 Hi-Performance Microprocessor Division
-# M68060 Software Package Production Release
-#
-# M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
-# All rights reserved.
-#
-# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-# To the maximum extent permitted by applicable law,
-# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
-# FOR A PARTICULAR PURPOSE and any warranty against infringement with
-# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-# and any accompanying written materials.
-#
-# To the maximum extent permitted by applicable law,
-# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
-# BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
-# ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
-#
-# Motorola assumes no responsibility for the maintenance and support
-# of the SOFTWARE.
-#
-# You are hereby granted a copyright license to use, modify, and distribute the
-# SOFTWARE so long as this entire notice is retained without alteration
-# in any modified and/or redistributed versions, and that such modified
-# versions are clearly identified as such.
-# No licenses are granted by implication, estoppel or otherwise under any
-# patents or trademarks of Motorola, Inc.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-#
-# iskeleton.s
-#
-# This file contains:
-# (1) example "Call-out"s
-# (2) example package entry code
-# (3) example "Call-out" table
-#
-
-
-#################################
-# (1) EXAMPLE CALL-OUTS #
-# #
-# _060_isp_done() #
-# _060_real_chk() #
-# _060_real_divbyzero() #
-# #
-# _060_real_cas() #
-# _060_real_cas2() #
-# _060_real_lock_page() #
-# _060_real_unlock_page() #
-#################################
-
-#
-# _060_isp_done():
-#
-# This is and example main exit point for the Unimplemented Integer
-# Instruction exception handler. For a normal exit, the
-# _isp_unimp() branches to here so that the operating system
-# can do any clean-up desired. The stack frame is the
-# Unimplemented Integer Instruction stack frame with
-# the PC pointing to the instruction following the instruction
-# just emulated.
-# To simply continue execution at the next instruction, just
-# do an "rte".
-#
- global _060_isp_done
-_060_isp_done:
- rte
-
-#
-# _060_real_chk():
-#
-# This is an alternate exit point for the Unimplemented Integer
-# Instruction exception handler. If the instruction was a "chk2"
-# and the operand was out of bounds, then _isp_unimp() creates
-# a CHK exception stack frame from the Unimplemented Integer Instrcution
-# stack frame and branches to this routine.
-#
- global _060_real_chk
-_060_real_chk:
- tst.b (%sp) # is tracing enabled?
- bpl.b real_chk_end # no
-
-#
-# CHK FRAME TRACE FRAME
-# ***************** *****************
-# * Current PC * * Current PC *
-# ***************** *****************
-# * 0x2 * 0x018 * * 0x2 * 0x024 *
-# ***************** *****************
-# * Next * * Next *
-# * PC * * PC *
-# ***************** *****************
-# * SR * * SR *
-# ***************** *****************
-#
- mov.b &0x24,0x7(%sp) # set trace vecno
- bra.l _060_real_trace
-
-real_chk_end:
- rte
-
-#
-# _060_real_divbyzero:
-#
-# This is an alternate exit point for the Unimplemented Integer
-# Instruction exception handler isp_unimp(). If the instruction is a 64-bit
-# integer divide where the source operand is a zero, then the _isp_unimp()
-# creates a Divide-by-zero exception stack frame from the Unimplemented
-# Integer Instruction stack frame and branches to this routine.
-#
-# Remember that a trace exception may be pending. The code below performs
-# no action associated with the "chk" exception. If tracing is enabled,
-# then it create a Trace exception stack frame from the "chk" exception
-# stack frame and branches to the _real_trace() entry point.
-#
- global _060_real_divbyzero
-_060_real_divbyzero:
- tst.b (%sp) # is tracing enabled?
- bpl.b real_divbyzero_end # no
-
-#
-# DIVBYZERO FRAME TRACE FRAME
-# ***************** *****************
-# * Current PC * * Current PC *
-# ***************** *****************
-# * 0x2 * 0x014 * * 0x2 * 0x024 *
-# ***************** *****************
-# * Next * * Next *
-# * PC * * PC *
-# ***************** *****************
-# * SR * * SR *
-# ***************** *****************
-#
- mov.b &0x24,0x7(%sp) # set trace vecno
- bra.l _060_real_trace
-
-real_divbyzero_end:
- rte
-
-###########################
-
-#
-# _060_real_cas():
-#
-# Entry point for the selected cas emulation code implementation.
-# If the implementation provided by the 68060ISP is sufficient,
-# then this routine simply re-enters the package through _isp_cas.
-#
- global _060_real_cas
-_060_real_cas:
- bra.l _I_CALL_TOP+0x80+0x08
-
-#
-# _060_real_cas2():
-#
-# Entry point for the selected cas2 emulation code implementation.
-# If the implementation provided by the 68060ISP is sufficient,
-# then this routine simply re-enters the package through _isp_cas2.
-#
- global _060_real_cas2
-_060_real_cas2:
- bra.l _I_CALL_TOP+0x80+0x10
-
-#
-# _060_lock_page():
-#
-# Entry point for the operating system's routine to "lock" a page
-# from being paged out. This routine is needed by the cas/cas2
-# algorithms so that no page faults occur within the "core" code
-# region. Note: the routine must lock two pages if the operand
-# spans two pages.
-# NOTE: THE ROUTINE SHOULD RETURN AN FSLW VALUE IN D0 ON FAILURE
-# SO THAT THE 060SP CAN CREATE A PROPER ACCESS ERROR FRAME.
-# Arguments:
-# a0 = operand address
-# d0 = `xxxxxxff -> supervisor; `xxxxxx00 -> user
-# d1 = `xxxxxxff -> longword; `xxxxxx00 -> word
-# Expected outputs:
-# d0 = 0 -> success; non-zero -> failure
-#
- global _060_real_lock_page
-_060_real_lock_page:
- clr.l %d0
- rts
-
-#
-# _060_unlock_page():
-#
-# Entry point for the operating system's routine to "unlock" a
-# page that has been "locked" previously with _real_lock_page.
-# Note: the routine must unlock two pages if the operand spans
-# two pages.
-# Arguments:
-# a0 = operand address
-# d0 = `xxxxxxff -> supervisor; `xxxxxx00 -> user
-# d1 = `xxxxxxff -> longword; `xxxxxx00 -> word
-#
- global _060_real_unlock_page
-_060_real_unlock_page:
- clr.l %d0
- rts
-
-############################################################################
-
-##################################
-# (2) EXAMPLE PACKAGE ENTRY CODE #
-##################################
-
- global _060_isp_unimp
-_060_isp_unimp:
- bra.l _I_CALL_TOP+0x80+0x00
-
- global _060_isp_cas
-_060_isp_cas:
- bra.l _I_CALL_TOP+0x80+0x08
-
- global _060_isp_cas2
-_060_isp_cas2:
- bra.l _I_CALL_TOP+0x80+0x10
-
- global _060_isp_cas_finish
-_060_isp_cas_finish:
- bra.l _I_CALL_TOP+0x80+0x18
-
- global _060_isp_cas2_finish
-_060_isp_cas2_finish:
- bra.l _I_CALL_TOP+0x80+0x20
-
- global _060_isp_cas_inrange
-_060_isp_cas_inrange:
- bra.l _I_CALL_TOP+0x80+0x28
-
- global _060_isp_cas_terminate
-_060_isp_cas_terminate:
- bra.l _I_CALL_TOP+0x80+0x30
-
- global _060_isp_cas_restart
-_060_isp_cas_restart:
- bra.l _I_CALL_TOP+0x80+0x38
-
-############################################################################
-
-################################
-# (3) EXAMPLE CALL-OUT SECTION #
-################################
-
-# The size of this section MUST be 128 bytes!!!
-
- global _I_CALL_TOP
-_I_CALL_TOP:
- long _060_real_chk - _I_CALL_TOP
- long _060_real_divbyzero - _I_CALL_TOP
- long _060_real_trace - _I_CALL_TOP
- long _060_real_access - _I_CALL_TOP
- long _060_isp_done - _I_CALL_TOP
-
- long _060_real_cas - _I_CALL_TOP
- long _060_real_cas2 - _I_CALL_TOP
- long _060_real_lock_page - _I_CALL_TOP
- long _060_real_unlock_page - _I_CALL_TOP
-
- long 0x00000000, 0x00000000, 0x00000000, 0x00000000
- long 0x00000000, 0x00000000, 0x00000000
-
- long _060_imem_read - _I_CALL_TOP
- long _060_dmem_read - _I_CALL_TOP
- long _060_dmem_write - _I_CALL_TOP
- long _060_imem_read_word - _I_CALL_TOP
- long _060_imem_read_long - _I_CALL_TOP
- long _060_dmem_read_byte - _I_CALL_TOP
- long _060_dmem_read_word - _I_CALL_TOP
- long _060_dmem_read_long - _I_CALL_TOP
- long _060_dmem_write_byte - _I_CALL_TOP
- long _060_dmem_write_word - _I_CALL_TOP
- long _060_dmem_write_long - _I_CALL_TOP
-
- long 0x00000000
- long 0x00000000, 0x00000000, 0x00000000, 0x00000000
-
-############################################################################
-
-# 060 INTEGER KERNEL PACKAGE MUST GO HERE!!!
diff --git a/sys/arch/m68k/060sp/isp.doc b/sys/arch/m68k/060sp/isp.doc
deleted file mode 100644
index 1ecabe9b706..00000000000
--- a/sys/arch/m68k/060sp/isp.doc
+++ /dev/null
@@ -1,228 +0,0 @@
-#
-# $OpenBSD: isp.doc,v 1.2 1996/05/30 22:14:45 niklas Exp $
-# $NetBSD: isp.doc,v 1.2 1996/05/15 19:48:44 is Exp $
-#
-
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-# M68000 Hi-Performance Microprocessor Division
-# M68060 Software Package Production Release
-#
-# M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
-# All rights reserved.
-#
-# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-# To the maximum extent permitted by applicable law,
-# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
-# FOR A PARTICULAR PURPOSE and any warranty against infringement with
-# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-# and any accompanying written materials.
-#
-# To the maximum extent permitted by applicable law,
-# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
-# BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
-# ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
-#
-# Motorola assumes no responsibility for the maintenance and support
-# of the SOFTWARE.
-#
-# You are hereby granted a copyright license to use, modify, and distribute the
-# SOFTWARE so long as this entire notice is retained without alteration
-# in any modified and/or redistributed versions, and that such modified
-# versions are clearly identified as such.
-# No licenses are granted by implication, estoppel or otherwise under any
-# patents or trademarks of Motorola, Inc.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-68060 INTEGER SOFTWARE PACKAGE (Kernel version)
-------------------------------------------------
-
-The file isp.sa contains the 68060 Integer Software Package.
-This package is essentially an exception handler that can be
-integrated into an operating system to handle the "Unimplemented
-Integer Instruction" exception vector #61.
-This exception is taken when any of the integer instructions
-not hardware implemented on the 68060 are encountered. The
-isp.sa provides full emulation support for these instructions.
-
-The unimplemented integer instructions are:
- 64-bit divide
- 64-bit multiply
- movep
- cmp2
- chk2
- cas (w/ a misaligned effective address)
- cas2
-
-Release file format:
---------------------
-The file isp.sa is essentially a hexadecimal image of the
-release package. This is the ONLY format which will be supported.
-The hex image was created by assembling the source code and
-then converting the resulting binary output image into an
-ASCII text file. The hexadecimal numbers are listed
-using the Motorola Assembly Syntax assembler directive "dc.l"
-(define constant longword). The file can be converted to other
-assembly syntaxes by using any word processor with a global
-search and replace function.
-
-To assist in assembling and linking this module with other modules,
-the installer should add a symbolic label to the top of the file.
-This will allow calling routines to access the entry points
-of this package.
-
-The source code isp.s has also been included but only for
-documentation purposes.
-
-Release file structure:
------------------------
-
-(top of module)
- -----------------
- | | - 128 byte-sized section
- (1) | Call-Out | - 4 bytes per entry (user fills these in)
- | | - example routines in iskeleton.s
- -----------------
- | | - 8 bytes per entry
- (2) | Entry Point | - user does a "bra" or "jmp" to this address
- | |
- -----------------
- | | - code section
- (3) ~ ~
- | |
- -----------------
-(bottom of module)
-
-The first section of this module is the "Call-out" section. This section
-is NOT INCLUDED in isp.sa (an example "Call-out" section is provided at
-the end of the file iskeleton.s). The purpose of this section is to allow
-the ISP routines to reference external functions that must be provided
-by the host operating system. This section MUST be exactly 128 bytes in
-size. There are 32 fields, each 4 bytes in size. Each field corresponds
-to a function required by the ISP (these functions and their location are
-listed in "68060ISP call-outs" below). Each field entry should contain
-the address of the corresponding function RELATIVE to the starting address
-of the "call-out" section. The "Call-out" section must sit adjacent to the
-isp.sa image in memory.
-
-The second section, the "Entry-point" section, is used by external routines
-to access the functions within the ISP. Since the isp.sa hex file contains
-no symbol names, this section contains function entry points that are fixed
-with respect to the top of the package. The currently defined entry-points
-are listed in section "68060 ISP entry points" below. A calling routine
-would simply execute a "bra" or "jmp" that jumped to the selected function
-entry-point.
-
-For example, if the 68060 hardware took a "Unimplemented Integer Instruction"
-exception (vector #61), the operating system should execute something
-similar to:
-
- bra _060ISP_TOP+128+0
-
-(_060ISP_TOP is the starting address of the "Call-out" section; the "Call-out"
-section is 128 bytes long; and the Unimplemented Integer ISP handler entry
-point is located 0 bytes from the top of the "Entry-point" section.)
-
-The third section is the code section. After entering through an "Entry-point",
-the entry code jumps to the appropriate emulation code within the code section.
-
-68060ISP call-outs: (details in iskeleton.s)
---------------------
-0x000: _060_real_chk
-0x004: _060_real_divbyzero
-0x008: _060_real_trace
-0x00c: _060_real_access
-0x010: _060_isp_done
-
-0x014: _060_real_cas
-0x018: _060_real_cas2
-0x01c: _060_real_lock_page
-0x020: _060_real_unlock_page
-
-0x024: (Motorola reserved)
-0x028: (Motorola reserved)
-0x02c: (Motorola reserved)
-0x030: (Motorola reserved)
-0x034: (Motorola reserved)
-0x038: (Motorola reserved)
-0x03c: (Motorola reserved)
-
-0x040: _060_imem_read
-0x044: _060_dmem_read
-0x048: _060_dmem_write
-0x04c: _060_imem_read_word
-0x050: _060_imem_read_long
-0x054: _060_dmem_read_byte
-0x058: _060_dmem_read_word
-0x05c: _060_dmem_read_long
-0x060: _060_dmem_write_byte
-0x064: _060_dmem_write_word
-0x068: _060_dmem_write_long
-
-0x06c: (Motorola reserved)
-0x070: (Motorola reserved)
-0x074: (Motorola reserved)
-0x078: (Motorola reserved)
-0x07c: (Motorola reserved)
-
-68060ISP entry points:
------------------------
-0x000: _060_isp_unimp
-
-0x008: _060_isp_cas
-0x010: _060_isp_cas2
-0x018: _060_isp_cas_finish
-0x020: _060_isp_cas2_finish
-0x028: _060_isp_cas_inrange
-0x030: _060_isp_cas_terminate
-0x038: _060_isp_cas_restart
-
-Integrating cas/cas2:
----------------------
-The instructions "cas2" and "cas" (when used with a misaligned effective
-address) take the Unimplemented Integer Instruction exception. When the
-060ISP is installed properly, these instructions will enter through the
-_060_isp_unimp() entry point of the ISP.
-
-After the 060ISP decodes the instruction type and fetches the appropriate
-data registers, and BEFORE the actual emulated transfers occur, the
-package calls either the "Call-out" _060_real_cas() or _060_real_cas2().
-If the emulation code provided by the 060ISP is sufficient for the
-host system (see isp.s source code), then these "Call-out"s should be
-made, by the system integrator, to point directly back into the package
-through the "Entry-point"s _060_isp_cas() or _060_isp_cas2().
-
-One other necessary action by the integrator is to supply the routines
-_060_real_lock_page() and _060_real_unlock_page(). These functions are
-defined further in iskeleton.s and the 68060 Software Package Specification.
-
-If the "core" emulation routines of either "cas" or "cas2" perform some
-actions which are too system-specific, then the system integrator must
-supply new emulation code. This new emulation code should reside within
-the functions _060_real_cas() or _060_real_cas2(). When this new emulation
-code has completed, then it should re-enter the 060ISP package through the
-"Entry-point" _060_isp_cas_finish() or _060_isp_cas2_finish().
-To see what the register state is upon entering _060_real_cas() or
-_060_real_cas2() and what it should be upon return to the package through
-_060_isp_cas_finish() or _060_isp_cas2_finish(), please refer to the
-source code in isp.s.
-
-Miscellaneous:
---------------
-
-_060_isp_unimp:
-----------------
-- documented in 2.2 in spec.
-- Basic flow:
- exception taken ---> enter _060_isp_unimp --|
- |
- |
- may exit through _060_real_itrace <----|
- or |
- may exit through _060_real_chk <----|
- or |
- may exit through _060_real_divbyzero <----|
- or |
- may exit through _060_isp_done <----|
diff --git a/sys/arch/m68k/060sp/isp.s b/sys/arch/m68k/060sp/isp.s
deleted file mode 100644
index fde538c49e4..00000000000
--- a/sys/arch/m68k/060sp/isp.s
+++ /dev/null
@@ -1,4310 +0,0 @@
-#
-# $OpenBSD: isp.s,v 1.6 2007/04/10 17:47:54 miod Exp $
-# $NetBSD: isp.s,v 1.2 1996/05/15 19:48:48 is Exp $
-#
-
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-# M68000 Hi-Performance Microprocessor Division
-# M68060 Software Package Production Release
-#
-# M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
-# All rights reserved.
-#
-# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-# To the maximum extent permitted by applicable law,
-# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
-# FOR A PARTICULAR PURPOSE and any warranty against infringement with
-# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-# and any accompanying written materials.
-#
-# To the maximum extent permitted by applicable law,
-# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
-# BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
-# ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
-#
-# Motorola assumes no responsibility for the maintenance and support
-# of the SOFTWARE.
-#
-# You are hereby granted a copyright license to use, modify, and distribute the
-# SOFTWARE so long as this entire notice is retained without alteration
-# in any modified and/or redistributed versions, and that such modified
-# versions are clearly identified as such.
-# No licenses are granted by implication, estoppel or otherwise under any
-# patents or trademarks of Motorola, Inc.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-#
-# ireal.s:
-# This file is appended to the top of the 060ISP package
-# and contains the entry points into the package. The user, in
-# effect, branches to one of the branch table entries located
-# after _060ISP_TABLE.
-# Also, subroutine stubs exist in this file (_isp_done for
-# example) that are referenced by the ISP package itself in order
-# to call a given routine. The stub routine actually performs the
-# callout. The ISP code does a "bsr" to the stub routine. This
-# extra layer of hierarchy adds a slight performance penalty but
-# it makes the ISP code easier to read and more mainatinable.
-#
-
-set _off_chk, 0x00
-set _off_divbyzero, 0x04
-set _off_trace, 0x08
-set _off_access, 0x0c
-set _off_done, 0x10
-
-set _off_cas, 0x14
-set _off_cas2, 0x18
-set _off_lock, 0x1c
-set _off_unlock, 0x20
-
-set _off_imr, 0x40
-set _off_dmr, 0x44
-set _off_dmw, 0x48
-set _off_irw, 0x4c
-set _off_irl, 0x50
-set _off_drb, 0x54
-set _off_drw, 0x58
-set _off_drl, 0x5c
-set _off_dwb, 0x60
-set _off_dww, 0x64
-set _off_dwl, 0x68
-
-_060ISP_TABLE:
-
-# Here's the table of ENTRY POINTS for those linking the package.
- bra.l _isp_unimp
- short 0x0000
-
- bra.l _isp_cas
- short 0x0000
-
- bra.l _isp_cas2
- short 0x0000
-
- bra.l _isp_cas_finish
- short 0x0000
-
- bra.l _isp_cas2_finish
- short 0x0000
-
- bra.l _isp_cas_inrange
- short 0x0000
-
- bra.l _isp_cas_terminate
- short 0x0000
-
- bra.l _isp_cas_restart
- short 0x0000
-
- space 64
-
-#############################################################
-
- global _real_chk
-_real_chk:
- mov.l %d0,-(%sp)
- mov.l (_060ISP_TABLE-0x80+_off_chk,%pc),%d0
- pea.l (_060ISP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_divbyzero
-_real_divbyzero:
- mov.l %d0,-(%sp)
- mov.l (_060ISP_TABLE-0x80+_off_divbyzero,%pc),%d0
- pea.l (_060ISP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_trace
-_real_trace:
- mov.l %d0,-(%sp)
- mov.l (_060ISP_TABLE-0x80+_off_trace,%pc),%d0
- pea.l (_060ISP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_access
-_real_access:
- mov.l %d0,-(%sp)
- mov.l (_060ISP_TABLE-0x80+_off_access,%pc),%d0
- pea.l (_060ISP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _isp_done
-_isp_done:
- mov.l %d0,-(%sp)
- mov.l (_060ISP_TABLE-0x80+_off_done,%pc),%d0
- pea.l (_060ISP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
-#######################################
-
- global _real_cas
-_real_cas:
- mov.l %d0,-(%sp)
- mov.l (_060ISP_TABLE-0x80+_off_cas,%pc),%d0
- pea.l (_060ISP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_cas2
-_real_cas2:
- mov.l %d0,-(%sp)
- mov.l (_060ISP_TABLE-0x80+_off_cas2,%pc),%d0
- pea.l (_060ISP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_lock_page
-_real_lock_page:
- mov.l %d0,-(%sp)
- mov.l (_060ISP_TABLE-0x80+_off_lock,%pc),%d0
- pea.l (_060ISP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_unlock_page
-_real_unlock_page:
- mov.l %d0,-(%sp)
- mov.l (_060ISP_TABLE-0x80+_off_unlock,%pc),%d0
- pea.l (_060ISP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
-#######################################
-
- global _imem_read
-_imem_read:
- mov.l %d0,-(%sp)
- mov.l (_060ISP_TABLE-0x80+_off_imr,%pc),%d0
- pea.l (_060ISP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _dmem_read
-_dmem_read:
- mov.l %d0,-(%sp)
- mov.l (_060ISP_TABLE-0x80+_off_dmr,%pc),%d0
- pea.l (_060ISP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _dmem_write
-_dmem_write:
- mov.l %d0,-(%sp)
- mov.l (_060ISP_TABLE-0x80+_off_dmw,%pc),%d0
- pea.l (_060ISP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _imem_read_word
-_imem_read_word:
- mov.l %d0,-(%sp)
- mov.l (_060ISP_TABLE-0x80+_off_irw,%pc),%d0
- pea.l (_060ISP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _imem_read_long
-_imem_read_long:
- mov.l %d0,-(%sp)
- mov.l (_060ISP_TABLE-0x80+_off_irl,%pc),%d0
- pea.l (_060ISP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _dmem_read_byte
-_dmem_read_byte:
- mov.l %d0,-(%sp)
- mov.l (_060ISP_TABLE-0x80+_off_drb,%pc),%d0
- pea.l (_060ISP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _dmem_read_word
-_dmem_read_word:
- mov.l %d0,-(%sp)
- mov.l (_060ISP_TABLE-0x80+_off_drw,%pc),%d0
- pea.l (_060ISP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _dmem_read_long
-_dmem_read_long:
- mov.l %d0,-(%sp)
- mov.l (_060ISP_TABLE-0x80+_off_drl,%pc),%d0
- pea.l (_060ISP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _dmem_write_byte
-_dmem_write_byte:
- mov.l %d0,-(%sp)
- mov.l (_060ISP_TABLE-0x80+_off_dwb,%pc),%d0
- pea.l (_060ISP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _dmem_write_word
-_dmem_write_word:
- mov.l %d0,-(%sp)
- mov.l (_060ISP_TABLE-0x80+_off_dww,%pc),%d0
- pea.l (_060ISP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _dmem_write_long
-_dmem_write_long:
- mov.l %d0,-(%sp)
- mov.l (_060ISP_TABLE-0x80+_off_dwl,%pc),%d0
- pea.l (_060ISP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
-#
-# This file contains a set of define statements for constants
-# in oreder to promote readability within the core code itself.
-#
-
-set LOCAL_SIZE, 96 # stack frame size(bytes)
-set LV, -LOCAL_SIZE # stack offset
-
-set EXC_ISR, 0x4 # stack status register
-set EXC_IPC, 0x6 # stack pc
-set EXC_IVOFF, 0xa # stacked vector offset
-
-set EXC_AREGS, LV+64 # offset of all address regs
-set EXC_DREGS, LV+32 # offset of all data regs
-
-set EXC_A7, EXC_AREGS+(7*4) # offset of a7
-set EXC_A6, EXC_AREGS+(6*4) # offset of a6
-set EXC_A5, EXC_AREGS+(5*4) # offset of a5
-set EXC_A4, EXC_AREGS+(4*4) # offset of a4
-set EXC_A3, EXC_AREGS+(3*4) # offset of a3
-set EXC_A2, EXC_AREGS+(2*4) # offset of a2
-set EXC_A1, EXC_AREGS+(1*4) # offset of a1
-set EXC_A0, EXC_AREGS+(0*4) # offset of a0
-set EXC_D7, EXC_DREGS+(7*4) # offset of d7
-set EXC_D6, EXC_DREGS+(6*4) # offset of d6
-set EXC_D5, EXC_DREGS+(5*4) # offset of d5
-set EXC_D4, EXC_DREGS+(4*4) # offset of d4
-set EXC_D3, EXC_DREGS+(3*4) # offset of d3
-set EXC_D2, EXC_DREGS+(2*4) # offset of d2
-set EXC_D1, EXC_DREGS+(1*4) # offset of d1
-set EXC_D0, EXC_DREGS+(0*4) # offset of d0
-
-set EXC_TEMP, LV+16 # offset of temp stack space
-
-set EXC_SAVVAL, LV+12 # offset of old areg value
-set EXC_SAVREG, LV+11 # offset of old areg index
-
-set SPCOND_FLG, LV+10 # offset of spc condition flg
-
-set EXC_CC, LV+8 # offset of cc register
-set EXC_EXTWPTR, LV+4 # offset of current PC
-set EXC_EXTWORD, LV+2 # offset of current ext opword
-set EXC_OPWORD, LV+0 # offset of current opword
-
-###########################
-# SPecial CONDition FLaGs #
-###########################
-set mia7_flg, 0x04 # (a7)+ flag
-set mda7_flg, 0x08 # -(a7) flag
-set ichk_flg, 0x10 # chk exception flag
-set idbyz_flg, 0x20 # divbyzero flag
-set restore_flg, 0x40 # restore -(an)+ flag
-set immed_flg, 0x80 # immediate data flag
-
-set mia7_bit, 0x2 # (a7)+ bit
-set mda7_bit, 0x3 # -(a7) bit
-set ichk_bit, 0x4 # chk exception bit
-set idbyz_bit, 0x5 # divbyzero bit
-set restore_bit, 0x6 # restore -(a7)+ bit
-set immed_bit, 0x7 # immediate data bit
-
-#########
-# Misc. #
-#########
-set BYTE, 1 # len(byte) == 1 byte
-set WORD, 2 # len(word) == 2 bytes
-set LONG, 4 # len(longword) == 4 bytes
-
-#########################################################################
-# XDEF **************************************************************** #
-# _isp_unimp(): 060ISP entry point for Unimplemented Instruction #
-# #
-# This handler should be the first code executed upon taking the #
-# "Unimplemented Integer Instruction" exception in an operating #
-# system. #
-# #
-# XREF **************************************************************** #
-# _imem_read_{word,long}() - read instruction word/longword #
-# _mul64() - emulate 64-bit multiply #
-# _div64() - emulate 64-bit divide #
-# _moveperipheral() - emulate "movep" #
-# _compandset() - emulate misaligned "cas" #
-# _compandset2() - emulate "cas2" #
-# _chk2_cmp2() - emulate "cmp2" and "chk2" #
-# _isp_done() - "callout" for normal final exit #
-# _real_trace() - "callout" for Trace exception #
-# _real_chk() - "callout" for Chk exception #
-# _real_divbyzero() - "callout" for DZ exception #
-# _real_access() - "callout" for access error exception #
-# #
-# INPUT *************************************************************** #
-# - The system stack contains the Unimp Int Instr stack frame #
-# #
-# OUTPUT ************************************************************** #
-# If Trace exception: #
-# - The system stack changed to contain Trace exc stack frame #
-# If Chk exception: #
-# - The system stack changed to contain Chk exc stack frame #
-# If DZ exception: #
-# - The system stack changed to contain DZ exc stack frame #
-# If access error exception: #
-# - The system stack changed to contain access err exc stk frame #
-# Else: #
-# - Results saved as appropriate #
-# #
-# ALGORITHM *********************************************************** #
-# This handler fetches the first instruction longword from #
-# memory and decodes it to determine which of the unimplemented #
-# integer instructions caused this exception. This handler then calls #
-# one of _mul64(), _div64(), _moveperipheral(), _compandset(), #
-# _compandset2(), or _chk2_cmp2() as appropriate. #
-# Some of these instructions, by their nature, may produce other #
-# types of exceptions. "div" can produce a divide-by-zero exception, #
-# and "chk2" can cause a "Chk" exception. In both cases, the current #
-# exception stack frame must be converted to an exception stack frame #
-# of the correct exception type and an exit must be made through #
-# _real_divbyzero() or _real_chk() as appropriate. In addition, all #
-# instructions may be executing while Trace is enabled. If so, then #
-# a Trace exception stack frame must be created and an exit made #
-# through _real_trace(). #
-# Meanwhile, if any read or write to memory using the #
-# _mem_{read,write}() "callout"s returns a failing value, then an #
-# access error frame must be created and an exit made through #
-# _real_access(). #
-# If none of these occur, then a normal exit is made through #
-# _isp_done(). #
-# #
-# This handler, upon entry, saves almost all user-visible #
-# address and data registers to the stack. Although this may seem to #
-# cause excess memory traffic, it was found that due to having to #
-# access these register files for things like data retrieval and <ea> #
-# calculations, it was more efficient to have them on the stack where #
-# they could be accessed by indexing rather than to make subroutine #
-# calls to retrieve a register of a particular index. #
-# #
-#########################################################################
-
- global _isp_unimp
-_isp_unimp:
- link.w %a6,&-LOCAL_SIZE # create room for stack frame
-
- movm.l &0x3fff,EXC_DREGS(%a6) # store d0-d7/a0-a5
- mov.l (%a6),EXC_A6(%a6) # store a6
-
- btst &0x5,EXC_ISR(%a6) # from s or u mode?
- bne.b uieh_s # supervisor mode
-uieh_u:
- mov.l %usp,%a0 # fetch user stack pointer
- mov.l %a0,EXC_A7(%a6) # store a7
- bra.b uieh_cont
-uieh_s:
- lea 0xc(%a6),%a0
- mov.l %a0,EXC_A7(%a6) # store corrected sp
-
-###############################################################################
-
-uieh_cont:
- clr.b SPCOND_FLG(%a6) # clear "special case" flag
-
- mov.w EXC_ISR(%a6),EXC_CC(%a6) # store cc copy on stack
- mov.l EXC_IPC(%a6),EXC_EXTWPTR(%a6) # store extwptr on stack
-
-#
-# fetch the opword and first extension word pointed to by the stacked pc
-# and store them to the stack for now
-#
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch opword & extword
- mov.l %d0,EXC_OPWORD(%a6) # store extword on stack
-
-
-#########################################################################
-# muls.l 0100 1100 00 |<ea>| 0*** 1100 0000 0*** #
-# mulu.l 0100 1100 00 |<ea>| 0*** 0100 0000 0*** #
-# #
-# divs.l 0100 1100 01 |<ea>| 0*** 1100 0000 0*** #
-# divu.l 0100 1100 01 |<ea>| 0*** 0100 0000 0*** #
-# #
-# movep.w m2r 0000 ***1 00 001*** | <displacement> | #
-# movep.l m2r 0000 ***1 01 001*** | <displacement> | #
-# movep.w r2m 0000 ***1 10 001*** | <displacement> | #
-# movep.l r2m 0000 ***1 11 001*** | <displacement> | #
-# #
-# cas.w 0000 1100 11 |<ea>| 0000 000* **00 0*** #
-# cas.l 0000 1110 11 |<ea>| 0000 000* **00 0*** #
-# #
-# cas2.w 0000 1100 11 111100 **** 000* **00 0*** #
-# **** 000* **00 0*** #
-# cas2.l 0000 1110 11 111100 **** 000* **00 0*** #
-# **** 000* **00 0*** #
-# #
-# chk2.b 0000 0000 11 |<ea>| **** 1000 0000 0000 #
-# chk2.w 0000 0010 11 |<ea>| **** 1000 0000 0000 #
-# chk2.l 0000 0100 11 |<ea>| **** 1000 0000 0000 #
-# #
-# cmp2.b 0000 0000 11 |<ea>| **** 0000 0000 0000 #
-# cmp2.w 0000 0010 11 |<ea>| **** 0000 0000 0000 #
-# cmp2.l 0000 0100 11 |<ea>| **** 0000 0000 0000 #
-#########################################################################
-
-#
-# using bit 14 of the operation word, separate into 2 groups:
-# (group1) mul64, div64
-# (group2) movep, chk2, cmp2, cas2, cas
-#
- btst &0x1e,%d0 # group1 or group2
- beq.b uieh_group2 # go handle group2
-
-#
-# now, w/ group1, make mul64's decode the fastest since it will
-# most likely be used the most.
-#
-uieh_group1:
- btst &0x16,%d0 # test for div64
- bne.b uieh_div64 # go handle div64
-
-uieh_mul64:
-# mul64() may use ()+ addressing and may, therefore, alter a7
-
- bsr.l _mul64 # _mul64()
-
- btst &0x5,EXC_ISR(%a6) # supervisor mode?
- beq.w uieh_done
- btst &mia7_bit,SPCOND_FLG(%a6) # was a7 changed?
- beq.w uieh_done # no
- btst &0x7,EXC_ISR(%a6) # is trace enabled?
- bne.w uieh_trace_a7 # yes
- bra.w uieh_a7 # no
-
-uieh_div64:
-# div64() may use ()+ addressing and may, therefore, alter a7.
-# div64() may take a divide by zero exception.
-
- bsr.l _div64 # _div64()
-
-# here, we sort out all of the special cases that may have happened.
- btst &mia7_bit,SPCOND_FLG(%a6) # was a7 changed?
- bne.b uieh_div64_a7 # yes
-uieh_div64_dbyz:
- btst &idbyz_bit,SPCOND_FLG(%a6) # did divide-by-zero occur?
- bne.w uieh_divbyzero # yes
- bra.w uieh_done # no
-uieh_div64_a7:
- btst &0x5,EXC_ISR(%a6) # supervisor mode?
- beq.b uieh_div64_dbyz # no
-# here, a7 has been incremented by 4 bytes in supervisor mode. we still
-# may have the following 3 cases:
-# (i) (a7)+
-# (ii) (a7)+; trace
-# (iii) (a7)+; divide-by-zero
-#
- btst &idbyz_bit,SPCOND_FLG(%a6) # did divide-by-zero occur?
- bne.w uieh_divbyzero_a7 # yes
- tst.b EXC_ISR(%a6) # no; is trace enabled?
- bmi.w uieh_trace_a7 # yes
- bra.w uieh_a7 # no
-
-#
-# now, w/ group2, make movep's decode the fastest since it will
-# most likely be used the most.
-#
-uieh_group2:
- btst &0x18,%d0 # test for not movep
- beq.b uieh_not_movep
-
-
- bsr.l _moveperipheral # _movep()
- bra.w uieh_done
-
-uieh_not_movep:
- btst &0x1b,%d0 # test for chk2,cmp2
- beq.b uieh_chk2cmp2 # go handle chk2,cmp2
-
- swap %d0 # put opword in lo word
- cmpi.b %d0,&0xfc # test for cas2
- beq.b uieh_cas2 # go handle cas2
-
-uieh_cas:
-
- bsr.l _compandset # _cas()
-
-# the cases of "cas Dc,Du,(a7)+" and "cas Dc,Du,-(a7)" used from supervisor
-# mode are simply not considered valid and therefore are not handled.
-
- bra.w uieh_done
-
-uieh_cas2:
-
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word # read extension word
-
- tst.l %d1 # ifetch error?
- bne.w isp_iacc # yes
-
- bsr.l _compandset2 # _cas2()
- bra.w uieh_done
-
-uieh_chk2cmp2:
-# chk2 may take a chk exception
-
- bsr.l _chk2_cmp2 # _chk2_cmp2()
-
-# here we check to see if a chk trap should be taken
- cmpi.b SPCOND_FLG(%a6),&ichk_flg
- bne.w uieh_done
- bra.b uieh_chk_trap
-
-###########################################################################
-
-#
-# the required emulation has been completed. now, clean up the necessary stack
-# info and prepare for rte
-#
-uieh_done:
- mov.b EXC_CC+1(%a6),EXC_ISR+1(%a6) # insert new ccodes
-
-# if exception occurred in user mode, then we have to restore a7 in case it
-# changed. we don't have to update a7 for supervisor mose because that case
-# doesn't flow through here
- btst &0x5,EXC_ISR(%a6) # user or supervisor?
- bne.b uieh_finish # supervisor
-
- mov.l EXC_A7(%a6),%a0 # fetch user stack pointer
- mov.l %a0,%usp # restore it
-
-uieh_finish:
- movm.l EXC_DREGS(%a6),&0x3fff # restore d0-d7/a0-a5
-
- btst &0x7,EXC_ISR(%a6) # is trace mode on?
- bne.b uieh_trace # yes;go handle trace mode
-
- mov.l EXC_EXTWPTR(%a6),EXC_IPC(%a6) # new pc on stack frame
- mov.l EXC_A6(%a6),(%a6) # prepare new a6 for unlink
- unlk %a6 # unlink stack frame
- bra.l _isp_done
-
-#
-# The instruction that was just emulated was also being traced. The trace
-# trap for this instruction will be lost unless we jump to the trace handler.
-# So, here we create a Trace Exception format number two exception stack
-# frame from the Unimplemented Integer Intruction Exception stack frame
-# format number zero and jump to the user supplied hook "_real_trace()".
-#
-# UIEH FRAME TRACE FRAME
-# ***************** *****************
-# * 0x0 * 0x0f4 * * Current *
-# ***************** * PC *
-# * Current * *****************
-# * PC * * 0x2 * 0x024 *
-# ***************** *****************
-# * SR * * Next *
-# ***************** * PC *
-# ->* Old * *****************
-# from link -->* A6 * * SR *
-# ***************** *****************
-# /* A7 * * New * <-- for final unlink
-# / * * * A6 *
-# link frame < ***************** *****************
-# \ ~ ~ ~ ~
-# \***************** *****************
-#
-uieh_trace:
- mov.l EXC_A6(%a6),-0x4(%a6)
- mov.w EXC_ISR(%a6),0x0(%a6)
- mov.l EXC_IPC(%a6),0x8(%a6)
- mov.l EXC_EXTWPTR(%a6),0x2(%a6)
- mov.w &0x2024,0x6(%a6)
- sub.l &0x4,%a6
- unlk %a6
- bra.l _real_trace
-
-#
-# UIEH FRAME CHK FRAME
-# ***************** *****************
-# * 0x0 * 0x0f4 * * Current *
-# ***************** * PC *
-# * Current * *****************
-# * PC * * 0x2 * 0x018 *
-# ***************** *****************
-# * SR * * Next *
-# ***************** * PC *
-# (4 words) *****************
-# * SR *
-# *****************
-# (6 words)
-#
-# the chk2 instruction should take a chk trap. so, here we must create a
-# chk stack frame from an unimplemented integer instruction exception frame
-# and jump to the user supplied entry point "_real_chk()".
-#
-uieh_chk_trap:
- mov.b EXC_CC+1(%a6),EXC_ISR+1(%a6) # insert new ccodes
- movm.l EXC_DREGS(%a6),&0x3fff # restore d0-d7/a0-a5
-
- mov.w EXC_ISR(%a6),(%a6) # put new SR on stack
- mov.l EXC_IPC(%a6),0x8(%a6) # put "Current PC" on stack
- mov.l EXC_EXTWPTR(%a6),0x2(%a6) # put "Next PC" on stack
- mov.w &0x2018,0x6(%a6) # put Vector Offset on stack
-
- mov.l EXC_A6(%a6),%a6 # restore a6
- add.l &LOCAL_SIZE,%sp # clear stack frame
-
- bra.l _real_chk
-
-#
-# UIEH FRAME DIVBYZERO FRAME
-# ***************** *****************
-# * 0x0 * 0x0f4 * * Current *
-# ***************** * PC *
-# * Current * *****************
-# * PC * * 0x2 * 0x014 *
-# ***************** *****************
-# * SR * * Next *
-# ***************** * PC *
-# (4 words) *****************
-# * SR *
-# *****************
-# (6 words)
-#
-# the divide instruction should take an integer divide by zero trap. so, here
-# we must create a divbyzero stack frame from an unimplemented integer
-# instruction exception frame and jump to the user supplied entry point
-# "_real_divbyzero()".
-#
-uieh_divbyzero:
- mov.b EXC_CC+1(%a6),EXC_ISR+1(%a6) # insert new ccodes
- movm.l EXC_DREGS(%a6),&0x3fff # restore d0-d7/a0-a5
-
- mov.w EXC_ISR(%a6),(%a6) # put new SR on stack
- mov.l EXC_IPC(%a6),0x8(%a6) # put "Current PC" on stack
- mov.l EXC_EXTWPTR(%a6),0x2(%a6) # put "Next PC" on stack
- mov.w &0x2014,0x6(%a6) # put Vector Offset on stack
-
- mov.l EXC_A6(%a6),%a6 # restore a6
- add.l &LOCAL_SIZE,%sp # clear stack frame
-
- bra.l _real_divbyzero
-
-#
-# DIVBYZERO FRAME
-# *****************
-# * Current *
-# UIEH FRAME * PC *
-# ***************** *****************
-# * 0x0 * 0x0f4 * * 0x2 * 0x014 *
-# ***************** *****************
-# * Current * * Next *
-# * PC * * PC *
-# ***************** *****************
-# * SR * * SR *
-# ***************** *****************
-# (4 words) (6 words)
-#
-# the divide instruction should take an integer divide by zero trap. so, here
-# we must create a divbyzero stack frame from an unimplemented integer
-# instruction exception frame and jump to the user supplied entry point
-# "_real_divbyzero()".
-#
-# However, we must also deal with the fact that (a7)+ was used from supervisor
-# mode, thereby shifting the stack frame up 4 bytes.
-#
-uieh_divbyzero_a7:
- mov.b EXC_CC+1(%a6),EXC_ISR+1(%a6) # insert new ccodes
- movm.l EXC_DREGS(%a6),&0x3fff # restore d0-d7/a0-a5
-
- mov.l EXC_IPC(%a6),0xc(%a6) # put "Current PC" on stack
- mov.w &0x2014,0xa(%a6) # put Vector Offset on stack
- mov.l EXC_EXTWPTR(%a6),0x6(%a6) # put "Next PC" on stack
-
- mov.l EXC_A6(%a6),%a6 # restore a6
- add.l &4+LOCAL_SIZE,%sp # clear stack frame
-
- bra.l _real_divbyzero
-
-#
-# TRACE FRAME
-# *****************
-# * Current *
-# UIEH FRAME * PC *
-# ***************** *****************
-# * 0x0 * 0x0f4 * * 0x2 * 0x024 *
-# ***************** *****************
-# * Current * * Next *
-# * PC * * PC *
-# ***************** *****************
-# * SR * * SR *
-# ***************** *****************
-# (4 words) (6 words)
-#
-#
-# The instruction that was just emulated was also being traced. The trace
-# trap for this instruction will be lost unless we jump to the trace handler.
-# So, here we create a Trace Exception format number two exception stack
-# frame from the Unimplemented Integer Intruction Exception stack frame
-# format number zero and jump to the user supplied hook "_real_trace()".
-#
-# However, we must also deal with the fact that (a7)+ was used from supervisor
-# mode, thereby shifting the stack frame up 4 bytes.
-#
-uieh_trace_a7:
- mov.b EXC_CC+1(%a6),EXC_ISR+1(%a6) # insert new ccodes
- movm.l EXC_DREGS(%a6),&0x3fff # restore d0-d7/a0-a5
-
- mov.l EXC_IPC(%a6),0xc(%a6) # put "Current PC" on stack
- mov.w &0x2024,0xa(%a6) # put Vector Offset on stack
- mov.l EXC_EXTWPTR(%a6),0x6(%a6) # put "Next PC" on stack
-
- mov.l EXC_A6(%a6),%a6 # restore a6
- add.l &4+LOCAL_SIZE,%sp # clear stack frame
-
- bra.l _real_trace
-
-#
-# UIEH FRAME
-# *****************
-# * 0x0 * 0x0f4 *
-# UIEH FRAME *****************
-# ***************** * Next *
-# * 0x0 * 0x0f4 * * PC *
-# ***************** *****************
-# * Current * * SR *
-# * PC * *****************
-# ***************** (4 words)
-# * SR *
-# *****************
-# (4 words)
-uieh_a7:
- mov.b EXC_CC+1(%a6),EXC_ISR+1(%a6) # insert new ccodes
- movm.l EXC_DREGS(%a6),&0x3fff # restore d0-d7/a0-a5
-
- mov.w &0x00f4,0xe(%a6) # put Vector Offset on stack
- mov.l EXC_EXTWPTR(%a6),0xa(%a6) # put "Next PC" on stack
- mov.w EXC_ISR(%a6),0x8(%a6) # put SR on stack
-
- mov.l EXC_A6(%a6),%a6 # restore a6
- add.l &8+LOCAL_SIZE,%sp # clear stack frame
- bra.l _isp_done
-
-##########
-
-# this is the exit point if a data read or write fails.
-# a0 = failing address
-# d0 = fslw
-isp_dacc:
- mov.l %a0,(%a6) # save address
- mov.l %d0,-0x4(%a6) # save partial fslw
-
- lea -64(%a6),%sp
- movm.l (%sp)+,&0x7fff # restore d0-d7/a0-a6
-
- mov.l 0xc(%sp),-(%sp) # move voff,hi(pc)
- mov.l 0x4(%sp),0x10(%sp) # store fslw
- mov.l 0xc(%sp),0x4(%sp) # store sr,lo(pc)
- mov.l 0x8(%sp),0xc(%sp) # store address
- mov.l (%sp)+,0x4(%sp) # store voff,hi(pc)
- mov.w &0x4008,0x6(%sp) # store new voff
-
- bra.b isp_acc_exit
-
-# this is the exit point if an instruction word read fails.
-# FSLW:
-# misaligned = true
-# read = true
-# size = word
-# instruction = true
-# software emulation error = true
-isp_iacc:
- movm.l EXC_DREGS(%a6),&0x3fff # restore d0-d7/a0-a5
- unlk %a6 # unlink frame
- sub.w &0x8,%sp # make room for acc frame
- mov.l 0x8(%sp),(%sp) # store sr,lo(pc)
- mov.w 0xc(%sp),0x4(%sp) # store hi(pc)
- mov.w &0x4008,0x6(%sp) # store new voff
- mov.l 0x2(%sp),0x8(%sp) # store address (=pc)
- mov.l &0x09428001,0xc(%sp) # store fslw
-
-isp_acc_exit:
- btst &0x5,(%sp) # user or supervisor?
- beq.b isp_acc_exit2 # user
- bset &0x2,0xd(%sp) # set supervisor TM bit
-isp_acc_exit2:
- bra.l _real_access
-
-# if the addressing mode was (an)+ or -(an), the address register must
-# be restored to its pre-exception value before entering _real_access.
-isp_restore:
- cmpi.b SPCOND_FLG(%a6),&restore_flg # do we need a restore?
- bne.b isp_restore_done # no
- clr.l %d0
- mov.b EXC_SAVREG(%a6),%d0 # regno to restore
- mov.l EXC_SAVVAL(%a6),(EXC_AREGS,%a6,%d0.l*4) # restore value
-isp_restore_done:
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# _calc_ea(): routine to calculate effective address #
-# #
-# XREF **************************************************************** #
-# _imem_read_word() - read instruction word #
-# _imem_read_long() - read instruction longword #
-# _dmem_read_long() - read data longword (for memory indirect) #
-# isp_iacc() - handle instruction access error exception #
-# isp_dacc() - handle data access error exception #
-# #
-# INPUT *************************************************************** #
-# d0 = number of bytes related to effective address (w,l) #
-# #
-# OUTPUT ************************************************************** #
-# If exiting through isp_dacc... #
-# a0 = failing address #
-# d0 = FSLW #
-# elsif exiting though isp_iacc... #
-# none #
-# else #
-# a0 = effective address #
-# #
-# ALGORITHM *********************************************************** #
-# The effective address type is decoded from the opword residing #
-# on the stack. A jump table is used to vector to a routine for the #
-# appropriate mode. Since none of the emulated integer instructions #
-# uses byte-sized operands, only handle word and long operations. #
-# #
-# Dn,An - shouldn't enter here #
-# (An) - fetch An value from stack #
-# -(An) - fetch An value from stack; return decr value; #
-# place decr value on stack; store old value in case of #
-# future access error; if -(a7), set mda7_flg in #
-# SPCOND_FLG #
-# (An)+ - fetch An value from stack; return value; #
-# place incr value on stack; store old value in case of #
-# future access error; if (a7)+, set mia7_flg in #
-# SPCOND_FLG #
-# (d16,An) - fetch An value from stack; read d16 using #
-# _imem_read_word(); fetch may fail -> branch to #
-# isp_iacc() #
-# (xxx).w,(xxx).l - use _imem_read_{word,long}() to fetch #
-# address; fetch may fail #
-# #<data> - return address of immediate value; set immed_flg #
-# in SPCOND_FLG #
-# (d16,PC) - fetch stacked PC value; read d16 using #
-# _imem_read_word(); fetch may fail -> branch to #
-# isp_iacc() #
-# everything else - read needed displacements as appropriate w/ #
-# _imem_read_{word,long}(); read may fail; if memory #
-# indirect, read indirect address using #
-# _dmem_read_long() which may also fail #
-# #
-#########################################################################
-
- global _calc_ea
-_calc_ea:
- mov.l %d0,%a0 # move # bytes to a0
-
-# MODE and REG are taken from the EXC_OPWORD.
- mov.w EXC_OPWORD(%a6),%d0 # fetch opcode word
- mov.w %d0,%d1 # make a copy
-
- andi.w &0x3f,%d0 # extract mode field
- andi.l &0x7,%d1 # extract reg field
-
-# jump to the corresponding function for each {MODE,REG} pair.
- mov.w (tbl_ea_mode.b,%pc,%d0.w*2), %d0 # fetch jmp distance
- jmp (tbl_ea_mode.b,%pc,%d0.w*1) # jmp to correct ea mode
-
- swbeg &64
-tbl_ea_mode:
- short tbl_ea_mode - tbl_ea_mode
- short tbl_ea_mode - tbl_ea_mode
- short tbl_ea_mode - tbl_ea_mode
- short tbl_ea_mode - tbl_ea_mode
- short tbl_ea_mode - tbl_ea_mode
- short tbl_ea_mode - tbl_ea_mode
- short tbl_ea_mode - tbl_ea_mode
- short tbl_ea_mode - tbl_ea_mode
-
- short tbl_ea_mode - tbl_ea_mode
- short tbl_ea_mode - tbl_ea_mode
- short tbl_ea_mode - tbl_ea_mode
- short tbl_ea_mode - tbl_ea_mode
- short tbl_ea_mode - tbl_ea_mode
- short tbl_ea_mode - tbl_ea_mode
- short tbl_ea_mode - tbl_ea_mode
- short tbl_ea_mode - tbl_ea_mode
-
- short addr_ind_a0 - tbl_ea_mode
- short addr_ind_a1 - tbl_ea_mode
- short addr_ind_a2 - tbl_ea_mode
- short addr_ind_a3 - tbl_ea_mode
- short addr_ind_a4 - tbl_ea_mode
- short addr_ind_a5 - tbl_ea_mode
- short addr_ind_a6 - tbl_ea_mode
- short addr_ind_a7 - tbl_ea_mode
-
- short addr_ind_p_a0 - tbl_ea_mode
- short addr_ind_p_a1 - tbl_ea_mode
- short addr_ind_p_a2 - tbl_ea_mode
- short addr_ind_p_a3 - tbl_ea_mode
- short addr_ind_p_a4 - tbl_ea_mode
- short addr_ind_p_a5 - tbl_ea_mode
- short addr_ind_p_a6 - tbl_ea_mode
- short addr_ind_p_a7 - tbl_ea_mode
-
- short addr_ind_m_a0 - tbl_ea_mode
- short addr_ind_m_a1 - tbl_ea_mode
- short addr_ind_m_a2 - tbl_ea_mode
- short addr_ind_m_a3 - tbl_ea_mode
- short addr_ind_m_a4 - tbl_ea_mode
- short addr_ind_m_a5 - tbl_ea_mode
- short addr_ind_m_a6 - tbl_ea_mode
- short addr_ind_m_a7 - tbl_ea_mode
-
- short addr_ind_disp_a0 - tbl_ea_mode
- short addr_ind_disp_a1 - tbl_ea_mode
- short addr_ind_disp_a2 - tbl_ea_mode
- short addr_ind_disp_a3 - tbl_ea_mode
- short addr_ind_disp_a4 - tbl_ea_mode
- short addr_ind_disp_a5 - tbl_ea_mode
- short addr_ind_disp_a6 - tbl_ea_mode
- short addr_ind_disp_a7 - tbl_ea_mode
-
- short _addr_ind_ext - tbl_ea_mode
- short _addr_ind_ext - tbl_ea_mode
- short _addr_ind_ext - tbl_ea_mode
- short _addr_ind_ext - tbl_ea_mode
- short _addr_ind_ext - tbl_ea_mode
- short _addr_ind_ext - tbl_ea_mode
- short _addr_ind_ext - tbl_ea_mode
- short _addr_ind_ext - tbl_ea_mode
-
- short abs_short - tbl_ea_mode
- short abs_long - tbl_ea_mode
- short pc_ind - tbl_ea_mode
- short pc_ind_ext - tbl_ea_mode
- short immediate - tbl_ea_mode
- short tbl_ea_mode - tbl_ea_mode
- short tbl_ea_mode - tbl_ea_mode
- short tbl_ea_mode - tbl_ea_mode
-
-###################################
-# Address register indirect: (An) #
-###################################
-addr_ind_a0:
- mov.l EXC_A0(%a6),%a0 # Get current a0
- rts
-
-addr_ind_a1:
- mov.l EXC_A1(%a6),%a0 # Get current a1
- rts
-
-addr_ind_a2:
- mov.l EXC_A2(%a6),%a0 # Get current a2
- rts
-
-addr_ind_a3:
- mov.l EXC_A3(%a6),%a0 # Get current a3
- rts
-
-addr_ind_a4:
- mov.l EXC_A4(%a6),%a0 # Get current a4
- rts
-
-addr_ind_a5:
- mov.l EXC_A5(%a6),%a0 # Get current a5
- rts
-
-addr_ind_a6:
- mov.l EXC_A6(%a6),%a0 # Get current a6
- rts
-
-addr_ind_a7:
- mov.l EXC_A7(%a6),%a0 # Get current a7
- rts
-
-#####################################################
-# Address register indirect w/ postincrement: (An)+ #
-#####################################################
-addr_ind_p_a0:
- mov.l %a0,%d0 # copy no. bytes
- mov.l EXC_A0(%a6),%a0 # load current value
- add.l %a0,%d0 # increment
- mov.l %d0,EXC_A0(%a6) # save incremented value
-
- mov.l %a0,EXC_SAVVAL(%a6) # save in case of access error
- mov.b &0x0,EXC_SAVREG(%a6) # save regno, too
- mov.b &restore_flg,SPCOND_FLG(%a6) # set flag
- rts
-
-addr_ind_p_a1:
- mov.l %a0,%d0 # copy no. bytes
- mov.l EXC_A1(%a6),%a0 # load current value
- add.l %a0,%d0 # increment
- mov.l %d0,EXC_A1(%a6) # save incremented value
-
- mov.l %a0,EXC_SAVVAL(%a6) # save in case of access error
- mov.b &0x1,EXC_SAVREG(%a6) # save regno, too
- mov.b &restore_flg,SPCOND_FLG(%a6) # set flag
- rts
-
-addr_ind_p_a2:
- mov.l %a0,%d0 # copy no. bytes
- mov.l EXC_A2(%a6),%a0 # load current value
- add.l %a0,%d0 # increment
- mov.l %d0,EXC_A2(%a6) # save incremented value
-
- mov.l %a0,EXC_SAVVAL(%a6) # save in case of access error
- mov.b &0x2,EXC_SAVREG(%a6) # save regno, too
- mov.b &restore_flg,SPCOND_FLG(%a6) # set flag
- rts
-
-addr_ind_p_a3:
- mov.l %a0,%d0 # copy no. bytes
- mov.l EXC_A3(%a6),%a0 # load current value
- add.l %a0,%d0 # increment
- mov.l %d0,EXC_A3(%a6) # save incremented value
-
- mov.l %a0,EXC_SAVVAL(%a6) # save in case of access error
- mov.b &0x3,EXC_SAVREG(%a6) # save regno, too
- mov.b &restore_flg,SPCOND_FLG(%a6) # set flag
- rts
-
-addr_ind_p_a4:
- mov.l %a0,%d0 # copy no. bytes
- mov.l EXC_A4(%a6),%a0 # load current value
- add.l %a0,%d0 # increment
- mov.l %d0,EXC_A4(%a6) # save incremented value
-
- mov.l %a0,EXC_SAVVAL(%a6) # save in case of access error
- mov.b &0x4,EXC_SAVREG(%a6) # save regno, too
- mov.b &restore_flg,SPCOND_FLG(%a6) # set flag
- rts
-
-addr_ind_p_a5:
- mov.l %a0,%d0 # copy no. bytes
- mov.l EXC_A5(%a6),%a0 # load current value
- add.l %a0,%d0 # increment
- mov.l %d0,EXC_A5(%a6) # save incremented value
-
- mov.l %a0,EXC_SAVVAL(%a6) # save in case of access error
- mov.b &0x5,EXC_SAVREG(%a6) # save regno, too
- mov.b &restore_flg,SPCOND_FLG(%a6) # set flag
- rts
-
-addr_ind_p_a6:
- mov.l %a0,%d0 # copy no. bytes
- mov.l EXC_A6(%a6),%a0 # load current value
- add.l %a0,%d0 # increment
- mov.l %d0,EXC_A6(%a6) # save incremented value
-
- mov.l %a0,EXC_SAVVAL(%a6) # save in case of access error
- mov.b &0x6,EXC_SAVREG(%a6) # save regno, too
- mov.b &restore_flg,SPCOND_FLG(%a6) # set flag
- rts
-
-addr_ind_p_a7:
- mov.b &mia7_flg,SPCOND_FLG(%a6) # set "special case" flag
-
- mov.l %a0,%d0 # copy no. bytes
- mov.l EXC_A7(%a6),%a0 # load current value
- add.l %a0,%d0 # increment
- mov.l %d0,EXC_A7(%a6) # save incremented value
- rts
-
-####################################################
-# Address register indirect w/ predecrement: -(An) #
-####################################################
-addr_ind_m_a0:
- mov.l EXC_A0(%a6),%d0 # Get current a0
- mov.l %d0,EXC_SAVVAL(%a6) # save in case of access error
- sub.l %a0,%d0 # Decrement
- mov.l %d0,EXC_A0(%a6) # Save decr value
- mov.l %d0,%a0
-
- mov.b &0x0,EXC_SAVREG(%a6) # save regno, too
- mov.b &restore_flg,SPCOND_FLG(%a6) # set flag
- rts
-
-addr_ind_m_a1:
- mov.l EXC_A1(%a6),%d0 # Get current a1
- mov.l %d0,EXC_SAVVAL(%a6) # save in case of access error
- sub.l %a0,%d0 # Decrement
- mov.l %d0,EXC_A1(%a6) # Save decr value
- mov.l %d0,%a0
-
- mov.b &0x1,EXC_SAVREG(%a6) # save regno, too
- mov.b &restore_flg,SPCOND_FLG(%a6) # set flag
- rts
-
-addr_ind_m_a2:
- mov.l EXC_A2(%a6),%d0 # Get current a2
- mov.l %d0,EXC_SAVVAL(%a6) # save in case of access error
- sub.l %a0,%d0 # Decrement
- mov.l %d0,EXC_A2(%a6) # Save decr value
- mov.l %d0,%a0
-
- mov.b &0x2,EXC_SAVREG(%a6) # save regno, too
- mov.b &restore_flg,SPCOND_FLG(%a6) # set flag
- rts
-
-addr_ind_m_a3:
- mov.l EXC_A3(%a6),%d0 # Get current a3
- mov.l %d0,EXC_SAVVAL(%a6) # save in case of access error
- sub.l %a0,%d0 # Decrement
- mov.l %d0,EXC_A3(%a6) # Save decr value
- mov.l %d0,%a0
-
- mov.b &0x3,EXC_SAVREG(%a6) # save regno, too
- mov.b &restore_flg,SPCOND_FLG(%a6) # set flag
- rts
-
-addr_ind_m_a4:
- mov.l EXC_A4(%a6),%d0 # Get current a4
- mov.l %d0,EXC_SAVVAL(%a6) # save in case of access error
- sub.l %a0,%d0 # Decrement
- mov.l %d0,EXC_A4(%a6) # Save decr value
- mov.l %d0,%a0
-
- mov.b &0x4,EXC_SAVREG(%a6) # save regno, too
- mov.b &restore_flg,SPCOND_FLG(%a6) # set flag
- rts
-
-addr_ind_m_a5:
- mov.l EXC_A5(%a6),%d0 # Get current a5
- mov.l %d0,EXC_SAVVAL(%a6) # save in case of access error
- sub.l %a0,%d0 # Decrement
- mov.l %d0,EXC_A5(%a6) # Save decr value
- mov.l %d0,%a0
-
- mov.b &0x5,EXC_SAVREG(%a6) # save regno, too
- mov.b &restore_flg,SPCOND_FLG(%a6) # set flag
- rts
-
-addr_ind_m_a6:
- mov.l EXC_A6(%a6),%d0 # Get current a6
- mov.l %d0,EXC_SAVVAL(%a6) # save in case of access error
- sub.l %a0,%d0 # Decrement
- mov.l %d0,EXC_A6(%a6) # Save decr value
- mov.l %d0,%a0
-
- mov.b &0x6,EXC_SAVREG(%a6) # save regno, too
- mov.b &restore_flg,SPCOND_FLG(%a6) # set flag
- rts
-
-addr_ind_m_a7:
- mov.b &mda7_flg,SPCOND_FLG(%a6) # set "special case" flag
-
- mov.l EXC_A7(%a6),%d0 # Get current a7
- sub.l %a0,%d0 # Decrement
- mov.l %d0,EXC_A7(%a6) # Save decr value
- mov.l %d0,%a0
- rts
-
-########################################################
-# Address register indirect w/ displacement: (d16, An) #
-########################################################
-addr_ind_disp_a0:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # ifetch error?
- bne.l isp_iacc # yes
-
- mov.w %d0,%a0 # sign extend displacement
- add.l EXC_A0(%a6),%a0 # a0 + d16
- rts
-
-addr_ind_disp_a1:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # ifetch error?
- bne.l isp_iacc # yes
-
- mov.w %d0,%a0 # sign extend displacement
- add.l EXC_A1(%a6),%a0 # a1 + d16
- rts
-
-addr_ind_disp_a2:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # ifetch error?
- bne.l isp_iacc # yes
-
- mov.w %d0,%a0 # sign extend displacement
- add.l EXC_A2(%a6),%a0 # a2 + d16
- rts
-
-addr_ind_disp_a3:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # ifetch error?
- bne.l isp_iacc # yes
-
- mov.w %d0,%a0 # sign extend displacement
- add.l EXC_A3(%a6),%a0 # a3 + d16
- rts
-
-addr_ind_disp_a4:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # ifetch error?
- bne.l isp_iacc # yes
-
- mov.w %d0,%a0 # sign extend displacement
- add.l EXC_A4(%a6),%a0 # a4 + d16
- rts
-
-addr_ind_disp_a5:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # ifetch error?
- bne.l isp_iacc # yes
-
- mov.w %d0,%a0 # sign extend displacement
- add.l EXC_A5(%a6),%a0 # a5 + d16
- rts
-
-addr_ind_disp_a6:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # ifetch error?
- bne.l isp_iacc # yes
-
- mov.w %d0,%a0 # sign extend displacement
- add.l EXC_A6(%a6),%a0 # a6 + d16
- rts
-
-addr_ind_disp_a7:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # ifetch error?
- bne.l isp_iacc # yes
-
- mov.w %d0,%a0 # sign extend displacement
- add.l EXC_A7(%a6),%a0 # a7 + d16
- rts
-
-########################################################################
-# Address register indirect w/ index(8-bit displacement): (dn, An, Xn) #
-# " " " w/ " (base displacement): (bd, An, Xn) #
-# Memory indirect postindexed: ([bd, An], Xn, od) #
-# Memory indirect preindexed: ([bd, An, Xn], od) #
-########################################################################
-_addr_ind_ext:
- mov.l %d1,-(%sp)
-
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word # fetch extword in d0
-
- tst.l %d1 # ifetch error?
- bne.l isp_iacc # yes
-
- mov.l (%sp)+,%d1
-
- mov.l (EXC_AREGS,%a6,%d1.w*4),%a0 # put base in a0
-
- btst &0x8,%d0
- beq.b addr_ind_index_8bit # for ext word or not?
-
- movm.l &0x3c00,-(%sp) # save d2-d5
-
- mov.l %d0,%d5 # put extword in d5
- mov.l %a0,%d3 # put base in d3
-
- bra.l calc_mem_ind # calc memory indirect
-
-addr_ind_index_8bit:
- mov.l %d2,-(%sp) # save old d2
-
- mov.l %d0,%d1
- rol.w &0x4,%d1
- andi.w &0xf,%d1 # extract index regno
-
- mov.l (EXC_DREGS,%a6,%d1.w*4),%d1 # fetch index reg value
-
- btst &0xb,%d0 # is it word or long?
- bne.b aii8_long
- ext.l %d1 # sign extend word index
-aii8_long:
- mov.l %d0,%d2
- rol.w &0x7,%d2
- andi.l &0x3,%d2 # extract scale value
-
- lsl.l %d2,%d1 # shift index by scale
-
- extb.l %d0 # sign extend displacement
- add.l %d1,%d0 # index + disp
- add.l %d0,%a0 # An + (index + disp)
-
- mov.l (%sp)+,%d2 # restore old d2
- rts
-
-######################
-# Immediate: #<data> #
-#########################################################################
-# word, long: <ea> of the data is the current extension word #
-# pointer value. new extension word pointer is simply the old #
-# plus the number of bytes in the data type(2 or 4). #
-#########################################################################
-immediate:
- mov.b &immed_flg,SPCOND_FLG(%a6) # set immediate flag
-
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch extension word ptr
- rts
-
-###########################
-# Absolute short: (XXX).W #
-###########################
-abs_short:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word # fetch short address
-
- tst.l %d1 # ifetch error?
- bne.l isp_iacc # yes
-
- mov.w %d0,%a0 # return <ea> in a0
- rts
-
-##########################
-# Absolute long: (XXX).L #
-##########################
-abs_long:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch long address
-
- tst.l %d1 # ifetch error?
- bne.l isp_iacc # yes
-
- mov.l %d0,%a0 # return <ea> in a0
- rts
-
-#######################################################
-# Program counter indirect w/ displacement: (d16, PC) #
-#######################################################
-pc_ind:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word # fetch word displacement
-
- tst.l %d1 # ifetch error?
- bne.l isp_iacc # yes
-
- mov.w %d0,%a0 # sign extend displacement
-
- add.l EXC_EXTWPTR(%a6),%a0 # pc + d16
-
-# _imem_read_word() increased the extwptr by 2. need to adjust here.
- subq.l &0x2,%a0 # adjust <ea>
-
- rts
-
-##########################################################
-# PC indirect w/ index(8-bit displacement): (d8, PC, An) #
-# " " w/ " (base displacement): (bd, PC, An) #
-# PC memory indirect postindexed: ([bd, PC], Xn, od) #
-# PC memory indirect preindexed: ([bd, PC, Xn], od) #
-##########################################################
-pc_ind_ext:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word # fetch ext word
-
- tst.l %d1 # ifetch error?
- bne.l isp_iacc # yes
-
- mov.l EXC_EXTWPTR(%a6),%a0 # put base in a0
- subq.l &0x2,%a0 # adjust base
-
- btst &0x8,%d0 # is disp only 8 bits?
- beq.b pc_ind_index_8bit # yes
-
-# the indexed addressing mode uses a base displacement of size
-# word or long
- movm.l &0x3c00,-(%sp) # save d2-d5
-
- mov.l %d0,%d5 # put extword in d5
- mov.l %a0,%d3 # put base in d3
-
- bra.l calc_mem_ind # calc memory indirect
-
-pc_ind_index_8bit:
- mov.l %d2,-(%sp) # create a temp register
-
- mov.l %d0,%d1 # make extword copy
- rol.w &0x4,%d1 # rotate reg num into place
- andi.w &0xf,%d1 # extract register number
-
- mov.l (EXC_DREGS,%a6,%d1.w*4),%d1 # fetch index reg value
-
- btst &0xb,%d0 # is index word or long?
- bne.b pii8_long # long
- ext.l %d1 # sign extend word index
-pii8_long:
- mov.l %d0,%d2 # make extword copy
- rol.w &0x7,%d2 # rotate scale value into place
- andi.l &0x3,%d2 # extract scale value
-
- lsl.l %d2,%d1 # shift index by scale
-
- extb.l %d0 # sign extend displacement
- add.l %d1,%d0 # index + disp
- add.l %d0,%a0 # An + (index + disp)
-
- mov.l (%sp)+,%d2 # restore temp register
-
- rts
-
-# a5 = exc_extwptr (global to uaeh)
-# a4 = exc_opword (global to uaeh)
-# a3 = exc_dregs (global to uaeh)
-
-# d2 = index (internal " " )
-# d3 = base (internal " " )
-# d4 = od (internal " " )
-# d5 = extword (internal " " )
-calc_mem_ind:
- btst &0x6,%d5 # is the index suppressed?
- beq.b calc_index
- clr.l %d2 # yes, so index = 0
- bra.b base_supp_ck
-calc_index:
- bfextu %d5{&16:&4},%d2
- mov.l (EXC_DREGS,%a6,%d2.w*4),%d2
- btst &0xb,%d5 # is index word or long?
- bne.b no_ext
- ext.l %d2
-no_ext:
- bfextu %d5{&21:&2},%d0
- lsl.l %d0,%d2
-base_supp_ck:
- btst &0x7,%d5 # is the bd suppressed?
- beq.b no_base_sup
- clr.l %d3
-no_base_sup:
- bfextu %d5{&26:&2},%d0 # get bd size
-# beq.l _error # if (size == 0) it's reserved
- cmpi.b %d0,&2
- blt.b no_bd
- beq.b get_word_bd
-
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long
-
- tst.l %d1 # ifetch error?
- bne.l isp_iacc # yes
-
- bra.b chk_ind
-get_word_bd:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # ifetch error?
- bne.l isp_iacc # yes
-
- ext.l %d0 # sign extend bd
-
-chk_ind:
- add.l %d0,%d3 # base += bd
-no_bd:
- bfextu %d5{&30:&2},%d0 # is od suppressed?
- beq.w aii_bd
- cmpi.b %d0,&0x2
- blt.b null_od
- beq.b word_od
-
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long
-
- tst.l %d1 # ifetch error?
- bne.l isp_iacc # yes
-
- bra.b add_them
-
-word_od:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # ifetch error?
- bne.l isp_iacc # yes
-
- ext.l %d0 # sign extend od
- bra.b add_them
-
-null_od:
- clr.l %d0
-add_them:
- mov.l %d0,%d4
- btst &0x2,%d5 # pre or post indexing?
- beq.b pre_indexed
-
- mov.l %d3,%a0
- bsr.l _dmem_read_long
-
- tst.l %d1 # dfetch error?
- bne.b calc_ea_err # yes
-
- add.l %d2,%d0 # <ea> += index
- add.l %d4,%d0 # <ea> += od
- bra.b done_ea
-
-pre_indexed:
- add.l %d2,%d3 # preindexing
- mov.l %d3,%a0
- bsr.l _dmem_read_long
-
- tst.l %d1 # ifetch error?
- bne.b calc_ea_err # yes
-
- add.l %d4,%d0 # ea += od
- bra.b done_ea
-
-aii_bd:
- add.l %d2,%d3 # ea = (base + bd) + index
- mov.l %d3,%d0
-done_ea:
- mov.l %d0,%a0
-
- movm.l (%sp)+,&0x003c # restore d2-d5
- rts
-
-# if dmem_read_long() returns a fail message in d1, the package
-# must create an access error frame. here, we pass a skeleton fslw
-# and the failing address to the routine that creates the new frame.
-# FSLW:
-# read = true
-# size = longword
-# TM = data
-# software emulation error = true
-calc_ea_err:
- mov.l %d3,%a0 # pass failing address
- mov.l &0x01010001,%d0 # pass fslw
- bra.l isp_dacc
-
-#########################################################################
-# XDEF **************************************************************** #
-# _moveperipheral(): routine to emulate movep instruction #
-# #
-# XREF **************************************************************** #
-# _dmem_read_byte() - read byte from memory #
-# _dmem_write_byte() - write byte to memory #
-# isp_dacc() - handle data access error exception #
-# #
-# INPUT *************************************************************** #
-# none #
-# #
-# OUTPUT ************************************************************** #
-# If exiting through isp_dacc... #
-# a0 = failing address #
-# d0 = FSLW #
-# else #
-# none #
-# #
-# ALGORITHM *********************************************************** #
-# Decode the movep instruction words stored at EXC_OPWORD and #
-# either read or write the required bytes from/to memory. Use the #
-# _dmem_{read,write}_byte() routines. If one of the memory routines #
-# returns a failing value, we must pass the failing address and a FSLW #
-# to the _isp_dacc() routine. #
-# Since this instruction is used to access peripherals, make sure #
-# to only access the required bytes. #
-# #
-#########################################################################
-
-###########################
-# movep.(w,l) Dx,(d,Ay) #
-# movep.(w,l) (d,Ay),Dx #
-###########################
- global _moveperipheral
-_moveperipheral:
- mov.w EXC_OPWORD(%a6),%d1 # fetch the opcode word
-
- mov.b %d1,%d0
- and.w &0x7,%d0 # extract Ay from opcode word
-
- mov.l (EXC_AREGS,%a6,%d0.w*4),%a0 # fetch ay
-
- add.w EXC_EXTWORD(%a6),%a0 # add: an + sgn_ext(disp)
-
- btst &0x7,%d1 # (reg 2 mem) or (mem 2 reg)
- beq.w mem2reg
-
-# reg2mem: fetch dx, then write it to memory
-reg2mem:
- mov.w %d1,%d0
- rol.w &0x7,%d0
- and.w &0x7,%d0 # extract Dx from opcode word
-
- mov.l (EXC_DREGS,%a6,%d0.w*4), %d0 # fetch dx
-
- btst &0x6,%d1 # word or long operation?
- beq.b r2mwtrans
-
-# a0 = dst addr
-# d0 = Dx
-r2mltrans:
- mov.l %d0,%d2 # store data
- mov.l %a0,%a2 # store addr
- rol.l &0x8,%d2
- mov.l %d2,%d0
-
- bsr.l _dmem_write_byte # os : write hi
-
- tst.l %d1 # dfetch error?
- bne.w movp_write_err # yes
-
- add.w &0x2,%a2 # incr addr
- mov.l %a2,%a0
- rol.l &0x8,%d2
- mov.l %d2,%d0
-
- bsr.l _dmem_write_byte # os : write lo
-
- tst.l %d1 # dfetch error?
- bne.w movp_write_err # yes
-
- add.w &0x2,%a2 # incr addr
- mov.l %a2,%a0
- rol.l &0x8,%d2
- mov.l %d2,%d0
-
- bsr.l _dmem_write_byte # os : write lo
-
- tst.l %d1 # dfetch error?
- bne.w movp_write_err # yes
-
- add.w &0x2,%a2 # incr addr
- mov.l %a2,%a0
- rol.l &0x8,%d2
- mov.l %d2,%d0
-
- bsr.l _dmem_write_byte # os : write lo
-
- tst.l %d1 # dfetch error?
- bne.w movp_write_err # yes
-
- rts
-
-# a0 = dst addr
-# d0 = Dx
-r2mwtrans:
- mov.l %d0,%d2 # store data
- mov.l %a0,%a2 # store addr
- lsr.w &0x8,%d0
-
- bsr.l _dmem_write_byte # os : write hi
-
- tst.l %d1 # dfetch error?
- bne.w movp_write_err # yes
-
- add.w &0x2,%a2
- mov.l %a2,%a0
- mov.l %d2,%d0
-
- bsr.l _dmem_write_byte # os : write lo
-
- tst.l %d1 # dfetch error?
- bne.w movp_write_err # yes
-
- rts
-
-# mem2reg: read bytes from memory.
-# determines the dest register, and then writes the bytes into it.
-mem2reg:
- btst &0x6,%d1 # word or long operation?
- beq.b m2rwtrans
-
-# a0 = dst addr
-m2rltrans:
- mov.l %a0,%a2 # store addr
-
- bsr.l _dmem_read_byte # read first byte
-
- tst.l %d1 # dfetch error?
- bne.w movp_read_err # yes
-
- mov.l %d0,%d2
-
- add.w &0x2,%a2 # incr addr by 2 bytes
- mov.l %a2,%a0
-
- bsr.l _dmem_read_byte # read second byte
-
- tst.l %d1 # dfetch error?
- bne.w movp_read_err # yes
-
- lsl.w &0x8,%d2
- mov.b %d0,%d2 # append bytes
-
- add.w &0x2,%a2 # incr addr by 2 bytes
- mov.l %a2,%a0
-
- bsr.l _dmem_read_byte # read second byte
-
- tst.l %d1 # dfetch error?
- bne.w movp_read_err # yes
-
- lsl.l &0x8,%d2
- mov.b %d0,%d2 # append bytes
-
- add.w &0x2,%a2 # incr addr by 2 bytes
- mov.l %a2,%a0
-
- bsr.l _dmem_read_byte # read second byte
-
- tst.l %d1 # dfetch error?
- bne.w movp_read_err # yes
-
- lsl.l &0x8,%d2
- mov.b %d0,%d2 # append bytes
-
- mov.b EXC_OPWORD(%a6),%d1
- lsr.b &0x1,%d1
- and.w &0x7,%d1 # extract Dx from opcode word
-
- mov.l %d2,(EXC_DREGS,%a6,%d1.w*4) # store dx
-
- rts
-
-# a0 = dst addr
-m2rwtrans:
- mov.l %a0,%a2 # store addr
-
- bsr.l _dmem_read_byte # read first byte
-
- tst.l %d1 # dfetch error?
- bne.w movp_read_err # yes
-
- mov.l %d0,%d2
-
- add.w &0x2,%a2 # incr addr by 2 bytes
- mov.l %a2,%a0
-
- bsr.l _dmem_read_byte # read second byte
-
- tst.l %d1 # dfetch error?
- bne.w movp_read_err # yes
-
- lsl.w &0x8,%d2
- mov.b %d0,%d2 # append bytes
-
- mov.b EXC_OPWORD(%a6),%d1
- lsr.b &0x1,%d1
- and.w &0x7,%d1 # extract Dx from opcode word
-
- mov.w %d2,(EXC_DREGS+2,%a6,%d1.w*4) # store dx
-
- rts
-
-# if dmem_{read,write}_byte() returns a fail message in d1, the package
-# must create an access error frame. here, we pass a skeleton fslw
-# and the failing address to the routine that creates the new frame.
-# FSLW:
-# write = true
-# size = byte
-# TM = data
-# software emulation error = true
-movp_write_err:
- mov.l %a2,%a0 # pass failing address
- mov.l &0x00a10001,%d0 # pass fslw
- bra.l isp_dacc
-
-# FSLW:
-# read = true
-# size = byte
-# TM = data
-# software emulation error = true
-movp_read_err:
- mov.l %a2,%a0 # pass failing address
- mov.l &0x01210001,%d0 # pass fslw
- bra.l isp_dacc
-
-#########################################################################
-# XDEF **************************************************************** #
-# _chk2_cmp2(): routine to emulate chk2/cmp2 instructions #
-# #
-# XREF **************************************************************** #
-# _calc_ea(): calculate effective address #
-# _dmem_read_long(): read operands #
-# _dmem_read_word(): read operands #
-# isp_dacc(): handle data access error exception #
-# #
-# INPUT *************************************************************** #
-# none #
-# #
-# OUTPUT ************************************************************** #
-# If exiting through isp_dacc... #
-# a0 = failing address #
-# d0 = FSLW #
-# else #
-# none #
-# #
-# ALGORITHM *********************************************************** #
-# First, calculate the effective address, then fetch the byte, #
-# word, or longword sized operands. Then, in the interest of #
-# simplicity, all operands are converted to longword size whether the #
-# operation is byte, word, or long. The bounds are sign extended #
-# accordingly. If Rn is a data regsiter, Rn is also sign extended. If #
-# Rn is an address register, it need not be sign extended since the #
-# full register is always used. #
-# The comparisons are made and the condition codes calculated. #
-# If the instruction is chk2 and the Rn value is out-of-bounds, set #
-# the ichk_flg in SPCOND_FLG. #
-# If the memory fetch returns a failing value, pass the failing #
-# address and FSLW to the isp_dacc() routine. #
-# #
-#########################################################################
-
- global _chk2_cmp2
-_chk2_cmp2:
-
-# passing size parameter doesn't matter since chk2 & cmp2 can't do
-# either predecrement, postincrement, or immediate.
- bsr.l _calc_ea # calculate <ea>
-
- mov.b EXC_EXTWORD(%a6), %d0 # fetch hi extension word
- rol.b &0x4, %d0 # rotate reg bits into lo
- and.w &0xf, %d0 # extract reg bits
-
- mov.l (EXC_DREGS,%a6,%d0.w*4), %d2 # get regval
-
- cmpi.b EXC_OPWORD(%a6), &0x2 # what size is operation?
- blt.b chk2_cmp2_byte # size == byte
- beq.b chk2_cmp2_word # size == word
-
-# the bounds are longword size. call routine to read the lower
-# bound into d0 and the higher bound into d1.
-chk2_cmp2_long:
- mov.l %a0,%a2 # save copy of <ea>
- bsr.l _dmem_read_long # fetch long lower bound
-
- tst.l %d1 # dfetch error?
- bne.w chk2_cmp2_err_l # yes
-
- mov.l %d0,%d3 # save long lower bound
- addq.l &0x4,%a2
- mov.l %a2,%a0 # pass <ea> of long upper bound
- bsr.l _dmem_read_long # fetch long upper bound
-
- tst.l %d1 # dfetch error?
- bne.w chk2_cmp2_err_l # yes
-
- mov.l %d0,%d1 # long upper bound in d1
- mov.l %d3,%d0 # long lower bound in d0
- bra.w chk2_cmp2_compare # go do the compare emulation
-
-# the bounds are word size. fetch them in one subroutine call by
-# reading a longword. sign extend both. if it's a data operation,
-# sign extend Rn to long, also.
-chk2_cmp2_word:
- mov.l %a0,%a2
- bsr.l _dmem_read_long # fetch 2 word bounds
-
- tst.l %d1 # dfetch error?
- bne.w chk2_cmp2_err_l # yes
-
- mov.w %d0, %d1 # place hi in %d1
- swap %d0 # place lo in %d0
-
- ext.l %d0 # sign extend lo bnd
- ext.l %d1 # sign extend hi bnd
-
- btst &0x7, EXC_EXTWORD(%a6) # address compare?
- bne.w chk2_cmp2_compare # yes; don't sign extend
-
-# operation is a data register compare.
-# sign extend word to long so we can do simple longword compares.
- ext.l %d2 # sign extend data word
- bra.w chk2_cmp2_compare # go emulate compare
-
-# the bounds are byte size. fetch them in one subroutine call by
-# reading a word. sign extend both. if it's a data operation,
-# sign extend Rn to long, also.
-chk2_cmp2_byte:
- mov.l %a0,%a2
- bsr.l _dmem_read_word # fetch 2 byte bounds
-
- tst.l %d1 # dfetch error?
- bne.w chk2_cmp2_err_w # yes
-
- mov.b %d0, %d1 # place hi in %d1
- lsr.w &0x8, %d0 # place lo in %d0
-
- extb.l %d0 # sign extend lo bnd
- extb.l %d1 # sign extend hi bnd
-
- btst &0x7, EXC_EXTWORD(%a6) # address compare?
- bne.b chk2_cmp2_compare # yes; don't sign extend
-
-# operation is a data register compare.
-# sign extend byte to long so we can do simple longword compares.
- extb.l %d2 # sign extend data byte
-
-#
-# To set the ccodes correctly:
-# (1) save 'Z' bit from (Rn - lo)
-# (2) save 'Z' and 'N' bits from ((hi - lo) - (Rn - hi))
-# (3) keep 'X', 'N', and 'V' from before instruction
-# (4) combine ccodes
-#
-chk2_cmp2_compare:
- sub.l %d0, %d2 # (Rn - lo)
- mov.w %cc, %d3 # fetch resulting ccodes
- andi.b &0x4, %d3 # keep 'Z' bit
- sub.l %d0, %d1 # (hi - lo)
- cmp.l %d1,%d2 # ((hi - lo) - (Rn - hi))
-
- mov.w %cc, %d4 # fetch resulting ccodes
- or.b %d4, %d3 # combine w/ earlier ccodes
- andi.b &0x5, %d3 # keep 'Z' and 'N'
-
- mov.w EXC_CC(%a6), %d4 # fetch old ccodes
- andi.b &0x1a, %d4 # keep 'X','N','V' bits
- or.b %d3, %d4 # insert new ccodes
- mov.w %d4, EXC_CC(%a6) # save new ccodes
-
- btst &0x3, EXC_EXTWORD(%a6) # separate chk2,cmp2
- bne.b chk2_finish # it's a chk2
-
- rts
-
-# this code handles the only difference between chk2 and cmp2. chk2 would
-# have trapped out if the value was out of bounds. we check this by seeing
-# if the 'N' bit was set by the operation.
-chk2_finish:
- btst &0x0, %d4 # is 'N' bit set?
- bne.b chk2_trap # yes;chk2 should trap
- rts
-chk2_trap:
- mov.b &ichk_flg,SPCOND_FLG(%a6) # set "special case" flag
- rts
-
-# if dmem_read_{long,word}() returns a fail message in d1, the package
-# must create an access error frame. here, we pass a skeleton fslw
-# and the failing address to the routine that creates the new frame.
-# FSLW:
-# read = true
-# size = longword
-# TM = data
-# software emulation error = true
-chk2_cmp2_err_l:
- mov.l %a2,%a0 # pass failing address
- mov.l &0x01010001,%d0 # pass fslw
- bra.l isp_dacc
-
-# FSLW:
-# read = true
-# size = word
-# TM = data
-# software emulation error = true
-chk2_cmp2_err_w:
- mov.l %a2,%a0 # pass failing address
- mov.l &0x01410001,%d0 # pass fslw
- bra.l isp_dacc
-
-#########################################################################
-# XDEF **************************************************************** #
-# _div64(): routine to emulate div{u,s}.l <ea>,Dr:Dq #
-# 64/32->32r:32q #
-# #
-# XREF **************************************************************** #
-# _calc_ea() - calculate effective address #
-# isp_iacc() - handle instruction access error exception #
-# isp_dacc() - handle data access error exception #
-# isp_restore() - restore An on access error w/ -() or ()+ #
-# #
-# INPUT *************************************************************** #
-# none #
-# #
-# OUTPUT ************************************************************** #
-# If exiting through isp_dacc... #
-# a0 = failing address #
-# d0 = FSLW #
-# else #
-# none #
-# #
-# ALGORITHM *********************************************************** #
-# First, decode the operand location. If it's in Dn, fetch from #
-# the stack. If it's in memory, use _calc_ea() to calculate the #
-# effective address. Use _dmem_read_long() to fetch at that address. #
-# Unless the operand is immediate data. Then use _imem_read_long(). #
-# Send failures to isp_dacc() or isp_iacc() as appropriate. #
-# If the operands are signed, make them unsigned and save the #
-# sign info for later. Separate out special cases like divide-by-zero #
-# or 32-bit divides if possible. Else, use a special math algorithm #
-# to calculate the result. #
-# Restore sign info if signed instruction. Set the condition #
-# codes. Set idbyz_flg in SPCOND_FLG if divisor was zero. Store the #
-# quotient and remainder in the appropriate data registers on the stack.#
-# #
-#########################################################################
-
-set NDIVISOR, EXC_TEMP+0x0
-set NDIVIDEND, EXC_TEMP+0x1
-set NDRSAVE, EXC_TEMP+0x2
-set NDQSAVE, EXC_TEMP+0x4
-set DDSECOND, EXC_TEMP+0x6
-set DDQUOTIENT, EXC_TEMP+0x8
-set DDNORMAL, EXC_TEMP+0xc
-
- global _div64
-#############
-# div(u,s)l #
-#############
-_div64:
- mov.b EXC_OPWORD+1(%a6), %d0
- andi.b &0x38, %d0 # extract src mode
-
- bne.w dcontrolmodel_s # %dn dest or control mode?
-
- mov.b EXC_OPWORD+1(%a6), %d0 # extract Dn from opcode
- andi.w &0x7, %d0
- mov.l (EXC_DREGS,%a6,%d0.w*4), %d7 # fetch divisor from register
-
-dgotsrcl:
- beq.w div64eq0 # divisor is = 0!!!
-
- mov.b EXC_EXTWORD+1(%a6), %d0 # extract Dr from extword
- mov.b EXC_EXTWORD(%a6), %d1 # extract Dq from extword
- and.w &0x7, %d0
- lsr.b &0x4, %d1
- and.w &0x7, %d1
- mov.w %d0, NDRSAVE(%a6) # save Dr for later
- mov.w %d1, NDQSAVE(%a6) # save Dq for later
-
-# fetch %dr and %dq directly off stack since all regs are saved there
- mov.l (EXC_DREGS,%a6,%d0.w*4), %d5 # get dividend hi
- mov.l (EXC_DREGS,%a6,%d1.w*4), %d6 # get dividend lo
-
-# separate signed and unsigned divide
- btst &0x3, EXC_EXTWORD(%a6) # signed or unsigned?
- beq.b dspecialcases # use positive divide
-
-# save the sign of the divisor
-# make divisor unsigned if it's negative
- tst.l %d7 # chk sign of divisor
- slt NDIVISOR(%a6) # save sign of divisor
- bpl.b dsgndividend
- neg.l %d7 # complement negative divisor
-
-# save the sign of the dividend
-# make dividend unsigned if it's negative
-dsgndividend:
- tst.l %d5 # chk sign of hi(dividend)
- slt NDIVIDEND(%a6) # save sign of dividend
- bpl.b dspecialcases
-
- mov.w &0x0, %cc # clear 'X' cc bit
- negx.l %d6 # complement signed dividend
- negx.l %d5
-
-# extract some special cases:
-# - is (dividend == 0) ?
-# - is (hi(dividend) == 0 && (divisor <= lo(dividend))) ? (32-bit div)
-dspecialcases:
- tst.l %d5 # is (hi(dividend) == 0)
- bne.b dnormaldivide # no, so try it the long way
-
- tst.l %d6 # is (lo(dividend) == 0), too
- beq.w ddone # yes, so (dividend == 0)
-
- cmp.l %d7,%d6 # is (divisor <= lo(dividend))
- bls.b d32bitdivide # yes, so use 32 bit divide
-
- exg %d5,%d6 # q = 0, r = dividend
- bra.w divfinish # can't divide, we're done.
-
-d32bitdivide:
- tdivu.l %d7, %d5:%d6 # it's only a 32/32 bit div!
-
- bra.b divfinish
-
-dnormaldivide:
-# last special case:
-# - is hi(dividend) >= divisor ? if yes, then overflow
- cmp.l %d7,%d5
- bls.b ddovf # answer won't fit in 32 bits
-
-# perform the divide algorithm:
- bsr.l dclassical # do int divide
-
-# separate into signed and unsigned finishes.
-divfinish:
- btst &0x3, EXC_EXTWORD(%a6) # do divs, divu separately
- beq.b ddone # divu has no processing!!!
-
-# it was a divs.l, so ccode setting is a little more complicated...
- tst.b NDIVIDEND(%a6) # remainder has same sign
- beq.b dcc # as dividend.
- neg.l %d5 # sgn(rem) = sgn(dividend)
-dcc:
- mov.b NDIVISOR(%a6), %d0
- eor.b %d0, NDIVIDEND(%a6) # chk if quotient is negative
- beq.b dqpos # branch to quot positive
-
-# 0x80000000 is the largest number representable as a 32-bit negative
-# number. the negative of 0x80000000 is 0x80000000.
- cmpi.l %d6, &0x80000000 # will (-quot) fit in 32 bits?
- bhi.b ddovf
-
- neg.l %d6 # make (-quot) 2's comp
-
- bra.b ddone
-
-dqpos:
- btst &0x1f, %d6 # will (+quot) fit in 32 bits?
- bne.b ddovf
-
-ddone:
-# at this point, result is normal so ccodes are set based on result.
- mov.w EXC_CC(%a6), %cc
- tst.l %d6 # set %ccode bits
- mov.w %cc, EXC_CC(%a6)
-
- mov.w NDRSAVE(%a6), %d0 # get Dr off stack
- mov.w NDQSAVE(%a6), %d1 # get Dq off stack
-
-# if the register numbers are the same, only the quotient gets saved.
-# so, if we always save the quotient second, we save ourselves a cmp&beq
- mov.l %d5, (EXC_DREGS,%a6,%d0.w*4) # save remainder
- mov.l %d6, (EXC_DREGS,%a6,%d1.w*4) # save quotient
-
- rts
-
-ddovf:
- bset &0x1, EXC_CC+1(%a6) # 'V' set on overflow
- bclr &0x0, EXC_CC+1(%a6) # 'C' cleared on overflow
-
- rts
-
-div64eq0:
- andi.b &0x1e, EXC_CC+1(%a6) # clear 'C' bit on divbyzero
- ori.b &idbyz_flg,SPCOND_FLG(%a6) # set "special case" flag
- rts
-
-###########################################################################
-#########################################################################
-# This routine uses the 'classical' Algorithm D from Donald Knuth's #
-# Art of Computer Programming, vol II, Seminumerical Algorithms. #
-# For this implementation b=2**16, and the target is U1U2U3U4/V1V2, #
-# where U,V are words of the quadword dividend and longword divisor, #
-# and U1, V1 are the most significant words. #
-# #
-# The most sig. longword of the 64 bit dividend must be in %d5, least #
-# in %d6. The divisor must be in the variable ddivisor, and the #
-# signed/unsigned flag ddusign must be set (0=unsigned,1=signed). #
-# The quotient is returned in %d6, remainder in %d5, unless the #
-# v (overflow) bit is set in the saved %ccr. If overflow, the dividend #
-# is unchanged. #
-#########################################################################
-dclassical:
-# if the divisor msw is 0, use simpler algorithm then the full blown
-# one at ddknuth:
-
- cmpi.l %d7, &0xffff
- bhi.b ddknuth # go use D. Knuth algorithm
-
-# Since the divisor is only a word (and larger than the mslw of the dividend),
-# a simpler algorithm may be used :
-# In the general case, four quotient words would be created by
-# dividing the divisor word into each dividend word. In this case,
-# the first two quotient words must be zero, or overflow would occur.
-# Since we already checked this case above, we can treat the most significant
-# longword of the dividend as (0) remainder (see Knuth) and merely complete
-# the last two divisions to get a quotient longword and word remainder:
-
- clr.l %d1
- swap %d5 # same as r*b if previous step rqd
- swap %d6 # get u3 to lsw position
- mov.w %d6, %d5 # rb + u3
-
- divu.w %d7, %d5
-
- mov.w %d5, %d1 # first quotient word
- swap %d6 # get u4
- mov.w %d6, %d5 # rb + u4
-
- divu.w %d7, %d5
-
- swap %d1
- mov.w %d5, %d1 # 2nd quotient 'digit'
- clr.w %d5
- swap %d5 # now remainder
- mov.l %d1, %d6 # and quotient
-
- rts
-
-ddknuth:
-# In this algorithm, the divisor is treated as a 2 digit (word) number
-# which is divided into a 3 digit (word) dividend to get one quotient
-# digit (word). After subtraction, the dividend is shifted and the
-# process repeated. Before beginning, the divisor and quotient are
-# 'normalized' so that the process of estimating the quotient digit
-# will yield verifiably correct results..
-
- clr.l DDNORMAL(%a6) # count of shifts for normalization
- clr.b DDSECOND(%a6) # clear flag for quotient digits
- clr.l %d1 # %d1 will hold trial quotient
-ddnchk:
- btst &31, %d7 # must we normalize? first word of
- bne.b ddnormalized # divisor (V1) must be >= 65536/2
- addq.l &0x1, DDNORMAL(%a6) # count normalization shifts
- lsl.l &0x1, %d7 # shift the divisor
- lsl.l &0x1, %d6 # shift u4,u3 with overflow to u2
- roxl.l &0x1, %d5 # shift u1,u2
- bra.w ddnchk
-ddnormalized:
-
-# Now calculate an estimate of the quotient words (msw first, then lsw).
-# The comments use subscripts for the first quotient digit determination.
- mov.l %d7, %d3 # divisor
- mov.l %d5, %d2 # dividend mslw
- swap %d2
- swap %d3
- cmp.w %d2, %d3 # V1 = U1 ?
- bne.b ddqcalc1
- mov.w &0xffff, %d1 # use max trial quotient word
- bra.b ddadj0
-ddqcalc1:
- mov.l %d5, %d1
-
- divu.w %d3, %d1 # use quotient of mslw/msw
-
- andi.l &0x0000ffff, %d1 # zero any remainder
-ddadj0:
-
-# now test the trial quotient and adjust. This step plus the
-# normalization assures (according to Knuth) that the trial
-# quotient will be at worst 1 too large.
- mov.l %d6, -(%sp)
- clr.w %d6 # word u3 left
- swap %d6 # in lsw position
-ddadj1: mov.l %d7, %d3
- mov.l %d1, %d2
- mulu.w %d7, %d2 # V2q
- swap %d3
- mulu.w %d1, %d3 # V1q
- mov.l %d5, %d4 # U1U2
- sub.l %d3, %d4 # U1U2 - V1q
-
- swap %d4
-
- mov.w %d4,%d0
- mov.w %d6,%d4 # insert lower word (U3)
-
- tst.w %d0 # is upper word set?
- bne.w ddadjd1
-
-# add.l %d6, %d4 # (U1U2 - V1q) + U3
-
- cmp.l %d2, %d4
- bls.b ddadjd1 # is V2q > (U1U2-V1q) + U3 ?
- subq.l &0x1, %d1 # yes, decrement and recheck
- bra.b ddadj1
-ddadjd1:
-# now test the word by multiplying it by the divisor (V1V2) and comparing
-# the 3 digit (word) result with the current dividend words
- mov.l %d5, -(%sp) # save %d5 (%d6 already saved)
- mov.l %d1, %d6
- swap %d6 # shift answer to ms 3 words
- mov.l %d7, %d5
- bsr.l dmm2
- mov.l %d5, %d2 # now %d2,%d3 are trial*divisor
- mov.l %d6, %d3
- mov.l (%sp)+, %d5 # restore dividend
- mov.l (%sp)+, %d6
- sub.l %d3, %d6
- subx.l %d2, %d5 # subtract double precision
- bcc dd2nd # no carry, do next quotient digit
- subq.l &0x1, %d1 # q is one too large
-# need to add back divisor longword to current ms 3 digits of dividend
-# - according to Knuth, this is done only 2 out of 65536 times for random
-# divisor, dividend selection.
- clr.l %d2
- mov.l %d7, %d3
- swap %d3
- clr.w %d3 # %d3 now ls word of divisor
- add.l %d3, %d6 # aligned with 3rd word of dividend
- addx.l %d2, %d5
- mov.l %d7, %d3
- clr.w %d3 # %d3 now ms word of divisor
- swap %d3 # aligned with 2nd word of dividend
- add.l %d3, %d5
-dd2nd:
- tst.b DDSECOND(%a6) # both q words done?
- bne.b ddremain
-# first quotient digit now correct. store digit and shift the
-# (subtracted) dividend
- mov.w %d1, DDQUOTIENT(%a6)
- clr.l %d1
- swap %d5
- swap %d6
- mov.w %d6, %d5
- clr.w %d6
- st DDSECOND(%a6) # second digit
- bra.w ddnormalized
-ddremain:
-# add 2nd word to quotient, get the remainder.
- mov.w %d1, DDQUOTIENT+2(%a6)
-# shift down one word/digit to renormalize remainder.
- mov.w %d5, %d6
- swap %d6
- swap %d5
- mov.l DDNORMAL(%a6), %d7 # get norm shift count
- beq.b ddrn
- subq.l &0x1, %d7 # set for loop count
-ddnlp:
- lsr.l &0x1, %d5 # shift into %d6
- roxr.l &0x1, %d6
- dbf %d7, ddnlp
-ddrn:
- mov.l %d6, %d5 # remainder
- mov.l DDQUOTIENT(%a6), %d6 # quotient
-
- rts
-dmm2:
-# factors for the 32X32->64 multiplication are in %d5 and %d6.
-# returns 64 bit result in %d5 (hi) %d6(lo).
-# destroys %d2,%d3,%d4.
-
-# multiply hi,lo words of each factor to get 4 intermediate products
- mov.l %d6, %d2
- mov.l %d6, %d3
- mov.l %d5, %d4
- swap %d3
- swap %d4
- mulu.w %d5, %d6 # %d6 <- lsw*lsw
- mulu.w %d3, %d5 # %d5 <- msw-dest*lsw-source
- mulu.w %d4, %d2 # %d2 <- msw-source*lsw-dest
- mulu.w %d4, %d3 # %d3 <- msw*msw
-# now use swap and addx to consolidate to two longwords
- clr.l %d4
- swap %d6
- add.w %d5, %d6 # add msw of l*l to lsw of m*l product
- addx.w %d4, %d3 # add any carry to m*m product
- add.w %d2, %d6 # add in lsw of other m*l product
- addx.w %d4, %d3 # add any carry to m*m product
- swap %d6 # %d6 is low 32 bits of final product
- clr.w %d5
- clr.w %d2 # lsw of two mixed products used,
- swap %d5 # now use msws of longwords
- swap %d2
- add.l %d2, %d5
- add.l %d3, %d5 # %d5 now ms 32 bits of final product
- rts
-
-##########
-dcontrolmodel_s:
- movq.l &LONG,%d0
- bsr.l _calc_ea # calc <ea>
-
- cmpi.b SPCOND_FLG(%a6),&immed_flg # immediate addressing mode?
- beq.b dimmed # yes
-
- mov.l %a0,%a2
- bsr.l _dmem_read_long # fetch divisor from <ea>
-
- tst.l %d1 # dfetch error?
- bne.b div64_err # yes
-
- mov.l %d0, %d7
- bra.w dgotsrcl
-
-# we have to split out immediate data here because it must be read using
-# imem_read() instead of dmem_read(). this becomes especially important
-# if the fetch runs into some deadly fault.
-dimmed:
- addq.l &0x4,EXC_EXTWPTR(%a6)
- bsr.l _imem_read_long # read immediate value
-
- tst.l %d1 # ifetch error?
- bne.l isp_iacc # yes
-
- mov.l %d0,%d7
- bra.w dgotsrcl
-
-##########
-
-# if dmem_read_long() returns a fail message in d1, the package
-# must create an access error frame. here, we pass a skeleton fslw
-# and the failing address to the routine that creates the new frame.
-# also, we call isp_restore in case the effective addressing mode was
-# (an)+ or -(an) in which case the previous "an" value must be restored.
-# FSLW:
-# read = true
-# size = longword
-# TM = data
-# software emulation error = true
-div64_err:
- bsr.l isp_restore # restore addr reg
- mov.l %a2,%a0 # pass failing address
- mov.l &0x01010001,%d0 # pass fslw
- bra.l isp_dacc
-
-#########################################################################
-# XDEF **************************************************************** #
-# _mul64(): routine to emulate mul{u,s}.l <ea>,Dh:Dl 32x32->64 #
-# #
-# XREF **************************************************************** #
-# _calc_ea() - calculate effective address #
-# isp_iacc() - handle instruction access error exception #
-# isp_dacc() - handle data access error exception #
-# isp_restore() - restore An on access error w/ -() or ()+ #
-# #
-# INPUT *************************************************************** #
-# none #
-# #
-# OUTPUT ************************************************************** #
-# If exiting through isp_dacc... #
-# a0 = failing address #
-# d0 = FSLW #
-# else #
-# none #
-# #
-# ALGORITHM *********************************************************** #
-# First, decode the operand location. If it's in Dn, fetch from #
-# the stack. If it's in memory, use _calc_ea() to calculate the #
-# effective address. Use _dmem_read_long() to fetch at that address. #
-# Unless the operand is immediate data. Then use _imem_read_long(). #
-# Send failures to isp_dacc() or isp_iacc() as appropriate. #
-# If the operands are signed, make them unsigned and save the #
-# sign info for later. Perform the multiplication using 16x16->32 #
-# unsigned multiplies and "add" instructions. Store the high and low #
-# portions of the result in the appropriate data registers on the #
-# stack. Calculate the condition codes, also. #
-# #
-#########################################################################
-
-#############
-# mul(u,s)l #
-#############
- global _mul64
-_mul64:
- mov.b EXC_OPWORD+1(%a6), %d0 # extract src {mode,reg}
- cmpi.b %d0, &0x7 # is src mode Dn or other?
- bgt.w mul64_memop # src is in memory
-
-# multiplier operand in the data register file.
-# must extract the register number and fetch the operand from the stack.
-mul64_regop:
- andi.w &0x7, %d0 # extract Dn
- mov.l (EXC_DREGS,%a6,%d0.w*4), %d3 # fetch multiplier
-
-# multiplier is in %d3. now, extract Dl and Dh fields and fetch the
-# multiplicand from the data register specified by Dl.
-mul64_multiplicand:
- mov.w EXC_EXTWORD(%a6), %d2 # fetch ext word
- clr.w %d1 # clear Dh reg
- mov.b %d2, %d1 # grab Dh
- rol.w &0x4, %d2 # align Dl byte
- andi.w &0x7, %d2 # extract Dl
-
- mov.l (EXC_DREGS,%a6,%d2.w*4), %d4 # get multiplicand
-
-# check for the case of "zero" result early
- tst.l %d4 # test multiplicand
- beq.w mul64_zero # handle zero separately
- tst.l %d3 # test multiplier
- beq.w mul64_zero # handle zero separately
-
-# multiplier is in %d3 and multiplicand is in %d4.
-# if the operation is to be signed, then the operands are converted
-# to unsigned and the result sign is saved for the end.
- clr.b EXC_TEMP(%a6) # clear temp space
- btst &0x3, EXC_EXTWORD(%a6) # signed or unsigned?
- beq.b mul64_alg # unsigned; skip sgn calc
-
- tst.l %d3 # is multiplier negative?
- bge.b mul64_chk_md_sgn # no
- neg.l %d3 # make multiplier positive
- ori.b &0x1, EXC_TEMP(%a6) # save multiplier sgn
-
-# the result sign is the exclusive or of the operand sign bits.
-mul64_chk_md_sgn:
- tst.l %d4 # is multiplicand negative?
- bge.b mul64_alg # no
- neg.l %d4 # make multiplicand positive
- eori.b &0x1, EXC_TEMP(%a6) # calculate correct sign
-
-#########################################################################
-# 63 32 0 #
-# ---------------------------- #
-# | hi(mplier) * hi(mplicand)| #
-# ---------------------------- #
-# ----------------------------- #
-# | hi(mplier) * lo(mplicand) | #
-# ----------------------------- #
-# ----------------------------- #
-# | lo(mplier) * hi(mplicand) | #
-# ----------------------------- #
-# | ----------------------------- #
-# --|-- | lo(mplier) * lo(mplicand) | #
-# | ----------------------------- #
-# ======================================================== #
-# -------------------------------------------------------- #
-# | hi(result) | lo(result) | #
-# -------------------------------------------------------- #
-#########################################################################
-mul64_alg:
-# load temp registers with operands
- mov.l %d3, %d5 # mr in %d5
- mov.l %d3, %d6 # mr in %d6
- mov.l %d4, %d7 # md in %d7
- swap %d6 # hi(mr) in lo %d6
- swap %d7 # hi(md) in lo %d7
-
-# complete necessary multiplies:
- mulu.w %d4, %d3 # [1] lo(mr) * lo(md)
- mulu.w %d6, %d4 # [2] hi(mr) * lo(md)
- mulu.w %d7, %d5 # [3] lo(mr) * hi(md)
- mulu.w %d7, %d6 # [4] hi(mr) * hi(md)
-
-# add lo portions of [2],[3] to hi portion of [1].
-# add carries produced from these adds to [4].
-# lo([1]) is the final lo 16 bits of the result.
- clr.l %d7 # load %d7 w/ zero value
- swap %d3 # hi([1]) <==> lo([1])
- add.w %d4, %d3 # hi([1]) + lo([2])
- addx.l %d7, %d6 # [4] + carry
- add.w %d5, %d3 # hi([1]) + lo([3])
- addx.l %d7, %d6 # [4] + carry
- swap %d3 # lo([1]) <==> hi([1])
-
-# lo portions of [2],[3] have been added in to final result.
-# now, clear lo, put hi in lo reg, and add to [4]
- clr.w %d4 # clear lo([2])
- clr.w %d5 # clear hi([3])
- swap %d4 # hi([2]) in lo %d4
- swap %d5 # hi([3]) in lo %d5
- add.l %d5, %d4 # [4] + hi([2])
- add.l %d6, %d4 # [4] + hi([3])
-
-# unsigned result is now in {%d4,%d3}
- tst.b EXC_TEMP(%a6) # should result be signed?
- beq.b mul64_done # no
-
-# result should be a signed negative number.
-# compute 2's complement of the unsigned number:
-# -negate all bits and add 1
-mul64_neg:
- not.l %d3 # negate lo(result) bits
- not.l %d4 # negate hi(result) bits
- addq.l &1, %d3 # add 1 to lo(result)
- addx.l %d7, %d4 # add carry to hi(result)
-
-# the result is saved to the register file.
-# for '040 compatibility, if Dl == Dh then only the hi(result) is
-# saved. so, saving hi after lo accomplishes this without need to
-# check Dl,Dh equality.
-mul64_done:
- mov.l %d3, (EXC_DREGS,%a6,%d2.w*4) # save lo(result)
- mov.w &0x0, %cc
- mov.l %d4, (EXC_DREGS,%a6,%d1.w*4) # save hi(result)
-
-# now, grab the condition codes. only one that can be set is 'N'.
-# 'N' CAN be set if the operation is unsigned if bit 63 is set.
- mov.w %cc, %d7 # fetch %ccr to see if 'N' set
- andi.b &0x8, %d7 # extract 'N' bit
-
-mul64_ccode_set:
- mov.b EXC_CC+1(%a6), %d6 # fetch previous %ccr
- andi.b &0x10, %d6 # all but 'X' bit changes
-
- or.b %d7, %d6 # group 'X' and 'N'
- mov.b %d6, EXC_CC+1(%a6) # save new %ccr
-
- rts
-
-# one or both of the operands is zero so the result is also zero.
-# save the zero result to the register file and set the 'Z' ccode bit.
-mul64_zero:
- clr.l (EXC_DREGS,%a6,%d2.w*4) # save lo(result)
- clr.l (EXC_DREGS,%a6,%d1.w*4) # save hi(result)
-
- movq.l &0x4, %d7 # set 'Z' ccode bit
- bra.b mul64_ccode_set # finish ccode set
-
-##########
-
-# multiplier operand is in memory at the effective address.
-# must calculate the <ea> and go fetch the 32-bit operand.
-mul64_memop:
- movq.l &LONG, %d0 # pass # of bytes
- bsr.l _calc_ea # calculate <ea>
-
- cmpi.b SPCOND_FLG(%a6),&immed_flg # immediate addressing mode?
- beq.b mul64_immed # yes
-
- mov.l %a0,%a2
- bsr.l _dmem_read_long # fetch src from addr (%a0)
-
- tst.l %d1 # dfetch error?
- bne.w mul64_err # yes
-
- mov.l %d0, %d3 # store multiplier in %d3
-
- bra.w mul64_multiplicand
-
-# we have to split out immediate data here because it must be read using
-# imem_read() instead of dmem_read(). this becomes especially important
-# if the fetch runs into some deadly fault.
-mul64_immed:
- addq.l &0x4,EXC_EXTWPTR(%a6)
- bsr.l _imem_read_long # read immediate value
-
- tst.l %d1 # ifetch error?
- bne.l isp_iacc # yes
-
- mov.l %d0,%d3
- bra.w mul64_multiplicand
-
-##########
-
-# if dmem_read_long() returns a fail message in d1, the package
-# must create an access error frame. here, we pass a skeleton fslw
-# and the failing address to the routine that creates the new frame.
-# also, we call isp_restore in case the effective addressing mode was
-# (an)+ or -(an) in which case the previous "an" value must be restored.
-# FSLW:
-# read = true
-# size = longword
-# TM = data
-# software emulation error = true
-mul64_err:
- bsr.l isp_restore # restore addr reg
- mov.l %a2,%a0 # pass failing address
- mov.l &0x01010001,%d0 # pass fslw
- bra.l isp_dacc
-
-#########################################################################
-# XDEF **************************************************************** #
-# _compandset2(): routine to emulate cas2() #
-# (internal to package) #
-# #
-# _isp_cas2_finish(): store ccodes, store compare regs #
-# (external to package) #
-# #
-# XREF **************************************************************** #
-# _real_lock_page() - "callout" to lock op's page from page-outs #
-# _cas_terminate2() - access error exit #
-# _real_cas2() - "callout" to core cas2 emulation code #
-# _real_unlock_page() - "callout" to unlock page #
-# #
-# INPUT *************************************************************** #
-# _compandset2(): #
-# d0 = instruction extension word #
-# #
-# _isp_cas2_finish(): #
-# see cas2 core emulation code #
-# #
-# OUTPUT ************************************************************** #
-# _compandset2(): #
-# see cas2 core emulation code #
-# #
-# _isp_cas_finish(): #
-# None (register file or memroy changed as appropriate) #
-# #
-# ALGORITHM *********************************************************** #
-# compandset2(): #
-# Decode the instruction and fetch the appropriate Update and #
-# Compare operands. Then call the "callout" _real_lock_page() for each #
-# memory operand address so that the operating system can keep these #
-# pages from being paged out. If either _real_lock_page() fails, exit #
-# through _cas_terminate2(). Don't forget to unlock the 1st locked page #
-# using _real_unlock_paged() if the 2nd lock-page fails. #
-# Finally, branch to the core cas2 emulation code by calling the #
-# "callout" _real_cas2(). #
-# #
-# _isp_cas2_finish(): #
-# Re-perform the comparison so we can determine the condition #
-# codes which were too much trouble to keep around during the locked #
-# emulation. Then unlock each operands page by calling the "callout" #
-# _real_unlock_page(). #
-# #
-#########################################################################
-
-set ADDR1, EXC_TEMP+0xc
-set ADDR2, EXC_TEMP+0x0
-set DC2, EXC_TEMP+0xa
-set DC1, EXC_TEMP+0x8
-
- global _compandset2
-_compandset2:
- mov.l %d0,EXC_TEMP+0x4(%a6) # store for possible restart
- mov.l %d0,%d1 # extension word in d0
-
- rol.w &0x4,%d0
- andi.w &0xf,%d0 # extract Rn2
- mov.l (EXC_DREGS,%a6,%d0.w*4),%a1 # fetch ADDR2
- mov.l %a1,ADDR2(%a6)
-
- mov.l %d1,%d0
-
- lsr.w &0x6,%d1
- andi.w &0x7,%d1 # extract Du2
- mov.l (EXC_DREGS,%a6,%d1.w*4),%d5 # fetch Update2 Op
-
- andi.w &0x7,%d0 # extract Dc2
- mov.l (EXC_DREGS,%a6,%d0.w*4),%d3 # fetch Compare2 Op
- mov.w %d0,DC2(%a6)
-
- mov.w EXC_EXTWORD(%a6),%d0
- mov.l %d0,%d1
-
- rol.w &0x4,%d0
- andi.w &0xf,%d0 # extract Rn1
- mov.l (EXC_DREGS,%a6,%d0.w*4),%a0 # fetch ADDR1
- mov.l %a0,ADDR1(%a6)
-
- mov.l %d1,%d0
-
- lsr.w &0x6,%d1
- andi.w &0x7,%d1 # extract Du1
- mov.l (EXC_DREGS,%a6,%d1.w*4),%d4 # fetch Update1 Op
-
- andi.w &0x7,%d0 # extract Dc1
- mov.l (EXC_DREGS,%a6,%d0.w*4),%d2 # fetch Compare1 Op
- mov.w %d0,DC1(%a6)
-
- btst &0x1,EXC_OPWORD(%a6) # word or long?
- sne %d7
-
- btst &0x5,EXC_ISR(%a6) # user or supervisor?
- sne %d6
-
- mov.l %a0,%a2
- mov.l %a1,%a3
-
- mov.l %d7,%d1 # pass size
- mov.l %d6,%d0 # pass mode
- bsr.l _real_lock_page # lock page
- mov.l %a2,%a0
- tst.l %d0 # error?
- bne.l _cas_terminate2 # yes
-
- mov.l %d7,%d1 # pass size
- mov.l %d6,%d0 # pass mode
- mov.l %a3,%a0 # pass addr
- bsr.l _real_lock_page # lock page
- mov.l %a3,%a0
- tst.l %d0 # error?
- bne.b cas_preterm # yes
-
- mov.l %a2,%a0
- mov.l %a3,%a1
-
- bra.l _real_cas2
-
-# if the 2nd lock attempt fails, then we must still unlock the
-# first page(s).
-cas_preterm:
- mov.l %d0,-(%sp) # save FSLW
- mov.l %d7,%d1 # pass size
- mov.l %d6,%d0 # pass mode
- mov.l %a2,%a0 # pass ADDR1
- bsr.l _real_unlock_page # unlock first page(s)
- mov.l (%sp)+,%d0 # restore FSLW
- mov.l %a3,%a0 # pass failing addr
- bra.l _cas_terminate2
-
-#############################################################
-
- global _isp_cas2_finish
-_isp_cas2_finish:
- btst &0x1,EXC_OPWORD(%a6)
- bne.b cas2_finish_l
-
- mov.w EXC_CC(%a6),%cc # load old ccodes
- cmp.w %d0,%d2
- bne.b cas2_finish_w_save
- cmp.w %d1,%d3
-cas2_finish_w_save:
- mov.w %cc,EXC_CC(%a6) # save new ccodes
-
- tst.b %d4 # update compare reg?
- bne.b cas2_finish_w_done # no
-
- mov.w DC2(%a6),%d3 # fetch Dc2
- mov.w %d1,(2+EXC_DREGS,%a6,%d3.w*4) # store new Compare2 Op
-
- mov.w DC1(%a6),%d2 # fetch Dc1
- mov.w %d0,(2+EXC_DREGS,%a6,%d2.w*4) # store new Compare1 Op
-
-cas2_finish_w_done:
- btst &0x5,EXC_ISR(%a6)
- sne %d2
- mov.l %d2,%d0 # pass mode
- sf %d1 # pass size
- mov.l ADDR1(%a6),%a0 # pass ADDR1
- bsr.l _real_unlock_page # unlock page
-
- mov.l %d2,%d0 # pass mode
- sf %d1 # pass size
- mov.l ADDR2(%a6),%a0 # pass ADDR2
- bsr.l _real_unlock_page # unlock page
- rts
-
-cas2_finish_l:
- mov.w EXC_CC(%a6),%cc # load old ccodes
- cmp.l %d0,%d2
- bne.b cas2_finish_l_save
- cmp.l %d1,%d3
-cas2_finish_l_save:
- mov.w %cc,EXC_CC(%a6) # save new ccodes
-
- tst.b %d4 # update compare reg?
- bne.b cas2_finish_l_done # no
-
- mov.w DC2(%a6),%d3 # fetch Dc2
- mov.l %d1,(EXC_DREGS,%a6,%d3.w*4) # store new Compare2 Op
-
- mov.w DC1(%a6),%d2 # fetch Dc1
- mov.l %d0,(EXC_DREGS,%a6,%d2.w*4) # store new Compare1 Op
-
-cas2_finish_l_done:
- btst &0x5,EXC_ISR(%a6)
- sne %d2
- mov.l %d2,%d0 # pass mode
- st %d1 # pass size
- mov.l ADDR1(%a6),%a0 # pass ADDR1
- bsr.l _real_unlock_page # unlock page
-
- mov.l %d2,%d0 # pass mode
- st %d1 # pass size
- mov.l ADDR2(%a6),%a0 # pass ADDR2
- bsr.l _real_unlock_page # unlock page
- rts
-
-########
- global cr_cas2
-cr_cas2:
- mov.l EXC_TEMP+0x4(%a6),%d0
- bra.w _compandset2
-
-#########################################################################
-# XDEF **************************************************************** #
-# _compandset(): routine to emulate cas w/ misaligned <ea> #
-# (internal to package) #
-# _isp_cas_finish(): routine called when cas emulation completes #
-# (external and internal to package) #
-# _isp_cas_restart(): restart cas emulation after a fault #
-# (external to package) #
-# _isp_cas_terminate(): create access error stack frame on fault #
-# (external and internal to package) #
-# _isp_cas_inrange(): checks whether instr addr is within range #
-# of core cas/cas2emulation code #
-# (external to package) #
-# #
-# XREF **************************************************************** #
-# _calc_ea(): calculate effective address #
-# #
-# INPUT *************************************************************** #
-# compandset(): #
-# none #
-# _isp_cas_restart(): #
-# d6 = previous sfc/dfc #
-# _isp_cas_finish(): #
-# _isp_cas_terminate(): #
-# a0 = failing address #
-# d0 = FSLW #
-# d6 = previous sfc/dfc #
-# _isp_cas_inrange(): #
-# a0 = instruction address to be checked #
-# #
-# OUTPUT ************************************************************** #
-# compandset(): #
-# none #
-# _isp_cas_restart(): #
-# a0 = effective address #
-# d7 = word or longword flag #
-# _isp_cas_finish(): #
-# a0 = effective address #
-# _isp_cas_terminate(): #
-# initial register set before emulation exception #
-# _isp_cas_inrange(): #
-# d0 = 0 => in range; -1 => out of range #
-# #
-# ALGORITHM *********************************************************** #
-# #
-# compandset(): #
-# First, calculate the effective address. Then, decode the #
-# instruction word and fetch the "compare" (DC) and "update" (Du) #
-# operands. #
-# Next, call the external routine _real_lock_page() so that the #
-# operating system can keep this page from being paged out while we're #
-# in this routine. If this call fails, jump to _cas_terminate2(). #
-# The routine then branches to _real_cas(). This external routine #
-# that actually emulates cas can be supplied by the external os or #
-# made to point directly back into the 060ISP which has a routine for #
-# this purpose. #
-# #
-# _isp_cas_finish(): #
-# Either way, after emulation, the package is re-entered at #
-# _isp_cas_finish(). This routine re-compares the operands in order to #
-# set the condition codes. Finally, these routines will call #
-# _real_unlock_page() in order to unlock the pages that were previously #
-# locked. #
-# #
-# _isp_cas_restart(): #
-# This routine can be entered from an access error handler where #
-# the emulation sequence should be re-started from the beginning. #
-# #
-# _isp_cas_terminate(): #
-# This routine can be entered from an access error handler where #
-# an emulation operand access failed and the operating system would #
-# like an access error stack frame created instead of the current #
-# unimplemented integer instruction frame. #
-# Also, the package enters here if a call to _real_lock_page() #
-# fails. #
-# #
-# _isp_cas_inrange(): #
-# Checks to see whether the instruction address passed to it in #
-# a0 is within the software package cas/cas2 emulation routines. This #
-# can be helpful for an operating system to determine whether an access #
-# error during emulation was due to a cas/cas2 emulation access. #
-# #
-#########################################################################
-
-set DC, EXC_TEMP+0x8
-set ADDR, EXC_TEMP+0x4
-
- global _compandset
-_compandset:
- btst &0x1,EXC_OPWORD(%a6) # word or long operation?
- bne.b compandsetl # long
-
-compandsetw:
- movq.l &0x2,%d0 # size = 2 bytes
- bsr.l _calc_ea # a0 = calculated <ea>
- mov.l %a0,ADDR(%a6) # save <ea> for possible restart
- sf %d7 # clear d7 for word size
- bra.b compandsetfetch
-
-compandsetl:
- movq.l &0x4,%d0 # size = 4 bytes
- bsr.l _calc_ea # a0 = calculated <ea>
- mov.l %a0,ADDR(%a6) # save <ea> for possible restart
- st %d7 # set d7 for longword size
-
-compandsetfetch:
- mov.w EXC_EXTWORD(%a6),%d0 # fetch cas extension word
- mov.l %d0,%d1 # make a copy
-
- lsr.w &0x6,%d0
- andi.w &0x7,%d0 # extract Du
- mov.l (EXC_DREGS,%a6,%d0.w*4),%d2 # get update operand
-
- andi.w &0x7,%d1 # extract Dc
- mov.l (EXC_DREGS,%a6,%d1.w*4),%d4 # get compare operand
- mov.w %d1,DC(%a6) # save Dc
-
- btst &0x5,EXC_ISR(%a6) # which mode for exception?
- sne %d6 # set on supervisor mode
-
- mov.l %a0,%a2 # save temporarily
- mov.l %d7,%d1 # pass size
- mov.l %d6,%d0 # pass mode
- bsr.l _real_lock_page # lock page
- tst.l %d0 # did error occur?
- bne.w _cas_terminate2 # yes, clean up the mess
- mov.l %a2,%a0 # pass addr in a0
-
- bra.l _real_cas
-
-########
- global _isp_cas_finish
-_isp_cas_finish:
- btst &0x1,EXC_OPWORD(%a6)
- bne.b cas_finish_l
-
-# just do the compare again since it's faster than saving the ccodes
-# from the locked routine...
-cas_finish_w:
- mov.w EXC_CC(%a6),%cc # restore cc
- cmp.w %d0,%d4 # do word compare
- mov.w %cc,EXC_CC(%a6) # save cc
-
- tst.b %d1 # update compare reg?
- bne.b cas_finish_w_done # no
-
- mov.w DC(%a6),%d3
- mov.w %d0,(EXC_DREGS+2,%a6,%d3.w*4) # Dc = destination
-
-cas_finish_w_done:
- mov.l ADDR(%a6),%a0 # pass addr
- sf %d1 # pass size
- btst &0x5,EXC_ISR(%a6)
- sne %d0 # pass mode
- bsr.l _real_unlock_page # unlock page
- rts
-
-# just do the compare again since it's faster than saving the ccodes
-# from the locked routine...
-cas_finish_l:
- mov.w EXC_CC(%a6),%cc # restore cc
- cmp.l %d0,%d4 # do longword compare
- mov.w %cc,EXC_CC(%a6) # save cc
-
- tst.b %d1 # update compare reg?
- bne.b cas_finish_l_done # no
-
- mov.w DC(%a6),%d3
- mov.l %d0,(EXC_DREGS,%a6,%d3.w*4) # Dc = destination
-
-cas_finish_l_done:
- mov.l ADDR(%a6),%a0 # pass addr
- st %d1 # pass size
- btst &0x5,EXC_ISR(%a6)
- sne %d0 # pass mode
- bsr.l _real_unlock_page # unlock page
- rts
-
-########
-
- global _isp_cas_restart
-_isp_cas_restart:
- mov.l %d6,%sfc # restore previous sfc
- mov.l %d6,%dfc # restore previous dfc
-
- cmpi.b EXC_OPWORD+1(%a6),&0xfc # cas or cas2?
- beq.l cr_cas2 # cas2
-cr_cas:
- mov.l ADDR(%a6),%a0 # load <ea>
- btst &0x1,EXC_OPWORD(%a6) # word or long operation?
- sne %d7 # set d7 accordingly
- bra.w compandsetfetch
-
-########
-
-# At this stage, it would be nice if d0 held the FSLW.
- global _isp_cas_terminate
-_isp_cas_terminate:
- mov.l %d6,%sfc # restore previous sfc
- mov.l %d6,%dfc # restore previous dfc
-
- global _cas_terminate2
-_cas_terminate2:
- mov.l %a0,%a2 # copy failing addr to a2
-
- mov.l %d0,-(%sp)
- bsr.l isp_restore # restore An (if ()+ or -())
- mov.l (%sp)+,%d0
-
- addq.l &0x4,%sp # remove sub return addr
- subq.l &0x8,%sp # make room for bigger stack
- subq.l &0x8,%a6 # shift frame ptr down, too
- mov.l &26,%d1 # want to move 51 longwords
- lea 0x8(%sp),%a0 # get address of old stack
- lea 0x0(%sp),%a1 # get address of new stack
-cas_term_cont:
- mov.l (%a0)+,(%a1)+ # move a longword
- dbra.w %d1,cas_term_cont # keep going
-
- mov.w &0x4008,EXC_IVOFF(%a6) # put new stk fmt, voff
- mov.l %a2,EXC_IVOFF+0x2(%a6) # put faulting addr on stack
- mov.l %d0,EXC_IVOFF+0x6(%a6) # put FSLW on stack
- movm.l EXC_DREGS(%a6),&0x3fff # restore user regs
- unlk %a6 # unlink stack frame
- bra.l _real_access
-
-########
-
- global _isp_cas_inrange
-_isp_cas_inrange:
- clr.l %d0 # clear return result
- lea _CASHI(%pc),%a1 # load end of CAS core code
- cmp.l %a1,%a0 # is PC in range?
- blt.b cin_no # no
- lea _CASLO(%pc),%a1 # load begin of CAS core code
- cmp.l %a0,%a1 # is PC in range?
- blt.b cin_no # no
- rts # yes; return d0 = 0
-cin_no:
- mov.l &-0x1,%d0 # out of range; return d0 = -1
- rts
-
-#################################################################
-#################################################################
-#################################################################
-# This is the start of the cas and cas2 "core" emulation code. #
-# This is the section that may need to be replaced by the host #
-# OS if it is too operating system-specific. #
-# Please refer to the package documentation to see how to #
-# "replace" this section, if necessary. #
-#################################################################
-#################################################################
-#################################################################
-
-# ###### ## ###### ####
-# # # # # # #
-# # ###### ###### #
-# # # # # #
-# ###### # # ###### ######
-
-#########################################################################
-# XDEF **************************************************************** #
-# _isp_cas2(): "core" emulation code for the cas2 instruction #
-# #
-# XREF **************************************************************** #
-# _isp_cas2_finish() - only exit point for this emulation code; #
-# do clean-up; calculate ccodes; store #
-# Compare Ops if appropriate. #
-# #
-# INPUT *************************************************************** #
-# *see chart below* #
-# #
-# OUTPUT ************************************************************** #
-# *see chart below* #
-# #
-# ALGORITHM *********************************************************** #
-# (1) Make several copies of the effective address. #
-# (2) Save current SR; Then mask off all maskable interrupts. #
-# (3) Save current SFC/DFC (ASSUMED TO BE EQUAL!!!); Then set #
-# according to whether exception occurred in user or #
-# supervisor mode. #
-# (4) Use "plpaw" instruction to pre-load ATC with effective #
-# address pages(s). THIS SHOULD NOT FAULT!!! The relevant #
-# page(s) should have already been made resident prior to #
-# entering this routine. #
-# (5) Push the operand lines from the cache w/ "cpushl". #
-# In the 68040, this was done within the locked region. In #
-# the 68060, it is done outside of the locked region. #
-# (6) Use "plpar" instruction to do a re-load of ATC entries for #
-# ADDR1 since ADDR2 entries may have pushed ADDR1 out of the #
-# ATC. #
-# (7) Pre-fetch the core emulation instructions by executing #
-# one branch within each physical line (16 bytes) of the code #
-# before actually executing the code. #
-# (8) Load the BUSCR w/ the bus lock value. #
-# (9) Fetch the source operands using "moves". #
-# (10)Do the compares. If both equal, go to step (13). #
-# (11)Unequal. No update occurs. But, we do write the DST1 op #
-# back to itself (as w/ the '040) so we can gracefully unlock #
-# the bus (and assert LOCKE*) using BUSCR and the final move. #
-# (12)Exit. #
-# (13)Write update operand to the DST locations. Use BUSCR to #
-# assert LOCKE* for the final write operation. #
-# (14)Exit. #
-# #
-# The algorithm is actually implemented slightly differently #
-# depending on the size of the operation and the misalignment of the #
-# operands. A misaligned operand must be written in aligned chunks or #
-# else the BUSCR register control gets confused. #
-# #
-#########################################################################
-
-#################################################################
-# THIS IS THE STATE OF THE INTEGER REGISTER FILE UPON #
-# ENTERING _isp_cas2(). #
-# #
-# D0 = xxxxxxxx #
-# D1 = xxxxxxxx #
-# D2 = cmp operand 1 #
-# D3 = cmp operand 2 #
-# D4 = update oper 1 #
-# D5 = update oper 2 #
-# D6 = 'xxxxxxff if supervisor mode; 'xxxxxx00 if user mode #
-# D7 = 'xxxxxxff if longword operation; 'xxxxxx00 if word #
-# A0 = ADDR1 #
-# A1 = ADDR2 #
-# A2 = xxxxxxxx #
-# A3 = xxxxxxxx #
-# A4 = xxxxxxxx #
-# A5 = xxxxxxxx #
-# A6 = frame pointer #
-# A7 = stack pointer #
-#################################################################
-
-# align 0x1000
-# beginning label used by _isp_cas_inrange()
- global _CASLO
-_CASLO:
-
- global _isp_cas2
-_isp_cas2:
- tst.b %d6 # user or supervisor mode?
- bne.b cas2_supervisor # supervisor
-cas2_user:
- movq.l &0x1,%d0 # load user data fc
- bra.b cas2_cont
-cas2_supervisor:
- movq.l &0x5,%d0 # load supervisor data fc
-cas2_cont:
- tst.b %d7 # word or longword?
- beq.w cas2w # word
-
-####
-cas2l:
- mov.l %a0,%a2 # copy ADDR1
- mov.l %a1,%a3 # copy ADDR2
- mov.l %a0,%a4 # copy ADDR1
- mov.l %a1,%a5 # copy ADDR2
-
- addq.l &0x3,%a4 # ADDR1+3
- addq.l &0x3,%a5 # ADDR2+3
- mov.l %a2,%d1 # ADDR1
-
-# mask interrupts levels 0-6. save old mask value.
- mov.w %sr,%d7 # save current SR
- ori.w &0x0700,%sr # inhibit interrupts
-
-# load the SFC and DFC with the appropriate mode.
- movc %sfc,%d6 # save old SFC/DFC
- movc %d0,%sfc # store new SFC
- movc %d0,%dfc # store new DFC
-
-# pre-load the operand ATC. no page faults should occur here because
-# _real_lock_page() should have taken care of this.
- plpaw (%a2) # load atc for ADDR1
- plpaw (%a4) # load atc for ADDR1+3
- plpaw (%a3) # load atc for ADDR2
- plpaw (%a5) # load atc for ADDR2+3
-
-# push the operand lines from the cache if they exist.
- cpushl %dc,(%a2) # push line for ADDR1
- cpushl %dc,(%a4) # push line for ADDR1+3
- cpushl %dc,(%a3) # push line for ADDR2
- cpushl %dc,(%a5) # push line for ADDR2+2
-
- mov.l %d1,%a2 # ADDR1
- addq.l &0x3,%d1
- mov.l %d1,%a4 # ADDR1+3
-# if ADDR1 was ATC resident before the above "plpaw" and was executed
-# and it was the next entry scheduled for replacement and ADDR2
-# shares the same set, then the "plpaw" for ADDR2 can push the ADDR1
-# entries from the ATC. so, we do a second set of "plpa"s.
- plpar (%a2) # load atc for ADDR1
- plpar (%a4) # load atc for ADDR1+3
-
-# load the BUSCR values.
- mov.l &0x80000000,%a2 # assert LOCK* buscr value
- mov.l &0xa0000000,%a3 # assert LOCKE* buscr value
- mov.l &0x00000000,%a4 # buscr unlock value
-
-# there are three possible mis-aligned cases for longword cas. they
-# are separated because the final write which asserts LOCKE* must
-# be aligned.
- mov.l %a0,%d0 # is ADDR1 misaligned?
- andi.b &0x3,%d0
- beq.b CAS2L_ENTER # no
- cmpi.b %d0,&0x2
- beq.w CAS2L2_ENTER # yes; word misaligned
- bra.w CAS2L3_ENTER # yes; byte misaligned
-
-#
-# D0 = dst operand 1 <-
-# D1 = dst operand 2 <-
-# D2 = cmp operand 1
-# D3 = cmp operand 2
-# D4 = update oper 1
-# D5 = update oper 2
-# D6 = old SFC/DFC
-# D7 = old SR
-# A0 = ADDR1
-# A1 = ADDR2
-# A2 = bus LOCK* value
-# A3 = bus LOCKE* value
-# A4 = bus unlock value
-# A5 = xxxxxxxx
-#
- align 0x10
-CAS2L_START:
- movc %a2,%buscr # assert LOCK*
- movs.l (%a1),%d1 # fetch Dest2[31:0]
- movs.l (%a0),%d0 # fetch Dest1[31:0]
- bra.b CAS2L_CONT
-CAS2L_ENTER:
- bra.b ~+16
-
-CAS2L_CONT:
- cmp.l %d0,%d2 # Dest1 - Compare1
- bne.b CAS2L_NOUPDATE
- cmp.l %d1,%d3 # Dest2 - Compare2
- bne.b CAS2L_NOUPDATE
- movs.l %d5,(%a1) # Update2[31:0] -> DEST2
- bra.b CAS2L_UPDATE
- bra.b ~+16
-
-CAS2L_UPDATE:
- movc %a3,%buscr # assert LOCKE*
- movs.l %d4,(%a0) # Update1[31:0] -> DEST1
- movc %a4,%buscr # unlock the bus
- bra.b cas2l_update_done
- bra.b ~+16
-
-CAS2L_NOUPDATE:
- movc %a3,%buscr # assert LOCKE*
- movs.l %d0,(%a0) # Dest1[31:0] -> DEST1
- movc %a4,%buscr # unlock the bus
- bra.b cas2l_noupdate_done
- bra.b ~+16
-
-CAS2L_FILLER:
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- bra.b CAS2L_START
-
-####
-
-#################################################################
-# THIS MUST BE THE STATE OF THE INTEGER REGISTER FILE UPON #
-# ENTERING _isp_cas2(). #
-# #
-# D0 = destination[31:0] operand 1 #
-# D1 = destination[31:0] operand 2 #
-# D2 = cmp[31:0] operand 1 #
-# D3 = cmp[31:0] operand 2 #
-# D4 = 'xxxxxx11 -> no reg update; 'xxxxxx00 -> update required #
-# D5 = xxxxxxxx #
-# D6 = xxxxxxxx #
-# D7 = xxxxxxxx #
-# A0 = xxxxxxxx #
-# A1 = xxxxxxxx #
-# A2 = xxxxxxxx #
-# A3 = xxxxxxxx #
-# A4 = xxxxxxxx #
-# A5 = xxxxxxxx #
-# A6 = frame pointer #
-# A7 = stack pointer #
-#################################################################
-
-cas2l_noupdate_done:
-
-# restore previous SFC/DFC value.
- movc %d6,%sfc # restore old SFC
- movc %d6,%dfc # restore old DFC
-
-# restore previous interrupt mask level.
- mov.w %d7,%sr # restore old SR
-
- sf %d4 # indicate no update was done
- bra.l _isp_cas2_finish
-
-cas2l_update_done:
-
-# restore previous SFC/DFC value.
- movc %d6,%sfc # restore old SFC
- movc %d6,%dfc # restore old DFC
-
-# restore previous interrupt mask level.
- mov.w %d7,%sr # restore old SR
-
- st %d4 # indicate update was done
- bra.l _isp_cas2_finish
-####
-
- align 0x10
-CAS2L2_START:
- movc %a2,%buscr # assert LOCK*
- movs.l (%a1),%d1 # fetch Dest2[31:0]
- movs.l (%a0),%d0 # fetch Dest1[31:0]
- bra.b CAS2L2_CONT
-CAS2L2_ENTER:
- bra.b ~+16
-
-CAS2L2_CONT:
- cmp.l %d0,%d2 # Dest1 - Compare1
- bne.b CAS2L2_NOUPDATE
- cmp.l %d1,%d3 # Dest2 - Compare2
- bne.b CAS2L2_NOUPDATE
- movs.l %d5,(%a1) # Update2[31:0] -> Dest2
- bra.b CAS2L2_UPDATE
- bra.b ~+16
-
-CAS2L2_UPDATE:
- swap %d4 # get Update1[31:16]
- movs.w %d4,(%a0)+ # Update1[31:16] -> DEST1
- movc %a3,%buscr # assert LOCKE*
- swap %d4 # get Update1[15:0]
- bra.b CAS2L2_UPDATE2
- bra.b ~+16
-
-CAS2L2_UPDATE2:
- movs.w %d4,(%a0) # Update1[15:0] -> DEST1+0x2
- movc %a4,%buscr # unlock the bus
- bra.w cas2l_update_done
- nop
- bra.b ~+16
-
-CAS2L2_NOUPDATE:
- swap %d0 # get Dest1[31:16]
- movs.w %d0,(%a0)+ # Dest1[31:16] -> DEST1
- movc %a3,%buscr # assert LOCKE*
- swap %d0 # get Dest1[15:0]
- bra.b CAS2L2_NOUPDATE2
- bra.b ~+16
-
-CAS2L2_NOUPDATE2:
- movs.w %d0,(%a0) # Dest1[15:0] -> DEST1+0x2
- movc %a4,%buscr # unlock the bus
- bra.w cas2l_noupdate_done
- nop
- bra.b ~+16
-
-CAS2L2_FILLER:
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- bra.b CAS2L2_START
-
-#################################
-
- align 0x10
-CAS2L3_START:
- movc %a2,%buscr # assert LOCK*
- movs.l (%a1),%d1 # fetch Dest2[31:0]
- movs.l (%a0),%d0 # fetch Dest1[31:0]
- bra.b CAS2L3_CONT
-CAS2L3_ENTER:
- bra.b ~+16
-
-CAS2L3_CONT:
- cmp.l %d0,%d2 # Dest1 - Compare1
- bne.b CAS2L3_NOUPDATE
- cmp.l %d1,%d3 # Dest2 - Compare2
- bne.b CAS2L3_NOUPDATE
- movs.l %d5,(%a1) # Update2[31:0] -> DEST2
- bra.b CAS2L3_UPDATE
- bra.b ~+16
-
-CAS2L3_UPDATE:
- rol.l &0x8,%d4 # get Update1[31:24]
- movs.b %d4,(%a0)+ # Update1[31:24] -> DEST1
- swap %d4 # get Update1[23:8]
- movs.w %d4,(%a0)+ # Update1[23:8] -> DEST1+0x1
- bra.b CAS2L3_UPDATE2
- bra.b ~+16
-
-CAS2L3_UPDATE2:
- rol.l &0x8,%d4 # get Update1[7:0]
- movc %a3,%buscr # assert LOCKE*
- movs.b %d4,(%a0) # Update1[7:0] -> DEST1+0x3
- bra.b CAS2L3_UPDATE3
- nop
- bra.b ~+16
-
-CAS2L3_UPDATE3:
- movc %a4,%buscr # unlock the bus
- bra.w cas2l_update_done
- nop
- nop
- nop
- bra.b ~+16
-
-CAS2L3_NOUPDATE:
- rol.l &0x8,%d0 # get Dest1[31:24]
- movs.b %d0,(%a0)+ # Dest1[31:24] -> DEST1
- swap %d0 # get Dest1[23:8]
- movs.w %d0,(%a0)+ # Dest1[23:8] -> DEST1+0x1
- bra.b CAS2L3_NOUPDATE2
- bra.b ~+16
-
-CAS2L3_NOUPDATE2:
- rol.l &0x8,%d0 # get Dest1[7:0]
- movc %a3,%buscr # assert LOCKE*
- movs.b %d0,(%a0) # Update1[7:0] -> DEST1+0x3
- bra.b CAS2L3_NOUPDATE3
- nop
- bra.b ~+16
-
-CAS2L3_NOUPDATE3:
- movc %a4,%buscr # unlock the bus
- bra.w cas2l_noupdate_done
- nop
- nop
- nop
- bra.b ~+14
-
-CAS2L3_FILLER:
- nop
- nop
- nop
- nop
- nop
- nop
- bra.w CAS2L3_START
-
-#############################################################
-#############################################################
-
-cas2w:
- mov.l %a0,%a2 # copy ADDR1
- mov.l %a1,%a3 # copy ADDR2
- mov.l %a0,%a4 # copy ADDR1
- mov.l %a1,%a5 # copy ADDR2
-
- addq.l &0x1,%a4 # ADDR1+1
- addq.l &0x1,%a5 # ADDR2+1
- mov.l %a2,%d1 # ADDR1
-
-# mask interrupt levels 0-6. save old mask value.
- mov.w %sr,%d7 # save current SR
- ori.w &0x0700,%sr # inhibit interrupts
-
-# load the SFC and DFC with the appropriate mode.
- movc %sfc,%d6 # save old SFC/DFC
- movc %d0,%sfc # store new SFC
- movc %d0,%dfc # store new DFC
-
-# pre-load the operand ATC. no page faults should occur because
-# _real_lock_page() should have taken care of this.
- plpaw (%a2) # load atc for ADDR1
- plpaw (%a4) # load atc for ADDR1+1
- plpaw (%a3) # load atc for ADDR2
- plpaw (%a5) # load atc for ADDR2+1
-
-# push the operand cache lines from the cache if they exist.
- cpushl %dc,(%a2) # push line for ADDR1
- cpushl %dc,(%a4) # push line for ADDR1+1
- cpushl %dc,(%a3) # push line for ADDR2
- cpushl %dc,(%a5) # push line for ADDR2+1
-
- mov.l %d1,%a2 # ADDR1
- addq.l &0x3,%d1
- mov.l %d1,%a4 # ADDR1+3
-# if ADDR1 was ATC resident before the above "plpaw" and was executed
-# and it was the next entry scheduled for replacement and ADDR2
-# shares the same set, then the "plpaw" for ADDR2 can push the ADDR1
-# entries from the ATC. so, we do a second set of "plpa"s.
- plpar (%a2) # load atc for ADDR1
- plpar (%a4) # load atc for ADDR1+3
-
-# load the BUSCR values.
- mov.l &0x80000000,%a2 # assert LOCK* buscr value
- mov.l &0xa0000000,%a3 # assert LOCKE* buscr value
- mov.l &0x00000000,%a4 # buscr unlock value
-
-# there are two possible mis-aligned cases for word cas. they
-# are separated because the final write which asserts LOCKE* must
-# be aligned.
- mov.l %a0,%d0 # is ADDR1 misaligned?
- btst &0x0,%d0
- bne.w CAS2W2_ENTER # yes
- bra.b CAS2W_ENTER # no
-
-#
-# D0 = dst operand 1 <-
-# D1 = dst operand 2 <-
-# D2 = cmp operand 1
-# D3 = cmp operand 2
-# D4 = update oper 1
-# D5 = update oper 2
-# D6 = old SFC/DFC
-# D7 = old SR
-# A0 = ADDR1
-# A1 = ADDR2
-# A2 = bus LOCK* value
-# A3 = bus LOCKE* value
-# A4 = bus unlock value
-# A5 = xxxxxxxx
-#
- align 0x10
-CAS2W_START:
- movc %a2,%buscr # assert LOCK*
- movs.w (%a1),%d1 # fetch Dest2[15:0]
- movs.w (%a0),%d0 # fetch Dest1[15:0]
- bra.b CAS2W_CONT2
-CAS2W_ENTER:
- bra.b ~+16
-
-CAS2W_CONT2:
- cmp.w %d0,%d2 # Dest1 - Compare1
- bne.b CAS2W_NOUPDATE
- cmp.w %d1,%d3 # Dest2 - Compare2
- bne.b CAS2W_NOUPDATE
- movs.w %d5,(%a1) # Update2[15:0] -> DEST2
- bra.b CAS2W_UPDATE
- bra.b ~+16
-
-CAS2W_UPDATE:
- movc %a3,%buscr # assert LOCKE*
- movs.w %d4,(%a0) # Update1[15:0] -> DEST1
- movc %a4,%buscr # unlock the bus
- bra.b cas2w_update_done
- bra.b ~+16
-
-CAS2W_NOUPDATE:
- movc %a3,%buscr # assert LOCKE*
- movs.w %d0,(%a0) # Dest1[15:0] -> DEST1
- movc %a4,%buscr # unlock the bus
- bra.b cas2w_noupdate_done
- bra.b ~+16
-
-CAS2W_FILLER:
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- bra.b CAS2W_START
-
-####
-
-#################################################################
-# THIS MUST BE THE STATE OF THE INTEGER REGISTER FILE UPON #
-# ENTERING _isp_cas2(). #
-# #
-# D0 = destination[15:0] operand 1 #
-# D1 = destination[15:0] operand 2 #
-# D2 = cmp[15:0] operand 1 #
-# D3 = cmp[15:0] operand 2 #
-# D4 = 'xxxxxx11 -> no reg update; 'xxxxxx00 -> update required #
-# D5 = xxxxxxxx #
-# D6 = xxxxxxxx #
-# D7 = xxxxxxxx #
-# A0 = xxxxxxxx #
-# A1 = xxxxxxxx #
-# A2 = xxxxxxxx #
-# A3 = xxxxxxxx #
-# A4 = xxxxxxxx #
-# A5 = xxxxxxxx #
-# A6 = frame pointer #
-# A7 = stack pointer #
-#################################################################
-
-cas2w_noupdate_done:
-
-# restore previous SFC/DFC value.
- movc %d6,%sfc # restore old SFC
- movc %d6,%dfc # restore old DFC
-
-# restore previous interrupt mask level.
- mov.w %d7,%sr # restore old SR
-
- sf %d4 # indicate no update was done
- bra.l _isp_cas2_finish
-
-cas2w_update_done:
-
-# restore previous SFC/DFC value.
- movc %d6,%sfc # restore old SFC
- movc %d6,%dfc # restore old DFC
-
-# restore previous interrupt mask level.
- mov.w %d7,%sr # restore old SR
-
- st %d4 # indicate update was done
- bra.l _isp_cas2_finish
-####
-
- align 0x10
-CAS2W2_START:
- movc %a2,%buscr # assert LOCK*
- movs.w (%a1),%d1 # fetch Dest2[15:0]
- movs.w (%a0),%d0 # fetch Dest1[15:0]
- bra.b CAS2W2_CONT2
-CAS2W2_ENTER:
- bra.b ~+16
-
-CAS2W2_CONT2:
- cmp.w %d0,%d2 # Dest1 - Compare1
- bne.b CAS2W2_NOUPDATE
- cmp.w %d1,%d3 # Dest2 - Compare2
- bne.b CAS2W2_NOUPDATE
- movs.w %d5,(%a1) # Update2[15:0] -> DEST2
- bra.b CAS2W2_UPDATE
- bra.b ~+16
-
-CAS2W2_UPDATE:
- ror.l &0x8,%d4 # get Update1[15:8]
- movs.b %d4,(%a0)+ # Update1[15:8] -> DEST1
- movc %a3,%buscr # assert LOCKE*
- rol.l &0x8,%d4 # get Update1[7:0]
- bra.b CAS2W2_UPDATE2
- bra.b ~+16
-
-CAS2W2_UPDATE2:
- movs.b %d4,(%a0) # Update1[7:0] -> DEST1+0x1
- movc %a4,%buscr # unlock the bus
- bra.w cas2w_update_done
- nop
- bra.b ~+16
-
-CAS2W2_NOUPDATE:
- ror.l &0x8,%d0 # get Dest1[15:8]
- movs.b %d0,(%a0)+ # Dest1[15:8] -> DEST1
- movc %a3,%buscr # assert LOCKE*
- rol.l &0x8,%d0 # get Dest1[7:0]
- bra.b CAS2W2_NOUPDATE2
- bra.b ~+16
-
-CAS2W2_NOUPDATE2:
- movs.b %d0,(%a0) # Dest1[7:0] -> DEST1+0x1
- movc %a4,%buscr # unlock the bus
- bra.w cas2w_noupdate_done
- nop
- bra.b ~+16
-
-CAS2W2_FILLER:
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- bra.b CAS2W2_START
-
-# ###### ## ######
-# # # # #
-# # ###### ######
-# # # # #
-# ###### # # ######
-
-#########################################################################
-# XDEF **************************************************************** #
-# _isp_cas(): "core" emulation code for the cas instruction #
-# #
-# XREF **************************************************************** #
-# _isp_cas_finish() - only exit point for this emulation code; #
-# do clean-up #
-# #
-# INPUT *************************************************************** #
-# *see entry chart below* #
-# #
-# OUTPUT ************************************************************** #
-# *see exit chart below* #
-# #
-# ALGORITHM *********************************************************** #
-# (1) Make several copies of the effective address. #
-# (2) Save current SR; Then mask off all maskable interrupts. #
-# (3) Save current DFC/SFC (ASSUMED TO BE EQUAL!!!); Then set #
-# SFC/DFC according to whether exception occurred in user or #
-# supervisor mode. #
-# (4) Use "plpaw" instruction to pre-load ATC with effective #
-# address page(s). THIS SHOULD NOT FAULT!!! The relevant #
-# page(s) should have been made resident prior to entering #
-# this routine. #
-# (5) Push the operand lines from the cache w/ "cpushl". #
-# In the 68040, this was done within the locked region. In #
-# the 68060, it is done outside of the locked region. #
-# (6) Pre-fetch the core emulation instructions by executing one #
-# branch within each physical line (16 bytes) of the code #
-# before actually executing the code. #
-# (7) Load the BUSCR with the bus lock value. #
-# (8) Fetch the source operand. #
-# (9) Do the compare. If equal, go to step (12). #
-# (10)Unequal. No update occurs. But, we do write the DST op back #
-# to itself (as w/ the '040) so we can gracefully unlock #
-# the bus (and assert LOCKE*) using BUSCR and the final move. #
-# (11)Exit. #
-# (12)Write update operand to the DST location. Use BUSCR to #
-# assert LOCKE* for the final write operation. #
-# (13)Exit. #
-# #
-# The algorithm is actually implemented slightly differently #
-# depending on the size of the operation and the misalignment of the #
-# operand. A misaligned operand must be written in aligned chunks or #
-# else the BUSCR register control gets confused. #
-# #
-#########################################################################
-
-#########################################################
-# THIS IS THE STATE OF THE INTEGER REGISTER FILE UPON #
-# ENTERING _isp_cas(). #
-# #
-# D0 = xxxxxxxx #
-# D1 = xxxxxxxx #
-# D2 = update operand #
-# D3 = xxxxxxxx #
-# D4 = compare operand #
-# D5 = xxxxxxxx #
-# D6 = supervisor ('xxxxxxff) or user mode ('xxxxxx00) #
-# D7 = longword ('xxxxxxff) or word size ('xxxxxx00) #
-# A0 = ADDR #
-# A1 = xxxxxxxx #
-# A2 = xxxxxxxx #
-# A3 = xxxxxxxx #
-# A4 = xxxxxxxx #
-# A5 = xxxxxxxx #
-# A6 = frame pointer #
-# A7 = stack pointer #
-#########################################################
-
- global _isp_cas
-_isp_cas:
- tst.b %d6 # user or supervisor mode?
- bne.b cas_super # supervisor
-cas_user:
- movq.l &0x1,%d0 # load user data fc
- bra.b cas_cont
-cas_super:
- movq.l &0x5,%d0 # load supervisor data fc
-
-cas_cont:
- tst.b %d7 # word or longword?
- bne.w casl # longword
-
-####
-casw:
- mov.l %a0,%a1 # make copy for plpaw1
- mov.l %a0,%a2 # make copy for plpaw2
- addq.l &0x1,%a2 # plpaw2 points to end of word
-
- mov.l %d2,%d3 # d3 = update[7:0]
- lsr.w &0x8,%d2 # d2 = update[15:8]
-
-# mask interrupt levels 0-6. save old mask value.
- mov.w %sr,%d7 # save current SR
- ori.w &0x0700,%sr # inhibit interrupts
-
-# load the SFC and DFC with the appropriate mode.
- movc %sfc,%d6 # save old SFC/DFC
- movc %d0,%sfc # load new sfc
- movc %d0,%dfc # load new dfc
-
-# pre-load the operand ATC. no page faults should occur here because
-# _real_lock_page() should have taken care of this.
- plpaw (%a1) # load atc for ADDR
- plpaw (%a2) # load atc for ADDR+1
-
-# push the operand lines from the cache if they exist.
- cpushl %dc,(%a1) # push dirty data
- cpushl %dc,(%a2) # push dirty data
-
-# load the BUSCR values.
- mov.l &0x80000000,%a1 # assert LOCK* buscr value
- mov.l &0xa0000000,%a2 # assert LOCKE* buscr value
- mov.l &0x00000000,%a3 # buscr unlock value
-
-# pre-load the instruction cache for the following algorithm.
-# this will minimize the number of cycles that LOCK* will be asserted.
- bra.b CASW_ENTER # start pre-loading icache
-
-#
-# D0 = dst operand <-
-# D1 = update[15:8] operand
-# D2 = update[7:0] operand
-# D3 = xxxxxxxx
-# D4 = compare[15:0] operand
-# D5 = xxxxxxxx
-# D6 = old SFC/DFC
-# D7 = old SR
-# A0 = ADDR
-# A1 = bus LOCK* value
-# A2 = bus LOCKE* value
-# A3 = bus unlock value
-# A4 = xxxxxxxx
-# A5 = xxxxxxxx
-#
- align 0x10
-CASW_START:
- movc %a1,%buscr # assert LOCK*
- movs.w (%a0),%d0 # fetch Dest[15:0]
- cmp.w %d0,%d4 # Dest - Compare
- bne.b CASW_NOUPDATE
- bra.b CASW_UPDATE
-CASW_ENTER:
- bra.b ~+16
-
-CASW_UPDATE:
- movs.b %d2,(%a0)+ # Update[15:8] -> DEST
- movc %a2,%buscr # assert LOCKE*
- movs.b %d3,(%a0) # Update[7:0] -> DEST+0x1
- bra.b CASW_UPDATE2
- bra.b ~+16
-
-CASW_UPDATE2:
- movc %a3,%buscr # unlock the bus
- bra.b casw_update_done
- nop
- nop
- nop
- nop
- bra.b ~+16
-
-CASW_NOUPDATE:
- ror.l &0x8,%d0 # get Dest[15:8]
- movs.b %d0,(%a0)+ # Dest[15:8] -> DEST
- movc %a2,%buscr # assert LOCKE*
- rol.l &0x8,%d0 # get Dest[7:0]
- bra.b CASW_NOUPDATE2
- bra.b ~+16
-
-CASW_NOUPDATE2:
- movs.b %d0,(%a0) # Dest[7:0] -> DEST+0x1
- movc %a3,%buscr # unlock the bus
- bra.b casw_noupdate_done
- nop
- nop
- bra.b ~+16
-
-CASW_FILLER:
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- bra.b CASW_START
-
-#################################################################
-# THIS MUST BE THE STATE OF THE INTEGER REGISTER FILE UPON #
-# CALLING _isp_cas_finish(). #
-# #
-# D0 = destination[15:0] operand #
-# D1 = 'xxxxxx11 -> no reg update; 'xxxxxx00 -> update required #
-# D2 = xxxxxxxx #
-# D3 = xxxxxxxx #
-# D4 = compare[15:0] operand #
-# D5 = xxxxxxxx #
-# D6 = xxxxxxxx #
-# D7 = xxxxxxxx #
-# A0 = xxxxxxxx #
-# A1 = xxxxxxxx #
-# A2 = xxxxxxxx #
-# A3 = xxxxxxxx #
-# A4 = xxxxxxxx #
-# A5 = xxxxxxxx #
-# A6 = frame pointer #
-# A7 = stack pointer #
-#################################################################
-
-casw_noupdate_done:
-
-# restore previous SFC/DFC value.
- movc %d6,%sfc # restore old SFC
- movc %d6,%dfc # restore old DFC
-
-# restore previous interrupt mask level.
- mov.w %d7,%sr # restore old SR
-
- sf %d1 # indicate no update was done
- bra.l _isp_cas_finish
-
-casw_update_done:
-
-# restore previous SFC/DFC value.
- movc %d6,%sfc # restore old SFC
- movc %d6,%dfc # restore old DFC
-
-# restore previous interrupt mask level.
- mov.w %d7,%sr # restore old SR
-
- st %d1 # indicate update was done
- bra.l _isp_cas_finish
-
-################
-
-# there are two possible mis-aligned cases for longword cas. they
-# are separated because the final write which asserts LOCKE* must
-# be an aligned write.
-casl:
- mov.l %a0,%a1 # make copy for plpaw1
- mov.l %a0,%a2 # make copy for plpaw2
- addq.l &0x3,%a2 # plpaw2 points to end of longword
-
- mov.l %a0,%d1 # byte or word misaligned?
- btst &0x0,%d1
- bne.w casl2 # byte misaligned
-
- mov.l %d2,%d3 # d3 = update[15:0]
- swap %d2 # d2 = update[31:16]
-
-# mask interrupts levels 0-6. save old mask value.
- mov.w %sr,%d7 # save current SR
- ori.w &0x0700,%sr # inhibit interrupts
-
-# load the SFC and DFC with the appropriate mode.
- movc %sfc,%d6 # save old SFC/DFC
- movc %d0,%sfc # load new sfc
- movc %d0,%dfc # load new dfc
-
-# pre-load the operand ATC. no page faults should occur here because
-# _real_lock_page() should have taken care of this.
- plpaw (%a1) # load atc for ADDR
- plpaw (%a2) # load atc for ADDR+3
-
-# push the operand lines from the cache if they exist.
- cpushl %dc,(%a1) # push dirty data
- cpushl %dc,(%a2) # push dirty data
-
-# load the BUSCR values.
- mov.l &0x80000000,%a1 # assert LOCK* buscr value
- mov.l &0xa0000000,%a2 # assert LOCKE* buscr value
- mov.l &0x00000000,%a3 # buscr unlock value
-
- bra.b CASL_ENTER # start pre-loading icache
-
-#
-# D0 = dst operand <-
-# D1 = xxxxxxxx
-# D2 = update[31:16] operand
-# D3 = update[15:0] operand
-# D4 = compare[31:0] operand
-# D5 = xxxxxxxx
-# D6 = old SFC/DFC
-# D7 = old SR
-# A0 = ADDR
-# A1 = bus LOCK* value
-# A2 = bus LOCKE* value
-# A3 = bus unlock value
-# A4 = xxxxxxxx
-# A5 = xxxxxxxx
-#
- align 0x10
-CASL_START:
- movc %a1,%buscr # assert LOCK*
- movs.l (%a0),%d0 # fetch Dest[31:0]
- cmp.l %d0,%d4 # Dest - Compare
- bne.b CASL_NOUPDATE
- bra.b CASL_UPDATE
-CASL_ENTER:
- bra.b ~+16
-
-CASL_UPDATE:
- movs.w %d2,(%a0)+ # Update[31:16] -> DEST
- movc %a2,%buscr # assert LOCKE*
- movs.w %d3,(%a0) # Update[15:0] -> DEST+0x2
- bra.b CASL_UPDATE2
- bra.b ~+16
-
-CASL_UPDATE2:
- movc %a3,%buscr # unlock the bus
- bra.b casl_update_done
- nop
- nop
- nop
- nop
- bra.b ~+16
-
-CASL_NOUPDATE:
- swap %d0 # get Dest[31:16]
- movs.w %d0,(%a0)+ # Dest[31:16] -> DEST
- swap %d0 # get Dest[15:0]
- movc %a2,%buscr # assert LOCKE*
- bra.b CASL_NOUPDATE2
- bra.b ~+16
-
-CASL_NOUPDATE2:
- movs.w %d0,(%a0) # Dest[15:0] -> DEST+0x2
- movc %a3,%buscr # unlock the bus
- bra.b casl_noupdate_done
- nop
- nop
- bra.b ~+16
-
-CASL_FILLER:
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- bra.b CASL_START
-
-#################################################################
-# THIS MUST BE THE STATE OF THE INTEGER REGISTER FILE UPON #
-# CALLING _isp_cas_finish(). #
-# #
-# D0 = destination[31:0] operand #
-# D1 = 'xxxxxx11 -> no reg update; 'xxxxxx00 -> update required #
-# D2 = xxxxxxxx #
-# D3 = xxxxxxxx #
-# D4 = compare[31:0] operand #
-# D5 = xxxxxxxx #
-# D6 = xxxxxxxx #
-# D7 = xxxxxxxx #
-# A0 = xxxxxxxx #
-# A1 = xxxxxxxx #
-# A2 = xxxxxxxx #
-# A3 = xxxxxxxx #
-# A4 = xxxxxxxx #
-# A5 = xxxxxxxx #
-# A6 = frame pointer #
-# A7 = stack pointer #
-#################################################################
-
-casl_noupdate_done:
-
-# restore previous SFC/DFC value.
- movc %d6,%sfc # restore old SFC
- movc %d6,%dfc # restore old DFC
-
-# restore previous interrupt mask level.
- mov.w %d7,%sr # restore old SR
-
- sf %d1 # indicate no update was done
- bra.l _isp_cas_finish
-
-casl_update_done:
-
-# restore previous SFC/DFC value.
- movc %d6,%sfc # restore old SFC
- movc %d6,%dfc # restore old DFC
-
-# restore previous interrupts mask level.
- mov.w %d7,%sr # restore old SR
-
- st %d1 # indicate update was done
- bra.l _isp_cas_finish
-
-#######################################
-casl2:
- mov.l %d2,%d5 # d5 = Update[7:0]
- lsr.l &0x8,%d2
- mov.l %d2,%d3 # d3 = Update[23:8]
- swap %d2 # d2 = Update[31:24]
-
-# mask interrupts levels 0-6. save old mask value.
- mov.w %sr,%d7 # save current SR
- ori.w &0x0700,%sr # inhibit interrupts
-
-# load the SFC and DFC with the appropriate mode.
- movc %sfc,%d6 # save old SFC/DFC
- movc %d0,%sfc # load new sfc
- movc %d0,%dfc # load new dfc
-
-# pre-load the operand ATC. no page faults should occur here because
-# _real_lock_page() should have taken care of this already.
- plpaw (%a1) # load atc for ADDR
- plpaw (%a2) # load atc for ADDR+3
-
-# puch the operand lines from the cache if they exist.
- cpushl %dc,(%a1) # push dirty data
- cpushl %dc,(%a2) # push dirty data
-
-# load the BUSCR values.
- mov.l &0x80000000,%a1 # assert LOCK* buscr value
- mov.l &0xa0000000,%a2 # assert LOCKE* buscr value
- mov.l &0x00000000,%a3 # buscr unlock value
-
-# pre-load the instruction cache for the following algorithm.
-# this will minimize the number of cycles that LOCK* will be asserted.
- bra.b CASL2_ENTER # start pre-loading icache
-
-#
-# D0 = dst operand <-
-# D1 = xxxxxxxx
-# D2 = update[31:24] operand
-# D3 = update[23:8] operand
-# D4 = compare[31:0] operand
-# D5 = update[7:0] operand
-# D6 = old SFC/DFC
-# D7 = old SR
-# A0 = ADDR
-# A1 = bus LOCK* value
-# A2 = bus LOCKE* value
-# A3 = bus unlock value
-# A4 = xxxxxxxx
-# A5 = xxxxxxxx
-#
- align 0x10
-CASL2_START:
- movc %a1,%buscr # assert LOCK*
- movs.l (%a0),%d0 # fetch Dest[31:0]
- cmp.l %d0,%d4 # Dest - Compare
- bne.b CASL2_NOUPDATE
- bra.b CASL2_UPDATE
-CASL2_ENTER:
- bra.b ~+16
-
-CASL2_UPDATE:
- movs.b %d2,(%a0)+ # Update[31:24] -> DEST
- movs.w %d3,(%a0)+ # Update[23:8] -> DEST+0x1
- movc %a2,%buscr # assert LOCKE*
- bra.b CASL2_UPDATE2
- bra.b ~+16
-
-CASL2_UPDATE2:
- movs.b %d5,(%a0) # Update[7:0] -> DEST+0x3
- movc %a3,%buscr # unlock the bus
- bra.w casl_update_done
- nop
- bra.b ~+16
-
-CASL2_NOUPDATE:
- rol.l &0x8,%d0 # get Dest[31:24]
- movs.b %d0,(%a0)+ # Dest[31:24] -> DEST
- swap %d0 # get Dest[23:8]
- movs.w %d0,(%a0)+ # Dest[23:8] -> DEST+0x1
- bra.b CASL2_NOUPDATE2
- bra.b ~+16
-
-CASL2_NOUPDATE2:
- rol.l &0x8,%d0 # get Dest[7:0]
- movc %a2,%buscr # assert LOCKE*
- movs.b %d0,(%a0) # Dest[7:0] -> DEST+0x3
- bra.b CASL2_NOUPDATE3
- nop
- bra.b ~+16
-
-CASL2_NOUPDATE3:
- movc %a3,%buscr # unlock the bus
- bra.w casl_noupdate_done
- nop
- nop
- nop
- bra.b ~+16
-
-CASL2_FILLER:
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- bra.b CASL2_START
-
-####
-####
-# end label used by _isp_cas_inrange()
- global _CASHI
-_CASHI:
diff --git a/sys/arch/m68k/060sp/isp.sa b/sys/arch/m68k/060sp/isp.sa
deleted file mode 100644
index a735746aba6..00000000000
--- a/sys/arch/m68k/060sp/isp.sa
+++ /dev/null
@@ -1,430 +0,0 @@
-#
-# $OpenBSD: isp.sa,v 1.2 1996/05/30 22:14:51 niklas Exp $
-# $NetBSD: isp.sa,v 1.2 1996/05/15 19:48:51 is Exp $
-#
-
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-# M68000 Hi-Performance Microprocessor Division
-# M68060 Software Package Production Release
-#
-# M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
-# All rights reserved.
-#
-# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-# To the maximum extent permitted by applicable law,
-# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
-# FOR A PARTICULAR PURPOSE and any warranty against infringement with
-# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-# and any accompanying written materials.
-#
-# To the maximum extent permitted by applicable law,
-# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
-# BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
-# ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
-#
-# Motorola assumes no responsibility for the maintenance and support
-# of the SOFTWARE.
-#
-# You are hereby granted a copyright license to use, modify, and distribute the
-# SOFTWARE so long as this entire notice is retained without alteration
-# in any modified and/or redistributed versions, and that such modified
-# versions are clearly identified as such.
-# No licenses are granted by implication, estoppel or otherwise under any
-# patents or trademarks of Motorola, Inc.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- dc.l $60ff0000,$02360000,$60ff0000,$16260000
- dc.l $60ff0000,$12dc0000,$60ff0000,$11ea0000
- dc.l $60ff0000,$10de0000,$60ff0000,$12a40000
- dc.l $60ff0000,$12560000,$60ff0000,$122a0000
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $2f00203a,$fefc487b,$0930ffff,$fef8202f
- dc.l $00044e74,$00042f00,$203afeea,$487b0930
- dc.l $fffffee2,$202f0004,$4e740004,$2f00203a
- dc.l $fed8487b,$0930ffff,$fecc202f,$00044e74
- dc.l $00042f00,$203afec6,$487b0930,$fffffeb6
- dc.l $202f0004,$4e740004,$2f00203a,$feb4487b
- dc.l $0930ffff,$fea0202f,$00044e74,$00042f00
- dc.l $203afea2,$487b0930,$fffffe8a,$202f0004
- dc.l $4e740004,$2f00203a,$fe90487b,$0930ffff
- dc.l $fe74202f,$00044e74,$00042f00,$203afe7e
- dc.l $487b0930,$fffffe5e,$202f0004,$4e740004
- dc.l $2f00203a,$fe6c487b,$0930ffff,$fe48202f
- dc.l $00044e74,$00042f00,$203afe76,$487b0930
- dc.l $fffffe32,$202f0004,$4e740004,$2f00203a
- dc.l $fe64487b,$0930ffff,$fe1c202f,$00044e74
- dc.l $00042f00,$203afe52,$487b0930,$fffffe06
- dc.l $202f0004,$4e740004,$2f00203a,$fe40487b
- dc.l $0930ffff,$fdf0202f,$00044e74,$00042f00
- dc.l $203afe2e,$487b0930,$fffffdda,$202f0004
- dc.l $4e740004,$2f00203a,$fe1c487b,$0930ffff
- dc.l $fdc4202f,$00044e74,$00042f00,$203afe0a
- dc.l $487b0930,$fffffdae,$202f0004,$4e740004
- dc.l $2f00203a,$fdf8487b,$0930ffff,$fd98202f
- dc.l $00044e74,$00042f00,$203afde6,$487b0930
- dc.l $fffffd82,$202f0004,$4e740004,$2f00203a
- dc.l $fdd4487b,$0930ffff,$fd6c202f,$00044e74
- dc.l $00042f00,$203afdc2,$487b0930,$fffffd56
- dc.l $202f0004,$4e740004,$4e56ffa0,$48ee3fff
- dc.l $ffc02d56,$fff8082e,$00050004,$66084e68
- dc.l $2d48fffc,$600841ee,$000c2d48,$fffc422e
- dc.l $ffaa3d6e,$0004ffa8,$2d6e0006,$ffa4206e
- dc.l $ffa458ae,$ffa461ff,$ffffff26,$2d40ffa0
- dc.l $0800001e,$67680800,$00166628,$61ff0000
- dc.l $0cb0082e,$00050004,$670000ac,$082e0002
- dc.l $ffaa6700,$00a2082e,$00070004,$66000186
- dc.l $600001b0,$61ff0000,$0a28082e,$0002ffaa
- dc.l $660e082e,$0005ffaa,$6600010a,$60000078
- dc.l $082e0005,$000467ea,$082e0005,$ffaa6600
- dc.l $01264a2e,$00046b00,$014c6000,$01760800
- dc.l $0018670a,$61ff0000,$07ae6000,$004a0800
- dc.l $001b6730,$48400c00,$00fc670a,$61ff0000
- dc.l $0e926000,$0032206e,$ffa454ae,$ffa461ff
- dc.l $fffffe68,$4a816600,$019861ff,$00000d20
- dc.l $60000014,$61ff0000,$08c40c2e,$0010ffaa
- dc.l $66000004,$605c1d6e,$ffa90005,$082e0005
- dc.l $00046606,$206efffc,$4e604cee,$3fffffc0
- dc.l $082e0007,$00046612,$2d6effa4,$00062cae
- dc.l $fff84e5e,$60ffffff,$fd622d6e,$fff8fffc
- dc.l $3d6e0004,$00002d6e,$00060008,$2d6effa4
- dc.l $00023d7c,$20240006,$598e4e5e,$60ffffff
- dc.l $fd0e1d6e,$ffa90005,$4cee3fff,$ffc03cae
- dc.l $00042d6e,$00060008,$2d6effa4,$00023d7c
- dc.l $20180006,$2c6efff8,$dffc0000,$006060ff
- dc.l $fffffcb0,$1d6effa9,$00054cee,$3fffffc0
- dc.l $3cae0004,$2d6e0006,$00082d6e,$ffa40002
- dc.l $3d7c2014,$00062c6e,$fff8dffc,$00000060
- dc.l $60ffffff,$fc941d6e,$ffa90005,$4cee3fff
- dc.l $ffc02d6e,$0006000c,$3d7c2014,$000a2d6e
- dc.l $ffa40006,$2c6efff8,$dffc0000,$006460ff
- dc.l $fffffc66,$1d6effa9,$00054cee,$3fffffc0
- dc.l $2d6e0006,$000c3d7c,$2024000a,$2d6effa4
- dc.l $00062c6e,$fff8dffc,$00000064,$60ffffff
- dc.l $fc4e1d6e,$ffa90005,$4cee3fff,$ffc03d7c
- dc.l $00f4000e,$2d6effa4,$000a3d6e,$00040008
- dc.l $2c6efff8,$dffc0000,$006860ff,$fffffc4c
- dc.l $2c882d40,$fffc4fee,$ffc04cdf,$7fff2f2f
- dc.l $000c2f6f,$00040010,$2f6f000c,$00042f6f
- dc.l $0008000c,$2f5f0004,$3f7c4008,$00066028
- dc.l $4cee3fff,$ffc04e5e,$514f2eaf,$00083f6f
- dc.l $000c0004,$3f7c4008,$00062f6f,$00020008
- dc.l $2f7c0942,$8001000c,$08170005,$670608ef
- dc.l $0002000d,$60ffffff,$fbcc0c2e,$0040ffaa
- dc.l $660c4280,$102effab,$2daeffac,$0ce04e75
- dc.l $2040302e,$ffa03200,$0240003f,$02810000
- dc.l $0007303b,$020a4efb,$00064afc,$00400000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000080
- dc.l $0086008c,$00920098,$009e00a4,$00aa00b0
- dc.l $00ce00ec,$010a0128,$01460164,$01820196
- dc.l $01b401d2,$01f0020e,$022c024a,$0268027c
- dc.l $029a02b8,$02d602f4,$03120330,$034e036c
- dc.l $036c036c,$036c036c,$036c036c,$036c03d6
- dc.l $03f0040a,$042a03ca,$00000000,$0000206e
- dc.l $ffe04e75,$206effe4,$4e75206e,$ffe84e75
- dc.l $206effec,$4e75206e,$fff04e75,$206efff4
- dc.l $4e75206e,$fff84e75,$206efffc,$4e752008
- dc.l $206effe0,$d0882d40,$ffe02d48,$ffac1d7c
- dc.l $0000ffab,$1d7c0040,$ffaa4e75,$2008206e
- dc.l $ffe4d088,$2d40ffe4,$2d48ffac,$1d7c0001
- dc.l $ffab1d7c,$0040ffaa,$4e752008,$206effe8
- dc.l $d0882d40,$ffe82d48,$ffac1d7c,$0002ffab
- dc.l $1d7c0040,$ffaa4e75,$2008206e,$ffecd088
- dc.l $2d40ffec,$2d48ffac,$1d7c0003,$ffab1d7c
- dc.l $0040ffaa,$4e752008,$206efff0,$d0882d40
- dc.l $fff02d48,$ffac1d7c,$0004ffab,$1d7c0040
- dc.l $ffaa4e75,$2008206e,$fff4d088,$2d40fff4
- dc.l $2d48ffac,$1d7c0005,$ffab1d7c,$0040ffaa
- dc.l $4e752008,$206efff8,$d0882d40,$fff82d48
- dc.l $ffac1d7c,$0006ffab,$1d7c0040,$ffaa4e75
- dc.l $1d7c0004,$ffaa2008,$206efffc,$d0882d40
- dc.l $fffc4e75,$202effe0,$2d40ffac,$90882d40
- dc.l $ffe02040,$1d7c0000,$ffab1d7c,$0040ffaa
- dc.l $4e75202e,$ffe42d40,$ffac9088,$2d40ffe4
- dc.l $20401d7c,$0001ffab,$1d7c0040,$ffaa4e75
- dc.l $202effe8,$2d40ffac,$90882d40,$ffe82040
- dc.l $1d7c0002,$ffab1d7c,$0040ffaa,$4e75202e
- dc.l $ffec2d40,$ffac9088,$2d40ffec,$20401d7c
- dc.l $0003ffab,$1d7c0040,$ffaa4e75,$202efff0
- dc.l $2d40ffac,$90882d40,$fff02040,$1d7c0004
- dc.l $ffab1d7c,$0040ffaa,$4e75202e,$fff42d40
- dc.l $ffac9088,$2d40fff4,$20401d7c,$0005ffab
- dc.l $1d7c0040,$ffaa4e75,$202efff8,$2d40ffac
- dc.l $90882d40,$fff82040,$1d7c0006,$ffab1d7c
- dc.l $0040ffaa,$4e751d7c,$0008ffaa,$202efffc
- dc.l $90882d40,$fffc2040,$4e75206e,$ffa454ae
- dc.l $ffa461ff,$fffff9d4,$4a8166ff,$fffffd04
- dc.l $3040d1ee,$ffe04e75,$206effa4,$54aeffa4
- dc.l $61ffffff,$f9b64a81,$66ffffff,$fce63040
- dc.l $d1eeffe4,$4e75206e,$ffa454ae,$ffa461ff
- dc.l $fffff998,$4a8166ff,$fffffcc8,$3040d1ee
- dc.l $ffe84e75,$206effa4,$54aeffa4,$61ffffff
- dc.l $f97a4a81,$66ffffff,$fcaa3040,$d1eeffec
- dc.l $4e75206e,$ffa454ae,$ffa461ff,$fffff95c
- dc.l $4a8166ff,$fffffc8c,$3040d1ee,$fff04e75
- dc.l $206effa4,$54aeffa4,$61ffffff,$f93e4a81
- dc.l $66ffffff,$fc6e3040,$d1eefff4,$4e75206e
- dc.l $ffa454ae,$ffa461ff,$fffff920,$4a8166ff
- dc.l $fffffc50,$3040d1ee,$fff84e75,$206effa4
- dc.l $54aeffa4,$61ffffff,$f9024a81,$66ffffff
- dc.l $fc323040,$d1eefffc,$4e752f01,$206effa4
- dc.l $54aeffa4,$61ffffff,$f8e24a81,$66ffffff
- dc.l $fc12221f,$207614e0,$08000008,$670e48e7
- dc.l $3c002a00,$260860ff,$000000ec,$2f022200
- dc.l $e9590241,$000f2236,$14c00800,$000b6602
- dc.l $48c12400,$ef5a0282,$00000003,$e5a949c0
- dc.l $d081d1c0,$241f4e75,$1d7c0080,$ffaa206e
- dc.l $ffa44e75,$206effa4,$54aeffa4,$61ffffff
- dc.l $f87a4a81,$66ffffff,$fbaa3040,$4e75206e
- dc.l $ffa458ae,$ffa461ff,$fffff876,$4a8166ff
- dc.l $fffffb90,$20404e75,$206effa4,$54aeffa4
- dc.l $61ffffff,$f8464a81,$66ffffff,$fb763040
- dc.l $d1eeffa4,$55884e75,$206effa4,$54aeffa4
- dc.l $61ffffff,$f8264a81,$66ffffff,$fb56206e
- dc.l $ffa45588,$08000008,$670e48e7,$3c002a00
- dc.l $260860ff,$00000030,$2f022200,$e9590241
- dc.l $000f2236,$14c00800,$000b6602,$48c12400
- dc.l $ef5a0282,$00000003,$e5a949c0,$d081d1c0
- dc.l $241f4e75,$08050006,$67044282,$6016e9c5
- dc.l $24042436,$24c00805,$000b6602,$48c2e9c5
- dc.l $0542e1aa,$08050007,$67024283,$e9c50682
- dc.l $0c000002,$6d346718,$206effa4,$58aeffa4
- dc.l $61ffffff,$f7ac4a81,$66ffffff,$fac66018
- dc.l $206effa4,$54aeffa4,$61ffffff,$f77e4a81
- dc.l $66ffffff,$faae48c0,$d680e9c5,$07826700
- dc.l $006a0c00,$00026d34,$6718206e,$ffa458ae
- dc.l $ffa461ff,$fffff76a,$4a8166ff,$fffffa84
- dc.l $601c206e,$ffa454ae,$ffa461ff,$fffff73c
- dc.l $4a8166ff,$fffffa6c,$48c06002,$42802800
- dc.l $08050002,$67122043,$61ffffff,$f7764a81
- dc.l $6624d082,$d0846016,$d6822043,$61ffffff
- dc.l $f7624a81,$6610d084,$6004d682,$20032040
- dc.l $4cdf003c,$4e752043,$203c0101,$000160ff
- dc.l $fffff9f0,$322effa0,$10010240,$00072076
- dc.l $04e0d0ee,$ffa20801,$00076700,$008c3001
- dc.l $ef580240,$00072036,$04c00801,$00066752
- dc.l $24002448,$e19a2002,$61ffffff,$f71c4a81
- dc.l $660000fc,$544a204a,$e19a2002,$61ffffff
- dc.l $f7084a81,$660000e8,$544a204a,$e19a2002
- dc.l $61ffffff,$f6f44a81,$660000d4,$544a204a
- dc.l $e19a2002,$61ffffff,$f6e04a81,$660000c0
- dc.l $4e752400,$2448e048,$61ffffff,$f6cc4a81
- dc.l $660000ac,$544a204a,$200261ff,$fffff6ba
- dc.l $4a816600,$009a4e75,$08010006,$675c2448
- dc.l $61ffffff,$f6624a81,$66000092,$2400544a
- dc.l $204a61ff,$fffff650,$4a816600,$0080e14a
- dc.l $1400544a,$204a61ff,$fffff63c,$4a816600
- dc.l $006ce18a,$1400544a,$204a61ff,$fffff628
- dc.l $4a816600,$0058e18a,$1400122e,$ffa0e209
- dc.l $02410007,$2d8214c0,$4e752448,$61ffffff
- dc.l $f6064a81,$66000036,$2400544a,$204a61ff
- dc.l $fffff5f4,$4a816600,$0024e14a,$1400122e
- dc.l $ffa0e209,$02410007,$3d8214c2,$4e75204a
- dc.l $203c00a1,$000160ff,$fffff8a8,$204a203c
- dc.l $01210001,$60ffffff,$f89a61ff,$fffff914
- dc.l $102effa2,$e9180240,$000f2436,$04c00c2e
- dc.l $0002ffa0,$6d506728,$244861ff,$fffff5c4
- dc.l $4a816600,$009e2600,$588a204a,$61ffffff
- dc.l $f5b24a81,$6600008c,$22002003,$60000048
- dc.l $244861ff,$fffff59c,$4a816600,$00763200
- dc.l $484048c0,$48c1082e,$0007ffa2,$66000028
- dc.l $48c26000,$00222448,$61ffffff,$f5604a81
- dc.l $6600005e,$1200e048,$49c049c1,$082e0007
- dc.l $ffa26602,$49c29480,$42c30203,$00049280
- dc.l $b28242c4,$86040203,$0005382e,$ffa80204
- dc.l $001a8803,$3d44ffa8,$082e0003,$ffa26602
- dc.l $4e750804,$00006602,$4e751d7c,$0010ffaa
- dc.l $4e75204a,$203c0101,$000160ff,$fffff7c4
- dc.l $204a203c,$01410001,$60ffffff,$f7b6102e
- dc.l $ffa10200,$00386600,$0208102e,$ffa10240
- dc.l $00072e36,$04c06700,$00c0102e,$ffa3122e
- dc.l $ffa20240,$0007e809,$02410007,$3d40ffb2
- dc.l $3d41ffb4,$2a3604c0,$2c3614c0,$082e0003
- dc.l $ffa2671a,$4a875dee,$ffb06a02,$44874a85
- dc.l $5deeffb1,$6a0844fc,$00004086,$40854a85
- dc.l $66164a86,$67000048,$be866306,$cb466000
- dc.l $00124c47,$6005600a,$be85634e,$61ff0000
- dc.l $0068082e,$0003ffa2,$67244a2e,$ffb16702
- dc.l $4485102e,$ffb0b12e,$ffb1670c,$0c868000
- dc.l $00006226,$44866006,$0806001f,$661c44ee
- dc.l $ffa84a86,$42eeffa8,$302effb2,$322effb4
- dc.l $2d8504c0,$2d8614c0,$4e7508ee,$0001ffa9
- dc.l $08ae0000,$ffa94e75,$022e001e,$ffa9002e
- dc.l $0020ffaa,$4e750c87,$0000ffff,$621e4281
- dc.l $48454846,$3a068ac7,$32054846,$3a068ac7
- dc.l $48413205,$42454845,$2c014e75,$42aeffbc
- dc.l $422effb6,$42810807,$001f660e,$52aeffbc
- dc.l $e38fe38e,$e3956000,$ffee2607,$24054842
- dc.l $4843b443,$6606323c,$ffff600a,$220582c3
- dc.l $02810000,$ffff2f06,$42464846,$26072401
- dc.l $c4c74843,$c6c12805,$98834844,$30043806
- dc.l $4a406600,$000ab484,$63045381,$60de2f05
- dc.l $2c014846,$2a0761ff,$0000006a,$24052606
- dc.l $2a1f2c1f,$9c839b82,$64ff0000,$001a5381
- dc.l $42822607,$48434243,$dc83db82,$26074243
- dc.l $4843da83,$4a2effb6,$66163d41,$ffb84281
- dc.l $48454846,$3a064246,$50eeffb6,$6000ff6c
- dc.l $3d41ffba,$3c054846,$48452e2e,$ffbc670a
- dc.l $5387e28d,$e29651cf,$fffa2a06,$2c2effb8
- dc.l $4e752406,$26062805,$48434844,$ccc5cac3
- dc.l $c4c4c6c4,$42844846,$dc45d744,$dc42d744
- dc.l $48464245,$42424845,$4842da82,$da834e75
- dc.l $700461ff,$fffff61c,$0c2e0080,$ffaa6712
- dc.l $244861ff,$fffff2dc,$4a81661e,$2e006000
- dc.l $fde658ae,$ffa461ff,$fffff286,$4a8166ff
- dc.l $fffff5a0,$2e006000,$fdce61ff,$fffff5ce
- dc.l $204a203c,$01010001,$60ffffff,$f556102e
- dc.l $ffa10c00,$00076e00,$00b40240,$00072636
- dc.l $04c0342e,$ffa24241,$1202e95a,$02420007
- dc.l $283624c0,$4a846700,$00884a83,$67000082
- dc.l $422effb0,$082e0003,$ffa26718,$4a836c08
- dc.l $4483002e,$0001ffb0,$4a846c08,$44840a2e
- dc.l $0001ffb0,$2a032c03,$2e044846,$4847c6c4
- dc.l $c8c6cac7,$ccc74287,$4843d644,$dd87d645
- dc.l $dd874843,$42444245,$48444845,$d885d886
- dc.l $4a2effb0,$67084683,$46845283,$d9872d83
- dc.l $24c044fc,$00002d84,$14c042c7,$02070008
- dc.l $1c2effa9,$02060010,$8c071d46,$ffa94e75
- dc.l $42b624c0,$42b614c0,$7e0460e4,$700461ff
- dc.l $fffff510,$0c2e0080,$ffaa6714,$244861ff
- dc.l $fffff1d0,$4a816600,$00202600,$6000ff34
- dc.l $58aeffa4,$61ffffff,$f1784a81,$66ffffff
- dc.l $f4922600,$6000ff1c,$61ffffff,$f4c0204a
- dc.l $203c0101,$000160ff,$fffff448,$2d40ffb4
- dc.l $2200e958,$0240000f,$227604c0,$2d49ffb0
- dc.l $2001ec49,$02410007,$2a3614c0,$02400007
- dc.l $263604c0,$3d40ffba,$302effa2,$2200e958
- dc.l $0240000f,$207604c0,$2d48ffbc,$2001ec49
- dc.l $02410007,$283614c0,$02400007,$243604c0
- dc.l $3d40ffb8,$082e0001,$ffa056c7,$082e0005
- dc.l $000456c6,$24482649,$22072006,$61ffffff
- dc.l $f05c204a,$4a8066ff,$000001c8,$22072006
- dc.l $204b61ff,$fffff046,$204b4a80,$660a204a
- dc.l $224b60ff,$fffff020,$2f002207,$2006204a
- dc.l $61ffffff,$f03e201f,$204b60ff,$00000194
- dc.l $082e0001,$ffa06648,$44eeffa8,$b0426602
- dc.l $b24342ee,$ffa84a04,$6610362e,$ffba3d81
- dc.l $34c2342e,$ffb83d80,$24c2082e,$00050004
- dc.l $56c22002,$51c1206e,$ffbc61ff,$ffffeff4
- dc.l $200251c1,$206effb0,$61ffffff,$efe64e75
- dc.l $44eeffa8,$b0826602,$b28342ee,$ffa84a04
- dc.l $6610362e,$ffba2d81,$34c0342e,$ffb82d80
- dc.l $24c0082e,$00050004,$56c22002,$50c1206e
- dc.l $ffbc61ff,$ffffefac,$200250c1,$206effb0
- dc.l $61ffffff,$ef9e4e75,$202effb4,$6000feae
- dc.l $082e0001,$ffa06610,$700261ff,$fffff364
- dc.l $2d48ffb4,$51c7600e,$700461ff,$fffff354
- dc.l $2d48ffb4,$50c7302e,$ffa22200,$ec480240
- dc.l $00072436,$04c00241,$00072836,$14c03d41
- dc.l $ffb8082e,$00050004,$56c62448,$22072006
- dc.l $61ffffff,$ef284a80,$66000096,$204a60ff
- dc.l $ffffeeee,$082e0001,$ffa0662c,$44eeffa8
- dc.l $b04442ee,$ffa84a01,$6608362e,$ffb83d80
- dc.l $34c2206e,$ffb451c1,$082e0005,$000456c0
- dc.l $61ffffff,$eefe4e75,$44eeffa8,$b08442ee
- dc.l $ffa84a01,$6608362e,$ffb82d80,$34c0206e
- dc.l $ffb450c1,$082e0005,$000456c0,$61ffffff
- dc.l $eed24e75,$4e7b6000,$4e7b6001,$0c2e00fc
- dc.l $ffa167ff,$ffffff24,$206effb4,$082e0001
- dc.l $ffa056c7,$6000ff40,$4e7b6000,$4e7b6001
- dc.l $24482f00,$61ffffff,$f264201f,$588f518f
- dc.l $518e721a,$41ef0008,$43ef0000,$22d851c9
- dc.l $fffc3d7c,$4008000a,$2d4a000c,$2d400010
- dc.l $4cee3fff,$ffc04e5e,$60ffffff,$edf84280
- dc.l $43fb0170,$000005ae,$b3c86d0e,$43fb0170
- dc.l $00000010,$b1c96d02,$4e7570ff,$4e754a06
- dc.l $66047001,$60027005,$4a076700,$01e42448
- dc.l $26492848,$2a49568c,$568d220a,$40c7007c
- dc.l $07004e7a,$60004e7b,$00004e7b,$0001f58a
- dc.l $f58cf58b,$f58df46a,$f46cf46b,$f46d2441
- dc.l $56812841,$f5caf5cc,$247c8000,$0000267c
- dc.l $a0000000,$287c0000,$00002008,$02000003
- dc.l $671c0c00,$00026700,$00966000,$010251fc
- dc.l $4e7ba008,$0e911000,$0e900000,$6002600e
- dc.l $b082661c,$b2836618,$0e915800,$6002600e
- dc.l $4e7bb008,$0e904800,$4e7bc008,$6034600e
- dc.l $4e7bb008,$0e900800,$4e7bc008,$6012600e
- dc.l $4e714e71,$4e714e71,$4e714e71,$4e7160b0
- dc.l $4e7b6000,$4e7b6001,$46c751c4,$60ffffff
- dc.l $fd424e7b,$60004e7b,$600146c7,$50c460ff
- dc.l $fffffd30,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $4e7ba008,$0e911000,$0e900000,$6002600e
- dc.l $b082662c,$b2836628,$0e915800,$6002600e
- dc.l $48440e58,$48004e7b,$b0084844,$6002600e
- dc.l $0e504800,$4e7bc008,$6000ffa8,$4e71600e
- dc.l $48400e58,$08004e7b,$b0084840,$6002600e
- dc.l $0e500800,$4e7bc008,$6000ff76,$4e71600e
- dc.l $4e714e71,$4e714e71,$4e714e71,$4e716090
- dc.l $4e7ba008,$0e911000,$0e900000,$6002600e
- dc.l $b082663c,$b2836638,$0e915800,$6002600e
- dc.l $e19c0e18,$48004844,$0e584800,$6002600e
- dc.l $e19c4e7b,$b0080e10,$48006004,$4e71600e
- dc.l $4e7bc008,$6000ff2c,$4e714e71,$4e71600e
- dc.l $e1980e18,$08004840,$0e580800,$6002600e
- dc.l $e1984e7b,$b0080e10,$08006004,$4e71600e
- dc.l $4e7bc008,$6000feea,$4e714e71,$4e71600c
- dc.l $4e714e71,$4e714e71,$4e714e71,$6000ff72
- dc.l $24482649,$28482a49,$528c528d,$220a40c7
- dc.l $007c0700,$4e7a6000,$4e7b0000,$4e7b0001
- dc.l $f58af58c,$f58bf58d,$f46af46c,$f46bf46d
- dc.l $24415681,$2841f5ca,$f5cc247c,$80000000
- dc.l $267ca000,$0000287c,$00000000,$20080800
- dc.l $00006600,$009a6016,$51fc51fc,$51fc51fc
- dc.l $4e7ba008,$0e511000,$0e500000,$6002600e
- dc.l $b042661c,$b2436618,$0e515800,$6002600e
- dc.l $4e7bb008,$0e504800,$4e7bc008,$6034600e
- dc.l $4e7bb008,$0e500800,$4e7bc008,$6012600e
- dc.l $4e714e71,$4e714e71,$4e714e71,$4e7160b0
- dc.l $4e7b6000,$4e7b6001,$46c751c4,$60ffffff
- dc.l $fb624e7b,$60004e7b,$600146c7,$50c460ff
- dc.l $fffffb50,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $4e7ba008,$0e511000,$0e500000,$6002600e
- dc.l $b042662c,$b2436628,$0e515800,$6002600e
- dc.l $e09c0e18,$48004e7b,$b008e19c,$6002600e
- dc.l $0e104800,$4e7bc008,$6000ffa8,$4e71600e
- dc.l $e0980e18,$08004e7b,$b008e198,$6002600e
- dc.l $0e100800,$4e7bc008,$6000ff76,$4e71600e
- dc.l $4e714e71,$4e714e71,$4e714e71,$4e716090
- dc.l $4a066604,$70016002,$70054a07,$660000c6
- dc.l $22482448,$528a2602,$e04a40c7,$007c0700
- dc.l $4e7a6000,$4e7b0000,$4e7b0001,$f589f58a
- dc.l $f469f46a,$227c8000,$0000247c,$a0000000
- dc.l $267c0000,$00006016,$51fc51fc,$51fc51fc
- dc.l $4e7b9008,$0e500000,$b0446624,$6002600e
- dc.l $0e182800,$4e7ba008,$0e103800,$6002600e
- dc.l $4e7bb008,$604c4e71,$4e714e71,$4e71600e
- dc.l $e0980e18,$08004e7b,$a008e198,$6002600e
- dc.l $0e100800,$4e7bb008,$60164e71,$4e71600e
- dc.l $4e714e71,$4e714e71,$4e714e71,$4e7160a0
- dc.l $4e7b6000,$4e7b6001,$46c751c1,$60ffffff
- dc.l $fb164e7b,$60004e7b,$600146c7,$50c160ff
- dc.l $fffffb04,$22482448,$568a2208,$08010000
- dc.l $660000c2,$26024842,$40c7007c,$07004e7a
- dc.l $60004e7b,$00004e7b,$0001f589,$f58af469
- dc.l $f46a227c,$80000000,$247ca000,$0000267c
- dc.l $00000000,$601851fc,$51fc51fc,$51fc51fc
- dc.l $4e7b9008,$0e900000,$b0846624,$6002600e
- dc.l $0e582800,$4e7ba008,$0e503800,$6002600e
- dc.l $4e7bb008,$604c4e71,$4e714e71,$4e71600e
- dc.l $48400e58,$08004840,$4e7ba008,$6002600e
- dc.l $0e500800,$4e7bb008,$60164e71,$4e71600e
- dc.l $4e714e71,$4e714e71,$4e714e71,$4e7160a0
- dc.l $4e7b6000,$4e7b6001,$46c751c1,$60ffffff
- dc.l $fa464e7b,$60004e7b,$600146c7,$50c160ff
- dc.l $fffffa34,$2a02e08a,$26024842,$40c7007c
- dc.l $07004e7a,$60004e7b,$00004e7b,$0001f589
- dc.l $f58af469,$f46a227c,$80000000,$247ca000
- dc.l $0000267c,$00000000,$601451fc,$51fc51fc
- dc.l $4e7b9008,$0e900000,$b0846624,$6002600e
- dc.l $0e182800,$0e583800,$4e7ba008,$6002600e
- dc.l $0e105800,$4e7bb008,$6000ff88,$4e71600e
- dc.l $e1980e18,$08004840,$0e580800,$6002600e
- dc.l $e1984e7b,$a0080e10,$08006004,$4e71600e
- dc.l $4e7bb008,$6000ff4a,$4e714e71,$4e71600e
- dc.l $4e714e71,$4e714e71,$4e714e71,$4e716090
diff --git a/sys/arch/m68k/060sp/itest.s b/sys/arch/m68k/060sp/itest.s
deleted file mode 100644
index e5c8cea9bf6..00000000000
--- a/sys/arch/m68k/060sp/itest.s
+++ /dev/null
@@ -1,6396 +0,0 @@
-#
-# $OpenBSD: itest.s,v 1.2 1996/05/30 22:14:54 niklas Exp $
-# $NetBSD: itest.s,v 1.2 1996/05/15 19:48:53 is Exp $
-#
-
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-# M68000 Hi-Performance Microprocessor Division
-# M68060 Software Package Production Release
-#
-# M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
-# All rights reserved.
-#
-# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-# To the maximum extent permitted by applicable law,
-# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
-# FOR A PARTICULAR PURPOSE and any warranty against infringement with
-# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-# and any accompanying written materials.
-#
-# To the maximum extent permitted by applicable law,
-# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
-# BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
-# ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
-#
-# Motorola assumes no responsibility for the maintenance and support
-# of the SOFTWARE.
-#
-# You are hereby granted a copyright license to use, modify, and distribute the
-# SOFTWARE so long as this entire notice is retained without alteration
-# in any modified and/or redistributed versions, and that such modified
-# versions are clearly identified as such.
-# No licenses are granted by implication, estoppel or otherwise under any
-# patents or trademarks of Motorola, Inc.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-#############################################
-set SREGS, -64
-set IREGS, -128
-set SCCR, -130
-set ICCR, -132
-set TESTCTR, -136
-set EAMEM, -140
-set EASTORE, -144
-set DATA, -160
-
-#############################################
-TESTTOP:
- bra.l _060TESTS_
-
-start_str:
- string "Testing 68060 ISP started:\n"
-
-pass_str:
- string "passed\n"
-fail_str:
- string " failed\n"
-
- align 0x4
-chk_test:
- tst.l %d0
- bne.b test_fail
-test_pass:
- pea pass_str(%pc)
- bsr.l _print_str
- addq.l &0x4,%sp
- rts
-test_fail:
- mov.l %d1,-(%sp)
- bsr.l _print_num
- addq.l &0x4,%sp
-
- pea fail_str(%pc)
- bsr.l _print_str
- addq.l &0x4,%sp
- rts
-
-#############################################
-_060TESTS_:
- link %a6,&-160
-
- movm.l &0x3f3c,-(%sp)
-
- pea start_str(%pc)
- bsr.l _print_str
- addq.l &0x4,%sp
-
-### mul
- clr.l TESTCTR(%a6)
- pea mulul_str(%pc)
- bsr.l _print_str
- addq.l &0x4,%sp
-
- bsr.l mulul_0
-
- bsr.l chk_test
-
-### div
- clr.l TESTCTR(%a6)
- pea divul_str(%pc)
- bsr.l _print_str
- addq.l &0x4,%sp
-
- bsr.l divul_0
-
- bsr.l chk_test
-
-### cmp2
- clr.l TESTCTR(%a6)
- pea cmp2_str(%pc)
- bsr.l _print_str
- addq.l &0x4,%sp
-
- bsr.l cmp2_1
-
- bsr.l chk_test
-
-### movp
- clr.l TESTCTR(%a6)
- pea movp_str(%pc)
- bsr.l _print_str
- addq.l &0x4,%sp
-
- bsr.l movp_0
-
- bsr.l chk_test
-
-### ea
- clr.l TESTCTR(%a6)
- pea ea_str(%pc)
- bsr.l _print_str
- addq.l &0x4,%sp
-
- mov.l &0x2,EAMEM(%a6)
- bsr.l ea_0
-
- bsr.l chk_test
-
-### cas
- clr.l TESTCTR(%a6)
- pea cas_str(%pc)
- bsr.l _print_str
- addq.l &0x4,%sp
-
- bsr.l cas0
-
- bsr.l chk_test
-
-### cas2
- clr.l TESTCTR(%a6)
- pea cas2_str(%pc)
- bsr.l _print_str
- addq.l &0x4,%sp
-
- bsr.l cas20
-
- bsr.l chk_test
-
-###
- movm.l (%sp)+,&0x3cfc
-
- unlk %a6
- rts
-
-#############################################
-#############################################
-
-mulul_str:
- string "\t64-bit multiply..."
-
- align 0x4
-mulul_0:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d1
- mov.l &0x99999999,%d2
- mov.l &0x88888888,%d3
-
- mov.w &0x0004,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- mulu.l %d1,%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- clr.l IREGS+0x8(%a6)
- clr.l IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-mulul_1:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0x77777777,%d1
- mov.l &0x99999999,%d2
- mov.l &0x00000000,%d3
-
- mov.w &0x0004,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- mulu.l %d1,%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- clr.l IREGS+0x8(%a6)
- clr.l IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-mulul_2:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0x00000010,%d1
- mov.l &0x66666666,%d2
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- mulu.l %d1,%d2:%d2
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- mov.l &0x00000006,IREGS+0x8(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-mulul_3:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0x55555555,%d1
- mov.l &0x00000000,%d2
- mov.l &0x00000003,%d3
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- mulu.l %d1,%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- mov.l &0x00000000,IREGS+0x8(%a6)
- mov.l &0xffffffff,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-mulul_4:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0x40000000,%d1
- mov.l &0x00000000,%d2
- mov.l &0x00000004,%d3
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- mulu.l %d1,%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- mov.l &0x00000001,IREGS+0x8(%a6)
- mov.l &0x00000000,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-mulul_5:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0xffffffff,%d1
- mov.l &0x00000000,%d2
- mov.l &0xffffffff,%d3
-
- mov.w &0x0008,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- mulu.l %d1,%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- mov.l &0xfffffffe,IREGS+0x8(%a6)
- mov.l &0x00000001,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-mulul_6:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0x80000000,%d1
- mov.l &0x00000000,%d2
- mov.l &0xffffffff,%d3
-
- mov.w &0x00000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- muls.l %d1,%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- mov.l &0x00000000,IREGS+0x8(%a6)
- mov.l &0x80000000,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-mulul_7:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0x80000000,%d1
- mov.l &0x00000000,%d2
- mov.l &0x00000001,%d3
-
- mov.w &0x0008,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- muls.l %d1,%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- mov.l &0xffffffff,IREGS+0x8(%a6)
- mov.l &0x80000000,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-mulul_8:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0x00000001,%d1
- mov.l &0x00000000,%d2
- mov.l &0x80000000,%d3
-
- mov.w &0x0008,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- muls.l %d1,%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- mov.l &0xffffffff,IREGS+0x8(%a6)
- mov.l &0x80000000,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- mov.l TESTCTR(%a6),%d1
- clr.l %d0
- rts
-
-#############################################
-
-movp_str:
- string "\tmovep..."
-
- align 0x4
-###############################
-# movep.w %d0,(0x0,%a0) #
-###############################
-movp_0:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA(%a6),%a0
- mov.w &0xaaaa,%d0
- clr.b 0x0(%a0)
- clr.b 0x2(%a0)
-
- mov.w &0x001f,ICCR(%a6)
- mov.w &0x001f,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- movp.w %d0,(0x0,%a0)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- mov.b 0x2(%a0),%d1
- lsl.w &0x8,%d1
- mov.b 0x0(%a0),%d1
-
- cmp.w %d0,%d1
- bne.l error
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-###############################
-# movep.w %d0,(0x0,%a0) #
-###############################
-movp_1:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA+0x4(%a6),%a0
- mov.w &0xaaaa,%d0
- clr.l -0x4(%a0)
- clr.l (%a0)
- clr.l 0x4(%a0)
-
- mov.w &0x001f,ICCR(%a6)
- mov.w &0x001f,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- movp.w %d0,(0x0,%a0)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- tst.l -0x4(%a0)
- bne.l error
- tst.l 0x4(%a0)
- bne.l error
- cmpi.l (%a0),&0xaa00aa00
- bne.l error
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-#####################################################
-# movep.w %d0,(0x0,%a0) #
-# - this test has %cc initially equal to zero #
-#####################################################
-movp_2:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA(%a6),%a0
- mov.w &0xaaaa,%d0
- clr.b 0x0(%a0)
- clr.b 0x2(%a0)
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- movp.w %d0,(0x0,%a0)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- mov.b 0x2(%a0),%d1
- lsl.w &0x8,%d1
- mov.b 0x0(%a0),%d1
-
- cmp.w %d0,%d1
- bne.l error
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-###############################
-# movep.w (0x0,%a0),%d0 #
-###############################
-movp_3:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA(%a6),%a0
- mov.b &0xaa,0x0(%a0)
- mov.b &0xaa,0x2(%a0)
-
- mov.w &0x001f,ICCR(%a6)
- mov.w &0x001f,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- movp.w (0x0,%a0),%d0
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- mov.w &0xaaaa,IREGS+0x2(%a6)
-
- mov.w &0xaaaa,%d1
-
- cmp.w %d0,%d1
- bne.l error
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-###############################
-# movep.l %d0,(0x0,%a0) #
-###############################
-movp_4:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA(%a6),%a0
- mov.l &0xaaaaaaaa,%d0
- clr.b 0x0(%a0)
- clr.b 0x2(%a0)
- clr.b 0x4(%a0)
- clr.b 0x6(%a0)
-
- mov.w &0x001f,ICCR(%a6)
- mov.w &0x001f,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- movp.l %d0,(0x0,%a0)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- mov.b 0x6(%a0),%d1
- lsl.l &0x8,%d1
- mov.b 0x4(%a0),%d1
- lsl.l &0x8,%d1
- mov.b 0x2(%a0),%d1
- lsl.l &0x8,%d1
- mov.b 0x0(%a0),%d1
-
- cmp.l %d0,%d1
- bne.l error
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-###############################
-# movep.l %d0,(0x0,%a0) #
-###############################
-movp_5:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA+0x4(%a6),%a0
- mov.l &0xaaaaaaaa,%d0
- clr.l -0x4(%a0)
- clr.l (%a0)
- clr.l 0x4(%a0)
- clr.l 0x8(%a0)
-
- mov.w &0x001f,ICCR(%a6)
- mov.w &0x001f,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- movp.l %d0,(0x0,%a0)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- tst.l -0x4(%a0)
- bne.l error
- tst.l 0x8(%a0)
- bne.l error
- cmpi.l (%a0),&0xaa00aa00
- bne.l error
- cmpi.l 0x4(%a0),&0xaa00aa00
- bne.l error
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-###############################
-# movep.l (0x0,%a0),%d0 #
-###############################
-movp_6:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA(%a6),%a0
- mov.b &0xaa,0x0(%a0)
- mov.b &0xaa,0x2(%a0)
- mov.b &0xaa,0x4(%a0)
- mov.b &0xaa,0x6(%a0)
-
- mov.w &0x001f,ICCR(%a6)
- mov.w &0x001f,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- movp.l (0x0,%a0),%d0
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- mov.l &0xaaaaaaaa,IREGS(%a6)
-
- mov.l &0xaaaaaaaa,%d1
-
- cmp.l %d0,%d1
- bne.l error
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-###############################
-# movep.w %d7,(0x0,%a0) #
-###############################
-movp_7:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA(%a6),%a0
- mov.w &0xaaaa,%d7
- clr.b 0x0(%a0)
- clr.b 0x2(%a0)
-
- mov.w &0x001f,ICCR(%a6)
- mov.w &0x001f,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- movp.w %d7,(0x0,%a0)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- mov.b 0x2(%a0),%d1
- lsl.w &0x8,%d1
- mov.b 0x0(%a0),%d1
-
- cmp.w %d7,%d1
- bne.l error
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-###############################
-# movep.w (0x0,%a0),%d7 #
-###############################
-movp_8:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA(%a6),%a0
- mov.b &0xaa,0x0(%a0)
- mov.b &0xaa,0x2(%a0)
-
- mov.w &0x001f,ICCR(%a6)
- mov.w &0x001f,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- movp.w (0x0,%a0),%d7
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- mov.w &0xaaaa,IREGS+30(%a6)
-
- mov.w &0xaaaa,%d1
-
- cmp.w %d7,%d1
- bne.l error
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-###############################
-# movep.w %d0,(0x0,%a0) #
-###############################
-movp_9:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA(%a6),%a0
- mov.w &0xaaaa,%d0
- clr.b 0x0(%a0)
- clr.b 0x2(%a0)
-
- mov.w &0x001f,ICCR(%a6)
- mov.w &0x001f,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- movp.w %d0,(0x0,%a0)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- mov.b 0x2(%a0),%d1
- lsl.w &0x8,%d1
- mov.b 0x0(%a0),%d1
-
- cmp.w %d0,%d1
- bne.l error
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-###############################
-# movep.w %d0,(0x8,%a0) #
-###############################
-movp_10:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA(%a6),%a0
- mov.w &0xaaaa,%d0
- clr.b 0x0+0x8(%a0)
- clr.b 0x2+0x8(%a0)
-
- mov.w &0x001f,ICCR(%a6)
- mov.w &0x1f,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- movp.w %d0,(0x8,%a0)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- mov.b 0x2+0x8(%a0),%d1
- lsl.w &0x8,%d1
- mov.b 0x0+0x8(%a0),%d1
-
- cmp.w %d0,%d1
- bne.l error
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-###############################
-# movep.w (0x8,%a0),%d0 #
-###############################
-movp_11:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA(%a6),%a0
- mov.b &0xaa,0x0+0x8(%a0)
- mov.b &0xaa,0x2+0x8(%a0)
-
- mov.w &0x001f,ICCR(%a6)
- mov.w &0x1f,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- movp.w (0x8,%a0),%d0
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- mov.w &0xaaaa,IREGS+0x2(%a6)
-
- mov.w &0xaaaa,%d1
-
- cmp.w %d0,%d1
- bne.l error
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-###############################
-# movep.l %d0,(0x8,%a0) #
-###############################
-movp_12:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA(%a6),%a0
- mov.l &0xaaaaaaaa,%d0
- clr.b 0x0+0x8(%a0)
- clr.b 0x2+0x8(%a0)
- clr.b 0x4+0x8(%a0)
- clr.b 0x6+0x8(%a0)
-
- mov.w &0x001f,ICCR(%a6)
- mov.w &0x1f,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- movp.l %d0,(0x8,%a0)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- mov.b 0x6+0x8(%a0),%d1
- lsl.l &0x8,%d1
- mov.b 0x4+0x8(%a0),%d1
- lsl.l &0x8,%d1
- mov.b 0x2+0x8(%a0),%d1
- lsl.l &0x8,%d1
- mov.b 0x0+0x8(%a0),%d1
-
- cmp.l %d0,%d1
- bne.l error
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-###############################
-# movep.l (0x8,%a0),%d0 #
-###############################
-movp_13:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA(%a6),%a0
- mov.b &0xaa,0x0+0x8(%a0)
- mov.b &0xaa,0x2+0x8(%a0)
- mov.b &0xaa,0x4+0x8(%a0)
- mov.b &0xaa,0x6+0x8(%a0)
-
- mov.w &0x001f,ICCR(%a6)
- mov.w &0x1f,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- movp.l (0x8,%a0),%d0
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- mov.l &0xaaaaaaaa,IREGS(%a6)
-
- mov.l &0xaaaaaaaa,%d1
-
- cmp.l %d0,%d1
- bne.l error
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-################################
-# movep.w %d0,(-0x8,%a0) #
-################################
-movp_14:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA+0x8(%a6),%a0
- mov.w &0xaaaa,%d0
- clr.b 0x0-0x8(%a0)
- clr.b 0x2-0x8(%a0)
-
- mov.w &0x001f,ICCR(%a6)
- mov.w &0x1f,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- movp.w %d0,(-0x8,%a0)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- mov.b 0x2-0x8(%a0),%d1
- lsl.w &0x8,%d1
- mov.b 0x0-0x8(%a0),%d1
-
- cmp.w %d0,%d1
- bne.l error
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-################################
-# movep.w (-0x8,%a0),%d0 #
-################################
-movp_15:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA+0x8(%a6),%a0
- mov.b &0xaa,0x0-0x8(%a0)
- mov.b &0xaa,0x2-0x8(%a0)
-
- mov.w &0x001f,ICCR(%a6)
- mov.w &0x1f,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- movp.w (-0x8,%a0),%d0
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- mov.w &0xaaaa,IREGS+0x2(%a6)
-
- mov.w &0xaaaa,%d1
-
- cmp.w %d0,%d1
- bne.l error
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-################################
-# movep.l %d0,(-0x8,%a0) #
-################################
-movp_16:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA+0x8(%a6),%a0
- mov.l &0xaaaaaaaa,%d0
- clr.b 0x0-0x8(%a0)
- clr.b 0x2-0x8(%a0)
- clr.b 0x4-0x8(%a0)
- clr.b 0x8-0x8(%a0)
-
- mov.w &0x001f,ICCR(%a6)
- mov.w &0x1f,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- movp.l %d0,(-0x8,%a0)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- mov.b 0x6-0x8(%a0),%d1
- lsl.l &0x8,%d1
- mov.b 0x4-0x8(%a0),%d1
- lsl.l &0x8,%d1
- mov.b 0x2-0x8(%a0),%d1
- lsl.l &0x8,%d1
- mov.b 0x0-0x8(%a0),%d1
-
- cmp.l %d0,%d1
- bne.l error
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-################################
-# movep.l (-0x8,%a0),%d0 #
-################################
-movp_17:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA+0x8(%a6),%a0
- mov.b &0xaa,0x0-0x8(%a0)
- mov.b &0xaa,0x2-0x8(%a0)
- mov.b &0xaa,0x4-0x8(%a0)
- mov.b &0xaa,0x8-0x8(%a0)
-
- mov.w &0x001f,ICCR(%a6)
- mov.w &0x1f,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- movp.l (-0x8,%a0),%d0
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- mov.l &0xaaaaaaaa,IREGS(%a6)
-
- mov.l &0xaaaaaaaa,%d1
-
- cmp.l %d0,%d1
- bne.l error
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- mov.l TESTCTR(%a6),%d1
- clr.l %d0
- rts
-
-###########################################################
-
-divul_str:
- string "\t64-bit divide..."
-
- align 0x4
-divul_0:
- addq.l &0x1,TESTCTR(%a6)
-
-# movm.l DEF_REGS(%pc),&0x3fff
-
-# clr.l %d1
-# mov.l &0x99999999,%d2
-# mov.l &0x88888888,%d3
-
-# mov.w &0x001e,ICCR(%a6)
-# mov.w &0x001f,%cc
-# movm.l &0x7fff,IREGS(%a6)
-
-# divu.l %d1,%d2:%d3
-
-# mov.w %cc,SCCR(%a6)
-# movm.l &0x7fff,SREGS(%a6)
-
-# bsr.l chkregs
-# tst.b %d0
-# bne.l error
-
-divul_1:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0x00000001,%d1
- mov.l &0x00000000,%d2
- mov.l &0x00000000,%d3
-
- mov.w &0x0014,ICCR(%a6)
- mov.w &0x001f,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- divu.l %d1,%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-divul_2:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0x44444444,%d1
- mov.l &0x00000000,%d2
- mov.l &0x55555555,%d3
-
- mov.w &0x0010,ICCR(%a6)
- mov.w &0x001f,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- divu.l %d1,%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- mov.l &0x11111111,IREGS+0x8(%a6)
- mov.l &0x00000001,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-divul_3:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0x55555555,%d1
- mov.l &0x00000000,%d2
- mov.l &0x44444444,%d3
-
- mov.w &0x0014,ICCR(%a6)
- mov.w &0x001f,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- divu.l %d1,%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- mov.l &0x44444444,IREGS+0x8(%a6)
- mov.l &0x00000000,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-divul_4:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0x11111111,%d1
- mov.l &0x44444444,%d2
- mov.l &0x44444444,%d3
-
- mov.w &0x001e,ICCR(%a6)
- mov.w &0x001d,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- divu.l %d1,%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-divul_5:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0xfffffffe,%d1
- mov.l &0x00000001,%d2
- mov.l &0x00000002,%d3
-
- mov.w &0x001e,ICCR(%a6)
- mov.w &0x001d,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- divs.l %d1,%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-divul_6:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0xfffffffe,%d1
- mov.l &0x00000001,%d2
- mov.l &0x00000000,%d3
-
- mov.w &0x0018,ICCR(%a6)
- mov.w &0x001d,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- divs.l %d1,%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- mov.l &0x00000000,IREGS+0x8(%a6)
- mov.l &0x80000000,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-divul_7:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0x00000002,%d1
- mov.l &0x00000001,%d2
- mov.l &0x00000000,%d3
-
- mov.w &0x001e,ICCR(%a6)
- mov.w &0x001d,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- divs.l %d1,%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-divul_8:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0xffffffff,%d1
- mov.l &0xfffffffe,%d2
- mov.l &0xffffffff,%d3
-
- mov.w &0x0008,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- divu.l %d1,%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-divul_9:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0xffffffff,%d1
- mov.l &0xfffffffe,%d2
- mov.l &0xffffffff,%d3
-
- mov.w &0x0008,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- divu.l &0xffffffff,%d2:%d2
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- mov.l &0xffffffff,IREGS+0x8(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-divul_10:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0x0000ffff,%d1
- mov.l &0x00000001,%d2
- mov.l &0x55555555,%d3
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- divu.l %d1,%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- mov.l &0x0000aaab,IREGS+0x8(%a6)
- mov.l &0x00015556,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- mov.l TESTCTR(%a6),%d1
- clr.l %d0
- rts
-
-###########################################################
-
-cas_str:
- string "\tcas..."
-
- align 0x4
-cas0:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA+0x1(%a6),%a0
-
- mov.w &0xaaaa,(%a0)
-
- mov.w &0xaaaa,%d1
- mov.w &0xbbbb,%d2
-
- mov.w &0x0014,ICCR(%a6)
- mov.w &0x0010,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cas.w %d1,%d2,(%a0) # Dc,Du,<ea>
-
- mov.w %cc,SCCR(%a6)
- mov.w (%a0),%d3
- mov.w &0xbbbb,IREGS+0xc+0x2(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cas1:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA+0x1(%a6),%a0
-
- mov.w &0xeeee,(%a0)
-
- mov.w &0x0000aaaa,%d1
- mov.w &0x0000bbbb,%d2
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cas.w %d1,%d2,(%a0) # Dc,Du,<ea>
-
- mov.w %cc,SCCR(%a6)
- mov.w (%a0),%d3
- mov.w &0xeeee,IREGS+0x4+0x2(%a6)
- mov.w &0xeeee,IREGS+0xc+0x2(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cas2:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA+0x2(%a6),%a0
-
- mov.l &0xaaaaaaaa,(%a0)
-
- mov.l &0xaaaaaaaa,%d1
- mov.l &0xbbbbbbbb,%d2
-
- mov.w &0x0004,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cas.l %d1,%d2,(%a0) # Dc,Du,<ea>
-
- mov.w %cc,SCCR(%a6)
- mov.l (%a0),%d3
- mov.l &0xbbbbbbbb,IREGS+0xc(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cas3:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA+0x2(%a6),%a0
-
- mov.l &0xeeeeeeee,(%a0)
-
- mov.l &0xaaaaaaaa,%d1
- mov.l &0xbbbbbbbb,%d2
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cas.l %d1,%d2,(%a0) # Dc,Du,<ea>
-
- mov.w %cc,SCCR(%a6)
- mov.l (%a0),%d3
- mov.l &0xeeeeeeee,IREGS+0x4(%a6)
- mov.l &0xeeeeeeee,IREGS+0xc(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cas4:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA+0x1(%a6),%a0
-
- mov.l &0xaaaaaaaa,(%a0)
-
- mov.l &0xaaaaaaaa,%d1
- mov.l &0xbbbbbbbb,%d2
-
- mov.w &0x0004,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cas.l %d1,%d2,(%a0) # Dc,Du,<ea>
-
- mov.w %cc,SCCR(%a6)
- mov.l (%a0),%d3
- mov.l &0xbbbbbbbb,IREGS+0xc(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cas5:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA+0x1(%a6),%a0
-
- mov.l &0x7fffffff,(%a0)
-
- mov.l &0x80000000,%d1
- mov.l &0xbbbbbbbb,%d2
-
- mov.w &0x001b,ICCR(%a6)
- mov.w &0x0010,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cas.l %d1,%d2,(%a0) # Dc,Du,<ea>
-
- mov.w %cc,SCCR(%a6)
- mov.l (%a0),%d3
- mov.l &0x7fffffff,IREGS+0x4(%a6)
- mov.l &0x7fffffff,IREGS+0xc(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- mov.l TESTCTR(%a6),%d1
- clr.l %d0
- rts
-
-###########################################################
-
-cas2_str:
- string "\tcas2..."
-
- align 0x4
-cas20:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA+0x0(%a6),%a0
- lea DATA+0x4(%a6),%a1
-
- mov.l &0xaaaaaaaa,(%a0)
- mov.l &0xbbbbbbbb,(%a1)
-
- mov.l &0xaaaaaaaa,%d1
- mov.l &0xbbbbbbbb,%d2
- mov.l &0xcccccccc,%d3
- mov.l &0xdddddddd,%d4
-
- mov.w &0x0014,ICCR(%a6)
- mov.w &0x0010,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cas2.l %d1:%d2,%d3:%d4,(%a0):(%a1) # Dc1:Dc2,Du1:Du2,(Rn1):(Rn2)
-
- mov.w %cc,SCCR(%a6)
- mov.l (%a0),%d5
- mov.l (%a1),%d6
- mov.l &0xcccccccc,IREGS+0x14(%a6)
- mov.l &0xdddddddd,IREGS+0x18(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cas21:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA+0x1(%a6),%a0
- lea DATA+0x5(%a6),%a1
-
- mov.l &0xaaaaaaaa,(%a0)
- mov.l &0xbbbbbbbb,(%a1)
-
- mov.l &0xaaaaaaaa,%d1
- mov.l &0xbbbbbbbb,%d2
- mov.l &0xcccccccc,%d3
- mov.l &0xdddddddd,%d4
-
- mov.w &0x0014,ICCR(%a6)
- mov.w &0x0010,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cas2.l %d1:%d2,%d3:%d4,(%a0):(%a1) # Dc1:Dc2,Du1:Du2,(Rn1):(Rn2)
-
- mov.w %cc,SCCR(%a6)
- mov.l (%a0),%d5
- mov.l (%a1),%d6
- mov.l &0xcccccccc,IREGS+0x14(%a6)
- mov.l &0xdddddddd,IREGS+0x18(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cas22:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA+0x2(%a6),%a0
- lea DATA+0x6(%a6),%a1
-
- mov.l &0xaaaaaaaa,(%a0)
- mov.l &0xbbbbbbbb,(%a1)
-
- mov.l &0xaaaaaaaa,%d1
- mov.l &0xbbbbbbbb,%d2
- mov.l &0xcccccccc,%d3
- mov.l &0xdddddddd,%d4
-
- mov.w &0x0014,ICCR(%a6)
- mov.w &0x0010,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cas2.l %d1:%d2,%d3:%d4,(%a0):(%a1) # Dc1:Dc2,Du1:Du2,(Rn1):(Rn2)
-
- mov.w %cc,SCCR(%a6)
- mov.l (%a0),%d5
- mov.l (%a1),%d6
- mov.l &0xcccccccc,IREGS+0x14(%a6)
- mov.l &0xdddddddd,IREGS+0x18(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cas23:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA+0x0(%a6),%a0
- lea DATA+0x4(%a6),%a1
-
- mov.l &0xeeeeeeee,(%a0)
- mov.l &0xbbbbbbbb,(%a1)
-
- mov.l &0xaaaaaaaa,%d1
- mov.l &0xbbbbbbbb,%d2
- mov.l &0xcccccccc,%d3
- mov.l &0xdddddddd,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cas2.l %d1:%d2,%d3:%d4,(%a0):(%a1) # Dc1:Dc2,Du1:Du2,(Rn1):(Rn2)
-
- mov.w %cc,SCCR(%a6)
- mov.l (%a0),%d5
- mov.l (%a1),%d6
- mov.l &0xeeeeeeee,IREGS+0x4(%a6)
- mov.l &0xbbbbbbbb,IREGS+0x8(%a6)
- mov.l &0xeeeeeeee,IREGS+0x14(%a6)
- mov.l &0xbbbbbbbb,IREGS+0x18(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cas24:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA+0x1(%a6),%a0
- lea DATA+0x5(%a6),%a1
-
- mov.l &0xeeeeeeee,(%a0)
- mov.l &0xbbbbbbbb,(%a1)
-
- mov.l &0xaaaaaaaa,%d1
- mov.l &0xbbbbbbbb,%d2
- mov.l &0xcccccccc,%d3
- mov.l &0xdddddddd,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cas2.l %d1:%d2,%d3:%d4,(%a0):(%a1) # Dc1:Dc2,Du1:Du2,(Rn1):(Rn2)
-
- mov.w %cc,SCCR(%a6)
- mov.l (%a0),%d5
- mov.l (%a1),%d6
- mov.l &0xeeeeeeee,IREGS+0x4(%a6)
- mov.l &0xbbbbbbbb,IREGS+0x8(%a6)
- mov.l &0xeeeeeeee,IREGS+0x14(%a6)
- mov.l &0xbbbbbbbb,IREGS+0x18(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cas25:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA+0x2(%a6),%a0
- lea DATA+0x6(%a6),%a1
-
- mov.l &0xeeeeeeee,(%a0)
- mov.l &0xbbbbbbbb,(%a1)
-
- mov.l &0xaaaaaaaa,%d1
- mov.l &0xbbbbbbbb,%d2
- mov.l &0xcccccccc,%d3
- mov.l &0xdddddddd,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cas2.l %d1:%d2,%d3:%d4,(%a0):(%a1) # Dc1:Dc2,Du1:Du2,(Rn1):(Rn2)
-
- mov.w %cc,SCCR(%a6)
- mov.l (%a0),%d5
- mov.l (%a1),%d6
- mov.l &0xeeeeeeee,IREGS+0x4(%a6)
- mov.l &0xbbbbbbbb,IREGS+0x8(%a6)
- mov.l &0xeeeeeeee,IREGS+0x14(%a6)
- mov.l &0xbbbbbbbb,IREGS+0x18(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cas26:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA+0x0(%a6),%a0
- lea DATA+0x4(%a6),%a1
-
- mov.l &0xaaaaaaaa,(%a0)
- mov.l &0xeeeeeeee,(%a1)
-
- mov.l &0xaaaaaaaa,%d1
- mov.l &0xbbbbbbbb,%d2
- mov.l &0xcccccccc,%d3
- mov.l &0xdddddddd,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cas2.l %d1:%d2,%d3:%d4,(%a0):(%a1) # Dc1:Dc2,Du1:Du2,(Rn1):(Rn2)
-
- mov.w %cc,SCCR(%a6)
- mov.l (%a0),%d5
- mov.l (%a1),%d6
- mov.l &0xaaaaaaaa,IREGS+0x4(%a6)
- mov.l &0xeeeeeeee,IREGS+0x8(%a6)
- mov.l &0xaaaaaaaa,IREGS+0x14(%a6)
- mov.l &0xeeeeeeee,IREGS+0x18(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cas27:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA+0x1(%a6),%a0
- lea DATA+0x5(%a6),%a1
-
- mov.l &0xaaaaaaaa,(%a0)
- mov.l &0xeeeeeeee,(%a1)
-
- mov.l &0xaaaaaaaa,%d1
- mov.l &0xbbbbbbbb,%d2
- mov.l &0xcccccccc,%d3
- mov.l &0xdddddddd,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cas2.l %d1:%d2,%d3:%d4,(%a0):(%a1) # Dc1:Dc2,Du1:Du2,(Rn1):(Rn2)
-
- mov.w %cc,SCCR(%a6)
- mov.l (%a0),%d5
- mov.l (%a1),%d6
- mov.l &0xaaaaaaaa,IREGS+0x4(%a6)
- mov.l &0xeeeeeeee,IREGS+0x8(%a6)
- mov.l &0xaaaaaaaa,IREGS+0x14(%a6)
- mov.l &0xeeeeeeee,IREGS+0x18(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cas28:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA+0x2(%a6),%a0
- lea DATA+0x6(%a6),%a1
-
- mov.l &0xaaaaaaaa,(%a0)
- mov.l &0x7fffffff,(%a1)
-
- mov.l &0xaaaaaaaa,%d1
- mov.l &0x80000000,%d2
- mov.l &0xcccccccc,%d3
- mov.l &0xdddddddd,%d4
-
- mov.w &0x000b,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cas2.l %d1:%d2,%d3:%d4,(%a0):(%a1) # Dc1:Dc2,Du1:Du2,(Rn1):(Rn2)
-
- mov.w %cc,SCCR(%a6)
- mov.l (%a0),%d5
- mov.l (%a1),%d6
- mov.l &0xaaaaaaaa,IREGS+0x4(%a6)
- mov.l &0x7fffffff,IREGS+0x8(%a6)
- mov.l &0xaaaaaaaa,IREGS+0x14(%a6)
- mov.l &0x7fffffff,IREGS+0x18(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-##################################
-cas29:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA+0x0(%a6),%a0
- lea DATA+0x4(%a6),%a1
-
- mov.w &0xaaaa,(%a0)
- mov.w &0xbbbb,(%a1)
-
- mov.w &0xaaaa,%d1
- mov.w &0xbbbb,%d2
- mov.w &0xcccc,%d3
- mov.w &0xdddd,%d4
-
- mov.w &0x0014,ICCR(%a6)
- mov.w &0x0010,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cas2.w %d1:%d2,%d3:%d4,(%a0):(%a1) # Dc1:Dc2,Du1:Du2,(Rn1):(Rn2)
-
- mov.w %cc,SCCR(%a6)
- mov.w (%a0),%d5
- mov.w (%a1),%d6
- mov.w &0xcccc,IREGS+0x14+0x2(%a6)
- mov.w &0xdddd,IREGS+0x18+0x2(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cas210:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA+0x1(%a6),%a0
- lea DATA+0x5(%a6),%a1
-
- mov.w &0xaaaa,(%a0)
- mov.w &0xbbbb,(%a1)
-
- mov.w &0xaaaa,%d1
- mov.w &0xbbbb,%d2
- mov.w &0xcccc,%d3
- mov.w &0xdddd,%d4
-
- mov.w &0x0004,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cas2.w %d1:%d2,%d3:%d4,(%a0):(%a1) # Dc1:Dc2,Du1:Du2,(Rn1):(Rn2)
-
- mov.w %cc,SCCR(%a6)
- mov.w (%a0),%d5
- mov.w (%a1),%d6
- mov.w &0xcccc,IREGS+0x14+0x2(%a6)
- mov.w &0xdddd,IREGS+0x18+0x2(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cas211:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA+0x0(%a6),%a0
- lea DATA+0x4(%a6),%a1
-
- mov.w &0xeeee,(%a0)
- mov.w &0xbbbb,(%a1)
-
- mov.w &0xaaaa,%d1
- mov.w &0xbbbb,%d2
- mov.w &0xcccc,%d3
- mov.w &0xdddd,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cas2.w %d1:%d2,%d3:%d4,(%a0):(%a1) # Dc1:Dc2,Du1:Du2,(Rn1):(Rn2)
-
- mov.w %cc,SCCR(%a6)
- mov.w (%a0),%d5
- mov.w (%a1),%d6
- mov.w &0xeeee,IREGS+0x4+0x2(%a6)
- mov.w &0xbbbb,IREGS+0x8+0x2(%a6)
- mov.w &0xeeee,IREGS+0x14+0x2(%a6)
- mov.w &0xbbbb,IREGS+0x18+0x2(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cas212:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA+0x1(%a6),%a0
- lea DATA+0x5(%a6),%a1
-
- mov.w &0xeeee,(%a0)
- mov.w &0xbbbb,(%a1)
-
- mov.w &0xaaaa,%d1
- mov.w &0xbbbb,%d2
- mov.w &0xcccc,%d3
- mov.w &0xdddd,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cas2.w %d1:%d2,%d3:%d4,(%a0):(%a1) # Dc1:Dc2,Du1:Du2,(Rn1):(Rn2)
-
- mov.w %cc,SCCR(%a6)
- mov.w (%a0),%d5
- mov.w (%a1),%d6
- mov.w &0xeeee,IREGS+0x4+0x2(%a6)
- mov.w &0xbbbb,IREGS+0x8+0x2(%a6)
- mov.w &0xeeee,IREGS+0x14+0x2(%a6)
- mov.w &0xbbbb,IREGS+0x18+0x2(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cas213:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA+0x0(%a6),%a0
- lea DATA+0x4(%a6),%a1
-
- mov.w &0xaaaa,(%a0)
- mov.w &0xeeee,(%a1)
-
- mov.w &0xaaaa,%d1
- mov.w &0xbbbb,%d2
- mov.w &0xcccc,%d3
- mov.w &0xdddd,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cas2.w %d1:%d2,%d3:%d4,(%a0):(%a1) # Dc1:Dc2,Du1:Du2,(Rn1):(Rn2)
-
- mov.w %cc,SCCR(%a6)
- mov.w (%a0),%d5
- mov.w (%a1),%d6
- mov.w &0xaaaa,IREGS+0x4+0x2(%a6)
- mov.w &0xeeee,IREGS+0x8+0x2(%a6)
- mov.w &0xaaaa,IREGS+0x14+0x2(%a6)
- mov.w &0xeeee,IREGS+0x18+0x2(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cas214:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- lea DATA+0x1(%a6),%a0
- lea DATA+0x5(%a6),%a1
-
- mov.w &0xaaaa,(%a0)
- mov.w &0x7fff,(%a1)
-
- mov.w &0xaaaa,%d1
- mov.w &0x8000,%d2
- mov.w &0xcccc,%d3
- mov.w &0xdddd,%d4
-
- mov.w &0x001b,ICCR(%a6)
- mov.w &0x0010,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cas2.w %d1:%d2,%d3:%d4,(%a0):(%a1) # Dc1:Dc2,Du1:Du2,(Rn1):(Rn2)
-
- mov.w %cc,SCCR(%a6)
- mov.w (%a0),%d5
- mov.w (%a1),%d6
- mov.w &0xaaaa,IREGS+0x4+0x2(%a6)
- mov.w &0x7fff,IREGS+0x8+0x2(%a6)
- mov.w &0xaaaa,IREGS+0x14+0x2(%a6)
- mov.w &0x7fff,IREGS+0x18+0x2(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- mov.l TESTCTR(%a6),%d1
- clr.l %d0
- rts
-
-###########################################################
-
-cmp2_str:
- string "\tcmp2,chk2..."
-
- align 0x4
-# unsigned - small,small
-cmp2_1:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.w &0x2040,DATA(%a6)
- mov.l &0x11111120,%d1
-
- mov.w &0x0004,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cmp2.b %d1,DATA(%a6)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cmp2_2:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.w &0x2040,DATA(%a6)
- mov.l &0x00000040,%a1
-
- mov.w &0x0004,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cmp2.b %a1,DATA(%a6)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cmp2_3:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.w &0x2040,DATA(%a6)
- mov.l &0x11111130,%d1
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- chk2.b DATA(%a6),%d1
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cmp2_4:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.w &0x2040,DATA(%a6)
- mov.l &0x00000010,%a1
-
- mov.w &0x0001,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cmp2.b %a1,DATA(%a6)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cmp2_5:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.w &0x2040,DATA(%a6)
- mov.l &0x11111150,%d1
-
- mov.w &0x0001,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cmp2.b %d1,DATA(%a6)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cmp2_6:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.w &0x2040,DATA(%a6)
- mov.l &0x00000090,%a1
-
- mov.w &0x0001,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cmp2.b %a1,DATA(%a6)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-# unsigned - small,large
-cmp2_7:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0x2000a000,DATA(%a6)
- mov.l &0x11112000,%d1
-
- mov.w &0x0004,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cmp2.w %d1,DATA(%a6)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cmp2_8:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0x2000a000,DATA(%a6)
- mov.l &0xffffa000,%a1
-
- mov.w &0x0004,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cmp2.w %a1,DATA(%a6)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cmp2_9:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0x2000a000,DATA(%a6)
- mov.l &0x11113000,%d1
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- chk2.w DATA(%a6),%d1
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cmp2_10:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0x2000a000,DATA(%a6)
- mov.l &0xffff9000,%a1
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cmp2.w %a1,DATA(%a6)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cmp2_11:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0x2000a000,DATA(%a6)
- mov.l &0x11111000,%d1
-
- mov.w &0x0001,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cmp2.w %d1,DATA(%a6)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cmp2_12:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0x2000a000,DATA(%a6)
- mov.l &0xffffb000,%a1
-
- mov.w &0x0001,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cmp2.w %a1,DATA(%a6)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-# unsigned - large,large
-cmp2_13:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0xa0000000,DATA(%a6)
- mov.l &0xc0000000,DATA+0x4(%a6)
- mov.l &0xa0000000,%d1
-
- mov.w &0x000c,ICCR(%a6)
- mov.w &0x0008,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cmp2.l %d1,DATA(%a6)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cmp2_14:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0xa0000000,DATA(%a6)
- mov.l &0xc0000000,DATA+0x4(%a6)
- mov.l &0xc0000000,%a1
-
- mov.w &0x000c,ICCR(%a6)
- mov.w &0x0008,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cmp2.l %a1,DATA(%a6)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cmp2_15:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0xa0000000,DATA(%a6)
- mov.l &0xc0000000,DATA+0x4(%a6)
- mov.l &0xb0000000,%d1
-
- mov.w &0x0008,ICCR(%a6)
- mov.w &0x0008,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- chk2.l DATA(%a6),%d1
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cmp2_16:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0xa0000000,DATA(%a6)
- mov.l &0xc0000000,DATA+0x4(%a6)
- mov.l &0x10000000,%a1
-
- mov.w &0x0009,ICCR(%a6)
- mov.w &0x0008,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cmp2.l %a1,DATA(%a6)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cmp2_17:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0xa0000000,DATA(%a6)
- mov.l &0xc0000000,DATA+0x4(%a6)
- mov.l &0x90000000,%d1
-
- mov.w &0x0009,ICCR(%a6)
- mov.w &0x0008,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cmp2.l %d1,DATA(%a6)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cmp2_18:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l &0xa0000000,DATA(%a6)
- mov.l &0xc0000000,DATA+0x4(%a6)
- mov.l &0xd0000000,%a1
-
- mov.w &0x0009,ICCR(%a6)
- mov.w &0x0008,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cmp2.l %a1,DATA(%a6)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-# signed - negative,positive
-cmp2_19:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.w &0xa040,DATA(%a6)
- mov.l &0x111111a0,%d1
-
- mov.w &0x0004,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cmp2.b %d1,DATA(%a6)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cmp2_20:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.w &0xa040,DATA(%a6)
- mov.l &0x00000040,%a1
-
- mov.w &0x0004,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- chk2.b DATA(%a6),%a1
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cmp2_21:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.w &0xa040,DATA(%a6)
- mov.l &0x111111b0,%d1
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cmp2.b %d1,DATA(%a6)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cmp2_22:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.w &0xa040,DATA(%a6)
- mov.l &0x00000010,%a1
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cmp2.b %a1,DATA(%a6)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cmp2_23:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.w &0xa040,DATA(%a6)
- mov.l &0x11111190,%d1
-
- mov.w &0x0001,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cmp2.b %d1,DATA(%a6)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cmp2_24:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.w &0xa040,DATA(%a6)
- mov.l &0x00000050,%a1
-
- mov.w &0x0001,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cmp2.b %a1,DATA(%a6)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-# signed - negative,negative
-cmp2_25:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.w &0xa0c0,DATA(%a6)
- mov.l &0x111111a0,%d1
-
- mov.w &0x0004,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cmp2.b %d1,DATA(%a6)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cmp2_26:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.w &0xa0c0,DATA(%a6)
- mov.l &0xffffffc0,%a1
-
- mov.w &0x0004,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cmp2.b %a1,DATA(%a6)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cmp2_27:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.w &0xa0c0,DATA(%a6)
- mov.l &0x111111b0,%d1
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- chk2.b DATA(%a6),%d1
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cmp2_28:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.w &0xa0c0,DATA(%a6)
- mov.l &0x11111190,%a1
-
- mov.w &0x0001,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cmp2.b %a1,DATA(%a6)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cmp2_29:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.w &0xa0c0,DATA(%a6)
- mov.l &0x111111d0,%d1
-
- mov.w &0x0001,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cmp2.b %d1,DATA(%a6)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-cmp2_30:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.w &0xa0c0,DATA(%a6)
- mov.l &0x00000050,%a1
-
- mov.w &0x001b,ICCR(%a6)
- mov.w &0x001f,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- cmp2.b %a1,DATA(%a6)
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- mov.l TESTCTR(%a6),%d1
- clr.l %d0
- rts
-
-###########################################################
-
-ea_str:
- string "\tEffective addresses..."
-
- align 0x4
-ea_0:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a0
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (%a0),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_1:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a0
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (%a0)+,%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
- lea EAMEM+0x4(%a6),%a0
- mov.l %a0,IREGS+0x20(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_2:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM+0x4(%a6),%a0
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l -(%a0),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
- lea EAMEM(%a6),%a0
- mov.l %a0,IREGS+0x20(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_3:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM+0x1000(%a6),%a0
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (-0x1000,%a0),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_4:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%a6),%a0
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x1000,%a0),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_5:
- addq.l &0x1,TESTCTR(%a6)
-
-# movm.l DEF_REGS(%pc),&0x3fff
-
-# clr.l %d2
-# mov.l &0x00000002,%d3
-
-# mov.w &0x0000,ICCR(%a6)
-# mov.w &0x0000,%cc
-# movm.l &0xffff,IREGS(%a6)
-
-# mulu.l EAMEM.w,%d2:%d3
-
-# mov.w %cc,SCCR(%a6)
-# movm.l &0xffff,SREGS(%a6)
-# mov.l &0x00000004,IREGS+0xc(%a6)
-
-# bsr.l chkregs
-# tst.b %d0
-# bne.l error
-
-ea_6:
- addq.l &0x1,TESTCTR(%a6)
-
-# movm.l DEF_REGS(%pc),&0x3fff
-
-# clr.l %d2
-# mov.l &0x00000002,%d3
-
-# mov.w &0x0000,ICCR(%a6)
-# mov.w &0x0000,%cc
-# movm.l &0xffff,IREGS(%a6)
-
-# mulu.l EAMEM.l,%d2:%d3
-
-# mov.w %cc,SCCR(%a6)
-# movm.l &0xffff,SREGS(%a6)
-# mov.l &0x00000004,IREGS+0xc(%a6)
-
-# bsr.l chkregs
-# tst.b %d0
-# bne.l error
-
-ea_7:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l &0x00000002,%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_8:
- addq.l &0x1,TESTCTR(%a6)
-
- bra.b ea_8_next
-ea_8_mem:
- long 0x00000002
-ea_8_next:
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (ea_8_mem.w,%pc),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_9:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM+0x4(%a6),%a1
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l -(%a1),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
- lea EAMEM(%a6),%a0
- mov.l %a0,IREGS+0x24(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_10:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM+0x4(%a6),%a2
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l -(%a2),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
- lea EAMEM(%a6),%a0
- mov.l %a0,IREGS+0x28(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_11:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM+0x4(%a6),%a3
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l -(%a3),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
- lea EAMEM(%a6),%a0
- mov.l %a0,IREGS+0x2c(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_12:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM+0x4(%a6),%a4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l -(%a4),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
- lea EAMEM(%a6),%a0
- mov.l %a0,IREGS+0x30(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_13:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM+0x4(%a6),%a5
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l -(%a5),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
- lea EAMEM(%a6),%a0
- mov.l %a0,IREGS+0x34(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_14:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l %a6,%a1
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM+0x4(%a1),%a6
-
- mov.w &0x0000,ICCR(%a1)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a1)
-
- mulu.l -(%a6),%d2:%d3
-
- mov.w %cc,SCCR(%a1)
- movm.l &0xffff,SREGS(%a1)
- mov.l &0x00000004,IREGS+0xc(%a1)
- lea EAMEM(%a1),%a0
- mov.l %a0,IREGS+0x38(%a1)
-
- mov.l %a1,%a6
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_15:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
- clr.l %d2
- mov.l &0x00000002,%d3
- mov.l %a7,%a0
- lea EAMEM+0x4(%a6),%a7
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l -(%a7),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
- lea EAMEM(%a6),%a1
- mov.l %a1,IREGS+0x3c(%a6)
-
- mov.l %a0,%a7
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_16:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a0
- mov.l &-0x10,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x10.b,%a0,%d4.w*1),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_17:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a0
- mov.l &-0x8,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x10.b,%a0,%d4.w*2),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_18:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a0
- mov.l &-0x4,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x10.b,%a0,%d4.w*4),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_19:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a0
- mov.l &-0x2,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x10.b,%a0,%d4.w*8),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_20:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a0
- mov.l &-0x10,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x10.b,%a0,%d4.l*1),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_21:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a0
- mov.l &-0x8,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x10.b,%a0,%d4.l*2),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_22:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a0
- mov.l &-0x4,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x10.b,%a0,%d4.l*4),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_23:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a0
- mov.l &-0x2,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x10.b,%a0,%d4.l*8),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_24:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a0
- mov.l &-0x2,%a4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x10.b,%a0,%a4.l*8),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_25:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a0
- mov.l &0x2,%a4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (-0x10.b,%a0,%a4.l*8),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_26:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a1
- mov.l &-0x10,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x10.b,%a1,%d4.w*1),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_27:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a2
- mov.l &-0x10,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x10.b,%a2,%d4.w*1),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_28:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a3
- mov.l &-0x10,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x10.b,%a3,%d4.w*1),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_29:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a4
- mov.l &-0x10,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x10.b,%a4,%d4.w*1),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_30:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a5
- mov.l &-0x10,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x10.b,%a5,%d4.w*1),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_31:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l %a6,%a1
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a1),%a6
- mov.l &-0x10,%d4
-
- mov.w &0x0000,ICCR(%a1)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a1)
-
- mulu.l (0x10.b,%a6,%d4.w*1),%d2:%d3
-
- mov.w %cc,SCCR(%a1)
- movm.l &0xffff,SREGS(%a1)
- mov.l &0x00000004,IREGS+0xc(%a1)
-
- mov.l %a1,%a6
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_32:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- mov.l %a7,%a0
- lea EAMEM(%a6),%a7
- mov.l &-0x10,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x10.b,%a7,%d4.w*1),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- mov.l %a0,%a7
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_33:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a1
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (%a1),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_34:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a2
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (%a2),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_35:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a3
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (%a3),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_36:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (%a4),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_37:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a5
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (%a5),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_38:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l %a6,%a1
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a1),%a6
-
- mov.w &0x0000,ICCR(%a1)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a1)
-
- mulu.l (%a6),%d2:%d3
-
- mov.w %cc,SCCR(%a1)
- movm.l &0xffff,SREGS(%a1)
- mov.l &0x00000004,IREGS+0xc(%a1)
-
- mov.l %a1,%a6
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_39:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- mov.l %a7,%a0
- lea EAMEM(%a6),%a7
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (%a7),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- mov.l %a0,%a7
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_40:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a1
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (%a1)+,%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
- lea EAMEM+0x4(%a6),%a0
- mov.l %a0,IREGS+0x24(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_41:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a2
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (%a2)+,%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
- lea EAMEM+0x4(%a6),%a0
- mov.l %a0,IREGS+0x28(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_42:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a3
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (%a3)+,%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
- lea EAMEM+0x4(%a6),%a0
- mov.l %a0,IREGS+0x2c(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_43:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (%a4)+,%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
- lea EAMEM+0x4(%a6),%a0
- mov.l %a0,IREGS+0x30(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_44:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a5
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (%a5)+,%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
- lea EAMEM+0x4(%a6),%a0
- mov.l %a0,IREGS+0x34(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_45:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l %a6,%a1
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a1),%a6
-
- mov.w &0x0000,ICCR(%a1)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a1)
-
- mulu.l (%a6)+,%d2:%d3
-
- mov.w %cc,SCCR(%a1)
- movm.l &0xffff,SREGS(%a1)
- mov.l &0x00000004,IREGS+0xc(%a1)
- lea EAMEM+0x4(%a1),%a0
- mov.l %a0,IREGS+0x38(%a1)
-
- mov.l %a1,%a6
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_46:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- mov.l %a7,%a0
- lea EAMEM(%a6),%a7
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (%a7)+,%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
- lea EAMEM+0x4(%a6),%a1
- mov.l %a1,IREGS+0x3c(%a6)
-
- mov.l %a0,%a7
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_47:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%a6),%a1
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x1000,%a1),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_48:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%a6),%a2
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x1000,%a2),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_49:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%a6),%a3
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x1000,%a3),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_50:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%a6),%a4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x1000,%a4),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_51:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%a6),%a5
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x1000,%a5),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_52:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l %a6,%a1
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%a1),%a6
-
- mov.w &0x0000,ICCR(%a1)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a1)
-
- mulu.l (0x1000,%a6),%d2:%d3
-
- mov.w %cc,SCCR(%a1)
- movm.l &0xffff,SREGS(%a1)
- mov.l &0x00000004,IREGS+0xc(%a1)
-
- mov.l %a1,%a6
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_53:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- mov.l %a7,%a0
- lea EAMEM-0x1000(%a6),%a7
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x1000,%a7),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- mov.l %a0,%a7
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_54:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM+0x1000(%a6),%a0
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (-0x1000,%a0),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_55:
- addq.l &0x1,TESTCTR(%a6)
-
- bra.b ea_55_next
-
-ea_55_data:
- long 0x00000002
-ea_55_next:
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (ea_55_data.w,%pc),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_56:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a3
- mov.l &-0x10,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x10.w,%a3,%d4.w*1),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_57:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a3
- mov.l &-0x8,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x10.w,%a3,%d4.w*2),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_58:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a3
- mov.l &-0x4,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x10.w,%a3,%d4.w*4),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_59:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a3
- mov.l &-0x2,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x10.w,%a3,%d4.w*8),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_60:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a3
- mov.l &-0x10,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x10.w,%a3,%d4.l*1),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_61:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a3
- mov.l &-0x8,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x10.w,%a3,%d4.l*2),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_62:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a3
- mov.l &-0x4,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x10.w,%a3,%d4.l*4),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_63:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a3
- mov.l &-0x2,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x10.w,%a3,%d4.l*8),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_64:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a3
- mov.l &0x2,%a4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (-0x10.w,%a3,%a4.l*8),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_65:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a3
- mov.l &0x2,%a4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (0x00.w,%a3,%za4.l*8),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_66:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a3
- mov.l %a3,%a4
- add.l &0x10,%a4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (-0x10.w,%za3,%a4.l*1),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_67:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a3
- mov.l &0x2,%a4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (-0x10.l,%a3,%a4.l*8),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_68:
- addq.l &0x1,TESTCTR(%a6)
-
- bra.b ea_68_next
-ea_68_mem:
- long 0x00000002
-ea_68_next:
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a3
- mov.l &-0x10,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (ea_68_mem+0x10.w,%pc,%d4.w*1),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_69:
- addq.l &0x1,TESTCTR(%a6)
-
- bra.b ea_69_next
-ea_69_mem:
- long 0x00000002
-ea_69_next:
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a0
- mov.l &-0x8,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- mulu.l (ea_69_mem+0x10.w,%pc,%d4.w*2),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_70:
- addq.l &0x1,TESTCTR(%a6)
-
- bra.b ea_70_next
-ea_70_mem:
- long 0x00000002
-ea_70_next:
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a0
- mov.l &-0x4,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- mulu.l (ea_70_mem+0x10.w,%pc,%d4.w*4),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_71:
- addq.l &0x1,TESTCTR(%a6)
-
- bra.b ea_71_next
-ea_71_mem:
- long 0x00000002
-ea_71_next:
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a0
- mov.l &-0x2,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- mulu.l (ea_71_mem+0x10.w,%pc,%d4.w*8),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_72:
- addq.l &0x1,TESTCTR(%a6)
-
- bra.b ea_72_next
-ea_72_mem:
- long 0x00000002
-ea_72_next:
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a0
- mov.l &-0x10,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- mulu.l (ea_72_mem+0x10.w,%pc,%d4.l*1),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_73:
- addq.l &0x1,TESTCTR(%a6)
-
- bra.b ea_73_next
-ea_73_mem:
- long 0x00000002
-ea_73_next:
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a0
- mov.l &-0x8,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- mulu.l (ea_73_mem+0x10.w,%pc,%d4.l*2),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_74:
- addq.l &0x1,TESTCTR(%a6)
-
- bra.b ea_74_next
-ea_74_mem:
- long 0x00000002
-ea_74_next:
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a0
- mov.l &-0x4,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- mulu.l (ea_74_mem+0x10.w,%pc,%d4.l*4),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_75:
- addq.l &0x1,TESTCTR(%a6)
-
- bra.b ea_75_next
-ea_75_mem:
- long 0x00000002
-ea_75_next:
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a0
- mov.l &-0x2,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0x7fff,IREGS(%a6)
-
- mulu.l (ea_75_mem+0x10.w,%pc,%d4.l*8),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0x7fff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_76:
- addq.l &0x1,TESTCTR(%a6)
-
- bra.b ea_76_next
-ea_76_mem:
- long 0x00000002
-ea_76_next:
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a3
- mov.l &-0x2,%a4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (ea_76_mem+0x10.w,%pc,%a4.l*8),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_77:
- addq.l &0x1,TESTCTR(%a6)
-
- bra.b ea_77_next
-ea_77_mem:
- long 0x00000002
-ea_77_next:
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a3
- mov.l &0x2,%a4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (ea_77_mem+0x00.w,%pc,%za4.l*8),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_78:
- addq.l &0x1,TESTCTR(%a6)
-
-# movm.l DEF_REGS(%pc),&0x3fff
-
-# clr.l %d2
-# mov.l &0x00000002,%d3
-# lea EAMEM,%a3
-# mov.l %a3,%a4
-# add.l &0x10,%a4
-
-# mov.w &0x0000,ICCR(%a6)
-# mov.w &0x0000,%cc
-# movm.l &0xffff,IREGS(%a6)
-
-# mulu.l (EAMEM-0x10.w,%zpc,%a4.l*1),%d2:%d3
-
-# mov.w %cc,SCCR(%a6)
-# movm.l &0xffff,SREGS(%a6)
-# mov.l &0x00000004,IREGS+0xc(%a6)
-
-# bsr.l chkregs
-# tst.b %d0
-# bne.l error
-
-ea_79:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM,%a3
- mov.l &0x2,%a4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (ea_79_mem-0x10.l,%pc,%a4.l*8),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bra.b ea_79_next
-ea_79_mem:
- long 0x00000002
-ea_79_next:
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_80:
- addq.l &0x1,TESTCTR(%a6)
-
- bra.b ea_80_next
-ea_80_mem:
- long 0x00000002
-ea_80_next:
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a1
- mov.l &-0x10,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (ea_80_mem+0x10.b,%pc,%d4.w*1),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_81:
- addq.l &0x1,TESTCTR(%a6)
-
- bra.b ea_81_next
-ea_81_mem:
- long 0x00000002
-ea_81_next:
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a0
- mov.l &-0x8,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (ea_81_mem+0x10.b,%pc,%d4.w*2),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_82:
- addq.l &0x1,TESTCTR(%a6)
-
- bra.b ea_82_next
-ea_82_mem:
- long 0x00000002
-ea_82_next:
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a0
- mov.l &-0x4,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (ea_82_mem+0x10.b,%pc,%d4.w*4),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_83:
- addq.l &0x1,TESTCTR(%a6)
-
- bra.b ea_83_next
-ea_83_mem:
- long 0x00000002
-ea_83_next:
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a0
- mov.l &-0x2,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (ea_83_mem+0x10.b,%pc,%d4.w*8),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_84:
- addq.l &0x1,TESTCTR(%a6)
-
- bra.b ea_84_next
-ea_84_mem:
- long 0x00000002
-ea_84_next:
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a0
- mov.l &-0x10,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (ea_84_mem+0x10.b,%pc,%d4.l*1),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_85:
- addq.l &0x1,TESTCTR(%a6)
-
- bra.b ea_85_next
-ea_85_mem:
- long 0x00000002
-ea_85_next:
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a0
- mov.l &-0x8,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (ea_85_mem+0x10.b,%pc,%d4.l*2),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_86:
- addq.l &0x1,TESTCTR(%a6)
-
- bra.b ea_86_next
-ea_86_mem:
- long 0x00000002
-ea_86_next:
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a0
- mov.l &-0x4,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (ea_86_mem+0x10.b,%pc,%d4.l*4),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_87:
- addq.l &0x1,TESTCTR(%a6)
-
- bra.b ea_87_next
-ea_87_mem:
- long 0x00000002
-ea_87_next:
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a0
- mov.l &-0x2,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (ea_87_mem+0x10.b,%pc,%d4.l*8),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_88:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a6),%a0
- mov.l &-0x2,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l (ea_88_mem+0x10.b,%pc,%d4.l*8),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bra.b ea_88_next
-ea_88_mem:
- long 0x00000002
-ea_88_next:
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_89:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%a6),%a3
- lea EASTORE(%a6),%a4
- mov.l %a3,(%a4)
- mov.l &-0x10,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([0x10.w,%a4,%d4.w*1],0x1000.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_90:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%a6),%a3
- lea EASTORE(%a6),%a4
- mov.l %a3,(%a4)
- mov.l &-0x8,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([0x10.w,%a4,%d4.w*2],0x1000.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_91:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%a6),%a3
- lea EASTORE(%a6),%a4
- mov.l %a3,(%a4)
- mov.l &-0x4,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([0x10.w,%a4,%d4.w*4],0x1000.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_92:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%a6),%a3
- lea EASTORE(%a6),%a4
- mov.l %a3,(%a4)
- mov.l &-0x2,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([0x10.w,%a4,%d4.w*8],0x1000.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_93:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%a6),%a3
- lea EASTORE(%a6),%a4
- mov.l %a3,(%a4)
- mov.l &-0x10,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([0x10.w,%a4,%d4.l*1],0x1000.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_94:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%a6),%a3
- lea EASTORE(%a6),%a4
- mov.l %a3,(%a4)
- mov.l &-0x8,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([0x10.w,%a4,%d4.l*2],0x1000.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_95:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%a6),%a3
- lea EASTORE(%a6),%a4
- mov.l %a3,(%a4)
- mov.l &-0x4,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([0x10.w,%a4,%d4.l*4],0x1000.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_96:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%a6),%a3
- lea EASTORE(%a6),%a4
- mov.l %a3,(%a4)
- mov.l &-0x2,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([0x10.w,%a4,%d4.l*8],0x1000.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_97:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%a6),%a3
- lea EASTORE(%a6),%a4
- mov.l %a3,(%a4)
- mov.l &-0x2,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([0x10.l,%a4,%d4.l*8],0x1000.l),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_98:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%a6),%a3
- lea EASTORE(%a6),%a4
- mov.l %a3,(%a4)
- mov.l &-0x2,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([0x00.l,%a4,%zd4.l*8],0x1000.l),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_99:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%a6),%a3
- lea EASTORE(%a6),%a4
- mov.l %a3,(%a4)
- mov.l &-0x2,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([%a4,%zd4.l*8],0x1000.l),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_100:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%a6),%a3
- lea EASTORE(%a6),%a4
- mov.l %a3,(%a4)
- mov.l &-0x10,%d4
- add.l %a4,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([0x10.l,%za4,%d4.l*1],0x1000.l),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_101:
- addq.l &0x1,TESTCTR(%a6)
-
-# movm.l DEF_REGS(%pc),&0x3fff
-
-# clr.l %d2
-# mov.l &0x00000002,%d3
-# lea EAMEM(%a6),%a3
-# lea EASTORE(%a6),%a4
-# mov.l %a3,(%a4)
-# mov.l &-0x10,%d4
-
-# mov.w &0x0000,ICCR(%a6)
-# mov.w &0x0000,%cc
-# movm.l &0xffff,IREGS(%a6)
-
-# mulu.l ([EASTORE.l,%za4,%zd4.l*1]),%d2:%d3
-
-# mov.w %cc,SCCR(%a6)
-# movm.l &0xffff,SREGS(%a6)
-# mov.l &0x00000004,IREGS+0xc(%a6)
-
-# bsr.l chkregs
-# tst.b %d0
-# bne.l error
-
-ea_102:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l %a6,%a1
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM+0x1000(%a1),%a3
- lea EASTORE(%a1),%a4
- mov.l %a3,(%a4)
- mov.l &-0x2,%a6
-
- mov.w &0x0000,ICCR(%a1)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a1)
-
- mulu.l ([0x10.w,%a4,%a6.l*8],-0x1000.w),%d2:%d3
-
- mov.w %cc,SCCR(%a1)
- movm.l &0xffff,SREGS(%a1)
- mov.l &0x00000004,IREGS+0xc(%a1)
-
- mov.l %a1,%a6
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_103:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l %a6,%a1
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM+0x1000(%a1),%a3
- lea EASTORE(%a1),%a4
- mov.l %a3,(%a4)
- mov.l &0x2,%a6
-
- mov.w &0x0000,ICCR(%a1)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a1)
-
- mulu.l ([-0x10.w,%a4,%a6.l*8],-0x1000.w),%d2:%d3
-
- mov.w %cc,SCCR(%a1)
- movm.l &0xffff,SREGS(%a1)
- mov.l &0x00000004,IREGS+0xc(%a1)
-
- mov.l %a1,%a6
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_104:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x20(%a6),%a3
- lea EASTORE(%a6),%a4
- mov.l %a3,(%a4)
- sub.l &0x10,%a4
- mov.l &0x10,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([0x10.w,%a4],%d4.w*1,0x10.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_105:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x20(%a6),%a3
- lea EASTORE(%a6),%a4
- mov.l %a3,(%a4)
- sub.l &0x10,%a4
- mov.l &0x8,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([0x10.w,%a4],%d4.w*2,0x10.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_106:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x20(%a6),%a3
- lea EASTORE(%a6),%a4
- mov.l %a3,(%a4)
- sub.l &0x10,%a4
- mov.l &0x4,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([0x10.w,%a4],%d4.w*4,0x10.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_107:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x20(%a6),%a3
- lea EASTORE(%a6),%a4
- mov.l %a3,(%a4)
- sub.l &0x10,%a4
- mov.l &0x2,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([0x10.w,%a4],%d4.w*8,0x10.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_108:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x20(%a6),%a3
- lea EASTORE(%a6),%a4
- mov.l %a3,(%a4)
- sub.l &0x10,%a4
- mov.l &0x10,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([0x10.w,%a4],%d4.l*1,0x10.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_109:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x20(%a6),%a3
- lea EASTORE(%a6),%a4
- mov.l %a3,(%a4)
- sub.l &0x10,%a4
- mov.l &0x8,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([0x10.w,%a4],%d4.w*2,0x10.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_110:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x20(%a6),%a3
- lea EASTORE(%a6),%a4
- mov.l %a3,(%a4)
- sub.l &0x10,%a4
- mov.l &0x4,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([0x10.w,%a4],%d4.l*4,0x10.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_111:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x20(%a6),%a3
- lea EASTORE(%a6),%a4
- mov.l %a3,(%a4)
- sub.l &0x10,%a4
- mov.l &0x2,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([0x10.w,%a4],%d4.l*8,0x10.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_112:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x20(%a6),%a3
- lea EASTORE(%a6),%a4
- mov.l %a3,(%a4)
- sub.l &0x10,%a4
- mov.l &0x2,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([0x10.l,%a4],%d4.l*8,0x10.l),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_113:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x20(%a6),%a3
- lea EASTORE(%a6),%a4
- mov.l %a3,(%a4)
- mov.l &0x2,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([0x00.l,%a4],%zd4.l*8,0x20.l),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_114:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l %a7,%a0
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x20(%a6),%a3
- lea EASTORE(%a6),%a7
- mov.l %a3,(%a7)
- mov.l &0x20,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([%a7],%d4.l*1),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- mov.l %a0,%a7
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_115:
- addq.l &0x1,TESTCTR(%a6)
-
-# movm.l DEF_REGS(%pc),&0x3fff
-
-# clr.l %d2
-# mov.l &0x00000002,%d3
-# lea EAMEM-0x20(%pc),%a3
-# lea EASTORE(%pc),%a4
-# mov.l %a3,(%a4)
-# mov.l &0x2,%d4
-
-# mov.w &0x0000,ICCR(%a6)
-# mov.w &0x0000,%cc
-# movm.l &0xffff,IREGS(%a6)
-
-# mulu.l ([EASTORE.l,%za4],%zd4.l*8,0x20.l),%d2:%d3
-
-# mov.w %cc,SCCR(%a6)
-# movm.l &0xffff,SREGS(%a6)
-# mov.l &0x00000004,IREGS+0xc(%a6)
-
-# bsr.l chkregs
-# tst.b %d0
-# bne.l error
-
-ea_116:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l %a6,%a1
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%a1),%a3
- lea EASTORE(%a1),%a6
- mov.l %a3,(%a6)
- add.l &0x10,%a6
- mov.l &-0x2,%a5
-
- mov.w &0x0000,ICCR(%a1)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a1)
-
- mulu.l ([-0x10.w,%a6],%a5.l*8,0x10.l),%d2:%d3
-
- mov.w %cc,SCCR(%a1)
- movm.l &0xffff,SREGS(%a1)
- mov.l &0x00000004,IREGS+0xc(%a1)
-
- mov.l %a1,%a6
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- mov.l TESTCTR(%a6),%d1
- clr.l %d0
- rts
-
-ea_117:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%pc),%a3
- lea EASTORE(%pc),%a4
- mov.l %a3,(%a4)
- mov.l &-0x10,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([EASTORE+0x10.w,%pc,%d4.w*1],0x1000.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_118:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%pc),%a3
- lea EASTORE(%pc),%a4
- mov.l %a3,(%a4)
- mov.l &-0x8,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([EASTORE+0x10.w,%pc,%d4.w*2],0x1000.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_119:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%pc),%a3
- lea EASTORE(%pc),%a4
- mov.l %a3,(%a4)
- mov.l &-0x4,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([EASTORE+0x10.w,%pc,%d4.w*4],0x1000.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_120:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%pc),%a3
- lea EASTORE(%pc),%a4
- mov.l %a3,(%a4)
- mov.l &-0x2,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([EASTORE+0x10.w,%pc,%d4.w*8],0x1000.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_121:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%pc),%a3
- lea EASTORE(%pc),%a4
- mov.l %a3,(%a4)
- mov.l &-0x10,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([EASTORE+0x10.w,%pc,%d4.l*1],0x1000.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_122:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%pc),%a3
- lea EASTORE(%pc),%a4
- mov.l %a3,(%a4)
- mov.l &-0x8,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([EASTORE+0x10.w,%pc,%d4.l*2],0x1000.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_123:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%pc),%a3
- lea EASTORE(%pc),%a4
- mov.l %a3,(%a4)
- mov.l &-0x4,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([EASTORE+0x10.w,%pc,%d4.l*4],0x1000.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_124:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%pc),%a3
- lea EASTORE(%pc),%a4
- mov.l %a3,(%a4)
- mov.l &-0x2,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([EASTORE+0x10.w,%pc,%d4.l*8],0x1000.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_125:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%pc),%a3
- lea EASTORE(%pc),%a4
- mov.l %a3,(%a4)
- mov.l &-0x2,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
- mulu.l ([EASTORE+0x10.l,%pc,%d4.l*8],0x1000.l),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_126:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%pc),%a3
- lea EASTORE(%pc),%a4
- mov.l %a3,(%a4)
- mov.l &-0x2,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([EASTORE+0x00.l,%pc,%zd4.l*8],0x1000.l),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_127:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%pc),%a3
- lea EASTORE(%pc),%a4
- mov.l %a3,(%a4)
- mov.l %a4,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([%zpc,%d4.l*1],0x1000.l),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_128:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x1000(%pc),%a3
- lea EASTORE(%pc),%a4
- mov.l %a3,(%a4)
- mov.l &-0x10,%d4
- add.l %a4,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([0x10.l,%zpc,%d4.l*1],0x1000.l),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_129:
- addq.l &0x1,TESTCTR(%a6)
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%pc),%a3
- lea EASTORE(%pc),%a4
- mov.l %a3,(%a4)
- mov.l &-0x10,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([EASTORE.l,%zpc,%zd4.l*1]),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_130:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM+0x1000(%pc),%a3
- lea EASTORE(%pc),%a4
- mov.l %a3,(%a4)
- mov.l &0x2,%a6
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([EASTORE-0x10.w,%pc,%a6.l*8],-0x1000.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_131:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l %a7,%a0
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM+0x1000(%pc),%a3
- lea EASTORE(%pc),%a4
- mov.l %a3,(%a4)
- mov.l &0x2,%a7
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([EASTORE-0x10.w,%pc,%a7.l*8],-0x1000.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- mov.l %a0,%a7
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_132:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x20(%pc),%a3
- lea EASTORE(%pc),%a4
- mov.l %a3,(%a4)
- sub.l &0x10,%a4
- mov.l &0x10,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([EASTORE.w,%pc],%d4.w*1,0x10.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_133:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x20(%pc),%a3
- lea EASTORE(%pc),%a4
- mov.l %a3,(%a4)
- sub.l &0x10,%a4
- mov.l &0x8,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([EASTORE.w,%pc],%d4.w*2,0x10.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_134:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x20(%pc),%a3
- lea EASTORE(%pc),%a4
- mov.l %a3,(%a4)
- sub.l &0x10,%a4
- mov.l &0x4,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([EASTORE.w,%pc],%d4.w*4,0x10.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_135:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x20(%pc),%a3
- lea EASTORE(%pc),%a4
- mov.l %a3,(%a4)
- sub.l &0x10,%a4
- mov.l &0x2,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([EASTORE.w,%pc],%d4.w*8,0x10.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_136:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x20(%pc),%a3
- lea EASTORE(%pc),%a4
- mov.l %a3,(%a4)
- sub.l &0x10,%a4
- mov.l &0x10,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([EASTORE.w,%pc],%d4.l*1,0x10.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_137:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x20(%pc),%a3
- lea EASTORE(%pc),%a4
- mov.l %a3,(%a4)
- sub.l &0x10,%a4
- mov.l &0x8,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([EASTORE.w,%pc],%d4.w*2,0x10.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_138:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x20(%pc),%a3
- lea EASTORE(%pc),%a4
- mov.l %a3,(%a4)
- sub.l &0x10,%a4
- mov.l &0x4,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([EASTORE.w,%pc],%d4.l*4,0x10.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_139:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x20(%pc),%a3
- lea EASTORE(%pc),%a4
- mov.l %a3,(%a4)
- sub.l &0x10,%a4
- mov.l &0x2,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([EASTORE.w,%pc],%d4.l*8,0x10.w),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_140:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x20(%pc),%a3
- lea EASTORE(%pc),%a4
- mov.l %a3,(%a4)
- sub.l &0x10,%a4
- mov.l &0x2,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([EASTORE.l,%pc],%d4.l*8,0x10.l),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_141:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x20(%pc),%a3
- lea EASTORE(%pc),%a4
- mov.l %a3,(%a4)
- mov.l &0x2,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([EASTORE.l,%pc],%zd4.l*8,0x20.l),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_142:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM-0x20(%pc),%a3
- lea EASTORE(%pc),%a4
- mov.l %a3,(%a4)
- mov.l &0x4,%d4
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([EASTORE.l,%zpc],%d4.l*8),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
-ea_143:
- addq.l &0x1,TESTCTR(%a6)
-
- movm.l DEF_REGS(%pc),&0x3fff
-
- mov.l %a7,%a0
- clr.l %d2
- mov.l &0x00000002,%d3
- lea EAMEM(%pc),%a3
- lea EASTORE(%pc),%a6
- mov.l %a3,(%a6)
- add.l &0x10,%a6
- mov.l &-0x2,%a7
-
- mov.w &0x0000,ICCR(%a6)
- mov.w &0x0000,%cc
- movm.l &0xffff,IREGS(%a6)
-
- mulu.l ([EASTORE.w,%pc],%a7.l*8,0x10.l),%d2:%d3
-
- mov.w %cc,SCCR(%a6)
- movm.l &0xffff,SREGS(%a6)
- mov.l &0x00000004,IREGS+0xc(%a6)
-
- mov.l %a0,%a7
- bsr.l chkregs
- tst.b %d0
- bne.l error
-
- clr.l %d0
- rts
-
-###########################################################
-###########################################################
-chkregs:
- lea IREGS(%a6),%a0
- lea SREGS(%a6),%a1
- mov.l &14,%d0
-chkregs_loop:
- cmp.l (%a0)+,(%a1)+
- bne.l chkregs_error
- dbra.w %d0,chkregs_loop
-
- mov.w ICCR(%a6),%d0
- mov.w SCCR(%a6),%d1
- cmp.w %d0,%d1
- bne.l chkregs_error
-
- clr.l %d0
- rts
-
-chkregs_error:
- movq.l &0x1,%d0
- rts
-
-error:
- mov.l TESTCTR(%a6),%d1
- movq.l &0x1,%d0
- rts
-
-DEF_REGS:
- long 0xacacacac, 0xacacacac, 0xacacacac, 0xacacacac
- long 0xacacacac, 0xacacacac, 0xacacacac, 0xacacacac
-
- long 0xacacacac, 0xacacacac, 0xacacacac, 0xacacacac
- long 0xacacacac, 0xacacacac, 0xacacacac, 0xacacacac
-
-############################################################
-
-_print_str:
- mov.l %d0,-(%sp)
- mov.l (TESTTOP-0x80+0x0,%pc),%d0
- pea (TESTTOP-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
-_print_num:
- mov.l %d0,-(%sp)
- mov.l (TESTTOP-0x80+0x4,%pc),%d0
- pea (TESTTOP-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
-############################################################
diff --git a/sys/arch/m68k/060sp/itest.sa b/sys/arch/m68k/060sp/itest.sa
deleted file mode 100644
index 0d29cd366e5..00000000000
--- a/sys/arch/m68k/060sp/itest.sa
+++ /dev/null
@@ -1,1315 +0,0 @@
-# $OpenBSD: itest.sa,v 1.2 1996/05/30 22:14:57 niklas Exp $
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-# M68000 Hi-Performance Microprocessor Division
-# M68060 Software Package Production Release
-#
-# M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
-# All rights reserved.
-#
-# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-# To the maximum extent permitted by applicable law,
-# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
-# FOR A PARTICULAR PURPOSE and any warranty against infringement with
-# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-# and any accompanying written materials.
-#
-# To the maximum extent permitted by applicable law,
-# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
-# BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
-# ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
-#
-# Motorola assumes no responsibility for the maintenance and support
-# of the SOFTWARE.
-#
-# You are hereby granted a copyright license to use, modify, and distribute the
-# SOFTWARE so long as this entire notice is retained without alteration
-# in any modified and/or redistributed versions, and that such modified
-# versions are clearly identified as such.
-# No licenses are granted by implication, estoppel or otherwise under any
-# patents or trademarks of Motorola, Inc.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- dc.l $60ff0000,$005c5465,$7374696e,$67203638
- dc.l $30363020,$49535020,$73746172,$7465643a
- dc.l $0a007061,$73736564,$0a002066,$61696c65
- dc.l $640a0000,$4a80660e,$487affe8,$61ff0000
- dc.l $4f9a588f,$4e752f01,$61ff0000,$4fa4588f
- dc.l $487affd8,$61ff0000,$4f82588f,$4e754e56
- dc.l $ff6048e7,$3f3c487a,$ff9e61ff,$00004f6c
- dc.l $588f42ae,$ff78487b,$01700000,$00ea61ff
- dc.l $00004f58,$588f61ff,$000000f0,$61ffffff
- dc.l $ffa642ae,$ff78487b,$01700000,$0af661ff
- dc.l $00004f38,$588f61ff,$00000af8,$61ffffff
- dc.l $ff8642ae,$ff78487b,$01700000,$179c61ff
- dc.l $00004f18,$588f61ff,$0000179c,$61ffffff
- dc.l $ff6642ae,$ff78487b,$01700000,$038661ff
- dc.l $00004ef8,$588f61ff,$00000380,$61ffffff
- dc.l $ff4642ae,$ff78487b,$01700000,$202c61ff
- dc.l $00004ed8,$588f2d7c,$00000002,$ff7461ff
- dc.l $0000202c,$61ffffff,$ff1e42ae,$ff78487b
- dc.l $01700000,$0d7c61ff,$00004eb0,$588f61ff
- dc.l $00000d74,$61ffffff,$fefe42ae,$ff78487b
- dc.l $01700000,$0f8e61ff,$00004e90,$588f61ff
- dc.l $00000f88,$61ffffff,$fede4cdf,$3cfc4e5e
- dc.l $4e750936,$342d6269,$74206d75,$6c746970
- dc.l $6c792e2e,$2e0051fc,$52aeff78,$4cfb3fff
- dc.l $01700000,$4e184281,$243c9999,$9999263c
- dc.l $88888888,$3d7c0004,$ff7c44fc,$000048ee
- dc.l $7fffff80,$4c013402,$42eeff7e,$48ee7fff
- dc.l $ffc042ae,$ff8842ae,$ff8c61ff,$00004da6
- dc.l $4a0066ff,$00004dcc,$52aeff78,$4cfb3fff
- dc.l $01700000,$4dc8223c,$77777777,$243c9999
- dc.l $99997600,$3d7c0004,$ff7c44fc,$000048ee
- dc.l $7fffff80,$4c013402,$42eeff7e,$48ee7fff
- dc.l $ffc042ae,$ff8842ae,$ff8c61ff,$00004d56
- dc.l $4a0066ff,$00004d7c,$52aeff78,$4cfb3fff
- dc.l $01700000,$4d787210,$243c6666,$66663d7c
- dc.l $0000ff7c,$44fc0000,$48ee7fff,$ff804c01
- dc.l $240242ee,$ff7e48ee,$7fffffc0,$2d7c0000
- dc.l $0006ff88,$61ff0000,$4d0c4a00,$66ff0000
- dc.l $4d3252ae,$ff784cfb,$3fff0170,$00004d2e
- dc.l $223c5555,$55557400,$76033d7c,$0000ff7c
- dc.l $44fc0000,$48ee7fff,$ff804c01,$340242ee
- dc.l $ff7e48ee,$7fffffc0,$2d7c0000,$0000ff88
- dc.l $2d7cffff,$ffffff8c,$61ff0000,$4cb84a00
- dc.l $66ff0000,$4cde52ae,$ff784cfb,$3fff0170
- dc.l $00004cda,$223c4000,$00007400,$76043d7c
- dc.l $0000ff7c,$44fc0000,$48ee7fff,$ff804c01
- dc.l $340242ee,$ff7e48ee,$7fffffc0,$2d7c0000
- dc.l $0001ff88,$2d7c0000,$0000ff8c,$61ff0000
- dc.l $4c644a00,$66ff0000,$4c8a52ae,$ff784cfb
- dc.l $3fff0170,$00004c86,$72ff7400,$76ff3d7c
- dc.l $0008ff7c,$44fc0000,$48ee7fff,$ff804c01
- dc.l $340242ee,$ff7e48ee,$7fffffc0,$2d7cffff
- dc.l $fffeff88,$2d7c0000,$0001ff8c,$61ff0000
- dc.l $4c144a00,$66ff0000,$4c3a52ae,$ff784cfb
- dc.l $3fff0170,$00004c36,$223c8000,$00007400
- dc.l $76ff3d7c,$0000ff7c,$44fc0000,$48ee7fff
- dc.l $ff804c01,$3c0242ee,$ff7e48ee,$7fffffc0
- dc.l $2d7c0000,$0000ff88,$2d7c8000,$0000ff8c
- dc.l $61ff0000,$4bc04a00,$66ff0000,$4be652ae
- dc.l $ff784cfb,$3fff0170,$00004be2,$223c8000
- dc.l $00007400,$76013d7c,$0008ff7c,$44fc0000
- dc.l $48ee7fff,$ff804c01,$3c0242ee,$ff7e48ee
- dc.l $7fffffc0,$2d7cffff,$ffffff88,$2d7c8000
- dc.l $0000ff8c,$61ff0000,$4b6c4a00,$66ff0000
- dc.l $4b9252ae,$ff784cfb,$3fff0170,$00004b8e
- dc.l $72017400,$263c8000,$00003d7c,$0008ff7c
- dc.l $44fc0000,$48ee7fff,$ff804c01,$3c0242ee
- dc.l $ff7e48ee,$7fffffc0,$2d7cffff,$ffffff88
- dc.l $2d7c8000,$0000ff8c,$61ff0000,$4b184a00
- dc.l $66ff0000,$4b3e222e,$ff784280,$4e75096d
- dc.l $6f766570,$2e2e2e00,$52aeff78,$4cfb3fff
- dc.l $01700000,$4b2841ee,$ff60303c,$aaaa4228
- dc.l $00004228,$00023d7c,$001fff7c,$44fc001f
- dc.l $48ee7fff,$ff800188,$000042ee,$ff7e48ee
- dc.l $7fffffc0,$12280002,$e1491228,$0000b041
- dc.l $66ff0000,$4ade61ff,$00004aaa,$4a0066ff
- dc.l $00004ad0,$52aeff78,$4cfb3fff,$01700000
- dc.l $4acc41ee,$ff64303c,$aaaa42a8,$fffc4290
- dc.l $42a80004,$3d7c001f,$ff7c44fc,$001f48ee
- dc.l $7fffff80,$01880000,$42eeff7e,$48ee7fff
- dc.l $ffc04aa8,$fffc66ff,$00004a88,$4aa80004
- dc.l $66ff0000,$4a7e0c90,$aa00aa00,$66ff0000
- dc.l $4a7261ff,$00004a3e,$4a0066ff,$00004a64
- dc.l $52aeff78,$4cfb3fff,$01700000,$4a6041ee
- dc.l $ff60303c,$aaaa4228,$00004228,$00023d7c
- dc.l $0000ff7c,$44fc0000,$48ee7fff,$ff800188
- dc.l $000042ee,$ff7e48ee,$7fffffc0,$12280002
- dc.l $e1491228,$0000b041,$66ff0000,$4a1661ff
- dc.l $000049e2,$4a0066ff,$00004a08,$52aeff78
- dc.l $4cfb3fff,$01700000,$4a0441ee,$ff60117c
- dc.l $00aa0000,$117c00aa,$00023d7c,$001fff7c
- dc.l $44fc001f,$48ee7fff,$ff800108,$000042ee
- dc.l $ff7e48ee,$7fffffc0,$3d7caaaa,$ff82323c
- dc.l $aaaab041,$66ff0000,$49ba61ff,$00004986
- dc.l $4a0066ff,$000049ac,$52aeff78,$4cfb3fff
- dc.l $01700000,$49a841ee,$ff60203c,$aaaaaaaa
- dc.l $42280000,$42280002,$42280004,$42280006
- dc.l $3d7c001f,$ff7c44fc,$001f48ee,$7fffff80
- dc.l $01c80000,$42eeff7e,$48ee7fff,$ffc01228
- dc.l $0006e189,$12280004,$e1891228,$0002e189
- dc.l $12280000,$b08166ff,$00004948,$61ff0000
- dc.l $49144a00,$66ff0000,$493a52ae,$ff784cfb
- dc.l $3fff0170,$00004936,$41eeff64,$203caaaa
- dc.l $aaaa42a8,$fffc4290,$42a80004,$42a80008
- dc.l $3d7c001f,$ff7c44fc,$001f48ee,$7fffff80
- dc.l $01c80000,$42eeff7e,$48ee7fff,$ffc04aa8
- dc.l $fffc66ff,$000048ec,$4aa80008,$66ff0000
- dc.l $48e20c90,$aa00aa00,$66ff0000,$48d60ca8
- dc.l $aa00aa00,$000466ff,$000048c8,$61ff0000
- dc.l $48944a00,$66ff0000,$48ba52ae,$ff784cfb
- dc.l $3fff0170,$000048b6,$41eeff60,$117c00aa
- dc.l $0000117c,$00aa0002,$117c00aa,$0004117c
- dc.l $00aa0006,$3d7c001f,$ff7c44fc,$001f48ee
- dc.l $7fffff80,$01480000,$42eeff7e,$48ee7fff
- dc.l $ffc02d7c,$aaaaaaaa,$ff80223c,$aaaaaaaa
- dc.l $b08166ff,$0000485c,$61ff0000,$48284a00
- dc.l $66ff0000,$484e52ae,$ff784cfb,$3fff0170
- dc.l $0000484a,$41eeff60,$3e3caaaa,$42280000
- dc.l $42280002,$3d7c001f,$ff7c44fc,$001f48ee
- dc.l $7fffff80,$0f880000,$42eeff7e,$48ee7fff
- dc.l $ffc01228,$0002e149,$12280000,$be4166ff
- dc.l $00004800,$61ff0000,$47cc4a00,$66ff0000
- dc.l $47f252ae,$ff784cfb,$3fff0170,$000047ee
- dc.l $41eeff60,$117c00aa,$0000117c,$00aa0002
- dc.l $3d7c001f,$ff7c44fc,$001f48ee,$7fffff80
- dc.l $0f080000,$42eeff7e,$48ee7fff,$ffc03d7c
- dc.l $aaaaff9e,$323caaaa,$be4166ff,$000047a4
- dc.l $61ff0000,$47704a00,$66ff0000,$479652ae
- dc.l $ff784cfb,$3fff0170,$00004792,$41eeff60
- dc.l $303caaaa,$42280000,$42280002,$3d7c001f
- dc.l $ff7c44fc,$001f48ee,$7fffff80,$01880000
- dc.l $42eeff7e,$48ee7fff,$ffc01228,$0002e149
- dc.l $12280000,$b04166ff,$00004748,$61ff0000
- dc.l $47144a00,$66ff0000,$473a52ae,$ff784cfb
- dc.l $3fff0170,$00004736,$41eeff60,$303caaaa
- dc.l $42280008,$4228000a,$3d7c001f,$ff7c44fc
- dc.l $001f48ee,$7fffff80,$01880008,$42eeff7e
- dc.l $48ee7fff,$ffc01228,$000ae149,$12280008
- dc.l $b04166ff,$000046ec,$61ff0000,$46b84a00
- dc.l $66ff0000,$46de52ae,$ff784cfb,$3fff0170
- dc.l $000046da,$41eeff60,$117c00aa,$0008117c
- dc.l $00aa000a,$3d7c001f,$ff7c44fc,$001f48ee
- dc.l $7fffff80,$01080008,$42eeff7e,$48ee7fff
- dc.l $ffc03d7c,$aaaaff82,$323caaaa,$b04166ff
- dc.l $00004690,$61ff0000,$465c4a00,$66ff0000
- dc.l $468252ae,$ff784cfb,$3fff0170,$0000467e
- dc.l $41eeff60,$203caaaa,$aaaa4228,$00084228
- dc.l $000a4228,$000c4228,$000e3d7c,$001fff7c
- dc.l $44fc001f,$48ee7fff,$ff8001c8,$000842ee
- dc.l $ff7e48ee,$7fffffc0,$1228000e,$e1891228
- dc.l $000ce189,$1228000a,$e1891228,$0008b081
- dc.l $66ff0000,$461e61ff,$000045ea,$4a0066ff
- dc.l $00004610,$52aeff78,$4cfb3fff,$01700000
- dc.l $460c41ee,$ff60117c,$00aa0008,$117c00aa
- dc.l $000a117c,$00aa000c,$117c00aa,$000e3d7c
- dc.l $001fff7c,$44fc001f,$48ee7fff,$ff800148
- dc.l $000842ee,$ff7e48ee,$7fffffc0,$2d7caaaa
- dc.l $aaaaff80,$223caaaa,$aaaab081,$66ff0000
- dc.l $45b261ff,$0000457e,$4a0066ff,$000045a4
- dc.l $52aeff78,$4cfb3fff,$01700000,$45a041ee
- dc.l $ff68303c,$aaaa4228,$fff84228,$fffa3d7c
- dc.l $001fff7c,$44fc001f,$48ee7fff,$ff800188
- dc.l $fff842ee,$ff7e48ee,$7fffffc0,$1228fffa
- dc.l $e1491228,$fff8b041,$66ff0000,$455661ff
- dc.l $00004522,$4a0066ff,$00004548,$52aeff78
- dc.l $4cfb3fff,$01700000,$454441ee,$ff68117c
- dc.l $00aafff8,$117c00aa,$fffa3d7c,$001fff7c
- dc.l $44fc001f,$48ee7fff,$ff800108,$fff842ee
- dc.l $ff7e48ee,$7fffffc0,$3d7caaaa,$ff82323c
- dc.l $aaaab041,$66ff0000,$44fa61ff,$000044c6
- dc.l $4a0066ff,$000044ec,$52aeff78,$4cfb3fff
- dc.l $01700000,$44e841ee,$ff68203c,$aaaaaaaa
- dc.l $4228fff8,$4228fffa,$4228fffc,$42280000
- dc.l $3d7c001f,$ff7c44fc,$001f48ee,$7fffff80
- dc.l $01c8fff8,$42eeff7e,$48ee7fff,$ffc01228
- dc.l $fffee189,$1228fffc,$e1891228,$fffae189
- dc.l $1228fff8,$b08166ff,$00004488,$61ff0000
- dc.l $44544a00,$66ff0000,$447a52ae,$ff784cfb
- dc.l $3fff0170,$00004476,$41eeff68,$117c00aa
- dc.l $fff8117c,$00aafffa,$117c00aa,$fffc117c
- dc.l $00aa0000,$3d7c001f,$ff7c44fc,$001f48ee
- dc.l $7fffff80,$0148fff8,$42eeff7e,$48ee7fff
- dc.l $ffc02d7c,$aaaaaaaa,$ff80223c,$aaaaaaaa
- dc.l $b08166ff,$0000441c,$61ff0000,$43e84a00
- dc.l $66ff0000,$440e222e,$ff784280,$4e750936
- dc.l $342d6269,$74206469,$76696465,$2e2e2e00
- dc.l $52aeff78,$52aeff78,$4cfb3fff,$01700000
- dc.l $43ec7201,$74007600,$3d7c0014,$ff7c44fc
- dc.l $001f48ee,$7fffff80,$4c413402,$42eeff7e
- dc.l $48ee7fff,$ffc061ff,$0000438a,$4a0066ff
- dc.l $000043b0,$52aeff78,$4cfb3fff,$01700000
- dc.l $43ac223c,$44444444,$7400263c,$55555555
- dc.l $3d7c0010,$ff7c44fc,$001f48ee,$7fffff80
- dc.l $4c413402,$42eeff7e,$48ee7fff,$ffc02d7c
- dc.l $11111111,$ff882d7c,$00000001,$ff8c61ff
- dc.l $00004332,$4a0066ff,$00004358,$52aeff78
- dc.l $4cfb3fff,$01700000,$4354223c,$55555555
- dc.l $7400263c,$44444444,$3d7c0014,$ff7c44fc
- dc.l $001f48ee,$7fffff80,$4c413402,$42eeff7e
- dc.l $48ee7fff,$ffc02d7c,$44444444,$ff882d7c
- dc.l $00000000,$ff8c61ff,$000042da,$4a0066ff
- dc.l $00004300,$52aeff78,$4cfb3fff,$01700000
- dc.l $42fc223c,$11111111,$243c4444,$4444263c
- dc.l $44444444,$3d7c001e,$ff7c44fc,$001d48ee
- dc.l $7fffff80,$4c413402,$42eeff7e,$48ee7fff
- dc.l $ffc061ff,$0000428e,$4a0066ff,$000042b4
- dc.l $52aeff78,$4cfb3fff,$01700000,$42b072fe
- dc.l $74017602,$3d7c001e,$ff7c44fc,$001d48ee
- dc.l $7fffff80,$4c413c02,$42eeff7e,$48ee7fff
- dc.l $ffc061ff,$0000424e,$4a0066ff,$00004274
- dc.l $52aeff78,$4cfb3fff,$01700000,$427072fe
- dc.l $74017600,$3d7c0018,$ff7c44fc,$001d48ee
- dc.l $7fffff80,$4c413c02,$42eeff7e,$48ee7fff
- dc.l $ffc02d7c,$00000000,$ff882d7c,$80000000
- dc.l $ff8c61ff,$000041fe,$4a0066ff,$00004224
- dc.l $52aeff78,$4cfb3fff,$01700000,$42207202
- dc.l $74017600,$3d7c001e,$ff7c44fc,$001d48ee
- dc.l $7fffff80,$4c413c02,$42eeff7e,$48ee7fff
- dc.l $ffc061ff,$000041be,$4a0066ff,$000041e4
- dc.l $52aeff78,$4cfb3fff,$01700000,$41e072ff
- dc.l $74fe76ff,$3d7c0008,$ff7c44fc,$000048ee
- dc.l $7fffff80,$4c413402,$42eeff7e,$48ee7fff
- dc.l $ffc061ff,$0000417e,$4a0066ff,$000041a4
- dc.l $52aeff78,$4cfb3fff,$01700000,$41a072ff
- dc.l $74fe76ff,$3d7c0008,$ff7c44fc,$000048ee
- dc.l $7fffff80,$4c7c2402,$ffffffff,$42eeff7e
- dc.l $48ee7fff,$ffc02d7c,$ffffffff,$ff8861ff
- dc.l $00004132,$4a0066ff,$00004158,$52aeff78
- dc.l $4cfb3fff,$01700000,$4154223c,$0000ffff
- dc.l $7401263c,$55555555,$3d7c0000,$ff7c44fc
- dc.l $000048ee,$7fffff80,$4c413402,$42eeff7e
- dc.l $48ee7fff,$ffc02d7c,$0000aaab,$ff882d7c
- dc.l $00015556,$ff8c61ff,$000040da,$4a0066ff
- dc.l $00004100,$222eff78,$42804e75,$09636173
- dc.l $2e2e2e00,$52aeff78,$4cfb3fff,$01700000
- dc.l $40ec41ee,$ff6130bc,$aaaa323c,$aaaa343c
- dc.l $bbbb3d7c,$0014ff7c,$44fc0010,$48ee7fff
- dc.l $ff800cd0,$008142ee,$ff7e3610,$3d7cbbbb
- dc.l $ff8e48ee,$7fffffc0,$61ff0000,$40784a00
- dc.l $66ff0000,$409e52ae,$ff784cfb,$3fff0170
- dc.l $0000409a,$41eeff61,$30bceeee,$323caaaa
- dc.l $343cbbbb,$3d7c0000,$ff7c44fc,$000048ee
- dc.l $7fffff80,$0cd00081,$42eeff7e,$36103d7c
- dc.l $eeeeff86,$3d7ceeee,$ff8e48ee,$7fffffc0
- dc.l $61ff0000,$40204a00,$66ff0000,$404652ae
- dc.l $ff784cfb,$3fff0170,$00004042,$41eeff62
- dc.l $20bcaaaa,$aaaa223c,$aaaaaaaa,$243cbbbb
- dc.l $bbbb3d7c,$0004ff7c,$44fc0000,$48ee7fff
- dc.l $ff800ed0,$008142ee,$ff7e2610,$2d7cbbbb
- dc.l $bbbbff8c,$48ee7fff,$ffc061ff,$00003fc6
- dc.l $4a0066ff,$00003fec,$52aeff78,$4cfb3fff
- dc.l $01700000,$3fe841ee,$ff6220bc,$eeeeeeee
- dc.l $223caaaa,$aaaa243c,$bbbbbbbb,$3d7c0000
- dc.l $ff7c44fc,$000048ee,$7fffff80,$0ed00081
- dc.l $42eeff7e,$26102d7c,$eeeeeeee,$ff842d7c
- dc.l $eeeeeeee,$ff8c48ee,$7fffffc0,$61ff0000
- dc.l $3f644a00,$66ff0000,$3f8a52ae,$ff784cfb
- dc.l $3fff0170,$00003f86,$41eeff61,$20bcaaaa
- dc.l $aaaa223c,$aaaaaaaa,$243cbbbb,$bbbb3d7c
- dc.l $0004ff7c,$44fc0000,$48ee7fff,$ff800ed0
- dc.l $008142ee,$ff7e2610,$2d7cbbbb,$bbbbff8c
- dc.l $48ee7fff,$ffc061ff,$00003f0a,$4a0066ff
- dc.l $00003f30,$52aeff78,$4cfb3fff,$01700000
- dc.l $3f2c41ee,$ff6120bc,$7fffffff,$223c8000
- dc.l $0000243c,$bbbbbbbb,$3d7c001b,$ff7c44fc
- dc.l $001048ee,$7fffff80,$0ed00081,$42eeff7e
- dc.l $26102d7c,$7fffffff,$ff842d7c,$7fffffff
- dc.l $ff8c48ee,$7fffffc0,$61ff0000,$3ea84a00
- dc.l $66ff0000,$3ece222e,$ff784280,$4e750963
- dc.l $6173322e,$2e2e0000,$52aeff78,$4cfb3fff
- dc.l $01700000,$3eb841ee,$ff6043ee,$ff6420bc
- dc.l $aaaaaaaa,$22bcbbbb,$bbbb223c,$aaaaaaaa
- dc.l $243cbbbb,$bbbb263c,$cccccccc,$283cdddd
- dc.l $dddd3d7c,$0014ff7c,$44fc0010,$48ee7fff
- dc.l $ff800efc,$80c19102,$42eeff7e,$2a102c11
- dc.l $2d7ccccc,$ccccff94,$2d7cdddd,$ddddff98
- dc.l $48ee7fff,$ffc061ff,$00003e1a,$4a0066ff
- dc.l $00003e40,$52aeff78,$4cfb3fff,$01700000
- dc.l $3e3c41ee,$ff6143ee,$ff6520bc,$aaaaaaaa
- dc.l $22bcbbbb,$bbbb223c,$aaaaaaaa,$243cbbbb
- dc.l $bbbb263c,$cccccccc,$283cdddd,$dddd3d7c
- dc.l $0014ff7c,$44fc0010,$48ee7fff,$ff800efc
- dc.l $80c19102,$42eeff7e,$2a102c11,$2d7ccccc
- dc.l $ccccff94,$2d7cdddd,$ddddff98,$48ee7fff
- dc.l $ffc061ff,$00003d9e,$4a0066ff,$00003dc4
- dc.l $52aeff78,$4cfb3fff,$01700000,$3dc041ee
- dc.l $ff6243ee,$ff6620bc,$aaaaaaaa,$22bcbbbb
- dc.l $bbbb223c,$aaaaaaaa,$243cbbbb,$bbbb263c
- dc.l $cccccccc,$283cdddd,$dddd3d7c,$0014ff7c
- dc.l $44fc0010,$48ee7fff,$ff800efc,$80c19102
- dc.l $42eeff7e,$2a102c11,$2d7ccccc,$ccccff94
- dc.l $2d7cdddd,$ddddff98,$48ee7fff,$ffc061ff
- dc.l $00003d22,$4a0066ff,$00003d48,$52aeff78
- dc.l $4cfb3fff,$01700000,$3d4441ee,$ff6043ee
- dc.l $ff6420bc,$eeeeeeee,$22bcbbbb,$bbbb223c
- dc.l $aaaaaaaa,$243cbbbb,$bbbb263c,$cccccccc
- dc.l $283cdddd,$dddd3d7c,$0000ff7c,$44fc0000
- dc.l $48ee7fff,$ff800efc,$80c19102,$42eeff7e
- dc.l $2a102c11,$2d7ceeee,$eeeeff84,$2d7cbbbb
- dc.l $bbbbff88,$2d7ceeee,$eeeeff94,$2d7cbbbb
- dc.l $bbbbff98,$48ee7fff,$ffc061ff,$00003c96
- dc.l $4a0066ff,$00003cbc,$52aeff78,$4cfb3fff
- dc.l $01700000,$3cb841ee,$ff6143ee,$ff6520bc
- dc.l $eeeeeeee,$22bcbbbb,$bbbb223c,$aaaaaaaa
- dc.l $243cbbbb,$bbbb263c,$cccccccc,$283cdddd
- dc.l $dddd3d7c,$0000ff7c,$44fc0000,$48ee7fff
- dc.l $ff800efc,$80c19102,$42eeff7e,$2a102c11
- dc.l $2d7ceeee,$eeeeff84,$2d7cbbbb,$bbbbff88
- dc.l $2d7ceeee,$eeeeff94,$2d7cbbbb,$bbbbff98
- dc.l $48ee7fff,$ffc061ff,$00003c0a,$4a0066ff
- dc.l $00003c30,$52aeff78,$4cfb3fff,$01700000
- dc.l $3c2c41ee,$ff6243ee,$ff6620bc,$eeeeeeee
- dc.l $22bcbbbb,$bbbb223c,$aaaaaaaa,$243cbbbb
- dc.l $bbbb263c,$cccccccc,$283cdddd,$dddd3d7c
- dc.l $0000ff7c,$44fc0000,$48ee7fff,$ff800efc
- dc.l $80c19102,$42eeff7e,$2a102c11,$2d7ceeee
- dc.l $eeeeff84,$2d7cbbbb,$bbbbff88,$2d7ceeee
- dc.l $eeeeff94,$2d7cbbbb,$bbbbff98,$48ee7fff
- dc.l $ffc061ff,$00003b7e,$4a0066ff,$00003ba4
- dc.l $52aeff78,$4cfb3fff,$01700000,$3ba041ee
- dc.l $ff6043ee,$ff6420bc,$aaaaaaaa,$22bceeee
- dc.l $eeee223c,$aaaaaaaa,$243cbbbb,$bbbb263c
- dc.l $cccccccc,$283cdddd,$dddd3d7c,$0000ff7c
- dc.l $44fc0000,$48ee7fff,$ff800efc,$80c19102
- dc.l $42eeff7e,$2a102c11,$2d7caaaa,$aaaaff84
- dc.l $2d7ceeee,$eeeeff88,$2d7caaaa,$aaaaff94
- dc.l $2d7ceeee,$eeeeff98,$48ee7fff,$ffc061ff
- dc.l $00003af2,$4a0066ff,$00003b18,$52aeff78
- dc.l $4cfb3fff,$01700000,$3b1441ee,$ff6143ee
- dc.l $ff6520bc,$aaaaaaaa,$22bceeee,$eeee223c
- dc.l $aaaaaaaa,$243cbbbb,$bbbb263c,$cccccccc
- dc.l $283cdddd,$dddd3d7c,$0000ff7c,$44fc0000
- dc.l $48ee7fff,$ff800efc,$80c19102,$42eeff7e
- dc.l $2a102c11,$2d7caaaa,$aaaaff84,$2d7ceeee
- dc.l $eeeeff88,$2d7caaaa,$aaaaff94,$2d7ceeee
- dc.l $eeeeff98,$48ee7fff,$ffc061ff,$00003a66
- dc.l $4a0066ff,$00003a8c,$52aeff78,$4cfb3fff
- dc.l $01700000,$3a8841ee,$ff6243ee,$ff6620bc
- dc.l $aaaaaaaa,$22bc7fff,$ffff223c,$aaaaaaaa
- dc.l $243c8000,$0000263c,$cccccccc,$283cdddd
- dc.l $dddd3d7c,$000bff7c,$44fc0000,$48ee7fff
- dc.l $ff800efc,$80c19102,$42eeff7e,$2a102c11
- dc.l $2d7caaaa,$aaaaff84,$2d7c7fff,$ffffff88
- dc.l $2d7caaaa,$aaaaff94,$2d7c7fff,$ffffff98
- dc.l $48ee7fff,$ffc061ff,$000039da,$4a0066ff
- dc.l $00003a00,$52aeff78,$4cfb3fff,$01700000
- dc.l $39fc41ee,$ff6043ee,$ff6430bc,$aaaa32bc
- dc.l $bbbb323c,$aaaa343c,$bbbb363c,$cccc383c
- dc.l $dddd3d7c,$0014ff7c,$44fc0010,$48ee7fff
- dc.l $ff800cfc,$80c19102,$42eeff7e,$3a103c11
- dc.l $3d7ccccc,$ff963d7c,$ddddff9a,$48ee7fff
- dc.l $ffc061ff,$0000396e,$4a0066ff,$00003994
- dc.l $52aeff78,$4cfb3fff,$01700000,$399041ee
- dc.l $ff6143ee,$ff6530bc,$aaaa32bc,$bbbb323c
- dc.l $aaaa343c,$bbbb363c,$cccc383c,$dddd3d7c
- dc.l $0004ff7c,$44fc0000,$48ee7fff,$ff800cfc
- dc.l $80c19102,$42eeff7e,$3a103c11,$3d7ccccc
- dc.l $ff963d7c,$ddddff9a,$48ee7fff,$ffc061ff
- dc.l $00003902,$4a0066ff,$00003928,$52aeff78
- dc.l $4cfb3fff,$01700000,$392441ee,$ff6043ee
- dc.l $ff6430bc,$eeee32bc,$bbbb323c,$aaaa343c
- dc.l $bbbb363c,$cccc383c,$dddd3d7c,$0000ff7c
- dc.l $44fc0000,$48ee7fff,$ff800cfc,$80c19102
- dc.l $42eeff7e,$3a103c11,$3d7ceeee,$ff863d7c
- dc.l $bbbbff8a,$3d7ceeee,$ff963d7c,$bbbbff9a
- dc.l $48ee7fff,$ffc061ff,$0000388a,$4a0066ff
- dc.l $000038b0,$52aeff78,$4cfb3fff,$01700000
- dc.l $38ac41ee,$ff6143ee,$ff6530bc,$eeee32bc
- dc.l $bbbb323c,$aaaa343c,$bbbb363c,$cccc383c
- dc.l $dddd3d7c,$0000ff7c,$44fc0000,$48ee7fff
- dc.l $ff800cfc,$80c19102,$42eeff7e,$3a103c11
- dc.l $3d7ceeee,$ff863d7c,$bbbbff8a,$3d7ceeee
- dc.l $ff963d7c,$bbbbff9a,$48ee7fff,$ffc061ff
- dc.l $00003812,$4a0066ff,$00003838,$52aeff78
- dc.l $4cfb3fff,$01700000,$383441ee,$ff6043ee
- dc.l $ff6430bc,$aaaa32bc,$eeee323c,$aaaa343c
- dc.l $bbbb363c,$cccc383c,$dddd3d7c,$0000ff7c
- dc.l $44fc0000,$48ee7fff,$ff800cfc,$80c19102
- dc.l $42eeff7e,$3a103c11,$3d7caaaa,$ff863d7c
- dc.l $eeeeff8a,$3d7caaaa,$ff963d7c,$eeeeff9a
- dc.l $48ee7fff,$ffc061ff,$0000379a,$4a0066ff
- dc.l $000037c0,$52aeff78,$4cfb3fff,$01700000
- dc.l $37bc41ee,$ff6143ee,$ff6530bc,$aaaa32bc
- dc.l $7fff323c,$aaaa343c,$8000363c,$cccc383c
- dc.l $dddd3d7c,$001bff7c,$44fc0010,$48ee7fff
- dc.l $ff800cfc,$80c19102,$42eeff7e,$3a103c11
- dc.l $3d7caaaa,$ff863d7c,$7fffff8a,$3d7caaaa
- dc.l $ff963d7c,$7fffff9a,$48ee7fff,$ffc061ff
- dc.l $00003722,$4a0066ff,$00003748,$222eff78
- dc.l $42804e75,$09636d70,$322c6368,$6b322e2e
- dc.l $2e0051fc,$52aeff78,$4cfb3fff,$01700000
- dc.l $372c3d7c,$2040ff60,$223c1111,$11203d7c
- dc.l $0004ff7c,$44fc0000,$48ee7fff,$ff8000ee
- dc.l $1000ff60,$42eeff7e,$48ee7fff,$ffc061ff
- dc.l $000036c2,$4a0066ff,$000036e8,$52aeff78
- dc.l $4cfb3fff,$01700000,$36e43d7c,$2040ff60
- dc.l $227c0000,$00403d7c,$0004ff7c,$44fc0000
- dc.l $48ee7fff,$ff8000ee,$9000ff60,$42eeff7e
- dc.l $48ee7fff,$ffc061ff,$0000367a,$4a0066ff
- dc.l $000036a0,$52aeff78,$4cfb3fff,$01700000
- dc.l $369c3d7c,$2040ff60,$223c1111,$11303d7c
- dc.l $0000ff7c,$44fc0000,$48ee7fff,$ff8000ee
- dc.l $1800ff60,$42eeff7e,$48ee7fff,$ffc061ff
- dc.l $00003632,$4a0066ff,$00003658,$52aeff78
- dc.l $4cfb3fff,$01700000,$36543d7c,$2040ff60
- dc.l $227c0000,$00103d7c,$0001ff7c,$44fc0000
- dc.l $48ee7fff,$ff8000ee,$9000ff60,$42eeff7e
- dc.l $48ee7fff,$ffc061ff,$000035ea,$4a0066ff
- dc.l $00003610,$52aeff78,$4cfb3fff,$01700000
- dc.l $360c3d7c,$2040ff60,$223c1111,$11503d7c
- dc.l $0001ff7c,$44fc0000,$48ee7fff,$ff8000ee
- dc.l $1000ff60,$42eeff7e,$48ee7fff,$ffc061ff
- dc.l $000035a2,$4a0066ff,$000035c8,$52aeff78
- dc.l $4cfb3fff,$01700000,$35c43d7c,$2040ff60
- dc.l $227c0000,$00903d7c,$0001ff7c,$44fc0000
- dc.l $48ee7fff,$ff8000ee,$9000ff60,$42eeff7e
- dc.l $48ee7fff,$ffc061ff,$0000355a,$4a0066ff
- dc.l $00003580,$52aeff78,$4cfb3fff,$01700000
- dc.l $357c2d7c,$2000a000,$ff60223c,$11112000
- dc.l $3d7c0004,$ff7c44fc,$000048ee,$7fffff80
- dc.l $02ee1000,$ff6042ee,$ff7e48ee,$7fffffc0
- dc.l $61ff0000,$35104a00,$66ff0000,$353652ae
- dc.l $ff784cfb,$3fff0170,$00003532,$2d7c2000
- dc.l $a000ff60,$227cffff,$a0003d7c,$0004ff7c
- dc.l $44fc0000,$48ee7fff,$ff8002ee,$9000ff60
- dc.l $42eeff7e,$48ee7fff,$ffc061ff,$000034c6
- dc.l $4a0066ff,$000034ec,$52aeff78,$4cfb3fff
- dc.l $01700000,$34e82d7c,$2000a000,$ff60223c
- dc.l $11113000,$3d7c0000,$ff7c44fc,$000048ee
- dc.l $7fffff80,$02ee1800,$ff6042ee,$ff7e48ee
- dc.l $7fffffc0,$61ff0000,$347c4a00,$66ff0000
- dc.l $34a252ae,$ff784cfb,$3fff0170,$0000349e
- dc.l $2d7c2000,$a000ff60,$227cffff,$90003d7c
- dc.l $0000ff7c,$44fc0000,$48ee7fff,$ff8002ee
- dc.l $9000ff60,$42eeff7e,$48ee7fff,$ffc061ff
- dc.l $00003432,$4a0066ff,$00003458,$52aeff78
- dc.l $4cfb3fff,$01700000,$34542d7c,$2000a000
- dc.l $ff60223c,$11111000,$3d7c0001,$ff7c44fc
- dc.l $000048ee,$7fffff80,$02ee1000,$ff6042ee
- dc.l $ff7e48ee,$7fffffc0,$61ff0000,$33e84a00
- dc.l $66ff0000,$340e52ae,$ff784cfb,$3fff0170
- dc.l $0000340a,$2d7c2000,$a000ff60,$227cffff
- dc.l $b0003d7c,$0001ff7c,$44fc0000,$48ee7fff
- dc.l $ff8002ee,$9000ff60,$42eeff7e,$48ee7fff
- dc.l $ffc061ff,$0000339e,$4a0066ff,$000033c4
- dc.l $52aeff78,$4cfb3fff,$01700000,$33c02d7c
- dc.l $a0000000,$ff602d7c,$c0000000,$ff64223c
- dc.l $a0000000,$3d7c000c,$ff7c44fc,$000848ee
- dc.l $7fffff80,$04ee1000,$ff6042ee,$ff7e48ee
- dc.l $7fffffc0,$61ff0000,$334c4a00,$66ff0000
- dc.l $337252ae,$ff784cfb,$3fff0170,$0000336e
- dc.l $2d7ca000,$0000ff60,$2d7cc000,$0000ff64
- dc.l $227cc000,$00003d7c,$000cff7c,$44fc0008
- dc.l $48ee7fff,$ff8004ee,$9000ff60,$42eeff7e
- dc.l $48ee7fff,$ffc061ff,$000032fa,$4a0066ff
- dc.l $00003320,$52aeff78,$4cfb3fff,$01700000
- dc.l $331c2d7c,$a0000000,$ff602d7c,$c0000000
- dc.l $ff64223c,$b0000000,$3d7c0008,$ff7c44fc
- dc.l $000848ee,$7fffff80,$04ee1800,$ff6042ee
- dc.l $ff7e48ee,$7fffffc0,$61ff0000,$32a84a00
- dc.l $66ff0000,$32ce52ae,$ff784cfb,$3fff0170
- dc.l $000032ca,$2d7ca000,$0000ff60,$2d7cc000
- dc.l $0000ff64,$227c1000,$00003d7c,$0009ff7c
- dc.l $44fc0008,$48ee7fff,$ff8004ee,$9000ff60
- dc.l $42eeff7e,$48ee7fff,$ffc061ff,$00003256
- dc.l $4a0066ff,$0000327c,$52aeff78,$4cfb3fff
- dc.l $01700000,$32782d7c,$a0000000,$ff602d7c
- dc.l $c0000000,$ff64223c,$90000000,$3d7c0009
- dc.l $ff7c44fc,$000848ee,$7fffff80,$04ee1000
- dc.l $ff6042ee,$ff7e48ee,$7fffffc0,$61ff0000
- dc.l $32044a00,$66ff0000,$322a52ae,$ff784cfb
- dc.l $3fff0170,$00003226,$2d7ca000,$0000ff60
- dc.l $2d7cc000,$0000ff64,$227cd000,$00003d7c
- dc.l $0009ff7c,$44fc0008,$48ee7fff,$ff8004ee
- dc.l $9000ff60,$42eeff7e,$48ee7fff,$ffc061ff
- dc.l $000031b2,$4a0066ff,$000031d8,$52aeff78
- dc.l $4cfb3fff,$01700000,$31d43d7c,$a040ff60
- dc.l $223c1111,$11a03d7c,$0004ff7c,$44fc0000
- dc.l $48ee7fff,$ff8000ee,$1000ff60,$42eeff7e
- dc.l $48ee7fff,$ffc061ff,$0000316a,$4a0066ff
- dc.l $00003190,$52aeff78,$4cfb3fff,$01700000
- dc.l $318c3d7c,$a040ff60,$227c0000,$00403d7c
- dc.l $0004ff7c,$44fc0000,$48ee7fff,$ff8000ee
- dc.l $9800ff60,$42eeff7e,$48ee7fff,$ffc061ff
- dc.l $00003122,$4a0066ff,$00003148,$52aeff78
- dc.l $4cfb3fff,$01700000,$31443d7c,$a040ff60
- dc.l $223c1111,$11b03d7c,$0000ff7c,$44fc0000
- dc.l $48ee7fff,$ff8000ee,$1000ff60,$42eeff7e
- dc.l $48ee7fff,$ffc061ff,$000030da,$4a0066ff
- dc.l $00003100,$52aeff78,$4cfb3fff,$01700000
- dc.l $30fc3d7c,$a040ff60,$227c0000,$00103d7c
- dc.l $0000ff7c,$44fc0000,$48ee7fff,$ff8000ee
- dc.l $9000ff60,$42eeff7e,$48ee7fff,$ffc061ff
- dc.l $00003092,$4a0066ff,$000030b8,$52aeff78
- dc.l $4cfb3fff,$01700000,$30b43d7c,$a040ff60
- dc.l $223c1111,$11903d7c,$0001ff7c,$44fc0000
- dc.l $48ee7fff,$ff8000ee,$1000ff60,$42eeff7e
- dc.l $48ee7fff,$ffc061ff,$0000304a,$4a0066ff
- dc.l $00003070,$52aeff78,$4cfb3fff,$01700000
- dc.l $306c3d7c,$a040ff60,$227c0000,$00503d7c
- dc.l $0001ff7c,$44fc0000,$48ee7fff,$ff8000ee
- dc.l $9000ff60,$42eeff7e,$48ee7fff,$ffc061ff
- dc.l $00003002,$4a0066ff,$00003028,$52aeff78
- dc.l $4cfb3fff,$01700000,$30243d7c,$a0c0ff60
- dc.l $223c1111,$11a03d7c,$0004ff7c,$44fc0000
- dc.l $48ee7fff,$ff8000ee,$1000ff60,$42eeff7e
- dc.l $48ee7fff,$ffc061ff,$00002fba,$4a0066ff
- dc.l $00002fe0,$52aeff78,$4cfb3fff,$01700000
- dc.l $2fdc3d7c,$a0c0ff60,$227cffff,$ffc03d7c
- dc.l $0004ff7c,$44fc0000,$48ee7fff,$ff8000ee
- dc.l $9000ff60,$42eeff7e,$48ee7fff,$ffc061ff
- dc.l $00002f72,$4a0066ff,$00002f98,$52aeff78
- dc.l $4cfb3fff,$01700000,$2f943d7c,$a0c0ff60
- dc.l $223c1111,$11b03d7c,$0000ff7c,$44fc0000
- dc.l $48ee7fff,$ff8000ee,$1800ff60,$42eeff7e
- dc.l $48ee7fff,$ffc061ff,$00002f2a,$4a0066ff
- dc.l $00002f50,$52aeff78,$4cfb3fff,$01700000
- dc.l $2f4c3d7c,$a0c0ff60,$227c1111,$11903d7c
- dc.l $0001ff7c,$44fc0000,$48ee7fff,$ff8000ee
- dc.l $9000ff60,$42eeff7e,$48ee7fff,$ffc061ff
- dc.l $00002ee2,$4a0066ff,$00002f08,$52aeff78
- dc.l $4cfb3fff,$01700000,$2f043d7c,$a0c0ff60
- dc.l $223c1111,$11d03d7c,$0001ff7c,$44fc0000
- dc.l $48ee7fff,$ff8000ee,$1000ff60,$42eeff7e
- dc.l $48ee7fff,$ffc061ff,$00002e9a,$4a0066ff
- dc.l $00002ec0,$52aeff78,$4cfb3fff,$01700000
- dc.l $2ebc3d7c,$a0c0ff60,$227c0000,$00503d7c
- dc.l $001bff7c,$44fc001f,$48ee7fff,$ff8000ee
- dc.l $9000ff60,$42eeff7e,$48ee7fff,$ffc061ff
- dc.l $00002e52,$4a0066ff,$00002e78,$222eff78
- dc.l $42804e75,$09456666,$65637469,$76652061
- dc.l $64647265,$73736573,$2e2e2e00,$52aeff78
- dc.l $4cfb3fff,$01700000,$2e544282,$760241ee
- dc.l $ff743d7c,$0000ff7c,$44fc0000,$48eeffff
- dc.l $ff804c10,$340242ee,$ff7e48ee,$ffffffc0
- dc.l $2d7c0000,$0004ff8c,$61ff0000,$2de84a00
- dc.l $66ff0000,$2e0e52ae,$ff784cfb,$3fff0170
- dc.l $00002e0a,$42827602,$41eeff74,$3d7c0000
- dc.l $ff7c44fc,$000048ee,$ffffff80,$4c183402
- dc.l $42eeff7e,$48eeffff,$ffc02d7c,$00000004
- dc.l $ff8c41ee,$ff782d48,$ffa061ff,$00002d96
- dc.l $4a0066ff,$00002dbc,$52aeff78,$4cfb3fff
- dc.l $01700000,$2db84282,$760241ee,$ff783d7c
- dc.l $0000ff7c,$44fc0000,$48eeffff,$ff804c20
- dc.l $340242ee,$ff7e48ee,$ffffffc0,$2d7c0000
- dc.l $0004ff8c,$41eeff74,$2d48ffa0,$61ff0000
- dc.l $2d444a00,$66ff0000,$2d6a52ae,$ff784cfb
- dc.l $3fff0170,$00002d66,$42827602,$41ee0f74
- dc.l $3d7c0000,$ff7c44fc,$000048ee,$ffffff80
- dc.l $4c283402,$f00042ee,$ff7e48ee,$ffffffc0
- dc.l $2d7c0000,$0004ff8c,$61ff0000,$2cf84a00
- dc.l $66ff0000,$2d1e52ae,$ff784cfb,$3fff0170
- dc.l $00002d1a,$42827602,$41eeef74,$3d7c0000
- dc.l $ff7c44fc,$000048ee,$ffffff80,$4c283402
- dc.l $100042ee,$ff7e48ee,$ffffffc0,$2d7c0000
- dc.l $0004ff8c,$61ff0000,$2cac4a00,$66ff0000
- dc.l $2cd252ae,$ff7852ae,$ff7852ae,$ff784cfb
- dc.l $3fff0170,$00002cc6,$42827602,$3d7c0000
- dc.l $ff7c44fc,$000048ee,$ffffff80,$4c3c3402
- dc.l $00000002,$42eeff7e,$48eeffff,$ffc02d7c
- dc.l $00000004,$ff8c61ff,$00002c5a,$4a0066ff
- dc.l $00002c80,$52aeff78,$60040000,$00024cfb
- dc.l $3fff0170,$00002c76,$42827602,$3d7c0000
- dc.l $ff7c44fc,$000048ee,$ffffff80,$4c3a3402
- dc.l $ffda42ee,$ff7e48ee,$ffffffc0,$2d7c0000
- dc.l $0004ff8c,$61ff0000,$2c0c4a00,$66ff0000
- dc.l $2c3252ae,$ff784cfb,$3fff0170,$00002c2e
- dc.l $42827602,$43eeff78,$3d7c0000,$ff7c44fc
- dc.l $000048ee,$ffffff80,$4c213402,$42eeff7e
- dc.l $48eeffff,$ffc02d7c,$00000004,$ff8c41ee
- dc.l $ff742d48,$ffa461ff,$00002bba,$4a0066ff
- dc.l $00002be0,$52aeff78,$4cfb3fff,$01700000
- dc.l $2bdc4282,$760245ee,$ff783d7c,$0000ff7c
- dc.l $44fc0000,$48eeffff,$ff804c22,$340242ee
- dc.l $ff7e48ee,$ffffffc0,$2d7c0000,$0004ff8c
- dc.l $41eeff74,$2d48ffa8,$61ff0000,$2b684a00
- dc.l $66ff0000,$2b8e52ae,$ff784cfb,$3fff0170
- dc.l $00002b8a,$42827602,$47eeff78,$3d7c0000
- dc.l $ff7c44fc,$000048ee,$ffffff80,$4c233402
- dc.l $42eeff7e,$48eeffff,$ffc02d7c,$00000004
- dc.l $ff8c41ee,$ff742d48,$ffac61ff,$00002b16
- dc.l $4a0066ff,$00002b3c,$52aeff78,$4cfb3fff
- dc.l $01700000,$2b384282,$760249ee,$ff783d7c
- dc.l $0000ff7c,$44fc0000,$48eeffff,$ff804c24
- dc.l $340242ee,$ff7e48ee,$ffffffc0,$2d7c0000
- dc.l $0004ff8c,$41eeff74,$2d48ffb0,$61ff0000
- dc.l $2ac44a00,$66ff0000,$2aea52ae,$ff784cfb
- dc.l $3fff0170,$00002ae6,$42827602,$4beeff78
- dc.l $3d7c0000,$ff7c44fc,$000048ee,$ffffff80
- dc.l $4c253402,$42eeff7e,$48eeffff,$ffc02d7c
- dc.l $00000004,$ff8c41ee,$ff742d48,$ffb461ff
- dc.l $00002a72,$4a0066ff,$00002a98,$52aeff78
- dc.l $4cfb3fff,$01700000,$2a94224e,$42827602
- dc.l $4de9ff78,$337c0000,$ff7c44fc,$000048e9
- dc.l $ffffff80,$4c263402,$42e9ff7e,$48e9ffff
- dc.l $ffc0237c,$00000004,$ff8c41e9,$ff742348
- dc.l $ffb82c49,$61ff0000,$2a1c4a00,$66ff0000
- dc.l $2a4252ae,$ff784cfb,$3fff0170,$00002a3e
- dc.l $42827602,$204f4fee,$ff783d7c,$0000ff7c
- dc.l $44fc0000,$48eeffff,$ff804c27,$340242ee
- dc.l $ff7e48ee,$ffffffc0,$2d7c0000,$0004ff8c
- dc.l $43eeff74,$2d49ffbc,$2e4861ff,$000029c6
- dc.l $4a0066ff,$000029ec,$52aeff78,$4cfb3fff
- dc.l $01700000,$29e84282,$760241ee,$ff7478f0
- dc.l $3d7c0000,$ff7c44fc,$000048ee,$ffffff80
- dc.l $4c303402,$401042ee,$ff7e48ee,$ffffffc0
- dc.l $2d7c0000,$0004ff8c,$61ff0000,$29784a00
- dc.l $66ff0000,$299e52ae,$ff784cfb,$3fff0170
- dc.l $0000299a,$42827602,$41eeff74,$78f83d7c
- dc.l $0000ff7c,$44fc0000,$48eeffff,$ff804c30
- dc.l $34024210,$42eeff7e,$48eeffff,$ffc02d7c
- dc.l $00000004,$ff8c61ff,$0000292a,$4a0066ff
- dc.l $00002950,$52aeff78,$4cfb3fff,$01700000
- dc.l $294c4282,$760241ee,$ff7478fc,$3d7c0000
- dc.l $ff7c44fc,$000048ee,$ffffff80,$4c303402
- dc.l $441042ee,$ff7e48ee,$ffffffc0,$2d7c0000
- dc.l $0004ff8c,$61ff0000,$28dc4a00,$66ff0000
- dc.l $290252ae,$ff784cfb,$3fff0170,$000028fe
- dc.l $42827602,$41eeff74,$78fe3d7c,$0000ff7c
- dc.l $44fc0000,$48eeffff,$ff804c30,$34024610
- dc.l $42eeff7e,$48eeffff,$ffc02d7c,$00000004
- dc.l $ff8c61ff,$0000288e,$4a0066ff,$000028b4
- dc.l $52aeff78,$4cfb3fff,$01700000,$28b04282
- dc.l $760241ee,$ff7478f0,$3d7c0000,$ff7c44fc
- dc.l $000048ee,$ffffff80,$4c303402,$481042ee
- dc.l $ff7e48ee,$ffffffc0,$2d7c0000,$0004ff8c
- dc.l $61ff0000,$28404a00,$66ff0000,$286652ae
- dc.l $ff784cfb,$3fff0170,$00002862,$42827602
- dc.l $41eeff74,$78f83d7c,$0000ff7c,$44fc0000
- dc.l $48eeffff,$ff804c30,$34024a10,$42eeff7e
- dc.l $48eeffff,$ffc02d7c,$00000004,$ff8c61ff
- dc.l $000027f2,$4a0066ff,$00002818,$52aeff78
- dc.l $4cfb3fff,$01700000,$28144282,$760241ee
- dc.l $ff7478fc,$3d7c0000,$ff7c44fc,$000048ee
- dc.l $ffffff80,$4c303402,$4c1042ee,$ff7e48ee
- dc.l $ffffffc0,$2d7c0000,$0004ff8c,$61ff0000
- dc.l $27a44a00,$66ff0000,$27ca52ae,$ff784cfb
- dc.l $3fff0170,$000027c6,$42827602,$41eeff74
- dc.l $78fe3d7c,$0000ff7c,$44fc0000,$48eeffff
- dc.l $ff804c30,$34024e10,$42eeff7e,$48eeffff
- dc.l $ffc02d7c,$00000004,$ff8c61ff,$00002756
- dc.l $4a0066ff,$0000277c,$52aeff78,$4cfb3fff
- dc.l $01700000,$27784282,$760241ee,$ff74287c
- dc.l $fffffffe,$3d7c0000,$ff7c44fc,$000048ee
- dc.l $ffffff80,$4c303402,$ce1042ee,$ff7e48ee
- dc.l $ffffffc0,$2d7c0000,$0004ff8c,$61ff0000
- dc.l $27044a00,$66ff0000,$272a52ae,$ff784cfb
- dc.l $3fff0170,$00002726,$42827602,$41eeff74
- dc.l $287c0000,$00023d7c,$0000ff7c,$44fc0000
- dc.l $48eeffff,$ff804c30,$3402cef0,$42eeff7e
- dc.l $48eeffff,$ffc02d7c,$00000004,$ff8c61ff
- dc.l $000026b2,$4a0066ff,$000026d8,$52aeff78
- dc.l $4cfb3fff,$01700000,$26d44282,$760243ee
- dc.l $ff7478f0,$3d7c0000,$ff7c44fc,$000048ee
- dc.l $ffffff80,$4c313402,$401042ee,$ff7e48ee
- dc.l $ffffffc0,$2d7c0000,$0004ff8c,$61ff0000
- dc.l $26644a00,$66ff0000,$268a52ae,$ff784cfb
- dc.l $3fff0170,$00002686,$42827602,$45eeff74
- dc.l $78f03d7c,$0000ff7c,$44fc0000,$48eeffff
- dc.l $ff804c32,$34024010,$42eeff7e,$48eeffff
- dc.l $ffc02d7c,$00000004,$ff8c61ff,$00002616
- dc.l $4a0066ff,$0000263c,$52aeff78,$4cfb3fff
- dc.l $01700000,$26384282,$760247ee,$ff7478f0
- dc.l $3d7c0000,$ff7c44fc,$000048ee,$ffffff80
- dc.l $4c333402,$401042ee,$ff7e48ee,$ffffffc0
- dc.l $2d7c0000,$0004ff8c,$61ff0000,$25c84a00
- dc.l $66ff0000,$25ee52ae,$ff784cfb,$3fff0170
- dc.l $000025ea,$42827602,$49eeff74,$78f03d7c
- dc.l $0000ff7c,$44fc0000,$48eeffff,$ff804c34
- dc.l $34024010,$42eeff7e,$48eeffff,$ffc02d7c
- dc.l $00000004,$ff8c61ff,$0000257a,$4a0066ff
- dc.l $000025a0,$52aeff78,$4cfb3fff,$01700000
- dc.l $259c4282,$76024bee,$ff7478f0,$3d7c0000
- dc.l $ff7c44fc,$000048ee,$ffffff80,$4c353402
- dc.l $401042ee,$ff7e48ee,$ffffffc0,$2d7c0000
- dc.l $0004ff8c,$61ff0000,$252c4a00,$66ff0000
- dc.l $255252ae,$ff784cfb,$3fff0170,$0000254e
- dc.l $224e4282,$76024de9,$ff7478f0,$337c0000
- dc.l $ff7c44fc,$000048e9,$ffffff80,$4c363402
- dc.l $401042e9,$ff7e48e9,$ffffffc0,$237c0000
- dc.l $0004ff8c,$2c4961ff,$000024da,$4a0066ff
- dc.l $00002500,$52aeff78,$4cfb3fff,$01700000
- dc.l $24fc4282,$7602204f,$4feeff74,$78f03d7c
- dc.l $0000ff7c,$44fc0000,$48eeffff,$ff804c37
- dc.l $34024010,$42eeff7e,$48eeffff,$ffc02d7c
- dc.l $00000004,$ff8c2e48,$61ff0000,$24884a00
- dc.l $66ff0000,$24ae52ae,$ff784cfb,$3fff0170
- dc.l $000024aa,$42827602,$43eeff74,$3d7c0000
- dc.l $ff7c44fc,$000048ee,$ffffff80,$4c113402
- dc.l $42eeff7e,$48eeffff,$ffc02d7c,$00000004
- dc.l $ff8c61ff,$0000243e,$4a0066ff,$00002464
- dc.l $52aeff78,$4cfb3fff,$01700000,$24604282
- dc.l $760245ee,$ff743d7c,$0000ff7c,$44fc0000
- dc.l $48eeffff,$ff804c12,$340242ee,$ff7e48ee
- dc.l $ffffffc0,$2d7c0000,$0004ff8c,$61ff0000
- dc.l $23f44a00,$66ff0000,$241a52ae,$ff784cfb
- dc.l $3fff0170,$00002416,$42827602,$47eeff74
- dc.l $3d7c0000,$ff7c44fc,$000048ee,$ffffff80
- dc.l $4c133402,$42eeff7e,$48eeffff,$ffc02d7c
- dc.l $00000004,$ff8c61ff,$000023aa,$4a0066ff
- dc.l $000023d0,$52aeff78,$4cfb3fff,$01700000
- dc.l $23cc4282,$760249ee,$ff743d7c,$0000ff7c
- dc.l $44fc0000,$48eeffff,$ff804c14,$340242ee
- dc.l $ff7e48ee,$ffffffc0,$2d7c0000,$0004ff8c
- dc.l $61ff0000,$23604a00,$66ff0000,$238652ae
- dc.l $ff784cfb,$3fff0170,$00002382,$42827602
- dc.l $4beeff74,$3d7c0000,$ff7c44fc,$000048ee
- dc.l $ffffff80,$4c153402,$42eeff7e,$48eeffff
- dc.l $ffc02d7c,$00000004,$ff8c61ff,$00002316
- dc.l $4a0066ff,$0000233c,$52aeff78,$4cfb3fff
- dc.l $01700000,$2338224e,$42827602,$4de9ff74
- dc.l $337c0000,$ff7c44fc,$000048e9,$ffffff80
- dc.l $4c163402,$42e9ff7e,$48e9ffff,$ffc0237c
- dc.l $00000004,$ff8c2c49,$61ff0000,$22c84a00
- dc.l $66ff0000,$22ee52ae,$ff784cfb,$3fff0170
- dc.l $000022ea,$42827602,$204f4fee,$ff743d7c
- dc.l $0000ff7c,$44fc0000,$48eeffff,$ff804c17
- dc.l $340242ee,$ff7e48ee,$ffffffc0,$2d7c0000
- dc.l $0004ff8c,$2e4861ff,$0000227a,$4a0066ff
- dc.l $000022a0,$52aeff78,$4cfb3fff,$01700000
- dc.l $229c4282,$760243ee,$ff743d7c,$0000ff7c
- dc.l $44fc0000,$48eeffff,$ff804c19,$340242ee
- dc.l $ff7e48ee,$ffffffc0,$2d7c0000,$0004ff8c
- dc.l $41eeff78,$2d48ffa4,$61ff0000,$22284a00
- dc.l $66ff0000,$224e52ae,$ff784cfb,$3fff0170
- dc.l $0000224a,$42827602,$45eeff74,$3d7c0000
- dc.l $ff7c44fc,$000048ee,$ffffff80,$4c1a3402
- dc.l $42eeff7e,$48eeffff,$ffc02d7c,$00000004
- dc.l $ff8c41ee,$ff782d48,$ffa861ff,$000021d6
- dc.l $4a0066ff,$000021fc,$52aeff78,$4cfb3fff
- dc.l $01700000,$21f84282,$760247ee,$ff743d7c
- dc.l $0000ff7c,$44fc0000,$48eeffff,$ff804c1b
- dc.l $340242ee,$ff7e48ee,$ffffffc0,$2d7c0000
- dc.l $0004ff8c,$41eeff78,$2d48ffac,$61ff0000
- dc.l $21844a00,$66ff0000,$21aa52ae,$ff784cfb
- dc.l $3fff0170,$000021a6,$42827602,$49eeff74
- dc.l $3d7c0000,$ff7c44fc,$000048ee,$ffffff80
- dc.l $4c1c3402,$42eeff7e,$48eeffff,$ffc02d7c
- dc.l $00000004,$ff8c41ee,$ff782d48,$ffb061ff
- dc.l $00002132,$4a0066ff,$00002158,$52aeff78
- dc.l $4cfb3fff,$01700000,$21544282,$76024bee
- dc.l $ff743d7c,$0000ff7c,$44fc0000,$48eeffff
- dc.l $ff804c1d,$340242ee,$ff7e48ee,$ffffffc0
- dc.l $2d7c0000,$0004ff8c,$41eeff78,$2d48ffb4
- dc.l $61ff0000,$20e04a00,$66ff0000,$210652ae
- dc.l $ff784cfb,$3fff0170,$00002102,$224e4282
- dc.l $76024de9,$ff74337c,$0000ff7c,$44fc0000
- dc.l $48e9ffff,$ff804c1e,$340242e9,$ff7e48e9
- dc.l $ffffffc0,$237c0000,$0004ff8c,$41e9ff78
- dc.l $2348ffb8,$2c4961ff,$0000208a,$4a0066ff
- dc.l $000020b0,$52aeff78,$4cfb3fff,$01700000
- dc.l $20ac4282,$7602204f,$4feeff74,$3d7c0000
- dc.l $ff7c44fc,$000048ee,$ffffff80,$4c1f3402
- dc.l $42eeff7e,$48eeffff,$ffc02d7c,$00000004
- dc.l $ff8c43ee,$ff782d49,$ffbc2e48,$61ff0000
- dc.l $20344a00,$66ff0000,$205a52ae,$ff784cfb
- dc.l $3fff0170,$00002056,$42827602,$43eeef74
- dc.l $3d7c0000,$ff7c44fc,$000048ee,$ffffff80
- dc.l $4c293402,$100042ee,$ff7e48ee,$ffffffc0
- dc.l $2d7c0000,$0004ff8c,$61ff0000,$1fe84a00
- dc.l $66ff0000,$200e52ae,$ff784cfb,$3fff0170
- dc.l $0000200a,$42827602,$45eeef74,$3d7c0000
- dc.l $ff7c44fc,$000048ee,$ffffff80,$4c2a3402
- dc.l $100042ee,$ff7e48ee,$ffffffc0,$2d7c0000
- dc.l $0004ff8c,$61ff0000,$1f9c4a00,$66ff0000
- dc.l $1fc252ae,$ff784cfb,$3fff0170,$00001fbe
- dc.l $42827602,$47eeef74,$3d7c0000,$ff7c44fc
- dc.l $000048ee,$ffffff80,$4c2b3402,$100042ee
- dc.l $ff7e48ee,$ffffffc0,$2d7c0000,$0004ff8c
- dc.l $61ff0000,$1f504a00,$66ff0000,$1f7652ae
- dc.l $ff784cfb,$3fff0170,$00001f72,$42827602
- dc.l $49eeef74,$3d7c0000,$ff7c44fc,$000048ee
- dc.l $ffffff80,$4c2c3402,$100042ee,$ff7e48ee
- dc.l $ffffffc0,$2d7c0000,$0004ff8c,$61ff0000
- dc.l $1f044a00,$66ff0000,$1f2a52ae,$ff784cfb
- dc.l $3fff0170,$00001f26,$42827602,$4beeef74
- dc.l $3d7c0000,$ff7c44fc,$000048ee,$ffffff80
- dc.l $4c2d3402,$100042ee,$ff7e48ee,$ffffffc0
- dc.l $2d7c0000,$0004ff8c,$61ff0000,$1eb84a00
- dc.l $66ff0000,$1ede52ae,$ff784cfb,$3fff0170
- dc.l $00001eda,$224e4282,$76024de9,$ef74337c
- dc.l $0000ff7c,$44fc0000,$48e9ffff,$ff804c2e
- dc.l $34021000,$42e9ff7e,$48e9ffff,$ffc0237c
- dc.l $00000004,$ff8c2c49,$61ff0000,$1e684a00
- dc.l $66ff0000,$1e8e52ae,$ff784cfb,$3fff0170
- dc.l $00001e8a,$42827602,$204f4fee,$ef743d7c
- dc.l $0000ff7c,$44fc0000,$48eeffff,$ff804c2f
- dc.l $34021000,$42eeff7e,$48eeffff,$ffc02d7c
- dc.l $00000004,$ff8c2e48,$61ff0000,$1e184a00
- dc.l $66ff0000,$1e3e52ae,$ff784cfb,$3fff0170
- dc.l $00001e3a,$42827602,$41ee0f74,$3d7c0000
- dc.l $ff7c44fc,$000048ee,$ffffff80,$4c283402
- dc.l $f00042ee,$ff7e48ee,$ffffffc0,$2d7c0000
- dc.l $0004ff8c,$61ff0000,$1dcc4a00,$66ff0000
- dc.l $1df252ae,$ff786004,$00000002,$4cfb3fff
- dc.l $01700000,$1de84282,$76023d7c,$0000ff7c
- dc.l $44fc0000,$48eeffff,$ff804c3a,$3402ffda
- dc.l $42eeff7e,$48eeffff,$ffc02d7c,$00000004
- dc.l $ff8c61ff,$00001d7e,$4a0066ff,$00001da4
- dc.l $52aeff78,$4cfb3fff,$01700000,$1da04282
- dc.l $760247ee,$ff7478f0,$3d7c0000,$ff7c44fc
- dc.l $000048ee,$ffffff80,$4c333402,$401042ee
- dc.l $ff7e48ee,$ffffffc0,$2d7c0000,$0004ff8c
- dc.l $61ff0000,$1d304a00,$66ff0000,$1d5652ae
- dc.l $ff784cfb,$3fff0170,$00001d52,$42827602
- dc.l $47eeff74,$78f83d7c,$0000ff7c,$44fc0000
- dc.l $48eeffff,$ff804c33,$34024210,$42eeff7e
- dc.l $48eeffff,$ffc02d7c,$00000004,$ff8c61ff
- dc.l $00001ce2,$4a0066ff,$00001d08,$52aeff78
- dc.l $4cfb3fff,$01700000,$1d044282,$760247ee
- dc.l $ff7478fc,$3d7c0000,$ff7c44fc,$000048ee
- dc.l $ffffff80,$4c333402,$441042ee,$ff7e48ee
- dc.l $ffffffc0,$2d7c0000,$0004ff8c,$61ff0000
- dc.l $1c944a00,$66ff0000,$1cba52ae,$ff784cfb
- dc.l $3fff0170,$00001cb6,$42827602,$47eeff74
- dc.l $78fe3d7c,$0000ff7c,$44fc0000,$48eeffff
- dc.l $ff804c33,$34024610,$42eeff7e,$48eeffff
- dc.l $ffc02d7c,$00000004,$ff8c61ff,$00001c46
- dc.l $4a0066ff,$00001c6c,$52aeff78,$4cfb3fff
- dc.l $01700000,$1c684282,$760247ee,$ff7478f0
- dc.l $3d7c0000,$ff7c44fc,$000048ee,$ffffff80
- dc.l $4c333402,$481042ee,$ff7e48ee,$ffffffc0
- dc.l $2d7c0000,$0004ff8c,$61ff0000,$1bf84a00
- dc.l $66ff0000,$1c1e52ae,$ff784cfb,$3fff0170
- dc.l $00001c1a,$42827602,$47eeff74,$78f83d7c
- dc.l $0000ff7c,$44fc0000,$48eeffff,$ff804c33
- dc.l $34024a10,$42eeff7e,$48eeffff,$ffc02d7c
- dc.l $00000004,$ff8c61ff,$00001baa,$4a0066ff
- dc.l $00001bd0,$52aeff78,$4cfb3fff,$01700000
- dc.l $1bcc4282,$760247ee,$ff7478fc,$3d7c0000
- dc.l $ff7c44fc,$000048ee,$ffffff80,$4c333402
- dc.l $4c1042ee,$ff7e48ee,$ffffffc0,$2d7c0000
- dc.l $0004ff8c,$61ff0000,$1b5c4a00,$66ff0000
- dc.l $1b8252ae,$ff784cfb,$3fff0170,$00001b7e
- dc.l $42827602,$47eeff74,$78fe3d7c,$0000ff7c
- dc.l $44fc0000,$48eeffff,$ff804c33,$34024e10
- dc.l $42eeff7e,$48eeffff,$ffc02d7c,$00000004
- dc.l $ff8c61ff,$00001b0e,$4a0066ff,$00001b34
- dc.l $52aeff78,$4cfb3fff,$01700000,$1b304282
- dc.l $760247ee,$ff74287c,$00000002,$3d7c0000
- dc.l $ff7c44fc,$000048ee,$ffffff80,$4c333402
- dc.l $cef042ee,$ff7e48ee,$ffffffc0,$2d7c0000
- dc.l $0004ff8c,$61ff0000,$1abc4a00,$66ff0000
- dc.l $1ae252ae,$ff784cfb,$3fff0170,$00001ade
- dc.l $42827602,$47eeff74,$287c0000,$00023d7c
- dc.l $0000ff7c,$44fc0000,$48eeffff,$ff804c33
- dc.l $34020750,$42eeff7e,$48eeffff,$ffc02d7c
- dc.l $00000004,$ff8c61ff,$00001a6a,$4a0066ff
- dc.l $00001a90,$52aeff78,$4cfb3fff,$01700000
- dc.l $1a8c4282,$760247ee,$ff74284b,$d9fc0000
- dc.l $00103d7c,$0000ff7c,$44fc0000,$48eeffff
- dc.l $ff804c30,$3402c9a0,$fff042ee,$ff7e48ee
- dc.l $ffffffc0,$2d7c0000,$0004ff8c,$61ff0000
- dc.l $1a144a00,$66ff0000,$1a3a52ae,$ff784cfb
- dc.l $3fff0170,$00001a36,$42827602,$47eeff74
- dc.l $287c0000,$00023d7c,$0000ff7c,$44fc0000
- dc.l $48eeffff,$ff804c33,$3402cef0,$42eeff7e
- dc.l $48eeffff,$ffc02d7c,$00000004,$ff8c61ff
- dc.l $000019c2,$4a0066ff,$000019e8,$52aeff78
- dc.l $60040000,$00024cfb,$3fff0170,$000019de
- dc.l $42827602,$47eeff74,$78f03d7c,$0000ff7c
- dc.l $44fc0000,$48eeffff,$ff804c3b,$340240e4
- dc.l $42eeff7e,$48eeffff,$ffc02d7c,$00000004
- dc.l $ff8c61ff,$0000196e,$4a0066ff,$00001994
- dc.l $52aeff78,$60040000,$00024cfb,$3fff0170
- dc.l $0000198a,$42827602,$41eeff74,$78f83d7c
- dc.l $0000ff7c,$44fc0000,$48ee7fff,$ff804c3b
- dc.l $340242e4,$42eeff7e,$48ee7fff,$ffc02d7c
- dc.l $00000004,$ff8c61ff,$0000191a,$4a0066ff
- dc.l $00001940,$52aeff78,$60040000,$00024cfb
- dc.l $3fff0170,$00001936,$42827602,$41eeff74
- dc.l $78fc3d7c,$0000ff7c,$44fc0000,$48ee7fff
- dc.l $ff804c3b,$340244e4,$42eeff7e,$48ee7fff
- dc.l $ffc02d7c,$00000004,$ff8c61ff,$000018c6
- dc.l $4a0066ff,$000018ec,$52aeff78,$60040000
- dc.l $00024cfb,$3fff0170,$000018e2,$42827602
- dc.l $41eeff74,$78fe3d7c,$0000ff7c,$44fc0000
- dc.l $48ee7fff,$ff804c3b,$340246e4,$42eeff7e
- dc.l $48ee7fff,$ffc02d7c,$00000004,$ff8c61ff
- dc.l $00001872,$4a0066ff,$00001898,$52aeff78
- dc.l $60040000,$00024cfb,$3fff0170,$0000188e
- dc.l $42827602,$41eeff74,$78f03d7c,$0000ff7c
- dc.l $44fc0000,$48ee7fff,$ff804c3b,$340248e4
- dc.l $42eeff7e,$48ee7fff,$ffc02d7c,$00000004
- dc.l $ff8c61ff,$0000181e,$4a0066ff,$00001844
- dc.l $52aeff78,$60040000,$00024cfb,$3fff0170
- dc.l $0000183a,$42827602,$41eeff74,$78f83d7c
- dc.l $0000ff7c,$44fc0000,$48ee7fff,$ff804c3b
- dc.l $34024ae4,$42eeff7e,$48ee7fff,$ffc02d7c
- dc.l $00000004,$ff8c61ff,$000017ca,$4a0066ff
- dc.l $000017f0,$52aeff78,$60040000,$00024cfb
- dc.l $3fff0170,$000017e6,$42827602,$41eeff74
- dc.l $78fc3d7c,$0000ff7c,$44fc0000,$48ee7fff
- dc.l $ff804c3b,$34024ce4,$42eeff7e,$48ee7fff
- dc.l $ffc02d7c,$00000004,$ff8c61ff,$00001776
- dc.l $4a0066ff,$0000179c,$52aeff78,$60040000
- dc.l $00024cfb,$3fff0170,$00001792,$42827602
- dc.l $41eeff74,$78fe3d7c,$0000ff7c,$44fc0000
- dc.l $48ee7fff,$ff804c3b,$34024ee4,$42eeff7e
- dc.l $48ee7fff,$ffc02d7c,$00000004,$ff8c61ff
- dc.l $00001722,$4a0066ff,$00001748,$52aeff78
- dc.l $60040000,$00024cfb,$3fff0170,$0000173e
- dc.l $42827602,$47eeff74,$287cffff,$fffe3d7c
- dc.l $0000ff7c,$44fc0000,$48eeffff,$ff804c3b
- dc.l $3402cee0,$42eeff7e,$48eeffff,$ffc02d7c
- dc.l $00000004,$ff8c61ff,$000016ca,$4a0066ff
- dc.l $000016f0,$52aeff78,$60040000,$00024cfb
- dc.l $3fff0170,$000016e6,$42827602,$47eeff74
- dc.l $287c0000,$00023d7c,$0000ff7c,$44fc0000
- dc.l $48eeffff,$ff804c3b,$34020760,$ffd042ee
- dc.l $ff7e48ee,$ffffffc0,$2d7c0000,$0004ff8c
- dc.l $61ff0000,$16704a00,$66ff0000,$169652ae
- dc.l $ff7852ae,$ff784cfb,$3fff0170,$0000168e
- dc.l $42827602,$47f9ffff,$ff74287c,$00000002
- dc.l $3d7c0000,$ff7c44fc,$000048ee,$ffffff80
- dc.l $4c3b3402,$cf300000,$000a42ee,$ff7e48ee
- dc.l $ffffffc0,$2d7c0000,$0004ff8c,$60040000
- dc.l $000261ff,$0000160e,$4a0066ff,$00001634
- dc.l $52aeff78,$60040000,$00024cfb,$3fff0170
- dc.l $0000162a,$42827602,$43eeff74,$78f03d7c
- dc.l $0000ff7c,$44fc0000,$48eeffff,$ff804c3b
- dc.l $340240e4,$42eeff7e,$48eeffff,$ffc02d7c
- dc.l $00000004,$ff8c61ff,$000015ba,$4a0066ff
- dc.l $000015e0,$52aeff78,$60040000,$00024cfb
- dc.l $3fff0170,$000015d6,$42827602,$41eeff74
- dc.l $78f83d7c,$0000ff7c,$44fc0000,$48eeffff
- dc.l $ff804c3b,$340242e4,$42eeff7e,$48eeffff
- dc.l $ffc02d7c,$00000004,$ff8c61ff,$00001566
- dc.l $4a0066ff,$0000158c,$52aeff78,$60040000
- dc.l $00024cfb,$3fff0170,$00001582,$42827602
- dc.l $41eeff74,$78fc3d7c,$0000ff7c,$44fc0000
- dc.l $48eeffff,$ff804c3b,$340244e4,$42eeff7e
- dc.l $48eeffff,$ffc02d7c,$00000004,$ff8c61ff
- dc.l $00001512,$4a0066ff,$00001538,$52aeff78
- dc.l $60040000,$00024cfb,$3fff0170,$0000152e
- dc.l $42827602,$41eeff74,$78fe3d7c,$0000ff7c
- dc.l $44fc0000,$48eeffff,$ff804c3b,$340246e4
- dc.l $42eeff7e,$48eeffff,$ffc02d7c,$00000004
- dc.l $ff8c61ff,$000014be,$4a0066ff,$000014e4
- dc.l $52aeff78,$60040000,$00024cfb,$3fff0170
- dc.l $000014da,$42827602,$41eeff74,$78f03d7c
- dc.l $0000ff7c,$44fc0000,$48eeffff,$ff804c3b
- dc.l $340248e4,$42eeff7e,$48eeffff,$ffc02d7c
- dc.l $00000004,$ff8c61ff,$0000146a,$4a0066ff
- dc.l $00001490,$52aeff78,$60040000,$00024cfb
- dc.l $3fff0170,$00001486,$42827602,$41eeff74
- dc.l $78f83d7c,$0000ff7c,$44fc0000,$48eeffff
- dc.l $ff804c3b,$34024ae4,$42eeff7e,$48eeffff
- dc.l $ffc02d7c,$00000004,$ff8c61ff,$00001416
- dc.l $4a0066ff,$0000143c,$52aeff78,$60040000
- dc.l $00024cfb,$3fff0170,$00001432,$42827602
- dc.l $41eeff74,$78fc3d7c,$0000ff7c,$44fc0000
- dc.l $48eeffff,$ff804c3b,$34024ce4,$42eeff7e
- dc.l $48eeffff,$ffc02d7c,$00000004,$ff8c61ff
- dc.l $000013c2,$4a0066ff,$000013e8,$52aeff78
- dc.l $60040000,$00024cfb,$3fff0170,$000013de
- dc.l $42827602,$41eeff74,$78fe3d7c,$0000ff7c
- dc.l $44fc0000,$48eeffff,$ff804c3b,$34024ee4
- dc.l $42eeff7e,$48eeffff,$ffc02d7c,$00000004
- dc.l $ff8c61ff,$0000136e,$4a0066ff,$00001394
- dc.l $52aeff78,$4cfb3fff,$01700000,$13904282
- dc.l $760241ee,$ff7478fe,$3d7c0000,$ff7c44fc
- dc.l $000048ee,$ffffff80,$4c3b3402,$4e2642ee
- dc.l $ff7e48ee,$ffffffc0,$2d7c0000,$0004ff8c
- dc.l $60040000,$000261ff,$0000131a,$4a0066ff
- dc.l $00001340,$52aeff78,$4cfb3fff,$01700000
- dc.l $133c4282,$760247ee,$ef7449ee,$ff70288b
- dc.l $78f03d7c,$0000ff7c,$44fc0000,$48eeffff
- dc.l $ff804c34,$34024122,$00101000,$42eeff7e
- dc.l $48eeffff,$ffc02d7c,$00000004,$ff8c61ff
- dc.l $000012c2,$4a0066ff,$000012e8,$52aeff78
- dc.l $4cfb3fff,$01700000,$12e44282,$760247ee
- dc.l $ef7449ee,$ff70288b,$78f83d7c,$0000ff7c
- dc.l $44fc0000,$48eeffff,$ff804c34,$34024322
- dc.l $00101000,$42eeff7e,$48eeffff,$ffc02d7c
- dc.l $00000004,$ff8c61ff,$0000126a,$4a0066ff
- dc.l $00001290,$52aeff78,$4cfb3fff,$01700000
- dc.l $128c4282,$760247ee,$ef7449ee,$ff70288b
- dc.l $78fc3d7c,$0000ff7c,$44fc0000,$48eeffff
- dc.l $ff804c34,$34024522,$00101000,$42eeff7e
- dc.l $48eeffff,$ffc02d7c,$00000004,$ff8c61ff
- dc.l $00001212,$4a0066ff,$00001238,$52aeff78
- dc.l $4cfb3fff,$01700000,$12344282,$760247ee
- dc.l $ef7449ee,$ff70288b,$78fe3d7c,$0000ff7c
- dc.l $44fc0000,$48eeffff,$ff804c34,$34024722
- dc.l $00101000,$42eeff7e,$48eeffff,$ffc02d7c
- dc.l $00000004,$ff8c61ff,$000011ba,$4a0066ff
- dc.l $000011e0,$52aeff78,$4cfb3fff,$01700000
- dc.l $11dc4282,$760247ee,$ef7449ee,$ff70288b
- dc.l $78f03d7c,$0000ff7c,$44fc0000,$48eeffff
- dc.l $ff804c34,$34024922,$00101000,$42eeff7e
- dc.l $48eeffff,$ffc02d7c,$00000004,$ff8c61ff
- dc.l $00001162,$4a0066ff,$00001188,$52aeff78
- dc.l $4cfb3fff,$01700000,$11844282,$760247ee
- dc.l $ef7449ee,$ff70288b,$78f83d7c,$0000ff7c
- dc.l $44fc0000,$48eeffff,$ff804c34,$34024b22
- dc.l $00101000,$42eeff7e,$48eeffff,$ffc02d7c
- dc.l $00000004,$ff8c61ff,$0000110a,$4a0066ff
- dc.l $00001130,$52aeff78,$4cfb3fff,$01700000
- dc.l $112c4282,$760247ee,$ef7449ee,$ff70288b
- dc.l $78fc3d7c,$0000ff7c,$44fc0000,$48eeffff
- dc.l $ff804c34,$34024d22,$00101000,$42eeff7e
- dc.l $48eeffff,$ffc02d7c,$00000004,$ff8c61ff
- dc.l $000010b2,$4a0066ff,$000010d8,$52aeff78
- dc.l $4cfb3fff,$01700000,$10d44282,$760247ee
- dc.l $ef7449ee,$ff70288b,$78fe3d7c,$0000ff7c
- dc.l $44fc0000,$48eeffff,$ff804c34,$34024f22
- dc.l $00101000,$42eeff7e,$48eeffff,$ffc02d7c
- dc.l $00000004,$ff8c61ff,$0000105a,$4a0066ff
- dc.l $00001080,$52aeff78,$4cfb3fff,$01700000
- dc.l $107c4282,$760247ee,$ef7449ee,$ff70288b
- dc.l $78fe3d7c,$0000ff7c,$44fc0000,$48eeffff
- dc.l $ff804c34,$34024f33,$00000010,$00001000
- dc.l $42eeff7e,$48eeffff,$ffc02d7c,$00000004
- dc.l $ff8c61ff,$00000ffe,$4a0066ff,$00001024
- dc.l $52aeff78,$4cfb3fff,$01700000,$10204282
- dc.l $760247ee,$ef7449ee,$ff70288b,$78fe3d7c
- dc.l $0000ff7c,$44fc0000,$48eeffff,$ff804c34
- dc.l $34020753,$00001000,$42eeff7e,$48eeffff
- dc.l $ffc02d7c,$00000004,$ff8c61ff,$00000fa6
- dc.l $4a0066ff,$00000fcc,$52aeff78,$4cfb3fff
- dc.l $01700000,$0fc84282,$760247ee,$ef7449ee
- dc.l $ff70288b,$78fe3d7c,$0000ff7c,$44fc0000
- dc.l $48eeffff,$ff804c34,$34020753,$00001000
- dc.l $42eeff7e,$48eeffff,$ffc02d7c,$00000004
- dc.l $ff8c61ff,$00000f4e,$4a0066ff,$00000f74
- dc.l $52aeff78,$4cfb3fff,$01700000,$0f704282
- dc.l $760247ee,$ef7449ee,$ff70288b,$78f0d88c
- dc.l $3d7c0000,$ff7c44fc,$000048ee,$ffffff80
- dc.l $4c303402,$49b30000,$00100000,$100042ee
- dc.l $ff7e48ee,$ffffffc0,$2d7c0000,$0004ff8c
- dc.l $61ff0000,$0ef04a00,$66ff0000,$0f1652ae
- dc.l $ff7852ae,$ff784cfb,$3fff0170,$00000f0e
- dc.l $224e4282,$760247e9,$0f7449e9,$ff70288b
- dc.l $2c7cffff,$fffe337c,$0000ff7c,$44fc0000
- dc.l $48e9ffff,$ff804c34,$3402ef22,$0010f000
- dc.l $42e9ff7e,$48e9ffff,$ffc0237c,$00000004
- dc.l $ff8c2c49,$61ff0000,$0e8c4a00,$66ff0000
- dc.l $0eb252ae,$ff784cfb,$3fff0170,$00000eae
- dc.l $224e4282,$760247e9,$0f7449e9,$ff70288b
- dc.l $2c7c0000,$0002337c,$0000ff7c,$44fc0000
- dc.l $48e9ffff,$ff804c34,$3402ef22,$fff0f000
- dc.l $42e9ff7e,$48e9ffff,$ffc0237c,$00000004
- dc.l $ff8c2c49,$61ff0000,$0e2c4a00,$66ff0000
- dc.l $0e5252ae,$ff784cfb,$3fff0170,$00000e4e
- dc.l $42827602,$47eeff54,$49eeff70,$288b99fc
- dc.l $00000010,$78103d7c,$0000ff7c,$44fc0000
- dc.l $48eeffff,$ff804c34,$34024126,$00100010
- dc.l $42eeff7e,$48eeffff,$ffc02d7c,$00000004
- dc.l $ff8c61ff,$00000dce,$4a0066ff,$00000df4
- dc.l $52aeff78,$4cfb3fff,$01700000,$0df04282
- dc.l $760247ee,$ff5449ee,$ff70288b,$99fc0000
- dc.l $00107808,$3d7c0000,$ff7c44fc,$000048ee
- dc.l $ffffff80,$4c343402,$43260010,$001042ee
- dc.l $ff7e48ee,$ffffffc0,$2d7c0000,$0004ff8c
- dc.l $61ff0000,$0d704a00,$66ff0000,$0d9652ae
- dc.l $ff784cfb,$3fff0170,$00000d92,$42827602
- dc.l $47eeff54,$49eeff70,$288b99fc,$00000010
- dc.l $78043d7c,$0000ff7c,$44fc0000,$48eeffff
- dc.l $ff804c34,$34024526,$00100010,$42eeff7e
- dc.l $48eeffff,$ffc02d7c,$00000004,$ff8c61ff
- dc.l $00000d12,$4a0066ff,$00000d38,$52aeff78
- dc.l $4cfb3fff,$01700000,$0d344282,$760247ee
- dc.l $ff5449ee,$ff70288b,$99fc0000,$00107802
- dc.l $3d7c0000,$ff7c44fc,$000048ee,$ffffff80
- dc.l $4c343402,$47260010,$001042ee,$ff7e48ee
- dc.l $ffffffc0,$2d7c0000,$0004ff8c,$61ff0000
- dc.l $0cb44a00,$66ff0000,$0cda52ae,$ff784cfb
- dc.l $3fff0170,$00000cd6,$42827602,$47eeff54
- dc.l $49eeff70,$288b99fc,$00000010,$78103d7c
- dc.l $0000ff7c,$44fc0000,$48eeffff,$ff804c34
- dc.l $34024926,$00100010,$42eeff7e,$48eeffff
- dc.l $ffc02d7c,$00000004,$ff8c61ff,$00000c56
- dc.l $4a0066ff,$00000c7c,$52aeff78,$4cfb3fff
- dc.l $01700000,$0c784282,$760247ee,$ff5449ee
- dc.l $ff70288b,$99fc0000,$00107808,$3d7c0000
- dc.l $ff7c44fc,$000048ee,$ffffff80,$4c343402
- dc.l $43260010,$001042ee,$ff7e48ee,$ffffffc0
- dc.l $2d7c0000,$0004ff8c,$61ff0000,$0bf84a00
- dc.l $66ff0000,$0c1e52ae,$ff784cfb,$3fff0170
- dc.l $00000c1a,$42827602,$47eeff54,$49eeff70
- dc.l $288b99fc,$00000010,$78043d7c,$0000ff7c
- dc.l $44fc0000,$48eeffff,$ff804c34,$34024d26
- dc.l $00100010,$42eeff7e,$48eeffff,$ffc02d7c
- dc.l $00000004,$ff8c61ff,$00000b9a,$4a0066ff
- dc.l $00000bc0,$52aeff78,$4cfb3fff,$01700000
- dc.l $0bbc4282,$760247ee,$ff5449ee,$ff70288b
- dc.l $99fc0000,$00107802,$3d7c0000,$ff7c44fc
- dc.l $000048ee,$ffffff80,$4c343402,$4f260010
- dc.l $001042ee,$ff7e48ee,$ffffffc0,$2d7c0000
- dc.l $0004ff8c,$61ff0000,$0b3c4a00,$66ff0000
- dc.l $0b6252ae,$ff784cfb,$3fff0170,$00000b5e
- dc.l $42827602,$47eeff54,$49eeff70,$288b99fc
- dc.l $00000010,$78023d7c,$0000ff7c,$44fc0000
- dc.l $48eeffff,$ff804c34,$34024f37,$00000010
- dc.l $00000010,$42eeff7e,$48eeffff,$ffc02d7c
- dc.l $00000004,$ff8c61ff,$00000ada,$4a0066ff
- dc.l $00000b00,$52aeff78,$4cfb3fff,$01700000
- dc.l $0afc4282,$760247ee,$ff5449ee,$ff70288b
- dc.l $78023d7c,$0000ff7c,$44fc0000,$48eeffff
- dc.l $ff804c34,$34020753,$00000020,$42eeff7e
- dc.l $48eeffff,$ffc02d7c,$00000004,$ff8c61ff
- dc.l $00000a82,$4a0066ff,$00000aa8,$52aeff78
- dc.l $4cfb3fff,$01700000,$0aa4204f,$42827602
- dc.l $47eeff54,$4feeff70,$2e8b7820,$3d7c0000
- dc.l $ff7c44fc,$000048ee,$ffffff80,$4c373402
- dc.l $491542ee,$ff7e48ee,$ffffffc0,$2d7c0000
- dc.l $0004ff8c,$2e4861ff,$00000a2a,$4a0066ff
- dc.l $00000a50,$52aeff78,$52aeff78,$4cfb3fff
- dc.l $01700000,$0a48224e,$42827602,$47e9ff74
- dc.l $4de9ff70,$2c8bddfc,$00000010,$2a7cffff
- dc.l $fffe337c,$0000ff7c,$44fc0000,$48e9ffff
- dc.l $ff804c36,$3402df27,$fff00000,$001042e9
- dc.l $ff7e48e9,$ffffffc0,$237c0000,$0004ff8c
- dc.l $2c4961ff,$000009be,$4a0066ff,$000009e4
- dc.l $222eff78,$42804e75,$52aeff78,$4cfb3fff
- dc.l $01700000,$09d84282,$760247fa,$ef7449fa
- dc.l $ff70288b,$78f03d7c,$0000ff7c,$44fc0000
- dc.l $48eeffff,$ff804c3b,$34024122,$ff801000
- dc.l $42eeff7e,$48eeffff,$ffc02d7c,$00000004
- dc.l $ff8c61ff,$0000095e,$4a0066ff,$00000984
- dc.l $52aeff78,$4cfb3fff,$01700000,$09804282
- dc.l $760247fa,$ef7449fa,$ff70288b,$78f83d7c
- dc.l $0000ff7c,$44fc0000,$48eeffff,$ff804c3b
- dc.l $34024322,$ff801000,$42eeff7e,$48eeffff
- dc.l $ffc02d7c,$00000004,$ff8c61ff,$00000906
- dc.l $4a0066ff,$0000092c,$52aeff78,$4cfb3fff
- dc.l $01700000,$09284282,$760247fa,$ef7449fa
- dc.l $ff70288b,$78fc3d7c,$0000ff7c,$44fc0000
- dc.l $48eeffff,$ff804c3b,$34024522,$ff801000
- dc.l $42eeff7e,$48eeffff,$ffc02d7c,$00000004
- dc.l $ff8c61ff,$000008ae,$4a0066ff,$000008d4
- dc.l $52aeff78,$4cfb3fff,$01700000,$08d04282
- dc.l $760247fa,$ef7449fa,$ff70288b,$78fe3d7c
- dc.l $0000ff7c,$44fc0000,$48eeffff,$ff804c3b
- dc.l $34024722,$ff801000,$42eeff7e,$48eeffff
- dc.l $ffc02d7c,$00000004,$ff8c61ff,$00000856
- dc.l $4a0066ff,$0000087c,$52aeff78,$4cfb3fff
- dc.l $01700000,$08784282,$760247fa,$ef7449fa
- dc.l $ff70288b,$78f03d7c,$0000ff7c,$44fc0000
- dc.l $48eeffff,$ff804c3b,$34024922,$ff801000
- dc.l $42eeff7e,$48eeffff,$ffc02d7c,$00000004
- dc.l $ff8c61ff,$000007fe,$4a0066ff,$00000824
- dc.l $52aeff78,$4cfb3fff,$01700000,$08204282
- dc.l $760247fa,$ef7449fa,$ff70288b,$78f83d7c
- dc.l $0000ff7c,$44fc0000,$48eeffff,$ff804c3b
- dc.l $34024b22,$ff801000,$42eeff7e,$48eeffff
- dc.l $ffc02d7c,$00000004,$ff8c61ff,$000007a6
- dc.l $4a0066ff,$000007cc,$52aeff78,$4cfb3fff
- dc.l $01700000,$07c84282,$760247fa,$ef7449fa
- dc.l $ff70288b,$78fc3d7c,$0000ff7c,$44fc0000
- dc.l $48eeffff,$ff804c3b,$34024d22,$ff801000
- dc.l $42eeff7e,$48eeffff,$ffc02d7c,$00000004
- dc.l $ff8c61ff,$0000074e,$4a0066ff,$00000774
- dc.l $52aeff78,$4cfb3fff,$01700000,$07704282
- dc.l $760247fa,$ef7449fa,$ff70288b,$78fe3d7c
- dc.l $0000ff7c,$44fc0000,$48eeffff,$ff804c3b
- dc.l $34024f22,$ff801000,$42eeff7e,$48eeffff
- dc.l $ffc02d7c,$00000004,$ff8c61ff,$000006f6
- dc.l $4a0066ff,$0000071c,$52aeff78,$4cfb3fff
- dc.l $01700000,$07184282,$760247fa,$ef7449fa
- dc.l $ff70288b,$78fe3d7c,$0000ff7c,$44fc0000
- dc.l $48eeffff,$ff804c3b,$34024f33,$ffffff80
- dc.l $00001000,$42eeff7e,$48eeffff,$ffc02d7c
- dc.l $00000004,$ff8c61ff,$0000069a,$4a0066ff
- dc.l $000006c0,$52aeff78,$4cfb3fff,$01700000
- dc.l $06bc4282,$760247fa,$ef7449fa,$ff70288b
- dc.l $78fe3d7c,$0000ff7c,$44fc0000,$48eeffff
- dc.l $ff804c3b,$34020773,$ffffff70,$00001000
- dc.l $42eeff7e,$48eeffff,$ffc02d7c,$00000004
- dc.l $ff8c61ff,$0000063e,$4a0066ff,$00000664
- dc.l $52aeff78,$4cfb3fff,$01700000,$06604282
- dc.l $760247fa,$ef7449fa,$ff70288b,$280c3d7c
- dc.l $0000ff7c,$44fc0000,$48eeffff,$ff804c30
- dc.l $34024993,$00001000,$42eeff7e,$48eeffff
- dc.l $ffc02d7c,$00000004,$ff8c61ff,$000005e6
- dc.l $4a0066ff,$0000060c,$52aeff78,$4cfb3fff
- dc.l $01700000,$06084282,$760247fa,$ef7449fa
- dc.l $ff70288b,$78f0d88c,$3d7c0000,$ff7c44fc
- dc.l $000048ee,$ffffff80,$4c303402,$49b30000
- dc.l $00100000,$100042ee,$ff7e48ee,$ffffffc0
- dc.l $2d7c0000,$0004ff8c,$61ff0000,$05884a00
- dc.l $66ff0000,$05ae52ae,$ff784282,$760247fa
- dc.l $ff7449fa,$ff70288b,$78f03d7c,$0000ff7c
- dc.l $44fc0000,$48eeffff,$ff804c30,$340201f1
- dc.l $ffffff70,$42eeff7e,$48eeffff,$ffc02d7c
- dc.l $00000004,$ff8c61ff,$0000053a,$4a0066ff
- dc.l $00000560,$52aeff78,$4cfb3fff,$01700000
- dc.l $055c4282,$760247fa,$0f7449fa,$ff70288b
- dc.l $2c7c0000,$00023d7c,$0000ff7c,$44fc0000
- dc.l $48eeffff,$ff804c3b,$3402ef22,$ff60f000
- dc.l $42eeff7e,$48eeffff,$ffc02d7c,$00000004
- dc.l $ff8c61ff,$000004de,$4a0066ff,$00000504
- dc.l $52aeff78,$4cfb3fff,$01700000,$0500204f
- dc.l $42827602,$47fa0f74,$49faff70,$288b2e7c
- dc.l $00000002,$3d7c0000,$ff7c44fc,$000048ee
- dc.l $ffffff80,$4c3b3402,$ff22ff60,$f00042ee
- dc.l $ff7e48ee,$ffffffc0,$2d7c0000,$0004ff8c
- dc.l $2e4861ff,$0000047e,$4a0066ff,$000004a4
- dc.l $52aeff78,$4cfb3fff,$01700000,$04a04282
- dc.l $760247fa,$ff5449fa,$ff70288b,$99fc0000
- dc.l $00107810,$3d7c0000,$ff7c44fc,$000048ee
- dc.l $ffffff80,$4c3b3402,$4126ff70,$001042ee
- dc.l $ff7e48ee,$ffffffc0,$2d7c0000,$0004ff8c
- dc.l $61ff0000,$04204a00,$66ff0000,$044652ae
- dc.l $ff784cfb,$3fff0170,$00000442,$42827602
- dc.l $47faff54,$49faff70,$288b99fc,$00000010
- dc.l $78083d7c,$0000ff7c,$44fc0000,$48eeffff
- dc.l $ff804c3b,$34024326,$ff700010,$42eeff7e
- dc.l $48eeffff,$ffc02d7c,$00000004,$ff8c61ff
- dc.l $000003c2,$4a0066ff,$000003e8,$52aeff78
- dc.l $4cfb3fff,$01700000,$03e44282,$760247fa
- dc.l $ff5449fa,$ff70288b,$99fc0000,$00107804
- dc.l $3d7c0000,$ff7c44fc,$000048ee,$ffffff80
- dc.l $4c3b3402,$4526ff70,$001042ee,$ff7e48ee
- dc.l $ffffffc0,$2d7c0000,$0004ff8c,$61ff0000
- dc.l $03644a00,$66ff0000,$038a52ae,$ff784cfb
- dc.l $3fff0170,$00000386,$42827602,$47faff54
- dc.l $49faff70,$288b99fc,$00000010,$78023d7c
- dc.l $0000ff7c,$44fc0000,$48eeffff,$ff804c3b
- dc.l $34024726,$ff700010,$42eeff7e,$48eeffff
- dc.l $ffc02d7c,$00000004,$ff8c61ff,$00000306
- dc.l $4a0066ff,$0000032c,$52aeff78,$4cfb3fff
- dc.l $01700000,$03284282,$760247fa,$ff5449fa
- dc.l $ff70288b,$99fc0000,$00107810,$3d7c0000
- dc.l $ff7c44fc,$000048ee,$ffffff80,$4c3b3402
- dc.l $4926ff70,$001042ee,$ff7e48ee,$ffffffc0
- dc.l $2d7c0000,$0004ff8c,$61ff0000,$02a84a00
- dc.l $66ff0000,$02ce52ae,$ff784cfb,$3fff0170
- dc.l $000002ca,$42827602,$47faff54,$49faff70
- dc.l $288b99fc,$00000010,$78083d7c,$0000ff7c
- dc.l $44fc0000,$48eeffff,$ff804c3b,$34024326
- dc.l $ff700010,$42eeff7e,$48eeffff,$ffc02d7c
- dc.l $00000004,$ff8c61ff,$0000024a,$4a0066ff
- dc.l $00000270,$52aeff78,$4cfb3fff,$01700000
- dc.l $026c4282,$760247fa,$ff5449fa,$ff70288b
- dc.l $99fc0000,$00107804,$3d7c0000,$ff7c44fc
- dc.l $000048ee,$ffffff80,$4c3b3402,$4d26ff70
- dc.l $001042ee,$ff7e48ee,$ffffffc0,$2d7c0000
- dc.l $0004ff8c,$61ff0000,$01ec4a00,$66ff0000
- dc.l $021252ae,$ff784cfb,$3fff0170,$0000020e
- dc.l $42827602,$47faff54,$49faff70,$288b99fc
- dc.l $00000010,$78023d7c,$0000ff7c,$44fc0000
- dc.l $48eeffff,$ff804c3b,$34024f26,$ff700010
- dc.l $42eeff7e,$48eeffff,$ffc02d7c,$00000004
- dc.l $ff8c61ff,$0000018e,$4a0066ff,$000001b4
- dc.l $52aeff78,$4cfb3fff,$01700000,$01b04282
- dc.l $760247fa,$ff5449fa,$ff70288b,$99fc0000
- dc.l $00107802,$3d7c0000,$ff7c44fc,$000048ee
- dc.l $ffffff80,$4c3b3402,$4f37ffff,$ff700000
- dc.l $001042ee,$ff7e48ee,$ffffffc0,$2d7c0000
- dc.l $0004ff8c,$61ff0000,$012c4a00,$66ff0000
- dc.l $015252ae,$ff784cfb,$3fff0170,$0000014e
- dc.l $42827602,$47faff54,$49faff70,$288b7802
- dc.l $3d7c0000,$ff7c44fc,$000048ee,$ffffff80
- dc.l $4c3b3402,$0773ffff,$ff700000,$002042ee
- dc.l $ff7e48ee,$ffffffc0,$2d7c0000,$0004ff8c
- dc.l $61ff0000,$00d04a00,$66ff0000,$00f652ae
- dc.l $ff784cfb,$3fff0170,$000000f2,$42827602
- dc.l $47faff54,$49faff70,$288b7804,$3d7c0000
- dc.l $ff7c44fc,$000048ee,$ffffff80,$4c303402
- dc.l $4fb5ffff,$ff7042ee,$ff7e48ee,$ffffffc0
- dc.l $2d7c0000,$0004ff8c,$61ff0000,$00784a00
- dc.l $66ff0000,$009e52ae,$ff784cfb,$3fff0170
- dc.l $0000009a,$204f4282,$760247fa,$ff744dfa
- dc.l $ff702c8b,$ddfc0000,$00102e7c,$fffffffe
- dc.l $3d7c0000,$ff7c44fc,$000048ee,$ffffff80
- dc.l $4c3b3402,$ff27ff70,$00000010,$42eeff7e
- dc.l $48eeffff,$ffc02d7c,$00000004,$ff8c2e48
- dc.l $61ff0000,$00104a00,$66ff0000,$00364280
- dc.l $4e7541ee,$ff8043ee,$ffc0700e,$b18966ff
- dc.l $0000001c,$51c8fff6,$302eff7c,$322eff7e
- dc.l $b04166ff,$00000008,$42804e75,$70014e75
- dc.l $222eff78,$70014e75,$acacacac,$acacacac
- dc.l $acacacac,$acacacac,$acacacac,$acacacac
- dc.l $acacacac,$acacacac,$acacacac,$acacacac
- dc.l $acacacac,$acacacac,$acacacac,$acacacac
- dc.l $acacacac,$acacacac,$2f00203a,$afa4487b
- dc.l $0930ffff,$afa0202f,$00044e74,$00042f00
- dc.l $203aaf92,$487b0930,$ffffaf8a,$202f0004
- dc.l $4e740004,$00000000,$00000000,$00000000
diff --git a/sys/arch/m68k/060sp/misc b/sys/arch/m68k/060sp/misc
deleted file mode 100644
index 2fd39ca1743..00000000000
--- a/sys/arch/m68k/060sp/misc
+++ /dev/null
@@ -1,211 +0,0 @@
-#
-# $OpenBSD: misc,v 1.2 1996/05/30 22:15:00 niklas Exp $
-# $NetBSD: misc,v 1.2 1996/05/15 19:49:04 is Exp $
-#
-
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-# M68000 Hi-Performance Microprocessor Division
-# M68060 Software Package Production Release
-#
-# M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
-# All rights reserved.
-#
-# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-# To the maximum extent permitted by applicable law,
-# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
-# FOR A PARTICULAR PURPOSE and any warranty against infringement with
-# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-# and any accompanying written materials.
-#
-# To the maximum extent permitted by applicable law,
-# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
-# BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
-# ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
-#
-# Motorola assumes no responsibility for the maintenance and support
-# of the SOFTWARE.
-#
-# You are hereby granted a copyright license to use, modify, and distribute the
-# SOFTWARE so long as this entire notice is retained without alteration
-# in any modified and/or redistributed versions, and that such modified
-# versions are clearly identified as such.
-# No licenses are granted by implication, estoppel or otherwise under any
-# patents or trademarks of Motorola, Inc.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-RELEASE FILE VERSIONS:
------------------------
-
-fpsp.sa
-----------
-freal.s : 2.4
-hdr.fpu : 2.4
-x_fovfl.s : 2.16
-x_funfl.s : 2.19
-x_funsupp.s : 2.27
-x_effadd.s : 2.21
-x_foperr.s : 2.9
-x_fsnan.s : 2.12
-x_finex.s : 2.14
-x_fdz.s : 2.5
-x_fline.s : 2.5
-x_funimp.s : 2.27
-fsin.s : 2.6
-ftan.s : 2.6
-fatan.s : 2.3
-fasin.s : 2.3
-facos.s : 2.5
-fetox.s : 2.4
-fgetem.s : 2.5
-fcosh.s : 2.4
-fsinh.s : 2.5
-ftanh.s : 2.3
-flogn.s : 2.6
-fatanh.s : 2.4
-flog2.s : 2.4
-ftwotox.s : 2.4
-fmovecr.s : 2.5
-fscale.s : 2.5
-frem_mod.s : 2.6
-fkern.s : 2.6
-fkern2.s : 2.5
-fgen_except.s: 2.7
-foptbl.s : 2.3
-fmul.s : 2.5
-fin.s : 2.4
-fdiv.s : 2.5
-fneg.s : 2.4
-ftst.s : 2.3
-fint.s : 2.3
-fintrz.s : 2.3
-fabs.s : 2.4
-fcmp.s : 2.4
-fsglmul.s : 2.5
-fsgldiv.s : 2.8
-fadd.s : 2.6
-fsub.s : 2.6
-fsqrt.s : 2.4
-fmisc.s : 2.3
-fdbcc.s : 2.8
-ftrapcc.s : 2.5
-fscc.s : 2.6
-fmovm.s : 2.15
-fctrl.s : 2.6
-fcalc_ea.s : 2.7
-fmem.s : 2.9
-fout.s : 2.9
-ireg.s : 2.6
-fdenorm.s : 2.3
-fround.s : 2.4
-fnorm.s : 2.3
-foptag_set.s: 2.4
-fresult.s : 2.3
-fpack.s : 2.6
-fdecbin.s : 2.4
-fbindec.s : 2.5
-fbinstr.s : 2.3
-faccess.s : 2.3
-
-pfpsp.sa
-----------
-freal.s : 2.4
-hdr.fpu : 2.4
-x_fovfl.s : 2.16
-x_funfl.s : 2.19
-x_funsupp.s : 2.27
-x_effadd.s : 2.21
-x_foperr.s : 2.9
-x_fsnan.s : 2.12
-x_finex.s : 2.14
-x_fdz.s : 2.5
-x_fline2.s : 2.3
-fcalc_ea.s : 2.7
-foptbl2.s : 2.4
-fmovm.s : 2.15
-fctrl.s : 2.6
-fmisc.s : 2.3
-fdenorm.s : 2.3
-fround.s : 2.4
-fnorm.s : 2.3
-foptag_set.s: 2.4
-fresult.s : 2.3
-fout.s : 2.9
-fmul.s : 2.5
-fin.s : 2.4
-fdiv.s : 2.5
-fneg.s : 2.4
-ftst.s : 2.3
-fint.s : 2.3
-fintrz.s : 2.3
-fabs.s : 2.4
-fcmp.s : 2.4
-fsglmul.s : 2.5
-fsgldiv.s : 2.8
-fadd.s : 2.6
-fsub.s : 2.6
-fsqrt.s : 2.4
-ireg.s : 2.6
-fpack.s : 2.6
-fdecbin.s : 2.4
-fbindec.s : 2.5
-fbinstr.s : 2.3
-faccess.s : 2.3
-
-fplsp.sa
-----------
-lfptop.s : 2.3
-hdr.fpu : 2.4
-fsin.s : 2.6
-ftan.s : 2.6
-fatan.s : 2.3
-fasin.s : 2.3
-facos.s : 2.5
-fetox.s : 2.4
-fgetem.s : 2.5
-fcosh.s : 2.4
-fsinh.s : 2.5
-ftanh.s : 2.3
-flogn.s : 2.6
-fatanh.s : 2.4
-flog2.s : 2.4
-ftwotox.s : 2.4
-fscale.s : 2.5
-frem_mod.s : 2.6
-l_support.s : 2.15
-fnorm.s : 2.3
-
-isp.sa
-----------
-ireal.s : 2.4
-hdr.int : 2.4
-x_uieh.s : 2.13
-icalc_ea.s : 2.11
-imovep.s : 2.8
-ichk2cmp2.s : 2.6
-idiv64.s : 2.10
-imul64.s :
-icas2.s : 2.11
-icas.s : 2.12
-icas2_core.s: 2.6
-icas_core.s : 2.6
-
-ilsp.sa
-----------
-litop.s : 2.2
-l_idiv64.s : 2.8
-l_imul64.s : 2.6
-l_ichk2cmp2.s: 2.5
-
-ex. files
-----------
-wrk/fskeleton.s: 2.2
-wrk/iskeleton.s: 2.2
-wrk/os.s : 2.1
-
-tests
-----------
-itest.s : 2.2
-ftest.s : 2.1
diff --git a/sys/arch/m68k/060sp/netbsd.S b/sys/arch/m68k/060sp/netbsd.S
deleted file mode 100644
index 6a86914c92e..00000000000
--- a/sys/arch/m68k/060sp/netbsd.S
+++ /dev/null
@@ -1,365 +0,0 @@
-/*
- * $OpenBSD: netbsd.S,v 1.4 2013/02/02 13:32:05 miod Exp $
- * $NetBSD: netbsd.S,v 1.3 1997/06/27 23:32:09 is Exp $
- *
- *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- * MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
- * M68000 Hi-Performance Microprocessor Division
- * M68060 Software Package Production Release
- *
- * M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
- * All rights reserved.
- *
- * THE SOFTWARE is provided on an "AS IS" basis and without warranty.
- * To the maximum extent permitted by applicable law,
- * MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
- * INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
- * FOR A PARTICULAR PURPOSE and any warranty against infringement with
- * regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
- * and any accompanying written materials.
- *
- * To the maximum extent permitted by applicable law,
- * IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
- * (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
- * BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
- * ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
- *
- * Motorola assumes no responsibility for the maintenance and support
- * of the SOFTWARE.
- *
- * You are hereby granted a copyright license to use, modify, and distribute the
- * SOFTWARE so long as this entire notice is retained without alteration
- * in any modified and/or redistributed versions, and that such modified
- * versions are clearly identified as such.
- * No licenses are granted by implication, estoppel or otherwise under any
- * patents or trademarks of Motorola, Inc.
- *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- * Derived from:
- * os.s
- *
- * This file contains:
- * - example "Call-Out"s required by both the ISP and FPSP.
- */
-
-#include <machine/asm.h>
-
-/*
- * make the copyright notice appear in the binary:
- */
-#include "copyright.S"
-
-/********************************
- * EXAMPLE CALL-OUTS *
- * *
- * _060_dmem_write() *
- * _060_dmem_read() *
- * _060_imem_read() *
- * _060_dmem_read_byte() *
- * _060_dmem_read_word() *
- * _060_dmem_read_long() *
- * _060_imem_read_word() *
- * _060_imem_read_long() *
- * _060_dmem_write_byte() *
- * _060_dmem_write_word() *
- * _060_dmem_write_long() *
- * *
- * _060_real_trace() *
- * _060_real_access() *
- ********************************/
-
-/*
- * Each IO routine checks to see if the memory write/read is to/from user
- * or supervisor application space. The examples below use simple "move"
- * instructions for supervisor mode applications and call _copyin()/_copyout()
- * for user mode applications.
- * When installing the 060SP, the _copyin()/_copyout() equivalents for a
- * given operating system should be substituted.
- *
- * The addresses within the 060SP are guaranteed to be on the stack.
- * The result is that Unix processes are allowed to sleep as a consequence
- * of a page fault during a _copyout.
- */
-
-/*
- * _060_dmem_write():
- *
- * Writes to data memory while in supervisor mode.
- *
- * INPUTS:
- * a0 - supervisor source address
- * a1 - user destination address
- * d0 - number of bytes to write
- * a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
- * OUTPUTS:
- * d1 - 0 = success, !0 = failure
- */
-ASENTRY_NOPROFILE(_060_dmem_write)
- btst #0x5,%a6@(0x4) |# check for supervisor state
- beqs user_write
-super_write:
- moveb %a0@+,%a1@+ |# copy 1 byte
- subql #0x1,%d0 |# decr byte counter
- bnes super_write |# quit if ctr = 0
- clrl %d1 |# return success
- rts
-user_write:
- movel %d0,%sp@- |# pass: counter
- movel %a1,%sp@- |# pass: user dst
- movel %a0,%sp@- |# pass: supervisor src
- bsrl _C_LABEL(copyout) |# write byte to user mem
- movel %d0,%d1 |# return success
- addl #0xc,%sp |# clear 3 lw params
- rts
-
-/*
- * _060_imem_read(), _060_dmem_read():
- *
- * Reads from data/instruction memory while in supervisor mode.
- *
- * INPUTS:
- * a0 - user source address
- * a1 - supervisor destination address
- * d0 - number of bytes to read
- * a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
- * OUTPUTS:
- * d1 - 0 = success, !0 = failure
- */
-ASENTRY_NOPROFILE(_060_imem_read)
-ASENTRY_NOPROFILE(_060_dmem_read)
- btst #0x5,%a6@(0x4) |# check for supervisor state
- beqs user_read
-super_read:
- moveb %a0@+,%a1@+ |# copy 1 byte
- subql #0x1,%d0 |# decr byte counter
- bnes super_read |# quit if ctr = 0
- clrl %d1 |# return success
- rts
-user_read:
- movel %d0,%sp@- |# pass: counter
- movel %a1,%sp@- |# pass: super dst
- movel %a0,%sp@- |# pass: user src
- bsrl _C_LABEL(copyin) |# read byte from user mem
- movel %d0,%d1 |# return success
- addl #0xc,%sp |# clear 3 lw params
- rts
-
-/*
- * _060_dmem_read_byte():
- *
- * Read a data byte from user memory.
- *
- * INPUTS:
- * a0 - user source address
- * a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
- * OUTPUTS:
- * d0 - data byte in d0
- * d1 - 0 = success, !0 = failure
- */
-ASENTRY_NOPROFILE(_060_dmem_read_byte)
- btst #0x5,%a6@(0x4) |# check for supervisor state
- bnes dmrbs |# supervisor
-dmrbu:
- clrl %sp@- |# clear space on stack for result
- movel #0x1,%sp@- |# pass: # bytes to copy
- pea %sp@(0x7) |# pass: dst addr (stack)
- movel %a0,%sp@- |# pass: src addr (user mem)
- bsrl _C_LABEL(copyin) |# "copy in" the data
- movel %d0,%d1 |# return success
- addl #0xc,%sp |# delete params
- movel %sp@+,%d0 |# put answer in d0
- rts
-dmrbs:
- clrl %d0 |# clear whole longword
- moveb %a0@,%d0 |# fetch super byte
- clrl %d1 |# return success
- rts
-
-/*
- * _060_imem_read_word():
- * Read an instruction word from user memory.
- *
- * _060_dmem_read_word():
- * Read a data word from user memory.
- *
- * INPUTS:
- * a0 - user source address
- * a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
- * OUTPUTS:
- * d0 - data word in d0
- * d1 - 0 = success, !0 = failure
- */
-
-ASENTRY_NOPROFILE(_060_imem_read_word)
-ASENTRY_NOPROFILE(_060_dmem_read_word)
- btst #0x5,%a6@(0x4) |# check for supervisor state
- bnes dmrws |# supervisor
-dmrwu:
- clrl %sp@- |# clear result space on stack
- movel #0x2,%sp@- |# pass: # bytes to copy
- pea %sp@(0x6) |# pass: dst addr (stack)
- movel %a0,%sp@- |# pass: src addr (user mem)
- bsrl _C_LABEL(copyin) |# "copy in" the data
- movel %d0,%d1 |# return success
- addl #0xc,%sp |# delete params
- movel %sp@+,%d0 |# put answer in d0
- rts
-dmrws:
- clrl %d0 |# clear whole longword
- movew %a0@,%d0 |# fetch super word
- clrl %d1 |# return success
- rts
-
-/*
- * _060_imem_read_long():
- * Read an instruction longword from user memory.
- *
- * _060_dmem_read_long():
- * Read an data longword from user memory.
- *
-
- *
- * INPUTS:
- * a0 - user source address
- * a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
- * OUTPUTS:
- * d0 - data longword in d0
- * d1 - 0 = success, !0 = failure
- */
-
-ASENTRY_NOPROFILE(_060_imem_read_long)
-ASENTRY_NOPROFILE(_060_dmem_read_long)
- btst #0x5,%a6@(0x4) |# check for supervisor state
- bnes dmrls |# supervisor
-dmrlu:
- subql #0x4,%sp |# clear result space on stack
- movel #0x4,%sp@- |# pass: # bytes to copy
- pea %sp@(0x4) |# pass: dst addr (stack)
- movel %a0,%sp@- |# pass: src addr (user mem)
- bsrl _C_LABEL(copyin) |# "copy in" the data
- movel %d0,%d1 |# return success
- addl #0xc,%sp |# delete params
- movel %sp@+,%d0 |# put answer in d0
- rts
-dmrls:
- movel %a0@,%d0 |# fetch super longword
- clrl %d1 |# return success
- rts
-
-/*
- * _060_dmem_write_byte():
- *
- * Write a data byte to user memory.
- *
- * INPUTS:
- * a0 - user destination address
- * d0 - data byte in d0
- * a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
- * OUTPUTS:
- * d1 - 0 = success, !0 = failure
- */
-ASENTRY_NOPROFILE(_060_dmem_write_byte)
- btst #0x5,%a6@(0x4) |# check for supervisor state
- bnes dmwbs |# supervisor
-dmwbu:
- movel %d0,%sp@- |# put src on stack
- movel #0x1,%sp@- |# pass: # bytes to copy
- movel %a0,%sp@- |# pass: dst addr (user mem)
- pea %sp@(0xb) |# pass: src addr (stack)
- bsrl _C_LABEL(copyout) |# "copy out" the data
- movel %d0,%d1 |# return success
- addl #0x10,%sp |# delete params + src
- rts
-dmwbs:
- moveb %d0,%a0@ |# store super byte
- clrl %d1 |# return success
- rts
-
-/*
- * _060_dmem_write_word():
- *
- * Write a data word to user memory.
- *
- * INPUTS:
- * a0 - user destination address
- * d0 - data word in d0
- * a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
- * OUTPUTS:
- * d1 - 0 = success, !0 = failure
- */
-ASENTRY_NOPROFILE(_060_dmem_write_word)
- btst #0x5,%a6@(0x4) |# check for supervisor state
- bnes dmwws |# supervisor
-dmwwu:
- movel %d0,%sp@- |# put src on stack
- movel #0x2,%sp@- |# pass: # bytes to copy
- movel %a0,%sp@- |# pass: dst addr (user mem)
- pea %sp@(0xa) |# pass: src addr (stack)
- bsrl _C_LABEL(copyout) |# "copy out" the data
- movel %d0,%d1 |# return success
- addl #0x10,%sp |# delete params + src
- rts
-dmwws:
- movew %d0,%a0@ |# store super word
- clrl %d1 |# return success
- rts
-
-/*
- * _060_dmem_write_long():
- *
- * Write a data longword to user memory.
- *
- * INPUTS:
- * a0 - user destination address
- * d0 - data longword in d0
- * a6@(0x4),bit5 - 1 = supervisor mode, 0 = user mode
- * OUTPUTS:
- * d1 - 0 = success, !0 = failure
- */
-ASENTRY_NOPROFILE(_060_dmem_write_long)
- btst #0x5,%a6@(0x4) |# check for supervisor state
- bnes dmwls |# supervisor
-dmwlu:
- movel %d0,%sp@- |# put src on stack
- movel #0x4,%sp@- |# pass: # bytes to copy
- movel %a0,%sp@- |# pass: dst addr (user mem)
- pea %sp@(0x8) |# pass: src addr (stack)
- bsrl _C_LABEL(copyout) |# "copy out" the data
- movel %d0,%d1 |# return success
- addl #0x10,%sp |# delete params + src
- rts
-dmwls:
- movel %d0,%a0@ |# store super longword
- clrl %d1 |# return success
- rts
-
-/*###########################################################################/
-
-/*
- * _060_real_trace():
- *
- * This is the exit point for the 060FPSP when an instruction is being traced
- * and there are no other higher priority exceptions pending for this instruction
- * or they have already been processed.
- *
- * The sample code below simply executes an "rte".
- */
-ASENTRY_NOPROFILE(_060_real_trace)
- jra _C_LABEL(trace)
-
-/*
- * _060_real_access():
- *
- * This is the exit point for the 060FPSP when an access error exception
- * is encountered. The routine below should point to the operating system
- * handler for access error exceptions. The exception stack frame is an
- * 8-word access error frame.
- *
- * We jump directly to the 68060 buserr handler.
- * If we had a sane ld, we could use use that entry point directly...
- */
-ASENTRY_NOPROFILE(_060_real_access)
- jra _C_LABEL(buserr60)
-
-#include "inetbsd.S"
-#include "fnetbsd.S"
diff --git a/sys/arch/m68k/060sp/os.s b/sys/arch/m68k/060sp/os.s
deleted file mode 100644
index 8b60b997cda..00000000000
--- a/sys/arch/m68k/060sp/os.s
+++ /dev/null
@@ -1,443 +0,0 @@
-#
-# $OpenBSD: os.s,v 1.2 1996/05/30 22:15:04 niklas Exp $
-# $NetBSD: os.s,v 1.2 1996/05/15 19:49:06 is Exp $
-#
-
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-# M68000 Hi-Performance Microprocessor Division
-# M68060 Software Package Production Release
-#
-# M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
-# All rights reserved.
-#
-# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-# To the maximum extent permitted by applicable law,
-# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
-# FOR A PARTICULAR PURPOSE and any warranty against infringement with
-# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-# and any accompanying written materials.
-#
-# To the maximum extent permitted by applicable law,
-# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
-# BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
-# ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
-#
-# Motorola assumes no responsibility for the maintenance and support
-# of the SOFTWARE.
-#
-# You are hereby granted a copyright license to use, modify, and distribute the
-# SOFTWARE so long as this entire notice is retained without alteration
-# in any modified and/or redistributed versions, and that such modified
-# versions are clearly identified as such.
-# No licenses are granted by implication, estoppel or otherwise under any
-# patents or trademarks of Motorola, Inc.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-#
-# os.s
-#
-# This file contains:
-# - example "Call-Out"s required by both the ISP and FPSP.
-#
-
-
-#################################
-# EXAMPLE CALL-OUTS #
-# #
-# _060_dmem_write() #
-# _060_dmem_read() #
-# _060_imem_read() #
-# _060_dmem_read_byte() #
-# _060_dmem_read_word() #
-# _060_dmem_read_long() #
-# _060_imem_read_word() #
-# _060_imem_read_long() #
-# _060_dmem_write_byte() #
-# _060_dmem_write_word() #
-# _060_dmem_write_long() #
-# #
-# _060_real_trace() #
-# _060_real_access() #
-#################################
-
-#
-# Each IO routine checks to see if the memory write/read is to/from user
-# or supervisor application space. The examples below use simple "move"
-# instructions for supervisor mode applications and call _copyin()/_copyout()
-# for user mode applications.
-# When installing the 060SP, the _copyin()/_copyout() equivalents for a
-# given operating system should be substituted.
-#
-# The addresses within the 060SP are guaranteed to be on the stack.
-# The result is that Unix processes are allowed to sleep as a consequence
-# of a page fault during a _copyout.
-#
-
-#
-# _060_dmem_write():
-#
-# Writes to data memory while in supervisor mode.
-#
-# INPUTS:
-# a0 - supervisor source address
-# a1 - user destination address
-# d0 - number of bytes to write
-# 0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
-# OUTPUTS:
-# d1 - 0 = success, !0 = failure
-#
- global _060_dmem_write
-_060_dmem_write:
- btst &0x5,0x4(%a6) # check for supervisor state
- beq.b user_write
-super_write:
- mov.b (%a0)+,(%a1)+ # copy 1 byte
- subq.l &0x1,%d0 # decr byte counter
- bne.b super_write # quit if ctr = 0
- clr.l %d1 # return success
- rts
-user_write:
- mov.l %d0,-(%sp) # pass: counter
- mov.l %a1,-(%sp) # pass: user dst
- mov.l %a0,-(%sp) # pass: supervisor src
- bsr.l _copyout # write byte to user mem
- mov.l %d0,%d1 # return success
- add.l &0xc, %sp # clear 3 lw params
- rts
-
-#
-# _060_imem_read(), _060_dmem_read():
-#
-# Reads from data/instruction memory while in supervisor mode.
-#
-# INPUTS:
-# a0 - user source address
-# a1 - supervisor destination address
-# d0 - number of bytes to read
-# 0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
-# OUTPUTS:
-# d1 - 0 = success, !0 = failure
-#
- global _060_imem_read
- global _060_dmem_read
-_060_imem_read:
-_060_dmem_read:
- btst &0x5,0x4(%a6) # check for supervisor state
- beq.b user_read
-super_read:
- mov.b (%a0)+,(%a1)+ # copy 1 byte
- subq.l &0x1,%d0 # decr byte counter
- bne.b super_read # quit if ctr = 0
- clr.l %d1 # return success
- rts
-user_read:
- mov.l %d0,-(%sp) # pass: counter
- mov.l %a1,-(%sp) # pass: super dst
- mov.l %a0,-(%sp) # pass: user src
- bsr.l _copyin # read byte from user mem
- mov.l %d0,%d1 # return success
- add.l &0xc,%sp # clear 3 lw params
- rts
-
-#
-# _060_dmem_read_byte():
-#
-# Read a data byte from user memory.
-#
-# INPUTS:
-# a0 - user source address
-# 0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
-# OUTPUTS:
-# d0 - data byte in d0
-# d1 - 0 = success, !0 = failure
-#
- global _060_dmem_read_byte
-_060_dmem_read_byte:
- btst &0x5,0x4(%a6) # check for supervisor state
- bne.b dmrbs # supervisor
-dmrbu: clr.l -(%sp) # clear space on stack for result
- mov.l &0x1,-(%sp) # pass: # bytes to copy
- pea 0x7(%sp) # pass: dst addr (stack)
- mov.l %a0,-(%sp) # pass: src addr (user mem)
- bsr.l _copyin # "copy in" the data
- mov.l %d0,%d1 # return success
- add.l &0xc,%sp # delete params
- mov.l (%sp)+,%d0 # put answer in d0
- rts
-dmrbs: clr.l %d0 # clear whole longword
- mov.b (%a0),%d0 # fetch super byte
- clr.l %d1 # return success
- rts
-
-#
-# _060_dmem_read_word():
-#
-# Read a data word from user memory.
-#
-# INPUTS:
-# a0 - user source address
-# 0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
-# OUTPUTS:
-# d0 - data word in d0
-# d1 - 0 = success, !0 = failure
-#
- global _060_dmem_read_word
-_060_dmem_read_word:
- btst &0x5,0x4(%a6) # check for supervisor state
- bne.b dmrws # supervisor
-dmrwu: clr.l -(%sp) # clear space on stack for result
- mov.l &0x2,-(%sp) # pass: # bytes to copy
- pea 0x6(%sp) # pass: dst addr (stack)
- mov.l %a0,-(%sp) # pass: src addr (user mem)
- bsr.l _copyin # "copy in" the data
- mov.l %d0,%d1 # return success
- add.l &0xc,%sp # delete params
- mov.l (%sp)+,%d0 # put answer in d0
- rts
-dmrws: clr.l %d0 # clear whole longword
- mov.w (%a0), %d0 # fetch super word
- clr.l %d1 # return success
- rts
-
-#
-# _060_dmem_read_long():
-#
-
-#
-# INPUTS:
-# a0 - user source address
-# 0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
-# OUTPUTS:
-# d0 - data longword in d0
-# d1 - 0 = success, !0 = failure
-#
- global _060_dmem_read_long
-_060_dmem_read_long:
- btst &0x5,0x4(%a6) # check for supervisor state
- bne.b dmrls # supervisor
-dmrlu: subq.l &0x4,%sp # clear space on stack for result
- mov.l &0x4,-(%sp) # pass: # bytes to copy
- pea 0x4(%sp) # pass: dst addr (stack)
- mov.l %a0,-(%sp) # pass: src addr (user mem)
- bsr.l _copyin # "copy in" the data
- mov.l %d0,%d1 # return success
- add.l &0xc,%sp # delete params
- mov.l (%sp)+,%d0 # put answer in d0
- rts
-dmrls: mov.l (%a0),%d0 # fetch super longword
- clr.l %d1 # return success
- rts
-
-#
-# _060_dmem_write_byte():
-#
-# Write a data byte to user memory.
-#
-# INPUTS:
-# a0 - user destination address
-# d0 - data byte in d0
-# 0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
-# OUTPUTS:
-# d1 - 0 = success, !0 = failure
-#
- global _060_dmem_write_byte
-_060_dmem_write_byte:
- btst &0x5,0x4(%a6) # check for supervisor state
- bne.b dmwbs # supervisor
-dmwbu: mov.l %d0,-(%sp) # put src on stack
- mov.l &0x1,-(%sp) # pass: # bytes to copy
- mov.l %a0,-(%sp) # pass: dst addr (user mem)
- pea 0xb(%sp) # pass: src addr (stack)
- bsr.l _copyout # "copy out" the data
- mov.l %d0,%d1 # return success
- add.l &0x10,%sp # delete params + src
- rts
-dmwbs: mov.b %d0,(%a0) # store super byte
- clr.l %d1 # return success
- rts
-
-#
-# _060_dmem_write_word():
-#
-# Write a data word to user memory.
-#
-# INPUTS:
-# a0 - user destination address
-# d0 - data word in d0
-# 0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
-# OUTPUTS:
-# d1 - 0 = success, !0 = failure
-#
- global _060_dmem_write_word
-_060_dmem_write_word:
- btst &0x5,0x4(%a6) # check for supervisor state
- bne.b dmwws # supervisor
-dmwwu: mov.l %d0,-(%sp) # put src on stack
- mov.l &0x2,-(%sp) # pass: # bytes to copy
- mov.l %a0,-(%sp) # pass: dst addr (user mem)
- pea 0xa(%sp) # pass: src addr (stack)
- bsr.l _copyout # "copy out" the data
- mov.l %d0,%d1 # return success
- add.l &0x10,%sp # delete params + src
- rts
-dmwws: mov.w %d0,(%a0) # store super word
- clr.l %d1 # return success
- rts
-
-#
-# _060_dmem_write_long():
-#
-# Write a data longword to user memory.
-#
-# INPUTS:
-# a0 - user destination address
-# d0 - data longword in d0
-# 0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
-# OUTPUTS:
-# d1 - 0 = success, !0 = failure
-#
- global _060_dmem_write_long
-_060_dmem_write_long:
- btst &0x5,0x4(%a6) # check for supervisor state
- bne.b dmwls # supervisor
-dmwlu: mov.l %d0,-(%sp) # put src on stack
- mov.l &0x4,-(%sp) # pass: # bytes to copy
- mov.l %a0,-(%sp) # pass: dst addr (user mem)
- pea 0x8(%sp) # pass: src addr (stack)
- bsr.l _copyout # "copy out" the data
- mov.l %d0,%d1 # return success
- add.l &0x10,%sp # delete params + src
- rts
-dmwls: mov.l %d0,(%a0) # store super longword
- clr.l %d1 # return success
- rts
-
-#
-# _060_imem_read_word():
-#
-# Read an instruction word from user memory.
-#
-# INPUTS:
-# a0 - user source address
-# 0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
-# OUTPUTS:
-# d0 - instruction word in d0
-# d1 - 0 = success, !0 = failure
-#
- global _060_imem_read_word
-_060_imem_read_word:
- btst &0x5,0x4(%a6) # check for supervisor state
- bne.b imrws # supervisor
-imrwu: clr.l -(%sp) # clear space on stack for result
- mov.l &0x2,-(%sp) # pass: # bytes to copy
- pea 0x6(%sp) # pass: dst addr (stack)
- mov.l %a0,-(%sp) # pass: src addr (user mem)
- bsr.l _copyin # "copy in" the data
- mov.l %d0,%d1 # return success
- add.l &0xc,%sp # delete params
- mov.l (%sp)+,%d0 # put answer in d0
- rts
-imrws: mov.w (%a0),%d0 # fetch super word
- clr.l %d1 # return success
- rts
-
-#
-# _060_imem_read_long():
-#
-# Read an instruction longword from user memory.
-#
-# INPUTS:
-# a0 - user source address
-# 0x4(%a6),bit5 - 1 = supervisor mode, 0 = user mode
-# OUTPUTS:
-# d0 - instruction longword in d0
-# d1 - 0 = success, !0 = failure
-#
- global _060_imem_read_long
-_060_imem_read_long:
- btst &0x5,0x4(%a6) # check for supervisor state
- bne.b imrls # supervisor
-imrlu: subq.l &0x4,%sp # clear space on stack for result
- mov.l &0x4,-(%sp) # pass: # bytes to copy
- pea 0x4(%sp) # pass: dst addr (stack)
- mov.l %a0,-(%sp) # pass: src addr (user mem)
- bsr.l _copyin # "copy in" the data
- mov.l %d0,%d1 # return success
- add.l &0xc,%sp # delete params
- mov.l (%sp)+,%d0 # put answer in d0
- rts
-imrls: mov.l (%a0),%d0 # fetch super longword
- clr.l %d1 # return success
- rts
-
-################################################
-
-#
-# Use these routines if your kernel doesn't have _copyout/_copyin equivalents.
-# Assumes that D0/D1/A0/A1 are scratch registers. The _copyin/_copyout
-# below assume that the SFC/DFC have been set previously.
-#
-
-#
-# int _copyout(supervisor_addr, user_addr, nbytes)
-#
- global _copyout
-_copyout:
- mov.l 4(%sp),%a0 # source
- mov.l 8(%sp),%a1 # destination
- mov.l 12(%sp),%d0 # count
-moreout:
- mov.b (%a0)+,%d1 # fetch supervisor byte
- movs.b %d1,(%a1)+ # store user byte
- subq.l &0x1,%d0 # are we through yet?
- bne.w moreout # no; so, continue
- rts
-
-#
-# int _copyin(user_addr, supervisor_addr, nbytes)
-#
- global _copyin
-_copyin:
- mov.l 4(%sp),%a0 # source
- mov.l 8(%sp),%a1 # destination
- mov.l 12(%sp),%d0 # count
-morein:
- movs.b (%a0)+,%d1 # fetch user byte
- mov.b %d1,(%a1)+ # write supervisor byte
- subq.l &0x1,%d0 # are we through yet?
- bne.w morein # no; so, continue
- rts
-
-############################################################################
-
-#
-# _060_real_trace():
-#
-# This is the exit point for the 060FPSP when an instruction is being traced
-# and there are no other higher priority exceptions pending for this instruction
-# or they have already been processed.
-#
-# The sample code below simply executes an "rte".
-#
- global _060_real_trace
-_060_real_trace:
- rte
-
-#
-# _060_real_access():
-#
-# This is the exit point for the 060FPSP when an access error exception
-# is encountered. The routine below should point to the operating system
-# handler for access error exceptions. The exception stack frame is an
-# 8-word access error frame.
-#
-# The sample routine below simply executes an "rte" instruction which
-# is most likely the incorrect thing to do and could put the system
-# into an infinite loop.
-#
- global _060_real_access
-_060_real_access:
- rte
diff --git a/sys/arch/m68k/060sp/pfpsp.s b/sys/arch/m68k/060sp/pfpsp.s
deleted file mode 100644
index 850164cbe47..00000000000
--- a/sys/arch/m68k/060sp/pfpsp.s
+++ /dev/null
@@ -1,14756 +0,0 @@
-#
-# $OpenBSD: pfpsp.s,v 1.8 2007/04/10 17:47:54 miod Exp $
-# $NetBSD: pfpsp.s,v 1.2 1996/05/15 19:49:12 is Exp $
-#
-
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-# M68000 Hi-Performance Microprocessor Division
-# M68060 Software Package Production Release
-#
-# M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
-# All rights reserved.
-#
-# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-# To the maximum extent permitted by applicable law,
-# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
-# FOR A PARTICULAR PURPOSE and any warranty against infringement with
-# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-# and any accompanying written materials.
-#
-# To the maximum extent permitted by applicable law,
-# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
-# BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
-# ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
-#
-# Motorola assumes no responsibility for the maintenance and support
-# of the SOFTWARE.
-#
-# You are hereby granted a copyright license to use, modify, and distribute the
-# SOFTWARE so long as this entire notice is retained without alteration
-# in any modified and/or redistributed versions, and that such modified
-# versions are clearly identified as such.
-# No licenses are granted by implication, estoppel or otherwise under any
-# patents or trademarks of Motorola, Inc.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-#
-# freal.s:
-# This file is appended to the top of the 060FPSP package
-# and contains the entry points into the package. The user, in
-# effect, branches to one of the branch table entries located
-# after _060FPSP_TABLE.
-# Also, subroutine stubs exist in this file (_fpsp_done for
-# example) that are referenced by the FPSP package itself in order
-# to call a given routine. The stub routine actually performs the
-# callout. The FPSP code does a "bsr" to the stub routine. This
-# extra layer of hierarchy adds a slight performance penalty but
-# it makes the FPSP code easier to read and more mainatinable.
-#
-
-set _off_bsun, 0x00
-set _off_snan, 0x04
-set _off_operr, 0x08
-set _off_ovfl, 0x0c
-set _off_unfl, 0x10
-set _off_dz, 0x14
-set _off_inex, 0x18
-set _off_fline, 0x1c
-set _off_fpu_dis, 0x20
-set _off_trap, 0x24
-set _off_trace, 0x28
-set _off_access, 0x2c
-set _off_done, 0x30
-
-set _off_imr, 0x40
-set _off_dmr, 0x44
-set _off_dmw, 0x48
-set _off_irw, 0x4c
-set _off_irl, 0x50
-set _off_drb, 0x54
-set _off_drw, 0x58
-set _off_drl, 0x5c
-set _off_dwb, 0x60
-set _off_dww, 0x64
-set _off_dwl, 0x68
-
-_060FPSP_TABLE:
-
-###############################################################
-
-# Here's the table of ENTRY POINTS for those linking the package.
- bra.l _fpsp_snan
- short 0x0000
- bra.l _fpsp_operr
- short 0x0000
- bra.l _fpsp_ovfl
- short 0x0000
- bra.l _fpsp_unfl
- short 0x0000
- bra.l _fpsp_dz
- short 0x0000
- bra.l _fpsp_inex
- short 0x0000
- bra.l _fpsp_fline
- short 0x0000
- bra.l _fpsp_unsupp
- short 0x0000
- bra.l _fpsp_effadd
- short 0x0000
-
- space 56
-
-###############################################################
- global _fpsp_done
-_fpsp_done:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_done,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_ovfl
-_real_ovfl:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_ovfl,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_unfl
-_real_unfl:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_unfl,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_inex
-_real_inex:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_inex,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_bsun
-_real_bsun:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_bsun,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_operr
-_real_operr:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_operr,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_snan
-_real_snan:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_snan,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_dz
-_real_dz:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_dz,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_fline
-_real_fline:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_fline,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_fpu_disabled
-_real_fpu_disabled:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_fpu_dis,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_trap
-_real_trap:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_trap,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_trace
-_real_trace:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_trace,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _real_access
-_real_access:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_access,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
-#######################################
-
- global _imem_read
-_imem_read:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_imr,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _dmem_read
-_dmem_read:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_dmr,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _dmem_write
-_dmem_write:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_dmw,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _imem_read_word
-_imem_read_word:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_irw,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _imem_read_long
-_imem_read_long:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_irl,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _dmem_read_byte
-_dmem_read_byte:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_drb,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _dmem_read_word
-_dmem_read_word:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_drw,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _dmem_read_long
-_dmem_read_long:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_drl,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _dmem_write_byte
-_dmem_write_byte:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_dwb,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _dmem_write_word
-_dmem_write_word:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_dww,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
- global _dmem_write_long
-_dmem_write_long:
- mov.l %d0,-(%sp)
- mov.l (_060FPSP_TABLE-0x80+_off_dwl,%pc),%d0
- pea.l (_060FPSP_TABLE-0x80,%pc,%d0)
- mov.l 0x4(%sp),%d0
- rtd &0x4
-
-#
-# This file contains a set of define statements for constants
-# in order to promote readability within the corecode itself.
-#
-
-set LOCAL_SIZE, 192 # stack frame size(bytes)
-set LV, -LOCAL_SIZE # stack offset
-
-set EXC_SR, 0x4 # stack status register
-set EXC_PC, 0x6 # stack pc
-set EXC_VOFF, 0xa # stacked vector offset
-set EXC_EA, 0xc # stacked <ea>
-
-set EXC_FP, 0x0 # frame pointer
-
-set EXC_AREGS, -68 # offset of all address regs
-set EXC_DREGS, -100 # offset of all data regs
-set EXC_FPREGS, -36 # offset of all fp regs
-
-set EXC_A7, EXC_AREGS+(7*4) # offset of saved a7
-set OLD_A7, EXC_AREGS+(6*4) # extra copy of saved a7
-set EXC_A6, EXC_AREGS+(6*4) # offset of saved a6
-set EXC_A5, EXC_AREGS+(5*4)
-set EXC_A4, EXC_AREGS+(4*4)
-set EXC_A3, EXC_AREGS+(3*4)
-set EXC_A2, EXC_AREGS+(2*4)
-set EXC_A1, EXC_AREGS+(1*4)
-set EXC_A0, EXC_AREGS+(0*4)
-set EXC_D7, EXC_DREGS+(7*4)
-set EXC_D6, EXC_DREGS+(6*4)
-set EXC_D5, EXC_DREGS+(5*4)
-set EXC_D4, EXC_DREGS+(4*4)
-set EXC_D3, EXC_DREGS+(3*4)
-set EXC_D2, EXC_DREGS+(2*4)
-set EXC_D1, EXC_DREGS+(1*4)
-set EXC_D0, EXC_DREGS+(0*4)
-
-set EXC_FP0, EXC_FPREGS+(0*12) # offset of saved fp0
-set EXC_FP1, EXC_FPREGS+(1*12) # offset of saved fp1
-set EXC_FP2, EXC_FPREGS+(2*12) # offset of saved fp2 (not used)
-
-set FP_SCR1, LV+80 # fp scratch 1
-set FP_SCR1_EX, FP_SCR1+0
-set FP_SCR1_SGN, FP_SCR1+2
-set FP_SCR1_HI, FP_SCR1+4
-set FP_SCR1_LO, FP_SCR1+8
-
-set FP_SCR0, LV+68 # fp scratch 0
-set FP_SCR0_EX, FP_SCR0+0
-set FP_SCR0_SGN, FP_SCR0+2
-set FP_SCR0_HI, FP_SCR0+4
-set FP_SCR0_LO, FP_SCR0+8
-
-set FP_DST, LV+56 # fp destination operand
-set FP_DST_EX, FP_DST+0
-set FP_DST_SGN, FP_DST+2
-set FP_DST_HI, FP_DST+4
-set FP_DST_LO, FP_DST+8
-
-set FP_SRC, LV+44 # fp source operand
-set FP_SRC_EX, FP_SRC+0
-set FP_SRC_SGN, FP_SRC+2
-set FP_SRC_HI, FP_SRC+4
-set FP_SRC_LO, FP_SRC+8
-
-set USER_FPIAR, LV+40 # FP instr address register
-
-set USER_FPSR, LV+36 # FP status register
-set FPSR_CC, USER_FPSR+0 # FPSR condition codes
-set FPSR_QBYTE, USER_FPSR+1 # FPSR qoutient byte
-set FPSR_EXCEPT, USER_FPSR+2 # FPSR exception status byte
-set FPSR_AEXCEPT, USER_FPSR+3 # FPSR accrued exception byte
-
-set USER_FPCR, LV+32 # FP control register
-set FPCR_ENABLE, USER_FPCR+2 # FPCR exception enable
-set FPCR_MODE, USER_FPCR+3 # FPCR rounding mode control
-
-set L_SCR3, LV+28 # integer scratch 3
-set L_SCR2, LV+24 # integer scratch 2
-set L_SCR1, LV+20 # integer scratch 1
-
-set STORE_FLG, LV+19 # flag: operand store (ie. not fcmp/ftst)
-
-set EXC_TEMP2, LV+24 # temporary space
-set EXC_TEMP, LV+16 # temporary space
-
-set DTAG, LV+15 # destination operand type
-set STAG, LV+14 # source operand type
-
-set SPCOND_FLG, LV+10 # flag: special case (see below)
-
-set EXC_CC, LV+8 # saved condition codes
-set EXC_EXTWPTR, LV+4 # saved current PC (active)
-set EXC_EXTWORD, LV+2 # saved extension word
-set EXC_CMDREG, LV+2 # saved extension word
-set EXC_OPWORD, LV+0 # saved operation word
-
-################################
-
-# Helpful macros
-
-set FTEMP, 0 # offsets within an
-set FTEMP_EX, 0 # extended precision
-set FTEMP_SGN, 2 # value saved in memory.
-set FTEMP_HI, 4
-set FTEMP_LO, 8
-set FTEMP_GRS, 12
-
-set LOCAL, 0 # offsets within an
-set LOCAL_EX, 0 # extended precision
-set LOCAL_SGN, 2 # value saved in memory.
-set LOCAL_HI, 4
-set LOCAL_LO, 8
-set LOCAL_GRS, 12
-
-set DST, 0 # offsets within an
-set DST_EX, 0 # extended precision
-set DST_HI, 4 # value saved in memory.
-set DST_LO, 8
-
-set SRC, 0 # offsets within an
-set SRC_EX, 0 # extended precision
-set SRC_HI, 4 # value saved in memory.
-set SRC_LO, 8
-
-set SGL_LO, 0x3f81 # min sgl prec exponent
-set SGL_HI, 0x407e # max sgl prec exponent
-set DBL_LO, 0x3c01 # min dbl prec exponent
-set DBL_HI, 0x43fe # max dbl prec exponent
-set EXT_LO, 0x0 # min ext prec exponent
-set EXT_HI, 0x7ffe # max ext prec exponent
-
-set EXT_BIAS, 0x3fff # extended precision bias
-set SGL_BIAS, 0x007f # single precision bias
-set DBL_BIAS, 0x03ff # double precision bias
-
-set NORM, 0x00 # operand type for STAG/DTAG
-set ZERO, 0x01 # operand type for STAG/DTAG
-set INF, 0x02 # operand type for STAG/DTAG
-set QNAN, 0x03 # operand type for STAG/DTAG
-set DENORM, 0x04 # operand type for STAG/DTAG
-set SNAN, 0x05 # operand type for STAG/DTAG
-set UNNORM, 0x06 # operand type for STAG/DTAG
-
-##################
-# FPSR/FPCR bits #
-##################
-set neg_bit, 0x3 # negative result
-set z_bit, 0x2 # zero result
-set inf_bit, 0x1 # infinite result
-set nan_bit, 0x0 # NAN result
-
-set q_sn_bit, 0x7 # sign bit of quotient byte
-
-set bsun_bit, 7 # branch on unordered
-set snan_bit, 6 # signalling NAN
-set operr_bit, 5 # operand error
-set ovfl_bit, 4 # overflow
-set unfl_bit, 3 # underflow
-set dz_bit, 2 # divide by zero
-set inex2_bit, 1 # inexact result 2
-set inex1_bit, 0 # inexact result 1
-
-set aiop_bit, 7 # accrued inexact operation bit
-set aovfl_bit, 6 # accrued overflow bit
-set aunfl_bit, 5 # accrued underflow bit
-set adz_bit, 4 # accrued dz bit
-set ainex_bit, 3 # accrued inexact bit
-
-#############################
-# FPSR individual bit masks #
-#############################
-set neg_mask, 0x08000000 # negative bit mask (lw)
-set inf_mask, 0x02000000 # infinity bit mask (lw)
-set z_mask, 0x04000000 # zero bit mask (lw)
-set nan_mask, 0x01000000 # nan bit mask (lw)
-
-set neg_bmask, 0x08 # negative bit mask (byte)
-set inf_bmask, 0x02 # infinity bit mask (byte)
-set z_bmask, 0x04 # zero bit mask (byte)
-set nan_bmask, 0x01 # nan bit mask (byte)
-
-set bsun_mask, 0x00008000 # bsun exception mask
-set snan_mask, 0x00004000 # snan exception mask
-set operr_mask, 0x00002000 # operr exception mask
-set ovfl_mask, 0x00001000 # overflow exception mask
-set unfl_mask, 0x00000800 # underflow exception mask
-set dz_mask, 0x00000400 # dz exception mask
-set inex2_mask, 0x00000200 # inex2 exception mask
-set inex1_mask, 0x00000100 # inex1 exception mask
-
-set aiop_mask, 0x00000080 # accrued illegal operation
-set aovfl_mask, 0x00000040 # accrued overflow
-set aunfl_mask, 0x00000020 # accrued underflow
-set adz_mask, 0x00000010 # accrued divide by zero
-set ainex_mask, 0x00000008 # accrued inexact
-
-######################################
-# FPSR combinations used in the FPSP #
-######################################
-set dzinf_mask, inf_mask+dz_mask+adz_mask
-set opnan_mask, nan_mask+operr_mask+aiop_mask
-set nzi_mask, 0x01ffffff #clears N, Z, and I
-set unfinx_mask, unfl_mask+inex2_mask+aunfl_mask+ainex_mask
-set unf2inx_mask, unfl_mask+inex2_mask+ainex_mask
-set ovfinx_mask, ovfl_mask+inex2_mask+aovfl_mask+ainex_mask
-set inx1a_mask, inex1_mask+ainex_mask
-set inx2a_mask, inex2_mask+ainex_mask
-set snaniop_mask, nan_mask+snan_mask+aiop_mask
-set snaniop2_mask, snan_mask+aiop_mask
-set naniop_mask, nan_mask+aiop_mask
-set neginf_mask, neg_mask+inf_mask
-set infaiop_mask, inf_mask+aiop_mask
-set negz_mask, neg_mask+z_mask
-set opaop_mask, operr_mask+aiop_mask
-set unfl_inx_mask, unfl_mask+aunfl_mask+ainex_mask
-set ovfl_inx_mask, ovfl_mask+aovfl_mask+ainex_mask
-
-#########
-# misc. #
-#########
-set rnd_stky_bit, 29 # stky bit pos in longword
-
-set sign_bit, 0x7 # sign bit
-set signan_bit, 0x6 # signalling nan bit
-
-set sgl_thresh, 0x3f81 # minimum sgl exponent
-set dbl_thresh, 0x3c01 # minimum dbl exponent
-
-set x_mode, 0x0 # extended precision
-set s_mode, 0x4 # single precision
-set d_mode, 0x8 # double precision
-
-set rn_mode, 0x0 # round-to-nearest
-set rz_mode, 0x1 # round-to-zero
-set rm_mode, 0x2 # round-tp-minus-infinity
-set rp_mode, 0x3 # round-to-plus-infinity
-
-set mantissalen, 64 # length of mantissa in bits
-
-set BYTE, 1 # len(byte) == 1 byte
-set WORD, 2 # len(word) == 2 bytes
-set LONG, 4 # len(longword) == 2 bytes
-
-set BSUN_VEC, 0xc0 # bsun vector offset
-set INEX_VEC, 0xc4 # inexact vector offset
-set DZ_VEC, 0xc8 # dz vector offset
-set UNFL_VEC, 0xcc # unfl vector offset
-set OPERR_VEC, 0xd0 # operr vector offset
-set OVFL_VEC, 0xd4 # ovfl vector offset
-set SNAN_VEC, 0xd8 # snan vector offset
-
-###########################
-# SPecial CONDition FLaGs #
-###########################
-set ftrapcc_flg, 0x01 # flag bit: ftrapcc exception
-set fbsun_flg, 0x02 # flag bit: bsun exception
-set mia7_flg, 0x04 # flag bit: (a7)+ <ea>
-set mda7_flg, 0x08 # flag bit: -(a7) <ea>
-set fmovm_flg, 0x40 # flag bit: fmovm instruction
-set immed_flg, 0x80 # flag bit: &<data> <ea>
-
-set ftrapcc_bit, 0x0
-set fbsun_bit, 0x1
-set mia7_bit, 0x2
-set mda7_bit, 0x3
-set immed_bit, 0x7
-
-##################################
-# TRANSCENDENTAL "LAST-OP" FLAGS #
-##################################
-set FMUL_OP, 0x0 # fmul instr performed last
-set FDIV_OP, 0x1 # fdiv performed last
-set FADD_OP, 0x2 # fadd performed last
-set FMOV_OP, 0x3 # fmov performed last
-
-#############
-# CONSTANTS #
-#############
-T1: long 0x40C62D38,0xD3D64634 # 16381 LOG2 LEAD
-T2: long 0x3D6F90AE,0xB1E75CC7 # 16381 LOG2 TRAIL
-
-PI: long 0x40000000,0xC90FDAA2,0x2168C235,0x00000000
-PIBY2: long 0x3FFF0000,0xC90FDAA2,0x2168C235,0x00000000
-
-TWOBYPI:
- long 0x3FE45F30,0x6DC9C883
-
-#########################################################################
-# XDEF **************************************************************** #
-# _fpsp_ovfl(): 060FPSP entry point for FP Overflow exception. #
-# #
-# This handler should be the first code executed upon taking the #
-# FP Overflow exception in an operating system. #
-# #
-# XREF **************************************************************** #
-# _imem_read_long() - read instruction longword #
-# fix_skewed_ops() - adjust src operand in fsave frame #
-# set_tag_x() - determine optype of src/dst operands #
-# store_fpreg() - store opclass 0 or 2 result to FP regfile #
-# unnorm_fix() - change UNNORM operands to NORM or ZERO #
-# load_fpn2() - load dst operand from FP regfile #
-# fout() - emulate an opclass 3 instruction #
-# tbl_unsupp - add of table of emulation routines for opclass 0,2 #
-# _fpsp_done() - "callout" for 060FPSP exit (all work done!) #
-# _real_ovfl() - "callout" for Overflow exception enabled code #
-# _real_inex() - "callout" for Inexact exception enabled code #
-# _real_trace() - "callout" for Trace exception code #
-# #
-# INPUT *************************************************************** #
-# - The system stack contains the FP Ovfl exception stack frame #
-# - The fsave frame contains the source operand #
-# #
-# OUTPUT ************************************************************** #
-# Overflow Exception enabled: #
-# - The system stack is unchanged #
-# - The fsave frame contains the adjusted src op for opclass 0,2 #
-# Overflow Exception disabled: #
-# - The system stack is unchanged #
-# - The "exception present" flag in the fsave frame is cleared #
-# #
-# ALGORITHM *********************************************************** #
-# On the 060, if an FP overflow is present as the result of any #
-# instruction, the 060 will take an overflow exception whether the #
-# exception is enabled or disabled in the FPCR. For the disabled case, #
-# This handler emulates the instruction to determine what the correct #
-# default result should be for the operation. This default result is #
-# then stored in either the FP regfile, data regfile, or memory. #
-# Finally, the handler exits through the "callout" _fpsp_done() #
-# denoting that no exceptional conditions exist within the machine. #
-# If the exception is enabled, then this handler must create the #
-# exceptional operand and plave it in the fsave state frame, and store #
-# the default result (only if the instruction is opclass 3). For #
-# exceptions enabled, this handler must exit through the "callout" #
-# _real_ovfl() so that the operating system enabled overflow handler #
-# can handle this case. #
-# Two other conditions exist. First, if overflow was disabled #
-# but the inexact exception was enabled, this handler must exit #
-# through the "callout" _real_inex() regardless of whether the result #
-# was inexact. #
-# Also, in the case of an opclass three instruction where #
-# overflow was disabled and the trace exception was enabled, this #
-# handler must exit through the "callout" _real_trace(). #
-# #
-#########################################################################
-
- global _fpsp_ovfl
-_fpsp_ovfl:
-
-#$# sub.l &24,%sp # make room for src/dst
-
- link.w %a6,&-LOCAL_SIZE # init stack frame
-
- fsave FP_SRC(%a6) # grab the "busy" frame
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FPREGS(%a6) # save fp0-fp1 on stack
-
-# the FPIAR holds the "current PC" of the faulting instruction
- mov.l USER_FPIAR(%a6),EXC_EXTWPTR(%a6)
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch the instruction words
- mov.l %d0,EXC_OPWORD(%a6)
-
-##############################################################################
-
- btst &0x5,EXC_CMDREG(%a6) # is instr an fmove out?
- bne.w fovfl_out
-
-
- lea FP_SRC(%a6),%a0 # pass: ptr to src op
- bsr.l fix_skewed_ops # fix src op
-
-# since, I believe, only NORMs and DENORMs can come through here,
-# maybe we can avoid the subroutine call.
- lea FP_SRC(%a6),%a0 # pass: ptr to src op
- bsr.l set_tag_x # tag the operand type
- mov.b %d0,STAG(%a6) # maybe NORM,DENORM
-
-# bit five of the fp extension word separates the monadic and dyadic operations
-# that can pass through fpsp_ovfl(). remember that fcmp, ftst, and fsincos
-# will never take this exception.
- btst &0x5,1+EXC_CMDREG(%a6) # is operation monadic or dyadic?
- beq.b fovfl_extract # monadic
-
- bfextu EXC_CMDREG(%a6){&6:&3},%d0 # dyadic; load dst reg
- bsr.l load_fpn2 # load dst into FP_DST
-
- lea FP_DST(%a6),%a0 # pass: ptr to dst op
- bsr.l set_tag_x # tag the operand type
- cmpi.b %d0,&UNNORM # is operand an UNNORM?
- bne.b fovfl_op2_done # no
- bsr.l unnorm_fix # yes; convert to NORM,DENORM,or ZERO
-fovfl_op2_done:
- mov.b %d0,DTAG(%a6) # save dst optype tag
-
-fovfl_extract:
-
-#$# mov.l FP_SRC_EX(%a6),TRAP_SRCOP_EX(%a6)
-#$# mov.l FP_SRC_HI(%a6),TRAP_SRCOP_HI(%a6)
-#$# mov.l FP_SRC_LO(%a6),TRAP_SRCOP_LO(%a6)
-#$# mov.l FP_DST_EX(%a6),TRAP_DSTOP_EX(%a6)
-#$# mov.l FP_DST_HI(%a6),TRAP_DSTOP_HI(%a6)
-#$# mov.l FP_DST_LO(%a6),TRAP_DSTOP_LO(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd prec/mode
-
- mov.b 1+EXC_CMDREG(%a6),%d1
- andi.w &0x007f,%d1 # extract extension
-
- andi.l &0x00ff01ff,USER_FPSR(%a6) # zero all but accured field
-
- fmov.l &0x0,%fpcr # zero current control regs
- fmov.l &0x0,%fpsr
-
- lea FP_SRC(%a6),%a0
- lea FP_DST(%a6),%a1
-
-# maybe we can make these entry points ONLY the OVFL entry points of each routine.
- mov.l (tbl_unsupp.l,%pc,%d1.w*4),%d1 # fetch routine addr
- jsr (tbl_unsupp.l,%pc,%d1.l*1)
-
-# the operation has been emulated. the result is in fp0.
-# the EXOP, if an exception occurred, is in fp1.
-# we must save the default result regardless of whether
-# traps are enabled or disabled.
- bfextu EXC_CMDREG(%a6){&6:&3},%d0
- bsr.l store_fpreg
-
-# the exceptional possibilities we have left ourselves with are ONLY overflow
-# and inexact. and, the inexact is such that overflow occurred and was disabled
-# but inexact was enabled.
- btst &ovfl_bit,FPCR_ENABLE(%a6)
- bne.b fovfl_ovfl_on
-
- btst &inex2_bit,FPCR_ENABLE(%a6)
- bne.b fovfl_inex_on
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6
-#$# add.l &24,%sp
- bra.l _fpsp_done
-
-# overflow is enabled AND overflow, of course, occurred. so, we have the EXOP
-# in fp1. now, simply jump to _real_ovfl()!
-fovfl_ovfl_on:
- fmovm.x &0x40,FP_SRC(%a6) # save EXOP (fp1) to stack
-
- mov.w &0xe005,2+FP_SRC(%a6) # save exc status
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- frestore FP_SRC(%a6) # do this after fmovm,other f<op>s!
-
- unlk %a6
-
- bra.l _real_ovfl
-
-# overflow occurred but is disabled. meanwhile, inexact is enabled. therefore,
-# we must jump to real_inex().
-fovfl_inex_on:
-
- fmovm.x &0x40,FP_SRC(%a6) # save EXOP (fp1) to stack
-
- mov.b &0xc4,1+EXC_VOFF(%a6) # vector offset = 0xc4
- mov.w &0xe001,2+FP_SRC(%a6) # save exc status
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- frestore FP_SRC(%a6) # do this after fmovm,other f<op>s!
-
- unlk %a6
-
- bra.l _real_inex
-
-########################################################################
-fovfl_out:
-
-
-#$# mov.l FP_SRC_EX(%a6),TRAP_SRCOP_EX(%a6)
-#$# mov.l FP_SRC_HI(%a6),TRAP_SRCOP_HI(%a6)
-#$# mov.l FP_SRC_LO(%a6),TRAP_SRCOP_LO(%a6)
-
-# the src operand is definitely a NORM(!), so tag it as such
- mov.b &NORM,STAG(%a6) # set src optype tag
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd prec/mode
-
- and.l &0xffff00ff,USER_FPSR(%a6) # zero all but accured field
-
- fmov.l &0x0,%fpcr # zero current control regs
- fmov.l &0x0,%fpsr
-
- lea FP_SRC(%a6),%a0 # pass ptr to src operand
-
- bsr.l fout
-
- btst &ovfl_bit,FPCR_ENABLE(%a6)
- bne.w fovfl_ovfl_on
-
- btst &inex2_bit,FPCR_ENABLE(%a6)
- bne.w fovfl_inex_on
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6
-#$# add.l &24,%sp
-
- btst &0x7,(%sp) # is trace on?
- beq.l _fpsp_done # no
-
- fmov.l %fpiar,0x8(%sp) # "Current PC" is in FPIAR
- mov.w &0x2024,0x6(%sp) # stk fmt = 0x2; voff = 0x024
- bra.l _real_trace
-
-#########################################################################
-# XDEF **************************************************************** #
-# _fpsp_unfl(): 060FPSP entry point for FP Underflow exception. #
-# #
-# This handler should be the first code executed upon taking the #
-# FP Underflow exception in an operating system. #
-# #
-# XREF **************************************************************** #
-# _imem_read_long() - read instruction longword #
-# fix_skewed_ops() - adjust src operand in fsave frame #
-# set_tag_x() - determine optype of src/dst operands #
-# store_fpreg() - store opclass 0 or 2 result to FP regfile #
-# unnorm_fix() - change UNNORM operands to NORM or ZERO #
-# load_fpn2() - load dst operand from FP regfile #
-# fout() - emulate an opclass 3 instruction #
-# tbl_unsupp - add of table of emulation routines for opclass 0,2 #
-# _fpsp_done() - "callout" for 060FPSP exit (all work done!) #
-# _real_ovfl() - "callout" for Overflow exception enabled code #
-# _real_inex() - "callout" for Inexact exception enabled code #
-# _real_trace() - "callout" for Trace exception code #
-# #
-# INPUT *************************************************************** #
-# - The system stack contains the FP Unfl exception stack frame #
-# - The fsave frame contains the source operand #
-# #
-# OUTPUT ************************************************************** #
-# Underflow Exception enabled: #
-# - The system stack is unchanged #
-# - The fsave frame contains the adjusted src op for opclass 0,2 #
-# Underflow Exception disabled: #
-# - The system stack is unchanged #
-# - The "exception present" flag in the fsave frame is cleared #
-# #
-# ALGORITHM *********************************************************** #
-# On the 060, if an FP underflow is present as the result of any #
-# instruction, the 060 will take an underflow exception whether the #
-# exception is enabled or disabled in the FPCR. For the disabled case, #
-# This handler emulates the instruction to determine what the correct #
-# default result should be for the operation. This default result is #
-# then stored in either the FP regfile, data regfile, or memory. #
-# Finally, the handler exits through the "callout" _fpsp_done() #
-# denoting that no exceptional conditions exist within the machine. #
-# If the exception is enabled, then this handler must create the #
-# exceptional operand and plave it in the fsave state frame, and store #
-# the default result (only if the instruction is opclass 3). For #
-# exceptions enabled, this handler must exit through the "callout" #
-# _real_unfl() so that the operating system enabled overflow handler #
-# can handle this case. #
-# Two other conditions exist. First, if underflow was disabled #
-# but the inexact exception was enabled and the result was inexact, #
-# this handler must exit through the "callout" _real_inex(). #
-# was inexact. #
-# Also, in the case of an opclass three instruction where #
-# underflow was disabled and the trace exception was enabled, this #
-# handler must exit through the "callout" _real_trace(). #
-# #
-#########################################################################
-
- global _fpsp_unfl
-_fpsp_unfl:
-
-#$# sub.l &24,%sp # make room for src/dst
-
- link.w %a6,&-LOCAL_SIZE # init stack frame
-
- fsave FP_SRC(%a6) # grab the "busy" frame
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FPREGS(%a6) # save fp0-fp1 on stack
-
-# the FPIAR holds the "current PC" of the faulting instruction
- mov.l USER_FPIAR(%a6),EXC_EXTWPTR(%a6)
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch the instruction words
- mov.l %d0,EXC_OPWORD(%a6)
-
-##############################################################################
-
- btst &0x5,EXC_CMDREG(%a6) # is instr an fmove out?
- bne.w funfl_out
-
-
- lea FP_SRC(%a6),%a0 # pass: ptr to src op
- bsr.l fix_skewed_ops # fix src op
-
- lea FP_SRC(%a6),%a0 # pass: ptr to src op
- bsr.l set_tag_x # tag the operand type
- mov.b %d0,STAG(%a6) # maybe NORM,DENORM
-
-# bit five of the fp ext word separates the monadic and dyadic operations
-# that can pass through fpsp_unfl(). remember that fcmp, and ftst
-# will never take this exception.
- btst &0x5,1+EXC_CMDREG(%a6) # is op monadic or dyadic?
- beq.b funfl_extract # monadic
-
-# now, what's left that's not dyadic is fsincos. we can distinguish it
-# from all dyadics by the '0110xxx pattern
- btst &0x4,1+EXC_CMDREG(%a6) # is op an fsincos?
- bne.b funfl_extract # yes
-
- bfextu EXC_CMDREG(%a6){&6:&3},%d0 # dyadic; load dst reg
- bsr.l load_fpn2 # load dst into FP_DST
-
- lea FP_DST(%a6),%a0 # pass: ptr to dst op
- bsr.l set_tag_x # tag the operand type
- cmpi.b %d0,&UNNORM # is operand an UNNORM?
- bne.b funfl_op2_done # no
- bsr.l unnorm_fix # yes; convert to NORM,DENORM,or ZERO
-funfl_op2_done:
- mov.b %d0,DTAG(%a6) # save dst optype tag
-
-funfl_extract:
-
-#$# mov.l FP_SRC_EX(%a6),TRAP_SRCOP_EX(%a6)
-#$# mov.l FP_SRC_HI(%a6),TRAP_SRCOP_HI(%a6)
-#$# mov.l FP_SRC_LO(%a6),TRAP_SRCOP_LO(%a6)
-#$# mov.l FP_DST_EX(%a6),TRAP_DSTOP_EX(%a6)
-#$# mov.l FP_DST_HI(%a6),TRAP_DSTOP_HI(%a6)
-#$# mov.l FP_DST_LO(%a6),TRAP_DSTOP_LO(%a6)
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd prec/mode
-
- mov.b 1+EXC_CMDREG(%a6),%d1
- andi.w &0x007f,%d1 # extract extension
-
- andi.l &0x00ff01ff,USER_FPSR(%a6)
-
- fmov.l &0x0,%fpcr # zero current control regs
- fmov.l &0x0,%fpsr
-
- lea FP_SRC(%a6),%a0
- lea FP_DST(%a6),%a1
-
-# maybe we can make these entry points ONLY the OVFL entry points of each routine.
- mov.l (tbl_unsupp.l,%pc,%d1.w*4),%d1 # fetch routine addr
- jsr (tbl_unsupp.l,%pc,%d1.l*1)
-
- bfextu EXC_CMDREG(%a6){&6:&3},%d0
- bsr.l store_fpreg
-
-# The `060 FPU multiplier hardware is such that if the result of a
-# multiply operation is the smallest possible normalized number
-# (0x00000000_80000000_00000000), then the machine will take an
-# underflow exception. Since this is incorrect, we need to check
-# if our emulation, after re-doing the operation, decided that
-# no underflow was called for. We do these checks only in
-# funfl_{unfl,inex}_on() because w/ both exceptions disabled, this
-# special case will simply exit gracefully with the correct result.
-
-# the exceptional possibilities we have left ourselves with are ONLY overflow
-# and inexact. and, the inexact is such that overflow occurred and was disabled
-# but inexact was enabled.
- btst &unfl_bit,FPCR_ENABLE(%a6)
- bne.b funfl_unfl_on
-
-funfl_chkinex:
- btst &inex2_bit,FPCR_ENABLE(%a6)
- bne.b funfl_inex_on
-
-funfl_exit:
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6
-#$# add.l &24,%sp
- bra.l _fpsp_done
-
-# overflow is enabled AND overflow, of course, occurred. so, we have the EXOP
-# in fp1 (don't forget to save fp0). what to do now?
-# well, we simply have to get to go to _real_unfl()!
-funfl_unfl_on:
-
-# The `060 FPU multiplier hardware is such that if the result of a
-# multiply operation is the smallest possible normalized number
-# (0x00000000_80000000_00000000), then the machine will take an
-# underflow exception. Since this is incorrect, we check here to see
-# if our emulation, after re-doing the operation, decided that
-# no underflow was called for.
- btst &unfl_bit,FPSR_EXCEPT(%a6)
- beq.w funfl_chkinex
-
-funfl_unfl_on2:
- fmovm.x &0x40,FP_SRC(%a6) # save EXOP (fp1) to stack
-
- mov.w &0xe003,2+FP_SRC(%a6) # save exc status
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- frestore FP_SRC(%a6) # do this after fmovm,other f<op>s!
-
- unlk %a6
-
- bra.l _real_unfl
-
-# undeflow occurred but is disabled. meanwhile, inexact is enabled. therefore,
-# we must jump to real_inex().
-funfl_inex_on:
-
-# The `060 FPU multiplier hardware is such that if the result of a
-# multiply operation is the smallest possible normalized number
-# (0x00000000_80000000_00000000), then the machine will take an
-# underflow exception.
-# But, whether bogus or not, if inexact is enabled AND it occurred,
-# then we have to branch to real_inex.
-
- btst &inex2_bit,FPSR_EXCEPT(%a6)
- beq.w funfl_exit
-
-funfl_inex_on2:
-
- fmovm.x &0x40,FP_SRC(%a6) # save EXOP to stack
-
- mov.b &0xc4,1+EXC_VOFF(%a6) # vector offset = 0xc4
- mov.w &0xe001,2+FP_SRC(%a6) # save exc status
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- frestore FP_SRC(%a6) # do this after fmovm,other f<op>s!
-
- unlk %a6
-
- bra.l _real_inex
-
-#######################################################################
-funfl_out:
-
-
-#$# mov.l FP_SRC_EX(%a6),TRAP_SRCOP_EX(%a6)
-#$# mov.l FP_SRC_HI(%a6),TRAP_SRCOP_HI(%a6)
-#$# mov.l FP_SRC_LO(%a6),TRAP_SRCOP_LO(%a6)
-
-# the src operand is definitely a NORM(!), so tag it as such
- mov.b &NORM,STAG(%a6) # set src optype tag
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd prec/mode
-
- and.l &0xffff00ff,USER_FPSR(%a6) # zero all but accured field
-
- fmov.l &0x0,%fpcr # zero current control regs
- fmov.l &0x0,%fpsr
-
- lea FP_SRC(%a6),%a0 # pass ptr to src operand
-
- bsr.l fout
-
- btst &unfl_bit,FPCR_ENABLE(%a6)
- bne.w funfl_unfl_on2
-
- btst &inex2_bit,FPCR_ENABLE(%a6)
- bne.w funfl_inex_on2
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6
-#$# add.l &24,%sp
-
- btst &0x7,(%sp) # is trace on?
- beq.l _fpsp_done # no
-
- fmov.l %fpiar,0x8(%sp) # "Current PC" is in FPIAR
- mov.w &0x2024,0x6(%sp) # stk fmt = 0x2; voff = 0x024
- bra.l _real_trace
-
-#########################################################################
-# XDEF **************************************************************** #
-# _fpsp_unsupp(): 060FPSP entry point for FP "Unimplemented #
-# Data Type" exception. #
-# #
-# This handler should be the first code executed upon taking the #
-# FP Unimplemented Data Type exception in an operating system. #
-# #
-# XREF **************************************************************** #
-# _imem_read_{word,long}() - read instruction word/longword #
-# fix_skewed_ops() - adjust src operand in fsave frame #
-# set_tag_x() - determine optype of src/dst operands #
-# store_fpreg() - store opclass 0 or 2 result to FP regfile #
-# unnorm_fix() - change UNNORM operands to NORM or ZERO #
-# load_fpn2() - load dst operand from FP regfile #
-# load_fpn1() - load src operand from FP regfile #
-# fout() - emulate an opclass 3 instruction #
-# tbl_unsupp - add of table of emulation routines for opclass 0,2 #
-# _real_inex() - "callout" to operating system inexact handler #
-# _fpsp_done() - "callout" for exit; work all done #
-# _real_trace() - "callout" for Trace enabled exception #
-# funimp_skew() - adjust fsave src ops to "incorrect" value #
-# _real_snan() - "callout" for SNAN exception #
-# _real_operr() - "callout" for OPERR exception #
-# _real_ovfl() - "callout" for OVFL exception #
-# _real_unfl() - "callout" for UNFL exception #
-# get_packed() - fetch packed operand from memory #
-# #
-# INPUT *************************************************************** #
-# - The system stack contains the "Unimp Data Type" stk frame #
-# - The fsave frame contains the ssrc op (for UNNORM/DENORM) #
-# #
-# OUTPUT ************************************************************** #
-# If Inexact exception (opclass 3): #
-# - The system stack is changed to an Inexact exception stk frame #
-# If SNAN exception (opclass 3): #
-# - The system stack is changed to an SNAN exception stk frame #
-# If OPERR exception (opclass 3): #
-# - The system stack is changed to an OPERR exception stk frame #
-# If OVFL exception (opclass 3): #
-# - The system stack is changed to an OVFL exception stk frame #
-# If UNFL exception (opclass 3): #
-# - The system stack is changed to an UNFL exception stack frame #
-# If Trace exception enabled: #
-# - The system stack is changed to a Trace exception stack frame #
-# Else: (normal case) #
-# - Correct result has been stored as appropriate #
-# #
-# ALGORITHM *********************************************************** #
-# Two main instruction types can enter here: (1) DENORM or UNNORM #
-# unimplemented data types. These can be either opclass 0,2 or 3 #
-# instructions, and (2) PACKED unimplemented data format instructions #
-# also of opclasses 0,2, or 3. #
-# For UNNORM/DENORM opclass 0 and 2, the handler fetches the src #
-# operand from the fsave state frame and the dst operand (if dyadic) #
-# from the FP register file. The instruction is then emulated by #
-# choosing an emulation routine from a table of routines indexed by #
-# instruction type. Once the instruction has been emulated and result #
-# saved, then we check to see if any enabled exceptions resulted from #
-# instruction emulation. If none, then we exit through the "callout" #
-# _fpsp_done(). If there is an enabled FP exception, then we insert #
-# this exception into the FPU in the fsave state frame and then exit #
-# through _fpsp_done(). #
-# PACKED opclass 0 and 2 is similar in how the instruction is #
-# emulated and exceptions handled. The differences occur in how the #
-# handler loads the packed op (by calling get_packed() routine) and #
-# by the fact that a Trace exception could be pending for PACKED ops. #
-# If a Trace exception is pending, then the current exception stack #
-# frame is changed to a Trace exception stack frame and an exit is #
-# made through _real_trace(). #
-# For UNNORM/DENORM opclass 3, the actual move out to memory is #
-# performed by calling the routine fout(). If no exception should occur #
-# as the result of emulation, then an exit either occurs through #
-# _fpsp_done() or through _real_trace() if a Trace exception is pending #
-# (a Trace stack frame must be created here, too). If an FP exception #
-# should occur, then we must create an exception stack frame of that #
-# type and jump to either _real_snan(), _real_operr(), _real_inex(), #
-# _real_unfl(), or _real_ovfl() as appropriate. PACKED opclass 3 #
-# emulation is performed in a similar manner. #
-# #
-#########################################################################
-
-#
-# (1) DENORM and UNNORM (unimplemented) data types:
-#
-# post-instruction
-# *****************
-# * EA *
-# pre-instruction * *
-# ***************** *****************
-# * 0x0 * 0x0dc * * 0x3 * 0x0dc *
-# ***************** *****************
-# * Next * * Next *
-# * PC * * PC *
-# ***************** *****************
-# * SR * * SR *
-# ***************** *****************
-#
-# (2) PACKED format (unsupported) opclasses two and three:
-# *****************
-# * EA *
-# * *
-# *****************
-# * 0x2 * 0x0dc *
-# *****************
-# * Next *
-# * PC *
-# *****************
-# * SR *
-# *****************
-#
- global _fpsp_unsupp
-_fpsp_unsupp:
-
- link.w %a6,&-LOCAL_SIZE # init stack frame
-
- fsave FP_SRC(%a6) # save fp state
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FPREGS(%a6) # save fp0-fp1 on stack
-
- btst &0x5,EXC_SR(%a6) # user or supervisor mode?
- bne.b fu_s
-fu_u:
- mov.l %usp,%a0 # fetch user stack pointer
- mov.l %a0,EXC_A7(%a6) # save on stack
- bra.b fu_cont
-# if the exception is an opclass zero or two unimplemented data type
-# exception, then the a7' calculated here is wrong since it doesn't
-# stack an ea. however, we don't need an a7' for this case anyways.
-fu_s:
- lea 0x4+EXC_EA(%a6),%a0 # load old a7'
- mov.l %a0,EXC_A7(%a6) # save on stack
-
-fu_cont:
-
-# the FPIAR holds the "current PC" of the faulting instruction
-# the FPIAR should be set correctly for ALL exceptions passing through
-# this point.
- mov.l USER_FPIAR(%a6),EXC_EXTWPTR(%a6)
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch the instruction words
- mov.l %d0,EXC_OPWORD(%a6) # store OPWORD and EXTWORD
-
-############################
-
- clr.b SPCOND_FLG(%a6) # clear special condition flag
-
-# Separate opclass three (fpn-to-mem) ops since they have a different
-# stack frame and protocol.
- btst &0x5,EXC_CMDREG(%a6) # is it an fmove out?
- bne.w fu_out # yes
-
-# Separate packed opclass two instructions.
- bfextu EXC_CMDREG(%a6){&0:&6},%d0
- cmpi.b %d0,&0x13
- beq.w fu_in_pack
-
-
-# I'm not sure at this point what FPSR bits are valid for this instruction.
-# so, since the emulation routines re-create them anyways, zero exception field
- andi.l &0x00ff00ff,USER_FPSR(%a6) # zero exception field
-
- fmov.l &0x0,%fpcr # zero current control regs
- fmov.l &0x0,%fpsr
-
-# Opclass two w/ memory-to-fpn operation will have an incorrect extended
-# precision format if the src format was single or double and the
-# source data type was an INF, NAN, DENORM, or UNNORM
- lea FP_SRC(%a6),%a0 # pass ptr to input
- bsr.l fix_skewed_ops
-
-# we don't know whether the src operand or the dst operand (or both) is the
-# UNNORM or DENORM. call the function that tags the operand type. if the
-# input is an UNNORM, then convert it to a NORM, DENORM, or ZERO.
- lea FP_SRC(%a6),%a0 # pass: ptr to src op
- bsr.l set_tag_x # tag the operand type
- cmpi.b %d0,&UNNORM # is operand an UNNORM?
- bne.b fu_op2 # no
- bsr.l unnorm_fix # yes; convert to NORM,DENORM,or ZERO
-
-fu_op2:
- mov.b %d0,STAG(%a6) # save src optype tag
-
- bfextu EXC_CMDREG(%a6){&6:&3},%d0 # dyadic; load dst reg
-
-# bit five of the fp extension word separates the monadic and dyadic operations
-# at this point
- btst &0x5,1+EXC_CMDREG(%a6) # is operation monadic or dyadic?
- beq.b fu_extract # monadic
- cmpi.b 1+EXC_CMDREG(%a6),&0x3a # is operation an ftst?
- beq.b fu_extract # yes, so it's monadic, too
-
- bsr.l load_fpn2 # load dst into FP_DST
-
- lea FP_DST(%a6),%a0 # pass: ptr to dst op
- bsr.l set_tag_x # tag the operand type
- cmpi.b %d0,&UNNORM # is operand an UNNORM?
- bne.b fu_op2_done # no
- bsr.l unnorm_fix # yes; convert to NORM,DENORM,or ZERO
-fu_op2_done:
- mov.b %d0,DTAG(%a6) # save dst optype tag
-
-fu_extract:
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # fetch rnd mode/prec
-
- bfextu 1+EXC_CMDREG(%a6){&1:&7},%d1 # extract extension
-
- lea FP_SRC(%a6),%a0
- lea FP_DST(%a6),%a1
-
- mov.l (tbl_unsupp.l,%pc,%d1.l*4),%d1 # fetch routine addr
- jsr (tbl_unsupp.l,%pc,%d1.l*1)
-
-#
-# Exceptions in order of precedence:
-# BSUN : none
-# SNAN : all dyadic ops
-# OPERR : fsqrt(-NORM)
-# OVFL : all except ftst,fcmp
-# UNFL : all except ftst,fcmp
-# DZ : fdiv
-# INEX2 : all except ftst,fcmp
-# INEX1 : none (packed doesn't go through here)
-#
-
-# we determine the highest priority exception(if any) set by the
-# emulation routine that has also been enabled by the user.
- mov.b FPCR_ENABLE(%a6),%d0 # fetch exceptions set
- bne.b fu_in_ena # some are enabled
-
-fu_in_cont:
-# fcmp and ftst do not store any result.
- mov.b 1+EXC_CMDREG(%a6),%d0 # fetch extension
- andi.b &0x38,%d0 # extract bits 3-5
- cmpi.b %d0,&0x38 # is instr fcmp or ftst?
- beq.b fu_in_exit # yes
-
- bfextu EXC_CMDREG(%a6){&6:&3},%d0 # dyadic; load dst reg
- bsr.l store_fpreg # store the result
-
-fu_in_exit:
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6
-
- bra.l _fpsp_done
-
-fu_in_ena:
- and.b FPSR_EXCEPT(%a6),%d0 # keep only ones enabled
- bfffo %d0{&24:&8},%d0 # find highest priority exception
- bne.b fu_in_exc # there is at least one set
-
-#
-# No exceptions occurred that were also enabled. Now:
-#
-# if (OVFL && ovfl_disabled && inexact_enabled) {
-# branch to _real_inex() (even if the result was exact!);
-# } else {
-# save the result in the proper fp reg (unless the op is fcmp or ftst);
-# return;
-# }
-#
- btst &ovfl_bit,FPSR_EXCEPT(%a6) # was overflow set?
- beq.b fu_in_cont # no
-
-fu_in_ovflchk:
- btst &inex2_bit,FPCR_ENABLE(%a6) # was inexact enabled?
- beq.b fu_in_cont # no
- bra.w fu_in_exc_ovfl # go insert overflow frame
-
-#
-# An exception occurred and that exception was enabled:
-#
-# shift enabled exception field into lo byte of d0;
-# if (((INEX2 || INEX1) && inex_enabled && OVFL && ovfl_disabled) ||
-# ((INEX2 || INEX1) && inex_enabled && UNFL && unfl_disabled)) {
-# /*
-# * this is the case where we must call _real_inex() now or else
-# * there will be no other way to pass it the exceptional operand
-# */
-# call _real_inex();
-# } else {
-# restore exc state (SNAN||OPERR||OVFL||UNFL||DZ||INEX) into the FPU;
-# }
-#
-fu_in_exc:
- subi.l &24,%d0 # fix offset to be 0-8
- cmpi.b %d0,&0x6 # is exception INEX? (6)
- bne.b fu_in_exc_exit # no
-
-# the enabled exception was inexact
- btst &unfl_bit,FPSR_EXCEPT(%a6) # did disabled underflow occur?
- bne.w fu_in_exc_unfl # yes
- btst &ovfl_bit,FPSR_EXCEPT(%a6) # did disabled overflow occur?
- bne.w fu_in_exc_ovfl # yes
-
-# here, we insert the correct fsave status value into the fsave frame for the
-# corresponding exception. the operand in the fsave frame should be the original
-# src operand.
-fu_in_exc_exit:
- mov.l %d0,-(%sp) # save d0
- bsr.l funimp_skew # skew sgl or dbl inputs
- mov.l (%sp)+,%d0 # restore d0
-
- mov.w (tbl_except.b,%pc,%d0.w*2),2+FP_SRC(%a6) # create exc status
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- frestore FP_SRC(%a6) # restore src op
-
- unlk %a6
-
- bra.l _fpsp_done
-
-tbl_except:
- short 0xe000,0xe006,0xe004,0xe005
- short 0xe003,0xe002,0xe001,0xe001
-
-fu_in_exc_unfl:
- mov.w &0x4,%d0
- bra.b fu_in_exc_exit
-fu_in_exc_ovfl:
- mov.w &0x03,%d0
- bra.b fu_in_exc_exit
-
-# If the input operand to this operation was opclass two and a single
-# or double precision denorm, inf, or nan, the operand needs to be
-# "corrected" in order to have the proper equivalent extended precision
-# number.
- global fix_skewed_ops
-fix_skewed_ops:
- bfextu EXC_CMDREG(%a6){&0:&6},%d0 # extract opclass,src fmt
- cmpi.b %d0,&0x11 # is class = 2 & fmt = sgl?
- beq.b fso_sgl # yes
- cmpi.b %d0,&0x15 # is class = 2 & fmt = dbl?
- beq.b fso_dbl # yes
- rts # no
-
-fso_sgl:
- mov.w LOCAL_EX(%a0),%d0 # fetch src exponent
- andi.w &0x7fff,%d0 # strip sign
- cmpi.w %d0,&0x3f80 # is |exp| == $3f80?
- beq.b fso_sgl_dnrm_zero # yes
- cmpi.w %d0,&0x407f # no; is |exp| == $407f?
- beq.b fso_infnan # yes
- rts # no
-
-fso_sgl_dnrm_zero:
- andi.l &0x7fffffff,LOCAL_HI(%a0) # clear j-bit
- beq.b fso_zero # it's a skewed zero
-fso_sgl_dnrm:
-# here, we count on norm not to alter a0...
- bsr.l norm # normalize mantissa
- neg.w %d0 # -shft amt
- addi.w &0x3f81,%d0 # adjust new exponent
- andi.w &0x8000,LOCAL_EX(%a0) # clear old exponent
- or.w %d0,LOCAL_EX(%a0) # insert new exponent
- rts
-
-fso_zero:
- andi.w &0x8000,LOCAL_EX(%a0) # clear bogus exponent
- rts
-
-fso_infnan:
- andi.b &0x7f,LOCAL_HI(%a0) # clear j-bit
- ori.w &0x7fff,LOCAL_EX(%a0) # make exponent = $7fff
- rts
-
-fso_dbl:
- mov.w LOCAL_EX(%a0),%d0 # fetch src exponent
- andi.w &0x7fff,%d0 # strip sign
- cmpi.w %d0,&0x3c00 # is |exp| == $3c00?
- beq.b fso_dbl_dnrm_zero # yes
- cmpi.w %d0,&0x43ff # no; is |exp| == $43ff?
- beq.b fso_infnan # yes
- rts # no
-
-fso_dbl_dnrm_zero:
- andi.l &0x7fffffff,LOCAL_HI(%a0) # clear j-bit
- bne.b fso_dbl_dnrm # it's a skewed denorm
- tst.l LOCAL_LO(%a0) # is it a zero?
- beq.b fso_zero # yes
-fso_dbl_dnrm:
-# here, we count on norm not to alter a0...
- bsr.l norm # normalize mantissa
- neg.w %d0 # -shft amt
- addi.w &0x3c01,%d0 # adjust new exponent
- andi.w &0x8000,LOCAL_EX(%a0) # clear old exponent
- or.w %d0,LOCAL_EX(%a0) # insert new exponent
- rts
-
-#################################################################
-
-# fmove out took an unimplemented data type exception.
-# the src operand is in FP_SRC. Call _fout() to write out the result and
-# to determine which exceptions, if any, to take.
-fu_out:
-
-# Separate packed move outs from the UNNORM and DENORM move outs.
- bfextu EXC_CMDREG(%a6){&3:&3},%d0
- cmpi.b %d0,&0x3
- beq.w fu_out_pack
- cmpi.b %d0,&0x7
- beq.w fu_out_pack
-
-
-# I'm not sure at this point what FPSR bits are valid for this instruction.
-# so, since the emulation routines re-create them anyways, zero exception field.
-# fmove out doesn't affect ccodes.
- and.l &0xffff00ff,USER_FPSR(%a6) # zero exception field
-
- fmov.l &0x0,%fpcr # zero current control regs
- fmov.l &0x0,%fpsr
-
-# the src can ONLY be a DENORM or an UNNORM! so, don't make any big subroutine
-# call here. just figure out what it is...
- mov.w FP_SRC_EX(%a6),%d0 # get exponent
- andi.w &0x7fff,%d0 # strip sign
- beq.b fu_out_denorm # it's a DENORM
-
- lea FP_SRC(%a6),%a0
- bsr.l unnorm_fix # yes; fix it
-
- mov.b %d0,STAG(%a6)
-
- bra.b fu_out_cont
-fu_out_denorm:
- mov.b &DENORM,STAG(%a6)
-fu_out_cont:
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # fetch rnd mode/prec
-
- lea FP_SRC(%a6),%a0 # pass ptr to src operand
-
- mov.l (%a6),EXC_A6(%a6) # in case a6 changes
- bsr.l fout # call fmove out routine
-
-# Exceptions in order of precedence:
-# BSUN : none
-# SNAN : none
-# OPERR : fmove.{b,w,l} out of large UNNORM
-# OVFL : fmove.{s,d}
-# UNFL : fmove.{s,d,x}
-# DZ : none
-# INEX2 : all
-# INEX1 : none (packed doesn't travel through here)
-
-# determine the highest priority exception(if any) set by the
-# emulation routine that has also been enabled by the user.
- mov.b FPCR_ENABLE(%a6),%d0 # fetch exceptions enabled
- bne.w fu_out_ena # some are enabled
-
-fu_out_done:
-
- mov.l EXC_A6(%a6),(%a6) # in case a6 changed
-
-# on extended precision opclass three instructions using pre-decrement or
-# post-increment addressing mode, the address register is not updated. is the
-# address register was the stack pointer used from user mode, then let's update
-# it here. if it was used from supervisor mode, then we have to handle this
-# as a special case.
- btst &0x5,EXC_SR(%a6)
- bne.b fu_out_done_s
-
- mov.l EXC_A7(%a6),%a0 # restore a7
- mov.l %a0,%usp
-
-fu_out_done_cont:
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6
-
- btst &0x7,(%sp) # is trace on?
- bne.b fu_out_trace # yes
-
- bra.l _fpsp_done
-
-# is the ea mode pre-decrement of the stack pointer from supervisor mode?
-# ("fmov.x fpm,-(a7)") if so,
-fu_out_done_s:
- cmpi.b SPCOND_FLG(%a6),&mda7_flg
- bne.b fu_out_done_cont
-
-# the extended precision result is still in fp0. but, we need to save it
-# somewhere on the stack until we can copy it to its final resting place.
-# here, we're counting on the top of the stack to be the old place-holders
-# for fp0/fp1 which have already been restored. that way, we can write
-# over those destinations with the shifted stack frame.
- fmovm.x &0x80,FP_SRC(%a6) # put answer on stack
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- mov.l (%a6),%a6 # restore frame pointer
-
- mov.l LOCAL_SIZE+EXC_SR(%sp),LOCAL_SIZE+EXC_SR-0xc(%sp)
- mov.l LOCAL_SIZE+2+EXC_PC(%sp),LOCAL_SIZE+2+EXC_PC-0xc(%sp)
-
-# now, copy the result to the proper place on the stack
- mov.l LOCAL_SIZE+FP_SRC_EX(%sp),LOCAL_SIZE+EXC_SR+0x0(%sp)
- mov.l LOCAL_SIZE+FP_SRC_HI(%sp),LOCAL_SIZE+EXC_SR+0x4(%sp)
- mov.l LOCAL_SIZE+FP_SRC_LO(%sp),LOCAL_SIZE+EXC_SR+0x8(%sp)
-
- add.l &LOCAL_SIZE-0x8,%sp
-
- btst &0x7,(%sp)
- bne.b fu_out_trace
-
- bra.l _fpsp_done
-
-fu_out_ena:
- and.b FPSR_EXCEPT(%a6),%d0 # keep only ones enabled
- bfffo %d0{&24:&8},%d0 # find highest priority exception
- bne.b fu_out_exc # there is at least one set
-
-# no exceptions were set.
-# if a disabled overflow occurred and inexact was enabled but the result
-# was exact, then a branch to _real_inex() is made.
- btst &ovfl_bit,FPSR_EXCEPT(%a6) # was overflow set?
- beq.w fu_out_done # no
-
-fu_out_ovflchk:
- btst &inex2_bit,FPCR_ENABLE(%a6) # was inexact enabled?
- beq.w fu_out_done # no
- bra.w fu_inex # yes
-
-#
-# The fp move out that took the "Unimplemented Data Type" exception was
-# being traced. Since the stack frames are similar, get the "current" PC
-# from FPIAR and put it in the trace stack frame then jump to _real_trace().
-#
-# UNSUPP FRAME TRACE FRAME
-# ***************** *****************
-# * EA * * Current *
-# * * * PC *
-# ***************** *****************
-# * 0x3 * 0x0dc * * 0x2 * 0x024 *
-# ***************** *****************
-# * Next * * Next *
-# * PC * * PC *
-# ***************** *****************
-# * SR * * SR *
-# ***************** *****************
-#
-fu_out_trace:
- mov.w &0x2024,0x6(%sp)
- fmov.l %fpiar,0x8(%sp)
- bra.l _real_trace
-
-# an exception occurred and that exception was enabled.
-fu_out_exc:
- subi.l &24,%d0 # fix offset to be 0-8
-
-# we don't mess with the existing fsave frame. just re-insert it and
-# jump to the "_real_{}()" handler...
- mov.w (tbl_fu_out.b,%pc,%d0.w*2),%d0
- jmp (tbl_fu_out.b,%pc,%d0.w*1)
-
- swbeg &0x8
-tbl_fu_out:
- short tbl_fu_out - tbl_fu_out # BSUN can't happen
- short tbl_fu_out - tbl_fu_out # SNAN can't happen
- short fu_operr - tbl_fu_out # OPERR
- short fu_ovfl - tbl_fu_out # OVFL
- short fu_unfl - tbl_fu_out # UNFL
- short tbl_fu_out - tbl_fu_out # DZ can't happen
- short fu_inex - tbl_fu_out # INEX2
- short tbl_fu_out - tbl_fu_out # INEX1 won't make it here
-
-# for snan,operr,ovfl,unfl, src op is still in FP_SRC so just
-# frestore it.
-fu_snan:
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- mov.w &0x30d8,EXC_VOFF(%a6) # vector offset = 0xd8
- mov.w &0xe006,2+FP_SRC(%a6)
-
- frestore FP_SRC(%a6)
-
- unlk %a6
-
-
- bra.l _real_snan
-
-fu_operr:
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- mov.w &0x30d0,EXC_VOFF(%a6) # vector offset = 0xd0
- mov.w &0xe004,2+FP_SRC(%a6)
-
- frestore FP_SRC(%a6)
-
- unlk %a6
-
-
- bra.l _real_operr
-
-fu_ovfl:
- fmovm.x &0x40,FP_SRC(%a6) # save EXOP to the stack
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- mov.w &0x30d4,EXC_VOFF(%a6) # vector offset = 0xd4
- mov.w &0xe005,2+FP_SRC(%a6)
-
- frestore FP_SRC(%a6) # restore EXOP
-
- unlk %a6
-
- bra.l _real_ovfl
-
-# underflow can happen for extended precision. extended precision opclass
-# three instruction exceptions don't update the stack pointer. so, if the
-# exception occurred from user mode, then simply update a7 and exit normally.
-# if the exception occurred from supervisor mode, check if
-fu_unfl:
- mov.l EXC_A6(%a6),(%a6) # restore a6
-
- btst &0x5,EXC_SR(%a6)
- bne.w fu_unfl_s
-
- mov.l EXC_A7(%a6),%a0 # restore a7 whether we need
- mov.l %a0,%usp # to or not...
-
-fu_unfl_cont:
- fmovm.x &0x40,FP_SRC(%a6) # save EXOP to the stack
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- mov.w &0x30cc,EXC_VOFF(%a6) # vector offset = 0xcc
- mov.w &0xe003,2+FP_SRC(%a6)
-
- frestore FP_SRC(%a6) # restore EXOP
-
- unlk %a6
-
- bra.l _real_unfl
-
-fu_unfl_s:
- cmpi.b SPCOND_FLG(%a6),&mda7_flg # was the <ea> mode -(sp)?
- bne.b fu_unfl_cont
-
-# the extended precision result is still in fp0. but, we need to save it
-# somewhere on the stack until we can copy it to its final resting place
-# (where the exc frame is currently). make sure it's not at the top of the
-# frame or it will get overwritten when the exc stack frame is shifted "down".
- fmovm.x &0x80,FP_SRC(%a6) # put answer on stack
- fmovm.x &0x40,FP_DST(%a6) # put EXOP on stack
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- mov.w &0x30cc,EXC_VOFF(%a6) # vector offset = 0xcc
- mov.w &0xe003,2+FP_DST(%a6)
-
- frestore FP_DST(%a6) # restore EXOP
-
- mov.l (%a6),%a6 # restore frame pointer
-
- mov.l LOCAL_SIZE+EXC_SR(%sp),LOCAL_SIZE+EXC_SR-0xc(%sp)
- mov.l LOCAL_SIZE+2+EXC_PC(%sp),LOCAL_SIZE+2+EXC_PC-0xc(%sp)
- mov.l LOCAL_SIZE+EXC_EA(%sp),LOCAL_SIZE+EXC_EA-0xc(%sp)
-
-# now, copy the result to the proper place on the stack
- mov.l LOCAL_SIZE+FP_SRC_EX(%sp),LOCAL_SIZE+EXC_SR+0x0(%sp)
- mov.l LOCAL_SIZE+FP_SRC_HI(%sp),LOCAL_SIZE+EXC_SR+0x4(%sp)
- mov.l LOCAL_SIZE+FP_SRC_LO(%sp),LOCAL_SIZE+EXC_SR+0x8(%sp)
-
- add.l &LOCAL_SIZE-0x8,%sp
-
- bra.l _real_unfl
-
-# fmove in and out enter here.
-fu_inex:
- fmovm.x &0x40,FP_SRC(%a6) # save EXOP to the stack
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- mov.w &0x30c4,EXC_VOFF(%a6) # vector offset = 0xc4
- mov.w &0xe001,2+FP_SRC(%a6)
-
- frestore FP_SRC(%a6) # restore EXOP
-
- unlk %a6
-
-
- bra.l _real_inex
-
-#########################################################################
-#########################################################################
-fu_in_pack:
-
-
-# I'm not sure at this point what FPSR bits are valid for this instruction.
-# so, since the emulation routines re-create them anyways, zero exception field
- andi.l &0x0ff00ff,USER_FPSR(%a6) # zero exception field
-
- fmov.l &0x0,%fpcr # zero current control regs
- fmov.l &0x0,%fpsr
-
- bsr.l get_packed # fetch packed src operand
-
- lea FP_SRC(%a6),%a0 # pass ptr to src
- bsr.l set_tag_x # set src optype tag
-
- mov.b %d0,STAG(%a6) # save src optype tag
-
- bfextu EXC_CMDREG(%a6){&6:&3},%d0 # dyadic; load dst reg
-
-# bit five of the fp extension word separates the monadic and dyadic operations
-# at this point
- btst &0x5,1+EXC_CMDREG(%a6) # is operation monadic or dyadic?
- beq.b fu_extract_p # monadic
- cmpi.b 1+EXC_CMDREG(%a6),&0x3a # is operation an ftst?
- beq.b fu_extract_p # yes, so it's monadic, too
-
- bsr.l load_fpn2 # load dst into FP_DST
-
- lea FP_DST(%a6),%a0 # pass: ptr to dst op
- bsr.l set_tag_x # tag the operand type
- cmpi.b %d0,&UNNORM # is operand an UNNORM?
- bne.b fu_op2_done_p # no
- bsr.l unnorm_fix # yes; convert to NORM,DENORM,or ZERO
-fu_op2_done_p:
- mov.b %d0,DTAG(%a6) # save dst optype tag
-
-fu_extract_p:
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # fetch rnd mode/prec
-
- bfextu 1+EXC_CMDREG(%a6){&1:&7},%d1 # extract extension
-
- lea FP_SRC(%a6),%a0
- lea FP_DST(%a6),%a1
-
- mov.l (tbl_unsupp.l,%pc,%d1.l*4),%d1 # fetch routine addr
- jsr (tbl_unsupp.l,%pc,%d1.l*1)
-
-#
-# Exceptions in order of precedence:
-# BSUN : none
-# SNAN : all dyadic ops
-# OPERR : fsqrt(-NORM)
-# OVFL : all except ftst,fcmp
-# UNFL : all except ftst,fcmp
-# DZ : fdiv
-# INEX2 : all except ftst,fcmp
-# INEX1 : all
-#
-
-# we determine the highest priority exception(if any) set by the
-# emulation routine that has also been enabled by the user.
- mov.b FPCR_ENABLE(%a6),%d0 # fetch exceptions enabled
- bne.w fu_in_ena_p # some are enabled
-
-fu_in_cont_p:
-# fcmp and ftst do not store any result.
- mov.b 1+EXC_CMDREG(%a6),%d0 # fetch extension
- andi.b &0x38,%d0 # extract bits 3-5
- cmpi.b %d0,&0x38 # is instr fcmp or ftst?
- beq.b fu_in_exit_p # yes
-
- bfextu EXC_CMDREG(%a6){&6:&3},%d0 # dyadic; load dst reg
- bsr.l store_fpreg # store the result
-
-fu_in_exit_p:
-
- btst &0x5,EXC_SR(%a6) # user or supervisor?
- bne.w fu_in_exit_s_p # supervisor
-
- mov.l EXC_A7(%a6),%a0 # update user a7
- mov.l %a0,%usp
-
-fu_in_exit_cont_p:
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6 # unravel stack frame
-
- btst &0x7,(%sp) # is trace on?
- bne.w fu_trace_p # yes
-
- bra.l _fpsp_done # exit to os
-
-# the exception occurred in supervisor mode. check to see if the
-# addressing mode was (a7)+. if so, we'll need to shift the
-# stack frame "up".
-fu_in_exit_s_p:
- btst &mia7_bit,SPCOND_FLG(%a6) # was ea mode (a7)+
- beq.b fu_in_exit_cont_p # no
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6 # unravel stack frame
-
-# shift the stack frame "up". we don't really care about the <ea> field.
- mov.l 0x4(%sp),0x10(%sp)
- mov.l 0x0(%sp),0xc(%sp)
- add.l &0xc,%sp
-
- btst &0x7,(%sp) # is trace on?
- bne.w fu_trace_p # yes
-
- bra.l _fpsp_done # exit to os
-
-fu_in_ena_p:
- and.b FPSR_EXCEPT(%a6),%d0 # keep only ones enabled & set
- bfffo %d0{&24:&8},%d0 # find highest priority exception
- bne.b fu_in_exc_p # at least one was set
-
-#
-# No exceptions occurred that were also enabled. Now:
-#
-# if (OVFL && ovfl_disabled && inexact_enabled) {
-# branch to _real_inex() (even if the result was exact!);
-# } else {
-# save the result in the proper fp reg (unless the op is fcmp or ftst);
-# return;
-# }
-#
- btst &ovfl_bit,FPSR_EXCEPT(%a6) # was overflow set?
- beq.w fu_in_cont_p # no
-
-fu_in_ovflchk_p:
- btst &inex2_bit,FPCR_ENABLE(%a6) # was inexact enabled?
- beq.w fu_in_cont_p # no
- bra.w fu_in_exc_ovfl_p # do _real_inex() now
-
-#
-# An exception occurred and that exception was enabled:
-#
-# shift enabled exception field into lo byte of d0;
-# if (((INEX2 || INEX1) && inex_enabled && OVFL && ovfl_disabled) ||
-# ((INEX2 || INEX1) && inex_enabled && UNFL && unfl_disabled)) {
-# /*
-# * this is the case where we must call _real_inex() now or else
-# * there will be no other way to pass it the exceptional operand
-# */
-# call _real_inex();
-# } else {
-# restore exc state (SNAN||OPERR||OVFL||UNFL||DZ||INEX) into the FPU;
-# }
-#
-fu_in_exc_p:
- subi.l &24,%d0 # fix offset to be 0-8
- cmpi.b %d0,&0x6 # is exception INEX? (6 or 7)
- blt.b fu_in_exc_exit_p # no
-
-# the enabled exception was inexact
- btst &unfl_bit,FPSR_EXCEPT(%a6) # did disabled underflow occur?
- bne.w fu_in_exc_unfl_p # yes
- btst &ovfl_bit,FPSR_EXCEPT(%a6) # did disabled overflow occur?
- bne.w fu_in_exc_ovfl_p # yes
-
-# here, we insert the correct fsave status value into the fsave frame for the
-# corresponding exception. the operand in the fsave frame should be the original
-# src operand.
-# as a reminder for future predicted pain and agony, we are passing in fsave the
-# "non-skewed" operand for cases of sgl and dbl src INFs,NANs, and DENORMs.
-# this is INCORRECT for enabled SNAN which would give to the user the skewed SNAN!!!
-fu_in_exc_exit_p:
- btst &0x5,EXC_SR(%a6) # user or supervisor?
- bne.w fu_in_exc_exit_s_p # supervisor
-
- mov.l EXC_A7(%a6),%a0 # update user a7
- mov.l %a0,%usp
-
-fu_in_exc_exit_cont_p:
- mov.w (tbl_except_p.b,%pc,%d0.w*2),2+FP_SRC(%a6)
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- frestore FP_SRC(%a6) # restore src op
-
- unlk %a6
-
- btst &0x7,(%sp) # is trace enabled?
- bne.w fu_trace_p # yes
-
- bra.l _fpsp_done
-
-tbl_except_p:
- short 0xe000,0xe006,0xe004,0xe005
- short 0xe003,0xe002,0xe001,0xe001
-
-fu_in_exc_ovfl_p:
- mov.w &0x3,%d0
- bra.w fu_in_exc_exit_p
-
-fu_in_exc_unfl_p:
- mov.w &0x4,%d0
- bra.w fu_in_exc_exit_p
-
-fu_in_exc_exit_s_p:
- btst &mia7_bit,SPCOND_FLG(%a6)
- beq.b fu_in_exc_exit_cont_p
-
- mov.w (tbl_except_p.b,%pc,%d0.w*2),2+FP_SRC(%a6)
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- frestore FP_SRC(%a6) # restore src op
-
- unlk %a6 # unravel stack frame
-
-# shift stack frame "up". who cares about <ea> field.
- mov.l 0x4(%sp),0x10(%sp)
- mov.l 0x0(%sp),0xc(%sp)
- add.l &0xc,%sp
-
- btst &0x7,(%sp) # is trace on?
- bne.b fu_trace_p # yes
-
- bra.l _fpsp_done # exit to os
-
-#
-# The opclass two PACKED instruction that took an "Unimplemented Data Type"
-# exception was being traced. Make the "current" PC the FPIAR and put it in the
-# trace stack frame then jump to _real_trace().
-#
-# UNSUPP FRAME TRACE FRAME
-# ***************** *****************
-# * EA * * Current *
-# * * * PC *
-# ***************** *****************
-# * 0x2 * 0x0dc * * 0x2 * 0x024 *
-# ***************** *****************
-# * Next * * Next *
-# * PC * * PC *
-# ***************** *****************
-# * SR * * SR *
-# ***************** *****************
-fu_trace_p:
- mov.w &0x2024,0x6(%sp)
- fmov.l %fpiar,0x8(%sp)
-
- bra.l _real_trace
-
-#########################################################
-#########################################################
-fu_out_pack:
-
-
-# I'm not sure at this point what FPSR bits are valid for this instruction.
-# so, since the emulation routines re-create them anyways, zero exception field.
-# fmove out doesn't affect ccodes.
- and.l &0xffff00ff,USER_FPSR(%a6) # zero exception field
-
- fmov.l &0x0,%fpcr # zero current control regs
- fmov.l &0x0,%fpsr
-
- bfextu EXC_CMDREG(%a6){&6:&3},%d0
- bsr.l load_fpn1
-
-# unlike other opclass 3, unimplemented data type exceptions, packed must be
-# able to detect all operand types.
- lea FP_SRC(%a6),%a0
- bsr.l set_tag_x # tag the operand type
- cmpi.b %d0,&UNNORM # is operand an UNNORM?
- bne.b fu_op2_p # no
- bsr.l unnorm_fix # yes; convert to NORM,DENORM,or ZERO
-
-fu_op2_p:
- mov.b %d0,STAG(%a6) # save src optype tag
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # fetch rnd mode/prec
-
- lea FP_SRC(%a6),%a0 # pass ptr to src operand
-
- mov.l (%a6),EXC_A6(%a6) # in case a6 changes
- bsr.l fout # call fmove out routine
-
-# Exceptions in order of precedence:
-# BSUN : no
-# SNAN : yes
-# OPERR : if ((k_factor > +17) || (dec. exp exceeds 3 digits))
-# OVFL : no
-# UNFL : no
-# DZ : no
-# INEX2 : yes
-# INEX1 : no
-
-# determine the highest priority exception(if any) set by the
-# emulation routine that has also been enabled by the user.
- mov.b FPCR_ENABLE(%a6),%d0 # fetch exceptions enabled
- bne.w fu_out_ena_p # some are enabled
-
-fu_out_exit_p:
- mov.l EXC_A6(%a6),(%a6) # restore a6
-
- btst &0x5,EXC_SR(%a6) # user or supervisor?
- bne.b fu_out_exit_s_p # supervisor
-
- mov.l EXC_A7(%a6),%a0 # update user a7
- mov.l %a0,%usp
-
-fu_out_exit_cont_p:
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6 # unravel stack frame
-
- btst &0x7,(%sp) # is trace on?
- bne.w fu_trace_p # yes
-
- bra.l _fpsp_done # exit to os
-
-# the exception occurred in supervisor mode. check to see if the
-# addressing mode was -(a7). if so, we'll need to shift the
-# stack frame "down".
-fu_out_exit_s_p:
- btst &mda7_bit,SPCOND_FLG(%a6) # was ea mode -(a7)
- beq.b fu_out_exit_cont_p # no
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- mov.l (%a6),%a6 # restore frame pointer
-
- mov.l LOCAL_SIZE+EXC_SR(%sp),LOCAL_SIZE+EXC_SR-0xc(%sp)
- mov.l LOCAL_SIZE+2+EXC_PC(%sp),LOCAL_SIZE+2+EXC_PC-0xc(%sp)
-
-# now, copy the result to the proper place on the stack
- mov.l LOCAL_SIZE+FP_DST_EX(%sp),LOCAL_SIZE+EXC_SR+0x0(%sp)
- mov.l LOCAL_SIZE+FP_DST_HI(%sp),LOCAL_SIZE+EXC_SR+0x4(%sp)
- mov.l LOCAL_SIZE+FP_DST_LO(%sp),LOCAL_SIZE+EXC_SR+0x8(%sp)
-
- add.l &LOCAL_SIZE-0x8,%sp
-
- btst &0x7,(%sp)
- bne.w fu_trace_p
-
- bra.l _fpsp_done
-
-fu_out_ena_p:
- and.b FPSR_EXCEPT(%a6),%d0 # keep only ones enabled
- bfffo %d0{&24:&8},%d0 # find highest priority exception
- beq.w fu_out_exit_p
-
- mov.l EXC_A6(%a6),(%a6) # restore a6
-
-# an exception occurred and that exception was enabled.
-# the only exception possible on packed move out are INEX, OPERR, and SNAN.
-fu_out_exc_p:
- cmpi.b %d0,&0x1a
- bgt.w fu_inex_p2
- beq.w fu_operr_p
-
-fu_snan_p:
- btst &0x5,EXC_SR(%a6)
- bne.b fu_snan_s_p
-
- mov.l EXC_A7(%a6),%a0
- mov.l %a0,%usp
- bra.w fu_snan
-
-fu_snan_s_p:
- cmpi.b SPCOND_FLG(%a6),&mda7_flg
- bne.w fu_snan
-
-# the instruction was "fmove.p fpn,-(a7)" from supervisor mode.
-# the strategy is to move the exception frame "down" 12 bytes. then, we
-# can store the default result where the exception frame was.
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- mov.w &0x30d8,EXC_VOFF(%a6) # vector offset = 0xd0
- mov.w &0xe006,2+FP_SRC(%a6) # set fsave status
-
- frestore FP_SRC(%a6) # restore src operand
-
- mov.l (%a6),%a6 # restore frame pointer
-
- mov.l LOCAL_SIZE+EXC_SR(%sp),LOCAL_SIZE+EXC_SR-0xc(%sp)
- mov.l LOCAL_SIZE+2+EXC_PC(%sp),LOCAL_SIZE+2+EXC_PC-0xc(%sp)
- mov.l LOCAL_SIZE+EXC_EA(%sp),LOCAL_SIZE+EXC_EA-0xc(%sp)
-
-# now, we copy the default result to its proper location
- mov.l LOCAL_SIZE+FP_DST_EX(%sp),LOCAL_SIZE+0x4(%sp)
- mov.l LOCAL_SIZE+FP_DST_HI(%sp),LOCAL_SIZE+0x8(%sp)
- mov.l LOCAL_SIZE+FP_DST_LO(%sp),LOCAL_SIZE+0xc(%sp)
-
- add.l &LOCAL_SIZE-0x8,%sp
-
-
- bra.l _real_snan
-
-fu_operr_p:
- btst &0x5,EXC_SR(%a6)
- bne.w fu_operr_p_s
-
- mov.l EXC_A7(%a6),%a0
- mov.l %a0,%usp
- bra.w fu_operr
-
-fu_operr_p_s:
- cmpi.b SPCOND_FLG(%a6),&mda7_flg
- bne.w fu_operr
-
-# the instruction was "fmove.p fpn,-(a7)" from supervisor mode.
-# the strategy is to move the exception frame "down" 12 bytes. then, we
-# can store the default result where the exception frame was.
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- mov.w &0x30d0,EXC_VOFF(%a6) # vector offset = 0xd0
- mov.w &0xe004,2+FP_SRC(%a6) # set fsave status
-
- frestore FP_SRC(%a6) # restore src operand
-
- mov.l (%a6),%a6 # restore frame pointer
-
- mov.l LOCAL_SIZE+EXC_SR(%sp),LOCAL_SIZE+EXC_SR-0xc(%sp)
- mov.l LOCAL_SIZE+2+EXC_PC(%sp),LOCAL_SIZE+2+EXC_PC-0xc(%sp)
- mov.l LOCAL_SIZE+EXC_EA(%sp),LOCAL_SIZE+EXC_EA-0xc(%sp)
-
-# now, we copy the default result to its proper location
- mov.l LOCAL_SIZE+FP_DST_EX(%sp),LOCAL_SIZE+0x4(%sp)
- mov.l LOCAL_SIZE+FP_DST_HI(%sp),LOCAL_SIZE+0x8(%sp)
- mov.l LOCAL_SIZE+FP_DST_LO(%sp),LOCAL_SIZE+0xc(%sp)
-
- add.l &LOCAL_SIZE-0x8,%sp
-
-
- bra.l _real_operr
-
-fu_inex_p2:
- btst &0x5,EXC_SR(%a6)
- bne.w fu_inex_s_p2
-
- mov.l EXC_A7(%a6),%a0
- mov.l %a0,%usp
- bra.w fu_inex
-
-fu_inex_s_p2:
- cmpi.b SPCOND_FLG(%a6),&mda7_flg
- bne.w fu_inex
-
-# the instruction was "fmove.p fpn,-(a7)" from supervisor mode.
-# the strategy is to move the exception frame "down" 12 bytes. then, we
-# can store the default result where the exception frame was.
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0/fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- mov.w &0x30c4,EXC_VOFF(%a6) # vector offset = 0xc4
- mov.w &0xe001,2+FP_SRC(%a6) # set fsave status
-
- frestore FP_SRC(%a6) # restore src operand
-
- mov.l (%a6),%a6 # restore frame pointer
-
- mov.l LOCAL_SIZE+EXC_SR(%sp),LOCAL_SIZE+EXC_SR-0xc(%sp)
- mov.l LOCAL_SIZE+2+EXC_PC(%sp),LOCAL_SIZE+2+EXC_PC-0xc(%sp)
- mov.l LOCAL_SIZE+EXC_EA(%sp),LOCAL_SIZE+EXC_EA-0xc(%sp)
-
-# now, we copy the default result to its proper location
- mov.l LOCAL_SIZE+FP_DST_EX(%sp),LOCAL_SIZE+0x4(%sp)
- mov.l LOCAL_SIZE+FP_DST_HI(%sp),LOCAL_SIZE+0x8(%sp)
- mov.l LOCAL_SIZE+FP_DST_LO(%sp),LOCAL_SIZE+0xc(%sp)
-
- add.l &LOCAL_SIZE-0x8,%sp
-
-
- bra.l _real_inex
-
-#########################################################################
-
-#
-# if we're stuffing a source operand back into an fsave frame then we
-# have to make sure that for single or double source operands that the
-# format stuffed is as weird as the hardware usually makes it.
-#
- global funimp_skew
-funimp_skew:
- bfextu EXC_EXTWORD(%a6){&3:&3},%d0 # extract src specifier
- cmpi.b %d0,&0x1 # was src sgl?
- beq.b funimp_skew_sgl # yes
- cmpi.b %d0,&0x5 # was src dbl?
- beq.b funimp_skew_dbl # yes
- rts
-
-funimp_skew_sgl:
- mov.w FP_SRC_EX(%a6),%d0 # fetch DENORM exponent
- andi.w &0x7fff,%d0 # strip sign
- beq.b funimp_skew_sgl_not
- cmpi.w %d0,&0x3f80
- bgt.b funimp_skew_sgl_not
- neg.w %d0 # make exponent negative
- addi.w &0x3f81,%d0 # find amt to shift
- mov.l FP_SRC_HI(%a6),%d1 # fetch DENORM hi(man)
- lsr.l %d0,%d1 # shift it
- bset &31,%d1 # set j-bit
- mov.l %d1,FP_SRC_HI(%a6) # insert new hi(man)
- andi.w &0x8000,FP_SRC_EX(%a6) # clear old exponent
- ori.w &0x3f80,FP_SRC_EX(%a6) # insert new "skewed" exponent
-funimp_skew_sgl_not:
- rts
-
-funimp_skew_dbl:
- mov.w FP_SRC_EX(%a6),%d0 # fetch DENORM exponent
- andi.w &0x7fff,%d0 # strip sign
- beq.b funimp_skew_dbl_not
- cmpi.w %d0,&0x3c00
- bgt.b funimp_skew_dbl_not
-
- tst.b FP_SRC_EX(%a6) # make "internal format"
- smi.b 0x2+FP_SRC(%a6)
- mov.w %d0,FP_SRC_EX(%a6) # insert exponent with cleared sign
- clr.l %d0 # clear g,r,s
- lea FP_SRC(%a6),%a0 # pass ptr to src op
- mov.w &0x3c01,%d1 # pass denorm threshold
- bsr.l dnrm_lp # denorm it
- mov.w &0x3c00,%d0 # new exponent
- tst.b 0x2+FP_SRC(%a6) # is sign set?
- beq.b fss_dbl_denorm_done # no
- bset &15,%d0 # set sign
-fss_dbl_denorm_done:
- bset &0x7,FP_SRC_HI(%a6) # set j-bit
- mov.w %d0,FP_SRC_EX(%a6) # insert new exponent
-funimp_skew_dbl_not:
- rts
-
-#########################################################################
- global _mem_write2
-_mem_write2:
- btst &0x5,EXC_SR(%a6)
- beq.l _dmem_write
- mov.l 0x0(%a0),FP_DST_EX(%a6)
- mov.l 0x4(%a0),FP_DST_HI(%a6)
- mov.l 0x8(%a0),FP_DST_LO(%a6)
- clr.l %d1
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# _fpsp_effadd(): 060FPSP entry point for FP "Unimplemented #
-# effective address" exception. #
-# #
-# This handler should be the first code executed upon taking the #
-# FP Unimplemented Effective Address exception in an operating #
-# system. #
-# #
-# XREF **************************************************************** #
-# _imem_read_long() - read instruction longword #
-# fix_skewed_ops() - adjust src operand in fsave frame #
-# set_tag_x() - determine optype of src/dst operands #
-# store_fpreg() - store opclass 0 or 2 result to FP regfile #
-# unnorm_fix() - change UNNORM operands to NORM or ZERO #
-# load_fpn2() - load dst operand from FP regfile #
-# tbl_unsupp - add of table of emulation routines for opclass 0,2 #
-# decbin() - convert packed data to FP binary data #
-# _real_fpu_disabled() - "callout" for "FPU disabled" exception #
-# _real_access() - "callout" for access error exception #
-# _mem_read() - read extended immediate operand from memory #
-# _fpsp_done() - "callout" for exit; work all done #
-# _real_trace() - "callout" for Trace enabled exception #
-# fmovm_dynamic() - emulate dynamic fmovm instruction #
-# fmovm_ctrl() - emulate fmovm control instruction #
-# #
-# INPUT *************************************************************** #
-# - The system stack contains the "Unimplemented <ea>" stk frame #
-# #
-# OUTPUT ************************************************************** #
-# If access error: #
-# - The system stack is changed to an access error stack frame #
-# If FPU disabled: #
-# - The system stack is changed to an FPU disabled stack frame #
-# If Trace exception enabled: #
-# - The system stack is changed to a Trace exception stack frame #
-# Else: (normal case) #
-# - None (correct result has been stored as appropriate) #
-# #
-# ALGORITHM *********************************************************** #
-# This exception handles 3 types of operations: #
-# (1) FP Instructions using extended precision or packed immediate #
-# addressing mode. #
-# (2) The "fmovm.x" instruction w/ dynamic register specification. #
-# (3) The "fmovm.l" instruction w/ 2 or 3 control registers. #
-# #
-# For immediate data operations, the data is read in w/ a #
-# _mem_read() "callout", converted to FP binary (if packed), and used #
-# as the source operand to the instruction specified by the instruction #
-# word. If no FP exception should be reported ads a result of the #
-# emulation, then the result is stored to the destination register and #
-# the handler exits through _fpsp_done(). If an enabled exc has been #
-# signalled as a result of emulation, then an fsave state frame #
-# corresponding to the FP exception type must be entered into the 060 #
-# FPU before exiting. In either the enabled or disabled cases, we #
-# must also check if a Trace exception is pending, in which case, we #
-# must create a Trace exception stack frame from the current exception #
-# stack frame. If no Trace is pending, we simply exit through #
-# _fpsp_done(). #
-# For "fmovm.x", call the routine fmovm_dynamic() which will #
-# decode and emulate the instruction. No FP exceptions can be pending #
-# as a result of this operation emulation. A Trace exception can be #
-# pending, though, which means the current stack frame must be changed #
-# to a Trace stack frame and an exit made through _real_trace(). #
-# For the case of "fmovm.x Dn,-(a7)", where the offending instruction #
-# was executed from supervisor mode, this handler must store the FP #
-# register file values to the system stack by itself since #
-# fmovm_dynamic() can't handle this. A normal exit is made through #
-# fpsp_done(). #
-# For "fmovm.l", fmovm_ctrl() is used to emulate the instruction. #
-# Again, a Trace exception may be pending and an exit made through #
-# _real_trace(). Else, a normal exit is made through _fpsp_done(). #
-# #
-# Before any of the above is attempted, it must be checked to #
-# see if the FPU is disabled. Since the "Unimp <ea>" exception is taken #
-# before the "FPU disabled" exception, but the "FPU disabled" exception #
-# has higher priority, we check the disabled bit in the PCR. If set, #
-# then we must create an 8 word "FPU disabled" exception stack frame #
-# from the current 4 word exception stack frame. This includes #
-# reproducing the effective address of the instruction to put on the #
-# new stack frame. #
-# #
-# In the process of all emulation work, if a _mem_read() #
-# "callout" returns a failing result indicating an access error, then #
-# we must create an access error stack frame from the current stack #
-# frame. This information includes a faulting address and a fault- #
-# status-longword. These are created within this handler. #
-# #
-#########################################################################
-
- global _fpsp_effadd
-_fpsp_effadd:
-
-# This exception type takes priority over the "Line F Emulator"
-# exception. Therefore, the FPU could be disabled when entering here.
-# So, we must check to see if it's disabled and handle that case separately.
- mov.l %d0,-(%sp) # save d0
- movc %pcr,%d0 # load proc cr
- btst &0x1,%d0 # is FPU disabled?
- bne.w iea_disabled # yes
- mov.l (%sp)+,%d0 # restore d0
-
- link %a6,&-LOCAL_SIZE # init stack frame
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FPREGS(%a6) # save fp0-fp1 on stack
-
-# PC of instruction that took the exception is the PC in the frame
- mov.l EXC_PC(%a6),EXC_EXTWPTR(%a6)
-
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch the instruction words
- mov.l %d0,EXC_OPWORD(%a6) # store OPWORD and EXTWORD
-
-#########################################################################
-
- tst.w %d0 # is operation fmovem?
- bmi.w iea_fmovm # yes
-
-#
-# here, we will have:
-# fabs fdabs fsabs facos fmod
-# fadd fdadd fsadd fasin frem
-# fcmp fatan fscale
-# fdiv fddiv fsdiv fatanh fsin
-# fint fcos fsincos
-# fintrz fcosh fsinh
-# fmove fdmove fsmove fetox ftan
-# fmul fdmul fsmul fetoxm1 ftanh
-# fneg fdneg fsneg fgetexp ftentox
-# fsgldiv fgetman ftwotox
-# fsglmul flog10
-# fsqrt flog2
-# fsub fdsub fssub flogn
-# ftst flognp1
-# which can all use f<op>.{x,p}
-# so, now it's immediate data extended precision AND PACKED FORMAT!
-#
-iea_op:
- andi.l &0x00ff00ff,USER_FPSR(%a6)
-
- btst &0xa,%d0 # is src fmt x or p?
- bne.b iea_op_pack # packed
-
-
- mov.l EXC_EXTWPTR(%a6),%a0 # pass: ptr to #<data>
- lea FP_SRC(%a6),%a1 # pass: ptr to super addr
- mov.l &0xc,%d0 # pass: 12 bytes
- bsr.l _imem_read # read extended immediate
-
- tst.l %d1 # did ifetch fail?
- bne.w iea_iacc # yes
-
- bra.b iea_op_setsrc
-
-iea_op_pack:
-
- mov.l EXC_EXTWPTR(%a6),%a0 # pass: ptr to #<data>
- lea FP_SRC(%a6),%a1 # pass: ptr to super dst
- mov.l &0xc,%d0 # pass: 12 bytes
- bsr.l _imem_read # read packed operand
-
- tst.l %d1 # did ifetch fail?
- bne.w iea_iacc # yes
-
-# The packed operand is an INF or a NAN if the exponent field is all ones.
- bfextu FP_SRC(%a6){&1:&15},%d0 # get exp
- cmpi.w %d0,&0x7fff # INF or NAN?
- beq.b iea_op_setsrc # operand is an INF or NAN
-
-# The packed operand is a zero if the mantissa is all zero, else it's
-# a normal packed op.
- mov.b 3+FP_SRC(%a6),%d0 # get byte 4
- andi.b &0x0f,%d0 # clear all but last nybble
- bne.b iea_op_gp_not_spec # not a zero
- tst.l FP_SRC_HI(%a6) # is lw 2 zero?
- bne.b iea_op_gp_not_spec # not a zero
- tst.l FP_SRC_LO(%a6) # is lw 3 zero?
- beq.b iea_op_setsrc # operand is a ZERO
-iea_op_gp_not_spec:
- lea FP_SRC(%a6),%a0 # pass: ptr to packed op
- bsr.l decbin # convert to extended
- fmovm.x &0x80,FP_SRC(%a6) # make this the srcop
-
-iea_op_setsrc:
- addi.l &0xc,EXC_EXTWPTR(%a6) # update extension word pointer
-
-# FP_SRC now holds the src operand.
- lea FP_SRC(%a6),%a0 # pass: ptr to src op
- bsr.l set_tag_x # tag the operand type
- mov.b %d0,STAG(%a6) # could be ANYTHING!!!
- cmpi.b %d0,&UNNORM # is operand an UNNORM?
- bne.b iea_op_getdst # no
- bsr.l unnorm_fix # yes; convert to NORM/DENORM/ZERO
- mov.b %d0,STAG(%a6) # set new optype tag
-iea_op_getdst:
- clr.b STORE_FLG(%a6) # clear "store result" boolean
-
- btst &0x5,1+EXC_CMDREG(%a6) # is operation monadic or dyadic?
- beq.b iea_op_extract # monadic
- btst &0x4,1+EXC_CMDREG(%a6) # is operation fsincos,ftst,fcmp?
- bne.b iea_op_spec # yes
-
-iea_op_loaddst:
- bfextu EXC_CMDREG(%a6){&6:&3},%d0 # fetch dst regno
- bsr.l load_fpn2 # load dst operand
-
- lea FP_DST(%a6),%a0 # pass: ptr to dst op
- bsr.l set_tag_x # tag the operand type
- mov.b %d0,DTAG(%a6) # could be ANYTHING!!!
- cmpi.b %d0,&UNNORM # is operand an UNNORM?
- bne.b iea_op_extract # no
- bsr.l unnorm_fix # yes; convert to NORM/DENORM/ZERO
- mov.b %d0,DTAG(%a6) # set new optype tag
- bra.b iea_op_extract
-
-# the operation is fsincos, ftst, or fcmp. only fcmp is dyadic
-iea_op_spec:
- btst &0x3,1+EXC_CMDREG(%a6) # is operation fsincos?
- beq.b iea_op_extract # yes
-# now, we're left with ftst and fcmp. so, first let's tag them so that they don't
-# store a result. then, only fcmp will branch back and pick up a dst operand.
- st STORE_FLG(%a6) # don't store a final result
- btst &0x1,1+EXC_CMDREG(%a6) # is operation fcmp?
- beq.b iea_op_loaddst # yes
-
-iea_op_extract:
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass: rnd mode,prec
-
- mov.b 1+EXC_CMDREG(%a6),%d1
- andi.w &0x007f,%d1 # extract extension
-
- fmov.l &0x0,%fpcr
- fmov.l &0x0,%fpsr
-
- lea FP_SRC(%a6),%a0
- lea FP_DST(%a6),%a1
-
- mov.l (tbl_unsupp.l,%pc,%d1.w*4),%d1 # fetch routine addr
- jsr (tbl_unsupp.l,%pc,%d1.l*1)
-
-#
-# Exceptions in order of precedence:
-# BSUN : none
-# SNAN : all operations
-# OPERR : all reg-reg or mem-reg operations that can normally operr
-# OVFL : same as OPERR
-# UNFL : same as OPERR
-# DZ : same as OPERR
-# INEX2 : same as OPERR
-# INEX1 : all packed immediate operations
-#
-
-# we determine the highest priority exception(if any) set by the
-# emulation routine that has also been enabled by the user.
- mov.b FPCR_ENABLE(%a6),%d0 # fetch exceptions enabled
- bne.b iea_op_ena # some are enabled
-
-# now, we save the result, unless, of course, the operation was ftst or fcmp.
-# these don't save results.
-iea_op_save:
- tst.b STORE_FLG(%a6) # does this op store a result?
- bne.b iea_op_exit1 # exit with no frestore
-
-iea_op_store:
- bfextu EXC_CMDREG(%a6){&6:&3},%d0 # fetch dst regno
- bsr.l store_fpreg # store the result
-
-iea_op_exit1:
- mov.l EXC_PC(%a6),USER_FPIAR(%a6) # set FPIAR to "Current PC"
- mov.l EXC_EXTWPTR(%a6),EXC_PC(%a6) # set "Next PC" in exc frame
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6 # unravel the frame
-
- btst &0x7,(%sp) # is trace on?
- bne.w iea_op_trace # yes
-
- bra.l _fpsp_done # exit to os
-
-iea_op_ena:
- and.b FPSR_EXCEPT(%a6),%d0 # keep only ones enable and set
- bfffo %d0{&24:&8},%d0 # find highest priority exception
- bne.b iea_op_exc # at least one was set
-
-# no exception occurred. now, did a disabled, exact overflow occur with inexact
-# enabled? if so, then we have to stuff an overflow frame into the FPU.
- btst &ovfl_bit,FPSR_EXCEPT(%a6) # did overflow occur?
- beq.b iea_op_save
-
-iea_op_ovfl:
- btst &inex2_bit,FPCR_ENABLE(%a6) # is inexact enabled?
- beq.b iea_op_store # no
- bra.b iea_op_exc_ovfl # yes
-
-# an enabled exception occurred. we have to insert the exception type back into
-# the machine.
-iea_op_exc:
- subi.l &24,%d0 # fix offset to be 0-8
- cmpi.b %d0,&0x6 # is exception INEX?
- bne.b iea_op_exc_force # no
-
-# the enabled exception was inexact. so, if it occurs with an overflow
-# or underflow that was disabled, then we have to force an overflow or
-# underflow frame.
- btst &ovfl_bit,FPSR_EXCEPT(%a6) # did overflow occur?
- bne.b iea_op_exc_ovfl # yes
- btst &unfl_bit,FPSR_EXCEPT(%a6) # did underflow occur?
- bne.b iea_op_exc_unfl # yes
-
-iea_op_exc_force:
- mov.w (tbl_iea_except.b,%pc,%d0.w*2),2+FP_SRC(%a6)
- bra.b iea_op_exit2 # exit with frestore
-
-tbl_iea_except:
- short 0xe002, 0xe006, 0xe004, 0xe005
- short 0xe003, 0xe002, 0xe001, 0xe001
-
-iea_op_exc_ovfl:
- mov.w &0xe005,2+FP_SRC(%a6)
- bra.b iea_op_exit2
-
-iea_op_exc_unfl:
- mov.w &0xe003,2+FP_SRC(%a6)
-
-iea_op_exit2:
- mov.l EXC_PC(%a6),USER_FPIAR(%a6) # set FPIAR to "Current PC"
- mov.l EXC_EXTWPTR(%a6),EXC_PC(%a6) # set "Next PC" in exc frame
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- frestore FP_SRC(%a6) # restore exceptional state
-
- unlk %a6 # unravel the frame
-
- btst &0x7,(%sp) # is trace on?
- bne.b iea_op_trace # yes
-
- bra.l _fpsp_done # exit to os
-
-#
-# The opclass two instruction that took an "Unimplemented Effective Address"
-# exception was being traced. Make the "current" PC the FPIAR and put it in
-# the trace stack frame then jump to _real_trace().
-#
-# UNIMP EA FRAME TRACE FRAME
-# ***************** *****************
-# * 0x0 * 0x0f0 * * Current *
-# ***************** * PC *
-# * Current * *****************
-# * PC * * 0x2 * 0x024 *
-# ***************** *****************
-# * SR * * Next *
-# ***************** * PC *
-# *****************
-# * SR *
-# *****************
-iea_op_trace:
- mov.l (%sp),-(%sp) # shift stack frame "down"
- mov.w 0x8(%sp),0x4(%sp)
- mov.w &0x2024,0x6(%sp) # stk fmt = 0x2; voff = 0x024
- fmov.l %fpiar,0x8(%sp) # "Current PC" is in FPIAR
-
- bra.l _real_trace
-
-#########################################################################
-iea_fmovm:
- btst &14,%d0 # ctrl or data reg
- beq.w iea_fmovm_ctrl
-
-iea_fmovm_data:
-
- btst &0x5,EXC_SR(%a6) # user or supervisor mode
- bne.b iea_fmovm_data_s
-
-iea_fmovm_data_u:
- mov.l %usp,%a0
- mov.l %a0,EXC_A7(%a6) # store current a7
- bsr.l fmovm_dynamic # do dynamic fmovm
- mov.l EXC_A7(%a6),%a0 # load possibly new a7
- mov.l %a0,%usp # update usp
- bra.w iea_fmovm_exit
-
-iea_fmovm_data_s:
- clr.b SPCOND_FLG(%a6)
- lea 0x2+EXC_VOFF(%a6),%a0
- mov.l %a0,EXC_A7(%a6)
- bsr.l fmovm_dynamic # do dynamic fmovm
-
- cmpi.b SPCOND_FLG(%a6),&mda7_flg
- beq.w iea_fmovm_data_predec
- cmpi.b SPCOND_FLG(%a6),&mia7_flg
- bne.w iea_fmovm_exit
-
-# right now, d0 = the size.
-# the data has been fetched from the supervisor stack, but we have not
-# incremented the stack pointer by the appropriate number of bytes.
-# do it here.
-iea_fmovm_data_postinc:
- btst &0x7,EXC_SR(%a6)
- bne.b iea_fmovm_data_pi_trace
-
- mov.w EXC_SR(%a6),(EXC_SR,%a6,%d0)
- mov.l EXC_EXTWPTR(%a6),(EXC_PC,%a6,%d0)
- mov.w &0x00f0,(EXC_VOFF,%a6,%d0)
-
- lea (EXC_SR,%a6,%d0),%a0
- mov.l %a0,EXC_SR(%a6)
-
- fmovm.x EXC_FP0(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6
- mov.l (%sp)+,%sp
- bra.l _fpsp_done
-
-iea_fmovm_data_pi_trace:
- mov.w EXC_SR(%a6),(EXC_SR-0x4,%a6,%d0)
- mov.l EXC_EXTWPTR(%a6),(EXC_PC-0x4,%a6,%d0)
- mov.w &0x2024,(EXC_VOFF-0x4,%a6,%d0)
- mov.l EXC_PC(%a6),(EXC_VOFF+0x2-0x4,%a6,%d0)
-
- lea (EXC_SR-0x4,%a6,%d0),%a0
- mov.l %a0,EXC_SR(%a6)
-
- fmovm.x EXC_FP0(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6
- mov.l (%sp)+,%sp
- bra.l _real_trace
-
-# right now, d1 = size and d0 = the strg.
-iea_fmovm_data_predec:
- mov.b %d1,EXC_VOFF(%a6) # store strg
- mov.b %d0,0x1+EXC_VOFF(%a6) # store size
-
- fmovm.x EXC_FP0(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- mov.l (%a6),-(%sp) # make a copy of a6
- mov.l %d0,-(%sp) # save d0
- mov.l %d1,-(%sp) # save d1
- mov.l EXC_EXTWPTR(%a6),-(%sp) # make a copy of Next PC
-
- clr.l %d0
- mov.b 0x1+EXC_VOFF(%a6),%d0 # fetch size
- neg.l %d0 # get negative of size
-
- btst &0x7,EXC_SR(%a6) # is trace enabled?
- beq.b iea_fmovm_data_p2
-
- mov.w EXC_SR(%a6),(EXC_SR-0x4,%a6,%d0)
- mov.l EXC_PC(%a6),(EXC_VOFF-0x2,%a6,%d0)
- mov.l (%sp)+,(EXC_PC-0x4,%a6,%d0)
- mov.w &0x2024,(EXC_VOFF-0x4,%a6,%d0)
-
- pea (%a6,%d0) # create final sp
- bra.b iea_fmovm_data_p3
-
-iea_fmovm_data_p2:
- mov.w EXC_SR(%a6),(EXC_SR,%a6,%d0)
- mov.l (%sp)+,(EXC_PC,%a6,%d0)
- mov.w &0x00f0,(EXC_VOFF,%a6,%d0)
-
- pea (0x4,%a6,%d0) # create final sp
-
-iea_fmovm_data_p3:
- clr.l %d1
- mov.b EXC_VOFF(%a6),%d1 # fetch strg
-
- tst.b %d1
- bpl.b fm_1
- fmovm.x &0x80,(0x4+0x8,%a6,%d0)
- addi.l &0xc,%d0
-fm_1:
- lsl.b &0x1,%d1
- bpl.b fm_2
- fmovm.x &0x40,(0x4+0x8,%a6,%d0)
- addi.l &0xc,%d0
-fm_2:
- lsl.b &0x1,%d1
- bpl.b fm_3
- fmovm.x &0x20,(0x4+0x8,%a6,%d0)
- addi.l &0xc,%d0
-fm_3:
- lsl.b &0x1,%d1
- bpl.b fm_4
- fmovm.x &0x10,(0x4+0x8,%a6,%d0)
- addi.l &0xc,%d0
-fm_4:
- lsl.b &0x1,%d1
- bpl.b fm_5
- fmovm.x &0x08,(0x4+0x8,%a6,%d0)
- addi.l &0xc,%d0
-fm_5:
- lsl.b &0x1,%d1
- bpl.b fm_6
- fmovm.x &0x04,(0x4+0x8,%a6,%d0)
- addi.l &0xc,%d0
-fm_6:
- lsl.b &0x1,%d1
- bpl.b fm_7
- fmovm.x &0x02,(0x4+0x8,%a6,%d0)
- addi.l &0xc,%d0
-fm_7:
- lsl.b &0x1,%d1
- bpl.b fm_end
- fmovm.x &0x01,(0x4+0x8,%a6,%d0)
-fm_end:
- mov.l 0x4(%sp),%d1
- mov.l 0x8(%sp),%d0
- mov.l 0xc(%sp),%a6
- mov.l (%sp)+,%sp
-
- btst &0x7,(%sp) # is trace enabled?
- beq.l _fpsp_done
- bra.l _real_trace
-
-#########################################################################
-iea_fmovm_ctrl:
-
- bsr.l fmovm_ctrl # load ctrl regs
-
-iea_fmovm_exit:
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- btst &0x7,EXC_SR(%a6) # is trace on?
- bne.b iea_fmovm_trace # yes
-
- mov.l EXC_EXTWPTR(%a6),EXC_PC(%a6) # set Next PC
-
- unlk %a6 # unravel the frame
-
- bra.l _fpsp_done # exit to os
-
-#
-# The control reg instruction that took an "Unimplemented Effective Address"
-# exception was being traced. The "Current PC" for the trace frame is the
-# PC stacked for Unimp EA. The "Next PC" is in EXC_EXTWPTR.
-# After fixing the stack frame, jump to _real_trace().
-#
-# UNIMP EA FRAME TRACE FRAME
-# ***************** *****************
-# * 0x0 * 0x0f0 * * Current *
-# ***************** * PC *
-# * Current * *****************
-# * PC * * 0x2 * 0x024 *
-# ***************** *****************
-# * SR * * Next *
-# ***************** * PC *
-# *****************
-# * SR *
-# *****************
-# this ain't a pretty solution, but it works:
-# -restore a6 (not with unlk)
-# -shift stack frame down over where old a6 used to be
-# -add LOCAL_SIZE to stack pointer
-iea_fmovm_trace:
- mov.l (%a6),%a6 # restore frame pointer
- mov.w EXC_SR+LOCAL_SIZE(%sp),0x0+LOCAL_SIZE(%sp)
- mov.l EXC_PC+LOCAL_SIZE(%sp),0x8+LOCAL_SIZE(%sp)
- mov.l EXC_EXTWPTR+LOCAL_SIZE(%sp),0x2+LOCAL_SIZE(%sp)
- mov.w &0x2024,0x6+LOCAL_SIZE(%sp) # stk fmt = 0x2; voff = 0x024
- add.l &LOCAL_SIZE,%sp # clear stack frame
-
- bra.l _real_trace
-
-#########################################################################
-# The FPU is disabled and so we should really have taken the "Line
-# F Emulator" exception. So, here we create an 8-word stack frame
-# from our 4-word stack frame. This means we must calculate the length
-# of the faulting instruction to get the "next PC". This is trivial for
-# immediate operands but requires some extra work for fmovm dynamic
-# which can use most addressing modes.
-iea_disabled:
- mov.l (%sp)+,%d0 # restore d0
-
- link %a6,&-LOCAL_SIZE # init stack frame
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
-
-# PC of instruction that took the exception is the PC in the frame
- mov.l EXC_PC(%a6),EXC_EXTWPTR(%a6)
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch the instruction words
- mov.l %d0,EXC_OPWORD(%a6) # store OPWORD and EXTWORD
-
- tst.w %d0 # is instr fmovm?
- bmi.b iea_dis_fmovm # yes
-# instruction is using an extended precision immediate operand. therefore,
-# the total instruction length is 16 bytes.
-iea_dis_immed:
- mov.l &0x10,%d0 # 16 bytes of instruction
- bra.b iea_dis_cont
-iea_dis_fmovm:
- btst &0xe,%d0 # is instr fmovm ctrl
- bne.b iea_dis_fmovm_data # no
-# the instruction is a fmovm.l with 2 or 3 registers.
- bfextu %d0{&19:&3},%d1
- mov.l &0xc,%d0
- cmpi.b %d1,&0x7 # move all regs?
- bne.b iea_dis_cont
- addq.l &0x4,%d0
- bra.b iea_dis_cont
-# the instruction is an fmovm.x dynamic which can use many addressing
-# modes and thus can have several different total instruction lengths.
-# call fmovm_calc_ea which will go through the ea calc process and,
-# as a by-product, will tell us how long the instruction is.
-iea_dis_fmovm_data:
- clr.l %d0
- bsr.l fmovm_calc_ea
- mov.l EXC_EXTWPTR(%a6),%d0
- sub.l EXC_PC(%a6),%d0
-iea_dis_cont:
- mov.w %d0,EXC_VOFF(%a6) # store stack shift value
-
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6
-
-# here, we actually create the 8-word frame from the 4-word frame,
-# with the "next PC" as additional info.
-# the <ea> field is let as undefined.
- subq.l &0x8,%sp # make room for new stack
- mov.l %d0,-(%sp) # save d0
- mov.w 0xc(%sp),0x4(%sp) # move SR
- mov.l 0xe(%sp),0x6(%sp) # move Current PC
- clr.l %d0
- mov.w 0x12(%sp),%d0
- mov.l 0x6(%sp),0x10(%sp) # move Current PC
- add.l %d0,0x6(%sp) # make Next PC
- mov.w &0x402c,0xa(%sp) # insert offset,frame format
- mov.l (%sp)+,%d0 # restore d0
-
- bra.l _real_fpu_disabled
-
-##########
-
-iea_iacc:
- movc %pcr,%d0
- btst &0x1,%d0
- bne.b iea_iacc_cont
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1 on stack
-iea_iacc_cont:
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6
-
- subq.w &0x8,%sp # make stack frame bigger
- mov.l 0x8(%sp),(%sp) # store SR,hi(PC)
- mov.w 0xc(%sp),0x4(%sp) # store lo(PC)
- mov.w &0x4008,0x6(%sp) # store voff
- mov.l 0x2(%sp),0x8(%sp) # store ea
- mov.l &0x09428001,0xc(%sp) # store fslw
-
-iea_acc_done:
- btst &0x5,(%sp) # user or supervisor mode?
- beq.b iea_acc_done2 # user
- bset &0x2,0xd(%sp) # set supervisor TM bit
-
-iea_acc_done2:
- bra.l _real_access
-
-iea_dacc:
- lea -LOCAL_SIZE(%a6),%sp
-
- movc %pcr,%d1
- btst &0x1,%d1
- bne.b iea_dacc_cont
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1 on stack
- fmovm.l LOCAL_SIZE+USER_FPCR(%sp),%fpcr,%fpsr,%fpiar # restore ctrl regs
-iea_dacc_cont:
- mov.l (%a6),%a6
-
- mov.l 0x4+LOCAL_SIZE(%sp),-0x8+0x4+LOCAL_SIZE(%sp)
- mov.w 0x8+LOCAL_SIZE(%sp),-0x8+0x8+LOCAL_SIZE(%sp)
- mov.w &0x4008,-0x8+0xa+LOCAL_SIZE(%sp)
- mov.l %a0,-0x8+0xc+LOCAL_SIZE(%sp)
- mov.w %d0,-0x8+0x10+LOCAL_SIZE(%sp)
- mov.w &0x0001,-0x8+0x12+LOCAL_SIZE(%sp)
-
- movm.l LOCAL_SIZE+EXC_DREGS(%sp),&0x0303 # restore d0-d1/a0-a1
- add.w &LOCAL_SIZE-0x4,%sp
-
- bra.b iea_acc_done
-
-#########################################################################
-# XDEF **************************************************************** #
-# _fpsp_operr(): 060FPSP entry point for FP Operr exception. #
-# #
-# This handler should be the first code executed upon taking the #
-# FP Operand Error exception in an operating system. #
-# #
-# XREF **************************************************************** #
-# _imem_read_long() - read instruction longword #
-# fix_skewed_ops() - adjust src operand in fsave frame #
-# _real_operr() - "callout" to operating system operr handler #
-# _dmem_write_{byte,word,long}() - store data to mem (opclass 3) #
-# store_dreg_{b,w,l}() - store data to data regfile (opclass 3) #
-# facc_out_{b,w,l}() - store to memory took access error (opcl 3) #
-# #
-# INPUT *************************************************************** #
-# - The system stack contains the FP Operr exception frame #
-# - The fsave frame contains the source operand #
-# #
-# OUTPUT ************************************************************** #
-# No access error: #
-# - The system stack is unchanged #
-# - The fsave frame contains the adjusted src op for opclass 0,2 #
-# #
-# ALGORITHM *********************************************************** #
-# In a system where the FP Operr exception is enabled, the goal #
-# is to get to the handler specified at _real_operr(). But, on the 060, #
-# for opclass zero and two instruction taking this exception, the #
-# input operand in the fsave frame may be incorrect for some cases #
-# and needs to be corrected. This handler calls fix_skewed_ops() to #
-# do just this and then exits through _real_operr(). #
-# For opclass 3 instructions, the 060 doesn't store the default #
-# operr result out to memory or data register file as it should. #
-# This code must emulate the move out before finally exiting through #
-# _real_inex(). The move out, if to memory, is performed using #
-# _mem_write() "callout" routines that may return a failing result. #
-# In this special case, the handler must exit through facc_out() #
-# which creates an access error stack frame from the current operr #
-# stack frame. #
-# #
-#########################################################################
-
- global _fpsp_operr
-_fpsp_operr:
-
- link.w %a6,&-LOCAL_SIZE # init stack frame
-
- fsave FP_SRC(%a6) # grab the "busy" frame
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FPREGS(%a6) # save fp0-fp1 on stack
-
-# the FPIAR holds the "current PC" of the faulting instruction
- mov.l USER_FPIAR(%a6),EXC_EXTWPTR(%a6)
-
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch the instruction words
- mov.l %d0,EXC_OPWORD(%a6)
-
-##############################################################################
-
- btst &13,%d0 # is instr an fmove out?
- bne.b foperr_out # fmove out
-
-
-# here, we simply see if the operand in the fsave frame needs to be "unskewed".
-# this would be the case for opclass two operations with a source infinity or
-# denorm operand in the sgl or dbl format. NANs also become skewed, but can't
-# cause an operr so we don't need to check for them here.
- lea FP_SRC(%a6),%a0 # pass: ptr to src op
- bsr.l fix_skewed_ops # fix src op
-
-foperr_exit:
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- frestore FP_SRC(%a6)
-
- unlk %a6
- bra.l _real_operr
-
-########################################################################
-
-#
-# the hardware does not save the default result to memory on enabled
-# operand error exceptions. we do this here before passing control to
-# the user operand error handler.
-#
-# byte, word, and long destination format operations can pass
-# through here. we simply need to test the sign of the src
-# operand and save the appropriate minimum or maximum integer value
-# to the effective address as pointed to by the stacked effective address.
-#
-# although packed opclass three operations can take operand error
-# exceptions, they won't pass through here since they are caught
-# first by the unsupported data format exception handler. that handler
-# sends them directly to _real_operr() if necessary.
-#
-foperr_out:
-
- mov.w FP_SRC_EX(%a6),%d1 # fetch exponent
- andi.w &0x7fff,%d1
- cmpi.w %d1,&0x7fff
- bne.b foperr_out_not_qnan
-# the operand is either an infinity or a QNAN.
- tst.l FP_SRC_LO(%a6)
- bne.b foperr_out_qnan
- mov.l FP_SRC_HI(%a6),%d1
- andi.l &0x7fffffff,%d1
- beq.b foperr_out_not_qnan
-foperr_out_qnan:
- mov.l FP_SRC_HI(%a6),L_SCR1(%a6)
- bra.b foperr_out_jmp
-
-foperr_out_not_qnan:
- mov.l &0x7fffffff,%d1
- tst.b FP_SRC_EX(%a6)
- bpl.b foperr_out_not_qnan2
- addq.l &0x1,%d1
-foperr_out_not_qnan2:
- mov.l %d1,L_SCR1(%a6)
-
-foperr_out_jmp:
- bfextu %d0{&19:&3},%d0 # extract dst format field
- mov.b 1+EXC_OPWORD(%a6),%d1 # extract <ea> mode,reg
- mov.w (tbl_operr.b,%pc,%d0.w*2),%a0
- jmp (tbl_operr.b,%pc,%a0)
-
-tbl_operr:
- short foperr_out_l - tbl_operr # long word integer
- short tbl_operr - tbl_operr # sgl prec shouldn't happen
- short tbl_operr - tbl_operr # ext prec shouldn't happen
- short foperr_exit - tbl_operr # packed won't enter here
- short foperr_out_w - tbl_operr # word integer
- short tbl_operr - tbl_operr # dbl prec shouldn't happen
- short foperr_out_b - tbl_operr # byte integer
- short tbl_operr - tbl_operr # packed won't enter here
-
-foperr_out_b:
- mov.b L_SCR1(%a6),%d0 # load positive default result
- cmpi.b %d1,&0x7 # is <ea> mode a data reg?
- ble.b foperr_out_b_save_dn # yes
- mov.l EXC_EA(%a6),%a0 # pass: <ea> of default result
- bsr.l _dmem_write_byte # write the default result
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_b # yes
-
- bra.w foperr_exit
-foperr_out_b_save_dn:
- andi.w &0x0007,%d1
- bsr.l store_dreg_b # store result to regfile
- bra.w foperr_exit
-
-foperr_out_w:
- mov.w L_SCR1(%a6),%d0 # load positive default result
- cmpi.b %d1,&0x7 # is <ea> mode a data reg?
- ble.b foperr_out_w_save_dn # yes
- mov.l EXC_EA(%a6),%a0 # pass: <ea> of default result
- bsr.l _dmem_write_word # write the default result
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_w # yes
-
- bra.w foperr_exit
-foperr_out_w_save_dn:
- andi.w &0x0007,%d1
- bsr.l store_dreg_w # store result to regfile
- bra.w foperr_exit
-
-foperr_out_l:
- mov.l L_SCR1(%a6),%d0 # load positive default result
- cmpi.b %d1,&0x7 # is <ea> mode a data reg?
- ble.b foperr_out_l_save_dn # yes
- mov.l EXC_EA(%a6),%a0 # pass: <ea> of default result
- bsr.l _dmem_write_long # write the default result
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_l # yes
-
- bra.w foperr_exit
-foperr_out_l_save_dn:
- andi.w &0x0007,%d1
- bsr.l store_dreg_l # store result to regfile
- bra.w foperr_exit
-
-#########################################################################
-# XDEF **************************************************************** #
-# _fpsp_snan(): 060FPSP entry point for FP SNAN exception. #
-# #
-# This handler should be the first code executed upon taking the #
-# FP Signalling NAN exception in an operating system. #
-# #
-# XREF **************************************************************** #
-# _imem_read_long() - read instruction longword #
-# fix_skewed_ops() - adjust src operand in fsave frame #
-# _real_snan() - "callout" to operating system SNAN handler #
-# _dmem_write_{byte,word,long}() - store data to mem (opclass 3) #
-# store_dreg_{b,w,l}() - store data to data regfile (opclass 3) #
-# facc_out_{b,w,l,d,x}() - store to mem took acc error (opcl 3) #
-# _calc_ea_fout() - fix An if <ea> is -() or ()+; also get <ea> #
-# #
-# INPUT *************************************************************** #
-# - The system stack contains the FP SNAN exception frame #
-# - The fsave frame contains the source operand #
-# #
-# OUTPUT ************************************************************** #
-# No access error: #
-# - The system stack is unchanged #
-# - The fsave frame contains the adjusted src op for opclass 0,2 #
-# #
-# ALGORITHM *********************************************************** #
-# In a system where the FP SNAN exception is enabled, the goal #
-# is to get to the handler specified at _real_snan(). But, on the 060, #
-# for opclass zero and two instructions taking this exception, the #
-# input operand in the fsave frame may be incorrect for some cases #
-# and needs to be corrected. This handler calls fix_skewed_ops() to #
-# do just this and then exits through _real_snan(). #
-# For opclass 3 instructions, the 060 doesn't store the default #
-# SNAN result out to memory or data register file as it should. #
-# This code must emulate the move out before finally exiting through #
-# _real_snan(). The move out, if to memory, is performed using #
-# _mem_write() "callout" routines that may return a failing result. #
-# In this special case, the handler must exit through facc_out() #
-# which creates an access error stack frame from the current SNAN #
-# stack frame. #
-# For the case of an extended precision opclass 3 instruction, #
-# if the effective addressing mode was -() or ()+, then the address #
-# register must get updated by calling _calc_ea_fout(). If the <ea> #
-# was -(a7) from supervisor mode, then the exception frame currently #
-# on the system stack must be carefully moved "down" to make room #
-# for the operand being moved. #
-# #
-#########################################################################
-
- global _fpsp_snan
-_fpsp_snan:
-
- link.w %a6,&-LOCAL_SIZE # init stack frame
-
- fsave FP_SRC(%a6) # grab the "busy" frame
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FPREGS(%a6) # save fp0-fp1 on stack
-
-# the FPIAR holds the "current PC" of the faulting instruction
- mov.l USER_FPIAR(%a6),EXC_EXTWPTR(%a6)
-
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch the instruction words
- mov.l %d0,EXC_OPWORD(%a6)
-
-##############################################################################
-
- btst &13,%d0 # is instr an fmove out?
- bne.w fsnan_out # fmove out
-
-
-# here, we simply see if the operand in the fsave frame needs to be "unskewed".
-# this would be the case for opclass two operations with a source infinity or
-# denorm operand in the sgl or dbl format. NANs also become skewed and must be
-# fixed here.
- lea FP_SRC(%a6),%a0 # pass: ptr to src op
- bsr.l fix_skewed_ops # fix src op
-
-fsnan_exit:
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- frestore FP_SRC(%a6)
-
- unlk %a6
- bra.l _real_snan
-
-########################################################################
-
-#
-# the hardware does not save the default result to memory on enabled
-# snan exceptions. we do this here before passing control to
-# the user snan handler.
-#
-# byte, word, long, and packed destination format operations can pass
-# through here. since packed format operations already were handled by
-# fpsp_unsupp(), then we need to do nothing else for them here.
-# for byte, word, and long, we simply need to test the sign of the src
-# operand and save the appropriate minimum or maximum integer value
-# to the effective address as pointed to by the stacked effective address.
-#
-fsnan_out:
-
- bfextu %d0{&19:&3},%d0 # extract dst format field
- mov.b 1+EXC_OPWORD(%a6),%d1 # extract <ea> mode,reg
- mov.w (tbl_snan.b,%pc,%d0.w*2),%a0
- jmp (tbl_snan.b,%pc,%a0)
-
-tbl_snan:
- short fsnan_out_l - tbl_snan # long word integer
- short fsnan_out_s - tbl_snan # sgl prec shouldn't happen
- short fsnan_out_x - tbl_snan # ext prec shouldn't happen
- short tbl_snan - tbl_snan # packed needs no help
- short fsnan_out_w - tbl_snan # word integer
- short fsnan_out_d - tbl_snan # dbl prec shouldn't happen
- short fsnan_out_b - tbl_snan # byte integer
- short tbl_snan - tbl_snan # packed needs no help
-
-fsnan_out_b:
- mov.b FP_SRC_HI(%a6),%d0 # load upper byte of SNAN
- bset &6,%d0 # set SNAN bit
- cmpi.b %d1,&0x7 # is <ea> mode a data reg?
- ble.b fsnan_out_b_dn # yes
- mov.l EXC_EA(%a6),%a0 # pass: <ea> of default result
- bsr.l _dmem_write_byte # write the default result
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_b # yes
-
- bra.w fsnan_exit
-fsnan_out_b_dn:
- andi.w &0x0007,%d1
- bsr.l store_dreg_b # store result to regfile
- bra.w fsnan_exit
-
-fsnan_out_w:
- mov.w FP_SRC_HI(%a6),%d0 # load upper word of SNAN
- bset &14,%d0 # set SNAN bit
- cmpi.b %d1,&0x7 # is <ea> mode a data reg?
- ble.b fsnan_out_w_dn # yes
- mov.l EXC_EA(%a6),%a0 # pass: <ea> of default result
- bsr.l _dmem_write_word # write the default result
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_w # yes
-
- bra.w fsnan_exit
-fsnan_out_w_dn:
- andi.w &0x0007,%d1
- bsr.l store_dreg_w # store result to regfile
- bra.w fsnan_exit
-
-fsnan_out_l:
- mov.l FP_SRC_HI(%a6),%d0 # load upper longword of SNAN
- bset &30,%d0 # set SNAN bit
- cmpi.b %d1,&0x7 # is <ea> mode a data reg?
- ble.b fsnan_out_l_dn # yes
- mov.l EXC_EA(%a6),%a0 # pass: <ea> of default result
- bsr.l _dmem_write_long # write the default result
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_l # yes
-
- bra.w fsnan_exit
-fsnan_out_l_dn:
- andi.w &0x0007,%d1
- bsr.l store_dreg_l # store result to regfile
- bra.w fsnan_exit
-
-fsnan_out_s:
- cmpi.b %d1,&0x7 # is <ea> mode a data reg?
- ble.b fsnan_out_d_dn # yes
- mov.l FP_SRC_EX(%a6),%d0 # fetch SNAN sign
- andi.l &0x80000000,%d0 # keep sign
- ori.l &0x7fc00000,%d0 # insert new exponent,SNAN bit
- mov.l FP_SRC_HI(%a6),%d1 # load mantissa
- lsr.l &0x8,%d1 # shift mantissa for sgl
- or.l %d1,%d0 # create sgl SNAN
- mov.l EXC_EA(%a6),%a0 # pass: <ea> of default result
- bsr.l _dmem_write_long # write the default result
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_l # yes
-
- bra.w fsnan_exit
-fsnan_out_d_dn:
- mov.l FP_SRC_EX(%a6),%d0 # fetch SNAN sign
- andi.l &0x80000000,%d0 # keep sign
- ori.l &0x7fc00000,%d0 # insert new exponent,SNAN bit
- mov.l %d1,-(%sp)
- mov.l FP_SRC_HI(%a6),%d1 # load mantissa
- lsr.l &0x8,%d1 # shift mantissa for sgl
- or.l %d1,%d0 # create sgl SNAN
- mov.l (%sp)+,%d1
- andi.w &0x0007,%d1
- bsr.l store_dreg_l # store result to regfile
- bra.w fsnan_exit
-
-fsnan_out_d:
- mov.l FP_SRC_EX(%a6),%d0 # fetch SNAN sign
- andi.l &0x80000000,%d0 # keep sign
- ori.l &0x7ff80000,%d0 # insert new exponent,SNAN bit
- mov.l FP_SRC_HI(%a6),%d1 # load hi mantissa
- mov.l %d0,FP_SCR0_EX(%a6) # store to temp space
- mov.l &11,%d0 # load shift amt
- lsr.l %d0,%d1
- or.l %d1,FP_SCR0_EX(%a6) # create dbl hi
- mov.l FP_SRC_HI(%a6),%d1 # load hi mantissa
- andi.l &0x000007ff,%d1
- ror.l %d0,%d1
- mov.l %d1,FP_SCR0_HI(%a6) # store to temp space
- mov.l FP_SRC_LO(%a6),%d1 # load lo mantissa
- lsr.l %d0,%d1
- or.l %d1,FP_SCR0_HI(%a6) # create dbl lo
- lea FP_SCR0(%a6),%a0 # pass: ptr to operand
- mov.l EXC_EA(%a6),%a1 # pass: dst addr
- movq.l &0x8,%d0 # pass: size of 8 bytes
- bsr.l _dmem_write # write the default result
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_d # yes
-
- bra.w fsnan_exit
-
-# for extended precision, if the addressing mode is pre-decrement or
-# post-increment, then the address register did not get updated.
-# in addition, for pre-decrement, the stacked <ea> is incorrect.
-fsnan_out_x:
- clr.b SPCOND_FLG(%a6) # clear special case flag
-
- mov.w FP_SRC_EX(%a6),FP_SCR0_EX(%a6)
- clr.w 2+FP_SCR0(%a6)
- mov.l FP_SRC_HI(%a6),%d0
- bset &30,%d0
- mov.l %d0,FP_SCR0_HI(%a6)
- mov.l FP_SRC_LO(%a6),FP_SCR0_LO(%a6)
-
- btst &0x5,EXC_SR(%a6) # supervisor mode exception?
- bne.b fsnan_out_x_s # yes
-
- mov.l %usp,%a0 # fetch user stack pointer
- mov.l %a0,EXC_A7(%a6) # save on stack for calc_ea()
- mov.l (%a6),EXC_A6(%a6)
-
- bsr.l _calc_ea_fout # find the correct ea,update An
- mov.l %a0,%a1
- mov.l %a0,EXC_EA(%a6) # stack correct <ea>
-
- mov.l EXC_A7(%a6),%a0
- mov.l %a0,%usp # restore user stack pointer
- mov.l EXC_A6(%a6),(%a6)
-
-fsnan_out_x_save:
- lea FP_SCR0(%a6),%a0 # pass: ptr to operand
- movq.l &0xc,%d0 # pass: size of extended
- bsr.l _dmem_write # write the default result
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_x # yes
-
- bra.w fsnan_exit
-
-fsnan_out_x_s:
- mov.l (%a6),EXC_A6(%a6)
-
- bsr.l _calc_ea_fout # find the correct ea,update An
- mov.l %a0,%a1
- mov.l %a0,EXC_EA(%a6) # stack correct <ea>
-
- mov.l EXC_A6(%a6),(%a6)
-
- cmpi.b SPCOND_FLG(%a6),&mda7_flg # is <ea> mode -(a7)?
- bne.b fsnan_out_x_save # no
-
-# the operation was "fmove.x SNAN,-(a7)" from supervisor mode.
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- frestore FP_SRC(%a6)
-
- mov.l EXC_A6(%a6),%a6 # restore frame pointer
-
- mov.l LOCAL_SIZE+EXC_SR(%sp),LOCAL_SIZE+EXC_SR-0xc(%sp)
- mov.l LOCAL_SIZE+EXC_PC+0x2(%sp),LOCAL_SIZE+EXC_PC+0x2-0xc(%sp)
- mov.l LOCAL_SIZE+EXC_EA(%sp),LOCAL_SIZE+EXC_EA-0xc(%sp)
-
- mov.l LOCAL_SIZE+FP_SCR0_EX(%sp),LOCAL_SIZE+EXC_SR(%sp)
- mov.l LOCAL_SIZE+FP_SCR0_HI(%sp),LOCAL_SIZE+EXC_PC+0x2(%sp)
- mov.l LOCAL_SIZE+FP_SCR0_LO(%sp),LOCAL_SIZE+EXC_EA(%sp)
-
- add.l &LOCAL_SIZE-0x8,%sp
-
- bra.l _real_snan
-
-#########################################################################
-# XDEF **************************************************************** #
-# _fpsp_inex(): 060FPSP entry point for FP Inexact exception. #
-# #
-# This handler should be the first code executed upon taking the #
-# FP Inexact exception in an operating system. #
-# #
-# XREF **************************************************************** #
-# _imem_read_long() - read instruction longword #
-# fix_skewed_ops() - adjust src operand in fsave frame #
-# set_tag_x() - determine optype of src/dst operands #
-# store_fpreg() - store opclass 0 or 2 result to FP regfile #
-# unnorm_fix() - change UNNORM operands to NORM or ZERO #
-# load_fpn2() - load dst operand from FP regfile #
-# smovcr() - emulate an "fmovcr" instruction #
-# fout() - emulate an opclass 3 instruction #
-# tbl_unsupp - add of table of emulation routines for opclass 0,2 #
-# _real_inex() - "callout" to operating system inexact handler #
-# #
-# INPUT *************************************************************** #
-# - The system stack contains the FP Inexact exception frame #
-# - The fsave frame contains the source operand #
-# #
-# OUTPUT ************************************************************** #
-# - The system stack is unchanged #
-# - The fsave frame contains the adjusted src op for opclass 0,2 #
-# #
-# ALGORITHM *********************************************************** #
-# In a system where the FP Inexact exception is enabled, the goal #
-# is to get to the handler specified at _real_inex(). But, on the 060, #
-# for opclass zero and two instruction taking this exception, the #
-# hardware doesn't store the correct result to the destination FP #
-# register as did the '040 and '881/2. This handler must emulate the #
-# instruction in order to get this value and then store it to the #
-# correct register before calling _real_inex(). #
-# For opclass 3 instructions, the 060 doesn't store the default #
-# inexact result out to memory or data register file as it should. #
-# This code must emulate the move out by calling fout() before finally #
-# exiting through _real_inex(). #
-# #
-#########################################################################
-
- global _fpsp_inex
-_fpsp_inex:
-
- link.w %a6,&-LOCAL_SIZE # init stack frame
-
- fsave FP_SRC(%a6) # grab the "busy" frame
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FPREGS(%a6) # save fp0-fp1 on stack
-
-# the FPIAR holds the "current PC" of the faulting instruction
- mov.l USER_FPIAR(%a6),EXC_EXTWPTR(%a6)
-
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch the instruction words
- mov.l %d0,EXC_OPWORD(%a6)
-
-##############################################################################
-
- btst &13,%d0 # is instr an fmove out?
- bne.w finex_out # fmove out
-
-
-# the hardware, for "fabs" and "fneg" w/ a long source format, puts the
-# longword integer directly into the upper longword of the mantissa along
-# w/ an exponent value of 0x401e. we convert this to extended precision here.
- bfextu %d0{&19:&3},%d0 # fetch instr size
- bne.b finex_cont # instr size is not long
- cmpi.w FP_SRC_EX(%a6),&0x401e # is exponent 0x401e?
- bne.b finex_cont # no
- fmov.l &0x0,%fpcr
- fmov.l FP_SRC_HI(%a6),%fp0 # load integer src
- fmov.x %fp0,FP_SRC(%a6) # store integer as extended precision
- mov.w &0xe001,0x2+FP_SRC(%a6)
-
-finex_cont:
- lea FP_SRC(%a6),%a0 # pass: ptr to src op
- bsr.l fix_skewed_ops # fix src op
-
-# Here, we zero the ccode and exception byte field since we're going to
-# emulate the whole instruction. Notice, though, that we don't kill the
-# INEX1 bit. This is because a packed op has long since been converted
-# to extended before arriving here. Therefore, we need to retain the
-# INEX1 bit from when the operand was first converted.
- andi.l &0x00ff01ff,USER_FPSR(%a6) # zero all but accured field
-
- fmov.l &0x0,%fpcr # zero current control regs
- fmov.l &0x0,%fpsr
-
- bfextu EXC_EXTWORD(%a6){&0:&6},%d1 # extract upper 6 of cmdreg
- cmpi.b %d1,&0x17 # is op an fmovecr?
- beq.w finex_fmovcr # yes
-
- lea FP_SRC(%a6),%a0 # pass: ptr to src op
- bsr.l set_tag_x # tag the operand type
- mov.b %d0,STAG(%a6) # maybe NORM,DENORM
-
-# bits four and five of the fp extension word separate the monadic and dyadic
-# operations that can pass through fpsp_inex(). remember that fcmp and ftst
-# will never take this exception, but fsincos will.
- btst &0x5,1+EXC_CMDREG(%a6) # is operation monadic or dyadic?
- beq.b finex_extract # monadic
-
- btst &0x4,1+EXC_CMDREG(%a6) # is operation an fsincos?
- bne.b finex_extract # yes
-
- bfextu EXC_CMDREG(%a6){&6:&3},%d0 # dyadic; load dst reg
- bsr.l load_fpn2 # load dst into FP_DST
-
- lea FP_DST(%a6),%a0 # pass: ptr to dst op
- bsr.l set_tag_x # tag the operand type
- cmpi.b %d0,&UNNORM # is operand an UNNORM?
- bne.b finex_op2_done # no
- bsr.l unnorm_fix # yes; convert to NORM,DENORM,or ZERO
-finex_op2_done:
- mov.b %d0,DTAG(%a6) # save dst optype tag
-
-finex_extract:
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd prec/mode
-
- mov.b 1+EXC_CMDREG(%a6),%d1
- andi.w &0x007f,%d1 # extract extension
-
- lea FP_SRC(%a6),%a0
- lea FP_DST(%a6),%a1
-
- mov.l (tbl_unsupp.l,%pc,%d1.w*4),%d1 # fetch routine addr
- jsr (tbl_unsupp.l,%pc,%d1.l*1)
-
-# the operation has been emulated. the result is in fp0.
-finex_save:
- bfextu EXC_CMDREG(%a6){&6:&3},%d0
- bsr.l store_fpreg
-
-finex_exit:
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- frestore FP_SRC(%a6)
-
- unlk %a6
- bra.l _real_inex
-
-finex_fmovcr:
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd prec,mode
- mov.b 1+EXC_CMDREG(%a6),%d1
- andi.l &0x0000007f,%d1 # pass rom offset
- bsr.l smovcr
- bra.b finex_save
-
-########################################################################
-
-#
-# the hardware does not save the default result to memory on enabled
-# inexact exceptions. we do this here before passing control to
-# the user inexact handler.
-#
-# byte, word, and long destination format operations can pass
-# through here. so can double and single precision.
-# although packed opclass three operations can take inexact
-# exceptions, they won't pass through here since they are caught
-# first by the unsupported data format exception handler. that handler
-# sends them directly to _real_inex() if necessary.
-#
-finex_out:
-
- mov.b &NORM,STAG(%a6) # src is a NORM
-
- clr.l %d0
- mov.b FPCR_MODE(%a6),%d0 # pass rnd prec,mode
-
- andi.l &0xffff00ff,USER_FPSR(%a6) # zero exception field
-
- lea FP_SRC(%a6),%a0 # pass ptr to src operand
-
- bsr.l fout # store the default result
-
- bra.b finex_exit
-
-#########################################################################
-# XDEF **************************************************************** #
-# _fpsp_dz(): 060FPSP entry point for FP DZ exception. #
-# #
-# This handler should be the first code executed upon taking #
-# the FP DZ exception in an operating system. #
-# #
-# XREF **************************************************************** #
-# _imem_read_long() - read instruction longword from memory #
-# fix_skewed_ops() - adjust fsave operand #
-# _real_dz() - "callout" exit point from FP DZ handler #
-# #
-# INPUT *************************************************************** #
-# - The system stack contains the FP DZ exception stack. #
-# - The fsave frame contains the source operand. #
-# #
-# OUTPUT ************************************************************** #
-# - The system stack contains the FP DZ exception stack. #
-# - The fsave frame contains the adjusted source operand. #
-# #
-# ALGORITHM *********************************************************** #
-# In a system where the DZ exception is enabled, the goal is to #
-# get to the handler specified at _real_dz(). But, on the 060, when the #
-# exception is taken, the input operand in the fsave state frame may #
-# be incorrect for some cases and need to be adjusted. So, this package #
-# adjusts the operand using fix_skewed_ops() and then branches to #
-# _real_dz(). #
-# #
-#########################################################################
-
- global _fpsp_dz
-_fpsp_dz:
-
- link.w %a6,&-LOCAL_SIZE # init stack frame
-
- fsave FP_SRC(%a6) # grab the "busy" frame
-
- movm.l &0x0303,EXC_DREGS(%a6) # save d0-d1/a0-a1
- fmovm.l %fpcr,%fpsr,%fpiar,USER_FPCR(%a6) # save ctrl regs
- fmovm.x &0xc0,EXC_FPREGS(%a6) # save fp0-fp1 on stack
-
-# the FPIAR holds the "current PC" of the faulting instruction
- mov.l USER_FPIAR(%a6),EXC_EXTWPTR(%a6)
-
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch the instruction words
- mov.l %d0,EXC_OPWORD(%a6)
-
-##############################################################################
-
-
-# here, we simply see if the operand in the fsave frame needs to be "unskewed".
-# this would be the case for opclass two operations with a source zero
-# in the sgl or dbl format.
- lea FP_SRC(%a6),%a0 # pass: ptr to src op
- bsr.l fix_skewed_ops # fix src op
-
-fdz_exit:
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- frestore FP_SRC(%a6)
-
- unlk %a6
- bra.l _real_dz
-
-#########################################################################
-# XDEF **************************************************************** #
-# _fpsp_fline(): 060FPSP entry point for "Line F emulator" #
-# exception when the "reduced" version of the #
-# FPSP is implemented that does not emulate #
-# FP unimplemented instructions. #
-# #
-# This handler should be the first code executed upon taking a #
-# "Line F Emulator" exception in an operating system integrating #
-# the reduced version of 060FPSP. #
-# #
-# XREF **************************************************************** #
-# _real_fpu_disabled() - Handle "FPU disabled" exceptions #
-# _real_fline() - Handle all other cases (treated equally) #
-# #
-# INPUT *************************************************************** #
-# - The system stack contains a "Line F Emulator" exception #
-# stack frame. #
-# #
-# OUTPUT ************************************************************** #
-# - The system stack is unchanged. #
-# #
-# ALGORITHM *********************************************************** #
-# When a "Line F Emulator" exception occurs in a system where #
-# "FPU Unimplemented" instructions will not be emulated, the exception #
-# can occur because then FPU is disabled or the instruction is to be #
-# classifed as "Line F". This module determines which case exists and #
-# calls the appropriate "callout". #
-# #
-#########################################################################
-
- global _fpsp_fline
-_fpsp_fline:
-
-# check to see if the FPU is disabled. if so, jump to the OS entry
-# point for that condition.
- cmpi.w 0x6(%sp),&0x402c
- beq.l _real_fpu_disabled
-
- bra.l _real_fline
-
-#########################################################################
-# XDEF **************************************************************** #
-# _dcalc_ea(): calc correct <ea> from <ea> stacked on exception #
-# #
-# XREF **************************************************************** #
-# inc_areg() - increment an address register #
-# dec_areg() - decrement an address register #
-# #
-# INPUT *************************************************************** #
-# d0 = number of bytes to adjust <ea> by #
-# #
-# OUTPUT ************************************************************** #
-# None #
-# #
-# ALGORITHM *********************************************************** #
-# "Dummy" CALCulate Effective Address: #
-# The stacked <ea> for FP unimplemented instructions and opclass #
-# two packed instructions is correct with the exception of... #
-# #
-# 1) -(An) : The register is not updated regardless of size. #
-# Also, for extended precision and packed, the #
-# stacked <ea> value is 8 bytes too big #
-# 2) (An)+ : The register is not updated. #
-# 3) #<data> : The upper longword of the immediate operand is #
-# stacked b,w,l and s sizes are completely stacked. #
-# d,x, and p are not. #
-# #
-#########################################################################
-
- global _dcalc_ea
-_dcalc_ea:
- mov.l %d0, %a0 # move # bytes to %a0
-
- mov.b 1+EXC_OPWORD(%a6), %d0 # fetch opcode word
- mov.l %d0, %d1 # make a copy
-
- andi.w &0x38, %d0 # extract mode field
- andi.l &0x7, %d1 # extract reg field
-
- cmpi.b %d0,&0x18 # is mode (An)+ ?
- beq.b dcea_pi # yes
-
- cmpi.b %d0,&0x20 # is mode -(An) ?
- beq.b dcea_pd # yes
-
- or.w %d1,%d0 # concat mode,reg
- cmpi.b %d0,&0x3c # is mode #<data>?
-
- beq.b dcea_imm # yes
-
- mov.l EXC_EA(%a6),%a0 # return <ea>
- rts
-
-# need to set immediate data flag here since we'll need to do
-# an imem_read to fetch this later.
-dcea_imm:
- mov.b &immed_flg,SPCOND_FLG(%a6)
- lea ([USER_FPIAR,%a6],0x4),%a0 # no; return <ea>
- rts
-
-# here, the <ea> is stacked correctly. however, we must update the
-# address register...
-dcea_pi:
- mov.l %a0,%d0 # pass amt to inc by
- bsr.l inc_areg # inc addr register
-
- mov.l EXC_EA(%a6),%a0 # stacked <ea> is correct
- rts
-
-# the <ea> is stacked correctly for all but extended and packed which
-# the <ea>s are 8 bytes too large.
-# it would make no sense to have a pre-decrement to a7 in supervisor
-# mode so we don't even worry about this tricky case here : )
-dcea_pd:
- mov.l %a0,%d0 # pass amt to dec by
- bsr.l dec_areg # dec addr register
-
- mov.l EXC_EA(%a6),%a0 # stacked <ea> is correct
-
- cmpi.b %d0,&0xc # is opsize ext or packed?
- beq.b dcea_pd2 # yes
- rts
-dcea_pd2:
- sub.l &0x8,%a0 # correct <ea>
- mov.l %a0,EXC_EA(%a6) # put correct <ea> on stack
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# _calc_ea_fout(): calculate correct stacked <ea> for extended #
-# and packed data opclass 3 operations. #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# None #
-# #
-# OUTPUT ************************************************************** #
-# a0 = return correct effective address #
-# #
-# ALGORITHM *********************************************************** #
-# For opclass 3 extended and packed data operations, the <ea> #
-# stacked for the exception is incorrect for -(an) and (an)+ addressing #
-# modes. Also, while we're at it, the index register itself must get #
-# updated. #
-# So, for -(an), we must subtract 8 off of the stacked <ea> value #
-# and return that value as the correct <ea> and store that value in An. #
-# For (an)+, the stacked <ea> is correct but we must adjust An by +12. #
-# #
-#########################################################################
-
-# This calc_ea is currently used to retrieve the correct <ea>
-# for fmove outs of type extended and packed.
- global _calc_ea_fout
-_calc_ea_fout:
- mov.b 1+EXC_OPWORD(%a6),%d0 # fetch opcode word
- mov.l %d0,%d1 # make a copy
-
- andi.w &0x38,%d0 # extract mode field
- andi.l &0x7,%d1 # extract reg field
-
- cmpi.b %d0,&0x18 # is mode (An)+ ?
- beq.b ceaf_pi # yes
-
- cmpi.b %d0,&0x20 # is mode -(An) ?
- beq.w ceaf_pd # yes
-
- mov.l EXC_EA(%a6),%a0 # stacked <ea> is correct
- rts
-
-# (An)+ : extended and packed fmove out
-# : stacked <ea> is correct
-# : "An" not updated
-ceaf_pi:
- mov.w (tbl_ceaf_pi.b,%pc,%d1.w*2),%d1
- mov.l EXC_EA(%a6),%a0
- jmp (tbl_ceaf_pi.b,%pc,%d1.w*1)
-
- swbeg &0x8
-tbl_ceaf_pi:
- short ceaf_pi0 - tbl_ceaf_pi
- short ceaf_pi1 - tbl_ceaf_pi
- short ceaf_pi2 - tbl_ceaf_pi
- short ceaf_pi3 - tbl_ceaf_pi
- short ceaf_pi4 - tbl_ceaf_pi
- short ceaf_pi5 - tbl_ceaf_pi
- short ceaf_pi6 - tbl_ceaf_pi
- short ceaf_pi7 - tbl_ceaf_pi
-
-ceaf_pi0:
- addi.l &0xc,EXC_DREGS+0x8(%a6)
- rts
-ceaf_pi1:
- addi.l &0xc,EXC_DREGS+0xc(%a6)
- rts
-ceaf_pi2:
- add.l &0xc,%a2
- rts
-ceaf_pi3:
- add.l &0xc,%a3
- rts
-ceaf_pi4:
- add.l &0xc,%a4
- rts
-ceaf_pi5:
- add.l &0xc,%a5
- rts
-ceaf_pi6:
- addi.l &0xc,EXC_A6(%a6)
- rts
-ceaf_pi7:
- mov.b &mia7_flg,SPCOND_FLG(%a6)
- addi.l &0xc,EXC_A7(%a6)
- rts
-
-# -(An) : extended and packed fmove out
-# : stacked <ea> = actual <ea> + 8
-# : "An" not updated
-ceaf_pd:
- mov.w (tbl_ceaf_pd.b,%pc,%d1.w*2),%d1
- mov.l EXC_EA(%a6),%a0
- sub.l &0x8,%a0
- sub.l &0x8,EXC_EA(%a6)
- jmp (tbl_ceaf_pd.b,%pc,%d1.w*1)
-
- swbeg &0x8
-tbl_ceaf_pd:
- short ceaf_pd0 - tbl_ceaf_pd
- short ceaf_pd1 - tbl_ceaf_pd
- short ceaf_pd2 - tbl_ceaf_pd
- short ceaf_pd3 - tbl_ceaf_pd
- short ceaf_pd4 - tbl_ceaf_pd
- short ceaf_pd5 - tbl_ceaf_pd
- short ceaf_pd6 - tbl_ceaf_pd
- short ceaf_pd7 - tbl_ceaf_pd
-
-ceaf_pd0:
- mov.l %a0,EXC_DREGS+0x8(%a6)
- rts
-ceaf_pd1:
- mov.l %a0,EXC_DREGS+0xc(%a6)
- rts
-ceaf_pd2:
- mov.l %a0,%a2
- rts
-ceaf_pd3:
- mov.l %a0,%a3
- rts
-ceaf_pd4:
- mov.l %a0,%a4
- rts
-ceaf_pd5:
- mov.l %a0,%a5
- rts
-ceaf_pd6:
- mov.l %a0,EXC_A6(%a6)
- rts
-ceaf_pd7:
- mov.l %a0,EXC_A7(%a6)
- mov.b &mda7_flg,SPCOND_FLG(%a6)
- rts
-
-#
-# This table holds the offsets of the emulation routines for each individual
-# math operation relative to the address of this table. Included are
-# routines like fadd/fmul/fabs. The transcendentals ARE NOT. This is because
-# this table is for the version if the 060FPSP without transcendentals.
-# The location within the table is determined by the extension bits of the
-# operation longword.
-#
-
- swbeg &109
-tbl_unsupp:
- long fin - tbl_unsupp # 00: fmove
- long fint - tbl_unsupp # 01: fint
- long tbl_unsupp - tbl_unsupp # 02: fsinh
- long fintrz - tbl_unsupp # 03: fintrz
- long fsqrt - tbl_unsupp # 04: fsqrt
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp # 06: flognp1
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp # 08: fetoxm1
- long tbl_unsupp - tbl_unsupp # 09: ftanh
- long tbl_unsupp - tbl_unsupp # 0a: fatan
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp # 0c: fasin
- long tbl_unsupp - tbl_unsupp # 0d: fatanh
- long tbl_unsupp - tbl_unsupp # 0e: fsin
- long tbl_unsupp - tbl_unsupp # 0f: ftan
- long tbl_unsupp - tbl_unsupp # 10: fetox
- long tbl_unsupp - tbl_unsupp # 11: ftwotox
- long tbl_unsupp - tbl_unsupp # 12: ftentox
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp # 14: flogn
- long tbl_unsupp - tbl_unsupp # 15: flog10
- long tbl_unsupp - tbl_unsupp # 16: flog2
- long tbl_unsupp - tbl_unsupp
- long fabs - tbl_unsupp # 18: fabs
- long tbl_unsupp - tbl_unsupp # 19: fcosh
- long fneg - tbl_unsupp # 1a: fneg
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp # 1c: facos
- long tbl_unsupp - tbl_unsupp # 1d: fcos
- long tbl_unsupp - tbl_unsupp # 1e: fgetexp
- long tbl_unsupp - tbl_unsupp # 1f: fgetman
- long fdiv - tbl_unsupp # 20: fdiv
- long tbl_unsupp - tbl_unsupp # 21: fmod
- long fadd - tbl_unsupp # 22: fadd
- long fmul - tbl_unsupp # 23: fmul
- long fsgldiv - tbl_unsupp # 24: fsgldiv
- long tbl_unsupp - tbl_unsupp # 25: frem
- long tbl_unsupp - tbl_unsupp # 26: fscale
- long fsglmul - tbl_unsupp # 27: fsglmul
- long fsub - tbl_unsupp # 28: fsub
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp # 30: fsincos
- long tbl_unsupp - tbl_unsupp # 31: fsincos
- long tbl_unsupp - tbl_unsupp # 32: fsincos
- long tbl_unsupp - tbl_unsupp # 33: fsincos
- long tbl_unsupp - tbl_unsupp # 34: fsincos
- long tbl_unsupp - tbl_unsupp # 35: fsincos
- long tbl_unsupp - tbl_unsupp # 36: fsincos
- long tbl_unsupp - tbl_unsupp # 37: fsincos
- long fcmp - tbl_unsupp # 38: fcmp
- long tbl_unsupp - tbl_unsupp
- long ftst - tbl_unsupp # 3a: ftst
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long fsin - tbl_unsupp # 40: fsmove
- long fssqrt - tbl_unsupp # 41: fssqrt
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long fdin - tbl_unsupp # 44: fdmove
- long fdsqrt - tbl_unsupp # 45: fdsqrt
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long fsabs - tbl_unsupp # 58: fsabs
- long tbl_unsupp - tbl_unsupp
- long fsneg - tbl_unsupp # 5a: fsneg
- long tbl_unsupp - tbl_unsupp
- long fdabs - tbl_unsupp # 5c: fdabs
- long tbl_unsupp - tbl_unsupp
- long fdneg - tbl_unsupp # 5e: fdneg
- long tbl_unsupp - tbl_unsupp
- long fsdiv - tbl_unsupp # 60: fsdiv
- long tbl_unsupp - tbl_unsupp
- long fsadd - tbl_unsupp # 62: fsadd
- long fsmul - tbl_unsupp # 63: fsmul
- long fddiv - tbl_unsupp # 64: fddiv
- long tbl_unsupp - tbl_unsupp
- long fdadd - tbl_unsupp # 66: fdadd
- long fdmul - tbl_unsupp # 67: fdmul
- long fssub - tbl_unsupp # 68: fssub
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long tbl_unsupp - tbl_unsupp
- long fdsub - tbl_unsupp # 6c: fdsub
-
-#################################################
-# Add this here so non-fp modules can compile.
-# (smovcr is called from fpsp_inex.)
- global smovcr
-smovcr:
- bra.b smovcr
-
-#########################################################################
-# XDEF **************************************************************** #
-# fmovm_dynamic(): emulate "fmovm" dynamic instruction #
-# #
-# XREF **************************************************************** #
-# fetch_dreg() - fetch data register #
-# {i,d,}mem_read() - fetch data from memory #
-# _mem_write() - write data to memory #
-# iea_iacc() - instruction memory access error occurred #
-# iea_dacc() - data memory access error occurred #
-# restore() - restore An index regs if access error occurred #
-# #
-# INPUT *************************************************************** #
-# None #
-# #
-# OUTPUT ************************************************************** #
-# If instr is "fmovm Dn,-(A7)" from supervisor mode, #
-# d0 = size of dump #
-# d1 = Dn #
-# Else if instruction access error, #
-# d0 = FSLW #
-# Else if data access error, #
-# d0 = FSLW #
-# a0 = address of fault #
-# Else #
-# none. #
-# #
-# ALGORITHM *********************************************************** #
-# The effective address must be calculated since this is entered #
-# from an "Unimplemented Effective Address" exception handler. So, we #
-# have our own fcalc_ea() routine here. If an access error is flagged #
-# by a _{i,d,}mem_read() call, we must exit through the special #
-# handler. #
-# The data register is determined and its value loaded to get the #
-# string of FP registers affected. This value is used as an index into #
-# a lookup table such that we can determine the number of bytes #
-# involved. #
-# If the instruction is "fmovm.x <ea>,Dn", a _mem_read() is used #
-# to read in all FP values. Again, _mem_read() may fail and require a #
-# special exit. #
-# If the instruction is "fmovm.x DN,<ea>", a _mem_write() is used #
-# to write all FP values. _mem_write() may also fail. #
-# If the instruction is "fmovm.x DN,-(a7)" from supervisor mode, #
-# then we return the size of the dump and the string to the caller #
-# so that the move can occur outside of this routine. This special #
-# case is required so that moves to the system stack are handled #
-# correctly. #
-# #
-# DYNAMIC: #
-# fmovm.x dn, <ea> #
-# fmovm.x <ea>, dn #
-# #
-# <WORD 1> <WORD2> #
-# 1111 0010 00 |<ea>| 11@& 1000 0$$$ 0000 #
-# #
-# & = (0): predecrement addressing mode #
-# (1): postincrement or control addressing mode #
-# @ = (0): move listed regs from memory to the FPU #
-# (1): move listed regs from the FPU to memory #
-# $$$ : index of data register holding reg select mask #
-# #
-# NOTES: #
-# If the data register holds a zero, then the #
-# instruction is a nop. #
-# #
-#########################################################################
-
- global fmovm_dynamic
-fmovm_dynamic:
-
-# extract the data register in which the bit string resides...
- mov.b 1+EXC_EXTWORD(%a6),%d1 # fetch extword
- andi.w &0x70,%d1 # extract reg bits
- lsr.b &0x4,%d1 # shift into lo bits
-
-# fetch the bit string into d0...
- bsr.l fetch_dreg # fetch reg string
-
- andi.l &0x000000ff,%d0 # keep only lo byte
-
- mov.l %d0,-(%sp) # save strg
- mov.b (tbl_fmovm_size.w,%pc,%d0),%d0
- mov.l %d0,-(%sp) # save size
- bsr.l fmovm_calc_ea # calculate <ea>
- mov.l (%sp)+,%d0 # restore size
- mov.l (%sp)+,%d1 # restore strg
-
-# if the bit string is a zero, then the operation is a no-op
-# but, make sure that we've calculated ea and advanced the opword pointer
- beq.w fmovm_data_done
-
-# separate move ins from move outs...
- btst &0x5,EXC_EXTWORD(%a6) # is it a move in or out?
- beq.w fmovm_data_in # it's a move out
-
-#############
-# MOVE OUT: #
-#############
-fmovm_data_out:
- btst &0x4,EXC_EXTWORD(%a6) # control or predecrement?
- bne.w fmovm_out_ctrl # control
-
-############################
-fmovm_out_predec:
-# for predecrement mode, the bit string is the opposite of both control
-# operations and postincrement mode. (bit7 = FP7 ... bit0 = FP0)
-# here, we convert it to be just like the others...
- mov.b (tbl_fmovm_convert.w,%pc,%d1.w*1),%d1
-
- btst &0x5,EXC_SR(%a6) # user or supervisor mode?
- beq.b fmovm_out_ctrl # user
-
-fmovm_out_predec_s:
- cmpi.b SPCOND_FLG(%a6),&mda7_flg # is <ea> mode -(a7)?
- bne.b fmovm_out_ctrl
-
-# the operation was unfortunately an: fmovm.x dn,-(sp)
-# called from supervisor mode.
-# we're also passing "size" and "strg" back to the calling routine
- rts
-
-############################
-fmovm_out_ctrl:
- mov.l %a0,%a1 # move <ea> to a1
-
- sub.l %d0,%sp # subtract size of dump
- lea (%sp),%a0
-
- tst.b %d1 # should FP0 be moved?
- bpl.b fmovm_out_ctrl_fp1 # no
-
- mov.l 0x0+EXC_FP0(%a6),(%a0)+ # yes
- mov.l 0x4+EXC_FP0(%a6),(%a0)+
- mov.l 0x8+EXC_FP0(%a6),(%a0)+
-
-fmovm_out_ctrl_fp1:
- lsl.b &0x1,%d1 # should FP1 be moved?
- bpl.b fmovm_out_ctrl_fp2 # no
-
- mov.l 0x0+EXC_FP1(%a6),(%a0)+ # yes
- mov.l 0x4+EXC_FP1(%a6),(%a0)+
- mov.l 0x8+EXC_FP1(%a6),(%a0)+
-
-fmovm_out_ctrl_fp2:
- lsl.b &0x1,%d1 # should FP2 be moved?
- bpl.b fmovm_out_ctrl_fp3 # no
-
- fmovm.x &0x20,(%a0) # yes
- add.l &0xc,%a0
-
-fmovm_out_ctrl_fp3:
- lsl.b &0x1,%d1 # should FP3 be moved?
- bpl.b fmovm_out_ctrl_fp4 # no
-
- fmovm.x &0x10,(%a0) # yes
- add.l &0xc,%a0
-
-fmovm_out_ctrl_fp4:
- lsl.b &0x1,%d1 # should FP4 be moved?
- bpl.b fmovm_out_ctrl_fp5 # no
-
- fmovm.x &0x08,(%a0) # yes
- add.l &0xc,%a0
-
-fmovm_out_ctrl_fp5:
- lsl.b &0x1,%d1 # should FP5 be moved?
- bpl.b fmovm_out_ctrl_fp6 # no
-
- fmovm.x &0x04,(%a0) # yes
- add.l &0xc,%a0
-
-fmovm_out_ctrl_fp6:
- lsl.b &0x1,%d1 # should FP6 be moved?
- bpl.b fmovm_out_ctrl_fp7 # no
-
- fmovm.x &0x02,(%a0) # yes
- add.l &0xc,%a0
-
-fmovm_out_ctrl_fp7:
- lsl.b &0x1,%d1 # should FP7 be moved?
- bpl.b fmovm_out_ctrl_done # no
-
- fmovm.x &0x01,(%a0) # yes
- add.l &0xc,%a0
-
-fmovm_out_ctrl_done:
- mov.l %a1,L_SCR1(%a6)
-
- lea (%sp),%a0 # pass: supervisor src
- mov.l %d0,-(%sp) # save size
- bsr.l _dmem_write # copy data to user mem
-
- mov.l (%sp)+,%d0
- add.l %d0,%sp # clear fpreg data from stack
-
- tst.l %d1 # did dstore err?
- bne.w fmovm_out_err # yes
-
- rts
-
-############
-# MOVE IN: #
-############
-fmovm_data_in:
- mov.l %a0,L_SCR1(%a6)
-
- sub.l %d0,%sp # make room for fpregs
- lea (%sp),%a1
-
- mov.l %d1,-(%sp) # save bit string for later
- mov.l %d0,-(%sp) # save # of bytes
-
- bsr.l _dmem_read # copy data from user mem
-
- mov.l (%sp)+,%d0 # retrieve # of bytes
-
- tst.l %d1 # did dfetch fail?
- bne.w fmovm_in_err # yes
-
- mov.l (%sp)+,%d1 # load bit string
-
- lea (%sp),%a0 # addr of stack
-
- tst.b %d1 # should FP0 be moved?
- bpl.b fmovm_data_in_fp1 # no
-
- mov.l (%a0)+,0x0+EXC_FP0(%a6) # yes
- mov.l (%a0)+,0x4+EXC_FP0(%a6)
- mov.l (%a0)+,0x8+EXC_FP0(%a6)
-
-fmovm_data_in_fp1:
- lsl.b &0x1,%d1 # should FP1 be moved?
- bpl.b fmovm_data_in_fp2 # no
-
- mov.l (%a0)+,0x0+EXC_FP1(%a6) # yes
- mov.l (%a0)+,0x4+EXC_FP1(%a6)
- mov.l (%a0)+,0x8+EXC_FP1(%a6)
-
-fmovm_data_in_fp2:
- lsl.b &0x1,%d1 # should FP2 be moved?
- bpl.b fmovm_data_in_fp3 # no
-
- fmovm.x (%a0)+,&0x20 # yes
-
-fmovm_data_in_fp3:
- lsl.b &0x1,%d1 # should FP3 be moved?
- bpl.b fmovm_data_in_fp4 # no
-
- fmovm.x (%a0)+,&0x10 # yes
-
-fmovm_data_in_fp4:
- lsl.b &0x1,%d1 # should FP4 be moved?
- bpl.b fmovm_data_in_fp5 # no
-
- fmovm.x (%a0)+,&0x08 # yes
-
-fmovm_data_in_fp5:
- lsl.b &0x1,%d1 # should FP5 be moved?
- bpl.b fmovm_data_in_fp6 # no
-
- fmovm.x (%a0)+,&0x04 # yes
-
-fmovm_data_in_fp6:
- lsl.b &0x1,%d1 # should FP6 be moved?
- bpl.b fmovm_data_in_fp7 # no
-
- fmovm.x (%a0)+,&0x02 # yes
-
-fmovm_data_in_fp7:
- lsl.b &0x1,%d1 # should FP7 be moved?
- bpl.b fmovm_data_in_done # no
-
- fmovm.x (%a0)+,&0x01 # yes
-
-fmovm_data_in_done:
- add.l %d0,%sp # remove fpregs from stack
- rts
-
-#####################################
-
-fmovm_data_done:
- rts
-
-##############################################################################
-
-#
-# table indexed by the operation's bit string that gives the number
-# of bytes that will be moved.
-#
-# number of bytes = (# of 1's in bit string) * 12(bytes/fpreg)
-#
-tbl_fmovm_size:
- byte 0x00,0x0c,0x0c,0x18,0x0c,0x18,0x18,0x24
- byte 0x0c,0x18,0x18,0x24,0x18,0x24,0x24,0x30
- byte 0x0c,0x18,0x18,0x24,0x18,0x24,0x24,0x30
- byte 0x18,0x24,0x24,0x30,0x24,0x30,0x30,0x3c
- byte 0x0c,0x18,0x18,0x24,0x18,0x24,0x24,0x30
- byte 0x18,0x24,0x24,0x30,0x24,0x30,0x30,0x3c
- byte 0x18,0x24,0x24,0x30,0x24,0x30,0x30,0x3c
- byte 0x24,0x30,0x30,0x3c,0x30,0x3c,0x3c,0x48
- byte 0x0c,0x18,0x18,0x24,0x18,0x24,0x24,0x30
- byte 0x18,0x24,0x24,0x30,0x24,0x30,0x30,0x3c
- byte 0x18,0x24,0x24,0x30,0x24,0x30,0x30,0x3c
- byte 0x24,0x30,0x30,0x3c,0x30,0x3c,0x3c,0x48
- byte 0x18,0x24,0x24,0x30,0x24,0x30,0x30,0x3c
- byte 0x24,0x30,0x30,0x3c,0x30,0x3c,0x3c,0x48
- byte 0x24,0x30,0x30,0x3c,0x30,0x3c,0x3c,0x48
- byte 0x30,0x3c,0x3c,0x48,0x3c,0x48,0x48,0x54
- byte 0x0c,0x18,0x18,0x24,0x18,0x24,0x24,0x30
- byte 0x18,0x24,0x24,0x30,0x24,0x30,0x30,0x3c
- byte 0x18,0x24,0x24,0x30,0x24,0x30,0x30,0x3c
- byte 0x24,0x30,0x30,0x3c,0x30,0x3c,0x3c,0x48
- byte 0x18,0x24,0x24,0x30,0x24,0x30,0x30,0x3c
- byte 0x24,0x30,0x30,0x3c,0x30,0x3c,0x3c,0x48
- byte 0x24,0x30,0x30,0x3c,0x30,0x3c,0x3c,0x48
- byte 0x30,0x3c,0x3c,0x48,0x3c,0x48,0x48,0x54
- byte 0x18,0x24,0x24,0x30,0x24,0x30,0x30,0x3c
- byte 0x24,0x30,0x30,0x3c,0x30,0x3c,0x3c,0x48
- byte 0x24,0x30,0x30,0x3c,0x30,0x3c,0x3c,0x48
- byte 0x30,0x3c,0x3c,0x48,0x3c,0x48,0x48,0x54
- byte 0x24,0x30,0x30,0x3c,0x30,0x3c,0x3c,0x48
- byte 0x30,0x3c,0x3c,0x48,0x3c,0x48,0x48,0x54
- byte 0x30,0x3c,0x3c,0x48,0x3c,0x48,0x48,0x54
- byte 0x3c,0x48,0x48,0x54,0x48,0x54,0x54,0x60
-
-#
-# table to convert a pre-decrement bit string into a post-increment
-# or control bit string.
-# ex: 0x00 ==> 0x00
-# 0x01 ==> 0x80
-# 0x02 ==> 0x40
-# .
-# .
-# 0xfd ==> 0xbf
-# 0xfe ==> 0x7f
-# 0xff ==> 0xff
-#
-tbl_fmovm_convert:
- byte 0x00,0x80,0x40,0xc0,0x20,0xa0,0x60,0xe0
- byte 0x10,0x90,0x50,0xd0,0x30,0xb0,0x70,0xf0
- byte 0x08,0x88,0x48,0xc8,0x28,0xa8,0x68,0xe8
- byte 0x18,0x98,0x58,0xd8,0x38,0xb8,0x78,0xf8
- byte 0x04,0x84,0x44,0xc4,0x24,0xa4,0x64,0xe4
- byte 0x14,0x94,0x54,0xd4,0x34,0xb4,0x74,0xf4
- byte 0x0c,0x8c,0x4c,0xcc,0x2c,0xac,0x6c,0xec
- byte 0x1c,0x9c,0x5c,0xdc,0x3c,0xbc,0x7c,0xfc
- byte 0x02,0x82,0x42,0xc2,0x22,0xa2,0x62,0xe2
- byte 0x12,0x92,0x52,0xd2,0x32,0xb2,0x72,0xf2
- byte 0x0a,0x8a,0x4a,0xca,0x2a,0xaa,0x6a,0xea
- byte 0x1a,0x9a,0x5a,0xda,0x3a,0xba,0x7a,0xfa
- byte 0x06,0x86,0x46,0xc6,0x26,0xa6,0x66,0xe6
- byte 0x16,0x96,0x56,0xd6,0x36,0xb6,0x76,0xf6
- byte 0x0e,0x8e,0x4e,0xce,0x2e,0xae,0x6e,0xee
- byte 0x1e,0x9e,0x5e,0xde,0x3e,0xbe,0x7e,0xfe
- byte 0x01,0x81,0x41,0xc1,0x21,0xa1,0x61,0xe1
- byte 0x11,0x91,0x51,0xd1,0x31,0xb1,0x71,0xf1
- byte 0x09,0x89,0x49,0xc9,0x29,0xa9,0x69,0xe9
- byte 0x19,0x99,0x59,0xd9,0x39,0xb9,0x79,0xf9
- byte 0x05,0x85,0x45,0xc5,0x25,0xa5,0x65,0xe5
- byte 0x15,0x95,0x55,0xd5,0x35,0xb5,0x75,0xf5
- byte 0x0d,0x8d,0x4d,0xcd,0x2d,0xad,0x6d,0xed
- byte 0x1d,0x9d,0x5d,0xdd,0x3d,0xbd,0x7d,0xfd
- byte 0x03,0x83,0x43,0xc3,0x23,0xa3,0x63,0xe3
- byte 0x13,0x93,0x53,0xd3,0x33,0xb3,0x73,0xf3
- byte 0x0b,0x8b,0x4b,0xcb,0x2b,0xab,0x6b,0xeb
- byte 0x1b,0x9b,0x5b,0xdb,0x3b,0xbb,0x7b,0xfb
- byte 0x07,0x87,0x47,0xc7,0x27,0xa7,0x67,0xe7
- byte 0x17,0x97,0x57,0xd7,0x37,0xb7,0x77,0xf7
- byte 0x0f,0x8f,0x4f,0xcf,0x2f,0xaf,0x6f,0xef
- byte 0x1f,0x9f,0x5f,0xdf,0x3f,0xbf,0x7f,0xff
-
- global fmovm_calc_ea
-###############################################
-# _fmovm_calc_ea: calculate effective address #
-###############################################
-fmovm_calc_ea:
- mov.l %d0,%a0 # move # bytes to a0
-
-# currently, MODE and REG are taken from the EXC_OPWORD. this could be
-# easily changed if they were inputs passed in registers.
- mov.w EXC_OPWORD(%a6),%d0 # fetch opcode word
- mov.w %d0,%d1 # make a copy
-
- andi.w &0x3f,%d0 # extract mode field
- andi.l &0x7,%d1 # extract reg field
-
-# jump to the corresponding function for each {MODE,REG} pair.
- mov.w (tbl_fea_mode.b,%pc,%d0.w*2),%d0 # fetch jmp distance
- jmp (tbl_fea_mode.b,%pc,%d0.w*1) # jmp to correct ea mode
-
- swbeg &64
-tbl_fea_mode:
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
-
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
-
- short faddr_ind_a0 - tbl_fea_mode
- short faddr_ind_a1 - tbl_fea_mode
- short faddr_ind_a2 - tbl_fea_mode
- short faddr_ind_a3 - tbl_fea_mode
- short faddr_ind_a4 - tbl_fea_mode
- short faddr_ind_a5 - tbl_fea_mode
- short faddr_ind_a6 - tbl_fea_mode
- short faddr_ind_a7 - tbl_fea_mode
-
- short faddr_ind_p_a0 - tbl_fea_mode
- short faddr_ind_p_a1 - tbl_fea_mode
- short faddr_ind_p_a2 - tbl_fea_mode
- short faddr_ind_p_a3 - tbl_fea_mode
- short faddr_ind_p_a4 - tbl_fea_mode
- short faddr_ind_p_a5 - tbl_fea_mode
- short faddr_ind_p_a6 - tbl_fea_mode
- short faddr_ind_p_a7 - tbl_fea_mode
-
- short faddr_ind_m_a0 - tbl_fea_mode
- short faddr_ind_m_a1 - tbl_fea_mode
- short faddr_ind_m_a2 - tbl_fea_mode
- short faddr_ind_m_a3 - tbl_fea_mode
- short faddr_ind_m_a4 - tbl_fea_mode
- short faddr_ind_m_a5 - tbl_fea_mode
- short faddr_ind_m_a6 - tbl_fea_mode
- short faddr_ind_m_a7 - tbl_fea_mode
-
- short faddr_ind_disp_a0 - tbl_fea_mode
- short faddr_ind_disp_a1 - tbl_fea_mode
- short faddr_ind_disp_a2 - tbl_fea_mode
- short faddr_ind_disp_a3 - tbl_fea_mode
- short faddr_ind_disp_a4 - tbl_fea_mode
- short faddr_ind_disp_a5 - tbl_fea_mode
- short faddr_ind_disp_a6 - tbl_fea_mode
- short faddr_ind_disp_a7 - tbl_fea_mode
-
- short faddr_ind_ext - tbl_fea_mode
- short faddr_ind_ext - tbl_fea_mode
- short faddr_ind_ext - tbl_fea_mode
- short faddr_ind_ext - tbl_fea_mode
- short faddr_ind_ext - tbl_fea_mode
- short faddr_ind_ext - tbl_fea_mode
- short faddr_ind_ext - tbl_fea_mode
- short faddr_ind_ext - tbl_fea_mode
-
- short fabs_short - tbl_fea_mode
- short fabs_long - tbl_fea_mode
- short fpc_ind - tbl_fea_mode
- short fpc_ind_ext - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
- short tbl_fea_mode - tbl_fea_mode
-
-###################################
-# Address register indirect: (An) #
-###################################
-faddr_ind_a0:
- mov.l EXC_DREGS+0x8(%a6),%a0 # Get current a0
- rts
-
-faddr_ind_a1:
- mov.l EXC_DREGS+0xc(%a6),%a0 # Get current a1
- rts
-
-faddr_ind_a2:
- mov.l %a2,%a0 # Get current a2
- rts
-
-faddr_ind_a3:
- mov.l %a3,%a0 # Get current a3
- rts
-
-faddr_ind_a4:
- mov.l %a4,%a0 # Get current a4
- rts
-
-faddr_ind_a5:
- mov.l %a5,%a0 # Get current a5
- rts
-
-faddr_ind_a6:
- mov.l (%a6),%a0 # Get current a6
- rts
-
-faddr_ind_a7:
- mov.l EXC_A7(%a6),%a0 # Get current a7
- rts
-
-#####################################################
-# Address register indirect w/ postincrement: (An)+ #
-#####################################################
-faddr_ind_p_a0:
- mov.l EXC_DREGS+0x8(%a6),%d0 # Get current a0
- mov.l %d0,%d1
- add.l %a0,%d1 # Increment
- mov.l %d1,EXC_DREGS+0x8(%a6) # Save incr value
- mov.l %d0,%a0
- rts
-
-faddr_ind_p_a1:
- mov.l EXC_DREGS+0xc(%a6),%d0 # Get current a1
- mov.l %d0,%d1
- add.l %a0,%d1 # Increment
- mov.l %d1,EXC_DREGS+0xc(%a6) # Save incr value
- mov.l %d0,%a0
- rts
-
-faddr_ind_p_a2:
- mov.l %a2,%d0 # Get current a2
- mov.l %d0,%d1
- add.l %a0,%d1 # Increment
- mov.l %d1,%a2 # Save incr value
- mov.l %d0,%a0
- rts
-
-faddr_ind_p_a3:
- mov.l %a3,%d0 # Get current a3
- mov.l %d0,%d1
- add.l %a0,%d1 # Increment
- mov.l %d1,%a3 # Save incr value
- mov.l %d0,%a0
- rts
-
-faddr_ind_p_a4:
- mov.l %a4,%d0 # Get current a4
- mov.l %d0,%d1
- add.l %a0,%d1 # Increment
- mov.l %d1,%a4 # Save incr value
- mov.l %d0,%a0
- rts
-
-faddr_ind_p_a5:
- mov.l %a5,%d0 # Get current a5
- mov.l %d0,%d1
- add.l %a0,%d1 # Increment
- mov.l %d1,%a5 # Save incr value
- mov.l %d0,%a0
- rts
-
-faddr_ind_p_a6:
- mov.l (%a6),%d0 # Get current a6
- mov.l %d0,%d1
- add.l %a0,%d1 # Increment
- mov.l %d1,(%a6) # Save incr value
- mov.l %d0,%a0
- rts
-
-faddr_ind_p_a7:
- mov.b &mia7_flg,SPCOND_FLG(%a6) # set "special case" flag
-
- mov.l EXC_A7(%a6),%d0 # Get current a7
- mov.l %d0,%d1
- add.l %a0,%d1 # Increment
- mov.l %d1,EXC_A7(%a6) # Save incr value
- mov.l %d0,%a0
- rts
-
-####################################################
-# Address register indirect w/ predecrement: -(An) #
-####################################################
-faddr_ind_m_a0:
- mov.l EXC_DREGS+0x8(%a6),%d0 # Get current a0
- sub.l %a0,%d0 # Decrement
- mov.l %d0,EXC_DREGS+0x8(%a6) # Save decr value
- mov.l %d0,%a0
- rts
-
-faddr_ind_m_a1:
- mov.l EXC_DREGS+0xc(%a6),%d0 # Get current a1
- sub.l %a0,%d0 # Decrement
- mov.l %d0,EXC_DREGS+0xc(%a6) # Save decr value
- mov.l %d0,%a0
- rts
-
-faddr_ind_m_a2:
- mov.l %a2,%d0 # Get current a2
- sub.l %a0,%d0 # Decrement
- mov.l %d0,%a2 # Save decr value
- mov.l %d0,%a0
- rts
-
-faddr_ind_m_a3:
- mov.l %a3,%d0 # Get current a3
- sub.l %a0,%d0 # Decrement
- mov.l %d0,%a3 # Save decr value
- mov.l %d0,%a0
- rts
-
-faddr_ind_m_a4:
- mov.l %a4,%d0 # Get current a4
- sub.l %a0,%d0 # Decrement
- mov.l %d0,%a4 # Save decr value
- mov.l %d0,%a0
- rts
-
-faddr_ind_m_a5:
- mov.l %a5,%d0 # Get current a5
- sub.l %a0,%d0 # Decrement
- mov.l %d0,%a5 # Save decr value
- mov.l %d0,%a0
- rts
-
-faddr_ind_m_a6:
- mov.l (%a6),%d0 # Get current a6
- sub.l %a0,%d0 # Decrement
- mov.l %d0,(%a6) # Save decr value
- mov.l %d0,%a0
- rts
-
-faddr_ind_m_a7:
- mov.b &mda7_flg,SPCOND_FLG(%a6) # set "special case" flag
-
- mov.l EXC_A7(%a6),%d0 # Get current a7
- sub.l %a0,%d0 # Decrement
- mov.l %d0,EXC_A7(%a6) # Save decr value
- mov.l %d0,%a0
- rts
-
-########################################################
-# Address register indirect w/ displacement: (d16, An) #
-########################################################
-faddr_ind_disp_a0:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.w %d0,%a0 # sign extend displacement
-
- add.l EXC_DREGS+0x8(%a6),%a0 # a0 + d16
- rts
-
-faddr_ind_disp_a1:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.w %d0,%a0 # sign extend displacement
-
- add.l EXC_DREGS+0xc(%a6),%a0 # a1 + d16
- rts
-
-faddr_ind_disp_a2:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.w %d0,%a0 # sign extend displacement
-
- add.l %a2,%a0 # a2 + d16
- rts
-
-faddr_ind_disp_a3:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.w %d0,%a0 # sign extend displacement
-
- add.l %a3,%a0 # a3 + d16
- rts
-
-faddr_ind_disp_a4:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.w %d0,%a0 # sign extend displacement
-
- add.l %a4,%a0 # a4 + d16
- rts
-
-faddr_ind_disp_a5:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.w %d0,%a0 # sign extend displacement
-
- add.l %a5,%a0 # a5 + d16
- rts
-
-faddr_ind_disp_a6:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.w %d0,%a0 # sign extend displacement
-
- add.l (%a6),%a0 # a6 + d16
- rts
-
-faddr_ind_disp_a7:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.w %d0,%a0 # sign extend displacement
-
- add.l EXC_A7(%a6),%a0 # a7 + d16
- rts
-
-########################################################################
-# Address register indirect w/ index(8-bit displacement): (d8, An, Xn) #
-# " " " w/ " (base displacement): (bd, An, Xn) #
-# Memory indirect postindexed: ([bd, An], Xn, od) #
-# Memory indirect preindexed: ([bd, An, Xn], od) #
-########################################################################
-faddr_ind_ext:
- addq.l &0x8,%d1
- bsr.l fetch_dreg # fetch base areg
- mov.l %d0,-(%sp)
-
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word # fetch extword in d0
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.l (%sp)+,%a0
-
- btst &0x8,%d0
- bne.w fcalc_mem_ind
-
- mov.l %d0,L_SCR1(%a6) # hold opword
-
- mov.l %d0,%d1
- rol.w &0x4,%d1
- andi.w &0xf,%d1 # extract index regno
-
-# count on fetch_dreg() not to alter a0...
- bsr.l fetch_dreg # fetch index
-
- mov.l %d2,-(%sp) # save d2
- mov.l L_SCR1(%a6),%d2 # fetch opword
-
- btst &0xb,%d2 # is it word or long?
- bne.b faii8_long
- ext.l %d0 # sign extend word index
-faii8_long:
- mov.l %d2,%d1
- rol.w &0x7,%d1
- andi.l &0x3,%d1 # extract scale value
-
- lsl.l %d1,%d0 # shift index by scale
-
- extb.l %d2 # sign extend displacement
- add.l %d2,%d0 # index + disp
- add.l %d0,%a0 # An + (index + disp)
-
- mov.l (%sp)+,%d2 # restore old d2
- rts
-
-###########################
-# Absolute short: (XXX).W #
-###########################
-fabs_short:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word # fetch short address
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.w %d0,%a0 # return <ea> in a0
- rts
-
-##########################
-# Absolute long: (XXX).L #
-##########################
-fabs_long:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch long address
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.l %d0,%a0 # return <ea> in a0
- rts
-
-#######################################################
-# Program counter indirect w/ displacement: (d16, PC) #
-#######################################################
-fpc_ind:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word # fetch word displacement
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.w %d0,%a0 # sign extend displacement
-
- add.l EXC_EXTWPTR(%a6),%a0 # pc + d16
-
-# _imem_read_word() increased the extwptr by 2. need to adjust here.
- subq.l &0x2,%a0 # adjust <ea>
- rts
-
-##########################################################
-# PC indirect w/ index(8-bit displacement): (d8, PC, An) #
-# " " w/ " (base displacement): (bd, PC, An) #
-# PC memory indirect postindexed: ([bd, PC], Xn, od) #
-# PC memory indirect preindexed: ([bd, PC, Xn], od) #
-##########################################################
-fpc_ind_ext:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word # fetch ext word
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.l EXC_EXTWPTR(%a6),%a0 # put base in a0
- subq.l &0x2,%a0 # adjust base
-
- btst &0x8,%d0 # is disp only 8 bits?
- bne.w fcalc_mem_ind # calc memory indirect
-
- mov.l %d0,L_SCR1(%a6) # store opword
-
- mov.l %d0,%d1 # make extword copy
- rol.w &0x4,%d1 # rotate reg num into place
- andi.w &0xf,%d1 # extract register number
-
-# count on fetch_dreg() not to alter a0...
- bsr.l fetch_dreg # fetch index
-
- mov.l %d2,-(%sp) # save d2
- mov.l L_SCR1(%a6),%d2 # fetch opword
-
- btst &0xb,%d2 # is index word or long?
- bne.b fpii8_long # long
- ext.l %d0 # sign extend word index
-fpii8_long:
- mov.l %d2,%d1
- rol.w &0x7,%d1 # rotate scale value into place
- andi.l &0x3,%d1 # extract scale value
-
- lsl.l %d1,%d0 # shift index by scale
-
- extb.l %d2 # sign extend displacement
- add.l %d2,%d0 # disp + index
- add.l %d0,%a0 # An + (index + disp)
-
- mov.l (%sp)+,%d2 # restore temp register
- rts
-
-# d2 = index
-# d3 = base
-# d4 = od
-# d5 = extword
-fcalc_mem_ind:
- btst &0x6,%d0 # is the index suppressed?
- beq.b fcalc_index
-
- movm.l &0x3c00,-(%sp) # save d2-d5
-
- mov.l %d0,%d5 # put extword in d5
- mov.l %a0,%d3 # put base in d3
-
- clr.l %d2 # yes, so index = 0
- bra.b fbase_supp_ck
-
-# index:
-fcalc_index:
- mov.l %d0,L_SCR1(%a6) # save d0 (opword)
- bfextu %d0{&16:&4},%d1 # fetch dreg index
- bsr.l fetch_dreg
-
- movm.l &0x3c00,-(%sp) # save d2-d5
- mov.l %d0,%d2 # put index in d2
- mov.l L_SCR1(%a6),%d5
- mov.l %a0,%d3
-
- btst &0xb,%d5 # is index word or long?
- bne.b fno_ext
- ext.l %d2
-
-fno_ext:
- bfextu %d5{&21:&2},%d0
- lsl.l %d0,%d2
-
-# base address (passed as parameter in d3):
-# we clear the value here if it should actually be suppressed.
-fbase_supp_ck:
- btst &0x7,%d5 # is the bd suppressed?
- beq.b fno_base_sup
- clr.l %d3
-
-# base displacement:
-fno_base_sup:
- bfextu %d5{&26:&2},%d0 # get bd size
-# beq.l fmovm_error # if (size == 0) it's reserved
-
- cmpi.b %d0,&0x2
- blt.b fno_bd
- beq.b fget_word_bd
-
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long
-
- tst.l %d1 # did ifetch fail?
- bne.l fcea_iacc # yes
-
- bra.b fchk_ind
-
-fget_word_bd:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # did ifetch fail?
- bne.l fcea_iacc # yes
-
- ext.l %d0 # sign extend bd
-
-fchk_ind:
- add.l %d0,%d3 # base += bd
-
-# outer displacement:
-fno_bd:
- bfextu %d5{&30:&2},%d0 # is od suppressed?
- beq.w faii_bd
-
- cmpi.b %d0,&0x2
- blt.b fnull_od
- beq.b fword_od
-
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long
-
- tst.l %d1 # did ifetch fail?
- bne.l fcea_iacc # yes
-
- bra.b fadd_them
-
-fword_od:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x2,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_word
-
- tst.l %d1 # did ifetch fail?
- bne.l fcea_iacc # yes
-
- ext.l %d0 # sign extend od
- bra.b fadd_them
-
-fnull_od:
- clr.l %d0
-
-fadd_them:
- mov.l %d0,%d4
-
- btst &0x2,%d5 # pre or post indexing?
- beq.b fpre_indexed
-
- mov.l %d3,%a0
- bsr.l _dmem_read_long
-
- tst.l %d1 # did dfetch fail?
- bne.w fcea_err # yes
-
- add.l %d2,%d0 # <ea> += index
- add.l %d4,%d0 # <ea> += od
- bra.b fdone_ea
-
-fpre_indexed:
- add.l %d2,%d3 # preindexing
- mov.l %d3,%a0
- bsr.l _dmem_read_long
-
- tst.l %d1 # did dfetch fail?
- bne.w fcea_err # yes
-
- add.l %d4,%d0 # ea += od
- bra.b fdone_ea
-
-faii_bd:
- add.l %d2,%d3 # ea = (base + bd) + index
- mov.l %d3,%d0
-fdone_ea:
- mov.l %d0,%a0
-
- movm.l (%sp)+,&0x003c # restore d2-d5
- rts
-
-#########################################################
-fcea_err:
- mov.l %d3,%a0
-
- movm.l (%sp)+,&0x003c # restore d2-d5
- mov.w &0x0101,%d0
- bra.l iea_dacc
-
-fcea_iacc:
- movm.l (%sp)+,&0x003c # restore d2-d5
- bra.l iea_iacc
-
-fmovm_out_err:
- bsr.l restore
- mov.w &0x00e1,%d0
- bra.b fmovm_err
-
-fmovm_in_err:
- bsr.l restore
- mov.w &0x0161,%d0
-
-fmovm_err:
- mov.l L_SCR1(%a6),%a0
- bra.l iea_dacc
-
-#########################################################################
-# XDEF **************************************************************** #
-# fmovm_ctrl(): emulate fmovm.l of control registers instr #
-# #
-# XREF **************************************************************** #
-# _imem_read_long() - read longword from memory #
-# iea_iacc() - _imem_read_long() failed; error recovery #
-# #
-# INPUT *************************************************************** #
-# None #
-# #
-# OUTPUT ************************************************************** #
-# If _imem_read_long() doesn't fail: #
-# USER_FPCR(a6) = new FPCR value #
-# USER_FPSR(a6) = new FPSR value #
-# USER_FPIAR(a6) = new FPIAR value #
-# #
-# ALGORITHM *********************************************************** #
-# Decode the instruction type by looking at the extension word #
-# in order to see how many control registers to fetch from memory. #
-# Fetch them using _imem_read_long(). If this fetch fails, exit through #
-# the special access error exit handler iea_iacc(). #
-# #
-# Instruction word decoding: #
-# #
-# fmovem.l #<data>, {FPIAR&|FPCR&|FPSR} #
-# #
-# WORD1 WORD2 #
-# 1111 0010 00 111100 100$ $$00 0000 0000 #
-# #
-# $$$ (100): FPCR #
-# (010): FPSR #
-# (001): FPIAR #
-# (000): FPIAR #
-# #
-#########################################################################
-
- global fmovm_ctrl
-fmovm_ctrl:
- mov.b EXC_EXTWORD(%a6),%d0 # fetch reg select bits
- cmpi.b %d0,&0x9c # fpcr & fpsr & fpiar ?
- beq.w fctrl_in_7 # yes
- cmpi.b %d0,&0x98 # fpcr & fpsr ?
- beq.w fctrl_in_6 # yes
- cmpi.b %d0,&0x94 # fpcr & fpiar ?
- beq.b fctrl_in_5 # yes
-
-# fmovem.l #<data>, fpsr/fpiar
-fctrl_in_3:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch FPSR from mem
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.l %d0,USER_FPSR(%a6) # store new FPSR to stack
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch FPIAR from mem
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.l %d0,USER_FPIAR(%a6) # store new FPIAR to stack
- rts
-
-# fmovem.l #<data>, fpcr/fpiar
-fctrl_in_5:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch FPCR from mem
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.l %d0,USER_FPCR(%a6) # store new FPCR to stack
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch FPIAR from mem
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.l %d0,USER_FPIAR(%a6) # store new FPIAR to stack
- rts
-
-# fmovem.l #<data>, fpcr/fpsr
-fctrl_in_6:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch FPCR from mem
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.l %d0,USER_FPCR(%a6) # store new FPCR to mem
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch FPSR from mem
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.l %d0,USER_FPSR(%a6) # store new FPSR to mem
- rts
-
-# fmovem.l #<data>, fpcr/fpsr/fpiar
-fctrl_in_7:
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch FPCR from mem
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.l %d0,USER_FPCR(%a6) # store new FPCR to mem
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch FPSR from mem
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.l %d0,USER_FPSR(%a6) # store new FPSR to mem
- mov.l EXC_EXTWPTR(%a6),%a0 # fetch instruction addr
- addq.l &0x4,EXC_EXTWPTR(%a6) # incr instruction ptr
- bsr.l _imem_read_long # fetch FPIAR from mem
-
- tst.l %d1 # did ifetch fail?
- bne.l iea_iacc # yes
-
- mov.l %d0,USER_FPIAR(%a6) # store new FPIAR to mem
- rts
-
-##########################################################################
-
-#########################################################################
-# XDEF **************************************************************** #
-# addsub_scaler2(): scale inputs to fadd/fsub such that no #
-# OVFL/UNFL exceptions will result #
-# #
-# XREF **************************************************************** #
-# norm() - normalize mantissa after adjusting exponent #
-# #
-# INPUT *************************************************************** #
-# FP_SRC(a6) = fp op1(src) #
-# FP_DST(a6) = fp op2(dst) #
-# #
-# OUTPUT ************************************************************** #
-# FP_SRC(a6) = fp op1 scaled(src) #
-# FP_DST(a6) = fp op2 scaled(dst) #
-# d0 = scale amount #
-# #
-# ALGORITHM *********************************************************** #
-# If the DST exponent is > the SRC exponent, set the DST exponent #
-# equal to 0x3fff and scale the SRC exponent by the value that the #
-# DST exponent was scaled by. If the SRC exponent is greater or equal, #
-# do the opposite. Return this scale factor in d0. #
-# If the two exponents differ by > the number of mantissa bits #
-# plus two, then set the smallest exponent to a very small value as a #
-# quick shortcut. #
-# #
-#########################################################################
-
- global addsub_scaler2
-addsub_scaler2:
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l DST_HI(%a1),FP_SCR1_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- mov.l DST_LO(%a1),FP_SCR1_LO(%a6)
- mov.w SRC_EX(%a0),%d0
- mov.w DST_EX(%a1),%d1
- mov.w %d0,FP_SCR0_EX(%a6)
- mov.w %d1,FP_SCR1_EX(%a6)
-
- andi.w &0x7fff,%d0
- andi.w &0x7fff,%d1
- mov.w %d0,L_SCR1(%a6) # store src exponent
- mov.w %d1,2+L_SCR1(%a6) # store dst exponent
-
- cmp.w %d0, %d1 # is src exp >= dst exp?
- bge.l src_exp_ge2
-
-# dst exp is > src exp; scale dst to exp = 0x3fff
-dst_exp_gt2:
- bsr.l scale_to_zero_dst
- mov.l %d0,-(%sp) # save scale factor
-
- cmpi.b STAG(%a6),&DENORM # is dst denormalized?
- bne.b cmpexp12
-
- lea FP_SCR0(%a6),%a0
- bsr.l norm # normalize the denorm; result is new exp
- neg.w %d0 # new exp = -(shft val)
- mov.w %d0,L_SCR1(%a6) # inset new exp
-
-cmpexp12:
- mov.w 2+L_SCR1(%a6),%d0
- subi.w &mantissalen+2,%d0 # subtract mantissalen+2 from larger exp
-
- cmp.w %d0,L_SCR1(%a6) # is difference >= len(mantissa)+2?
- bge.b quick_scale12
-
- mov.w L_SCR1(%a6),%d0
- add.w 0x2(%sp),%d0 # scale src exponent by scale factor
- mov.w FP_SCR0_EX(%a6),%d1
- and.w &0x8000,%d1
- or.w %d1,%d0 # concat {sgn,new exp}
- mov.w %d0,FP_SCR0_EX(%a6) # insert new dst exponent
-
- mov.l (%sp)+,%d0 # return SCALE factor
- rts
-
-quick_scale12:
- andi.w &0x8000,FP_SCR0_EX(%a6) # zero src exponent
- bset &0x0,1+FP_SCR0_EX(%a6) # set exp = 1
-
- mov.l (%sp)+,%d0 # return SCALE factor
- rts
-
-# src exp is >= dst exp; scale src to exp = 0x3fff
-src_exp_ge2:
- bsr.l scale_to_zero_src
- mov.l %d0,-(%sp) # save scale factor
-
- cmpi.b DTAG(%a6),&DENORM # is dst denormalized?
- bne.b cmpexp22
- lea FP_SCR1(%a6),%a0
- bsr.l norm # normalize the denorm; result is new exp
- neg.w %d0 # new exp = -(shft val)
- mov.w %d0,2+L_SCR1(%a6) # inset new exp
-
-cmpexp22:
- mov.w L_SCR1(%a6),%d0
- subi.w &mantissalen+2,%d0 # subtract mantissalen+2 from larger exp
-
- cmp.w %d0,2+L_SCR1(%a6) # is difference >= len(mantissa)+2?
- bge.b quick_scale22
-
- mov.w 2+L_SCR1(%a6),%d0
- add.w 0x2(%sp),%d0 # scale dst exponent by scale factor
- mov.w FP_SCR1_EX(%a6),%d1
- andi.w &0x8000,%d1
- or.w %d1,%d0 # concat {sgn,new exp}
- mov.w %d0,FP_SCR1_EX(%a6) # insert new dst exponent
-
- mov.l (%sp)+,%d0 # return SCALE factor
- rts
-
-quick_scale22:
- andi.w &0x8000,FP_SCR1_EX(%a6) # zero dst exponent
- bset &0x0,1+FP_SCR1_EX(%a6) # set exp = 1
-
- mov.l (%sp)+,%d0 # return SCALE factor
- rts
-
-##########################################################################
-
-#########################################################################
-# XDEF **************************************************************** #
-# scale_to_zero_src(): scale the exponent of extended precision #
-# value at FP_SCR0(a6). #
-# #
-# XREF **************************************************************** #
-# norm() - normalize the mantissa if the operand was a DENORM #
-# #
-# INPUT *************************************************************** #
-# FP_SCR0(a6) = extended precision operand to be scaled #
-# #
-# OUTPUT ************************************************************** #
-# FP_SCR0(a6) = scaled extended precision operand #
-# d0 = scale value #
-# #
-# ALGORITHM *********************************************************** #
-# Set the exponent of the input operand to 0x3fff. Save the value #
-# of the difference between the original and new exponent. Then, #
-# normalize the operand if it was a DENORM. Add this normalization #
-# value to the previous value. Return the result. #
-# #
-#########################################################################
-
- global scale_to_zero_src
-scale_to_zero_src:
- mov.w FP_SCR0_EX(%a6),%d1 # extract operand's {sgn,exp}
- mov.w %d1,%d0 # make a copy
-
- andi.l &0x7fff,%d1 # extract operand's exponent
-
- andi.w &0x8000,%d0 # extract operand's sgn
- or.w &0x3fff,%d0 # insert new operand's exponent(=0)
-
- mov.w %d0,FP_SCR0_EX(%a6) # insert biased exponent
-
- cmpi.b STAG(%a6),&DENORM # is operand normalized?
- beq.b stzs_denorm # normalize the DENORM
-
-stzs_norm:
- mov.l &0x3fff,%d0
- sub.l %d1,%d0 # scale = BIAS + (-exp)
-
- rts
-
-stzs_denorm:
- lea FP_SCR0(%a6),%a0 # pass ptr to src op
- bsr.l norm # normalize denorm
- neg.l %d0 # new exponent = -(shft val)
- mov.l %d0,%d1 # prepare for op_norm call
- bra.b stzs_norm # finish scaling
-
-###
-
-#########################################################################
-# XDEF **************************************************************** #
-# scale_sqrt(): scale the input operand exponent so a subsequent #
-# fsqrt operation won't take an exception. #
-# #
-# XREF **************************************************************** #
-# norm() - normalize the mantissa if the operand was a DENORM #
-# #
-# INPUT *************************************************************** #
-# FP_SCR0(a6) = extended precision operand to be scaled #
-# #
-# OUTPUT ************************************************************** #
-# FP_SCR0(a6) = scaled extended precision operand #
-# d0 = scale value #
-# #
-# ALGORITHM *********************************************************** #
-# If the input operand is a DENORM, normalize it. #
-# If the exponent of the input operand is even, set the exponent #
-# to 0x3ffe and return a scale factor of "(exp-0x3ffe)/2". If the #
-# exponent of the input operand is off, set the exponent to ox3fff and #
-# return a scale factor of "(exp-0x3fff)/2". #
-# #
-#########################################################################
-
- global scale_sqrt
-scale_sqrt:
- cmpi.b STAG(%a6),&DENORM # is operand normalized?
- beq.b ss_denorm # normalize the DENORM
-
- mov.w FP_SCR0_EX(%a6),%d1 # extract operand's {sgn,exp}
- andi.l &0x7fff,%d1 # extract operand's exponent
-
- andi.w &0x8000,FP_SCR0_EX(%a6) # extract operand's sgn
-
- btst &0x0,%d1 # is exp even or odd?
- beq.b ss_norm_even
-
- ori.w &0x3fff,FP_SCR0_EX(%a6) # insert new operand's exponent(=0)
-
- mov.l &0x3fff,%d0
- sub.l %d1,%d0 # scale = BIAS + (-exp)
- asr.l &0x1,%d0 # divide scale factor by 2
- rts
-
-ss_norm_even:
- ori.w &0x3ffe,FP_SCR0_EX(%a6) # insert new operand's exponent(=0)
-
- mov.l &0x3ffe,%d0
- sub.l %d1,%d0 # scale = BIAS + (-exp)
- asr.l &0x1,%d0 # divide scale factor by 2
- rts
-
-ss_denorm:
- lea FP_SCR0(%a6),%a0 # pass ptr to src op
- bsr.l norm # normalize denorm
-
- btst &0x0,%d0 # is exp even or odd?
- beq.b ss_denorm_even
-
- ori.w &0x3fff,FP_SCR0_EX(%a6) # insert new operand's exponent(=0)
-
- add.l &0x3fff,%d0
- asr.l &0x1,%d0 # divide scale factor by 2
- rts
-
-ss_denorm_even:
- ori.w &0x3ffe,FP_SCR0_EX(%a6) # insert new operand's exponent(=0)
-
- add.l &0x3ffe,%d0
- asr.l &0x1,%d0 # divide scale factor by 2
- rts
-
-###
-
-#########################################################################
-# XDEF **************************************************************** #
-# scale_to_zero_dst(): scale the exponent of extended precision #
-# value at FP_SCR1(a6). #
-# #
-# XREF **************************************************************** #
-# norm() - normalize the mantissa if the operand was a DENORM #
-# #
-# INPUT *************************************************************** #
-# FP_SCR1(a6) = extended precision operand to be scaled #
-# #
-# OUTPUT ************************************************************** #
-# FP_SCR1(a6) = scaled extended precision operand #
-# d0 = scale value #
-# #
-# ALGORITHM *********************************************************** #
-# Set the exponent of the input operand to 0x3fff. Save the value #
-# of the difference between the original and new exponent. Then, #
-# normalize the operand if it was a DENORM. Add this normalization #
-# value to the previous value. Return the result. #
-# #
-#########################################################################
-
- global scale_to_zero_dst
-scale_to_zero_dst:
- mov.w FP_SCR1_EX(%a6),%d1 # extract operand's {sgn,exp}
- mov.w %d1,%d0 # make a copy
-
- andi.l &0x7fff,%d1 # extract operand's exponent
-
- andi.w &0x8000,%d0 # extract operand's sgn
- or.w &0x3fff,%d0 # insert new operand's exponent(=0)
-
- mov.w %d0,FP_SCR1_EX(%a6) # insert biased exponent
-
- cmpi.b DTAG(%a6),&DENORM # is operand normalized?
- beq.b stzd_denorm # normalize the DENORM
-
-stzd_norm:
- mov.l &0x3fff,%d0
- sub.l %d1,%d0 # scale = BIAS + (-exp)
- rts
-
-stzd_denorm:
- lea FP_SCR1(%a6),%a0 # pass ptr to dst op
- bsr.l norm # normalize denorm
- neg.l %d0 # new exponent = -(shft val)
- mov.l %d0,%d1 # prepare for op_norm call
- bra.b stzd_norm # finish scaling
-
-##########################################################################
-
-#########################################################################
-# XDEF **************************************************************** #
-# res_qnan(): return default result w/ QNAN operand for dyadic #
-# res_snan(): return default result w/ SNAN operand for dyadic #
-# res_qnan_1op(): return dflt result w/ QNAN operand for monadic #
-# res_snan_1op(): return dflt result w/ SNAN operand for monadic #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# FP_SRC(a6) = pointer to extended precision src operand #
-# FP_DST(a6) = pointer to extended precision dst operand #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = default result #
-# #
-# ALGORITHM *********************************************************** #
-# If either operand (but not both operands) of an operation is a #
-# nonsignalling NAN, then that NAN is returned as the result. If both #
-# operands are nonsignalling NANs, then the destination operand #
-# nonsignalling NAN is returned as the result. #
-# If either operand to an operation is a signalling NAN (SNAN), #
-# then, the SNAN bit is set in the FPSR EXC byte. If the SNAN trap #
-# enable bit is set in the FPCR, then the trap is taken and the #
-# destination is not modified. If the SNAN trap enable bit is not set, #
-# then the SNAN is converted to a nonsignalling NAN (by setting the #
-# SNAN bit in the operand to one), and the operation continues as #
-# described in the preceding paragraph, for nonsignalling NANs. #
-# Make sure the appropriate FPSR bits are set before exiting. #
-# #
-#########################################################################
-
- global res_qnan
- global res_snan
-res_qnan:
-res_snan:
- cmp.b DTAG(%a6), &SNAN # is the dst an SNAN?
- beq.b dst_snan2
- cmp.b DTAG(%a6), &QNAN # is the dst a QNAN?
- beq.b dst_qnan2
-src_nan:
- cmp.b STAG(%a6), &QNAN
- beq.b src_qnan2
- global res_snan_1op
-res_snan_1op:
-src_snan2:
- bset &0x6, FP_SRC_HI(%a6) # set SNAN bit
- or.l &nan_mask+aiop_mask+snan_mask, USER_FPSR(%a6)
- lea FP_SRC(%a6), %a0
- bra.b nan_comp
- global res_qnan_1op
-res_qnan_1op:
-src_qnan2:
- or.l &nan_mask, USER_FPSR(%a6)
- lea FP_SRC(%a6), %a0
- bra.b nan_comp
-dst_snan2:
- or.l &nan_mask+aiop_mask+snan_mask, USER_FPSR(%a6)
- bset &0x6, FP_DST_HI(%a6) # set SNAN bit
- lea FP_DST(%a6), %a0
- bra.b nan_comp
-dst_qnan2:
- lea FP_DST(%a6), %a0
- cmp.b STAG(%a6), &SNAN
- bne nan_done
- or.l &aiop_mask+snan_mask, USER_FPSR(%a6)
-nan_done:
- or.l &nan_mask, USER_FPSR(%a6)
-nan_comp:
- btst &0x7, FTEMP_EX(%a0) # is NAN neg?
- beq.b nan_not_neg
- or.l &neg_mask, USER_FPSR(%a6)
-nan_not_neg:
- fmovm.x (%a0), &0x80
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# res_operr(): return default result during operand error #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# None #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = default operand error result #
-# #
-# ALGORITHM *********************************************************** #
-# An nonsignalling NAN is returned as the default result when #
-# an operand error occurs for the following cases: #
-# #
-# Multiply: (Infinity x Zero) #
-# Divide : (Zero / Zero) || (Infinity / Infinity) #
-# #
-#########################################################################
-
- global res_operr
-res_operr:
- or.l &nan_mask+operr_mask+aiop_mask, USER_FPSR(%a6)
- fmovm.x nan_return(%pc), &0x80
- rts
-
-nan_return:
- long 0x7fff0000, 0xffffffff, 0xffffffff
-
-#########################################################################
-# XDEF **************************************************************** #
-# _denorm(): denormalize an intermediate result #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# a0 = points to the operand to be denormalized #
-# (in the internal extended format) #
-# #
-# d0 = rounding precision #
-# #
-# OUTPUT ************************************************************** #
-# a0 = pointer to the denormalized result #
-# (in the internal extended format) #
-# #
-# d0 = guard,round,sticky #
-# #
-# ALGORITHM *********************************************************** #
-# According to the exponent underflow threshold for the given #
-# precision, shift the mantissa bits to the right in order raise the #
-# exponent of the operand to the threshold value. While shifting the #
-# mantissa bits right, maintain the value of the guard, round, and #
-# sticky bits. #
-# other notes: #
-# (1) _denorm() is called by the underflow routines #
-# (2) _denorm() does NOT affect the status register #
-# #
-#########################################################################
-
-#
-# table of exponent threshold values for each precision
-#
-tbl_thresh:
- short 0x0
- short sgl_thresh
- short dbl_thresh
-
- global _denorm
-_denorm:
-#
-# Load the exponent threshold for the precision selected and check
-# to see if (threshold - exponent) is > 65 in which case we can
-# simply calculate the sticky bit and zero the mantissa. otherwise
-# we have to call the denormalization routine.
-#
- lsr.b &0x2, %d0 # shift prec to lo bits
- mov.w (tbl_thresh.b,%pc,%d0.w*2), %d1 # load prec threshold
- mov.w %d1, %d0 # copy d1 into d0
- sub.w FTEMP_EX(%a0), %d0 # diff = threshold - exp
- cmpi.w %d0, &66 # is diff > 65? (mant + g,r bits)
- bpl.b denorm_set_stky # yes; just calc sticky
-
- clr.l %d0 # clear g,r,s
- btst &inex2_bit, FPSR_EXCEPT(%a6) # yes; was INEX2 set?
- beq.b denorm_call # no; don't change anything
- bset &29, %d0 # yes; set sticky bit
-
-denorm_call:
- bsr.l dnrm_lp # denormalize the number
- rts
-
-#
-# all bit would have been shifted off during the denorm so simply
-# calculate if the sticky should be set and clear the entire mantissa.
-#
-denorm_set_stky:
- mov.l &0x20000000, %d0 # set sticky bit in return value
- mov.w %d1, FTEMP_EX(%a0) # load exp with threshold
- clr.l FTEMP_HI(%a0) # set d1 = 0 (ms mantissa)
- clr.l FTEMP_LO(%a0) # set d2 = 0 (ms mantissa)
- rts
-
-# #
-# dnrm_lp(): normalize exponent/mantissa to specified threshold #
-# #
-# INPUT: #
-# %a0 : points to the operand to be denormalized #
-# %d0{31:29} : initial guard,round,sticky #
-# %d1{15:0} : denormalization threshold #
-# OUTPUT: #
-# %a0 : points to the denormalized operand #
-# %d0{31:29} : final guard,round,sticky #
-# #
-
-# *** Local Equates *** #
-set GRS, L_SCR2 # g,r,s temp storage
-set FTEMP_LO2, L_SCR1 # FTEMP_LO copy
-
- global dnrm_lp
-dnrm_lp:
-
-#
-# make a copy of FTEMP_LO and place the g,r,s bits directly after it
-# in memory so as to make the bitfield extraction for denormalization easier.
-#
- mov.l FTEMP_LO(%a0), FTEMP_LO2(%a6) # make FTEMP_LO copy
- mov.l %d0, GRS(%a6) # place g,r,s after it
-
-#
-# check to see how much less than the underflow threshold the operand
-# exponent is.
-#
- mov.l %d1, %d0 # copy the denorm threshold
- sub.w FTEMP_EX(%a0), %d1 # d1 = threshold - uns exponent
- ble.b dnrm_no_lp # d1 <= 0
- cmpi.w %d1, &0x20 # is ( 0 <= d1 < 32) ?
- blt.b case_1 # yes
- cmpi.w %d1, &0x40 # is (32 <= d1 < 64) ?
- blt.b case_2 # yes
- bra.w case_3 # (d1 >= 64)
-
-#
-# No normalization necessary
-#
-dnrm_no_lp:
- mov.l GRS(%a6), %d0 # restore original g,r,s
- rts
-
-#
-# case (0<d1<32)
-#
-# %d0 = denorm threshold
-# %d1 = "n" = amt to shift
-#
-# ---------------------------------------------------------
-# | FTEMP_HI | FTEMP_LO |grs000.........000|
-# ---------------------------------------------------------
-# <-(32 - n)-><-(n)-><-(32 - n)-><-(n)-><-(32 - n)-><-(n)->
-# \ \ \ \
-# \ \ \ \
-# \ \ \ \
-# \ \ \ \
-# \ \ \ \
-# \ \ \ \
-# \ \ \ \
-# \ \ \ \
-# <-(n)-><-(32 - n)-><------(32)-------><------(32)------->
-# ---------------------------------------------------------
-# |0.....0| NEW_HI | NEW_FTEMP_LO |grs |
-# ---------------------------------------------------------
-#
-case_1:
- mov.l %d2, -(%sp) # create temp storage
-
- mov.w %d0, FTEMP_EX(%a0) # exponent = denorm threshold
- mov.l &32, %d0
- sub.w %d1, %d0 # %d0 = 32 - %d1
-
- cmpi.w %d1, &29 # is shft amt >= 29
- blt.b case1_extract # no; no fix needed
- mov.b GRS(%a6), %d2
- or.b %d2, 3+FTEMP_LO2(%a6)
-
-case1_extract:
- bfextu FTEMP_HI(%a0){&0:%d0}, %d2 # %d2 = new FTEMP_HI
- bfextu FTEMP_HI(%a0){%d0:&32}, %d1 # %d1 = new FTEMP_LO
- bfextu FTEMP_LO2(%a6){%d0:&32}, %d0 # %d0 = new G,R,S
-
- mov.l %d2, FTEMP_HI(%a0) # store new FTEMP_HI
- mov.l %d1, FTEMP_LO(%a0) # store new FTEMP_LO
-
- bftst %d0{&2:&30} # were bits shifted off?
- beq.b case1_sticky_clear # no; go finish
- bset &rnd_stky_bit, %d0 # yes; set sticky bit
-
-case1_sticky_clear:
- and.l &0xe0000000, %d0 # clear all but G,R,S
- mov.l (%sp)+, %d2 # restore temp register
- rts
-
-#
-# case (32<=d1<64)
-#
-# %d0 = denorm threshold
-# %d1 = "n" = amt to shift
-#
-# ---------------------------------------------------------
-# | FTEMP_HI | FTEMP_LO |grs000.........000|
-# ---------------------------------------------------------
-# <-(32 - n)-><-(n)-><-(32 - n)-><-(n)-><-(32 - n)-><-(n)->
-# \ \ \
-# \ \ \
-# \ \ -------------------
-# \ -------------------- \
-# ------------------- \ \
-# \ \ \
-# \ \ \
-# \ \ \
-# <-------(32)------><-(n)-><-(32 - n)-><------(32)------->
-# ---------------------------------------------------------
-# |0...............0|0....0| NEW_LO |grs |
-# ---------------------------------------------------------
-#
-case_2:
- mov.l %d2, -(%sp) # create temp storage
-
- mov.w %d0, FTEMP_EX(%a0) # exponent = denorm threshold
- subi.w &0x20, %d1 # %d1 now between 0 and 32
- mov.l &0x20, %d0
- sub.w %d1, %d0 # %d0 = 32 - %d1
-
-# subtle step here; or in the g,r,s at the bottom of FTEMP_LO to minimize
-# the number of bits to check for the sticky detect.
-# it only plays a role in shift amounts of 61-63.
- mov.b GRS(%a6), %d2
- or.b %d2, 3+FTEMP_LO2(%a6)
-
- bfextu FTEMP_HI(%a0){&0:%d0}, %d2 # %d2 = new FTEMP_LO
- bfextu FTEMP_HI(%a0){%d0:&32}, %d1 # %d1 = new G,R,S
-
- bftst %d1{&2:&30} # were any bits shifted off?
- bne.b case2_set_sticky # yes; set sticky bit
- bftst FTEMP_LO2(%a6){%d0:&31} # were any bits shifted off?
- bne.b case2_set_sticky # yes; set sticky bit
-
- mov.l %d1, %d0 # move new G,R,S to %d0
- bra.b case2_end
-
-case2_set_sticky:
- mov.l %d1, %d0 # move new G,R,S to %d0
- bset &rnd_stky_bit, %d0 # set sticky bit
-
-case2_end:
- clr.l FTEMP_HI(%a0) # store FTEMP_HI = 0
- mov.l %d2, FTEMP_LO(%a0) # store FTEMP_LO
- and.l &0xe0000000, %d0 # clear all but G,R,S
-
- mov.l (%sp)+,%d2 # restore temp register
- rts
-
-#
-# case (d1>=64)
-#
-# %d0 = denorm threshold
-# %d1 = amt to shift
-#
-case_3:
- mov.w %d0, FTEMP_EX(%a0) # insert denorm threshold
-
- cmpi.w %d1, &65 # is shift amt > 65?
- blt.b case3_64 # no; it's == 64
- beq.b case3_65 # no; it's == 65
-
-#
-# case (d1>65)
-#
-# Shift value is > 65 and out of range. All bits are shifted off.
-# Return a zero mantissa with the sticky bit set
-#
- clr.l FTEMP_HI(%a0) # clear hi(mantissa)
- clr.l FTEMP_LO(%a0) # clear lo(mantissa)
- mov.l &0x20000000, %d0 # set sticky bit
- rts
-
-#
-# case (d1 == 64)
-#
-# ---------------------------------------------------------
-# | FTEMP_HI | FTEMP_LO |grs000.........000|
-# ---------------------------------------------------------
-# <-------(32)------>
-# \ \
-# \ \
-# \ \
-# \ ------------------------------
-# ------------------------------- \
-# \ \
-# \ \
-# \ \
-# <-------(32)------>
-# ---------------------------------------------------------
-# |0...............0|0................0|grs |
-# ---------------------------------------------------------
-#
-case3_64:
- mov.l FTEMP_HI(%a0), %d0 # fetch hi(mantissa)
- mov.l %d0, %d1 # make a copy
- and.l &0xc0000000, %d0 # extract G,R
- and.l &0x3fffffff, %d1 # extract other bits
-
- bra.b case3_complete
-
-#
-# case (d1 == 65)
-#
-# ---------------------------------------------------------
-# | FTEMP_HI | FTEMP_LO |grs000.........000|
-# ---------------------------------------------------------
-# <-------(32)------>
-# \ \
-# \ \
-# \ \
-# \ ------------------------------
-# -------------------------------- \
-# \ \
-# \ \
-# \ \
-# <-------(31)----->
-# ---------------------------------------------------------
-# |0...............0|0................0|0rs |
-# ---------------------------------------------------------
-#
-case3_65:
- mov.l FTEMP_HI(%a0), %d0 # fetch hi(mantissa)
- and.l &0x80000000, %d0 # extract R bit
- lsr.l &0x1, %d0 # shift high bit into R bit
- and.l &0x7fffffff, %d1 # extract other bits
-
-case3_complete:
-# last operation done was an "and" of the bits shifted off so the condition
-# codes are already set so branch accordingly.
- bne.b case3_set_sticky # yes; go set new sticky
- tst.l FTEMP_LO(%a0) # were any bits shifted off?
- bne.b case3_set_sticky # yes; go set new sticky
- tst.b GRS(%a6) # were any bits shifted off?
- bne.b case3_set_sticky # yes; go set new sticky
-
-#
-# no bits were shifted off so don't set the sticky bit.
-# the guard and
-# the entire mantissa is zero.
-#
- clr.l FTEMP_HI(%a0) # clear hi(mantissa)
- clr.l FTEMP_LO(%a0) # clear lo(mantissa)
- rts
-
-#
-# some bits were shifted off so set the sticky bit.
-# the entire mantissa is zero.
-#
-case3_set_sticky:
- bset &rnd_stky_bit,%d0 # set new sticky bit
- clr.l FTEMP_HI(%a0) # clear hi(mantissa)
- clr.l FTEMP_LO(%a0) # clear lo(mantissa)
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# _round(): round result according to precision/mode #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# a0 = ptr to input operand in internal extended format #
-# d1(hi) = contains rounding precision: #
-# ext = $0000xxxx #
-# sgl = $0004xxxx #
-# dbl = $0008xxxx #
-# d1(lo) = contains rounding mode: #
-# RN = $xxxx0000 #
-# RZ = $xxxx0001 #
-# RM = $xxxx0002 #
-# RP = $xxxx0003 #
-# d0{31:29} = contains the g,r,s bits (extended) #
-# #
-# OUTPUT ************************************************************** #
-# a0 = pointer to rounded result #
-# #
-# ALGORITHM *********************************************************** #
-# On return the value pointed to by a0 is correctly rounded, #
-# a0 is preserved and the g-r-s bits in d0 are cleared. #
-# The result is not typed - the tag field is invalid. The #
-# result is still in the internal extended format. #
-# #
-# The INEX bit of USER_FPSR will be set if the rounded result was #
-# inexact (i.e. if any of the g-r-s bits were set). #
-# #
-#########################################################################
-
- global _round
-_round:
-#
-# ext_grs() looks at the rounding precision and sets the appropriate
-# G,R,S bits.
-# If (G,R,S == 0) then result is exact and round is done, else set
-# the inex flag in status reg and continue.
-#
- bsr.l ext_grs # extract G,R,S
-
- tst.l %d0 # are G,R,S zero?
- beq.w truncate # yes; round is complete
-
- or.w &inx2a_mask, 2+USER_FPSR(%a6) # set inex2/ainex
-
-#
-# Use rounding mode as an index into a jump table for these modes.
-# All of the following assumes grs != 0.
-#
- mov.w (tbl_mode.b,%pc,%d1.w*2), %a1 # load jump offset
- jmp (tbl_mode.b,%pc,%a1) # jmp to rnd mode handler
-
-tbl_mode:
- short rnd_near - tbl_mode
- short truncate - tbl_mode # RZ always truncates
- short rnd_mnus - tbl_mode
- short rnd_plus - tbl_mode
-
-#################################################################
-# ROUND PLUS INFINITY #
-# #
-# If sign of fp number = 0 (positive), then add 1 to l. #
-#################################################################
-rnd_plus:
- tst.b FTEMP_SGN(%a0) # check for sign
- bmi.w truncate # if positive then truncate
-
- mov.l &0xffffffff, %d0 # force g,r,s to be all f's
- swap %d1 # set up d1 for round prec.
-
- cmpi.b %d1, &s_mode # is prec = sgl?
- beq.w add_sgl # yes
- bgt.w add_dbl # no; it's dbl
- bra.w add_ext # no; it's ext
-
-#################################################################
-# ROUND MINUS INFINITY #
-# #
-# If sign of fp number = 1 (negative), then add 1 to l. #
-#################################################################
-rnd_mnus:
- tst.b FTEMP_SGN(%a0) # check for sign
- bpl.w truncate # if negative then truncate
-
- mov.l &0xffffffff, %d0 # force g,r,s to be all f's
- swap %d1 # set up d1 for round prec.
-
- cmpi.b %d1, &s_mode # is prec = sgl?
- beq.w add_sgl # yes
- bgt.w add_dbl # no; it's dbl
- bra.w add_ext # no; it's ext
-
-#################################################################
-# ROUND NEAREST #
-# #
-# If (g=1), then add 1 to l and if (r=s=0), then clear l #
-# Note that this will round to even in case of a tie. #
-#################################################################
-rnd_near:
- asl.l &0x1, %d0 # shift g-bit to c-bit
- bcc.w truncate # if (g=1) then
-
- swap %d1 # set up d1 for round prec.
-
- cmpi.b %d1, &s_mode # is prec = sgl?
- beq.w add_sgl # yes
- bgt.w add_dbl # no; it's dbl
- bra.w add_ext # no; it's ext
-
-# *** LOCAL EQUATES ***
-set ad_1_sgl, 0x00000100 # constant to add 1 to l-bit in sgl prec
-set ad_1_dbl, 0x00000800 # constant to add 1 to l-bit in dbl prec
-
-#########################
-# ADD SINGLE #
-#########################
-add_sgl:
- add.l &ad_1_sgl, FTEMP_HI(%a0)
- bcc.b scc_clr # no mantissa overflow
- roxr.w FTEMP_HI(%a0) # shift v-bit back in
- roxr.w FTEMP_HI+2(%a0) # shift v-bit back in
- add.w &0x1, FTEMP_EX(%a0) # and incr exponent
-scc_clr:
- tst.l %d0 # test for rs = 0
- bne.b sgl_done
- and.w &0xfe00, FTEMP_HI+2(%a0) # clear the l-bit
-sgl_done:
- and.l &0xffffff00, FTEMP_HI(%a0) # truncate bits beyond sgl limit
- clr.l FTEMP_LO(%a0) # clear d2
- rts
-
-#########################
-# ADD EXTENDED #
-#########################
-add_ext:
- addq.l &1,FTEMP_LO(%a0) # add 1 to l-bit
- bcc.b xcc_clr # test for carry out
- addq.l &1,FTEMP_HI(%a0) # propagate carry
- bcc.b xcc_clr
- roxr.w FTEMP_HI(%a0) # mant is 0 so restore v-bit
- roxr.w FTEMP_HI+2(%a0) # mant is 0 so restore v-bit
- roxr.w FTEMP_LO(%a0)
- roxr.w FTEMP_LO+2(%a0)
- add.w &0x1,FTEMP_EX(%a0) # and inc exp
-xcc_clr:
- tst.l %d0 # test rs = 0
- bne.b add_ext_done
- and.b &0xfe,FTEMP_LO+3(%a0) # clear the l bit
-add_ext_done:
- rts
-
-#########################
-# ADD DOUBLE #
-#########################
-add_dbl:
- add.l &ad_1_dbl, FTEMP_LO(%a0) # add 1 to lsb
- bcc.b dcc_clr # no carry
- addq.l &0x1, FTEMP_HI(%a0) # propagate carry
- bcc.b dcc_clr # no carry
-
- roxr.w FTEMP_HI(%a0) # mant is 0 so restore v-bit
- roxr.w FTEMP_HI+2(%a0) # mant is 0 so restore v-bit
- roxr.w FTEMP_LO(%a0)
- roxr.w FTEMP_LO+2(%a0)
- addq.w &0x1, FTEMP_EX(%a0) # incr exponent
-dcc_clr:
- tst.l %d0 # test for rs = 0
- bne.b dbl_done
- and.w &0xf000, FTEMP_LO+2(%a0) # clear the l-bit
-
-dbl_done:
- and.l &0xfffff800,FTEMP_LO(%a0) # truncate bits beyond dbl limit
- rts
-
-###########################
-# Truncate all other bits #
-###########################
-truncate:
- swap %d1 # select rnd prec
-
- cmpi.b %d1, &s_mode # is prec sgl?
- beq.w sgl_done # yes
- bgt.b dbl_done # no; it's dbl
- rts # no; it's ext
-
-
-#
-# ext_grs(): extract guard, round and sticky bits according to
-# rounding precision.
-#
-# INPUT
-# d0 = extended precision g,r,s (in d0{31:29})
-# d1 = {PREC,ROUND}
-# OUTPUT
-# d0{31:29} = guard, round, sticky
-#
-# The ext_grs extract the guard/round/sticky bits according to the
-# selected rounding precision. It is called by the round subroutine
-# only. All registers except d0 are kept intact. d0 becomes an
-# updated guard,round,sticky in d0{31:29}
-#
-# Notes: the ext_grs uses the round PREC, and therefore has to swap d1
-# prior to usage, and needs to restore d1 to original. this
-# routine is tightly tied to the round routine and not meant to
-# uphold standard subroutine calling practices.
-#
-
-ext_grs:
- swap %d1 # have d1.w point to round precision
- tst.b %d1 # is rnd prec = extended?
- bne.b ext_grs_not_ext # no; go handle sgl or dbl
-
-#
-# %d0 actually already hold g,r,s since _round() had it before calling
-# this function. so, as long as we don't disturb it, we are "returning" it.
-#
-ext_grs_ext:
- swap %d1 # yes; return to correct positions
- rts
-
-ext_grs_not_ext:
- movm.l &0x3000, -(%sp) # make some temp registers {d2/d3}
-
- cmpi.b %d1, &s_mode # is rnd prec = sgl?
- bne.b ext_grs_dbl # no; go handle dbl
-
-#
-# sgl:
-# 96 64 40 32 0
-# -----------------------------------------------------
-# | EXP |XXXXXXX| |xx | |grs|
-# -----------------------------------------------------
-# <--(24)--->nn\ /
-# ee ---------------------
-# ww |
-# v
-# gr new sticky
-#
-ext_grs_sgl:
- bfextu FTEMP_HI(%a0){&24:&2}, %d3 # sgl prec. g-r are 2 bits right
- mov.l &30, %d2 # of the sgl prec. limits
- lsl.l %d2, %d3 # shift g-r bits to MSB of d3
- mov.l FTEMP_HI(%a0), %d2 # get word 2 for s-bit test
- and.l &0x0000003f, %d2 # s bit is the or of all other
- bne.b ext_grs_st_stky # bits to the right of g-r
- tst.l FTEMP_LO(%a0) # test lower mantissa
- bne.b ext_grs_st_stky # if any are set, set sticky
- tst.l %d0 # test original g,r,s
- bne.b ext_grs_st_stky # if any are set, set sticky
- bra.b ext_grs_end_sd # if words 3 and 4 are clr, exit
-
-#
-# dbl:
-# 96 64 32 11 0
-# -----------------------------------------------------
-# | EXP |XXXXXXX| | |xx |grs|
-# -----------------------------------------------------
-# nn\ /
-# ee -------
-# ww |
-# v
-# gr new sticky
-#
-ext_grs_dbl:
- bfextu FTEMP_LO(%a0){&21:&2}, %d3 # dbl-prec. g-r are 2 bits right
- mov.l &30, %d2 # of the dbl prec. limits
- lsl.l %d2, %d3 # shift g-r bits to the MSB of d3
- mov.l FTEMP_LO(%a0), %d2 # get lower mantissa for s-bit test
- and.l &0x000001ff, %d2 # s bit is the or-ing of all
- bne.b ext_grs_st_stky # other bits to the right of g-r
- tst.l %d0 # test word original g,r,s
- bne.b ext_grs_st_stky # if any are set, set sticky
- bra.b ext_grs_end_sd # if clear, exit
-
-ext_grs_st_stky:
- bset &rnd_stky_bit, %d3 # set sticky bit
-ext_grs_end_sd:
- mov.l %d3, %d0 # return grs to d0
-
- movm.l (%sp)+, &0xc # restore scratch registers {d2/d3}
-
- swap %d1 # restore d1 to original
- rts
-
-#########################################################################
-# norm(): normalize the mantissa of an extended precision input. the #
-# input operand should not be normalized already. #
-# #
-# XDEF **************************************************************** #
-# norm() #
-# #
-# XREF **************************************************************** #
-# none #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer fp extended precision operand to normalize #
-# #
-# OUTPUT ************************************************************** #
-# d0 = number of bit positions the mantissa was shifted #
-# a0 = the input operand's mantissa is normalized; the exponent #
-# is unchanged. #
-# #
-#########################################################################
- global norm
-norm:
- mov.l %d2, -(%sp) # create some temp regs
- mov.l %d3, -(%sp)
-
- mov.l FTEMP_HI(%a0), %d0 # load hi(mantissa)
- mov.l FTEMP_LO(%a0), %d1 # load lo(mantissa)
-
- bfffo %d0{&0:&32}, %d2 # how many places to shift?
- beq.b norm_lo # hi(man) is all zeroes!
-
-norm_hi:
- lsl.l %d2, %d0 # left shift hi(man)
- bfextu %d1{&0:%d2}, %d3 # extract lo bits
-
- or.l %d3, %d0 # create hi(man)
- lsl.l %d2, %d1 # create lo(man)
-
- mov.l %d0, FTEMP_HI(%a0) # store new hi(man)
- mov.l %d1, FTEMP_LO(%a0) # store new lo(man)
-
- mov.l %d2, %d0 # return shift amount
-
- mov.l (%sp)+, %d3 # restore temp regs
- mov.l (%sp)+, %d2
-
- rts
-
-norm_lo:
- bfffo %d1{&0:&32}, %d2 # how many places to shift?
- lsl.l %d2, %d1 # shift lo(man)
- add.l &32, %d2 # add 32 to shft amount
-
- mov.l %d1, FTEMP_HI(%a0) # store hi(man)
- clr.l FTEMP_LO(%a0) # lo(man) is now zero
-
- mov.l %d2, %d0 # return shift amount
-
- mov.l (%sp)+, %d3 # restore temp regs
- mov.l (%sp)+, %d2
-
- rts
-
-#########################################################################
-# unnorm_fix(): - changes an UNNORM to one of NORM, DENORM, or ZERO #
-# - returns corresponding optype tag #
-# #
-# XDEF **************************************************************** #
-# unnorm_fix() #
-# #
-# XREF **************************************************************** #
-# norm() - normalize the mantissa #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to unnormalized extended precision number #
-# #
-# OUTPUT ************************************************************** #
-# d0 = optype tag - is corrected to one of NORM, DENORM, or ZERO #
-# a0 = input operand has been converted to a norm, denorm, or #
-# zero; both the exponent and mantissa are changed. #
-# #
-#########################################################################
-
- global unnorm_fix
-unnorm_fix:
- bfffo FTEMP_HI(%a0){&0:&32}, %d0 # how many shifts are needed?
- bne.b unnorm_shift # hi(man) is not all zeroes
-
-#
-# hi(man) is all zeroes so see if any bits in lo(man) are set
-#
-unnorm_chk_lo:
- bfffo FTEMP_LO(%a0){&0:&32}, %d0 # is operand really a zero?
- beq.w unnorm_zero # yes
-
- add.w &32, %d0 # no; fix shift distance
-
-#
-# d0 = # shifts needed for complete normalization
-#
-unnorm_shift:
- clr.l %d1 # clear top word
- mov.w FTEMP_EX(%a0), %d1 # extract exponent
- and.w &0x7fff, %d1 # strip off sgn
-
- cmp.w %d0, %d1 # will denorm push exp < 0?
- bgt.b unnorm_nrm_zero # yes; denorm only until exp = 0
-
-#
-# exponent would not go < 0. therefore, number stays normalized
-#
- sub.w %d0, %d1 # shift exponent value
- mov.w FTEMP_EX(%a0), %d0 # load old exponent
- and.w &0x8000, %d0 # save old sign
- or.w %d0, %d1 # {sgn,new exp}
- mov.w %d1, FTEMP_EX(%a0) # insert new exponent
-
- bsr.l norm # normalize UNNORM
-
- mov.b &NORM, %d0 # return new optype tag
- rts
-
-#
-# exponent would go < 0, so only denormalize until exp = 0
-#
-unnorm_nrm_zero:
- cmp.b %d1, &32 # is exp <= 32?
- bgt.b unnorm_nrm_zero_lrg # no; go handle large exponent
-
- bfextu FTEMP_HI(%a0){%d1:&32}, %d0 # extract new hi(man)
- mov.l %d0, FTEMP_HI(%a0) # save new hi(man)
-
- mov.l FTEMP_LO(%a0), %d0 # fetch old lo(man)
- lsl.l %d1, %d0 # extract new lo(man)
- mov.l %d0, FTEMP_LO(%a0) # save new lo(man)
-
- and.w &0x8000, FTEMP_EX(%a0) # set exp = 0
-
- mov.b &DENORM, %d0 # return new optype tag
- rts
-
-#
-# only mantissa bits set are in lo(man)
-#
-unnorm_nrm_zero_lrg:
- sub.w &32, %d1 # adjust shft amt by 32
-
- mov.l FTEMP_LO(%a0), %d0 # fetch old lo(man)
- lsl.l %d1, %d0 # left shift lo(man)
-
- mov.l %d0, FTEMP_HI(%a0) # store new hi(man)
- clr.l FTEMP_LO(%a0) # lo(man) = 0
-
- and.w &0x8000, FTEMP_EX(%a0) # set exp = 0
-
- mov.b &DENORM, %d0 # return new optype tag
- rts
-
-#
-# whole mantissa is zero so this UNNORM is actually a zero
-#
-unnorm_zero:
- and.w &0x8000, FTEMP_EX(%a0) # force exponent to zero
-
- mov.b &ZERO, %d0 # fix optype tag
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# set_tag_x(): return the optype of the input ext fp number #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision operand #
-# #
-# OUTPUT ************************************************************** #
-# d0 = value of type tag #
-# one of: NORM, INF, QNAN, SNAN, DENORM, UNNORM, ZERO #
-# #
-# ALGORITHM *********************************************************** #
-# Simply test the exponent, j-bit, and mantissa values to #
-# determine the type of operand. #
-# If it's an unnormalized zero, alter the operand and force it #
-# to be a normal zero. #
-# #
-#########################################################################
-
- global set_tag_x
-set_tag_x:
- mov.w FTEMP_EX(%a0), %d0 # extract exponent
- andi.w &0x7fff, %d0 # strip off sign
- cmpi.w %d0, &0x7fff # is (EXP == MAX)?
- beq.b inf_or_nan_x
-not_inf_or_nan_x:
- btst &0x7,FTEMP_HI(%a0)
- beq.b not_norm_x
-is_norm_x:
- mov.b &NORM, %d0
- rts
-not_norm_x:
- tst.w %d0 # is exponent = 0?
- bne.b is_unnorm_x
-not_unnorm_x:
- tst.l FTEMP_HI(%a0)
- bne.b is_denorm_x
- tst.l FTEMP_LO(%a0)
- bne.b is_denorm_x
-is_zero_x:
- mov.b &ZERO, %d0
- rts
-is_denorm_x:
- mov.b &DENORM, %d0
- rts
-# must distinguish now "Unnormalized zeroes" which we
-# must convert to zero.
-is_unnorm_x:
- tst.l FTEMP_HI(%a0)
- bne.b is_unnorm_reg_x
- tst.l FTEMP_LO(%a0)
- bne.b is_unnorm_reg_x
-# it's an "unnormalized zero". let's convert it to an actual zero...
- andi.w &0x8000,FTEMP_EX(%a0) # clear exponent
- mov.b &ZERO, %d0
- rts
-is_unnorm_reg_x:
- mov.b &UNNORM, %d0
- rts
-inf_or_nan_x:
- tst.l FTEMP_LO(%a0)
- bne.b is_nan_x
- mov.l FTEMP_HI(%a0), %d0
- and.l &0x7fffffff, %d0 # msb is a don't care!
- bne.b is_nan_x
-is_inf_x:
- mov.b &INF, %d0
- rts
-is_nan_x:
- btst &0x6, FTEMP_HI(%a0)
- beq.b is_snan_x
- mov.b &QNAN, %d0
- rts
-is_snan_x:
- mov.b &SNAN, %d0
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# set_tag_d(): return the optype of the input dbl fp number #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# a0 = points to double precision operand #
-# #
-# OUTPUT ************************************************************** #
-# d0 = value of type tag #
-# one of: NORM, INF, QNAN, SNAN, DENORM, ZERO #
-# #
-# ALGORITHM *********************************************************** #
-# Simply test the exponent, j-bit, and mantissa values to #
-# determine the type of operand. #
-# #
-#########################################################################
-
- global set_tag_d
-set_tag_d:
- mov.l FTEMP(%a0), %d0
- mov.l %d0, %d1
-
- andi.l &0x7ff00000, %d0
- beq.b zero_or_denorm_d
-
- cmpi.l %d0, &0x7ff00000
- beq.b inf_or_nan_d
-
-is_norm_d:
- mov.b &NORM, %d0
- rts
-zero_or_denorm_d:
- and.l &0x000fffff, %d1
- bne is_denorm_d
- tst.l 4+FTEMP(%a0)
- bne is_denorm_d
-is_zero_d:
- mov.b &ZERO, %d0
- rts
-is_denorm_d:
- mov.b &DENORM, %d0
- rts
-inf_or_nan_d:
- and.l &0x000fffff, %d1
- bne is_nan_d
- tst.l 4+FTEMP(%a0)
- bne is_nan_d
-is_inf_d:
- mov.b &INF, %d0
- rts
-is_nan_d:
- btst &19, %d1
- bne is_qnan_d
-is_snan_d:
- mov.b &SNAN, %d0
- rts
-is_qnan_d:
- mov.b &QNAN, %d0
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# set_tag_s(): return the optype of the input sgl fp number #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to single precision operand #
-# #
-# OUTPUT ************************************************************** #
-# d0 = value of type tag #
-# one of: NORM, INF, QNAN, SNAN, DENORM, ZERO #
-# #
-# ALGORITHM *********************************************************** #
-# Simply test the exponent, j-bit, and mantissa values to #
-# determine the type of operand. #
-# #
-#########################################################################
-
- global set_tag_s
-set_tag_s:
- mov.l FTEMP(%a0), %d0
- mov.l %d0, %d1
-
- andi.l &0x7f800000, %d0
- beq.b zero_or_denorm_s
-
- cmpi.l %d0, &0x7f800000
- beq.b inf_or_nan_s
-
-is_norm_s:
- mov.b &NORM, %d0
- rts
-zero_or_denorm_s:
- and.l &0x007fffff, %d1
- bne is_denorm_s
-is_zero_s:
- mov.b &ZERO, %d0
- rts
-is_denorm_s:
- mov.b &DENORM, %d0
- rts
-inf_or_nan_s:
- and.l &0x007fffff, %d1
- bne is_nan_s
-is_inf_s:
- mov.b &INF, %d0
- rts
-is_nan_s:
- btst &22, %d1
- bne is_qnan_s
-is_snan_s:
- mov.b &SNAN, %d0
- rts
-is_qnan_s:
- mov.b &QNAN, %d0
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# unf_res(): routine to produce default underflow result of a #
-# scaled extended precision number; this is used by #
-# fadd/fdiv/fmul/etc. emulation routines. #
-# unf_res4(): same as above but for fsglmul/fsgldiv which use #
-# single round prec and extended prec mode. #
-# #
-# XREF **************************************************************** #
-# _denorm() - denormalize according to scale factor #
-# _round() - round denormalized number according to rnd prec #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision operand #
-# d0 = scale factor #
-# d1 = rounding precision/mode #
-# #
-# OUTPUT ************************************************************** #
-# a0 = pointer to default underflow result in extended precision #
-# d0.b = result FPSR_cc which caller may or may not want to save #
-# #
-# ALGORITHM *********************************************************** #
-# Convert the input operand to "internal format" which means the #
-# exponent is extended to 16 bits and the sign is stored in the unused #
-# portion of the extended precision operand. Denormalize the number #
-# according to the scale factor passed in d0. Then, round the #
-# denormalized result. #
-# Set the FPSR_exc bits as appropriate but return the cc bits in #
-# d0 in case the caller doesn't want to save them (as is the case for #
-# fmove out). #
-# unf_res4() for fsglmul/fsgldiv forces the denorm to extended #
-# precision and the rounding mode to single. #
-# #
-#########################################################################
- global unf_res
-unf_res:
- mov.l %d1, -(%sp) # save rnd prec,mode on stack
-
- btst &0x7, FTEMP_EX(%a0) # make "internal" format
- sne FTEMP_SGN(%a0)
-
- mov.w FTEMP_EX(%a0), %d1 # extract exponent
- and.w &0x7fff, %d1
- sub.w %d0, %d1
- mov.w %d1, FTEMP_EX(%a0) # insert 16 bit exponent
-
- mov.l %a0, -(%sp) # save operand ptr during calls
-
- mov.l 0x4(%sp),%d0 # pass rnd prec.
- andi.w &0x00c0,%d0
- lsr.w &0x4,%d0
- bsr.l _denorm # denorm result
-
- mov.l (%sp),%a0
- mov.w 0x6(%sp),%d1 # load prec:mode into %d1
- andi.w &0xc0,%d1 # extract rnd prec
- lsr.w &0x4,%d1
- swap %d1
- mov.w 0x6(%sp),%d1
- andi.w &0x30,%d1
- lsr.w &0x4,%d1
- bsr.l _round # round the denorm
-
- mov.l (%sp)+, %a0
-
-# result is now rounded properly. convert back to normal format
- bclr &0x7, FTEMP_EX(%a0) # clear sgn first; may have residue
- tst.b FTEMP_SGN(%a0) # is "internal result" sign set?
- beq.b unf_res_chkifzero # no; result is positive
- bset &0x7, FTEMP_EX(%a0) # set result sgn
- clr.b FTEMP_SGN(%a0) # clear temp sign
-
-# the number may have become zero after rounding. set ccodes accordingly.
-unf_res_chkifzero:
- clr.l %d0
- tst.l FTEMP_HI(%a0) # is value now a zero?
- bne.b unf_res_cont # no
- tst.l FTEMP_LO(%a0)
- bne.b unf_res_cont # no
-# bset &z_bit, FPSR_CC(%a6) # yes; set zero ccode bit
- bset &z_bit, %d0 # yes; set zero ccode bit
-
-unf_res_cont:
-
-#
-# can inex1 also be set along with unfl and inex2???
-#
-# we know that underflow has occurred. aunfl should be set if INEX2 is also set.
-#
- btst &inex2_bit, FPSR_EXCEPT(%a6) # is INEX2 set?
- beq.b unf_res_end # no
- bset &aunfl_bit, FPSR_AEXCEPT(%a6) # yes; set aunfl
-
-unf_res_end:
- add.l &0x4, %sp # clear stack
- rts
-
-# unf_res() for fsglmul() and fsgldiv().
- global unf_res4
-unf_res4:
- mov.l %d1,-(%sp) # save rnd prec,mode on stack
-
- btst &0x7,FTEMP_EX(%a0) # make "internal" format
- sne FTEMP_SGN(%a0)
-
- mov.w FTEMP_EX(%a0),%d1 # extract exponent
- and.w &0x7fff,%d1
- sub.w %d0,%d1
- mov.w %d1,FTEMP_EX(%a0) # insert 16 bit exponent
-
- mov.l %a0,-(%sp) # save operand ptr during calls
-
- clr.l %d0 # force rnd prec = ext
- bsr.l _denorm # denorm result
-
- mov.l (%sp),%a0
- mov.w &s_mode,%d1 # force rnd prec = sgl
- swap %d1
- mov.w 0x6(%sp),%d1 # load rnd mode
- andi.w &0x30,%d1 # extract rnd prec
- lsr.w &0x4,%d1
- bsr.l _round # round the denorm
-
- mov.l (%sp)+,%a0
-
-# result is now rounded properly. convert back to normal format
- bclr &0x7,FTEMP_EX(%a0) # clear sgn first; may have residue
- tst.b FTEMP_SGN(%a0) # is "internal result" sign set?
- beq.b unf_res4_chkifzero # no; result is positive
- bset &0x7,FTEMP_EX(%a0) # set result sgn
- clr.b FTEMP_SGN(%a0) # clear temp sign
-
-# the number may have become zero after rounding. set ccodes accordingly.
-unf_res4_chkifzero:
- clr.l %d0
- tst.l FTEMP_HI(%a0) # is value now a zero?
- bne.b unf_res4_cont # no
- tst.l FTEMP_LO(%a0)
- bne.b unf_res4_cont # no
-# bset &z_bit,FPSR_CC(%a6) # yes; set zero ccode bit
- bset &z_bit,%d0 # yes; set zero ccode bit
-
-unf_res4_cont:
-
-#
-# can inex1 also be set along with unfl and inex2???
-#
-# we know that underflow has occurred. aunfl should be set if INEX2 is also set.
-#
- btst &inex2_bit,FPSR_EXCEPT(%a6) # is INEX2 set?
- beq.b unf_res4_end # no
- bset &aunfl_bit,FPSR_AEXCEPT(%a6) # yes; set aunfl
-
-unf_res4_end:
- add.l &0x4,%sp # clear stack
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# ovf_res(): routine to produce the default overflow result of #
-# an overflowing number. #
-# ovf_res2(): same as above but the rnd mode/prec are passed #
-# differently. #
-# #
-# XREF **************************************************************** #
-# none #
-# #
-# INPUT *************************************************************** #
-# d1.b = '-1' => (-); '0' => (+) #
-# ovf_res(): #
-# d0 = rnd mode/prec #
-# ovf_res2(): #
-# hi(d0) = rnd prec #
-# lo(d0) = rnd mode #
-# #
-# OUTPUT ************************************************************** #
-# a0 = points to extended precision result #
-# d0.b = condition code bits #
-# #
-# ALGORITHM *********************************************************** #
-# The default overflow result can be determined by the sign of #
-# the result and the rounding mode/prec in effect. These bits are #
-# concatenated together to create an index into the default result #
-# table. A pointer to the correct result is returned in a0. The #
-# resulting condition codes are returned in d0 in case the caller #
-# doesn't want FPSR_cc altered (as is the case for fmove out). #
-# #
-#########################################################################
-
- global ovf_res
-ovf_res:
- andi.w &0x10,%d1 # keep result sign
- lsr.b &0x4,%d0 # shift prec/mode
- or.b %d0,%d1 # concat the two
- mov.w %d1,%d0 # make a copy
- lsl.b &0x1,%d1 # multiply d1 by 2
- bra.b ovf_res_load
-
- global ovf_res2
-ovf_res2:
- and.w &0x10, %d1 # keep result sign
- or.b %d0, %d1 # insert rnd mode
- swap %d0
- or.b %d0, %d1 # insert rnd prec
- mov.w %d1, %d0 # make a copy
- lsl.b &0x1, %d1 # shift left by 1
-
-#
-# use the rounding mode, precision, and result sign as in index into the
-# two tables below to fetch the default result and the result ccodes.
-#
-ovf_res_load:
- mov.b (tbl_ovfl_cc.b,%pc,%d0.w*1), %d0 # fetch result ccodes
- lea (tbl_ovfl_result.b,%pc,%d1.w*8), %a0 # return result ptr
-
- rts
-
-tbl_ovfl_cc:
- byte 0x2, 0x0, 0x0, 0x2
- byte 0x2, 0x0, 0x0, 0x2
- byte 0x2, 0x0, 0x0, 0x2
- byte 0x0, 0x0, 0x0, 0x0
- byte 0x2+0x8, 0x8, 0x2+0x8, 0x8
- byte 0x2+0x8, 0x8, 0x2+0x8, 0x8
- byte 0x2+0x8, 0x8, 0x2+0x8, 0x8
-
-tbl_ovfl_result:
- long 0x7fff0000,0x00000000,0x00000000,0x00000000 # +INF; RN
- long 0x7ffe0000,0xffffffff,0xffffffff,0x00000000 # +EXT; RZ
- long 0x7ffe0000,0xffffffff,0xffffffff,0x00000000 # +EXT; RM
- long 0x7fff0000,0x00000000,0x00000000,0x00000000 # +INF; RP
-
- long 0x7fff0000,0x00000000,0x00000000,0x00000000 # +INF; RN
- long 0x407e0000,0xffffff00,0x00000000,0x00000000 # +SGL; RZ
- long 0x407e0000,0xffffff00,0x00000000,0x00000000 # +SGL; RM
- long 0x7fff0000,0x00000000,0x00000000,0x00000000 # +INF; RP
-
- long 0x7fff0000,0x00000000,0x00000000,0x00000000 # +INF; RN
- long 0x43fe0000,0xffffffff,0xfffff800,0x00000000 # +DBL; RZ
- long 0x43fe0000,0xffffffff,0xfffff800,0x00000000 # +DBL; RM
- long 0x7fff0000,0x00000000,0x00000000,0x00000000 # +INF; RP
-
- long 0x00000000,0x00000000,0x00000000,0x00000000
- long 0x00000000,0x00000000,0x00000000,0x00000000
- long 0x00000000,0x00000000,0x00000000,0x00000000
- long 0x00000000,0x00000000,0x00000000,0x00000000
-
- long 0xffff0000,0x00000000,0x00000000,0x00000000 # -INF; RN
- long 0xfffe0000,0xffffffff,0xffffffff,0x00000000 # -EXT; RZ
- long 0xffff0000,0x00000000,0x00000000,0x00000000 # -INF; RM
- long 0xfffe0000,0xffffffff,0xffffffff,0x00000000 # -EXT; RP
-
- long 0xffff0000,0x00000000,0x00000000,0x00000000 # -INF; RN
- long 0xc07e0000,0xffffff00,0x00000000,0x00000000 # -SGL; RZ
- long 0xffff0000,0x00000000,0x00000000,0x00000000 # -INF; RM
- long 0xc07e0000,0xffffff00,0x00000000,0x00000000 # -SGL; RP
-
- long 0xffff0000,0x00000000,0x00000000,0x00000000 # -INF; RN
- long 0xc3fe0000,0xffffffff,0xfffff800,0x00000000 # -DBL; RZ
- long 0xffff0000,0x00000000,0x00000000,0x00000000 # -INF; RM
- long 0xc3fe0000,0xffffffff,0xfffff800,0x00000000 # -DBL; RP
-
-#########################################################################
-# XDEF **************************************************************** #
-# fout(): move from fp register to memory or data register #
-# #
-# XREF **************************************************************** #
-# _round() - needed to create EXOP for sgl/dbl precision #
-# norm() - needed to create EXOP for extended precision #
-# ovf_res() - create default overflow result for sgl/dbl precision#
-# unf_res() - create default underflow result for sgl/dbl prec. #
-# dst_dbl() - create rounded dbl precision result. #
-# dst_sgl() - create rounded sgl precision result. #
-# fetch_dreg() - fetch dynamic k-factor reg for packed. #
-# bindec() - convert FP binary number to packed number. #
-# _mem_write() - write data to memory. #
-# _mem_write2() - write data to memory unless supv mode -(a7) exc.#
-# _dmem_write_{byte,word,long}() - write data to memory. #
-# store_dreg_{b,w,l}() - store data to data register file. #
-# facc_out_{b,w,l,d,x}() - data access error occurred. #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# d0 = round prec,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 : intermediate underflow or overflow result if #
-# OVFL/UNFL occurred for a sgl or dbl operand #
-# #
-# ALGORITHM *********************************************************** #
-# This routine is accessed by many handlers that need to do an #
-# opclass three move of an operand out to memory. #
-# Decode an fmove out (opclass 3) instruction to determine if #
-# it's b,w,l,s,d,x, or p in size. b,w,l can be stored to either a data #
-# register or memory. The algorithm uses a standard "fmove" to create #
-# the rounded result. Also, since exceptions are disabled, this also #
-# create the correct OPERR default result if appropriate. #
-# For sgl or dbl precision, overflow or underflow can occur. If #
-# either occurs and is enabled, the EXOP. #
-# For extended precision, the stacked <ea> must be fixed along #
-# w/ the address index register as appropriate w/ _calc_ea_fout(). If #
-# the source is a denorm and if underflow is enabled, an EXOP must be #
-# created. #
-# For packed, the k-factor must be fetched from the instruction #
-# word or a data register. The <ea> must be fixed as w/ extended #
-# precision. Then, bindec() is called to create the appropriate #
-# packed result. #
-# If at any time an access error is flagged by one of the move- #
-# to-memory routines, then a special exit must be made so that the #
-# access error can be handled properly. #
-# #
-#########################################################################
-
- global fout
-fout:
- bfextu EXC_CMDREG(%a6){&3:&3},%d1 # extract dst fmt
- mov.w (tbl_fout.b,%pc,%d1.w*2),%a1 # use as index
- jmp (tbl_fout.b,%pc,%a1) # jump to routine
-
- swbeg &0x8
-tbl_fout:
- short fout_long - tbl_fout
- short fout_sgl - tbl_fout
- short fout_ext - tbl_fout
- short fout_pack - tbl_fout
- short fout_word - tbl_fout
- short fout_dbl - tbl_fout
- short fout_byte - tbl_fout
- short fout_pack - tbl_fout
-
-#################################################################
-# fmove.b out ###################################################
-#################################################################
-
-# Only "Unimplemented Data Type" exceptions enter here. The operand
-# is either a DENORM or a NORM.
-fout_byte:
- tst.b STAG(%a6) # is operand normalized?
- bne.b fout_byte_denorm # no
-
- fmovm.x SRC(%a0),&0x80 # load value
-
-fout_byte_norm:
- fmov.l %d0,%fpcr # insert rnd prec,mode
-
- fmov.b %fp0,%d0 # exec move out w/ correct rnd mode
-
- fmov.l &0x0,%fpcr # clear FPCR
- fmov.l %fpsr,%d1 # fetch FPSR
- or.w %d1,2+USER_FPSR(%a6) # save new exc,accrued bits
-
- mov.b 1+EXC_OPWORD(%a6),%d1 # extract dst mode
- andi.b &0x38,%d1 # is mode == 0? (Dreg dst)
- beq.b fout_byte_dn # must save to integer regfile
-
- mov.l EXC_EA(%a6),%a0 # stacked <ea> is correct
- bsr.l _dmem_write_byte # write byte
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_b # yes
-
- rts
-
-fout_byte_dn:
- mov.b 1+EXC_OPWORD(%a6),%d1 # extract Dn
- andi.w &0x7,%d1
- bsr.l store_dreg_b
- rts
-
-fout_byte_denorm:
- mov.l SRC_EX(%a0),%d1
- andi.l &0x80000000,%d1 # keep DENORM sign
- ori.l &0x00800000,%d1 # make smallest sgl
- fmov.s %d1,%fp0
- bra.b fout_byte_norm
-
-#################################################################
-# fmove.w out ###################################################
-#################################################################
-
-# Only "Unimplemented Data Type" exceptions enter here. The operand
-# is either a DENORM or a NORM.
-fout_word:
- tst.b STAG(%a6) # is operand normalized?
- bne.b fout_word_denorm # no
-
- fmovm.x SRC(%a0),&0x80 # load value
-
-fout_word_norm:
- fmov.l %d0,%fpcr # insert rnd prec:mode
-
- fmov.w %fp0,%d0 # exec move out w/ correct rnd mode
-
- fmov.l &0x0,%fpcr # clear FPCR
- fmov.l %fpsr,%d1 # fetch FPSR
- or.w %d1,2+USER_FPSR(%a6) # save new exc,accrued bits
-
- mov.b 1+EXC_OPWORD(%a6),%d1 # extract dst mode
- andi.b &0x38,%d1 # is mode == 0? (Dreg dst)
- beq.b fout_word_dn # must save to integer regfile
-
- mov.l EXC_EA(%a6),%a0 # stacked <ea> is correct
- bsr.l _dmem_write_word # write word
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_w # yes
-
- rts
-
-fout_word_dn:
- mov.b 1+EXC_OPWORD(%a6),%d1 # extract Dn
- andi.w &0x7,%d1
- bsr.l store_dreg_w
- rts
-
-fout_word_denorm:
- mov.l SRC_EX(%a0),%d1
- andi.l &0x80000000,%d1 # keep DENORM sign
- ori.l &0x00800000,%d1 # make smallest sgl
- fmov.s %d1,%fp0
- bra.b fout_word_norm
-
-#################################################################
-# fmove.l out ###################################################
-#################################################################
-
-# Only "Unimplemented Data Type" exceptions enter here. The operand
-# is either a DENORM or a NORM.
-fout_long:
- tst.b STAG(%a6) # is operand normalized?
- bne.b fout_long_denorm # no
-
- fmovm.x SRC(%a0),&0x80 # load value
-
-fout_long_norm:
- fmov.l %d0,%fpcr # insert rnd prec:mode
-
- fmov.l %fp0,%d0 # exec move out w/ correct rnd mode
-
- fmov.l &0x0,%fpcr # clear FPCR
- fmov.l %fpsr,%d1 # fetch FPSR
- or.w %d1,2+USER_FPSR(%a6) # save new exc,accrued bits
-
-fout_long_write:
- mov.b 1+EXC_OPWORD(%a6),%d1 # extract dst mode
- andi.b &0x38,%d1 # is mode == 0? (Dreg dst)
- beq.b fout_long_dn # must save to integer regfile
-
- mov.l EXC_EA(%a6),%a0 # stacked <ea> is correct
- bsr.l _dmem_write_long # write long
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_l # yes
-
- rts
-
-fout_long_dn:
- mov.b 1+EXC_OPWORD(%a6),%d1 # extract Dn
- andi.w &0x7,%d1
- bsr.l store_dreg_l
- rts
-
-fout_long_denorm:
- mov.l SRC_EX(%a0),%d1
- andi.l &0x80000000,%d1 # keep DENORM sign
- ori.l &0x00800000,%d1 # make smallest sgl
- fmov.s %d1,%fp0
- bra.b fout_long_norm
-
-#################################################################
-# fmove.x out ###################################################
-#################################################################
-
-# Only "Unimplemented Data Type" exceptions enter here. The operand
-# is either a DENORM or a NORM.
-# The DENORM causes an Underflow exception.
-fout_ext:
-
-# we copy the extended precision result to FP_SCR0 so that the reserved
-# 16-bit field gets zeroed. we do this since we promise not to disturb
-# what's at SRC(a0).
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- clr.w 2+FP_SCR0_EX(%a6) # clear reserved field
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
-
- fmovm.x SRC(%a0),&0x80 # return result
-
- bsr.l _calc_ea_fout # fix stacked <ea>
-
- mov.l %a0,%a1 # pass: dst addr
- lea FP_SCR0(%a6),%a0 # pass: src addr
- mov.l &0xc,%d0 # pass: opsize is 12 bytes
-
-# we must not yet write the extended precision data to the stack
-# in the pre-decrement case from supervisor mode or else we'll corrupt
-# the stack frame. so, leave it in FP_SRC for now and deal with it later...
- cmpi.b SPCOND_FLG(%a6),&mda7_flg
- beq.b fout_ext_a7
-
- bsr.l _dmem_write # write ext prec number to memory
-
- tst.l %d1 # did dstore fail?
- bne.w fout_ext_err # yes
-
- tst.b STAG(%a6) # is operand normalized?
- bne.b fout_ext_denorm # no
- rts
-
-# the number is a DENORM. must set the underflow exception bit
-fout_ext_denorm:
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set underflow exc bit
-
- mov.b FPCR_ENABLE(%a6),%d0
- andi.b &0x0a,%d0 # is UNFL or INEX enabled?
- bne.b fout_ext_exc # yes
- rts
-
-# we don't want to do the write if the exception occurred in supervisor mode
-# so _mem_write2() handles this for us.
-fout_ext_a7:
- bsr.l _mem_write2 # write ext prec number to memory
-
- tst.l %d1 # did dstore fail?
- bne.w fout_ext_err # yes
-
- tst.b STAG(%a6) # is operand normalized?
- bne.b fout_ext_denorm # no
- rts
-
-fout_ext_exc:
- lea FP_SCR0(%a6),%a0
- bsr.l norm # normalize the mantissa
- neg.w %d0 # new exp = -(shft amt)
- andi.w &0x7fff,%d0
- andi.w &0x8000,FP_SCR0_EX(%a6) # keep only old sign
- or.w %d0,FP_SCR0_EX(%a6) # insert new exponent
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- rts
-
-fout_ext_err:
- mov.l EXC_A6(%a6),(%a6) # fix stacked a6
- bra.l facc_out_x
-
-#########################################################################
-# fmove.s out ###########################################################
-#########################################################################
-fout_sgl:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &s_mode*0x10,%d0 # insert sgl prec
- mov.l %d0,L_SCR3(%a6) # save rnd prec,mode on stack
-
-#
-# operand is a normalized number. first, we check to see if the move out
-# would cause either an underflow or overflow. these cases are handled
-# separately. otherwise, set the FPCR to the proper rounding mode and
-# execute the move.
-#
- mov.w SRC_EX(%a0),%d0 # extract exponent
- andi.w &0x7fff,%d0 # strip sign
-
- cmpi.w %d0,&SGL_HI # will operand overflow?
- bgt.w fout_sgl_ovfl # yes; go handle OVFL
- beq.w fout_sgl_may_ovfl # maybe; go handle possible OVFL
- cmpi.w %d0,&SGL_LO # will operand underflow?
- blt.w fout_sgl_unfl # yes; go handle underflow
-
-#
-# NORMs(in range) can be stored out by a simple "fmov.s"
-# Unnormalized inputs can come through this point.
-#
-fout_sgl_exg:
- fmovm.x SRC(%a0),&0x80 # fetch fop from stack
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fmov.s %fp0,%d0 # store does convert and round
-
- fmov.l &0x0,%fpcr # clear FPCR
- fmov.l %fpsr,%d1 # save FPSR
-
- or.w %d1,2+USER_FPSR(%a6) # set possible inex2/ainex
-
-fout_sgl_exg_write:
- mov.b 1+EXC_OPWORD(%a6),%d1 # extract dst mode
- andi.b &0x38,%d1 # is mode == 0? (Dreg dst)
- beq.b fout_sgl_exg_write_dn # must save to integer regfile
-
- mov.l EXC_EA(%a6),%a0 # stacked <ea> is correct
- bsr.l _dmem_write_long # write long
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_l # yes
-
- rts
-
-fout_sgl_exg_write_dn:
- mov.b 1+EXC_OPWORD(%a6),%d1 # extract Dn
- andi.w &0x7,%d1
- bsr.l store_dreg_l
- rts
-
-#
-# here, we know that the operand would UNFL if moved out to single prec,
-# so, denorm and round and then use generic store single routine to
-# write the value to memory.
-#
-fout_sgl_unfl:
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set UNFL
-
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- mov.l %a0,-(%sp)
-
- clr.l %d0 # pass: S.F. = 0
-
- cmpi.b STAG(%a6),&DENORM # fetch src optype tag
- bne.b fout_sgl_unfl_cont # let DENORMs fall through
-
- lea FP_SCR0(%a6),%a0
- bsr.l norm # normalize the DENORM
-
-fout_sgl_unfl_cont:
- lea FP_SCR0(%a6),%a0 # pass: ptr to operand
- mov.l L_SCR3(%a6),%d1 # pass: rnd prec,mode
- bsr.l unf_res # calc default underflow result
-
- lea FP_SCR0(%a6),%a0 # pass: ptr to fop
- bsr.l dst_sgl # convert to single prec
-
- mov.b 1+EXC_OPWORD(%a6),%d1 # extract dst mode
- andi.b &0x38,%d1 # is mode == 0? (Dreg dst)
- beq.b fout_sgl_unfl_dn # must save to integer regfile
-
- mov.l EXC_EA(%a6),%a0 # stacked <ea> is correct
- bsr.l _dmem_write_long # write long
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_l # yes
-
- bra.b fout_sgl_unfl_chkexc
-
-fout_sgl_unfl_dn:
- mov.b 1+EXC_OPWORD(%a6),%d1 # extract Dn
- andi.w &0x7,%d1
- bsr.l store_dreg_l
-
-fout_sgl_unfl_chkexc:
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x0a,%d1 # is UNFL or INEX enabled?
- bne.w fout_sd_exc_unfl # yes
- addq.l &0x4,%sp
- rts
-
-#
-# it's definitely an overflow so call ovf_res to get the correct answer
-#
-fout_sgl_ovfl:
- tst.b 3+SRC_HI(%a0) # is result inexact?
- bne.b fout_sgl_ovfl_inex2
- tst.l SRC_LO(%a0) # is result inexact?
- bne.b fout_sgl_ovfl_inex2
- ori.w &ovfl_inx_mask,2+USER_FPSR(%a6) # set ovfl/aovfl/ainex
- bra.b fout_sgl_ovfl_cont
-fout_sgl_ovfl_inex2:
- ori.w &ovfinx_mask,2+USER_FPSR(%a6) # set ovfl/aovfl/ainex/inex2
-
-fout_sgl_ovfl_cont:
- mov.l %a0,-(%sp)
-
-# call ovf_res() w/ sgl prec and the correct rnd mode to create the default
-# overflow result. DON'T save the returned ccodes from ovf_res() since
-# fmove out doesn't alter them.
- tst.b SRC_EX(%a0) # is operand negative?
- smi %d1 # set if so
- mov.l L_SCR3(%a6),%d0 # pass: sgl prec,rnd mode
- bsr.l ovf_res # calc OVFL result
- fmovm.x (%a0),&0x80 # load default overflow result
- fmov.s %fp0,%d0 # store to single
-
- mov.b 1+EXC_OPWORD(%a6),%d1 # extract dst mode
- andi.b &0x38,%d1 # is mode == 0? (Dreg dst)
- beq.b fout_sgl_ovfl_dn # must save to integer regfile
-
- mov.l EXC_EA(%a6),%a0 # stacked <ea> is correct
- bsr.l _dmem_write_long # write long
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_l # yes
-
- bra.b fout_sgl_ovfl_chkexc
-
-fout_sgl_ovfl_dn:
- mov.b 1+EXC_OPWORD(%a6),%d1 # extract Dn
- andi.w &0x7,%d1
- bsr.l store_dreg_l
-
-fout_sgl_ovfl_chkexc:
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x0a,%d1 # is UNFL or INEX enabled?
- bne.w fout_sd_exc_ovfl # yes
- addq.l &0x4,%sp
- rts
-
-#
-# move out MAY overflow:
-# (1) force the exp to 0x3fff
-# (2) do a move w/ appropriate rnd mode
-# (3) if exp still equals zero, then insert original exponent
-# for the correct result.
-# if exp now equals one, then it overflowed so call ovf_res.
-#
-fout_sgl_may_ovfl:
- mov.w SRC_EX(%a0),%d1 # fetch current sign
- andi.w &0x8000,%d1 # keep it,clear exp
- ori.w &0x3fff,%d1 # insert exp = 0
- mov.w %d1,FP_SCR0_EX(%a6) # insert scaled exp
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6) # copy hi(man)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6) # copy lo(man)
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fmov.x FP_SCR0(%a6),%fp0 # force fop to be rounded
- fmov.l &0x0,%fpcr # clear FPCR
-
- fabs.x %fp0 # need absolute value
- fcmp.b %fp0,&0x2 # did exponent increase?
- fblt.w fout_sgl_exg # no; go finish NORM
- bra.w fout_sgl_ovfl # yes; go handle overflow
-
-################
-
-fout_sd_exc_unfl:
- mov.l (%sp)+,%a0
-
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
-
- cmpi.b STAG(%a6),&DENORM # was src a DENORM?
- bne.b fout_sd_exc_cont # no
-
- lea FP_SCR0(%a6),%a0
- bsr.l norm
- neg.l %d0
- andi.w &0x7fff,%d0
- bfins %d0,FP_SCR0_EX(%a6){&1:&15}
- bra.b fout_sd_exc_cont
-
-fout_sd_exc:
-fout_sd_exc_ovfl:
- mov.l (%sp)+,%a0 # restore a0
-
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
-
-fout_sd_exc_cont:
- bclr &0x7,FP_SCR0_EX(%a6) # clear sign bit
- sne.b 2+FP_SCR0_EX(%a6) # set internal sign bit
- lea FP_SCR0(%a6),%a0 # pass: ptr to DENORM
-
- mov.b 3+L_SCR3(%a6),%d1
- lsr.b &0x4,%d1
- andi.w &0x0c,%d1
- swap %d1
- mov.b 3+L_SCR3(%a6),%d1
- lsr.b &0x4,%d1
- andi.w &0x03,%d1
- clr.l %d0 # pass: zero g,r,s
- bsr.l _round # round the DENORM
-
- tst.b 2+FP_SCR0_EX(%a6) # is EXOP negative?
- beq.b fout_sd_exc_done # no
- bset &0x7,FP_SCR0_EX(%a6) # yes
-
-fout_sd_exc_done:
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- rts
-
-#################################################################
-# fmove.d out ###################################################
-#################################################################
-fout_dbl:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &d_mode*0x10,%d0 # insert dbl prec
- mov.l %d0,L_SCR3(%a6) # save rnd prec,mode on stack
-
-#
-# operand is a normalized number. first, we check to see if the move out
-# would cause either an underflow or overflow. these cases are handled
-# separately. otherwise, set the FPCR to the proper rounding mode and
-# execute the move.
-#
- mov.w SRC_EX(%a0),%d0 # extract exponent
- andi.w &0x7fff,%d0 # strip sign
-
- cmpi.w %d0,&DBL_HI # will operand overflow?
- bgt.w fout_dbl_ovfl # yes; go handle OVFL
- beq.w fout_dbl_may_ovfl # maybe; go handle possible OVFL
- cmpi.w %d0,&DBL_LO # will operand underflow?
- blt.w fout_dbl_unfl # yes; go handle underflow
-
-#
-# NORMs(in range) can be stored out by a simple "fmov.d"
-# Unnormalized inputs can come through this point.
-#
-fout_dbl_exg:
- fmovm.x SRC(%a0),&0x80 # fetch fop from stack
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fmov.d %fp0,L_SCR1(%a6) # store does convert and round
-
- fmov.l &0x0,%fpcr # clear FPCR
- fmov.l %fpsr,%d0 # save FPSR
-
- or.w %d0,2+USER_FPSR(%a6) # set possible inex2/ainex
-
- mov.l EXC_EA(%a6),%a1 # pass: dst addr
- lea L_SCR1(%a6),%a0 # pass: src addr
- movq.l &0x8,%d0 # pass: opsize is 8 bytes
- bsr.l _dmem_write # store dbl fop to memory
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_d # yes
-
- rts # no; so we're finished
-
-#
-# here, we know that the operand would UNFL if moved out to double prec,
-# so, denorm and round and then use generic store double routine to
-# write the value to memory.
-#
-fout_dbl_unfl:
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set UNFL
-
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- mov.l %a0,-(%sp)
-
- clr.l %d0 # pass: S.F. = 0
-
- cmpi.b STAG(%a6),&DENORM # fetch src optype tag
- bne.b fout_dbl_unfl_cont # let DENORMs fall through
-
- lea FP_SCR0(%a6),%a0
- bsr.l norm # normalize the DENORM
-
-fout_dbl_unfl_cont:
- lea FP_SCR0(%a6),%a0 # pass: ptr to operand
- mov.l L_SCR3(%a6),%d1 # pass: rnd prec,mode
- bsr.l unf_res # calc default underflow result
-
- lea FP_SCR0(%a6),%a0 # pass: ptr to fop
- bsr.l dst_dbl # convert to single prec
- mov.l %d0,L_SCR1(%a6)
- mov.l %d1,L_SCR2(%a6)
-
- mov.l EXC_EA(%a6),%a1 # pass: dst addr
- lea L_SCR1(%a6),%a0 # pass: src addr
- movq.l &0x8,%d0 # pass: opsize is 8 bytes
- bsr.l _dmem_write # store dbl fop to memory
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_d # yes
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x0a,%d1 # is UNFL or INEX enabled?
- bne.w fout_sd_exc_unfl # yes
- addq.l &0x4,%sp
- rts
-
-#
-# it's definitely an overflow so call ovf_res to get the correct answer
-#
-fout_dbl_ovfl:
- mov.w 2+SRC_LO(%a0),%d0
- andi.w &0x7ff,%d0
- bne.b fout_dbl_ovfl_inex2
-
- ori.w &ovfl_inx_mask,2+USER_FPSR(%a6) # set ovfl/aovfl/ainex
- bra.b fout_dbl_ovfl_cont
-fout_dbl_ovfl_inex2:
- ori.w &ovfinx_mask,2+USER_FPSR(%a6) # set ovfl/aovfl/ainex/inex2
-
-fout_dbl_ovfl_cont:
- mov.l %a0,-(%sp)
-
-# call ovf_res() w/ dbl prec and the correct rnd mode to create the default
-# overflow result. DON'T save the returned ccodes from ovf_res() since
-# fmove out doesn't alter them.
- tst.b SRC_EX(%a0) # is operand negative?
- smi %d1 # set if so
- mov.l L_SCR3(%a6),%d0 # pass: dbl prec,rnd mode
- bsr.l ovf_res # calc OVFL result
- fmovm.x (%a0),&0x80 # load default overflow result
- fmov.d %fp0,L_SCR1(%a6) # store to double
-
- mov.l EXC_EA(%a6),%a1 # pass: dst addr
- lea L_SCR1(%a6),%a0 # pass: src addr
- movq.l &0x8,%d0 # pass: opsize is 8 bytes
- bsr.l _dmem_write # store dbl fop to memory
-
- tst.l %d1 # did dstore fail?
- bne.l facc_out_d # yes
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x0a,%d1 # is UNFL or INEX enabled?
- bne.w fout_sd_exc_ovfl # yes
- addq.l &0x4,%sp
- rts
-
-#
-# move out MAY overflow:
-# (1) force the exp to 0x3fff
-# (2) do a move w/ appropriate rnd mode
-# (3) if exp still equals zero, then insert original exponent
-# for the correct result.
-# if exp now equals one, then it overflowed so call ovf_res.
-#
-fout_dbl_may_ovfl:
- mov.w SRC_EX(%a0),%d1 # fetch current sign
- andi.w &0x8000,%d1 # keep it,clear exp
- ori.w &0x3fff,%d1 # insert exp = 0
- mov.w %d1,FP_SCR0_EX(%a6) # insert scaled exp
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6) # copy hi(man)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6) # copy lo(man)
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fmov.x FP_SCR0(%a6),%fp0 # force fop to be rounded
- fmov.l &0x0,%fpcr # clear FPCR
-
- fabs.x %fp0 # need absolute value
- fcmp.b %fp0,&0x2 # did exponent increase?
- fblt.w fout_dbl_exg # no; go finish NORM
- bra.w fout_dbl_ovfl # yes; go handle overflow
-
-#########################################################################
-# XDEF **************************************************************** #
-# dst_dbl(): create double precision value from extended prec. #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to source operand in extended precision #
-# #
-# OUTPUT ************************************************************** #
-# d0 = hi(double precision result) #
-# d1 = lo(double precision result) #
-# #
-# ALGORITHM *********************************************************** #
-# #
-# Changes extended precision to double precision. #
-# Note: no attempt is made to round the extended value to double. #
-# dbl_sign = ext_sign #
-# dbl_exp = ext_exp - $3fff(ext bias) + $7ff(dbl bias) #
-# get rid of ext integer bit #
-# dbl_mant = ext_mant{62:12} #
-# #
-# --------------- --------------- --------------- #
-# extended -> |s| exp | |1| ms mant | | ls mant | #
-# --------------- --------------- --------------- #
-# 95 64 63 62 32 31 11 0 #
-# | | #
-# | | #
-# | | #
-# v v #
-# --------------- --------------- #
-# double -> |s|exp| mant | | mant | #
-# --------------- --------------- #
-# 63 51 32 31 0 #
-# #
-#########################################################################
-
-dst_dbl:
- clr.l %d0 # clear d0
- mov.w FTEMP_EX(%a0),%d0 # get exponent
- subi.w &EXT_BIAS,%d0 # subtract extended precision bias
- addi.w &DBL_BIAS,%d0 # add double precision bias
- tst.b FTEMP_HI(%a0) # is number a denorm?
- bmi.b dst_get_dupper # no
- subq.w &0x1,%d0 # yes; denorm bias = DBL_BIAS - 1
-dst_get_dupper:
- swap %d0 # d0 now in upper word
- lsl.l &0x4,%d0 # d0 in proper place for dbl prec exp
- tst.b FTEMP_EX(%a0) # test sign
- bpl.b dst_get_dman # if positive, go process mantissa
- bset &0x1f,%d0 # if negative, set sign
-dst_get_dman:
- mov.l FTEMP_HI(%a0),%d1 # get ms mantissa
- bfextu %d1{&1:&20},%d1 # get upper 20 bits of ms
- or.l %d1,%d0 # put these bits in ms word of double
- mov.l %d0,L_SCR1(%a6) # put the new exp back on the stack
- mov.l FTEMP_HI(%a0),%d1 # get ms mantissa
- mov.l &21,%d0 # load shift count
- lsl.l %d0,%d1 # put lower 11 bits in upper bits
- mov.l %d1,L_SCR2(%a6) # build lower lword in memory
- mov.l FTEMP_LO(%a0),%d1 # get ls mantissa
- bfextu %d1{&0:&21},%d0 # get ls 21 bits of double
- mov.l L_SCR2(%a6),%d1
- or.l %d0,%d1 # put them in double result
- mov.l L_SCR1(%a6),%d0
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# dst_sgl(): create single precision value from extended prec #
-# #
-# XREF **************************************************************** #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to source operand in extended precision #
-# #
-# OUTPUT ************************************************************** #
-# d0 = single precision result #
-# #
-# ALGORITHM *********************************************************** #
-# #
-# Changes extended precision to single precision. #
-# sgl_sign = ext_sign #
-# sgl_exp = ext_exp - $3fff(ext bias) + $7f(sgl bias) #
-# get rid of ext integer bit #
-# sgl_mant = ext_mant{62:12} #
-# #
-# --------------- --------------- --------------- #
-# extended -> |s| exp | |1| ms mant | | ls mant | #
-# --------------- --------------- --------------- #
-# 95 64 63 62 40 32 31 12 0 #
-# | | #
-# | | #
-# | | #
-# v v #
-# --------------- #
-# single -> |s|exp| mant | #
-# --------------- #
-# 31 22 0 #
-# #
-#########################################################################
-
-dst_sgl:
- clr.l %d0
- mov.w FTEMP_EX(%a0),%d0 # get exponent
- subi.w &EXT_BIAS,%d0 # subtract extended precision bias
- addi.w &SGL_BIAS,%d0 # add single precision bias
- tst.b FTEMP_HI(%a0) # is number a denorm?
- bmi.b dst_get_supper # no
- subq.w &0x1,%d0 # yes; denorm bias = SGL_BIAS - 1
-dst_get_supper:
- swap %d0 # put exp in upper word of d0
- lsl.l &0x7,%d0 # shift it into single exp bits
- tst.b FTEMP_EX(%a0) # test sign
- bpl.b dst_get_sman # if positive, continue
- bset &0x1f,%d0 # if negative, put in sign first
-dst_get_sman:
- mov.l FTEMP_HI(%a0),%d1 # get ms mantissa
- andi.l &0x7fffff00,%d1 # get upper 23 bits of ms
- lsr.l &0x8,%d1 # and put them flush right
- or.l %d1,%d0 # put these bits in ms word of single
- rts
-
-##############################################################################
-fout_pack:
- bsr.l _calc_ea_fout # fetch the <ea>
- mov.l %a0,-(%sp)
-
- mov.b STAG(%a6),%d0 # fetch input type
- bne.w fout_pack_not_norm # input is not NORM
-
-fout_pack_norm:
- btst &0x4,EXC_CMDREG(%a6) # static or dynamic?
- beq.b fout_pack_s # static
-
-fout_pack_d:
- mov.b 1+EXC_CMDREG(%a6),%d1 # fetch dynamic reg
- lsr.b &0x4,%d1
- andi.w &0x7,%d1
-
- bsr.l fetch_dreg # fetch Dn w/ k-factor
-
- bra.b fout_pack_type
-fout_pack_s:
- mov.b 1+EXC_CMDREG(%a6),%d0 # fetch static field
-
-fout_pack_type:
- bfexts %d0{&25:&7},%d0 # extract k-factor
- mov.l %d0,-(%sp)
-
- lea FP_SRC(%a6),%a0 # pass: ptr to input
-
-# bindec is currently scrambling FP_SRC for denorm inputs.
-# we'll have to change this, but for now, tough luck!!!
- bsr.l bindec # convert xprec to packed
-
-# andi.l &0xcfff000f,FP_SCR0(%a6) # clear unused fields
- andi.l &0xcffff00f,FP_SCR0(%a6) # clear unused fields
-
- mov.l (%sp)+,%d0
-
- tst.b 3+FP_SCR0_EX(%a6)
- bne.b fout_pack_set
- tst.l FP_SCR0_HI(%a6)
- bne.b fout_pack_set
- tst.l FP_SCR0_LO(%a6)
- bne.b fout_pack_set
-
-# add the extra condition that only if the k-factor was zero, too, should
-# we zero the exponent
- tst.l %d0
- bne.b fout_pack_set
-# "mantissa" is all zero which means that the answer is zero. but, the '040
-# algorithm allows the exponent to be non-zero. the 881/2 do not. therefore,
-# if the mantissa is zero, I will zero the exponent, too.
-# the question now is whether the exponents sign bit is allowed to be non-zero
-# for a zero, also...
- andi.w &0xf000,FP_SCR0(%a6)
-
-fout_pack_set:
-
- lea FP_SCR0(%a6),%a0 # pass: src addr
-
-fout_pack_write:
- mov.l (%sp)+,%a1 # pass: dst addr
- mov.l &0xc,%d0 # pass: opsize is 12 bytes
-
- cmpi.b SPCOND_FLG(%a6),&mda7_flg
- beq.b fout_pack_a7
-
- bsr.l _dmem_write # write ext prec number to memory
-
- tst.l %d1 # did dstore fail?
- bne.w fout_ext_err # yes
-
- rts
-
-# we don't want to do the write if the exception occurred in supervisor mode
-# so _mem_write2() handles this for us.
-fout_pack_a7:
- bsr.l _mem_write2 # write ext prec number to memory
-
- tst.l %d1 # did dstore fail?
- bne.w fout_ext_err # yes
-
- rts
-
-fout_pack_not_norm:
- cmpi.b %d0,&DENORM # is it a DENORM?
- beq.w fout_pack_norm # yes
- lea FP_SRC(%a6),%a0
- clr.w 2+FP_SRC_EX(%a6)
- cmpi.b %d0,&SNAN # is it an SNAN?
- beq.b fout_pack_snan # yes
- bra.b fout_pack_write # no
-
-fout_pack_snan:
- ori.w &snaniop2_mask,FPSR_EXCEPT(%a6) # set SNAN/AIOP
- bset &0x6,FP_SRC_HI(%a6) # set snan bit
- bra.b fout_pack_write
-
-#########################################################################
-# XDEF **************************************************************** #
-# fmul(): emulates the fmul instruction #
-# fsmul(): emulates the fsmul instruction #
-# fdmul(): emulates the fdmul instruction #
-# #
-# XREF **************************************************************** #
-# scale_to_zero_src() - scale src exponent to zero #
-# scale_to_zero_dst() - scale dst exponent to zero #
-# unf_res() - return default underflow result #
-# ovf_res() - return default overflow result #
-# res_qnan() - return QNAN result #
-# res_snan() - return SNAN result #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# a1 = pointer to extended precision destination operand #
-# d0 rnd prec,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = result #
-# fp1 = EXOP (if exception occurred) #
-# #
-# ALGORITHM *********************************************************** #
-# Handle NANs, infinities, and zeroes as special cases. Divide #
-# norms/denorms into ext/sgl/dbl precision. #
-# For norms/denorms, scale the exponents such that a multiply #
-# instruction won't cause an exception. Use the regular fmul to #
-# compute a result. Check if the regular operands would have taken #
-# an exception. If so, return the default overflow/underflow result #
-# and return the EXOP if exceptions are enabled. Else, scale the #
-# result operand to the proper exponent. #
-# #
-#########################################################################
-
- align 0x10
-tbl_fmul_ovfl:
- long 0x3fff - 0x7ffe # ext_max
- long 0x3fff - 0x407e # sgl_max
- long 0x3fff - 0x43fe # dbl_max
-tbl_fmul_unfl:
- long 0x3fff + 0x0001 # ext_unfl
- long 0x3fff - 0x3f80 # sgl_unfl
- long 0x3fff - 0x3c00 # dbl_unfl
-
- global fsmul
-fsmul:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &s_mode*0x10,%d0 # insert sgl prec
- bra.b fmul
-
- global fdmul
-fdmul:
- andi.b &0x30,%d0
- ori.b &d_mode*0x10,%d0 # insert dbl prec
-
- global fmul
-fmul:
- mov.l %d0,L_SCR3(%a6) # store rnd info
-
- clr.w %d1
- mov.b DTAG(%a6),%d1
- lsl.b &0x3,%d1
- or.b STAG(%a6),%d1 # combine src tags
- bne.w fmul_not_norm # optimize on non-norm input
-
-fmul_norm:
- mov.w DST_EX(%a1),FP_SCR1_EX(%a6)
- mov.l DST_HI(%a1),FP_SCR1_HI(%a6)
- mov.l DST_LO(%a1),FP_SCR1_LO(%a6)
-
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
-
- bsr.l scale_to_zero_src # scale src exponent
- mov.l %d0,-(%sp) # save scale factor 1
-
- bsr.l scale_to_zero_dst # scale dst exponent
-
- add.l %d0,(%sp) # SCALE_FACTOR = scale1 + scale2
-
- mov.w 2+L_SCR3(%a6),%d1 # fetch precision
- lsr.b &0x6,%d1 # shift to lo bits
- mov.l (%sp)+,%d0 # load S.F.
- cmp.l %d0,(tbl_fmul_ovfl.w,%pc,%d1.w*4) # would result ovfl?
- beq.w fmul_may_ovfl # result may rnd to overflow
- blt.w fmul_ovfl # result will overflow
-
- cmp.l %d0,(tbl_fmul_unfl.w,%pc,%d1.w*4) # would result unfl?
- beq.w fmul_may_unfl # result may rnd to no unfl
- bgt.w fmul_unfl # result will underflow
-
-#
-# NORMAL:
-# - the result of the multiply operation will neither overflow nor underflow.
-# - do the multiply to the proper precision and rounding mode.
-# - scale the result exponent using the scale factor. if both operands were
-# normalized then we really don't need to go through this scaling. but for now,
-# this will do.
-#
-fmul_normal:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst operand
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fmul.x FP_SCR0(%a6),%fp0 # execute multiply
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-fmul_normal_exit:
- fmovm.x &0x80,FP_SCR0(%a6) # store out result
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # load {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- or.w %d2,%d1 # concat old sign,new exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x80 # return default result in fp0
- rts
-
-#
-# OVERFLOW:
-# - the result of the multiply operation is an overflow.
-# - do the multiply to the proper precision and rounding mode in order to
-# set the inexact bits.
-# - calculate the default result and return it in fp0.
-# - if overflow or inexact is enabled, we need a multiply result rounded to
-# extended precision. if the original operation was extended, then we have this
-# result. if the original operation was single or double, we have to do another
-# multiply using extended precision and the correct rounding mode. the result
-# of this operation then has its exponent scaled by -0x6000 to create the
-# exceptional operand.
-#
-fmul_ovfl:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst operand
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fmul.x FP_SCR0(%a6),%fp0 # execute multiply
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-# save setting this until now because this is where fmul_may_ovfl may jump in
-fmul_ovfl_tst:
- or.l &ovfl_inx_mask,USER_FPSR(%a6) # set ovfl/aovfl/ainex
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x13,%d1 # is OVFL or INEX enabled?
- bne.b fmul_ovfl_ena # yes
-
-# calculate the default result
-fmul_ovfl_dis:
- btst &neg_bit,FPSR_CC(%a6) # is result negative?
- sne %d1 # set sign param accordingly
- mov.l L_SCR3(%a6),%d0 # pass rnd prec,mode
- bsr.l ovf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # set INF,N if applicable
- fmovm.x (%a0),&0x80 # return default result in fp0
- rts
-
-#
-# OVFL is enabled; Create EXOP:
-# - if precision is extended, then we have the EXOP. simply bias the exponent
-# with an extra -0x6000. if the precision is single or double, we need to
-# calculate a result rounded to extended precision.
-#
-fmul_ovfl_ena:
- mov.l L_SCR3(%a6),%d1
- andi.b &0xc0,%d1 # test the rnd prec
- bne.b fmul_ovfl_ena_sd # it's sgl or dbl
-
-fmul_ovfl_ena_cont:
- fmovm.x &0x80,FP_SCR0(%a6) # move result to stack
-
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # fetch {sgn,exp}
- mov.w %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- sub.l %d0,%d1 # add scale factor
- subi.l &0x6000,%d1 # subtract bias
- andi.w &0x7fff,%d1 # clear sign bit
- andi.w &0x8000,%d2 # keep old sign
- or.w %d2,%d1 # concat old sign,new exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- bra.b fmul_ovfl_dis
-
-fmul_ovfl_ena_sd:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst operand
-
- mov.l L_SCR3(%a6),%d1
- andi.b &0x30,%d1 # keep rnd mode only
- fmov.l %d1,%fpcr # set FPCR
-
- fmul.x FP_SCR0(%a6),%fp0 # execute multiply
-
- fmov.l &0x0,%fpcr # clear FPCR
- bra.b fmul_ovfl_ena_cont
-
-#
-# may OVERFLOW:
-# - the result of the multiply operation MAY overflow.
-# - do the multiply to the proper precision and rounding mode in order to
-# set the inexact bits.
-# - calculate the default result and return it in fp0.
-#
-fmul_may_ovfl:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fmul.x FP_SCR0(%a6),%fp0 # execute multiply
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
- fabs.x %fp0,%fp1 # make a copy of result
- fcmp.b %fp1,&0x2 # is |result| >= 2.b?
- fbge.w fmul_ovfl_tst # yes; overflow has occurred
-
-# no, it didn't overflow; we have correct result
- bra.w fmul_normal_exit
-
-#
-# UNDERFLOW:
-# - the result of the multiply operation is an underflow.
-# - do the multiply to the proper precision and rounding mode in order to
-# set the inexact bits.
-# - calculate the default result and return it in fp0.
-# - if overflow or inexact is enabled, we need a multiply result rounded to
-# extended precision. if the original operation was extended, then we have this
-# result. if the original operation was single or double, we have to do another
-# multiply using extended precision and the correct rounding mode. the result
-# of this operation then has its exponent scaled by -0x6000 to create the
-# exceptional operand.
-#
-fmul_unfl:
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
-
-# for fun, let's use only extended precision, round to zero. then, let
-# the unf_res() routine figure out all the rest.
-# will we get the correct answer.
- fmovm.x FP_SCR1(%a6),&0x80 # load dst operand
-
- fmov.l &rz_mode*0x10,%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fmul.x FP_SCR0(%a6),%fp0 # execute multiply
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x0b,%d1 # is UNFL or INEX enabled?
- bne.b fmul_unfl_ena # yes
-
-fmul_unfl_dis:
- fmovm.x &0x80,FP_SCR0(%a6) # store out result
-
- lea FP_SCR0(%a6),%a0 # pass: result addr
- mov.l L_SCR3(%a6),%d1 # pass: rnd prec,mode
- bsr.l unf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # unf_res2 may have set 'Z'
- fmovm.x FP_SCR0(%a6),&0x80 # return default result in fp0
- rts
-
-#
-# UNFL is enabled.
-#
-fmul_unfl_ena:
- fmovm.x FP_SCR1(%a6),&0x40 # load dst op
-
- mov.l L_SCR3(%a6),%d1
- andi.b &0xc0,%d1 # is precision extended?
- bne.b fmul_unfl_ena_sd # no, sgl or dbl
-
-# if the rnd mode is anything but RZ, then we have to re-do the above
-# multiplication because we used RZ for all.
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
-fmul_unfl_ena_cont:
- fmov.l &0x0,%fpsr # clear FPSR
-
- fmul.x FP_SCR0(%a6),%fp1 # execute multiply
-
- fmov.l &0x0,%fpcr # clear FPCR
-
- fmovm.x &0x40,FP_SCR0(%a6) # save result to stack
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # fetch {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- addi.l &0x6000,%d1 # add bias
- andi.w &0x7fff,%d1
- or.w %d2,%d1 # concat old sign,new exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- bra.w fmul_unfl_dis
-
-fmul_unfl_ena_sd:
- mov.l L_SCR3(%a6),%d1
- andi.b &0x30,%d1 # use only rnd mode
- fmov.l %d1,%fpcr # set FPCR
-
- bra.b fmul_unfl_ena_cont
-
-# MAY UNDERFLOW:
-# -use the correct rounding mode and precision. this code favors operations
-# that do not underflow.
-fmul_may_unfl:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst operand
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fmul.x FP_SCR0(%a6),%fp0 # execute multiply
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
- fabs.x %fp0,%fp1 # make a copy of result
- fcmp.b %fp1,&0x2 # is |result| > 2.b?
- fbgt.w fmul_normal_exit # no; no underflow occurred
- fblt.w fmul_unfl # yes; underflow occurred
-
-#
-# we still don't know if underflow occurred. result is ~ equal to 2. but,
-# we don't know if the result was an underflow that rounded up to a 2 or
-# a normalized number that rounded down to a 2. so, redo the entire operation
-# using RZ as the rounding mode to see what the pre-rounded result is.
-# this case should be relatively rare.
-#
- fmovm.x FP_SCR1(%a6),&0x40 # load dst operand
-
- mov.l L_SCR3(%a6),%d1
- andi.b &0xc0,%d1 # keep rnd prec
- ori.b &rz_mode*0x10,%d1 # insert RZ
-
- fmov.l %d1,%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fmul.x FP_SCR0(%a6),%fp1 # execute multiply
-
- fmov.l &0x0,%fpcr # clear FPCR
- fabs.x %fp1 # make absolute value
- fcmp.b %fp1,&0x2 # is |result| < 2.b?
- fbge.w fmul_normal_exit # no; no underflow occurred
- bra.w fmul_unfl # yes, underflow occurred
-
-################################################################################
-
-#
-# Multiply: inputs are not both normalized; what are they?
-#
-fmul_not_norm:
- mov.w (tbl_fmul_op.b,%pc,%d1.w*2),%d1
- jmp (tbl_fmul_op.b,%pc,%d1.w)
-
- swbeg &48
-tbl_fmul_op:
- short fmul_norm - tbl_fmul_op # NORM x NORM
- short fmul_zero - tbl_fmul_op # NORM x ZERO
- short fmul_inf_src - tbl_fmul_op # NORM x INF
- short fmul_res_qnan - tbl_fmul_op # NORM x QNAN
- short fmul_norm - tbl_fmul_op # NORM x DENORM
- short fmul_res_snan - tbl_fmul_op # NORM x SNAN
- short tbl_fmul_op - tbl_fmul_op #
- short tbl_fmul_op - tbl_fmul_op #
-
- short fmul_zero - tbl_fmul_op # ZERO x NORM
- short fmul_zero - tbl_fmul_op # ZERO x ZERO
- short fmul_res_operr - tbl_fmul_op # ZERO x INF
- short fmul_res_qnan - tbl_fmul_op # ZERO x QNAN
- short fmul_zero - tbl_fmul_op # ZERO x DENORM
- short fmul_res_snan - tbl_fmul_op # ZERO x SNAN
- short tbl_fmul_op - tbl_fmul_op #
- short tbl_fmul_op - tbl_fmul_op #
-
- short fmul_inf_dst - tbl_fmul_op # INF x NORM
- short fmul_res_operr - tbl_fmul_op # INF x ZERO
- short fmul_inf_dst - tbl_fmul_op # INF x INF
- short fmul_res_qnan - tbl_fmul_op # INF x QNAN
- short fmul_inf_dst - tbl_fmul_op # INF x DENORM
- short fmul_res_snan - tbl_fmul_op # INF x SNAN
- short tbl_fmul_op - tbl_fmul_op #
- short tbl_fmul_op - tbl_fmul_op #
-
- short fmul_res_qnan - tbl_fmul_op # QNAN x NORM
- short fmul_res_qnan - tbl_fmul_op # QNAN x ZERO
- short fmul_res_qnan - tbl_fmul_op # QNAN x INF
- short fmul_res_qnan - tbl_fmul_op # QNAN x QNAN
- short fmul_res_qnan - tbl_fmul_op # QNAN x DENORM
- short fmul_res_snan - tbl_fmul_op # QNAN x SNAN
- short tbl_fmul_op - tbl_fmul_op #
- short tbl_fmul_op - tbl_fmul_op #
-
- short fmul_norm - tbl_fmul_op # NORM x NORM
- short fmul_zero - tbl_fmul_op # NORM x ZERO
- short fmul_inf_src - tbl_fmul_op # NORM x INF
- short fmul_res_qnan - tbl_fmul_op # NORM x QNAN
- short fmul_norm - tbl_fmul_op # NORM x DENORM
- short fmul_res_snan - tbl_fmul_op # NORM x SNAN
- short tbl_fmul_op - tbl_fmul_op #
- short tbl_fmul_op - tbl_fmul_op #
-
- short fmul_res_snan - tbl_fmul_op # SNAN x NORM
- short fmul_res_snan - tbl_fmul_op # SNAN x ZERO
- short fmul_res_snan - tbl_fmul_op # SNAN x INF
- short fmul_res_snan - tbl_fmul_op # SNAN x QNAN
- short fmul_res_snan - tbl_fmul_op # SNAN x DENORM
- short fmul_res_snan - tbl_fmul_op # SNAN x SNAN
- short tbl_fmul_op - tbl_fmul_op #
- short tbl_fmul_op - tbl_fmul_op #
-
-fmul_res_operr:
- bra.l res_operr
-fmul_res_snan:
- bra.l res_snan
-fmul_res_qnan:
- bra.l res_qnan
-
-#
-# Multiply: (Zero x Zero) || (Zero x norm) || (Zero x denorm)
-#
- global fmul_zero # global for fsglmul
-fmul_zero:
- mov.b SRC_EX(%a0),%d0 # exclusive or the signs
- mov.b DST_EX(%a1),%d1
- eor.b %d0,%d1
- bpl.b fmul_zero_p # result ZERO is pos.
-fmul_zero_n:
- fmov.s &0x80000000,%fp0 # load -ZERO
- mov.b &z_bmask+neg_bmask,FPSR_CC(%a6) # set Z/N
- rts
-fmul_zero_p:
- fmov.s &0x00000000,%fp0 # load +ZERO
- mov.b &z_bmask,FPSR_CC(%a6) # set Z
- rts
-
-#
-# Multiply: (inf x inf) || (inf x norm) || (inf x denorm)
-#
-# Note: The j-bit for an infinity is a don't-care. However, to be
-# strictly compatible w/ the 68881/882, we make sure to return an
-# INF w/ the j-bit set if the input INF j-bit was set. Destination
-# INFs take priority.
-#
- global fmul_inf_dst # global for fsglmul
-fmul_inf_dst:
- fmovm.x DST(%a1),&0x80 # return INF result in fp0
- mov.b SRC_EX(%a0),%d0 # exclusive or the signs
- mov.b DST_EX(%a1),%d1
- eor.b %d0,%d1
- bpl.b fmul_inf_dst_p # result INF is pos.
-fmul_inf_dst_n:
- fabs.x %fp0 # clear result sign
- fneg.x %fp0 # set result sign
- mov.b &inf_bmask+neg_bmask,FPSR_CC(%a6) # set INF/N
- rts
-fmul_inf_dst_p:
- fabs.x %fp0 # clear result sign
- mov.b &inf_bmask,FPSR_CC(%a6) # set INF
- rts
-
- global fmul_inf_src # global for fsglmul
-fmul_inf_src:
- fmovm.x SRC(%a0),&0x80 # return INF result in fp0
- mov.b SRC_EX(%a0),%d0 # exclusive or the signs
- mov.b DST_EX(%a1),%d1
- eor.b %d0,%d1
- bpl.b fmul_inf_dst_p # result INF is pos.
- bra.b fmul_inf_dst_n
-
-#########################################################################
-# XDEF **************************************************************** #
-# fin(): emulates the fmove instruction #
-# fsin(): emulates the fsmove instruction #
-# fdin(): emulates the fdmove instruction #
-# #
-# XREF **************************************************************** #
-# norm() - normalize mantissa for EXOP on denorm #
-# scale_to_zero_src() - scale src exponent to zero #
-# ovf_res() - return default overflow result #
-# unf_res() - return default underflow result #
-# res_qnan_1op() - return QNAN result #
-# res_snan_1op() - return SNAN result #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# d0 = round prec/mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = result #
-# fp1 = EXOP (if exception occurred) #
-# #
-# ALGORITHM *********************************************************** #
-# Handle NANs, infinities, and zeroes as special cases. Divide #
-# norms into extended, single, and double precision. #
-# Norms can be emulated w/ a regular fmove instruction. For #
-# sgl/dbl, must scale exponent and perform an "fmove". Check to see #
-# if the result would have overflowed/underflowed. If so, use unf_res() #
-# or ovf_res() to return the default result. Also return EXOP if #
-# exception is enabled. If no exception, return the default result. #
-# Unnorms don't pass through here. #
-# #
-#########################################################################
-
- global fsin
-fsin:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &s_mode*0x10,%d0 # insert sgl precision
- bra.b fin
-
- global fdin
-fdin:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &d_mode*0x10,%d0 # insert dbl precision
-
- global fin
-fin:
- mov.l %d0,L_SCR3(%a6) # store rnd info
-
- mov.b STAG(%a6),%d1 # fetch src optype tag
- bne.w fin_not_norm # optimize on non-norm input
-
-#
-# FP MOVE IN: NORMs and DENORMs ONLY!
-#
-fin_norm:
- andi.b &0xc0,%d0 # is precision extended?
- bne.w fin_not_ext # no, so go handle dbl or sgl
-
-#
-# precision selected is extended. so...we cannot get an underflow
-# or overflow because of rounding to the correct precision. so...
-# skip the scaling and unscaling...
-#
- tst.b SRC_EX(%a0) # is the operand negative?
- bpl.b fin_norm_done # no
- bset &neg_bit,FPSR_CC(%a6) # yes, so set 'N' ccode bit
-fin_norm_done:
- fmovm.x SRC(%a0),&0x80 # return result in fp0
- rts
-
-#
-# for an extended precision DENORM, the UNFL exception bit is set
-# the accrued bit is NOT set in this instance(no inexactness!)
-#
-fin_denorm:
- andi.b &0xc0,%d0 # is precision extended?
- bne.w fin_not_ext # no, so go handle dbl or sgl
-
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
- tst.b SRC_EX(%a0) # is the operand negative?
- bpl.b fin_denorm_done # no
- bset &neg_bit,FPSR_CC(%a6) # yes, so set 'N' ccode bit
-fin_denorm_done:
- fmovm.x SRC(%a0),&0x80 # return result in fp0
- btst &unfl_bit,FPCR_ENABLE(%a6) # is UNFL enabled?
- bne.b fin_denorm_unfl_ena # yes
- rts
-
-#
-# the input is an extended DENORM and underflow is enabled in the FPCR.
-# normalize the mantissa and add the bias of 0x6000 to the resulting negative
-# exponent and insert back into the operand.
-#
-fin_denorm_unfl_ena:
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- lea FP_SCR0(%a6),%a0 # pass: ptr to operand
- bsr.l norm # normalize result
- neg.w %d0 # new exponent = -(shft val)
- addi.w &0x6000,%d0 # add new bias to exponent
- mov.w FP_SCR0_EX(%a6),%d1 # fetch old sign,exp
- andi.w &0x8000,%d1 # keep old sign
- andi.w &0x7fff,%d0 # clear sign position
- or.w %d1,%d0 # concat new exo,old sign
- mov.w %d0,FP_SCR0_EX(%a6) # insert new exponent
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- rts
-
-#
-# operand is to be rounded to single or double precision
-#
-fin_not_ext:
- cmpi.b %d0,&s_mode*0x10 # separate sgl/dbl prec
- bne.b fin_dbl
-
-#
-# operand is to be rounded to single precision
-#
-fin_sgl:
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- bsr.l scale_to_zero_src # calculate scale factor
-
- cmpi.l %d0,&0x3fff-0x3f80 # will move in underflow?
- bge.w fin_sd_unfl # yes; go handle underflow
- cmpi.l %d0,&0x3fff-0x407e # will move in overflow?
- beq.w fin_sd_may_ovfl # maybe; go check
- blt.w fin_sd_ovfl # yes; go handle overflow
-
-#
-# operand will NOT overflow or underflow when moved into the fp reg file
-#
-fin_sd_normal:
- fmov.l &0x0,%fpsr # clear FPSR
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fmov.x FP_SCR0(%a6),%fp0 # perform move
-
- fmov.l %fpsr,%d1 # save FPSR
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-fin_sd_normal_exit:
- mov.l %d2,-(%sp) # save d2
- fmovm.x &0x80,FP_SCR0(%a6) # store out result
- mov.w FP_SCR0_EX(%a6),%d1 # load {sgn,exp}
- mov.w %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- sub.l %d0,%d1 # add scale factor
- andi.w &0x8000,%d2 # keep old sign
- or.w %d1,%d2 # concat old sign,new exponent
- mov.w %d2,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x80 # return result in fp0
- rts
-
-#
-# operand is to be rounded to double precision
-#
-fin_dbl:
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- bsr.l scale_to_zero_src # calculate scale factor
-
- cmpi.l %d0,&0x3fff-0x3c00 # will move in underflow?
- bge.w fin_sd_unfl # yes; go handle underflow
- cmpi.l %d0,&0x3fff-0x43fe # will move in overflow?
- beq.w fin_sd_may_ovfl # maybe; go check
- blt.w fin_sd_ovfl # yes; go handle overflow
- bra.w fin_sd_normal # no; ho handle normalized op
-
-#
-# operand WILL underflow when moved in to the fp register file
-#
-fin_sd_unfl:
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
-
- tst.b FP_SCR0_EX(%a6) # is operand negative?
- bpl.b fin_sd_unfl_tst
- bset &neg_bit,FPSR_CC(%a6) # set 'N' ccode bit
-
-# if underflow or inexact is enabled, then go calculate the EXOP first.
-fin_sd_unfl_tst:
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x0b,%d1 # is UNFL or INEX enabled?
- bne.b fin_sd_unfl_ena # yes
-
-fin_sd_unfl_dis:
- lea FP_SCR0(%a6),%a0 # pass: result addr
- mov.l L_SCR3(%a6),%d1 # pass: rnd prec,mode
- bsr.l unf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # unf_res may have set 'Z'
- fmovm.x FP_SCR0(%a6),&0x80 # return default result in fp0
- rts
-
-#
-# operand will underflow AND underflow or inexact is enabled.
-# therefore, we must return the result rounded to extended precision.
-#
-fin_sd_unfl_ena:
- mov.l FP_SCR0_HI(%a6),FP_SCR1_HI(%a6)
- mov.l FP_SCR0_LO(%a6),FP_SCR1_LO(%a6)
- mov.w FP_SCR0_EX(%a6),%d1 # load current exponent
-
- mov.l %d2,-(%sp) # save d2
- mov.w %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- sub.l %d0,%d1 # subtract scale factor
- andi.w &0x8000,%d2 # extract old sign
- addi.l &0x6000,%d1 # add new bias
- andi.w &0x7fff,%d1
- or.w %d1,%d2 # concat old sign,new exp
- mov.w %d2,FP_SCR1_EX(%a6) # insert new exponent
- fmovm.x FP_SCR1(%a6),&0x40 # return EXOP in fp1
- mov.l (%sp)+,%d2 # restore d2
- bra.b fin_sd_unfl_dis
-
-#
-# operand WILL overflow.
-#
-fin_sd_ovfl:
- fmov.l &0x0,%fpsr # clear FPSR
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fmov.x FP_SCR0(%a6),%fp0 # perform move
-
- fmov.l &0x0,%fpcr # clear FPCR
- fmov.l %fpsr,%d1 # save FPSR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-fin_sd_ovfl_tst:
- or.l &ovfl_inx_mask,USER_FPSR(%a6) # set ovfl/aovfl/ainex
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x13,%d1 # is OVFL or INEX enabled?
- bne.b fin_sd_ovfl_ena # yes
-
-#
-# OVFL is not enabled; therefore, we must create the default result by
-# calling ovf_res().
-#
-fin_sd_ovfl_dis:
- btst &neg_bit,FPSR_CC(%a6) # is result negative?
- sne %d1 # set sign param accordingly
- mov.l L_SCR3(%a6),%d0 # pass: prec,mode
- bsr.l ovf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # set INF,N if applicable
- fmovm.x (%a0),&0x80 # return default result in fp0
- rts
-
-#
-# OVFL is enabled.
-# the INEX2 bit has already been updated by the round to the correct precision.
-# now, round to extended(and don't alter the FPSR).
-#
-fin_sd_ovfl_ena:
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # fetch {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- sub.l &0x6000,%d1 # subtract bias
- andi.w &0x7fff,%d1
- or.w %d2,%d1
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- bra.b fin_sd_ovfl_dis
-
-#
-# the move in MAY overflow. so...
-#
-fin_sd_may_ovfl:
- fmov.l &0x0,%fpsr # clear FPSR
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fmov.x FP_SCR0(%a6),%fp0 # perform the move
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
- fabs.x %fp0,%fp1 # make a copy of result
- fcmp.b %fp1,&0x2 # is |result| >= 2.b?
- fbge.w fin_sd_ovfl_tst # yes; overflow has occurred
-
-# no, it didn't overflow; we have correct result
- bra.w fin_sd_normal_exit
-
-##########################################################################
-
-#
-# operand is not a NORM: check its optype and branch accordingly
-#
-fin_not_norm:
- cmpi.b %d1,&DENORM # weed out DENORM
- beq.w fin_denorm
- cmpi.b %d1,&SNAN # weed out SNANs
- beq.l res_snan_1op
- cmpi.b %d1,&QNAN # weed out QNANs
- beq.l res_qnan_1op
-
-#
-# do the fmove in; at this point, only possible ops are ZERO and INF.
-# use fmov to determine ccodes.
-# prec:mode should be zero at this point but it won't affect answer anyways.
-#
- fmov.x SRC(%a0),%fp0 # do fmove in
- fmov.l %fpsr,%d0 # no exceptions possible
- rol.l &0x8,%d0 # put ccodes in lo byte
- mov.b %d0,FPSR_CC(%a6) # insert correct ccodes
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# fdiv(): emulates the fdiv instruction #
-# fsdiv(): emulates the fsdiv instruction #
-# fddiv(): emulates the fddiv instruction #
-# #
-# XREF **************************************************************** #
-# scale_to_zero_src() - scale src exponent to zero #
-# scale_to_zero_dst() - scale dst exponent to zero #
-# unf_res() - return default underflow result #
-# ovf_res() - return default overflow result #
-# res_qnan() - return QNAN result #
-# res_snan() - return SNAN result #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# a1 = pointer to extended precision destination operand #
-# d0 rnd prec,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = result #
-# fp1 = EXOP (if exception occurred) #
-# #
-# ALGORITHM *********************************************************** #
-# Handle NANs, infinities, and zeroes as special cases. Divide #
-# norms/denorms into ext/sgl/dbl precision. #
-# For norms/denorms, scale the exponents such that a divide #
-# instruction won't cause an exception. Use the regular fdiv to #
-# compute a result. Check if the regular operands would have taken #
-# an exception. If so, return the default overflow/underflow result #
-# and return the EXOP if exceptions are enabled. Else, scale the #
-# result operand to the proper exponent. #
-# #
-#########################################################################
-
- align 0x10
-tbl_fdiv_unfl:
- long 0x3fff - 0x0000 # ext_unfl
- long 0x3fff - 0x3f81 # sgl_unfl
- long 0x3fff - 0x3c01 # dbl_unfl
-
-tbl_fdiv_ovfl:
- long 0x3fff - 0x7ffe # ext overflow exponent
- long 0x3fff - 0x407e # sgl overflow exponent
- long 0x3fff - 0x43fe # dbl overflow exponent
-
- global fsdiv
-fsdiv:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &s_mode*0x10,%d0 # insert sgl prec
- bra.b fdiv
-
- global fddiv
-fddiv:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &d_mode*0x10,%d0 # insert dbl prec
-
- global fdiv
-fdiv:
- mov.l %d0,L_SCR3(%a6) # store rnd info
-
- clr.w %d1
- mov.b DTAG(%a6),%d1
- lsl.b &0x3,%d1
- or.b STAG(%a6),%d1 # combine src tags
-
- bne.w fdiv_not_norm # optimize on non-norm input
-
-#
-# DIVIDE: NORMs and DENORMs ONLY!
-#
-fdiv_norm:
- mov.w DST_EX(%a1),FP_SCR1_EX(%a6)
- mov.l DST_HI(%a1),FP_SCR1_HI(%a6)
- mov.l DST_LO(%a1),FP_SCR1_LO(%a6)
-
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
-
- bsr.l scale_to_zero_src # scale src exponent
- mov.l %d0,-(%sp) # save scale factor 1
-
- bsr.l scale_to_zero_dst # scale dst exponent
-
- neg.l (%sp) # SCALE FACTOR = scale1 - scale2
- add.l %d0,(%sp)
-
- mov.w 2+L_SCR3(%a6),%d1 # fetch precision
- lsr.b &0x6,%d1 # shift to lo bits
- mov.l (%sp)+,%d0 # load S.F.
- cmp.l %d0,(tbl_fdiv_ovfl.b,%pc,%d1.w*4) # will result overflow?
- ble.w fdiv_may_ovfl # result will overflow
-
- cmp.l %d0,(tbl_fdiv_unfl.w,%pc,%d1.w*4) # will result underflow?
- beq.w fdiv_may_unfl # maybe
- bgt.w fdiv_unfl # yes; go handle underflow
-
-fdiv_normal:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l L_SCR3(%a6),%fpcr # save FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fdiv.x FP_SCR0(%a6),%fp0 # perform divide
-
- fmov.l %fpsr,%d1 # save FPSR
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-fdiv_normal_exit:
- fmovm.x &0x80,FP_SCR0(%a6) # store result on stack
- mov.l %d2,-(%sp) # store d2
- mov.w FP_SCR0_EX(%a6),%d1 # load {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- or.w %d2,%d1 # concat old sign,new exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x80 # return result in fp0
- rts
-
-tbl_fdiv_ovfl2:
- long 0x7fff
- long 0x407f
- long 0x43ff
-
-fdiv_no_ovfl:
- mov.l (%sp)+,%d0 # restore scale factor
- bra.b fdiv_normal_exit
-
-fdiv_may_ovfl:
- mov.l %d0,-(%sp) # save scale factor
-
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # set FPSR
-
- fdiv.x FP_SCR0(%a6),%fp0 # execute divide
-
- fmov.l %fpsr,%d0
- fmov.l &0x0,%fpcr
-
- or.l %d0,USER_FPSR(%a6) # save INEX,N
-
- fmovm.x &0x01,-(%sp) # save result to stack
- mov.w (%sp),%d0 # fetch new exponent
- add.l &0xc,%sp # clear result from stack
- andi.l &0x7fff,%d0 # strip sign
- sub.l (%sp),%d0 # add scale factor
- cmp.l %d0,(tbl_fdiv_ovfl2.b,%pc,%d1.w*4)
- blt.b fdiv_no_ovfl
- mov.l (%sp)+,%d0
-
-fdiv_ovfl_tst:
- or.l &ovfl_inx_mask,USER_FPSR(%a6) # set ovfl/aovfl/ainex
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x13,%d1 # is OVFL or INEX enabled?
- bne.b fdiv_ovfl_ena # yes
-
-fdiv_ovfl_dis:
- btst &neg_bit,FPSR_CC(%a6) # is result negative?
- sne %d1 # set sign param accordingly
- mov.l L_SCR3(%a6),%d0 # pass prec:rnd
- bsr.l ovf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # set INF if applicable
- fmovm.x (%a0),&0x80 # return default result in fp0
- rts
-
-fdiv_ovfl_ena:
- mov.l L_SCR3(%a6),%d1
- andi.b &0xc0,%d1 # is precision extended?
- bne.b fdiv_ovfl_ena_sd # no, do sgl or dbl
-
-fdiv_ovfl_ena_cont:
- fmovm.x &0x80,FP_SCR0(%a6) # move result to stack
-
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # fetch {sgn,exp}
- mov.w %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- sub.l %d0,%d1 # add scale factor
- subi.l &0x6000,%d1 # subtract bias
- andi.w &0x7fff,%d1 # clear sign bit
- andi.w &0x8000,%d2 # keep old sign
- or.w %d2,%d1 # concat old sign,new exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- bra.b fdiv_ovfl_dis
-
-fdiv_ovfl_ena_sd:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst operand
-
- mov.l L_SCR3(%a6),%d1
- andi.b &0x30,%d1 # keep rnd mode
- fmov.l %d1,%fpcr # set FPCR
-
- fdiv.x FP_SCR0(%a6),%fp0 # execute divide
-
- fmov.l &0x0,%fpcr # clear FPCR
- bra.b fdiv_ovfl_ena_cont
-
-fdiv_unfl:
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
-
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l &rz_mode*0x10,%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fdiv.x FP_SCR0(%a6),%fp0 # execute divide
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x0b,%d1 # is UNFL or INEX enabled?
- bne.b fdiv_unfl_ena # yes
-
-fdiv_unfl_dis:
- fmovm.x &0x80,FP_SCR0(%a6) # store out result
-
- lea FP_SCR0(%a6),%a0 # pass: result addr
- mov.l L_SCR3(%a6),%d1 # pass: rnd prec,mode
- bsr.l unf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # 'Z' may have been set
- fmovm.x FP_SCR0(%a6),&0x80 # return default result in fp0
- rts
-
-#
-# UNFL is enabled.
-#
-fdiv_unfl_ena:
- fmovm.x FP_SCR1(%a6),&0x40 # load dst op
-
- mov.l L_SCR3(%a6),%d1
- andi.b &0xc0,%d1 # is precision extended?
- bne.b fdiv_unfl_ena_sd # no, sgl or dbl
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
-fdiv_unfl_ena_cont:
- fmov.l &0x0,%fpsr # clear FPSR
-
- fdiv.x FP_SCR0(%a6),%fp1 # execute divide
-
- fmov.l &0x0,%fpcr # clear FPCR
-
- fmovm.x &0x40,FP_SCR0(%a6) # save result to stack
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # fetch {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- addi.l &0x6000,%d1 # add bias
- andi.w &0x7fff,%d1
- or.w %d2,%d1 # concat old sign,new exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exp
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- bra.w fdiv_unfl_dis
-
-fdiv_unfl_ena_sd:
- mov.l L_SCR3(%a6),%d1
- andi.b &0x30,%d1 # use only rnd mode
- fmov.l %d1,%fpcr # set FPCR
-
- bra.b fdiv_unfl_ena_cont
-
-#
-# the divide operation MAY underflow:
-#
-fdiv_may_unfl:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fdiv.x FP_SCR0(%a6),%fp0 # execute divide
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
- fabs.x %fp0,%fp1 # make a copy of result
- fcmp.b %fp1,&0x1 # is |result| > 1.b?
- fbgt.w fdiv_normal_exit # no; no underflow occurred
- fblt.w fdiv_unfl # yes; underflow occurred
-
-#
-# we still don't know if underflow occurred. result is ~ equal to 1. but,
-# we don't know if the result was an underflow that rounded up to a 1
-# or a normalized number that rounded down to a 1. so, redo the entire
-# operation using RZ as the rounding mode to see what the pre-rounded
-# result is. this case should be relatively rare.
-#
- fmovm.x FP_SCR1(%a6),&0x40 # load dst op into fp1
-
- mov.l L_SCR3(%a6),%d1
- andi.b &0xc0,%d1 # keep rnd prec
- ori.b &rz_mode*0x10,%d1 # insert RZ
-
- fmov.l %d1,%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fdiv.x FP_SCR0(%a6),%fp1 # execute divide
-
- fmov.l &0x0,%fpcr # clear FPCR
- fabs.x %fp1 # make absolute value
- fcmp.b %fp1,&0x1 # is |result| < 1.b?
- fbge.w fdiv_normal_exit # no; no underflow occurred
- bra.w fdiv_unfl # yes; underflow occurred
-
-############################################################################
-
-#
-# Divide: inputs are not both normalized; what are they?
-#
-fdiv_not_norm:
- mov.w (tbl_fdiv_op.b,%pc,%d1.w*2),%d1
- jmp (tbl_fdiv_op.b,%pc,%d1.w*1)
-
- swbeg &48
-tbl_fdiv_op:
- short fdiv_norm - tbl_fdiv_op # NORM / NORM
- short fdiv_inf_load - tbl_fdiv_op # NORM / ZERO
- short fdiv_zero_load - tbl_fdiv_op # NORM / INF
- short fdiv_res_qnan - tbl_fdiv_op # NORM / QNAN
- short fdiv_norm - tbl_fdiv_op # NORM / DENORM
- short fdiv_res_snan - tbl_fdiv_op # NORM / SNAN
- short tbl_fdiv_op - tbl_fdiv_op #
- short tbl_fdiv_op - tbl_fdiv_op #
-
- short fdiv_zero_load - tbl_fdiv_op # ZERO / NORM
- short fdiv_res_operr - tbl_fdiv_op # ZERO / ZERO
- short fdiv_zero_load - tbl_fdiv_op # ZERO / INF
- short fdiv_res_qnan - tbl_fdiv_op # ZERO / QNAN
- short fdiv_zero_load - tbl_fdiv_op # ZERO / DENORM
- short fdiv_res_snan - tbl_fdiv_op # ZERO / SNAN
- short tbl_fdiv_op - tbl_fdiv_op #
- short tbl_fdiv_op - tbl_fdiv_op #
-
- short fdiv_inf_dst - tbl_fdiv_op # INF / NORM
- short fdiv_inf_dst - tbl_fdiv_op # INF / ZERO
- short fdiv_res_operr - tbl_fdiv_op # INF / INF
- short fdiv_res_qnan - tbl_fdiv_op # INF / QNAN
- short fdiv_inf_dst - tbl_fdiv_op # INF / DENORM
- short fdiv_res_snan - tbl_fdiv_op # INF / SNAN
- short tbl_fdiv_op - tbl_fdiv_op #
- short tbl_fdiv_op - tbl_fdiv_op #
-
- short fdiv_res_qnan - tbl_fdiv_op # QNAN / NORM
- short fdiv_res_qnan - tbl_fdiv_op # QNAN / ZERO
- short fdiv_res_qnan - tbl_fdiv_op # QNAN / INF
- short fdiv_res_qnan - tbl_fdiv_op # QNAN / QNAN
- short fdiv_res_qnan - tbl_fdiv_op # QNAN / DENORM
- short fdiv_res_snan - tbl_fdiv_op # QNAN / SNAN
- short tbl_fdiv_op - tbl_fdiv_op #
- short tbl_fdiv_op - tbl_fdiv_op #
-
- short fdiv_norm - tbl_fdiv_op # DENORM / NORM
- short fdiv_inf_load - tbl_fdiv_op # DENORM / ZERO
- short fdiv_zero_load - tbl_fdiv_op # DENORM / INF
- short fdiv_res_qnan - tbl_fdiv_op # DENORM / QNAN
- short fdiv_norm - tbl_fdiv_op # DENORM / DENORM
- short fdiv_res_snan - tbl_fdiv_op # DENORM / SNAN
- short tbl_fdiv_op - tbl_fdiv_op #
- short tbl_fdiv_op - tbl_fdiv_op #
-
- short fdiv_res_snan - tbl_fdiv_op # SNAN / NORM
- short fdiv_res_snan - tbl_fdiv_op # SNAN / ZERO
- short fdiv_res_snan - tbl_fdiv_op # SNAN / INF
- short fdiv_res_snan - tbl_fdiv_op # SNAN / QNAN
- short fdiv_res_snan - tbl_fdiv_op # SNAN / DENORM
- short fdiv_res_snan - tbl_fdiv_op # SNAN / SNAN
- short tbl_fdiv_op - tbl_fdiv_op #
- short tbl_fdiv_op - tbl_fdiv_op #
-
-fdiv_res_qnan:
- bra.l res_qnan
-fdiv_res_snan:
- bra.l res_snan
-fdiv_res_operr:
- bra.l res_operr
-
- global fdiv_zero_load # global for fsgldiv
-fdiv_zero_load:
- mov.b SRC_EX(%a0),%d0 # result sign is exclusive
- mov.b DST_EX(%a1),%d1 # or of input signs.
- eor.b %d0,%d1
- bpl.b fdiv_zero_load_p # result is positive
- fmov.s &0x80000000,%fp0 # load a -ZERO
- mov.b &z_bmask+neg_bmask,FPSR_CC(%a6) # set Z/N
- rts
-fdiv_zero_load_p:
- fmov.s &0x00000000,%fp0 # load a +ZERO
- mov.b &z_bmask,FPSR_CC(%a6) # set Z
- rts
-
-#
-# The destination was In Range and the source was a ZERO. The result,
-# therefore, is an INF w/ the proper sign.
-# So, determine the sign and return a new INF (w/ the j-bit cleared).
-#
- global fdiv_inf_load # global for fsgldiv
-fdiv_inf_load:
- ori.w &dz_mask+adz_mask,2+USER_FPSR(%a6) # no; set DZ/ADZ
- mov.b SRC_EX(%a0),%d0 # load both signs
- mov.b DST_EX(%a1),%d1
- eor.b %d0,%d1
- bpl.b fdiv_inf_load_p # result is positive
- fmov.s &0xff800000,%fp0 # make result -INF
- mov.b &inf_bmask+neg_bmask,FPSR_CC(%a6) # set INF/N
- rts
-fdiv_inf_load_p:
- fmov.s &0x7f800000,%fp0 # make result +INF
- mov.b &inf_bmask,FPSR_CC(%a6) # set INF
- rts
-
-#
-# The destination was an INF w/ an In Range or ZERO source, the result is
-# an INF w/ the proper sign.
-# The 68881/882 returns the destination INF w/ the new sign(if the j-bit of the
-# dst INF is set, then then j-bit of the result INF is also set).
-#
- global fdiv_inf_dst # global for fsgldiv
-fdiv_inf_dst:
- mov.b DST_EX(%a1),%d0 # load both signs
- mov.b SRC_EX(%a0),%d1
- eor.b %d0,%d1
- bpl.b fdiv_inf_dst_p # result is positive
-
- fmovm.x DST(%a1),&0x80 # return result in fp0
- fabs.x %fp0 # clear sign bit
- fneg.x %fp0 # set sign bit
- mov.b &inf_bmask+neg_bmask,FPSR_CC(%a6) # set INF/NEG
- rts
-
-fdiv_inf_dst_p:
- fmovm.x DST(%a1),&0x80 # return result in fp0
- fabs.x %fp0 # return positive INF
- mov.b &inf_bmask,FPSR_CC(%a6) # set INF
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# fneg(): emulates the fneg instruction #
-# fsneg(): emulates the fsneg instruction #
-# fdneg(): emulates the fdneg instruction #
-# #
-# XREF **************************************************************** #
-# norm() - normalize a denorm to provide EXOP #
-# scale_to_zero_src() - scale sgl/dbl source exponent #
-# ovf_res() - return default overflow result #
-# unf_res() - return default underflow result #
-# res_qnan_1op() - return QNAN result #
-# res_snan_1op() - return SNAN result #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# d0 = rnd prec,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = result #
-# fp1 = EXOP (if exception occurred) #
-# #
-# ALGORITHM *********************************************************** #
-# Handle NANs, zeroes, and infinities as special cases. Separate #
-# norms/denorms into ext/sgl/dbl precisions. Extended precision can be #
-# emulated by simply setting sign bit. Sgl/dbl operands must be scaled #
-# and an actual fneg performed to see if overflow/underflow would have #
-# occurred. If so, return default underflow/overflow result. Else, #
-# scale the result exponent and return result. FPSR gets set based on #
-# the result value. #
-# #
-#########################################################################
-
- global fsneg
-fsneg:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &s_mode*0x10,%d0 # insert sgl precision
- bra.b fneg
-
- global fdneg
-fdneg:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &d_mode*0x10,%d0 # insert dbl prec
-
- global fneg
-fneg:
- mov.l %d0,L_SCR3(%a6) # store rnd info
- mov.b STAG(%a6),%d1
- bne.w fneg_not_norm # optimize on non-norm input
-
-#
-# NEGATE SIGN : norms and denorms ONLY!
-#
-fneg_norm:
- andi.b &0xc0,%d0 # is precision extended?
- bne.w fneg_not_ext # no; go handle sgl or dbl
-
-#
-# precision selected is extended. so...we can not get an underflow
-# or overflow because of rounding to the correct precision. so...
-# skip the scaling and unscaling...
-#
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- mov.w SRC_EX(%a0),%d0
- eori.w &0x8000,%d0 # negate sign
- bpl.b fneg_norm_load # sign is positive
- mov.b &neg_bmask,FPSR_CC(%a6) # set 'N' ccode bit
-fneg_norm_load:
- mov.w %d0,FP_SCR0_EX(%a6)
- fmovm.x FP_SCR0(%a6),&0x80 # return result in fp0
- rts
-
-#
-# for an extended precision DENORM, the UNFL exception bit is set
-# the accrued bit is NOT set in this instance(no inexactness!)
-#
-fneg_denorm:
- andi.b &0xc0,%d0 # is precision extended?
- bne.b fneg_not_ext # no; go handle sgl or dbl
-
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
-
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- mov.w SRC_EX(%a0),%d0
- eori.w &0x8000,%d0 # negate sign
- bpl.b fneg_denorm_done # no
- mov.b &neg_bmask,FPSR_CC(%a6) # yes, set 'N' ccode bit
-fneg_denorm_done:
- mov.w %d0,FP_SCR0_EX(%a6)
- fmovm.x FP_SCR0(%a6),&0x80 # return default result in fp0
-
- btst &unfl_bit,FPCR_ENABLE(%a6) # is UNFL enabled?
- bne.b fneg_ext_unfl_ena # yes
- rts
-
-#
-# the input is an extended DENORM and underflow is enabled in the FPCR.
-# normalize the mantissa and add the bias of 0x6000 to the resulting negative
-# exponent and insert back into the operand.
-#
-fneg_ext_unfl_ena:
- lea FP_SCR0(%a6),%a0 # pass: ptr to operand
- bsr.l norm # normalize result
- neg.w %d0 # new exponent = -(shft val)
- addi.w &0x6000,%d0 # add new bias to exponent
- mov.w FP_SCR0_EX(%a6),%d1 # fetch old sign,exp
- andi.w &0x8000,%d1 # keep old sign
- andi.w &0x7fff,%d0 # clear sign position
- or.w %d1,%d0 # concat old sign, new exponent
- mov.w %d0,FP_SCR0_EX(%a6) # insert new exponent
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- rts
-
-#
-# operand is either single or double
-#
-fneg_not_ext:
- cmpi.b %d0,&s_mode*0x10 # separate sgl/dbl prec
- bne.b fneg_dbl
-
-#
-# operand is to be rounded to single precision
-#
-fneg_sgl:
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- bsr.l scale_to_zero_src # calculate scale factor
-
- cmpi.l %d0,&0x3fff-0x3f80 # will move in underflow?
- bge.w fneg_sd_unfl # yes; go handle underflow
- cmpi.l %d0,&0x3fff-0x407e # will move in overflow?
- beq.w fneg_sd_may_ovfl # maybe; go check
- blt.w fneg_sd_ovfl # yes; go handle overflow
-
-#
-# operand will NOT overflow or underflow when moved in to the fp reg file
-#
-fneg_sd_normal:
- fmov.l &0x0,%fpsr # clear FPSR
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fneg.x FP_SCR0(%a6),%fp0 # perform negation
-
- fmov.l %fpsr,%d1 # save FPSR
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-fneg_sd_normal_exit:
- mov.l %d2,-(%sp) # save d2
- fmovm.x &0x80,FP_SCR0(%a6) # store out result
- mov.w FP_SCR0_EX(%a6),%d1 # load sgn,exp
- mov.w %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- sub.l %d0,%d1 # add scale factor
- andi.w &0x8000,%d2 # keep old sign
- or.w %d1,%d2 # concat old sign,new exp
- mov.w %d2,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x80 # return result in fp0
- rts
-
-#
-# operand is to be rounded to double precision
-#
-fneg_dbl:
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- bsr.l scale_to_zero_src # calculate scale factor
-
- cmpi.l %d0,&0x3fff-0x3c00 # will move in underflow?
- bge.b fneg_sd_unfl # yes; go handle underflow
- cmpi.l %d0,&0x3fff-0x43fe # will move in overflow?
- beq.w fneg_sd_may_ovfl # maybe; go check
- blt.w fneg_sd_ovfl # yes; go handle overflow
- bra.w fneg_sd_normal # no; ho handle normalized op
-
-#
-# operand WILL underflow when moved in to the fp register file
-#
-fneg_sd_unfl:
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
-
- eori.b &0x80,FP_SCR0_EX(%a6) # negate sign
- bpl.b fneg_sd_unfl_tst
- bset &neg_bit,FPSR_CC(%a6) # set 'N' ccode bit
-
-# if underflow or inexact is enabled, go calculate EXOP first.
-fneg_sd_unfl_tst:
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x0b,%d1 # is UNFL or INEX enabled?
- bne.b fneg_sd_unfl_ena # yes
-
-fneg_sd_unfl_dis:
- lea FP_SCR0(%a6),%a0 # pass: result addr
- mov.l L_SCR3(%a6),%d1 # pass: rnd prec,mode
- bsr.l unf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # unf_res may have set 'Z'
- fmovm.x FP_SCR0(%a6),&0x80 # return default result in fp0
- rts
-
-#
-# operand will underflow AND underflow is enabled.
-# therefore, we must return the result rounded to extended precision.
-#
-fneg_sd_unfl_ena:
- mov.l FP_SCR0_HI(%a6),FP_SCR1_HI(%a6)
- mov.l FP_SCR0_LO(%a6),FP_SCR1_LO(%a6)
- mov.w FP_SCR0_EX(%a6),%d1 # load current exponent
-
- mov.l %d2,-(%sp) # save d2
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # subtract scale factor
- addi.l &0x6000,%d1 # add new bias
- andi.w &0x7fff,%d1
- or.w %d2,%d1 # concat new sign,new exp
- mov.w %d1,FP_SCR1_EX(%a6) # insert new exp
- fmovm.x FP_SCR1(%a6),&0x40 # return EXOP in fp1
- mov.l (%sp)+,%d2 # restore d2
- bra.b fneg_sd_unfl_dis
-
-#
-# operand WILL overflow.
-#
-fneg_sd_ovfl:
- fmov.l &0x0,%fpsr # clear FPSR
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fneg.x FP_SCR0(%a6),%fp0 # perform negation
-
- fmov.l &0x0,%fpcr # clear FPCR
- fmov.l %fpsr,%d1 # save FPSR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-fneg_sd_ovfl_tst:
- or.l &ovfl_inx_mask,USER_FPSR(%a6) # set ovfl/aovfl/ainex
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x13,%d1 # is OVFL or INEX enabled?
- bne.b fneg_sd_ovfl_ena # yes
-
-#
-# OVFL is not enabled; therefore, we must create the default result by
-# calling ovf_res().
-#
-fneg_sd_ovfl_dis:
- btst &neg_bit,FPSR_CC(%a6) # is result negative?
- sne %d1 # set sign param accordingly
- mov.l L_SCR3(%a6),%d0 # pass: prec,mode
- bsr.l ovf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # set INF,N if applicable
- fmovm.x (%a0),&0x80 # return default result in fp0
- rts
-
-#
-# OVFL is enabled.
-# the INEX2 bit has already been updated by the round to the correct precision.
-# now, round to extended(and don't alter the FPSR).
-#
-fneg_sd_ovfl_ena:
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # fetch {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- subi.l &0x6000,%d1 # subtract bias
- andi.w &0x7fff,%d1
- or.w %d2,%d1 # concat sign,exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- mov.l (%sp)+,%d2 # restore d2
- bra.b fneg_sd_ovfl_dis
-
-#
-# the move in MAY underflow. so...
-#
-fneg_sd_may_ovfl:
- fmov.l &0x0,%fpsr # clear FPSR
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fneg.x FP_SCR0(%a6),%fp0 # perform negation
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
- fabs.x %fp0,%fp1 # make a copy of result
- fcmp.b %fp1,&0x2 # is |result| >= 2.b?
- fbge.w fneg_sd_ovfl_tst # yes; overflow has occurred
-
-# no, it didn't overflow; we have correct result
- bra.w fneg_sd_normal_exit
-
-##########################################################################
-
-#
-# input is not normalized; what is it?
-#
-fneg_not_norm:
- cmpi.b %d1,&DENORM # weed out DENORM
- beq.w fneg_denorm
- cmpi.b %d1,&SNAN # weed out SNAN
- beq.l res_snan_1op
- cmpi.b %d1,&QNAN # weed out QNAN
- beq.l res_qnan_1op
-
-#
-# do the fneg; at this point, only possible ops are ZERO and INF.
-# use fneg to determine ccodes.
-# prec:mode should be zero at this point but it won't affect answer anyways.
-#
- fneg.x SRC_EX(%a0),%fp0 # do fneg
- fmov.l %fpsr,%d0
- rol.l &0x8,%d0 # put ccodes in lo byte
- mov.b %d0,FPSR_CC(%a6) # insert correct ccodes
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# ftst(): emulates the ftest instruction #
-# #
-# XREF **************************************************************** #
-# res{s,q}nan_1op() - set NAN result for monadic instruction #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# #
-# OUTPUT ************************************************************** #
-# none #
-# #
-# ALGORITHM *********************************************************** #
-# Check the source operand tag (STAG) and set the FPCR according #
-# to the operand type and sign. #
-# #
-#########################################################################
-
- global ftst
-ftst:
- mov.b STAG(%a6),%d1
- bne.b ftst_not_norm # optimize on non-norm input
-
-#
-# Norm:
-#
-ftst_norm:
- tst.b SRC_EX(%a0) # is operand negative?
- bmi.b ftst_norm_m # yes
- rts
-ftst_norm_m:
- mov.b &neg_bmask,FPSR_CC(%a6) # set 'N' ccode bit
- rts
-
-#
-# input is not normalized; what is it?
-#
-ftst_not_norm:
- cmpi.b %d1,&ZERO # weed out ZERO
- beq.b ftst_zero
- cmpi.b %d1,&INF # weed out INF
- beq.b ftst_inf
- cmpi.b %d1,&SNAN # weed out SNAN
- beq.l res_snan_1op
- cmpi.b %d1,&QNAN # weed out QNAN
- beq.l res_qnan_1op
-
-#
-# Denorm:
-#
-ftst_denorm:
- tst.b SRC_EX(%a0) # is operand negative?
- bmi.b ftst_denorm_m # yes
- rts
-ftst_denorm_m:
- mov.b &neg_bmask,FPSR_CC(%a6) # set 'N' ccode bit
- rts
-
-#
-# Infinity:
-#
-ftst_inf:
- tst.b SRC_EX(%a0) # is operand negative?
- bmi.b ftst_inf_m # yes
-ftst_inf_p:
- mov.b &inf_bmask,FPSR_CC(%a6) # set 'I' ccode bit
- rts
-ftst_inf_m:
- mov.b &inf_bmask+neg_bmask,FPSR_CC(%a6) # set 'I','N' ccode bits
- rts
-
-#
-# Zero:
-#
-ftst_zero:
- tst.b SRC_EX(%a0) # is operand negative?
- bmi.b ftst_zero_m # yes
-ftst_zero_p:
- mov.b &z_bmask,FPSR_CC(%a6) # set 'N' ccode bit
- rts
-ftst_zero_m:
- mov.b &z_bmask+neg_bmask,FPSR_CC(%a6) # set 'Z','N' ccode bits
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# fint(): emulates the fint instruction #
-# #
-# XREF **************************************************************** #
-# res_{s,q}nan_1op() - set NAN result for monadic operation #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# d0 = round precision/mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = result #
-# #
-# ALGORITHM *********************************************************** #
-# Separate according to operand type. Unnorms don't pass through #
-# here. For norms, load the rounding mode/prec, execute a "fint", then #
-# store the resulting FPSR bits. #
-# For denorms, force the j-bit to a one and do the same as for #
-# norms. Denorms are so low that the answer will either be a zero or a #
-# one. #
-# For zeroes/infs/NANs, return the same while setting the FPSR #
-# as appropriate. #
-# #
-#########################################################################
-
- global fint
-fint:
- mov.b STAG(%a6),%d1
- bne.b fint_not_norm # optimize on non-norm input
-
-#
-# Norm:
-#
-fint_norm:
- andi.b &0x30,%d0 # set prec = ext
-
- fmov.l %d0,%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fint.x SRC(%a0),%fp0 # execute fint
-
- fmov.l &0x0,%fpcr # clear FPCR
- fmov.l %fpsr,%d0 # save FPSR
- or.l %d0,USER_FPSR(%a6) # set exception bits
-
- rts
-
-#
-# input is not normalized; what is it?
-#
-fint_not_norm:
- cmpi.b %d1,&ZERO # weed out ZERO
- beq.b fint_zero
- cmpi.b %d1,&INF # weed out INF
- beq.b fint_inf
- cmpi.b %d1,&DENORM # weed out DENORM
- beq.b fint_denorm
- cmpi.b %d1,&SNAN # weed out SNAN
- beq.l res_snan_1op
- bra.l res_qnan_1op # weed out QNAN
-
-#
-# Denorm:
-#
-# for DENORMs, the result will be either (+/-)ZERO or (+/-)1.
-# also, the INEX2 and AINEX exception bits will be set.
-# so, we could either set these manually or force the DENORM
-# to a very small NORM and ship it to the NORM routine.
-# I do the latter.
-#
-fint_denorm:
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6) # copy sign, zero exp
- mov.b &0x80,FP_SCR0_HI(%a6) # force DENORM ==> small NORM
- lea FP_SCR0(%a6),%a0
- bra.b fint_norm
-
-#
-# Zero:
-#
-fint_zero:
- tst.b SRC_EX(%a0) # is ZERO negative?
- bmi.b fint_zero_m # yes
-fint_zero_p:
- fmov.s &0x00000000,%fp0 # return +ZERO in fp0
- mov.b &z_bmask,FPSR_CC(%a6) # set 'Z' ccode bit
- rts
-fint_zero_m:
- fmov.s &0x80000000,%fp0 # return -ZERO in fp0
- mov.b &z_bmask+neg_bmask,FPSR_CC(%a6) # set 'Z','N' ccode bits
- rts
-
-#
-# Infinity:
-#
-fint_inf:
- fmovm.x SRC(%a0),&0x80 # return result in fp0
- tst.b SRC_EX(%a0) # is INF negative?
- bmi.b fint_inf_m # yes
-fint_inf_p:
- mov.b &inf_bmask,FPSR_CC(%a6) # set 'I' ccode bit
- rts
-fint_inf_m:
- mov.b &inf_bmask+neg_bmask,FPSR_CC(%a6) # set 'N','I' ccode bits
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# fintrz(): emulates the fintrz instruction #
-# #
-# XREF **************************************************************** #
-# res_{s,q}nan_1op() - set NAN result for monadic operation #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# d0 = round precision/mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = result #
-# #
-# ALGORITHM *********************************************************** #
-# Separate according to operand type. Unnorms don't pass through #
-# here. For norms, load the rounding mode/prec, execute a "fintrz", #
-# then store the resulting FPSR bits. #
-# For denorms, force the j-bit to a one and do the same as for #
-# norms. Denorms are so low that the answer will either be a zero or a #
-# one. #
-# For zeroes/infs/NANs, return the same while setting the FPSR #
-# as appropriate. #
-# #
-#########################################################################
-
- global fintrz
-fintrz:
- mov.b STAG(%a6),%d1
- bne.b fintrz_not_norm # optimize on non-norm input
-
-#
-# Norm:
-#
-fintrz_norm:
- fmov.l &0x0,%fpsr # clear FPSR
-
- fintrz.x SRC(%a0),%fp0 # execute fintrz
-
- fmov.l %fpsr,%d0 # save FPSR
- or.l %d0,USER_FPSR(%a6) # set exception bits
-
- rts
-
-#
-# input is not normalized; what is it?
-#
-fintrz_not_norm:
- cmpi.b %d1,&ZERO # weed out ZERO
- beq.b fintrz_zero
- cmpi.b %d1,&INF # weed out INF
- beq.b fintrz_inf
- cmpi.b %d1,&DENORM # weed out DENORM
- beq.b fintrz_denorm
- cmpi.b %d1,&SNAN # weed out SNAN
- beq.l res_snan_1op
- bra.l res_qnan_1op # weed out QNAN
-
-#
-# Denorm:
-#
-# for DENORMs, the result will be (+/-)ZERO.
-# also, the INEX2 and AINEX exception bits will be set.
-# so, we could either set these manually or force the DENORM
-# to a very small NORM and ship it to the NORM routine.
-# I do the latter.
-#
-fintrz_denorm:
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6) # copy sign, zero exp
- mov.b &0x80,FP_SCR0_HI(%a6) # force DENORM ==> small NORM
- lea FP_SCR0(%a6),%a0
- bra.b fintrz_norm
-
-#
-# Zero:
-#
-fintrz_zero:
- tst.b SRC_EX(%a0) # is ZERO negative?
- bmi.b fintrz_zero_m # yes
-fintrz_zero_p:
- fmov.s &0x00000000,%fp0 # return +ZERO in fp0
- mov.b &z_bmask,FPSR_CC(%a6) # set 'Z' ccode bit
- rts
-fintrz_zero_m:
- fmov.s &0x80000000,%fp0 # return -ZERO in fp0
- mov.b &z_bmask+neg_bmask,FPSR_CC(%a6) # set 'Z','N' ccode bits
- rts
-
-#
-# Infinity:
-#
-fintrz_inf:
- fmovm.x SRC(%a0),&0x80 # return result in fp0
- tst.b SRC_EX(%a0) # is INF negative?
- bmi.b fintrz_inf_m # yes
-fintrz_inf_p:
- mov.b &inf_bmask,FPSR_CC(%a6) # set 'I' ccode bit
- rts
-fintrz_inf_m:
- mov.b &inf_bmask+neg_bmask,FPSR_CC(%a6) # set 'N','I' ccode bits
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# fabs(): emulates the fabs instruction #
-# fsabs(): emulates the fsabs instruction #
-# fdabs(): emulates the fdabs instruction #
-# #
-# XREF **************************************************************** #
-# norm() - normalize denorm mantissa to provide EXOP #
-# scale_to_zero_src() - make exponent. = 0; get scale factor #
-# unf_res() - calculate underflow result #
-# ovf_res() - calculate overflow result #
-# res_{s,q}nan_1op() - set NAN result for monadic operation #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# d0 = rnd precision/mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = result #
-# fp1 = EXOP (if exception occurred) #
-# #
-# ALGORITHM *********************************************************** #
-# Handle NANs, infinities, and zeroes as special cases. Divide #
-# norms into extended, single, and double precision. #
-# Simply clear sign for extended precision norm. Ext prec denorm #
-# gets an EXOP created for it since it's an underflow. #
-# Double and single precision can overflow and underflow. First, #
-# scale the operand such that the exponent is zero. Perform an "fabs" #
-# using the correct rnd mode/prec. Check to see if the original #
-# exponent would take an exception. If so, use unf_res() or ovf_res() #
-# to calculate the default result. Also, create the EXOP for the #
-# exceptional case. If no exception should occur, insert the correct #
-# result exponent and return. #
-# Unnorms don't pass through here. #
-# #
-#########################################################################
-
- global fsabs
-fsabs:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &s_mode*0x10,%d0 # insert sgl precision
- bra.b fabs
-
- global fdabs
-fdabs:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &d_mode*0x10,%d0 # insert dbl precision
-
- global fabs
-fabs:
- mov.l %d0,L_SCR3(%a6) # store rnd info
- mov.b STAG(%a6),%d1
- bne.w fabs_not_norm # optimize on non-norm input
-
-#
-# ABSOLUTE VALUE: norms and denorms ONLY!
-#
-fabs_norm:
- andi.b &0xc0,%d0 # is precision extended?
- bne.b fabs_not_ext # no; go handle sgl or dbl
-
-#
-# precision selected is extended. so...we can not get an underflow
-# or overflow because of rounding to the correct precision. so...
-# skip the scaling and unscaling...
-#
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- mov.w SRC_EX(%a0),%d1
- bclr &15,%d1 # force absolute value
- mov.w %d1,FP_SCR0_EX(%a6) # insert exponent
- fmovm.x FP_SCR0(%a6),&0x80 # return result in fp0
- rts
-
-#
-# for an extended precision DENORM, the UNFL exception bit is set
-# the accrued bit is NOT set in this instance(no inexactness!)
-#
-fabs_denorm:
- andi.b &0xc0,%d0 # is precision extended?
- bne.b fabs_not_ext # no
-
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
-
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- mov.w SRC_EX(%a0),%d0
- bclr &15,%d0 # clear sign
- mov.w %d0,FP_SCR0_EX(%a6) # insert exponent
-
- fmovm.x FP_SCR0(%a6),&0x80 # return default result in fp0
-
- btst &unfl_bit,FPCR_ENABLE(%a6) # is UNFL enabled?
- bne.b fabs_ext_unfl_ena
- rts
-
-#
-# the input is an extended DENORM and underflow is enabled in the FPCR.
-# normalize the mantissa and add the bias of 0x6000 to the resulting negative
-# exponent and insert back into the operand.
-#
-fabs_ext_unfl_ena:
- lea FP_SCR0(%a6),%a0 # pass: ptr to operand
- bsr.l norm # normalize result
- neg.w %d0 # new exponent = -(shft val)
- addi.w &0x6000,%d0 # add new bias to exponent
- mov.w FP_SCR0_EX(%a6),%d1 # fetch old sign,exp
- andi.w &0x8000,%d1 # keep old sign
- andi.w &0x7fff,%d0 # clear sign position
- or.w %d1,%d0 # concat old sign, new exponent
- mov.w %d0,FP_SCR0_EX(%a6) # insert new exponent
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- rts
-
-#
-# operand is either single or double
-#
-fabs_not_ext:
- cmpi.b %d0,&s_mode*0x10 # separate sgl/dbl prec
- bne.b fabs_dbl
-
-#
-# operand is to be rounded to single precision
-#
-fabs_sgl:
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- bsr.l scale_to_zero_src # calculate scale factor
-
- cmpi.l %d0,&0x3fff-0x3f80 # will move in underflow?
- bge.w fabs_sd_unfl # yes; go handle underflow
- cmpi.l %d0,&0x3fff-0x407e # will move in overflow?
- beq.w fabs_sd_may_ovfl # maybe; go check
- blt.w fabs_sd_ovfl # yes; go handle overflow
-
-#
-# operand will NOT overflow or underflow when moved in to the fp reg file
-#
-fabs_sd_normal:
- fmov.l &0x0,%fpsr # clear FPSR
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fabs.x FP_SCR0(%a6),%fp0 # perform absolute
-
- fmov.l %fpsr,%d1 # save FPSR
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-fabs_sd_normal_exit:
- mov.l %d2,-(%sp) # save d2
- fmovm.x &0x80,FP_SCR0(%a6) # store out result
- mov.w FP_SCR0_EX(%a6),%d1 # load sgn,exp
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- sub.l %d0,%d1 # add scale factor
- andi.w &0x8000,%d2 # keep old sign
- or.w %d1,%d2 # concat old sign,new exp
- mov.w %d2,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x80 # return result in fp0
- rts
-
-#
-# operand is to be rounded to double precision
-#
-fabs_dbl:
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- bsr.l scale_to_zero_src # calculate scale factor
-
- cmpi.l %d0,&0x3fff-0x3c00 # will move in underflow?
- bge.b fabs_sd_unfl # yes; go handle underflow
- cmpi.l %d0,&0x3fff-0x43fe # will move in overflow?
- beq.w fabs_sd_may_ovfl # maybe; go check
- blt.w fabs_sd_ovfl # yes; go handle overflow
- bra.w fabs_sd_normal # no; ho handle normalized op
-
-#
-# operand WILL underflow when moved in to the fp register file
-#
-fabs_sd_unfl:
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
-
- bclr &0x7,FP_SCR0_EX(%a6) # force absolute value
-
-# if underflow or inexact is enabled, go calculate EXOP first.
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x0b,%d1 # is UNFL or INEX enabled?
- bne.b fabs_sd_unfl_ena # yes
-
-fabs_sd_unfl_dis:
- lea FP_SCR0(%a6),%a0 # pass: result addr
- mov.l L_SCR3(%a6),%d1 # pass: rnd prec,mode
- bsr.l unf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # set possible 'Z' ccode
- fmovm.x FP_SCR0(%a6),&0x80 # return default result in fp0
- rts
-
-#
-# operand will underflow AND underflow is enabled.
-# therefore, we must return the result rounded to extended precision.
-#
-fabs_sd_unfl_ena:
- mov.l FP_SCR0_HI(%a6),FP_SCR1_HI(%a6)
- mov.l FP_SCR0_LO(%a6),FP_SCR1_LO(%a6)
- mov.w FP_SCR0_EX(%a6),%d1 # load current exponent
-
- mov.l %d2,-(%sp) # save d2
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # subtract scale factor
- addi.l &0x6000,%d1 # add new bias
- andi.w &0x7fff,%d1
- or.w %d2,%d1 # concat new sign,new exp
- mov.w %d1,FP_SCR1_EX(%a6) # insert new exp
- fmovm.x FP_SCR1(%a6),&0x40 # return EXOP in fp1
- mov.l (%sp)+,%d2 # restore d2
- bra.b fabs_sd_unfl_dis
-
-#
-# operand WILL overflow.
-#
-fabs_sd_ovfl:
- fmov.l &0x0,%fpsr # clear FPSR
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fabs.x FP_SCR0(%a6),%fp0 # perform absolute
-
- fmov.l &0x0,%fpcr # clear FPCR
- fmov.l %fpsr,%d1 # save FPSR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-fabs_sd_ovfl_tst:
- or.l &ovfl_inx_mask,USER_FPSR(%a6) # set ovfl/aovfl/ainex
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x13,%d1 # is OVFL or INEX enabled?
- bne.b fabs_sd_ovfl_ena # yes
-
-#
-# OVFL is not enabled; therefore, we must create the default result by
-# calling ovf_res().
-#
-fabs_sd_ovfl_dis:
- btst &neg_bit,FPSR_CC(%a6) # is result negative?
- sne %d1 # set sign param accordingly
- mov.l L_SCR3(%a6),%d0 # pass: prec,mode
- bsr.l ovf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # set INF,N if applicable
- fmovm.x (%a0),&0x80 # return default result in fp0
- rts
-
-#
-# OVFL is enabled.
-# the INEX2 bit has already been updated by the round to the correct precision.
-# now, round to extended(and don't alter the FPSR).
-#
-fabs_sd_ovfl_ena:
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # fetch {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- subi.l &0x6000,%d1 # subtract bias
- andi.w &0x7fff,%d1
- or.w %d2,%d1 # concat sign,exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- mov.l (%sp)+,%d2 # restore d2
- bra.b fabs_sd_ovfl_dis
-
-#
-# the move in MAY underflow. so...
-#
-fabs_sd_may_ovfl:
- fmov.l &0x0,%fpsr # clear FPSR
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fabs.x FP_SCR0(%a6),%fp0 # perform absolute
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
- fabs.x %fp0,%fp1 # make a copy of result
- fcmp.b %fp1,&0x2 # is |result| >= 2.b?
- fbge.w fabs_sd_ovfl_tst # yes; overflow has occurred
-
-# no, it didn't overflow; we have correct result
- bra.w fabs_sd_normal_exit
-
-##########################################################################
-
-#
-# input is not normalized; what is it?
-#
-fabs_not_norm:
- cmpi.b %d1,&DENORM # weed out DENORM
- beq.w fabs_denorm
- cmpi.b %d1,&SNAN # weed out SNAN
- beq.l res_snan_1op
- cmpi.b %d1,&QNAN # weed out QNAN
- beq.l res_qnan_1op
-
- fabs.x SRC(%a0),%fp0 # force absolute value
-
- cmpi.b %d1,&INF # weed out INF
- beq.b fabs_inf
-fabs_zero:
- mov.b &z_bmask,FPSR_CC(%a6) # set 'Z' ccode bit
- rts
-fabs_inf:
- mov.b &inf_bmask,FPSR_CC(%a6) # set 'I' ccode bit
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# fcmp(): fp compare op routine #
-# #
-# XREF **************************************************************** #
-# res_qnan() - return QNAN result #
-# res_snan() - return SNAN result #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# a1 = pointer to extended precision destination operand #
-# d0 = round prec/mode #
-# #
-# OUTPUT ************************************************************** #
-# None #
-# #
-# ALGORITHM *********************************************************** #
-# Handle NANs and denorms as special cases. For everything else, #
-# just use the actual fcmp instruction to produce the correct condition #
-# codes. #
-# #
-#########################################################################
-
- global fcmp
-fcmp:
- clr.w %d1
- mov.b DTAG(%a6),%d1
- lsl.b &0x3,%d1
- or.b STAG(%a6),%d1
- bne.b fcmp_not_norm # optimize on non-norm input
-
-#
-# COMPARE FP OPs : NORMs, ZEROs, INFs, and "corrected" DENORMs
-#
-fcmp_norm:
- fmovm.x DST(%a1),&0x80 # load dst op
-
- fcmp.x %fp0,SRC(%a0) # do compare
-
- fmov.l %fpsr,%d0 # save FPSR
- rol.l &0x8,%d0 # extract ccode bits
- mov.b %d0,FPSR_CC(%a6) # set ccode bits(no exc bits are set)
-
- rts
-
-#
-# fcmp: inputs are not both normalized; what are they?
-#
-fcmp_not_norm:
- mov.w (tbl_fcmp_op.b,%pc,%d1.w*2),%d1
- jmp (tbl_fcmp_op.b,%pc,%d1.w*1)
-
- swbeg &48
-tbl_fcmp_op:
- short fcmp_norm - tbl_fcmp_op # NORM - NORM
- short fcmp_norm - tbl_fcmp_op # NORM - ZERO
- short fcmp_norm - tbl_fcmp_op # NORM - INF
- short fcmp_res_qnan - tbl_fcmp_op # NORM - QNAN
- short fcmp_nrm_dnrm - tbl_fcmp_op # NORM - DENORM
- short fcmp_res_snan - tbl_fcmp_op # NORM - SNAN
- short tbl_fcmp_op - tbl_fcmp_op #
- short tbl_fcmp_op - tbl_fcmp_op #
-
- short fcmp_norm - tbl_fcmp_op # ZERO - NORM
- short fcmp_norm - tbl_fcmp_op # ZERO - ZERO
- short fcmp_norm - tbl_fcmp_op # ZERO - INF
- short fcmp_res_qnan - tbl_fcmp_op # ZERO - QNAN
- short fcmp_dnrm_s - tbl_fcmp_op # ZERO - DENORM
- short fcmp_res_snan - tbl_fcmp_op # ZERO - SNAN
- short tbl_fcmp_op - tbl_fcmp_op #
- short tbl_fcmp_op - tbl_fcmp_op #
-
- short fcmp_norm - tbl_fcmp_op # INF - NORM
- short fcmp_norm - tbl_fcmp_op # INF - ZERO
- short fcmp_norm - tbl_fcmp_op # INF - INF
- short fcmp_res_qnan - tbl_fcmp_op # INF - QNAN
- short fcmp_dnrm_s - tbl_fcmp_op # INF - DENORM
- short fcmp_res_snan - tbl_fcmp_op # INF - SNAN
- short tbl_fcmp_op - tbl_fcmp_op #
- short tbl_fcmp_op - tbl_fcmp_op #
-
- short fcmp_res_qnan - tbl_fcmp_op # QNAN - NORM
- short fcmp_res_qnan - tbl_fcmp_op # QNAN - ZERO
- short fcmp_res_qnan - tbl_fcmp_op # QNAN - INF
- short fcmp_res_qnan - tbl_fcmp_op # QNAN - QNAN
- short fcmp_res_qnan - tbl_fcmp_op # QNAN - DENORM
- short fcmp_res_snan - tbl_fcmp_op # QNAN - SNAN
- short tbl_fcmp_op - tbl_fcmp_op #
- short tbl_fcmp_op - tbl_fcmp_op #
-
- short fcmp_dnrm_nrm - tbl_fcmp_op # DENORM - NORM
- short fcmp_dnrm_d - tbl_fcmp_op # DENORM - ZERO
- short fcmp_dnrm_d - tbl_fcmp_op # DENORM - INF
- short fcmp_res_qnan - tbl_fcmp_op # DENORM - QNAN
- short fcmp_dnrm_sd - tbl_fcmp_op # DENORM - DENORM
- short fcmp_res_snan - tbl_fcmp_op # DENORM - SNAN
- short tbl_fcmp_op - tbl_fcmp_op #
- short tbl_fcmp_op - tbl_fcmp_op #
-
- short fcmp_res_snan - tbl_fcmp_op # SNAN - NORM
- short fcmp_res_snan - tbl_fcmp_op # SNAN - ZERO
- short fcmp_res_snan - tbl_fcmp_op # SNAN - INF
- short fcmp_res_snan - tbl_fcmp_op # SNAN - QNAN
- short fcmp_res_snan - tbl_fcmp_op # SNAN - DENORM
- short fcmp_res_snan - tbl_fcmp_op # SNAN - SNAN
- short tbl_fcmp_op - tbl_fcmp_op #
- short tbl_fcmp_op - tbl_fcmp_op #
-
-# unlike all other functions for QNAN and SNAN, fcmp does NOT set the
-# 'N' bit for a negative QNAN or SNAN input so we must squelch it here.
-fcmp_res_qnan:
- bsr.l res_qnan
- andi.b &0xf7,FPSR_CC(%a6)
- rts
-fcmp_res_snan:
- bsr.l res_snan
- andi.b &0xf7,FPSR_CC(%a6)
- rts
-
-#
-# DENORMs are a little more difficult.
-# If you have a 2 DENORMs, then you can just force the j-bit to a one
-# and use the fcmp_norm routine.
-# If you have a DENORM and an INF or ZERO, just force the DENORM's j-bit to a one
-# and use the fcmp_norm routine.
-# If you have a DENORM and a NORM with opposite signs, then use fcmp_norm, also.
-# But with a DENORM and a NORM of the same sign, the neg bit is set if the
-# (1) signs are (+) and the DENORM is the dst or
-# (2) signs are (-) and the DENORM is the src
-#
-
-fcmp_dnrm_s:
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),%d0
- bset &31,%d0 # DENORM src; make into small norm
- mov.l %d0,FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- lea FP_SCR0(%a6),%a0
- bra.w fcmp_norm
-
-fcmp_dnrm_d:
- mov.l DST_EX(%a1),FP_SCR0_EX(%a6)
- mov.l DST_HI(%a1),%d0
- bset &31,%d0 # DENORM src; make into small norm
- mov.l %d0,FP_SCR0_HI(%a6)
- mov.l DST_LO(%a1),FP_SCR0_LO(%a6)
- lea FP_SCR0(%a6),%a1
- bra.w fcmp_norm
-
-fcmp_dnrm_sd:
- mov.w DST_EX(%a1),FP_SCR1_EX(%a6)
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l DST_HI(%a1),%d0
- bset &31,%d0 # DENORM dst; make into small norm
- mov.l %d0,FP_SCR1_HI(%a6)
- mov.l SRC_HI(%a0),%d0
- bset &31,%d0 # DENORM dst; make into small norm
- mov.l %d0,FP_SCR0_HI(%a6)
- mov.l DST_LO(%a1),FP_SCR1_LO(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- lea FP_SCR1(%a6),%a1
- lea FP_SCR0(%a6),%a0
- bra.w fcmp_norm
-
-fcmp_nrm_dnrm:
- mov.b SRC_EX(%a0),%d0 # determine if like signs
- mov.b DST_EX(%a1),%d1
- eor.b %d0,%d1
- bmi.w fcmp_dnrm_s
-
-# signs are the same, so must determine the answer ourselves.
- tst.b %d0 # is src op negative?
- bmi.b fcmp_nrm_dnrm_m # yes
- rts
-fcmp_nrm_dnrm_m:
- mov.b &neg_bmask,FPSR_CC(%a6) # set 'Z' ccode bit
- rts
-
-fcmp_dnrm_nrm:
- mov.b SRC_EX(%a0),%d0 # determine if like signs
- mov.b DST_EX(%a1),%d1
- eor.b %d0,%d1
- bmi.w fcmp_dnrm_d
-
-# signs are the same, so must determine the answer ourselves.
- tst.b %d0 # is src op negative?
- bpl.b fcmp_dnrm_nrm_m # no
- rts
-fcmp_dnrm_nrm_m:
- mov.b &neg_bmask,FPSR_CC(%a6) # set 'Z' ccode bit
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# fsglmul(): emulates the fsglmul instruction #
-# #
-# XREF **************************************************************** #
-# scale_to_zero_src() - scale src exponent to zero #
-# scale_to_zero_dst() - scale dst exponent to zero #
-# unf_res4() - return default underflow result for sglop #
-# ovf_res() - return default overflow result #
-# res_qnan() - return QNAN result #
-# res_snan() - return SNAN result #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# a1 = pointer to extended precision destination operand #
-# d0 rnd prec,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = result #
-# fp1 = EXOP (if exception occurred) #
-# #
-# ALGORITHM *********************************************************** #
-# Handle NANs, infinities, and zeroes as special cases. Divide #
-# norms/denorms into ext/sgl/dbl precision. #
-# For norms/denorms, scale the exponents such that a multiply #
-# instruction won't cause an exception. Use the regular fsglmul to #
-# compute a result. Check if the regular operands would have taken #
-# an exception. If so, return the default overflow/underflow result #
-# and return the EXOP if exceptions are enabled. Else, scale the #
-# result operand to the proper exponent. #
-# #
-#########################################################################
-
- global fsglmul
-fsglmul:
- mov.l %d0,L_SCR3(%a6) # store rnd info
-
- clr.w %d1
- mov.b DTAG(%a6),%d1
- lsl.b &0x3,%d1
- or.b STAG(%a6),%d1
-
- bne.w fsglmul_not_norm # optimize on non-norm input
-
-fsglmul_norm:
- mov.w DST_EX(%a1),FP_SCR1_EX(%a6)
- mov.l DST_HI(%a1),FP_SCR1_HI(%a6)
- mov.l DST_LO(%a1),FP_SCR1_LO(%a6)
-
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
-
- bsr.l scale_to_zero_src # scale exponent
- mov.l %d0,-(%sp) # save scale factor 1
-
- bsr.l scale_to_zero_dst # scale dst exponent
-
- add.l (%sp)+,%d0 # SCALE_FACTOR = scale1 + scale2
-
- cmpi.l %d0,&0x3fff-0x7ffe # would result ovfl?
- beq.w fsglmul_may_ovfl # result may rnd to overflow
- blt.w fsglmul_ovfl # result will overflow
-
- cmpi.l %d0,&0x3fff+0x0001 # would result unfl?
- beq.w fsglmul_may_unfl # result may rnd to no unfl
- bgt.w fsglmul_unfl # result will underflow
-
-fsglmul_normal:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsglmul.x FP_SCR0(%a6),%fp0 # execute sgl multiply
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-fsglmul_normal_exit:
- fmovm.x &0x80,FP_SCR0(%a6) # store out result
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # load {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- or.w %d2,%d1 # concat old sign,new exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x80 # return result in fp0
- rts
-
-fsglmul_ovfl:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsglmul.x FP_SCR0(%a6),%fp0 # execute sgl multiply
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-fsglmul_ovfl_tst:
-
-# save setting this until now because this is where fsglmul_may_ovfl may jump in
- or.l &ovfl_inx_mask, USER_FPSR(%a6) # set ovfl/aovfl/ainex
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x13,%d1 # is OVFL or INEX enabled?
- bne.b fsglmul_ovfl_ena # yes
-
-fsglmul_ovfl_dis:
- btst &neg_bit,FPSR_CC(%a6) # is result negative?
- sne %d1 # set sign param accordingly
- mov.l L_SCR3(%a6),%d0 # pass prec:rnd
- andi.b &0x30,%d0 # force prec = ext
- bsr.l ovf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # set INF,N if applicable
- fmovm.x (%a0),&0x80 # return default result in fp0
- rts
-
-fsglmul_ovfl_ena:
- fmovm.x &0x80,FP_SCR0(%a6) # move result to stack
-
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # fetch {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- sub.l %d0,%d1 # add scale factor
- subi.l &0x6000,%d1 # subtract bias
- andi.w &0x7fff,%d1
- andi.w &0x8000,%d2 # keep old sign
- or.w %d2,%d1 # concat old sign,new exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- bra.b fsglmul_ovfl_dis
-
-fsglmul_may_ovfl:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsglmul.x FP_SCR0(%a6),%fp0 # execute sgl multiply
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
- fabs.x %fp0,%fp1 # make a copy of result
- fcmp.b %fp1,&0x2 # is |result| >= 2.b?
- fbge.w fsglmul_ovfl_tst # yes; overflow has occurred
-
-# no, it didn't overflow; we have correct result
- bra.w fsglmul_normal_exit
-
-fsglmul_unfl:
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
-
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l &rz_mode*0x10,%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsglmul.x FP_SCR0(%a6),%fp0 # execute sgl multiply
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x0b,%d1 # is UNFL or INEX enabled?
- bne.b fsglmul_unfl_ena # yes
-
-fsglmul_unfl_dis:
- fmovm.x &0x80,FP_SCR0(%a6) # store out result
-
- lea FP_SCR0(%a6),%a0 # pass: result addr
- mov.l L_SCR3(%a6),%d1 # pass: rnd prec,mode
- bsr.l unf_res4 # calculate default result
- or.b %d0,FPSR_CC(%a6) # 'Z' bit may have been set
- fmovm.x FP_SCR0(%a6),&0x80 # return default result in fp0
- rts
-
-#
-# UNFL is enabled.
-#
-fsglmul_unfl_ena:
- fmovm.x FP_SCR1(%a6),&0x40 # load dst op
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsglmul.x FP_SCR0(%a6),%fp1 # execute sgl multiply
-
- fmov.l &0x0,%fpcr # clear FPCR
-
- fmovm.x &0x40,FP_SCR0(%a6) # save result to stack
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # fetch {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- addi.l &0x6000,%d1 # add bias
- andi.w &0x7fff,%d1
- or.w %d2,%d1 # concat old sign,new exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- bra.w fsglmul_unfl_dis
-
-fsglmul_may_unfl:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsglmul.x FP_SCR0(%a6),%fp0 # execute sgl multiply
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
- fabs.x %fp0,%fp1 # make a copy of result
- fcmp.b %fp1,&0x2 # is |result| > 2.b?
- fbgt.w fsglmul_normal_exit # no; no underflow occurred
- fblt.w fsglmul_unfl # yes; underflow occurred
-
-#
-# we still don't know if underflow occurred. result is ~ equal to 2. but,
-# we don't know if the result was an underflow that rounded up to a 2 or
-# a normalized number that rounded down to a 2. so, redo the entire operation
-# using RZ as the rounding mode to see what the pre-rounded result is.
-# this case should be relatively rare.
-#
- fmovm.x FP_SCR1(%a6),&0x40 # load dst op into fp1
-
- mov.l L_SCR3(%a6),%d1
- andi.b &0xc0,%d1 # keep rnd prec
- ori.b &rz_mode*0x10,%d1 # insert RZ
-
- fmov.l %d1,%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsglmul.x FP_SCR0(%a6),%fp1 # execute sgl multiply
-
- fmov.l &0x0,%fpcr # clear FPCR
- fabs.x %fp1 # make absolute value
- fcmp.b %fp1,&0x2 # is |result| < 2.b?
- fbge.w fsglmul_normal_exit # no; no underflow occurred
- bra.w fsglmul_unfl # yes, underflow occurred
-
-##############################################################################
-
-#
-# Single Precision Multiply: inputs are not both normalized; what are they?
-#
-fsglmul_not_norm:
- mov.w (tbl_fsglmul_op.b,%pc,%d1.w*2),%d1
- jmp (tbl_fsglmul_op.b,%pc,%d1.w*1)
-
- swbeg &48
-tbl_fsglmul_op:
- short fsglmul_norm - tbl_fsglmul_op # NORM x NORM
- short fsglmul_zero - tbl_fsglmul_op # NORM x ZERO
- short fsglmul_inf_src - tbl_fsglmul_op # NORM x INF
- short fsglmul_res_qnan - tbl_fsglmul_op # NORM x QNAN
- short fsglmul_norm - tbl_fsglmul_op # NORM x DENORM
- short fsglmul_res_snan - tbl_fsglmul_op # NORM x SNAN
- short tbl_fsglmul_op - tbl_fsglmul_op #
- short tbl_fsglmul_op - tbl_fsglmul_op #
-
- short fsglmul_zero - tbl_fsglmul_op # ZERO x NORM
- short fsglmul_zero - tbl_fsglmul_op # ZERO x ZERO
- short fsglmul_res_operr - tbl_fsglmul_op # ZERO x INF
- short fsglmul_res_qnan - tbl_fsglmul_op # ZERO x QNAN
- short fsglmul_zero - tbl_fsglmul_op # ZERO x DENORM
- short fsglmul_res_snan - tbl_fsglmul_op # ZERO x SNAN
- short tbl_fsglmul_op - tbl_fsglmul_op #
- short tbl_fsglmul_op - tbl_fsglmul_op #
-
- short fsglmul_inf_dst - tbl_fsglmul_op # INF x NORM
- short fsglmul_res_operr - tbl_fsglmul_op # INF x ZERO
- short fsglmul_inf_dst - tbl_fsglmul_op # INF x INF
- short fsglmul_res_qnan - tbl_fsglmul_op # INF x QNAN
- short fsglmul_inf_dst - tbl_fsglmul_op # INF x DENORM
- short fsglmul_res_snan - tbl_fsglmul_op # INF x SNAN
- short tbl_fsglmul_op - tbl_fsglmul_op #
- short tbl_fsglmul_op - tbl_fsglmul_op #
-
- short fsglmul_res_qnan - tbl_fsglmul_op # QNAN x NORM
- short fsglmul_res_qnan - tbl_fsglmul_op # QNAN x ZERO
- short fsglmul_res_qnan - tbl_fsglmul_op # QNAN x INF
- short fsglmul_res_qnan - tbl_fsglmul_op # QNAN x QNAN
- short fsglmul_res_qnan - tbl_fsglmul_op # QNAN x DENORM
- short fsglmul_res_snan - tbl_fsglmul_op # QNAN x SNAN
- short tbl_fsglmul_op - tbl_fsglmul_op #
- short tbl_fsglmul_op - tbl_fsglmul_op #
-
- short fsglmul_norm - tbl_fsglmul_op # NORM x NORM
- short fsglmul_zero - tbl_fsglmul_op # NORM x ZERO
- short fsglmul_inf_src - tbl_fsglmul_op # NORM x INF
- short fsglmul_res_qnan - tbl_fsglmul_op # NORM x QNAN
- short fsglmul_norm - tbl_fsglmul_op # NORM x DENORM
- short fsglmul_res_snan - tbl_fsglmul_op # NORM x SNAN
- short tbl_fsglmul_op - tbl_fsglmul_op #
- short tbl_fsglmul_op - tbl_fsglmul_op #
-
- short fsglmul_res_snan - tbl_fsglmul_op # SNAN x NORM
- short fsglmul_res_snan - tbl_fsglmul_op # SNAN x ZERO
- short fsglmul_res_snan - tbl_fsglmul_op # SNAN x INF
- short fsglmul_res_snan - tbl_fsglmul_op # SNAN x QNAN
- short fsglmul_res_snan - tbl_fsglmul_op # SNAN x DENORM
- short fsglmul_res_snan - tbl_fsglmul_op # SNAN x SNAN
- short tbl_fsglmul_op - tbl_fsglmul_op #
- short tbl_fsglmul_op - tbl_fsglmul_op #
-
-fsglmul_res_operr:
- bra.l res_operr
-fsglmul_res_snan:
- bra.l res_snan
-fsglmul_res_qnan:
- bra.l res_qnan
-fsglmul_zero:
- bra.l fmul_zero
-fsglmul_inf_src:
- bra.l fmul_inf_src
-fsglmul_inf_dst:
- bra.l fmul_inf_dst
-
-#########################################################################
-# XDEF **************************************************************** #
-# fsgldiv(): emulates the fsgldiv instruction #
-# #
-# XREF **************************************************************** #
-# scale_to_zero_src() - scale src exponent to zero #
-# scale_to_zero_dst() - scale dst exponent to zero #
-# unf_res4() - return default underflow result for sglop #
-# ovf_res() - return default overflow result #
-# res_qnan() - return QNAN result #
-# res_snan() - return SNAN result #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# a1 = pointer to extended precision destination operand #
-# d0 rnd prec,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = result #
-# fp1 = EXOP (if exception occurred) #
-# #
-# ALGORITHM *********************************************************** #
-# Handle NANs, infinities, and zeroes as special cases. Divide #
-# norms/denorms into ext/sgl/dbl precision. #
-# For norms/denorms, scale the exponents such that a divide #
-# instruction won't cause an exception. Use the regular fsgldiv to #
-# compute a result. Check if the regular operands would have taken #
-# an exception. If so, return the default overflow/underflow result #
-# and return the EXOP if exceptions are enabled. Else, scale the #
-# result operand to the proper exponent. #
-# #
-#########################################################################
-
- global fsgldiv
-fsgldiv:
- mov.l %d0,L_SCR3(%a6) # store rnd info
-
- clr.w %d1
- mov.b DTAG(%a6),%d1
- lsl.b &0x3,%d1
- or.b STAG(%a6),%d1 # combine src tags
-
- bne.w fsgldiv_not_norm # optimize on non-norm input
-
-#
-# DIVIDE: NORMs and DENORMs ONLY!
-#
-fsgldiv_norm:
- mov.w DST_EX(%a1),FP_SCR1_EX(%a6)
- mov.l DST_HI(%a1),FP_SCR1_HI(%a6)
- mov.l DST_LO(%a1),FP_SCR1_LO(%a6)
-
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
-
- bsr.l scale_to_zero_src # calculate scale factor 1
- mov.l %d0,-(%sp) # save scale factor 1
-
- bsr.l scale_to_zero_dst # calculate scale factor 2
-
- neg.l (%sp) # S.F. = scale1 - scale2
- add.l %d0,(%sp)
-
- mov.w 2+L_SCR3(%a6),%d1 # fetch precision,mode
- lsr.b &0x6,%d1
- mov.l (%sp)+,%d0
- cmpi.l %d0,&0x3fff-0x7ffe
- ble.w fsgldiv_may_ovfl
-
- cmpi.l %d0,&0x3fff-0x0000 # will result underflow?
- beq.w fsgldiv_may_unfl # maybe
- bgt.w fsgldiv_unfl # yes; go handle underflow
-
-fsgldiv_normal:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l L_SCR3(%a6),%fpcr # save FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsgldiv.x FP_SCR0(%a6),%fp0 # perform sgl divide
-
- fmov.l %fpsr,%d1 # save FPSR
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-fsgldiv_normal_exit:
- fmovm.x &0x80,FP_SCR0(%a6) # store result on stack
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # load {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- or.w %d2,%d1 # concat old sign,new exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x80 # return result in fp0
- rts
-
-fsgldiv_may_ovfl:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # set FPSR
-
- fsgldiv.x FP_SCR0(%a6),%fp0 # execute divide
-
- fmov.l %fpsr,%d1
- fmov.l &0x0,%fpcr
-
- or.l %d1,USER_FPSR(%a6) # save INEX,N
-
- fmovm.x &0x01,-(%sp) # save result to stack
- mov.w (%sp),%d1 # fetch new exponent
- add.l &0xc,%sp # clear result
- andi.l &0x7fff,%d1 # strip sign
- sub.l %d0,%d1 # add scale factor
- cmp.l %d1,&0x7fff # did divide overflow?
- blt.b fsgldiv_normal_exit
-
-fsgldiv_ovfl_tst:
- or.w &ovfl_inx_mask,2+USER_FPSR(%a6) # set ovfl/aovfl/ainex
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x13,%d1 # is OVFL or INEX enabled?
- bne.b fsgldiv_ovfl_ena # yes
-
-fsgldiv_ovfl_dis:
- btst &neg_bit,FPSR_CC(%a6) # is result negative
- sne %d1 # set sign param accordingly
- mov.l L_SCR3(%a6),%d0 # pass prec:rnd
- andi.b &0x30,%d0 # kill precision
- bsr.l ovf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # set INF if applicable
- fmovm.x (%a0),&0x80 # return default result in fp0
- rts
-
-fsgldiv_ovfl_ena:
- fmovm.x &0x80,FP_SCR0(%a6) # move result to stack
-
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # fetch {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- subi.l &0x6000,%d1 # subtract new bias
- andi.w &0x7fff,%d1 # clear ms bit
- or.w %d2,%d1 # concat old sign,new exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- bra.b fsgldiv_ovfl_dis
-
-fsgldiv_unfl:
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
-
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l &rz_mode*0x10,%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsgldiv.x FP_SCR0(%a6),%fp0 # execute sgl divide
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x0b,%d1 # is UNFL or INEX enabled?
- bne.b fsgldiv_unfl_ena # yes
-
-fsgldiv_unfl_dis:
- fmovm.x &0x80,FP_SCR0(%a6) # store out result
-
- lea FP_SCR0(%a6),%a0 # pass: result addr
- mov.l L_SCR3(%a6),%d1 # pass: rnd prec,mode
- bsr.l unf_res4 # calculate default result
- or.b %d0,FPSR_CC(%a6) # 'Z' bit may have been set
- fmovm.x FP_SCR0(%a6),&0x80 # return default result in fp0
- rts
-
-#
-# UNFL is enabled.
-#
-fsgldiv_unfl_ena:
- fmovm.x FP_SCR1(%a6),&0x40 # load dst op
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsgldiv.x FP_SCR0(%a6),%fp1 # execute sgl divide
-
- fmov.l &0x0,%fpcr # clear FPCR
-
- fmovm.x &0x40,FP_SCR0(%a6) # save result to stack
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # fetch {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- addi.l &0x6000,%d1 # add bias
- andi.w &0x7fff,%d1 # clear top bit
- or.w %d2,%d1 # concat old sign, new exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- bra.b fsgldiv_unfl_dis
-
-#
-# the divide operation MAY underflow:
-#
-fsgldiv_may_unfl:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsgldiv.x FP_SCR0(%a6),%fp0 # execute sgl divide
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
- fabs.x %fp0,%fp1 # make a copy of result
- fcmp.b %fp1,&0x1 # is |result| > 1.b?
- fbgt.w fsgldiv_normal_exit # no; no underflow occurred
- fblt.w fsgldiv_unfl # yes; underflow occurred
-
-#
-# we still don't know if underflow occurred. result is ~ equal to 1. but,
-# we don't know if the result was an underflow that rounded up to a 1
-# or a normalized number that rounded down to a 1. so, redo the entire
-# operation using RZ as the rounding mode to see what the pre-rounded
-# result is. this case should be relatively rare.
-#
- fmovm.x FP_SCR1(%a6),&0x40 # load dst op into %fp1
-
- clr.l %d1 # clear scratch register
- ori.b &rz_mode*0x10,%d1 # force RZ rnd mode
-
- fmov.l %d1,%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsgldiv.x FP_SCR0(%a6),%fp1 # execute sgl divide
-
- fmov.l &0x0,%fpcr # clear FPCR
- fabs.x %fp1 # make absolute value
- fcmp.b %fp1,&0x1 # is |result| < 1.b?
- fbge.w fsgldiv_normal_exit # no; no underflow occurred
- bra.w fsgldiv_unfl # yes; underflow occurred
-
-############################################################################
-
-#
-# Divide: inputs are not both normalized; what are they?
-#
-fsgldiv_not_norm:
- mov.w (tbl_fsgldiv_op.b,%pc,%d1.w*2),%d1
- jmp (tbl_fsgldiv_op.b,%pc,%d1.w*1)
-
- swbeg &48
-tbl_fsgldiv_op:
- short fsgldiv_norm - tbl_fsgldiv_op # NORM / NORM
- short fsgldiv_inf_load - tbl_fsgldiv_op # NORM / ZERO
- short fsgldiv_zero_load - tbl_fsgldiv_op # NORM / INF
- short fsgldiv_res_qnan - tbl_fsgldiv_op # NORM / QNAN
- short fsgldiv_norm - tbl_fsgldiv_op # NORM / DENORM
- short fsgldiv_res_snan - tbl_fsgldiv_op # NORM / SNAN
- short tbl_fsgldiv_op - tbl_fsgldiv_op #
- short tbl_fsgldiv_op - tbl_fsgldiv_op #
-
- short fsgldiv_zero_load - tbl_fsgldiv_op # ZERO / NORM
- short fsgldiv_res_operr - tbl_fsgldiv_op # ZERO / ZERO
- short fsgldiv_zero_load - tbl_fsgldiv_op # ZERO / INF
- short fsgldiv_res_qnan - tbl_fsgldiv_op # ZERO / QNAN
- short fsgldiv_zero_load - tbl_fsgldiv_op # ZERO / DENORM
- short fsgldiv_res_snan - tbl_fsgldiv_op # ZERO / SNAN
- short tbl_fsgldiv_op - tbl_fsgldiv_op #
- short tbl_fsgldiv_op - tbl_fsgldiv_op #
-
- short fsgldiv_inf_dst - tbl_fsgldiv_op # INF / NORM
- short fsgldiv_inf_dst - tbl_fsgldiv_op # INF / ZERO
- short fsgldiv_res_operr - tbl_fsgldiv_op # INF / INF
- short fsgldiv_res_qnan - tbl_fsgldiv_op # INF / QNAN
- short fsgldiv_inf_dst - tbl_fsgldiv_op # INF / DENORM
- short fsgldiv_res_snan - tbl_fsgldiv_op # INF / SNAN
- short tbl_fsgldiv_op - tbl_fsgldiv_op #
- short tbl_fsgldiv_op - tbl_fsgldiv_op #
-
- short fsgldiv_res_qnan - tbl_fsgldiv_op # QNAN / NORM
- short fsgldiv_res_qnan - tbl_fsgldiv_op # QNAN / ZERO
- short fsgldiv_res_qnan - tbl_fsgldiv_op # QNAN / INF
- short fsgldiv_res_qnan - tbl_fsgldiv_op # QNAN / QNAN
- short fsgldiv_res_qnan - tbl_fsgldiv_op # QNAN / DENORM
- short fsgldiv_res_snan - tbl_fsgldiv_op # QNAN / SNAN
- short tbl_fsgldiv_op - tbl_fsgldiv_op #
- short tbl_fsgldiv_op - tbl_fsgldiv_op #
-
- short fsgldiv_norm - tbl_fsgldiv_op # DENORM / NORM
- short fsgldiv_inf_load - tbl_fsgldiv_op # DENORM / ZERO
- short fsgldiv_zero_load - tbl_fsgldiv_op # DENORM / INF
- short fsgldiv_res_qnan - tbl_fsgldiv_op # DENORM / QNAN
- short fsgldiv_norm - tbl_fsgldiv_op # DENORM / DENORM
- short fsgldiv_res_snan - tbl_fsgldiv_op # DENORM / SNAN
- short tbl_fsgldiv_op - tbl_fsgldiv_op #
- short tbl_fsgldiv_op - tbl_fsgldiv_op #
-
- short fsgldiv_res_snan - tbl_fsgldiv_op # SNAN / NORM
- short fsgldiv_res_snan - tbl_fsgldiv_op # SNAN / ZERO
- short fsgldiv_res_snan - tbl_fsgldiv_op # SNAN / INF
- short fsgldiv_res_snan - tbl_fsgldiv_op # SNAN / QNAN
- short fsgldiv_res_snan - tbl_fsgldiv_op # SNAN / DENORM
- short fsgldiv_res_snan - tbl_fsgldiv_op # SNAN / SNAN
- short tbl_fsgldiv_op - tbl_fsgldiv_op #
- short tbl_fsgldiv_op - tbl_fsgldiv_op #
-
-fsgldiv_res_qnan:
- bra.l res_qnan
-fsgldiv_res_snan:
- bra.l res_snan
-fsgldiv_res_operr:
- bra.l res_operr
-fsgldiv_inf_load:
- bra.l fdiv_inf_load
-fsgldiv_zero_load:
- bra.l fdiv_zero_load
-fsgldiv_inf_dst:
- bra.l fdiv_inf_dst
-
-#########################################################################
-# XDEF **************************************************************** #
-# fadd(): emulates the fadd instruction #
-# fsadd(): emulates the fadd instruction #
-# fdadd(): emulates the fdadd instruction #
-# #
-# XREF **************************************************************** #
-# addsub_scaler2() - scale the operands so they won't take exc #
-# ovf_res() - return default overflow result #
-# unf_res() - return default underflow result #
-# res_qnan() - set QNAN result #
-# res_snan() - set SNAN result #
-# res_operr() - set OPERR result #
-# scale_to_zero_src() - set src operand exponent equal to zero #
-# scale_to_zero_dst() - set dst operand exponent equal to zero #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# a1 = pointer to extended precision destination operand #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = result #
-# fp1 = EXOP (if exception occurred) #
-# #
-# ALGORITHM *********************************************************** #
-# Handle NANs, infinities, and zeroes as special cases. Divide #
-# norms into extended, single, and double precision. #
-# Do addition after scaling exponents such that exception won't #
-# occur. Then, check result exponent to see if exception would have #
-# occurred. If so, return default result and maybe EXOP. Else, insert #
-# the correct result exponent and return. Set FPSR bits as appropriate. #
-# #
-#########################################################################
-
- global fsadd
-fsadd:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &s_mode*0x10,%d0 # insert sgl prec
- bra.b fadd
-
- global fdadd
-fdadd:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &d_mode*0x10,%d0 # insert dbl prec
-
- global fadd
-fadd:
- mov.l %d0,L_SCR3(%a6) # store rnd info
-
- clr.w %d1
- mov.b DTAG(%a6),%d1
- lsl.b &0x3,%d1
- or.b STAG(%a6),%d1 # combine src tags
-
- bne.w fadd_not_norm # optimize on non-norm input
-
-#
-# ADD: norms and denorms
-#
-fadd_norm:
- bsr.l addsub_scaler2 # scale exponents
-
-fadd_zero_entry:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l &0x0,%fpsr # clear FPSR
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fadd.x FP_SCR0(%a6),%fp0 # execute add
-
- fmov.l &0x0,%fpcr # clear FPCR
- fmov.l %fpsr,%d1 # fetch INEX2,N,Z
-
- or.l %d1,USER_FPSR(%a6) # save exc and ccode bits
-
- fbeq.w fadd_zero_exit # if result is zero, end now
-
- mov.l %d2,-(%sp) # save d2
-
- fmovm.x &0x01,-(%sp) # save result to stack
-
- mov.w 2+L_SCR3(%a6),%d1
- lsr.b &0x6,%d1
-
- mov.w (%sp),%d2 # fetch new sign, exp
- andi.l &0x7fff,%d2 # strip sign
- sub.l %d0,%d2 # add scale factor
-
- cmp.l %d2,(tbl_fadd_ovfl.b,%pc,%d1.w*4) # is it an overflow?
- bge.b fadd_ovfl # yes
-
- cmp.l %d2,(tbl_fadd_unfl.b,%pc,%d1.w*4) # is it an underflow?
- blt.w fadd_unfl # yes
- beq.w fadd_may_unfl # maybe; go find out
-
-fadd_normal:
- mov.w (%sp),%d1
- andi.w &0x8000,%d1 # keep sign
- or.w %d2,%d1 # concat sign,new exp
- mov.w %d1,(%sp) # insert new exponent
-
- fmovm.x (%sp)+,&0x80 # return result in fp0
-
- mov.l (%sp)+,%d2 # restore d2
- rts
-
-fadd_zero_exit:
-# fmov.s &0x00000000,%fp0 # return zero in fp0
- rts
-
-tbl_fadd_ovfl:
- long 0x7fff # ext ovfl
- long 0x407f # sgl ovfl
- long 0x43ff # dbl ovfl
-
-tbl_fadd_unfl:
- long 0x0000 # ext unfl
- long 0x3f81 # sgl unfl
- long 0x3c01 # dbl unfl
-
-fadd_ovfl:
- or.l &ovfl_inx_mask,USER_FPSR(%a6) # set ovfl/aovfl/ainex
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x13,%d1 # is OVFL or INEX enabled?
- bne.b fadd_ovfl_ena # yes
-
- add.l &0xc,%sp
-fadd_ovfl_dis:
- btst &neg_bit,FPSR_CC(%a6) # is result negative?
- sne %d1 # set sign param accordingly
- mov.l L_SCR3(%a6),%d0 # pass prec:rnd
- bsr.l ovf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # set INF,N if applicable
- fmovm.x (%a0),&0x80 # return default result in fp0
- mov.l (%sp)+,%d2 # restore d2
- rts
-
-fadd_ovfl_ena:
- mov.b L_SCR3(%a6),%d1
- andi.b &0xc0,%d1 # is precision extended?
- bne.b fadd_ovfl_ena_sd # no; prec = sgl or dbl
-
-fadd_ovfl_ena_cont:
- mov.w (%sp),%d1
- andi.w &0x8000,%d1 # keep sign
- subi.l &0x6000,%d2 # add extra bias
- andi.w &0x7fff,%d2
- or.w %d2,%d1 # concat sign,new exp
- mov.w %d1,(%sp) # insert new exponent
-
- fmovm.x (%sp)+,&0x40 # return EXOP in fp1
- bra.b fadd_ovfl_dis
-
-fadd_ovfl_ena_sd:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- mov.l L_SCR3(%a6),%d1
- andi.b &0x30,%d1 # keep rnd mode
- fmov.l %d1,%fpcr # set FPCR
-
- fadd.x FP_SCR0(%a6),%fp0 # execute add
-
- fmov.l &0x0,%fpcr # clear FPCR
-
- add.l &0xc,%sp
- fmovm.x &0x01,-(%sp)
- bra.b fadd_ovfl_ena_cont
-
-fadd_unfl:
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
-
- add.l &0xc,%sp
-
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l &rz_mode*0x10,%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fadd.x FP_SCR0(%a6),%fp0 # execute add
-
- fmov.l &0x0,%fpcr # clear FPCR
- fmov.l %fpsr,%d1 # save status
-
- or.l %d1,USER_FPSR(%a6) # save INEX,N
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x0b,%d1 # is UNFL or INEX enabled?
- bne.b fadd_unfl_ena # yes
-
-fadd_unfl_dis:
- fmovm.x &0x80,FP_SCR0(%a6) # store out result
-
- lea FP_SCR0(%a6),%a0 # pass: result addr
- mov.l L_SCR3(%a6),%d1 # pass: rnd prec,mode
- bsr.l unf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # 'Z' bit may have been set
- fmovm.x FP_SCR0(%a6),&0x80 # return default result in fp0
- mov.l (%sp)+,%d2 # restore d2
- rts
-
-fadd_unfl_ena:
- fmovm.x FP_SCR1(%a6),&0x40 # load dst op
-
- mov.l L_SCR3(%a6),%d1
- andi.b &0xc0,%d1 # is precision extended?
- bne.b fadd_unfl_ena_sd # no; sgl or dbl
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
-fadd_unfl_ena_cont:
- fmov.l &0x0,%fpsr # clear FPSR
-
- fadd.x FP_SCR0(%a6),%fp1 # execute multiply
-
- fmov.l &0x0,%fpcr # clear FPCR
-
- fmovm.x &0x40,FP_SCR0(%a6) # save result to stack
- mov.w FP_SCR0_EX(%a6),%d1 # fetch {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- addi.l &0x6000,%d1 # add new bias
- andi.w &0x7fff,%d1 # clear top bit
- or.w %d2,%d1 # concat sign,new exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- bra.w fadd_unfl_dis
-
-fadd_unfl_ena_sd:
- mov.l L_SCR3(%a6),%d1
- andi.b &0x30,%d1 # use only rnd mode
- fmov.l %d1,%fpcr # set FPCR
-
- bra.b fadd_unfl_ena_cont
-
-#
-# result is equal to the smallest normalized number in the selected precision
-# if the precision is extended, this result could not have come from an
-# underflow that rounded up.
-#
-fadd_may_unfl:
- mov.l L_SCR3(%a6),%d1
- andi.b &0xc0,%d1
- beq.w fadd_normal # yes; no underflow occurred
-
- mov.l 0x4(%sp),%d1 # extract hi(man)
- cmpi.l %d1,&0x80000000 # is hi(man) = 0x80000000?
- bne.w fadd_normal # no; no underflow occurred
-
- tst.l 0x8(%sp) # is lo(man) = 0x0?
- bne.w fadd_normal # no; no underflow occurred
-
- btst &inex2_bit,FPSR_EXCEPT(%a6) # is INEX2 set?
- beq.w fadd_normal # no; no underflow occurred
-
-#
-# ok, so now the result has a exponent equal to the smallest normalized
-# exponent for the selected precision. also, the mantissa is equal to
-# 0x8000000000000000 and this mantissa is the result of rounding non-zero
-# g,r,s.
-# now, we must determine whether the pre-rounded result was an underflow
-# rounded "up" or a normalized number rounded "down".
-# so, we do this be re-executing the add using RZ as the rounding mode and
-# seeing if the new result is smaller or equal to the current result.
-#
- fmovm.x FP_SCR1(%a6),&0x40 # load dst op into fp1
-
- mov.l L_SCR3(%a6),%d1
- andi.b &0xc0,%d1 # keep rnd prec
- ori.b &rz_mode*0x10,%d1 # insert rnd mode
- fmov.l %d1,%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fadd.x FP_SCR0(%a6),%fp1 # execute add
-
- fmov.l &0x0,%fpcr # clear FPCR
-
- fabs.x %fp0 # compare absolute values
- fabs.x %fp1
- fcmp.x %fp0,%fp1 # is first result > second?
-
- fbgt.w fadd_unfl # yes; it's an underflow
- bra.w fadd_normal # no; it's not an underflow
-
-##########################################################################
-
-#
-# Add: inputs are not both normalized; what are they?
-#
-fadd_not_norm:
- mov.w (tbl_fadd_op.b,%pc,%d1.w*2),%d1
- jmp (tbl_fadd_op.b,%pc,%d1.w*1)
-
- swbeg &48
-tbl_fadd_op:
- short fadd_norm - tbl_fadd_op # NORM + NORM
- short fadd_zero_src - tbl_fadd_op # NORM + ZERO
- short fadd_inf_src - tbl_fadd_op # NORM + INF
- short fadd_res_qnan - tbl_fadd_op # NORM + QNAN
- short fadd_norm - tbl_fadd_op # NORM + DENORM
- short fadd_res_snan - tbl_fadd_op # NORM + SNAN
- short tbl_fadd_op - tbl_fadd_op #
- short tbl_fadd_op - tbl_fadd_op #
-
- short fadd_zero_dst - tbl_fadd_op # ZERO + NORM
- short fadd_zero_2 - tbl_fadd_op # ZERO + ZERO
- short fadd_inf_src - tbl_fadd_op # ZERO + INF
- short fadd_res_qnan - tbl_fadd_op # NORM + QNAN
- short fadd_zero_dst - tbl_fadd_op # ZERO + DENORM
- short fadd_res_snan - tbl_fadd_op # NORM + SNAN
- short tbl_fadd_op - tbl_fadd_op #
- short tbl_fadd_op - tbl_fadd_op #
-
- short fadd_inf_dst - tbl_fadd_op # INF + NORM
- short fadd_inf_dst - tbl_fadd_op # INF + ZERO
- short fadd_inf_2 - tbl_fadd_op # INF + INF
- short fadd_res_qnan - tbl_fadd_op # NORM + QNAN
- short fadd_inf_dst - tbl_fadd_op # INF + DENORM
- short fadd_res_snan - tbl_fadd_op # NORM + SNAN
- short tbl_fadd_op - tbl_fadd_op #
- short tbl_fadd_op - tbl_fadd_op #
-
- short fadd_res_qnan - tbl_fadd_op # QNAN + NORM
- short fadd_res_qnan - tbl_fadd_op # QNAN + ZERO
- short fadd_res_qnan - tbl_fadd_op # QNAN + INF
- short fadd_res_qnan - tbl_fadd_op # QNAN + QNAN
- short fadd_res_qnan - tbl_fadd_op # QNAN + DENORM
- short fadd_res_snan - tbl_fadd_op # QNAN + SNAN
- short tbl_fadd_op - tbl_fadd_op #
- short tbl_fadd_op - tbl_fadd_op #
-
- short fadd_norm - tbl_fadd_op # DENORM + NORM
- short fadd_zero_src - tbl_fadd_op # DENORM + ZERO
- short fadd_inf_src - tbl_fadd_op # DENORM + INF
- short fadd_res_qnan - tbl_fadd_op # NORM + QNAN
- short fadd_norm - tbl_fadd_op # DENORM + DENORM
- short fadd_res_snan - tbl_fadd_op # NORM + SNAN
- short tbl_fadd_op - tbl_fadd_op #
- short tbl_fadd_op - tbl_fadd_op #
-
- short fadd_res_snan - tbl_fadd_op # SNAN + NORM
- short fadd_res_snan - tbl_fadd_op # SNAN + ZERO
- short fadd_res_snan - tbl_fadd_op # SNAN + INF
- short fadd_res_snan - tbl_fadd_op # SNAN + QNAN
- short fadd_res_snan - tbl_fadd_op # SNAN + DENORM
- short fadd_res_snan - tbl_fadd_op # SNAN + SNAN
- short tbl_fadd_op - tbl_fadd_op #
- short tbl_fadd_op - tbl_fadd_op #
-
-fadd_res_qnan:
- bra.l res_qnan
-fadd_res_snan:
- bra.l res_snan
-
-#
-# both operands are ZEROes
-#
-fadd_zero_2:
- mov.b SRC_EX(%a0),%d0 # are the signs opposite
- mov.b DST_EX(%a1),%d1
- eor.b %d0,%d1
- bmi.w fadd_zero_2_chk_rm # weed out (-ZERO)+(+ZERO)
-
-# the signs are the same. so determine whether they are positive or negative
-# and return the appropriately signed zero.
- tst.b %d0 # are ZEROes positive or negative?
- bmi.b fadd_zero_rm # negative
- fmov.s &0x00000000,%fp0 # return +ZERO
- mov.b &z_bmask,FPSR_CC(%a6) # set Z
- rts
-
-#
-# the ZEROes have opposite signs:
-# - therefore, we return +ZERO if the rounding modes are RN,RZ, or RP.
-# - -ZERO is returned in the case of RM.
-#
-fadd_zero_2_chk_rm:
- mov.b 3+L_SCR3(%a6),%d1
- andi.b &0x30,%d1 # extract rnd mode
- cmpi.b %d1,&rm_mode*0x10 # is rnd mode == RM?
- beq.b fadd_zero_rm # yes
- fmov.s &0x00000000,%fp0 # return +ZERO
- mov.b &z_bmask,FPSR_CC(%a6) # set Z
- rts
-
-fadd_zero_rm:
- fmov.s &0x80000000,%fp0 # return -ZERO
- mov.b &neg_bmask+z_bmask,FPSR_CC(%a6) # set NEG/Z
- rts
-
-#
-# one operand is a ZERO and the other is a DENORM or NORM. scale
-# the DENORM or NORM and jump to the regular fadd routine.
-#
-fadd_zero_dst:
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- bsr.l scale_to_zero_src # scale the operand
- clr.w FP_SCR1_EX(%a6)
- clr.l FP_SCR1_HI(%a6)
- clr.l FP_SCR1_LO(%a6)
- bra.w fadd_zero_entry # go execute fadd
-
-fadd_zero_src:
- mov.w DST_EX(%a1),FP_SCR1_EX(%a6)
- mov.l DST_HI(%a1),FP_SCR1_HI(%a6)
- mov.l DST_LO(%a1),FP_SCR1_LO(%a6)
- bsr.l scale_to_zero_dst # scale the operand
- clr.w FP_SCR0_EX(%a6)
- clr.l FP_SCR0_HI(%a6)
- clr.l FP_SCR0_LO(%a6)
- bra.w fadd_zero_entry # go execute fadd
-
-#
-# both operands are INFs. an OPERR will result if the INFs have
-# different signs. else, an INF of the same sign is returned
-#
-fadd_inf_2:
- mov.b SRC_EX(%a0),%d0 # exclusive or the signs
- mov.b DST_EX(%a1),%d1
- eor.b %d1,%d0
- bmi.l res_operr # weed out (-INF)+(+INF)
-
-# ok, so it's not an OPERR. but, we do have to remember to return the
-# src INF since that's where the 881/882 gets the j-bit from...
-
-#
-# operands are INF and one of {ZERO, INF, DENORM, NORM}
-#
-fadd_inf_src:
- fmovm.x SRC(%a0),&0x80 # return src INF
- tst.b SRC_EX(%a0) # is INF positive?
- bpl.b fadd_inf_done # yes; we're done
- mov.b &neg_bmask+inf_bmask,FPSR_CC(%a6) # set INF/NEG
- rts
-
-#
-# operands are INF and one of {ZERO, INF, DENORM, NORM}
-#
-fadd_inf_dst:
- fmovm.x DST(%a1),&0x80 # return dst INF
- tst.b DST_EX(%a1) # is INF positive?
- bpl.b fadd_inf_done # yes; we're done
- mov.b &neg_bmask+inf_bmask,FPSR_CC(%a6) # set INF/NEG
- rts
-
-fadd_inf_done:
- mov.b &inf_bmask,FPSR_CC(%a6) # set INF
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# fsub(): emulates the fsub instruction #
-# fssub(): emulates the fssub instruction #
-# fdsub(): emulates the fdsub instruction #
-# #
-# XREF **************************************************************** #
-# addsub_scaler2() - scale the operands so they won't take exc #
-# ovf_res() - return default overflow result #
-# unf_res() - return default underflow result #
-# res_qnan() - set QNAN result #
-# res_snan() - set SNAN result #
-# res_operr() - set OPERR result #
-# scale_to_zero_src() - set src operand exponent equal to zero #
-# scale_to_zero_dst() - set dst operand exponent equal to zero #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# a1 = pointer to extended precision destination operand #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = result #
-# fp1 = EXOP (if exception occurred) #
-# #
-# ALGORITHM *********************************************************** #
-# Handle NANs, infinities, and zeroes as special cases. Divide #
-# norms into extended, single, and double precision. #
-# Do subtraction after scaling exponents such that exception won't#
-# occur. Then, check result exponent to see if exception would have #
-# occurred. If so, return default result and maybe EXOP. Else, insert #
-# the correct result exponent and return. Set FPSR bits as appropriate. #
-# #
-#########################################################################
-
- global fssub
-fssub:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &s_mode*0x10,%d0 # insert sgl prec
- bra.b fsub
-
- global fdsub
-fdsub:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &d_mode*0x10,%d0 # insert dbl prec
-
- global fsub
-fsub:
- mov.l %d0,L_SCR3(%a6) # store rnd info
-
- clr.w %d1
- mov.b DTAG(%a6),%d1
- lsl.b &0x3,%d1
- or.b STAG(%a6),%d1 # combine src tags
-
- bne.w fsub_not_norm # optimize on non-norm input
-
-#
-# SUB: norms and denorms
-#
-fsub_norm:
- bsr.l addsub_scaler2 # scale exponents
-
-fsub_zero_entry:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l &0x0,%fpsr # clear FPSR
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fsub.x FP_SCR0(%a6),%fp0 # execute subtract
-
- fmov.l &0x0,%fpcr # clear FPCR
- fmov.l %fpsr,%d1 # fetch INEX2, N, Z
-
- or.l %d1,USER_FPSR(%a6) # save exc and ccode bits
-
- fbeq.w fsub_zero_exit # if result zero, end now
-
- mov.l %d2,-(%sp) # save d2
-
- fmovm.x &0x01,-(%sp) # save result to stack
-
- mov.w 2+L_SCR3(%a6),%d1
- lsr.b &0x6,%d1
-
- mov.w (%sp),%d2 # fetch new exponent
- andi.l &0x7fff,%d2 # strip sign
- sub.l %d0,%d2 # add scale factor
-
- cmp.l %d2,(tbl_fsub_ovfl.b,%pc,%d1.w*4) # is it an overflow?
- bge.b fsub_ovfl # yes
-
- cmp.l %d2,(tbl_fsub_unfl.b,%pc,%d1.w*4) # is it an underflow?
- blt.w fsub_unfl # yes
- beq.w fsub_may_unfl # maybe; go find out
-
-fsub_normal:
- mov.w (%sp),%d1
- andi.w &0x8000,%d1 # keep sign
- or.w %d2,%d1 # insert new exponent
- mov.w %d1,(%sp) # insert new exponent
-
- fmovm.x (%sp)+,&0x80 # return result in fp0
-
- mov.l (%sp)+,%d2 # restore d2
- rts
-
-fsub_zero_exit:
-# fmov.s &0x00000000,%fp0 # return zero in fp0
- rts
-
-tbl_fsub_ovfl:
- long 0x7fff # ext ovfl
- long 0x407f # sgl ovfl
- long 0x43ff # dbl ovfl
-
-tbl_fsub_unfl:
- long 0x0000 # ext unfl
- long 0x3f81 # sgl unfl
- long 0x3c01 # dbl unfl
-
-fsub_ovfl:
- or.l &ovfl_inx_mask,USER_FPSR(%a6) # set ovfl/aovfl/ainex
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x13,%d1 # is OVFL or INEX enabled?
- bne.b fsub_ovfl_ena # yes
-
- add.l &0xc,%sp
-fsub_ovfl_dis:
- btst &neg_bit,FPSR_CC(%a6) # is result negative?
- sne %d1 # set sign param accordingly
- mov.l L_SCR3(%a6),%d0 # pass prec:rnd
- bsr.l ovf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # set INF,N if applicable
- fmovm.x (%a0),&0x80 # return default result in fp0
- mov.l (%sp)+,%d2 # restore d2
- rts
-
-fsub_ovfl_ena:
- mov.b L_SCR3(%a6),%d1
- andi.b &0xc0,%d1 # is precision extended?
- bne.b fsub_ovfl_ena_sd # no
-
-fsub_ovfl_ena_cont:
- mov.w (%sp),%d1 # fetch {sgn,exp}
- andi.w &0x8000,%d1 # keep sign
- subi.l &0x6000,%d2 # subtract new bias
- andi.w &0x7fff,%d2 # clear top bit
- or.w %d2,%d1 # concat sign,exp
- mov.w %d1,(%sp) # insert new exponent
-
- fmovm.x (%sp)+,&0x40 # return EXOP in fp1
- bra.b fsub_ovfl_dis
-
-fsub_ovfl_ena_sd:
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- mov.l L_SCR3(%a6),%d1
- andi.b &0x30,%d1 # clear rnd prec
- fmov.l %d1,%fpcr # set FPCR
-
- fsub.x FP_SCR0(%a6),%fp0 # execute subtract
-
- fmov.l &0x0,%fpcr # clear FPCR
-
- add.l &0xc,%sp
- fmovm.x &0x01,-(%sp)
- bra.b fsub_ovfl_ena_cont
-
-fsub_unfl:
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
-
- add.l &0xc,%sp
-
- fmovm.x FP_SCR1(%a6),&0x80 # load dst op
-
- fmov.l &rz_mode*0x10,%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsub.x FP_SCR0(%a6),%fp0 # execute subtract
-
- fmov.l &0x0,%fpcr # clear FPCR
- fmov.l %fpsr,%d1 # save status
-
- or.l %d1,USER_FPSR(%a6)
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x0b,%d1 # is UNFL or INEX enabled?
- bne.b fsub_unfl_ena # yes
-
-fsub_unfl_dis:
- fmovm.x &0x80,FP_SCR0(%a6) # store out result
-
- lea FP_SCR0(%a6),%a0 # pass: result addr
- mov.l L_SCR3(%a6),%d1 # pass: rnd prec,mode
- bsr.l unf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # 'Z' may have been set
- fmovm.x FP_SCR0(%a6),&0x80 # return default result in fp0
- mov.l (%sp)+,%d2 # restore d2
- rts
-
-fsub_unfl_ena:
- fmovm.x FP_SCR1(%a6),&0x40
-
- mov.l L_SCR3(%a6),%d1
- andi.b &0xc0,%d1 # is precision extended?
- bne.b fsub_unfl_ena_sd # no
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
-fsub_unfl_ena_cont:
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsub.x FP_SCR0(%a6),%fp1 # execute subtract
-
- fmov.l &0x0,%fpcr # clear FPCR
-
- fmovm.x &0x40,FP_SCR0(%a6) # store result to stack
- mov.w FP_SCR0_EX(%a6),%d1 # fetch {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- addi.l &0x6000,%d1 # subtract new bias
- andi.w &0x7fff,%d1 # clear top bit
- or.w %d2,%d1 # concat sgn,exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- bra.w fsub_unfl_dis
-
-fsub_unfl_ena_sd:
- mov.l L_SCR3(%a6),%d1
- andi.b &0x30,%d1 # clear rnd prec
- fmov.l %d1,%fpcr # set FPCR
-
- bra.b fsub_unfl_ena_cont
-
-#
-# result is equal to the smallest normalized number in the selected precision
-# if the precision is extended, this result could not have come from an
-# underflow that rounded up.
-#
-fsub_may_unfl:
- mov.l L_SCR3(%a6),%d1
- andi.b &0xc0,%d1 # fetch rnd prec
- beq.w fsub_normal # yes; no underflow occurred
-
- mov.l 0x4(%sp),%d1
- cmpi.l %d1,&0x80000000 # is hi(man) = 0x80000000?
- bne.w fsub_normal # no; no underflow occurred
-
- tst.l 0x8(%sp) # is lo(man) = 0x0?
- bne.w fsub_normal # no; no underflow occurred
-
- btst &inex2_bit,FPSR_EXCEPT(%a6) # is INEX2 set?
- beq.w fsub_normal # no; no underflow occurred
-
-#
-# ok, so now the result has a exponent equal to the smallest normalized
-# exponent for the selected precision. also, the mantissa is equal to
-# 0x8000000000000000 and this mantissa is the result of rounding non-zero
-# g,r,s.
-# now, we must determine whether the pre-rounded result was an underflow
-# rounded "up" or a normalized number rounded "down".
-# so, we do this be re-executing the add using RZ as the rounding mode and
-# seeing if the new result is smaller or equal to the current result.
-#
- fmovm.x FP_SCR1(%a6),&0x40 # load dst op into fp1
-
- mov.l L_SCR3(%a6),%d1
- andi.b &0xc0,%d1 # keep rnd prec
- ori.b &rz_mode*0x10,%d1 # insert rnd mode
- fmov.l %d1,%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsub.x FP_SCR0(%a6),%fp1 # execute subtract
-
- fmov.l &0x0,%fpcr # clear FPCR
-
- fabs.x %fp0 # compare absolute values
- fabs.x %fp1
- fcmp.x %fp0,%fp1 # is first result > second?
-
- fbgt.w fsub_unfl # yes; it's an underflow
- bra.w fsub_normal # no; it's not an underflow
-
-##########################################################################
-
-#
-# Sub: inputs are not both normalized; what are they?
-#
-fsub_not_norm:
- mov.w (tbl_fsub_op.b,%pc,%d1.w*2),%d1
- jmp (tbl_fsub_op.b,%pc,%d1.w*1)
-
- swbeg &48
-tbl_fsub_op:
- short fsub_norm - tbl_fsub_op # NORM - NORM
- short fsub_zero_src - tbl_fsub_op # NORM - ZERO
- short fsub_inf_src - tbl_fsub_op # NORM - INF
- short fsub_res_qnan - tbl_fsub_op # NORM - QNAN
- short fsub_norm - tbl_fsub_op # NORM - DENORM
- short fsub_res_snan - tbl_fsub_op # NORM - SNAN
- short tbl_fsub_op - tbl_fsub_op #
- short tbl_fsub_op - tbl_fsub_op #
-
- short fsub_zero_dst - tbl_fsub_op # ZERO - NORM
- short fsub_zero_2 - tbl_fsub_op # ZERO - ZERO
- short fsub_inf_src - tbl_fsub_op # ZERO - INF
- short fsub_res_qnan - tbl_fsub_op # NORM - QNAN
- short fsub_zero_dst - tbl_fsub_op # ZERO - DENORM
- short fsub_res_snan - tbl_fsub_op # NORM - SNAN
- short tbl_fsub_op - tbl_fsub_op #
- short tbl_fsub_op - tbl_fsub_op #
-
- short fsub_inf_dst - tbl_fsub_op # INF - NORM
- short fsub_inf_dst - tbl_fsub_op # INF - ZERO
- short fsub_inf_2 - tbl_fsub_op # INF - INF
- short fsub_res_qnan - tbl_fsub_op # NORM - QNAN
- short fsub_inf_dst - tbl_fsub_op # INF - DENORM
- short fsub_res_snan - tbl_fsub_op # NORM - SNAN
- short tbl_fsub_op - tbl_fsub_op #
- short tbl_fsub_op - tbl_fsub_op #
-
- short fsub_res_qnan - tbl_fsub_op # QNAN - NORM
- short fsub_res_qnan - tbl_fsub_op # QNAN - ZERO
- short fsub_res_qnan - tbl_fsub_op # QNAN - INF
- short fsub_res_qnan - tbl_fsub_op # QNAN - QNAN
- short fsub_res_qnan - tbl_fsub_op # QNAN - DENORM
- short fsub_res_snan - tbl_fsub_op # QNAN - SNAN
- short tbl_fsub_op - tbl_fsub_op #
- short tbl_fsub_op - tbl_fsub_op #
-
- short fsub_norm - tbl_fsub_op # DENORM - NORM
- short fsub_zero_src - tbl_fsub_op # DENORM - ZERO
- short fsub_inf_src - tbl_fsub_op # DENORM - INF
- short fsub_res_qnan - tbl_fsub_op # NORM - QNAN
- short fsub_norm - tbl_fsub_op # DENORM - DENORM
- short fsub_res_snan - tbl_fsub_op # NORM - SNAN
- short tbl_fsub_op - tbl_fsub_op #
- short tbl_fsub_op - tbl_fsub_op #
-
- short fsub_res_snan - tbl_fsub_op # SNAN - NORM
- short fsub_res_snan - tbl_fsub_op # SNAN - ZERO
- short fsub_res_snan - tbl_fsub_op # SNAN - INF
- short fsub_res_snan - tbl_fsub_op # SNAN - QNAN
- short fsub_res_snan - tbl_fsub_op # SNAN - DENORM
- short fsub_res_snan - tbl_fsub_op # SNAN - SNAN
- short tbl_fsub_op - tbl_fsub_op #
- short tbl_fsub_op - tbl_fsub_op #
-
-fsub_res_qnan:
- bra.l res_qnan
-fsub_res_snan:
- bra.l res_snan
-
-#
-# both operands are ZEROes
-#
-fsub_zero_2:
- mov.b SRC_EX(%a0),%d0
- mov.b DST_EX(%a1),%d1
- eor.b %d1,%d0
- bpl.b fsub_zero_2_chk_rm
-
-# the signs are opposite, so, return a ZERO w/ the sign of the dst ZERO
- tst.b %d0 # is dst negative?
- bmi.b fsub_zero_2_rm # yes
- fmov.s &0x00000000,%fp0 # no; return +ZERO
- mov.b &z_bmask,FPSR_CC(%a6) # set Z
- rts
-
-#
-# the ZEROes have the same signs:
-# - therefore, we return +ZERO if the rounding mode is RN,RZ, or RP
-# - -ZERO is returned in the case of RM.
-#
-fsub_zero_2_chk_rm:
- mov.b 3+L_SCR3(%a6),%d1
- andi.b &0x30,%d1 # extract rnd mode
- cmpi.b %d1,&rm_mode*0x10 # is rnd mode = RM?
- beq.b fsub_zero_2_rm # yes
- fmov.s &0x00000000,%fp0 # no; return +ZERO
- mov.b &z_bmask,FPSR_CC(%a6) # set Z
- rts
-
-fsub_zero_2_rm:
- fmov.s &0x80000000,%fp0 # return -ZERO
- mov.b &z_bmask+neg_bmask,FPSR_CC(%a6) # set Z/NEG
- rts
-
-#
-# one operand is a ZERO and the other is a DENORM or a NORM.
-# scale the DENORM or NORM and jump to the regular fsub routine.
-#
-fsub_zero_dst:
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
- bsr.l scale_to_zero_src # scale the operand
- clr.w FP_SCR1_EX(%a6)
- clr.l FP_SCR1_HI(%a6)
- clr.l FP_SCR1_LO(%a6)
- bra.w fsub_zero_entry # go execute fsub
-
-fsub_zero_src:
- mov.w DST_EX(%a1),FP_SCR1_EX(%a6)
- mov.l DST_HI(%a1),FP_SCR1_HI(%a6)
- mov.l DST_LO(%a1),FP_SCR1_LO(%a6)
- bsr.l scale_to_zero_dst # scale the operand
- clr.w FP_SCR0_EX(%a6)
- clr.l FP_SCR0_HI(%a6)
- clr.l FP_SCR0_LO(%a6)
- bra.w fsub_zero_entry # go execute fsub
-
-#
-# both operands are INFs. an OPERR will result if the INFs have the
-# same signs. else,
-#
-fsub_inf_2:
- mov.b SRC_EX(%a0),%d0 # exclusive or the signs
- mov.b DST_EX(%a1),%d1
- eor.b %d1,%d0
- bpl.l res_operr # weed out (-INF)+(+INF)
-
-# ok, so it's not an OPERR. but we do have to remember to return
-# the src INF since that's where the 881/882 gets the j-bit.
-
-fsub_inf_src:
- fmovm.x SRC(%a0),&0x80 # return src INF
- fneg.x %fp0 # invert sign
- fbge.w fsub_inf_done # sign is now positive
- mov.b &neg_bmask+inf_bmask,FPSR_CC(%a6) # set INF/NEG
- rts
-
-fsub_inf_dst:
- fmovm.x DST(%a1),&0x80 # return dst INF
- tst.b DST_EX(%a1) # is INF negative?
- bpl.b fsub_inf_done # no
- mov.b &neg_bmask+inf_bmask,FPSR_CC(%a6) # set INF/NEG
- rts
-
-fsub_inf_done:
- mov.b &inf_bmask,FPSR_CC(%a6) # set INF
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# fsqrt(): emulates the fsqrt instruction #
-# fssqrt(): emulates the fssqrt instruction #
-# fdsqrt(): emulates the fdsqrt instruction #
-# #
-# XREF **************************************************************** #
-# scale_sqrt() - scale the source operand #
-# unf_res() - return default underflow result #
-# ovf_res() - return default overflow result #
-# res_qnan_1op() - return QNAN result #
-# res_snan_1op() - return SNAN result #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to extended precision source operand #
-# d0 rnd prec,mode #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = result #
-# fp1 = EXOP (if exception occurred) #
-# #
-# ALGORITHM *********************************************************** #
-# Handle NANs, infinities, and zeroes as special cases. Divide #
-# norms/denorms into ext/sgl/dbl precision. #
-# For norms/denorms, scale the exponents such that a sqrt #
-# instruction won't cause an exception. Use the regular fsqrt to #
-# compute a result. Check if the regular operands would have taken #
-# an exception. If so, return the default overflow/underflow result #
-# and return the EXOP if exceptions are enabled. Else, scale the #
-# result operand to the proper exponent. #
-# #
-#########################################################################
-
- global fssqrt
-fssqrt:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &s_mode*0x10,%d0 # insert sgl precision
- bra.b fsqrt
-
- global fdsqrt
-fdsqrt:
- andi.b &0x30,%d0 # clear rnd prec
- ori.b &d_mode*0x10,%d0 # insert dbl precision
-
- global fsqrt
-fsqrt:
- mov.l %d0,L_SCR3(%a6) # store rnd info
- clr.w %d1
- mov.b STAG(%a6),%d1
- bne.w fsqrt_not_norm # optimize on non-norm input
-
-#
-# SQUARE ROOT: norms and denorms ONLY!
-#
-fsqrt_norm:
- tst.b SRC_EX(%a0) # is operand negative?
- bmi.l res_operr # yes
-
- andi.b &0xc0,%d0 # is precision extended?
- bne.b fsqrt_not_ext # no; go handle sgl or dbl
-
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsqrt.x (%a0),%fp0 # execute square root
-
- fmov.l %fpsr,%d1
- or.l %d1,USER_FPSR(%a6) # set N,INEX
-
- rts
-
-fsqrt_denorm:
- tst.b SRC_EX(%a0) # is operand negative?
- bmi.l res_operr # yes
-
- andi.b &0xc0,%d0 # is precision extended?
- bne.b fsqrt_not_ext # no; go handle sgl or dbl
-
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
-
- bsr.l scale_sqrt # calculate scale factor
-
- bra.w fsqrt_sd_normal
-
-#
-# operand is either single or double
-#
-fsqrt_not_ext:
- cmpi.b %d0,&s_mode*0x10 # separate sgl/dbl prec
- bne.w fsqrt_dbl
-
-#
-# operand is to be rounded to single precision
-#
-fsqrt_sgl:
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
-
- bsr.l scale_sqrt # calculate scale factor
-
- cmpi.l %d0,&0x3fff-0x3f81 # will move in underflow?
- beq.w fsqrt_sd_may_unfl
- bgt.w fsqrt_sd_unfl # yes; go handle underflow
- cmpi.l %d0,&0x3fff-0x407f # will move in overflow?
- beq.w fsqrt_sd_may_ovfl # maybe; go check
- blt.w fsqrt_sd_ovfl # yes; go handle overflow
-
-#
-# operand will NOT overflow or underflow when moved in to the fp reg file
-#
-fsqrt_sd_normal:
- fmov.l &0x0,%fpsr # clear FPSR
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fsqrt.x FP_SCR0(%a6),%fp0 # perform absolute
-
- fmov.l %fpsr,%d1 # save FPSR
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-fsqrt_sd_normal_exit:
- mov.l %d2,-(%sp) # save d2
- fmovm.x &0x80,FP_SCR0(%a6) # store out result
- mov.w FP_SCR0_EX(%a6),%d1 # load sgn,exp
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- sub.l %d0,%d1 # add scale factor
- andi.w &0x8000,%d2 # keep old sign
- or.w %d1,%d2 # concat old sign,new exp
- mov.w %d2,FP_SCR0_EX(%a6) # insert new exponent
- mov.l (%sp)+,%d2 # restore d2
- fmovm.x FP_SCR0(%a6),&0x80 # return result in fp0
- rts
-
-#
-# operand is to be rounded to double precision
-#
-fsqrt_dbl:
- mov.w SRC_EX(%a0),FP_SCR0_EX(%a6)
- mov.l SRC_HI(%a0),FP_SCR0_HI(%a6)
- mov.l SRC_LO(%a0),FP_SCR0_LO(%a6)
-
- bsr.l scale_sqrt # calculate scale factor
-
- cmpi.l %d0,&0x3fff-0x3c01 # will move in underflow?
- beq.w fsqrt_sd_may_unfl
- bgt.b fsqrt_sd_unfl # yes; go handle underflow
- cmpi.l %d0,&0x3fff-0x43ff # will move in overflow?
- beq.w fsqrt_sd_may_ovfl # maybe; go check
- blt.w fsqrt_sd_ovfl # yes; go handle overflow
- bra.w fsqrt_sd_normal # no; ho handle normalized op
-
-# we're on the line here and the distinguishing characteristic is whether
-# the exponent is 3fff or 3ffe. if it's 3ffe, then it's a safe number
-# elsewise fall through to underflow.
-fsqrt_sd_may_unfl:
- btst &0x0,1+FP_SCR0_EX(%a6) # is exponent 0x3fff?
- bne.w fsqrt_sd_normal # yes, so no underflow
-
-#
-# operand WILL underflow when moved in to the fp register file
-#
-fsqrt_sd_unfl:
- bset &unfl_bit,FPSR_EXCEPT(%a6) # set unfl exc bit
-
- fmov.l &rz_mode*0x10,%fpcr # set FPCR
- fmov.l &0x0,%fpsr # clear FPSR
-
- fsqrt.x FP_SCR0(%a6),%fp0 # execute square root
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-# if underflow or inexact is enabled, go calculate EXOP first.
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x0b,%d1 # is UNFL or INEX enabled?
- bne.b fsqrt_sd_unfl_ena # yes
-
-fsqrt_sd_unfl_dis:
- fmovm.x &0x80,FP_SCR0(%a6) # store out result
-
- lea FP_SCR0(%a6),%a0 # pass: result addr
- mov.l L_SCR3(%a6),%d1 # pass: rnd prec,mode
- bsr.l unf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # set possible 'Z' ccode
- fmovm.x FP_SCR0(%a6),&0x80 # return default result in fp0
- rts
-
-#
-# operand will underflow AND underflow is enabled.
-# therefore, we must return the result rounded to extended precision.
-#
-fsqrt_sd_unfl_ena:
- mov.l FP_SCR0_HI(%a6),FP_SCR1_HI(%a6)
- mov.l FP_SCR0_LO(%a6),FP_SCR1_LO(%a6)
- mov.w FP_SCR0_EX(%a6),%d1 # load current exponent
-
- mov.l %d2,-(%sp) # save d2
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # subtract scale factor
- addi.l &0x6000,%d1 # add new bias
- andi.w &0x7fff,%d1
- or.w %d2,%d1 # concat new sign,new exp
- mov.w %d1,FP_SCR1_EX(%a6) # insert new exp
- fmovm.x FP_SCR1(%a6),&0x40 # return EXOP in fp1
- mov.l (%sp)+,%d2 # restore d2
- bra.b fsqrt_sd_unfl_dis
-
-#
-# operand WILL overflow.
-#
-fsqrt_sd_ovfl:
- fmov.l &0x0,%fpsr # clear FPSR
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fsqrt.x FP_SCR0(%a6),%fp0 # perform square root
-
- fmov.l &0x0,%fpcr # clear FPCR
- fmov.l %fpsr,%d1 # save FPSR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
-fsqrt_sd_ovfl_tst:
- or.l &ovfl_inx_mask,USER_FPSR(%a6) # set ovfl/aovfl/ainex
-
- mov.b FPCR_ENABLE(%a6),%d1
- andi.b &0x13,%d1 # is OVFL or INEX enabled?
- bne.b fsqrt_sd_ovfl_ena # yes
-
-#
-# OVFL is not enabled; therefore, we must create the default result by
-# calling ovf_res().
-#
-fsqrt_sd_ovfl_dis:
- btst &neg_bit,FPSR_CC(%a6) # is result negative?
- sne %d1 # set sign param accordingly
- mov.l L_SCR3(%a6),%d0 # pass: prec,mode
- bsr.l ovf_res # calculate default result
- or.b %d0,FPSR_CC(%a6) # set INF,N if applicable
- fmovm.x (%a0),&0x80 # return default result in fp0
- rts
-
-#
-# OVFL is enabled.
-# the INEX2 bit has already been updated by the round to the correct precision.
-# now, round to extended(and don't alter the FPSR).
-#
-fsqrt_sd_ovfl_ena:
- mov.l %d2,-(%sp) # save d2
- mov.w FP_SCR0_EX(%a6),%d1 # fetch {sgn,exp}
- mov.l %d1,%d2 # make a copy
- andi.l &0x7fff,%d1 # strip sign
- andi.w &0x8000,%d2 # keep old sign
- sub.l %d0,%d1 # add scale factor
- subi.l &0x6000,%d1 # subtract bias
- andi.w &0x7fff,%d1
- or.w %d2,%d1 # concat sign,exp
- mov.w %d1,FP_SCR0_EX(%a6) # insert new exponent
- fmovm.x FP_SCR0(%a6),&0x40 # return EXOP in fp1
- mov.l (%sp)+,%d2 # restore d2
- bra.b fsqrt_sd_ovfl_dis
-
-#
-# the move in MAY underflow. so...
-#
-fsqrt_sd_may_ovfl:
- btst &0x0,1+FP_SCR0_EX(%a6) # is exponent 0x3fff?
- bne.w fsqrt_sd_ovfl # yes, so overflow
-
- fmov.l &0x0,%fpsr # clear FPSR
- fmov.l L_SCR3(%a6),%fpcr # set FPCR
-
- fsqrt.x FP_SCR0(%a6),%fp0 # perform absolute
-
- fmov.l %fpsr,%d1 # save status
- fmov.l &0x0,%fpcr # clear FPCR
-
- or.l %d1,USER_FPSR(%a6) # save INEX2,N
-
- fmov.x %fp0,%fp1 # make a copy of result
- fcmp.b %fp1,&0x1 # is |result| >= 1.b?
- fbge.w fsqrt_sd_ovfl_tst # yes; overflow has occurred
-
-# no, it didn't overflow; we have correct result
- bra.w fsqrt_sd_normal_exit
-
-##########################################################################
-
-#
-# input is not normalized; what is it?
-#
-fsqrt_not_norm:
- cmpi.b %d1,&DENORM # weed out DENORM
- beq.w fsqrt_denorm
- cmpi.b %d1,&ZERO # weed out ZERO
- beq.b fsqrt_zero
- cmpi.b %d1,&INF # weed out INF
- beq.b fsqrt_inf
- cmpi.b %d1,&SNAN # weed out SNAN
- beq.l res_snan_1op
- bra.l res_qnan_1op
-
-#
-# fsqrt(+0) = +0
-# fsqrt(-0) = -0
-# fsqrt(+INF) = +INF
-# fsqrt(-INF) = OPERR
-#
-fsqrt_zero:
- tst.b SRC_EX(%a0) # is ZERO positive or negative?
- bmi.b fsqrt_zero_m # negative
-fsqrt_zero_p:
- fmov.s &0x00000000,%fp0 # return +ZERO
- mov.b &z_bmask,FPSR_CC(%a6) # set 'Z' ccode bit
- rts
-fsqrt_zero_m:
- fmov.s &0x80000000,%fp0 # return -ZERO
- mov.b &z_bmask+neg_bmask,FPSR_CC(%a6) # set 'Z','N' ccode bits
- rts
-
-fsqrt_inf:
- tst.b SRC_EX(%a0) # is INF positive or negative?
- bmi.l res_operr # negative
-fsqrt_inf_p:
- fmovm.x SRC(%a0),&0x80 # return +INF in fp0
- mov.b &inf_bmask,FPSR_CC(%a6) # set 'I' ccode bit
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# fetch_dreg(): fetch register according to index in d1 #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# d1 = index of register to fetch from #
-# #
-# OUTPUT ************************************************************** #
-# d0 = value of register fetched #
-# #
-# ALGORITHM *********************************************************** #
-# According to the index value in d1 which can range from zero #
-# to fifteen, load the corresponding register file value (where #
-# address register indexes start at 8). D0/D1/A0/A1/A6/A7 are on the #
-# stack. The rest should still be in their original places. #
-# #
-#########################################################################
-
-# this routine leaves d1 intact for subsequent store_dreg calls.
- global fetch_dreg
-fetch_dreg:
- mov.w (tbl_fdreg.b,%pc,%d1.w*2),%d0
- jmp (tbl_fdreg.b,%pc,%d0.w*1)
-
-tbl_fdreg:
- short fdreg0 - tbl_fdreg
- short fdreg1 - tbl_fdreg
- short fdreg2 - tbl_fdreg
- short fdreg3 - tbl_fdreg
- short fdreg4 - tbl_fdreg
- short fdreg5 - tbl_fdreg
- short fdreg6 - tbl_fdreg
- short fdreg7 - tbl_fdreg
- short fdreg8 - tbl_fdreg
- short fdreg9 - tbl_fdreg
- short fdrega - tbl_fdreg
- short fdregb - tbl_fdreg
- short fdregc - tbl_fdreg
- short fdregd - tbl_fdreg
- short fdrege - tbl_fdreg
- short fdregf - tbl_fdreg
-
-fdreg0:
- mov.l EXC_DREGS+0x0(%a6),%d0
- rts
-fdreg1:
- mov.l EXC_DREGS+0x4(%a6),%d0
- rts
-fdreg2:
- mov.l %d2,%d0
- rts
-fdreg3:
- mov.l %d3,%d0
- rts
-fdreg4:
- mov.l %d4,%d0
- rts
-fdreg5:
- mov.l %d5,%d0
- rts
-fdreg6:
- mov.l %d6,%d0
- rts
-fdreg7:
- mov.l %d7,%d0
- rts
-fdreg8:
- mov.l EXC_DREGS+0x8(%a6),%d0
- rts
-fdreg9:
- mov.l EXC_DREGS+0xc(%a6),%d0
- rts
-fdrega:
- mov.l %a2,%d0
- rts
-fdregb:
- mov.l %a3,%d0
- rts
-fdregc:
- mov.l %a4,%d0
- rts
-fdregd:
- mov.l %a5,%d0
- rts
-fdrege:
- mov.l (%a6),%d0
- rts
-fdregf:
- mov.l EXC_A7(%a6),%d0
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# store_dreg_l(): store longword to data register specified by d1 #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# d0 = longowrd value to store #
-# d1 = index of register to fetch from #
-# #
-# OUTPUT ************************************************************** #
-# (data register is updated) #
-# #
-# ALGORITHM *********************************************************** #
-# According to the index value in d1, store the longword value #
-# in d0 to the corresponding data register. D0/D1 are on the stack #
-# while the rest are in their initial places. #
-# #
-#########################################################################
-
- global store_dreg_l
-store_dreg_l:
- mov.w (tbl_sdregl.b,%pc,%d1.w*2),%d1
- jmp (tbl_sdregl.b,%pc,%d1.w*1)
-
-tbl_sdregl:
- short sdregl0 - tbl_sdregl
- short sdregl1 - tbl_sdregl
- short sdregl2 - tbl_sdregl
- short sdregl3 - tbl_sdregl
- short sdregl4 - tbl_sdregl
- short sdregl5 - tbl_sdregl
- short sdregl6 - tbl_sdregl
- short sdregl7 - tbl_sdregl
-
-sdregl0:
- mov.l %d0,EXC_DREGS+0x0(%a6)
- rts
-sdregl1:
- mov.l %d0,EXC_DREGS+0x4(%a6)
- rts
-sdregl2:
- mov.l %d0,%d2
- rts
-sdregl3:
- mov.l %d0,%d3
- rts
-sdregl4:
- mov.l %d0,%d4
- rts
-sdregl5:
- mov.l %d0,%d5
- rts
-sdregl6:
- mov.l %d0,%d6
- rts
-sdregl7:
- mov.l %d0,%d7
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# store_dreg_w(): store word to data register specified by d1 #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# d0 = word value to store #
-# d1 = index of register to fetch from #
-# #
-# OUTPUT ************************************************************** #
-# (data register is updated) #
-# #
-# ALGORITHM *********************************************************** #
-# According to the index value in d1, store the word value #
-# in d0 to the corresponding data register. D0/D1 are on the stack #
-# while the rest are in their initial places. #
-# #
-#########################################################################
-
- global store_dreg_w
-store_dreg_w:
- mov.w (tbl_sdregw.b,%pc,%d1.w*2),%d1
- jmp (tbl_sdregw.b,%pc,%d1.w*1)
-
-tbl_sdregw:
- short sdregw0 - tbl_sdregw
- short sdregw1 - tbl_sdregw
- short sdregw2 - tbl_sdregw
- short sdregw3 - tbl_sdregw
- short sdregw4 - tbl_sdregw
- short sdregw5 - tbl_sdregw
- short sdregw6 - tbl_sdregw
- short sdregw7 - tbl_sdregw
-
-sdregw0:
- mov.w %d0,2+EXC_DREGS+0x0(%a6)
- rts
-sdregw1:
- mov.w %d0,2+EXC_DREGS+0x4(%a6)
- rts
-sdregw2:
- mov.w %d0,%d2
- rts
-sdregw3:
- mov.w %d0,%d3
- rts
-sdregw4:
- mov.w %d0,%d4
- rts
-sdregw5:
- mov.w %d0,%d5
- rts
-sdregw6:
- mov.w %d0,%d6
- rts
-sdregw7:
- mov.w %d0,%d7
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# store_dreg_b(): store byte to data register specified by d1 #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# d0 = byte value to store #
-# d1 = index of register to fetch from #
-# #
-# OUTPUT ************************************************************** #
-# (data register is updated) #
-# #
-# ALGORITHM *********************************************************** #
-# According to the index value in d1, store the byte value #
-# in d0 to the corresponding data register. D0/D1 are on the stack #
-# while the rest are in their initial places. #
-# #
-#########################################################################
-
- global store_dreg_b
-store_dreg_b:
- mov.w (tbl_sdregb.b,%pc,%d1.w*2),%d1
- jmp (tbl_sdregb.b,%pc,%d1.w*1)
-
-tbl_sdregb:
- short sdregb0 - tbl_sdregb
- short sdregb1 - tbl_sdregb
- short sdregb2 - tbl_sdregb
- short sdregb3 - tbl_sdregb
- short sdregb4 - tbl_sdregb
- short sdregb5 - tbl_sdregb
- short sdregb6 - tbl_sdregb
- short sdregb7 - tbl_sdregb
-
-sdregb0:
- mov.b %d0,3+EXC_DREGS+0x0(%a6)
- rts
-sdregb1:
- mov.b %d0,3+EXC_DREGS+0x4(%a6)
- rts
-sdregb2:
- mov.b %d0,%d2
- rts
-sdregb3:
- mov.b %d0,%d3
- rts
-sdregb4:
- mov.b %d0,%d4
- rts
-sdregb5:
- mov.b %d0,%d5
- rts
-sdregb6:
- mov.b %d0,%d6
- rts
-sdregb7:
- mov.b %d0,%d7
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# inc_areg(): increment an address register by the value in d0 #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# d0 = amount to increment by #
-# d1 = index of address register to increment #
-# #
-# OUTPUT ************************************************************** #
-# (address register is updated) #
-# #
-# ALGORITHM *********************************************************** #
-# Typically used for an instruction w/ a post-increment <ea>, #
-# this routine adds the increment value in d0 to the address register #
-# specified by d1. A0/A1/A6/A7 reside on the stack. The rest reside #
-# in their original places. #
-# For a7, if the increment amount is one, then we have to #
-# increment by two. For any a7 update, set the mia7_flag so that if #
-# an access error exception occurs later in emulation, this address #
-# register update can be undone. #
-# #
-#########################################################################
-
- global inc_areg
-inc_areg:
- mov.w (tbl_iareg.b,%pc,%d1.w*2),%d1
- jmp (tbl_iareg.b,%pc,%d1.w*1)
-
-tbl_iareg:
- short iareg0 - tbl_iareg
- short iareg1 - tbl_iareg
- short iareg2 - tbl_iareg
- short iareg3 - tbl_iareg
- short iareg4 - tbl_iareg
- short iareg5 - tbl_iareg
- short iareg6 - tbl_iareg
- short iareg7 - tbl_iareg
-
-iareg0: add.l %d0,EXC_DREGS+0x8(%a6)
- rts
-iareg1: add.l %d0,EXC_DREGS+0xc(%a6)
- rts
-iareg2: add.l %d0,%a2
- rts
-iareg3: add.l %d0,%a3
- rts
-iareg4: add.l %d0,%a4
- rts
-iareg5: add.l %d0,%a5
- rts
-iareg6: add.l %d0,(%a6)
- rts
-iareg7: mov.b &mia7_flg,SPCOND_FLG(%a6)
- cmpi.b %d0,&0x1
- beq.b iareg7b
- add.l %d0,EXC_A7(%a6)
- rts
-iareg7b:
- addq.l &0x2,EXC_A7(%a6)
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# dec_areg(): decrement an address register by the value in d0 #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# d0 = amount to decrement by #
-# d1 = index of address register to decrement #
-# #
-# OUTPUT ************************************************************** #
-# (address register is updated) #
-# #
-# ALGORITHM *********************************************************** #
-# Typically used for an instruction w/ a pre-decrement <ea>, #
-# this routine adds the decrement value in d0 to the address register #
-# specified by d1. A0/A1/A6/A7 reside on the stack. The rest reside #
-# in their original places. #
-# For a7, if the decrement amount is one, then we have to #
-# decrement by two. For any a7 update, set the mda7_flag so that if #
-# an access error exception occurs later in emulation, this address #
-# register update can be undone. #
-# #
-#########################################################################
-
- global dec_areg
-dec_areg:
- mov.w (tbl_dareg.b,%pc,%d1.w*2),%d1
- jmp (tbl_dareg.b,%pc,%d1.w*1)
-
-tbl_dareg:
- short dareg0 - tbl_dareg
- short dareg1 - tbl_dareg
- short dareg2 - tbl_dareg
- short dareg3 - tbl_dareg
- short dareg4 - tbl_dareg
- short dareg5 - tbl_dareg
- short dareg6 - tbl_dareg
- short dareg7 - tbl_dareg
-
-dareg0: sub.l %d0,EXC_DREGS+0x8(%a6)
- rts
-dareg1: sub.l %d0,EXC_DREGS+0xc(%a6)
- rts
-dareg2: sub.l %d0,%a2
- rts
-dareg3: sub.l %d0,%a3
- rts
-dareg4: sub.l %d0,%a4
- rts
-dareg5: sub.l %d0,%a5
- rts
-dareg6: sub.l %d0,(%a6)
- rts
-dareg7: mov.b &mda7_flg,SPCOND_FLG(%a6)
- cmpi.b %d0,&0x1
- beq.b dareg7b
- sub.l %d0,EXC_A7(%a6)
- rts
-dareg7b:
- subq.l &0x2,EXC_A7(%a6)
- rts
-
-##############################################################################
-
-#########################################################################
-# XDEF **************************************************************** #
-# load_fpn1(): load FP register value into FP_SRC(a6). #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# d0 = index of FP register to load #
-# #
-# OUTPUT ************************************************************** #
-# FP_SRC(a6) = value loaded from FP register file #
-# #
-# ALGORITHM *********************************************************** #
-# Using the index in d0, load FP_SRC(a6) with a number from the #
-# FP register file. #
-# #
-#########################################################################
-
- global load_fpn1
-load_fpn1:
- mov.w (tbl_load_fpn1.b,%pc,%d0.w*2), %d0
- jmp (tbl_load_fpn1.b,%pc,%d0.w*1)
-
-tbl_load_fpn1:
- short load_fpn1_0 - tbl_load_fpn1
- short load_fpn1_1 - tbl_load_fpn1
- short load_fpn1_2 - tbl_load_fpn1
- short load_fpn1_3 - tbl_load_fpn1
- short load_fpn1_4 - tbl_load_fpn1
- short load_fpn1_5 - tbl_load_fpn1
- short load_fpn1_6 - tbl_load_fpn1
- short load_fpn1_7 - tbl_load_fpn1
-
-load_fpn1_0:
- mov.l 0+EXC_FP0(%a6), 0+FP_SRC(%a6)
- mov.l 4+EXC_FP0(%a6), 4+FP_SRC(%a6)
- mov.l 8+EXC_FP0(%a6), 8+FP_SRC(%a6)
- lea FP_SRC(%a6), %a0
- rts
-load_fpn1_1:
- mov.l 0+EXC_FP1(%a6), 0+FP_SRC(%a6)
- mov.l 4+EXC_FP1(%a6), 4+FP_SRC(%a6)
- mov.l 8+EXC_FP1(%a6), 8+FP_SRC(%a6)
- lea FP_SRC(%a6), %a0
- rts
-load_fpn1_2:
- fmovm.x &0x20, FP_SRC(%a6)
- lea FP_SRC(%a6), %a0
- rts
-load_fpn1_3:
- fmovm.x &0x10, FP_SRC(%a6)
- lea FP_SRC(%a6), %a0
- rts
-load_fpn1_4:
- fmovm.x &0x08, FP_SRC(%a6)
- lea FP_SRC(%a6), %a0
- rts
-load_fpn1_5:
- fmovm.x &0x04, FP_SRC(%a6)
- lea FP_SRC(%a6), %a0
- rts
-load_fpn1_6:
- fmovm.x &0x02, FP_SRC(%a6)
- lea FP_SRC(%a6), %a0
- rts
-load_fpn1_7:
- fmovm.x &0x01, FP_SRC(%a6)
- lea FP_SRC(%a6), %a0
- rts
-
-#############################################################################
-
-#########################################################################
-# XDEF **************************************************************** #
-# load_fpn2(): load FP register value into FP_DST(a6). #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# d0 = index of FP register to load #
-# #
-# OUTPUT ************************************************************** #
-# FP_DST(a6) = value loaded from FP register file #
-# #
-# ALGORITHM *********************************************************** #
-# Using the index in d0, load FP_DST(a6) with a number from the #
-# FP register file. #
-# #
-#########################################################################
-
- global load_fpn2
-load_fpn2:
- mov.w (tbl_load_fpn2.b,%pc,%d0.w*2), %d0
- jmp (tbl_load_fpn2.b,%pc,%d0.w*1)
-
-tbl_load_fpn2:
- short load_fpn2_0 - tbl_load_fpn2
- short load_fpn2_1 - tbl_load_fpn2
- short load_fpn2_2 - tbl_load_fpn2
- short load_fpn2_3 - tbl_load_fpn2
- short load_fpn2_4 - tbl_load_fpn2
- short load_fpn2_5 - tbl_load_fpn2
- short load_fpn2_6 - tbl_load_fpn2
- short load_fpn2_7 - tbl_load_fpn2
-
-load_fpn2_0:
- mov.l 0+EXC_FP0(%a6), 0+FP_DST(%a6)
- mov.l 4+EXC_FP0(%a6), 4+FP_DST(%a6)
- mov.l 8+EXC_FP0(%a6), 8+FP_DST(%a6)
- lea FP_DST(%a6), %a0
- rts
-load_fpn2_1:
- mov.l 0+EXC_FP1(%a6), 0+FP_DST(%a6)
- mov.l 4+EXC_FP1(%a6), 4+FP_DST(%a6)
- mov.l 8+EXC_FP1(%a6), 8+FP_DST(%a6)
- lea FP_DST(%a6), %a0
- rts
-load_fpn2_2:
- fmovm.x &0x20, FP_DST(%a6)
- lea FP_DST(%a6), %a0
- rts
-load_fpn2_3:
- fmovm.x &0x10, FP_DST(%a6)
- lea FP_DST(%a6), %a0
- rts
-load_fpn2_4:
- fmovm.x &0x08, FP_DST(%a6)
- lea FP_DST(%a6), %a0
- rts
-load_fpn2_5:
- fmovm.x &0x04, FP_DST(%a6)
- lea FP_DST(%a6), %a0
- rts
-load_fpn2_6:
- fmovm.x &0x02, FP_DST(%a6)
- lea FP_DST(%a6), %a0
- rts
-load_fpn2_7:
- fmovm.x &0x01, FP_DST(%a6)
- lea FP_DST(%a6), %a0
- rts
-
-#############################################################################
-
-#########################################################################
-# XDEF **************************************************************** #
-# store_fpreg(): store an fp value to the fpreg designated d0. #
-# #
-# XREF **************************************************************** #
-# None #
-# #
-# INPUT *************************************************************** #
-# fp0 = extended precision value to store #
-# d0 = index of floating-point register #
-# #
-# OUTPUT ************************************************************** #
-# None #
-# #
-# ALGORITHM *********************************************************** #
-# Store the value in fp0 to the FP register designated by the #
-# value in d0. The FP number can be DENORM or SNAN so we have to be #
-# careful that we don't take an exception here. #
-# #
-#########################################################################
-
- global store_fpreg
-store_fpreg:
- mov.w (tbl_store_fpreg.b,%pc,%d0.w*2), %d0
- jmp (tbl_store_fpreg.b,%pc,%d0.w*1)
-
-tbl_store_fpreg:
- short store_fpreg_0 - tbl_store_fpreg
- short store_fpreg_1 - tbl_store_fpreg
- short store_fpreg_2 - tbl_store_fpreg
- short store_fpreg_3 - tbl_store_fpreg
- short store_fpreg_4 - tbl_store_fpreg
- short store_fpreg_5 - tbl_store_fpreg
- short store_fpreg_6 - tbl_store_fpreg
- short store_fpreg_7 - tbl_store_fpreg
-
-store_fpreg_0:
- fmovm.x &0x80, EXC_FP0(%a6)
- rts
-store_fpreg_1:
- fmovm.x &0x80, EXC_FP1(%a6)
- rts
-store_fpreg_2:
- fmovm.x &0x01, -(%sp)
- fmovm.x (%sp)+, &0x20
- rts
-store_fpreg_3:
- fmovm.x &0x01, -(%sp)
- fmovm.x (%sp)+, &0x10
- rts
-store_fpreg_4:
- fmovm.x &0x01, -(%sp)
- fmovm.x (%sp)+, &0x08
- rts
-store_fpreg_5:
- fmovm.x &0x01, -(%sp)
- fmovm.x (%sp)+, &0x04
- rts
-store_fpreg_6:
- fmovm.x &0x01, -(%sp)
- fmovm.x (%sp)+, &0x02
- rts
-store_fpreg_7:
- fmovm.x &0x01, -(%sp)
- fmovm.x (%sp)+, &0x01
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# get_packed(): fetch a packed operand from memory and then #
-# convert it to a floating-point binary number. #
-# #
-# XREF **************************************************************** #
-# _dcalc_ea() - calculate the correct <ea> #
-# _mem_read() - fetch the packed operand from memory #
-# facc_in_x() - the fetch failed so jump to special exit code #
-# decbin() - convert packed to binary extended precision #
-# #
-# INPUT *************************************************************** #
-# None #
-# #
-# OUTPUT ************************************************************** #
-# If no failure on _mem_read(): #
-# FP_SRC(a6) = packed operand now as a binary FP number #
-# #
-# ALGORITHM *********************************************************** #
-# Get the correct <ea> which is the value on the exception stack #
-# frame w/ maybe a correction factor if the <ea> is -(an) or (an)+. #
-# Then, fetch the operand from memory. If the fetch fails, exit #
-# through facc_in_x(). #
-# If the packed operand is a ZERO,NAN, or INF, convert it to #
-# its binary representation here. Else, call decbin() which will #
-# convert the packed value to an extended precision binary value. #
-# #
-#########################################################################
-
-# the stacked <ea> for packed is correct except for -(An).
-# the base reg must be updated for both -(An) and (An)+.
- global get_packed
-get_packed:
- mov.l &0xc,%d0 # packed is 12 bytes
- bsr.l _dcalc_ea # fetch <ea>; correct An
-
- lea FP_SRC(%a6),%a1 # pass: ptr to super dst
- mov.l &0xc,%d0 # pass: 12 bytes
- bsr.l _dmem_read # read packed operand
-
- tst.l %d1 # did dfetch fail?
- bne.l facc_in_x # yes
-
-# The packed operand is an INF or a NAN if the exponent field is all ones.
- bfextu FP_SRC(%a6){&1:&15},%d0 # get exp
- cmpi.w %d0,&0x7fff # INF or NAN?
- bne.b gp_try_zero # no
- rts # operand is an INF or NAN
-
-# The packed operand is a zero if the mantissa is all zero, else it's
-# a normal packed op.
-gp_try_zero:
- mov.b 3+FP_SRC(%a6),%d0 # get byte 4
- andi.b &0x0f,%d0 # clear all but last nybble
- bne.b gp_not_spec # not a zero
- tst.l FP_SRC_HI(%a6) # is lw 2 zero?
- bne.b gp_not_spec # not a zero
- tst.l FP_SRC_LO(%a6) # is lw 3 zero?
- bne.b gp_not_spec # not a zero
- rts # operand is a ZERO
-gp_not_spec:
- lea FP_SRC(%a6),%a0 # pass: ptr to packed op
- bsr.l decbin # convert to extended
- fmovm.x &0x80,FP_SRC(%a6) # make this the srcop
- rts
-
-#########################################################################
-# decbin(): Converts normalized packed bcd value pointed to by register #
-# a0 to extended-precision value in fp0. #
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to normalized packed bcd value #
-# #
-# OUTPUT ************************************************************** #
-# fp0 = exact fp representation of the packed bcd value. #
-# #
-# ALGORITHM *********************************************************** #
-# Expected is a normal bcd (i.e. non-exceptional; all inf, zero, #
-# and NaN operands are dispatched without entering this routine) #
-# value in 68881/882 format at location (a0). #
-# #
-# A1. Convert the bcd exponent to binary by successive adds and #
-# muls. Set the sign according to SE. Subtract 16 to compensate #
-# for the mantissa which is to be interpreted as 17 integer #
-# digits, rather than 1 integer and 16 fraction digits. #
-# Note: this operation can never overflow. #
-# #
-# A2. Convert the bcd mantissa to binary by successive #
-# adds and muls in FP0. Set the sign according to SM. #
-# The mantissa digits will be converted with the decimal point #
-# assumed following the least-significant digit. #
-# Note: this operation can never overflow. #
-# #
-# A3. Count the number of leading/trailing zeros in the #
-# bcd string. If SE is positive, count the leading zeros; #
-# if negative, count the trailing zeros. Set the adjusted #
-# exponent equal to the exponent from A1 and the zero count #
-# added if SM = 1 and subtracted if SM = 0. Scale the #
-# mantissa the equivalent of forcing in the bcd value: #
-# #
-# SM = 0 a non-zero digit in the integer position #
-# SM = 1 a non-zero digit in Mant0, lsd of the fraction #
-# #
-# this will insure that any value, regardless of its #
-# representation (ex. 0.1E2, 1E1, 10E0, 100E-1), is converted #
-# consistently. #
-# #
-# A4. Calculate the factor 10^exp in FP1 using a table of #
-# 10^(2^n) values. To reduce the error in forming factors #
-# greater than 10^27, a directed rounding scheme is used with #
-# tables rounded to RN, RM, and RP, according to the table #
-# in the comments of the pwrten section. #
-# #
-# A5. Form the final binary number by scaling the mantissa by #
-# the exponent factor. This is done by multiplying the #
-# mantissa in FP0 by the factor in FP1 if the adjusted #
-# exponent sign is positive, and dividing FP0 by FP1 if #
-# it is negative. #
-# #
-# Clean up and return. Check if the final mul or div was inexact. #
-# If so, set INEX1 in USER_FPSR. #
-# #
-#########################################################################
-
-#
-# PTENRN, PTENRM, and PTENRP are arrays of powers of 10 rounded
-# to nearest, minus, and plus, respectively. The tables include
-# 10**{1,2,4,8,16,32,64,128,256,512,1024,2048,4096}. No rounding
-# is required until the power is greater than 27, however, all
-# tables include the first 5 for ease of indexing.
-#
-RTABLE:
- byte 0,0,0,0
- byte 2,3,2,3
- byte 2,3,3,2
- byte 3,2,2,3
-
- set FNIBS,7
- set FSTRT,0
-
- set ESTRT,4
- set EDIGITS,2
-
- global decbin
-decbin:
- mov.l 0x0(%a0),FP_SCR0_EX(%a6) # make a copy of input
- mov.l 0x4(%a0),FP_SCR0_HI(%a6) # so we don't alter it
- mov.l 0x8(%a0),FP_SCR0_LO(%a6)
-
- lea FP_SCR0(%a6),%a0
-
- movm.l &0x3c00,-(%sp) # save d2-d5
- fmovm.x &0x1,-(%sp) # save fp1
-#
-# Calculate exponent:
-# 1. Copy bcd value in memory for use as a working copy.
-# 2. Calculate absolute value of exponent in d1 by mul and add.
-# 3. Correct for exponent sign.
-# 4. Subtract 16 to compensate for interpreting the mant as all integer digits.
-# (i.e., all digits assumed left of the decimal point.)
-#
-# Register usage:
-#
-# calc_e:
-# (*) d0: temp digit storage
-# (*) d1: accumulator for binary exponent
-# (*) d2: digit count
-# (*) d3: offset pointer
-# ( ) d4: first word of bcd
-# ( ) a0: pointer to working bcd value
-# ( ) a6: pointer to original bcd value
-# (*) FP_SCR1: working copy of original bcd value
-# (*) L_SCR1: copy of original exponent word
-#
-calc_e:
- mov.l &EDIGITS,%d2 # # of nibbles (digits) in fraction part
- mov.l &ESTRT,%d3 # counter to pick up digits
- mov.l (%a0),%d4 # get first word of bcd
- clr.l %d1 # zero d1 for accumulator
-e_gd:
- mulu.l &0xa,%d1 # mul partial product by one digit place
- bfextu %d4{%d3:&4},%d0 # get the digit and zero extend into d0
- add.l %d0,%d1 # d1 = d1 + d0
- addq.b &4,%d3 # advance d3 to the next digit
- dbf.w %d2,e_gd # if we have used all 3 digits, exit loop
- btst &30,%d4 # get SE
- beq.b e_pos # don't negate if pos
- neg.l %d1 # negate before subtracting
-e_pos:
- sub.l &16,%d1 # sub to compensate for shift of mant
- bge.b e_save # if still pos, do not neg
- neg.l %d1 # now negative, make pos and set SE
- or.l &0x40000000,%d4 # set SE in d4,
- or.l &0x40000000,(%a0) # and in working bcd
-e_save:
- mov.l %d1,-(%sp) # save exp on stack
-#
-#
-# Calculate mantissa:
-# 1. Calculate absolute value of mantissa in fp0 by mul and add.
-# 2. Correct for mantissa sign.
-# (i.e., all digits assumed left of the decimal point.)
-#
-# Register usage:
-#
-# calc_m:
-# (*) d0: temp digit storage
-# (*) d1: lword counter
-# (*) d2: digit count
-# (*) d3: offset pointer
-# ( ) d4: words 2 and 3 of bcd
-# ( ) a0: pointer to working bcd value
-# ( ) a6: pointer to original bcd value
-# (*) fp0: mantissa accumulator
-# ( ) FP_SCR1: working copy of original bcd value
-# ( ) L_SCR1: copy of original exponent word
-#
-calc_m:
- mov.l &1,%d1 # word counter, init to 1
- fmov.s &0x00000000,%fp0 # accumulator
-#
-#
-# Since the packed number has a long word between the first & second parts,
-# get the integer digit then skip down & get the rest of the
-# mantissa. We will unroll the loop once.
-#
- bfextu (%a0){&28:&4},%d0 # integer part is ls digit in long word
- fadd.b %d0,%fp0 # add digit to sum in fp0
-#
-#
-# Get the rest of the mantissa.
-#
-loadlw:
- mov.l (%a0,%d1.L*4),%d4 # load mantissa lonqword into d4
- mov.l &FSTRT,%d3 # counter to pick up digits
- mov.l &FNIBS,%d2 # reset number of digits per a0 ptr
-md2b:
- fmul.s &0x41200000,%fp0 # fp0 = fp0 * 10
- bfextu %d4{%d3:&4},%d0 # get the digit and zero extend
- fadd.b %d0,%fp0 # fp0 = fp0 + digit
-#
-#
-# If all the digits (8) in that long word have been converted (d2=0),
-# then inc d1 (=2) to point to the next long word and reset d3 to 0
-# to initialize the digit offset, and set d2 to 7 for the digit count;
-# else continue with this long word.
-#
- addq.b &4,%d3 # advance d3 to the next digit
- dbf.w %d2,md2b # check for last digit in this lw
-nextlw:
- addq.l &1,%d1 # inc lw pointer in mantissa
- cmp.l %d1,&2 # test for last lw
- ble.b loadlw # if not, get last one
-#
-# Check the sign of the mant and make the value in fp0 the same sign.
-#
-m_sign:
- btst &31,(%a0) # test sign of the mantissa
- beq.b ap_st_z # if clear, go to append/strip zeros
- fneg.x %fp0 # if set, negate fp0
-#
-# Append/strip zeros:
-#
-# For adjusted exponents which have an absolute value greater than 27*,
-# this routine calculates the amount needed to normalize the mantissa
-# for the adjusted exponent. That number is subtracted from the exp
-# if the exp was positive, and added if it was negative. The purpose
-# of this is to reduce the value of the exponent and the possibility
-# of error in calculation of pwrten.
-#
-# 1. Branch on the sign of the adjusted exponent.
-# 2p.(positive exp)
-# 2. Check M16 and the digits in lwords 2 and 3 in descending order.
-# 3. Add one for each zero encountered until a non-zero digit.
-# 4. Subtract the count from the exp.
-# 5. Check if the exp has crossed zero in #3 above; make the exp abs
-# and set SE.
-# 6. Multiply the mantissa by 10**count.
-# 2n.(negative exp)
-# 2. Check the digits in lwords 3 and 2 in descending order.
-# 3. Add one for each zero encountered until a non-zero digit.
-# 4. Add the count to the exp.
-# 5. Check if the exp has crossed zero in #3 above; clear SE.
-# 6. Divide the mantissa by 10**count.
-#
-# *Why 27? If the adjusted exponent is within -28 < expA < 28, than
-# any adjustment due to append/strip zeros will drive the resultane
-# exponent towards zero. Since all pwrten constants with a power
-# of 27 or less are exact, there is no need to use this routine to
-# attempt to lessen the resultant exponent.
-#
-# Register usage:
-#
-# ap_st_z:
-# (*) d0: temp digit storage
-# (*) d1: zero count
-# (*) d2: digit count
-# (*) d3: offset pointer
-# ( ) d4: first word of bcd
-# (*) d5: lword counter
-# ( ) a0: pointer to working bcd value
-# ( ) FP_SCR1: working copy of original bcd value
-# ( ) L_SCR1: copy of original exponent word
-#
-#
-# First check the absolute value of the exponent to see if this
-# routine is necessary. If so, then check the sign of the exponent
-# and do append (+) or strip (-) zeros accordingly.
-# This section handles a positive adjusted exponent.
-#
-ap_st_z:
- mov.l (%sp),%d1 # load expA for range test
- cmp.l %d1,&27 # test is with 27
- ble.w pwrten # if abs(expA) <28, skip ap/st zeros
- btst &30,(%a0) # check sign of exp
- bne.b ap_st_n # if neg, go to neg side
- clr.l %d1 # zero count reg
- mov.l (%a0),%d4 # load lword 1 to d4
- bfextu %d4{&28:&4},%d0 # get M16 in d0
- bne.b ap_p_fx # if M16 is non-zero, go fix exp
- addq.l &1,%d1 # inc zero count
- mov.l &1,%d5 # init lword counter
- mov.l (%a0,%d5.L*4),%d4 # get lword 2 to d4
- bne.b ap_p_cl # if lw 2 is zero, skip it
- addq.l &8,%d1 # and inc count by 8
- addq.l &1,%d5 # inc lword counter
- mov.l (%a0,%d5.L*4),%d4 # get lword 3 to d4
-ap_p_cl:
- clr.l %d3 # init offset reg
- mov.l &7,%d2 # init digit counter
-ap_p_gd:
- bfextu %d4{%d3:&4},%d0 # get digit
- bne.b ap_p_fx # if non-zero, go to fix exp
- addq.l &4,%d3 # point to next digit
- addq.l &1,%d1 # inc digit counter
- dbf.w %d2,ap_p_gd # get next digit
-ap_p_fx:
- mov.l %d1,%d0 # copy counter to d2
- mov.l (%sp),%d1 # get adjusted exp from memory
- sub.l %d0,%d1 # subtract count from exp
- bge.b ap_p_fm # if still pos, go to pwrten
- neg.l %d1 # now its neg; get abs
- mov.l (%a0),%d4 # load lword 1 to d4
- or.l &0x40000000,%d4 # and set SE in d4
- or.l &0x40000000,(%a0) # and in memory
-#
-# Calculate the mantissa multiplier to compensate for the striping of
-# zeros from the mantissa.
-#
-ap_p_fm:
- lea.l PTENRN(%pc),%a1 # get address of power-of-ten table
- clr.l %d3 # init table index
- fmov.s &0x3f800000,%fp1 # init fp1 to 1
- mov.l &3,%d2 # init d2 to count bits in counter
-ap_p_el:
- asr.l &1,%d0 # shift lsb into carry
- bcc.b ap_p_en # if 1, mul fp1 by pwrten factor
- fmul.x (%a1,%d3),%fp1 # mul by 10**(d3_bit_no)
-ap_p_en:
- add.l &12,%d3 # inc d3 to next rtable entry
- tst.l %d0 # check if d0 is zero
- bne.b ap_p_el # if not, get next bit
- fmul.x %fp1,%fp0 # mul mantissa by 10**(no_bits_shifted)
- bra.b pwrten # go calc pwrten
-#
-# This section handles a negative adjusted exponent.
-#
-ap_st_n:
- clr.l %d1 # clr counter
- mov.l &2,%d5 # set up d5 to point to lword 3
- mov.l (%a0,%d5.L*4),%d4 # get lword 3
- bne.b ap_n_cl # if not zero, check digits
- sub.l &1,%d5 # dec d5 to point to lword 2
- addq.l &8,%d1 # inc counter by 8
- mov.l (%a0,%d5.L*4),%d4 # get lword 2
-ap_n_cl:
- mov.l &28,%d3 # point to last digit
- mov.l &7,%d2 # init digit counter
-ap_n_gd:
- bfextu %d4{%d3:&4},%d0 # get digit
- bne.b ap_n_fx # if non-zero, go to exp fix
- subq.l &4,%d3 # point to previous digit
- addq.l &1,%d1 # inc digit counter
- dbf.w %d2,ap_n_gd # get next digit
-ap_n_fx:
- mov.l %d1,%d0 # copy counter to d0
- mov.l (%sp),%d1 # get adjusted exp from memory
- sub.l %d0,%d1 # subtract count from exp
- bgt.b ap_n_fm # if still pos, go fix mantissa
- neg.l %d1 # take abs of exp and clr SE
- mov.l (%a0),%d4 # load lword 1 to d4
- and.l &0xbfffffff,%d4 # and clr SE in d4
- and.l &0xbfffffff,(%a0) # and in memory
-#
-# Calculate the mantissa multiplier to compensate for the appending of
-# zeros to the mantissa.
-#
-ap_n_fm:
- lea.l PTENRN(%pc),%a1 # get address of power-of-ten table
- clr.l %d3 # init table index
- fmov.s &0x3f800000,%fp1 # init fp1 to 1
- mov.l &3,%d2 # init d2 to count bits in counter
-ap_n_el:
- asr.l &1,%d0 # shift lsb into carry
- bcc.b ap_n_en # if 1, mul fp1 by pwrten factor
- fmul.x (%a1,%d3),%fp1 # mul by 10**(d3_bit_no)
-ap_n_en:
- add.l &12,%d3 # inc d3 to next rtable entry
- tst.l %d0 # check if d0 is zero
- bne.b ap_n_el # if not, get next bit
- fdiv.x %fp1,%fp0 # div mantissa by 10**(no_bits_shifted)
-#
-#
-# Calculate power-of-ten factor from adjusted and shifted exponent.
-#
-# Register usage:
-#
-# pwrten:
-# (*) d0: temp
-# ( ) d1: exponent
-# (*) d2: {FPCR[6:5],SM,SE} as index in RTABLE; temp
-# (*) d3: FPCR work copy
-# ( ) d4: first word of bcd
-# (*) a1: RTABLE pointer
-# calc_p:
-# (*) d0: temp
-# ( ) d1: exponent
-# (*) d3: PWRTxx table index
-# ( ) a0: pointer to working copy of bcd
-# (*) a1: PWRTxx pointer
-# (*) fp1: power-of-ten accumulator
-#
-# Pwrten calculates the exponent factor in the selected rounding mode
-# according to the following table:
-#
-# Sign of Mant Sign of Exp Rounding Mode PWRTEN Rounding Mode
-#
-# ANY ANY RN RN
-#
-# + + RP RP
-# - + RP RM
-# + - RP RM
-# - - RP RP
-#
-# + + RM RM
-# - + RM RP
-# + - RM RP
-# - - RM RM
-#
-# + + RZ RM
-# - + RZ RM
-# + - RZ RP
-# - - RZ RP
-#
-#
-pwrten:
- mov.l USER_FPCR(%a6),%d3 # get user's FPCR
- bfextu %d3{&26:&2},%d2 # isolate rounding mode bits
- mov.l (%a0),%d4 # reload 1st bcd word to d4
- asl.l &2,%d2 # format d2 to be
- bfextu %d4{&0:&2},%d0 # {FPCR[6],FPCR[5],SM,SE}
- add.l %d0,%d2 # in d2 as index into RTABLE
- lea.l RTABLE(%pc),%a1 # load rtable base
- mov.b (%a1,%d2),%d0 # load new rounding bits from table
- clr.l %d3 # clear d3 to force no exc and extended
- bfins %d0,%d3{&26:&2} # stuff new rounding bits in FPCR
- fmov.l %d3,%fpcr # write new FPCR
- asr.l &1,%d0 # write correct PTENxx table
- bcc.b not_rp # to a1
- lea.l PTENRP(%pc),%a1 # it is RP
- bra.b calc_p # go to init section
-not_rp:
- asr.l &1,%d0 # keep checking
- bcc.b not_rm
- lea.l PTENRM(%pc),%a1 # it is RM
- bra.b calc_p # go to init section
-not_rm:
- lea.l PTENRN(%pc),%a1 # it is RN
-calc_p:
- mov.l %d1,%d0 # copy exp to d0;use d0
- bpl.b no_neg # if exp is negative,
- neg.l %d0 # invert it
- or.l &0x40000000,(%a0) # and set SE bit
-no_neg:
- clr.l %d3 # table index
- fmov.s &0x3f800000,%fp1 # init fp1 to 1
-e_loop:
- asr.l &1,%d0 # shift next bit into carry
- bcc.b e_next # if zero, skip the mul
- fmul.x (%a1,%d3),%fp1 # mul by 10**(d3_bit_no)
-e_next:
- add.l &12,%d3 # inc d3 to next rtable entry
- tst.l %d0 # check if d0 is zero
- bne.b e_loop # not zero, continue shifting
-#
-#
-# Check the sign of the adjusted exp and make the value in fp0 the
-# same sign. If the exp was pos then multiply fp1*fp0;
-# else divide fp0/fp1.
-#
-# Register Usage:
-# norm:
-# ( ) a0: pointer to working bcd value
-# (*) fp0: mantissa accumulator
-# ( ) fp1: scaling factor - 10**(abs(exp))
-#
-pnorm:
- btst &30,(%a0) # test the sign of the exponent
- beq.b mul # if clear, go to multiply
-div:
- fdiv.x %fp1,%fp0 # exp is negative, so divide mant by exp
- bra.b end_dec
-mul:
- fmul.x %fp1,%fp0 # exp is positive, so multiply by exp
-#
-#
-# Clean up and return with result in fp0.
-#
-# If the final mul/div in decbin incurred an inex exception,
-# it will be inex2, but will be reported as inex1 by get_op.
-#
-end_dec:
- fmov.l %fpsr,%d0 # get status register
- bclr &inex2_bit+8,%d0 # test for inex2 and clear it
- beq.b no_exc # skip this if no exc
- ori.w &inx1a_mask,2+USER_FPSR(%a6) # set INEX1/AINEX
-no_exc:
- add.l &0x4,%sp # clear 1 lw param
- fmovm.x (%sp)+,&0x40 # restore fp1
- movm.l (%sp)+,&0x3c # restore d2-d5
- fmov.l &0x0,%fpcr
- fmov.l &0x0,%fpsr
- rts
-
-#########################################################################
-# bindec(): Converts an input in extended precision format to bcd format#
-# #
-# INPUT *************************************************************** #
-# a0 = pointer to the input extended precision value in memory. #
-# the input may be either normalized, unnormalized, or #
-# denormalized. #
-# d0 = contains the k-factor sign-extended to 32-bits. #
-# #
-# OUTPUT ************************************************************** #
-# FP_SCR0(a6) = bcd format result on the stack. #
-# #
-# ALGORITHM *********************************************************** #
-# #
-# A1. Set RM and size ext; Set SIGMA = sign of input. #
-# The k-factor is saved for use in d7. Clear the #
-# BINDEC_FLG for separating normalized/denormalized #
-# input. If input is unnormalized or denormalized, #
-# normalize it. #
-# #
-# A2. Set X = abs(input). #
-# #
-# A3. Compute ILOG. #
-# ILOG is the log base 10 of the input value. It is #
-# approximated by adding e + 0.f when the original #
-# value is viewed as 2^^e * 1.f in extended precision. #
-# This value is stored in d6. #
-# #
-# A4. Clr INEX bit. #
-# The operation in A3 above may have set INEX2. #
-# #
-# A5. Set ICTR = 0; #
-# ICTR is a flag used in A13. It must be set before the #
-# loop entry A6. #
-# #
-# A6. Calculate LEN. #
-# LEN is the number of digits to be displayed. The #
-# k-factor can dictate either the total number of digits, #
-# if it is a positive number, or the number of digits #
-# after the decimal point which are to be included as #
-# significant. See the 68882 manual for examples. #
-# If LEN is computed to be greater than 17, set OPERR in #
-# USER_FPSR. LEN is stored in d4. #
-# #
-# A7. Calculate SCALE. #
-# SCALE is equal to 10^ISCALE, where ISCALE is the number #
-# of decimal places needed to insure LEN integer digits #
-# in the output before conversion to bcd. LAMBDA is the #
-# sign of ISCALE, used in A9. Fp1 contains #
-# 10^^(abs(ISCALE)) using a rounding mode which is a #
-# function of the original rounding mode and the signs #
-# of ISCALE and X. A table is given in the code. #
-# #
-# A8. Clr INEX; Force RZ. #
-# The operation in A3 above may have set INEX2. #
-# RZ mode is forced for the scaling operation to insure #
-# only one rounding error. The grs bits are collected in #
-# the INEX flag for use in A10. #
-# #
-# A9. Scale X -> Y. #
-# The mantissa is scaled to the desired number of #
-# significant digits. The excess digits are collected #
-# in INEX2. #
-# #
-# A10. Or in INEX. #
-# If INEX is set, round error occurred. This is #
-# compensated for by 'or-ing' in the INEX2 flag to #
-# the lsb of Y. #
-# #
-# A11. Restore original FPCR; set size ext. #
-# Perform FINT operation in the user's rounding mode. #
-# Keep the size to extended. #
-# #
-# A12. Calculate YINT = FINT(Y) according to user's rounding #
-# mode. The FPSP routine sintd0 is used. The output #
-# is in fp0. #
-# #
-# A13. Check for LEN digits. #
-# If the int operation results in more than LEN digits, #
-# or less than LEN -1 digits, adjust ILOG and repeat from #
-# A6. This test occurs only on the first pass. If the #
-# result is exactly 10^LEN, decrement ILOG and divide #
-# the mantissa by 10. #
-# #
-# A14. Convert the mantissa to bcd. #
-# The binstr routine is used to convert the LEN digit #
-# mantissa to bcd in memory. The input to binstr is #
-# to be a fraction; i.e. (mantissa)/10^LEN and adjusted #
-# such that the decimal point is to the left of bit 63. #
-# The bcd digits are stored in the correct position in #
-# the final string area in memory. #
-# #
-# A15. Convert the exponent to bcd. #
-# As in A14 above, the exp is converted to bcd and the #
-# digits are stored in the final string. #
-# Test the length of the final exponent string. If the #
-# length is 4, set operr. #
-# #
-# A16. Write sign bits to final string. #
-# #
-#########################################################################
-
-set BINDEC_FLG, EXC_TEMP # DENORM flag
-
-# Constants in extended precision
-PLOG2:
- long 0x3FFD0000,0x9A209A84,0xFBCFF798,0x00000000
-PLOG2UP1:
- long 0x3FFD0000,0x9A209A84,0xFBCFF799,0x00000000
-
-# Constants in single precision
-FONE:
- long 0x3F800000,0x00000000,0x00000000,0x00000000
-FTWO:
- long 0x40000000,0x00000000,0x00000000,0x00000000
-FTEN:
- long 0x41200000,0x00000000,0x00000000,0x00000000
-F4933:
- long 0x459A2800,0x00000000,0x00000000,0x00000000
-
-RBDTBL:
- byte 0,0,0,0
- byte 3,3,2,2
- byte 3,2,2,3
- byte 2,3,3,2
-
-# Implementation Notes:
-#
-# The registers are used as follows:
-#
-# d0: scratch; LEN input to binstr
-# d1: scratch
-# d2: upper 32-bits of mantissa for binstr
-# d3: scratch;lower 32-bits of mantissa for binstr
-# d4: LEN
-# d5: LAMBDA/ICTR
-# d6: ILOG
-# d7: k-factor
-# a0: ptr for original operand/final result
-# a1: scratch pointer
-# a2: pointer to FP_X; abs(original value) in ext
-# fp0: scratch
-# fp1: scratch
-# fp2: scratch
-# F_SCR1:
-# F_SCR2:
-# L_SCR1:
-# L_SCR2:
-
- global bindec
-bindec:
- movm.l &0x3f20,-(%sp) # {%d2-%d7/%a2}
- fmovm.x &0x7,-(%sp) # {%fp0-%fp2}
-
-# A1. Set RM and size ext. Set SIGMA = sign input;
-# The k-factor is saved for use in d7. Clear BINDEC_FLG for
-# separating normalized/denormalized input. If the input
-# is a denormalized number, set the BINDEC_FLG memory word
-# to signal denorm. If the input is unnormalized, normalize
-# the input and test for denormalized result.
-#
- fmov.l &rm_mode*0x10,%fpcr # set RM and ext
- mov.l (%a0),L_SCR2(%a6) # save exponent for sign check
- mov.l %d0,%d7 # move k-factor to d7
-
- clr.b BINDEC_FLG(%a6) # clr norm/denorm flag
- cmpi.b STAG(%a6),&DENORM # is input a DENORM?
- bne.w A2_str # no; input is a NORM
-
-#
-# Normalize the denorm
-#
-un_de_norm:
- mov.w (%a0),%d0
- and.w &0x7fff,%d0 # strip sign of normalized exp
- mov.l 4(%a0),%d1
- mov.l 8(%a0),%d2
-norm_loop:
- sub.w &1,%d0
- lsl.l &1,%d2
- roxl.l &1,%d1
- tst.l %d1
- bge.b norm_loop
-#
-# Test if the normalized input is denormalized
-#
- tst.w %d0
- bgt.b pos_exp # if greater than zero, it is a norm
- st BINDEC_FLG(%a6) # set flag for denorm
-pos_exp:
- and.w &0x7fff,%d0 # strip sign of normalized exp
- mov.w %d0,(%a0)
- mov.l %d1,4(%a0)
- mov.l %d2,8(%a0)
-
-# A2. Set X = abs(input).
-#
-A2_str:
- mov.l (%a0),FP_SCR1(%a6) # move input to work space
- mov.l 4(%a0),FP_SCR1+4(%a6) # move input to work space
- mov.l 8(%a0),FP_SCR1+8(%a6) # move input to work space
- and.l &0x7fffffff,FP_SCR1(%a6) # create abs(X)
-
-# A3. Compute ILOG.
-# ILOG is the log base 10 of the input value. It is approx-
-# imated by adding e + 0.f when the original value is viewed
-# as 2^^e * 1.f in extended precision. This value is stored
-# in d6.
-#
-# Register usage:
-# Input/Output
-# d0: k-factor/exponent
-# d2: x/x
-# d3: x/x
-# d4: x/x
-# d5: x/x
-# d6: x/ILOG
-# d7: k-factor/Unchanged
-# a0: ptr for original operand/final result
-# a1: x/x
-# a2: x/x
-# fp0: x/float(ILOG)
-# fp1: x/x
-# fp2: x/x
-# F_SCR1:x/x
-# F_SCR2:Abs(X)/Abs(X) with $3fff exponent
-# L_SCR1:x/x
-# L_SCR2:first word of X packed/Unchanged
-
- tst.b BINDEC_FLG(%a6) # check for denorm
- beq.b A3_cont # if clr, continue with norm
- mov.l &-4933,%d6 # force ILOG = -4933
- bra.b A4_str
-A3_cont:
- mov.w FP_SCR1(%a6),%d0 # move exp to d0
- mov.w &0x3fff,FP_SCR1(%a6) # replace exponent with 0x3fff
- fmov.x FP_SCR1(%a6),%fp0 # now fp0 has 1.f
- sub.w &0x3fff,%d0 # strip off bias
- fadd.w %d0,%fp0 # add in exp
- fsub.s FONE(%pc),%fp0 # subtract off 1.0
- fbge.w pos_res # if pos, branch
- fmul.x PLOG2UP1(%pc),%fp0 # if neg, mul by LOG2UP1
- fmov.l %fp0,%d6 # put ILOG in d6 as a lword
- bra.b A4_str # go move out ILOG
-pos_res:
- fmul.x PLOG2(%pc),%fp0 # if pos, mul by LOG2
- fmov.l %fp0,%d6 # put ILOG in d6 as a lword
-
-
-# A4. Clr INEX bit.
-# The operation in A3 above may have set INEX2.
-
-A4_str:
- fmov.l &0,%fpsr # zero all of fpsr - nothing needed
-
-
-# A5. Set ICTR = 0;
-# ICTR is a flag used in A13. It must be set before the
-# loop entry A6. The lower word of d5 is used for ICTR.
-
- clr.w %d5 # clear ICTR
-
-# A6. Calculate LEN.
-# LEN is the number of digits to be displayed. The k-factor
-# can dictate either the total number of digits, if it is
-# a positive number, or the number of digits after the
-# original decimal point which are to be included as
-# significant. See the 68882 manual for examples.
-# If LEN is computed to be greater than 17, set OPERR in
-# USER_FPSR. LEN is stored in d4.
-#
-# Register usage:
-# Input/Output
-# d0: exponent/Unchanged
-# d2: x/x/scratch
-# d3: x/x
-# d4: exc picture/LEN
-# d5: ICTR/Unchanged
-# d6: ILOG/Unchanged
-# d7: k-factor/Unchanged
-# a0: ptr for original operand/final result
-# a1: x/x
-# a2: x/x
-# fp0: float(ILOG)/Unchanged
-# fp1: x/x
-# fp2: x/x
-# F_SCR1:x/x
-# F_SCR2:Abs(X) with $3fff exponent/Unchanged
-# L_SCR1:x/x
-# L_SCR2:first word of X packed/Unchanged
-
-A6_str:
- tst.l %d7 # branch on sign of k
- ble.b k_neg # if k <= 0, LEN = ILOG + 1 - k
- mov.l %d7,%d4 # if k > 0, LEN = k
- bra.b len_ck # skip to LEN check
-k_neg:
- mov.l %d6,%d4 # first load ILOG to d4
- sub.l %d7,%d4 # subtract off k
- addq.l &1,%d4 # add in the 1
-len_ck:
- tst.l %d4 # LEN check: branch on sign of LEN
- ble.b LEN_ng # if neg, set LEN = 1
- cmp.l %d4,&17 # test if LEN > 17
- ble.b A7_str # if not, forget it
- mov.l &17,%d4 # set max LEN = 17
- tst.l %d7 # if negative, never set OPERR
- ble.b A7_str # if positive, continue
- or.l &opaop_mask,USER_FPSR(%a6) # set OPERR & AIOP in USER_FPSR
- bra.b A7_str # finished here
-LEN_ng:
- mov.l &1,%d4 # min LEN is 1
-
-
-# A7. Calculate SCALE.
-# SCALE is equal to 10^ISCALE, where ISCALE is the number
-# of decimal places needed to insure LEN integer digits
-# in the output before conversion to bcd. LAMBDA is the sign
-# of ISCALE, used in A9. Fp1 contains 10^^(abs(ISCALE)) using
-# the rounding mode as given in the following table (see
-# Coonen, p. 7.23 as ref.; however, the SCALE variable is
-# of opposite sign in bindec.sa from Coonen).
-#
-# Initial USE
-# FPCR[6:5] LAMBDA SIGN(X) FPCR[6:5]
-# ----------------------------------------------
-# RN 00 0 0 00/0 RN
-# RN 00 0 1 00/0 RN
-# RN 00 1 0 00/0 RN
-# RN 00 1 1 00/0 RN
-# RZ 01 0 0 11/3 RP
-# RZ 01 0 1 11/3 RP
-# RZ 01 1 0 10/2 RM
-# RZ 01 1 1 10/2 RM
-# RM 10 0 0 11/3 RP
-# RM 10 0 1 10/2 RM
-# RM 10 1 0 10/2 RM
-# RM 10 1 1 11/3 RP
-# RP 11 0 0 10/2 RM
-# RP 11 0 1 11/3 RP
-# RP 11 1 0 11/3 RP
-# RP 11 1 1 10/2 RM
-#
-# Register usage:
-# Input/Output
-# d0: exponent/scratch - final is 0
-# d2: x/0 or 24 for A9
-# d3: x/scratch - offset ptr into PTENRM array
-# d4: LEN/Unchanged
-# d5: 0/ICTR:LAMBDA
-# d6: ILOG/ILOG or k if ((k<=0)&(ILOG<k))
-# d7: k-factor/Unchanged
-# a0: ptr for original operand/final result
-# a1: x/ptr to PTENRM array
-# a2: x/x
-# fp0: float(ILOG)/Unchanged
-# fp1: x/10^ISCALE
-# fp2: x/x
-# F_SCR1:x/x
-# F_SCR2:Abs(X) with $3fff exponent/Unchanged
-# L_SCR1:x/x
-# L_SCR2:first word of X packed/Unchanged
-
-A7_str:
- tst.l %d7 # test sign of k
- bgt.b k_pos # if pos and > 0, skip this
- cmp.l %d7,%d6 # test k - ILOG
- blt.b k_pos # if ILOG >= k, skip this
- mov.l %d7,%d6 # if ((k<0) & (ILOG < k)) ILOG = k
-k_pos:
- mov.l %d6,%d0 # calc ILOG + 1 - LEN in d0
- addq.l &1,%d0 # add the 1
- sub.l %d4,%d0 # sub off LEN
- swap %d5 # use upper word of d5 for LAMBDA
- clr.w %d5 # set it zero initially
- clr.w %d2 # set up d2 for very small case
- tst.l %d0 # test sign of ISCALE
- bge.b iscale # if pos, skip next inst
- addq.w &1,%d5 # if neg, set LAMBDA true
- cmp.l %d0,&0xffffecd4 # test iscale <= -4908
- bgt.b no_inf # if false, skip rest
- add.l &24,%d0 # add in 24 to iscale
- mov.l &24,%d2 # put 24 in d2 for A9
-no_inf:
- neg.l %d0 # and take abs of ISCALE
-iscale:
- fmov.s FONE(%pc),%fp1 # init fp1 to 1
- bfextu USER_FPCR(%a6){&26:&2},%d1 # get initial rmode bits
- lsl.w &1,%d1 # put them in bits 2:1
- add.w %d5,%d1 # add in LAMBDA
- lsl.w &1,%d1 # put them in bits 3:1
- tst.l L_SCR2(%a6) # test sign of original x
- bge.b x_pos # if pos, don't set bit 0
- addq.l &1,%d1 # if neg, set bit 0
-x_pos:
- lea.l RBDTBL(%pc),%a2 # load rbdtbl base
- mov.b (%a2,%d1),%d3 # load d3 with new rmode
- lsl.l &4,%d3 # put bits in proper position
- fmov.l %d3,%fpcr # load bits into fpu
- lsr.l &4,%d3 # put bits in proper position
- tst.b %d3 # decode new rmode for pten table
- bne.b not_rn # if zero, it is RN
- lea.l PTENRN(%pc),%a1 # load a1 with RN table base
- bra.b rmode # exit decode
-not_rn:
- lsr.b &1,%d3 # get lsb in carry
- bcc.b not_rp2 # if carry clear, it is RM
- lea.l PTENRP(%pc),%a1 # load a1 with RP table base
- bra.b rmode # exit decode
-not_rp2:
- lea.l PTENRM(%pc),%a1 # load a1 with RM table base
-rmode:
- clr.l %d3 # clr table index
-e_loop2:
- lsr.l &1,%d0 # shift next bit into carry
- bcc.b e_next2 # if zero, skip the mul
- fmul.x (%a1,%d3),%fp1 # mul by 10**(d3_bit_no)
-e_next2:
- add.l &12,%d3 # inc d3 to next pwrten table entry
- tst.l %d0 # test if ISCALE is zero
- bne.b e_loop2 # if not, loop
-
-# A8. Clr INEX; Force RZ.
-# The operation in A3 above may have set INEX2.
-# RZ mode is forced for the scaling operation to insure
-# only one rounding error. The grs bits are collected in
-# the INEX flag for use in A10.
-#
-# Register usage:
-# Input/Output
-
- fmov.l &0,%fpsr # clr INEX
- fmov.l &rz_mode*0x10,%fpcr # set RZ rounding mode
-
-# A9. Scale X -> Y.
-# The mantissa is scaled to the desired number of significant
-# digits. The excess digits are collected in INEX2. If mul,
-# Check d2 for excess 10 exponential value. If not zero,
-# the iscale value would have caused the pwrten calculation
-# to overflow. Only a negative iscale can cause this, so
-# multiply by 10^(d2), which is now only allowed to be 24,
-# with a multiply by 10^8 and 10^16, which is exact since
-# 10^24 is exact. If the input was denormalized, we must
-# create a busy stack frame with the mul command and the
-# two operands, and allow the fpu to complete the multiply.
-#
-# Register usage:
-# Input/Output
-# d0: FPCR with RZ mode/Unchanged
-# d2: 0 or 24/unchanged
-# d3: x/x
-# d4: LEN/Unchanged
-# d5: ICTR:LAMBDA
-# d6: ILOG/Unchanged
-# d7: k-factor/Unchanged
-# a0: ptr for original operand/final result
-# a1: ptr to PTENRM array/Unchanged
-# a2: x/x
-# fp0: float(ILOG)/X adjusted for SCALE (Y)
-# fp1: 10^ISCALE/Unchanged
-# fp2: x/x
-# F_SCR1:x/x
-# F_SCR2:Abs(X) with $3fff exponent/Unchanged
-# L_SCR1:x/x
-# L_SCR2:first word of X packed/Unchanged
-
-A9_str:
- fmov.x (%a0),%fp0 # load X from memory
- fabs.x %fp0 # use abs(X)
- tst.w %d5 # LAMBDA is in lower word of d5
- bne.b sc_mul # if neg (LAMBDA = 1), scale by mul
- fdiv.x %fp1,%fp0 # calculate X / SCALE -> Y to fp0
- bra.w A10_st # branch to A10
-
-sc_mul:
- tst.b BINDEC_FLG(%a6) # check for denorm
- beq.w A9_norm # if norm, continue with mul
-
-# for DENORM, we must calculate:
-# fp0 = input_op * 10^ISCALE * 10^24
-# since the input operand is a DENORM, we can't multiply it directly.
-# so, we do the multiplication of the exponents and mantissas separately.
-# in this way, we avoid underflow on intermediate stages of the
-# multiplication and guarantee a result without exception.
- fmovm.x &0x2,-(%sp) # save 10^ISCALE to stack
-
- mov.w (%sp),%d3 # grab exponent
- andi.w &0x7fff,%d3 # clear sign
- ori.w &0x8000,(%a0) # make DENORM exp negative
- add.w (%a0),%d3 # add DENORM exp to 10^ISCALE exp
- subi.w &0x3fff,%d3 # subtract BIAS
- add.w 36(%a1),%d3
- subi.w &0x3fff,%d3 # subtract BIAS
- add.w 48(%a1),%d3
- subi.w &0x3fff,%d3 # subtract BIAS
-
- bmi.w sc_mul_err # is result is DENORM, punt!!!
-
- andi.w &0x8000,(%sp) # keep sign
- or.w %d3,(%sp) # insert new exponent
- andi.w &0x7fff,(%a0) # clear sign bit on DENORM again
- mov.l 0x8(%a0),-(%sp) # put input op mantissa on stk
- mov.l 0x4(%a0),-(%sp)
- mov.l &0x3fff0000,-(%sp) # force exp to zero
- fmovm.x (%sp)+,&0x80 # load normalized DENORM into fp0
- fmul.x (%sp)+,%fp0
-
-# fmul.x 36(%a1),%fp0 # multiply fp0 by 10^8
-# fmul.x 48(%a1),%fp0 # multiply fp0 by 10^16
- mov.l 36+8(%a1),-(%sp) # get 10^8 mantissa
- mov.l 36+4(%a1),-(%sp)
- mov.l &0x3fff0000,-(%sp) # force exp to zero
- mov.l 48+8(%a1),-(%sp) # get 10^16 mantissa
- mov.l 48+4(%a1),-(%sp)
- mov.l &0x3fff0000,-(%sp)# force exp to zero
- fmul.x (%sp)+,%fp0 # multiply fp0 by 10^8
- fmul.x (%sp)+,%fp0 # multiply fp0 by 10^16
- bra.b A10_st
-
-sc_mul_err:
- bra.b sc_mul_err
-
-A9_norm:
- tst.w %d2 # test for small exp case
- beq.b A9_con # if zero, continue as normal
- fmul.x 36(%a1),%fp0 # multiply fp0 by 10^8
- fmul.x 48(%a1),%fp0 # multiply fp0 by 10^16
-A9_con:
- fmul.x %fp1,%fp0 # calculate X * SCALE -> Y to fp0
-
-# A10. Or in INEX.
-# If INEX is set, round error occurred. This is compensated
-# for by 'or-ing' in the INEX2 flag to the lsb of Y.
-#
-# Register usage:
-# Input/Output
-# d0: FPCR with RZ mode/FPSR with INEX2 isolated
-# d2: x/x
-# d3: x/x
-# d4: LEN/Unchanged
-# d5: ICTR:LAMBDA
-# d6: ILOG/Unchanged
-# d7: k-factor/Unchanged
-# a0: ptr for original operand/final result
-# a1: ptr to PTENxx array/Unchanged
-# a2: x/ptr to FP_SCR1(a6)
-# fp0: Y/Y with lsb adjusted
-# fp1: 10^ISCALE/Unchanged
-# fp2: x/x
-
-A10_st:
- fmov.l %fpsr,%d0 # get FPSR
- fmov.x %fp0,FP_SCR1(%a6) # move Y to memory
- lea.l FP_SCR1(%a6),%a2 # load a2 with ptr to FP_SCR1
- btst &9,%d0 # check if INEX2 set
- beq.b A11_st # if clear, skip rest
- or.l &1,8(%a2) # or in 1 to lsb of mantissa
- fmov.x FP_SCR1(%a6),%fp0 # write adjusted Y back to fpu
-
-
-# A11. Restore original FPCR; set size ext.
-# Perform FINT operation in the user's rounding mode. Keep
-# the size to extended. The sintdo entry point in the sint
-# routine expects the FPCR value to be in USER_FPCR for
-# mode and precision. The original FPCR is saved in L_SCR1.
-
-A11_st:
- mov.l USER_FPCR(%a6),L_SCR1(%a6) # save it for later
- and.l &0x00000030,USER_FPCR(%a6) # set size to ext,
-# ;block exceptions
-
-
-# A12. Calculate YINT = FINT(Y) according to user's rounding mode.
-# The FPSP routine sintd0 is used. The output is in fp0.
-#
-# Register usage:
-# Input/Output
-# d0: FPSR with AINEX cleared/FPCR with size set to ext
-# d2: x/x/scratch
-# d3: x/x
-# d4: LEN/Unchanged
-# d5: ICTR:LAMBDA/Unchanged
-# d6: ILOG/Unchanged
-# d7: k-factor/Unchanged
-# a0: ptr for original operand/src ptr for sintdo
-# a1: ptr to PTENxx array/Unchanged
-# a2: ptr to FP_SCR1(a6)/Unchanged
-# a6: temp pointer to FP_SCR1(a6) - orig value saved and restored
-# fp0: Y/YINT
-# fp1: 10^ISCALE/Unchanged
-# fp2: x/x
-# F_SCR1:x/x
-# F_SCR2:Y adjusted for inex/Y with original exponent
-# L_SCR1:x/original USER_FPCR
-# L_SCR2:first word of X packed/Unchanged
-
-A12_st:
- movm.l &0xc0c0,-(%sp) # save regs used by sintd0 {%d0-%d1/%a0-%a1}
- mov.l L_SCR1(%a6),-(%sp)
- mov.l L_SCR2(%a6),-(%sp)
-
- lea.l FP_SCR1(%a6),%a0 # a0 is ptr to FP_SCR1(a6)
- fmov.x %fp0,(%a0) # move Y to memory at FP_SCR1(a6)
- tst.l L_SCR2(%a6) # test sign of original operand
- bge.b do_fint12 # if pos, use Y
- or.l &0x80000000,(%a0) # if neg, use -Y
-do_fint12:
- mov.l USER_FPSR(%a6),-(%sp)
-# bsr sintdo # sint routine returns int in fp0
-
- fmov.l USER_FPCR(%a6),%fpcr
- fmov.l &0x0,%fpsr # clear the AEXC bits!!!
-## mov.l USER_FPCR(%a6),%d0 # ext prec/keep rnd mode
-## andi.l &0x00000030,%d0
-## fmov.l %d0,%fpcr
- fint.x FP_SCR1(%a6),%fp0 # do fint()
- fmov.l %fpsr,%d0
- or.w %d0,FPSR_EXCEPT(%a6)
-## fmov.l &0x0,%fpcr
-## fmov.l %fpsr,%d0 # don't keep ccodes
-## or.w %d0,FPSR_EXCEPT(%a6)
-
- mov.b (%sp),USER_FPSR(%a6)
- add.l &4,%sp
-
- mov.l (%sp)+,L_SCR2(%a6)
- mov.l (%sp)+,L_SCR1(%a6)
- movm.l (%sp)+,&0x303 # restore regs used by sint {%d0-%d1/%a0-%a1}
-
- mov.l L_SCR2(%a6),FP_SCR1(%a6) # restore original exponent
- mov.l L_SCR1(%a6),USER_FPCR(%a6) # restore user's FPCR
-
-# A13. Check for LEN digits.
-# If the int operation results in more than LEN digits,
-# or less than LEN -1 digits, adjust ILOG and repeat from
-# A6. This test occurs only on the first pass. If the
-# result is exactly 10^LEN, decrement ILOG and divide
-# the mantissa by 10. The calculation of 10^LEN cannot
-# be inexact, since all powers of ten upto 10^27 are exact
-# in extended precision, so the use of a previous power-of-ten
-# table will introduce no error.
-#
-#
-# Register usage:
-# Input/Output
-# d0: FPCR with size set to ext/scratch final = 0
-# d2: x/x
-# d3: x/scratch final = x
-# d4: LEN/LEN adjusted
-# d5: ICTR:LAMBDA/LAMBDA:ICTR
-# d6: ILOG/ILOG adjusted
-# d7: k-factor/Unchanged
-# a0: pointer into memory for packed bcd string formation
-# a1: ptr to PTENxx array/Unchanged
-# a2: ptr to FP_SCR1(a6)/Unchanged
-# fp0: int portion of Y/abs(YINT) adjusted
-# fp1: 10^ISCALE/Unchanged
-# fp2: x/10^LEN
-# F_SCR1:x/x
-# F_SCR2:Y with original exponent/Unchanged
-# L_SCR1:original USER_FPCR/Unchanged
-# L_SCR2:first word of X packed/Unchanged
-
-A13_st:
- swap %d5 # put ICTR in lower word of d5
- tst.w %d5 # check if ICTR = 0
- bne not_zr # if non-zero, go to second test
-#
-# Compute 10^(LEN-1)
-#
- fmov.s FONE(%pc),%fp2 # init fp2 to 1.0
- mov.l %d4,%d0 # put LEN in d0
- subq.l &1,%d0 # d0 = LEN -1
- clr.l %d3 # clr table index
-l_loop:
- lsr.l &1,%d0 # shift next bit into carry
- bcc.b l_next # if zero, skip the mul
- fmul.x (%a1,%d3),%fp2 # mul by 10**(d3_bit_no)
-l_next:
- add.l &12,%d3 # inc d3 to next pwrten table entry
- tst.l %d0 # test if LEN is zero
- bne.b l_loop # if not, loop
-#
-# 10^LEN-1 is computed for this test and A14. If the input was
-# denormalized, check only the case in which YINT > 10^LEN.
-#
- tst.b BINDEC_FLG(%a6) # check if input was norm
- beq.b A13_con # if norm, continue with checking
- fabs.x %fp0 # take abs of YINT
- bra test_2
-#
-# Compare abs(YINT) to 10^(LEN-1) and 10^LEN
-#
-A13_con:
- fabs.x %fp0 # take abs of YINT
- fcmp.x %fp0,%fp2 # compare abs(YINT) with 10^(LEN-1)
- fbge.w test_2 # if greater, do next test
- subq.l &1,%d6 # subtract 1 from ILOG
- mov.w &1,%d5 # set ICTR
- fmov.l &rm_mode*0x10,%fpcr # set rmode to RM
- fmul.s FTEN(%pc),%fp2 # compute 10^LEN
- bra.w A6_str # return to A6 and recompute YINT
-test_2:
- fmul.s FTEN(%pc),%fp2 # compute 10^LEN
- fcmp.x %fp0,%fp2 # compare abs(YINT) with 10^LEN
- fblt.w A14_st # if less, all is ok, go to A14
- fbgt.w fix_ex # if greater, fix and redo
- fdiv.s FTEN(%pc),%fp0 # if equal, divide by 10
- addq.l &1,%d6 # and inc ILOG
- bra.b A14_st # and continue elsewhere
-fix_ex:
- addq.l &1,%d6 # increment ILOG by 1
- mov.w &1,%d5 # set ICTR
- fmov.l &rm_mode*0x10,%fpcr # set rmode to RM
- bra.w A6_str # return to A6 and recompute YINT
-#
-# Since ICTR <> 0, we have already been through one adjustment,
-# and shouldn't have another; this is to check if abs(YINT) = 10^LEN
-# 10^LEN is again computed using whatever table is in a1 since the
-# value calculated cannot be inexact.
-#
-not_zr:
- fmov.s FONE(%pc),%fp2 # init fp2 to 1.0
- mov.l %d4,%d0 # put LEN in d0
- clr.l %d3 # clr table index
-z_loop:
- lsr.l &1,%d0 # shift next bit into carry
- bcc.b z_next # if zero, skip the mul
- fmul.x (%a1,%d3),%fp2 # mul by 10**(d3_bit_no)
-z_next:
- add.l &12,%d3 # inc d3 to next pwrten table entry
- tst.l %d0 # test if LEN is zero
- bne.b z_loop # if not, loop
- fabs.x %fp0 # get abs(YINT)
- fcmp.x %fp0,%fp2 # check if abs(YINT) = 10^LEN
- fbneq.w A14_st # if not, skip this
- fdiv.s FTEN(%pc),%fp0 # divide abs(YINT) by 10
- addq.l &1,%d6 # and inc ILOG by 1
- addq.l &1,%d4 # and inc LEN
- fmul.s FTEN(%pc),%fp2 # if LEN++, the get 10^^LEN
-
-# A14. Convert the mantissa to bcd.
-# The binstr routine is used to convert the LEN digit
-# mantissa to bcd in memory. The input to binstr is
-# to be a fraction; i.e. (mantissa)/10^LEN and adjusted
-# such that the decimal point is to the left of bit 63.
-# The bcd digits are stored in the correct position in
-# the final string area in memory.
-#
-#
-# Register usage:
-# Input/Output
-# d0: x/LEN call to binstr - final is 0
-# d1: x/0
-# d2: x/ms 32-bits of mant of abs(YINT)
-# d3: x/ls 32-bits of mant of abs(YINT)
-# d4: LEN/Unchanged
-# d5: ICTR:LAMBDA/LAMBDA:ICTR
-# d6: ILOG
-# d7: k-factor/Unchanged
-# a0: pointer into memory for packed bcd string formation
-# /ptr to first mantissa byte in result string
-# a1: ptr to PTENxx array/Unchanged
-# a2: ptr to FP_SCR1(a6)/Unchanged
-# fp0: int portion of Y/abs(YINT) adjusted
-# fp1: 10^ISCALE/Unchanged
-# fp2: 10^LEN/Unchanged
-# F_SCR1:x/Work area for final result
-# F_SCR2:Y with original exponent/Unchanged
-# L_SCR1:original USER_FPCR/Unchanged
-# L_SCR2:first word of X packed/Unchanged
-
-A14_st:
- fmov.l &rz_mode*0x10,%fpcr # force rz for conversion
- fdiv.x %fp2,%fp0 # divide abs(YINT) by 10^LEN
- lea.l FP_SCR0(%a6),%a0
- fmov.x %fp0,(%a0) # move abs(YINT)/10^LEN to memory
- mov.l 4(%a0),%d2 # move 2nd word of FP_RES to d2
- mov.l 8(%a0),%d3 # move 3rd word of FP_RES to d3
- clr.l 4(%a0) # zero word 2 of FP_RES
- clr.l 8(%a0) # zero word 3 of FP_RES
- mov.l (%a0),%d0 # move exponent to d0
- swap %d0 # put exponent in lower word
- beq.b no_sft # if zero, don't shift
- sub.l &0x3ffd,%d0 # sub bias less 2 to make fract
- tst.l %d0 # check if > 1
- bgt.b no_sft # if so, don't shift
- neg.l %d0 # make exp positive
-m_loop:
- lsr.l &1,%d2 # shift d2:d3 right, add 0s
- roxr.l &1,%d3 # the number of places
- dbf.w %d0,m_loop # given in d0
-no_sft:
- tst.l %d2 # check for mantissa of zero
- bne.b no_zr # if not, go on
- tst.l %d3 # continue zero check
- beq.b zer_m # if zero, go directly to binstr
-no_zr:
- clr.l %d1 # put zero in d1 for addx
- add.l &0x00000080,%d3 # inc at bit 7
- addx.l %d1,%d2 # continue inc
- and.l &0xffffff80,%d3 # strip off lsb not used by 882
-zer_m:
- mov.l %d4,%d0 # put LEN in d0 for binstr call
- addq.l &3,%a0 # a0 points to M16 byte in result
- bsr binstr # call binstr to convert mant
-
-
-# A15. Convert the exponent to bcd.
-# As in A14 above, the exp is converted to bcd and the
-# digits are stored in the final string.
-#
-# Digits are stored in L_SCR1(a6) on return from BINDEC as:
-#
-# 32 16 15 0
-# -----------------------------------------
-# | 0 | e3 | e2 | e1 | e4 | X | X | X |
-# -----------------------------------------
-#
-# And are moved into their proper places in FP_SCR0. If digit e4
-# is non-zero, OPERR is signaled. In all cases, all 4 digits are
-# written as specified in the 881/882 manual for packed decimal.
-#
-# Register usage:
-# Input/Output
-# d0: x/LEN call to binstr - final is 0
-# d1: x/scratch (0);shift count for final exponent packing
-# d2: x/ms 32-bits of exp fraction/scratch
-# d3: x/ls 32-bits of exp fraction
-# d4: LEN/Unchanged
-# d5: ICTR:LAMBDA/LAMBDA:ICTR
-# d6: ILOG
-# d7: k-factor/Unchanged
-# a0: ptr to result string/ptr to L_SCR1(a6)
-# a1: ptr to PTENxx array/Unchanged
-# a2: ptr to FP_SCR1(a6)/Unchanged
-# fp0: abs(YINT) adjusted/float(ILOG)
-# fp1: 10^ISCALE/Unchanged
-# fp2: 10^LEN/Unchanged
-# F_SCR1:Work area for final result/BCD result
-# F_SCR2:Y with original exponent/ILOG/10^4
-# L_SCR1:original USER_FPCR/Exponent digits on return from binstr
-# L_SCR2:first word of X packed/Unchanged
-
-A15_st:
- tst.b BINDEC_FLG(%a6) # check for denorm
- beq.b not_denorm
- ftest.x %fp0 # test for zero
- fbeq.w den_zero # if zero, use k-factor or 4933
- fmov.l %d6,%fp0 # float ILOG
- fabs.x %fp0 # get abs of ILOG
- bra.b convrt
-den_zero:
- tst.l %d7 # check sign of the k-factor
- blt.b use_ilog # if negative, use ILOG
- fmov.s F4933(%pc),%fp0 # force exponent to 4933
- bra.b convrt # do it
-use_ilog:
- fmov.l %d6,%fp0 # float ILOG
- fabs.x %fp0 # get abs of ILOG
- bra.b convrt
-not_denorm:
- ftest.x %fp0 # test for zero
- fbneq.w not_zero # if zero, force exponent
- fmov.s FONE(%pc),%fp0 # force exponent to 1
- bra.b convrt # do it
-not_zero:
- fmov.l %d6,%fp0 # float ILOG
- fabs.x %fp0 # get abs of ILOG
-convrt:
- fdiv.x 24(%a1),%fp0 # compute ILOG/10^4
- fmov.x %fp0,FP_SCR1(%a6) # store fp0 in memory
- mov.l 4(%a2),%d2 # move word 2 to d2
- mov.l 8(%a2),%d3 # move word 3 to d3
- mov.w (%a2),%d0 # move exp to d0
- beq.b x_loop_fin # if zero, skip the shift
- sub.w &0x3ffd,%d0 # subtract off bias
- neg.w %d0 # make exp positive
-x_loop:
- lsr.l &1,%d2 # shift d2:d3 right
- roxr.l &1,%d3 # the number of places
- dbf.w %d0,x_loop # given in d0
-x_loop_fin:
- clr.l %d1 # put zero in d1 for addx
- add.l &0x00000080,%d3 # inc at bit 6
- addx.l %d1,%d2 # continue inc
- and.l &0xffffff80,%d3 # strip off lsb not used by 882
- mov.l &4,%d0 # put 4 in d0 for binstr call
- lea.l L_SCR1(%a6),%a0 # a0 is ptr to L_SCR1 for exp digits
- bsr binstr # call binstr to convert exp
- mov.l L_SCR1(%a6),%d0 # load L_SCR1 lword to d0
- mov.l &12,%d1 # use d1 for shift count
- lsr.l %d1,%d0 # shift d0 right by 12
- bfins %d0,FP_SCR0(%a6){&4:&12} # put e3:e2:e1 in FP_SCR0
- lsr.l %d1,%d0 # shift d0 right by 12
- bfins %d0,FP_SCR0(%a6){&16:&4} # put e4 in FP_SCR0
- tst.b %d0 # check if e4 is zero
- beq.b A16_st # if zero, skip rest
- or.l &opaop_mask,USER_FPSR(%a6) # set OPERR & AIOP in USER_FPSR
-
-
-# A16. Write sign bits to final string.
-# Sigma is bit 31 of initial value; RHO is bit 31 of d6 (ILOG).
-#
-# Register usage:
-# Input/Output
-# d0: x/scratch - final is x
-# d2: x/x
-# d3: x/x
-# d4: LEN/Unchanged
-# d5: ICTR:LAMBDA/LAMBDA:ICTR
-# d6: ILOG/ILOG adjusted
-# d7: k-factor/Unchanged
-# a0: ptr to L_SCR1(a6)/Unchanged
-# a1: ptr to PTENxx array/Unchanged
-# a2: ptr to FP_SCR1(a6)/Unchanged
-# fp0: float(ILOG)/Unchanged
-# fp1: 10^ISCALE/Unchanged
-# fp2: 10^LEN/Unchanged
-# F_SCR1:BCD result with correct signs
-# F_SCR2:ILOG/10^4
-# L_SCR1:Exponent digits on return from binstr
-# L_SCR2:first word of X packed/Unchanged
-
-A16_st:
- clr.l %d0 # clr d0 for collection of signs
- and.b &0x0f,FP_SCR0(%a6) # clear first nibble of FP_SCR0
- tst.l L_SCR2(%a6) # check sign of original mantissa
- bge.b mant_p # if pos, don't set SM
- mov.l &2,%d0 # move 2 in to d0 for SM
-mant_p:
- tst.l %d6 # check sign of ILOG
- bge.b wr_sgn # if pos, don't set SE
- addq.l &1,%d0 # set bit 0 in d0 for SE
-wr_sgn:
- bfins %d0,FP_SCR0(%a6){&0:&2} # insert SM and SE into FP_SCR0
-
-# Clean up and restore all registers used.
-
- fmov.l &0,%fpsr # clear possible inex2/ainex bits
- fmovm.x (%sp)+,&0xe0 # {%fp0-%fp2}
- movm.l (%sp)+,&0x4fc # {%d2-%d7/%a2}
- rts
-
- global PTENRN
-PTENRN:
- long 0x40020000,0xA0000000,0x00000000 # 10 ^ 1
- long 0x40050000,0xC8000000,0x00000000 # 10 ^ 2
- long 0x400C0000,0x9C400000,0x00000000 # 10 ^ 4
- long 0x40190000,0xBEBC2000,0x00000000 # 10 ^ 8
- long 0x40340000,0x8E1BC9BF,0x04000000 # 10 ^ 16
- long 0x40690000,0x9DC5ADA8,0x2B70B59E # 10 ^ 32
- long 0x40D30000,0xC2781F49,0xFFCFA6D5 # 10 ^ 64
- long 0x41A80000,0x93BA47C9,0x80E98CE0 # 10 ^ 128
- long 0x43510000,0xAA7EEBFB,0x9DF9DE8E # 10 ^ 256
- long 0x46A30000,0xE319A0AE,0xA60E91C7 # 10 ^ 512
- long 0x4D480000,0xC9767586,0x81750C17 # 10 ^ 1024
- long 0x5A920000,0x9E8B3B5D,0xC53D5DE5 # 10 ^ 2048
- long 0x75250000,0xC4605202,0x8A20979B # 10 ^ 4096
-
- global PTENRP
-PTENRP:
- long 0x40020000,0xA0000000,0x00000000 # 10 ^ 1
- long 0x40050000,0xC8000000,0x00000000 # 10 ^ 2
- long 0x400C0000,0x9C400000,0x00000000 # 10 ^ 4
- long 0x40190000,0xBEBC2000,0x00000000 # 10 ^ 8
- long 0x40340000,0x8E1BC9BF,0x04000000 # 10 ^ 16
- long 0x40690000,0x9DC5ADA8,0x2B70B59E # 10 ^ 32
- long 0x40D30000,0xC2781F49,0xFFCFA6D6 # 10 ^ 64
- long 0x41A80000,0x93BA47C9,0x80E98CE0 # 10 ^ 128
- long 0x43510000,0xAA7EEBFB,0x9DF9DE8E # 10 ^ 256
- long 0x46A30000,0xE319A0AE,0xA60E91C7 # 10 ^ 512
- long 0x4D480000,0xC9767586,0x81750C18 # 10 ^ 1024
- long 0x5A920000,0x9E8B3B5D,0xC53D5DE5 # 10 ^ 2048
- long 0x75250000,0xC4605202,0x8A20979B # 10 ^ 4096
-
- global PTENRM
-PTENRM:
- long 0x40020000,0xA0000000,0x00000000 # 10 ^ 1
- long 0x40050000,0xC8000000,0x00000000 # 10 ^ 2
- long 0x400C0000,0x9C400000,0x00000000 # 10 ^ 4
- long 0x40190000,0xBEBC2000,0x00000000 # 10 ^ 8
- long 0x40340000,0x8E1BC9BF,0x04000000 # 10 ^ 16
- long 0x40690000,0x9DC5ADA8,0x2B70B59D # 10 ^ 32
- long 0x40D30000,0xC2781F49,0xFFCFA6D5 # 10 ^ 64
- long 0x41A80000,0x93BA47C9,0x80E98CDF # 10 ^ 128
- long 0x43510000,0xAA7EEBFB,0x9DF9DE8D # 10 ^ 256
- long 0x46A30000,0xE319A0AE,0xA60E91C6 # 10 ^ 512
- long 0x4D480000,0xC9767586,0x81750C17 # 10 ^ 1024
- long 0x5A920000,0x9E8B3B5D,0xC53D5DE4 # 10 ^ 2048
- long 0x75250000,0xC4605202,0x8A20979A # 10 ^ 4096
-
-#########################################################################
-# binstr(): Converts a 64-bit binary integer to bcd. #
-# #
-# INPUT *************************************************************** #
-# d2:d3 = 64-bit binary integer #
-# d0 = desired length (LEN) #
-# a0 = pointer to start in memory for bcd characters #
-# (This pointer must point to byte 4 of the first #
-# lword of the packed decimal memory string.) #
-# #
-# OUTPUT ************************************************************** #
-# a0 = pointer to LEN bcd digits representing the 64-bit integer. #
-# #
-# ALGORITHM *********************************************************** #
-# The 64-bit binary is assumed to have a decimal point before #
-# bit 63. The fraction is multiplied by 10 using a mul by 2 #
-# shift and a mul by 8 shift. The bits shifted out of the #
-# msb form a decimal digit. This process is iterated until #
-# LEN digits are formed. #
-# #
-# A1. Init d7 to 1. D7 is the byte digit counter, and if 1, the #
-# digit formed will be assumed the least significant. This is #
-# to force the first byte formed to have a 0 in the upper 4 bits. #
-# #
-# A2. Beginning of the loop: #
-# Copy the fraction in d2:d3 to d4:d5. #
-# #
-# A3. Multiply the fraction in d2:d3 by 8 using bit-field #
-# extracts and shifts. The three msbs from d2 will go into d1. #
-# #
-# A4. Multiply the fraction in d4:d5 by 2 using shifts. The msb #
-# will be collected by the carry. #
-# #
-# A5. Add using the carry the 64-bit quantities in d2:d3 and d4:d5 #
-# into d2:d3. D1 will contain the bcd digit formed. #
-# #
-# A6. Test d7. If zero, the digit formed is the ms digit. If non- #
-# zero, it is the ls digit. Put the digit in its place in the #
-# upper word of d0. If it is the ls digit, write the word #
-# from d0 to memory. #
-# #
-# A7. Decrement d6 (LEN counter) and repeat the loop until zero. #
-# #
-#########################################################################
-
-# Implementation Notes:
-#
-# The registers are used as follows:
-#
-# d0: LEN counter
-# d1: temp used to form the digit
-# d2: upper 32-bits of fraction for mul by 8
-# d3: lower 32-bits of fraction for mul by 8
-# d4: upper 32-bits of fraction for mul by 2
-# d5: lower 32-bits of fraction for mul by 2
-# d6: temp for bit-field extracts
-# d7: byte digit formation word;digit count {0,1}
-# a0: pointer into memory for packed bcd string formation
-#
-
- global binstr
-binstr:
- movm.l &0xff00,-(%sp) # {%d0-%d7}
-
-#
-# A1: Init d7
-#
- mov.l &1,%d7 # init d7 for second digit
- subq.l &1,%d0 # for dbf d0 would have LEN+1 passes
-#
-# A2. Copy d2:d3 to d4:d5. Start loop.
-#
-loop:
- mov.l %d2,%d4 # copy the fraction before muls
- mov.l %d3,%d5 # to d4:d5
-#
-# A3. Multiply d2:d3 by 8; extract msbs into d1.
-#
- bfextu %d2{&0:&3},%d1 # copy 3 msbs of d2 into d1
- asl.l &3,%d2 # shift d2 left by 3 places
- bfextu %d3{&0:&3},%d6 # copy 3 msbs of d3 into d6
- asl.l &3,%d3 # shift d3 left by 3 places
- or.l %d6,%d2 # or in msbs from d3 into d2
-#
-# A4. Multiply d4:d5 by 2; add carry out to d1.
-#
- asl.l &1,%d5 # mul d5 by 2
- roxl.l &1,%d4 # mul d4 by 2
- swap %d6 # put 0 in d6 lower word
- addx.w %d6,%d1 # add in extend from mul by 2
-#
-# A5. Add mul by 8 to mul by 2. D1 contains the digit formed.
-#
- add.l %d5,%d3 # add lower 32 bits
- nop # ERRATA FIX #13 (Rev. 1.2 6/6/90)
- addx.l %d4,%d2 # add with extend upper 32 bits
- nop # ERRATA FIX #13 (Rev. 1.2 6/6/90)
- addx.w %d6,%d1 # add in extend from add to d1
- swap %d6 # with d6 = 0; put 0 in upper word
-#
-# A6. Test d7 and branch.
-#
- tst.w %d7 # if zero, store digit & to loop
- beq.b first_d # if non-zero, form byte & write
-sec_d:
- swap %d7 # bring first digit to word d7b
- asl.w &4,%d7 # first digit in upper 4 bits d7b
- add.w %d1,%d7 # add in ls digit to d7b
- mov.b %d7,(%a0)+ # store d7b byte in memory
- swap %d7 # put LEN counter in word d7a
- clr.w %d7 # set d7a to signal no digits done
- dbf.w %d0,loop # do loop some more!
- bra.b end_bstr # finished, so exit
-first_d:
- swap %d7 # put digit word in d7b
- mov.w %d1,%d7 # put new digit in d7b
- swap %d7 # put LEN counter in word d7a
- addq.w &1,%d7 # set d7a to signal first digit done
- dbf.w %d0,loop # do loop some more!
- swap %d7 # put last digit in string
- lsl.w &4,%d7 # move it to upper 4 bits
- mov.b %d7,(%a0)+ # store it in memory string
-#
-# Clean up and return with result in fp0.
-#
-end_bstr:
- movm.l (%sp)+,&0xff # {%d0-%d7}
- rts
-
-#########################################################################
-# XDEF **************************************************************** #
-# facc_in_b(): dmem_read_byte failed #
-# facc_in_w(): dmem_read_word failed #
-# facc_in_l(): dmem_read_long failed #
-# facc_in_d(): dmem_read of dbl prec failed #
-# facc_in_x(): dmem_read of ext prec failed #
-# #
-# facc_out_b(): dmem_write_byte failed #
-# facc_out_w(): dmem_write_word failed #
-# facc_out_l(): dmem_write_long failed #
-# facc_out_d(): dmem_write of dbl prec failed #
-# facc_out_x(): dmem_write of ext prec failed #
-# #
-# XREF **************************************************************** #
-# _real_access() - exit through access error handler #
-# #
-# INPUT *************************************************************** #
-# None #
-# #
-# OUTPUT ************************************************************** #
-# None #
-# #
-# ALGORITHM *********************************************************** #
-# Flow jumps here when an FP data fetch call gets an error #
-# result. This means the operating system wants an access error frame #
-# made out of the current exception stack frame. #
-# So, we first call restore() which makes sure that any updated #
-# -(an)+ register gets returned to its pre-exception value and then #
-# we change the stack to an access error stack frame. #
-# #
-#########################################################################
-
-facc_in_b:
- movq.l &0x1,%d0 # one byte
- bsr.w restore # fix An
-
- mov.w &0x0121,EXC_VOFF(%a6) # set FSLW
- bra.w facc_finish
-
-facc_in_w:
- movq.l &0x2,%d0 # two bytes
- bsr.w restore # fix An
-
- mov.w &0x0141,EXC_VOFF(%a6) # set FSLW
- bra.b facc_finish
-
-facc_in_l:
- movq.l &0x4,%d0 # four bytes
- bsr.w restore # fix An
-
- mov.w &0x0101,EXC_VOFF(%a6) # set FSLW
- bra.b facc_finish
-
-facc_in_d:
- movq.l &0x8,%d0 # eight bytes
- bsr.w restore # fix An
-
- mov.w &0x0161,EXC_VOFF(%a6) # set FSLW
- bra.b facc_finish
-
-facc_in_x:
- movq.l &0xc,%d0 # twelve bytes
- bsr.w restore # fix An
-
- mov.w &0x0161,EXC_VOFF(%a6) # set FSLW
- bra.b facc_finish
-
-################################################################
-
-facc_out_b:
- movq.l &0x1,%d0 # one byte
- bsr.w restore # restore An
-
- mov.w &0x00a1,EXC_VOFF(%a6) # set FSLW
- bra.b facc_finish
-
-facc_out_w:
- movq.l &0x2,%d0 # two bytes
- bsr.w restore # restore An
-
- mov.w &0x00c1,EXC_VOFF(%a6) # set FSLW
- bra.b facc_finish
-
-facc_out_l:
- movq.l &0x4,%d0 # four bytes
- bsr.w restore # restore An
-
- mov.w &0x0081,EXC_VOFF(%a6) # set FSLW
- bra.b facc_finish
-
-facc_out_d:
- movq.l &0x8,%d0 # eight bytes
- bsr.w restore # restore An
-
- mov.w &0x00e1,EXC_VOFF(%a6) # set FSLW
- bra.b facc_finish
-
-facc_out_x:
- mov.l &0xc,%d0 # twelve bytes
- bsr.w restore # restore An
-
- mov.w &0x00e1,EXC_VOFF(%a6) # set FSLW
-
-# here's where we actually create the access error frame from the
-# current exception stack frame.
-facc_finish:
- mov.l USER_FPIAR(%a6),EXC_PC(%a6) # store current PC
-
- fmovm.x EXC_FPREGS(%a6),&0xc0 # restore fp0-fp1
- fmovm.l USER_FPCR(%a6),%fpcr,%fpsr,%fpiar # restore ctrl regs
- movm.l EXC_DREGS(%a6),&0x0303 # restore d0-d1/a0-a1
-
- unlk %a6
-
- mov.l (%sp),-(%sp) # store SR, hi(PC)
- mov.l 0x8(%sp),0x4(%sp) # store lo(PC)
- mov.l 0xc(%sp),0x8(%sp) # store EA
- mov.l &0x00000001,0xc(%sp) # store FSLW
- mov.w 0x6(%sp),0xc(%sp) # fix FSLW (size)
- mov.w &0x4008,0x6(%sp) # store voff
-
- btst &0x5,(%sp) # supervisor or user mode?
- beq.b facc_out2 # user
- bset &0x2,0xd(%sp) # set supervisor TM bit
-
-facc_out2:
- bra.l _real_access
-
-##################################################################
-
-# if the effective addressing mode was predecrement or postincrement,
-# the emulation has already changed its value to the correct post-
-# instruction value. but since we're exiting to the access error
-# handler, then AN must be returned to its pre-instruction value.
-# we do that here.
-restore:
- mov.b EXC_OPWORD+0x1(%a6),%d1
- andi.b &0x38,%d1 # extract opmode
- cmpi.b %d1,&0x18 # postinc?
- beq.w rest_inc
- cmpi.b %d1,&0x20 # predec?
- beq.w rest_dec
- rts
-
-rest_inc:
- mov.b EXC_OPWORD+0x1(%a6),%d1
- andi.w &0x0007,%d1 # fetch An
-
- mov.w (tbl_rest_inc.b,%pc,%d1.w*2),%d1
- jmp (tbl_rest_inc.b,%pc,%d1.w*1)
-
-tbl_rest_inc:
- short ri_a0 - tbl_rest_inc
- short ri_a1 - tbl_rest_inc
- short ri_a2 - tbl_rest_inc
- short ri_a3 - tbl_rest_inc
- short ri_a4 - tbl_rest_inc
- short ri_a5 - tbl_rest_inc
- short ri_a6 - tbl_rest_inc
- short ri_a7 - tbl_rest_inc
-
-ri_a0:
- sub.l %d0,EXC_DREGS+0x8(%a6) # fix stacked a0
- rts
-ri_a1:
- sub.l %d0,EXC_DREGS+0xc(%a6) # fix stacked a1
- rts
-ri_a2:
- sub.l %d0,%a2 # fix a2
- rts
-ri_a3:
- sub.l %d0,%a3 # fix a3
- rts
-ri_a4:
- sub.l %d0,%a4 # fix a4
- rts
-ri_a5:
- sub.l %d0,%a5 # fix a5
- rts
-ri_a6:
- sub.l %d0,(%a6) # fix stacked a6
- rts
-# if it's a fmove out instruction, we don't have to fix a7
-# because we hadn't changed it yet. if it's an opclass two
-# instruction (data moved in) and the exception was in supervisor
-# mode, then also also wasn't updated. if it was user mode, then
-# restore the correct a7 which is in the USP currently.
-ri_a7:
- cmpi.b EXC_VOFF(%a6),&0x30 # move in or out?
- bne.b ri_a7_done # out
-
- btst &0x5,EXC_SR(%a6) # user or supervisor?
- bne.b ri_a7_done # supervisor
- movc %usp,%a0 # restore USP
- sub.l %d0,%a0
- movc %a0,%usp
-ri_a7_done:
- rts
-
-# need to invert adjustment value if the <ea> was predec
-rest_dec:
- neg.l %d0
- bra.b rest_inc
diff --git a/sys/arch/m68k/060sp/pfpsp.sa b/sys/arch/m68k/060sp/pfpsp.sa
deleted file mode 100644
index 74130393973..00000000000
--- a/sys/arch/m68k/060sp/pfpsp.sa
+++ /dev/null
@@ -1,1768 +0,0 @@
-#
-# $OpenBSD: pfpsp.sa,v 1.2 1996/05/30 22:15:14 niklas Exp $
-# $NetBSD: pfpsp.sa,v 1.2 1996/05/15 19:49:26 is Exp $
-#
-
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-# M68000 Hi-Performance Microprocessor Division
-# M68060 Software Package Production Release
-#
-# M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
-# All rights reserved.
-#
-# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-# To the maximum extent permitted by applicable law,
-# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
-# FOR A PARTICULAR PURPOSE and any warranty against infringement with
-# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-# and any accompanying written materials.
-#
-# To the maximum extent permitted by applicable law,
-# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
-# BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
-# ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
-#
-# Motorola assumes no responsibility for the maintenance and support
-# of the SOFTWARE.
-#
-# You are hereby granted a copyright license to use, modify, and distribute the
-# SOFTWARE so long as this entire notice is retained without alteration
-# in any modified and/or redistributed versions, and that such modified
-# versions are clearly identified as such.
-# No licenses are granted by implication, estoppel or otherwise under any
-# patents or trademarks of Motorola, Inc.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- dc.l $60ff0000,$17400000,$60ff0000,$15f40000
- dc.l $60ff0000,$02b60000,$60ff0000,$04700000
- dc.l $60ff0000,$1b100000,$60ff0000,$19aa0000
- dc.l $60ff0000,$1b5a0000,$60ff0000,$062e0000
- dc.l $60ff0000,$102c0000,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $51fc51fc,$51fc51fc,$51fc51fc,$51fc51fc
- dc.l $2f00203a,$ff2c487b,$0930ffff,$fef8202f
- dc.l $00044e74,$00042f00,$203afef2,$487b0930
- dc.l $fffffee2,$202f0004,$4e740004,$2f00203a
- dc.l $fee0487b,$0930ffff,$fecc202f,$00044e74
- dc.l $00042f00,$203afed2,$487b0930,$fffffeb6
- dc.l $202f0004,$4e740004,$2f00203a,$fea4487b
- dc.l $0930ffff,$fea0202f,$00044e74,$00042f00
- dc.l $203afe96,$487b0930,$fffffe8a,$202f0004
- dc.l $4e740004,$2f00203a,$fe7c487b,$0930ffff
- dc.l $fe74202f,$00044e74,$00042f00,$203afe76
- dc.l $487b0930,$fffffe5e,$202f0004,$4e740004
- dc.l $2f00203a,$fe68487b,$0930ffff,$fe48202f
- dc.l $00044e74,$00042f00,$203afe56,$487b0930
- dc.l $fffffe32,$202f0004,$4e740004,$2f00203a
- dc.l $fe44487b,$0930ffff,$fe1c202f,$00044e74
- dc.l $00042f00,$203afe32,$487b0930,$fffffe06
- dc.l $202f0004,$4e740004,$2f00203a,$fe20487b
- dc.l $0930ffff,$fdf0202f,$00044e74,$00042f00
- dc.l $203afe1e,$487b0930,$fffffdda,$202f0004
- dc.l $4e740004,$2f00203a,$fe0c487b,$0930ffff
- dc.l $fdc4202f,$00044e74,$00042f00,$203afdfa
- dc.l $487b0930,$fffffdae,$202f0004,$4e740004
- dc.l $2f00203a,$fde8487b,$0930ffff,$fd98202f
- dc.l $00044e74,$00042f00,$203afdd6,$487b0930
- dc.l $fffffd82,$202f0004,$4e740004,$2f00203a
- dc.l $fdc4487b,$0930ffff,$fd6c202f,$00044e74
- dc.l $00042f00,$203afdb2,$487b0930,$fffffd56
- dc.l $202f0004,$4e740004,$2f00203a,$fda0487b
- dc.l $0930ffff,$fd40202f,$00044e74,$00042f00
- dc.l $203afd8e,$487b0930,$fffffd2a,$202f0004
- dc.l $4e740004,$2f00203a,$fd7c487b,$0930ffff
- dc.l $fd14202f,$00044e74,$00042f00,$203afd6a
- dc.l $487b0930,$fffffcfe,$202f0004,$4e740004
- dc.l $40c62d38,$d3d64634,$3d6f90ae,$b1e75cc7
- dc.l $40000000,$c90fdaa2,$2168c235,$00000000
- dc.l $3fff0000,$c90fdaa2,$2168c235,$00000000
- dc.l $3fe45f30,$6dc9c883,$4e56ff40,$f32eff6c
- dc.l $48ee0303,$ff9cf22e,$bc00ff60,$f22ef0c0
- dc.l $ffdc2d6e,$ff68ff44,$206eff44,$58aeff44
- dc.l $61ffffff,$ff042d40,$ff40082e,$0005ff42
- dc.l $66000116,$41eeff6c,$61ff0000,$051c41ee
- dc.l $ff6c61ff,$00002aec,$1d40ff4e,$082e0005
- dc.l $ff436726,$e9ee0183,$ff4261ff,$00005cac
- dc.l $41eeff78,$61ff0000,$2aca0c00,$00066606
- dc.l $61ff0000,$2a2e1d40,$ff4f4280,$102eff63
- dc.l $122eff43,$0241007f,$02ae00ff,$01ffff64
- dc.l $f23c9000,$00000000,$f23c8800,$00000000
- dc.l $41eeff6c,$43eeff78,$223b1530,$00001974
- dc.l $4ebb1930,$0000196c,$e9ee0183,$ff4261ff
- dc.l $00005cd8,$082e0004,$ff626622,$082e0001
- dc.l $ff626644,$f22ed0c0,$ffdcf22e,$9c00ff60
- dc.l $4cee0303,$ff9c4e5e,$60ffffff,$fcc6f22e
- dc.l $f040ff6c,$3d7ce005,$ff6ef22e,$d0c0ffdc
- dc.l $f22e9c00,$ff604cee,$0303ff9c,$f36eff6c
- dc.l $4e5e60ff,$fffffcb2,$f22ef040,$ff6c1d7c
- dc.l $00c4000b,$3d7ce001,$ff6ef22e,$d0c0ffdc
- dc.l $f22e9c00,$ff604cee,$0303ff9c,$f36eff6c
- dc.l $4e5e60ff,$fffffcae,$1d7c0000,$ff4e4280
- dc.l $102eff63,$02aeffff,$00ffff64,$f23c9000
- dc.l $00000000,$f23c8800,$00000000,$41eeff6c
- dc.l $61ff0000,$2e0c082e,$0004ff62,$6600ff70
- dc.l $082e0001,$ff626600,$ff90f22e,$d0c0ffdc
- dc.l $f22e9c00,$ff604cee,$0303ff9c,$4e5e0817
- dc.l $000767ff,$fffffc0c,$f22fa400,$00083f7c
- dc.l $20240006,$60ffffff,$fcec4e56,$ff40f32e
- dc.l $ff6c48ee,$0303ff9c,$f22ebc00,$ff60f22e
- dc.l $f0c0ffdc,$2d6eff68,$ff44206e,$ff4458ae
- dc.l $ff4461ff,$fffffd42,$2d40ff40,$082e0005
- dc.l $ff426600,$013241ee,$ff6c61ff,$0000035a
- dc.l $41eeff6c,$61ff0000,$292a1d40,$ff4e082e
- dc.l $0005ff43,$672e082e,$0004ff43,$6626e9ee
- dc.l $0183ff42,$61ff0000,$5ae241ee,$ff7861ff
- dc.l $00002900,$0c000006,$660661ff,$00002864
- dc.l $1d40ff4f,$4280102e,$ff63122e,$ff430241
- dc.l $007f02ae,$00ff01ff,$ff64f23c,$90000000
- dc.l $0000f23c,$88000000,$000041ee,$ff6c43ee
- dc.l $ff78223b,$15300000,$17aa4ebb,$19300000
- dc.l $17a2e9ee,$0183ff42,$61ff0000,$5b0e082e
- dc.l $0003ff62,$6622082e,$0001ff62,$664ef22e
- dc.l $d0c0ffdc,$f22e9c00,$ff604cee,$0303ff9c
- dc.l $4e5e60ff,$fffffafc,$082e0003,$ff666700
- dc.l $ffd6f22e,$f040ff6c,$3d7ce003,$ff6ef22e
- dc.l $d0c0ffdc,$f22e9c00,$ff604cee,$0303ff9c
- dc.l $f36eff6c,$4e5e60ff,$fffffaf4,$082e0001
- dc.l $ff666700,$ffaaf22e,$f040ff6c,$1d7c00c4
- dc.l $000b3d7c,$e001ff6e,$f22ed0c0,$ffdcf22e
- dc.l $9c00ff60,$4cee0303,$ff9cf36e,$ff6c4e5e
- dc.l $60ffffff,$fad01d7c,$0000ff4e,$4280102e
- dc.l $ff6302ae,$ffff00ff,$ff64f23c,$90000000
- dc.l $0000f23c,$88000000,$000041ee,$ff6c61ff
- dc.l $00002c2e,$082e0003,$ff626600,$ff66082e
- dc.l $0001ff62,$6600ff90,$f22ed0c0,$ffdcf22e
- dc.l $9c00ff60,$4cee0303,$ff9c4e5e,$08170007
- dc.l $67ffffff,$fa2ef22f,$a4000008,$3f7c2024
- dc.l $000660ff,$fffffb0e,$4e56ff40,$f32eff6c
- dc.l $48ee0303,$ff9cf22e,$bc00ff60,$f22ef0c0
- dc.l $ffdc082e,$00050004,$66084e68,$2d48ffd8
- dc.l $600841ee,$00102d48,$ffd82d6e,$ff68ff44
- dc.l $206eff44,$58aeff44,$61ffffff,$fb4c2d40
- dc.l $ff40422e,$ff4a082e,$0005ff42,$66000208
- dc.l $e9ee0006,$ff420c00,$00136700,$049e02ae
- dc.l $00ff00ff,$ff64f23c,$90000000,$0000f23c
- dc.l $88000000,$000041ee,$ff6c61ff,$0000013a
- dc.l $41eeff6c,$61ff0000,$270a0c00,$00066606
- dc.l $61ff0000,$266e1d40,$ff4ee9ee,$0183ff42
- dc.l $082e0005,$ff436728,$0c2e003a,$ff436720
- dc.l $61ff0000,$58b641ee,$ff7861ff,$000026d4
- dc.l $0c000006,$660661ff,$00002638,$1d40ff4f
- dc.l $4280102e,$ff63e9ee,$1047ff43,$41eeff6c
- dc.l $43eeff78,$223b1d30,$00001598,$4ebb1930
- dc.l $00001590,$102eff62,$6634102e,$ff430200
- dc.l $00380c00,$0038670c,$e9ee0183,$ff4261ff
- dc.l $000058e8,$f22ed0c0,$ffdcf22e,$9c00ff60
- dc.l $4cee0303,$ff9c4e5e,$60ffffff,$f8e6c02e
- dc.l $ff66edc0,$06086614,$082e0004,$ff6667ba
- dc.l $082e0001,$ff6267b2,$60000066,$04800000
- dc.l $00180c00,$00066614,$082e0003,$ff666600
- dc.l $004a082e,$0004ff66,$66000046,$2f0061ff
- dc.l $000007e0,$201f3d7b,$0222ff6e,$f22ed0c0
- dc.l $ffdcf22e,$9c00ff60,$4cee0303,$ff9cf36e
- dc.l $ff6c4e5e,$60ffffff,$f87ae000,$e006e004
- dc.l $e005e003,$e002e001,$e001303c,$000460bc
- dc.l $303c0003,$60b6e9ee,$0006ff42,$0c000011
- dc.l $67080c00,$00156750,$4e753028,$00000240
- dc.l $7fff0c40,$3f806708,$0c40407f,$672c4e75
- dc.l $02a87fff,$ffff0004,$671861ff,$000024cc
- dc.l $44400640,$3f810268,$80000000,$81680000
- dc.l $4e750268,$80000000,$4e750228,$007f0004
- dc.l $00687fff,$00004e75,$30280000,$02407fff
- dc.l $0c403c00,$67080c40,$43ff67de,$4e7502a8
- dc.l $7fffffff,$00046606,$4aa80008,$67c461ff
- dc.l $00002478,$44400640,$3c010268,$80000000
- dc.l $81680000,$4e75e9ee,$00c3ff42,$0c000003
- dc.l $670004a2,$0c000007,$6700049a,$02aeffff
- dc.l $00ffff64,$f23c9000,$00000000,$f23c8800
- dc.l $00000000,$302eff6c,$02407fff,$671041ee
- dc.l $ff6c61ff,$0000246c,$1d40ff4e,$60061d7c
- dc.l $0004ff4e,$4280102e,$ff6341ee,$ff6c2d56
- dc.l $ffd461ff,$0000292a,$102eff62,$66000086
- dc.l $2caeffd4,$082e0005,$00046626,$206effd8
- dc.l $4e60f22e,$d0c0ffdc,$f22e9c00,$ff604cee
- dc.l $0303ff9c,$4e5e0817,$0007667a,$60ffffff
- dc.l $f7220c2e,$0008ff4a,$66d8f22e,$f080ff6c
- dc.l $f22ed0c0,$ffdcf22e,$9c00ff60,$4cee0303
- dc.l $ff9c2c56,$2f6f00c4,$00b82f6f,$00c800bc
- dc.l $2f6f002c,$00c42f6f,$003000c8,$2f6f0034
- dc.l $00ccdffc,$000000b8,$08170007,$662860ff
- dc.l $fffff6d0,$c02eff66,$edc00608,$662a082e
- dc.l $0004ff66,$6700ff6a,$082e0001,$ff626700
- dc.l $ff606000,$01663f7c,$20240006,$f22fa400
- dc.l $000860ff,$fffff78e,$04800000,$0018303b
- dc.l $020a4efb,$00064afc,$00080000,$0000003a
- dc.l $00640094,$00000140,$0000f22e,$d0c0ffdc
- dc.l $f22e9c00,$ff604cee,$0303ff9c,$3d7c30d8
- dc.l $000a3d7c,$e006ff6e,$f36eff6c,$4e5e60ff
- dc.l $fffff6d4,$f22ed0c0,$ffdcf22e,$9c00ff60
- dc.l $4cee0303,$ff9c3d7c,$30d0000a,$3d7ce004
- dc.l $ff6ef36e,$ff6c4e5e,$60ffffff,$f694f22e
- dc.l $f040ff6c,$f22ed0c0,$ffdcf22e,$9c00ff60
- dc.l $4cee0303,$ff9c3d7c,$30d4000a,$3d7ce005
- dc.l $ff6ef36e,$ff6c4e5e,$60ffffff,$f60c2cae
- dc.l $ffd4082e,$00050004,$66000038,$206effd8
- dc.l $4e60f22e,$f040ff6c,$f22ed0c0,$ffdcf22e
- dc.l $9c00ff60,$4cee0303,$ff9c3d7c,$30cc000a
- dc.l $3d7ce003,$ff6ef36e,$ff6c4e5e,$60ffffff
- dc.l $f5de0c2e,$0008ff4a,$66c8f22e,$f080ff6c
- dc.l $f22ef040,$ff78f22e,$d0c0ffdc,$f22e9c00
- dc.l $ff604cee,$0303ff9c,$3d7c30cc,$000a3d7c
- dc.l $e003ff7a,$f36eff78,$2c562f6f,$00c400b8
- dc.l $2f6f00c8,$00bc2f6f,$00cc00c0,$2f6f002c
- dc.l $00c42f6f,$003000c8,$2f6f0034,$00ccdffc
- dc.l $000000b8,$60ffffff,$f576f22e,$f040ff6c
- dc.l $f22ed0c0,$ffdcf22e,$9c00ff60,$4cee0303
- dc.l $ff9c3d7c,$30c4000a,$3d7ce001,$ff6ef36e
- dc.l $ff6c4e5e,$60ffffff,$f55c02ae,$00ff00ff
- dc.l $ff64f23c,$90000000,$0000f23c,$88000000
- dc.l $000061ff,$00005548,$41eeff6c,$61ff0000
- dc.l $22721d40,$ff4ee9ee,$0183ff42,$082e0005
- dc.l $ff436728,$0c2e003a,$ff436720,$61ff0000
- dc.l $542a41ee,$ff7861ff,$00002248,$0c000006
- dc.l $660661ff,$000021ac,$1d40ff4f,$4280102e
- dc.l $ff63e9ee,$1047ff43,$41eeff6c,$43eeff78
- dc.l $223b1d30,$0000110c,$4ebb1930,$00001104
- dc.l $102eff62,$6600008a,$102eff43,$02000038
- dc.l $0c000038,$670ce9ee,$0183ff42,$61ff0000
- dc.l $545a082e,$00050004,$6600002a,$206effd8
- dc.l $4e60f22e,$d0c0ffdc,$f22e9c00,$ff604cee
- dc.l $0303ff9c,$4e5e0817,$00076600,$012660ff
- dc.l $fffff440,$082e0002,$ff4a67d6,$f22ed0c0
- dc.l $ffdcf22e,$9c00ff60,$4cee0303,$ff9c4e5e
- dc.l $2f6f0004,$00102f6f,$0000000c,$dffc0000
- dc.l $000c0817,$00076600,$00ea60ff,$fffff404
- dc.l $c02eff66,$edc00608,$6618082e,$0004ff66
- dc.l $6700ff66,$082e0001,$ff626700,$ff5c6000
- dc.l $006e0480,$00000018,$0c000006,$6d14082e
- dc.l $0003ff66,$66000060,$082e0004,$ff666600
- dc.l $004e082e,$00050004,$66000054,$206effd8
- dc.l $4e603d7b,$022aff6e,$f22ed0c0,$ffdcf22e
- dc.l $9c00ff60,$4cee0303,$ff9cf36e,$ff6c4e5e
- dc.l $08170007,$6600006c,$60ffffff,$f386e000
- dc.l $e006e004,$e005e003,$e002e001,$e001303c
- dc.l $00036000,$ffae303c,$00046000,$ffa6082e
- dc.l $0002ff4a,$67ac3d7b,$02d6ff6e,$f22ed0c0
- dc.l $ffdcf22e,$9c00ff60,$4cee0303,$ff9cf36e
- dc.l $ff6c4e5e,$2f6f0004,$00102f6f,$0000000c
- dc.l $dffc0000,$000c0817,$00076606,$60ffffff
- dc.l $f3223f7c,$20240006,$f22fa400,$000860ff
- dc.l $fffff402,$02aeffff,$00ffff64,$f23c9000
- dc.l $00000000,$f23c8800,$00000000,$e9ee0183
- dc.l $ff4261ff,$000051b4,$41eeff6c,$61ff0000
- dc.l $20620c00,$00066606,$61ff0000,$1fc61d40
- dc.l $ff4e4280,$102eff63,$41eeff6c,$2d56ffd4
- dc.l $61ff0000,$248c102e,$ff626600,$00842cae
- dc.l $ffd4082e,$00050004,$6628206e,$ffd84e60
- dc.l $f22ed0c0,$ffdcf22e,$9c00ff60,$4cee0303
- dc.l $ff9c4e5e,$08170007,$6600ff68,$60ffffff
- dc.l $f282082e,$0003ff4a,$67d6f22e,$d0c0ffdc
- dc.l $f22e9c00,$ff604cee,$0303ff9c,$2c562f6f
- dc.l $00c400b8,$2f6f00c8,$00bc2f6f,$003800c4
- dc.l $2f6f003c,$00c82f6f,$004000cc,$dffc0000
- dc.l $00b80817,$00076600,$ff1a60ff,$fffff234
- dc.l $c02eff66,$edc00608,$6700ff74,$2caeffd4
- dc.l $0c00001a,$6e0000e8,$67000072,$082e0005
- dc.l $0004660a,$206effd8,$4e606000,$fb8e0c2e
- dc.l $0008ff4a,$6600fb84,$f22ed0c0,$ffdcf22e
- dc.l $9c00ff60,$4cee0303,$ff9c3d7c,$30d8000a
- dc.l $3d7ce006,$ff6ef36e,$ff6c2c56,$2f6f00c4
- dc.l $00b82f6f,$00c800bc,$2f6f00cc,$00c02f6f
- dc.l $003800c4,$2f6f003c,$00c82f6f,$004000cc
- dc.l $dffc0000,$00b860ff,$fffff22c,$082e0005
- dc.l $00046600,$000c206e,$ffd84e60,$6000fb46
- dc.l $0c2e0008,$ff4a6600,$fb3cf22e,$d0c0ffdc
- dc.l $f22e9c00,$ff604cee,$0303ff9c,$3d7c30d0
- dc.l $000a3d7c,$e004ff6e,$f36eff6c,$2c562f6f
- dc.l $00c400b8,$2f6f00c8,$00bc2f6f,$00cc00c0
- dc.l $2f6f0038,$00c42f6f,$003c00c8,$2f6f0040
- dc.l $00ccdffc,$000000b8,$60ffffff,$f1a4082e
- dc.l $00050004,$6600000c,$206effd8,$4e606000
- dc.l $fbda0c2e,$0008ff4a,$6600fbd0,$f22ed0c0
- dc.l $ffdcf22e,$9c00ff60,$4cee0303,$ff9c3d7c
- dc.l $30c4000a,$3d7ce001,$ff6ef36e,$ff6c2c56
- dc.l $2f6f00c4,$00b82f6f,$00c800bc,$2f6f00cc
- dc.l $00c02f6f,$003800c4,$2f6f003c,$00c82f6f
- dc.l $004000cc,$dffc0000,$00b860ff,$fffff106
- dc.l $e9ee00c3,$ff420c00,$00016708,$0c000005
- dc.l $67344e75,$302eff6c,$02407fff,$67260c40
- dc.l $3f806e20,$44400640,$3f81222e,$ff70e0a9
- dc.l $08c1001f,$2d41ff70,$026e8000,$ff6c006e
- dc.l $3f80ff6c,$4e75302e,$ff6c0240,$7fff673a
- dc.l $0c403c00,$6e344a2e,$ff6c5bee,$ff6e3d40
- dc.l $ff6c4280,$41eeff6c,$323c3c01,$61ff0000
- dc.l $1a66303c,$3c004a2e,$ff6e6704,$08c0000f
- dc.l $08ee0007,$ff703d40,$ff6c4e75,$082e0005
- dc.l $000467ff,$fffff176,$2d680000,$ff782d68
- dc.l $0004ff7c,$2d680008,$ff804281,$4e752f00
- dc.l $4e7a0808,$08000001,$66000460,$201f4e56
- dc.l $ff4048ee,$0303ff9c,$f22ebc00,$ff60f22e
- dc.l $f0c0ffdc,$2d6e0006,$ff44206e,$ff4458ae
- dc.l $ff4461ff,$fffff152,$2d40ff40,$4a406b00
- dc.l $020e02ae,$00ff00ff,$ff640800,$000a6618
- dc.l $206eff44,$43eeff6c,$700c61ff,$fffff0d2
- dc.l $4a816600,$04926048,$206eff44,$43eeff6c
- dc.l $700c61ff,$fffff0ba,$4a816600,$047ae9ee
- dc.l $004fff6c,$0c407fff,$6726102e,$ff6f0200
- dc.l $000f660c,$4aaeff70,$66064aae,$ff746710
- dc.l $41eeff6c,$61ff0000,$501af22e,$f080ff6c
- dc.l $06ae0000,$000cff44,$41eeff6c,$61ff0000
- dc.l $1cd21d40,$ff4e0c00,$0006660a,$61ff0000
- dc.l $1c321d40,$ff4e422e,$ff53082e,$0005ff43
- dc.l $6748082e,$0004ff43,$662ce9ee,$0183ff42
- dc.l $61ff0000,$4e7641ee,$ff7861ff,$00001c94
- dc.l $1d40ff4f,$0c000006,$662061ff,$00001bf4
- dc.l $1d40ff4f,$6014082e,$0003ff43,$670c50ee
- dc.l $ff53082e,$0001ff43,$67c04280,$102eff63
- dc.l $122eff43,$0241007f,$f23c9000,$00000000
- dc.l $f23c8800,$00000000,$41eeff6c,$43eeff78
- dc.l $223b1530,$00000b2c,$4ebb1930,$00000b24
- dc.l $102eff62,$66404a2e,$ff53660c,$e9ee0183
- dc.l $ff4261ff,$00004e84,$2d6e0006,$ff682d6e
- dc.l $ff440006,$f22ed0c0,$ffdcf22e,$9c00ff60
- dc.l $4cee0303,$ff9c4e5e,$08170007,$66000096
- dc.l $60ffffff,$ee6ec02e,$ff66edc0,$06086612
- dc.l $082e0004,$ff6667ae,$082e0001,$ff6267ac
- dc.l $60340480,$00000018,$0c000006,$6610082e
- dc.l $0004ff66,$6620082e,$0003ff66,$66203d7b
- dc.l $0206ff6e,$601ee002,$e006e004,$e005e003
- dc.l $e002e001,$e0013d7c,$e005ff6e,$60063d7c
- dc.l $e003ff6e,$2d6e0006,$ff682d6e,$ff440006
- dc.l $f22ed0c0,$ffdcf22e,$9c00ff60,$4cee0303
- dc.l $ff9cf36e,$ff6c4e5e,$08170007,$660660ff
- dc.l $ffffede0,$2f173f6f,$00080004,$3f7c2024
- dc.l $0006f22f,$a4000008,$60ffffff,$eeb80800
- dc.l $000e6700,$01c2082e,$00050004,$66164e68
- dc.l $2d48ffd8,$61ff0000,$0bce206e,$ffd84e60
- dc.l $600001aa,$422eff4a,$41ee000c,$2d48ffd8
- dc.l $61ff0000,$0bb20c2e,$0008ff4a,$67000086
- dc.l $0c2e0004,$ff4a6600,$0184082e,$00070004
- dc.l $66363dae,$00040804,$2daeff44,$08063dbc
- dc.l $00f0080a,$41f60804,$2d480004,$f22ed0c0
- dc.l $ffdcf22e,$9c00ff60,$4cee0303,$ff9c4e5e
- dc.l $2e5f60ff,$ffffed3c,$3dae0004,$08002dae
- dc.l $ff440802,$3dbc2024,$08062dae,$00060808
- dc.l $41f60800,$2d480004,$f22ed0c0,$ffdcf22e
- dc.l $9c00ff60,$4cee0303,$ff9c4e5e,$2e5f60ff
- dc.l $ffffedf2,$1d41000a,$1d40000b,$f22ed0c0
- dc.l $ffdcf22e,$9c00ff60,$4cee0303,$ff9c2f16
- dc.l $2f002f01,$2f2eff44,$4280102e,$000b4480
- dc.l $082e0007,$0004671c,$3dae0004,$08002dae
- dc.l $00060808,$2d9f0802,$3dbc2024,$08064876
- dc.l $08006014,$3dae0004,$08042d9f,$08063dbc
- dc.l $00f0080a,$48760804,$4281122e,$000a4a01
- dc.l $6a0cf236,$f080080c,$06800000,$000ce309
- dc.l $6a0cf236,$f040080c,$06800000,$000ce309
- dc.l $6a0cf236,$f020080c,$06800000,$000ce309
- dc.l $6a0cf236,$f010080c,$06800000,$000ce309
- dc.l $6a0cf236,$f008080c,$06800000,$000ce309
- dc.l $6a0cf236,$f004080c,$06800000,$000ce309
- dc.l $6a0cf236,$f002080c,$06800000,$000ce309
- dc.l $6a06f236,$f001080c,$222f0004,$202f0008
- dc.l $2c6f000c,$2e5f0817,$000767ff,$ffffec04
- dc.l $60ffffff,$ecf061ff,$00001244,$f22ed0c0
- dc.l $ffdcf22e,$9c00ff60,$4cee0303,$ff9c082e
- dc.l $00070004,$660e2d6e,$ff440006,$4e5e60ff
- dc.l $ffffebd0,$2c563f6f,$00c400c0,$2f6f00c6
- dc.l $00c82f6f,$000400c2,$3f7c2024,$00c6dffc
- dc.l $000000c0,$60ffffff,$ec9c201f,$4e56ff40
- dc.l $48ee0303,$ff9c2d6e,$0006ff44,$206eff44
- dc.l $58aeff44,$61ffffff,$ed002d40,$ff404a40
- dc.l $6b047010,$60260800,$000e6610,$e9c014c3
- dc.l $700c0c01,$00076614,$58806010,$428061ff
- dc.l $00000ce6,$202eff44,$90ae0006,$3d40000a
- dc.l $4cee0303,$ff9c4e5e,$518f2f00,$3f6f000c
- dc.l $00042f6f,$000e0006,$4280302f,$00122f6f
- dc.l $00060010,$d1af0006,$3f7c402c,$000a201f
- dc.l $60ffffff,$ebe44e7a,$08080800,$0001660c
- dc.l $f22e9c00,$ff60f22e,$d0c0ffdc,$4cee0303
- dc.l $ff9c4e5e,$514f2eaf,$00083f6f,$000c0004
- dc.l $3f7c4008,$00062f6f,$00020008,$2f7c0942
- dc.l $8001000c,$08170005,$670608ef,$0002000d
- dc.l $60ffffff,$ebd64fee,$ff404e7a,$18080801
- dc.l $0001660c,$f22ed0c0,$ffdcf22f,$9c000020
- dc.l $2c562f6f,$00c400bc,$3f6f00c8,$00c03f7c
- dc.l $400800c2,$2f4800c4,$3f4000c8,$3f7c0001
- dc.l $00ca4cef,$0303005c,$defc00bc,$60a64e56
- dc.l $ff40f32e,$ff6c48ee,$0303ff9c,$f22ebc00
- dc.l $ff60f22e,$f0c0ffdc,$2d6eff68,$ff44206e
- dc.l $ff4458ae,$ff4461ff,$ffffebce,$2d40ff40
- dc.l $0800000d,$662841ee,$ff6c61ff,$fffff1ea
- dc.l $f22ed0c0,$ffdcf22e,$9c00ff60,$4cee0303
- dc.l $ff9cf36e,$ff6c4e5e,$60ffffff,$ea94322e
- dc.l $ff6c0241,$7fff0c41,$7fff661a,$4aaeff74
- dc.l $660c222e,$ff700281,$7fffffff,$67082d6e
- dc.l $ff70ff54,$6012223c,$7fffffff,$4a2eff6c
- dc.l $6a025281,$2d41ff54,$e9c004c3,$122eff41
- dc.l $307b0206,$4efb8802,$006c0000,$0000ff98
- dc.l $003e0000,$00100000,$102eff54,$0c010007
- dc.l $6f16206e,$000c61ff,$ffffeb86,$4a8166ff
- dc.l $00005436,$6000ff6a,$02410007,$61ff0000
- dc.l $478e6000,$ff5c302e,$ff540c01,$00076f16
- dc.l $206e000c,$61ffffff,$eb6e4a81,$66ff0000
- dc.l $54166000,$ff3c0241,$000761ff,$00004724
- dc.l $6000ff2e,$202eff54,$0c010007,$6f16206e
- dc.l $000c61ff,$ffffeb56,$4a8166ff,$000053f6
- dc.l $6000ff0e,$02410007,$61ff0000,$46ba6000
- dc.l $ff004e56,$ff40f32e,$ff6c48ee,$0303ff9c
- dc.l $f22ebc00,$ff60f22e,$f0c0ffdc,$2d6eff68
- dc.l $ff44206e,$ff4458ae,$ff4461ff,$ffffea8a
- dc.l $2d40ff40,$0800000d,$6600002a,$41eeff6c
- dc.l $61ffffff,$f0a4f22e,$d0c0ffdc,$f22e9c00
- dc.l $ff604cee,$0303ff9c,$f36eff6c,$4e5e60ff
- dc.l $ffffe964,$e9c004c3,$122eff41,$307b0206
- dc.l $4efb8802,$007400a6,$015a0000,$00420104
- dc.l $00100000,$102eff70,$08c00006,$0c010007
- dc.l $6f16206e,$000c61ff,$ffffea76,$4a8166ff
- dc.l $00005326,$6000ffa0,$02410007,$61ff0000
- dc.l $467e6000,$ff92302e,$ff7008c0,$000e0c01
- dc.l $00076f16,$206e000c,$61ffffff,$ea5a4a81
- dc.l $66ff0000,$53026000,$ff6e0241,$000761ff
- dc.l $00004610,$6000ff60,$202eff70,$08c0001e
- dc.l $0c010007,$6f16206e,$000c61ff,$ffffea3e
- dc.l $4a8166ff,$000052de,$6000ff3c,$02410007
- dc.l $61ff0000,$45a26000,$ff2e0c01,$00076f2e
- dc.l $202eff6c,$02808000,$00000080,$7fc00000
- dc.l $222eff70,$e0898081,$206e000c,$61ffffff
- dc.l $e9fc4a81,$66ff0000,$529c6000,$fefa202e
- dc.l $ff6c0280,$80000000,$00807fc0,$00002f01
- dc.l $222eff70,$e0898081,$221f0241,$000761ff
- dc.l $00004544,$6000fed0,$202eff6c,$02808000
- dc.l $00000080,$7ff80000,$222eff70,$2d40ff84
- dc.l $700be0a9,$83aeff84,$222eff70,$02810000
- dc.l $07ffe0b9,$2d41ff88,$222eff74,$e0a983ae
- dc.l $ff8841ee,$ff84226e,$000c7008,$61ffffff
- dc.l $e8cc4a81,$66ff0000,$522a6000,$fe7a422e
- dc.l $ff4a3d6e,$ff6cff84,$426eff86,$202eff70
- dc.l $08c0001e,$2d40ff88,$2d6eff74,$ff8c082e
- dc.l $00050004,$66384e68,$2d48ffd8,$2d56ffd4
- dc.l $61ff0000,$02c22248,$2d48000c,$206effd8
- dc.l $4e602cae,$ffd441ee,$ff84700c,$61ffffff
- dc.l $e86c4a81,$66ff0000,$51d86000,$fe1a2d56
- dc.l $ffd461ff,$00000290,$22482d48,$000c2cae
- dc.l $ffd40c2e,$0008ff4a,$66ccf22e,$d0c0ffdc
- dc.l $f22e9c00,$ff604cee,$0303ff9c,$f36eff6c
- dc.l $2c6effd4,$2f6f00c4,$00b82f6f,$00c800bc
- dc.l $2f6f00cc,$00c02f6f,$004400c4,$2f6f0048
- dc.l $00c82f6f,$004c00cc,$dffc0000,$00b860ff
- dc.l $ffffe734,$4e56ff40,$f32eff6c,$48ee0303
- dc.l $ff9cf22e,$bc00ff60,$f22ef0c0,$ffdc2d6e
- dc.l $ff68ff44,$206eff44,$58aeff44,$61ffffff
- dc.l $e7f82d40,$ff400800,$000d6600,$0106e9c0
- dc.l $04c36622,$0c6e401e,$ff6c661a,$f23c9000
- dc.l $00000000,$f22e4000,$ff70f22e,$6800ff6c
- dc.l $3d7ce001,$ff6e41ee,$ff6c61ff,$ffffedea
- dc.l $02ae00ff,$01ffff64,$f23c9000,$00000000
- dc.l $f23c8800,$00000000,$e9ee1006,$ff420c01
- dc.l $00176700,$009641ee,$ff6c61ff,$00001394
- dc.l $1d40ff4e,$082e0005,$ff43672e,$082e0004
- dc.l $ff436626,$e9ee0183,$ff4261ff,$0000454c
- dc.l $41eeff78,$61ff0000,$136a0c00,$00066606
- dc.l $61ff0000,$12ce1d40,$ff4f4280,$102eff63
- dc.l $122eff43,$0241007f,$41eeff6c,$43eeff78
- dc.l $223b1530,$0000022c,$4ebb1930,$00000224
- dc.l $e9ee0183,$ff4261ff,$00004590,$f22ed0c0
- dc.l $ffdcf22e,$9c00ff60,$4cee0303,$ff9cf36e
- dc.l $ff6c4e5e,$60ffffff,$e5cc4280,$102eff63
- dc.l $122eff43,$02810000,$007f61ff,$00000396
- dc.l $60be1d7c,$0000ff4e,$4280102e,$ff6302ae
- dc.l $ffff00ff,$ff6441ee,$ff6c61ff,$00001722
- dc.l $60aa4e56,$ff40f32e,$ff6c48ee,$0303ff9c
- dc.l $f22ebc00,$ff60f22e,$f0c0ffdc,$2d6eff68
- dc.l $ff44206e,$ff4458ae,$ff4461ff,$ffffe69a
- dc.l $2d40ff40,$41eeff6c,$61ffffff,$ecbcf22e
- dc.l $d0c0ffdc,$f22e9c00,$ff604cee,$0303ff9c
- dc.l $f36eff6c,$4e5e60ff,$ffffe592,$0c6f402c
- dc.l $000667ff,$ffffe5b2,$60ffffff,$e5962040
- dc.l $102eff41,$22000240,$00380281,$00000007
- dc.l $0c000018,$67240c00,$0020672c,$80410c00
- dc.l $003c6706,$206e000c,$4e751d7c,$0080ff4a
- dc.l $41f60162,$ff680004,$4e752008,$61ff0000
- dc.l $42ca206e,$000c4e75,$200861ff,$0000430c
- dc.l $206e000c,$0c00000c,$67024e75,$51882d48
- dc.l $000c4e75,$102eff41,$22000240,$00380281
- dc.l $00000007,$0c000018,$670e0c00,$00206700
- dc.l $0076206e,$000c4e75,$323b120e,$206e000c
- dc.l $4efb1006,$4afc0008,$0010001a,$0024002c
- dc.l $0034003c,$0044004e,$06ae0000,$000cffa4
- dc.l $4e7506ae,$0000000c,$ffa84e75,$d5fc0000
- dc.l $000c4e75,$d7fc0000,$000c4e75,$d9fc0000
- dc.l $000c4e75,$dbfc0000,$000c4e75,$06ae0000
- dc.l $000cffd4,$4e751d7c,$0004ff4a,$06ae0000
- dc.l $000cffd8,$4e75323b,$1214206e,$000c5188
- dc.l $51ae000c,$4efb1006,$4afc0008,$00100016
- dc.l $001c0020,$00240028,$002c0032,$2d48ffa4
- dc.l $4e752d48,$ffa84e75,$24484e75,$26484e75
- dc.l $28484e75,$2a484e75,$2d48ffd4,$4e752d48
- dc.l $ffd81d7c,$0008ff4a,$4e754afc,$006d0000
- dc.l $20700000,$2a660000,$00000000,$2b0a0000
- dc.l $3db20000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $2bb00000,$00000000,$27460000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $233c0000,$00000000,$36220000,$1c7c0000
- dc.l $32f20000,$00000000,$00000000,$2fb00000
- dc.l $39ea0000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $2e4e0000,$00000000,$29f40000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $205e0000,$3da00000,$00000000,$00000000
- dc.l $20680000,$3daa0000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $2b9e0000,$00000000,$27340000,$00000000
- dc.l $2ba80000,$00000000,$273e0000,$00000000
- dc.l $232a0000,$00000000,$36100000,$1c6a0000
- dc.l $23340000,$00000000,$361a0000,$1c740000
- dc.l $39d80000,$00000000,$00000000,$00000000
- dc.l $39e260fe,$122eff43,$02410070,$e80961ff
- dc.l $00003ed2,$02800000,$00ff2f00,$103b0920
- dc.l $01482f00,$61ff0000,$0340201f,$221f6700
- dc.l $0134082e,$0005ff42,$670000b8,$082e0004
- dc.l $ff426600,$001a123b,$1120021e,$082e0005
- dc.l $0004670a,$0c2e0008,$ff4a6602,$4e752248
- dc.l $9fc041d7,$4a016a0c,$20eeffdc,$20eeffe0
- dc.l $20eeffe4,$e3096a0c,$20eeffe8,$20eeffec
- dc.l $20eefff0,$e3096a0a,$f210f020,$d1fc0000
- dc.l $000ce309,$6a0af210,$f010d1fc,$0000000c
- dc.l $e3096a0a,$f210f008,$d1fc0000,$000ce309
- dc.l $6a0af210,$f004d1fc,$0000000c,$e3096a0a
- dc.l $f210f002,$d1fc0000,$000ce309,$6a0af210
- dc.l $f001d1fc,$0000000c,$2d49ff54,$41d72f00
- dc.l $61ffffff,$e248201f,$dfc04a81,$6600071e
- dc.l $4e752d48,$ff549fc0,$43d72f01,$2f0061ff
- dc.l $ffffe214,$201f4a81,$6600070e,$221f41d7
- dc.l $4a016a0c,$2d58ffdc,$2d58ffe0,$2d58ffe4
- dc.l $e3096a0c,$2d58ffe8,$2d58ffec,$2d58fff0
- dc.l $e3096a04,$f218d020,$e3096a04,$f218d010
- dc.l $e3096a04,$f218d008,$e3096a04,$f218d004
- dc.l $e3096a04,$f218d002,$e3096a04,$f218d001
- dc.l $dfc04e75,$4e75000c,$0c180c18,$18240c18
- dc.l $18241824,$24300c18,$18241824,$24301824
- dc.l $24302430,$303c0c18,$18241824,$24301824
- dc.l $24302430,$303c1824,$24302430,$303c2430
- dc.l $303c303c,$3c480c18,$18241824,$24301824
- dc.l $24302430,$303c1824,$24302430,$303c2430
- dc.l $303c303c,$3c481824,$24302430,$303c2430
- dc.l $303c303c,$3c482430,$303c303c,$3c48303c
- dc.l $3c483c48,$48540c18,$18241824,$24301824
- dc.l $24302430,$303c1824,$24302430,$303c2430
- dc.l $303c303c,$3c481824,$24302430,$303c2430
- dc.l $303c303c,$3c482430,$303c303c,$3c48303c
- dc.l $3c483c48,$48541824,$24302430,$303c2430
- dc.l $303c303c,$3c482430,$303c303c,$3c48303c
- dc.l $3c483c48,$48542430,$303c303c,$3c48303c
- dc.l $3c483c48,$4854303c,$3c483c48,$48543c48
- dc.l $48544854,$54600080,$40c020a0,$60e01090
- dc.l $50d030b0,$70f00888,$48c828a8,$68e81898
- dc.l $58d838b8,$78f80484,$44c424a4,$64e41494
- dc.l $54d434b4,$74f40c8c,$4ccc2cac,$6cec1c9c
- dc.l $5cdc3cbc,$7cfc0282,$42c222a2,$62e21292
- dc.l $52d232b2,$72f20a8a,$4aca2aaa,$6aea1a9a
- dc.l $5ada3aba,$7afa0686,$46c626a6,$66e61696
- dc.l $56d636b6,$76f60e8e,$4ece2eae,$6eee1e9e
- dc.l $5ede3ebe,$7efe0181,$41c121a1,$61e11191
- dc.l $51d131b1,$71f10989,$49c929a9,$69e91999
- dc.l $59d939b9,$79f90585,$45c525a5,$65e51595
- dc.l $55d535b5,$75f50d8d,$4dcd2dad,$6ded1d9d
- dc.l $5ddd3dbd,$7dfd0383,$43c323a3,$63e31393
- dc.l $53d333b3,$73f30b8b,$4bcb2bab,$6beb1b9b
- dc.l $5bdb3bbb,$7bfb0787,$47c727a7,$67e71797
- dc.l $57d737b7,$77f70f8f,$4fcf2faf,$6fef1f9f
- dc.l $5fdf3fbf,$7fff2040,$302eff40,$32000240
- dc.l $003f0281,$00000007,$303b020a,$4efb0006
- dc.l $4afc0040,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00800086,$008c0090,$00940098
- dc.l $009c00a0,$00a600b6,$00c600d2,$00de00ea
- dc.l $00f60102,$01180126,$0134013e,$01480152
- dc.l $015c0166,$017a0198,$01b601d2,$01ee020a
- dc.l $02260242,$02600260,$02600260,$02600260
- dc.l $02600260,$02c002da,$02f40314,$00000000
- dc.l $00000000,$206effa4,$4e75206e,$ffa84e75
- dc.l $204a4e75,$204b4e75,$204c4e75,$204d4e75
- dc.l $20564e75,$206effd8,$4e75202e,$ffa42200
- dc.l $d2882d41,$ffa42040,$4e75202e,$ffa82200
- dc.l $d2882d41,$ffa82040,$4e75200a,$2200d288
- dc.l $24412040,$4e75200b,$2200d288,$26412040
- dc.l $4e75200c,$2200d288,$28412040,$4e75200d
- dc.l $2200d288,$2a412040,$4e752016,$2200d288
- dc.l $2c812040,$4e751d7c,$0004ff4a,$202effd8
- dc.l $2200d288,$2d41ffd8,$20404e75,$202effa4
- dc.l $90882d40,$ffa42040,$4e75202e,$ffa89088
- dc.l $2d40ffa8,$20404e75,$200a9088,$24402040
- dc.l $4e75200b,$90882640,$20404e75,$200c9088
- dc.l $28402040,$4e75200d,$90882a40,$20404e75
- dc.l $20169088,$2c802040,$4e751d7c,$0008ff4a
- dc.l $202effd8,$90882d40,$ffd82040,$4e75206e
- dc.l $ff4454ae,$ff4461ff,$ffffde38,$4a8166ff
- dc.l $fffff1b6,$3040d1ee,$ffa44e75,$206eff44
- dc.l $54aeff44,$61ffffff,$de1a4a81,$66ffffff
- dc.l $f1983040,$d1eeffa8,$4e75206e,$ff4454ae
- dc.l $ff4461ff,$ffffddfc,$4a8166ff,$fffff17a
- dc.l $3040d1ca,$4e75206e,$ff4454ae,$ff4461ff
- dc.l $ffffdde0,$4a8166ff,$fffff15e,$3040d1cb
- dc.l $4e75206e,$ff4454ae,$ff4461ff,$ffffddc4
- dc.l $4a8166ff,$fffff142,$3040d1cc,$4e75206e
- dc.l $ff4454ae,$ff4461ff,$ffffdda8,$4a8166ff
- dc.l $fffff126,$3040d1cd,$4e75206e,$ff4454ae
- dc.l $ff4461ff,$ffffdd8c,$4a8166ff,$fffff10a
- dc.l $3040d1d6,$4e75206e,$ff4454ae,$ff4461ff
- dc.l $ffffdd70,$4a8166ff,$fffff0ee,$3040d1ee
- dc.l $ffd84e75,$508161ff,$000038fa,$2f00206e
- dc.l $ff4454ae,$ff4461ff,$ffffdd48,$4a8166ff
- dc.l $fffff0c6,$205f0800,$00086600,$00e62d40
- dc.l $ff542200,$e9590241,$000f61ff,$000038c6
- dc.l $2f02242e,$ff540802,$000b6602,$48c02202
- dc.l $ef590281,$00000003,$e3a849c2,$d082d1c0
- dc.l $241f4e75,$206eff44,$54aeff44,$61ffffff
- dc.l $dcf24a81,$66ffffff,$f0703040,$4e75206e
- dc.l $ff4458ae,$ff4461ff,$ffffdcee,$4a8166ff
- dc.l $fffff056,$20404e75,$206eff44,$54aeff44
- dc.l $61ffffff,$dcbe4a81,$66ffffff,$f03c3040
- dc.l $d1eeff44,$55884e75,$206eff44,$54aeff44
- dc.l $61ffffff,$dc9e4a81,$66ffffff,$f01c206e
- dc.l $ff445588,$08000008,$66000038,$2d40ff54
- dc.l $2200e959,$0241000f,$61ff0000,$38182f02
- dc.l $242eff54,$0802000b,$660248c0,$2202ef59
- dc.l $02810000,$0003e3a8,$49c2d082,$d1c0241f
- dc.l $4e750800,$0006670c,$48e73c00,$2a002608
- dc.l $42826028,$2d40ff54,$e9c01404,$61ff0000
- dc.l $37d448e7,$3c002400,$2a2eff54,$26080805
- dc.l $000b6602,$48c2e9c5,$0542e1aa,$08050007
- dc.l $67024283,$e9c50682,$0c000002,$6d346718
- dc.l $206eff44,$58aeff44,$61ffffff,$dc0c4a81
- dc.l $66ff0000,$00b06018,$206eff44,$54aeff44
- dc.l $61ffffff,$dbde4a81,$66ff0000,$009848c0
- dc.l $d680e9c5,$07826700,$006e0c00,$00026d34
- dc.l $6718206e,$ff4458ae,$ff4461ff,$ffffdbca
- dc.l $4a8166ff,$0000006e,$601c206e,$ff4454ae
- dc.l $ff4461ff,$ffffdb9c,$4a8166ff,$00000056
- dc.l $48c06002,$42802800,$08050002,$67142043
- dc.l $61ffffff,$dbd64a81,$66000028,$d082d084
- dc.l $6018d682,$204361ff,$ffffdbc0,$4a816600
- dc.l $0012d084,$6004d682,$20032040,$4cdf003c
- dc.l $4e752043,$4cdf003c,$303c0101,$60ffffff
- dc.l $ef184cdf,$003c60ff,$ffffeebe,$61ff0000
- dc.l $44ea303c,$00e1600a,$61ff0000,$44de303c
- dc.l $0161206e,$ff5460ff,$ffffeeee,$102eff42
- dc.l $0c00009c,$670000b2,$0c000098,$67000074
- dc.l $0c000094,$6736206e,$ff4458ae,$ff4461ff
- dc.l $ffffdb06,$4a8166ff,$ffffee6e,$2d40ff64
- dc.l $206eff44,$58aeff44,$61ffffff,$daec4a81
- dc.l $66ffffff,$ee542d40,$ff684e75,$206eff44
- dc.l $58aeff44,$61ffffff,$dad04a81,$66ffffff
- dc.l $ee382d40,$ff60206e,$ff4458ae,$ff4461ff
- dc.l $ffffdab6,$4a8166ff,$ffffee1e,$2d40ff68
- dc.l $4e75206e,$ff4458ae,$ff4461ff,$ffffda9a
- dc.l $4a8166ff,$ffffee02,$2d40ff60,$206eff44
- dc.l $58aeff44,$61ffffff,$da804a81,$66ffffff
- dc.l $ede82d40,$ff644e75,$206eff44,$58aeff44
- dc.l $61ffffff,$da644a81,$66ffffff,$edcc2d40
- dc.l $ff60206e,$ff4458ae,$ff4461ff,$ffffda4a
- dc.l $4a8166ff,$ffffedb2,$2d40ff64,$206eff44
- dc.l $58aeff44,$61ffffff,$da304a81,$66ffffff
- dc.l $ed982d40,$ff684e75,$2d680004,$ff882d69
- dc.l $0004ff94,$2d680008,$ff8c2d69,$0008ff98
- dc.l $30280000,$32290000,$3d40ff84,$3d41ff90
- dc.l $02407fff,$02417fff,$3d40ff54,$3d41ff56
- dc.l $b0416cff,$0000005c,$61ff0000,$015a2f00
- dc.l $0c2e0004,$ff4e6610,$41eeff84,$61ff0000
- dc.l $04fa4440,$3d40ff54,$302eff56,$04400042
- dc.l $b06eff54,$6c1a302e,$ff54d06f,$0002322e
- dc.l $ff840241,$80008041,$3d40ff84,$201f4e75
- dc.l $026e8000,$ff8408ee,$0000ff85,$201f4e75
- dc.l $61ff0000,$00562f00,$0c2e0004,$ff4f6610
- dc.l $41eeff90,$61ff0000,$04a24440,$3d40ff56
- dc.l $302eff54,$04400042,$b06eff56,$6c1a302e
- dc.l $ff56d06f,$0002322e,$ff900241,$80008041
- dc.l $3d40ff90,$201f4e75,$026e8000,$ff9008ee
- dc.l $0000ff91,$201f4e75,$322eff84,$30010281
- dc.l $00007fff,$02408000,$00403fff,$3d40ff84
- dc.l $0c2e0004,$ff4e670a,$203c0000,$3fff9081
- dc.l $4e7541ee,$ff8461ff,$00000430,$44802200
- dc.l $60e60c2e,$0004ff4e,$673a322e,$ff840281
- dc.l $00007fff,$026e8000,$ff840801,$00006712
- dc.l $006e3fff,$ff84203c,$00003fff,$9081e280
- dc.l $4e75006e,$3ffeff84,$203c0000,$3ffe9081
- dc.l $e2804e75,$41eeff84,$61ff0000,$03de0800
- dc.l $00006710,$006e3fff,$ff840680,$00003fff
- dc.l $e2804e75,$006e3ffe,$ff840680,$00003ffe
- dc.l $e2804e75,$322eff90,$30010281,$00007fff
- dc.l $02408000,$00403fff,$3d40ff90,$0c2e0004
- dc.l $ff4f670a,$203c0000,$3fff9081,$4e7541ee
- dc.l $ff9061ff,$00000384,$44802200,$60e60c2e
- dc.l $0005ff4f,$67320c2e,$0003ff4f,$673e0c2e
- dc.l $0003ff4e,$671408ee,$0006ff70,$00ae0100
- dc.l $4080ff64,$41eeff6c,$604200ae,$01000000
- dc.l $ff6441ee,$ff6c6034,$00ae0100,$4080ff64
- dc.l $08ee0006,$ff7c41ee,$ff786020,$41eeff78
- dc.l $0c2e0005,$ff4e66ff,$0000000c,$00ae0000
- dc.l $4080ff64,$00ae0100,$0000ff64,$08280007
- dc.l $00006708,$00ae0800,$0000ff64,$f210d080
- dc.l $4e7500ae,$01002080,$ff64f23b,$d0800170
- dc.l $00000008,$4e757fff,$0000ffff,$ffffffff
- dc.l $ffff0000,$3f813c01,$e408323b,$02f63001
- dc.l $90680000,$0c400042,$6a164280,$082e0001
- dc.l $ff666704,$08c0001d,$61ff0000,$001a4e75
- dc.l $203c2000,$00003141,$000042a8,$000442a8
- dc.l $00084e75,$2d680008,$ff542d40,$ff582001
- dc.l $92680000,$6f100c41,$00206d10,$0c410040
- dc.l $6d506000,$009a202e,$ff584e75,$2f023140
- dc.l $00007020,$90410c41,$001d6d08,$142eff58
- dc.l $852eff57,$e9e82020,$0004e9e8,$18000004
- dc.l $e9ee0800,$ff542142,$00042141,$0008e8c0
- dc.l $009e6704,$08c0001d,$0280e000,$0000241f
- dc.l $4e752f02,$31400000,$04410020,$70209041
- dc.l $142eff58,$852eff57,$e9e82020,$0004e9e8
- dc.l $18000004,$e8c1009e,$660ce8ee,$081fff54
- dc.l $66042001,$60062001,$08c0001d,$42a80004
- dc.l $21420008,$0280e000,$0000241f,$4e753140
- dc.l $00000c41,$00416d12,$672442a8,$000442a8
- dc.l $0008203c,$20000000,$4e752028,$00042200
- dc.l $0280c000,$00000281,$3fffffff,$60122028
- dc.l $00040280,$80000000,$e2880281,$7fffffff
- dc.l $66164aa8,$00086610,$4a2eff58,$660a42a8
- dc.l $000442a8,$00084e75,$08c0001d,$42a80004
- dc.l $42a80008,$4e7561ff,$00000110,$4a806700
- dc.l $00fa006e,$0208ff66,$327b1206,$4efb9802
- dc.l $004000ea,$00240008,$4a280002,$6b0000dc
- dc.l $70ff4841,$0c010004,$6700003e,$6e000094
- dc.l $60000064,$4a280002,$6a0000c0,$70ff4841
- dc.l $0c010004,$67000022,$6e000078,$60000048
- dc.l $e3806400,$00a64841,$0c010004,$6700000a
- dc.l $6e000060,$60000030,$06a80000,$01000004
- dc.l $640ce4e8,$0004e4e8,$00065268,$00004a80
- dc.l $66060268,$fe000006,$02a8ffff,$ff000004
- dc.l $42a80008,$4e7552a8,$0008641a,$52a80004
- dc.l $6414e4e8,$0004e4e8,$0006e4e8,$0008e4e8
- dc.l $000a5268,$00004a80,$66060228,$00fe000b
- dc.l $4e7506a8,$00000800,$0008641a,$52a80004
- dc.l $6414e4e8,$0004e4e8,$0006e4e8,$0008e4e8
- dc.l $000a5268,$00004a80,$66060268,$f000000a
- dc.l $02a8ffff,$f8000008,$4e754841,$0c010004
- dc.l $6700ff86,$6eea4e75,$48414a01,$66044841
- dc.l $4e7548e7,$30000c01,$00046622,$e9e83602
- dc.l $0004741e,$e5ab2428,$00040282,$0000003f
- dc.l $66284aa8,$00086622,$4a80661e,$6020e9e8
- dc.l $35420008,$741ee5ab,$24280008,$02820000
- dc.l $01ff6606,$4a806602,$600408c3,$001d2003
- dc.l $4cdf000c,$48414e75,$2f022f03,$20280004
- dc.l $22280008,$edc02000,$671ae5a8,$e9c13022
- dc.l $8083e5a9,$21400004,$21410008,$2002261f
- dc.l $241f4e75,$edc12000,$e5a90682,$00000020
- dc.l $21410004,$42a80008,$2002261f,$241f4e75
- dc.l $ede80000,$0004660e,$ede80000,$00086700
- dc.l $00740640,$00204281,$32280000,$02417fff
- dc.l $b0416e1c,$92403028,$00000240,$80008240
- dc.l $31410000,$61ffffff,$ff82103c,$00004e75
- dc.l $0c010020,$6e20e9e8,$08400004,$21400004
- dc.l $20280008,$e3a82140,$00080268,$80000000
- dc.l $103c0004,$4e750441,$00202028,$0008e3a8
- dc.l $21400004,$42a80008,$02688000,$0000103c
- dc.l $00044e75,$02688000,$0000103c,$00014e75
- dc.l $30280000,$02407fff,$0c407fff,$67480828
- dc.l $00070004,$6706103c,$00004e75,$4a406618
- dc.l $4aa80004,$660c4aa8,$00086606,$103c0001
- dc.l $4e75103c,$00044e75,$4aa80004,$66124aa8
- dc.l $0008660c,$02688000,$0000103c,$00014e75
- dc.l $103c0006,$4e754aa8,$00086612,$20280004
- dc.l $02807fff,$ffff6606,$103c0002,$4e750828
- dc.l $00060004,$6706103c,$00034e75,$103c0005
- dc.l $4e752028,$00002200,$02807ff0,$0000670e
- dc.l $0c807ff0,$00006728,$103c0000,$4e750281
- dc.l $000fffff,$66ff0000,$00144aa8,$000466ff
- dc.l $0000000a,$103c0001,$4e75103c,$00044e75
- dc.l $0281000f,$ffff66ff,$00000014,$4aa80004
- dc.l $66ff0000,$000a103c,$00024e75,$08010013
- dc.l $66ff0000,$000a103c,$00054e75,$103c0003
- dc.l $4e752028,$00002200,$02807f80,$0000670e
- dc.l $0c807f80,$0000671e,$103c0000,$4e750281
- dc.l $007fffff,$66ff0000,$000a103c,$00014e75
- dc.l $103c0004,$4e750281,$007fffff,$66ff0000
- dc.l $000a103c,$00024e75,$08010016,$66ff0000
- dc.l $000a103c,$00054e75,$103c0003,$4e752f01
- dc.l $08280007,$000056e8,$00023228,$00000241
- dc.l $7fff9240,$31410000,$2f08202f,$00040240
- dc.l $00c0e848,$61ffffff,$fae22057,$322f0006
- dc.l $024100c0,$e8494841,$322f0006,$02410030
- dc.l $e84961ff,$fffffc22,$205f08a8,$00070000
- dc.l $4a280002,$670a08e8,$00070000,$42280002
- dc.l $42804aa8,$0004660a,$4aa80008,$660408c0
- dc.l $0002082e,$0001ff66,$670608ee,$0005ff67
- dc.l $588f4e75,$2f010828,$00070000,$56e80002
- dc.l $32280000,$02417fff,$92403141,$00002f08
- dc.l $428061ff,$fffffa64,$2057323c,$00044841
- dc.l $322f0006,$02410030,$e84961ff,$fffffbaa
- dc.l $205f08a8,$00070000,$4a280002,$670a08e8
- dc.l $00070000,$42280002,$42804aa8,$0004660a
- dc.l $4aa80008,$660408c0,$0002082e,$0001ff66
- dc.l $670608ee,$0005ff67,$588f4e75,$02410010
- dc.l $e8088200,$3001e309,$600e0241,$00108200
- dc.l $48408200,$3001e309,$103b0008,$41fb1620
- dc.l $4e750200,$00020200,$00020200,$00020000
- dc.l $00000a08,$0a080a08,$0a080a08,$0a087fff
- dc.l $00000000,$00000000,$00000000,$00007ffe
- dc.l $0000ffff,$ffffffff,$ffff0000,$00007ffe
- dc.l $0000ffff,$ffffffff,$ffff0000,$00007fff
- dc.l $00000000,$00000000,$00000000,$00007fff
- dc.l $00000000,$00000000,$00000000,$0000407e
- dc.l $0000ffff,$ff000000,$00000000,$0000407e
- dc.l $0000ffff,$ff000000,$00000000,$00007fff
- dc.l $00000000,$00000000,$00000000,$00007fff
- dc.l $00000000,$00000000,$00000000,$000043fe
- dc.l $0000ffff,$ffffffff,$f8000000,$000043fe
- dc.l $0000ffff,$ffffffff,$f8000000,$00007fff
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$00000000
- dc.l $00000000,$00000000,$00000000,$0000ffff
- dc.l $00000000,$00000000,$00000000,$0000fffe
- dc.l $0000ffff,$ffffffff,$ffff0000,$0000ffff
- dc.l $00000000,$00000000,$00000000,$0000fffe
- dc.l $0000ffff,$ffffffff,$ffff0000,$0000ffff
- dc.l $00000000,$00000000,$00000000,$0000c07e
- dc.l $0000ffff,$ff000000,$00000000,$0000ffff
- dc.l $00000000,$00000000,$00000000,$0000c07e
- dc.l $0000ffff,$ff000000,$00000000,$0000ffff
- dc.l $00000000,$00000000,$00000000,$0000c3fe
- dc.l $0000ffff,$ffffffff,$f8000000,$0000ffff
- dc.l $00000000,$00000000,$00000000,$0000c3fe
- dc.l $0000ffff,$ffffffff,$f8000000,$0000e9ee
- dc.l $10c3ff42,$327b120a,$4efb9806,$4afc0008
- dc.l $00e001e0,$01480620,$0078041a,$00100620
- dc.l $4a2eff4e,$664cf228,$d0800000,$f2009000
- dc.l $f2007800,$f23c9000,$00000000,$f201a800
- dc.l $836eff66,$122eff41,$02010038,$6714206e
- dc.l $000c61ff,$ffffcfaa,$4a8166ff,$0000385a
- dc.l $4e75122e,$ff410241,$000761ff,$00002bb0
- dc.l $4e752228,$00000281,$80000000,$00810080
- dc.l $0000f201,$440060a4,$4a2eff4e,$664cf228
- dc.l $d0800000,$f2009000,$f2007000,$f23c9000
- dc.l $00000000,$f201a800,$836eff66,$122eff41
- dc.l $02010038,$6714206e,$000c61ff,$ffffcf58
- dc.l $4a8166ff,$00003800,$4e75122e,$ff410241
- dc.l $000761ff,$00002b0c,$4e752228,$00000281
- dc.l $80000000,$00810080,$0000f201,$440060a4
- dc.l $4a2eff4e,$664cf228,$d0800000,$f2009000
- dc.l $f2006000,$f23c9000,$00000000,$f201a800
- dc.l $836eff66,$122eff41,$02010038,$6714206e
- dc.l $000c61ff,$ffffcf06,$4a8166ff,$000037a6
- dc.l $4e75122e,$ff410241,$000761ff,$00002a68
- dc.l $4e752228,$00000281,$80000000,$00810080
- dc.l $0000f201,$440060a4,$3d680000,$ff84426e
- dc.l $ff862d68,$0004ff88,$2d680008,$ff8cf228
- dc.l $d0800000,$61ffffff,$e83e2248,$41eeff84
- dc.l $700c0c2e,$0008ff4a,$672661ff,$ffffcdee
- dc.l $4a816600,$00524a2e,$ff4e6602,$4e7508ee
- dc.l $0003ff66,$102eff62,$0200000a,$66164e75
- dc.l $61ffffff,$dc4a4a81,$6600002c,$4a2eff4e
- dc.l $66dc4e75,$41eeff84,$61ffffff,$f90e4440
- dc.l $02407fff,$026e8000,$ff84816e,$ff84f22e
- dc.l $d040ff84,$4e752cae,$ffd460ff,$00003702
- dc.l $02000030,$00000040,$2d40ff5c,$30280000
- dc.l $02407fff,$0c40407e,$6e0000e6,$67000152
- dc.l $0c403f81,$6d000058,$f228d080,$0000f22e
- dc.l $9000ff5c,$f23c8800,$00000000,$f2006400
- dc.l $f23c9000,$00000000,$f201a800,$836eff66
- dc.l $122eff41,$02010038,$6714206e,$000c61ff
- dc.l $ffffcdda,$4a8166ff,$0000367a,$4e75122e
- dc.l $ff410241,$000761ff,$0000293c,$4e7508ee
- dc.l $0003ff66,$3d680000,$ff842d68,$0004ff88
- dc.l $2d680008,$ff8c2f08,$42800c2e,$0004ff4e
- dc.l $660a41ee,$ff8461ff,$fffff840,$41eeff84
- dc.l $222eff5c,$61ffffff,$fa5841ee,$ff8461ff
- dc.l $0000034c,$122eff41,$02010038,$6714206e
- dc.l $000c61ff,$ffffcd66,$4a8166ff,$00003606
- dc.l $600e122e,$ff410241,$000761ff,$000028c8
- dc.l $122eff62,$0201000a,$660000b8,$588f4e75
- dc.l $4a280007,$660e4aa8,$00086608,$006e1048
- dc.l $ff666006,$006e1248,$ff662f08,$4a280000
- dc.l $5bc1202e,$ff5c61ff,$fffffae4,$f210d080
- dc.l $f2006400,$122eff41,$02010038,$6714206e
- dc.l $000c61ff,$ffffccf6,$4a8166ff,$00003596
- dc.l $600e122e,$ff410241,$000761ff,$00002858
- dc.l $122eff62,$0201000a,$6600007c,$588f4e75
- dc.l $32280000,$02418000,$00413fff,$3d41ff84
- dc.l $2d680004,$ff882d68,$0008ff8c,$f22e9000
- dc.l $ff5cf22e,$4800ff84,$f23c9000,$00000000
- dc.l $f2000018,$f23c5838,$0002f294,$fe7c6000
- dc.l $ff50205f,$3d680000,$ff842d68,$0004ff88
- dc.l $2d680008,$ff8c0c2e,$0004ff4e,$662c41ee
- dc.l $ff8461ff,$fffff714,$44800240,$7fffefee
- dc.l $004fff84,$6014205f,$3d680000,$ff842d68
- dc.l $0004ff88,$2d680008,$ff8c08ae,$0007ff84
- dc.l $56eeff86,$41eeff84,$122eff5f,$e8090241
- dc.l $000c4841,$122eff5f,$e8090241,$00034280
- dc.l $61ffffff,$f5544a2e,$ff866706,$08ee0007
- dc.l $ff84f22e,$d040ff84,$4e750200,$00300000
- dc.l $00802d40,$ff5c3028,$00000240,$7fff0c40
- dc.l $43fe6e00,$00c86700,$01200c40,$3c016d00
- dc.l $0046f228,$d0800000,$f22e9000,$ff5cf23c
- dc.l $88000000,$0000f22e,$7400ff54,$f23c9000
- dc.l $00000000,$f200a800,$816eff66,$226e000c
- dc.l $41eeff54,$700861ff,$ffffcaf2,$4a8166ff
- dc.l $00003450,$4e7508ee,$0003ff66,$3d680000
- dc.l $ff842d68,$0004ff88,$2d680008,$ff8c2f08
- dc.l $42800c2e,$0004ff4e,$660a41ee,$ff8461ff
- dc.l $fffff618,$41eeff84,$222eff5c,$61ffffff
- dc.l $f83041ee,$ff8461ff,$000000d2,$2d40ff54
- dc.l $2d41ff58,$226e000c,$41eeff54,$700861ff
- dc.l $ffffca8a,$4a8166ff,$000033e8,$122eff62
- dc.l $0201000a,$6600fe9c,$588f4e75,$3028000a
- dc.l $024007ff,$6608006e,$1048ff66,$6006006e
- dc.l $1248ff66,$2f084a28,$00005bc1,$202eff5c
- dc.l $61ffffff,$f8caf210,$d080f22e,$7400ff54
- dc.l $226e000c,$41eeff54,$700861ff,$ffffca2e
- dc.l $4a8166ff,$0000338c,$122eff62,$0201000a
- dc.l $6600fe74,$588f4e75,$32280000,$02418000
- dc.l $00413fff,$3d41ff84,$2d680004,$ff882d68
- dc.l $0008ff8c,$f22e9000,$ff5cf22e,$4800ff84
- dc.l $f23c9000,$00000000,$f2000018,$f23c5838
- dc.l $0002f294,$feae6000,$ff644280,$30280000
- dc.l $04403fff,$064003ff,$4a280004,$6b025340
- dc.l $4840e988,$4a280000,$6a0408c0,$001f2228
- dc.l $0004e9c1,$10548081,$2d40ff54,$22280004
- dc.l $7015e1a9,$2d41ff58,$22280008,$e9c10015
- dc.l $222eff58,$8280202e,$ff544e75,$42803028
- dc.l $00000440,$3fff0640,$007f4a28,$00046b02
- dc.l $53404840,$ef884a28,$00006a04,$08c0001f
- dc.l $22280004,$02817fff,$ff00e089,$80814e75
- dc.l $61ffffff,$e3822f08,$102eff4e,$66000082
- dc.l $082e0004,$ff426712,$122eff43,$e8090241
- dc.l $000761ff,$000024de,$6004102e,$ff43ebc0
- dc.l $06472f00,$41eeff6c,$61ff0000,$2b2002ae
- dc.l $cffff00f,$ff84201f,$4a2eff87,$66164aae
- dc.l $ff886610,$4aaeff8c,$660a4a80,$6606026e
- dc.l $f000ff84,$41eeff84,$225f700c,$0c2e0008
- dc.l $ff4a670e,$61ffffff,$c8d44a81,$6600fb38
- dc.l $4e7561ff,$ffffd748,$4a816600,$fb2a4e75
- dc.l $0c000004,$6700ff7a,$41eeff6c,$426eff6e
- dc.l $0c000005,$670260c0,$006e4080,$ff6608ee
- dc.l $0006ff70,$60b251fc,$51fc51fc,$51fc51fc
- dc.l $ffffc001,$ffffff81,$fffffc01,$00004000
- dc.l $0000007f,$000003ff,$02000030,$00000040
- dc.l $60080200,$00300000,$00802d40,$ff5c4241
- dc.l $122eff4f,$e709822e,$ff4e6600,$02e43d69
- dc.l $0000ff90,$2d690004,$ff942d69,$0008ff98
- dc.l $3d680000,$ff842d68,$0004ff88,$2d680008
- dc.l $ff8c61ff,$ffffef24,$2f0061ff,$ffffefc8
- dc.l $d197322e,$ff5eec09,$201fb0bb,$14846700
- dc.l $011e6d00,$0062b0bb,$14846700,$021a6e00
- dc.l $014af22e,$d080ff90,$f22e9000,$ff5cf23c
- dc.l $88000000,$0000f22e,$4823ff84,$f201a800
- dc.l $f23c9000,$00000000,$83aeff64,$f22ef080
- dc.l $ff842f02,$322eff84,$24010281,$00007fff
- dc.l $02428000,$92808242,$3d41ff84,$241ff22e
- dc.l $d080ff84,$4e75f22e,$d080ff90,$f22e9000
- dc.l $ff5cf23c,$88000000,$0000f22e,$4823ff84
- dc.l $f201a800,$f23c9000,$00000000,$83aeff64
- dc.l $00ae0000,$1048ff64,$122eff62,$02010013
- dc.l $661c082e,$0003ff64,$56c1202e,$ff5c61ff
- dc.l $fffff5dc,$812eff64,$f210d080,$4e75222e
- dc.l $ff5c0201,$00c06634,$f22ef080,$ff842f02
- dc.l $322eff84,$34010281,$00007fff,$92800481
- dc.l $00006000,$02417fff,$02428000,$82423d41
- dc.l $ff84241f,$f22ed040,$ff8460a6,$f22ed080
- dc.l $ff90222e,$ff5c0201,$0030f201,$9000f22e
- dc.l $4823ff84,$f23c9000,$00000000,$60aaf22e
- dc.l $d080ff90,$f22e9000,$ff5cf23c,$88000000
- dc.l $0000f22e,$4823ff84,$f201a800,$f23c9000
- dc.l $00000000,$83aeff64,$f2000098,$f23c58b8
- dc.l $0002f293,$ff3c6000,$fee408ee,$0003ff66
- dc.l $f22ed080,$ff90f23c,$90000000,$0010f23c
- dc.l $88000000,$0000f22e,$4823ff84,$f201a800
- dc.l $f23c9000,$00000000,$83aeff64,$122eff62
- dc.l $0201000b,$6620f22e,$f080ff84,$41eeff84
- dc.l $222eff5c,$61ffffff,$f3e8812e,$ff64f22e
- dc.l $d080ff84,$4e75f22e,$d040ff90,$222eff5c
- dc.l $020100c0,$6652f22e,$9000ff5c,$f23c8800
- dc.l $00000000,$f22e48a3,$ff84f23c,$90000000
- dc.l $0000f22e,$f040ff84,$2f02322e,$ff842401
- dc.l $02810000,$7fff0242,$80009280,$06810000
- dc.l $60000241,$7fff8242,$3d41ff84,$241ff22e
- dc.l $d040ff84,$6000ff80,$222eff5c,$02010030
- dc.l $f2019000,$60a6f22e,$d080ff90,$f22e9000
- dc.l $ff5cf23c,$88000000,$0000f22e,$4823ff84
- dc.l $f201a800,$f23c9000,$00000000,$83aeff64
- dc.l $f2000098,$f23c58b8,$0002f292,$fde0f294
- dc.l $fefaf22e,$d040ff90,$222eff5c,$020100c0
- dc.l $00010010,$f2019000,$f23c8800,$00000000
- dc.l $f22e48a3,$ff84f23c,$90000000,$0000f200
- dc.l $0498f23c,$58b80002,$f293fda2,$6000febc
- dc.l $323b120a,$4efb1006,$4afc0030,$fd120072
- dc.l $00cc006c,$fd120066,$00000000,$00720072
- dc.l $0060006c,$00720066,$00000000,$009e0060
- dc.l $009e006c,$009e0066,$00000000,$006c006c
- dc.l $006c006c,$006c0066,$00000000,$fd120072
- dc.l $00cc006c,$fd120066,$00000000,$00660066
- dc.l $00660066,$00660066,$00000000,$60ffffff
- dc.l $ed6460ff,$ffffecda,$60ffffff,$ecd41028
- dc.l $00001229,$0000b101,$6a10f23c,$44008000
- dc.l $00001d7c,$000cff64,$4e75f23c,$44000000
- dc.l $00001d7c,$0004ff64,$4e75f229,$d0800000
- dc.l $10280000,$12290000,$b1016a10,$f2000018
- dc.l $f200001a,$1d7c000a,$ff644e75,$f2000018
- dc.l $1d7c0002,$ff644e75,$f228d080,$00001028
- dc.l $00001229,$0000b101,$6ae260d0,$02000030
- dc.l $00000040,$60080200,$00300000,$00802d40
- dc.l $ff5c122e,$ff4e6600,$02620200,$00c06600
- dc.l $007c4a28,$00006a06,$08ee0003,$ff64f228
- dc.l $d0800000,$4e750200,$00c06600,$006008ee
- dc.l $0003ff66,$4a280000,$6a0608ee,$0003ff64
- dc.l $f228d080,$0000082e,$0003ff62,$66024e75
- dc.l $3d680000,$ff842d68,$0004ff88,$2d680008
- dc.l $ff8c41ee,$ff8461ff,$ffffef60,$44400640
- dc.l $6000322e,$ff840241,$80000240,$7fff8041
- dc.l $3d40ff84,$f22ed040,$ff844e75,$0c000040
- dc.l $667e3d68,$0000ff84,$2d680004,$ff882d68
- dc.l $0008ff8c,$61ffffff,$eac20c80,$0000007f
- dc.l $6c000092,$0c80ffff,$ff816700,$01786d00
- dc.l $00f4f23c,$88000000,$0000f22e,$9000ff5c
- dc.l $f22e4800,$ff84f201,$a800f23c,$90000000
- dc.l $000083ae,$ff642f02,$f22ef080,$ff84322e
- dc.l $ff843401,$02810000,$7fff9280,$02428000
- dc.l $84413d42,$ff84241f,$f22ed080,$ff844e75
- dc.l $3d680000,$ff842d68,$0004ff88,$2d680008
- dc.l $ff8c61ff,$ffffea44,$0c800000,$03ff6c00
- dc.l $00140c80,$fffffc01,$670000fa,$6d000076
- dc.l $6000ff80,$08ee0003,$ff664a2e,$ff846a06
- dc.l $08ee0003,$ff64122e,$ff620201,$000b661a
- dc.l $41eeff84,$222eff5c,$61ffffff,$f084812e
- dc.l $ff64f22e,$d080ff84,$4e752d6e,$ff88ff94
- dc.l $2d6eff8c,$ff98322e,$ff842f02,$34010281
- dc.l $00007fff,$92800242,$80000681,$00006000
- dc.l $02417fff,$84413d42,$ff90f22e,$d040ff90
- dc.l $241f60ac,$f23c8800,$00000000,$f22e9000
- dc.l $ff5cf22e,$4800ff84,$f23c9000,$00000000
- dc.l $f201a800,$83aeff64,$00ae0000,$1048ff64
- dc.l $122eff62,$02010013,$661c082e,$0003ff64
- dc.l $56c1202e,$ff5c61ff,$fffff0f4,$812eff64
- dc.l $f210d080,$4e752f02,$322eff84,$24010281
- dc.l $00007fff,$02428000,$92800481,$00006000
- dc.l $02417fff,$82423d41,$ff84241f,$f22ed040
- dc.l $ff8460b6,$f23c8800,$00000000,$f22e9000
- dc.l $ff5cf22e,$4800ff84,$f201a800,$f23c9000
- dc.l $00000000,$83aeff64,$f2000098,$f23c58b8
- dc.l $0002f293,$ff746000,$fe7e0c01,$00046700
- dc.l $fdb60c01,$000567ff,$ffffe9ee,$0c010003
- dc.l $67ffffff,$e9f8f228,$48000000,$f200a800
- dc.l $e1981d40,$ff644e75,$51fc51fc,$51fc51fc
- dc.l $00003fff,$0000007e,$000003fe,$ffffc001
- dc.l $ffffff81,$fffffc01,$02000030,$00000040
- dc.l $60080200,$00300000,$00802d40,$ff5c4241
- dc.l $122eff4f,$e709822e,$ff4e6600,$02d63d69
- dc.l $0000ff90,$2d690004,$ff942d69,$0008ff98
- dc.l $3d680000,$ff842d68,$0004ff88,$2d680008
- dc.l $ff8c61ff,$ffffe864,$2f0061ff,$ffffe908
- dc.l $4497d197,$322eff5e,$ec09201f,$b0bb148e
- dc.l $6f000074,$b0bb1520,$ff7a6700,$020c6e00
- dc.l $013cf22e,$d080ff90,$f22e9000,$ff5cf23c
- dc.l $88000000,$0000f22e,$4820ff84,$f201a800
- dc.l $f23c9000,$00000000,$83aeff64,$f22ef080
- dc.l $ff842f02,$322eff84,$24010281,$00007fff
- dc.l $02428000,$92808242,$3d41ff84,$241ff22e
- dc.l $d080ff84,$4e750000,$7fff0000,$407f0000
- dc.l $43ff201f,$60c62f00,$f22ed080,$ff90f22e
- dc.l $9000ff5c,$f23c8800,$00000000,$f22e4820
- dc.l $ff84f200,$a800f23c,$90000000,$000081ae
- dc.l $ff64f227,$e0013017,$dffc0000,$000c0280
- dc.l $00007fff,$9097b0bb,$14ae6db6,$201f00ae
- dc.l $00001048,$ff64122e,$ff620201,$0013661c
- dc.l $082e0003,$ff6456c1,$202eff5c,$61ffffff
- dc.l $eeee812e,$ff64f210,$d0804e75,$222eff5c
- dc.l $020100c0,$6634f22e,$f080ff84,$2f02322e
- dc.l $ff843401,$02810000,$7fff9280,$04810000
- dc.l $60000241,$7fff0242,$80008242,$3d41ff84
- dc.l $241ff22e,$d040ff84,$60a6f22e,$d080ff90
- dc.l $222eff5c,$02010030,$f2019000,$f22e4820
- dc.l $ff84f23c,$90000000,$000060aa,$08ee0003
- dc.l $ff66f22e,$d080ff90,$f23c9000,$00000010
- dc.l $f23c8800,$00000000,$f22e4820,$ff84f201
- dc.l $a800f23c,$90000000,$000083ae,$ff64122e
- dc.l $ff620201,$000b6620,$f22ef080,$ff8441ee
- dc.l $ff84222e,$ff5c61ff,$ffffed36,$812eff64
- dc.l $f22ed080,$ff844e75,$f22ed040,$ff90222e
- dc.l $ff5c0201,$00c06652,$f22e9000,$ff5cf23c
- dc.l $88000000,$0000f22e,$48a0ff84,$f23c9000
- dc.l $00000000,$f22ef040,$ff842f02,$322eff84
- dc.l $24010281,$00007fff,$02428000,$92800681
- dc.l $00006000,$02417fff,$82423d41,$ff84241f
- dc.l $f22ed040,$ff846000,$ff80222e,$ff5c0201
- dc.l $0030f201,$900060a6,$f22ed080,$ff90f22e
- dc.l $9000ff5c,$f23c8800,$00000000,$f22e4820
- dc.l $ff84f201,$a800f23c,$90000000,$000083ae
- dc.l $ff64f200,$0098f23c,$58b80001,$f292fdee
- dc.l $f294fefa,$f22ed040,$ff90222e,$ff5c0201
- dc.l $00c00001,$0010f201,$9000f23c,$88000000
- dc.l $0000f22e,$48a0ff84,$f23c9000,$00000000
- dc.l $f2000498,$f23c58b8,$0001f293,$fdb06000
- dc.l $febc323b,$120a4efb,$10064afc,$0030fd20
- dc.l $009e0072,$0060fd20,$00660000,$00000072
- dc.l $006c0072,$00600072,$00660000,$000000d0
- dc.l $00d0006c,$006000d0,$00660000,$00000060
- dc.l $00600060,$00600060,$00660000,$0000fd20
- dc.l $009e0072,$0060fd20,$00660000,$00000066
- dc.l $00660066,$00660066,$00660000,$000060ff
- dc.l $ffffe62e,$60ffffff,$e62860ff,$ffffe6a6
- dc.l $10280000,$12290000,$b1016a10,$f23c4400
- dc.l $80000000,$1d7c000c,$ff644e75,$f23c4400
- dc.l $00000000,$1d7c0004,$ff644e75,$006e0410
- dc.l $ff661028,$00001229,$0000b101,$6a10f23c
- dc.l $4400ff80,$00001d7c,$000aff64,$4e75f23c
- dc.l $44007f80,$00001d7c,$0002ff64,$4e751029
- dc.l $00001228,$0000b101,$6a16f229,$d0800000
- dc.l $f2000018,$f200001a,$1d7c000a,$ff644e75
- dc.l $f229d080,$0000f200,$00181d7c,$0002ff64
- dc.l $4e750200,$00300000,$00406008,$02000030
- dc.l $00000080,$2d40ff5c,$122eff4e,$66000276
- dc.l $020000c0,$66000090,$2d680004,$ff882d68
- dc.l $0008ff8c,$30280000,$0a408000,$6a061d7c
- dc.l $0008ff64,$3d40ff84,$f22ed080,$ff844e75
- dc.l $020000c0,$666008ee,$0003ff66,$2d680004
- dc.l $ff882d68,$0008ff8c,$30280000,$0a408000
- dc.l $6a061d7c,$0008ff64,$3d40ff84,$f22ed080
- dc.l $ff84082e,$0003ff62,$66024e75,$41eeff84
- dc.l $61ffffff,$e8764440,$06406000,$322eff84
- dc.l $02418000,$02407fff,$80413d40,$ff84f22e
- dc.l $d040ff84,$4e750c00,$0040667e,$3d680000
- dc.l $ff842d68,$0004ff88,$2d680008,$ff8c61ff
- dc.l $ffffe3d8,$0c800000,$007f6c00,$00900c80
- dc.l $ffffff81,$67000178,$6d0000f4,$f23c8800
- dc.l $00000000,$f22e9000,$ff5cf22e,$481aff84
- dc.l $f201a800,$f23c9000,$00000000,$83aeff64
- dc.l $2f02f22e,$f080ff84,$322eff84,$34010281
- dc.l $00007fff,$92800242,$80008441,$3d42ff84
- dc.l $241ff22e,$d080ff84,$4e753d68,$0000ff84
- dc.l $2d680004,$ff882d68,$0008ff8c,$61ffffff
- dc.l $e35a0c80,$000003ff,$6c120c80,$fffffc01
- dc.l $670000fc,$6d000078,$6000ff82,$08ee0003
- dc.l $ff660a2e,$0080ff84,$6a0608ee,$0003ff64
- dc.l $122eff62,$0201000b,$661a41ee,$ff84222e
- dc.l $ff5c61ff,$ffffe99a,$812eff64,$f22ed080
- dc.l $ff844e75,$2d6eff88,$ff942d6e,$ff8cff98
- dc.l $322eff84,$2f022401,$02810000,$7fff0242
- dc.l $80009280,$06810000,$60000241,$7fff8242
- dc.l $3d41ff90,$f22ed040,$ff90241f,$60acf23c
- dc.l $88000000,$0000f22e,$9000ff5c,$f22e481a
- dc.l $ff84f23c,$90000000,$0000f201,$a80083ae
- dc.l $ff6400ae,$00001048,$ff64122e,$ff620201
- dc.l $0013661c,$082e0003,$ff6456c1,$202eff5c
- dc.l $61ffffff,$ea0a812e,$ff64f210,$d0804e75
- dc.l $2f02322e,$ff842401,$02810000,$7fff0242
- dc.l $80009280,$04810000,$60000241,$7fff8242
- dc.l $3d41ff84,$f22ed040,$ff84241f,$60b6f23c
- dc.l $88000000,$0000f22e,$9000ff5c,$f22e481a
- dc.l $ff84f201,$a800f23c,$90000000,$000083ae
- dc.l $ff64f200,$0098f23c,$58b80002,$f293ff74
- dc.l $6000fe7e,$0c010004,$6700fdb6,$0c010005
- dc.l $67ffffff,$e3040c01,$000367ff,$ffffe30e
- dc.l $f228481a,$0000f200,$a800e198,$1d40ff64
- dc.l $4e75122e,$ff4e6610,$4a280000,$6b024e75
- dc.l $1d7c0008,$ff644e75,$0c010001,$67400c01
- dc.l $00026724,$0c010005,$67ffffff,$e2bc0c01
- dc.l $000367ff,$ffffe2c6,$4a280000,$6b024e75
- dc.l $1d7c0008,$ff644e75,$4a280000,$6b081d7c
- dc.l $0002ff64,$4e751d7c,$000aff64,$4e754a28
- dc.l $00006b08,$1d7c0004,$ff644e75,$1d7c000c
- dc.l $ff644e75,$122eff4e,$66280200,$0030f200
- dc.l $9000f23c,$88000000,$0000f228,$48010000
- dc.l $f23c9000,$00000000,$f200a800,$81aeff64
- dc.l $4e750c01,$0001672e,$0c010002,$674e0c01
- dc.l $00046710,$0c010005,$67ffffff,$e22c60ff
- dc.l $ffffe23a,$3d680000,$ff841d7c,$0080ff88
- dc.l $41eeff84,$60a44a28,$00006b10,$f23c4400
- dc.l $00000000,$1d7c0004,$ff644e75,$f23c4400
- dc.l $80000000,$1d7c000c,$ff644e75,$f228d080
- dc.l $00004a28,$00006b08,$1d7c0002,$ff644e75
- dc.l $1d7c000a,$ff644e75,$122eff4e,$6618f23c
- dc.l $88000000,$0000f228,$48030000,$f200a800
- dc.l $81aeff64,$4e750c01,$0001672e,$0c010002
- dc.l $674e0c01,$00046710,$0c010005,$67ffffff
- dc.l $e19860ff,$ffffe1a6,$3d680000,$ff841d7c
- dc.l $0080ff88,$41eeff84,$60b44a28,$00006b10
- dc.l $f23c4400,$00000000,$1d7c0004,$ff644e75
- dc.l $f23c4400,$80000000,$1d7c000c,$ff644e75
- dc.l $f228d080,$00004a28,$00006b08,$1d7c0002
- dc.l $ff644e75,$1d7c000a,$ff644e75,$02000030
- dc.l $00000040,$60080200,$00300000,$00802d40
- dc.l $ff5c122e,$ff4e6600,$025c0200,$00c0667e
- dc.l $2d680004,$ff882d68,$0008ff8c,$32280000
- dc.l $0881000f,$3d41ff84,$f22ed080,$ff844e75
- dc.l $020000c0,$665808ee,$0003ff66,$2d680004
- dc.l $ff882d68,$0008ff8c,$30280000,$0880000f
- dc.l $3d40ff84,$f22ed080,$ff84082e,$0003ff62
- dc.l $66024e75,$41eeff84,$61ffffff,$e41e4440
- dc.l $06406000,$322eff84,$02418000,$02407fff
- dc.l $80413d40,$ff84f22e,$d040ff84,$4e750c00
- dc.l $0040667e,$3d680000,$ff842d68,$0004ff88
- dc.l $2d680008,$ff8c61ff,$ffffdf80,$0c800000
- dc.l $007f6c00,$00900c80,$ffffff81,$67000170
- dc.l $6d0000ec,$f23c8800,$00000000,$f22e9000
- dc.l $ff5cf22e,$4818ff84,$f201a800,$f23c9000
- dc.l $00000000,$83aeff64,$2f02f22e,$f080ff84
- dc.l $322eff84,$24010281,$00007fff,$92800242
- dc.l $80008441,$3d42ff84,$241ff22e,$d080ff84
- dc.l $4e753d68,$0000ff84,$2d680004,$ff882d68
- dc.l $0008ff8c,$61ffffff,$df020c80,$000003ff
- dc.l $6c120c80,$fffffc01,$670000f4,$6d000070
- dc.l $6000ff82,$08ee0003,$ff6608ae,$0007ff84
- dc.l $122eff62,$0201000b,$661a41ee,$ff84222e
- dc.l $ff5c61ff,$ffffe54a,$812eff64,$f22ed080
- dc.l $ff844e75,$2d6eff88,$ff942d6e,$ff8cff98
- dc.l $322eff84,$2f022401,$02810000,$7fff0242
- dc.l $80009280,$06810000,$60000241,$7fff8242
- dc.l $3d41ff90,$f22ed040,$ff90241f,$60acf23c
- dc.l $88000000,$0000f22e,$9000ff5c,$f22e4818
- dc.l $ff84f23c,$90000000,$0000f201,$a80083ae
- dc.l $ff6400ae,$00001048,$ff64122e,$ff620201
- dc.l $0013661c,$082e0003,$ff6456c1,$202eff5c
- dc.l $61ffffff,$e5ba812e,$ff64f210,$d0804e75
- dc.l $2f02322e,$ff842401,$02810000,$7fff0242
- dc.l $80009280,$04810000,$60000241,$7fff8242
- dc.l $3d41ff84,$f22ed040,$ff84241f,$60b6f23c
- dc.l $88000000,$0000f22e,$9000ff5c,$f22e4818
- dc.l $ff84f201,$a800f23c,$90000000,$000083ae
- dc.l $ff64f200,$0098f23c,$58b80002,$f293ff74
- dc.l $6000fe86,$0c010004,$6700fdc6,$0c010005
- dc.l $67ffffff,$deb40c01,$000367ff,$ffffdebe
- dc.l $f2284818,$00000c01,$00026708,$1d7c0004
- dc.l $ff644e75,$1d7c0002,$ff644e75,$4241122e
- dc.l $ff4fe709,$822eff4e,$6618f229,$d0800000
- dc.l $f2284838,$0000f200,$a800e198,$1d40ff64
- dc.l $4e75323b,$120a4efb,$10064afc,$0030ffdc
- dc.l $ffdcffdc,$006000f8,$006e0000,$0000ffdc
- dc.l $ffdcffdc,$0060007c,$006e0000,$0000ffdc
- dc.l $ffdcffdc,$0060007c,$006e0000,$00000060
- dc.l $00600060,$00600060,$006e0000,$00000114
- dc.l $009c009c,$006000bc,$006e0000,$0000006e
- dc.l $006e006e,$006e006e,$006e0000,$000061ff
- dc.l $ffffddde,$022e00f7,$ff644e75,$61ffffff
- dc.l $ddd0022e,$00f7ff64,$4e753d68,$0000ff84
- dc.l $20280004,$08c0001f,$2d40ff88,$2d680008
- dc.l $ff8c41ee,$ff846000,$ff422d69,$0000ff84
- dc.l $20290004,$08c0001f,$2d40ff88,$2d690008
- dc.l $ff8c43ee,$ff846000,$ff223d69,$0000ff90
- dc.l $3d680000,$ff842029,$000408c0,$001f2d40
- dc.l $ff942028,$000408c0,$001f2d40,$ff882d69
- dc.l $0008ff98,$2d680008,$ff8c43ee,$ff9041ee
- dc.l $ff846000,$fee61028,$00001229,$0000b101
- dc.l $6b00ff78,$4a006b02,$4e751d7c,$0008ff64
- dc.l $4e751028,$00001229,$0000b101,$6b00ff7c
- dc.l $4a006a02,$4e751d7c,$0008ff64,$4e752d40
- dc.l $ff5c4241,$122eff4f,$e709822e,$ff4e6600
- dc.l $02a03d69,$0000ff90,$2d690004,$ff942d69
- dc.l $0008ff98,$3d680000,$ff842d68,$0004ff88
- dc.l $2d680008,$ff8c61ff,$ffffdbf0,$2f0061ff
- dc.l $ffffdc94,$d09f0c80,$ffffc001,$670000f8
- dc.l $6d000064,$0c800000,$40006700,$01da6e00
- dc.l $0122f22e,$d080ff90,$f22e9000,$ff5cf23c
- dc.l $88000000,$0000f22e,$4827ff84,$f201a800
- dc.l $f23c9000,$00000000,$83aeff64,$f22ef080
- dc.l $ff842f02,$322eff84,$24010281,$00007fff
- dc.l $02428000,$92808242,$3d41ff84,$241ff22e
- dc.l $d080ff84,$4e75f22e,$d080ff90,$f22e9000
- dc.l $ff5cf23c,$88000000,$0000f22e,$4827ff84
- dc.l $f201a800,$f23c9000,$00000000,$83aeff64
- dc.l $00ae0000,$1048ff64,$122eff62,$02010013
- dc.l $6620082e,$0003ff64,$56c1202e,$ff5c0200
- dc.l $003061ff,$ffffe2a8,$812eff64,$f210d080
- dc.l $4e75f22e,$f080ff84,$2f02322e,$ff842401
- dc.l $02810000,$7fff9280,$04810000,$60000241
- dc.l $7fff0242,$80008242,$3d41ff84,$241ff22e
- dc.l $d040ff84,$60acf22e,$d080ff90,$f22e9000
- dc.l $ff5cf23c,$88000000,$0000f22e,$4827ff84
- dc.l $f201a800,$f23c9000,$00000000,$83aeff64
- dc.l $f2000098,$f23c58b8,$0002f293,$ff646000
- dc.l $ff0c08ee,$0003ff66,$f22ed080,$ff90f23c
- dc.l $90000000,$0010f23c,$88000000,$0000f22e
- dc.l $4827ff84,$f201a800,$f23c9000,$00000000
- dc.l $83aeff64,$122eff62,$0201000b,$6620f22e
- dc.l $f080ff84,$41eeff84,$222eff5c,$61ffffff
- dc.l $e166812e,$ff64f22e,$d080ff84,$4e75f22e
- dc.l $d040ff90,$f22e9000,$ff5cf23c,$88000000
- dc.l $0000f22e,$48a7ff84,$f23c9000,$00000000
- dc.l $f22ef040,$ff842f02,$322eff84,$24010281
- dc.l $00007fff,$02428000,$92800681,$00006000
- dc.l $02417fff,$82423d41,$ff84241f,$f22ed040
- dc.l $ff846000,$ff8af22e,$d080ff90,$f22e9000
- dc.l $ff5cf23c,$88000000,$0000f22e,$4827ff84
- dc.l $f201a800,$f23c9000,$00000000,$83aeff64
- dc.l $f2000098,$f23c58b8,$0002f292,$fe20f294
- dc.l $ff12f22e,$d040ff90,$222eff5c,$020100c0
- dc.l $00010010,$f2019000,$f23c8800,$00000000
- dc.l $f22e48a7,$ff84f23c,$90000000,$0000f200
- dc.l $0498f23c,$58b80002,$f293fde2,$6000fed4
- dc.l $323b120a,$4efb1006,$4afc0030,$fd560072
- dc.l $0078006c,$fd560066,$00000000,$00720072
- dc.l $0060006c,$00720066,$00000000,$007e0060
- dc.l $007e006c,$007e0066,$00000000,$006c006c
- dc.l $006c006c,$006c0066,$00000000,$fd560072
- dc.l $0078006c,$fd560066,$00000000,$00660066
- dc.l $00660066,$00660066,$00000000,$60ffffff
- dc.l $da7460ff,$ffffd9ea,$60ffffff,$d9e460ff
- dc.l $ffffed0e,$60ffffff,$ed6260ff,$ffffed2e
- dc.l $2d40ff5c,$4241122e,$ff4fe709,$822eff4e
- dc.l $6600027c,$3d690000,$ff902d69,$0004ff94
- dc.l $2d690008,$ff983d68,$0000ff84,$2d680004
- dc.l $ff882d68,$0008ff8c,$61ffffff,$d8ae2f00
- dc.l $61ffffff,$d9524497,$d197322e,$ff5eec09
- dc.l $201f0c80,$ffffc001,$6f000064,$0c800000
- dc.l $3fff6700,$01b66e00,$0100f22e,$d080ff90
- dc.l $f22e9000,$ff5cf23c,$88000000,$0000f22e
- dc.l $4824ff84,$f201a800,$f23c9000,$00000000
- dc.l $83aeff64,$f22ef080,$ff842f02,$322eff84
- dc.l $24010281,$00007fff,$02428000,$92808242
- dc.l $3d41ff84,$241ff22e,$d080ff84,$4e75f22e
- dc.l $d080ff90,$f22e9000,$ff5cf23c,$88000000
- dc.l $0000f22e,$4824ff84,$f201a800,$f23c9000
- dc.l $00000000,$83aeff64,$f227e001,$3217dffc
- dc.l $0000000c,$02810000,$7fff9280,$0c810000
- dc.l $7fff6d90,$006e1048,$ff66122e,$ff620201
- dc.l $00136620,$082e0003,$ff6456c1,$202eff5c
- dc.l $02000030,$61ffffff,$df46812e,$ff64f210
- dc.l $d0804e75,$f22ef080,$ff842f02,$322eff84
- dc.l $24010281,$00007fff,$02428000,$92800481
- dc.l $00006000,$02417fff,$82423d41,$ff84241f
- dc.l $f22ed040,$ff8460ac,$08ee0003,$ff66f22e
- dc.l $d080ff90,$f23c9000,$00000010,$f23c8800
- dc.l $00000000,$f22e4824,$ff84f201,$a800f23c
- dc.l $90000000,$000083ae,$ff64122e,$ff620201
- dc.l $000b6620,$f22ef080,$ff8441ee,$ff84222e
- dc.l $ff5c61ff,$ffffde40,$812eff64,$f22ed080
- dc.l $ff844e75,$f22ed040,$ff90f22e,$9000ff5c
- dc.l $f23c8800,$00000000,$f22e48a4,$ff84f23c
- dc.l $90000000,$0000f22e,$f040ff84,$2f02322e
- dc.l $ff842401,$02810000,$7fff0242,$80009280
- dc.l $06810000,$60000241,$7fff8242,$3d41ff84
- dc.l $241ff22e,$d040ff84,$608af22e,$d080ff90
- dc.l $f22e9000,$ff5cf23c,$88000000,$0000f22e
- dc.l $4824ff84,$f201a800,$f23c9000,$00000000
- dc.l $83aeff64,$f2000098,$f23c58b8,$0001f292
- dc.l $fe44f294,$ff14f22e,$d040ff90,$42810001
- dc.l $0010f201,$9000f23c,$88000000,$0000f22e
- dc.l $48a4ff84,$f23c9000,$00000000,$f2000498
- dc.l $f23c58b8,$0001f293,$fe0c6000,$fedc323b
- dc.l $120a4efb,$10064afc,$0030fd7a,$00720078
- dc.l $0060fd7a,$00660000,$00000078,$006c0078
- dc.l $00600078,$00660000,$0000007e,$007e006c
- dc.l $0060007e,$00660000,$00000060,$00600060
- dc.l $00600060,$00660000,$0000fd7a,$00720078
- dc.l $0060fd7a,$00660000,$00000066,$00660066
- dc.l $00660066,$00660000,$000060ff,$ffffd6d2
- dc.l $60ffffff,$d6cc60ff,$ffffd74a,$60ffffff
- dc.l $f0ce60ff,$fffff09c,$60ffffff,$f0f40200
- dc.l $00300000,$00406008,$02000030,$00000080
- dc.l $2d40ff5c,$4241122e,$ff4fe709,$822eff4e
- dc.l $6600024c,$61ffffff,$d4b2f22e,$d080ff90
- dc.l $f23c8800,$00000000,$f22e9000,$ff5cf22e
- dc.l $4822ff84,$f23c9000,$00000000,$f201a800
- dc.l $83aeff64,$f281003c,$2f02f227,$e001322e
- dc.l $ff5eec09,$34170282,$00007fff,$9480b4bb
- dc.l $14246c38,$b4bb142a,$6d0000b8,$67000184
- dc.l $32170241,$80008242,$3e81f21f,$d080241f
- dc.l $4e754e75,$00007fff,$0000407f,$000043ff
- dc.l $00000000,$00003f81,$00003c01,$00ae0000
- dc.l $1048ff64,$122eff62,$02010013,$6624dffc
- dc.l $0000000c,$082e0003,$ff6456c1,$202eff5c
- dc.l $61ffffff,$dc7a812e,$ff64f210,$d080241f
- dc.l $4e75122e,$ff5c0201,$00c0661a,$32170241
- dc.l $80000482,$00006000,$02427fff,$82423e81
- dc.l $f21fd040,$60bef22e,$d080ff90,$222eff5c
- dc.l $02010030,$f2019000,$f22e4822,$ff84f23c
- dc.l $90000000,$0000dffc,$0000000c,$f227e001
- dc.l $60ba08ee,$0003ff66,$dffc0000,$000cf22e
- dc.l $d080ff90,$f23c9000,$00000010,$f23c8800
- dc.l $00000000,$f22e4822,$ff84f23c,$90000000
- dc.l $0000f201,$a80083ae,$ff64122e,$ff620201
- dc.l $000b6622,$f22ef080,$ff8441ee,$ff84222e
- dc.l $ff5c61ff,$ffffdaca,$812eff64,$f22ed080
- dc.l $ff84241f,$4e75f22e,$d040ff90,$222eff5c
- dc.l $020100c0,$664ef22e,$9000ff5c,$f23c8800
- dc.l $00000000,$f22e48a2,$ff84f23c,$90000000
- dc.l $0000f22e,$f040ff84,$322eff84,$24010281
- dc.l $00007fff,$02428000,$92800681,$00006000
- dc.l $02417fff,$82423d41,$ff84f22e,$d040ff84
- dc.l $6000ff82,$222eff5c,$02010030,$f2019000
- dc.l $60aa222e,$ff5c0201,$00c06700,$fe74222f
- dc.l $00040c81,$80000000,$6600fe66,$4aaf0008
- dc.l $6600fe5e,$082e0001,$ff666700,$fe54f22e
- dc.l $d040ff90,$222eff5c,$020100c0,$00010010
- dc.l $f2019000,$f23c8800,$00000000,$f22e48a2
- dc.l $ff84f23c,$90000000,$0000f200,$0018f200
- dc.l $0498f200,$0438f292,$feca6000,$fe14323b
- dc.l $120a4efb,$10064afc,$0030fdaa,$00e4011c
- dc.l $0060fdaa,$00660000,$000000bc,$006c011c
- dc.l $006000bc,$00660000,$00000130,$0130010c
- dc.l $00600130,$00660000,$00000060,$00600060
- dc.l $00600060,$00660000,$0000fdaa,$00e4011c
- dc.l $0060fdaa,$00660000,$00000066,$00660066
- dc.l $00660066,$00660000,$000060ff,$ffffd3d2
- dc.l $60ffffff,$d3cc1028,$00001229,$0000b101
- dc.l $6b000016,$4a006b2e,$f23c4400,$00000000
- dc.l $1d7c0004,$ff644e75,$122eff5f,$02010030
- dc.l $0c010020,$6710f23c,$44000000,$00001d7c
- dc.l $0004ff64,$4e75f23c,$44008000,$00001d7c
- dc.l $000cff64,$4e753d68,$0000ff84,$2d680004
- dc.l $ff882d68,$0008ff8c,$61ffffff,$d27e426e
- dc.l $ff9042ae,$ff9442ae,$ff986000,$fcce3d69
- dc.l $0000ff90,$2d690004,$ff942d69,$0008ff98
- dc.l $61ffffff,$d302426e,$ff8442ae,$ff8842ae
- dc.l $ff8c6000,$fca61028,$00001229,$0000b300
- dc.l $6bffffff,$d3a0f228,$d0800000,$4a280000
- dc.l $6a1c1d7c,$000aff64,$4e75f229,$d0800000
- dc.l $4a290000,$6a081d7c,$000aff64,$4e751d7c
- dc.l $0002ff64,$4e750200,$00300000,$00406008
- dc.l $02000030,$00000080,$2d40ff5c,$4241122e
- dc.l $ff4fe709,$822eff4e,$6600024c,$61ffffff
- dc.l $d0eaf22e,$d080ff90,$f23c8800,$00000000
- dc.l $f22e9000,$ff5cf22e,$4828ff84,$f23c9000
- dc.l $00000000,$f201a800,$83aeff64,$f281003c
- dc.l $2f02f227,$e001322e,$ff5eec09,$34170282
- dc.l $00007fff,$9480b4bb,$14246c38,$b4bb142a
- dc.l $6d0000b8,$67000184,$32170241,$80008242
- dc.l $3e81f21f,$d080241f,$4e754e75,$00007fff
- dc.l $0000407f,$000043ff,$00000000,$00003f81
- dc.l $00003c01,$00ae0000,$1048ff64,$122eff62
- dc.l $02010013,$6624dffc,$0000000c,$082e0003
- dc.l $ff6456c1,$202eff5c,$61ffffff,$d8b2812e
- dc.l $ff64f210,$d080241f,$4e75122e,$ff5c0201
- dc.l $00c0661a,$32170241,$80000482,$00006000
- dc.l $02427fff,$82423e81,$f21fd040,$60bef22e
- dc.l $d080ff90,$222eff5c,$02010030,$f2019000
- dc.l $f22e4828,$ff84f23c,$90000000,$0000dffc
- dc.l $0000000c,$f227e001,$60ba08ee,$0003ff66
- dc.l $dffc0000,$000cf22e,$d080ff90,$f23c9000
- dc.l $00000010,$f23c8800,$00000000,$f22e4828
- dc.l $ff84f23c,$90000000,$0000f201,$a80083ae
- dc.l $ff64122e,$ff620201,$000b6622,$f22ef080
- dc.l $ff8441ee,$ff84222e,$ff5c61ff,$ffffd702
- dc.l $812eff64,$f22ed080,$ff84241f,$4e75f22e
- dc.l $d040ff90,$222eff5c,$020100c0,$664ef22e
- dc.l $9000ff5c,$f23c8800,$00000000,$f22e48a8
- dc.l $ff84f23c,$90000000,$0000f22e,$f040ff84
- dc.l $322eff84,$24010281,$00007fff,$02428000
- dc.l $92800681,$00006000,$02417fff,$82423d41
- dc.l $ff84f22e,$d040ff84,$6000ff82,$222eff5c
- dc.l $02010030,$f2019000,$60aa222e,$ff5c0201
- dc.l $00c06700,$fe74222f,$00040c81,$80000000
- dc.l $6600fe66,$4aaf0008,$6600fe5e,$082e0001
- dc.l $ff666700,$fe54f22e,$d040ff90,$222eff5c
- dc.l $020100c0,$00010010,$f2019000,$f23c8800
- dc.l $00000000,$f22e48a8,$ff84f23c,$90000000
- dc.l $0000f200,$0018f200,$0498f200,$0438f292
- dc.l $feca6000,$fe14323b,$120a4efb,$10064afc
- dc.l $0030fdaa,$00e2011a,$0060fdaa,$00660000
- dc.l $000000ba,$006c011a,$006000ba,$00660000
- dc.l $00000130,$0130010a,$00600130,$00660000
- dc.l $00000060,$00600060,$00600060,$00660000
- dc.l $0000fdaa,$00e2011a,$0060fdaa,$00660000
- dc.l $00000066,$00660066,$00660066,$00660000
- dc.l $000060ff,$ffffd00a,$60ffffff,$d0041028
- dc.l $00001229,$0000b300,$6a144a00,$6b2ef23c
- dc.l $44000000,$00001d7c,$0004ff64,$4e75122e
- dc.l $ff5f0201,$00300c01,$00206710,$f23c4400
- dc.l $00000000,$1d7c0004,$ff644e75,$f23c4400
- dc.l $80000000,$1d7c000c,$ff644e75,$3d680000
- dc.l $ff842d68,$0004ff88,$2d680008,$ff8c61ff
- dc.l $ffffceb8,$426eff90,$42aeff94,$42aeff98
- dc.l $6000fcd0,$3d690000,$ff902d69,$0004ff94
- dc.l $2d690008,$ff9861ff,$ffffcf3c,$426eff84
- dc.l $42aeff88,$42aeff8c,$6000fca8,$10280000
- dc.l $12290000,$b3006aff,$ffffcfda,$f228d080
- dc.l $0000f200,$001af293,$001e1d7c,$000aff64
- dc.l $4e75f229,$d0800000,$4a290000,$6a081d7c
- dc.l $000aff64,$4e751d7c,$0002ff64,$4e750200
- dc.l $00300000,$00406008,$02000030,$00000080
- dc.l $2d40ff5c,$4241122e,$ff4e6600,$02744a28
- dc.l $00006bff,$ffffcf7e,$020000c0,$6648f22e
- dc.l $9000ff5c,$f23c8800,$00000000,$f2104804
- dc.l $f201a800,$83aeff64,$4e754a28,$00006bff
- dc.l $ffffcf52,$020000c0,$661c3d68,$0000ff84
- dc.l $2d680004,$ff882d68,$0008ff8c,$61ffffff
- dc.l $ce046000,$003e0c00,$00406600,$00843d68
- dc.l $0000ff84,$2d680004,$ff882d68,$0008ff8c
- dc.l $61ffffff,$cde00c80,$0000007e,$67000098
- dc.l $6e00009e,$0c80ffff,$ff806700,$01a46d00
- dc.l $0120f23c,$88000000,$0000f22e,$9000ff5c
- dc.l $f22e4804,$ff84f201,$a800f23c,$90000000
- dc.l $000083ae,$ff642f02,$f22ef080,$ff84322e
- dc.l $ff842401,$02810000,$7fff9280,$02428000
- dc.l $84413d42,$ff84241f,$f22ed080,$ff844e75
- dc.l $3d680000,$ff842d68,$0004ff88,$2d680008
- dc.l $ff8c61ff,$ffffcd5e,$0c800000,$03fe6700
- dc.l $00166e1c,$0c80ffff,$fc006700,$01246d00
- dc.l $00a06000,$ff7e082e,$0000ff85,$6600ff74
- dc.l $08ee0003,$ff66f23c,$90000000,$0010f23c
- dc.l $88000000,$0000f22e,$4804ff84,$f201a800
- dc.l $f23c9000,$00000000,$83aeff64,$122eff62
- dc.l $0201000b,$6620f22e,$f080ff84,$41eeff84
- dc.l $222eff5c,$61ffffff,$d338812e,$ff64f22e
- dc.l $d080ff84,$4e752d6e,$ff88ff94,$2d6eff8c
- dc.l $ff98322e,$ff842f02,$24010281,$00007fff
- dc.l $02428000,$92800681,$00006000,$02417fff
- dc.l $82423d41,$ff90f22e,$d040ff90,$241f60a6
- dc.l $f23c8800,$00000000,$f22e9000,$ff5cf22e
- dc.l $4804ff84,$f23c9000,$00000000,$f201a800
- dc.l $83aeff64,$00ae0000,$1048ff64,$122eff62
- dc.l $02010013,$661c082e,$0003ff64,$56c1202e
- dc.l $ff5c61ff,$ffffd3a8,$812eff64,$f210d080
- dc.l $4e752f02,$322eff84,$24010281,$00007fff
- dc.l $02428000,$92800481,$00006000,$02417fff
- dc.l $82423d41,$ff84f22e,$d040ff84,$241f60b6
- dc.l $082e0000,$ff856600,$ff78f23c,$88000000
- dc.l $0000f22e,$9000ff5c,$f22e4804,$ff84f201
- dc.l $a800f23c,$90000000,$000083ae,$ff64f200
- dc.l $0080f23c,$58b80001,$f293ff6a,$6000fe48
- dc.l $0c010004,$6700fdb4,$0c010001,$67160c01
- dc.l $00026736,$0c010005,$67ffffff,$cc8c60ff
- dc.l $ffffcc9a,$4a280000,$6b10f23c,$44000000
- dc.l $00001d7c,$0004ff64,$4e75f23c,$44008000
- dc.l $00001d7c,$000cff64,$4e754a28,$00006bff
- dc.l $ffffccc2,$f228d080,$00001d7c,$0002ff64
- dc.l $4e75303b,$12064efb,$00020020,$0026002c
- dc.l $00300034,$0038003c,$00400044,$004a0050
- dc.l $00540058,$005c0060,$0064202e,$ff9c4e75
- dc.l $202effa0,$4e752002,$4e752003,$4e752004
- dc.l $4e752005,$4e752006,$4e752007,$4e75202e
- dc.l $ffa44e75,$202effa8,$4e75200a,$4e75200b
- dc.l $4e75200c,$4e75200d,$4e752016,$4e75202e
- dc.l $ffd84e75,$323b1206,$4efb1002,$00100016
- dc.l $001c0020,$00240028,$002c0030,$2d40ff9c
- dc.l $4e752d40,$ffa04e75,$24004e75,$26004e75
- dc.l $28004e75,$2a004e75,$2c004e75,$2e004e75
- dc.l $323b1206,$4efb1002,$00100016,$001c0020
- dc.l $00240028,$002c0030,$3d40ff9e,$4e753d40
- dc.l $ffa24e75,$34004e75,$36004e75,$38004e75
- dc.l $3a004e75,$3c004e75,$3e004e75,$323b1206
- dc.l $4efb1002,$00100016,$001c0020,$00240028
- dc.l $002c0030,$1d40ff9f,$4e751d40,$ffa34e75
- dc.l $14004e75,$16004e75,$18004e75,$1a004e75
- dc.l $1c004e75,$1e004e75,$323b1206,$4efb1002
- dc.l $00100016,$001c0020,$00240028,$002c0030
- dc.l $d1aeffa4,$4e75d1ae,$ffa84e75,$d5c04e75
- dc.l $d7c04e75,$d9c04e75,$dbc04e75,$d1964e75
- dc.l $1d7c0004,$ff4a0c00,$00016706,$d1aeffd8
- dc.l $4e7554ae,$ffd84e75,$323b1206,$4efb1002
- dc.l $00100016,$001c0020,$00240028,$002c0030
- dc.l $91aeffa4,$4e7591ae,$ffa84e75,$95c04e75
- dc.l $97c04e75,$99c04e75,$9bc04e75,$91964e75
- dc.l $1d7c0008,$ff4a0c00,$00016706,$91aeffd8
- dc.l $4e7555ae,$ffd84e75,$303b0206,$4efb0002
- dc.l $00100028,$0040004c,$00580064,$0070007c
- dc.l $2d6effdc,$ff6c2d6e,$ffe0ff70,$2d6effe4
- dc.l $ff7441ee,$ff6c4e75,$2d6effe8,$ff6c2d6e
- dc.l $ffecff70,$2d6efff0,$ff7441ee,$ff6c4e75
- dc.l $f22ef020,$ff6c41ee,$ff6c4e75,$f22ef010
- dc.l $ff6c41ee,$ff6c4e75,$f22ef008,$ff6c41ee
- dc.l $ff6c4e75,$f22ef004,$ff6c41ee,$ff6c4e75
- dc.l $f22ef002,$ff6c41ee,$ff6c4e75,$f22ef001
- dc.l $ff6c41ee,$ff6c4e75,$303b0206,$4efb0002
- dc.l $00100028,$0040004c,$00580064,$0070007c
- dc.l $2d6effdc,$ff782d6e,$ffe0ff7c,$2d6effe4
- dc.l $ff8041ee,$ff784e75,$2d6effe8,$ff782d6e
- dc.l $ffecff7c,$2d6efff0,$ff8041ee,$ff784e75
- dc.l $f22ef020,$ff7841ee,$ff784e75,$f22ef010
- dc.l $ff7841ee,$ff784e75,$f22ef008,$ff7841ee
- dc.l $ff784e75,$f22ef004,$ff7841ee,$ff784e75
- dc.l $f22ef002,$ff7841ee,$ff784e75,$f22ef001
- dc.l $ff7841ee,$ff784e75,$303b0206,$4efb0002
- dc.l $00100018,$0020002a,$0034003e,$00480052
- dc.l $f22ef080,$ffdc4e75,$f22ef080,$ffe84e75
- dc.l $f227e001,$f21fd020,$4e75f227,$e001f21f
- dc.l $d0104e75,$f227e001,$f21fd008,$4e75f227
- dc.l $e001f21f,$d0044e75,$f227e001,$f21fd002
- dc.l $4e75f227,$e001f21f,$d0014e75,$700c61ff
- dc.l $ffffbace,$43eeff6c,$700c61ff,$ffffa0d8
- dc.l $4a8166ff,$00000a14,$e9ee004f,$ff6c0c40
- dc.l $7fff6602,$4e75102e,$ff6f0200,$000f660e
- dc.l $4aaeff70,$66084aae,$ff746602,$4e7541ee
- dc.l $ff6c61ff,$0000001c,$f22ef080,$ff6c4e75
- dc.l $00000000,$02030203,$02030302,$03020203
- dc.l $2d680000,$ff842d68,$0004ff88,$2d680008
- dc.l $ff8c41ee,$ff8448e7,$3c00f227,$e0017402
- dc.l $76042810,$42814c3c,$10010000,$000ae9c4
- dc.l $08c4d280,$580351ca,$ffee0804,$001e6702
- dc.l $44810481,$00000010,$6c0e4481,$00844000
- dc.l $00000090,$40000000,$2f017201,$f23c4400
- dc.l $00000000,$e9d00704,$f2005822,$28301c00
- dc.l $76007407,$f23c4423,$41200000,$e9c408c4
- dc.l $f2005822,$580351ca,$ffec5281,$0c810000
- dc.l $00026fd8,$0810001f,$6704f200,$001a2217
- dc.l $0c810000,$001b6f00,$00e40810,$001e6674
- dc.l $42812810,$e9c40704,$66245281,$7a012830
- dc.l $5c006608,$50815285,$28305c00,$42837407
- dc.l $e9c408c4,$66085883,$528151ca,$fff42001
- dc.l $22179280,$6c104481,$28100084,$40000000
- dc.l $00904000,$000043fb,$01700000,$06664283
- dc.l $f23c4480,$3f800000,$7403e280,$6406f231
- dc.l $48a33800,$06830000,$000c4a80,$66ecf200
- dc.l $04236068,$42817a02,$28305c00,$66085385
- dc.l $50812830,$5c00761c,$7407e9c4,$08c46608
- dc.l $59835281,$51cafff4,$20012217,$92806e10
- dc.l $44812810,$0284bfff,$ffff0290,$bfffffff
- dc.l $43fb0170,$000005fc,$4283f23c,$44803f80
- dc.l $00007403,$e2806406,$f23148a3,$38000683
- dc.l $0000000c,$4a8066ec,$f2000420,$262eff60
- dc.l $e9c32682,$2810e582,$e9c40002,$d48043fa
- dc.l $fe501031,$28004283,$efc30682,$f2039000
- dc.l $e280640a,$43fb0170,$00000644,$6016e280
- dc.l $640a43fb,$01700000,$06d26008,$43fb0170
- dc.l $00000590,$20016a08,$44800090,$40000000
- dc.l $4283f23c,$44803f80,$0000e280,$6406f231
- dc.l $48a33800,$06830000,$000c4a80,$66ec0810
- dc.l $001e6706,$f2000420,$6004f200,$0423f200
- dc.l $a8000880,$00096706,$006e0108,$ff66588f
- dc.l $f21fd040,$4cdf003c,$f23c9000,$00000000
- dc.l $f23c8800,$00000000,$4e753ffd,$00009a20
- dc.l $9a84fbcf,$f7980000,$00003ffd,$00009a20
- dc.l $9a84fbcf,$f7990000,$00003f80,$00000000
- dc.l $00000000,$00000000,$00004000,$00000000
- dc.l $00000000,$00000000,$00004120,$00000000
- dc.l $00000000,$00000000,$0000459a,$28000000
- dc.l $00000000,$00000000,$00000000,$00000303
- dc.l $02020302,$02030203,$030248e7,$3f20f227
- dc.l $e007f23c,$90000000,$00202d50,$ff582e00
- dc.l $422eff50,$0c2e0004,$ff4e6600,$00303010
- dc.l $02407fff,$22280004,$24280008,$5340e38a
- dc.l $e3914a81,$6cf64a40,$6e0450ee,$ff500240
- dc.l $7fff3080,$21410004,$21420008,$2d50ff90
- dc.l $2d680004,$ff942d68,$0008ff98,$02ae7fff
- dc.l $ffffff90,$4a2eff50,$67082c3c,$ffffecbb
- dc.l $6038302e,$ff903d7c,$3fffff90,$f22e4800
- dc.l $ff900440,$3ffff200,$5022f23a,$4428ff1c
- dc.l $f293000e,$f23a4823,$ff02f206,$6000600a
- dc.l $f23a4823,$fee6f206,$6000f23c,$88000000
- dc.l $00004245,$4a876f04,$28076006,$28069887
- dc.l $52844a84,$6f180c84,$00000011,$6f127811
- dc.l $4a876f0c,$00ae0000,$2080ff64,$60027801
- dc.l $4a876e06,$be866d02,$2c072006,$52809084
- dc.l $48454245,$42424a80,$6c145245,$0c80ffff
- dc.l $ecd46e08,$06800000,$00187418,$4480f23a
- dc.l $4480fe98,$e9ee1682,$ff60e349,$d245e349
- dc.l $4aaeff58,$6c025281,$45fafec0,$16321800
- dc.l $e98bf203,$9000e88b,$4a03660a,$43fb0170
- dc.l $00000370,$6016e20b,$640a43fb,$01700000
- dc.l $03fe6008,$43fb0170,$00000490,$4283e288
- dc.l $6406f231,$48a33800,$06830000,$000c4a80
- dc.l $66ecf23c,$88000000,$0000f23c,$90000000
- dc.l $0010f210,$4800f200,$00184a45,$6608f200
- dc.l $04206000,$008e4a2e,$ff506700,$0072f227
- dc.l $e0023617,$02437fff,$00508000,$d6500443
- dc.l $3fffd669,$00240443,$3fffd669,$00300443
- dc.l $3fff6b00,$00480257,$80008757,$02507fff
- dc.l $2f280008,$2f280004,$2f3c3fff,$0000f21f
- dc.l $d080f21f,$48232f29,$002c2f29,$00282f3c
- dc.l $3fff0000,$2f290038,$2f290034,$2f3c3fff
- dc.l $0000f21f,$4823f21f,$48236016,$60fe4a42
- dc.l $670cf229,$48230024,$f2294823,$0030f200
- dc.l $0423f200,$a800f22e,$6800ff90,$45eeff90
- dc.l $08000009,$670e00aa,$00000001,$0008f22e
- dc.l $4800ff90,$2d6eff60,$ff5402ae,$00000030
- dc.l $ff6048e7,$c0c02f2e,$ff542f2e,$ff5841ee
- dc.l $ff90f210,$68004aae,$ff586c06,$00908000
- dc.l $00002f2e,$ff64f22e,$9000ff60,$f23c8800
- dc.l $00000000,$f22e4801,$ff90f200,$a800816e
- dc.l $ff661d57,$ff64588f,$2d5fff58,$2d5fff54
- dc.l $4cdf0303,$2d6eff58,$ff902d6e,$ff54ff60
- dc.l $48454a45,$66ff0000,$0086f23a,$4500fcec
- dc.l $20045380,$4283e288,$6406f231,$49233800
- dc.l $06830000,$000c4a80,$66ec4a2e,$ff50670a
- dc.l $f2000018,$60ff0000,$0028f200,$0018f200
- dc.l $0838f293,$001a5386,$3a3c0001,$f23c9000
- dc.l $00000020,$f23a4523,$fcc26000,$fda8f23a
- dc.l $4523fcb8,$f2000838,$f294005c,$f292000c
- dc.l $f23a4420,$fca65286,$604c5286,$3a3c0001
- dc.l $f23c9000,$00000020,$6000fd7a,$f23a4500
- dc.l $fc6a2004,$4283e288,$6406f231,$49233800
- dc.l $06830000,$000c4a80,$66ecf200,$0018f200
- dc.l $0838f28e,$0012f23a,$4420fc60,$52865284
- dc.l $f23a4523,$fc56f23c,$90000000,$0010f200
- dc.l $082041ee,$ff84f210,$68002428,$00042628
- dc.l $000842a8,$000442a8,$00082010,$48406714
- dc.l $04800000,$3ffd4a80,$6e0a4480,$e28ae293
- dc.l $51c8fffa,$4a826604,$4a836710,$42810683
- dc.l $00000080,$d5810283,$ffffff80,$20045688
- dc.l $61ff0000,$02b04a2e,$ff506728,$f200003a
- dc.l $f281000c,$f2064000,$f2000018,$602e4a87
- dc.l $6d08f23a,$4400fbe4,$6022f206,$4000f200
- dc.l $00186018,$f200003a,$f28e000a,$f23a4400
- dc.l $fb9a6008,$f2064000,$f2000018,$f2294820
- dc.l $0018f22e,$6800ff90,$242a0004,$262a0008
- dc.l $3012670e,$04403ffd,$4440e28a,$e29351c8
- dc.l $fffa4281,$06830000,$0080d581,$0283ffff
- dc.l $ff807004,$41eeff54,$61ff0000,$0228202e
- dc.l $ff54720c,$e2a8efee,$010cff84,$e2a8efee
- dc.l $0404ff84,$4a006708,$00ae0000,$2080ff64
- dc.l $4280022e,$000fff84,$4aaeff58,$6c027002
- dc.l $4a866c02,$5280efee,$0002ff84,$f23c8800
- dc.l $00000000,$f21fd0e0,$4cdf04fc,$4e754002
- dc.l $0000a000,$00000000,$00004005,$0000c800
- dc.l $00000000,$0000400c,$00009c40,$00000000
- dc.l $00004019,$0000bebc,$20000000,$00004034
- dc.l $00008e1b,$c9bf0400,$00004069,$00009dc5
- dc.l $ada82b70,$b59e40d3,$0000c278,$1f49ffcf
- dc.l $a6d541a8,$000093ba,$47c980e9,$8ce04351
- dc.l $0000aa7e,$ebfb9df9,$de8e46a3,$0000e319
- dc.l $a0aea60e,$91c74d48,$0000c976,$75868175
- dc.l $0c175a92,$00009e8b,$3b5dc53d,$5de57525
- dc.l $0000c460,$52028a20,$979b4002,$0000a000
- dc.l $00000000,$00004005,$0000c800,$00000000
- dc.l $0000400c,$00009c40,$00000000,$00004019
- dc.l $0000bebc,$20000000,$00004034,$00008e1b
- dc.l $c9bf0400,$00004069,$00009dc5,$ada82b70
- dc.l $b59e40d3,$0000c278,$1f49ffcf,$a6d641a8
- dc.l $000093ba,$47c980e9,$8ce04351,$0000aa7e
- dc.l $ebfb9df9,$de8e46a3,$0000e319,$a0aea60e
- dc.l $91c74d48,$0000c976,$75868175,$0c185a92
- dc.l $00009e8b,$3b5dc53d,$5de57525,$0000c460
- dc.l $52028a20,$979b4002,$0000a000,$00000000
- dc.l $00004005,$0000c800,$00000000,$0000400c
- dc.l $00009c40,$00000000,$00004019,$0000bebc
- dc.l $20000000,$00004034,$00008e1b,$c9bf0400
- dc.l $00004069,$00009dc5,$ada82b70,$b59d40d3
- dc.l $0000c278,$1f49ffcf,$a6d541a8,$000093ba
- dc.l $47c980e9,$8cdf4351,$0000aa7e,$ebfb9df9
- dc.l $de8d46a3,$0000e319,$a0aea60e,$91c64d48
- dc.l $0000c976,$75868175,$0c175a92,$00009e8b
- dc.l $3b5dc53d,$5de47525,$0000c460,$52028a20
- dc.l $979a48e7,$ff007e01,$53802802,$2a03e9c2
- dc.l $1003e782,$e9c36003,$e7838486,$e385e394
- dc.l $4846d346,$d6854e71,$d5844e71,$d3464846
- dc.l $4a476712,$4847e947,$de4110c7,$48474247
- dc.l $51c8ffc8,$60124847,$3e014847,$524751c8
- dc.l $ffba4847,$e94f10c7,$4cdf00ff,$4e757001
- dc.l $610000d6,$3d7c0121,$000a6000,$007e7002
- dc.l $610000c6,$3d7c0141,$000a606e,$70046100
- dc.l $00b83d7c,$0101000a,$60607008,$610000aa
- dc.l $3d7c0161,$000a6052,$700c6100,$009c3d7c
- dc.l $0161000a,$60447001,$6100008e,$3d7c00a1
- dc.l $000a6036,$70026100,$00803d7c,$00c1000a
- dc.l $60287004,$61000072,$3d7c0081,$000a601a
- dc.l $70086100,$00643d7c,$00e1000a,$600c700c
- dc.l $61000056,$3d7c00e1,$000a2d6e,$ff680006
- dc.l $f22ed0c0,$ffdcf22e,$9c00ff60,$4cee0303
- dc.l $ff9c4e5e,$2f172f6f,$00080004,$2f6f000c
- dc.l $00082f7c,$00000001,$000c3f6f,$0006000c
- dc.l $3f7c4008,$00060817,$00056706,$08ef0002
- dc.l $000d60ff,$ffff95f4,$122eff41,$02010038
- dc.l $0c010018,$6700000c,$0c010020,$67000060
- dc.l $4e75122e,$ff410241,$0007323b,$12064efb
- dc.l $10020010,$0016001c,$00200024,$0028002c
- dc.l $003091ae,$ffa44e75,$91aeffa8,$4e7595c0
- dc.l $4e7597c0,$4e7599c0,$4e759bc0,$4e759196
- dc.l $4e750c2e,$0030000a,$6612082e,$00050004
- dc.l $660a4e7a,$880091c0,$4e7b8800,$4e754480
- dc.l $60a051fc,$00000000,$00000000,$00000000
diff --git a/sys/arch/m68k/060sp/readme b/sys/arch/m68k/060sp/readme
deleted file mode 100644
index ef9d958b471..00000000000
--- a/sys/arch/m68k/060sp/readme
+++ /dev/null
@@ -1,81 +0,0 @@
-#
-# $OpenBSD: readme,v 1.2 1996/05/30 22:15:16 niklas Exp $
-# $NetBSD: readme,v 1.2 1996/05/15 19:49:35 is Exp $
-#
-
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-# M68000 Hi-Performance Microprocessor Division
-# M68060 Software Package Production Release
-#
-# M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
-# All rights reserved.
-#
-# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-# To the maximum extent permitted by applicable law,
-# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
-# FOR A PARTICULAR PURPOSE and any warranty against infringement with
-# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-# and any accompanying written materials.
-#
-# To the maximum extent permitted by applicable law,
-# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
-# BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
-# ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
-#
-# Motorola assumes no responsibility for the maintenance and support
-# of the SOFTWARE.
-#
-# You are hereby granted a copyright license to use, modify, and distribute the
-# SOFTWARE so long as this entire notice is retained without alteration
-# in any modified and/or redistributed versions, and that such modified
-# versions are clearly identified as such.
-# No licenses are granted by implication, estoppel or otherwise under any
-# patents or trademarks of Motorola, Inc.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Files in this directory:
--------------------------
-
-fpsp.sa Full FP Kernel Module - hex image
-fpsp.s Full FP Kernel Module - source code
-fpsp.doc Full FP Kernel Module - on-line documentation
-
-pfpsp.sa Partial FP Kernel Module - hex image
-pfpsp.s Partial FP Kernel Module - source code
-
-fplsp.sa FP Library Module - hex image
-fplsp.s FP Library Module - source code
-fplsp.doc FP Library Module - on-line documentation
-
-isp.sa Integer Unimplemented Kernel Module - hex image
-isp.s Integer Unimplemented Kernel Module - source code
-isp.doc Integer Unimplemented Kernel Module - on-line doc
-
-ilsp.sa Integer Unimplemented Library Module - hex image
-ilsp.s Integer Unimplemented Library Module - source code
-ilsp.doc Integer Unimplemented Library Module - on-line doc
-
-fskeleton.s Sample Call-outs needed by fpsp.sa and pfpsp.sa
-
-iskeleton.s Sample Call-outs needed by isp.sa
-
-os.s Sample Call-outs needed by fpsp.sa, pfpsp.sa, and isp.sa
-
-ftest.sa Simple test program to test that {p}fpsp.sa
- was connected properly; hex image
-ftest.s above test; source code
-
-itest.sa Simple test program to test that isp.sa was
- connected properly; hex image
-itest.s above test; source code
-
-test.doc on-line documentation for {i,f}test.sa
-
-README This file
-
-ERRATA Known errata for this release
-
-MISC Release file version numbers
diff --git a/sys/arch/m68k/060sp/test.doc b/sys/arch/m68k/060sp/test.doc
deleted file mode 100644
index 523f4cefc75..00000000000
--- a/sys/arch/m68k/060sp/test.doc
+++ /dev/null
@@ -1,218 +0,0 @@
-#
-# $OpenBSD: test.doc,v 1.2 1996/05/30 22:15:18 niklas Exp $
-# $NetBSD: test.doc,v 1.2 1996/05/15 19:49:40 is Exp $
-#
-
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-# M68000 Hi-Performance Microprocessor Division
-# M68060 Software Package Production Release
-#
-# M68060 Software Package Copyright (C) 1993, 1994, 1995, 1996 Motorola Inc.
-# All rights reserved.
-#
-# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-# To the maximum extent permitted by applicable law,
-# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS
-# FOR A PARTICULAR PURPOSE and any warranty against infringement with
-# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-# and any accompanying written materials.
-#
-# To the maximum extent permitted by applicable law,
-# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
-# BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS)
-# ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.
-#
-# Motorola assumes no responsibility for the maintenance and support
-# of the SOFTWARE.
-#
-# You are hereby granted a copyright license to use, modify, and distribute the
-# SOFTWARE so long as this entire notice is retained without alteration
-# in any modified and/or redistributed versions, and that such modified
-# versions are clearly identified as such.
-# No licenses are granted by implication, estoppel or otherwise under any
-# patents or trademarks of Motorola, Inc.
-#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-68060 SOFTWARE PACKAGE (Kernel version) SIMPLE TESTS
------------------------------------------------------
-
-The files itest.sa and ftest.sa contain simple tests to check
-the state of the 68060ISP and 68060FPSP once they have been installed.
-
-Release file format:
---------------------
-The release files itest.sa and ftest.sa are essentially
-hexadecimal images of the actual tests. This format is the
-ONLY format that will be supported. The hex images were created
-by assembling the source code and then converting the resulting
-binary output images into ASCII text files. The hexadecimal
-numbers are listed using the Motorola Assembly syntax assembler
-directive "dc.l" (define constant longword). The files can be
-converted to other assembly syntaxes by using any word processor
-with a global search and replace function.
-
-To assist in assembling and linking these modules with other modules,
-the instaler should add symbolic labels to the top of the files.
-This will allow the calling routines to access the entry points
-of these packages.
-
-The source code itest.s and ftest.s have been included but only
-for documentation purposes.
-
-Release file structure:
------------------------
-
-(top of module)
- -----------------
- | | - 128 byte-sized section
- (1) | Call-Out | - 4 bytes per entry (user fills these in)
- | |
- -----------------
- | | - 8 bytes per entry
- (2) | Entry Point | - user does "bsr" or "jsr" to this address
- | |
- -----------------
- | | - code section
- (3) ~ ~
- | |
- -----------------
-(bottom of module)
-
-The first section of this module is the "Call-out" section. This section
-is NOT INCLUDED in {i,f}test.sa (an example "Call-out" section is provided at
-the end of this file). The purpose of this section is to allow the test
-routines to reference external printing functions that must be provided
-by the host operating system. This section MUST be exactly 128 bytes in
-size. There are 32 fields, each 4 bytes in size. Each field corresponds
-to a function required by the test packages (these functions and their
-location are listed in "68060{ISP,FPSP}-TEST call-outs" below). Each field
-entry should contain the address of the corresponding function RELATIVE to
-the starting address of the "call-out" section. The "Call-out" section must
-sit adjacent to the {i,f}test.sa image in memory. Since itest.sa and ftest.sa
-are individual tests, they each require their own "Call-out" sections.
-
-The second section, the "Entry-point" section, is used by external routines
-to access the test routines. Since the {i,f}test.sa hex files contain
-no symbol names, this section contains function entry points that are fixed
-with respect to the top of the package. The currently defined entry-points
-are listed in section "68060{ISP,FPSP}-TEST entry points" below. A calling
-routine would simply execute a "bsr" or "jsr" that jumped to the selected
-function entry-point.
-
-For example, to run the 060ISP test, write a program that includes the
-itest.sa data and execute something similar to:
-
- bsr _060ISP_TEST+128+0
-
-(_060ISP_TEST is the starting address of the "Call-out" section; the "Call-out"
-section is 128 bytes long; and the 68060ISP test entry point is located
-0 bytes from the top of the "Entry-point" section.)
-
-The third section is the code section. After entering through an "Entry-point",
-the entry code jumps to the appropriate test code within the code section.
-
-68060ISP-TEST Call-outs:
-------------------------
-0x0: _print_string()
-0x4: _print_number()
-
-68060FPSP-TEST Call-outs:
--------------------------
-0x0: _print_string()
-0x4: _print_number()
-
-The test packages call _print_string() and _print_number()
-as subroutines and expect the main program to print a string
-or a number to a file or to the screen.
-In "C"-like fashion, the test program calls:
-
- print_string("Test passed");
-
- or
-
- print_number(20);
-
-For _print_string(), the test programs pass a longword address
-of the string on the stack. For _print_number(), the test programs pass
-a longword number to be printed.
-
-For debugging purposes, after the main program performs a "print"
-for a test package, it should flush the output so that it's not
-buffered. In this way, if the test program crashes, at least the previous
-statements printed will be seen.
-
-68060ISP-TEST Entry-points:
----------------------------
-0x0: integer test
-
-68060FPSP-TEST Entry-points:
-----------------------------
-0x00: main fp test
-0x08: FP unimplemented test
-0x10: FP enabled snan/operr/ovfl/unfl/dz/inex
-
-The floating-point unit test has 3 entry points which will require
-3 different calls to the package if each of the three following tests
-is desired:
-
-main fp test: tests (1) unimp effective address exception
- (2) unsupported data type exceptions
- (3) non-maskable overflow/underflow exceptions
-
-FP unimplemented: tests FP unimplemented exception. this one is
- separate from the previous tests for systems that don't
- want FP unimplemented instructions.
-
-FP enabled: tests enabled snan/operr/ovfl/unfl/dz/inex.
- basically, it enables each of these exceptions and forces
- each using an implemented FP instruction. this process
- exercizes _fpsp_{snan,operr,ovfl,unfl,dz,inex}() and
- _real_{snan,operr,ovfl,unfl,dz,inex}(). the test expects
- _real_XXXX() to do nothing except clear the exception
- and "rte". if a system's _real_XXXX() handler creates an
- alternate result, the test will print "failed" but this
- is acceptable.
-
-Miscellaneous:
---------------
-Again, itest.sa and ftest.sa are simple tests and do not thoroughly
-test all 68060SP connections. For example, they do not test connections
-to _real_access(), _real_trace(), _real_trap(), etc. because these
-will be system-implemented several different ways and the test packages
-must remain system independent.
-
-Example test package set-up:
-----------------------------
-_print_str:
- . # provided by system
- rts
-
-_print_num:
- . # provided by system
- rts
-
- .
- .
- bsr _060FPSP_TEST+128+0
- .
- .
- rts
-
-# beginning of "Call-out" section; provided by integrator.
-# MUST be 128 bytes long.
-_060FPSP_TEST:
- long _print_str - _060FPSP_TEST
- long _print_num - _060FPSP_TEST
- space 120
-
-# ftest.sa starts here; start of "Entry-point" section.
- long 0x60ff0000, 0x00002346
- long 0x60ff0000, 0x00018766
- long 0x60ff0000, 0x00023338
- long 0x24377299, 0xab2643ea
- .
- .
- .
diff --git a/sys/arch/m68k/Makefile b/sys/arch/m68k/Makefile
deleted file mode 100644
index 96f68660b88..00000000000
--- a/sys/arch/m68k/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# $OpenBSD: Makefile,v 1.12 2010/06/29 21:42:55 deraadt Exp $
-
-SUBDIR= 060sp fpsp
-
-tags:
-
-.include <bsd.subdir.mk>
diff --git a/sys/arch/m68k/conf/files.m68k b/sys/arch/m68k/conf/files.m68k
deleted file mode 100644
index 14397e816f1..00000000000
--- a/sys/arch/m68k/conf/files.m68k
+++ /dev/null
@@ -1,40 +0,0 @@
-# $OpenBSD: files.m68k,v 1.22 2013/06/17 17:50:07 jj Exp $
-# $NetBSD: files.m68k,v 1.18 1997/06/06 23:15:28 veego Exp $
-#
-file arch/m68k/m68k/cachectl.c
-file arch/m68k/m68k/copy.s
-file arch/m68k/m68k/copypage.s
-file arch/m68k/m68k/db_disasm.c ddb
-file arch/m68k/m68k/db_interface.c ddb
-file arch/m68k/m68k/db_trace.c ddb
-file arch/m68k/m68k/in_cksum.c inet
-file netinet/in4_cksum.c inet
-file arch/m68k/m68k/kgdb_m68k.c kgdb
-file arch/m68k/m68k/m68k_machdep.c
-file arch/m68k/m68k/mutex.c
-file arch/m68k/m68k/oc_cksum.s inet
-file arch/m68k/m68k/process_machdep.c
-file arch/m68k/m68k/regdump.c
-file arch/m68k/m68k/sig_machdep.c
-file arch/m68k/m68k/softintr.c
-
-# quad support is necessary for 32 bit architectures
-file lib/libkern/adddi3.c
-file lib/libkern/anddi3.c
-file lib/libkern/ashldi3.c
-file lib/libkern/ashrdi3.c
-file lib/libkern/cmpdi2.c
-file lib/libkern/divdi3.c
-file lib/libkern/iordi3.c
-file lib/libkern/lshldi3.c
-file lib/libkern/lshrdi3.c
-file lib/libkern/moddi3.c
-file lib/libkern/muldi3.c
-file lib/libkern/negdi2.c
-file lib/libkern/notdi2.c
-file lib/libkern/qdivrem.c
-file lib/libkern/subdi3.c
-file lib/libkern/ucmpdi2.c
-file lib/libkern/udivdi3.c
-file lib/libkern/umoddi3.c
-file lib/libkern/xordi3.c
diff --git a/sys/arch/m68k/fpsp/DYADIC.CI5 b/sys/arch/m68k/fpsp/DYADIC.CI5
deleted file mode 100644
index 73a351a151f..00000000000
--- a/sys/arch/m68k/fpsp/DYADIC.CI5
+++ /dev/null
@@ -1,78 +0,0 @@
-* $OpenBSD: DYADIC.CI5,v 1.2 1996/05/29 21:05:18 niklas Exp $
-* $NetBSD: DYADIC.CI5,v 1.2 1994/10/26 07:48:26 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* DYADIC.CI5 1.2 4/30/91
-*
-* DYADIC.CI5 --- DYADIC template for CI5 compiler
-*
-
- xref _OPa_
- xref tag
-
- xdef _OPd_
-_OPd_:
- link a6,#-LOCAL_SIZE
- fmovem.x fp2-fp3,USER_FP2(a6)
- fmovem.l fpsr/fpcr,USER_FPSR(a6) ; user's rounding mode/precision
- fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
-*
-* copy, convert and tag input arguments
-*
- fmove.d 8(a6),fp0
- fmove.x fp0,FPTEMP(a6)
- lea FPTEMP(a6),a0
- bsr tag
- move.b d0,DTAG(a6)
-
- fmove.d 16(a6),fp0
- fmove.x fp0,ETEMP(a6)
- lea ETEMP(a6),a0
- bsr tag
- move.b d0,STAG(a6)
-
- bsr _OPa_
-
- fmove.l fpsr,d0 ; update status register
- or.b FPSR_AEXCEPT(a6),d0 ;add previously accrued exceptions
- swap.w d0
- or.b FPSR_QBYTE(a6),d0 ; pickup sign of quotient byte
- swap.w d0
- fmove.l d0,fpsr
-*
-* Result is now in FP0
-*
- fmovem.x USER_FP2(a6),fp2-fp3 ; note: FP0/FP1 not restored
- unlk a6
- rts
-
diff --git a/sys/arch/m68k/fpsp/DYADIC.GCC b/sys/arch/m68k/fpsp/DYADIC.GCC
deleted file mode 100644
index 23f9ff03d22..00000000000
--- a/sys/arch/m68k/fpsp/DYADIC.GCC
+++ /dev/null
@@ -1,161 +0,0 @@
-* $OpenBSD: DYADIC.GCC,v 1.2 1996/05/29 21:05:19 niklas Exp $
-* $NetBSD: DYADIC.GCC,v 1.2 1994/10/26 07:48:27 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* DYADIC.GCC --- DYADIC template for GCC compiler
-*
-* This is based on the generic template. The only difference is that
-* GCC does not need the d0-d1/a0-a1 registers saved.
-*
-* Customizations:
-* 2. Likewise, don't save FP0/FP1 if they are scratch
-* registers.
-* 3. Delete updating of the fpsr if you only care about
-* the result.
-* 5. Move the result to d0/d1 if the compiler is that old.
-*
-
- xref _OPa_
- xref tag
-
- xdef _OPs_
-_OPs_:
- link a6,#-LOCAL_SIZE
- fmovem.x fp0-fp3,USER_FP0(a6)
- fmove.l fpsr,USER_FPSR(a6)
- fmove.l fpcr,USER_FPCR(a6) ; user's rounding mode/precision
- fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
-*
-* copy, convert and tag input arguments
-*
- fmove.s 8(a6),fp0
- fmove.x fp0,FPTEMP(a6)
- lea FPTEMP(a6),a0
- bsr tag
- move.b d0,DTAG(a6)
-
- fmove.s 12(a6),fp0
- fmove.x fp0,ETEMP(a6)
- lea ETEMP(a6),a0
- bsr tag
- move.b d0,STAG(a6)
-
- bsr _OPa_
-
- fmove.l fpsr,d0 ; update status register
- or.b FPSR_AEXCEPT(a6),d0 ;add previously accrued exceptions
- swap.w d0
- or.b FPSR_QBYTE(a6),d0 ; pickup sign of quotient byte
- swap.w d0
- fmove.l d0,fpsr
-*
-* Result is now in FP0
-*
- fmovem.x USER_FP1(a6),fp1-fp3 ; note: FP0 not restored
- unlk a6
- rts
-
- xdef _OPd_
-_OPd_:
- link a6,#-LOCAL_SIZE
- fmovem.x fp0-fp3,USER_FP0(a6)
- fmove.l fpsr,USER_FPSR(a6)
- fmove.l fpcr,USER_FPCR(a6) ; user's rounding mode/precision
- fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
-*
-* copy, convert and tag input arguments
-*
- fmove.d 8(a6),fp0
- fmove.x fp0,FPTEMP(a6)
- lea FPTEMP(a6),a0
- bsr tag
- move.b d0,DTAG(a6)
-
- fmove.d 16(a6),fp0
- fmove.x fp0,ETEMP(a6)
- lea ETEMP(a6),a0
- bsr tag
- move.b d0,STAG(a6)
-
- bsr _OPa_
-
- fmove.l fpsr,d0 ; update status register
- or.b FPSR_AEXCEPT(a6),d0 ;add previously accrued exceptions
- swap.w d0
- or.b FPSR_QBYTE(a6),d0 ; pickup sign of quotient byte
- swap.w d0
- fmove.l d0,fpsr
-*
-* Result is now in FP0
-*
- fmovem.x USER_FP1(a6),fp1-fp3 ; note: FP0 not restored
- unlk a6
- rts
-
- xdef _OPx_
-_OPx_:
- link a6,#-LOCAL_SIZE
- fmovem.x fp0-fp3,USER_FP0(a6)
- fmove.l fpsr,USER_FPSR(a6)
- fmove.l fpcr,USER_FPCR(a6) ; user's rounding mode/precision
- fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
-*
-* copy, convert and tag input arguments
-*
- fmove.x 8(a6),fp0
- fmove.x fp0,FPTEMP(a6)
- lea FPTEMP(a6),a0
- bsr tag
- move.b d0,DTAG(a6)
-
- fmove.x 20(a6),fp0
- fmove.x fp0,ETEMP(a6)
- lea ETEMP(a6),a0
- bsr tag
- move.b d0,STAG(a6)
-
- bsr _OPa_
-
- fmove.l fpsr,d0 ; update status register
- or.b FPSR_AEXCEPT(a6),d0 ;add previously accrued exceptions
- swap.w d0
- or.b FPSR_QBYTE(a6),d0 ; pickup sign of quotient byte
- swap.w d0
- fmove.l d0,fpsr
-*
-* Result is now in FP0
-*
- fmovem.x USER_FP1(a6),fp1-fp3 ; note: FP0 not restored
- unlk a6
- rts
-
diff --git a/sys/arch/m68k/fpsp/DYADIC.GEN b/sys/arch/m68k/fpsp/DYADIC.GEN
deleted file mode 100644
index 8dc646e38c5..00000000000
--- a/sys/arch/m68k/fpsp/DYADIC.GEN
+++ /dev/null
@@ -1,180 +0,0 @@
-* $OpenBSD: DYADIC.GEN,v 1.2 1996/05/29 21:05:19 niklas Exp $
-* $NetBSD: DYADIC.GEN,v 1.2 1994/10/26 07:48:29 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* DYADIC.GEN 1.2 4/30/91
-*
-* DYADIC.GEN --- generic DYADIC template
-*
-* This version saves all registers that will be used by the emulation
-* routines and restores all but FP0 on exit. The FPSR is
-* updated to reflect the result of the operation. Return value
-* is placed in FP0 for single, double and extended results.
-*
-* The package subroutines expect the incoming FPCR to be zeroed
-* since they need extended precision to work properly. The
-* 'final' FPCR is expected in USER_FPCR(a6) so that the calculated result
-* can be properly sized and rounded. Also, if the incoming FPCR
-* has enabled any exceptions, the exception will be taken on the
-* final fmovem in this template.
-*
-* Customizations:
-* 1. Remove the movem.l at the entry and exit of
-* each routine if your compiler treats those
-* registers as scratch.
-* 2. Likewise, don't save FP0/FP1 if they are scratch
-* registers.
-* 3. Delete updating of the fpsr if you only care about
-* the result.
-* 4. Remove the _OPs_ and _OPx_ entry points if your compiler
-* treats everything as doubles.
-* 5. Move the result to d0/d1 if the compiler is that old.
-*
-
- xref _OPa_
- xref tag
-
- xdef _OPs_
-_OPs_:
- link a6,#-LOCAL_SIZE
- movem.l d0-d1/a0-a1,USER_DA(a6)
- fmovem.x fp0-fp3,USER_FP0(a6)
- fmovem.l fpsr/fpcr,USER_FPSR(a6) ; user's rounding mode/precision
- fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
-*
-* copy, convert and tag input arguments
-*
- fmove.s 8(a6),fp0
- fmove.x fp0,FPTEMP(a6)
- lea FPTEMP(a6),a0
- bsr tag
- move.b d0,DTAG(a6)
-
- fmove.s 12(a6),fp0
- fmove.x fp0,ETEMP(a6)
- lea ETEMP(a6),a0
- bsr tag
- move.b d0,STAG(a6)
-
- bsr _OPa_
-
- fmove.l fpsr,d0 ; update status register
- or.b FPSR_AEXCEPT(a6),d0 ;add previously accrued exceptions
- swap.w d0
- or.b FPSR_QBYTE(a6),d0 ; pickup sign of quotient byte
- swap.w d0
- fmove.l d0,fpsr
-*
-* Result is now in FP0
-*
- movem.l USER_DA(a6),d0-d1/a0-a1
- fmovem.x USER_FP1(a6),fp1-fp3 ; note: FP0 not restored
- unlk a6
- rts
-
- xdef _OPd_
-_OPd_:
- link a6,#-LOCAL_SIZE
- movem.l d0-d1/a0-a1,USER_DA(a6)
- fmovem.x fp0-fp3,USER_FP0(a6)
- fmovem.l fpsr/fpcr,USER_FPSR(a6) ; user's rounding mode/precision
- fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
-*
-* copy, convert and tag input arguments
-*
- fmove.d 8(a6),fp0
- fmove.x fp0,FPTEMP(a6)
- lea FPTEMP(a6),a0
- bsr tag
- move.b d0,DTAG(a6)
-
- fmove.d 16(a6),fp0
- fmove.x fp0,ETEMP(a6)
- lea ETEMP(a6),a0
- bsr tag
- move.b d0,STAG(a6)
-
- bsr _OPa_
-
- fmove.l fpsr,d0 ; update status register
- or.b FPSR_AEXCEPT(a6),d0 ;add previously accrued exceptions
- swap.w d0
- or.b FPSR_QBYTE(a6),d0 ; pickup sign of quotient byte
- swap.w d0
- fmove.l d0,fpsr
-*
-* Result is now in FP0
-*
- movem.l USER_DA(a6),d0-d1/a0-a1
- fmovem.x USER_FP1(a6),fp1-fp3 ; note: FP0 not restored
- unlk a6
- rts
-
- xdef _OPx_
-_OPx_:
- link a6,#-LOCAL_SIZE
- movem.l d0-d1/a0-a1,USER_DA(a6)
- fmovem.x fp0-fp3,USER_FP0(a6)
- fmovem.l fpsr/fpcr,USER_FPSR(a6) ; user's rounding mode/precision
- fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
-*
-* copy, convert and tag input arguments
-*
- fmove.x 8(a6),fp0
- fmove.x fp0,FPTEMP(a6)
- lea FPTEMP(a6),a0
- bsr tag
- move.b d0,DTAG(a6)
-
- fmove.x 20(a6),fp0
- fmove.x fp0,ETEMP(a6)
- lea ETEMP(a6),a0
- bsr tag
- move.b d0,STAG(a6)
-
- bsr _OPa_
-
- fmove.l fpsr,d0 ; update status register
- or.b FPSR_AEXCEPT(a6),d0 ;add previously accrued exceptions
- swap.w d0
- or.b FPSR_QBYTE(a6),d0 ; pickup sign of quotient byte
- swap.w d0
- fmove.l d0,fpsr
-*
-* Result is now in FP0
-*
- movem.l USER_DA(a6),d0-d1/a0-a1
- fmovem.x USER_FP1(a6),fp1-fp3 ; note: FP0 not restored
- unlk a6
- rts
-
diff --git a/sys/arch/m68k/fpsp/DYADIC.R3V6 b/sys/arch/m68k/fpsp/DYADIC.R3V6
deleted file mode 100644
index d74081d056e..00000000000
--- a/sys/arch/m68k/fpsp/DYADIC.R3V6
+++ /dev/null
@@ -1,73 +0,0 @@
-* $OpenBSD: DYADIC.R3V6,v 1.2 1996/05/29 21:05:20 niklas Exp $
-* $NetBSD: DYADIC.R3V6,v 1.2 1994/10/26 07:48:31 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* DYADIC.R3V6 1.2 4/30/91
-*
-* DYADIC.R3V6 --- DYADIC template for MCD R3V6 native C compiler
-*
-* The MCD compiler is old. It returns float and double values
-* as a double stored in d0/d1. There is no support for single or extended
-* precision operations. It's not clear whether the float registers
-* should be preserved, so for speed they're not.
-*
-
- xref _OPa_
- xref tag
-
- xdef _OPd_
-_OPd_:
- link a6,#-LOCAL_SIZE
- fmovem.l fpsr/fpcr,USER_FPSR(a6) ; user's rounding mode/precision
- fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
-*
-* copy and convert arguments to ETEMP, FPTEMP.
-*
- fmove.d 8(a6),fp0
- fmove.x fp0,FPTEMP(a6)
- lea FPTEMP(a6),a0
- bsr tag
- move.b d0,DTAG(a6)
-
- fmove.d 16(a6),fp0
- fmove.x fp0,ETEMP(a6)
- lea ETEMP(a6),a0
- bsr tag
- move.b d0,STAG(a6)
-
- bsr _OPa_
-
- fmove.d fp0,USER_D0(a6) ; result goes into d0/d1 pair
- movem.l USER_D0(a6),d0-d1
- unlk a6
- rts
diff --git a/sys/arch/m68k/fpsp/FPSP.sa b/sys/arch/m68k/fpsp/FPSP.sa
deleted file mode 100644
index 62bc4e3740f..00000000000
--- a/sys/arch/m68k/fpsp/FPSP.sa
+++ /dev/null
@@ -1,80 +0,0 @@
-* $OpenBSD: FPSP.sa,v 1.2 1996/05/29 21:05:20 niklas Exp $
-* $NetBSD: FPSP.sa,v 1.2 1994/10/26 07:48:33 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* FPSP.sa 3.1 12/10/90
-*
-* Init file for testing FPSP software package.
-*
-* Takes over the exception vectors that the FPSP handles.
-*
-
-FPSP IDNT 2,1 Motorola 040 Floating Point Software Package
-
-CODE_ST equ $10000 ;address of test code start
-
-FLINE_VEC equ $2c
-BSUN_VEC equ $c0
-INEX2_VEC equ $c4
-DZ_VEC equ $c8
-UNFL_VEC equ $cc
-OPERR_VEC equ $d0
-OVFL_VEC equ $d4
-SNAN_VEC equ $d8
-UNSUP_VEC equ $dc
-
- xref fline,unsupp
- xref bsun,inex,dz,unfl
- xref operr,ovfl,snan
-
- section 7
-
-* Load vector table with addresses of FPSP routines and
-* branch to CODE_ST, start address of test code.
-
- xdef start
-start:
- movec.l VBR,a0
- move.l #fline,FLINE_VEC(a0)
- move.l #bsun,BSUN_VEC(a0)
- move.l #inex,INEX2_VEC(a0)
- move.l #dz,DZ_VEC(a0)
- move.l #unfl,UNFL_VEC(a0)
- move.l #operr,OPERR_VEC(a0)
- move.l #ovfl,OVFL_VEC(a0)
- move.l #snan,SNAN_VEC(a0)
- move.l #unsupp,UNSUP_VEC(a0)
-
- jmp CODE_ST
-
- end
diff --git a/sys/arch/m68k/fpsp/L_ENTRY.AWK b/sys/arch/m68k/fpsp/L_ENTRY.AWK
deleted file mode 100644
index 63122fa5399..00000000000
--- a/sys/arch/m68k/fpsp/L_ENTRY.AWK
+++ /dev/null
@@ -1,85 +0,0 @@
-# $OpenBSD: L_ENTRY.AWK,v 1.2 1996/05/29 21:05:21 niklas Exp $
-# $NetBSD: L_ENTRY.AWK,v 1.2 1994/10/26 07:48:34 cgd Exp $
-
-# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-# M68000 Hi-Performance Microprocessor Division
-# M68040 Software Package
-#
-# M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-# All rights reserved.
-#
-# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-# To the maximum extent permitted by applicable law,
-# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-# PARTICULAR PURPOSE and any warranty against infringement with
-# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-# and any accompanying written materials.
-#
-# To the maximum extent permitted by applicable law,
-# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-# PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-# OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-# SOFTWARE. Motorola assumes no responsibility for the maintenance
-# and support of the SOFTWARE.
-#
-# You are hereby granted a copyright license to use, modify, and
-# distribute the SOFTWARE so long as this entire notice is retained
-# without alteration in any modified and/or redistributed versions,
-# and that such modified versions are clearly identified as such.
-# No licenses are granted by implication, estoppel or otherwise
-# under any patents or trademarks of Motorola, Inc.
-
-# L_ENTRY.AWK 1.1 3/27/91
-
-BEGIN{
- print "echo \" section 8\""
- print "echo \" include l_fpsp.h\""
- print "echo \"\""
- print "echo \" xref tag\""
- print "echo \" xref szero\""
- print "echo \" xref sinf\""
- print "echo \" xref sopr_inf\""
- print "echo \" xref sone\""
- print "echo \" xref spi_2\""
- print "echo \" xref szr_inf\""
- print "echo \" xref src_nan\""
- print "echo \" xref t_operr\""
- print "echo \" xref t_dz2\""
- print "echo \" xref snzrinx\""
- print "echo \" xref ld_pone\""
- print "echo \" xref ld_pinf\""
- print "echo \" xref ld_ppi2\""
- print "echo \" xref ssincosz\""
- print "echo \" xref ssincosi\""
- print "echo \" xref ssincosnan\""
- print "echo \" xref setoxm1i\""
- utmp = 100
- }
-
-$4=="MONADIC"{
- printf "sed 's/_OPs_/" $1 "/g' MONADIC." SYS " | "
- printf "sed 's/_OPd_/" $2 "/g' | "
- printf "sed 's/_OPx_/" $3 "/g' | "
- printf "sed 's/_OPr_/" $5 "/g' | "
- printf "sed 's/_OPz_/" $6 "/g' | "
- printf "sed 's/_OPi_/" $7 "/g' | "
- printf "sed 's/_OPn_/" $8 "/g' | "
- printf "sed 's/_OPm_/" $9 "/g' | "
- utmp += 1
- printf "sed 's/_TMP_/" PREFIX utmp "/g'\n "
- }
-
-$4=="DYADIC"{
- printf "sed 's/_OPs_/" $1 "/g' DYADIC." SYS " | "
- printf "sed 's/_OPd_/" $2 "/g' | "
- printf "sed 's/_OPx_/" $3 "/g' | "
- printf "sed 's/_OPa_/" $5 "/g' | "
- utmp += 1
- printf "sed 's/_TMP_/" PREFIX utmp "/g'\n"
- }
-
-END{
- print "echo \" end\""
- }
diff --git a/sys/arch/m68k/fpsp/L_LIST b/sys/arch/m68k/fpsp/L_LIST
deleted file mode 100644
index 6b12f541039..00000000000
--- a/sys/arch/m68k/fpsp/L_LIST
+++ /dev/null
@@ -1,82 +0,0 @@
-# $OpenBSD: L_LIST,v 1.2 1996/05/29 21:05:21 niklas Exp $
-# $NetBSD: L_LIST,v 1.2 1994/10/26 07:48:38 cgd Exp $
-#
-# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-# M68000 Hi-Performance Microprocessor Division
-# M68040 Software Package
-#
-# M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-# All rights reserved.
-#
-# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-# To the maximum extent permitted by applicable law,
-# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-# PARTICULAR PURPOSE and any warranty against infringement with
-# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-# and any accompanying written materials.
-#
-# To the maximum extent permitted by applicable law,
-# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-# PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-# OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-# SOFTWARE. Motorola assumes no responsibility for the maintenance
-# and support of the SOFTWARE.
-#
-# You are hereby granted a copyright license to use, modify, and
-# distribute the SOFTWARE so long as this entire notice is retained
-# without alteration in any modified and/or redistributed versions,
-# and that such modified versions are clearly identified as such.
-# No licenses are granted by implication, estoppel or otherwise
-# under any patents or trademarks of Motorola, Inc.
-#
-# L_LIST 1.2 4/30/91
-#
-# Each line specifies the entry points for one function. The first
-# 3 items are the library entry point names for the single, double and
-# extended precision versions of the function. Change them to
-# suit your system. The next item is
-# either MONADIC or DYADIC. The remaining 5 items are the labels
-# in the FPSP code that correspond to subroutines to handle Regular,
-# Zero, Infinity, Nan and Denorm input values.
-#
-# The first 3
-#
-#Sgl Dbl. Ext. Type Reg Zero Inf Nan Denorm
-#---------------------- ---- --- ---- --- --- ------
-facoss facosd facosx MONADIC sacos ld_ppi2 t_operr mon_nan sacosd
-fasins fasind fasinx MONADIC sasin szero t_operr mon_nan sasind
-fatans fatand fatanx MONADIC satan szero spi_2 mon_nan satand
-fatanhs fatanhd fatanhx MONADIC satanh szero t_operr mon_nan satanhd
-fcoss fcosd fcosx MONADIC scos ld_pone t_operr mon_nan scosd
-fcoshs fcoshd fcoshx MONADIC scosh ld_pone ld_pinf mon_nan scoshd
-fetoxs fetoxd fetoxx MONADIC setox ld_pone szr_inf mon_nan setoxd
-fetoxm1s fetoxm1d fetoxm1x MONADIC setoxm1 szero setoxm1i mon_nan setoxm1d
-fgetexps fgetexpd fgetexpx MONADIC sgetexp szero t_operr mon_nan sgetexpd
-fsins fsind fsinx MONADIC ssin szero t_operr mon_nan ssind
-fsinhs fsinhd fsinhx MONADIC ssinh szero sinf mon_nan ssinhd
-ftans ftand ftanx MONADIC stan szero t_operr mon_nan stand
-ftanhs ftanhd ftanhx MONADIC stanh szero sone mon_nan stanhd
-ftentoxs ftentoxd ftentoxx MONADIC stentox ld_pone szr_inf mon_nan stentoxd
-ftwotoxs ftwotoxd ftwotoxx MONADIC stwotox ld_pone szr_inf mon_nan stwotoxd
-fgetmans fgetmand fgetmanx MONADIC sgetman szero t_operr mon_nan sgetmand
-flogns flognd flognx MONADIC sslogn t_dz2 sopr_inf mon_nan sslognd
-flog2s flog2d flog2x MONADIC sslog2 t_dz2 sopr_inf mon_nan sslog2d
-flog10s flog10d flog10x MONADIC sslog10 t_dz2 sopr_inf mon_nan sslog10d
-flognp1s flognp1d flognp1x MONADIC sslognp1 szero sopr_inf mon_nan slognp1d
-fints fintd fintx MONADIC l_sint szero sinf mon_nan l_sintd
-fintrzs fintrzd fintrzx MONADIC l_sintrz szero sinf mon_nan snzrinx
-frems fremd fremx DYADIC prem
-fmods fmodd fmodx DYADIC pmod
-fscales fscaled fscalex DYADIC pscale
-#
-# 68040 native instructions added for completeness
-#
-fabss fabsd fabsx MONADIC sabs sabs sabs sabs sabs
-fnegs fnegd fnegx MONADIC sneg sneg sneg sneg sneg
-fsqrts fsqrtd fsqrtx MONADIC ssqrt ssqrt ssqrt ssqrt ssqrt
-fadds faddd faddx DYADIC sadd
-fsubs fsubd fsubx DYADIC ssub
-fmuls fmuld fmulx DYADIC smul
-fdivs fdivd fdivx DYADIC sdiv
diff --git a/sys/arch/m68k/fpsp/MONADIC.CI5 b/sys/arch/m68k/fpsp/MONADIC.CI5
deleted file mode 100644
index d13f3ae90e8..00000000000
--- a/sys/arch/m68k/fpsp/MONADIC.CI5
+++ /dev/null
@@ -1,94 +0,0 @@
-* $OpenBSD: MONADIC.CI5,v 1.2 1996/05/29 21:05:21 niklas Exp $
-* $NetBSD: MONADIC.CI5,v 1.2 1994/10/26 07:48:39 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* MONADIC.CI5 1.3 4/30/91
-*
-* MONADIC.CI5 --- MONADIC template for CI5 compiler
-*
-
- xref tag
- xref _OPr_
- xref _OPz_
- xref _OPi_
- xref _OPn_
- xref _OPm_
-
-
- xdef _OPd_
-_OPd_:
- link a6,#-LOCAL_SIZE
- fmovem.x fp2-fp3,USER_FP2(a6)
- fmove.l fpsr,USER_FPSR(a6)
- fmove.l fpcr,d1 ; user's rounding mode/precision
- fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
-*
-* copy, convert and tag input argument
-*
- fmove.d 8(a6),fp0
- fmove.x fp0,ETEMP(a6)
- lea ETEMP(a6),a0
- bsr tag
- move.b d0,STAG(a6)
- tst.b d0
- bne.b _TMP_2
- bsr _OPr_ ; normalized (regular) number
- bra.b _TMP_6
-_TMP_2:
- cmp.b #$20,d0 ; zero?
- bne.b _TMP_3
- bsr _OPz_
- bra.b _TMP_6
-_TMP_3:
- cmp.b #$40,d0 ; infinity?
- bne.b _TMP_4
- bsr _OPi_
- bra.b _TMP_6
-_TMP_4:
- cmp.b #$60,d0 ; NaN?
- bne.b _TMP_5
- bsr _OPn_
- bra.b _TMP_6
-_TMP_5:
- bsr _OPm_ ; assuming a denorm...
-
-_TMP_6:
- fmove.l fpsr,d0 ; update status register
- or.b USER_FPSR+3(a6),d0 ;add previously accrued exceptions
- move.l d0,USER_FPSR(a6)
-*
-* Result is now in FP0
-*
- fmovem.x USER_FP2(a6),fp2-fp3 ; note: FP1 not restored
- unlk a6
- rts
diff --git a/sys/arch/m68k/fpsp/MONADIC.GCC b/sys/arch/m68k/fpsp/MONADIC.GCC
deleted file mode 100644
index cedc08f0bee..00000000000
--- a/sys/arch/m68k/fpsp/MONADIC.GCC
+++ /dev/null
@@ -1,204 +0,0 @@
-* $OpenBSD: MONADIC.GCC,v 1.2 1996/05/29 21:05:22 niklas Exp $
-* $NetBSD: MONADIC.GCC,v 1.2 1994/10/26 07:48:40 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* MONADIC.GCC --- MONADIC template for GCC compiler
-*
-* This is based on the generic template. The only difference is that
-* GCC does not need the d0-d1/a0-a1 registers saved.
-*
-* Customizations:
-* 2. Likewise, don't save FP0/FP1 if they are scratch
-* registers.
-* 3. Delete handling of the fpsr if you only care about
-* the result.
-* 5. Move the result to d0/d1 if the compiler is that old.
-*
-
- xref tag
- xref _OPr_
- xref _OPz_
- xref _OPi_
- xref _OPn_
- xref _OPm_
-
- xdef _OPs_
-_OPs_:
- link a6,#-LOCAL_SIZE
- fmovem.x fp0-fp3,USER_FP0(a6)
- fmove.l fpsr,USER_FPSR(a6)
- fmove.l fpcr,USER_FPCR(a6)
- fmove.l fpcr,d1 ; user's rounding mode/precision
- fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
-*
-* copy, convert and tag input argument
-*
- fmove.s 8(a6),fp0
- fmove.x fp0,ETEMP(a6)
- lea ETEMP(a6),a0
- bsr tag
- move.b d0,STAG(a6)
- tst.b d0
- bne.b _TMP_2
- bsr _OPr_ ; normalized (regular) number
- bra.b _TMP_6
-_TMP_2:
- cmp.b #$20,d0 ; zero?
- bne.b _TMP_3
- bsr _OPz_
- bra.b _TMP_6
-_TMP_3:
- cmp.b #$40,d0 ; infinity?
- bne.b _TMP_4
- bsr _OPi_
- bra.b _TMP_6
-_TMP_4:
- cmp.b #$60,d0 ; NaN?
- bne.b _TMP_5
- bsr _OPn_
- bra.b _TMP_6
-_TMP_5:
- bsr _OPm_ ; assuming a denorm...
-
-_TMP_6:
- fmove.l fpsr,d0 ; update status register
- or.b FPSR_AEXCEPT(a6),d0 ;add previously accrued exceptions
- fmove.l d0,fpsr
-*
-* Result is now in FP0
-*
- fmovem.x USER_FP1(a6),fp1-fp3 ; note: FP0 not restored
- fmove.l USER_FPCR(a6),fpcr ; fpcr restored
- unlk a6
- rts
-
- xdef _OPd_
-_OPd_:
- link a6,#-LOCAL_SIZE
- fmovem.x fp0-fp3,USER_FP0(a6)
- fmove.l fpsr,USER_FPSR(a6)
- fmove.l fpcr,USER_FPCR(a6)
- fmove.l fpcr,d1 ; user's rounding mode/precision
- fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
-*
-* copy, convert and tag input argument
-*
- fmove.d 8(a6),fp0
- fmove.x fp0,ETEMP(a6)
- lea ETEMP(a6),a0
- bsr tag
- move.b d0,STAG(a6)
- tst.b d0
- bne.b _TMP_7
- bsr _OPr_ ; normalized (regular) number
- bra.b _TMP_B
-_TMP_7:
- cmp.b #$20,d0 ; zero?
- bne.b _TMP_8
- bsr _OPz_
- bra.b _TMP_B
-_TMP_8:
- cmp.b #$40,d0 ; infinity?
- bne.b _TMP_9
- bsr _OPi_
- bra.b _TMP_B
-_TMP_9:
- cmp.b #$60,d0 ; NaN?
- bne.b _TMP_A
- bsr _OPn_
- bra.b _TMP_B
-_TMP_A:
- bsr _OPm_ ; assuming a denorm...
-
-_TMP_B:
- fmove.l fpsr,d0 ; update status register
- or.b FPSR_AEXCEPT(a6),d0 ;add previously accrued exceptions
- fmove.l d0,fpsr
-*
-* Result is now in FP0
-*
- fmovem.x USER_FP1(a6),fp1-fp3 ; note: FP0 not restored
- fmove.l USER_FPCR(a6),fpcr ; fpcr restored
- unlk a6
- rts
-
- xdef _OPx_
-_OPx_:
- link a6,#-LOCAL_SIZE
- fmovem.x fp0-fp3,USER_FP0(a6)
- fmove.l fpsr,USER_FPSR(a6)
- fmove.l fpcr,USER_FPCR(a6)
- fmove.l fpcr,d1 ; user's rounding mode/precision
- fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
-*
-* copy, convert and tag input argument
-*
- fmove.x 8(a6),fp0
- fmove.x fp0,ETEMP(a6)
- lea ETEMP(a6),a0
- bsr tag
- move.b d0,STAG(a6)
- tst.b d0
- bne.b _TMP_C
- bsr _OPr_ ; normalized (regular) number
- bra.b _TMP_G
-_TMP_C:
- cmp.b #$20,d0 ; zero?
- bne.b _TMP_D
- bsr _OPz_
- bra.b _TMP_G
-_TMP_D:
- cmp.b #$40,d0 ; infinity?
- bne.b _TMP_E
- bsr _OPi_
- bra.b _TMP_G
-_TMP_E:
- cmp.b #$60,d0 ; NaN?
- bne.b _TMP_F
- bsr _OPn_
- bra.b _TMP_G
-_TMP_F:
- bsr _OPm_ ; assuming a denorm...
-
-_TMP_G:
- fmove.l fpsr,d0 ; update status register
- or.b FPSR_AEXCEPT(a6),d0 ;add previously accrued exceptions
- fmove.l d0,fpsr
-*
-* Result is now in FP0
-*
- fmovem.x USER_FP1(a6),fp1-fp3 ; note: FP0 not restored
- fmove.l USER_FPCR(a6),fpcr ; fpcr restored
- unlk a6
- rts
-
diff --git a/sys/arch/m68k/fpsp/MONADIC.GEN b/sys/arch/m68k/fpsp/MONADIC.GEN
deleted file mode 100644
index 31c7a39f3c2..00000000000
--- a/sys/arch/m68k/fpsp/MONADIC.GEN
+++ /dev/null
@@ -1,231 +0,0 @@
-* $OpenBSD: MONADIC.GEN,v 1.2 1996/05/29 21:05:22 niklas Exp $
-* $NetBSD: MONADIC.GEN,v 1.3 1994/10/26 07:48:42 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* MONADIC.GEN 1.5 5/18/92
-*
-* MONADIC.GEN 1.4 1/16/92
-*
-* MONADIC.GEN 1.3 4/30/91
-*
-* MONADIC.GEN --- generic MONADIC template
-*
-* This version saves all registers that will be used by the emulation
-* routines and restores all but FP0 on exit. The FPSR is
-* updated to reflect the result of the operation. Return value
-* is placed in FP0 for single, double and extended results.
-*
-* The package subroutines expect the incoming FPCR to be zeroed
-* since they need extended precision to work properly. The
-* 'final' FPCR is expected in d1 so that the calculated result
-* can be properly sized and rounded. Also, if the incoming FPCR
-* has enabled any exceptions, the exception will be taken on the
-* final fmovem in this template.
-*
-* Customizations:
-* 1. Remove the movem.l at the entry and exit of
-* each routine if your compiler treats those
-* registers as scratch.
-* 2. Likewise, don't save FP0/FP1 if they are scratch
-* registers.
-* 3. Delete handling of the fpsr if you only care about
-* the result.
-* 4. Some (most?) C compilers convert all float arguments
-* to double, and provide no support at all for extended
-* precision so remove the _OPs_ and _OPx_ entry points.
-* 5. Move the result to d0/d1 if the compiler is that old.
-*
-
- xref tag
- xref _OPr_
- xref _OPz_
- xref _OPi_
- xref _OPn_
- xref _OPm_
-
- xdef _OPs_
-_OPs_:
- link a6,#-LOCAL_SIZE
- movem.l d0-d1/a0-a1,USER_DA(a6)
- fmovem.x fp0-fp3,USER_FP0(a6)
- fmove.l fpsr,USER_FPSR(a6)
- fmove.l fpcr,USER_FPCR(a6)
- fmove.l fpcr,d1 ; user's rounding mode/precision
- fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
-*
-* copy, convert and tag input argument
-*
- fmove.s 8(a6),fp0
- fmove.x fp0,ETEMP(a6)
- lea ETEMP(a6),a0
- bsr tag
- move.b d0,STAG(a6)
- tst.b d0
- bne.b _TMP_2
- bsr _OPr_ ; normalized (regular) number
- bra.b _TMP_6
-_TMP_2:
- cmp.b #$20,d0 ; zero?
- bne.b _TMP_3
- bsr _OPz_
- bra.b _TMP_6
-_TMP_3:
- cmp.b #$40,d0 ; infinity?
- bne.b _TMP_4
- bsr _OPi_
- bra.b _TMP_6
-_TMP_4:
- cmp.b #$60,d0 ; NaN?
- bne.b _TMP_5
- bsr _OPn_
- bra.b _TMP_6
-_TMP_5:
- bsr _OPm_ ; assuming a denorm...
-
-_TMP_6:
- fmove.l fpsr,d0 ; update status register
- or.b FPSR_AEXCEPT(a6),d0 ;add previously accrued exceptions
- fmove.l d0,fpsr
-*
-* Result is now in FP0
-*
- movem.l USER_DA(a6),d0-d1/a0-a1
- fmovem.x USER_FP1(a6),fp1-fp3 ; note: FP0 not restored
- fmove.l USER_FPCR(a6),fpcr ; fpcr restored
- unlk a6
- rts
-
- xdef _OPd_
-_OPd_:
- link a6,#-LOCAL_SIZE
- movem.l d0-d1/a0-a1,USER_DA(a6)
- fmovem.x fp0-fp3,USER_FP0(a6)
- fmove.l fpsr,USER_FPSR(a6)
- fmove.l fpcr,USER_FPCR(a6)
- fmove.l fpcr,d1 ; user's rounding mode/precision
- fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
-*
-* copy, convert and tag input argument
-*
- fmove.d 8(a6),fp0
- fmove.x fp0,ETEMP(a6)
- lea ETEMP(a6),a0
- bsr tag
- move.b d0,STAG(a6)
- tst.b d0
- bne.b _TMP_7
- bsr _OPr_ ; normalized (regular) number
- bra.b _TMP_B
-_TMP_7:
- cmp.b #$20,d0 ; zero?
- bne.b _TMP_8
- bsr _OPz_
- bra.b _TMP_B
-_TMP_8:
- cmp.b #$40,d0 ; infinity?
- bne.b _TMP_9
- bsr _OPi_
- bra.b _TMP_B
-_TMP_9:
- cmp.b #$60,d0 ; NaN?
- bne.b _TMP_A
- bsr _OPn_
- bra.b _TMP_B
-_TMP_A:
- bsr _OPm_ ; assuming a denorm...
-
-_TMP_B:
- fmove.l fpsr,d0 ; update status register
- or.b FPSR_AEXCEPT(a6),d0 ;add previously accrued exceptions
- fmove.l d0,fpsr
-*
-* Result is now in FP0
-*
- movem.l USER_DA(a6),d0-d1/a0-a1
- fmovem.x USER_FP1(a6),fp1-fp3 ; note: FP0 not restored
- fmove.l USER_FPCR(a6),fpcr ; fpcr restored
- unlk a6
- rts
-
- xdef _OPx_
-_OPx_:
- link a6,#-LOCAL_SIZE
- movem.l d0-d1/a0-a1,USER_DA(a6)
- fmovem.x fp0-fp3,USER_FP0(a6)
- fmove.l fpsr,USER_FPSR(a6)
- fmove.l fpcr,USER_FPCR(a6)
- fmove.l fpcr,d1 ; user's rounding mode/precision
- fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
-*
-* copy, convert and tag input argument
-*
- fmove.x 8(a6),fp0
- fmove.x fp0,ETEMP(a6)
- lea ETEMP(a6),a0
- bsr tag
- move.b d0,STAG(a6)
- tst.b d0
- bne.b _TMP_C
- bsr _OPr_ ; normalized (regular) number
- bra.b _TMP_G
-_TMP_C:
- cmp.b #$20,d0 ; zero?
- bne.b _TMP_D
- bsr _OPz_
- bra.b _TMP_G
-_TMP_D:
- cmp.b #$40,d0 ; infinity?
- bne.b _TMP_E
- bsr _OPi_
- bra.b _TMP_G
-_TMP_E:
- cmp.b #$60,d0 ; NaN?
- bne.b _TMP_F
- bsr _OPn_
- bra.b _TMP_G
-_TMP_F:
- bsr _OPm_ ; assuming a denorm...
-
-_TMP_G:
- fmove.l fpsr,d0 ; update status register
- or.b FPSR_AEXCEPT(a6),d0 ;add previously accrued exceptions
- fmove.l d0,fpsr
-*
-* Result is now in FP0
-*
- movem.l USER_DA(a6),d0-d1/a0-a1
- fmovem.x USER_FP1(a6),fp1-fp3 ; note: FP0 not restored
- fmove.l USER_FPCR(a6),fpcr ; fpcr restored
- unlk a6
- rts
-
diff --git a/sys/arch/m68k/fpsp/MONADIC.R3V6 b/sys/arch/m68k/fpsp/MONADIC.R3V6
deleted file mode 100644
index 2033f293ab0..00000000000
--- a/sys/arch/m68k/fpsp/MONADIC.R3V6
+++ /dev/null
@@ -1,92 +0,0 @@
-* $OpenBSD: MONADIC.R3V6,v 1.2 1996/05/29 21:05:23 niklas Exp $
-* $NetBSD: MONADIC.R3V6,v 1.2 1994/10/26 07:48:44 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* MONADIC.R3V6 1.3 4/30/91
-*
-* MONADIC.R3V6 --- MONADIC template for MCD R3V6 native C compiler
-*
-* The MCD compiler is old. It returns float and double values
-* as a double stored in d0/d1. There is no support for single or extended
-* precision operations. It's not clear whether the float registers
-* should be preserved, so for speed, they're not.
-*
-
- xref tag
- xref _OPr_
- xref _OPz_
- xref _OPi_
- xref _OPn_
- xref _OPm_
-
- xdef _OPd_
-_OPd_:
- link a6,#-LOCAL_SIZE
- fmove.l fpcr,d1 ; user's rounding mode/precision
- fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
-*
-* copy, convert and tag input argument
-*
- fmove.d 8(a6),fp0
- fmove.x fp0,ETEMP(a6)
- lea ETEMP(a6),a0
- bsr tag
- move.b d0,STAG(a6)
- tst.b d0
- bne.b _TMP_2
- bsr _OPr_ ; normalized (regular) number
- bra.b _TMP_6
-_TMP_2:
- cmp.b #$20,d0 ; zero?
- bne.b _TMP_3
- bsr _OPz_
- bra.b _TMP_6
-_TMP_3:
- cmp.b #$40,d0 ; infinity?
- bne.b _TMP_4
- bsr _OPi_
- bra.b _TMP_6
-_TMP_4:
- cmp.b #$60,d0 ; NaN?
- bne.b _TMP_5
- bsr _OPn_
- bra.b _TMP_6
-_TMP_5:
- bsr _OPm_ ; assuming a denorm...
-
-_TMP_6:
- fmove.d fp0,USER_D0(a6) ; result goes into d0/d1 pair
- movem.l USER_D0(a6),d0-d1
- unlk a6
- rts
-
diff --git a/sys/arch/m68k/fpsp/Makefile b/sys/arch/m68k/fpsp/Makefile
deleted file mode 100644
index 4dc33c02f40..00000000000
--- a/sys/arch/m68k/fpsp/Makefile
+++ /dev/null
@@ -1,357 +0,0 @@
-# $OpenBSD: Makefile,v 1.15 2007/10/18 18:08:02 deraadt Exp $
-# $NetBSD: Makefile,v 1.6 1997/04/25 22:17:33 veego Exp $
-
-# MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-# M68000 Hi-Performance Microprocessor Division
-# M68040 Software Package
-#
-# M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-# All rights reserved.
-#
-# THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-# To the maximum extent permitted by applicable law,
-# MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-# INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-# PARTICULAR PURPOSE and any warranty against infringement with
-# regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-# and any accompanying written materials.
-#
-# To the maximum extent permitted by applicable law,
-# IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-# (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-# PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-# OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-# SOFTWARE. Motorola assumes no responsibility for the maintenance
-# and support of the SOFTWARE.
-#
-# You are hereby granted a copyright license to use, modify, and
-# distribute the SOFTWARE so long as this entire notice is retained
-# without alteration in any modified and/or redistributed versions,
-# and that such modified versions are clearly identified as such.
-# No licenses are granted by implication, estoppel or otherwise
-# under any patents or trademarks of Motorola, Inc.
-
-#
-# Makefile 3.3 3/27/91
-#
-# Makefile for 68040 Floating Point Software Package
-#
-.if ${MACHINE_ARCH} == "m68k"
-
-TARGET = fpsp
-
-FPSPAS=${CC} -x assembler-with-cpp -traditional-cpp -c -m68040 -I${.CURDIR}
-LD ?= ld
-
-#
-# For the Library Version:
-#
-AR ?= ar
-LIB_FILTER = sed 's/fpsp.defs/l_fpsp.defs/'
-LIB_TARGET = lib$(TARGET).a
-#
-# SYS selects the template set to use
-# templates are supplied for R3V6, CI5 and GEN(generic)
-# PREFIX is a string that begins a temporary label in the assembler
-# R3V6 uses 'L%', CI5 likes '.L'
-#
-#SYS = R3V6
-#PREFIX = L%%
-#
-#SYS = CI5
-#PREFIX = .L
-#
-#SYS = GEN
-#PREFIX = L_
-#
-SYS = GCC
-PREFIX = L_
-
-.SUFFIXES: .o .s .sa .defs .h
-
-.sa.s:
- sh ${.CURDIR}/asm2gas ${.IMPSRC} >${.TARGET}
-.h.defs:
- sh ${.CURDIR}/asm2gas ${.IMPSRC} >${.TARGET}
-.s.o:
- $(FPSPAS) -o ${.TARGET} ${.IMPSRC}
-
-H_FILES = \
- fpsp.defs \
- l_fpsp.defs
-
-O_FILES = \
- copyright.o \
- netbsd.o \
- bindec.o \
- binstr.o \
- decbin.o \
- do_func.o \
- gen_except.o \
- get_op.o \
- kernel_ex.o \
- res_func.o \
- round.o \
- sacos.o \
- sasin.o \
- satan.o \
- satanh.o \
- scosh.o \
- setox.o \
- sgetem.o \
- sint.o \
- slogn.o \
- slog2.o \
- smovecr.o \
- srem_mod.o \
- scale.o \
- ssin.o \
- ssinh.o \
- stan.o \
- stanh.o \
- sto_res.o \
- stwotox.o \
- tbldo.o \
- util.o \
- x_bsun.o \
- x_fline.o \
- x_operr.o \
- x_ovfl.o \
- x_snan.o \
- x_store.o \
- x_unfl.o \
- x_unimp.o \
- x_unsupp.o \
- bugfix.o
-
-LIB_O_FILES = \
- l_copyright.o \
- l_entry.o \
- l_do_func.o \
- l_round.o \
- l_sacos.o \
- l_sasin.o \
- l_satan.o \
- l_satanh.o \
- l_scale.o \
- l_scosh.o \
- l_setox.o \
- l_sgetem.o \
- l_sint.o \
- l_slog2.o \
- l_slogn.o \
- l_srem_mod.o \
- l_ssin.o \
- l_ssinh.o \
- l_stan.o \
- l_stanh.o \
- l_stwotox.o \
- l_support.o
-
-S_FILES = \
- netbsd.s \
- bindec.s \
- binstr.s \
- decbin.s \
- do_func.s \
- get_op.s \
- gen_except.s \
- kernel_ex.s \
- res_func.s \
- round.s \
- sacos.s \
- sasin.s \
- satan.s \
- satanh.s \
- scosh.s \
- setox.s \
- sgetem.s \
- sint.s \
- slogn.s \
- slog2.s \
- smovecr.s \
- srem_mod.s \
- scale.s \
- ssin.s \
- ssinh.s \
- stan.s \
- stanh.s \
- sto_res.s \
- stwotox.s \
- tbldo.s \
- util.s \
- x_bsun.s \
- x_fline.s \
- x_operr.s \
- x_ovfl.s \
- x_snan.s \
- x_store.s \
- x_unfl.s \
- x_unimp.s \
- x_unsupp.s \
- bugfix.s
-
-LIB_S_FILES = \
- l_entry.sa l_entry.s \
- l_do_func.s \
- l_round.s \
- l_sacos.s \
- l_sasin.s \
- l_satan.s \
- l_satanh.s \
- l_scale.s \
- l_scosh.s \
- l_setox.s \
- l_sgetem.s \
- l_sint.s \
- l_slog2.s \
- l_slogn.s \
- l_srem_mod.s \
- l_ssin.s \
- l_ssinh.s \
- l_stan.s \
- l_stanh.s \
- l_stwotox.s \
- l_support.s
-
-#
-# Build the target object. The linkfile is created on the fly.
-# Change the SEG directives to suit your system.
-#
-$(TARGET).o: $(O_FILES)
- $(LD) -r -o $(TARGET).o $(O_FILES)
-
-#
-# Just about every file needs fpsp.h so:
-#
-$(O_FILES): fpsp.defs
-
-#
-#-----------------------------------------------------------------------
-#
-# For making a library version of the FPSP:
-#
-library: $(LIB_TARGET)
-
-$(LIB_TARGET): $(LIB_O_FILES)
- rm -f $(LIB_TARGET)
- $(AR) crv $(LIB_TARGET) $(LIB_O_FILES)
-
-$(LIB_O_FILES): l_fpsp.defs
-
-#
-# The entry points to the library version are created here
-# by using two template files an awk script and a list of
-# the entry routines for each function.
-#
-l_entry.sa: L_ENTRY.AWK L_LIST MONADIC.$(SYS) DYADIC.$(SYS) l_fpsp.h
- awk -f L_ENTRY.AWK SYS=$(SYS) PREFIX=$(PREFIX) - <L_LIST|sh>l_entry.sa
-
-#
-# Do_func.sa and round.sa need special editing to remove references that
-# aren't needed in the library version. Beware that changes in
-# the source code may cause this editing to break....
-#
-l_do_func.s: do_func.s
- $(LIB_FILTER) ${.ALLSRC} >${.TARGET}
- echo '/global.*do_func/,/^ rts/d' >.SCRIPT
- echo 'g/smovcr/d' >>.SCRIPT
- echo 'g/tblpre/d' >>.SCRIPT
- echo 'w' >>.SCRIPT
- echo 'q' >>.SCRIPT
- ed - ${.TARGET} <.SCRIPT
- rm .SCRIPT
-
-l_round.s: round.s
- $(LIB_FILTER) ${.ALLSRC} >${.TARGET}
- echo '/^not_E3:/-6,/^not_E3:/d' >.SCRIPT
- echo 'w' >>.SCRIPT
- echo 'q' >>.SCRIPT
- ed - ${.TARGET} <.SCRIPT
- rm .SCRIPT
-
-l_copyright.s: copyright.s
- $(LIB_FILTER) ${.ALLSRC} >${.TARGET}
-
-l_sacos.s: sacos.s
- $(LIB_FILTER) ${.ALLSRC} >${.TARGET}
-
-l_sasin.s: sasin.s
- $(LIB_FILTER) ${.ALLSRC} >${.TARGET}
-
-l_satan.s: satan.s
- $(LIB_FILTER) ${.ALLSRC} >${.TARGET}
-
-l_satanh.s: satanh.s
- $(LIB_FILTER) ${.ALLSRC} >${.TARGET}
-
-l_scale.s: scale.s
- $(LIB_FILTER) ${.ALLSRC} >${.TARGET}
-
-l_scosh.s: scosh.s
- $(LIB_FILTER) ${.ALLSRC} >${.TARGET}
-
-l_setox.s: setox.s
- $(LIB_FILTER) ${.ALLSRC} >${.TARGET}
-
-l_sgetem.s: sgetem.s
- $(LIB_FILTER) ${.ALLSRC} >${.TARGET}
-
-l_sint.s: sint.s
- $(LIB_FILTER) ${.ALLSRC} >${.TARGET}
-
-l_slog2.s: slog2.s
- $(LIB_FILTER) ${.ALLSRC} >${.TARGET}
-
-l_slogn.s: slogn.s
- $(LIB_FILTER) ${.ALLSRC} >${.TARGET}
-
-l_srem_mod.s: srem_mod.s
- $(LIB_FILTER) ${.ALLSRC} >${.TARGET}
-
-l_ssin.s: ssin.s
- $(LIB_FILTER) ${.ALLSRC} >${.TARGET}
-
-l_ssinh.s: ssinh.s
- $(LIB_FILTER) ${.ALLSRC} >${.TARGET}
-
-l_stan.s: stan.s
- $(LIB_FILTER) ${.ALLSRC} >${.TARGET}
-
-l_stanh.s: stanh.s
- $(LIB_FILTER) ${.ALLSRC} >${.TARGET}
-
-l_stwotox.s: stwotox.s
- $(LIB_FILTER) ${.ALLSRC} >${.TARGET}
-
-#
-# Extract all files from SCCS directory
-#
-clean cleandir:
- rm -f $(H_FILES)
- rm -f $(S_FILES)
- rm -f $(O_FILES)
- rm -f $(TARGET).o
- rm -f $(LIB_S_FILES)
- rm -f $(LIB_O_FILES)
- rm -f $(LIB_TARGET)
-
-clobber: clean
-
-_SUBDIRUSE:
-
-.else
-clean cleandir:
-
-.endif
-
-all:
-
-depend:
-
-install:
-
-includes:
-
-.include <bsd.obj.mk>
-.include <bsd.own.mk>
diff --git a/sys/arch/m68k/fpsp/Makefile.inc b/sys/arch/m68k/fpsp/Makefile.inc
deleted file mode 100644
index 6dc170ef1e6..00000000000
--- a/sys/arch/m68k/fpsp/Makefile.inc
+++ /dev/null
@@ -1,26 +0,0 @@
-# $OpenBSD: Makefile.inc,v 1.5 2001/08/22 18:10:20 miod Exp $
-# $NetBSD: Makefile.inc,v 1.5 1997/05/07 07:15:44 mycroft Exp $
-#
-# NOTE: $S must correspond to the top of the `sys' tree
-
-FPSPSRCDIR= $S/arch/m68k/fpsp
-
-FPSPOBJDIR!= cd $(FPSPSRCDIR); \
- printf "xxx: .MAKE\n\t@echo \$${.OBJDIR}\n" | $(MAKE) -s -f-
-
-FPSPOBJ= $(FPSPOBJDIR)/fpsp.o
-
-FPSPMAKE= \
- cd ${FPSPSRCDIR} && MAKEOBJDIR=${FPSPOBJDIR} ${MAKE}
-
-$(FPSPOBJ): .NOTMAIN __always_make_fpsp
- @echo making sure the fpsp is up to date...
- @${FPSPMAKE}
-
-clean:: .NOTMAIN __always_make_fpsp
- @echo cleaning the fpsp objects
- @${FPSPMAKE} clean
-
-FPSP!= printf "\#ifdef FPSP\n${FPSPOBJ}\n\#endif\n" | ${CPP} -P -undef ${CPPFLAGS:M-DFPSP}
-
-__always_make_fpsp: .NOTMAIN
diff --git a/sys/arch/m68k/fpsp/asm2gas b/sys/arch/m68k/fpsp/asm2gas
deleted file mode 100644
index 8257fe0eaae..00000000000
--- a/sys/arch/m68k/fpsp/asm2gas
+++ /dev/null
@@ -1,243 +0,0 @@
-#!/bin/sh
-# $OpenBSD: asm2gas,v 1.3 2013/02/02 13:32:05 miod Exp $
-# $NetBSD: asm2gas,v 1.6 2000/12/06 21:31:05 is Exp $
-
-#
-# Copyright (c) 1998 The NetBSD Foundation, Inc.
-# All rights reserved.
-#
-# This code is derived from software contributed to The NetBSD Foundation
-# by Charles M. Hannum.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by the NetBSD
-# Foundation, Inc. and its contributors.
-# 4. Neither the name of The NetBSD Foundation nor the names of its
-# contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
-# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
-# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-# This ugly script converts assembler code from Motorola's format to a
-# form that gas (MIT syntax) can digest.
-
-cat $1 | sed -e '
- # format canonicalization
-
- /[ ]IDNT[ ]/{s/^/|/;p;d;}
- /^\*/{s//|/;p;d;}
- s/;/|/
- /[ ]equ[ ]/{
- s/\([A-Za-z_][A-Za-z0-9_]*\)[ ]*equ[ ]*/\1,/
- s/[ ][ ]*\(.*\)$/ |\1/
- s/ ||/ |/
- s/^/ .set /
- p;d
- }
- s/^\([A-Za-z_][A-Za-z0-9_]*\)[ ][ ]*/\1: /
- s/^\([A-Za-z_][A-Za-z0-9_]*\)$/\1:/
- /^[A-Za-z_][A-Za-z0-9_]*:/{
- h
- s/:.*$/:/
- p
- g
- s/^.*:[ ]*/ /
- /^ $/d
- }
- /^[ ][ ]*\([.a-zA-Z][.a-zA-Z0-9]*\)/{
- h
- s///
- s/^[ ][ ]*//
- s/[ ][ ]*\(.*\)$/ |\1/
- s/ ||/ |/
- x
- s/^[ ][ ]*//
- s/[ ][ ]*.*$/ /
- y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
- s/^/ /
- G
- s/\n//
- }
-' | sed -e '
- # operator conversion
-
- s/^ section 7/ .text/
- s/^ section 8/ .text/
- s/^ section 15/ .data/
- /^ include/{s/include[ ]/.include "/;s/\.h[ ]*$/.defs"/;p;d;}
- s/^ xref/| xref/
- s/^ end/| end/
- s/^ xdef/ .global/
-
- s/^ dc\.l/ .long/
- s/^ dc\.w/ .short/
- s/^ dc\.b/ .byte/
-
- /^ [aceg-z]/{
- /^ add[aiqx]*\.[bwl] /{s/\.//;p;d;}
- /^ andi*\.[bwl] /{s/\.//;p;d;}
- /^ as[lr]\.[bwl] /{s/\.//;p;d;}
- /^ clr\.[bwl] /{s/\.//;p;d;}
- /^ cmp[i2]*\.[bwl] /{s/\.//;p;d;}
- /^ eori*\.[bwl] /{s/\.//;p;d;}
- /^ lea\.l /{s/\..//;p;d;}
- /^ ls[lr]\.[bwl] /{s/\.//;p;d;}
- /^ move[acmqs]*\.[bwl] /{s/\.//;p;d;}
- /^ mul[su]\.[wl] /{s/\.//;p;d;}
- /^ neg\.[bwl] /{s/\.//;p;d;}
- /^ ori*\.[bwl] /{s/\.//;p;d;}
- /^ ro[lrx]*\.[bwl] /{s/\.//;p;d;}
- /^ sub[aiqx]*\.[bwl] /{s/\.//;p;d;}
- /^ swap\.w /{s/\..//;p;d;}
- /^ s\([a-tv-z][a-z]*\)\.b /{s/\..//;p;d;}
- /^ tst\.[bwl] /{s/\.//;p;d;}
- p;d
- }
-
- /^ bchg\.[bl] /{s/\..//;p;d;}
- /^ bclr\.[bl] /{s/\..//;p;d;}
- /^ bset\.[bl] /{s/\..//;p;d;}
- /^ btst\.[bl] /{s/\..//;p;d;}
- /^ div[sul]*\.[wl] /{s/\.//;p;d;}
- /^ fabs\.[sdx] /{s/\.//;p;d;}
- /^ fadd\.[sdxbwl] /{s/\.//;p;d;}
- /^ fcmp\.[sdxbwl] /{s/\.//;p;d;}
- /^ fdiv\.[sdx] /{s/\.//;p;d;}
- /^ fmove[mx]*\.[sdxbwl] /{s/\.//;p;d;}
- /^ fmul\.[sdx] /{s/\.//;p;d;}
- /^ fneg\.[sdx] /{s/\.//;p;d;}
- /^ fsqrt\.[sdx] /{s/\.//;p;d;}
- /^ fsub\.[sdxbwl] /{s/\.//;p;d;}
- /^ ftst\.[sdx] /{s/\.//;p;d;}
-
- /^ b[a-eg-z][a-z]*\.b /{s/\.b/s/;p;d;}
- /^ b[a-eg-z][a-z]*\.w /{s/\.w//;p;d;}
- /^ b[a-eg-z][a-z]*\.l /{s/\.l/l/;p;d;}
- /^ db[a-z][a-z]*\.w /{s/\.w//;p;d;}
- /^ fb[a-eg-z][a-z]*\.w /{s/\.w//;p;d;}
- /^ fb[a-eg-z][a-z]*\.l /{s/\.l/l/;p;d;}
-' | sed -e '
- # operand conversion
-
- s/\([^_a-zA-Z0-9]\)FPIAR\([^_a-zA-Z0-9]\)/\1%FPI\2/g
- s/\([^_a-zA-Z0-9]\)FPIAR$/\1%FPI/g
- s/\([^_a-zA-Z0-9]\)fpiar\([^_a-zA-Z0-9]\)/\1%fpi\2/g
- s/\([^_a-zA-Z0-9]\)fpiar$/\1%fpi/g
- s/\([^_a-zA-Z0-9]\)FPCR\([^_a-zA-Z0-9]\)/\1%FPCR\2/g
- s/\([^_a-zA-Z0-9]\)FPCR$/\1%FPCR/g
- s/\([^_a-zA-Z0-9]\)fpcr\([^_a-zA-Z0-9]\)/\1%fpcr\2/g
- s/\([^_a-zA-Z0-9]\)fpcr$/\1%fpcr/g
- s/\([^_a-zA-Z0-9]\)FPSR\([^_a-zA-Z0-9]\)/\1%FPSR\2/g
- s/\([^_a-zA-Z0-9]\)FPSR$/\1%FPSR/g
- s/\([^_a-zA-Z0-9]\)fpsr\([^_a-zA-Z0-9]\)/\1%fpsr\2/g
- s/\([^_a-zA-Z0-9]\)fpsr$/\1%fpsr/g
-
- ## RCSId
- s/\$\(NetBSD.*\)\$/\1/g
- s/\$\(OpenBSD.*\)\$/\1/g
- s/\$/0x/g
- s/#:/#:0x/g
-
- s/\([^[:alnum:]_]\)\([dDaA][0-7]\)\([^[:alnum:]_]\)/\1%\2\3/g
- s/\([^[:alnum:]_]\)\([fF][pP][0-7]\)\([^[:alnum:]_]\)/\1%\2\3/g
- s/\([^[:alnum:]_]\)\(sp\)\([^[:alnum:]_]\)/\1%\2\3/g
- s/\([^[:alnum:]_]\)\(pc\)\([^[:alnum:]_]\)/\1%\2\3/g
-
- s/\([^[:alnum:]_]\)\([dDaA][0-7]\)$/\1%\2/g
- s/\([^[:alnum:]_]\)\([fF][pP][0-7]\)$/\1%\2/g
- s/\([^[:alnum:]_]\)\(sp\)$/\1%\2/g
-
- s/\(,\)\([dDaA][0-7]\)/\1%\2/g
- s/\(,\)\([fF][pP][0-7]\)/\1%\2/g
-
- s/-(\(%[sSpPaA][pPcC0-7]\))/\1@-/g
- s/(\(%[sSpPaA][pPcC0-7]\))+/\1@+/g
- s/\([-+A-Za-z0-9_]*\)(\(%[sSpPaA][pPcC0-7]\)\([),]\)/\2@(\1\3/g
-
- s/\.\([bBwWlL])\)/:\1/g
- s/\.\([bBwWlL]\)\*\([0-9][0-9]*)\)/:\1:\2/g
- s/\*\([0-9][0-9]*\))/:l:\1)/g
- s/{\([0-9][0-9]*\):\([0-9][0-9]*\)}/{#\1:#\2}/g
- s/{\(%[dD][0-7]\):\([0-9][0-9]*\)}/{\1:#\2}/g
- s/{\([dD][0-7]\):\([0-9][0-9]*\)}/{%\1:#\2}/g
- s/{\([dD][0-7]\):\(%[dD][0-9]*\)}/{%\1:\2}/g
-
- s/\(-\)\([dDaA][0-7]\)\([^_a-zA-Z0-9]\)/\1%\2\3/g
- s/\(-\)\([fF][pP][0-7]\)\([^_a-zA-Z0-9]\)/\1%\2\3/g
-
- s/\(\/\)\([dDaA][0-7]\)\([^_a-zA-Z0-9]\)/\1%\2\3/g
- s/\(\/\)\([fF][pP][0-7]\)\([^_a-zA-Z0-9]\)/\1%\2\3/g
-
- s/@(0*)/@/g
- s/(,/(/g;s/:)/)/g
-
- # make up for a gas bug
- /^ fmovemx /{
- s/ \(%[fF][pP][0-7]\),/ \1-\1,/
- s/,\(%[fF][pP][0-7]\) /,\1-\1 /
- s/,\(%[fF][pP][0-7]\)$/,\1-\1/
- }
-
- # symbol name collision with kernel
- s/pmod/_fpsp_pmod/g
-' | sed -e '
- # Floating point literal conversion
-
- s/:0x41dfffffffc00000/0r2147483647.0/g
- s/:0xc1e0000000000000/0r-2147483648.0/g
- s/:0x41dfffffffe00000/0r2147483647.5/g
- s/:0xc1e0000000100000/0r-2147483648.5/g
- s/:0x46fffe00/0r32767.0/g
- s/:0xc7000000/0r-32768.0/g
- s/:0x46ffff00/0r32767.5/g
- s/:0xc7000080/0r-32768.5/g
- s/:0x42fe0000/0r127.0/g
- s/:0xc3000000/0r-128.0/g
- s/:0x42ff0000/0r127.5/g
- s/:0xc3008000/0r-128.5/g
- s/:0x3F800000/0r1.0/g
- s/:0x00000000/0r0.0/g
- s/:0xBF800000/0r-1.0/g
- s/:0x3F000000/0r0.5/g
- s/:0x3E800000/0r0.25/g
- s/:0x42B8AA3B/0r92.332481384277343750/g
- s/:0xBC317218/0r-0.0108304247260093688964843750/g
- s/:0x3AB60B70/0r0.001388890668749809265136718750/g
- s/:0x3C088895/0r0.0083333449438214302062988281250/g
- s/:0x42B8AA3B/0r92.332481384277343750/g
- s/:0x3950097B/0r0.0001983995753107592463493347167968750/g
- s/:0x3AB60B6A/0r0.001388889970257878303527832031250/g
- s/:0x2F30CAA8/0r1.60791047143504783889511600136756896972656250e-10/g
- s/:0x310F8290/0r2.0883454965314740547910332679748535156250e-09/g
- s/:0x32D73220/0r2.5052088403754169121384620666503906250e-08/g
- s/:0x3493F281/0r2.755732850800995947793126106262207031250e-07/g
- s/:0x40000000/0r2.0/g
- s/:0x42800000/0r6.40e+01/g
- s/:0x3C800000/0r1.56250e-02/g
- s/fadds #:0x00800000,%[fF][pP]0/ .long 0xf23c4422,0x00800000/
- s/fsubs #:0x00800000,%[fF][pP]0/ .long 0xf23c4428,0x00800000/
- s/fsubs #:0x00800000,%[fF][pP]1/ .long 0xf23c44a8,0x00800000/
- s/fmoves #:0x80000000,%[fF][pP]0/ .long 0xf23c4400,0x80000000/
- s/fmoves #:0x00000000,%[fF][pP]0/ .long 0xf23c4400,0x00000000/
-
-'
diff --git a/sys/arch/m68k/fpsp/bindec.sa b/sys/arch/m68k/fpsp/bindec.sa
deleted file mode 100644
index 534b42ce64a..00000000000
--- a/sys/arch/m68k/fpsp/bindec.sa
+++ /dev/null
@@ -1,948 +0,0 @@
-* $OpenBSD: bindec.sa,v 1.4 2013/02/02 13:32:05 miod Exp $
-* $NetBSD: bindec.sa,v 1.3 1994/10/26 07:48:51 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* bindec.sa 3.4 1/3/91
-*
-* bindec
-*
-* Description:
-* Converts an input in extended precision format
-* to bcd format.
-*
-* Input:
-* a0 points to the input extended precision value
-* value in memory; d0 contains the k-factor sign-extended
-* to 32-bits. The input may be either normalized,
-* unnormalized, or denormalized.
-*
-* Output: result in the FP_SCR1 space on the stack.
-*
-* Saves and Modifies: D2-D7,A2,FP2
-*
-* Algorithm:
-*
-* A1. Set RM and size ext; Set SIGMA = sign of input.
-* The k-factor is saved for use in d7. Clear the
-* BINDEC_FLG for separating normalized/denormalized
-* input. If input is unnormalized or denormalized,
-* normalize it.
-*
-* A2. Set X = abs(input).
-*
-* A3. Compute ILOG.
-* ILOG is the log base 10 of the input value. It is
-* approximated by adding e + 0.f when the original
-* value is viewed as 2^^e * 1.f in extended precision.
-* This value is stored in d6.
-*
-* A4. Clr INEX bit.
-* The operation in A3 above may have set INEX2.
-*
-* A5. Set ICTR = 0;
-* ICTR is a flag used in A13. It must be set before the
-* loop entry A6.
-*
-* A6. Calculate LEN.
-* LEN is the number of digits to be displayed. The
-* k-factor can dictate either the total number of digits,
-* if it is a positive number, or the number of digits
-* after the decimal point which are to be included as
-* significant. See the 68882 manual for examples.
-* If LEN is computed to be greater than 17, set OPERR in
-* USER_FPSR. LEN is stored in d4.
-*
-* A7. Calculate SCALE.
-* SCALE is equal to 10^ISCALE, where ISCALE is the number
-* of decimal places needed to insure LEN integer digits
-* in the output before conversion to bcd. LAMBDA is the
-* sign of ISCALE, used in A9. Fp1 contains
-* 10^^(abs(ISCALE)) using a rounding mode which is a
-* function of the original rounding mode and the signs
-* of ISCALE and X. A table is given in the code.
-*
-* A8. Clr INEX; Force RZ.
-* The operation in A3 above may have set INEX2.
-* RZ mode is forced for the scaling operation to insure
-* only one rounding error. The grs bits are collected in
-* the INEX flag for use in A10.
-*
-* A9. Scale X -> Y.
-* The mantissa is scaled to the desired number of
-* significant digits. The excess digits are collected
-* in INEX2.
-*
-* A10. Or in INEX.
-* If INEX is set, round error occurred. This is
-* compensated for by 'or-ing' in the INEX2 flag to
-* the lsb of Y.
-*
-* A11. Restore original FPCR; set size ext.
-* Perform FINT operation in the user's rounding mode.
-* Keep the size to extended.
-*
-* A12. Calculate YINT = FINT(Y) according to user's rounding
-* mode. The FPSP routine sintd0 is used. The output
-* is in fp0.
-*
-* A13. Check for LEN digits.
-* If the int operation results in more than LEN digits,
-* or less than LEN -1 digits, adjust ILOG and repeat from
-* A6. This test occurs only on the first pass. If the
-* result is exactly 10^LEN, decrement ILOG and divide
-* the mantissa by 10.
-*
-* A14. Convert the mantissa to bcd.
-* The binstr routine is used to convert the LEN digit
-* mantissa to bcd in memory. The input to binstr is
-* to be a fraction; i.e. (mantissa)/10^LEN and adjusted
-* such that the decimal point is to the left of bit 63.
-* The bcd digits are stored in the correct position in
-* the final string area in memory.
-*
-* A15. Convert the exponent to bcd.
-* As in A14 above, the exp is converted to bcd and the
-* digits are stored in the final string.
-* Test the length of the final exponent string. If the
-* length is 4, set operr.
-*
-* A16. Write sign bits to final string.
-*
-* Implementation Notes:
-*
-* The registers are used as follows:
-*
-* d0: scratch; LEN input to binstr
-* d1: scratch
-* d2: upper 32-bits of mantissa for binstr
-* d3: scratch;lower 32-bits of mantissa for binstr
-* d4: LEN
-* d5: LAMBDA/ICTR
-* d6: ILOG
-* d7: k-factor
-* a0: ptr for original operand/final result
-* a1: scratch pointer
-* a2: pointer to FP_X; abs(original value) in ext
-* fp0: scratch
-* fp1: scratch
-* fp2: scratch
-* F_SCR1:
-* F_SCR2:
-* L_SCR1:
-* L_SCR2:
-*
-
-BINDEC IDNT 2,1 Motorola 040 Floating Point Software Package
-
- include fpsp.h
-
- section 8
-
-* Constants in extended precision
-LOG2 dc.l $3FFD0000,$9A209A84,$FBCFF798,$00000000
-LOG2UP1 dc.l $3FFD0000,$9A209A84,$FBCFF799,$00000000
-
-* Constants in single precision
-FONE dc.l $3F800000,$00000000,$00000000,$00000000
-FTWO dc.l $40000000,$00000000,$00000000,$00000000
-FTEN dc.l $41200000,$00000000,$00000000,$00000000
-F4933 dc.l $459A2800,$00000000,$00000000,$00000000
-
-RBDTBL dc.b 0,0,0,0
- dc.b 3,3,2,2
- dc.b 3,2,2,3
- dc.b 2,3,3,2
-
- xref binstr
- xref sintdo
- xref ptenrn,ptenrm,ptenrp
-
- xdef bindec
- xdef sc_mul
-bindec:
- movem.l d2-d7/a2,-(a7)
- fmovem.x fp0-fp2,-(a7)
-
-* A1. Set RM and size ext. Set SIGMA = sign input;
-* The k-factor is saved for use in d7. Clear BINDEC_FLG for
-* separating normalized/denormalized input. If the input
-* is a denormalized number, set the BINDEC_FLG memory word
-* to signal denorm. If the input is unnormalized, normalize
-* the input and test for denormalized result.
-*
- fmove.l #rm_mode,FPCR ;set RM and ext
- move.l (a0),L_SCR2(a6) ;save exponent for sign check
- move.l d0,d7 ;move k-factor to d7
- clr.b BINDEC_FLG(a6) ;clr norm/denorm flag
- move.w STAG(a6),d0 ;get stag
- andi.w #$e000,d0 ;isolate stag bits
- beq A2_str ;if zero, input is norm
-*
-* Normalize the denorm
-*
-un_de_norm:
- move.w (a0),d0
- andi.w #$7fff,d0 ;strip sign of normalized exp
- move.l 4(a0),d1
- move.l 8(a0),d2
-norm_loop:
- sub.w #1,d0
- add.l d2,d2
- addx.l d1,d1
- tst.l d1
- bge.b norm_loop
-*
-* Test if the normalized input is denormalized
-*
- tst.w d0
- bgt.b pos_exp ;if greater than zero, it is a norm
- st BINDEC_FLG(a6) ;set flag for denorm
-pos_exp:
- andi.w #$7fff,d0 ;strip sign of normalized exp
- move.w d0,(a0)
- move.l d1,4(a0)
- move.l d2,8(a0)
-
-* A2. Set X = abs(input).
-*
-A2_str:
- move.l (a0),FP_SCR2(a6) ; move input to work space
- move.l 4(a0),FP_SCR2+4(a6) ; move input to work space
- move.l 8(a0),FP_SCR2+8(a6) ; move input to work space
- andi.l #$7fffffff,FP_SCR2(a6) ;create abs(X)
-
-* A3. Compute ILOG.
-* ILOG is the log base 10 of the input value. It is approx-
-* imated by adding e + 0.f when the original value is viewed
-* as 2^^e * 1.f in extended precision. This value is stored
-* in d6.
-*
-* Register usage:
-* Input/Output
-* d0: k-factor/exponent
-* d2: x/x
-* d3: x/x
-* d4: x/x
-* d5: x/x
-* d6: x/ILOG
-* d7: k-factor/Unchanged
-* a0: ptr for original operand/final result
-* a1: x/x
-* a2: x/x
-* fp0: x/float(ILOG)
-* fp1: x/x
-* fp2: x/x
-* F_SCR1:x/x
-* F_SCR2:Abs(X)/Abs(X) with $3fff exponent
-* L_SCR1:x/x
-* L_SCR2:first word of X packed/Unchanged
-
- tst.b BINDEC_FLG(a6) ;check for denorm
- beq.b A3_cont ;if clr, continue with norm
- move.l #-4933,d6 ;force ILOG = -4933
- bra.b A4_str
-A3_cont:
- move.w FP_SCR2(a6),d0 ;move exp to d0
- move.w #$3fff,FP_SCR2(a6) ;replace exponent with 0x3fff
- fmove.x FP_SCR2(a6),fp0 ;now fp0 has 1.f
- sub.w #$3fff,d0 ;strip off bias
- fadd.w d0,fp0 ;add in exp
- fsub.s FONE,fp0 ;subtract off 1.0
- fbge.w pos_res ;if pos, branch
- fmul.x LOG2UP1,fp0 ;if neg, mul by LOG2UP1
- fmove.l fp0,d6 ;put ILOG in d6 as a lword
- bra.b A4_str ;go move out ILOG
-pos_res:
- fmul.x LOG2,fp0 ;if pos, mul by LOG2
- fmove.l fp0,d6 ;put ILOG in d6 as a lword
-
-
-* A4. Clr INEX bit.
-* The operation in A3 above may have set INEX2.
-
-A4_str:
- fmove.l #0,FPSR ;zero all of fpsr - nothing needed
-
-
-* A5. Set ICTR = 0;
-* ICTR is a flag used in A13. It must be set before the
-* loop entry A6. The lower word of d5 is used for ICTR.
-
- clr.w d5 ;clear ICTR
-
-
-* A6. Calculate LEN.
-* LEN is the number of digits to be displayed. The k-factor
-* can dictate either the total number of digits, if it is
-* a positive number, or the number of digits after the
-* original decimal point which are to be included as
-* significant. See the 68882 manual for examples.
-* If LEN is computed to be greater than 17, set OPERR in
-* USER_FPSR. LEN is stored in d4.
-*
-* Register usage:
-* Input/Output
-* d0: exponent/Unchanged
-* d2: x/x/scratch
-* d3: x/x
-* d4: exc picture/LEN
-* d5: ICTR/Unchanged
-* d6: ILOG/Unchanged
-* d7: k-factor/Unchanged
-* a0: ptr for original operand/final result
-* a1: x/x
-* a2: x/x
-* fp0: float(ILOG)/Unchanged
-* fp1: x/x
-* fp2: x/x
-* F_SCR1:x/x
-* F_SCR2:Abs(X) with $3fff exponent/Unchanged
-* L_SCR1:x/x
-* L_SCR2:first word of X packed/Unchanged
-
-A6_str:
- tst.l d7 ;branch on sign of k
- ble.b k_neg ;if k <= 0, LEN = ILOG + 1 - k
- move.l d7,d4 ;if k > 0, LEN = k
- bra.b len_ck ;skip to LEN check
-k_neg:
- move.l d6,d4 ;first load ILOG to d4
- sub.l d7,d4 ;subtract off k
- addq.l #1,d4 ;add in the 1
-len_ck:
- tst.l d4 ;LEN check: branch on sign of LEN
- ble.b LEN_ng ;if neg, set LEN = 1
- cmp.l #17,d4 ;test if LEN > 17
- ble.b A7_str ;if not, forget it
- move.l #17,d4 ;set max LEN = 17
- tst.l d7 ;if negative, never set OPERR
- ble.b A7_str ;if positive, continue
- or.l #opaop_mask,USER_FPSR(a6) ;set OPERR & AIOP in USER_FPSR
- bra.b A7_str ;finished here
-LEN_ng:
- moveq.l #1,d4 ;min LEN is 1
-
-
-* A7. Calculate SCALE.
-* SCALE is equal to 10^ISCALE, where ISCALE is the number
-* of decimal places needed to insure LEN integer digits
-* in the output before conversion to bcd. LAMBDA is the sign
-* of ISCALE, used in A9. Fp1 contains 10^^(abs(ISCALE)) using
-* the rounding mode as given in the following table (see
-* Coonen, p. 7.23 as ref.; however, the SCALE variable is
-* of opposite sign in bindec.sa from Coonen).
-*
-* Initial USE
-* FPCR[6:5] LAMBDA SIGN(X) FPCR[6:5]
-* ----------------------------------------------
-* RN 00 0 0 00/0 RN
-* RN 00 0 1 00/0 RN
-* RN 00 1 0 00/0 RN
-* RN 00 1 1 00/0 RN
-* RZ 01 0 0 11/3 RP
-* RZ 01 0 1 11/3 RP
-* RZ 01 1 0 10/2 RM
-* RZ 01 1 1 10/2 RM
-* RM 10 0 0 11/3 RP
-* RM 10 0 1 10/2 RM
-* RM 10 1 0 10/2 RM
-* RM 10 1 1 11/3 RP
-* RP 11 0 0 10/2 RM
-* RP 11 0 1 11/3 RP
-* RP 11 1 0 11/3 RP
-* RP 11 1 1 10/2 RM
-*
-* Register usage:
-* Input/Output
-* d0: exponent/scratch - final is 0
-* d2: x/0 or 24 for A9
-* d3: x/scratch - offset ptr into PTENRM array
-* d4: LEN/Unchanged
-* d5: 0/ICTR:LAMBDA
-* d6: ILOG/ILOG or k if ((k<=0)&(ILOG<k))
-* d7: k-factor/Unchanged
-* a0: ptr for original operand/final result
-* a1: x/ptr to PTENRM array
-* a2: x/x
-* fp0: float(ILOG)/Unchanged
-* fp1: x/10^ISCALE
-* fp2: x/x
-* F_SCR1:x/x
-* F_SCR2:Abs(X) with $3fff exponent/Unchanged
-* L_SCR1:x/x
-* L_SCR2:first word of X packed/Unchanged
-
-A7_str:
- tst.l d7 ;test sign of k
- bgt.b k_pos ;if pos and > 0, skip this
- cmp.l d6,d7 ;test k - ILOG
- blt.b k_pos ;if ILOG >= k, skip this
- move.l d7,d6 ;if ((k<0) & (ILOG < k)) ILOG = k
-k_pos:
- move.l d6,d0 ;calc ILOG + 1 - LEN in d0
- addq.l #1,d0 ;add the 1
- sub.l d4,d0 ;sub off LEN
- swap d5 ;use upper word of d5 for LAMBDA
- clr.w d5 ;set it zero initially
- clr.w d2 ;set up d2 for very small case
- tst.l d0 ;test sign of ISCALE
- bge.b iscale ;if pos, skip next inst
- addq.w #1,d5 ;if neg, set LAMBDA true
- cmp.l #$ffffecd4,d0 ;test iscale <= -4908
- bgt.b no_inf ;if false, skip rest
- addi.l #24,d0 ;add in 24 to iscale
- move.l #24,d2 ;put 24 in d2 for A9
-no_inf:
- neg.l d0 ;and take abs of ISCALE
-iscale:
- fmove.s FONE,fp1 ;init fp1 to 1
- bfextu USER_FPCR(a6){26:2},d1 ;get initial rmode bits
- add.w d1,d1 ;put them in bits 2:1
- add.w d5,d1 ;add in LAMBDA
- add.w d1,d1 ;put them in bits 3:1
- tst.l L_SCR2(a6) ;test sign of original x
- bge.b x_pos ;if pos, don't set bit 0
- addq.l #1,d1 ;if neg, set bit 0
-x_pos:
- lea.l RBDTBL,a2 ;load rbdtbl base
- move.b (a2,d1),d3 ;load d3 with new rmode
- lsl.l #4,d3 ;put bits in proper position
- fmove.l d3,fpcr ;load bits into fpu
- lsr.l #4,d3 ;put bits in proper position
- tst.b d3 ;decode new rmode for pten table
- bne.b not_rn ;if zero, it is RN
- lea.l PTENRN,a1 ;load a1 with RN table base
- bra.b rmode ;exit decode
-not_rn:
- lsr.b #1,d3 ;get lsb in carry
- bcc.b not_rp ;if carry clear, it is RM
- lea.l PTENRP,a1 ;load a1 with RP table base
- bra.b rmode ;exit decode
-not_rp:
- lea.l PTENRM,a1 ;load a1 with RM table base
-rmode:
- clr.l d3 ;clr table index
-e_loop:
- lsr.l #1,d0 ;shift next bit into carry
- bcc.b e_next ;if zero, skip the mul
- fmul.x (a1,d3),fp1 ;mul by 10**(d3_bit_no)
-e_next:
- add.l #12,d3 ;inc d3 to next pwrten table entry
- tst.l d0 ;test if ISCALE is zero
- bne.b e_loop ;if not, loop
-
-
-* A8. Clr INEX; Force RZ.
-* The operation in A3 above may have set INEX2.
-* RZ mode is forced for the scaling operation to insure
-* only one rounding error. The grs bits are collected in
-* the INEX flag for use in A10.
-*
-* Register usage:
-* Input/Output
-
- fmove.l #0,FPSR ;clr INEX
- fmove.l #rz_mode,FPCR ;set RZ rounding mode
-
-
-* A9. Scale X -> Y.
-* The mantissa is scaled to the desired number of significant
-* digits. The excess digits are collected in INEX2. If mul,
-* Check d2 for excess 10 exponential value. If not zero,
-* the iscale value would have caused the pwrten calculation
-* to overflow. Only a negative iscale can cause this, so
-* multiply by 10^(d2), which is now only allowed to be 24,
-* with a multiply by 10^8 and 10^16, which is exact since
-* 10^24 is exact. If the input was denormalized, we must
-* create a busy stack frame with the mul command and the
-* two operands, and allow the fpu to complete the multiply.
-*
-* Register usage:
-* Input/Output
-* d0: FPCR with RZ mode/Unchanged
-* d2: 0 or 24/unchanged
-* d3: x/x
-* d4: LEN/Unchanged
-* d5: ICTR:LAMBDA
-* d6: ILOG/Unchanged
-* d7: k-factor/Unchanged
-* a0: ptr for original operand/final result
-* a1: ptr to PTENRM array/Unchanged
-* a2: x/x
-* fp0: float(ILOG)/X adjusted for SCALE (Y)
-* fp1: 10^ISCALE/Unchanged
-* fp2: x/x
-* F_SCR1:x/x
-* F_SCR2:Abs(X) with $3fff exponent/Unchanged
-* L_SCR1:x/x
-* L_SCR2:first word of X packed/Unchanged
-
-A9_str:
- fmove.x (a0),fp0 ;load X from memory
- fabs.x fp0 ;use abs(X)
- tst.w d5 ;LAMBDA is in lower word of d5
- bne.b short_sc_mul ;if neg (LAMBDA = 1), scale by mul
- fdiv.x fp1,fp0 ;calculate X / SCALE -> Y to fp0
- bra.b A10_st ;branch to A10
-
-sc_mul:
-short_sc_mul:
- tst.b BINDEC_FLG(a6) ;check for denorm
- beq.b A9_norm ;if norm, continue with mul
- fmovem.x fp1,-(a7) ;load ETEMP with 10^ISCALE
- move.l 8(a0),-(a7) ;load FPTEMP with input arg
- move.l 4(a0),-(a7)
- move.l (a0),-(a7)
- move.l #18,d3 ;load count for busy stack
-A9_loop:
- clr.l -(a7) ;clear lword on stack
- dbf.w d3,A9_loop
- move.b VER_TMP(a6),(a7) ;write current version number
- move.b #BUSY_SIZE-4,1(a7) ;write current busy size
- move.b #$10,$44(a7) ;set fcefpte[15] bit
- move.w #$0023,$40(a7) ;load cmdreg1b with mul command
- move.b #$fe,$8(a7) ;load all 1s to cu savepc
- frestore (a7)+ ;restore frame to fpu for completion
- fmul.x 36(a1),fp0 ;multiply fp0 by 10^8
- fmul.x 48(a1),fp0 ;multiply fp0 by 10^16
- bra.b A10_st
-A9_norm:
- tst.w d2 ;test for small exp case
- beq.b A9_con ;if zero, continue as normal
- fmul.x 36(a1),fp0 ;multiply fp0 by 10^8
- fmul.x 48(a1),fp0 ;multiply fp0 by 10^16
-A9_con:
- fmul.x fp1,fp0 ;calculate X * SCALE -> Y to fp0
-
-
-* A10. Or in INEX.
-* If INEX is set, round error occurred. This is compensated
-* for by 'or-ing' in the INEX2 flag to the lsb of Y.
-*
-* Register usage:
-* Input/Output
-* d0: FPCR with RZ mode/FPSR with INEX2 isolated
-* d2: x/x
-* d3: x/x
-* d4: LEN/Unchanged
-* d5: ICTR:LAMBDA
-* d6: ILOG/Unchanged
-* d7: k-factor/Unchanged
-* a0: ptr for original operand/final result
-* a1: ptr to PTENxx array/Unchanged
-* a2: x/ptr to FP_SCR2(a6)
-* fp0: Y/Y with lsb adjusted
-* fp1: 10^ISCALE/Unchanged
-* fp2: x/x
-
-A10_st:
- fmove.l FPSR,d0 ;get FPSR
- fmove.x fp0,FP_SCR2(a6) ;move Y to memory
- lea.l FP_SCR2(a6),a2 ;load a2 with ptr to FP_SCR2
- btst.l #9,d0 ;check if INEX2 set
- beq.b A11_st ;if clear, skip rest
- ori.l #1,8(a2) ;or in 1 to lsb of mantissa
- fmove.x FP_SCR2(a6),fp0 ;write adjusted Y back to fpu
-
-
-* A11. Restore original FPCR; set size ext.
-* Perform FINT operation in the user's rounding mode. Keep
-* the size to extended. The sintdo entry point in the sint
-* routine expects the FPCR value to be in USER_FPCR for
-* mode and precision. The original FPCR is saved in L_SCR1.
-
-A11_st:
- move.l USER_FPCR(a6),L_SCR1(a6) ;save it for later
- andi.l #$00000030,USER_FPCR(a6) ;set size to ext,
-* ;block exceptions
-
-
-* A12. Calculate YINT = FINT(Y) according to user's rounding mode.
-* The FPSP routine sintd0 is used. The output is in fp0.
-*
-* Register usage:
-* Input/Output
-* d0: FPSR with AINEX cleared/FPCR with size set to ext
-* d2: x/x/scratch
-* d3: x/x
-* d4: LEN/Unchanged
-* d5: ICTR:LAMBDA/Unchanged
-* d6: ILOG/Unchanged
-* d7: k-factor/Unchanged
-* a0: ptr for original operand/src ptr for sintdo
-* a1: ptr to PTENxx array/Unchanged
-* a2: ptr to FP_SCR2(a6)/Unchanged
-* a6: temp pointer to FP_SCR2(a6) - orig value saved and restored
-* fp0: Y/YINT
-* fp1: 10^ISCALE/Unchanged
-* fp2: x/x
-* F_SCR1:x/x
-* F_SCR2:Y adjusted for inex/Y with original exponent
-* L_SCR1:x/original USER_FPCR
-* L_SCR2:first word of X packed/Unchanged
-
-A12_st:
- movem.l d0-d1/a0-a1,-(a7) ;save regs used by sintd0
- move.l L_SCR1(a6),-(a7)
- move.l L_SCR2(a6),-(a7)
- lea.l FP_SCR2(a6),a0 ;a0 is ptr to F_SCR2(a6)
- fmove.x fp0,(a0) ;move Y to memory at FP_SCR2(a6)
- tst.l L_SCR2(a6) ;test sign of original operand
- bge.b do_fint ;if pos, use Y
- or.l #$80000000,(a0) ;if neg, use -Y
-do_fint:
- move.l USER_FPSR(a6),-(a7)
- bsr sintdo ;sint routine returns int in fp0
- move.b (a7),USER_FPSR(a6)
- add.l #4,a7
- move.l (a7)+,L_SCR2(a6)
- move.l (a7)+,L_SCR1(a6)
- movem.l (a7)+,d0-d1/a0-a1 ;restore regs used by sint
- move.l L_SCR2(a6),FP_SCR2(a6) ;restore original exponent
- move.l L_SCR1(a6),USER_FPCR(a6) ;restore user's FPCR
-
-
-* A13. Check for LEN digits.
-* If the int operation results in more than LEN digits,
-* or less than LEN -1 digits, adjust ILOG and repeat from
-* A6. This test occurs only on the first pass. If the
-* result is exactly 10^LEN, decrement ILOG and divide
-* the mantissa by 10. The calculation of 10^LEN cannot
-* be inexact, since all powers of ten upto 10^27 are exact
-* in extended precision, so the use of a previous power-of-ten
-* table will introduce no error.
-*
-*
-* Register usage:
-* Input/Output
-* d0: FPCR with size set to ext/scratch final = 0
-* d2: x/x
-* d3: x/scratch final = x
-* d4: LEN/LEN adjusted
-* d5: ICTR:LAMBDA/LAMBDA:ICTR
-* d6: ILOG/ILOG adjusted
-* d7: k-factor/Unchanged
-* a0: pointer into memory for packed bcd string formation
-* a1: ptr to PTENxx array/Unchanged
-* a2: ptr to FP_SCR2(a6)/Unchanged
-* fp0: int portion of Y/abs(YINT) adjusted
-* fp1: 10^ISCALE/Unchanged
-* fp2: x/10^LEN
-* F_SCR1:x/x
-* F_SCR2:Y with original exponent/Unchanged
-* L_SCR1:original USER_FPCR/Unchanged
-* L_SCR2:first word of X packed/Unchanged
-
-A13_st:
- swap d5 ;put ICTR in lower word of d5
- tst.w d5 ;check if ICTR = 0
- bne not_zr ;if non-zero, go to second test
-*
-* Compute 10^(LEN-1)
-*
- fmove.s FONE,fp2 ;init fp2 to 1.0
- move.l d4,d0 ;put LEN in d0
- subq.l #1,d0 ;d0 = LEN -1
- clr.l d3 ;clr table index
-l_loop:
- lsr.l #1,d0 ;shift next bit into carry
- bcc.b l_next ;if zero, skip the mul
- fmul.x (a1,d3),fp2 ;mul by 10**(d3_bit_no)
-l_next:
- add.l #12,d3 ;inc d3 to next pwrten table entry
- tst.l d0 ;test if LEN is zero
- bne.b l_loop ;if not, loop
-*
-* 10^LEN-1 is computed for this test and A14. If the input was
-* denormalized, check only the case in which YINT > 10^LEN.
-*
- tst.b BINDEC_FLG(a6) ;check if input was norm
- beq.b A13_con ;if norm, continue with checking
- fabs.x fp0 ;take abs of YINT
- bra test_2
-*
-* Compare abs(YINT) to 10^(LEN-1) and 10^LEN
-*
-A13_con:
- fabs.x fp0 ;take abs of YINT
- fcmp.x fp2,fp0 ;compare abs(YINT) with 10^(LEN-1)
- fbge.w test_2 ;if greater, do next test
- subq.l #1,d6 ;subtract 1 from ILOG
- move.w #1,d5 ;set ICTR
- fmove.l #rm_mode,FPCR ;set rmode to RM
- fmul.s FTEN,fp2 ;compute 10^LEN
- bra.w A6_str ;return to A6 and recompute YINT
-test_2:
- fmul.s FTEN,fp2 ;compute 10^LEN
- fcmp.x fp2,fp0 ;compare abs(YINT) with 10^LEN
- fblt.w A14_st ;if less, all is ok, go to A14
- fbgt.w fix_ex ;if greater, fix and redo
- fdiv.s FTEN,fp0 ;if equal, divide by 10
- addq.l #1,d6 ; and inc ILOG
- bra.b A14_st ; and continue elsewhere
-fix_ex:
- addq.l #1,d6 ;increment ILOG by 1
- move.w #1,d5 ;set ICTR
- fmove.l #rm_mode,FPCR ;set rmode to RM
- bra.w A6_str ;return to A6 and recompute YINT
-*
-* Since ICTR <> 0, we have already been through one adjustment,
-* and shouldn't have another; this is to check if abs(YINT) = 10^LEN
-* 10^LEN is again computed using whatever table is in a1 since the
-* value calculated cannot be inexact.
-*
-not_zr:
- fmove.s FONE,fp2 ;init fp2 to 1.0
- move.l d4,d0 ;put LEN in d0
- clr.l d3 ;clr table index
-z_loop:
- lsr.l #1,d0 ;shift next bit into carry
- bcc.b z_next ;if zero, skip the mul
- fmul.x (a1,d3),fp2 ;mul by 10**(d3_bit_no)
-z_next:
- add.l #12,d3 ;inc d3 to next pwrten table entry
- tst.l d0 ;test if LEN is zero
- bne.b z_loop ;if not, loop
- fabs.x fp0 ;get abs(YINT)
- fcmp.x fp2,fp0 ;check if abs(YINT) = 10^LEN
- fbne.w A14_st ;if not, skip this
- fdiv.s FTEN,fp0 ;divide abs(YINT) by 10
- addq.l #1,d6 ;and inc ILOG by 1
- addq.l #1,d4 ; and inc LEN
- fmul.s FTEN,fp2 ; if LEN++, the get 10^^LEN
-
-
-* A14. Convert the mantissa to bcd.
-* The binstr routine is used to convert the LEN digit
-* mantissa to bcd in memory. The input to binstr is
-* to be a fraction; i.e. (mantissa)/10^LEN and adjusted
-* such that the decimal point is to the left of bit 63.
-* The bcd digits are stored in the correct position in
-* the final string area in memory.
-*
-*
-* Register usage:
-* Input/Output
-* d0: x/LEN call to binstr - final is 0
-* d1: x/0
-* d2: x/ms 32-bits of mant of abs(YINT)
-* d3: x/ls 32-bits of mant of abs(YINT)
-* d4: LEN/Unchanged
-* d5: ICTR:LAMBDA/LAMBDA:ICTR
-* d6: ILOG
-* d7: k-factor/Unchanged
-* a0: pointer into memory for packed bcd string formation
-* /ptr to first mantissa byte in result string
-* a1: ptr to PTENxx array/Unchanged
-* a2: ptr to FP_SCR2(a6)/Unchanged
-* fp0: int portion of Y/abs(YINT) adjusted
-* fp1: 10^ISCALE/Unchanged
-* fp2: 10^LEN/Unchanged
-* F_SCR1:x/Work area for final result
-* F_SCR2:Y with original exponent/Unchanged
-* L_SCR1:original USER_FPCR/Unchanged
-* L_SCR2:first word of X packed/Unchanged
-
-A14_st:
- fmove.l #rz_mode,FPCR ;force rz for conversion
- fdiv.x fp2,fp0 ;divide abs(YINT) by 10^LEN
- lea.l FP_SCR1(a6),a0
- fmove.x fp0,(a0) ;move abs(YINT)/10^LEN to memory
- move.l 4(a0),d2 ;move 2nd word of FP_RES to d2
- move.l 8(a0),d3 ;move 3rd word of FP_RES to d3
- clr.l 4(a0) ;zero word 2 of FP_RES
- clr.l 8(a0) ;zero word 3 of FP_RES
- move.l (a0),d0 ;move exponent to d0
- swap d0 ;put exponent in lower word
- beq.b no_sft ;if zero, don't shift
- subi.l #$3ffd,d0 ;sub bias less 2 to make fract
- tst.l d0 ;check if > 1
- bgt.b no_sft ;if so, don't shift
- neg.l d0 ;make exp positive
-m_loop:
- lsr.l #1,d2 ;shift d2:d3 right, add 0s
- roxr.l #1,d3 ;the number of places
- dbf.w d0,m_loop ;given in d0
-no_sft:
- tst.l d2 ;check for mantissa of zero
- bne.b no_zr ;if not, go on
- tst.l d3 ;continue zero check
- beq.b zer_m ;if zero, go directly to binstr
-no_zr:
- clr.l d1 ;put zero in d1 for addx
- addi.l #$00000080,d3 ;inc at bit 7
- addx.l d1,d2 ;continue inc
- andi.l #$ffffff80,d3 ;strip off lsb not used by 882
-zer_m:
- move.l d4,d0 ;put LEN in d0 for binstr call
- addq.l #3,a0 ;a0 points to M16 byte in result
- bsr binstr ;call binstr to convert mant
-
-
-* A15. Convert the exponent to bcd.
-* As in A14 above, the exp is converted to bcd and the
-* digits are stored in the final string.
-*
-* Digits are stored in L_SCR1(a6) on return from BINDEC as:
-*
-* 32 16 15 0
-* -----------------------------------------
-* | 0 | e3 | e2 | e1 | e4 | X | X | X |
-* -----------------------------------------
-*
-* And are moved into their proper places in FP_SCR1. If digit e4
-* is non-zero, OPERR is signaled. In all cases, all 4 digits are
-* written as specified in the 881/882 manual for packed decimal.
-*
-* Register usage:
-* Input/Output
-* d0: x/LEN call to binstr - final is 0
-* d1: x/scratch (0);shift count for final exponent packing
-* d2: x/ms 32-bits of exp fraction/scratch
-* d3: x/ls 32-bits of exp fraction
-* d4: LEN/Unchanged
-* d5: ICTR:LAMBDA/LAMBDA:ICTR
-* d6: ILOG
-* d7: k-factor/Unchanged
-* a0: ptr to result string/ptr to L_SCR1(a6)
-* a1: ptr to PTENxx array/Unchanged
-* a2: ptr to FP_SCR2(a6)/Unchanged
-* fp0: abs(YINT) adjusted/float(ILOG)
-* fp1: 10^ISCALE/Unchanged
-* fp2: 10^LEN/Unchanged
-* F_SCR1:Work area for final result/BCD result
-* F_SCR2:Y with original exponent/ILOG/10^4
-* L_SCR1:original USER_FPCR/Exponent digits on return from binstr
-* L_SCR2:first word of X packed/Unchanged
-
-A15_st:
- tst.b BINDEC_FLG(a6) ;check for denorm
- beq.b not_denorm
- ftst.x fp0 ;test for zero
- fbeq.w den_zero ;if zero, use k-factor or 4933
- fmove.l d6,fp0 ;float ILOG
- fabs.x fp0 ;get abs of ILOG
- bra.b convrt
-den_zero:
- tst.l d7 ;check sign of the k-factor
- blt.b use_ilog ;if negative, use ILOG
- fmove.s F4933,fp0 ;force exponent to 4933
- bra.b convrt ;do it
-use_ilog:
- fmove.l d6,fp0 ;float ILOG
- fabs.x fp0 ;get abs of ILOG
- bra.b convrt
-not_denorm:
- ftst.x fp0 ;test for zero
- fbne.w not_zero ;if zero, force exponent
- fmove.s FONE,fp0 ;force exponent to 1
- bra.b convrt ;do it
-not_zero:
- fmove.l d6,fp0 ;float ILOG
- fabs.x fp0 ;get abs of ILOG
-convrt:
- fdiv.x 24(a1),fp0 ;compute ILOG/10^4
- fmove.x fp0,FP_SCR2(a6) ;store fp0 in memory
- move.l 4(a2),d2 ;move word 2 to d2
- move.l 8(a2),d3 ;move word 3 to d3
- move.w (a2),d0 ;move exp to d0
- beq.b x_loop_fin ;if zero, skip the shift
- subi.w #$3ffd,d0 ;subtract off bias
- neg.w d0 ;make exp positive
-x_loop:
- lsr.l #1,d2 ;shift d2:d3 right
- roxr.l #1,d3 ;the number of places
- dbf.w d0,x_loop ;given in d0
-x_loop_fin:
- clr.l d1 ;put zero in d1 for addx
- addi.l #$00000080,d3 ;inc at bit 6
- addx.l d1,d2 ;continue inc
- andi.l #$ffffff80,d3 ;strip off lsb not used by 882
- move.l #4,d0 ;put 4 in d0 for binstr call
- lea.l L_SCR1(a6),a0 ;a0 is ptr to L_SCR1 for exp digits
- bsr binstr ;call binstr to convert exp
- move.l L_SCR1(a6),d0 ;load L_SCR1 lword to d0
- move.l #12,d1 ;use d1 for shift count
- lsr.l d1,d0 ;shift d0 right by 12
- bfins d0,FP_SCR1(a6){4:12} ;put e3:e2:e1 in FP_SCR1
- lsr.l d1,d0 ;shift d0 right by 12
- bfins d0,FP_SCR1(a6){16:4} ;put e4 in FP_SCR1
- tst.b d0 ;check if e4 is zero
- beq.b A16_st ;if zero, skip rest
- or.l #opaop_mask,USER_FPSR(a6) ;set OPERR & AIOP in USER_FPSR
-
-
-* A16. Write sign bits to final string.
-* Sigma is bit 31 of initial value; RHO is bit 31 of d6 (ILOG).
-*
-* Register usage:
-* Input/Output
-* d0: x/scratch - final is x
-* d2: x/x
-* d3: x/x
-* d4: LEN/Unchanged
-* d5: ICTR:LAMBDA/LAMBDA:ICTR
-* d6: ILOG/ILOG adjusted
-* d7: k-factor/Unchanged
-* a0: ptr to L_SCR1(a6)/Unchanged
-* a1: ptr to PTENxx array/Unchanged
-* a2: ptr to FP_SCR2(a6)/Unchanged
-* fp0: float(ILOG)/Unchanged
-* fp1: 10^ISCALE/Unchanged
-* fp2: 10^LEN/Unchanged
-* F_SCR1:BCD result with correct signs
-* F_SCR2:ILOG/10^4
-* L_SCR1:Exponent digits on return from binstr
-* L_SCR2:first word of X packed/Unchanged
-
-A16_st:
- clr.l d0 ;clr d0 for collection of signs
- andi.b #$0f,FP_SCR1(a6) ;clear first nibble of FP_SCR1
- tst.l L_SCR2(a6) ;check sign of original mantissa
- bge.b mant_p ;if pos, don't set SM
- moveq.l #2,d0 ;move 2 in to d0 for SM
-mant_p:
- tst.l d6 ;check sign of ILOG
- bge.b wr_sgn ;if pos, don't set SE
- addq.l #1,d0 ;set bit 0 in d0 for SE
-wr_sgn:
- bfins d0,FP_SCR1(a6){0:2} ;insert SM and SE into FP_SCR1
-
-* Clean up and restore all registers used.
-
- fmove.l #0,FPSR ;clear possible inex2/ainex bits
- fmovem.x (a7)+,fp0-fp2
- movem.l (a7)+,d2-d7/a2
- rts
-
- end
diff --git a/sys/arch/m68k/fpsp/binstr.sa b/sys/arch/m68k/fpsp/binstr.sa
deleted file mode 100644
index dd03cca7083..00000000000
--- a/sys/arch/m68k/fpsp/binstr.sa
+++ /dev/null
@@ -1,166 +0,0 @@
-* $OpenBSD: binstr.sa,v 1.2 1996/05/29 21:05:25 niklas Exp $
-* $NetBSD: binstr.sa,v 1.3 1994/10/26 07:48:53 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* binstr.sa 3.3 12/19/90
-*
-*
-* Description: Converts a 64-bit binary integer to bcd.
-*
-* Input: 64-bit binary integer in d2:d3, desired length (LEN) in
-* d0, and a pointer to start in memory for bcd characters
-* in d0. (This pointer must point to byte 4 of the first
-* lword of the packed decimal memory string.)
-*
-* Output: LEN bcd digits representing the 64-bit integer.
-*
-* Algorithm:
-* The 64-bit binary is assumed to have a decimal point before
-* bit 63. The fraction is multiplied by 10 using a mul by 2
-* shift and a mul by 8 shift. The bits shifted out of the
-* msb form a decimal digit. This process is iterated until
-* LEN digits are formed.
-*
-* A1. Init d7 to 1. D7 is the byte digit counter, and if 1, the
-* digit formed will be assumed the least significant. This is
-* to force the first byte formed to have a 0 in the upper 4 bits.
-*
-* A2. Beginning of the loop:
-* Copy the fraction in d2:d3 to d4:d5.
-*
-* A3. Multiply the fraction in d2:d3 by 8 using bit-field
-* extracts and shifts. The three msbs from d2 will go into
-* d1.
-*
-* A4. Multiply the fraction in d4:d5 by 2 using shifts. The msb
-* will be collected by the carry.
-*
-* A5. Add using the carry the 64-bit quantities in d2:d3 and d4:d5
-* into d2:d3. D1 will contain the bcd digit formed.
-*
-* A6. Test d7. If zero, the digit formed is the ms digit. If non-
-* zero, it is the ls digit. Put the digit in its place in the
-* upper word of d0. If it is the ls digit, write the word
-* from d0 to memory.
-*
-* A7. Decrement d6 (LEN counter) and repeat the loop until zero.
-*
-* Implementation Notes:
-*
-* The registers are used as follows:
-*
-* d0: LEN counter
-* d1: temp used to form the digit
-* d2: upper 32-bits of fraction for mul by 8
-* d3: lower 32-bits of fraction for mul by 8
-* d4: upper 32-bits of fraction for mul by 2
-* d5: lower 32-bits of fraction for mul by 2
-* d6: temp for bit-field extracts
-* d7: byte digit formation word;digit count {0,1}
-* a0: pointer into memory for packed bcd string formation
-*
-
-BINSTR IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
- xdef binstr
-binstr:
- movem.l d0-d7,-(a7)
-*
-* A1: Init d7
-*
- moveq.l #1,d7 ;init d7 for second digit
- subq.l #1,d0 ;for dbf d0 would have LEN+1 passes
-*
-* A2. Copy d2:d3 to d4:d5. Start loop.
-*
-loop:
- move.l d2,d4 ;copy the fraction before muls
- move.l d3,d5 ;to d4:d5
-*
-* A3. Multiply d2:d3 by 8; extract msbs into d1.
-*
- bfextu d2{0:3},d1 ;copy 3 msbs of d2 into d1
- asl.l #3,d2 ;shift d2 left by 3 places
- bfextu d3{0:3},d6 ;copy 3 msbs of d3 into d6
- asl.l #3,d3 ;shift d3 left by 3 places
- or.l d6,d2 ;or in msbs from d3 into d2
-*
-* A4. Multiply d4:d5 by 2; add carry out to d1.
-*
- add.l d5,d5 ;mul d5 by 2
- addx.l d4,d4 ;mul d4 by 2
- swap d6 ;put 0 in d6 lower word
- addx.w d6,d1 ;add in extend from mul by 2
-*
-* A5. Add mul by 8 to mul by 2. D1 contains the digit formed.
-*
- add.l d5,d3 ;add lower 32 bits
- nop ;ERRATA FIX #13 (Rev. 1.2 6/6/90)
- addx.l d4,d2 ;add with extend upper 32 bits
- nop ;ERRATA FIX #13 (Rev. 1.2 6/6/90)
- addx.w d6,d1 ;add in extend from add to d1
- swap d6 ;with d6 = 0; put 0 in upper word
-*
-* A6. Test d7 and branch.
-*
- tst.w d7 ;if zero, store digit & to loop
- beq.b first_d ;if non-zero, form byte & write
-sec_d:
- swap d7 ;bring first digit to word d7b
- asl.w #4,d7 ;first digit in upper 4 bits d7b
- add.w d1,d7 ;add in ls digit to d7b
- move.b d7,(a0)+ ;store d7b byte in memory
- swap d7 ;put LEN counter in word d7a
- clr.w d7 ;set d7a to signal no digits done
- dbf.w d0,loop ;do loop some more!
- bra.b end_bstr ;finished, so exit
-first_d:
- swap d7 ;put digit word in d7b
- move.w d1,d7 ;put new digit in d7b
- swap d7 ;put LEN counter in word d7a
- addq.w #1,d7 ;set d7a to signal first digit done
- dbf.w d0,loop ;do loop some more!
- swap d7 ;put last digit in string
- lsl.w #4,d7 ;move it to upper 4 bits
- move.b d7,(a0)+ ;store it in memory string
-*
-* Clean up and return with result in fp0.
-*
-end_bstr:
- movem.l (a7)+,d0-d7
- rts
- end
diff --git a/sys/arch/m68k/fpsp/bugfix.sa b/sys/arch/m68k/fpsp/bugfix.sa
deleted file mode 100644
index f0cc5ee30dc..00000000000
--- a/sys/arch/m68k/fpsp/bugfix.sa
+++ /dev/null
@@ -1,521 +0,0 @@
-* $OpenBSD: bugfix.sa,v 1.2 1996/05/29 21:05:26 niklas Exp $
-* $NetBSD: bugfix.sa,v 1.3 1994/10/26 07:48:55 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* bugfix.sa 3.2 1/31/91
-*
-*
-* This file contains workarounds for bugs in the 040
-* relating to the Floating-Point Software Package (FPSP)
-*
-* Fixes for bugs: 1238
-*
-* Bug: 1238
-*
-*
-* /* The following dirty_bit clear should be left in
-* * the handler permanently to improve throughput.
-* * The dirty_bits are located at bits [23:16] in
-* * longword $08 in the busy frame $4x60. Bit 16
-* * corresponds to FP0, bit 17 corresponds to FP1,
-* * and so on.
-* */
-* if (E3_exception_just_serviced) {
-* dirty_bit[cmdreg3b[9:7]] = 0;
-* }
-*
-* if (fsave_format_version != $40) {goto NOFIX}
-*
-* if !(E3_exception_just_serviced) {goto NOFIX}
-* if (cupc == 0000000) {goto NOFIX}
-* if ((cmdreg1b[15:13] != 000) &&
-* (cmdreg1b[15:10] != 010001)) {goto NOFIX}
-* if (((cmdreg1b[15:13] != 000) || ((cmdreg1b[12:10] != cmdreg2b[9:7]) &&
-* (cmdreg1b[12:10] != cmdreg3b[9:7])) ) &&
-* ((cmdreg1b[ 9: 7] != cmdreg2b[9:7]) &&
-* (cmdreg1b[ 9: 7] != cmdreg3b[9:7])) ) {goto NOFIX}
-*
-* /* Note: for 6d43b or 8d43b, you may want to add the following code
-* * to get better coverage. (If you do not insert this code, the part
-* * won't lock up; it will simply get the wrong answer.)
-* * Do NOT insert this code for 10d43b or later parts.
-* *
-* * if (fpiarcu == integer stack return address) {
-* * cupc = 0000000;
-* * goto NOFIX;
-* * }
-* */
-*
-* if (cmdreg1b[15:13] != 000) {goto FIX_OPCLASS2}
-* FIX_OPCLASS0:
-* if (((cmdreg1b[12:10] == cmdreg2b[9:7]) ||
-* (cmdreg1b[ 9: 7] == cmdreg2b[9:7])) &&
-* (cmdreg1b[12:10] != cmdreg3b[9:7]) &&
-* (cmdreg1b[ 9: 7] != cmdreg3b[9:7])) { /* xu conflict only */
-* /* We execute the following code if there is an
-* xu conflict and NOT an nu conflict */
-*
-* /* first save some values on the fsave frame */
-* stag_temp = STAG[fsave_frame];
-* cmdreg1b_temp = CMDREG1B[fsave_frame];
-* dtag_temp = DTAG[fsave_frame];
-* ete15_temp = ETE15[fsave_frame];
-*
-* CUPC[fsave_frame] = 0000000;
-* FRESTORE
-* FSAVE
-*
-* /* If the xu instruction is exceptional, we punt.
-* * Otherwise, we would have to include OVFL/UNFL handler
-* * code here to get the correct answer.
-* */
-* if (fsave_frame_format == $4060) {goto KILL_PROCESS}
-*
-* fsave_frame = /* build a long frame of all zeros */
-* fsave_frame_format = $4060; /* label it as long frame */
-*
-* /* load it with the temps we saved */
-* STAG[fsave_frame] = stag_temp;
-* CMDREG1B[fsave_frame] = cmdreg1b_temp;
-* DTAG[fsave_frame] = dtag_temp;
-* ETE15[fsave_frame] = ete15_temp;
-*
-* /* Make sure that the cmdreg3b dest reg is not going to
-* * be destroyed by a FMOVEM at the end of all this code.
-* * If it is, you should move the current value of the reg
-* * onto the stack so that the reg will loaded with that value.
-* */
-*
-* /* All done. Proceed with the code below */
-* }
-*
-* etemp = FP_reg_[cmdreg1b[12:10]];
-* ete15 = ~ete14;
-* cmdreg1b[15:10] = 010010;
-* clear(bug_flag_procIDxxxx);
-* FRESTORE and return;
-*
-*
-* FIX_OPCLASS2:
-* if ((cmdreg1b[9:7] == cmdreg2b[9:7]) &&
-* (cmdreg1b[9:7] != cmdreg3b[9:7])) { /* xu conflict only */
-* /* We execute the following code if there is an
-* xu conflict and NOT an nu conflict */
-*
-* /* first save some values on the fsave frame */
-* stag_temp = STAG[fsave_frame];
-* cmdreg1b_temp = CMDREG1B[fsave_frame];
-* dtag_temp = DTAG[fsave_frame];
-* ete15_temp = ETE15[fsave_frame];
-* etemp_temp = ETEMP[fsave_frame];
-*
-* CUPC[fsave_frame] = 0000000;
-* FRESTORE
-* FSAVE
-*
-*
-* /* If the xu instruction is exceptional, we punt.
-* * Otherwise, we would have to include OVFL/UNFL handler
-* * code here to get the correct answer.
-* */
-* if (fsave_frame_format == $4060) {goto KILL_PROCESS}
-*
-* fsave_frame = /* build a long frame of all zeros */
-* fsave_frame_format = $4060; /* label it as long frame */
-*
-* /* load it with the temps we saved */
-* STAG[fsave_frame] = stag_temp;
-* CMDREG1B[fsave_frame] = cmdreg1b_temp;
-* DTAG[fsave_frame] = dtag_temp;
-* ETE15[fsave_frame] = ete15_temp;
-* ETEMP[fsave_frame] = etemp_temp;
-*
-* /* Make sure that the cmdreg3b dest reg is not going to
-* * be destroyed by a FMOVEM at the end of all this code.
-* * If it is, you should move the current value of the reg
-* * onto the stack so that the reg will loaded with that value.
-* */
-*
-* /* All done. Proceed with the code below */
-* }
-*
-* if (etemp_exponent == min_sgl) etemp_exponent = min_dbl;
-* if (etemp_exponent == max_sgl) etemp_exponent = max_dbl;
-* cmdreg1b[15:10] = 010101;
-* clear(bug_flag_procIDxxxx);
-* FRESTORE and return;
-*
-*
-* NOFIX:
-* clear(bug_flag_procIDxxxx);
-* FRESTORE and return;
-*
-
-BUGFIX IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
- xref fpsp_fmt_error
-
- xdef b1238_fix
-b1238_fix:
-*
-* This code is entered only on completion of the handling of an
-* nu-generated ovfl, unfl, or inex exception. If the version
-* number of the fsave is not $40, this handler is not necessary.
-* Simply branch to fix_done and exit normally.
-*
- cmpi.b #VER_40,4(a7)
- bne.w fix_done
-*
-* Test for cu_savepc equal to zero. If not, this is not a bug
-* #1238 case.
-*
- move.b CU_SAVEPC(a6),d0
- andi.b #$FE,d0
- beq fix_done ;if zero, this is not bug #1238
-
-*
-* Test the register conflict aspect. If opclass0, check for
-* cu src equal to xu dest or equal to nu dest. If so, go to
-* op0. Else, or if opclass2, check for cu dest equal to
-* xu dest or equal to nu dest. If so, go to tst_opcl. Else,
-* exit, it is not the bug case.
-*
-* Check for opclass 0. If not, go and check for opclass 2 and sgl.
-*
- move.w CMDREG1B(a6),d0
- andi.w #$E000,d0 ;strip all but opclass
- bne op2sgl ;not opclass 0, check op2
-*
-* Check for cu and nu register conflict. If one exists, this takes
-* priority over a cu and xu conflict.
-*
- bfextu CMDREG1B(a6){3:3},d0 ;get 1st src
- bfextu CMDREG3B(a6){6:3},d1 ;get 3rd dest
- cmp.b d0,d1
- beq.b op0 ;if equal, continue bugfix
-*
-* Check for cu dest equal to nu dest. If so, go and fix the
-* bug condition. Otherwise, exit.
-*
- bfextu CMDREG1B(a6){6:3},d0 ;get 1st dest
- cmp.b d0,d1 ;cmp 1st dest with 3rd dest
- beq.b op0 ;if equal, continue bugfix
-*
-* Check for cu and xu register conflict.
-*
- bfextu CMDREG2B(a6){6:3},d1 ;get 2nd dest
- cmp.b d0,d1 ;cmp 1st dest with 2nd dest
- beq.b op0_xu ;if equal, continue bugfix
- bfextu CMDREG1B(a6){3:3},d0 ;get 1st src
- cmp.b d0,d1 ;cmp 1st src with 2nd dest
- beq op0_xu
- bne fix_done ;if the reg checks fail, exit
-*
-* We have the opclass 0 situation.
-*
-op0:
- bfextu CMDREG1B(a6){3:3},d0 ;get source register no
- move.l #7,d1
- sub.l d0,d1
- clr.l d0
- bset.l d1,d0
- fmovem.x d0,ETEMP(a6) ;load source to ETEMP
-
- move.b #$12,d0
- bfins d0,CMDREG1B(a6){0:6} ;opclass 2, extended
-*
-* Set ETEMP exponent bit 15 as the opposite of ete14
-*
- btst #6,ETEMP_EX(a6) ;check etemp exponent bit 14
- beq setete15
- bclr #etemp15_bit,STAG(a6)
- bra finish
-setete15:
- bset #etemp15_bit,STAG(a6)
- bra finish
-
-*
-* We have the case in which a conflict exists between the cu src or
-* dest and the dest of the xu. We must clear the instruction in
-* the cu and restore the state, allowing the instruction in the
-* xu to complete. Remember, the instruction in the nu
-* was exceptional, and was completed by the appropriate handler.
-* If the result of the xu instruction is not exceptional, we can
-* restore the instruction from the cu to the frame and continue
-* processing the original exception. If the result is also
-* exceptional, we choose to kill the process.
-*
-* Items saved from the stack:
-*
-* $3c stag - L_SCR1
-* $40 cmdreg1b - L_SCR2
-* $44 dtag - L_SCR3
-*
-* The cu savepc is set to zero, and the frame is restored to the
-* fpu.
-*
-op0_xu:
- move.l STAG(a6),L_SCR1(a6)
- move.l CMDREG1B(a6),L_SCR2(a6)
- move.l DTAG(a6),L_SCR3(a6)
- andi.l #$e0000000,L_SCR3(a6)
- clr.b CU_SAVEPC(a6)
- move.l (a7)+,d1 ;save return address from bsr
- frestore (a7)+
- fsave -(a7)
-*
-* Check if the instruction which just completed was exceptional.
-*
- cmp.w #$4060,(a7)
- beq op0_xb
-*
-* It is necessary to isolate the result of the instruction in the
-* xu if it is to fp0 - fp3 and write that value to the USER_FPn
-* locations on the stack. The correct destination register is in
-* cmdreg2b.
-*
- bfextu CMDREG2B(a6){6:3},d0 ;get dest register no
- cmpi.l #3,d0
- bgt.b op0_xi
- beq.b op0_fp3
- cmpi.l #1,d0
- blt.b op0_fp0
- beq.b op0_fp1
-op0_fp2:
- fmovem.x fp2,USER_FP2(a6)
- bra.b op0_xi
-op0_fp1:
- fmovem.x fp1,USER_FP1(a6)
- bra.b op0_xi
-op0_fp0:
- fmovem.x fp0,USER_FP0(a6)
- bra.b op0_xi
-op0_fp3:
- fmovem.x fp3,USER_FP3(a6)
-*
-* The frame returned is idle. We must build a busy frame to hold
-* the cu state information and setup etemp.
-*
-op0_xi:
- move.l #22,d0 ;clear 23 lwords
- clr.l (a7)
-op0_loop:
- clr.l -(a7)
- dbf d0,op0_loop
- move.l #$40600000,-(a7)
- move.l L_SCR1(a6),STAG(a6)
- move.l L_SCR2(a6),CMDREG1B(a6)
- move.l L_SCR3(a6),DTAG(a6)
- move.b #$6,CU_SAVEPC(a6)
- move.l d1,-(a7) ;return bsr return address
- bfextu CMDREG1B(a6){3:3},d0 ;get source register no
- move.l #7,d1
- sub.l d0,d1
- clr.l d0
- bset.l d1,d0
- fmovem.x d0,ETEMP(a6) ;load source to ETEMP
-
- move.b #$12,d0
- bfins d0,CMDREG1B(a6){0:6} ;opclass 2, extended
-*
-* Set ETEMP exponent bit 15 as the opposite of ete14
-*
- btst #6,ETEMP_EX(a6) ;check etemp exponent bit 14
- beq op0_sete15
- bclr #etemp15_bit,STAG(a6)
- bra finish
-op0_sete15:
- bset #etemp15_bit,STAG(a6)
- bra finish
-
-*
-* The frame returned is busy. It is not possible to reconstruct
-* the code sequence to allow completion. We will jump to
-* fpsp_fmt_error and allow the kernel to kill the process.
-*
-op0_xb:
- jmp fpsp_fmt_error
-
-*
-* Check for opclass 2 and single size. If not both, exit.
-*
-op2sgl:
- move.w CMDREG1B(a6),d0
- andi.w #$FC00,d0 ;strip all but opclass and size
- cmpi.w #$4400,d0 ;test for opclass 2 and size=sgl
- bne fix_done ;if not, it is not bug 1238
-*
-* Check for cu dest equal to nu dest or equal to xu dest, with
-* a cu and nu conflict taking priority an nu conflict. If either,
-* go and fix the bug condition. Otherwise, exit.
-*
- bfextu CMDREG1B(a6){6:3},d0 ;get 1st dest
- bfextu CMDREG3B(a6){6:3},d1 ;get 3rd dest
- cmp.b d0,d1 ;cmp 1st dest with 3rd dest
- beq op2_com ;if equal, continue bugfix
- bfextu CMDREG2B(a6){6:3},d1 ;get 2nd dest
- cmp.b d0,d1 ;cmp 1st dest with 2nd dest
- bne fix_done ;if the reg checks fail, exit
-*
-* We have the case in which a conflict exists between the cu src or
-* dest and the dest of the xu. We must clear the instruction in
-* the cu and restore the state, allowing the instruction in the
-* xu to complete. Remember, the instruction in the nu
-* was exceptional, and was completed by the appropriate handler.
-* If the result of the xu instruction is not exceptional, we can
-* restore the instruction from the cu to the frame and continue
-* processing the original exception. If the result is also
-* exceptional, we choose to kill the process.
-*
-* Items saved from the stack:
-*
-* $3c stag - L_SCR1
-* $40 cmdreg1b - L_SCR2
-* $44 dtag - L_SCR3
-* etemp - FP_SCR2
-*
-* The cu savepc is set to zero, and the frame is restored to the
-* fpu.
-*
-op2_xu:
- move.l STAG(a6),L_SCR1(a6)
- move.l CMDREG1B(a6),L_SCR2(a6)
- move.l DTAG(a6),L_SCR3(a6)
- andi.l #$e0000000,L_SCR3(a6)
- clr.b CU_SAVEPC(a6)
- move.l ETEMP(a6),FP_SCR2(a6)
- move.l ETEMP_HI(a6),FP_SCR2+4(a6)
- move.l ETEMP_LO(a6),FP_SCR2+8(a6)
- move.l (a7)+,d1 ;save return address from bsr
- frestore (a7)+
- fsave -(a7)
-*
-* Check if the instruction which just completed was exceptional.
-*
- cmp.w #$4060,(a7)
- beq op2_xb
-*
-* It is necessary to isolate the result of the instruction in the
-* xu if it is to fp0 - fp3 and write that value to the USER_FPn
-* locations on the stack. The correct destination register is in
-* cmdreg2b.
-*
- bfextu CMDREG2B(a6){6:3},d0 ;get dest register no
- cmpi.l #3,d0
- bgt.b op2_xi
- beq.b op2_fp3
- cmpi.l #1,d0
- blt.b op2_fp0
- beq.b op2_fp1
-op2_fp2:
- fmovem.x fp2,USER_FP2(a6)
- bra.b op2_xi
-op2_fp1:
- fmovem.x fp1,USER_FP1(a6)
- bra.b op2_xi
-op2_fp0:
- fmovem.x fp0,USER_FP0(a6)
- bra.b op2_xi
-op2_fp3:
- fmovem.x fp3,USER_FP3(a6)
-*
-* The frame returned is idle. We must build a busy frame to hold
-* the cu state information and fix up etemp.
-*
-op2_xi:
- move.l #22,d0 ;clear 23 lwords
- clr.l (a7)
-op2_loop:
- clr.l -(a7)
- dbf d0,op2_loop
- move.l #$40600000,-(a7)
- move.l L_SCR1(a6),STAG(a6)
- move.l L_SCR2(a6),CMDREG1B(a6)
- move.l L_SCR3(a6),DTAG(a6)
- move.b #$6,CU_SAVEPC(a6)
- move.l FP_SCR2(a6),ETEMP(a6)
- move.l FP_SCR2+4(a6),ETEMP_HI(a6)
- move.l FP_SCR2+8(a6),ETEMP_LO(a6)
- move.l d1,-(a7)
- bra op2_com
-
-*
-* We have the opclass 2 single source situation.
-*
-op2_com:
- move.b #$15,d0
- bfins d0,CMDREG1B(a6){0:6} ;opclass 2, double
-
- cmp.w #$407F,ETEMP_EX(a6) ;single +max
- bne.b case2
- move.w #$43FF,ETEMP_EX(a6) ;to double +max
- bra finish
-case2:
- cmp.w #$C07F,ETEMP_EX(a6) ;single -max
- bne.b case3
- move.w #$C3FF,ETEMP_EX(a6) ;to double -max
- bra finish
-case3:
- cmp.w #$3F80,ETEMP_EX(a6) ;single +min
- bne.b case4
- move.w #$3C00,ETEMP_EX(a6) ;to double +min
- bra finish
-case4:
- cmp.w #$BF80,ETEMP_EX(a6) ;single -min
- bne fix_done
- move.w #$BC00,ETEMP_EX(a6) ;to double -min
- bra finish
-*
-* The frame returned is busy. It is not possible to reconstruct
-* the code sequence to allow completion. fpsp_fmt_error causes
-* an fline illegal instruction to be executed.
-*
-* You should replace the jump to fpsp_fmt_error with a jump
-* to the entry point used to kill a process.
-*
-op2_xb:
- jmp fpsp_fmt_error
-
-*
-* Enter here if the case is not of the situations affected by
-* bug #1238, or if the fix is completed, and exit.
-*
-finish:
-fix_done:
- rts
-
- end
diff --git a/sys/arch/m68k/fpsp/copyright.s b/sys/arch/m68k/fpsp/copyright.s
deleted file mode 100644
index c23e1b6bbf7..00000000000
--- a/sys/arch/m68k/fpsp/copyright.s
+++ /dev/null
@@ -1,33 +0,0 @@
-| $OpenBSD: copyright.s,v 1.2 1996/05/29 21:05:26 niklas Exp $
-| $NetBSD: copyright.s,v 1.2 1994/10/26 07:48:57 cgd Exp $
-
-.text
-.ascii "MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP\n"
-.ascii "M68000 Hi-Performance Microprocessor Division\n"
-.ascii "M68040 Software Package\n"
-.ascii "\n"
-.ascii "M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.\n"
-.ascii "All rights reserved.\n"
-.ascii "\n"
-.ascii "THE SOFTWARE is provided on an \"AS IS\" basis and without warranty.\n"
-.ascii "To the maximum extent permitted by applicable law,\n"
-.ascii "MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,\n"
-.ascii "INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A\n"
-.ascii "PARTICULAR PURPOSE and any warranty against infringement with\n"
-.ascii "regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)\n"
-.ascii "and any accompanying written materials. \n"
-.ascii "\n"
-.ascii "To the maximum extent permitted by applicable law,\n"
-.ascii "IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER\n"
-.ascii "(INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS\n"
-.ascii "PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR\n"
-.ascii "OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE\n"
-.ascii "SOFTWARE. Motorola assumes no responsibility for the maintenance\n"
-.ascii "and support of the SOFTWARE. \n"
-.ascii "\n"
-.ascii "You are hereby granted a copyright license to use, modify, and\n"
-.ascii "distribute the SOFTWARE so long as this entire notice is retained\n"
-.ascii "without alteration in any modified and/or redistributed versions,\n"
-.ascii "and that such modified versions are clearly identified as such.\n"
-.ascii "No licenses are granted by implication, estoppel or otherwise\n"
-.ascii "under any patents or trademarks of Motorola, Inc.\n"
diff --git a/sys/arch/m68k/fpsp/decbin.sa b/sys/arch/m68k/fpsp/decbin.sa
deleted file mode 100644
index 40b57d6b1e4..00000000000
--- a/sys/arch/m68k/fpsp/decbin.sa
+++ /dev/null
@@ -1,535 +0,0 @@
-* $OpenBSD: decbin.sa,v 1.4 2013/02/02 13:32:05 miod Exp $
-* $NetBSD: decbin.sa,v 1.2 1994/10/26 07:48:59 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* decbin.sa 3.3 12/19/90
-*
-* Description: Converts normalized packed bcd value pointed to by
-* register A6 to extended-precision value in FP0.
-*
-* Input: Normalized packed bcd value in ETEMP(a6).
-*
-* Output: Exact floating-point representation of the packed bcd value.
-*
-* Saves and Modifies: D2-D5
-*
-* Speed: The program decbin takes ??? cycles to execute.
-*
-* Object Size:
-*
-* External Reference(s): None.
-*
-* Algorithm:
-* Expected is a normal bcd (i.e. non-exceptional; all inf, zero,
-* and NaN operands are dispatched without entering this routine)
-* value in 68881/882 format at location ETEMP(A6).
-*
-* A1. Convert the bcd exponent to binary by successive adds and muls.
-* Set the sign according to SE. Subtract 16 to compensate
-* for the mantissa which is to be interpreted as 17 integer
-* digits, rather than 1 integer and 16 fraction digits.
-* Note: this operation can never overflow.
-*
-* A2. Convert the bcd mantissa to binary by successive
-* adds and muls in FP0. Set the sign according to SM.
-* The mantissa digits will be converted with the decimal point
-* assumed following the least-significant digit.
-* Note: this operation can never overflow.
-*
-* A3. Count the number of leading/trailing zeros in the
-* bcd string. If SE is positive, count the leading zeros;
-* if negative, count the trailing zeros. Set the adjusted
-* exponent equal to the exponent from A1 and the zero count
-* added if SM = 1 and subtracted if SM = 0. Scale the
-* mantissa the equivalent of forcing in the bcd value:
-*
-* SM = 0 a non-zero digit in the integer position
-* SM = 1 a non-zero digit in Mant0, lsd of the fraction
-*
-* this will insure that any value, regardless of its
-* representation (ex. 0.1E2, 1E1, 10E0, 100E-1), is converted
-* consistently.
-*
-* A4. Calculate the factor 10^exp in FP1 using a table of
-* 10^(2^n) values. To reduce the error in forming factors
-* greater than 10^27, a directed rounding scheme is used with
-* tables rounded to RN, RM, and RP, according to the table
-* in the comments of the pwrten section.
-*
-* A5. Form the final binary number by scaling the mantissa by
-* the exponent factor. This is done by multiplying the
-* mantissa in FP0 by the factor in FP1 if the adjusted
-* exponent sign is positive, and dividing FP0 by FP1 if
-* it is negative.
-*
-* Clean up and return. Check if the final mul or div resulted
-* in an inex2 exception. If so, set inex1 in the fpsr and
-* check if the inex1 exception is enabled. If so, set d7 upper
-* word to $0100. This will signal unimp.sa that an enabled inex1
-* exception occurred. Unimp will fix the stack.
-*
-
-DECBIN IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
-*
-* PTENRN, PTENRM, and PTENRP are arrays of powers of 10 rounded
-* to nearest, minus, and plus, respectively. The tables include
-* 10**{1,2,4,8,16,32,64,128,256,512,1024,2048,4096}. No rounding
-* is required until the power is greater than 27, however, all
-* tables include the first 5 for ease of indexing.
-*
- xref PTENRN
- xref PTENRM
- xref PTENRP
-
-RTABLE dc.b 0,0,0,0
- dc.b 2,3,2,3
- dc.b 2,3,3,2
- dc.b 3,2,2,3
-
- xdef decbin
- xdef calc_e
- xdef pwrten
- xdef calc_m
- xdef norm
- xdef ap_st_z
- xdef ap_st_n
-*
-FNIBS equ 7
-FSTRT equ 0
-*
-ESTRT equ 4
-EDIGITS equ 2
-*
-* Constants in single precision
-FZERO dc.l $00000000
-FONE dc.l $3F800000
-FTEN dc.l $41200000
-
-TEN equ 10
-
-*
-decbin:
- fmove.l #0,FPCR ;clr real fpcr
- movem.l d2-d5,-(a7)
-*
-* Calculate exponent:
-* 1. Copy bcd value in memory for use as a working copy.
-* 2. Calculate absolute value of exponent in d1 by mul and add.
-* 3. Correct for exponent sign.
-* 4. Subtract 16 to compensate for interpreting the mant as all integer digits.
-* (i.e., all digits assumed left of the decimal point.)
-*
-* Register usage:
-*
-* calc_e:
-* (*) d0: temp digit storage
-* (*) d1: accumulator for binary exponent
-* (*) d2: digit count
-* (*) d3: offset pointer
-* ( ) d4: first word of bcd
-* ( ) a0: pointer to working bcd value
-* ( ) a6: pointer to original bcd value
-* (*) FP_SCR1: working copy of original bcd value
-* (*) L_SCR1: copy of original exponent word
-*
-calc_e:
- move.l #EDIGITS,d2 ;# of nibbles (digits) in fraction part
- moveq.l #ESTRT,d3 ;counter to pick up digits
- lea.l FP_SCR1(a6),a0 ;load tmp bcd storage address
- move.l ETEMP(a6),(a0) ;save input bcd value
- move.l ETEMP_HI(a6),4(a0) ;save words 2 and 3
- move.l ETEMP_LO(a6),8(a0) ;and work with these
- move.l (a0),d4 ;get first word of bcd
- clr.l d1 ;zero d1 for accumulator
-e_gd:
- mulu.l #TEN,d1 ;mul partial product by one digit place
- bfextu d4{d3:4},d0 ;get the digit and zero extend into d0
- add.l d0,d1 ;d1 = d1 + d0
- addq.b #4,d3 ;advance d3 to the next digit
- dbf.w d2,e_gd ;if we have used all 3 digits, exit loop
- btst #30,d4 ;get SE
- beq.b e_pos ;don't negate if pos
- neg.l d1 ;negate before subtracting
-e_pos:
- sub.l #16,d1 ;sub to compensate for shift of mant
- bge.b e_save ;if still pos, do not neg
- neg.l d1 ;now negative, make pos and set SE
- or.l #$40000000,d4 ;set SE in d4,
- or.l #$40000000,(a0) ;and in working bcd
-e_save:
- move.l d1,L_SCR1(a6) ;save exp in memory
-*
-*
-* Calculate mantissa:
-* 1. Calculate absolute value of mantissa in fp0 by mul and add.
-* 2. Correct for mantissa sign.
-* (i.e., all digits assumed left of the decimal point.)
-*
-* Register usage:
-*
-* calc_m:
-* (*) d0: temp digit storage
-* (*) d1: lword counter
-* (*) d2: digit count
-* (*) d3: offset pointer
-* ( ) d4: words 2 and 3 of bcd
-* ( ) a0: pointer to working bcd value
-* ( ) a6: pointer to original bcd value
-* (*) fp0: mantissa accumulator
-* ( ) FP_SCR1: working copy of original bcd value
-* ( ) L_SCR1: copy of original exponent word
-*
-calc_m:
- moveq.l #1,d1 ;word counter, init to 1
- fmove.s FZERO,fp0 ;accumulator
-*
-*
-* Since the packed number has a long word between the first & second parts,
-* get the integer digit then skip down & get the rest of the
-* mantissa. We will unroll the loop once.
-*
- bfextu (a0){28:4},d0 ;integer part is ls digit in long word
- fadd.b d0,fp0 ;add digit to sum in fp0
-*
-*
-* Get the rest of the mantissa.
-*
-loadlw:
- move.l (a0,d1.L*4),d4 ;load mantissa lonqword into d4
- moveq.l #FSTRT,d3 ;counter to pick up digits
- moveq.l #FNIBS,d2 ;reset number of digits per a0 ptr
-md2b:
- fmul.s FTEN,fp0 ;fp0 = fp0 * 10
- bfextu d4{d3:4},d0 ;get the digit and zero extend
- fadd.b d0,fp0 ;fp0 = fp0 + digit
-*
-*
-* If all the digits (8) in that long word have been converted (d2=0),
-* then inc d1 (=2) to point to the next long word and reset d3 to 0
-* to initialize the digit offset, and set d2 to 7 for the digit count;
-* else continue with this long word.
-*
- addq.b #4,d3 ;advance d3 to the next digit
- dbf.w d2,md2b ;check for last digit in this lw
-nextlw:
- addq.l #1,d1 ;inc lw pointer in mantissa
- cmp.l #2,d1 ;test for last lw
- ble loadlw ;if not, get last one
-
-*
-* Check the sign of the mant and make the value in fp0 the same sign.
-*
-m_sign:
- btst #31,(a0) ;test sign of the mantissa
- beq.b short_ap_st_z ;if clear, go to append/strip zeros
- fneg.x fp0 ;if set, negate fp0
-
-*
-* Append/strip zeros:
-*
-* For adjusted exponents which have an absolute value greater than 27*,
-* this routine calculates the amount needed to normalize the mantissa
-* for the adjusted exponent. That number is subtracted from the exp
-* if the exp was positive, and added if it was negative. The purpose
-* of this is to reduce the value of the exponent and the possibility
-* of error in calculation of pwrten.
-*
-* 1. Branch on the sign of the adjusted exponent.
-* 2p.(positive exp)
-* 2. Check M16 and the digits in lwords 2 and 3 in decending order.
-* 3. Add one for each zero encountered until a non-zero digit.
-* 4. Subtract the count from the exp.
-* 5. Check if the exp has crossed zero in #3 above; make the exp abs
-* and set SE.
-* 6. Multiply the mantissa by 10**count.
-* 2n.(negative exp)
-* 2. Check the digits in lwords 3 and 2 in decending order.
-* 3. Add one for each zero encountered until a non-zero digit.
-* 4. Add the count to the exp.
-* 5. Check if the exp has crossed zero in #3 above; clear SE.
-* 6. Divide the mantissa by 10**count.
-*
-* *Why 27? If the adjusted exponent is within -28 < expA < 28, than
-* any adjustment due to append/strip zeros will drive the resultane
-* exponent towards zero. Since all pwrten constants with a power
-* of 27 or less are exact, there is no need to use this routine to
-* attempt to lessen the resultant exponent.
-*
-* Register usage:
-*
-* ap_st_z:
-* (*) d0: temp digit storage
-* (*) d1: zero count
-* (*) d2: digit count
-* (*) d3: offset pointer
-* ( ) d4: first word of bcd
-* (*) d5: lword counter
-* ( ) a0: pointer to working bcd value
-* ( ) FP_SCR1: working copy of original bcd value
-* ( ) L_SCR1: copy of original exponent word
-*
-*
-* First check the absolute value of the exponent to see if this
-* routine is necessary. If so, then check the sign of the exponent
-* and do append (+) or strip (-) zeros accordingly.
-* This section handles a positive adjusted exponent.
-*
-ap_st_z:
-short_ap_st_z:
- move.l L_SCR1(a6),d1 ;load expA for range test
- cmp.l #27,d1 ;test is with 27
- ble.w pwrten ;if abs(expA) <28, skip ap/st zeros
- btst #30,(a0) ;check sign of exp
- bne.b short_ap_st_n ;if neg, go to neg side
- clr.l d1 ;zero count reg
- move.l (a0),d4 ;load lword 1 to d4
- bfextu d4{28:4},d0 ;get M16 in d0
- bne.b ap_p_fx ;if M16 is non-zero, go fix exp
- addq.l #1,d1 ;inc zero count
- moveq.l #1,d5 ;init lword counter
- move.l (a0,d5.L*4),d4 ;get lword 2 to d4
- bne.b ap_p_cl ;if lw 2 is zero, skip it
- addq.l #8,d1 ;and inc count by 8
- addq.l #1,d5 ;inc lword counter
- move.l (a0,d5.L*4),d4 ;get lword 3 to d4
-ap_p_cl:
- clr.l d3 ;init offset reg
- moveq.l #7,d2 ;init digit counter
-ap_p_gd:
- bfextu d4{d3:4},d0 ;get digit
- bne.b ap_p_fx ;if non-zero, go to fix exp
- addq.l #4,d3 ;point to next digit
- addq.l #1,d1 ;inc digit counter
- dbf.w d2,ap_p_gd ;get next digit
-ap_p_fx:
- move.l d1,d0 ;copy counter to d2
- move.l L_SCR1(a6),d1 ;get adjusted exp from memory
- sub.l d0,d1 ;subtract count from exp
- bge.b ap_p_fm ;if still pos, go to pwrten
- neg.l d1 ;now its neg; get abs
- move.l (a0),d4 ;load lword 1 to d4
- or.l #$40000000,d4 ; and set SE in d4
- or.l #$40000000,(a0) ; and in memory
-*
-* Calculate the mantissa multiplier to compensate for the striping of
-* zeros from the mantissa.
-*
-ap_p_fm:
- move.l #PTENRN,a1 ;get address of power-of-ten table
- clr.l d3 ;init table index
- fmove.s FONE,fp1 ;init fp1 to 1
- moveq.l #3,d2 ;init d2 to count bits in counter
-ap_p_el:
- asr.l #1,d0 ;shift lsb into carry
- bcc.b ap_p_en ;if 1, mul fp1 by pwrten factor
- fmul.x (a1,d3),fp1 ;mul by 10**(d3_bit_no)
-ap_p_en:
- add.l #12,d3 ;inc d3 to next rtable entry
- tst.l d0 ;check if d0 is zero
- bne.b ap_p_el ;if not, get next bit
- fmul.x fp1,fp0 ;mul mantissa by 10**(no_bits_shifted)
- bra.b short_pwrten ;go calc pwrten
-*
-* This section handles a negative adjusted exponent.
-*
-ap_st_n:
-short_ap_st_n:
- clr.l d1 ;clr counter
- moveq.l #2,d5 ;set up d5 to point to lword 3
- move.l (a0,d5.L*4),d4 ;get lword 3
- bne.b ap_n_cl ;if not zero, check digits
- sub.l #1,d5 ;dec d5 to point to lword 2
- addq.l #8,d1 ;inc counter by 8
- move.l (a0,d5.L*4),d4 ;get lword 2
-ap_n_cl:
- move.l #28,d3 ;point to last digit
- moveq.l #7,d2 ;init digit counter
-ap_n_gd:
- bfextu d4{d3:4},d0 ;get digit
- bne.b ap_n_fx ;if non-zero, go to exp fix
- subq.l #4,d3 ;point to previous digit
- addq.l #1,d1 ;inc digit counter
- dbf.w d2,ap_n_gd ;get next digit
-ap_n_fx:
- move.l d1,d0 ;copy counter to d0
- move.l L_SCR1(a6),d1 ;get adjusted exp from memory
- sub.l d0,d1 ;subtract count from exp
- bgt.b ap_n_fm ;if still pos, go fix mantissa
- neg.l d1 ;take abs of exp and clr SE
- move.l (a0),d4 ;load lword 1 to d4
- and.l #$bfffffff,d4 ; and clr SE in d4
- and.l #$bfffffff,(a0) ; and in memory
-*
-* Calculate the mantissa multiplier to compensate for the appending of
-* zeros to the mantissa.
-*
-ap_n_fm:
- move.l #PTENRN,a1 ;get address of power-of-ten table
- clr.l d3 ;init table index
- fmove.s FONE,fp1 ;init fp1 to 1
- moveq.l #3,d2 ;init d2 to count bits in counter
-ap_n_el:
- asr.l #1,d0 ;shift lsb into carry
- bcc.b ap_n_en ;if 1, mul fp1 by pwrten factor
- fmul.x (a1,d3),fp1 ;mul by 10**(d3_bit_no)
-ap_n_en:
- add.l #12,d3 ;inc d3 to next rtable entry
- tst.l d0 ;check if d0 is zero
- bne.b ap_n_el ;if not, get next bit
- fdiv.x fp1,fp0 ;div mantissa by 10**(no_bits_shifted)
-*
-*
-* Calculate power-of-ten factor from adjusted and shifted exponent.
-*
-* Register usage:
-*
-* pwrten:
-* (*) d0: temp
-* ( ) d1: exponent
-* (*) d2: {FPCR[6:5],SM,SE} as index in RTABLE; temp
-* (*) d3: FPCR work copy
-* ( ) d4: first word of bcd
-* (*) a1: RTABLE pointer
-* calc_p:
-* (*) d0: temp
-* ( ) d1: exponent
-* (*) d3: PWRTxx table index
-* ( ) a0: pointer to working copy of bcd
-* (*) a1: PWRTxx pointer
-* (*) fp1: power-of-ten accumulator
-*
-* Pwrten calculates the exponent factor in the selected rounding mode
-* according to the following table:
-*
-* Sign of Mant Sign of Exp Rounding Mode PWRTEN Rounding Mode
-*
-* ANY ANY RN RN
-*
-* + + RP RP
-* - + RP RM
-* + - RP RM
-* - - RP RP
-*
-* + + RM RM
-* - + RM RP
-* + - RM RP
-* - - RM RM
-*
-* + + RZ RM
-* - + RZ RM
-* + - RZ RP
-* - - RZ RP
-*
-*
-pwrten:
-short_pwrten:
- move.l USER_FPCR(a6),d3 ;get user's FPCR
- bfextu d3{26:2},d2 ;isolate rounding mode bits
- move.l (a0),d4 ;reload 1st bcd word to d4
- asl.l #2,d2 ;format d2 to be
- bfextu d4{0:2},d0 ; {FPCR[6],FPCR[5],SM,SE}
- add.l d0,d2 ;in d2 as index into RTABLE
- lea.l RTABLE,a1 ;load rtable base
- move.b (a1,d2),d0 ;load new rounding bits from table
- clr.l d3 ;clear d3 to force no exc and extended
- bfins d0,d3{26:2} ;stuff new rounding bits in FPCR
- fmove.l d3,FPCR ;write new FPCR
- asr.l #1,d0 ;write correct PTENxx table
- bcc.b not_rp ;to a1
- lea.l PTENRP,a1 ;it is RP
- bra.b calc_p ;go to init section
-not_rp:
- asr.l #1,d0 ;keep checking
- bcc.b not_rm
- lea.l PTENRM,a1 ;it is RM
- bra.b calc_p ;go to init section
-not_rm:
- lea.l PTENRN,a1 ;it is RN
-calc_p:
- move.l d1,d0 ;copy exp to d0;use d0
- bpl.b no_neg ;if exp is negative,
- neg.l d0 ;invert it
- or.l #$40000000,(a0) ;and set SE bit
-no_neg:
- clr.l d3 ;table index
- fmove.s FONE,fp1 ;init fp1 to 1
-e_loop:
- asr.l #1,d0 ;shift next bit into carry
- bcc.b e_next ;if zero, skip the mul
- fmul.x (a1,d3),fp1 ;mul by 10**(d3_bit_no)
-e_next:
- add.l #12,d3 ;inc d3 to next rtable entry
- tst.l d0 ;check if d0 is zero
- bne.b e_loop ;not zero, continue shifting
-*
-*
-* Check the sign of the adjusted exp and make the value in fp0 the
-* same sign. If the exp was pos then multiply fp1*fp0;
-* else divide fp0/fp1.
-*
-* Register Usage:
-* norm:
-* ( ) a0: pointer to working bcd value
-* (*) fp0: mantissa accumulator
-* ( ) fp1: scaling factor - 10**(abs(exp))
-*
-norm:
- btst #30,(a0) ;test the sign of the exponent
- beq.b mul ;if clear, go to multiply
-div:
- fdiv.x fp1,fp0 ;exp is negative, so divide mant by exp
- bra.b end_dec
-mul:
- fmul.x fp1,fp0 ;exp is positive, so multiply by exp
-*
-*
-* Clean up and return with result in fp0.
-*
-* If the final mul/div in decbin incurred an inex exception,
-* it will be inex2, but will be reported as inex1 by get_op.
-*
-end_dec:
- fmove.l FPSR,d0 ;get status register
- bclr.l #inex2_bit+8,d0 ;test for inex2 and clear it
- fmove.l d0,FPSR ;return status reg w/o inex2
- beq.b no_exc ;skip this if no exc
- or.l #inx1a_mask,USER_FPSR(a6) ;set inex1/ainex
-no_exc:
- movem.l (a7)+,d2-d5
- rts
- end
diff --git a/sys/arch/m68k/fpsp/do_func.sa b/sys/arch/m68k/fpsp/do_func.sa
deleted file mode 100644
index 4b637c5a8b6..00000000000
--- a/sys/arch/m68k/fpsp/do_func.sa
+++ /dev/null
@@ -1,586 +0,0 @@
-* $OpenBSD: do_func.sa,v 1.3 2013/02/02 13:32:05 miod Exp $
-* $NetBSD: do_func.sa,v 1.2 1994/10/26 07:49:02 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* do_func.sa 3.4 2/18/91
-*
-* Do_func performs the unimplemented operation. The operation
-* to be performed is determined from the lower 7 bits of the
-* extension word (except in the case of fmovecr and fsincos).
-* The opcode and tag bits form an index into a jump table in
-* tbldo.sa. Cases of zero, infinity and NaN are handled in
-* do_func by forcing the default result. Normalized and
-* denormalized (there are no unnormalized numbers at this
-* point) are passed onto the emulation code.
-*
-* CMDREG1B and STAG are extracted from the fsave frame
-* and combined to form the table index. The function called
-* will start with a0 pointing to the ETEMP operand. Dyadic
-* functions can find FPTEMP at -12(a0).
-*
-* Called functions return their result in fp0. Sincos returns
-* sin(x) in fp0 and cos(x) in fp1.
-*
-
-DO_FUNC IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
- xref t_dz2
- xref t_operr
- xref t_inx2
- xref t_resdnrm
- xref dst_nan
- xref src_nan
- xref nrm_set
- xref sto_cos
-
- xref tblpre
- xref slognp1,slogn,slog10,slog2
- xref slognd,slog10d,slog2d
- xref smod,srem
- xref sscale
- xref smovcr
-
-PONE dc.l $3fff0000,$80000000,$00000000 ;+1
-MONE dc.l $bfff0000,$80000000,$00000000 ;-1
-PZERO dc.l $00000000,$00000000,$00000000 ;+0
-MZERO dc.l $80000000,$00000000,$00000000 ;-0
-PINF dc.l $7fff0000,$00000000,$00000000 ;+inf
-MINF dc.l $ffff0000,$00000000,$00000000 ;-inf
-QNAN dc.l $7fff0000,$ffffffff,$ffffffff ;non-signaling nan
-PPIBY2 dc.l $3FFF0000,$C90FDAA2,$2168C235 ;+PI/2
-MPIBY2 dc.l $bFFF0000,$C90FDAA2,$2168C235 ;-PI/2
-
- xdef do_func
-do_func:
- clr.b CU_ONLY(a6)
-*
-* Check for fmovecr. It does not follow the format of fp gen
-* unimplemented instructions. The test is on the upper 6 bits;
-* if they are $17, the inst is fmovecr. Call entry smovcr
-* directly.
-*
- bfextu CMDREG1B(a6){0:6},d0 ;get opclass and src fields
- cmpi.l #$17,d0 ;if op class and size fields are $17,
-* ;it is FMOVECR; if not, continue
- bne.b not_fmovecr
- jmp smovcr ;fmovecr; jmp directly to emulation
-
-not_fmovecr:
- move.w CMDREG1B(a6),d0
- and.l #$7F,d0
- cmpi.l #$38,d0 ;if the extension is >= $38,
- bge.b short_serror ;it is illegal
- bfextu STAG(a6){0:3},d1
- lsl.l #3,d0 ;make room for STAG
- add.l d1,d0 ;combine for final index into table
- lea.l tblpre,a1 ;start of monster jump table
- move.l (a1,d0.w*4),a1 ;real target address
- lea.l ETEMP(a6),a0 ;a0 is pointer to src op
- move.l USER_FPCR(a6),d1
- and.l #$FF,d1 ; discard all but rounding mode/prec
- fmove.l #0,fpcr
- jmp (a1)
-*
-* ERROR
-*
- xdef serror
-serror:
-short_serror:
- st.b STORE_FLG(a6)
- rts
-*
-* These routines load forced values into fp0. They are called
-* by index into tbldo.
-*
-* Load a signed zero to fp0 and set inex2/ainex
-*
- xdef snzrinx
-snzrinx:
- btst.b #sign_bit,LOCAL_EX(a0) ;get sign of source operand
- bne.b ld_mzinx ;if negative, branch
- bsr ld_pzero ;bsr so we can return and set inx
- bra t_inx2 ;now, set the inx for the next inst
-ld_mzinx:
- bsr ld_mzero ;if neg, load neg zero, return here
- bra t_inx2 ;now, set the inx for the next inst
-*
-* Load a signed zero to fp0; do not set inex2/ainex
-*
- xdef szero
-szero:
- btst.b #sign_bit,LOCAL_EX(a0) ;get sign of source operand
- bne ld_mzero ;if neg, load neg zero
- bra ld_pzero ;load positive zero
-*
-* Load a signed infinity to fp0; do not set inex2/ainex
-*
- xdef sinf
-sinf:
- btst.b #sign_bit,LOCAL_EX(a0) ;get sign of source operand
- bne ld_minf ;if negative branch
- bra ld_pinf
-*
-* Load a signed one to fp0; do not set inex2/ainex
-*
- xdef sone
-sone:
- btst.b #sign_bit,LOCAL_EX(a0) ;check sign of source
- bne ld_mone
- bra ld_pone
-*
-* Load a signed pi/2 to fp0; do not set inex2/ainex
-*
- xdef spi_2
-spi_2:
- btst.b #sign_bit,LOCAL_EX(a0) ;check sign of source
- bne ld_mpi2
- bra ld_ppi2
-*
-* Load either a +0 or +inf for plus/minus operand
-*
- xdef szr_inf
-szr_inf:
- btst.b #sign_bit,LOCAL_EX(a0) ;check sign of source
- bne ld_pzero
- bra ld_pinf
-*
-* Result is either an operr or +inf for plus/minus operand
-* [Used by slogn, slognp1, slog10, and slog2]
-*
- xdef sopr_inf
-sopr_inf:
- btst.b #sign_bit,LOCAL_EX(a0) ;check sign of source
- bne t_operr
- bra ld_pinf
-*
-* FLOGNP1
-*
- xdef sslognp1
-sslognp1:
- fmovem.x (a0),fp0
- fcmp.b #-1,fp0
- fbgt slognp1
- fbeq t_dz2 ;if = -1, divide by zero exception
- fmove.l #0,FPSR ;clr N flag
- bra t_operr ;take care of operands < -1
-*
-* FETOXM1
-*
- xdef setoxm1i
-setoxm1i:
- btst.b #sign_bit,LOCAL_EX(a0) ;check sign of source
- bne ld_mone
- bra ld_pinf
-*
-* FLOGN
-*
-* Test for 1.0 as an input argument, returning +zero. Also check
-* the sign and return operr if negative.
-*
- xdef sslogn
-sslogn:
- btst.b #sign_bit,LOCAL_EX(a0)
- bne t_operr ;take care of operands < 0
- cmpi.w #$3fff,LOCAL_EX(a0) ;test for 1.0 input
- bne slogn
- cmpi.l #$80000000,LOCAL_HI(a0)
- bne slogn
- tst.l LOCAL_LO(a0)
- bne slogn
- fmove.x PZERO,fp0
- rts
-
- xdef sslognd
-sslognd:
- btst.b #sign_bit,LOCAL_EX(a0)
- beq slognd
- bra t_operr ;take care of operands < 0
-
-*
-* FLOG10
-*
- xdef sslog10
-sslog10:
- btst.b #sign_bit,LOCAL_EX(a0)
- bne t_operr ;take care of operands < 0
- cmpi.w #$3fff,LOCAL_EX(a0) ;test for 1.0 input
- bne slog10
- cmpi.l #$80000000,LOCAL_HI(a0)
- bne slog10
- tst.l LOCAL_LO(a0)
- bne slog10
- fmove.x PZERO,fp0
- rts
-
- xdef sslog10d
-sslog10d:
- btst.b #sign_bit,LOCAL_EX(a0)
- beq slog10d
- bra t_operr ;take care of operands < 0
-
-*
-* FLOG2
-*
- xdef sslog2
-sslog2:
- btst.b #sign_bit,LOCAL_EX(a0)
- bne t_operr ;take care of operands < 0
- cmpi.w #$3fff,LOCAL_EX(a0) ;test for 1.0 input
- bne slog2
- cmpi.l #$80000000,LOCAL_HI(a0)
- bne slog2
- tst.l LOCAL_LO(a0)
- bne slog2
- fmove.x PZERO,fp0
- rts
-
- xdef sslog2d
-sslog2d:
- btst.b #sign_bit,LOCAL_EX(a0)
- beq slog2d
- bra t_operr ;take care of operands < 0
-
-*
-* FMOD
-*
-pmodt:
-* ;$21 fmod
-* ;dtag,stag
- dc.l smod ; 00,00 norm,norm = normal
- dc.l smod_oper ; 00,01 norm,zero = nan with operr
- dc.l smod_fpn ; 00,10 norm,inf = fpn
- dc.l smod_snan ; 00,11 norm,nan = nan
- dc.l smod_zro ; 01,00 zero,norm = +-zero
- dc.l smod_oper ; 01,01 zero,zero = nan with operr
- dc.l smod_zro ; 01,10 zero,inf = +-zero
- dc.l smod_snan ; 01,11 zero,nan = nan
- dc.l smod_oper ; 10,00 inf,norm = nan with operr
- dc.l smod_oper ; 10,01 inf,zero = nan with operr
- dc.l smod_oper ; 10,10 inf,inf = nan with operr
- dc.l smod_snan ; 10,11 inf,nan = nan
- dc.l smod_dnan ; 11,00 nan,norm = nan
- dc.l smod_dnan ; 11,01 nan,zero = nan
- dc.l smod_dnan ; 11,10 nan,inf = nan
- dc.l smod_dnan ; 11,11 nan,nan = nan
-
- xdef pmod
-pmod:
- clr.b FPSR_QBYTE(a6) ; clear quotient field
- bfextu STAG(a6){0:3},d0 ;stag = d0
- bfextu DTAG(a6){0:3},d1 ;dtag = d1
-
-*
-* Alias extended denorms to norms for the jump table.
-*
- bclr.l #2,d0
- bclr.l #2,d1
-
- lsl.b #2,d1
- or.b d0,d1 ;d1{3:2} = dtag, d1{1:0} = stag
-* ;Tag values:
-* ;00 = norm or denorm
-* ;01 = zero
-* ;10 = inf
-* ;11 = nan
- lea pmodt,a1
- move.l (a1,d1.w*4),a1
- jmp (a1)
-
-smod_snan:
- bra src_nan
-smod_dnan:
- bra dst_nan
-smod_oper:
- bra t_operr
-smod_zro:
- move.b ETEMP(a6),d1 ;get sign of src op
- move.b FPTEMP(a6),d0 ;get sign of dst op
- eor.b d0,d1 ;get exor of sign bits
- btst.l #7,d1 ;test for sign
- beq.b smod_zsn ;if clr, do not set sign big
- bset.b #q_sn_bit,FPSR_QBYTE(a6) ;set q-byte sign bit
-smod_zsn:
- btst.l #7,d0 ;test if + or -
- beq ld_pzero ;if pos then load +0
- bra ld_mzero ;else neg load -0
-
-smod_fpn:
- move.b ETEMP(a6),d1 ;get sign of src op
- move.b FPTEMP(a6),d0 ;get sign of dst op
- eor.b d0,d1 ;get exor of sign bits
- btst.l #7,d1 ;test for sign
- beq.b smod_fsn ;if clr, do not set sign big
- bset.b #q_sn_bit,FPSR_QBYTE(a6) ;set q-byte sign bit
-smod_fsn:
- tst.b DTAG(a6) ;filter out denormal destination case
- bpl.b smod_nrm ;
- lea.l FPTEMP(a6),a0 ;a0<- addr(FPTEMP)
- bra t_resdnrm ;force UNFL(but exact) result
-smod_nrm:
- fmove.l USER_FPCR(a6),fpcr ;use user's rmode and precision
- fmove.x FPTEMP(a6),fp0 ;return dest to fp0
- rts
-
-*
-* FREM
-*
-premt:
-* ;$25 frem
-* ;dtag,stag
- dc.l srem ; 00,00 norm,norm = normal
- dc.l srem_oper ; 00,01 norm,zero = nan with operr
- dc.l srem_fpn ; 00,10 norm,inf = fpn
- dc.l srem_snan ; 00,11 norm,nan = nan
- dc.l srem_zro ; 01,00 zero,norm = +-zero
- dc.l srem_oper ; 01,01 zero,zero = nan with operr
- dc.l srem_zro ; 01,10 zero,inf = +-zero
- dc.l srem_snan ; 01,11 zero,nan = nan
- dc.l srem_oper ; 10,00 inf,norm = nan with operr
- dc.l srem_oper ; 10,01 inf,zero = nan with operr
- dc.l srem_oper ; 10,10 inf,inf = nan with operr
- dc.l srem_snan ; 10,11 inf,nan = nan
- dc.l srem_dnan ; 11,00 nan,norm = nan
- dc.l srem_dnan ; 11,01 nan,zero = nan
- dc.l srem_dnan ; 11,10 nan,inf = nan
- dc.l srem_dnan ; 11,11 nan,nan = nan
-
- xdef prem
-prem:
- clr.b FPSR_QBYTE(a6) ;clear quotient field
- bfextu STAG(a6){0:3},d0 ;stag = d0
- bfextu DTAG(a6){0:3},d1 ;dtag = d1
-*
-* Alias extended denorms to norms for the jump table.
-*
- bclr #2,d0
- bclr #2,d1
-
- lsl.b #2,d1
- or.b d0,d1 ;d1{3:2} = dtag, d1{1:0} = stag
-* ;Tag values:
-* ;00 = norm or denorm
-* ;01 = zero
-* ;10 = inf
-* ;11 = nan
- lea premt,a1
- move.l (a1,d1.w*4),a1
- jmp (a1)
-
-srem_snan:
- bra src_nan
-srem_dnan:
- bra dst_nan
-srem_oper:
- bra t_operr
-srem_zro:
- move.b ETEMP(a6),d1 ;get sign of src op
- move.b FPTEMP(a6),d0 ;get sign of dst op
- eor.b d0,d1 ;get exor of sign bits
- btst.l #7,d1 ;test for sign
- beq.b srem_zsn ;if clr, do not set sign big
- bset.b #q_sn_bit,FPSR_QBYTE(a6) ;set q-byte sign bit
-srem_zsn:
- btst.l #7,d0 ;test if + or -
- beq ld_pzero ;if pos then load +0
- bra ld_mzero ;else neg load -0
-
-srem_fpn:
- move.b ETEMP(a6),d1 ;get sign of src op
- move.b FPTEMP(a6),d0 ;get sign of dst op
- eor.b d0,d1 ;get exor of sign bits
- btst.l #7,d1 ;test for sign
- beq.b srem_fsn ;if clr, do not set sign big
- bset.b #q_sn_bit,FPSR_QBYTE(a6) ;set q-byte sign bit
-srem_fsn:
- tst.b DTAG(a6) ;filter out denormal destination case
- bpl.b srem_nrm ;
- lea.l FPTEMP(a6),a0 ;a0<- addr(FPTEMP)
- bra t_resdnrm ;force UNFL(but exact) result
-srem_nrm:
- fmove.l USER_FPCR(a6),fpcr ;use user's rmode and precision
- fmove.x FPTEMP(a6),fp0 ;return dest to fp0
- rts
-*
-* FSCALE
-*
-pscalet:
-* ;$26 fscale
-* ;dtag,stag
- dc.l sscale ; 00,00 norm,norm = result
- dc.l sscale ; 00,01 norm,zero = fpn
- dc.l scl_opr ; 00,10 norm,inf = nan with operr
- dc.l scl_snan ; 00,11 norm,nan = nan
- dc.l scl_zro ; 01,00 zero,norm = +-zero
- dc.l scl_zro ; 01,01 zero,zero = +-zero
- dc.l scl_opr ; 01,10 zero,inf = nan with operr
- dc.l scl_snan ; 01,11 zero,nan = nan
- dc.l scl_inf ; 10,00 inf,norm = +-inf
- dc.l scl_inf ; 10,01 inf,zero = +-inf
- dc.l scl_opr ; 10,10 inf,inf = nan with operr
- dc.l scl_snan ; 10,11 inf,nan = nan
- dc.l scl_dnan ; 11,00 nan,norm = nan
- dc.l scl_dnan ; 11,01 nan,zero = nan
- dc.l scl_dnan ; 11,10 nan,inf = nan
- dc.l scl_dnan ; 11,11 nan,nan = nan
-
- xdef pscale
-pscale:
- bfextu STAG(a6){0:3},d0 ;stag in d0
- bfextu DTAG(a6){0:3},d1 ;dtag in d1
- bclr.l #2,d0 ;alias denorm into norm
- bclr.l #2,d1 ;alias denorm into norm
- lsl.b #2,d1
- or.b d0,d1 ;d1{4:2} = dtag, d1{1:0} = stag
-* ;dtag values stag values:
-* ;000 = norm 00 = norm
-* ;001 = zero 01 = zero
-* ;010 = inf 10 = inf
-* ;011 = nan 11 = nan
-* ;100 = dnrm
-*
-*
- lea.l pscalet,a1 ;load start of jump table
- move.l (a1,d1.w*4),a1 ;load a1 with label depending on tag
- jmp (a1) ;go to the routine
-
-scl_opr:
- bra t_operr
-
-scl_dnan:
- bra dst_nan
-
-scl_zro:
- btst.b #sign_bit,FPTEMP_EX(a6) ;test if + or -
- beq ld_pzero ;if pos then load +0
- bra ld_mzero ;if neg then load -0
-scl_inf:
- btst.b #sign_bit,FPTEMP_EX(a6) ;test if + or -
- beq ld_pinf ;if pos then load +inf
- bra ld_minf ;else neg load -inf
-scl_snan:
- bra src_nan
-*
-* FSINCOS
-*
- xdef ssincosz
-ssincosz:
- btst.b #sign_bit,ETEMP(a6) ;get sign
- beq.b sincosp
- fmove.x MZERO,fp0
- bra.b sincoscom
-sincosp:
- fmove.x PZERO,fp0
-sincoscom:
- fmovem.x PONE,fp1 ;do not allow FPSR to be affected
- bra sto_cos ;store cosine result
-
- xdef ssincosi
-ssincosi:
- fmove.x QNAN,fp1 ;load NAN
- bsr sto_cos ;store cosine result
- fmove.x QNAN,fp0 ;load NAN
- bra t_operr
-
- xdef ssincosnan
-ssincosnan:
- move.l ETEMP_EX(a6),FP_SCR1(a6)
- move.l ETEMP_HI(a6),FP_SCR1+4(a6)
- move.l ETEMP_LO(a6),FP_SCR1+8(a6)
- bset.b #signan_bit,FP_SCR1+4(a6)
- fmovem.x FP_SCR1(a6),fp1
- bsr sto_cos
- bra src_nan
-*
-* This code forces default values for the zero, inf, and nan cases
-* in the transcendentals code. The CC bits must be set in the
-* stacked FPSR to be correctly reported.
-*
-***Returns +PI/2
- xdef ld_ppi2
-ld_ppi2:
- fmove.x PPIBY2,fp0 ;load +pi/2
- bra t_inx2 ;set inex2 exc
-
-***Returns -PI/2
- xdef ld_mpi2
-ld_mpi2:
- fmove.x MPIBY2,fp0 ;load -pi/2
- or.l #neg_mask,USER_FPSR(a6) ;set N bit
- bra t_inx2 ;set inex2 exc
-
-***Returns +inf
- xdef ld_pinf
-ld_pinf:
- fmove.x PINF,fp0 ;load +inf
- or.l #inf_mask,USER_FPSR(a6) ;set I bit
- rts
-
-***Returns -inf
- xdef ld_minf
-ld_minf:
- fmove.x MINF,fp0 ;load -inf
- or.l #neg_mask+inf_mask,USER_FPSR(a6) ;set N and I bits
- rts
-
-***Returns +1
- xdef ld_pone
-ld_pone:
- fmove.x PONE,fp0 ;load +1
- rts
-
-***Returns -1
- xdef ld_mone
-ld_mone:
- fmove.x MONE,fp0 ;load -1
- or.l #neg_mask,USER_FPSR(a6) ;set N bit
- rts
-
-***Returns +0
- xdef ld_pzero
-ld_pzero:
- fmove.x PZERO,fp0 ;load +0
- or.l #z_mask,USER_FPSR(a6) ;set Z bit
- rts
-
-***Returns -0
- xdef ld_mzero
-ld_mzero:
- fmove.x MZERO,fp0 ;load -0
- or.l #neg_mask+z_mask,USER_FPSR(a6) ;set N and Z bits
- rts
-
- end
diff --git a/sys/arch/m68k/fpsp/fpsp.h b/sys/arch/m68k/fpsp/fpsp.h
deleted file mode 100644
index 5956772069d..00000000000
--- a/sys/arch/m68k/fpsp/fpsp.h
+++ /dev/null
@@ -1,374 +0,0 @@
-* $OpenBSD: fpsp.h,v 1.3 2007/11/27 16:22:13 martynas Exp $
-* $NetBSD: fpsp.h,v 1.2 1994/10/26 07:49:04 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* fpsp.h 3.3 3.3
-*
-
-* fpsp.h --- stack frame offsets during FPSP exception handling
-*
-* These equates are used to access the exception frame, the fsave
-* frame and any local variables needed by the FPSP package.
-*
-* All FPSP handlers begin by executing:
-*
-* link a6,#-LOCAL_SIZE
-* fsave -(a7)
-* movem.l d0-d1/a0-a1,USER_DA(a6)
-* fmovem.x fp0-fp3,USER_FP0(a6)
-* fmove.l fpsr/fpcr/fpiar,USER_FPSR(a6)
-*
-* After initialization, the stack looks like this:
-*
-* A7 ---> +-------------------------------+
-* | |
-* | FPU fsave area |
-* | |
-* +-------------------------------+
-* | |
-* | FPSP Local Variables |
-* | including |
-* | saved registers |
-* | |
-* +-------------------------------+
-* A6 ---> | Saved A6 |
-* +-------------------------------+
-* | |
-* | Exception Frame |
-* | |
-* | |
-*
-* Positive offsets from A6 refer to the exception frame. Negative
-* offsets refer to the Local Variable area and the fsave area.
-* The fsave frame is also accessible 'from the top' via A7.
-*
-* On exit, the handlers execute:
-*
-* movem.l USER_DA(a6),d0-d1/a0-a1
-* fmovem.x USER_FP0(a6),fp0-fp3
-* fmove.l USER_FPSR(a6),fpsr/fpcr/fpiar
-* frestore (a7)+
-* unlk a6
-*
-* and then either 'bra fpsp_done' if the exception was completely
-* handled by the package, or 'bra real_xxxx' which is an external
-* label to a routine that will process a real exception of the
-* type that was generated. Some handlers may omit the 'frestore'
-* if the FPU state after the exception is idle.
-*
-* Sometimes the exception handler will transform the fsave area
-* because it needs to report an exception back to the user. This
-* can happen if the package is entered for an unimplemented float
-* instruction that generates (say) an underflow. Alternatively,
-* a second fsave frame can be pushed onto the stack and the
-* handler exit code will reload the new frame and discard the old.
-*
-* The registers d0, d1, a0, a1 and fp0-fp3 are always saved and
-* restored from the 'local variable' area and can be used as
-* temporaries. If a routine needs to change any
-* of these registers, it should modify the saved copy and let
-* the handler exit code restore the value.
-*
-*----------------------------------------------------------------------
-*
-* Local Variables on the stack
-*
-LOCAL_SIZE equ 192 ;bytes needed for local variables
-LV equ -LOCAL_SIZE ;convenient base value
-*
-USER_DA equ LV+0 ;save space for D0-D1,A0-A1
-USER_D0 equ LV+0 ;saved user D0
-USER_D1 equ LV+4 ;saved user D1
-USER_A0 equ LV+8 ;saved user A0
-USER_A1 equ LV+12 ;saved user A1
-USER_FP0 equ LV+16 ;saved user FP0
-USER_FP1 equ LV+28 ;saved user FP1
-USER_FP2 equ LV+40 ;saved user FP2
-USER_FP3 equ LV+52 ;saved user FP3
-USER_FPCR equ LV+64 ;saved user FPCR
-FPCR_ENABLE equ USER_FPCR+2 ; FPCR exception enable
-FPCR_MODE equ USER_FPCR+3 ; FPCR rounding mode control
-USER_FPSR equ LV+68 ;saved user FPSR
-FPSR_CC equ USER_FPSR+0 ; FPSR condition code
-FPSR_QBYTE equ USER_FPSR+1 ; FPSR quotient
-FPSR_EXCEPT equ USER_FPSR+2 ; FPSR exception
-FPSR_AEXCEPT equ USER_FPSR+3 ; FPSR accrued exception
-USER_FPIAR equ LV+72 ;saved user FPIAR
-FP_SCR1 equ LV+76 ;room for a temporary float value
-FP_SCR2 equ LV+92 ;room for a temporary float value
-L_SCR1 equ LV+108 ;room for a temporary long value
-L_SCR2 equ LV+112 ;room for a temporary long value
-STORE_FLG equ LV+116
-BINDEC_FLG equ LV+117 ;used in bindec
-DNRM_FLG equ LV+118 ;used in res_func
-RES_FLG equ LV+119 ;used in res_func
-DY_MO_FLG equ LV+120 ;dyadic/monadic flag
-UFLG_TMP equ LV+121 ;temporary for uflag errata
-CU_ONLY equ LV+122 ;cu-only flag
-VER_TMP equ LV+123 ;temp holding for version number
-L_SCR3 equ LV+124 ;room for a temporary long value
-FP_SCR3 equ LV+128 ;room for a temporary float value
-FP_SCR4 equ LV+144 ;room for a temporary float value
-FP_SCR5 equ LV+160 ;room for a temporary float value
-FP_SCR6 equ LV+176
-*
-*NEXT equ LV+192 ;need to increase LOCAL_SIZE
-*
-*--------------------------------------------------------------------------
-*
-* fsave offsets and bit definitions
-*
-* Offsets are defined from the end of an fsave because the last 10
-* words of a busy frame are the same as the unimplemented frame.
-*
-CU_SAVEPC equ LV-92 ;micro-pc for CU (1 byte)
-FPR_DIRTY_BITS equ LV-91 ;fpr dirty bits
-*
-WBTEMP equ LV-76 ;write back temp (12 bytes)
-WBTEMP_EX equ WBTEMP ;wbtemp sign and exponent (2 bytes)
-WBTEMP_HI equ WBTEMP+4 ;wbtemp mantissa [63:32] (4 bytes)
-WBTEMP_LO equ WBTEMP+8 ;wbtemp mantissa [31:00] (4 bytes)
-*
-WBTEMP_SGN equ WBTEMP+2 ;used to store sign
-*
-FPSR_SHADOW equ LV-64 ;fpsr shadow reg
-*
-FPIARCU equ LV-60 ;Instr. addr. reg. for CU (4 bytes)
-*
-CMDREG2B equ LV-52 ;cmd reg for machine 2
-CMDREG3B equ LV-48 ;cmd reg for E3 exceptions (2 bytes)
-*
-NMNEXC equ LV-44 ;NMNEXC (unsup,snan bits only)
-nmn_unsup_bit equ 1
-nmn_snan_bit equ 0
-*
-NMCEXC equ LV-43 ;NMNEXC & NMCEXC
-nmn_operr_bit equ 7
-nmn_ovfl_bit equ 6
-nmn_unfl_bit equ 5
-nmc_unsup_bit equ 4
-nmc_snan_bit equ 3
-nmc_operr_bit equ 2
-nmc_ovfl_bit equ 1
-nmc_unfl_bit equ 0
-*
-STAG equ LV-40 ;source tag (1 byte)
-WBTEMP_GRS equ LV-40 ;alias wbtemp guard, round, sticky
-guard_bit equ 1 ;guard bit is bit number 1
-round_bit equ 0 ;round bit is bit number 0
-stag_mask equ $E0 ;upper 3 bits are source tag type
-denorm_bit equ 7 ;bit determines if denorm or unnorm
-etemp15_bit equ 4 ;etemp exponent bit #15
-wbtemp66_bit equ 2 ;wbtemp mantissa bit #66
-wbtemp1_bit equ 1 ;wbtemp mantissa bit #1
-wbtemp0_bit equ 0 ;wbtemp mantissa bit #0
-*
-STICKY equ LV-39 ;holds sticky bit
-sticky_bit equ 7
-*
-CMDREG1B equ LV-36 ;cmd reg for E1 exceptions (2 bytes)
-kfact_bit equ 12 ;distinguishes static/dynamic k-factor
-* ;on packed move out's. NOTE: this
-* ;equate only works when CMDREG1B is in
-* ;a register.
-*
-CMDWORD equ LV-35 ;command word in cmd1b
-direction_bit equ 5 ;bit 0 in opclass
-size_bit2 equ 12 ;bit 2 in size field
-*
-DTAG equ LV-32 ;dest tag (1 byte)
-dtag_mask equ $E0 ;upper 3 bits are dest type tag
-fptemp15_bit equ 4 ;fptemp exponent bit #15
-*
-WB_BYTE equ LV-31 ;holds WBTE15 bit (1 byte)
-wbtemp15_bit equ 4 ;wbtemp exponent bit #15
-*
-E_BYTE equ LV-28 ;holds E1 and E3 bits (1 byte)
-E1 equ 2 ;which bit is E1 flag
-E3 equ 1 ;which bit is E3 flag
-SFLAG equ 0 ;which bit is S flag
-*
-T_BYTE equ LV-27 ;holds T and U bits (1 byte)
-XFLAG equ 7 ;which bit is X flag
-UFLAG equ 5 ;which bit is U flag
-TFLAG equ 4 ;which bit is T flag
-*
-FPTEMP equ LV-24 ;fptemp (12 bytes)
-FPTEMP_EX equ FPTEMP ;fptemp sign and exponent (2 bytes)
-FPTEMP_HI equ FPTEMP+4 ;fptemp mantissa [63:32] (4 bytes)
-FPTEMP_LO equ FPTEMP+8 ;fptemp mantissa [31:00] (4 bytes)
-*
-FPTEMP_SGN equ FPTEMP+2 ;used to store sign
-*
-ETEMP equ LV-12 ;etemp (12 bytes)
-ETEMP_EX equ ETEMP ;etemp sign and exponent (2 bytes)
-ETEMP_HI equ ETEMP+4 ;etemp mantissa [63:32] (4 bytes)
-ETEMP_LO equ ETEMP+8 ;etemp mantissa [31:00] (4 bytes)
-*
-ETEMP_SGN equ ETEMP+2 ;used to store sign
-*
-EXC_SR equ 4 ;exception frame status register
-EXC_PC equ 6 ;exception frame program counter
-EXC_VEC equ 10 ;exception frame vector (format+vector#)
-EXC_EA equ 12 ;exception frame effective address
-*
-*--------------------------------------------------------------------------
-*
-* FPSR/FPCR bits
-*
-neg_bit equ 3 negative result
-z_bit equ 2 zero result
-inf_bit equ 1 infinity result
-nan_bit equ 0 not-a-number result
-*
-q_sn_bit equ 7 sign bit of quotient byte
-*
-bsun_bit equ 7 branch on unordered
-snan_bit equ 6 signalling nan
-operr_bit equ 5 operand error
-ovfl_bit equ 4 overflow
-unfl_bit equ 3 underflow
-dz_bit equ 2 divide by zero
-inex2_bit equ 1 inexact result 2
-inex1_bit equ 0 inexact result 1
-*
-aiop_bit equ 7 accrued illegal operation
-aovfl_bit equ 6 accrued overflow
-aunfl_bit equ 5 accrued underflow
-adz_bit equ 4 accrued divide by zero
-ainex_bit equ 3 accrued inexact
-*
-* FPSR individual bit masks
-*
-neg_mask equ $08000000
-z_mask equ $04000000
-inf_mask equ $02000000
-nan_mask equ $01000000
-*
-bsun_mask equ $00008000
-snan_mask equ $00004000
-operr_mask equ $00002000
-ovfl_mask equ $00001000
-unfl_mask equ $00000800
-dz_mask equ $00000400
-inex2_mask equ $00000200
-inex1_mask equ $00000100
-*
-aiop_mask equ $00000080 accrued illegal operation
-aovfl_mask equ $00000040 accrued overflow
-aunfl_mask equ $00000020 accrued underflow
-adz_mask equ $00000010 accrued divide by zero
-ainex_mask equ $00000008 accrued inexact
-*
-* FPSR combinations used in the FPSP
-*
-dzinf_mask equ inf_mask+dz_mask+adz_mask
-opnan_mask equ nan_mask+operr_mask+aiop_mask
-nzi_mask equ $01ffffff clears N, Z, and I
-unfinx_mask equ unfl_mask+inex2_mask+aunfl_mask+ainex_mask
-unf2inx_mask equ unfl_mask+inex2_mask+ainex_mask
-ovfinx_mask equ ovfl_mask+inex2_mask+aovfl_mask+ainex_mask
-inx1a_mask equ inex1_mask+ainex_mask
-inx2a_mask equ inex2_mask+ainex_mask
-snaniop_mask equ nan_mask+snan_mask+aiop_mask
-naniop_mask equ nan_mask+aiop_mask
-neginf_mask equ neg_mask+inf_mask
-infaiop_mask equ inf_mask+aiop_mask
-negz_mask equ neg_mask+z_mask
-opaop_mask equ operr_mask+aiop_mask
-unfl_inx_mask equ unfl_mask+aunfl_mask+ainex_mask
-ovfl_inx_mask equ ovfl_mask+aovfl_mask+ainex_mask
-*
-*--------------------------------------------------------------------------
-*
-* FPCR rounding modes
-*
-x_mode equ $00 round to extended
-s_mode equ $40 round to single
-d_mode equ $80 round to double
-*
-rn_mode equ $00 round nearest
-rz_mode equ $10 round to zero
-rm_mode equ $20 round to minus infinity
-rp_mode equ $30 round to plus infinity
-*
-*--------------------------------------------------------------------------
-*
-* Miscellaneous equates
-*
-signan_bit equ 6 signalling nan bit in mantissa
-sign_bit equ 7
-*
-rnd_stky_bit equ 29 round/sticky bit of mantissa
-* this can only be used if in a data register
-sx_mask equ $01800000 set s and x bits in word $48
-*
-LOCAL_EX equ 0
-LOCAL_SGN equ 2
-LOCAL_HI equ 4
-LOCAL_LO equ 8
-LOCAL_GRS equ 12 valid ONLY for FP_SCR1, FP_SCR2
-*
-*
-norm_tag equ $00 tag bits in {7:5} position
-zero_tag equ $20
-inf_tag equ $40
-nan_tag equ $60
-dnrm_tag equ $80
-*
-* fsave sizes and formats
-*
-VER_4 equ $40 fpsp compatible version numbers
-* are in the $40s {$40-$4f}
-VER_40 equ $40 original version number
-VER_41 equ $41 revision version number
-*
-BUSY_SIZE equ 100 size of busy frame
-BUSY_FRAME equ LV-BUSY_SIZE start of busy frame
-*
-UNIMP_40_SIZE equ 44 size of orig unimp frame
-UNIMP_41_SIZE equ 52 size of rev unimp frame
-*
-IDLE_SIZE equ 4 size of idle frame
-IDLE_FRAME equ LV-IDLE_SIZE start of idle frame
-*
-* exception vectors
-*
-TRACE_VEC equ $2024 trace trap
-FLINE_VEC equ $002C 'real' F-line
-UNIMP_VEC equ $202C unimplemented
-INEX_VEC equ $00C4
-*
-dbl_thresh equ $3C01
-sgl_thresh equ $3F81
-*
diff --git a/sys/arch/m68k/fpsp/gen_except.sa b/sys/arch/m68k/fpsp/gen_except.sa
deleted file mode 100644
index 5a4c451e368..00000000000
--- a/sys/arch/m68k/fpsp/gen_except.sa
+++ /dev/null
@@ -1,494 +0,0 @@
-* $OpenBSD: gen_except.sa,v 1.3 2010/03/01 22:41:09 jasper Exp $
-* $NetBSD: gen_except.sa,v 1.3 1994/10/26 07:49:07 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* gen_except.sa 3.7 1/16/92
-*
-* gen_except --- FPSP routine to detect reportable exceptions
-*
-* This routine compares the exception enable byte of the
-* user_fpcr on the stack with the exception status byte
-* of the user_fpsr.
-*
-* Any routine which may report an exceptions must load
-* the stack frame in memory with the exceptional operand(s).
-*
-* Priority for exceptions is:
-*
-* Highest: bsun
-* snan
-* operr
-* ovfl
-* unfl
-* dz
-* inex2
-* Lowest: inex1
-*
-* Note: The IEEE standard specifies that inex2 is to be
-* reported if ovfl occurs and the ovfl enable bit is not
-* set but the inex2 enable bit is.
-*
-
-GEN_EXCEPT IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
- xref real_trace
- xref fpsp_done
- xref fpsp_fmt_error
-
-exc_tbl:
- dc.l bsun_exc
- dc.l commonE1
- dc.l commonE1
- dc.l ovfl_unfl
- dc.l ovfl_unfl
- dc.l commonE1
- dc.l commonE3
- dc.l commonE3
- dc.l no_match
-
- xdef gen_except
-gen_except:
- cmpi.b #IDLE_SIZE-4,1(a7) ;test for idle frame
- beq.w do_check ;go handle idle frame
- cmpi.b #UNIMP_40_SIZE-4,1(a7) ;test for orig unimp frame
- beq.b unimp_x ;go handle unimp frame
- cmpi.b #UNIMP_41_SIZE-4,1(a7) ;test for rev unimp frame
- beq.b unimp_x ;go handle unimp frame
- cmpi.b #BUSY_SIZE-4,1(a7) ;if size <> $60, fmt error
- bne.l fpsp_fmt_error
- lea.l BUSY_SIZE+LOCAL_SIZE(a7),a1 ;init a1 so fpsp.h
-* ;equates will work
-* Fix up the new busy frame with entries from the unimp frame
-*
- move.l ETEMP_EX(a6),ETEMP_EX(a1) ;copy etemp from unimp
- move.l ETEMP_HI(a6),ETEMP_HI(a1) ;frame to busy frame
- move.l ETEMP_LO(a6),ETEMP_LO(a1)
- move.l CMDREG1B(a6),CMDREG1B(a1) ;set inst in frame to unimp
- move.l CMDREG1B(a6),d0 ;fix cmd1b to make it
- and.l #$03c30000,d0 ;work for cmd3b
- bfextu CMDREG1B(a6){13:1},d1 ;extract bit 2
- lsl.l #5,d1
- swap d1
- or.l d1,d0 ;put it in the right place
- bfextu CMDREG1B(a6){10:3},d1 ;extract bit 3,4,5
- lsl.l #2,d1
- swap d1
- or.l d1,d0 ;put them in the right place
- move.l d0,CMDREG3B(a1) ;in the busy frame
-*
-* Or in the FPSR from the emulation with the USER_FPSR on the stack.
-*
- fmove.l FPSR,d0
- or.l d0,USER_FPSR(a6)
- move.l USER_FPSR(a6),FPSR_SHADOW(a1) ;set exc bits
- or.l #sx_mask,E_BYTE(a1)
- bra do_clean
-
-*
-* Frame is an unimp frame possible resulting from an fmove <ea>,fp0
-* that caused an exception
-*
-* a1 is modified to point into the new frame allowing fpsp equates
-* to be valid.
-*
-unimp_x:
- cmpi.b #UNIMP_40_SIZE-4,1(a7) ;test for orig unimp frame
- bne.b test_rev
- lea.l UNIMP_40_SIZE+LOCAL_SIZE(a7),a1
- bra.b unimp_con
-test_rev:
- cmpi.b #UNIMP_41_SIZE-4,1(a7) ;test for rev unimp frame
- bne.l fpsp_fmt_error ;if not $28 or $30
- lea.l UNIMP_41_SIZE+LOCAL_SIZE(a7),a1
-
-unimp_con:
-*
-* Fix up the new unimp frame with entries from the old unimp frame
-*
- move.l CMDREG1B(a6),CMDREG1B(a1) ;set inst in frame to unimp
-*
-* Or in the FPSR from the emulation with the USER_FPSR on the stack.
-*
- fmove.l FPSR,d0
- or.l d0,USER_FPSR(a6)
- bra do_clean
-
-*
-* Frame is idle, so check for exceptions reported through
-* USER_FPSR and set the unimp frame accordingly.
-* A7 must be incremented to the point before the
-* idle fsave vector to the unimp vector.
-*
-
-do_check:
- add.l #4,A7 ;point A7 back to unimp frame
-*
-* Or in the FPSR from the emulation with the USER_FPSR on the stack.
-*
- fmove.l FPSR,d0
- or.l d0,USER_FPSR(a6)
-*
-* On a busy frame, we must clear the nmnexc bits.
-*
- cmpi.b #BUSY_SIZE-4,1(a7) ;check frame type
- bne.b check_fr ;if busy, clr nmnexc
- clr.w NMNEXC(a6) ;clr nmnexc & nmcexc
- btst.b #5,CMDREG1B(a6) ;test for fmove out
- bne.b frame_com
- move.l USER_FPSR(a6),FPSR_SHADOW(a6) ;set exc bits
- or.l #sx_mask,E_BYTE(a6)
- bra.b frame_com
-check_fr:
- cmp.b #UNIMP_40_SIZE-4,1(a7)
- beq.b frame_com
- clr.w NMNEXC(a6)
-frame_com:
- move.b FPCR_ENABLE(a6),d0 ;get fpcr enable byte
- and.b FPSR_EXCEPT(a6),d0 ;and in the fpsr exc byte
- bfffo d0{24:8},d1 ;test for first set bit
- lea.l exc_tbl,a0 ;load jmp table address
- subi.b #24,d1 ;normalize bit offset to 0-8
- move.l (a0,d1.w*4),a0 ;load routine address based
-* ;based on first enabled exc
- jmp (a0) ;jump to routine
-*
-* Bsun is not possible in unimp or unsupp
-*
-bsun_exc:
- bra do_clean
-*
-* The typical work to be done to the unimp frame to report an
-* exception is to set the E1/E3 byte and clr the U flag.
-* commonE1 does this for E1 exceptions, which are snan,
-* operr, and dz. commonE3 does this for E3 exceptions, which
-* are inex2 and inex1, and also clears the E1 exception bit
-* left over from the unimp exception.
-*
-commonE1:
- bset.b #E1,E_BYTE(a6) ;set E1 flag
- bra.w commonE ;go clean and exit
-
-commonE3:
- tst.b UFLG_TMP(a6) ;test flag for unsup/unimp state
- bne.b unsE3
-uniE3:
- bset.b #E3,E_BYTE(a6) ;set E3 flag
- bclr.b #E1,E_BYTE(a6) ;clr E1 from unimp
- bra.w commonE
-
-unsE3:
- tst.b RES_FLG(a6)
- bne.b unsE3_0
-unsE3_1:
- bset.b #E3,E_BYTE(a6) ;set E3 flag
-unsE3_0:
- bclr.b #E1,E_BYTE(a6) ;clr E1 flag
- move.l CMDREG1B(a6),d0
- and.l #$03c30000,d0 ;work for cmd3b
- bfextu CMDREG1B(a6){13:1},d1 ;extract bit 2
- lsl.l #5,d1
- swap d1
- or.l d1,d0 ;put it in the right place
- bfextu CMDREG1B(a6){10:3},d1 ;extract bit 3,4,5
- lsl.l #2,d1
- swap d1
- or.l d1,d0 ;put them in the right place
- move.l d0,CMDREG3B(a6) ;in the busy frame
-
-commonE:
- bclr.b #UFLAG,T_BYTE(a6) ;clr U flag from unimp
- bra.w do_clean ;go clean and exit
-*
-* No bits in the enable byte match existing exceptions. Check for
-* the case of the ovfl exc without the ovfl enabled, but with
-* inex2 enabled.
-*
-no_match:
- btst.b #inex2_bit,FPCR_ENABLE(a6) ;check for ovfl/inex2 case
- beq.b no_exc ;if clear, exit
- btst.b #ovfl_bit,FPSR_EXCEPT(a6) ;now check ovfl
- beq.b no_exc ;if clear, exit
- bra.b ovfl_unfl ;go to unfl_ovfl to determine if
-* ;it is an unsupp or unimp exc
-
-* No exceptions are to be reported. If the instruction was
-* unimplemented, no FPU restore is necessary. If it was
-* unsupported, we must perform the restore.
-no_exc:
- tst.b UFLG_TMP(a6) ;test flag for unsupp/unimp state
- beq.b uni_no_exc
-uns_no_exc:
- tst.b RES_FLG(a6) ;check if frestore is needed
- bne.w do_clean ;if clear, no frestore needed
-uni_no_exc:
- movem.l USER_DA(a6),d0-d1/a0-a1
- fmovem.x USER_FP0(a6),fp0-fp3
- fmovem.l USER_FPCR(a6),fpcr/fpsr/fpiar
- unlk a6
- bra finish_up
-*
-* Unsupported Data Type Handler:
-* Ovfl:
-* An fmoveout that results in an overflow is reported this way.
-* Unfl:
-* An fmoveout that results in an underflow is reported this way.
-*
-* Unimplemented Instruction Handler:
-* Ovfl:
-* Only scosh, setox, ssinh, stwotox, and scale can set overflow in
-* this manner.
-* Unfl:
-* Stwotox, setox, and scale can set underflow in this manner.
-* Any of the other Library Routines such that f(x)=x in which
-* x is an extended denorm can report an underflow exception.
-* It is the responsibility of the exception-causing exception
-* to make sure that WBTEMP is correct.
-*
-* The exceptional operand is in FP_SCR1.
-*
-ovfl_unfl:
- tst.b UFLG_TMP(a6) ;test flag for unsupp/unimp state
- beq.b ofuf_con
-*
-* The caller was from an unsupported data type trap. Test if the
-* caller set CU_ONLY. If so, the exceptional operand is expected in
-* FPTEMP, rather than WBTEMP.
-*
- tst.b CU_ONLY(a6) ;test if inst is cu-only
- beq.w unsE3
-* move.w #$fe,CU_SAVEPC(a6)
- clr.b CU_SAVEPC(a6)
- bset.b #E1,E_BYTE(a6) ;set E1 exception flag
- move.w ETEMP_EX(a6),FPTEMP_EX(a6)
- move.l ETEMP_HI(a6),FPTEMP_HI(a6)
- move.l ETEMP_LO(a6),FPTEMP_LO(a6)
- bset.b #fptemp15_bit,DTAG(a6) ;set fpte15
- bclr.b #UFLAG,T_BYTE(a6) ;clr U flag from unimp
- bra.w do_clean ;go clean and exit
-
-ofuf_con:
- move.b (a7),VER_TMP(a6) ;save version number
- cmpi.b #BUSY_SIZE-4,1(a7) ;check for busy frame
- beq.b busy_fr ;if unimp, grow to busy
- cmpi.b #VER_40,(a7) ;test for orig unimp frame
- bne.b try_41 ;if not, test for rev frame
- moveq.l #13,d0 ;need to zero 14 lwords
- bra.b ofuf_fin
-try_41:
- cmpi.b #VER_41,(a7) ;test for rev unimp frame
- bne.l fpsp_fmt_error ;if neither, exit with error
- moveq.l #11,d0 ;need to zero 12 lwords
-
-ofuf_fin:
- clr.l (a7)
-loop1:
- clr.l -(a7) ;clear and dec a7
- dbra.w d0,loop1
- move.b VER_TMP(a6),(a7)
- move.b #BUSY_SIZE-4,1(a7) ;write busy fmt word.
-busy_fr:
- move.l FP_SCR1(a6),WBTEMP_EX(a6) ;write
- move.l FP_SCR1+4(a6),WBTEMP_HI(a6) ;exceptional op to
- move.l FP_SCR1+8(a6),WBTEMP_LO(a6) ;wbtemp
- bset.b #E3,E_BYTE(a6) ;set E3 flag
- bclr.b #E1,E_BYTE(a6) ;make sure E1 is clear
- bclr.b #UFLAG,T_BYTE(a6) ;clr U flag
- move.l USER_FPSR(a6),FPSR_SHADOW(a6)
- or.l #sx_mask,E_BYTE(a6)
- move.l CMDREG1B(a6),d0 ;fix cmd1b to make it
- and.l #$03c30000,d0 ;work for cmd3b
- bfextu CMDREG1B(a6){13:1},d1 ;extract bit 2
- lsl.l #5,d1
- swap d1
- or.l d1,d0 ;put it in the right place
- bfextu CMDREG1B(a6){10:3},d1 ;extract bit 3,4,5
- lsl.l #2,d1
- swap d1
- or.l d1,d0 ;put them in the right place
- move.l d0,CMDREG3B(a6) ;in the busy frame
-
-*
-* Check if the frame to be restored is busy or unimp.
-*** NOTE *** Bug fix for errata (0d43b #3)
-* If the frame is unimp, we must create a busy frame to
-* fix the bug with the nmnexc bits in cases in which they
-* are set by a previous instruction and not cleared by
-* the save. The frame will be unimp only if the final
-* instruction in an emulation routine caused the exception
-* by doing an fmove <ea>,fp0. The exception operand, in
-* internal format, is in fptemp.
-*
-do_clean:
- cmpi.b #UNIMP_40_SIZE-4,1(a7)
- bne.b do_con
- moveq.l #13,d0 ;in orig, need to zero 14 lwords
- bra.b do_build
-do_con:
- cmpi.b #UNIMP_41_SIZE-4,1(a7)
- bne.b do_restore ;frame must be busy
- moveq.l #11,d0 ;in rev, need to zero 12 lwords
-
-do_build:
- move.b (a7),VER_TMP(a6)
- clr.l (a7)
-loop2:
- clr.l -(a7) ;clear and dec a7
- dbra.w d0,loop2
-*
-* Use a1 as pointer into new frame. a6 is not correct if an unimp or
-* busy frame was created as the result of an exception on the final
-* instruction of an emulation routine.
-*
-* We need to set the nmcexc bits if the exception is E1. Otherwise,
-* the exc taken will be inex2.
-*
- lea.l BUSY_SIZE+LOCAL_SIZE(a7),a1 ;init a1 for new frame
- move.b VER_TMP(a6),(a7) ;write busy fmt word
- move.b #BUSY_SIZE-4,1(a7)
- move.l FP_SCR1(a6),WBTEMP_EX(a1) ;write
- move.l FP_SCR1+4(a6),WBTEMP_HI(a1) ;exceptional op to
- move.l FP_SCR1+8(a6),WBTEMP_LO(a1) ;wbtemp
-* btst.b #E1,E_BYTE(a1)
-* beq.b do_restore
- bfextu USER_FPSR(a6){17:4},d0 ;get snan/operr/ovfl/unfl bits
- bfins d0,NMCEXC(a1){4:4} ;and insert them in nmcexc
- move.l USER_FPSR(a6),FPSR_SHADOW(a1) ;set exc bits
- or.l #sx_mask,E_BYTE(a1)
-
-do_restore:
- movem.l USER_DA(a6),d0-d1/a0-a1
- fmovem.x USER_FP0(a6),fp0-fp3
- fmovem.l USER_FPCR(a6),fpcr/fpsr/fpiar
- frestore (a7)+
- tst.b RES_FLG(a6) ;RES_FLG indicates a "continuation" frame
- beq cont
- bsr bug1384
-cont:
- unlk a6
-*
-* If trace mode enabled, then go to trace handler. This handler
-* cannot have any fp instructions. If there are fp inst's and an
-* exception has been restored into the machine then the exception
-* will occur upon execution of the fp inst. This is not desirable
-* in the kernel (supervisor mode). See MC68040 manual Section 9.3.8.
-*
-finish_up:
- btst.b #7,(a7) ;test T1 in SR
- bne.b g_trace
- btst.b #6,(a7) ;test T0 in SR
- bne.b g_trace
- bra.l fpsp_done
-*
-* Change integer stack to look like trace stack
-* The address of the instruction that caused the
-* exception is already in the integer stack (is
-* the same as the saved friar)
-*
-* If the current frame is already a 6-word stack then all
-* that needs to be done is to change the vector# to TRACE.
-* If the frame is only a 4-word stack (meaning we got here
-* on an Unsupported data type exception), then we need to grow
-* the stack an extra 2 words and get the FPIAR from the FPU.
-*
-g_trace:
- bftst EXC_VEC-4(sp){0:4}
- bne g_easy
-
- subq.l #4,sp make room
- move.l 4(sp),(sp)
- move.l 8(sp),4(sp)
- sub.l #BUSY_SIZE,sp
- fsave (sp)
- fmove.l fpiar,BUSY_SIZE+EXC_EA-4(sp)
- frestore (sp)
- add.l #BUSY_SIZE,sp
-
-g_easy:
- move.w #TRACE_VEC,EXC_VEC-4(a7)
- bra.l real_trace
-*
-* This is a work-around for hardware bug 1384.
-*
-bug1384:
- link a5,#0
- fsave -(sp)
- cmpi.b #$41,(sp) ; check for correct frame
- beq frame_41
- bgt nofix ; if more advanced mask, do nada
-
-frame_40:
- tst.b 1(sp) ; check to see if idle
- bne notidle
-idle40:
- clr.l (sp) ; get rid of old fsave frame
- move.l d1,USER_D1(a6) ; save d1
- move.w #8,d1 ; place unimp frame instead
-loop40: clr.l -(sp)
- dbra d1,loop40
- move.l USER_D1(a6),d1 ; restore d1
- move.l #$40280000,-(sp)
- frestore (sp)+
- unlk a5
- rts
-
-frame_41:
- tst.b 1(sp) ; check to see if idle
- bne notidle
-idle41:
- clr.l (sp) ; get rid of old fsave frame
- move.l d1,USER_D1(a6) ; save d1
- move.w #10,d1 ; place unimp frame instead
-loop41: clr.l -(sp)
- dbra d1,loop41
- move.l USER_D1(a6),d1 ; restore d1
- move.l #$41300000,-(sp)
- frestore (sp)+
- unlk a5
- rts
-
-notidle:
- bclr.b #etemp15_bit,-40(a5)
- frestore (sp)+
- unlk a5
- rts
-
-nofix:
- frestore (sp)+
- unlk a5
- rts
-
- end
diff --git a/sys/arch/m68k/fpsp/get_op.sa b/sys/arch/m68k/fpsp/get_op.sa
deleted file mode 100644
index 2c0d50b0757..00000000000
--- a/sys/arch/m68k/fpsp/get_op.sa
+++ /dev/null
@@ -1,703 +0,0 @@
-* $OpenBSD: get_op.sa,v 1.3 2013/02/02 13:32:05 miod Exp $
-* $NetBSD: get_op.sa,v 1.3 1994/10/26 07:49:09 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* get_op.sa 3.6 5/19/92
-*
-* get_op.sa 3.5 4/26/91
-*
-* Description: This routine is called by the unsupported format/data
-* type exception handler ('unsupp' - vector 55) and the unimplemented
-* instruction exception handler ('unimp' - vector 11). 'get_op'
-* determines the opclass (0, 2, or 3) and branches to the
-* opclass handler routine. See 68881/2 User's Manual table 4-11
-* for a description of the opclasses.
-*
-* For UNSUPPORTED data/format (exception vector 55) and for
-* UNIMPLEMENTED instructions (exception vector 11) the following
-* applies:
-*
-* - For unnormormalized numbers (opclass 0, 2, or 3) the
-* number(s) is normalized and the operand type tag is updated.
-*
-* - For a packed number (opclass 2) the number is unpacked and the
-* operand type tag is updated.
-*
-* - For denormalized numbers (opclass 0 or 2) the number(s) is not
-* changed but passed to the next module. The next module for
-* unimp is do_func, the next module for unsupp is res_func.
-*
-* For UNSUPPORTED data/format (exception vector 55) only the
-* following applies:
-*
-* - If there is a move out with a packed number (opclass 3) the
-* number is packed and written to user memory. For the other
-* opclasses the number(s) are written back to the fsave stack
-* and the instruction is then restored back into the '040. The
-* '040 is then able to complete the instruction.
-*
-* For example:
-* fadd.x fpm,fpn where the fpm contains an unnormalized number.
-* The '040 takes an unsupported data trap and gets to this
-* routine. The number is normalized, put back on the stack and
-* then an frestore is done to restore the instruction back into
-* the '040. The '040 then re-executes the fadd.x fpm,fpn with
-* a normalized number in the source and the instruction is
-* successful.
-*
-* Next consider if in the process of normalizing the un-
-* normalized number it becomes a denormalized number. The
-* routine which converts the unnorm to a norm (called mk_norm)
-* detects this and tags the number as a denorm. The routine
-* res_func sees the denorm tag and converts the denorm to a
-* norm. The instruction is then restored back into the '040
-* which re_executess the instruction.
-*
-
-GET_OP IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
- xdef PIRN,PIRZRM,PIRP
- xdef SMALRN,SMALRZRM,SMALRP
- xdef BIGRN,BIGRZRM,BIGRP
-
-PIRN:
- dc.l $40000000,$c90fdaa2,$2168c235 ;pi
-PIRZRM:
- dc.l $40000000,$c90fdaa2,$2168c234 ;pi
-PIRP:
- dc.l $40000000,$c90fdaa2,$2168c235 ;pi
-
-*round to nearest
-SMALRN:
- dc.l $3ffd0000,$9a209a84,$fbcff798 ;log10(2)
- dc.l $40000000,$adf85458,$a2bb4a9a ;e
- dc.l $3fff0000,$b8aa3b29,$5c17f0bc ;log2(e)
- dc.l $3ffd0000,$de5bd8a9,$37287195 ;log10(e)
- dc.l $00000000,$00000000,$00000000 ;0.0
-* round to zero;round to negative infinity
-SMALRZRM:
- dc.l $3ffd0000,$9a209a84,$fbcff798 ;log10(2)
- dc.l $40000000,$adf85458,$a2bb4a9a ;e
- dc.l $3fff0000,$b8aa3b29,$5c17f0bb ;log2(e)
- dc.l $3ffd0000,$de5bd8a9,$37287195 ;log10(e)
- dc.l $00000000,$00000000,$00000000 ;0.0
-* round to positive infinity
-SMALRP:
- dc.l $3ffd0000,$9a209a84,$fbcff799 ;log10(2)
- dc.l $40000000,$adf85458,$a2bb4a9b ;e
- dc.l $3fff0000,$b8aa3b29,$5c17f0bc ;log2(e)
- dc.l $3ffd0000,$de5bd8a9,$37287195 ;log10(e)
- dc.l $00000000,$00000000,$00000000 ;0.0
-
-*round to nearest
-BIGRN:
- dc.l $3ffe0000,$b17217f7,$d1cf79ac ;ln(2)
- dc.l $40000000,$935d8ddd,$aaa8ac17 ;ln(10)
- dc.l $3fff0000,$80000000,$00000000 ;10 ^ 0
-
- xdef PTENRN
-PTENRN:
- dc.l $40020000,$A0000000,$00000000 ;10 ^ 1
- dc.l $40050000,$C8000000,$00000000 ;10 ^ 2
- dc.l $400C0000,$9C400000,$00000000 ;10 ^ 4
- dc.l $40190000,$BEBC2000,$00000000 ;10 ^ 8
- dc.l $40340000,$8E1BC9BF,$04000000 ;10 ^ 16
- dc.l $40690000,$9DC5ADA8,$2B70B59E ;10 ^ 32
- dc.l $40D30000,$C2781F49,$FFCFA6D5 ;10 ^ 64
- dc.l $41A80000,$93BA47C9,$80E98CE0 ;10 ^ 128
- dc.l $43510000,$AA7EEBFB,$9DF9DE8E ;10 ^ 256
- dc.l $46A30000,$E319A0AE,$A60E91C7 ;10 ^ 512
- dc.l $4D480000,$C9767586,$81750C17 ;10 ^ 1024
- dc.l $5A920000,$9E8B3B5D,$C53D5DE5 ;10 ^ 2048
- dc.l $75250000,$C4605202,$8A20979B ;10 ^ 4096
-*round to minus infinity
-BIGRZRM:
- dc.l $3ffe0000,$b17217f7,$d1cf79ab ;ln(2)
- dc.l $40000000,$935d8ddd,$aaa8ac16 ;ln(10)
- dc.l $3fff0000,$80000000,$00000000 ;10 ^ 0
-
- xdef PTENRM
-PTENRM:
- dc.l $40020000,$A0000000,$00000000 ;10 ^ 1
- dc.l $40050000,$C8000000,$00000000 ;10 ^ 2
- dc.l $400C0000,$9C400000,$00000000 ;10 ^ 4
- dc.l $40190000,$BEBC2000,$00000000 ;10 ^ 8
- dc.l $40340000,$8E1BC9BF,$04000000 ;10 ^ 16
- dc.l $40690000,$9DC5ADA8,$2B70B59D ;10 ^ 32
- dc.l $40D30000,$C2781F49,$FFCFA6D5 ;10 ^ 64
- dc.l $41A80000,$93BA47C9,$80E98CDF ;10 ^ 128
- dc.l $43510000,$AA7EEBFB,$9DF9DE8D ;10 ^ 256
- dc.l $46A30000,$E319A0AE,$A60E91C6 ;10 ^ 512
- dc.l $4D480000,$C9767586,$81750C17 ;10 ^ 1024
- dc.l $5A920000,$9E8B3B5D,$C53D5DE5 ;10 ^ 2048
- dc.l $75250000,$C4605202,$8A20979A ;10 ^ 4096
-*round to positive infinity
-BIGRP:
- dc.l $3ffe0000,$b17217f7,$d1cf79ac ;ln(2)
- dc.l $40000000,$935d8ddd,$aaa8ac17 ;ln(10)
- dc.l $3fff0000,$80000000,$00000000 ;10 ^ 0
-
- xdef PTENRP
-PTENRP:
- dc.l $40020000,$A0000000,$00000000 ;10 ^ 1
- dc.l $40050000,$C8000000,$00000000 ;10 ^ 2
- dc.l $400C0000,$9C400000,$00000000 ;10 ^ 4
- dc.l $40190000,$BEBC2000,$00000000 ;10 ^ 8
- dc.l $40340000,$8E1BC9BF,$04000000 ;10 ^ 16
- dc.l $40690000,$9DC5ADA8,$2B70B59E ;10 ^ 32
- dc.l $40D30000,$C2781F49,$FFCFA6D6 ;10 ^ 64
- dc.l $41A80000,$93BA47C9,$80E98CE0 ;10 ^ 128
- dc.l $43510000,$AA7EEBFB,$9DF9DE8E ;10 ^ 256
- dc.l $46A30000,$E319A0AE,$A60E91C7 ;10 ^ 512
- dc.l $4D480000,$C9767586,$81750C18 ;10 ^ 1024
- dc.l $5A920000,$9E8B3B5D,$C53D5DE6 ;10 ^ 2048
- dc.l $75250000,$C4605202,$8A20979B ;10 ^ 4096
-
- xref nrm_zero
- xref decbin
- xref round
-
- xdef get_op
- xdef uns_getop
- xdef uni_getop
-get_op:
- clr.b DY_MO_FLG(a6)
- tst.b UFLG_TMP(a6) ;test flag for unsupp/unimp state
- beq.b short_uni_getop
-
-uns_getop:
- btst.b #direction_bit,CMDREG1B(a6)
- bne.w opclass3 ;branch if a fmove out (any kind)
- btst.b #6,CMDREG1B(a6)
- beq.b uns_notpacked
-
- bfextu CMDREG1B(a6){3:3},d0
- cmp.b #3,d0
- beq.w pack_source ;check for a packed src op, branch if so
-uns_notpacked:
- bsr chk_dy_mo ;set the dyadic/monadic flag
- tst.b DY_MO_FLG(a6)
- beq.b src_op_ck ;if monadic, go check src op
-* ;else, check dst op (fall through)
-
- btst.b #7,DTAG(a6)
- beq.b src_op_ck ;if dst op is norm, check src op
- bra.b dst_ex_dnrm ;else, handle destination unnorm/dnrm
-
-uni_getop:
-short_uni_getop:
- bfextu CMDREG1B(a6){0:6},d0 ;get opclass and src fields
- cmpi.l #$17,d0 ;if op class and size fields are $17,
-* ;it is FMOVECR; if not, continue
-*
-* If the instruction is fmovecr, exit get_op. It is handled
-* in do_func and smovecr.sa.
-*
- bne.w not_fmovecr ;handle fmovecr as an unimplemented inst
- rts
-
-not_fmovecr:
- btst.b #E1,E_BYTE(a6) ;if set, there is a packed operand
- bne.w pack_source ;check for packed src op, branch if so
-
-* The following lines of are coded to optimize on normalized operands
- move.b STAG(a6),d0
- or.b DTAG(a6),d0 ;check if either of STAG/DTAG msb set
- bmi.b dest_op_ck ;if so, some op needs to be fixed
- rts
-
-dest_op_ck:
- btst.b #7,DTAG(a6) ;check for unsupported data types in
- beq.b src_op_ck ;the destination, if not, check src op
- bsr chk_dy_mo ;set dyadic/monadic flag
- tst.b DY_MO_FLG(a6) ;
- beq.b src_op_ck ;if monadic, check src op
-*
-* At this point, destination has an extended denorm or unnorm.
-*
-dst_ex_dnrm:
- move.w FPTEMP_EX(a6),d0 ;get destination exponent
- andi.w #$7fff,d0 ;mask sign, check if exp = 0000
- beq.b src_op_ck ;if denorm then check source op.
-* ;denorms are taken care of in res_func
-* ;(unsupp) or do_func (unimp)
-* ;else unnorm fall through
- lea.l FPTEMP(a6),a0 ;point a0 to dop - used in mk_norm
- bsr mk_norm ;go normalize - mk_norm returns:
-* ;L_SCR1{7:5} = operand tag
-* ; (000 = norm, 100 = denorm)
-* ;L_SCR1{4} = fpte15 or ete15
-* ; 0 = exp > $3fff
-* ; 1 = exp <= $3fff
-* ;and puts the normalized num back
-* ;on the fsave stack
-*
- move.b L_SCR1(a6),DTAG(a6) ;write the new tag & fpte15
-* ;to the fsave stack and fall
-* ;through to check source operand
-*
-src_op_ck:
- btst.b #7,STAG(a6)
- beq.w end_getop ;check for unsupported data types on the
-* ;source operand
- btst.b #5,STAG(a6)
- bne.b src_sd_dnrm ;if bit 5 set, handle sgl/dbl denorms
-*
-* At this point only unnorms or extended denorms are possible.
-*
-src_ex_dnrm:
- move.w ETEMP_EX(a6),d0 ;get source exponent
- andi.w #$7fff,d0 ;mask sign, check if exp = 0000
- beq.w end_getop ;if denorm then exit, denorms are
-* ;handled in do_func
- lea.l ETEMP(a6),a0 ;point a0 to sop - used in mk_norm
- bsr mk_norm ;go normalize - mk_norm returns:
-* ;L_SCR1{7:5} = operand tag
-* ; (000 = norm, 100 = denorm)
-* ;L_SCR1{4} = fpte15 or ete15
-* ; 0 = exp > $3fff
-* ; 1 = exp <= $3fff
-* ;and puts the normalized num back
-* ;on the fsave stack
-*
- move.b L_SCR1(a6),STAG(a6) ;write the new tag & ete15
- rts ;end_getop
-
-*
-* At this point, only single or double denorms are possible.
-* If the inst is not fmove, normalize the source. If it is,
-* do nothing to the input.
-*
-src_sd_dnrm:
- btst.b #4,CMDREG1B(a6) ;differentiate between sgl/dbl denorm
- bne.b is_double
-is_single:
- move.w #$3f81,d1 ;write bias for sgl denorm
- bra.b common ;goto the common code
-is_double:
- move.w #$3c01,d1 ;write the bias for a dbl denorm
-common:
- btst.b #sign_bit,ETEMP_EX(a6) ;grab sign bit of mantissa
- beq.b pos
- bset #15,d1 ;set sign bit because it is negative
-pos:
- move.w d1,ETEMP_EX(a6)
-* ;put exponent on stack
-
- move.w CMDREG1B(a6),d1
- and.w #$e3ff,d1 ;clear out source specifier
- or.w #$0800,d1 ;set source specifier to extended prec
- move.w d1,CMDREG1B(a6) ;write back to the command word in stack
-* ;this is needed to fix unsupp data stack
- lea.l ETEMP(a6),a0 ;point a0 to sop
-
- bsr mk_norm ;convert sgl/dbl denorm to norm
- move.b L_SCR1(a6),STAG(a6) ;put tag into source tag reg - d0
- rts ;end_getop
-*
-* At this point, the source is definitely packed, whether
-* instruction is dyadic or monadic is still unknown
-*
-pack_source:
- move.l FPTEMP_LO(a6),ETEMP(a6) ;write ms part of packed
-* ;number to etemp slot
- bsr chk_dy_mo ;set dyadic/monadic flag
- bsr unpack
-
- tst.b DY_MO_FLG(a6)
- beq.b end_getop ;if monadic, exit
-* ;else, fix FPTEMP
-pack_dya:
- bfextu CMDREG1B(a6){6:3},d0 ;extract dest fp reg
- move.l #7,d1
- sub.l d0,d1
- clr.l d0
- bset.l d1,d0 ;set up d0 as a dynamic register mask
- fmovem.x d0,FPTEMP(a6) ;write to FPTEMP
-
- btst.b #7,DTAG(a6) ;check dest tag for unnorm or denorm
- bne.w dst_ex_dnrm ;else, handle the unnorm or ext denorm
-*
-* Dest is not denormalized. Check for norm, and set fpte15
-* accordingly.
-*
- move.b DTAG(a6),d0
- andi.b #$f0,d0 ;strip to only dtag:fpte15
- tst.b d0 ;check for normalized value
- bne.b end_getop ;if inf/nan/zero leave get_op
- move.w FPTEMP_EX(a6),d0
- andi.w #$7fff,d0
- cmpi.w #$3fff,d0 ;check if fpte15 needs setting
- bge.b end_getop ;if >= $3fff, leave fpte15=0
- or.b #$10,DTAG(a6)
- bra.b end_getop
-
-*
-* At this point, it is either an fmoveout packed, unnorm or denorm
-*
-opclass3:
- clr.b DY_MO_FLG(a6) ;set dyadic/monadic flag to monadic
- bfextu CMDREG1B(a6){4:2},d0
- cmpi.b #3,d0
- bne.w src_ex_dnrm ;if not equal, must be unnorm or denorm
-* ;else it is a packed move out
-* ;exit
-end_getop:
- rts
-
-*
-* Sets the DY_MO_FLG correctly. This is used only on if it is an
-* unuspported data type exception. Set if dyadic.
-*
-chk_dy_mo:
- move.w CMDREG1B(a6),d0
- btst.l #5,d0 ;testing extension command word
- beq.b set_mon ;if bit 5 = 0 then monadic
- btst.l #4,d0 ;know that bit 5 = 1
- beq.b set_dya ;if bit 4 = 0 then dyadic
- andi.w #$007f,d0 ;get rid of all but extension bits {6:0}
- cmpi.w #$0038,d0 ;if extension = $38 then fcmp (dyadic)
- bne.b set_mon
-set_dya:
- st.b DY_MO_FLG(a6) ;set the inst flag type to dyadic
- rts
-set_mon:
- clr.b DY_MO_FLG(a6) ;set the inst flag type to monadic
- rts
-*
-* MK_NORM
-*
-* Normalizes unnormalized numbers, sets tag to norm or denorm, sets unfl
-* exception if denorm.
-*
-* CASE opclass 0x0 unsupp
-* mk_norm till msb set
-* set tag = norm
-*
-* CASE opclass 0x0 unimp
-* mk_norm till msb set or exp = 0
-* if integer bit = 0
-* tag = denorm
-* else
-* tag = norm
-*
-* CASE opclass 011 unsupp
-* mk_norm till msb set or exp = 0
-* if integer bit = 0
-* tag = denorm
-* set unfl_nmcexe = 1
-* else
-* tag = norm
-*
-* if exp <= $3fff
-* set ete15 or fpte15 = 1
-* else set ete15 or fpte15 = 0
-
-* input:
-* a0 = points to operand to be normalized
-* output:
-* L_SCR1{7:5} = operand tag (000 = norm, 100 = denorm)
-* L_SCR1{4} = fpte15 or ete15 (0 = exp > $3fff, 1 = exp <=$3fff)
-* the normalized operand is placed back on the fsave stack
-mk_norm:
- clr.l L_SCR1(a6)
- bclr.b #sign_bit,LOCAL_EX(a0)
- sne LOCAL_SGN(a0) ;transform into internal extended format
-
- cmpi.b #$2c,1+EXC_VEC(a6) ;check if unimp
- bne.b uns_data ;branch if unsupp
- bsr uni_inst ;call if unimp (opclass 0x0)
- bra.b reload
-uns_data:
- btst.b #direction_bit,CMDREG1B(a6) ;check transfer direction
- bne.b bit_set ;branch if set (opclass 011)
- bsr uns_opx ;call if opclass 0x0
- bra.b reload
-bit_set:
- bsr uns_op3 ;opclass 011
-reload:
- cmp.w #$3fff,LOCAL_EX(a0) ;if exp > $3fff
- bgt.b end_mk ; fpte15/ete15 already set to 0
- bset.b #4,L_SCR1(a6) ;else set fpte15/ete15 to 1
-* ;calling routine actually sets the
-* ;value on the stack (along with the
-* ;tag), since this routine doesn't
-* ;know if it should set ete15 or fpte15
-* ;ie, it doesn't know if this is the
-* ;src op or dest op.
-end_mk:
- bfclr LOCAL_SGN(a0){0:8}
- beq.b end_mk_pos
- bset.b #sign_bit,LOCAL_EX(a0) ;convert back to IEEE format
-end_mk_pos:
- rts
-*
-* CASE opclass 011 unsupp
-*
-uns_op3:
- bsr nrm_zero ;normalize till msb = 1 or exp = zero
- btst.b #7,LOCAL_HI(a0) ;if msb = 1
- bne.b no_unfl ;then branch
-set_unfl:
- or.b #dnrm_tag,L_SCR1(a6) ;set denorm tag
- bset.b #unfl_bit,FPSR_EXCEPT(a6) ;set unfl exception bit
-no_unfl:
- rts
-*
-* CASE opclass 0x0 unsupp
-*
-uns_opx:
- bsr nrm_zero ;normalize the number
- btst.b #7,LOCAL_HI(a0) ;check if integer bit (j-bit) is set
- beq.b uns_den ;if clear then now have a denorm
-uns_nrm:
- or.b #norm_tag,L_SCR1(a6) ;set tag to norm
- rts
-uns_den:
- or.b #dnrm_tag,L_SCR1(a6) ;set tag to denorm
- rts
-*
-* CASE opclass 0x0 unimp
-*
-uni_inst:
- bsr nrm_zero
- btst.b #7,LOCAL_HI(a0) ;check if integer bit (j-bit) is set
- beq.b uni_den ;if clear then now have a denorm
-uni_nrm:
- or.b #norm_tag,L_SCR1(a6) ;set tag to norm
- rts
-uni_den:
- or.b #dnrm_tag,L_SCR1(a6) ;set tag to denorm
- rts
-
-*
-* Decimal to binary conversion
-*
-* Special cases of inf and NaNs are completed outside of decbin.
-* If the input is an snan, the snan bit is not set.
-*
-* input:
-* ETEMP(a6) - points to packed decimal string in memory
-* output:
-* fp0 - contains packed string converted to extended precision
-* ETEMP - same as fp0
-unpack:
- move.w CMDREG1B(a6),d0 ;examine command word, looking for fmove's
- and.w #$3b,d0
- beq move_unpack ;special handling for fmove: must set FPSR_CC
-
- move.w ETEMP(a6),d0 ;get word with inf information
- bfextu d0{20:12},d1 ;get exponent into d1
- cmpi.w #$0fff,d1 ;test for inf or NaN
- bne.b try_zero ;if not equal, it is not special
- bfextu d0{17:3},d1 ;get SE and y bits into d1
- cmpi.w #7,d1 ;SE and y bits must be on for special
- bne.b try_zero ;if not on, it is not special
-*input is of the special cases of inf and NaN
- tst.l ETEMP_HI(a6) ;check ms mantissa
- bne.b fix_nan ;if non-zero, it is a NaN
- tst.l ETEMP_LO(a6) ;check ls mantissa
- bne.b fix_nan ;if non-zero, it is a NaN
- bra.w finish ;special already on stack
-fix_nan:
- btst.b #signan_bit,ETEMP_HI(a6) ;test for snan
- bne.w finish
- or.l #snaniop_mask,USER_FPSR(a6) ;always set snan if it is so
- bra.w finish
-try_zero:
- move.w ETEMP_EX+2(a6),d0 ;get word 4
- andi.w #$000f,d0 ;clear all but last ni(y)bble
- tst.w d0 ;check for zero.
- bne.w not_spec
- tst.l ETEMP_HI(a6) ;check words 3 and 2
- bne.w not_spec
- tst.l ETEMP_LO(a6) ;check words 1 and 0
- bne.w not_spec
- tst.l ETEMP(a6) ;test sign of the zero
- bge.b pos_zero
- move.l #$80000000,ETEMP(a6) ;write neg zero to etemp
- clr.l ETEMP_HI(a6)
- clr.l ETEMP_LO(a6)
- bra.w finish
-pos_zero:
- clr.l ETEMP(a6)
- clr.l ETEMP_HI(a6)
- clr.l ETEMP_LO(a6)
- bra.w finish
-
-not_spec:
- fmovem.x fp0-fp1,-(a7) ;save fp0 - decbin returns in it
- bsr decbin
- fmove.x fp0,ETEMP(a6) ;put the unpacked sop in the fsave stack
- fmovem.x (a7)+,fp0-fp1
- fmove.l #0,FPSR ;clr fpsr from decbin
- bra finish
-
-*
-* Special handling for packed move in: Same results as all other
-* packed cases, but we must set the FPSR condition codes properly.
-*
-move_unpack:
- move.w ETEMP(a6),d0 ;get word with inf information
- bfextu d0{20:12},d1 ;get exponent into d1
- cmpi.w #$0fff,d1 ;test for inf or NaN
- bne.b mtry_zero ;if not equal, it is not special
- bfextu d0{17:3},d1 ;get SE and y bits into d1
- cmpi.w #7,d1 ;SE and y bits must be on for special
- bne.b mtry_zero ;if not on, it is not special
-*input is of the special cases of inf and NaN
- tst.l ETEMP_HI(a6) ;check ms mantissa
- bne.b mfix_nan ;if non-zero, it is a NaN
- tst.l ETEMP_LO(a6) ;check ls mantissa
- bne.b mfix_nan ;if non-zero, it is a NaN
-*input is inf
- or.l #inf_mask,USER_FPSR(a6) ;set I bit
- tst.l ETEMP(a6) ;check sign
- bge.w finish
- or.l #neg_mask,USER_FPSR(a6) ;set N bit
- bra.w finish ;special already on stack
-mfix_nan:
- or.l #nan_mask,USER_FPSR(a6) ;set NaN bit
- move.b #nan_tag,STAG(a6) ;set stag to NaN
- btst.b #signan_bit,ETEMP_HI(a6) ;test for snan
- bne.b mn_snan
- or.l #snaniop_mask,USER_FPSR(a6) ;set snan bit
- btst.b #snan_bit,FPCR_ENABLE(a6) ;test for snan enabled
- bne.b mn_snan
- bset.b #signan_bit,ETEMP_HI(a6) ;force snans to qnans
-mn_snan:
- tst.l ETEMP(a6) ;check for sign
- bge.w finish ;if clr, go on
- or.l #neg_mask,USER_FPSR(a6) ;set N bit
- bra.w finish
-
-mtry_zero:
- move.w ETEMP_EX+2(a6),d0 ;get word 4
- andi.w #$000f,d0 ;clear all but last ni(y)bble
- tst.w d0 ;check for zero.
- bne.b mnot_spec
- tst.l ETEMP_HI(a6) ;check words 3 and 2
- bne.b mnot_spec
- tst.l ETEMP_LO(a6) ;check words 1 and 0
- bne.b mnot_spec
- tst.l ETEMP(a6) ;test sign of the zero
- bge.b mpos_zero
- or.l #neg_mask+z_mask,USER_FPSR(a6) ;set N and Z
- move.l #$80000000,ETEMP(a6) ;write neg zero to etemp
- clr.l ETEMP_HI(a6)
- clr.l ETEMP_LO(a6)
- bra.b finish
-mpos_zero:
- or.l #z_mask,USER_FPSR(a6) ;set Z
- clr.l ETEMP(a6)
- clr.l ETEMP_HI(a6)
- clr.l ETEMP_LO(a6)
- bra.b finish
-
-mnot_spec:
- fmovem.x fp0-fp1,-(a7) ;save fp0 ,fp1 - decbin returns in fp0
- bsr decbin
- fmove.x fp0,ETEMP(a6)
-* ;put the unpacked sop in the fsave stack
- fmovem.x (a7)+,fp0-fp1
-
-finish:
- move.w CMDREG1B(a6),d0 ;get the command word
- and.w #$fbff,d0 ;change the source specifier field to
-* ;extended (was packed).
- move.w d0,CMDREG1B(a6) ;write command word back to fsave stack
-* ;we need to do this so the 040 will
-* ;re-execute the inst. without taking
-* ;another packed trap.
-
-fix_stag:
-*Converted result is now in etemp on fsave stack, now set the source
-*tag (stag)
-* if (ete =$7fff) then INF or NAN
-* if (etemp = $x.0----0) then
-* stag = INF
-* else
-* stag = NAN
-* else
-* if (ete = $0000) then
-* stag = ZERO
-* else
-* stag = NORM
-*
-* Note also that the etemp_15 bit (just right of the stag) must
-* be set accordingly.
-*
- move.w ETEMP_EX(a6),d1
- andi.w #$7fff,d1 ;strip sign
- cmp.w #$7fff,d1
- bne.b z_or_nrm
- move.l ETEMP_HI(a6),d1
- bne.b is_nan
- move.l ETEMP_LO(a6),d1
- bne.b is_nan
-is_inf:
- move.b #$40,STAG(a6)
- move.l #$40,d0
- rts
-is_nan:
- move.b #$60,STAG(a6)
- move.l #$60,d0
- rts
-z_or_nrm:
- tst.w d1
- bne.b is_nrm
-is_zro:
-* For a zero, set etemp_15
- move.b #$30,STAG(a6)
- move.l #$20,d0
- rts
-is_nrm:
-* For a norm, check if the exp <= $3fff; if so, set etemp_15
- cmpi.w #$3fff,d1
- ble.b set_bit15
- clr.b STAG(a6)
- bra.b end_is_nrm
-set_bit15:
- move.b #$10,STAG(a6)
-end_is_nrm:
- clr.l d0
-end_fix:
- rts
-
-end_get:
- rts
- end
diff --git a/sys/arch/m68k/fpsp/kernel_ex.sa b/sys/arch/m68k/fpsp/kernel_ex.sa
deleted file mode 100644
index 3028b2ae4e2..00000000000
--- a/sys/arch/m68k/fpsp/kernel_ex.sa
+++ /dev/null
@@ -1,520 +0,0 @@
-* $OpenBSD: kernel_ex.sa,v 1.2 1996/05/29 21:05:30 niklas Exp $
-* $NetBSD: kernel_ex.sa,v 1.2 1994/10/26 07:49:12 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* kernel_ex.sa 3.3 12/19/90
-*
-* This file contains routines to force exception status in the
-* fpu for exceptional cases detected or reported within the
-* transcendental functions. Typically, the t_xx routine will
-* set the appropriate bits in the USER_FPSR word on the stack.
-* The bits are tested in gen_except.sa to determine if an exceptional
-* situation needs to be created on return from the FPSP.
-*
-
-KERNEL_EX IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
-mns_inf dc.l $ffff0000,$00000000,$00000000
-pls_inf dc.l $7fff0000,$00000000,$00000000
-nan dc.l $7fff0000,$ffffffff,$ffffffff
-huge dc.l $7ffe0000,$ffffffff,$ffffffff
-
- xref ovf_r_k
- xref unf_sub
- xref nrm_set
-
- xdef t_dz
- xdef t_dz2
- xdef t_operr
- xdef t_unfl
- xdef t_ovfl
- xdef t_ovfl2
- xdef t_inx2
- xdef t_frcinx
- xdef t_extdnrm
- xdef t_resdnrm
- xdef dst_nan
- xdef src_nan
-*
-* DZ exception
-*
-*
-* if dz trap disabled
-* store properly signed inf (use sign of etemp) into fp0
-* set FPSR exception status dz bit, condition code
-* inf bit, and accrued dz bit
-* return
-* frestore the frame into the machine (done by unimp_hd)
-*
-* else dz trap enabled
-* set exception status bit & accrued bits in FPSR
-* set flag to disable sto_res from corrupting fp register
-* return
-* frestore the frame into the machine (done by unimp_hd)
-*
-* t_dz2 is used by monadic functions such as flogn (from do_func).
-* t_dz is used by monadic functions such as satanh (from the
-* transcendental function).
-*
-t_dz2:
- bset.b #neg_bit,FPSR_CC(a6) ;set neg bit in FPSR
- fmove.l #0,FPSR ;clr status bits (Z set)
- btst.b #dz_bit,FPCR_ENABLE(a6) ;test FPCR for dz exc enabled
- bne.b dz_ena_end
- bra.b m_inf ;flogx always returns -inf
-t_dz:
- fmove.l #0,FPSR ;clr status bits (Z set)
- btst.b #dz_bit,FPCR_ENABLE(a6) ;test FPCR for dz exc enabled
- bne.b dz_ena
-*
-* dz disabled
-*
- btst.b #sign_bit,ETEMP_EX(a6) ;check sign for neg or pos
- beq.b p_inf ;branch if pos sign
-
-m_inf:
- fmovem.x mns_inf,fp0 ;load -inf
- bset.b #neg_bit,FPSR_CC(a6) ;set neg bit in FPSR
- bra.b set_fpsr
-p_inf:
- fmovem.x pls_inf,fp0 ;load +inf
-set_fpsr:
- or.l #dzinf_mask,USER_FPSR(a6) ;set I,DZ,ADZ
- rts
-*
-* dz enabled
-*
-dz_ena:
- btst.b #sign_bit,ETEMP_EX(a6) ;check sign for neg or pos
- beq.b dz_ena_end
- bset.b #neg_bit,FPSR_CC(a6) ;set neg bit in FPSR
-dz_ena_end:
- or.l #dzinf_mask,USER_FPSR(a6) ;set I,DZ,ADZ
- st.b STORE_FLG(a6)
- rts
-*
-* OPERR exception
-*
-* if (operr trap disabled)
-* set FPSR exception status operr bit, condition code
-* nan bit; Store default NAN into fp0
-* frestore the frame into the machine (done by unimp_hd)
-*
-* else (operr trap enabled)
-* set FPSR exception status operr bit, accrued operr bit
-* set flag to disable sto_res from corrupting fp register
-* frestore the frame into the machine (done by unimp_hd)
-*
-t_operr:
- or.l #opnan_mask,USER_FPSR(a6) ;set NaN, OPERR, AIOP
-
- btst.b #operr_bit,FPCR_ENABLE(a6) ;test FPCR for operr enabled
- bne.b op_ena
-
- fmovem.x nan,fp0 ;load default nan
- rts
-op_ena:
- st.b STORE_FLG(a6) ;do not corrupt destination
- rts
-
-*
-* t_unfl --- UNFL exception
-*
-* This entry point is used by all routines requiring unfl, inex2,
-* aunfl, and ainex to be set on exit.
-*
-* On entry, a0 points to the exceptional operand. The final exceptional
-* operand is built in FP_SCR1 and only the sign from the original operand
-* is used.
-*
-t_unfl:
- clr.l FP_SCR1(a6) ;set exceptional operand to zero
- clr.l FP_SCR1+4(a6)
- clr.l FP_SCR1+8(a6)
- tst.b (a0) ;extract sign from caller's exop
- bpl.b unfl_signok
- bset #sign_bit,FP_SCR1(a6)
-unfl_signok:
- lea.l FP_SCR1(a6),a0
- or.l #unfinx_mask,USER_FPSR(a6)
-* ;set UNFL, INEX2, AUNFL, AINEX
-unfl_con:
- btst.b #unfl_bit,FPCR_ENABLE(a6)
- beq.b unfl_dis
-
-unfl_ena:
- bfclr STAG(a6){5:3} ;clear wbtm66,wbtm1,wbtm0
- bset.b #wbtemp15_bit,WB_BYTE(a6) ;set wbtemp15
- bset.b #sticky_bit,STICKY(a6) ;set sticky bit
-
- bclr.b #E1,E_BYTE(a6)
-
-unfl_dis:
- bfextu FPCR_MODE(a6){0:2},d0 ;get round precision
-
- bclr.b #sign_bit,LOCAL_EX(a0)
- sne LOCAL_SGN(a0) ;convert to internal ext format
-
- bsr unf_sub ;returns IEEE result at a0
-* ;and sets FPSR_CC accordingly
-
- bfclr LOCAL_SGN(a0){0:8} ;convert back to IEEE ext format
- beq.b unfl_fin
-
- bset.b #sign_bit,LOCAL_EX(a0)
- bset.b #sign_bit,FP_SCR1(a6) ;set sign bit of exc operand
-
-unfl_fin:
- fmovem.x (a0),fp0 ;store result in fp0
- rts
-
-
-*
-* t_ovfl2 --- OVFL exception (without inex2 returned)
-*
-* This entry is used by scale to force catastrophic overflow. The
-* ovfl, aovfl, and ainex bits are set, but not the inex2 bit.
-*
-t_ovfl2:
- or.l #ovfl_inx_mask,USER_FPSR(a6)
- move.l ETEMP(a6),FP_SCR1(a6)
- move.l ETEMP_HI(a6),FP_SCR1+4(a6)
- move.l ETEMP_LO(a6),FP_SCR1+8(a6)
-*
-* Check for single or double round precision. If single, check if
-* the lower 40 bits of ETEMP are zero; if not, set inex2. If double,
-* check if the lower 21 bits are zero; if not, set inex2.
-*
- move.b FPCR_MODE(a6),d0
- andi.b #$c0,d0
- beq.w t_work ;if extended, finish ovfl processing
- cmpi.b #$40,d0 ;test for single
- bne.b t_dbl
-t_sgl:
- tst.b ETEMP_LO(a6)
- bne.b t_setinx2
- move.l ETEMP_HI(a6),d0
- andi.l #$ff,d0 ;look at only lower 8 bits
- bne.b t_setinx2
- bra.w t_work
-t_dbl:
- move.l ETEMP_LO(a6),d0
- andi.l #$7ff,d0 ;look at only lower 11 bits
- beq.w t_work
-t_setinx2:
- or.l #inex2_mask,USER_FPSR(a6)
- bra.b t_work
-*
-* t_ovfl --- OVFL exception
-*
-*** Note: the exc operand is returned in ETEMP.
-*
-t_ovfl:
- or.l #ovfinx_mask,USER_FPSR(a6)
-t_work:
- btst.b #ovfl_bit,FPCR_ENABLE(a6) ;test FPCR for ovfl enabled
- beq.b ovf_dis
-
-ovf_ena:
- clr.l FP_SCR1(a6) ;set exceptional operand
- clr.l FP_SCR1+4(a6)
- clr.l FP_SCR1+8(a6)
-
- bfclr STAG(a6){5:3} ;clear wbtm66,wbtm1,wbtm0
- bclr.b #wbtemp15_bit,WB_BYTE(a6) ;clear wbtemp15
- bset.b #sticky_bit,STICKY(a6) ;set sticky bit
-
- bclr.b #E1,E_BYTE(a6)
-* ;fall through to disabled case
-
-* For disabled overflow call 'ovf_r_k'. This routine loads the
-* correct result based on the rounding precision, destination
-* format, rounding mode and sign.
-*
-ovf_dis:
- bsr ovf_r_k ;returns unsigned ETEMP_EX
-* ;and sets FPSR_CC accordingly.
- bfclr ETEMP_SGN(a6){0:8} ;fix sign
- beq.b ovf_pos
- bset.b #sign_bit,ETEMP_EX(a6)
- bset.b #sign_bit,FP_SCR1(a6) ;set exceptional operand sign
-ovf_pos:
- fmovem.x ETEMP(a6),fp0 ;move the result to fp0
- rts
-
-
-*
-* INEX2 exception
-*
-* The inex2 and ainex bits are set.
-*
-t_inx2:
- or.l #inx2a_mask,USER_FPSR(a6) ;set INEX2, AINEX
- rts
-
-*
-* Force Inex2
-*
-* This routine is called by the transcendental routines to force
-* the inex2 exception bits set in the FPSR. If the underflow bit
-* is set, but the underflow trap was not taken, the aunfl bit in
-* the FPSR must be set.
-*
-t_frcinx:
- or.l #inx2a_mask,USER_FPSR(a6) ;set INEX2, AINEX
- btst.b #unfl_bit,FPSR_EXCEPT(a6) ;test for unfl bit set
- beq.b no_uacc1 ;if clear, do not set aunfl
- bset.b #aunfl_bit,FPSR_AEXCEPT(a6)
-no_uacc1:
- rts
-
-*
-* DST_NAN
-*
-* Determine if the destination nan is signalling or non-signalling,
-* and set the FPSR bits accordingly. See the MC68040 User's Manual
-* section 3.2.2.5 NOT-A-NUMBERS.
-*
-dst_nan:
- btst.b #sign_bit,FPTEMP_EX(a6) ;test sign of nan
- beq.b dst_pos ;if clr, it was positive
- bset.b #neg_bit,FPSR_CC(a6) ;set N bit
-dst_pos:
- btst.b #signan_bit,FPTEMP_HI(a6) ;check if signalling
- beq.b dst_snan ;branch if signalling
-
- fmove.l d1,fpcr ;restore user's rmode/prec
- fmove.x FPTEMP(a6),fp0 ;return the non-signalling nan
-*
-* Check the source nan. If it is signalling, snan will be reported.
-*
- move.b STAG(a6),d0
- andi.b #$e0,d0
- cmpi.b #$60,d0
- bne.b no_snan
- btst.b #signan_bit,ETEMP_HI(a6) ;check if signalling
- bne.b no_snan
- or.l #snaniop_mask,USER_FPSR(a6) ;set NAN, SNAN, AIOP
-no_snan:
- rts
-
-dst_snan:
- btst.b #snan_bit,FPCR_ENABLE(a6) ;check if trap enabled
- beq.b dst_dis ;branch if disabled
-
- or.b #nan_tag,DTAG(a6) ;set up dtag for nan
- st.b STORE_FLG(a6) ;do not store a result
- or.l #snaniop_mask,USER_FPSR(a6) ;set NAN, SNAN, AIOP
- rts
-
-dst_dis:
- bset.b #signan_bit,FPTEMP_HI(a6) ;set SNAN bit in sop
- fmove.l d1,fpcr ;restore user's rmode/prec
- fmove.x FPTEMP(a6),fp0 ;load non-sign. nan
- or.l #snaniop_mask,USER_FPSR(a6) ;set NAN, SNAN, AIOP
- rts
-
-*
-* SRC_NAN
-*
-* Determine if the source nan is signalling or non-signalling,
-* and set the FPSR bits accordingly. See the MC68040 User's Manual
-* section 3.2.2.5 NOT-A-NUMBERS.
-*
-src_nan:
- btst.b #sign_bit,ETEMP_EX(a6) ;test sign of nan
- beq.b src_pos ;if clr, it was positive
- bset.b #neg_bit,FPSR_CC(a6) ;set N bit
-src_pos:
- btst.b #signan_bit,ETEMP_HI(a6) ;check if signalling
- beq.b src_snan ;branch if signalling
- fmove.l d1,fpcr ;restore user's rmode/prec
- fmove.x ETEMP(a6),fp0 ;return the non-signalling nan
- rts
-
-src_snan:
- btst.b #snan_bit,FPCR_ENABLE(a6) ;check if trap enabled
- beq.b src_dis ;branch if disabled
- bset.b #signan_bit,ETEMP_HI(a6) ;set SNAN bit in sop
- or.b #norm_tag,DTAG(a6) ;set up dtag for norm
- or.b #nan_tag,STAG(a6) ;set up stag for nan
- st.b STORE_FLG(a6) ;do not store a result
- or.l #snaniop_mask,USER_FPSR(a6) ;set NAN, SNAN, AIOP
- rts
-
-src_dis:
- bset.b #signan_bit,ETEMP_HI(a6) ;set SNAN bit in sop
- fmove.l d1,fpcr ;restore user's rmode/prec
- fmove.x ETEMP(a6),fp0 ;load non-sign. nan
- or.l #snaniop_mask,USER_FPSR(a6) ;set NAN, SNAN, AIOP
- rts
-
-*
-* For all functions that have a denormalized input and that f(x)=x,
-* this is the entry point
-*
-t_extdnrm:
- or.l #unfinx_mask,USER_FPSR(a6)
-* ;set UNFL, INEX2, AUNFL, AINEX
- bra.b xdnrm_con
-*
-* Entry point for scale with extended denorm. The function does
-* not set inex2, aunfl, or ainex.
-*
-t_resdnrm:
- or.l #unfl_mask,USER_FPSR(a6)
-
-xdnrm_con:
- btst.b #unfl_bit,FPCR_ENABLE(a6)
- beq.b xdnrm_dis
-
-*
-* If exceptions are enabled, the additional task of setting up WBTEMP
-* is needed so that when the underflow exception handler is entered,
-* the user perceives no difference between what the 040 provides vs.
-* what the FPSP provides.
-*
-xdnrm_ena:
- move.l a0,-(a7)
-
- move.l LOCAL_EX(a0),FP_SCR1(a6)
- move.l LOCAL_HI(a0),FP_SCR1+4(a6)
- move.l LOCAL_LO(a0),FP_SCR1+8(a6)
-
- lea FP_SCR1(a6),a0
-
- bclr.b #sign_bit,LOCAL_EX(a0)
- sne LOCAL_SGN(a0) ;convert to internal ext format
- tst.w LOCAL_EX(a0) ;check if input is denorm
- beq.b xdnrm_dn ;if so, skip nrm_set
- bsr nrm_set ;normalize the result (exponent
-* ;will be negative
-xdnrm_dn:
- bclr.b #sign_bit,LOCAL_EX(a0) ;take off false sign
- bfclr LOCAL_SGN(a0){0:8} ;change back to IEEE ext format
- beq.b xdep
- bset.b #sign_bit,LOCAL_EX(a0)
-xdep:
- bfclr STAG(a6){5:3} ;clear wbtm66,wbtm1,wbtm0
- bset.b #wbtemp15_bit,WB_BYTE(a6) ;set wbtemp15
- bclr.b #sticky_bit,STICKY(a6) ;clear sticky bit
- bclr.b #E1,E_BYTE(a6)
- move.l (a7)+,a0
-xdnrm_dis:
- bfextu FPCR_MODE(a6){0:2},d0 ;get round precision
- bne.b not_ext ;if not round extended, store
-* ;IEEE defaults
-is_ext:
- btst.b #sign_bit,LOCAL_EX(a0)
- beq.b xdnrm_store
-
- bset.b #neg_bit,FPSR_CC(a6) ;set N bit in FPSR_CC
-
- bra.b xdnrm_store
-
-not_ext:
- bclr.b #sign_bit,LOCAL_EX(a0)
- sne LOCAL_SGN(a0) ;convert to internal ext format
- bsr unf_sub ;returns IEEE result pointed by
-* ;a0; sets FPSR_CC accordingly
- bfclr LOCAL_SGN(a0){0:8} ;convert back to IEEE ext format
- beq.b xdnrm_store
- bset.b #sign_bit,LOCAL_EX(a0)
-xdnrm_store:
- fmovem.x (a0),fp0 ;store result in fp0
- rts
-
-*
-* This subroutine is used for dyadic operations that use an extended
-* denorm within the kernel. The approach used is to capture the frame,
-* fix/restore.
-*
- xdef t_avoid_unsupp
-t_avoid_unsupp:
- link a2,#-LOCAL_SIZE ;so that a2 fpsp.h negative
-* ;offsets may be used
- fsave -(a7)
- tst.b 1(a7) ;check if idle, exit if so
- beq.w idle_end
- btst.b #E1,E_BYTE(a2) ;check for an E1 exception if
-* ;enabled, there is an unsupp
- beq.w end_avun ;else, exit
- btst.b #7,DTAG(a2) ;check for denorm destination
- beq.b src_den ;else, must be a source denorm
-*
-* handle destination denorm
-*
- lea FPTEMP(a2),a0
- btst.b #sign_bit,LOCAL_EX(a0)
- sne LOCAL_SGN(a0) ;convert to internal ext format
- bclr.b #7,DTAG(a2) ;set DTAG to norm
- bsr nrm_set ;normalize result, exponent
-* ;will become negative
- bclr.b #sign_bit,LOCAL_EX(a0) ;get rid of fake sign
- bfclr LOCAL_SGN(a0){0:8} ;convert back to IEEE ext format
- beq.b ck_src_den ;check if source is also denorm
- bset.b #sign_bit,LOCAL_EX(a0)
-ck_src_den:
- btst.b #7,STAG(a2)
- beq.b end_avun
-src_den:
- lea ETEMP(a2),a0
- btst.b #sign_bit,LOCAL_EX(a0)
- sne LOCAL_SGN(a0) ;convert to internal ext format
- bclr.b #7,STAG(a2) ;set STAG to norm
- bsr nrm_set ;normalize result, exponent
-* ;will become negative
- bclr.b #sign_bit,LOCAL_EX(a0) ;get rid of fake sign
- bfclr LOCAL_SGN(a0){0:8} ;convert back to IEEE ext format
- beq.b den_com
- bset.b #sign_bit,LOCAL_EX(a0)
-den_com:
- move.b #$fe,CU_SAVEPC(a2) ;set continue frame
- clr.w NMNEXC(a2) ;clear NMNEXC
- bclr.b #E1,E_BYTE(a2)
-* fmove.l FPSR,FPSR_SHADOW(a2)
-* bset.b #SFLAG,E_BYTE(a2)
-* bset.b #XFLAG,T_BYTE(a2)
-end_avun:
- frestore (a7)+
- unlk a2
- rts
-idle_end:
- add.l #4,a7
- unlk a2
- rts
- end
diff --git a/sys/arch/m68k/fpsp/l_fpsp.h b/sys/arch/m68k/fpsp/l_fpsp.h
deleted file mode 100644
index a92c798fe1d..00000000000
--- a/sys/arch/m68k/fpsp/l_fpsp.h
+++ /dev/null
@@ -1,281 +0,0 @@
-* $OpenBSD: l_fpsp.h,v 1.3 2007/04/10 17:47:54 miod Exp $
-* $NetBSD: l_fpsp.h,v 1.2 1994/10/26 07:49:14 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* l_fpsp.h 1.2 5/1/91
-*
-
-* l_fpsp.h --- stack frame offsets for library version of FPSP
-*
-* This file is derived from fpsp.h. All equates that refer
-* to the fsave frame and its bits are removed with the
-* exception of ETEMP, WBTEMP, DTAG and STAG which are simulated
-* in the library version. Equates for the exception frame are
-* also not needed. Some of the equates that are only used in
-* the kernel version of the FPSP are left in to minimize the
-* differences between this file and the original.
-*
-* The library routines use the same source files as the regular
-* kernel mode code so they expect the same setup. That is, you
-* must create enough space on the stack for all save areas and
-* work variables that are needed, and save any registers that
-* your compiler does not treat as scratch registers on return
-* from function calls.
-*
-* The worst case setup is:
-*
-* link a6,#-LOCAL_SIZE
-* movem.l d0-d1/a0-a1,USER_DA(a6)
-* fmovem.x fp0-fp3,USER_FP0(a6)
-* fmovem.l fpsr/fpcr,USER_FPSR(a6)
-*
-* After initialization, the stack looks like this:
-*
-* A7 ---> +-------------------------------+
-* | |
-* | FPSP Local Variables |
-* | including |
-* | saved registers |
-* | |
-* +-------------------------------+
-* A6 ---> | Saved A6 |
-* +-------------------------------+
-* | Return PC |
-* +-------------------------------+
-* | Arguments to |
-* | an FPSP library |
-* | package |
-* | |
-*
-* Positive offsets from A6 refer to the input arguments. Negative
-* offsets refer to the Local Variable area.
-*
-* On exit, execute:
-*
-* movem.l USER_DA(a6),d0-d1/a0-a1
-* fmovem.x USER_FP0(a6),fp0-fp3
-* fmove.l USER_FPSR(a6),fpsr/fpcr
-* unlk a6
-* rts
-*
-* Many 68K C compilers treat a0/a1/d0/d1/fp0/fp1 as scratch so
-* a simplified setup/exit is possible:
-*
-* link a6,#-LOCAL_SIZE
-* fmovem.x fp2-fp3,USER_FP2(a6)
-* fmove.l fpsr/fpcr,USER_FPSR(a6)
-*
-* [call appropriate emulation routine]
-*
-* fmovem.x USER_FP2(a6),fp2-fp3
-* fmove.l USER_FPSR(a6),fpsr/fpcr
-* unlk a6
-* rts
-*
-* Note that you must still save fp2/fp3 because the FPSP emulation
-* routines expect fp0-fp3 as scratch registers. For all monadic
-* entry points, the caller should save the fpcr in d1 and zero the
-* real fpcr before calling the emulation routine. On return, the
-* monadic emulation code will place the value supplied in d1 back
-* into the fpcr and do a single floating point operation so that
-* the final result will be correctly rounded and any specified
-* exceptions will be generated.
-*
-*----------------------------------------------------------------------
-*
-* Local Variables on the stack
-*
-LOCAL_SIZE equ 228 ;bytes needed for local variables
-LV equ -LOCAL_SIZE ;convenient base value
-*
-USER_DA equ LV+0 ;save space for D0-D1,A0-A1
-USER_D0 equ LV+0 ;saved user D0
-USER_D1 equ LV+4 ;saved user D1
-USER_A0 equ LV+8 ;saved user A0
-USER_A1 equ LV+12 ;saved user A1
-USER_FP0 equ LV+16 ;saved user FP0
-USER_FP1 equ LV+28 ;saved user FP1
-USER_FP2 equ LV+40 ;saved user FP2
-USER_FP3 equ LV+52 ;saved user FP3
-USER_FPCR equ LV+64 ;saved user FPCR
-FPCR_ENABLE equ USER_FPCR+2 ; FPCR exception enable
-FPCR_MODE equ USER_FPCR+3 ; FPCR rounding mode control
-USER_FPSR equ LV+68 ;saved user FPSR
-FPSR_CC equ USER_FPSR+0 ; FPSR condition code
-FPSR_QBYTE equ USER_FPSR+1 ; FPSR quotient
-FPSR_EXCEPT equ USER_FPSR+2 ; FPSR exception
-FPSR_AEXCEPT equ USER_FPSR+3 ; FPSR accrued exception
-USER_FPIAR equ LV+72 ;saved user FPIAR
-FP_SCR1 equ LV+76 ;room for a temporary float value
-FP_SCR2 equ LV+92 ;room for a temporary float value
-L_SCR1 equ LV+108 ;room for a temporary long value
-L_SCR2 equ LV+112 ;room for a temporary long value
-STORE_FLG equ LV+116
-BINDEC_FLG equ LV+117 ;used in bindec
-DNRM_FLG equ LV+118 ;used in res_func
-RES_FLG equ LV+119 ;used in res_func
-DY_MO_FLG equ LV+120 ;dyadic/monadic flag
-UFLG_TMP equ LV+121 ;temporary for uflag errata
-CU_ONLY equ LV+122 ;cu-only flag
-VER_TMP equ LV+123 ;temp holding for version number
-L_SCR3 equ LV+124 ;room for a temporary long value
-FP_SCR3 equ LV+128 ;room for a temporary float value
-FP_SCR4 equ LV+144 ;room for a temporary float value
-FP_SCR5 equ LV+160 ;room for a temporary float value
-FP_SCR6 equ LV+176
-*
-*--------------------------------------------------------------------------
-*
-STAG equ LV+192 ;source tag (1 byte)
-*
-DTAG equ LV+193 ;dest tag (1 byte)
-*
-FPTEMP equ LV+196 ;fptemp (12 bytes)
-FPTEMP_EX equ FPTEMP ;fptemp sign and exponent (2 bytes)
-FPTEMP_HI equ FPTEMP+4 ;fptemp mantissa [63:32] (4 bytes)
-FPTEMP_LO equ FPTEMP+8 ;fptemp mantissa [31:00] (4 bytes)
-*
-FPTEMP_SGN equ FPTEMP+2 ;used to store sign
-*
-ETEMP equ LV+208 ;etemp (12 bytes)
-ETEMP_EX equ ETEMP ;etemp sign and exponent (2 bytes)
-ETEMP_HI equ ETEMP+4 ;etemp mantissa [63:32] (4 bytes)
-ETEMP_LO equ ETEMP+8 ;etemp mantissa [31:00] (4 bytes)
-*
-ETEMP_SGN equ ETEMP+2 ;used to store sign
-*
-*--------------------------------------------------------------------------
-*
-* FPSR/FPCR bits
-*
-neg_bit equ 3 negative result
-z_bit equ 2 zero result
-inf_bit equ 1 infinity result
-nan_bit equ 0 not-a-number result
-*
-q_sn_bit equ 7 sign bit of quotient byte
-*
-bsun_bit equ 7 branch on unordered
-snan_bit equ 6 signalling nan
-operr_bit equ 5 operand error
-ovfl_bit equ 4 overflow
-unfl_bit equ 3 underflow
-dz_bit equ 2 divide by zero
-inex2_bit equ 1 inexact result 2
-inex1_bit equ 0 inexact result 1
-*
-aiop_bit equ 7 accrued illegal operation
-aovfl_bit equ 6 accrued overflow
-aunfl_bit equ 5 accrued underflow
-adz_bit equ 4 accrued divide by zero
-ainex_bit equ 3 accrued inexact
-*
-* FPSR individual bit masks
-*
-neg_mask equ $08000000
-z_mask equ $04000000
-inf_mask equ $02000000
-nan_mask equ $01000000
-*
-bsun_mask equ $00008000
-snan_mask equ $00004000
-operr_mask equ $00002000
-ovfl_mask equ $00001000
-unfl_mask equ $00000800
-dz_mask equ $00000400
-inex2_mask equ $00000200
-inex1_mask equ $00000100
-*
-aiop_mask equ $00000080 accrued illegal operation
-aovfl_mask equ $00000040 accrued overflow
-aunfl_mask equ $00000020 accrued underflow
-adz_mask equ $00000010 accrued divide by zero
-ainex_mask equ $00000008 accrued inexact
-*
-* FPSR combinations used in the FPSP
-*
-dzinf_mask equ inf_mask+dz_mask+adz_mask
-opnan_mask equ nan_mask+operr_mask+aiop_mask
-nzi_mask equ $01ffffff clears N, Z, and I
-unfinx_mask equ unfl_mask+inex2_mask+aunfl_mask+ainex_mask
-unf2inx_mask equ unfl_mask+inex2_mask+ainex_mask
-ovfinx_mask equ ovfl_mask+inex2_mask+aovfl_mask+ainex_mask
-inx1a_mask equ inex1_mask+ainex_mask
-inx2a_mask equ inex2_mask+ainex_mask
-snaniop_mask equ nan_mask+snan_mask+aiop_mask
-naniop_mask equ nan_mask+aiop_mask
-neginf_mask equ neg_mask+inf_mask
-infaiop_mask equ inf_mask+aiop_mask
-negz_mask equ neg_mask+z_mask
-opaop_mask equ operr_mask+aiop_mask
-unfl_inx_mask equ unfl_mask+aunfl_mask+ainex_mask
-ovfl_inx_mask equ ovfl_mask+aovfl_mask+ainex_mask
-*
-*--------------------------------------------------------------------------
-*
-* FPCR rounding modes
-*
-x_mode equ $00 round to extended
-s_mode equ $40 round to single
-d_mode equ $80 round to double
-*
-rn_mode equ $00 round nearest
-rz_mode equ $10 round to zero
-rm_mode equ $20 round to minus infinity
-rp_mode equ $30 round to plus infinity
-*
-*--------------------------------------------------------------------------
-*
-* Miscellaneous equates
-*
-signan_bit equ 6 signalling nan bit in mantissa
-sign_bit equ 7
-*
-rnd_stky_bit equ 29 round/sticky bit of mantissa
-* this can only be used if in a data register
-LOCAL_EX equ 0
-LOCAL_SGN equ 2
-LOCAL_HI equ 4
-LOCAL_LO equ 8
-LOCAL_GRS equ 12 valid ONLY for FP_SCR1, FP_SCR2
-*
-*
-norm_tag equ $00 tag bits in {7:5} position
-zero_tag equ $20
-inf_tag equ $40
-nan_tag equ $60
-dnrm_tag equ $80
-*
-dbl_thresh equ $3C01
-sgl_thresh equ $3F81
-*
diff --git a/sys/arch/m68k/fpsp/l_support.sa b/sys/arch/m68k/fpsp/l_support.sa
deleted file mode 100644
index 4a81e04c8e1..00000000000
--- a/sys/arch/m68k/fpsp/l_support.sa
+++ /dev/null
@@ -1,389 +0,0 @@
-* $OpenBSD: l_support.sa,v 1.2 1996/05/29 21:05:31 niklas Exp $
-* $NetBSD: l_support.sa,v 1.3 1994/10/26 07:49:16 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* l_support.sa 1.2 5/1/91
-*
-
-L_SUPPORT IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
-mns_one dc.l $bfff0000,$80000000,$00000000
-pls_one dc.l $3fff0000,$80000000,$00000000
-pls_inf dc.l $7fff0000,$00000000,$00000000
-pls_huge dc.l $7ffe0000,$ffffffff,$ffffffff
-mns_huge dc.l $fffe0000,$ffffffff,$ffffffff
-pls_tiny dc.l $00000000,$80000000,$00000000
-mns_tiny dc.l $80000000,$80000000,$00000000
-small dc.l $20000000,$80000000,$00000000
-pls_zero dc.l $00000000,$00000000,$00000000
-
- include l_fpsp.h
-
-*
-* tag --- determine the type of an extended precision operand
-*
-* The tag values returned match the way the 68040 would have
-* tagged them.
-*
-* Input: a0 points to operand
-*
-* Output d0.b = $00 norm
-* $20 zero
-* $40 inf
-* $60 nan
-* $80 denorm
-* All other registers are unchanged
-*
- xdef tag
-tag:
- move.w LOCAL_EX(a0),d0
- andi.w #$7fff,d0
- beq.b chk_zro
- cmpi.w #$7fff,d0
- beq.b chk_inf
-tag_nrm:
- clr.b d0
- rts
-tag_nan:
- move.b #$60,d0
- rts
-tag_dnrm:
- move.b #$80,d0
- rts
-chk_zro:
- btst.b #7,LOCAL_HI(a0) # check if J-bit is set
- bne.b tag_nrm
- tst.l LOCAL_HI(a0)
- bne.b tag_dnrm
- tst.l LOCAL_LO(a0)
- bne.b tag_dnrm
-tag_zero:
- move.b #$20,d0
- rts
-chk_inf:
- tst.l LOCAL_HI(a0)
- bne.b tag_nan
- tst.l LOCAL_LO(a0)
- bne.b tag_nan
-tag_inf:
- move.b #$40,d0
- rts
-
-*
-* t_dz, t_dz2 --- divide by zero exception
-*
-* t_dz2 is used by monadic functions such as flogn (from do_func).
-* t_dz is used by monadic functions such as satanh (from the
-* transcendental function).
-*
- xdef t_dz2
-t_dz2:
- fmovem.x mns_one,fp0
- fmove.l d1,fpcr
- fdiv.x pls_zero,fp0
- rts
-
- xdef t_dz
-t_dz:
- btst.b #sign_bit,ETEMP_EX(a6) ;check sign for neg or pos
- beq.b p_inf ;branch if pos sign
-m_inf:
- fmovem.x mns_one,fp0
- fmove.l d1,fpcr
- fdiv.x pls_zero,fp0
- rts
-p_inf:
- fmovem.x pls_one,fp0
- fmove.l d1,fpcr
- fdiv.x pls_zero,fp0
- rts
-*
-* t_operr --- Operand Error exception
-*
- xdef t_operr
-t_operr:
- fmovem.x pls_inf,fp0
- fmove.l d1,fpcr
- fmul.x pls_zero,fp0
- rts
-
-*
-* t_unfl --- UNFL exception
-*
- xdef t_unfl
-t_unfl:
- btst.b #sign_bit,ETEMP(a6)
- beq.b unf_pos
-unf_neg:
- fmovem.x mns_tiny,fp0
- fmove.l d1,fpcr
- fmul.x pls_tiny,fp0
- rts
-
-unf_pos:
- fmovem.x pls_tiny,fp0
- fmove.l d1,fpcr
- fmul.x fp0,fp0
- rts
-*
-* t_ovfl --- OVFL exception
-*
-* t_ovfl is called as an exit for monadic functions. t_ovfl2
-* is for dyadic exits.
-*
- xdef t_ovfl
-t_ovfl:
- xdef t_ovfl2
- move.l d1,USER_FPCR(a6) user's control register
- move.l #ovfinx_mask,d0
- bra.b t_work
-t_ovfl2:
- move.l #ovfl_inx_mask,d0
-t_work:
- btst.b #sign_bit,ETEMP(a6)
- beq.b ovf_pos
-ovf_neg:
- fmovem.x mns_huge,fp0
- fmove.l USER_FPCR(a6),fpcr
- fmul.x pls_huge,fp0
- fmove.l fpsr,d1
- or.l d1,d0
- fmove.l d0,fpsr
- rts
-ovf_pos:
- fmovem.x pls_huge,fp0
- fmove.l USER_FPCR(a6),fpcr
- fmul.x pls_huge,fp0
- fmove.l fpsr,d1
- or.l d1,d0
- fmove.l d0,fpsr
- rts
-*
-* t_inx2 --- INEX2 exception (correct fpcr is in USER_FPCR(a6))
-*
- xdef t_inx2
-t_inx2:
- fmove.l fpsr,USER_FPSR(a6) capture incoming fpsr
- fmove.l USER_FPCR(a6),fpcr
-*
-* create an inex2 exception by adding two numbers with very different exponents
-* do the add in fp1 so as to not disturb the result sitting in fp0
-*
- fmove.x pls_one,fp1
- fadd.x small,fp1
-*
- or.l #inx2a_mask,USER_FPSR(a6) ;set INEX2, AINEX
- fmove.l USER_FPSR(a6),fpsr
- rts
-*
-* t_frcinx --- Force Inex2 (for monadic functions)
-*
- xdef t_frcinx
-t_frcinx:
- fmove.l fpsr,USER_FPSR(a6) capture incoming fpsr
- fmove.l d1,fpcr
-*
-* create an inex2 exception by adding two numbers with very different exponents
-* do the add in fp1 so as to not disturb the result sitting in fp0
-*
- fmove.x pls_one,fp1
- fadd.x small,fp1
-*
- or.l #inx2a_mask,USER_FPSR(a6) ;set INEX2, AINEX
- btst.b #unfl_bit,FPSR_EXCEPT(a6) ;test for unfl bit set
- beq.b no_uacc1 ;if clear, do not set aunfl
- bset.b #aunfl_bit,FPSR_AEXCEPT(a6)
-no_uacc1:
- fmove.l USER_FPSR(a6),fpsr
- rts
-*
-* dst_nan --- force result when destination is a NaN
-*
- xdef dst_nan
-dst_nan:
- fmove.l USER_FPCR(a6),fpcr
- fmove.x FPTEMP(a6),fp0
- rts
-
-*
-* src_nan --- force result when source is a NaN
-*
- xdef src_nan
-src_nan:
- fmove.l USER_FPCR(a6),fpcr
- fmove.x ETEMP(a6),fp0
- rts
-*
-* mon_nan --- force result when source is a NaN (monadic version)
-*
-* This is the same as src_nan except that the user's fpcr comes
-* in via d1, not USER_FPCR(a6).
-*
- xdef mon_nan
-mon_nan:
- fmove.l d1,fpcr
- fmove.x ETEMP(a6),fp0
- rts
-*
-* t_extdnrm, t_resdnrm --- generate results for denorm inputs
-*
-* For all functions that have a denormalized input and that f(x)=x,
-* this is the entry point.
-*
- xdef t_extdnrm
-t_extdnrm:
- fmove.l d1,fpcr
- fmove.x LOCAL_EX(a0),fp0
- fmove.l fpsr,d0
- or.l #unfinx_mask,d0
- fmove.l d0,fpsr
- rts
-
- xdef t_resdnrm
-t_resdnrm:
- fmove.l USER_FPCR(a6),fpcr
- fmove.x LOCAL_EX(a0),fp0
- fmove.l fpsr,d0
- or.l #unfl_mask,d0
- fmove.l d0,fpsr
- rts
-*
-*
-*
- xdef t_avoid_unsupp
-t_avoid_unsupp:
- fmove.x fp0,fp0
- rts
-
- xdef sto_cos
-sto_cos:
- fmovem.x LOCAL_EX(a0),fp1
- rts
-*
-* Native instruction support
-*
-* Some systems may need entry points even for 68040 native
-* instructions. These routines are provided for
-* convenience.
-*
- xdef sadd
-sadd:
- fmovem.x FPTEMP(a6),fp0
- fmove.l USER_FPCR(a6),fpcr
- fadd.x ETEMP(a6),fp0
- rts
-
- xdef ssub
-ssub:
- fmovem.x FPTEMP(a6),fp0
- fmove.l USER_FPCR(a6),fpcr
- fsub.x ETEMP(a6),fp0
- rts
-
- xdef smul
-smul:
- fmovem.x FPTEMP(a6),fp0
- fmove.l USER_FPCR(a6),fpcr
- fmul.x ETEMP(a6),fp0
- rts
-
- xdef sdiv
-sdiv:
- fmovem.x FPTEMP(a6),fp0
- fmove.l USER_FPCR(a6),fpcr
- fdiv.x ETEMP(a6),fp0
- rts
-
- xdef sabs
-sabs:
- fmovem.x ETEMP(a6),fp0
- fmove.l d1,fpcr
- fabs.x fp0
- rts
-
- xdef sneg
-sneg:
- fmovem.x ETEMP(a6),fp0
- fmove.l d1,fpcr
- fneg.x fp0
- rts
-
- xdef ssqrt
-ssqrt:
- fmovem.x ETEMP(a6),fp0
- fmove.l d1,fpcr
- fsqrt.x fp0
- rts
-
-*
-* l_sint,l_sintrz,l_sintd --- special wrapper for fint and fintrz
-*
-* On entry, move the user's FPCR to USER_FPCR.
-*
-* On return from, we need to pickup the INEX2/AINEX bits
-* that are in USER_FPSR.
-*
- xref sint
- xref sintrz
- xref sintd
-
- xdef l_sint
-l_sint:
- move.l d1,USER_FPCR(a6)
- jsr sint
- fmove.l fpsr,d0
- or.l USER_FPSR(a6),d0
- fmove.l d0,fpsr
- rts
-
- xdef l_sintrz
-l_sintrz:
- move.l d1,USER_FPCR(a6)
- jsr sintrz
- fmove.l fpsr,d0
- or.l USER_FPSR(a6),d0
- fmove.l d0,fpsr
- rts
-
- xdef l_sintd
-l_sintd:
- move.l d1,USER_FPCR(a6)
- jsr sintd
- fmove.l fpsr,d0
- or.l USER_FPSR(a6),d0
- fmove.l d0,fpsr
- rts
-
- end
diff --git a/sys/arch/m68k/fpsp/netbsd.sa b/sys/arch/m68k/fpsp/netbsd.sa
deleted file mode 100644
index 1295a25e6ff..00000000000
--- a/sys/arch/m68k/fpsp/netbsd.sa
+++ /dev/null
@@ -1,399 +0,0 @@
-* $OpenBSD: netbsd.sa,v 1.6 2013/02/02 13:32:05 miod Exp $
-* $NetBSD: netbsd.sa,v 1.3 1997/04/25 02:26:04 thorpej Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* skeleton.sa 3.2 4/26/91
-*
-* This file contains code that is system dependent and will
-* need to be modified to install the FPSP.
-*
-* Each entry point for exception 'xxxx' begins with a 'jmp fpsp_xxxx'.
-* Put any target system specific handling that must be done immediately
-* before the jump instruction. If there no handling necessary, then
-* the 'fpsp_xxxx' handler entry point should be placed in the exception
-* table so that the 'jmp' can be eliminated. If the FPSP determines that the
-* exception is one that must be reported then there will be a
-* return from the package by a 'jmp real_xxxx'. At that point
-* the machine state will be identical to the state before
-* the FPSP was entered. In particular, whatever condition
-* that caused the exception will still be pending when the FPSP
-* package returns. Thus, there will be system specific code
-* to handle the exception.
-*
-* If the exception was completely handled by the package, then
-* the return will be via a 'jmp fpsp_done'. Unless there is
-* OS specific work to be done (such as handling a context switch or
-* interrupt) the user program can be resumed via 'rte'.
-*
-* In the following skeleton code, some typical 'real_xxxx' handling
-* code is shown. This code may need to be moved to an appropriate
-* place in the target system, or rewritten.
-*
-
-SKELETON IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 15
-*
-* The following counters are used for standalone testing
-*
-
- section 8
-
- include fpsp.h
-
-*
-* XXX Note, this is NOT valid Motorola syntax, but what else can we do?
-*
-#include <machine/asm.h>
-
- xref b1238_fix
-
-*
-* Divide by Zero exception
-*
-* All dz exceptions are 'real', hence no fpsp_dz entry point.
-*
- xdef dz
-dz:
- link a6,#-LOCAL_SIZE
- fsave -(sp)
- bclr.b #E1,E_BYTE(a6)
- frestore (sp)+
- unlk a6
- jmp _C_LABEL(fpfault)
-
-*
-* Inexact exception
-*
-* All inexact exceptions are real, but the 'real' handler
-* will probably want to clear the pending exception.
-* The provided code will clear the E3 exception (if pending),
-* otherwise clear the E1 exception. The frestore is not really
-* necessary for E1 exceptions.
-*
-* Code following the 'inex' label is to handle bug #1232. In this
-* bug, if an E1 snan, ovfl, or unfl occurred, and the process was
-* swapped out before taking the exception, the exception taken on
-* return was inex, rather than the correct exception. The snan, ovfl,
-* and unfl exception to be taken must not have been enabled. The
-* fix is to check for E1, and the existence of one of snan, ovfl,
-* or unfl bits set in the fpsr. If any of these are set, branch
-* to the appropriate handler for the exception in the fpsr. Note
-* that this fix is only for d43b parts, and is skipped if the
-* version number is not $40.
-*
-*
- xdef real_inex
- xdef inex
-inex:
- link a6,#-LOCAL_SIZE
- fsave -(sp)
- cmpi.b #VER_40,(sp) ;test version number
- bne.b not_fmt40
- fmove.l fpsr,-(sp)
- btst.b #E1,E_BYTE(a6) ;test for E1 set
- beq.b not_b1232
- btst.b #snan_bit,2(sp) ;test for snan
- beq inex_ckofl
- addq.l #4,sp
- frestore (sp)+
- unlk a6
- bra.l fpsp_snan
-inex_ckofl:
- btst.b #ovfl_bit,2(sp) ;test for ovfl
- beq inex_ckufl
- addq.l #4,sp
- frestore (sp)+
- unlk a6
- bra.l fpsp_ovfl
-inex_ckufl:
- btst.b #unfl_bit,2(sp) ;test for unfl
- beq not_b1232
- addq.l #4,sp
- frestore (sp)+
- unlk a6
- bra.l fpsp_unfl
-
-*
-* We do not have the bug 1232 case. Clean up the stack and call
-* real_inex.
-*
-not_b1232:
- addq.l #4,sp
- frestore (sp)+
- unlk a6
-
-real_inex:
- link a6,#-LOCAL_SIZE
- fsave -(sp)
-not_fmt40:
- bclr.b #E3,E_BYTE(a6) ;clear and test E3 flag
- beq.b inex_cke1
-*
-* Clear dirty bit on dest resister in the frame before branching
-* to b1238_fix.
-*
- movem.l d0/d1,USER_DA(a6)
- bfextu CMDREG1B(a6){6:3},d0 ;get dest reg no
- bclr.b d0,FPR_DIRTY_BITS(a6) ;clr dest dirty bit
- bsr.l b1238_fix ;test for bug1238 case
- movem.l USER_DA(a6),d0/d1
- bra.b inex_done
-inex_cke1:
- bclr.b #E1,E_BYTE(a6)
-inex_done:
- frestore (sp)+
- unlk a6
- jmp _C_LABEL(fpfault)
-
-*
-* Overflow exception
-*
- xdef real_ovfl
-real_ovfl:
- link a6,#-LOCAL_SIZE
- fsave -(sp)
- bclr.b #E3,E_BYTE(a6) ;clear and test E3 flag
- bne.b ovfl_done
- bclr.b #E1,E_BYTE(a6)
-ovfl_done:
- frestore (sp)+
- unlk a6
- jmp _C_LABEL(fpfault)
-
-*
-* Underflow exception
-*
- xdef real_unfl
-real_unfl:
- link a6,#-LOCAL_SIZE
- fsave -(sp)
- bclr.b #E3,E_BYTE(a6) ;clear and test E3 flag
- bne.b unfl_done
- bclr.b #E1,E_BYTE(a6)
-unfl_done:
- frestore (sp)+
- unlk a6
- jmp _C_LABEL(fpfault)
-
-*
-* Signalling NAN exception
-*
- xdef real_snan
-real_snan:
- link a6,#-LOCAL_SIZE
- fsave -(sp)
- bclr.b #E1,E_BYTE(a6) ;snan is always an E1 exception
- frestore (sp)+
- unlk a6
- jmp _C_LABEL(fpfault)
-
-*
-* Operand Error exception
-*
- xdef real_operr
-real_operr:
- link a6,#-LOCAL_SIZE
- fsave -(sp)
- bclr.b #E1,E_BYTE(a6) ;operr is always an E1 exception
- frestore (sp)+
- unlk a6
- jmp _C_LABEL(fpfault)
-
-*
-* BSUN exception
-*
-* This sample handler simply clears the nan bit in the FPSR.
-*
- xdef real_bsun
-real_bsun:
- link a6,#-LOCAL_SIZE
- fsave -(sp)
- bclr.b #E1,E_BYTE(a6) ;bsun is always an E1 exception
- fmove.l FPSR,-(sp)
- bclr.b #nan_bit,(sp)
- fmove.l (sp)+,FPSR
- frestore (sp)+
- unlk a6
- jmp _C_LABEL(fpfault)
-
-*
-* F-line exception
-*
-* A 'real' F-line exception is one that the FPSP isn't supposed to
-* handle. E.g. an instruction with a co-processor ID that is not 1.
-*
-*
- xdef real_fline
-real_fline:
- jmp _C_LABEL(fpfault)
-
-*
-* Unsupported data type exception
-*
- xdef real_unsupp
-real_unsupp:
- link a6,#-LOCAL_SIZE
- fsave -(sp)
- bclr.b #E1,E_BYTE(a6) ;unsupp is always an E1 exception
- frestore (sp)+
- unlk a6
- jmp _C_LABEL(fpfault)
-
-*
-* Trace exception
-*
- xdef real_trace
-real_trace:
- rte
-
-*
-* fpsp_fmt_error --- exit point for frame format error
-*
-* The fpu stack frame does not match the frames existing
-* or planned at the time of this writing. The fpsp is
-* unable to handle frame sizes not in the following
-* version:size pairs:
-*
-* {4060, 4160} - busy frame
-* {4028, 4130} - unimp frame
-* {4000, 4100} - idle frame
-*
-* This entry point simply holds an f-line illegal value.
-* Replace this with a call to your kernel panic code or
-* code to handle future revisions of the fpu.
-*
- xdef fpsp_fmt_error
-fpsp_fmt_error:
- pea 1f
- jsr _C_LABEL(panic)
- dc.l $f27f0000 ;f-line illegal
-1:
- .asciz "bad floating point stack frame"
- .even
-
-*
-* fpsp_done --- FPSP exit point
-*
-* The exception has been handled by the package and we are ready
-* to return to user mode, but there may be OS specific code
-* to execute before we do. If there is, do it now.
-*
-*
- xref _ASM_LABEL(rei)
- xdef fpsp_done
-fpsp_done:
- jmp _ASM_LABEL(rei)
-
-*
-* mem_write --- write to user or supervisor address space
-*
-* Writes to memory while in supervisor mode. copyout accomplishes
-* this via a 'moves' instruction. copyout is a UNIX SVR3 (and later) function.
-* If you don't have copyout, use the local copy of the function below.
-*
-* a0 - supervisor source address
-* a1 - user destination address
-* d0 - number of bytes to write (maximum count is 12)
-*
-* The supervisor source address is guaranteed to point into the supervisor
-* stack. The result is that a UNIX
-* process is allowed to sleep as a consequence of a page fault during
-* copyout. The probability of a page fault is exceedingly small because
-* the 68040 always reads the destination address and thus the page
-* faults should have already been handled.
-*
-* If the EXC_SR shows that the exception was from supervisor space,
-* then just do a dumb (and slow) memory move. In a UNIX environment
-* there shouldn't be any supervisor mode floating point exceptions.
-*
- xdef mem_write
-mem_write:
- btst.b #5,EXC_SR(a6) ;check for supervisor state
- beq.b user_write
-super_write:
- move.b (a0)+,(a1)+
- subq.l #1,d0
- bne.b super_write
- rts
-user_write:
- move.l d1,-(sp) ;preserve d1 just in case
- move.l d0,-(sp)
- move.l a1,-(sp)
- move.l a0,-(sp)
- jsr _C_LABEL(copyout)
- add.l #12,sp
- move.l (sp)+,d1
- rts
-
-*
-* mem_read --- read from user or supervisor address space
-*
-* Reads from memory while in supervisor mode. copyin accomplishes
-* this via a 'moves' instruction. copyin is a UNIX SVR3 (and later) function.
-* If you don't have copyin, use the local copy of the function below.
-*
-* The FPSP calls mem_read to read the original F-line instruction in order
-* to extract the data register number when the 'Dn' addressing mode is
-* used.
-*
-*Input:
-* a0 - user source address
-* a1 - supervisor destination address
-* d0 - number of bytes to read (maximum count is 12)
-*
-* Like mem_write, mem_read always reads with a supervisor
-* destination address on the supervisor stack. Also like mem_write,
-* the EXC_SR is checked and a simple memory copy is done if reading
-* from supervisor space is indicated.
-*
- xdef mem_read
-mem_read:
- btst.b #5,EXC_SR(a6) ;check for supervisor state
- beq.b user_read
-super_read:
- move.b (a0)+,(a1)+
- subq.l #1,d0
- bne.b super_read
- rts
-user_read:
- move.l d1,-(sp) ;preserve d1 just in case
- move.l d0,-(sp)
- move.l a1,-(sp)
- move.l a0,-(sp)
- jsr _C_LABEL(copyin)
- add.l #12,sp
- move.l (sp)+,d1
- rts
-
- end
diff --git a/sys/arch/m68k/fpsp/res_func.sa b/sys/arch/m68k/fpsp/res_func.sa
deleted file mode 100644
index 7431570ce4c..00000000000
--- a/sys/arch/m68k/fpsp/res_func.sa
+++ /dev/null
@@ -1,2066 +0,0 @@
-* $OpenBSD: res_func.sa,v 1.5 2006/11/30 20:08:22 mk Exp $
-* $NetBSD: res_func.sa,v 1.3 1994/10/26 07:49:22 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* res_func.sa 3.9 7/29/91
-*
-* Normalizes denormalized numbers if necessary and updates the
-* stack frame. The function is then restored back into the
-* machine and the 040 completes the operation. This routine
-* is only used by the unsupported data type/format handler.
-* (Exception vector 55).
-*
-* For packed move out (fmove.p fpm,<ea>) the operation is
-* completed here; data is packed and moved to user memory.
-* The stack is restored to the 040 only in the case of a
-* reportable exception in the conversion.
-*
-
-RES_FUNC IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
-sp_bnds: dc.w $3f81,$407e
- dc.w $3f6a,$0000
-dp_bnds: dc.w $3c01,$43fe
- dc.w $3bcd,$0000
-
- xref mem_write
- xref bindec
- xref get_fline
- xref round
- xref denorm
- xref dest_ext
- xref dest_dbl
- xref dest_sgl
- xref unf_sub
- xref nrm_set
- xref dnrm_lp
- xref ovf_res
- xref reg_dest
- xref t_ovfl
- xref t_unfl
-
- xdef res_func
- xdef p_move
-
-res_func:
- clr.b DNRM_FLG(a6)
- clr.b RES_FLG(a6)
- clr.b CU_ONLY(a6)
- tst.b DY_MO_FLG(a6)
- beq.b monadic
-dyadic:
- btst.b #7,DTAG(a6) ;if dop = norm=000, zero=001,
-* ;inf=010 or nan=011
- beq.b monadic ;then branch
-* ;else denorm
-* HANDLE DESTINATION DENORM HERE
-* ;set dtag to norm
-* ;write the tag & fpte15 to the fstack
- lea.l FPTEMP(a6),a0
-
- bclr.b #sign_bit,LOCAL_EX(a0)
- sne LOCAL_SGN(a0)
-
- bsr nrm_set ;normalize number (exp will go negative)
- bclr.b #sign_bit,LOCAL_EX(a0) ;get rid of false sign
- bfclr LOCAL_SGN(a0){0:8} ;change back to IEEE ext format
- beq.b dpos
- bset.b #sign_bit,LOCAL_EX(a0)
-dpos:
- bfclr DTAG(a6){0:4} ;set tag to normalized, FPTE15 = 0
- bset.b #4,DTAG(a6) ;set FPTE15
- or.b #$0f,DNRM_FLG(a6)
-monadic:
- lea.l ETEMP(a6),a0
- btst.b #direction_bit,CMDREG1B(a6) ;check direction
- bne.w opclass3 ;it is a mv out
-*
-* At this point, only oplcass 0 and 2 possible
-*
- btst.b #7,STAG(a6) ;if sop = norm=000, zero=001,
-* ;inf=010 or nan=011
- bne.w mon_dnrm ;else denorm
- tst.b DY_MO_FLG(a6) ;all cases of dyadic instructions would
- bne.w normal ;require normalization of denorm
-
-* At this point:
-* monadic instructions: fabs = $18 fneg = $1a ftst = $3a
-* fmove = $00 fsmove = $40 fdmove = $44
-* fsqrt = $05* fssqrt = $41 fdsqrt = $45
-* (*fsqrt reencoded to $05)
-*
- move.w CMDREG1B(a6),d0 ;get command register
- andi.l #$7f,d0 ;strip to only command word
-*
-* At this point, fabs, fneg, fsmove, fdmove, ftst, fsqrt, fssqrt, and
-* fdsqrt are possible.
-* For cases fabs, fneg, fsmove, and fdmove goto spos (do not normalize)
-* For cases fsqrt, fssqrt, and fdsqrt goto nrm_src (do normalize)
-*
- btst.l #0,d0
- bne.w normal ;weed out fsqrt instructions
-*
-* cu_norm handles fmove in instructions with normalized inputs.
-* The routine round is used to correctly round the input for the
-* destination precision and mode.
-*
-cu_norm:
- st CU_ONLY(a6) ;set cu-only inst flag
- move.w CMDREG1B(a6),d0
- andi.b #$3b,d0 ;isolate bits to select inst
- tst.b d0
- beq.l cu_nmove ;if zero, it is an fmove
- cmpi.b #$18,d0
- beq.l cu_nabs ;if $18, it is fabs
- cmpi.b #$1a,d0
- beq.l cu_nneg ;if $1a, it is fneg
-*
-* Inst is ftst. Check the source operand and set the cc's accordingly.
-* No write is done, so simply rts.
-*
-cu_ntst:
- move.w LOCAL_EX(a0),d0
- bclr.l #15,d0
- sne LOCAL_SGN(a0)
- beq.b cu_ntpo
- or.l #neg_mask,USER_FPSR(a6) ;set N
-cu_ntpo:
- cmpi.w #$7fff,d0 ;test for inf/nan
- bne.b cu_ntcz
- tst.l LOCAL_HI(a0)
- bne.b cu_ntn
- tst.l LOCAL_LO(a0)
- bne.b cu_ntn
- or.l #inf_mask,USER_FPSR(a6)
- rts
-cu_ntn:
- or.l #nan_mask,USER_FPSR(a6)
- move.l ETEMP_EX(a6),FPTEMP_EX(a6) ;set up fptemp sign for
-* ;snan handler
-
- rts
-cu_ntcz:
- tst.l LOCAL_HI(a0)
- bne.l cu_ntsx
- tst.l LOCAL_LO(a0)
- bne.l cu_ntsx
- or.l #z_mask,USER_FPSR(a6)
-cu_ntsx:
- rts
-*
-* Inst is fabs. Execute the absolute value function on the input.
-* Branch to the fmove code. If the operand is NaN, do nothing.
-*
-cu_nabs:
- move.b STAG(a6),d0
- btst.l #5,d0 ;test for NaN or zero
- bne wr_etemp ;if either, simply write it
- bclr.b #7,LOCAL_EX(a0) ;do abs
- bra.b cu_nmove ;fmove code will finish
-*
-* Inst is fneg. Execute the negate value function on the input.
-* Fall though to the fmove code. If the operand is NaN, do nothing.
-*
-cu_nneg:
- move.b STAG(a6),d0
- btst.l #5,d0 ;test for NaN or zero
- bne wr_etemp ;if either, simply write it
- bchg.b #7,LOCAL_EX(a0) ;do neg
-*
-* Inst is fmove. This code also handles all result writes.
-* If bit 2 is set, round is forced to double. If it is clear,
-* and bit 6 is set, round is forced to single. If both are clear,
-* the round precision is found in the fpcr. If the rounding precision
-* is double or single, round the result before the write.
-*
-cu_nmove:
- move.b STAG(a6),d0
- andi.b #$e0,d0 ;isolate stag bits
- bne wr_etemp ;if not norm, simply write it
- btst.b #2,CMDREG1B+1(a6) ;check for rd
- bne cu_nmrd
- btst.b #6,CMDREG1B+1(a6) ;check for rs
- bne cu_nmrs
-*
-* The move or operation is not with forced precision. Test for
-* nan or inf as the input; if so, simply write it to FPn. Use the
-* FPCR_MODE byte to get rounding on norms and zeros.
-*
-cu_nmnr:
- bfextu FPCR_MODE(a6){0:2},d0
- tst.b d0 ;check for extended
- beq cu_wrexn ;if so, just write result
- cmpi.b #1,d0 ;check for single
- beq cu_nmrs ;fall through to double
-*
-* The move is fdmove or round precision is double.
-*
-cu_nmrd:
- move.l #2,d0 ;set up the size for denorm
- move.w LOCAL_EX(a0),d1 ;compare exponent to double threshold
- and.w #$7fff,d1
- cmp.w #$3c01,d1
- bls cu_nunfl
- bfextu FPCR_MODE(a6){2:2},d1 ;get rmode
- or.l #$00020000,d1 ;or in rprec (double)
- clr.l d0 ;clear g,r,s for round
- bclr.b #sign_bit,LOCAL_EX(a0) ;convert to internal format
- sne LOCAL_SGN(a0)
- bsr.l round
- bfclr LOCAL_SGN(a0){0:8}
- beq.b cu_nmrdc
- bset.b #sign_bit,LOCAL_EX(a0)
-cu_nmrdc:
- move.w LOCAL_EX(a0),d1 ;check for overflow
- and.w #$7fff,d1
- cmp.w #$43ff,d1
- bge cu_novfl ;take care of overflow case
- bra.w cu_wrexn
-*
-* The move is fsmove or round precision is single.
-*
-cu_nmrs:
- move.l #1,d0
- move.w LOCAL_EX(a0),d1
- and.w #$7fff,d1
- cmp.w #$3f81,d1
- bls cu_nunfl
- bfextu FPCR_MODE(a6){2:2},d1
- or.l #$00010000,d1
- clr.l d0
- bclr.b #sign_bit,LOCAL_EX(a0)
- sne LOCAL_SGN(a0)
- bsr.l round
- bfclr LOCAL_SGN(a0){0:8}
- beq.b cu_nmrsc
- bset.b #sign_bit,LOCAL_EX(a0)
-cu_nmrsc:
- move.w LOCAL_EX(a0),d1
- and.w #$7FFF,d1
- cmp.w #$407f,d1
- blt cu_wrexn
-*
-* The operand is above precision boundaries. Use t_ovfl to
-* generate the correct value.
-*
-cu_novfl:
- bsr t_ovfl
- bra cu_wrexn
-*
-* The operand is below precision boundaries. Use denorm to
-* generate the correct value.
-*
-cu_nunfl:
- bclr.b #sign_bit,LOCAL_EX(a0)
- sne LOCAL_SGN(a0)
- bsr denorm
- bfclr LOCAL_SGN(a0){0:8} ;change back to IEEE ext format
- beq.b cu_nucont
- bset.b #sign_bit,LOCAL_EX(a0)
-cu_nucont:
- bfextu FPCR_MODE(a6){2:2},d1
- btst.b #2,CMDREG1B+1(a6) ;check for rd
- bne inst_d
- btst.b #6,CMDREG1B+1(a6) ;check for rs
- bne inst_s
- swap d1
- move.b FPCR_MODE(a6),d1
- lsr.b #6,d1
- swap d1
- bra inst_sd
-inst_d:
- or.l #$00020000,d1
- bra inst_sd
-inst_s:
- or.l #$00010000,d1
-inst_sd:
- bclr.b #sign_bit,LOCAL_EX(a0)
- sne LOCAL_SGN(a0)
- bsr.l round
- bfclr LOCAL_SGN(a0){0:8}
- beq.b cu_nuflp
- bset.b #sign_bit,LOCAL_EX(a0)
-cu_nuflp:
- btst.b #inex2_bit,FPSR_EXCEPT(a6)
- beq.b cu_nuninx
- or.l #aunfl_mask,USER_FPSR(a6) ;if the round was inex, set AUNFL
-cu_nuninx:
- tst.l LOCAL_HI(a0) ;test for zero
- bne.b cu_nunzro
- tst.l LOCAL_LO(a0)
- bne.b cu_nunzro
-*
-* The mantissa is zero from the denorm loop. Check sign and rmode
-* to see if rounding should have occurred which would leave the lsb.
-*
- move.l USER_FPCR(a6),d0
- andi.l #$30,d0 ;isolate rmode
- cmpi.l #$20,d0
- blt.b cu_nzro
- bne.b cu_nrp
-cu_nrm:
- tst.w LOCAL_EX(a0) ;if positive, set lsb
- bge.b cu_nzro
- btst.b #7,FPCR_MODE(a6) ;check for double
- beq.b cu_nincs
- bra.b cu_nincd
-cu_nrp:
- tst.w LOCAL_EX(a0) ;if positive, set lsb
- blt.b cu_nzro
- btst.b #7,FPCR_MODE(a6) ;check for double
- beq.b cu_nincs
-cu_nincd:
- or.l #$800,LOCAL_LO(a0) ;inc for double
- bra cu_nunzro
-cu_nincs:
- or.l #$100,LOCAL_HI(a0) ;inc for single
- bra cu_nunzro
-cu_nzro:
- or.l #z_mask,USER_FPSR(a6)
- move.b STAG(a6),d0
- andi.b #$e0,d0
- cmpi.b #$40,d0 ;check if input was tagged zero
- beq.b cu_numv
-cu_nunzro:
- or.l #unfl_mask,USER_FPSR(a6) ;set unfl
-cu_numv:
- move.l (a0),ETEMP(a6)
- move.l 4(a0),ETEMP_HI(a6)
- move.l 8(a0),ETEMP_LO(a6)
-*
-* Write the result to memory, setting the fpsr cc bits. NaN and Inf
-* bypass cu_wrexn.
-*
-cu_wrexn:
- tst.w LOCAL_EX(a0) ;test for zero
- beq.b cu_wrzero
- cmp.w #$8000,LOCAL_EX(a0) ;test for zero
- bne.b cu_wreon
-cu_wrzero:
- or.l #z_mask,USER_FPSR(a6) ;set Z bit
-cu_wreon:
- tst.w LOCAL_EX(a0)
- bpl wr_etemp
- or.l #neg_mask,USER_FPSR(a6)
- bra wr_etemp
-
-*
-* HANDLE SOURCE DENORM HERE
-*
-* ;clear denorm stag to norm
-* ;write the new tag & ete15 to the fstack
-mon_dnrm:
-*
-* At this point, check for the cases in which normalizing the
-* denorm produces incorrect results.
-*
- tst.b DY_MO_FLG(a6) ;all cases of dyadic instructions would
- bne.b nrm_src ;require normalization of denorm
-
-* At this point:
-* monadic instructions: fabs = $18 fneg = $1a ftst = $3a
-* fmove = $00 fsmove = $40 fdmove = $44
-* fsqrt = $05* fssqrt = $41 fdsqrt = $45
-* (*fsqrt reencoded to $05)
-*
- move.w CMDREG1B(a6),d0 ;get command register
- andi.l #$7f,d0 ;strip to only command word
-*
-* At this point, fabs, fneg, fsmove, fdmove, ftst, fsqrt, fssqrt, and
-* fdsqrt are possible.
-* For cases fabs, fneg, fsmove, and fdmove goto spos (do not normalize)
-* For cases fsqrt, fssqrt, and fdsqrt goto nrm_src (do normalize)
-*
- btst.l #0,d0
- bne.b nrm_src ;weed out fsqrt instructions
- st CU_ONLY(a6) ;set cu-only inst flag
- bra cu_dnrm ;fmove, fabs, fneg, ftst
-* ;cases go to cu_dnrm
-nrm_src:
- bclr.b #sign_bit,LOCAL_EX(a0)
- sne LOCAL_SGN(a0)
- bsr nrm_set ;normalize number (exponent will go
-* ; negative)
- bclr.b #sign_bit,LOCAL_EX(a0) ;get rid of false sign
-
- bfclr LOCAL_SGN(a0){0:8} ;change back to IEEE ext format
- beq.b spos
- bset.b #sign_bit,LOCAL_EX(a0)
-spos:
- bfclr STAG(a6){0:4} ;set tag to normalized, FPTE15 = 0
- bset.b #4,STAG(a6) ;set ETE15
- or.b #$f0,DNRM_FLG(a6)
-normal:
- tst.b DNRM_FLG(a6) ;check if any of the ops were denorms
- bne ck_wrap ;if so, check if it is a potential
-* ;wrap-around case
-fix_stk:
- move.b #$fe,CU_SAVEPC(a6)
- bclr.b #E1,E_BYTE(a6)
-
- clr.w NMNEXC(a6)
-
- st.b RES_FLG(a6) ;indicate that a restore is needed
- rts
-
-*
-* cu_dnrm handles all cu-only instructions (fmove, fabs, fneg, and
-* ftst) completely in software without an frestore to the 040.
-*
-cu_dnrm:
- st.b CU_ONLY(a6)
- move.w CMDREG1B(a6),d0
- andi.b #$3b,d0 ;isolate bits to select inst
- tst.b d0
- beq.l cu_dmove ;if zero, it is an fmove
- cmpi.b #$18,d0
- beq.l cu_dabs ;if $18, it is fabs
- cmpi.b #$1a,d0
- beq.l cu_dneg ;if $1a, it is fneg
-*
-* Inst is ftst. Check the source operand and set the cc's accordingly.
-* No write is done, so simply rts.
-*
-cu_dtst:
- move.w LOCAL_EX(a0),d0
- bclr.l #15,d0
- sne LOCAL_SGN(a0)
- beq.b cu_dtpo
- or.l #neg_mask,USER_FPSR(a6) ;set N
-cu_dtpo:
- cmpi.w #$7fff,d0 ;test for inf/nan
- bne.b cu_dtcz
- tst.l LOCAL_HI(a0)
- bne.b cu_dtn
- tst.l LOCAL_LO(a0)
- bne.b cu_dtn
- or.l #inf_mask,USER_FPSR(a6)
- rts
-cu_dtn:
- or.l #nan_mask,USER_FPSR(a6)
- move.l ETEMP_EX(a6),FPTEMP_EX(a6) ;set up fptemp sign for
-* ;snan handler
- rts
-cu_dtcz:
- tst.l LOCAL_HI(a0)
- bne.l cu_dtsx
- tst.l LOCAL_LO(a0)
- bne.l cu_dtsx
- or.l #z_mask,USER_FPSR(a6)
-cu_dtsx:
- rts
-*
-* Inst is fabs. Execute the absolute value function on the input.
-* Branch to the fmove code.
-*
-cu_dabs:
- bclr.b #7,LOCAL_EX(a0) ;do abs
- bra.b cu_dmove ;fmove code will finish
-*
-* Inst is fneg. Execute the negate value function on the input.
-* Fall though to the fmove code.
-*
-cu_dneg:
- bchg.b #7,LOCAL_EX(a0) ;do neg
-*
-* Inst is fmove. This code also handles all result writes.
-* If bit 2 is set, round is forced to double. If it is clear,
-* and bit 6 is set, round is forced to single. If both are clear,
-* the round precision is found in the fpcr. If the rounding precision
-* is double or single, the result is zero, and the mode is checked
-* to determine if the lsb of the result should be set.
-*
-cu_dmove:
- btst.b #2,CMDREG1B+1(a6) ;check for rd
- bne cu_dmrd
- btst.b #6,CMDREG1B+1(a6) ;check for rs
- bne cu_dmrs
-*
-* The move or operation is not with forced precision. Use the
-* FPCR_MODE byte to get rounding.
-*
-cu_dmnr:
- bfextu FPCR_MODE(a6){0:2},d0
- tst.b d0 ;check for extended
- beq cu_wrexd ;if so, just write result
- cmpi.b #1,d0 ;check for single
- beq cu_dmrs ;fall through to double
-*
-* The move is fdmove or round precision is double. Result is zero.
-* Check rmode for rp or rm and set lsb accordingly.
-*
-cu_dmrd:
- bfextu FPCR_MODE(a6){2:2},d1 ;get rmode
- tst.w LOCAL_EX(a0) ;check sign
- blt.b cu_dmdn
- cmpi.b #3,d1 ;check for rp
- bne cu_dpd ;load double pos zero
- bra cu_dpdr ;load double pos zero w/lsb
-cu_dmdn:
- cmpi.b #2,d1 ;check for rm
- bne cu_dnd ;load double neg zero
- bra cu_dndr ;load double neg zero w/lsb
-*
-* The move is fsmove or round precision is single. Result is zero.
-* Check for rp or rm and set lsb accordingly.
-*
-cu_dmrs:
- bfextu FPCR_MODE(a6){2:2},d1 ;get rmode
- tst.w LOCAL_EX(a0) ;check sign
- blt.b cu_dmsn
- cmpi.b #3,d1 ;check for rp
- bne cu_spd ;load single pos zero
- bra cu_spdr ;load single pos zero w/lsb
-cu_dmsn:
- cmpi.b #2,d1 ;check for rm
- bne cu_snd ;load single neg zero
- bra cu_sndr ;load single neg zero w/lsb
-*
-* The precision is extended, so the result in etemp is correct.
-* Simply set unfl (not inex2 or aunfl) and write the result to
-* the correct fp register.
-cu_wrexd:
- or.l #unfl_mask,USER_FPSR(a6)
- tst.w LOCAL_EX(a0)
- beq wr_etemp
- or.l #neg_mask,USER_FPSR(a6)
- bra wr_etemp
-*
-* These routines write +/- zero in double format. The routines
-* cu_dpdr and cu_dndr set the double lsb.
-*
-cu_dpd:
- move.l #$3c010000,LOCAL_EX(a0) ;force pos double zero
- clr.l LOCAL_HI(a0)
- clr.l LOCAL_LO(a0)
- or.l #z_mask,USER_FPSR(a6)
- or.l #unfinx_mask,USER_FPSR(a6)
- bra wr_etemp
-cu_dpdr:
- move.l #$3c010000,LOCAL_EX(a0) ;force pos double zero
- clr.l LOCAL_HI(a0)
- move.l #$800,LOCAL_LO(a0) ;with lsb set
- or.l #unfinx_mask,USER_FPSR(a6)
- bra wr_etemp
-cu_dnd:
- move.l #$bc010000,LOCAL_EX(a0) ;force pos double zero
- clr.l LOCAL_HI(a0)
- clr.l LOCAL_LO(a0)
- or.l #z_mask,USER_FPSR(a6)
- or.l #neg_mask,USER_FPSR(a6)
- or.l #unfinx_mask,USER_FPSR(a6)
- bra wr_etemp
-cu_dndr:
- move.l #$bc010000,LOCAL_EX(a0) ;force pos double zero
- clr.l LOCAL_HI(a0)
- move.l #$800,LOCAL_LO(a0) ;with lsb set
- or.l #neg_mask,USER_FPSR(a6)
- or.l #unfinx_mask,USER_FPSR(a6)
- bra wr_etemp
-*
-* These routines write +/- zero in single format. The routines
-* cu_dpdr and cu_dndr set the single lsb.
-*
-cu_spd:
- move.l #$3f810000,LOCAL_EX(a0) ;force pos single zero
- clr.l LOCAL_HI(a0)
- clr.l LOCAL_LO(a0)
- or.l #z_mask,USER_FPSR(a6)
- or.l #unfinx_mask,USER_FPSR(a6)
- bra wr_etemp
-cu_spdr:
- move.l #$3f810000,LOCAL_EX(a0) ;force pos single zero
- move.l #$100,LOCAL_HI(a0) ;with lsb set
- clr.l LOCAL_LO(a0)
- or.l #unfinx_mask,USER_FPSR(a6)
- bra wr_etemp
-cu_snd:
- move.l #$bf810000,LOCAL_EX(a0) ;force pos single zero
- clr.l LOCAL_HI(a0)
- clr.l LOCAL_LO(a0)
- or.l #z_mask,USER_FPSR(a6)
- or.l #neg_mask,USER_FPSR(a6)
- or.l #unfinx_mask,USER_FPSR(a6)
- bra wr_etemp
-cu_sndr:
- move.l #$bf810000,LOCAL_EX(a0) ;force pos single zero
- move.l #$100,LOCAL_HI(a0) ;with lsb set
- clr.l LOCAL_LO(a0)
- or.l #neg_mask,USER_FPSR(a6)
- or.l #unfinx_mask,USER_FPSR(a6)
- bra wr_etemp
-
-*
-* This code checks for 16-bit overflow conditions on dyadic
-* operations which are not restorable into the floating-point
-* unit and must be completed in software. Basically, this
-* condition exists with a very large norm and a denorm. One
-* of the operands must be denormalized to enter this code.
-*
-* Flags used:
-* DY_MO_FLG contains 0 for monadic op, $ff for dyadic
-* DNRM_FLG contains $00 for neither op denormalized
-* $0f for the destination op denormalized
-* $f0 for the source op denormalized
-* $ff for both ops denormalzed
-*
-* The wrap-around condition occurs for add, sub, div, and cmp
-* when
-*
-* abs(dest_exp - src_exp) >= $8000
-*
-* and for mul when
-*
-* (dest_exp + src_exp) < $0
-*
-* we must process the operation here if this case is true.
-*
-* The rts following the frcfpn routine is the exit from res_func
-* for this condition. The restore flag (RES_FLG) is left clear.
-* No frestore is done unless an exception is to be reported.
-*
-* For fadd:
-* if(sign_of(dest) != sign_of(src))
-* replace exponent of src with $3fff (keep sign)
-* use fpu to perform dest+new_src (user's rmode and X)
-* clr sticky
-* else
-* set sticky
-* call round with user's precision and mode
-* move result to fpn and wbtemp
-*
-* For fsub:
-* if(sign_of(dest) == sign_of(src))
-* replace exponent of src with $3fff (keep sign)
-* use fpu to perform dest+new_src (user's rmode and X)
-* clr sticky
-* else
-* set sticky
-* call round with user's precision and mode
-* move result to fpn and wbtemp
-*
-* For fdiv/fsgldiv:
-* if(both operands are denorm)
-* restore_to_fpu;
-* if(dest is norm)
-* force_ovf;
-* else(dest is denorm)
-* force_unf:
-*
-* For fcmp:
-* if(dest is norm)
-* N = sign_of(dest);
-* else(dest is denorm)
-* N = sign_of(src);
-*
-* For fmul:
-* if(both operands are denorm)
-* force_unf;
-* if((dest_exp + src_exp) < 0)
-* force_unf:
-* else
-* restore_to_fpu;
-*
-* local equates:
-addcode equ $22
-subcode equ $28
-mulcode equ $23
-divcode equ $20
-cmpcode equ $38
-ck_wrap:
- tst.b DY_MO_FLG(a6) ;check for fsqrt
- beq fix_stk ;if zero, it is fsqrt
- move.w CMDREG1B(a6),d0
- andi.w #$3b,d0 ;strip to command bits
- cmpi.w #addcode,d0
- beq wrap_add
- cmpi.w #subcode,d0
- beq wrap_sub
- cmpi.w #mulcode,d0
- beq wrap_mul
- cmpi.w #cmpcode,d0
- beq wrap_cmp
-*
-* Inst is fdiv.
-*
-wrap_div:
- cmp.b #$ff,DNRM_FLG(a6) ;if both ops denorm,
- beq fix_stk ;restore to fpu
-*
-* One of the ops is denormalized. Test for wrap condition
-* and force the result.
-*
- cmp.b #$0f,DNRM_FLG(a6) ;check for dest denorm
- bne.b div_srcd
-div_destd:
- bsr.l ckinf_ns
- bne fix_stk
- bfextu ETEMP_EX(a6){1:15},d0 ;get src exp (always pos)
- bfexts FPTEMP_EX(a6){1:15},d1 ;get dest exp (always neg)
- sub.l d1,d0 ;subtract dest from src
- cmp.l #$7fff,d0
- blt fix_stk ;if less, not wrap case
- clr.b WBTEMP_SGN(a6)
- move.w ETEMP_EX(a6),d0 ;find the sign of the result
- move.w FPTEMP_EX(a6),d1
- eor.w d1,d0
- andi.w #$8000,d0
- beq force_unf
- st.b WBTEMP_SGN(a6)
- bra force_unf
-
-ckinf_ns:
- move.b STAG(a6),d0 ;check source tag for inf or nan
- bra ck_in_com
-ckinf_nd:
- move.b DTAG(a6),d0 ;check destination tag for inf or nan
-ck_in_com:
- andi.b #$60,d0 ;isolate tag bits
- cmp.b #$40,d0 ;is it inf?
- beq nan_or_inf ;not wrap case
- cmp.b #$60,d0 ;is it nan?
- beq nan_or_inf ;yes, not wrap case?
- cmp.b #$20,d0 ;is it a zero?
- beq nan_or_inf ;yes
- clr.l d0
- rts ;then it is either a zero of norm,
-* ;check wrap case
-nan_or_inf:
- moveq.l #-1,d0
- rts
-
-
-
-div_srcd:
- bsr.l ckinf_nd
- bne fix_stk
- bfextu FPTEMP_EX(a6){1:15},d0 ;get dest exp (always pos)
- bfexts ETEMP_EX(a6){1:15},d1 ;get src exp (always neg)
- sub.l d1,d0 ;subtract src from dest
- cmp.l #$8000,d0
- blt fix_stk ;if less, not wrap case
- clr.b WBTEMP_SGN(a6)
- move.w ETEMP_EX(a6),d0 ;find the sign of the result
- move.w FPTEMP_EX(a6),d1
- eor.w d1,d0
- andi.w #$8000,d0
- beq.b force_ovf
- st.b WBTEMP_SGN(a6)
-*
-* This code handles the case of the instruction resulting in
-* an overflow condition.
-*
-force_ovf:
- bclr.b #E1,E_BYTE(a6)
- or.l #ovfl_inx_mask,USER_FPSR(a6)
- clr.w NMNEXC(a6)
- lea.l WBTEMP(a6),a0 ;point a0 to memory location
- move.w CMDREG1B(a6),d0
- btst.l #6,d0 ;test for forced precision
- beq.b frcovf_fpcr
- btst.l #2,d0 ;check for double
- bne.b frcovf_dbl
- move.l #$1,d0 ;inst is forced single
- bra.b frcovf_rnd
-frcovf_dbl:
- move.l #$2,d0 ;inst is forced double
- bra.b frcovf_rnd
-frcovf_fpcr:
- bfextu FPCR_MODE(a6){0:2},d0 ;inst not forced - use fpcr prec
-frcovf_rnd:
-
-* The 881/882 does not set inex2 for the following case, so the
-* line is commented out to be compatible with 881/882
-* tst.b d0
-* beq.b frcovf_x
-* or.l #inex2_mask,USER_FPSR(a6) ;if prec is s or d, set inex2
-
-*frcovf_x:
- bsr.l ovf_res ;get correct result based on
-* ;round precision/mode. This
-* ;sets FPSR_CC correctly
-* ;returns in external format
- bfclr WBTEMP_SGN(a6){0:8}
- beq frcfpn
- bset.b #sign_bit,WBTEMP_EX(a6)
- bra frcfpn
-*
-* Inst is fadd.
-*
-wrap_add:
- cmp.b #$ff,DNRM_FLG(a6) ;if both ops denorm,
- beq fix_stk ;restore to fpu
-*
-* One of the ops is denormalized. Test for wrap condition
-* and complete the instruction.
-*
- cmp.b #$0f,DNRM_FLG(a6) ;check for dest denorm
- bne.b add_srcd
-add_destd:
- bsr.l ckinf_ns
- bne fix_stk
- bfextu ETEMP_EX(a6){1:15},d0 ;get src exp (always pos)
- bfexts FPTEMP_EX(a6){1:15},d1 ;get dest exp (always neg)
- sub.l d1,d0 ;subtract dest from src
- cmp.l #$8000,d0
- blt fix_stk ;if less, not wrap case
- bra add_wrap
-add_srcd:
- bsr.l ckinf_nd
- bne fix_stk
- bfextu FPTEMP_EX(a6){1:15},d0 ;get dest exp (always pos)
- bfexts ETEMP_EX(a6){1:15},d1 ;get src exp (always neg)
- sub.l d1,d0 ;subtract src from dest
- cmp.l #$8000,d0
- blt fix_stk ;if less, not wrap case
-*
-* Check the signs of the operands. If they are unlike, the fpu
-* can be used to add the norm and 1.0 with the sign of the
-* denorm and it will correctly generate the result in extended
-* precision. We can then call round with no sticky and the result
-* will be correct for the user's rounding mode and precision. If
-* the signs are the same, we call round with the sticky bit set
-* and the result will be correctfor the user's rounding mode and
-* precision.
-*
-add_wrap:
- move.w ETEMP_EX(a6),d0
- move.w FPTEMP_EX(a6),d1
- eor.w d1,d0
- andi.w #$8000,d0
- beq add_same
-*
-* The signs are unlike.
-*
- cmp.b #$0f,DNRM_FLG(a6) ;is dest the denorm?
- bne.b add_u_srcd
- move.w FPTEMP_EX(a6),d0
- andi.w #$8000,d0
- or.w #$3fff,d0 ;force the exponent to +/- 1
- move.w d0,FPTEMP_EX(a6) ;in the denorm
- move.l USER_FPCR(a6),d0
- andi.l #$30,d0
- fmove.l d0,fpcr ;set up users rmode and X
- fmove.x ETEMP(a6),fp0
- fadd.x FPTEMP(a6),fp0
- lea.l WBTEMP(a6),a0 ;point a0 to wbtemp in frame
- fmove.l fpsr,d1
- or.l d1,USER_FPSR(a6) ;capture cc's and inex from fadd
- fmove.x fp0,WBTEMP(a6) ;write result to memory
- lsr.l #4,d0 ;put rmode in lower 2 bits
- move.l USER_FPCR(a6),d1
- andi.l #$c0,d1
- lsr.l #6,d1 ;put precision in upper word
- swap d1
- or.l d0,d1 ;set up for round call
- clr.l d0 ;force sticky to zero
- bclr.b #sign_bit,WBTEMP_EX(a6)
- sne WBTEMP_SGN(a6)
- bsr.l round ;round result to users rmode & prec
- bfclr WBTEMP_SGN(a6){0:8} ;convert back to IEEE ext format
- beq frcfpnr
- bset.b #sign_bit,WBTEMP_EX(a6)
- bra frcfpnr
-add_u_srcd:
- move.w ETEMP_EX(a6),d0
- andi.w #$8000,d0
- or.w #$3fff,d0 ;force the exponent to +/- 1
- move.w d0,ETEMP_EX(a6) ;in the denorm
- move.l USER_FPCR(a6),d0
- andi.l #$30,d0
- fmove.l d0,fpcr ;set up users rmode and X
- fmove.x ETEMP(a6),fp0
- fadd.x FPTEMP(a6),fp0
- fmove.l fpsr,d1
- or.l d1,USER_FPSR(a6) ;capture cc's and inex from fadd
- lea.l WBTEMP(a6),a0 ;point a0 to wbtemp in frame
- fmove.x fp0,WBTEMP(a6) ;write result to memory
- lsr.l #4,d0 ;put rmode in lower 2 bits
- move.l USER_FPCR(a6),d1
- andi.l #$c0,d1
- lsr.l #6,d1 ;put precision in upper word
- swap d1
- or.l d0,d1 ;set up for round call
- clr.l d0 ;force sticky to zero
- bclr.b #sign_bit,WBTEMP_EX(a6)
- sne WBTEMP_SGN(a6) ;use internal format for round
- bsr.l round ;round result to users rmode & prec
- bfclr WBTEMP_SGN(a6){0:8} ;convert back to IEEE ext format
- beq frcfpnr
- bset.b #sign_bit,WBTEMP_EX(a6)
- bra frcfpnr
-*
-* Signs are alike:
-*
-add_same:
- cmp.b #$0f,DNRM_FLG(a6) ;is dest the denorm?
- bne.b add_s_srcd
-add_s_destd:
- lea.l ETEMP(a6),a0
- move.l USER_FPCR(a6),d0
- andi.l #$30,d0
- lsr.l #4,d0 ;put rmode in lower 2 bits
- move.l USER_FPCR(a6),d1
- andi.l #$c0,d1
- lsr.l #6,d1 ;put precision in upper word
- swap d1
- or.l d0,d1 ;set up for round call
- move.l #$20000000,d0 ;set sticky for round
- bclr.b #sign_bit,ETEMP_EX(a6)
- sne ETEMP_SGN(a6)
- bsr.l round ;round result to users rmode & prec
- bfclr ETEMP_SGN(a6){0:8} ;convert back to IEEE ext format
- beq.b add_s_dclr
- bset.b #sign_bit,ETEMP_EX(a6)
-add_s_dclr:
- lea.l WBTEMP(a6),a0
- move.l ETEMP(a6),(a0) ;write result to wbtemp
- move.l ETEMP_HI(a6),4(a0)
- move.l ETEMP_LO(a6),8(a0)
- tst.w ETEMP_EX(a6)
- bgt add_ckovf
- or.l #neg_mask,USER_FPSR(a6)
- bra add_ckovf
-add_s_srcd:
- lea.l FPTEMP(a6),a0
- move.l USER_FPCR(a6),d0
- andi.l #$30,d0
- lsr.l #4,d0 ;put rmode in lower 2 bits
- move.l USER_FPCR(a6),d1
- andi.l #$c0,d1
- lsr.l #6,d1 ;put precision in upper word
- swap d1
- or.l d0,d1 ;set up for round call
- move.l #$20000000,d0 ;set sticky for round
- bclr.b #sign_bit,FPTEMP_EX(a6)
- sne FPTEMP_SGN(a6)
- bsr.l round ;round result to users rmode & prec
- bfclr FPTEMP_SGN(a6){0:8} ;convert back to IEEE ext format
- beq.b add_s_sclr
- bset.b #sign_bit,FPTEMP_EX(a6)
-add_s_sclr:
- lea.l WBTEMP(a6),a0
- move.l FPTEMP(a6),(a0) ;write result to wbtemp
- move.l FPTEMP_HI(a6),4(a0)
- move.l FPTEMP_LO(a6),8(a0)
- tst.w FPTEMP_EX(a6)
- bgt add_ckovf
- or.l #neg_mask,USER_FPSR(a6)
-add_ckovf:
- move.w WBTEMP_EX(a6),d0
- andi.w #$7fff,d0
- cmpi.w #$7fff,d0
- bne frcfpnr
-*
-* The result has overflowed to $7fff exponent. Set I, ovfl,
-* and aovfl, and clr the mantissa (incorrectly set by the
-* round routine.)
-*
- or.l #inf_mask+ovfl_inx_mask,USER_FPSR(a6)
- clr.l 4(a0)
- bra frcfpnr
-*
-* Inst is fsub.
-*
-wrap_sub:
- cmp.b #$ff,DNRM_FLG(a6) ;if both ops denorm,
- beq fix_stk ;restore to fpu
-*
-* One of the ops is denormalized. Test for wrap condition
-* and complete the instruction.
-*
- cmp.b #$0f,DNRM_FLG(a6) ;check for dest denorm
- bne.b sub_srcd
-sub_destd:
- bsr.l ckinf_ns
- bne fix_stk
- bfextu ETEMP_EX(a6){1:15},d0 ;get src exp (always pos)
- bfexts FPTEMP_EX(a6){1:15},d1 ;get dest exp (always neg)
- sub.l d1,d0 ;subtract src from dest
- cmp.l #$8000,d0
- blt fix_stk ;if less, not wrap case
- bra sub_wrap
-sub_srcd:
- bsr.l ckinf_nd
- bne fix_stk
- bfextu FPTEMP_EX(a6){1:15},d0 ;get dest exp (always pos)
- bfexts ETEMP_EX(a6){1:15},d1 ;get src exp (always neg)
- sub.l d1,d0 ;subtract dest from src
- cmp.l #$8000,d0
- blt fix_stk ;if less, not wrap case
-*
-* Check the signs of the operands. If they are alike, the fpu
-* can be used to subtract from the norm 1.0 with the sign of the
-* denorm and it will correctly generate the result in extended
-* precision. We can then call round with no sticky and the result
-* will be correct for the user's rounding mode and precision. If
-* the signs are unlike, we call round with the sticky bit set
-* and the result will be correctfor the user's rounding mode and
-* precision.
-*
-sub_wrap:
- move.w ETEMP_EX(a6),d0
- move.w FPTEMP_EX(a6),d1
- eor.w d1,d0
- andi.w #$8000,d0
- bne sub_diff
-*
-* The signs are alike.
-*
- cmp.b #$0f,DNRM_FLG(a6) ;is dest the denorm?
- bne.b sub_u_srcd
- move.w FPTEMP_EX(a6),d0
- andi.w #$8000,d0
- or.w #$3fff,d0 ;force the exponent to +/- 1
- move.w d0,FPTEMP_EX(a6) ;in the denorm
- move.l USER_FPCR(a6),d0
- andi.l #$30,d0
- fmove.l d0,fpcr ;set up users rmode and X
- fmove.x FPTEMP(a6),fp0
- fsub.x ETEMP(a6),fp0
- fmove.l fpsr,d1
- or.l d1,USER_FPSR(a6) ;capture cc's and inex from fadd
- lea.l WBTEMP(a6),a0 ;point a0 to wbtemp in frame
- fmove.x fp0,WBTEMP(a6) ;write result to memory
- lsr.l #4,d0 ;put rmode in lower 2 bits
- move.l USER_FPCR(a6),d1
- andi.l #$c0,d1
- lsr.l #6,d1 ;put precision in upper word
- swap d1
- or.l d0,d1 ;set up for round call
- clr.l d0 ;force sticky to zero
- bclr.b #sign_bit,WBTEMP_EX(a6)
- sne WBTEMP_SGN(a6)
- bsr.l round ;round result to users rmode & prec
- bfclr WBTEMP_SGN(a6){0:8} ;convert back to IEEE ext format
- beq frcfpnr
- bset.b #sign_bit,WBTEMP_EX(a6)
- bra frcfpnr
-sub_u_srcd:
- move.w ETEMP_EX(a6),d0
- andi.w #$8000,d0
- or.w #$3fff,d0 ;force the exponent to +/- 1
- move.w d0,ETEMP_EX(a6) ;in the denorm
- move.l USER_FPCR(a6),d0
- andi.l #$30,d0
- fmove.l d0,fpcr ;set up users rmode and X
- fmove.x FPTEMP(a6),fp0
- fsub.x ETEMP(a6),fp0
- fmove.l fpsr,d1
- or.l d1,USER_FPSR(a6) ;capture cc's and inex from fadd
- lea.l WBTEMP(a6),a0 ;point a0 to wbtemp in frame
- fmove.x fp0,WBTEMP(a6) ;write result to memory
- lsr.l #4,d0 ;put rmode in lower 2 bits
- move.l USER_FPCR(a6),d1
- andi.l #$c0,d1
- lsr.l #6,d1 ;put precision in upper word
- swap d1
- or.l d0,d1 ;set up for round call
- clr.l d0 ;force sticky to zero
- bclr.b #sign_bit,WBTEMP_EX(a6)
- sne WBTEMP_SGN(a6)
- bsr.l round ;round result to users rmode & prec
- bfclr WBTEMP_SGN(a6){0:8} ;convert back to IEEE ext format
- beq frcfpnr
- bset.b #sign_bit,WBTEMP_EX(a6)
- bra frcfpnr
-*
-* Signs are unlike:
-*
-sub_diff:
- cmp.b #$0f,DNRM_FLG(a6) ;is dest the denorm?
- bne.b sub_s_srcd
-sub_s_destd:
- lea.l ETEMP(a6),a0
- move.l USER_FPCR(a6),d0
- andi.l #$30,d0
- lsr.l #4,d0 ;put rmode in lower 2 bits
- move.l USER_FPCR(a6),d1
- andi.l #$c0,d1
- lsr.l #6,d1 ;put precision in upper word
- swap d1
- or.l d0,d1 ;set up for round call
- move.l #$20000000,d0 ;set sticky for round
-*
-* Since the dest is the denorm, the sign is the opposite of the
-* norm sign.
-*
- eori.w #$8000,ETEMP_EX(a6) ;flip sign on result
- tst.w ETEMP_EX(a6)
- bgt.b sub_s_dwr
- or.l #neg_mask,USER_FPSR(a6)
-sub_s_dwr:
- bclr.b #sign_bit,ETEMP_EX(a6)
- sne ETEMP_SGN(a6)
- bsr.l round ;round result to users rmode & prec
- bfclr ETEMP_SGN(a6){0:8} ;convert back to IEEE ext format
- beq.b sub_s_dclr
- bset.b #sign_bit,ETEMP_EX(a6)
-sub_s_dclr:
- lea.l WBTEMP(a6),a0
- move.l ETEMP(a6),(a0) ;write result to wbtemp
- move.l ETEMP_HI(a6),4(a0)
- move.l ETEMP_LO(a6),8(a0)
- bra sub_ckovf
-sub_s_srcd:
- lea.l FPTEMP(a6),a0
- move.l USER_FPCR(a6),d0
- andi.l #$30,d0
- lsr.l #4,d0 ;put rmode in lower 2 bits
- move.l USER_FPCR(a6),d1
- andi.l #$c0,d1
- lsr.l #6,d1 ;put precision in upper word
- swap d1
- or.l d0,d1 ;set up for round call
- move.l #$20000000,d0 ;set sticky for round
- bclr.b #sign_bit,FPTEMP_EX(a6)
- sne FPTEMP_SGN(a6)
- bsr.l round ;round result to users rmode & prec
- bfclr FPTEMP_SGN(a6){0:8} ;convert back to IEEE ext format
- beq.b sub_s_sclr
- bset.b #sign_bit,FPTEMP_EX(a6)
-sub_s_sclr:
- lea.l WBTEMP(a6),a0
- move.l FPTEMP(a6),(a0) ;write result to wbtemp
- move.l FPTEMP_HI(a6),4(a0)
- move.l FPTEMP_LO(a6),8(a0)
- tst.w FPTEMP_EX(a6)
- bgt sub_ckovf
- or.l #neg_mask,USER_FPSR(a6)
-sub_ckovf:
- move.w WBTEMP_EX(a6),d0
- andi.w #$7fff,d0
- cmpi.w #$7fff,d0
- bne frcfpnr
-*
-* The result has overflowed to $7fff exponent. Set I, ovfl,
-* and aovfl, and clr the mantissa (incorrectly set by the
-* round routine.)
-*
- or.l #inf_mask+ovfl_inx_mask,USER_FPSR(a6)
- clr.l 4(a0)
- bra frcfpnr
-*
-* Inst is fcmp.
-*
-wrap_cmp:
- cmp.b #$ff,DNRM_FLG(a6) ;if both ops denorm,
- beq fix_stk ;restore to fpu
-*
-* One of the ops is denormalized. Test for wrap condition
-* and complete the instruction.
-*
- cmp.b #$0f,DNRM_FLG(a6) ;check for dest denorm
- bne.b cmp_srcd
-cmp_destd:
- bsr.l ckinf_ns
- bne fix_stk
- bfextu ETEMP_EX(a6){1:15},d0 ;get src exp (always pos)
- bfexts FPTEMP_EX(a6){1:15},d1 ;get dest exp (always neg)
- sub.l d1,d0 ;subtract dest from src
- cmp.l #$8000,d0
- blt fix_stk ;if less, not wrap case
- tst.w ETEMP_EX(a6) ;set N to ~sign_of(src)
- bge cmp_setn
- rts
-cmp_srcd:
- bsr.l ckinf_nd
- bne fix_stk
- bfextu FPTEMP_EX(a6){1:15},d0 ;get dest exp (always pos)
- bfexts ETEMP_EX(a6){1:15},d1 ;get src exp (always neg)
- sub.l d1,d0 ;subtract src from dest
- cmp.l #$8000,d0
- blt fix_stk ;if less, not wrap case
- tst.w FPTEMP_EX(a6) ;set N to sign_of(dest)
- blt cmp_setn
- rts
-cmp_setn:
- or.l #neg_mask,USER_FPSR(a6)
- rts
-
-*
-* Inst is fmul.
-*
-wrap_mul:
- cmp.b #$ff,DNRM_FLG(a6) ;if both ops denorm,
- beq force_unf ;force an underflow (really!)
-*
-* One of the ops is denormalized. Test for wrap condition
-* and complete the instruction.
-*
- cmp.b #$0f,DNRM_FLG(a6) ;check for dest denorm
- bne.b mul_srcd
-mul_destd:
- bsr.l ckinf_ns
- bne fix_stk
- bfextu ETEMP_EX(a6){1:15},d0 ;get src exp (always pos)
- bfexts FPTEMP_EX(a6){1:15},d1 ;get dest exp (always neg)
- add.l d1,d0 ;subtract dest from src
- bgt fix_stk
- bra force_unf
-mul_srcd:
- bsr.l ckinf_nd
- bne fix_stk
- bfextu FPTEMP_EX(a6){1:15},d0 ;get dest exp (always pos)
- bfexts ETEMP_EX(a6){1:15},d1 ;get src exp (always neg)
- add.l d1,d0 ;subtract src from dest
- bgt fix_stk
-
-*
-* This code handles the case of the instruction resulting in
-* an underflow condition.
-*
-force_unf:
- bclr.b #E1,E_BYTE(a6)
- or.l #unfinx_mask,USER_FPSR(a6)
- clr.w NMNEXC(a6)
- clr.b WBTEMP_SGN(a6)
- move.w ETEMP_EX(a6),d0 ;find the sign of the result
- move.w FPTEMP_EX(a6),d1
- eor.w d1,d0
- andi.w #$8000,d0
- beq.b frcunfcont
- st.b WBTEMP_SGN(a6)
-frcunfcont:
- lea WBTEMP(a6),a0 ;point a0 to memory location
- move.w CMDREG1B(a6),d0
- btst.l #6,d0 ;test for forced precision
- beq.b frcunf_fpcr
- btst.l #2,d0 ;check for double
- bne.b frcunf_dbl
- move.l #$1,d0 ;inst is forced single
- bra.b frcunf_rnd
-frcunf_dbl:
- move.l #$2,d0 ;inst is forced double
- bra.b frcunf_rnd
-frcunf_fpcr:
- bfextu FPCR_MODE(a6){0:2},d0 ;inst not forced - use fpcr prec
-frcunf_rnd:
- bsr.l unf_sub ;get correct result based on
-* ;round precision/mode. This
-* ;sets FPSR_CC correctly
- bfclr WBTEMP_SGN(a6){0:8} ;convert back to IEEE ext format
- beq.b frcfpn
- bset.b #sign_bit,WBTEMP_EX(a6)
- bra frcfpn
-
-*
-* Write the result to the user's fpn. All results must be HUGE to be
-* written; otherwise the results would have overflowed or underflowed.
-* If the rounding precision is single or double, the ovf_res routine
-* is needed to correctly supply the max value.
-*
-frcfpnr:
- move.w CMDREG1B(a6),d0
- btst.l #6,d0 ;test for forced precision
- beq.b frcfpn_fpcr
- btst.l #2,d0 ;check for double
- bne.b frcfpn_dbl
- move.l #$1,d0 ;inst is forced single
- bra.b frcfpn_rnd
-frcfpn_dbl:
- move.l #$2,d0 ;inst is forced double
- bra.b frcfpn_rnd
-frcfpn_fpcr:
- bfextu FPCR_MODE(a6){0:2},d0 ;inst not forced - use fpcr prec
- tst.b d0
- beq.b frcfpn ;if extended, write what you got
-frcfpn_rnd:
- bclr.b #sign_bit,WBTEMP_EX(a6)
- sne WBTEMP_SGN(a6)
- bsr.l ovf_res ;get correct result based on
-* ;round precision/mode. This
-* ;sets FPSR_CC correctly
- bfclr WBTEMP_SGN(a6){0:8} ;convert back to IEEE ext format
- beq.b frcfpn_clr
- bset.b #sign_bit,WBTEMP_EX(a6)
-frcfpn_clr:
- or.l #ovfinx_mask,USER_FPSR(a6)
-*
-* Perform the write.
-*
-frcfpn:
- bfextu CMDREG1B(a6){6:3},d0 ;extract fp destination register
- cmpi.b #3,d0
- ble.b frc0123 ;check if dest is fp0-fp3
- move.l #7,d1
- sub.l d0,d1
- clr.l d0
- bset.l d1,d0
- fmovem.x WBTEMP(a6),d0
- rts
-frc0123:
- tst.b d0
- beq.b frc0_dst
- cmpi.b #1,d0
- beq.b frc1_dst
- cmpi.b #2,d0
- beq.b frc2_dst
-frc3_dst:
- move.l WBTEMP_EX(a6),USER_FP3(a6)
- move.l WBTEMP_HI(a6),USER_FP3+4(a6)
- move.l WBTEMP_LO(a6),USER_FP3+8(a6)
- rts
-frc2_dst:
- move.l WBTEMP_EX(a6),USER_FP2(a6)
- move.l WBTEMP_HI(a6),USER_FP2+4(a6)
- move.l WBTEMP_LO(a6),USER_FP2+8(a6)
- rts
-frc1_dst:
- move.l WBTEMP_EX(a6),USER_FP1(a6)
- move.l WBTEMP_HI(a6),USER_FP1+4(a6)
- move.l WBTEMP_LO(a6),USER_FP1+8(a6)
- rts
-frc0_dst:
- move.l WBTEMP_EX(a6),USER_FP0(a6)
- move.l WBTEMP_HI(a6),USER_FP0+4(a6)
- move.l WBTEMP_LO(a6),USER_FP0+8(a6)
- rts
-
-*
-* Write etemp to fpn.
-* A check is made on enabled and signalled snan exceptions,
-* and the destination is not overwritten if this condition exists.
-* This code is designed to make fmoveins of unsupported data types
-* faster.
-*
-wr_etemp:
- btst.b #snan_bit,FPSR_EXCEPT(a6) ;if snan is set, and
- beq.b fmoveinc ;enabled, force restore
- btst.b #snan_bit,FPCR_ENABLE(a6) ;and don't overwrite
- beq.b fmoveinc ;the dest
- move.l ETEMP_EX(a6),FPTEMP_EX(a6) ;set up fptemp sign for
-* ;snan handler
- tst.b ETEMP(a6) ;check for negative
- blt.b snan_neg
- rts
-snan_neg:
- or.l #neg_bit,USER_FPSR(a6) ;snan is negative; set N
- rts
-fmoveinc:
- clr.w NMNEXC(a6)
- bclr.b #E1,E_BYTE(a6)
- move.b STAG(a6),d0 ;check if stag is inf
- andi.b #$e0,d0
- cmpi.b #$40,d0
- bne.b fminc_cnan
- or.l #inf_mask,USER_FPSR(a6) ;if inf, nothing yet has set I
- tst.w LOCAL_EX(a0) ;check sign
- bge.b fminc_con
- or.l #neg_mask,USER_FPSR(a6)
- bra fminc_con
-fminc_cnan:
- cmpi.b #$60,d0 ;check if stag is NaN
- bne.b fminc_czero
- or.l #nan_mask,USER_FPSR(a6) ;if nan, nothing yet has set NaN
- move.l ETEMP_EX(a6),FPTEMP_EX(a6) ;set up fptemp sign for
-* ;snan handler
- tst.w LOCAL_EX(a0) ;check sign
- bge.b fminc_con
- or.l #neg_mask,USER_FPSR(a6)
- bra fminc_con
-fminc_czero:
- cmpi.b #$20,d0 ;check if zero
- bne.b fminc_con
- or.l #z_mask,USER_FPSR(a6) ;if zero, set Z
- tst.w LOCAL_EX(a0) ;check sign
- bge.b fminc_con
- or.l #neg_mask,USER_FPSR(a6)
-fminc_con:
- bfextu CMDREG1B(a6){6:3},d0 ;extract fp destination register
- cmpi.b #3,d0
- ble.b fp0123 ;check if dest is fp0-fp3
- move.l #7,d1
- sub.l d0,d1
- clr.l d0
- bset.l d1,d0
- fmovem.x ETEMP(a6),d0
- rts
-
-fp0123:
- tst.b d0
- beq.b fp0_dst
- cmpi.b #1,d0
- beq.b fp1_dst
- cmpi.b #2,d0
- beq.b fp2_dst
-fp3_dst:
- move.l ETEMP_EX(a6),USER_FP3(a6)
- move.l ETEMP_HI(a6),USER_FP3+4(a6)
- move.l ETEMP_LO(a6),USER_FP3+8(a6)
- rts
-fp2_dst:
- move.l ETEMP_EX(a6),USER_FP2(a6)
- move.l ETEMP_HI(a6),USER_FP2+4(a6)
- move.l ETEMP_LO(a6),USER_FP2+8(a6)
- rts
-fp1_dst:
- move.l ETEMP_EX(a6),USER_FP1(a6)
- move.l ETEMP_HI(a6),USER_FP1+4(a6)
- move.l ETEMP_LO(a6),USER_FP1+8(a6)
- rts
-fp0_dst:
- move.l ETEMP_EX(a6),USER_FP0(a6)
- move.l ETEMP_HI(a6),USER_FP0+4(a6)
- move.l ETEMP_LO(a6),USER_FP0+8(a6)
- rts
-
-opclass3:
- st.b CU_ONLY(a6)
- move.w CMDREG1B(a6),d0 ;check if packed moveout
- andi.w #$0c00,d0 ;isolate last 2 bits of size field
- cmpi.w #$0c00,d0 ;if size is 011 or 111, it is packed
- beq.w pack_out ;else it is norm or denorm
- bra.w mv_out
-
-
-*
-* MOVE OUT
-*
-
-mv_tbl:
- dc.l li
- dc.l sgp
- dc.l xp
- dc.l mvout_end ;should never be taken
- dc.l wi
- dc.l dp
- dc.l bi
- dc.l mvout_end ;should never be taken
-mv_out:
- bfextu CMDREG1B(a6){3:3},d1 ;put source specifier in d1
- lea.l mv_tbl,a0
- move.l (a0,d1*4),a0
- jmp (a0)
-
-*
-* This exit is for move-out to memory. The aunfl bit is
-* set if the result is inex and unfl is signalled.
-*
-mvout_end:
- btst.b #inex2_bit,FPSR_EXCEPT(a6)
- beq.b no_aufl
- btst.b #unfl_bit,FPSR_EXCEPT(a6)
- beq.b no_aufl
- bset.b #aunfl_bit,FPSR_AEXCEPT(a6)
-no_aufl:
- clr.w NMNEXC(a6)
- bclr.b #E1,E_BYTE(a6)
- fmove.l #0,FPSR ;clear any cc bits from res_func
-*
-* Return ETEMP to extended format from internal extended format so
-* that gen_except will have a correctly signed value for ovfl/unfl
-* handlers.
-*
- bfclr ETEMP_SGN(a6){0:8}
- beq.b mvout_con
- bset.b #sign_bit,ETEMP_EX(a6)
-mvout_con:
- rts
-*
-* This exit is for move-out to int register. The aunfl bit is
-* not set in any case for this move.
-*
-mvouti_end:
- clr.w NMNEXC(a6)
- bclr.b #E1,E_BYTE(a6)
- fmove.l #0,FPSR ;clear any cc bits from res_func
-*
-* Return ETEMP to extended format from internal extended format so
-* that gen_except will have a correctly signed value for ovfl/unfl
-* handlers.
-*
- bfclr ETEMP_SGN(a6){0:8}
- beq.b mvouti_con
- bset.b #sign_bit,ETEMP_EX(a6)
-mvouti_con:
- rts
-*
-* li is used to handle a long integer source specifier
-*
-
-li:
- moveq.l #4,d0 ;set byte count
-
- btst.b #7,STAG(a6) ;check for extended denorm
- bne.w int_dnrm ;if so, branch
-
- fmovem.x ETEMP(a6),fp0
- fcmp.d #:41dfffffffc00000,fp0
-* 41dfffffffc00000 in dbl prec = 401d0000fffffffe00000000 in ext prec
- fbge.w lo_plrg
- fcmp.d #:c1e0000000000000,fp0
-* c1e0000000000000 in dbl prec = c01e00008000000000000000 in ext prec
- fble.w lo_nlrg
-*
-* at this point, the answer is between the largest pos and neg values
-*
- move.l USER_FPCR(a6),d1 ;use user's rounding mode
- andi.l #$30,d1
- fmove.l d1,fpcr
- fmove.l fp0,L_SCR1(a6) ;let the 040 perform conversion
- fmove.l fpsr,d1
- or.l d1,USER_FPSR(a6) ;capture inex2/ainex if set
- bra.w int_wrt
-
-
-lo_plrg:
- move.l #$7fffffff,L_SCR1(a6) ;answer is largest positive int
- fbeq.w int_wrt ;exact answer
- fcmp.d #:41dfffffffe00000,fp0
-* 41dfffffffe00000 in dbl prec = 401d0000ffffffff00000000 in ext prec
- fbge.w int_operr ;set operr
- bra.w int_inx ;set inexact
-
-lo_nlrg:
- move.l #$80000000,L_SCR1(a6)
- fbeq.w int_wrt ;exact answer
- fcmp.d #:c1e0000000100000,fp0
-* c1e0000000100000 in dbl prec = c01e00008000000080000000 in ext prec
- fblt.w int_operr ;set operr
- bra.w int_inx ;set inexact
-
-*
-* wi is used to handle a word integer source specifier
-*
-
-wi:
- moveq.l #2,d0 ;set byte count
-
- btst.b #7,STAG(a6) ;check for extended denorm
- bne.w int_dnrm ;branch if so
-
- fmovem.x ETEMP(a6),fp0
- fcmp.s #:46fffe00,fp0
-* 46fffe00 in sgl prec = 400d0000fffe000000000000 in ext prec
- fbge.w wo_plrg
- fcmp.s #:c7000000,fp0
-* c7000000 in sgl prec = c00e00008000000000000000 in ext prec
- fble.w wo_nlrg
-
-*
-* at this point, the answer is between the largest pos and neg values
-*
- move.l USER_FPCR(a6),d1 ;use user's rounding mode
- andi.l #$30,d1
- fmove.l d1,fpcr
- fmove.w fp0,L_SCR1(a6) ;let the 040 perform conversion
- fmove.l fpsr,d1
- or.l d1,USER_FPSR(a6) ;capture inex2/ainex if set
- bra.w int_wrt
-
-wo_plrg:
- move.w #$7fff,L_SCR1(a6) ;answer is largest positive int
- fbeq.w int_wrt ;exact answer
- fcmp.s #:46ffff00,fp0
-* 46ffff00 in sgl prec = 400d0000ffff000000000000 in ext prec
- fbge.w int_operr ;set operr
- bra.w int_inx ;set inexact
-
-wo_nlrg:
- move.w #$8000,L_SCR1(a6)
- fbeq.w int_wrt ;exact answer
- fcmp.s #:c7000080,fp0
-* c7000080 in sgl prec = c00e00008000800000000000 in ext prec
- fblt.w int_operr ;set operr
- bra.w int_inx ;set inexact
-
-*
-* bi is used to handle a byte integer source specifier
-*
-
-bi:
- moveq.l #1,d0 ;set byte count
-
- btst.b #7,STAG(a6) ;check for extended denorm
- bne.w int_dnrm ;branch if so
-
- fmovem.x ETEMP(a6),fp0
- fcmp.s #:42fe0000,fp0
-* 42fe0000 in sgl prec = 40050000fe00000000000000 in ext prec
- fbge.w by_plrg
- fcmp.s #:c3000000,fp0
-* c3000000 in sgl prec = c00600008000000000000000 in ext prec
- fble.w by_nlrg
-
-*
-* at this point, the answer is between the largest pos and neg values
-*
- move.l USER_FPCR(a6),d1 ;use user's rounding mode
- andi.l #$30,d1
- fmove.l d1,fpcr
- fmove.b fp0,L_SCR1(a6) ;let the 040 perform conversion
- fmove.l fpsr,d1
- or.l d1,USER_FPSR(a6) ;capture inex2/ainex if set
- bra.w int_wrt
-
-by_plrg:
- move.b #$7f,L_SCR1(a6) ;answer is largest positive int
- fbeq.w int_wrt ;exact answer
- fcmp.s #:42ff0000,fp0
-* 42ff0000 in sgl prec = 40050000ff00000000000000 in ext prec
- fbge.w int_operr ;set operr
- bra.w int_inx ;set inexact
-
-by_nlrg:
- move.b #$80,L_SCR1(a6)
- fbeq.w int_wrt ;exact answer
- fcmp.s #:c3008000,fp0
-* c3008000 in sgl prec = c00600008080000000000000 in ext prec
- fblt.w int_operr ;set operr
- bra.w int_inx ;set inexact
-
-*
-* Common integer routines
-*
-* int_drnrm---account for possible nonzero result for round up with positive
-* operand and round down for negative answer. In the first case (result = 1)
-* byte-width (store in d0) of result must be honored. In the second case,
-* -1 in L_SCR1(a6) will cover all contingencies (FMOVE.B/W/L out).
-
-int_dnrm:
- clr.l L_SCR1(a6) ; initialize result to 0
- bfextu FPCR_MODE(a6){2:2},d1 ; d1 is the rounding mode
- cmp.b #2,d1
- bmi.b int_inx ; if RN or RZ, done
- bne.b int_rp ; if RP, continue below
- tst.w ETEMP(a6) ; RM: store -1 in L_SCR1 if src is negative
- bpl.b int_inx ; otherwise result is 0
- move.l #-1,L_SCR1(a6)
- bra.b int_inx
-int_rp:
- tst.w ETEMP(a6) ; RP: store +1 of proper width in L_SCR1 if
-* ; source is greater than 0
- bmi.b int_inx ; otherwise, result is 0
- lea L_SCR1(a6),a1 ; a1 is address of L_SCR1
- adda.l d0,a1 ; offset by destination width -1
- suba.l #1,a1
- bset.b #0,(a1) ; set low bit at a1 address
-int_inx:
- ori.l #inx2a_mask,USER_FPSR(a6)
- bra.b int_wrt
-int_operr:
- fmovem.x fp0,FPTEMP(a6) ;FPTEMP must contain the extended
-* ;precision source that needs to be
-* ;converted to integer this is required
-* ;if the operr exception is enabled.
-* ;set operr/aiop (no inex2 on int ovfl)
-
- ori.l #opaop_mask,USER_FPSR(a6)
-* ;fall through to perform int_wrt
-int_wrt:
- move.l EXC_EA(a6),a1 ;load destination address
- tst.l a1 ;check to see if it is a dest register
- beq.b wrt_dn ;write data register
- lea L_SCR1(a6),a0 ;point to supervisor source address
- bsr.l mem_write
- bra.w mvouti_end
-
-wrt_dn:
- move.l d0,-(sp) ;d0 currently contains the size to write
- bsr.l get_fline ;get_fline returns Dn in d0
- andi.w #$7,d0 ;isolate register
- move.l (sp)+,d1 ;get size
- cmpi.l #4,d1 ;most frequent case
- beq.b sz_long
- cmpi.l #2,d1
- bne.b sz_con
- or.l #8,d0 ;add 'word' size to register#
- bra.b sz_con
-sz_long:
- or.l #$10,d0 ;add 'long' size to register#
-sz_con:
- move.l d0,d1 ;reg_dest expects size:reg in d1
- bsr.l reg_dest ;load proper data register
- bra.w mvouti_end
-xp:
- lea ETEMP(a6),a0
- bclr.b #sign_bit,LOCAL_EX(a0)
- sne LOCAL_SGN(a0)
- btst.b #7,STAG(a6) ;check for extended denorm
- bne.w xdnrm
- clr.l d0
- bra.b do_fp ;do normal case
-sgp:
- lea ETEMP(a6),a0
- bclr.b #sign_bit,LOCAL_EX(a0)
- sne LOCAL_SGN(a0)
- btst.b #7,STAG(a6) ;check for extended denorm
- bne.w sp_catas ;branch if so
- move.w LOCAL_EX(a0),d0
- lea sp_bnds,a1
- cmp.w (a1),d0
- blt.w sp_under
- cmp.w 2(a1),d0
- bgt.w sp_over
- move.l #1,d0 ;set destination format to single
- bra.b do_fp ;do normal case
-dp:
- lea ETEMP(a6),a0
- bclr.b #sign_bit,LOCAL_EX(a0)
- sne LOCAL_SGN(a0)
-
- btst.b #7,STAG(a6) ;check for extended denorm
- bne.w dp_catas ;branch if so
-
- move.w LOCAL_EX(a0),d0
- lea dp_bnds,a1
-
- cmp.w (a1),d0
- blt.w dp_under
- cmp.w 2(a1),d0
- bgt.w dp_over
-
- move.l #2,d0 ;set destination format to double
-* ;fall through to do_fp
-*
-do_fp:
- bfextu FPCR_MODE(a6){2:2},d1 ;rnd mode in d1
- swap d0 ;rnd prec in upper word
- add.l d0,d1 ;d1 has PREC/MODE info
-
- clr.l d0 ;clear g,r,s
-
- bsr.l round ;round
-
- move.l a0,a1
- move.l EXC_EA(a6),a0
-
- bfextu CMDREG1B(a6){3:3},d1 ;extract destination format
-* ;at this point only the dest
-* ;formats sgl, dbl, ext are
-* ;possible
- cmp.b #2,d1
- bgt.b ddbl ;double=5, extended=2, single=1
- bne.b dsgl
-* ;fall through to dext
-dext:
- bsr.l dest_ext
- bra.w mvout_end
-dsgl:
- bsr.l dest_sgl
- bra.w mvout_end
-ddbl:
- bsr.l dest_dbl
- bra.w mvout_end
-
-*
-* Handle possible denorm or catastrophic underflow cases here
-*
-xdnrm:
- bsr.w set_xop ;initialize WBTEMP
- bset.b #wbtemp15_bit,WB_BYTE(a6) ;set wbtemp15
-
- move.l a0,a1
- move.l EXC_EA(a6),a0 ;a0 has the destination pointer
- bsr.l dest_ext ;store to memory
- bset.b #unfl_bit,FPSR_EXCEPT(a6)
- bra.w mvout_end
-
-sp_under:
- bset.b #etemp15_bit,STAG(a6)
-
- cmp.w 4(a1),d0
- blt.b sp_catas ;catastrophic underflow case
-
- move.l #1,d0 ;load in round precision
- move.l #sgl_thresh,d1 ;load in single denorm threshold
- bsr.l dpspdnrm ;expects d1 to have the proper
-* ;denorm threshold
- bsr.l dest_sgl ;stores value to destination
- bset.b #unfl_bit,FPSR_EXCEPT(a6)
- bra.w mvout_end ;exit
-
-dp_under:
- bset.b #etemp15_bit,STAG(a6)
-
- cmp.w 4(a1),d0
- blt.b dp_catas ;catastrophic underflow case
-
- move.l #dbl_thresh,d1 ;load in double precision threshold
- move.l #2,d0
- bsr.l dpspdnrm ;expects d1 to have proper
-* ;denorm threshold
-* ;expects d0 to have round precision
- bsr.l dest_dbl ;store value to destination
- bset.b #unfl_bit,FPSR_EXCEPT(a6)
- bra.w mvout_end ;exit
-
-*
-* Handle catastrophic underflow cases here
-*
-sp_catas:
-* Temp fix for z bit set in unf_sub
- move.l USER_FPSR(a6),-(a7)
-
- move.l #1,d0 ;set round precision to sgl
-
- bsr.l unf_sub ;a0 points to result
-
- move.l (a7)+,USER_FPSR(a6)
-
- move.l #1,d0
- sub.w d0,LOCAL_EX(a0) ;account for difference between
-* ;denorm/norm bias
-
- move.l a0,a1 ;a1 has the operand input
- move.l EXC_EA(a6),a0 ;a0 has the destination pointer
-
- bsr.l dest_sgl ;store the result
- ori.l #unfinx_mask,USER_FPSR(a6)
- bra.w mvout_end
-
-dp_catas:
-* Temp fix for z bit set in unf_sub
- move.l USER_FPSR(a6),-(a7)
-
- move.l #2,d0 ;set round precision to dbl
- bsr.l unf_sub ;a0 points to result
-
- move.l (a7)+,USER_FPSR(a6)
-
- move.l #1,d0
- sub.w d0,LOCAL_EX(a0) ;account for difference between
-* ;denorm/norm bias
-
- move.l a0,a1 ;a1 has the operand input
- move.l EXC_EA(a6),a0 ;a0 has the destination pointer
-
- bsr.l dest_dbl ;store the result
- ori.l #unfinx_mask,USER_FPSR(a6)
- bra.w mvout_end
-
-*
-* Handle catastrophic overflow cases here
-*
-sp_over:
-* Temp fix for z bit set in unf_sub
- move.l USER_FPSR(a6),-(a7)
-
- move.l #1,d0
- lea.l FP_SCR1(a6),a0 ;use FP_SCR1 for creating result
- move.l ETEMP_EX(a6),(a0)
- move.l ETEMP_HI(a6),4(a0)
- move.l ETEMP_LO(a6),8(a0)
- bsr.l ovf_res
-
- move.l (a7)+,USER_FPSR(a6)
-
- move.l a0,a1
- move.l EXC_EA(a6),a0
- bsr.l dest_sgl
- or.l #ovfinx_mask,USER_FPSR(a6)
- bra.w mvout_end
-
-dp_over:
-* Temp fix for z bit set in ovf_res
- move.l USER_FPSR(a6),-(a7)
-
- move.l #2,d0
- lea.l FP_SCR1(a6),a0 ;use FP_SCR1 for creating result
- move.l ETEMP_EX(a6),(a0)
- move.l ETEMP_HI(a6),4(a0)
- move.l ETEMP_LO(a6),8(a0)
- bsr.l ovf_res
-
- move.l (a7)+,USER_FPSR(a6)
-
- move.l a0,a1
- move.l EXC_EA(a6),a0
- bsr.l dest_dbl
- or.l #ovfinx_mask,USER_FPSR(a6)
- bra.w mvout_end
-
-*
-* DPSPDNRM
-*
-* This subroutine takes an extended normalized number and denormalizes
-* it to the given round precision. This subroutine also decrements
-* the input operand's exponent by 1 to account for the fact that
-* dest_sgl or dest_dbl expects a normalized number's bias.
-*
-* Input: a0 points to a normalized number in internal extended format
-* d0 is the round precision (=1 for sgl; =2 for dbl)
-* d1 is the single precision or double precision
-* denorm threshold
-*
-* Output: (In the format for dest_sgl or dest_dbl)
-* a0 points to the destination
-* a1 points to the operand
-*
-* Exceptions: Reports inexact 2 exception by setting USER_FPSR bits
-*
-dpspdnrm:
- move.l d0,-(a7) ;save round precision
- clr.l d0 ;clear initial g,r,s
- bsr.l dnrm_lp ;careful with d0, it's needed by round
-
- bfextu FPCR_MODE(a6){2:2},d1 ;get rounding mode
- swap d1
- move.w 2(a7),d1 ;set rounding precision
- swap d1 ;at this point d1 has PREC/MODE info
- bsr.l round ;round result, sets the inex bit in
-* ;USER_FPSR if needed
-
- move.w #1,d0
- sub.w d0,LOCAL_EX(a0) ;account for difference in denorm
-* ;vs norm bias
-
- move.l a0,a1 ;a1 has the operand input
- move.l EXC_EA(a6),a0 ;a0 has the destination pointer
- addq.l #4,a7 ;pop stack
- rts
-*
-* SET_XOP initialized WBTEMP with the value pointed to by a0
-* input: a0 points to input operand in the internal extended format
-*
-set_xop:
- move.l LOCAL_EX(a0),WBTEMP_EX(a6)
- move.l LOCAL_HI(a0),WBTEMP_HI(a6)
- move.l LOCAL_LO(a0),WBTEMP_LO(a6)
- bfclr WBTEMP_SGN(a6){0:8}
- beq.b sxop
- bset.b #sign_bit,WBTEMP_EX(a6)
-sxop:
- bfclr STAG(a6){5:4} ;clear wbtm66,wbtm1,wbtm0,sbit
- rts
-*
-* P_MOVE
-*
-p_movet:
- dc.l p_move
- dc.l p_movez
- dc.l p_movei
- dc.l p_moven
- dc.l p_move
-p_regd:
- dc.l p_dyd0
- dc.l p_dyd1
- dc.l p_dyd2
- dc.l p_dyd3
- dc.l p_dyd4
- dc.l p_dyd5
- dc.l p_dyd6
- dc.l p_dyd7
-
-pack_out:
- lea.l p_movet,a0 ;load jmp table address
- move.w STAG(a6),d0 ;get source tag
- bfextu d0{16:3},d0 ;isolate source bits
- move.l (a0,d0.w*4),a0 ;load a0 with routine label for tag
- jmp (a0) ;go to the routine
-
-p_write:
- move.l #$0c,d0 ;get byte count
- move.l EXC_EA(a6),a1 ;get the destination address
- bsr mem_write ;write the user's destination
- clr.b CU_SAVEPC(a6) ;set the cu save pc to all 0's
-
-*
-* Also note that the dtag must be set to norm here - this is because
-* the 040 uses the dtag to execute the correct microcode.
-*
- bfclr DTAG(a6){0:3} ;set dtag to norm
-
- rts
-
-* Notes on handling of special case (zero, inf, and nan) inputs:
-* 1. Operr is not signalled if the k-factor is greater than 18.
-* 2. Per the manual, status bits are not set.
-*
-
-p_move:
- move.w CMDREG1B(a6),d0
- btst.l #kfact_bit,d0 ;test for dynamic k-factor
- beq.b statick ;if clear, k-factor is static
-dynamick:
- bfextu d0{25:3},d0 ;isolate register for dynamic k-factor
- lea p_regd,a0
- move.l (a0,d0*4),a0
- jmp (a0)
-statick:
- andi.w #$007f,d0 ;get k-factor
- bfexts d0{25:7},d0 ;sign extend d0 for bindec
- lea.l ETEMP(a6),a0 ;a0 will point to the packed decimal
- bsr.l bindec ;perform the convert; data at a6
- lea.l FP_SCR1(a6),a0 ;load a0 with result address
- bra.l p_write
-p_movez:
- lea.l ETEMP(a6),a0 ;a0 will point to the packed decimal
- clr.w 2(a0) ;clear lower word of exp
- clr.l 4(a0) ;load second lword of ZERO
- clr.l 8(a0) ;load third lword of ZERO
- bra.w p_write ;go write results
-p_movei:
- fmove.l #0,FPSR ;clear aiop
- lea.l ETEMP(a6),a0 ;a0 will point to the packed decimal
- clr.w 2(a0) ;clear lower word of exp
- bra.w p_write ;go write the result
-p_moven:
- lea.l ETEMP(a6),a0 ;a0 will point to the packed decimal
- clr.w 2(a0) ;clear lower word of exp
- bra.w p_write ;go write the result
-
-*
-* Routines to read the dynamic k-factor from Dn.
-*
-p_dyd0:
- move.l USER_D0(a6),d0
- bra.b statick
-p_dyd1:
- move.l USER_D1(a6),d0
- bra.b statick
-p_dyd2:
- move.l d2,d0
- bra.b statick
-p_dyd3:
- move.l d3,d0
- bra.b statick
-p_dyd4:
- move.l d4,d0
- bra.b statick
-p_dyd5:
- move.l d5,d0
- bra.b statick
-p_dyd6:
- move.l d6,d0
- bra.w statick
-p_dyd7:
- move.l d7,d0
- bra.w statick
-
- end
diff --git a/sys/arch/m68k/fpsp/round.sa b/sys/arch/m68k/fpsp/round.sa
deleted file mode 100644
index a09325b1025..00000000000
--- a/sys/arch/m68k/fpsp/round.sa
+++ /dev/null
@@ -1,674 +0,0 @@
-* $OpenBSD: round.sa,v 1.4 2007/11/26 09:28:33 martynas Exp $
-* $NetBSD: round.sa,v 1.3 1994/10/26 07:49:24 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* round.sa 3.4 7/29/91
-*
-* handle rounding and normalization tasks
-*
-
-ROUND IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
-*
-* round --- round result according to precision/mode
-*
-* a0 points to the input operand in the internal extended format
-* d1(high word) contains rounding precision:
-* ext = $0000xxxx
-* sgl = $0001xxxx
-* dbl = $0002xxxx
-* d1(low word) contains rounding mode:
-* RN = $xxxx0000
-* RZ = $xxxx0001
-* RM = $xxxx0010
-* RP = $xxxx0011
-* d0{31:29} contains the g,r,s bits (extended)
-*
-* On return the value pointed to by a0 is correctly rounded,
-* a0 is preserved and the g-r-s bits in d0 are cleared.
-* The result is not typed - the tag field is invalid. The
-* result is still in the internal extended format.
-*
-* The INEX bit of USER_FPSR will be set if the rounded result was
-* inexact (i.e. if any of the g-r-s bits were set).
-*
-
- xdef round
-round:
-* If g=r=s=0 then result is exact and round is done, else set
-* the inex flag in status reg and continue.
-*
- bsr.b ext_grs ;this subroutine looks at the
-* :rounding precision and sets
-* ;the appropriate g-r-s bits.
- tst.l d0 ;if grs are zero, go force
- bne.w rnd_cont ;lower bits to zero for size
-
- swap d1 ;set up d1.w for round prec.
- bra.w truncate
-
-rnd_cont:
-*
-* Use rounding mode as an index into a jump table for these modes.
-*
- or.l #inx2a_mask,USER_FPSR(a6) ;set inex2/ainex
- lea mode_tab,a1
- move.l (a1,d1.w*4),a1
- jmp (a1)
-*
-* Jump table indexed by rounding mode in d1.w. All following assumes
-* grs != 0.
-*
-mode_tab:
- dc.l rnd_near
- dc.l rnd_zero
- dc.l rnd_mnus
- dc.l rnd_plus
-*
-* ROUND PLUS INFINITY
-*
-* If sign of fp number = 0 (positive), then add 1 to l.
-*
-rnd_plus:
- swap d1 ;set up d1 for round prec.
- tst.b LOCAL_SGN(a0) ;check for sign
- bmi.w truncate ;if positive then truncate
- move.l #$ffffffff,d0 ;force g,r,s to be all f's
- lea add_to_l,a1
- move.l (a1,d1.w*4),a1
- jmp (a1)
-*
-* ROUND MINUS INFINITY
-*
-* If sign of fp number = 1 (negative), then add 1 to l.
-*
-rnd_mnus:
- swap d1 ;set up d1 for round prec.
- tst.b LOCAL_SGN(a0) ;check for sign
- bpl.w truncate ;if negative then truncate
- move.l #$ffffffff,d0 ;force g,r,s to be all f's
- lea add_to_l,a1
- move.l (a1,d1.w*4),a1
- jmp (a1)
-*
-* ROUND ZERO
-*
-* Always truncate.
-rnd_zero:
- swap d1 ;set up d1 for round prec.
- bra.w truncate
-*
-*
-* ROUND NEAREST
-*
-* If (g=1), then add 1 to l and if (r=s=0), then clear l
-* Note that this will round to even in case of a tie.
-*
-rnd_near:
- swap d1 ;set up d1 for round prec.
- add.l d0,d0 ;shift g-bit to c-bit
- bcc.w truncate ;if (g=1) then
- lea add_to_l,a1
- move.l (a1,d1.w*4),a1
- jmp (a1)
-
-*
-* ext_grs --- extract guard, round and sticky bits
-*
-* Input: d1 = PREC:ROUND
-* Output: d0{31:29}= guard, round, sticky
-*
-* The ext_grs extract the guard/round/sticky bits according to the
-* selected rounding precision. It is called by the round subroutine
-* only. All registers except d0 are kept intact. d0 becomes an
-* updated guard,round,sticky in d0{31:29}
-*
-* Notes: the ext_grs uses the round PREC, and therefore has to swap d1
-* prior to usage, and needs to restore d1 to original.
-*
-ext_grs:
- swap d1 ;have d1.w point to round precision
- tst.w d1
- bne.b sgl_or_dbl
- bra.b end_ext_grs
-
-sgl_or_dbl:
- movem.l d2/d3,-(a7) ;make some temp registers
- cmpi.w #1,d1
- bne.b grs_dbl
-grs_sgl:
- bfextu LOCAL_HI(a0){24:2},d3 ;sgl prec. g-r are 2 bits right
- move.l #30,d2 ;of the sgl prec. limits
- lsl.l d2,d3 ;shift g-r bits to MSB of d3
- move.l LOCAL_HI(a0),d2 ;get word 2 for s-bit test
- andi.l #$0000003f,d2 ;s bit is the or of all other
- bne.b st_stky ;bits to the right of g-r
- tst.l LOCAL_LO(a0) ;test lower mantissa
- bne.b st_stky ;if any are set, set sticky
- tst.l d0 ;test original g,r,s
- bne.b st_stky ;if any are set, set sticky
- bra.b end_sd ;if words 3 and 4 are clr, exit
-grs_dbl:
- bfextu LOCAL_LO(a0){21:2},d3 ;dbl-prec. g-r are 2 bits right
- move.l #30,d2 ;of the dbl prec. limits
- lsl.l d2,d3 ;shift g-r bits to the MSB of d3
- move.l LOCAL_LO(a0),d2 ;get lower mantissa for s-bit test
- andi.l #$000001ff,d2 ;s bit is the or-ing of all
- bne.b st_stky ;other bits to the right of g-r
- tst.l d0 ;test word original g,r,s
- bne.b st_stky ;if any are set, set sticky
- bra.b end_sd ;if clear, exit
-st_stky:
- bset #rnd_stky_bit,d3
-end_sd:
- move.l d3,d0 ;return grs to d0
- movem.l (a7)+,d2/d3 ;restore scratch registers
-end_ext_grs:
- swap d1 ;restore d1 to original
- rts
-
-******************** Local Equates
-ad_1_sgl equ $00000100 constant to add 1 to l-bit in sgl prec
-ad_1_dbl equ $00000800 constant to add 1 to l-bit in dbl prec
-
-
-*Jump table for adding 1 to the l-bit indexed by rnd prec
-
-add_to_l:
- dc.l add_ext
- dc.l add_sgl
- dc.l add_dbl
- dc.l add_dbl
-*
-* ADD SINGLE
-*
-add_sgl:
- add.l #ad_1_sgl,LOCAL_HI(a0)
- bcc.b scc_clr ;no mantissa overflow
- roxr.w LOCAL_HI(a0) ;shift v-bit back in
- roxr.w LOCAL_HI+2(a0) ;shift v-bit back in
- add.w #$1,LOCAL_EX(a0) ;and incr exponent
-scc_clr:
- tst.l d0 ;test for rs = 0
- bne.b sgl_done
- andi.w #$fe00,LOCAL_HI+2(a0) ;clear the l-bit
-sgl_done:
- andi.l #$ffffff00,LOCAL_HI(a0) ;truncate bits beyond sgl limit
- clr.l LOCAL_LO(a0) ;clear d2
- rts
-
-*
-* ADD EXTENDED
-*
-add_ext:
- addq.l #1,LOCAL_LO(a0) ;add 1 to l-bit
- bcc.b xcc_clr ;test for carry out
- addq.l #1,LOCAL_HI(a0) ;propagate carry
- bcc.b xcc_clr
- roxr.w LOCAL_HI(a0) ;mant is 0 so restore v-bit
- roxr.w LOCAL_HI+2(a0) ;mant is 0 so restore v-bit
- roxr.w LOCAL_LO(a0)
- roxr.w LOCAL_LO+2(a0)
- add.w #$1,LOCAL_EX(a0) ;and inc exp
-xcc_clr:
- tst.l d0 ;test rs = 0
- bne.b add_ext_done
- andi.b #$fe,LOCAL_LO+3(a0) ;clear the l bit
-add_ext_done:
- rts
-*
-* ADD DOUBLE
-*
-add_dbl:
- add.l #ad_1_dbl,LOCAL_LO(a0)
- bcc.b dcc_clr
- addq.l #1,LOCAL_HI(a0) ;propagate carry
- bcc.b dcc_clr
- roxr.w LOCAL_HI(a0) ;mant is 0 so restore v-bit
- roxr.w LOCAL_HI+2(a0) ;mant is 0 so restore v-bit
- roxr.w LOCAL_LO(a0)
- roxr.w LOCAL_LO+2(a0)
- add.w #$1,LOCAL_EX(a0) ;incr exponent
-dcc_clr:
- tst.l d0 ;test for rs = 0
- bne.b dbl_done
- andi.w #$f000,LOCAL_LO+2(a0) ;clear the l-bit
-
-dbl_done:
- andi.l #$fffff800,LOCAL_LO(a0) ;truncate bits beyond dbl limit
- rts
-
-error:
- rts
-*
-* Truncate all other bits
-*
-trunct:
- dc.l end_rnd
- dc.l sgl_done
- dc.l dbl_done
- dc.l dbl_done
-
-truncate:
- lea trunct,a1
- move.l (a1,d1.w*4),a1
- jmp (a1)
-
-end_rnd:
- rts
-
-*
-* NORMALIZE
-*
-* These routines (nrm_zero & nrm_set) normalize the unnorm. This
-* is done by shifting the mantissa left while decrementing the
-* exponent.
-*
-* NRM_SET shifts and decrements until there is a 1 set in the integer
-* bit of the mantissa (msb in d1).
-*
-* NRM_ZERO shifts and decrements until there is a 1 set in the integer
-* bit of the mantissa (msb in d1) unless this would mean the exponent
-* would go less than 0. In that case the number becomes a denorm - the
-* exponent (d0) is set to 0 and the mantissa (d1 & d2) is not
-* normalized.
-*
-* Note that both routines have been optimized (for the worst case) and
-* therefore do not have the easy to follow decrement/shift loop.
-*
-* NRM_ZERO
-*
-* Distance to first 1 bit in mantissa = X
-* Distance to 0 from exponent = Y
-* If X < Y
-* Then
-* nrm_set
-* Else
-* shift mantissa by Y
-* set exponent = 0
-*
-*input:
-* FP_SCR1 = exponent, ms mantissa part, ls mantissa part
-*output:
-* L_SCR1{4} = fpte15 or ete15 bit
-*
- xdef nrm_zero
-nrm_zero:
- move.w LOCAL_EX(a0),d0
- cmp.w #64,d0 ;see if exp > 64
- bmi.b d0_less
- bsr nrm_set ;exp > 64 so exp won't exceed 0
- rts
-d0_less:
- movem.l d2/d3/d5/d6,-(a7)
- move.l LOCAL_HI(a0),d1
- move.l LOCAL_LO(a0),d2
-
- bfffo d1{0:32},d3 ;get the distance to the first 1
-* ;in ms mant
- beq.b ms_clr ;branch if no bits were set
- cmp.w d3,d0 ;of X>Y
- bmi.b greater ;then exp will go past 0 (neg) if
-* ;it is just shifted
- bsr nrm_set ;else exp won't go past 0
- movem.l (a7)+,d2/d3/d5/d6
- rts
-greater:
- move.l d2,d6 ;save ls mant in d6
- lsl.l d0,d2 ;shift ls mant by count
- lsl.l d0,d1 ;shift ms mant by count
- move.l #32,d5
- sub.l d0,d5 ;make op a denorm by shifting bits
- lsr.l d5,d6 ;by the number in the exp, then
-* ;set exp = 0.
- or.l d6,d1 ;shift the ls mant bits into the ms mant
- clr.l d0 ;same as if decremented exp to 0
-* ;while shifting
- move.w d0,LOCAL_EX(a0)
- move.l d1,LOCAL_HI(a0)
- move.l d2,LOCAL_LO(a0)
- movem.l (a7)+,d2/d3/d5/d6
- rts
-ms_clr:
- bfffo d2{0:32},d3 ;check if any bits set in ls mant
- beq.b all_clr ;branch if none set
- add.w #32,d3
- cmp.w d3,d0 ;if X>Y
- bmi.b greater ;then branch
- bsr nrm_set ;else exp won't go past 0
- movem.l (a7)+,d2/d3/d5/d6
- rts
-all_clr:
- clr.w LOCAL_EX(a0) ;no mantissa bits set. Set exp = 0.
- movem.l (a7)+,d2/d3/d5/d6
- rts
-*
-* NRM_SET
-*
- xdef nrm_set
-nrm_set:
- move.l d7,-(a7)
- bfffo LOCAL_HI(a0){0:32},d7 ;find first 1 in ms mant to d7)
- beq.b lower ;branch if ms mant is all 0's
-
- move.l d6,-(a7)
-
- sub.w d7,LOCAL_EX(a0) ;sub exponent by count
- move.l LOCAL_HI(a0),d0 ;d0 has ms mant
- move.l LOCAL_LO(a0),d1 ;d1 has ls mant
-
- lsl.l d7,d0 ;shift first 1 to j bit position
- move.l d1,d6 ;copy ls mant into d6
- lsl.l d7,d6 ;shift ls mant by count
- move.l d6,LOCAL_LO(a0) ;store ls mant into memory
- moveq.l #32,d6
- sub.l d7,d6 ;continue shift
- lsr.l d6,d1 ;shift off all bits but those that will
-* ;be shifted into ms mant
- or.l d1,d0 ;shift the ls mant bits into the ms mant
- move.l d0,LOCAL_HI(a0) ;store ms mant into memory
- movem.l (a7)+,d7/d6 ;restore registers
- rts
-
-*
-* We get here if ms mant was = 0, and we assume ls mant has bits
-* set (otherwise this would have been tagged a zero not a denorm).
-*
-lower:
- move.w LOCAL_EX(a0),d0 ;d0 has exponent
- move.l LOCAL_LO(a0),d1 ;d1 has ls mant
- sub.w #32,d0 ;account for ms mant being all zeros
- bfffo d1{0:32},d7 ;find first 1 in ls mant to d7)
- sub.w d7,d0 ;subtract shift count from exp
- lsl.l d7,d1 ;shift first 1 to integer bit in ms mant
- move.w d0,LOCAL_EX(a0) ;store ms mant
- move.l d1,LOCAL_HI(a0) ;store exp
- clr.l LOCAL_LO(a0) ;clear ls mant
- move.l (a7)+,d7
- rts
-*
-* denorm --- denormalize an intermediate result
-*
-* Used by underflow.
-*
-* Input:
-* a0 points to the operand to be denormalized
-* (in the internal extended format)
-*
-* d0: rounding precision
-* Output:
-* a0 points to the denormalized result
-* (in the internal extended format)
-*
-* d0 is guard,round,sticky
-*
-* d0 comes into this routine with the rounding precision. It
-* is then loaded with the denormalized exponent threshold for the
-* rounding precision.
-*
-
- xdef denorm
-denorm:
- btst.b #6,LOCAL_EX(a0) ;check for exponents between $7fff-$4000
- beq.b no_sgn_ext
- bset.b #7,LOCAL_EX(a0) ;sign extend if it is so
-no_sgn_ext:
-
- tst.b d0 ;if 0 then extended precision
- bne.b not_ext ;else branch
-
- clr.l d1 ;load d1 with ext threshold
- clr.l d0 ;clear the sticky flag
- bsr dnrm_lp ;denormalize the number
- tst.b d1 ;check for inex
- beq.w no_inex ;if clr, no inex
- bra.b dnrm_inex ;if set, set inex
-
-not_ext:
- cmpi.l #1,d0 ;if 1 then single precision
- beq.b load_sgl ;else must be 2, double prec
-
-load_dbl:
- move.w #dbl_thresh,d1 ;put copy of threshold in d1
- move.l d1,d0 ;copy d1 into d0
- sub.w LOCAL_EX(a0),d0 ;diff = threshold - exp
- cmp.w #67,d0 ;if diff > 67 (mant + grs bits)
- bpl.b chk_stky ;then branch (all bits would be
-* ; shifted off in denorm routine)
- clr.l d0 ;else clear the sticky flag
- bsr dnrm_lp ;denormalize the number
- tst.b d1 ;check flag
- beq.b no_inex ;if clr, no inex
- bra.b dnrm_inex ;if set, set inex
-
-load_sgl:
- move.w #sgl_thresh,d1 ;put copy of threshold in d1
- move.l d1,d0 ;copy d1 into d0
- sub.w LOCAL_EX(a0),d0 ;diff = threshold - exp
- cmp.w #67,d0 ;if diff > 67 (mant + grs bits)
- bpl.b chk_stky ;then branch (all bits would be
-* ; shifted off in denorm routine)
- clr.l d0 ;else clear the sticky flag
- bsr dnrm_lp ;denormalize the number
- tst.b d1 ;check flag
- beq.b no_inex ;if clr, no inex
- bra.b dnrm_inex ;if set, set inex
-
-chk_stky:
- tst.l LOCAL_HI(a0) ;check for any bits set
- bne.b set_stky
- tst.l LOCAL_LO(a0) ;check for any bits set
- bne.b set_stky
- bra.b clr_mant
-set_stky:
- or.l #inx2a_mask,USER_FPSR(a6) ;set inex2/ainex
- move.l #$20000000,d0 ;set sticky bit in return value
-clr_mant:
- move.w d1,LOCAL_EX(a0) ;load exp with threshold
- clr.l LOCAL_HI(a0) ;set d1 = 0 (ms mantissa)
- clr.l LOCAL_LO(a0) ;set d2 = 0 (ms mantissa)
- rts
-dnrm_inex:
- or.l #inx2a_mask,USER_FPSR(a6) ;set inex2/ainex
-no_inex:
- rts
-
-*
-* dnrm_lp --- normalize exponent/mantissa to specified threshold
-*
-* Input:
-* a0 points to the operand to be denormalized
-* d0{31:29} initial guard,round,sticky
-* d1{15:0} denormalization threshold
-* Output:
-* a0 points to the denormalized operand
-* d0{31:29} final guard,round,sticky
-* d1.b inexact flag: all ones means inexact result
-*
-* The LOCAL_LO and LOCAL_GRS parts of the value are copied to FP_SCR2
-* so that bfext can be used to extract the new low part of the mantissa.
-* Dnrm_lp can be called with a0 pointing to ETEMP or WBTEMP and there
-* is no LOCAL_GRS scratch word following it on the fsave frame.
-*
- xdef dnrm_lp
-dnrm_lp:
- move.l d2,-(sp) ;save d2 for temp use
- btst.b #E3,E_BYTE(a6) ;test for type E3 exception
- beq.b not_E3 ;not type E3 exception
- bfextu WBTEMP_GRS(a6){6:3},d2 ;extract guard,round, sticky bit
- move.l #29,d0
- lsl.l d0,d2 ;shift g,r,s to their postions
- move.l d2,d0
-not_E3:
- move.l (sp)+,d2 ;restore d2
- move.l LOCAL_LO(a0),FP_SCR2+LOCAL_LO(a6)
- move.l d0,FP_SCR2+LOCAL_GRS(a6)
- move.l d1,d0 ;copy the denorm threshold
- sub.w LOCAL_EX(a0),d1 ;d1 = threshold - uns exponent
- ble.b no_lp ;d1 <= 0
- cmp.w #32,d1
- blt.b case_1 ;0 = d1 < 32
- cmp.w #64,d1
- blt.b case_2 ;32 <= d1 < 64
- bra.w case_3 ;d1 >= 64
-*
-* No normalization necessary
-*
-no_lp:
- clr.b d1 ;set no inex2 reported
- move.l FP_SCR2+LOCAL_GRS(a6),d0 ;restore original g,r,s
- rts
-*
-* case (0<d1<32)
-*
-case_1:
- move.l d2,-(sp)
- move.w d0,LOCAL_EX(a0) ;exponent = denorm threshold
- move.l #32,d0
- sub.w d1,d0 ;d0 = 32 - d1
- bfextu LOCAL_EX(a0){d0:32},d2
- bfextu d2{d1:d0},d2 ;d2 = new LOCAL_HI
- bfextu LOCAL_HI(a0){d0:32},d1 ;d1 = new LOCAL_LO
- bfextu FP_SCR2+LOCAL_LO(a6){d0:32},d0 ;d0 = new G,R,S
- move.l d2,LOCAL_HI(a0) ;store new LOCAL_HI
- move.l d1,LOCAL_LO(a0) ;store new LOCAL_LO
- clr.b d1
- bftst d0{2:30}
- beq.b c1nstky
- bset.l #rnd_stky_bit,d0
- st.b d1
-c1nstky:
- move.l FP_SCR2+LOCAL_GRS(a6),d2 ;restore original g,r,s
- andi.l #$e0000000,d2 ;clear all but G,R,S
- tst.l d2 ;test if original G,R,S are clear
- beq.b grs_clear
- or.l #$20000000,d0 ;set sticky bit in d0
-grs_clear:
- andi.l #$e0000000,d0 ;clear all but G,R,S
- move.l (sp)+,d2
- rts
-*
-* case (32<=d1<64)
-*
-case_2:
- move.l d2,-(sp)
- move.w d0,LOCAL_EX(a0) ;unsigned exponent = threshold
- sub.w #32,d1 ;d1 now between 0 and 32
- move.l #32,d0
- sub.w d1,d0 ;d0 = 32 - d1
- bfextu LOCAL_EX(a0){d0:32},d2
- bfextu d2{d1:d0},d2 ;d2 = new LOCAL_LO
- bfextu LOCAL_HI(a0){d0:32},d1 ;d1 = new G,R,S
- bftst d1{2:30}
- bne.b c2_sstky ;bra if sticky bit to be set
- bftst FP_SCR2+LOCAL_LO(a6){d0:32}
- bne.b c2_sstky ;bra if sticky bit to be set
- move.l d1,d0
- clr.b d1
- bra.b end_c2
-c2_sstky:
- move.l d1,d0
- bset.l #rnd_stky_bit,d0
- st.b d1
-end_c2:
- clr.l LOCAL_HI(a0) ;store LOCAL_HI = 0
- move.l d2,LOCAL_LO(a0) ;store LOCAL_LO
- move.l FP_SCR2+LOCAL_GRS(a6),d2 ;restore original g,r,s
- andi.l #$e0000000,d2 ;clear all but G,R,S
- tst.l d2 ;test if original G,R,S are clear
- beq.b clear_grs
- or.l #$20000000,d0 ;set sticky bit in d0
-clear_grs:
- andi.l #$e0000000,d0 ;get rid of all but G,R,S
- move.l (sp)+,d2
- rts
-*
-* d1 >= 64 Force the exponent to be the denorm threshold with the
-* correct sign.
-*
-case_3:
- move.w d0,LOCAL_EX(a0)
- tst.w LOCAL_SGN(a0)
- bge.b c3con
-c3neg:
- or.l #$80000000,LOCAL_EX(a0)
-c3con:
- cmp.w #64,d1
- beq.b sixty_four
- cmp.w #65,d1
- beq.b sixty_five
-*
-* Shift value is out of range. Set d1 for inex2 flag and
-* return a zero with the given threshold.
-*
- clr.l LOCAL_HI(a0)
- clr.l LOCAL_LO(a0)
- move.l #$20000000,d0
- st.b d1
- rts
-
-sixty_four:
- move.l LOCAL_HI(a0),d0
- bfextu d0{2:30},d1
- andi.l #$c0000000,d0
- bra.b c3com
-
-sixty_five:
- move.l LOCAL_HI(a0),d0
- bfextu d0{1:31},d1
- andi.l #$80000000,d0
- lsr.l #1,d0 ;shift high bit into R bit
-
-c3com:
- tst.l d1
- bne.b c3ssticky
- tst.l LOCAL_LO(a0)
- bne.b c3ssticky
- tst.b FP_SCR2+LOCAL_GRS(a6)
- bne.b c3ssticky
- clr.b d1
- bra.b c3end
-
-c3ssticky:
- bset.l #rnd_stky_bit,d0
- st.b d1
-c3end:
- clr.l LOCAL_HI(a0)
- clr.l LOCAL_LO(a0)
- rts
-
- end
diff --git a/sys/arch/m68k/fpsp/sacos.sa b/sys/arch/m68k/fpsp/sacos.sa
deleted file mode 100644
index e93b7036a37..00000000000
--- a/sys/arch/m68k/fpsp/sacos.sa
+++ /dev/null
@@ -1,141 +0,0 @@
-* $OpenBSD: sacos.sa,v 1.2 1996/05/29 21:05:34 niklas Exp $
-* $NetBSD: sacos.sa,v 1.3 1994/10/26 07:49:27 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* sacos.sa 3.3 12/19/90
-*
-* Description: The entry point sAcos computes the inverse cosine of
-* an input argument; sAcosd does the same except for denormalized
-* input.
-*
-* Input: Double-extended number X in location pointed to
-* by address register a0.
-*
-* Output: The value arccos(X) returned in floating-point register Fp0.
-*
-* Accuracy and Monotonicity: The returned result is within 3 ulps in
-* 64 significant bit, i.e. within 0.5001 ulp to 53 bits if the
-* result is subsequently rounded to double precision. The
-* result is provably monotonic in double precision.
-*
-* Speed: The program sCOS takes approximately 310 cycles.
-*
-* Algorithm:
-*
-* ACOS
-* 1. If |X| >= 1, go to 3.
-*
-* 2. (|X| < 1) Calculate acos(X) by
-* z := (1-X) / (1+X)
-* acos(X) = 2 * atan( sqrt(z) ).
-* Exit.
-*
-* 3. If |X| > 1, go to 5.
-*
-* 4. (|X| = 1) If X > 0, return 0. Otherwise, return Pi. Exit.
-*
-* 5. (|X| > 1) Generate an invalid operation by 0 * infinity.
-* Exit.
-*
-
-SACOS IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
-PI DC.L $40000000,$C90FDAA2,$2168C235,$00000000
-PIBY2 DC.L $3FFF0000,$C90FDAA2,$2168C235,$00000000
-
- xref t_operr
- xref t_frcinx
- xref satan
-
- xdef sacosd
-sacosd:
-*--ACOS(X) = PI/2 FOR DENORMALIZED X
- fmove.l d1,fpcr ...load user's rounding mode/precision
- FMOVE.X PIBY2,FP0
- bra t_frcinx
-
- xdef sacos
-sacos:
- FMOVE.X (a0),FP0 ...LOAD INPUT
-
- move.l (a0),d0 ...pack exponent with upper 16 fraction
- move.w 4(a0),d0
- ANDI.L #$7FFFFFFF,D0
- CMPI.L #$3FFF8000,D0
- BGE.B ACOSBIG
-
-*--THIS IS THE USUAL CASE, |X| < 1
-*--ACOS(X) = 2 * ATAN( SQRT( (1-X)/(1+X) ) )
-
- FMOVE.S #:3F800000,FP1
- FADD.X FP0,FP1 ...1+X
- FNEG.X FP0 ... -X
- FADD.S #:3F800000,FP0 ...1-X
- FDIV.X FP1,FP0 ...(1-X)/(1+X)
- FSQRT.X FP0 ...SQRT((1-X)/(1+X))
- fmovem.x fp0,(a0) ...overwrite input
- move.l d1,-(sp) ;save original users fpcr
- clr.l d1
- bsr satan ...ATAN(SQRT([1-X]/[1+X]))
- fMOVE.L (sp)+,fpcr ;restore users exceptions
- FADD.X FP0,FP0 ...2 * ATAN( STUFF )
- bra t_frcinx
-
-ACOSBIG:
- FABS.X FP0
- FCMP.S #:3F800000,FP0
- fbgt t_operr ;cause an operr exception
-
-*--|X| = 1, ACOS(X) = 0 OR PI
- move.l (a0),d0 ...pack exponent with upper 16 fraction
- move.w 4(a0),d0
- TST.L D0 ;D0 has original exponent+fraction
- BGT.B ACOSP1
-
-*--X = -1
-*Returns PI and inexact exception
- FMOVE.X PI,FP0
- FMOVE.L d1,FPCR
- FADD.S #:00800000,FP0 ;cause an inexact exception to be put
-* ;into the 040 - will not trap until next
-* ;fp inst.
- bra t_frcinx
-
-ACOSP1:
- FMOVE.L d1,FPCR
- FMOVE.S #:00000000,FP0
- rts ;Facos of +1 is exact
-
- end
diff --git a/sys/arch/m68k/fpsp/sasin.sa b/sys/arch/m68k/fpsp/sasin.sa
deleted file mode 100644
index 61a5ec118aa..00000000000
--- a/sys/arch/m68k/fpsp/sasin.sa
+++ /dev/null
@@ -1,130 +0,0 @@
-* $OpenBSD: sasin.sa,v 1.2 1996/05/29 21:05:34 niklas Exp $
-* $NetBSD: sasin.sa,v 1.2 1994/10/26 07:49:29 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* sasin.sa 3.3 12/19/90
-*
-* Description: The entry point sAsin computes the inverse sine of
-* an input argument; sAsind does the same except for denormalized
-* input.
-*
-* Input: Double-extended number X in location pointed to
-* by address register a0.
-*
-* Output: The value arcsin(X) returned in floating-point register Fp0.
-*
-* Accuracy and Monotonicity: The returned result is within 3 ulps in
-* 64 significant bit, i.e. within 0.5001 ulp to 53 bits if the
-* result is subsequently rounded to double precision. The
-* result is provably monotonic in double precision.
-*
-* Speed: The program sASIN takes approximately 310 cycles.
-*
-* Algorithm:
-*
-* ASIN
-* 1. If |X| >= 1, go to 3.
-*
-* 2. (|X| < 1) Calculate asin(X) by
-* z := sqrt( [1-X][1+X] )
-* asin(X) = atan( x / z ).
-* Exit.
-*
-* 3. If |X| > 1, go to 5.
-*
-* 4. (|X| = 1) sgn := sign(X), return asin(X) := sgn * Pi/2. Exit.
-*
-* 5. (|X| > 1) Generate an invalid operation by 0 * infinity.
-* Exit.
-*
-
-SASIN IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
-PIBY2 DC.L $3FFF0000,$C90FDAA2,$2168C235,$00000000
-
- xref t_operr
- xref t_frcinx
- xref t_extdnrm
- xref satan
-
- xdef sasind
-sasind:
-*--ASIN(X) = X FOR DENORMALIZED X
-
- bra t_extdnrm
-
- xdef sasin
-sasin:
- FMOVE.X (a0),FP0 ...LOAD INPUT
-
- move.l (a0),d0
- move.w 4(a0),d0
- ANDI.L #$7FFFFFFF,D0
- CMPI.L #$3FFF8000,D0
- BGE.B asinbig
-
-*--THIS IS THE USUAL CASE, |X| < 1
-*--ASIN(X) = ATAN( X / SQRT( (1-X)(1+X) ) )
-
- FMOVE.S #:3F800000,FP1
- FSUB.X FP0,FP1 ...1-X
- fmovem.x fp2,-(a7)
- FMOVE.S #:3F800000,FP2
- FADD.X FP0,FP2 ...1+X
- FMUL.X FP2,FP1 ...(1+X)(1-X)
- fmovem.x (a7)+,fp2
- FSQRT.X FP1 ...SQRT([1-X][1+X])
- FDIV.X FP1,FP0 ...X/SQRT([1-X][1+X])
- fmovem.x fp0,(a0)
- bsr satan
- bra t_frcinx
-
-asinbig:
- FABS.X FP0 ...|X|
- FCMP.S #:3F800000,FP0
- fbgt t_operr ;cause an operr exception
-
-*--|X| = 1, ASIN(X) = +- PI/2.
-
- FMOVE.X PIBY2,FP0
- move.l (a0),d0
- ANDI.L #$80000000,D0 ...SIGN BIT OF X
- ORI.L #$3F800000,D0 ...+-1 IN SGL FORMAT
- MOVE.L D0,-(sp) ...push SIGN(X) IN SGL-FMT
- FMOVE.L d1,FPCR
- FMUL.S (sp)+,FP0
- bra t_frcinx
-
- end
diff --git a/sys/arch/m68k/fpsp/satan.sa b/sys/arch/m68k/fpsp/satan.sa
deleted file mode 100644
index 442a728328a..00000000000
--- a/sys/arch/m68k/fpsp/satan.sa
+++ /dev/null
@@ -1,504 +0,0 @@
-* $OpenBSD: satan.sa,v 1.2 1996/05/29 21:05:35 niklas Exp $
-* $NetBSD: satan.sa,v 1.3 1994/10/26 07:49:31 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* satan.sa 3.3 12/19/90
-*
-* The entry point satan computes the arctagent of an
-* input value. satand does the same except the input value is a
-* denormalized number.
-*
-* Input: Double-extended value in memory location pointed to by address
-* register a0.
-*
-* Output: Arctan(X) returned in floating-point register Fp0.
-*
-* Accuracy and Monotonicity: The returned result is within 2 ulps in
-* 64 significant bit, i.e. within 0.5001 ulp to 53 bits if the
-* result is subsequently rounded to double precision. The
-* result is provably monotonic in double precision.
-*
-* Speed: The program satan takes approximately 160 cycles for input
-* argument X such that 1/16 < |X| < 16. For the other arguments,
-* the program will run no worse than 10% slower.
-*
-* Algorithm:
-* Step 1. If |X| >= 16 or |X| < 1/16, go to Step 5.
-*
-* Step 2. Let X = sgn * 2**k * 1.xxxxxxxx...x. Note that k = -4, -3,..., or 3.
-* Define F = sgn * 2**k * 1.xxxx1, i.e. the first 5 significant bits
-* of X with a bit-1 attached at the 6-th bit position. Define u
-* to be u = (X-F) / (1 + X*F).
-*
-* Step 3. Approximate arctan(u) by a polynomial poly.
-*
-* Step 4. Return arctan(F) + poly, arctan(F) is fetched from a table of values
-* calculated beforehand. Exit.
-*
-* Step 5. If |X| >= 16, go to Step 7.
-*
-* Step 6. Approximate arctan(X) by an odd polynomial in X. Exit.
-*
-* Step 7. Define X' = -1/X. Approximate arctan(X') by an odd polynomial in X'.
-* Arctan(X) = sign(X)*Pi/2 + arctan(X'). Exit.
-*
-
-satan IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
-BOUNDS1 DC.L $3FFB8000,$4002FFFF
-
-ONE DC.L $3F800000
-
- DC.L $00000000
-
-ATANA3 DC.L $BFF6687E,$314987D8
-ATANA2 DC.L $4002AC69,$34A26DB3
-
-ATANA1 DC.L $BFC2476F,$4E1DA28E
-ATANB6 DC.L $3FB34444,$7F876989
-
-ATANB5 DC.L $BFB744EE,$7FAF45DB
-ATANB4 DC.L $3FBC71C6,$46940220
-
-ATANB3 DC.L $BFC24924,$921872F9
-ATANB2 DC.L $3FC99999,$99998FA9
-
-ATANB1 DC.L $BFD55555,$55555555
-ATANC5 DC.L $BFB70BF3,$98539E6A
-
-ATANC4 DC.L $3FBC7187,$962D1D7D
-ATANC3 DC.L $BFC24924,$827107B8
-
-ATANC2 DC.L $3FC99999,$9996263E
-ATANC1 DC.L $BFD55555,$55555536
-
-PPIBY2 DC.L $3FFF0000,$C90FDAA2,$2168C235,$00000000
-NPIBY2 DC.L $BFFF0000,$C90FDAA2,$2168C235,$00000000
-PTINY DC.L $00010000,$80000000,$00000000,$00000000
-NTINY DC.L $80010000,$80000000,$00000000,$00000000
-
-ATANTBL:
- DC.L $3FFB0000,$83D152C5,$060B7A51,$00000000
- DC.L $3FFB0000,$8BC85445,$65498B8B,$00000000
- DC.L $3FFB0000,$93BE4060,$17626B0D,$00000000
- DC.L $3FFB0000,$9BB3078D,$35AEC202,$00000000
- DC.L $3FFB0000,$A3A69A52,$5DDCE7DE,$00000000
- DC.L $3FFB0000,$AB98E943,$62765619,$00000000
- DC.L $3FFB0000,$B389E502,$F9C59862,$00000000
- DC.L $3FFB0000,$BB797E43,$6B09E6FB,$00000000
- DC.L $3FFB0000,$C367A5C7,$39E5F446,$00000000
- DC.L $3FFB0000,$CB544C61,$CFF7D5C6,$00000000
- DC.L $3FFB0000,$D33F62F8,$2488533E,$00000000
- DC.L $3FFB0000,$DB28DA81,$62404C77,$00000000
- DC.L $3FFB0000,$E310A407,$8AD34F18,$00000000
- DC.L $3FFB0000,$EAF6B0A8,$188EE1EB,$00000000
- DC.L $3FFB0000,$F2DAF194,$9DBE79D5,$00000000
- DC.L $3FFB0000,$FABD5813,$61D47E3E,$00000000
- DC.L $3FFC0000,$8346AC21,$0959ECC4,$00000000
- DC.L $3FFC0000,$8B232A08,$304282D8,$00000000
- DC.L $3FFC0000,$92FB70B8,$D29AE2F9,$00000000
- DC.L $3FFC0000,$9ACF476F,$5CCD1CB4,$00000000
- DC.L $3FFC0000,$A29E7630,$4954F23F,$00000000
- DC.L $3FFC0000,$AA68C5D0,$8AB85230,$00000000
- DC.L $3FFC0000,$B22DFFFD,$9D539F83,$00000000
- DC.L $3FFC0000,$B9EDEF45,$3E900EA5,$00000000
- DC.L $3FFC0000,$C1A85F1C,$C75E3EA5,$00000000
- DC.L $3FFC0000,$C95D1BE8,$28138DE6,$00000000
- DC.L $3FFC0000,$D10BF300,$840D2DE4,$00000000
- DC.L $3FFC0000,$D8B4B2BA,$6BC05E7A,$00000000
- DC.L $3FFC0000,$E0572A6B,$B42335F6,$00000000
- DC.L $3FFC0000,$E7F32A70,$EA9CAA8F,$00000000
- DC.L $3FFC0000,$EF888432,$64ECEFAA,$00000000
- DC.L $3FFC0000,$F7170A28,$ECC06666,$00000000
- DC.L $3FFD0000,$812FD288,$332DAD32,$00000000
- DC.L $3FFD0000,$88A8D1B1,$218E4D64,$00000000
- DC.L $3FFD0000,$9012AB3F,$23E4AEE8,$00000000
- DC.L $3FFD0000,$976CC3D4,$11E7F1B9,$00000000
- DC.L $3FFD0000,$9EB68949,$3889A227,$00000000
- DC.L $3FFD0000,$A5EF72C3,$4487361B,$00000000
- DC.L $3FFD0000,$AD1700BA,$F07A7227,$00000000
- DC.L $3FFD0000,$B42CBCFA,$FD37EFB7,$00000000
- DC.L $3FFD0000,$BB303A94,$0BA80F89,$00000000
- DC.L $3FFD0000,$C22115C6,$FCAEBBAF,$00000000
- DC.L $3FFD0000,$C8FEF3E6,$86331221,$00000000
- DC.L $3FFD0000,$CFC98330,$B4000C70,$00000000
- DC.L $3FFD0000,$D6807AA1,$102C5BF9,$00000000
- DC.L $3FFD0000,$DD2399BC,$31252AA3,$00000000
- DC.L $3FFD0000,$E3B2A855,$6B8FC517,$00000000
- DC.L $3FFD0000,$EA2D764F,$64315989,$00000000
- DC.L $3FFD0000,$F3BF5BF8,$BAD1A21D,$00000000
- DC.L $3FFE0000,$801CE39E,$0D205C9A,$00000000
- DC.L $3FFE0000,$8630A2DA,$DA1ED066,$00000000
- DC.L $3FFE0000,$8C1AD445,$F3E09B8C,$00000000
- DC.L $3FFE0000,$91DB8F16,$64F350E2,$00000000
- DC.L $3FFE0000,$97731420,$365E538C,$00000000
- DC.L $3FFE0000,$9CE1C8E6,$A0B8CDBA,$00000000
- DC.L $3FFE0000,$A22832DB,$CADAAE09,$00000000
- DC.L $3FFE0000,$A746F2DD,$B7602294,$00000000
- DC.L $3FFE0000,$AC3EC0FB,$997DD6A2,$00000000
- DC.L $3FFE0000,$B110688A,$EBDC6F6A,$00000000
- DC.L $3FFE0000,$B5BCC490,$59ECC4B0,$00000000
- DC.L $3FFE0000,$BA44BC7D,$D470782F,$00000000
- DC.L $3FFE0000,$BEA94144,$FD049AAC,$00000000
- DC.L $3FFE0000,$C2EB4ABB,$661628B6,$00000000
- DC.L $3FFE0000,$C70BD54C,$E602EE14,$00000000
- DC.L $3FFE0000,$CD000549,$ADEC7159,$00000000
- DC.L $3FFE0000,$D48457D2,$D8EA4EA3,$00000000
- DC.L $3FFE0000,$DB948DA7,$12DECE3B,$00000000
- DC.L $3FFE0000,$E23855F9,$69E8096A,$00000000
- DC.L $3FFE0000,$E8771129,$C4353259,$00000000
- DC.L $3FFE0000,$EE57C16E,$0D379C0D,$00000000
- DC.L $3FFE0000,$F3E10211,$A87C3779,$00000000
- DC.L $3FFE0000,$F919039D,$758B8D41,$00000000
- DC.L $3FFE0000,$FE058B8F,$64935FB3,$00000000
- DC.L $3FFF0000,$8155FB49,$7B685D04,$00000000
- DC.L $3FFF0000,$83889E35,$49D108E1,$00000000
- DC.L $3FFF0000,$859CFA76,$511D724B,$00000000
- DC.L $3FFF0000,$87952ECF,$FF8131E7,$00000000
- DC.L $3FFF0000,$89732FD1,$9557641B,$00000000
- DC.L $3FFF0000,$8B38CAD1,$01932A35,$00000000
- DC.L $3FFF0000,$8CE7A8D8,$301EE6B5,$00000000
- DC.L $3FFF0000,$8F46A39E,$2EAE5281,$00000000
- DC.L $3FFF0000,$922DA7D7,$91888487,$00000000
- DC.L $3FFF0000,$94D19FCB,$DEDF5241,$00000000
- DC.L $3FFF0000,$973AB944,$19D2A08B,$00000000
- DC.L $3FFF0000,$996FF00E,$08E10B96,$00000000
- DC.L $3FFF0000,$9B773F95,$12321DA7,$00000000
- DC.L $3FFF0000,$9D55CC32,$0F935624,$00000000
- DC.L $3FFF0000,$9F100575,$006CC571,$00000000
- DC.L $3FFF0000,$A0A9C290,$D97CC06C,$00000000
- DC.L $3FFF0000,$A22659EB,$EBC0630A,$00000000
- DC.L $3FFF0000,$A388B4AF,$F6EF0EC9,$00000000
- DC.L $3FFF0000,$A4D35F10,$61D292C4,$00000000
- DC.L $3FFF0000,$A60895DC,$FBE3187E,$00000000
- DC.L $3FFF0000,$A72A51DC,$7367BEAC,$00000000
- DC.L $3FFF0000,$A83A5153,$0956168F,$00000000
- DC.L $3FFF0000,$A93A2007,$7539546E,$00000000
- DC.L $3FFF0000,$AA9E7245,$023B2605,$00000000
- DC.L $3FFF0000,$AC4C84BA,$6FE4D58F,$00000000
- DC.L $3FFF0000,$ADCE4A4A,$606B9712,$00000000
- DC.L $3FFF0000,$AF2A2DCD,$8D263C9C,$00000000
- DC.L $3FFF0000,$B0656F81,$F22265C7,$00000000
- DC.L $3FFF0000,$B1846515,$0F71496A,$00000000
- DC.L $3FFF0000,$B28AAA15,$6F9ADA35,$00000000
- DC.L $3FFF0000,$B37B44FF,$3766B895,$00000000
- DC.L $3FFF0000,$B458C3DC,$E9630433,$00000000
- DC.L $3FFF0000,$B525529D,$562246BD,$00000000
- DC.L $3FFF0000,$B5E2CCA9,$5F9D88CC,$00000000
- DC.L $3FFF0000,$B692CADA,$7ACA1ADA,$00000000
- DC.L $3FFF0000,$B736AEA7,$A6925838,$00000000
- DC.L $3FFF0000,$B7CFAB28,$7E9F7B36,$00000000
- DC.L $3FFF0000,$B85ECC66,$CB219835,$00000000
- DC.L $3FFF0000,$B8E4FD5A,$20A593DA,$00000000
- DC.L $3FFF0000,$B99F41F6,$4AFF9BB5,$00000000
- DC.L $3FFF0000,$BA7F1E17,$842BBE7B,$00000000
- DC.L $3FFF0000,$BB471285,$7637E17D,$00000000
- DC.L $3FFF0000,$BBFABE8A,$4788DF6F,$00000000
- DC.L $3FFF0000,$BC9D0FAD,$2B689D79,$00000000
- DC.L $3FFF0000,$BD306A39,$471ECD86,$00000000
- DC.L $3FFF0000,$BDB6C731,$856AF18A,$00000000
- DC.L $3FFF0000,$BE31CAC5,$02E80D70,$00000000
- DC.L $3FFF0000,$BEA2D55C,$E33194E2,$00000000
- DC.L $3FFF0000,$BF0B10B7,$C03128F0,$00000000
- DC.L $3FFF0000,$BF6B7A18,$DACB778D,$00000000
- DC.L $3FFF0000,$BFC4EA46,$63FA18F6,$00000000
- DC.L $3FFF0000,$C0181BDE,$8B89A454,$00000000
- DC.L $3FFF0000,$C065B066,$CFBF6439,$00000000
- DC.L $3FFF0000,$C0AE345F,$56340AE6,$00000000
- DC.L $3FFF0000,$C0F22291,$9CB9E6A7,$00000000
-
-X equ FP_SCR1
-XDCARE equ X+2
-XFRAC equ X+4
-XFRACLO equ X+8
-
-ATANF equ FP_SCR2
-ATANFHI equ ATANF+4
-ATANFLO equ ATANF+8
-
-
- xref t_frcinx
- xref t_extdnrm
-
- xdef satand
-satand:
-*--ENTRY POINT FOR ATAN(X) FOR DENORMALIZED ARGUMENT
-
- bra t_extdnrm
-
- xdef satan
-satan:
-*--ENTRY POINT FOR ATAN(X), HERE X IS FINITE, NON-ZERO, AND NOT NAN'S
-
- FMOVE.X (A0),FP0 ...LOAD INPUT
-
- MOVE.L (A0),D0
- MOVE.W 4(A0),D0
- FMOVE.X FP0,X(a6)
- ANDI.L #$7FFFFFFF,D0
-
- CMPI.L #$3FFB8000,D0 ...|X| >= 1/16?
- BGE.B ATANOK1
- BRA.W ATANSM
-
-ATANOK1:
- CMPI.L #$4002FFFF,D0 ...|X| < 16 ?
- BLE.B ATANMAIN
- BRA.W ATANBIG
-
-
-*--THE MOST LIKELY CASE, |X| IN [1/16, 16). WE USE TABLE TECHNIQUE
-*--THE IDEA IS ATAN(X) = ATAN(F) + ATAN( [X-F] / [1+XF] ).
-*--SO IF F IS CHOSEN TO BE CLOSE TO X AND ATAN(F) IS STORED IN
-*--A TABLE, ALL WE NEED IS TO APPROXIMATE ATAN(U) WHERE
-*--U = (X-F)/(1+XF) IS SMALL (REMEMBER F IS CLOSE TO X). IT IS
-*--TRUE THAT A DIVIDE IS NOW NEEDED, BUT THE APPROXIMATION FOR
-*--ATAN(U) IS A VERY SHORT POLYNOMIAL AND THE INDEXING TO
-*--FETCH F AND SAVING OF REGISTERS CAN BE ALL HIDED UNDER THE
-*--DIVIDE. IN THE END THIS METHOD IS MUCH FASTER THAN A TRADITIONAL
-*--ONE. NOTE ALSO THAT THE TRADITIONAL SCHEME THAT APPROXIMATE
-*--ATAN(X) DIRECTLY WILL NEED TO USE A RATIONAL APPROXIMATION
-*--(DIVISION NEEDED) ANYWAY BECAUSE A POLYNOMIAL APPROXIMATION
-*--WILL INVOLVE A VERY LONG POLYNOMIAL.
-
-*--NOW WE SEE X AS +-2^K * 1.BBBBBBB....B <- 1. + 63 BITS
-*--WE CHOSE F TO BE +-2^K * 1.BBBB1
-*--THAT IS IT MATCHES THE EXPONENT AND FIRST 5 BITS OF X, THE
-*--SIXTH BITS IS SET TO BE 1. SINCE K = -4, -3, ..., 3, THERE
-*--ARE ONLY 8 TIMES 16 = 2^7 = 128 |F|'S. SINCE ATAN(-|F|) IS
-*-- -ATAN(|F|), WE NEED TO STORE ONLY ATAN(|F|).
-
-ATANMAIN:
-
- CLR.W XDCARE(a6) ...CLEAN UP X JUST IN CASE
- ANDI.L #$F8000000,XFRAC(a6) ...FIRST 5 BITS
- ORI.L #$04000000,XFRAC(a6) ...SET 6-TH BIT TO 1
- CLR.L XFRACLO(a6) ...LOCATION OF X IS NOW F
-
- FMOVE.X FP0,FP1 ...FP1 IS X
- FMUL.X X(a6),FP1 ...FP1 IS X*F, NOTE THAT X*F > 0
- FSUB.X X(a6),FP0 ...FP0 IS X-F
- FADD.S #:3F800000,FP1 ...FP1 IS 1 + X*F
- FDIV.X FP1,FP0 ...FP0 IS U = (X-F)/(1+X*F)
-
-*--WHILE THE DIVISION IS TAKING ITS TIME, WE FETCH ATAN(|F|)
-*--CREATE ATAN(F) AND STORE IT IN ATANF, AND
-*--SAVE REGISTERS FP2.
-
- MOVE.L d2,-(a7) ...SAVE d2 TEMPORARILY
- MOVE.L d0,d2 ...THE EXPO AND 16 BITS OF X
- ANDI.L #$00007800,d0 ...4 VARYING BITS OF F'S FRACTION
- ANDI.L #$7FFF0000,d2 ...EXPONENT OF F
- SUBI.L #$3FFB0000,d2 ...K+4
- ASR.L #1,d2
- ADD.L d2,d0 ...THE 7 BITS IDENTIFYING F
- ASR.L #7,d0 ...INDEX INTO TBL OF ATAN(|F|)
- LEA ATANTBL,a1
- ADDA.L d0,a1 ...ADDRESS OF ATAN(|F|)
- MOVE.L (a1)+,ATANF(a6)
- MOVE.L (a1)+,ATANFHI(a6)
- MOVE.L (a1)+,ATANFLO(a6) ...ATANF IS NOW ATAN(|F|)
- MOVE.L X(a6),d0 ...LOAD SIGN AND EXPO. AGAIN
- ANDI.L #$80000000,d0 ...SIGN(F)
- OR.L d0,ATANF(a6) ...ATANF IS NOW SIGN(F)*ATAN(|F|)
- MOVE.L (a7)+,d2 ...RESTORE d2
-
-*--THAT'S ALL I HAVE TO DO FOR NOW,
-*--BUT ALAS, THE DIVIDE IS STILL CRANKING!
-
-*--U IN FP0, WE ARE NOW READY TO COMPUTE ATAN(U) AS
-*--U + A1*U*V*(A2 + V*(A3 + V)), V = U*U
-*--THE POLYNOMIAL MAY LOOK STRANGE, BUT IS NEVERTHELESS CORRECT.
-*--THE NATURAL FORM IS U + U*V*(A1 + V*(A2 + V*A3))
-*--WHAT WE HAVE HERE IS MERELY A1 = A3, A2 = A1/A3, A3 = A2/A3.
-*--THE REASON FOR THIS REARRANGEMENT IS TO MAKE THE INDEPENDENT
-*--PARTS A1*U*V AND (A2 + ... STUFF) MORE LOAD-BALANCED
-
-
- FMOVE.X FP0,FP1
- FMUL.X FP1,FP1
- FMOVE.D ATANA3,FP2
- FADD.X FP1,FP2 ...A3+V
- FMUL.X FP1,FP2 ...V*(A3+V)
- FMUL.X FP0,FP1 ...U*V
- FADD.D ATANA2,FP2 ...A2+V*(A3+V)
- FMUL.D ATANA1,FP1 ...A1*U*V
- FMUL.X FP2,FP1 ...A1*U*V*(A2+V*(A3+V))
-
- FADD.X FP1,FP0 ...ATAN(U), FP1 RELEASED
- FMOVE.L d1,FPCR ;restore users exceptions
- FADD.X ATANF(a6),FP0 ...ATAN(X)
- bra t_frcinx
-
-ATANBORS:
-*--|X| IS IN d0 IN COMPACT FORM. FP1, d0 SAVED.
-*--FP0 IS X AND |X| <= 1/16 OR |X| >= 16.
- CMPI.L #$3FFF8000,d0
- BGT.W ATANBIG ...I.E. |X| >= 16
-
-ATANSM:
-*--|X| <= 1/16
-*--IF |X| < 2^(-40), RETURN X AS ANSWER. OTHERWISE, APPROXIMATE
-*--ATAN(X) BY X + X*Y*(B1+Y*(B2+Y*(B3+Y*(B4+Y*(B5+Y*B6)))))
-*--WHICH IS X + X*Y*( [B1+Z*(B3+Z*B5)] + [Y*(B2+Z*(B4+Z*B6)] )
-*--WHERE Y = X*X, AND Z = Y*Y.
-
- CMPI.L #$3FD78000,d0
- BLT.W ATANTINY
-*--COMPUTE POLYNOMIAL
- FMUL.X FP0,FP0 ...FP0 IS Y = X*X
-
-
- CLR.W XDCARE(a6)
-
- FMOVE.X FP0,FP1
- FMUL.X FP1,FP1 ...FP1 IS Z = Y*Y
-
- FMOVE.D ATANB6,FP2
- FMOVE.D ATANB5,FP3
-
- FMUL.X FP1,FP2 ...Z*B6
- FMUL.X FP1,FP3 ...Z*B5
-
- FADD.D ATANB4,FP2 ...B4+Z*B6
- FADD.D ATANB3,FP3 ...B3+Z*B5
-
- FMUL.X FP1,FP2 ...Z*(B4+Z*B6)
- FMUL.X FP3,FP1 ...Z*(B3+Z*B5)
-
- FADD.D ATANB2,FP2 ...B2+Z*(B4+Z*B6)
- FADD.D ATANB1,FP1 ...B1+Z*(B3+Z*B5)
-
- FMUL.X FP0,FP2 ...Y*(B2+Z*(B4+Z*B6))
- FMUL.X X(a6),FP0 ...X*Y
-
- FADD.X FP2,FP1 ...[B1+Z*(B3+Z*B5)]+[Y*(B2+Z*(B4+Z*B6))]
-
-
- FMUL.X FP1,FP0 ...X*Y*([B1+Z*(B3+Z*B5)]+[Y*(B2+Z*(B4+Z*B6))])
-
- FMOVE.L d1,FPCR ;restore users exceptions
- FADD.X X(a6),FP0
-
- bra t_frcinx
-
-ATANTINY:
-*--|X| < 2^(-40), ATAN(X) = X
- CLR.W XDCARE(a6)
-
- FMOVE.L d1,FPCR ;restore users exceptions
- FMOVE.X X(a6),FP0 ;last inst - possible exception set
-
- bra t_frcinx
-
-ATANBIG:
-*--IF |X| > 2^(100), RETURN SIGN(X)*(PI/2 - TINY). OTHERWISE,
-*--RETURN SIGN(X)*PI/2 + ATAN(-1/X).
- CMPI.L #$40638000,d0
- BGT.W ATANHUGE
-
-*--APPROXIMATE ATAN(-1/X) BY
-*--X'+X'*Y*(C1+Y*(C2+Y*(C3+Y*(C4+Y*C5)))), X' = -1/X, Y = X'*X'
-*--THIS CAN BE RE-WRITTEN AS
-*--X'+X'*Y*( [C1+Z*(C3+Z*C5)] + [Y*(C2+Z*C4)] ), Z = Y*Y.
-
- FMOVE.S #:BF800000,FP1 ...LOAD -1
- FDIV.X FP0,FP1 ...FP1 IS -1/X
-
-
-*--DIVIDE IS STILL CRANKING
-
- FMOVE.X FP1,FP0 ...FP0 IS X'
- FMUL.X FP0,FP0 ...FP0 IS Y = X'*X'
- FMOVE.X FP1,X(a6) ...X IS REALLY X'
-
- FMOVE.X FP0,FP1
- FMUL.X FP1,FP1 ...FP1 IS Z = Y*Y
-
- FMOVE.D ATANC5,FP3
- FMOVE.D ATANC4,FP2
-
- FMUL.X FP1,FP3 ...Z*C5
- FMUL.X FP1,FP2 ...Z*B4
-
- FADD.D ATANC3,FP3 ...C3+Z*C5
- FADD.D ATANC2,FP2 ...C2+Z*C4
-
- FMUL.X FP3,FP1 ...Z*(C3+Z*C5), FP3 RELEASED
- FMUL.X FP0,FP2 ...Y*(C2+Z*C4)
-
- FADD.D ATANC1,FP1 ...C1+Z*(C3+Z*C5)
- FMUL.X X(a6),FP0 ...X'*Y
-
- FADD.X FP2,FP1 ...[Y*(C2+Z*C4)]+[C1+Z*(C3+Z*C5)]
-
-
- FMUL.X FP1,FP0 ...X'*Y*([B1+Z*(B3+Z*B5)]
-* ... +[Y*(B2+Z*(B4+Z*B6))])
- FADD.X X(a6),FP0
-
- FMOVE.L d1,FPCR ;restore users exceptions
-
- btst.b #7,(a0)
- beq.b pos_big
-
-neg_big:
- FADD.X NPIBY2,FP0
- bra t_frcinx
-
-pos_big:
- FADD.X PPIBY2,FP0
- bra t_frcinx
-
-ATANHUGE:
-*--RETURN SIGN(X)*(PIBY2 - TINY) = SIGN(X)*PIBY2 - SIGN(X)*TINY
- btst.b #7,(a0)
- beq.b pos_huge
-
-neg_huge:
- FMOVE.X NPIBY2,fp0
- fmove.l d1,fpcr
- fsub.x NTINY,fp0
- bra t_frcinx
-
-pos_huge:
- FMOVE.X PPIBY2,fp0
- fmove.l d1,fpcr
- fsub.x PTINY,fp0
- bra t_frcinx
-
- end
diff --git a/sys/arch/m68k/fpsp/satanh.sa b/sys/arch/m68k/fpsp/satanh.sa
deleted file mode 100644
index 6c940e23ec6..00000000000
--- a/sys/arch/m68k/fpsp/satanh.sa
+++ /dev/null
@@ -1,130 +0,0 @@
-* $OpenBSD: satanh.sa,v 1.2 1996/05/29 21:05:35 niklas Exp $
-* $NetBSD: satanh.sa,v 1.2 1994/10/26 07:49:33 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* satanh.sa 3.3 12/19/90
-*
-* The entry point satanh computes the inverse
-* hyperbolic tangent of
-* an input argument; satanhd does the same except for denormalized
-* input.
-*
-* Input: Double-extended number X in location pointed to
-* by address register a0.
-*
-* Output: The value arctanh(X) returned in floating-point register Fp0.
-*
-* Accuracy and Monotonicity: The returned result is within 3 ulps in
-* 64 significant bit, i.e. within 0.5001 ulp to 53 bits if the
-* result is subsequently rounded to double precision. The
-* result is provably monotonic in double precision.
-*
-* Speed: The program satanh takes approximately 270 cycles.
-*
-* Algorithm:
-*
-* ATANH
-* 1. If |X| >= 1, go to 3.
-*
-* 2. (|X| < 1) Calculate atanh(X) by
-* sgn := sign(X)
-* y := |X|
-* z := 2y/(1-y)
-* atanh(X) := sgn * (1/2) * logp1(z)
-* Exit.
-*
-* 3. If |X| > 1, go to 5.
-*
-* 4. (|X| = 1) Generate infinity with an appropriate sign and
-* divide-by-zero by
-* sgn := sign(X)
-* atan(X) := sgn / (+0).
-* Exit.
-*
-* 5. (|X| > 1) Generate an invalid operation by 0 * infinity.
-* Exit.
-*
-
-satanh IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- xref t_dz
- xref t_operr
- xref t_frcinx
- xref t_extdnrm
- xref slognp1
-
- xdef satanhd
-satanhd:
-*--ATANH(X) = X FOR DENORMALIZED X
-
- bra t_extdnrm
-
- xdef satanh
-satanh:
- move.l (a0),d0
- move.w 4(a0),d0
- ANDI.L #$7FFFFFFF,D0
- CMPI.L #$3FFF8000,D0
- BGE.B ATANHBIG
-
-*--THIS IS THE USUAL CASE, |X| < 1
-*--Y = |X|, Z = 2Y/(1-Y), ATANH(X) = SIGN(X) * (1/2) * LOG1P(Z).
-
- FABS.X (a0),FP0 ...Y = |X|
- FMOVE.X FP0,FP1
- FNEG.X FP1 ...-Y
- FADD.X FP0,FP0 ...2Y
- FADD.S #:3F800000,FP1 ...1-Y
- FDIV.X FP1,FP0 ...2Y/(1-Y)
- move.l (a0),d0
- ANDI.L #$80000000,D0
- ORI.L #$3F000000,D0 ...SIGN(X)*HALF
- move.l d0,-(sp)
-
- fmovem.x fp0,(a0) ...overwrite input
- move.l d1,-(sp)
- clr.l d1
- bsr slognp1 ...LOG1P(Z)
- fmove.l (sp)+,fpcr
- FMUL.S (sp)+,FP0
- bra t_frcinx
-
-ATANHBIG:
- FABS.X (a0),FP0 ...|X|
- FCMP.S #:3F800000,FP0
- fbgt t_operr
- bra t_dz
-
- end
diff --git a/sys/arch/m68k/fpsp/scale.sa b/sys/arch/m68k/fpsp/scale.sa
deleted file mode 100644
index a28d00ac314..00000000000
--- a/sys/arch/m68k/fpsp/scale.sa
+++ /dev/null
@@ -1,398 +0,0 @@
-* $OpenBSD: scale.sa,v 1.2 1996/05/29 21:05:36 niklas Exp $
-* $NetBSD: scale.sa,v 1.3 1994/10/26 07:49:34 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* scale.sa 3.3 7/30/91
-*
-* The entry point sSCALE computes the destination operand
-* scaled by the source operand. If the absoulute value of
-* the source operand is (>= 2^14) an overflow or underflow
-* is returned.
-*
-* The entry point sscale is called from do_func to emulate
-* the fscale unimplemented instruction.
-*
-* Input: Double-extended destination operand in FPTEMP,
-* double-extended source operand in ETEMP.
-*
-* Output: The function returns scale(X,Y) to fp0.
-*
-* Modifies: fp0.
-*
-* Algorithm:
-*
-
-SCALE IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
- xref t_ovfl2
- xref t_unfl
- xref round
- xref t_resdnrm
-
-SRC_BNDS dc.w $3fff,$400c
-
-*
-* This entry point is used by the unimplemented instruction exception
-* handler.
-*
-*
-*
-* FSCALE
-*
- xdef sscale
-sscale:
- fmove.l #0,fpcr ;clr user enabled exc
- clr.l d1
- move.w FPTEMP(a6),d1 ;get dest exponent
- smi L_SCR1(a6) ;use L_SCR1 to hold sign
- andi.l #$7fff,d1 ;strip sign
- move.w ETEMP(a6),d0 ;check src bounds
- andi.w #$7fff,d0 ;clr sign bit
- cmp2.w SRC_BNDS,d0
- bcc.b src_in
- cmpi.w #$400c,d0 ;test for too large
- bge.w src_out
-*
-* The source input is below 1, so we check for denormalized numbers
-* and set unfl.
-*
-src_small:
- move.b DTAG(a6),d0
- andi.b #$e0,d0
- tst.b d0
- beq.b no_denorm
- st STORE_FLG(a6) ;dest already contains result
- or.l #unfl_mask,USER_FPSR(a6) ;set UNFL
-den_done:
- lea.l FPTEMP(a6),a0
- bra t_resdnrm
-no_denorm:
- fmove.l USER_FPCR(a6),FPCR
- fmove.x FPTEMP(a6),fp0 ;simply return dest
- rts
-
-
-*
-* Source is within 2^14 range. To perform the int operation,
-* move it to d0.
-*
-src_in:
- fmove.x ETEMP(a6),fp0 ;move in src for int
- fmove.l #rz_mode,fpcr ;force rz for src conversion
- fmove.l fp0,d0 ;int src to d0
- fmove.l #0,FPSR ;clr status from above
- tst.w ETEMP(a6) ;check src sign
- blt.w src_neg
-*
-* Source is positive. Add the src to the dest exponent.
-* The result can be denormalized, if src = 0, or overflow,
-* if the result of the add sets a bit in the upper word.
-*
-src_pos:
- tst.w d1 ;check for denorm
- beq.w dst_dnrm
- add.l d0,d1 ;add src to dest exp
- beq.b denorm ;if zero, result is denorm
- cmpi.l #$7fff,d1 ;test for overflow
- bge.b ovfl
- tst.b L_SCR1(a6)
- beq.b spos_pos
- or.w #$8000,d1
-spos_pos:
- move.w d1,FPTEMP(a6) ;result in FPTEMP
- fmove.l USER_FPCR(a6),FPCR
- fmove.x FPTEMP(a6),fp0 ;write result to fp0
- rts
-ovfl:
- tst.b L_SCR1(a6)
- beq.b sovl_pos
- or.w #$8000,d1
-sovl_pos:
- move.w FPTEMP(a6),ETEMP(a6) ;result in ETEMP
- move.l FPTEMP_HI(a6),ETEMP_HI(a6)
- move.l FPTEMP_LO(a6),ETEMP_LO(a6)
- bra t_ovfl2
-
-denorm:
- tst.b L_SCR1(a6)
- beq.b den_pos
- or.w #$8000,d1
-den_pos:
- tst.l FPTEMP_HI(a6) ;check j bit
- blt.b nden_exit ;if set, not denorm
- move.w d1,ETEMP(a6) ;input expected in ETEMP
- move.l FPTEMP_HI(a6),ETEMP_HI(a6)
- move.l FPTEMP_LO(a6),ETEMP_LO(a6)
- or.l #unfl_bit,USER_FPSR(a6) ;set unfl
- lea.l ETEMP(a6),a0
- bra t_resdnrm
-nden_exit:
- move.w d1,FPTEMP(a6) ;result in FPTEMP
- fmove.l USER_FPCR(a6),FPCR
- fmove.x FPTEMP(a6),fp0 ;write result to fp0
- rts
-
-*
-* Source is negative. Add the src to the dest exponent.
-* (The result exponent will be reduced). The result can be
-* denormalized.
-*
-src_neg:
- add.l d0,d1 ;add src to dest
- beq.b denorm ;if zero, result is denorm
- blt.b fix_dnrm ;if negative, result is
-* ;needing denormalization
- tst.b L_SCR1(a6)
- beq.b sneg_pos
- or.w #$8000,d1
-sneg_pos:
- move.w d1,FPTEMP(a6) ;result in FPTEMP
- fmove.l USER_FPCR(a6),FPCR
- fmove.x FPTEMP(a6),fp0 ;write result to fp0
- rts
-
-
-*
-* The result exponent is below denorm value. Test for catastrophic
-* underflow and force zero if true. If not, try to shift the
-* mantissa right until a zero exponent exists.
-*
-fix_dnrm:
- cmpi.w #$ffc0,d1 ;lower bound for normalization
- blt.w fix_unfl ;if lower, catastrophic unfl
- move.w d1,d0 ;use d0 for exp
- move.l d2,-(a7) ;free d2 for norm
- move.l FPTEMP_HI(a6),d1
- move.l FPTEMP_LO(a6),d2
- clr.l L_SCR2(a6)
-fix_loop:
- add.w #1,d0 ;drive d0 to 0
- lsr.l #1,d1 ;while shifting the
- roxr.l #1,d2 ;mantissa to the right
- bcc.b no_carry
- st L_SCR2(a6) ;use L_SCR2 to capture inex
-no_carry:
- tst.w d0 ;it is finished when
- blt.b fix_loop ;d0 is zero or the mantissa
- tst.b L_SCR2(a6)
- beq.b tst_zero
- or.l #unfl_inx_mask,USER_FPSR(a6)
-* ;set unfl, aunfl, ainex
-*
-* Test for zero. If zero, simply use fmove to return +/- zero
-* to the fpu.
-*
-tst_zero:
- clr.w FPTEMP_EX(a6)
- tst.b L_SCR1(a6) ;test for sign
- beq.b tst_con
- or.w #$8000,FPTEMP_EX(a6) ;set sign bit
-tst_con:
- move.l d1,FPTEMP_HI(a6)
- move.l d2,FPTEMP_LO(a6)
- move.l (a7)+,d2
- tst.l d1
- bne.b not_zero
- tst.l FPTEMP_LO(a6)
- bne.b not_zero
-*
-* Result is zero. Check for rounding mode to set lsb. If the
-* mode is rp, and the zero is positive, return smallest denorm.
-* If the mode is rm, and the zero is negative, return smallest
-* negative denorm.
-*
- btst.b #5,FPCR_MODE(a6) ;test if rm or rp
- beq.b no_dir
- btst.b #4,FPCR_MODE(a6) ;check which one
- beq.b zer_rm
-zer_rp:
- tst.b L_SCR1(a6) ;check sign
- bne.b no_dir ;if set, neg op, no inc
- move.l #1,FPTEMP_LO(a6) ;set lsb
- bra.b sm_dnrm
-zer_rm:
- tst.b L_SCR1(a6) ;check sign
- beq.b no_dir ;if clr, neg op, no inc
- move.l #1,FPTEMP_LO(a6) ;set lsb
- or.l #neg_mask,USER_FPSR(a6) ;set N
- bra.b sm_dnrm
-no_dir:
- fmove.l USER_FPCR(a6),FPCR
- fmove.x FPTEMP(a6),fp0 ;use fmove to set cc's
- rts
-
-*
-* The rounding mode changed the zero to a smallest denorm. Call
-* t_resdnrm with exceptional operand in ETEMP.
-*
-sm_dnrm:
- move.l FPTEMP_EX(a6),ETEMP_EX(a6)
- move.l FPTEMP_HI(a6),ETEMP_HI(a6)
- move.l FPTEMP_LO(a6),ETEMP_LO(a6)
- lea.l ETEMP(a6),a0
- bra t_resdnrm
-
-*
-* Result is still denormalized.
-*
-not_zero:
- or.l #unfl_mask,USER_FPSR(a6) ;set unfl
- tst.b L_SCR1(a6) ;check for sign
- beq.b fix_exit
- or.l #neg_mask,USER_FPSR(a6) ;set N
-fix_exit:
- bra.b sm_dnrm
-
-
-*
-* The result has underflowed to zero. Return zero and set
-* unfl, aunfl, and ainex.
-*
-fix_unfl:
- or.l #unfl_inx_mask,USER_FPSR(a6)
- btst.b #5,FPCR_MODE(a6) ;test if rm or rp
- beq.b no_dir2
- btst.b #4,FPCR_MODE(a6) ;check which one
- beq.b zer_rm2
-zer_rp2:
- tst.b L_SCR1(a6) ;check sign
- bne.b no_dir2 ;if set, neg op, no inc
- clr.l FPTEMP_EX(a6)
- clr.l FPTEMP_HI(a6)
- move.l #1,FPTEMP_LO(a6) ;set lsb
- bra.b sm_dnrm ;return smallest denorm
-zer_rm2:
- tst.b L_SCR1(a6) ;check sign
- beq.b no_dir2 ;if clr, neg op, no inc
- move.w #$8000,FPTEMP_EX(a6)
- clr.l FPTEMP_HI(a6)
- move.l #1,FPTEMP_LO(a6) ;set lsb
- or.l #neg_mask,USER_FPSR(a6) ;set N
- bra.w sm_dnrm ;return smallest denorm
-
-no_dir2:
- tst.b L_SCR1(a6)
- bge.b pos_zero
-neg_zero:
- clr.l FP_SCR1(a6) ;clear the exceptional operand
- clr.l FP_SCR1+4(a6) ;for gen_except.
- clr.l FP_SCR1+8(a6)
- fmove.s #:80000000,fp0
- rts
-pos_zero:
- clr.l FP_SCR1(a6) ;clear the exceptional operand
- clr.l FP_SCR1+4(a6) ;for gen_except.
- clr.l FP_SCR1+8(a6)
- fmove.s #:00000000,fp0
- rts
-
-*
-* The destination is a denormalized number. It must be handled
-* by first shifting the bits in the mantissa until it is normalized,
-* then adding the remainder of the source to the exponent.
-*
-dst_dnrm:
- movem.l d2/d3,-(a7)
- move.w FPTEMP_EX(a6),d1
- move.l FPTEMP_HI(a6),d2
- move.l FPTEMP_LO(a6),d3
-dst_loop:
- tst.l d2 ;test for normalized result
- blt.b dst_norm ;exit loop if so
- tst.l d0 ;otherwise, test shift count
- beq.b dst_fin ;if zero, shifting is done
- subq.l #1,d0 ;dec src
- add.l d3,d3
- addx.l d2,d2
- bra.b dst_loop
-*
-* Destination became normalized. Simply add the remaining
-* portion of the src to the exponent.
-*
-dst_norm:
- add.w d0,d1 ;dst is normalized; add src
- tst.b L_SCR1(a6)
- beq.b dnrm_pos
- or.w #$8000,d1
-dnrm_pos:
- movem.w d1,FPTEMP_EX(a6)
- movem.l d2,FPTEMP_HI(a6)
- movem.l d3,FPTEMP_LO(a6)
- fmove.l USER_FPCR(a6),FPCR
- fmove.x FPTEMP(a6),fp0
- movem.l (a7)+,d2/d3
- rts
-
-*
-* Destination remained denormalized. Call t_excdnrm with
-* exceptional operand in ETEMP.
-*
-dst_fin:
- tst.b L_SCR1(a6) ;check for sign
- beq.b dst_exit
- or.l #neg_mask,USER_FPSR(a6) ;set N
- or.w #$8000,d1
-dst_exit:
- movem.w d1,ETEMP_EX(a6)
- movem.l d2,ETEMP_HI(a6)
- movem.l d3,ETEMP_LO(a6)
- or.l #unfl_mask,USER_FPSR(a6) ;set unfl
- movem.l (a7)+,d2/d3
- lea.l ETEMP(a6),a0
- bra t_resdnrm
-
-*
-* Source is outside of 2^14 range. Test the sign and branch
-* to the appropriate exception handler.
-*
-src_out:
- tst.b L_SCR1(a6)
- beq.b scro_pos
- or.w #$8000,d1
-scro_pos:
- move.l FPTEMP_HI(a6),ETEMP_HI(a6)
- move.l FPTEMP_LO(a6),ETEMP_LO(a6)
- tst.w ETEMP(a6)
- blt.b res_neg
-res_pos:
- move.w d1,ETEMP(a6) ;result in ETEMP
- bra t_ovfl2
-res_neg:
- move.w d1,ETEMP(a6) ;result in ETEMP
- lea.l ETEMP(a6),a0
- bra t_unfl
- end
diff --git a/sys/arch/m68k/fpsp/scosh.sa b/sys/arch/m68k/fpsp/scosh.sa
deleted file mode 100644
index 64aafbfaa3d..00000000000
--- a/sys/arch/m68k/fpsp/scosh.sa
+++ /dev/null
@@ -1,157 +0,0 @@
-* $OpenBSD: scosh.sa,v 1.2 1996/05/29 21:05:36 niklas Exp $
-* $NetBSD: scosh.sa,v 1.2 1994/10/26 07:49:39 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* scosh.sa 3.1 12/10/90
-*
-* The entry point sCosh computes the hyperbolic cosine of
-* an input argument; sCoshd does the same except for denormalized
-* input.
-*
-* Input: Double-extended number X in location pointed to
-* by address register a0.
-*
-* Output: The value cosh(X) returned in floating-point register Fp0.
-*
-* Accuracy and Monotonicity: The returned result is within 3 ulps in
-* 64 significant bit, i.e. within 0.5001 ulp to 53 bits if the
-* result is subsequently rounded to double precision. The
-* result is provably monotonic in double precision.
-*
-* Speed: The program sCOSH takes approximately 250 cycles.
-*
-* Algorithm:
-*
-* COSH
-* 1. If |X| > 16380 log2, go to 3.
-*
-* 2. (|X| <= 16380 log2) Cosh(X) is obtained by the formulae
-* y = |X|, z = exp(Y), and
-* cosh(X) = (1/2)*( z + 1/z ).
-* Exit.
-*
-* 3. (|X| > 16380 log2). If |X| > 16480 log2, go to 5.
-*
-* 4. (16380 log2 < |X| <= 16480 log2)
-* cosh(X) = sign(X) * exp(|X|)/2.
-* However, invoking exp(|X|) may cause premature overflow.
-* Thus, we calculate sinh(X) as follows:
-* Y := |X|
-* Fact := 2**(16380)
-* Y' := Y - 16381 log2
-* cosh(X) := Fact * exp(Y').
-* Exit.
-*
-* 5. (|X| > 16480 log2) sinh(X) must overflow. Return
-* Huge*Huge to generate overflow and an infinity with
-* the appropriate sign. Huge is the largest finite number in
-* extended format. Exit.
-*
-
-SCOSH IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- xref t_ovfl
- xref t_frcinx
- xref setox
-
-T1 DC.L $40C62D38,$D3D64634 ... 16381 LOG2 LEAD
-T2 DC.L $3D6F90AE,$B1E75CC7 ... 16381 LOG2 TRAIL
-
-TWO16380 DC.L $7FFB0000,$80000000,$00000000,$00000000
-
- xdef scoshd
-scoshd:
-*--COSH(X) = 1 FOR DENORMALIZED X
-
- FMOVE.S #:3F800000,FP0
-
- FMOVE.L d1,FPCR
- FADD.S #:00800000,FP0
- bra t_frcinx
-
- xdef scosh
-scosh:
- FMOVE.X (a0),FP0 ...LOAD INPUT
-
- move.l (a0),d0
- move.w 4(a0),d0
- ANDI.L #$7FFFFFFF,d0
- CMPI.L #$400CB167,d0
- BGT.B COSHBIG
-
-*--THIS IS THE USUAL CASE, |X| < 16380 LOG2
-*--COSH(X) = (1/2) * ( EXP(X) + 1/EXP(X) )
-
- FABS.X FP0 ...|X|
-
- move.l d1,-(sp)
- clr.l d1
- fmovem.x fp0,(a0) ;pass parameter to setox
- bsr setox ...FP0 IS EXP(|X|)
- FMUL.S #:3F000000,FP0 ...(1/2)EXP(|X|)
- move.l (sp)+,d1
-
- FMOVE.S #:3E800000,FP1 ...(1/4)
- FDIV.X FP0,FP1 ...1/(2 EXP(|X|))
-
- FMOVE.L d1,FPCR
- FADD.X fp1,FP0
-
- bra t_frcinx
-
-COSHBIG:
- CMPI.L #$400CB2B3,d0
- BGT.B COSHHUGE
-
- FABS.X FP0
- FSUB.D T1(pc),FP0 ...(|X|-16381LOG2_LEAD)
- FSUB.D T2(pc),FP0 ...|X| - 16381 LOG2, ACCURATE
-
- move.l d1,-(sp)
- clr.l d1
- fmovem.x fp0,(a0)
- bsr setox
- fmove.l (sp)+,fpcr
-
- FMUL.X TWO16380(pc),FP0
- bra t_frcinx
-
-COSHHUGE:
- fmove.l #0,fpsr ;clr N bit if set by source
- bclr.b #7,(a0) ;always return positive value
- fmovem.x (a0),fp0
- bra t_ovfl
-
- end
diff --git a/sys/arch/m68k/fpsp/setox.sa b/sys/arch/m68k/fpsp/setox.sa
deleted file mode 100644
index b022b48a01c..00000000000
--- a/sys/arch/m68k/fpsp/setox.sa
+++ /dev/null
@@ -1,890 +0,0 @@
-* $OpenBSD: setox.sa,v 1.2 1996/05/29 21:05:37 niklas Exp $
-* $NetBSD: setox.sa,v 1.3 1994/10/26 07:49:42 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* setox.sa 3.1 12/10/90
-*
-* The entry point setox computes the exponential of a value.
-* setoxd does the same except the input value is a denormalized
-* number. setoxm1 computes exp(X)-1, and setoxm1d computes
-* exp(X)-1 for denormalized X.
-*
-* INPUT
-* -----
-* Double-extended value in memory location pointed to by address
-* register a0.
-*
-* OUTPUT
-* ------
-* exp(X) or exp(X)-1 returned in floating-point register fp0.
-*
-* ACCURACY and MONOTONICITY
-* -------------------------
-* The returned result is within 0.85 ulps in 64 significant bit, i.e.
-* within 0.5001 ulp to 53 bits if the result is subsequently rounded
-* to double precision. The result is provably monotonic in double
-* precision.
-*
-* SPEED
-* -----
-* Two timings are measured, both in the copy-back mode. The
-* first one is measured when the function is invoked the first time
-* (so the instructions and data are not in cache), and the
-* second one is measured when the function is reinvoked at the same
-* input argument.
-*
-* The program setox takes approximately 210/190 cycles for input
-* argument X whose magnitude is less than 16380 log2, which
-* is the usual situation. For the less common arguments,
-* depending on their values, the program may run faster or slower --
-* but no worse than 10% slower even in the extreme cases.
-*
-* The program setoxm1 takes approximately ???/??? cycles for input
-* argument X, 0.25 <= |X| < 70log2. For |X| < 0.25, it takes
-* approximately ???/??? cycles. For the less common arguments,
-* depending on their values, the program may run faster or slower --
-* but no worse than 10% slower even in the extreme cases.
-*
-* ALGORITHM and IMPLEMENTATION NOTES
-* ----------------------------------
-*
-* setoxd
-* ------
-* Step 1. Set ans := 1.0
-*
-* Step 2. Return ans := ans + sign(X)*2^(-126). Exit.
-* Notes: This will always generate one exception -- inexact.
-*
-*
-* setox
-* -----
-*
-* Step 1. Filter out extreme cases of input argument.
-* 1.1 If |X| >= 2^(-65), go to Step 1.3.
-* 1.2 Go to Step 7.
-* 1.3 If |X| < 16380 log(2), go to Step 2.
-* 1.4 Go to Step 8.
-* Notes: The usual case should take the branches 1.1 -> 1.3 -> 2.
-* To avoid the use of floating-point comparisons, a
-* compact representation of |X| is used. This format is a
-* 32-bit integer, the upper (more significant) 16 bits are
-* the sign and biased exponent field of |X|; the lower 16
-* bits are the 16 most significant fraction (including the
-* explicit bit) bits of |X|. Consequently, the comparisons
-* in Steps 1.1 and 1.3 can be performed by integer comparison.
-* Note also that the constant 16380 log(2) used in Step 1.3
-* is also in the compact form. Thus taking the branch
-* to Step 2 guarantees |X| < 16380 log(2). There is no harm
-* to have a small number of cases where |X| is less than,
-* but close to, 16380 log(2) and the branch to Step 9 is
-* taken.
-*
-* Step 2. Calculate N = round-to-nearest-int( X * 64/log2 ).
-* 2.1 Set AdjFlag := 0 (indicates the branch 1.3 -> 2 was taken)
-* 2.2 N := round-to-nearest-integer( X * 64/log2 ).
-* 2.3 Calculate J = N mod 64; so J = 0,1,2,..., or 63.
-* 2.4 Calculate M = (N - J)/64; so N = 64M + J.
-* 2.5 Calculate the address of the stored value of 2^(J/64).
-* 2.6 Create the value Scale = 2^M.
-* Notes: The calculation in 2.2 is really performed by
-*
-* Z := X * constant
-* N := round-to-nearest-integer(Z)
-*
-* where
-*
-* constant := single-precision( 64/log 2 ).
-*
-* Using a single-precision constant avoids memory access.
-* Another effect of using a single-precision "constant" is
-* that the calculated value Z is
-*
-* Z = X*(64/log2)*(1+eps), |eps| <= 2^(-24).
-*
-* This error has to be considered later in Steps 3 and 4.
-*
-* Step 3. Calculate X - N*log2/64.
-* 3.1 R := X + N*L1, where L1 := single-precision(-log2/64).
-* 3.2 R := R + N*L2, L2 := extended-precision(-log2/64 - L1).
-* Notes: a) The way L1 and L2 are chosen ensures L1+L2 approximate
-* the value -log2/64 to 88 bits of accuracy.
-* b) N*L1 is exact because N is no longer than 22 bits and
-* L1 is no longer than 24 bits.
-* c) The calculation X+N*L1 is also exact due to cancellation.
-* Thus, R is practically X+N(L1+L2) to full 64 bits.
-* d) It is important to estimate how large can |R| be after
-* Step 3.2.
-*
-* N = rnd-to-int( X*64/log2 (1+eps) ), |eps|<=2^(-24)
-* X*64/log2 (1+eps) = N + f, |f| <= 0.5
-* X*64/log2 - N = f - eps*X 64/log2
-* X - N*log2/64 = f*log2/64 - eps*X
-*
-*
-* Now |X| <= 16446 log2, thus
-*
-* |X - N*log2/64| <= (0.5 + 16446/2^(18))*log2/64
-* <= 0.57 log2/64.
-* This bound will be used in Step 4.
-*
-* Step 4. Approximate exp(R)-1 by a polynomial
-* p = R + R*R*(A1 + R*(A2 + R*(A3 + R*(A4 + R*A5))))
-* Notes: a) In order to reduce memory access, the coefficients are
-* made as "short" as possible: A1 (which is 1/2), A4 and A5
-* are single precision; A2 and A3 are double precision.
-* b) Even with the restrictions above,
-* |p - (exp(R)-1)| < 2^(-68.8) for all |R| <= 0.0062.
-* Note that 0.0062 is slightly bigger than 0.57 log2/64.
-* c) To fully utilize the pipeline, p is separated into
-* two independent pieces of roughly equal complexities
-* p = [ R + R*S*(A2 + S*A4) ] +
-* [ S*(A1 + S*(A3 + S*A5)) ]
-* where S = R*R.
-*
-* Step 5. Compute 2^(J/64)*exp(R) = 2^(J/64)*(1+p) by
-* ans := T + ( T*p + t)
-* where T and t are the stored values for 2^(J/64).
-* Notes: 2^(J/64) is stored as T and t where T+t approximates
-* 2^(J/64) to roughly 85 bits; T is in extended precision
-* and t is in single precision. Note also that T is rounded
-* to 62 bits so that the last two bits of T are zero. The
-* reason for such a special form is that T-1, T-2, and T-8
-* will all be exact --- a property that will give much
-* more accurate computation of the function EXPM1.
-*
-* Step 6. Reconstruction of exp(X)
-* exp(X) = 2^M * 2^(J/64) * exp(R).
-* 6.1 If AdjFlag = 0, go to 6.3
-* 6.2 ans := ans * AdjScale
-* 6.3 Restore the user FPCR
-* 6.4 Return ans := ans * Scale. Exit.
-* Notes: If AdjFlag = 0, we have X = Mlog2 + Jlog2/64 + R,
-* |M| <= 16380, and Scale = 2^M. Moreover, exp(X) will
-* neither overflow nor underflow. If AdjFlag = 1, that
-* means that
-* X = (M1+M)log2 + Jlog2/64 + R, |M1+M| >= 16380.
-* Hence, exp(X) may overflow or underflow or neither.
-* When that is the case, AdjScale = 2^(M1) where M1 is
-* approximately M. Thus 6.2 will never cause over/underflow.
-* Possible exception in 6.4 is overflow or underflow.
-* The inexact exception is not generated in 6.4. Although
-* one can argue that the inexact flag should always be
-* raised, to simulate that exception cost to much than the
-* flag is worth in practical uses.
-*
-* Step 7. Return 1 + X.
-* 7.1 ans := X
-* 7.2 Restore user FPCR.
-* 7.3 Return ans := 1 + ans. Exit
-* Notes: For non-zero X, the inexact exception will always be
-* raised by 7.3. That is the only exception raised by 7.3.
-* Note also that we use the FMOVEM instruction to move X
-* in Step 7.1 to avoid unnecessary trapping. (Although
-* the FMOVEM may not seem relevant since X is normalized,
-* the precaution will be useful in the library version of
-* this code where the separate entry for denormalized inputs
-* will be done away with.)
-*
-* Step 8. Handle exp(X) where |X| >= 16380log2.
-* 8.1 If |X| > 16480 log2, go to Step 9.
-* (mimic 2.2 - 2.6)
-* 8.2 N := round-to-integer( X * 64/log2 )
-* 8.3 Calculate J = N mod 64, J = 0,1,...,63
-* 8.4 K := (N-J)/64, M1 := truncate(K/2), M = K-M1, AdjFlag := 1.
-* 8.5 Calculate the address of the stored value 2^(J/64).
-* 8.6 Create the values Scale = 2^M, AdjScale = 2^M1.
-* 8.7 Go to Step 3.
-* Notes: Refer to notes for 2.2 - 2.6.
-*
-* Step 9. Handle exp(X), |X| > 16480 log2.
-* 9.1 If X < 0, go to 9.3
-* 9.2 ans := Huge, go to 9.4
-* 9.3 ans := Tiny.
-* 9.4 Restore user FPCR.
-* 9.5 Return ans := ans * ans. Exit.
-* Notes: Exp(X) will surely overflow or underflow, depending on
-* X's sign. "Huge" and "Tiny" are respectively large/tiny
-* extended-precision numbers whose square over/underflow
-* with an inexact result. Thus, 9.5 always raises the
-* inexact together with either overflow or underflow.
-*
-*
-* setoxm1d
-* --------
-*
-* Step 1. Set ans := 0
-*
-* Step 2. Return ans := X + ans. Exit.
-* Notes: This will return X with the appropriate rounding
-* precision prescribed by the user FPCR.
-*
-* setoxm1
-* -------
-*
-* Step 1. Check |X|
-* 1.1 If |X| >= 1/4, go to Step 1.3.
-* 1.2 Go to Step 7.
-* 1.3 If |X| < 70 log(2), go to Step 2.
-* 1.4 Go to Step 10.
-* Notes: The usual case should take the branches 1.1 -> 1.3 -> 2.
-* However, it is conceivable |X| can be small very often
-* because EXPM1 is intended to evaluate exp(X)-1 accurately
-* when |X| is small. For further details on the comparisons,
-* see the notes on Step 1 of setox.
-*
-* Step 2. Calculate N = round-to-nearest-int( X * 64/log2 ).
-* 2.1 N := round-to-nearest-integer( X * 64/log2 ).
-* 2.2 Calculate J = N mod 64; so J = 0,1,2,..., or 63.
-* 2.3 Calculate M = (N - J)/64; so N = 64M + J.
-* 2.4 Calculate the address of the stored value of 2^(J/64).
-* 2.5 Create the values Sc = 2^M and OnebySc := -2^(-M).
-* Notes: See the notes on Step 2 of setox.
-*
-* Step 3. Calculate X - N*log2/64.
-* 3.1 R := X + N*L1, where L1 := single-precision(-log2/64).
-* 3.2 R := R + N*L2, L2 := extended-precision(-log2/64 - L1).
-* Notes: Applying the analysis of Step 3 of setox in this case
-* shows that |R| <= 0.0055 (note that |X| <= 70 log2 in
-* this case).
-*
-* Step 4. Approximate exp(R)-1 by a polynomial
-* p = R+R*R*(A1+R*(A2+R*(A3+R*(A4+R*(A5+R*A6)))))
-* Notes: a) In order to reduce memory access, the coefficients are
-* made as "short" as possible: A1 (which is 1/2), A5 and A6
-* are single precision; A2, A3 and A4 are double precision.
-* b) Even with the restriction above,
-* |p - (exp(R)-1)| < |R| * 2^(-72.7)
-* for all |R| <= 0.0055.
-* c) To fully utilize the pipeline, p is separated into
-* two independent pieces of roughly equal complexity
-* p = [ R*S*(A2 + S*(A4 + S*A6)) ] +
-* [ R + S*(A1 + S*(A3 + S*A5)) ]
-* where S = R*R.
-*
-* Step 5. Compute 2^(J/64)*p by
-* p := T*p
-* where T and t are the stored values for 2^(J/64).
-* Notes: 2^(J/64) is stored as T and t where T+t approximates
-* 2^(J/64) to roughly 85 bits; T is in extended precision
-* and t is in single precision. Note also that T is rounded
-* to 62 bits so that the last two bits of T are zero. The
-* reason for such a special form is that T-1, T-2, and T-8
-* will all be exact --- a property that will be exploited
-* in Step 6 below. The total relative error in p is no
-* bigger than 2^(-67.7) compared to the final result.
-*
-* Step 6. Reconstruction of exp(X)-1
-* exp(X)-1 = 2^M * ( 2^(J/64) + p - 2^(-M) ).
-* 6.1 If M <= 63, go to Step 6.3.
-* 6.2 ans := T + (p + (t + OnebySc)). Go to 6.6
-* 6.3 If M >= -3, go to 6.5.
-* 6.4 ans := (T + (p + t)) + OnebySc. Go to 6.6
-* 6.5 ans := (T + OnebySc) + (p + t).
-* 6.6 Restore user FPCR.
-* 6.7 Return ans := Sc * ans. Exit.
-* Notes: The various arrangements of the expressions give accurate
-* evaluations.
-*
-* Step 7. exp(X)-1 for |X| < 1/4.
-* 7.1 If |X| >= 2^(-65), go to Step 9.
-* 7.2 Go to Step 8.
-*
-* Step 8. Calculate exp(X)-1, |X| < 2^(-65).
-* 8.1 If |X| < 2^(-16312), goto 8.3
-* 8.2 Restore FPCR; return ans := X - 2^(-16382). Exit.
-* 8.3 X := X * 2^(140).
-* 8.4 Restore FPCR; ans := ans - 2^(-16382).
-* Return ans := ans*2^(140). Exit
-* Notes: The idea is to return "X - tiny" under the user
-* precision and rounding modes. To avoid unnecessary
-* inefficiency, we stay away from denormalized numbers the
-* best we can. For |X| >= 2^(-16312), the straightforward
-* 8.2 generates the inexact exception as the case warrants.
-*
-* Step 9. Calculate exp(X)-1, |X| < 1/4, by a polynomial
-* p = X + X*X*(B1 + X*(B2 + ... + X*B12))
-* Notes: a) In order to reduce memory access, the coefficients are
-* made as "short" as possible: B1 (which is 1/2), B9 to B12
-* are single precision; B3 to B8 are double precision; and
-* B2 is double extended.
-* b) Even with the restriction above,
-* |p - (exp(X)-1)| < |X| 2^(-70.6)
-* for all |X| <= 0.251.
-* Note that 0.251 is slightly bigger than 1/4.
-* c) To fully preserve accuracy, the polynomial is computed
-* as X + ( S*B1 + Q ) where S = X*X and
-* Q = X*S*(B2 + X*(B3 + ... + X*B12))
-* d) To fully utilize the pipeline, Q is separated into
-* two independent pieces of roughly equal complexity
-* Q = [ X*S*(B2 + S*(B4 + ... + S*B12)) ] +
-* [ S*S*(B3 + S*(B5 + ... + S*B11)) ]
-*
-* Step 10. Calculate exp(X)-1 for |X| >= 70 log 2.
-* 10.1 If X >= 70log2 , exp(X) - 1 = exp(X) for all practical
-* purposes. Therefore, go to Step 1 of setox.
-* 10.2 If X <= -70log2, exp(X) - 1 = -1 for all practical purposes.
-* ans := -1
-* Restore user FPCR
-* Return ans := ans + 2^(-126). Exit.
-* Notes: 10.2 will always create an inexact and return -1 + tiny
-* in the user rounding precision and mode.
-*
-
-setox IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
-L2 DC.L $3FDC0000,$82E30865,$4361C4C6,$00000000
-
-EXPA3 DC.L $3FA55555,$55554431
-EXPA2 DC.L $3FC55555,$55554018
-
-HUGE DC.L $7FFE0000,$FFFFFFFF,$FFFFFFFF,$00000000
-TINY DC.L $00010000,$FFFFFFFF,$FFFFFFFF,$00000000
-
-EM1A4 DC.L $3F811111,$11174385
-EM1A3 DC.L $3FA55555,$55554F5A
-
-EM1A2 DC.L $3FC55555,$55555555,$00000000,$00000000
-
-EM1B8 DC.L $3EC71DE3,$A5774682
-EM1B7 DC.L $3EFA01A0,$19D7CB68
-
-EM1B6 DC.L $3F2A01A0,$1A019DF3
-EM1B5 DC.L $3F56C16C,$16C170E2
-
-EM1B4 DC.L $3F811111,$11111111
-EM1B3 DC.L $3FA55555,$55555555
-
-EM1B2 DC.L $3FFC0000,$AAAAAAAA,$AAAAAAAB
- DC.L $00000000
-
-TWO140 DC.L $48B00000,$00000000
-TWON140 DC.L $37300000,$00000000
-
-EXPTBL
- DC.L $3FFF0000,$80000000,$00000000,$00000000
- DC.L $3FFF0000,$8164D1F3,$BC030774,$9F841A9B
- DC.L $3FFF0000,$82CD8698,$AC2BA1D8,$9FC1D5B9
- DC.L $3FFF0000,$843A28C3,$ACDE4048,$A0728369
- DC.L $3FFF0000,$85AAC367,$CC487B14,$1FC5C95C
- DC.L $3FFF0000,$871F6196,$9E8D1010,$1EE85C9F
- DC.L $3FFF0000,$88980E80,$92DA8528,$9FA20729
- DC.L $3FFF0000,$8A14D575,$496EFD9C,$A07BF9AF
- DC.L $3FFF0000,$8B95C1E3,$EA8BD6E8,$A0020DCF
- DC.L $3FFF0000,$8D1ADF5B,$7E5BA9E4,$205A63DA
- DC.L $3FFF0000,$8EA4398B,$45CD53C0,$1EB70051
- DC.L $3FFF0000,$9031DC43,$1466B1DC,$1F6EB029
- DC.L $3FFF0000,$91C3D373,$AB11C338,$A0781494
- DC.L $3FFF0000,$935A2B2F,$13E6E92C,$9EB319B0
- DC.L $3FFF0000,$94F4EFA8,$FEF70960,$2017457D
- DC.L $3FFF0000,$96942D37,$20185A00,$1F11D537
- DC.L $3FFF0000,$9837F051,$8DB8A970,$9FB952DD
- DC.L $3FFF0000,$99E04593,$20B7FA64,$1FE43087
- DC.L $3FFF0000,$9B8D39B9,$D54E5538,$1FA2A818
- DC.L $3FFF0000,$9D3ED9A7,$2CFFB750,$1FDE494D
- DC.L $3FFF0000,$9EF53260,$91A111AC,$20504890
- DC.L $3FFF0000,$A0B0510F,$B9714FC4,$A073691C
- DC.L $3FFF0000,$A2704303,$0C496818,$1F9B7A05
- DC.L $3FFF0000,$A43515AE,$09E680A0,$A0797126
- DC.L $3FFF0000,$A5FED6A9,$B15138EC,$A071A140
- DC.L $3FFF0000,$A7CD93B4,$E9653568,$204F62DA
- DC.L $3FFF0000,$A9A15AB4,$EA7C0EF8,$1F283C4A
- DC.L $3FFF0000,$AB7A39B5,$A93ED338,$9F9A7FDC
- DC.L $3FFF0000,$AD583EEA,$42A14AC8,$A05B3FAC
- DC.L $3FFF0000,$AF3B78AD,$690A4374,$1FDF2610
- DC.L $3FFF0000,$B123F581,$D2AC2590,$9F705F90
- DC.L $3FFF0000,$B311C412,$A9112488,$201F678A
- DC.L $3FFF0000,$B504F333,$F9DE6484,$1F32FB13
- DC.L $3FFF0000,$B6FD91E3,$28D17790,$20038B30
- DC.L $3FFF0000,$B8FBAF47,$62FB9EE8,$200DC3CC
- DC.L $3FFF0000,$BAFF5AB2,$133E45FC,$9F8B2AE6
- DC.L $3FFF0000,$BD08A39F,$580C36C0,$A02BBF70
- DC.L $3FFF0000,$BF1799B6,$7A731084,$A00BF518
- DC.L $3FFF0000,$C12C4CCA,$66709458,$A041DD41
- DC.L $3FFF0000,$C346CCDA,$24976408,$9FDF137B
- DC.L $3FFF0000,$C5672A11,$5506DADC,$201F1568
- DC.L $3FFF0000,$C78D74C8,$ABB9B15C,$1FC13A2E
- DC.L $3FFF0000,$C9B9BD86,$6E2F27A4,$A03F8F03
- DC.L $3FFF0000,$CBEC14FE,$F2727C5C,$1FF4907D
- DC.L $3FFF0000,$CE248C15,$1F8480E4,$9E6E53E4
- DC.L $3FFF0000,$D06333DA,$EF2B2594,$1FD6D45C
- DC.L $3FFF0000,$D2A81D91,$F12AE45C,$A076EDB9
- DC.L $3FFF0000,$D4F35AAB,$CFEDFA20,$9FA6DE21
- DC.L $3FFF0000,$D744FCCA,$D69D6AF4,$1EE69A2F
- DC.L $3FFF0000,$D99D15C2,$78AFD7B4,$207F439F
- DC.L $3FFF0000,$DBFBB797,$DAF23754,$201EC207
- DC.L $3FFF0000,$DE60F482,$5E0E9124,$9E8BE175
- DC.L $3FFF0000,$E0CCDEEC,$2A94E110,$20032C4B
- DC.L $3FFF0000,$E33F8972,$BE8A5A50,$2004DFF5
- DC.L $3FFF0000,$E5B906E7,$7C8348A8,$1E72F47A
- DC.L $3FFF0000,$E8396A50,$3C4BDC68,$1F722F22
- DC.L $3FFF0000,$EAC0C6E7,$DD243930,$A017E945
- DC.L $3FFF0000,$ED4F301E,$D9942B84,$1F401A5B
- DC.L $3FFF0000,$EFE4B99B,$DCDAF5CC,$9FB9A9E3
- DC.L $3FFF0000,$F281773C,$59FFB138,$20744C05
- DC.L $3FFF0000,$F5257D15,$2486CC2C,$1F773A19
- DC.L $3FFF0000,$F7D0DF73,$0AD13BB8,$1FFE90D5
- DC.L $3FFF0000,$FA83B2DB,$722A033C,$A041ED22
- DC.L $3FFF0000,$FD3E0C0C,$F486C174,$1F853F3A
-
-ADJFLAG equ L_SCR2
-SCALE equ FP_SCR1
-ADJSCALE equ FP_SCR2
-SC equ FP_SCR3
-ONEBYSC equ FP_SCR4
-
- xref t_frcinx
- xref t_extdnrm
- xref t_unfl
- xref t_ovfl
-
- xdef setoxd
-setoxd:
-*--entry point for EXP(X), X is denormalized
- MOVE.L (a0),d0
- ANDI.L #$80000000,d0
- ORI.L #$00800000,d0 ...sign(X)*2^(-126)
- MOVE.L d0,-(sp)
- FMOVE.S #:3F800000,fp0
- fmove.l d1,fpcr
- FADD.S (sp)+,fp0
- bra t_frcinx
-
- xdef setox
-setox:
-*--entry point for EXP(X), here X is finite, non-zero, and not NaN's
-
-*--Step 1.
- MOVE.L (a0),d0 ...load part of input X
- ANDI.L #$7FFF0000,d0 ...biased expo. of X
- CMPI.L #$3FBE0000,d0 ...2^(-65)
- BGE.B EXPC1 ...normal case
- BRA.W EXPSM
-
-EXPC1:
-*--The case |X| >= 2^(-65)
- MOVE.W 4(a0),d0 ...expo. and partial sig. of |X|
- CMPI.L #$400CB167,d0 ...16380 log2 trunc. 16 bits
- BLT.B EXPMAIN ...normal case
- BRA.W EXPBIG
-
-EXPMAIN:
-*--Step 2.
-*--This is the normal branch: 2^(-65) <= |X| < 16380 log2.
- FMOVE.X (a0),fp0 ...load input from (a0)
-
- FMOVE.X fp0,fp1
- FMUL.S #:42B8AA3B,fp0 ...64/log2 * X
- fmovem.x fp2/fp3,-(a7) ...save fp2
- CLR.L ADJFLAG(a6)
- FMOVE.L fp0,d0 ...N = int( X * 64/log2 )
- LEA EXPTBL,a1
- FMOVE.L d0,fp0 ...convert to floating-format
-
- MOVE.L d0,L_SCR1(a6) ...save N temporarily
- ANDI.L #$3F,d0 ...D0 is J = N mod 64
- LSL.L #4,d0
- ADDA.L d0,a1 ...address of 2^(J/64)
- MOVE.L L_SCR1(a6),d0
- ASR.L #6,d0 ...D0 is M
- ADDI.W #$3FFF,d0 ...biased expo. of 2^(M)
- MOVE.W L2,L_SCR1(a6) ...prefetch L2, no need in CB
-
-EXPCONT1:
-*--Step 3.
-*--fp1,fp2 saved on the stack. fp0 is N, fp1 is X,
-*--a0 points to 2^(J/64), D0 is biased expo. of 2^(M)
- FMOVE.X fp0,fp2
- FMUL.S #:BC317218,fp0 ...N * L1, L1 = lead(-log2/64)
- FMUL.X L2,fp2 ...N * L2, L1+L2 = -log2/64
- FADD.X fp1,fp0 ...X + N*L1
- FADD.X fp2,fp0 ...fp0 is R, reduced arg.
-* MOVE.W #$3FA5,EXPA3 ...load EXPA3 in cache
-
-*--Step 4.
-*--WE NOW COMPUTE EXP(R)-1 BY A POLYNOMIAL
-*-- R + R*R*(A1 + R*(A2 + R*(A3 + R*(A4 + R*A5))))
-*--TO FULLY UTILIZE THE PIPELINE, WE COMPUTE S = R*R
-*--[R+R*S*(A2+S*A4)] + [S*(A1+S*(A3+S*A5))]
-
- FMOVE.X fp0,fp1
- FMUL.X fp1,fp1 ...fp1 IS S = R*R
-
- FMOVE.S #:3AB60B70,fp2 ...fp2 IS A5
-* CLR.W 2(a1) ...load 2^(J/64) in cache
-
- FMUL.X fp1,fp2 ...fp2 IS S*A5
- FMOVE.X fp1,fp3
- FMUL.S #:3C088895,fp3 ...fp3 IS S*A4
-
- FADD.D EXPA3,fp2 ...fp2 IS A3+S*A5
- FADD.D EXPA2,fp3 ...fp3 IS A2+S*A4
-
- FMUL.X fp1,fp2 ...fp2 IS S*(A3+S*A5)
- MOVE.W d0,SCALE(a6) ...SCALE is 2^(M) in extended
- clr.w SCALE+2(a6)
- move.l #$80000000,SCALE+4(a6)
- clr.l SCALE+8(a6)
-
- FMUL.X fp1,fp3 ...fp3 IS S*(A2+S*A4)
-
- FADD.S #:3F000000,fp2 ...fp2 IS A1+S*(A3+S*A5)
- FMUL.X fp0,fp3 ...fp3 IS R*S*(A2+S*A4)
-
- FMUL.X fp1,fp2 ...fp2 IS S*(A1+S*(A3+S*A5))
- FADD.X fp3,fp0 ...fp0 IS R+R*S*(A2+S*A4),
-* ...fp3 released
-
- FMOVE.X (a1)+,fp1 ...fp1 is lead. pt. of 2^(J/64)
- FADD.X fp2,fp0 ...fp0 is EXP(R) - 1
-* ...fp2 released
-
-*--Step 5
-*--final reconstruction process
-*--EXP(X) = 2^M * ( 2^(J/64) + 2^(J/64)*(EXP(R)-1) )
-
- FMUL.X fp1,fp0 ...2^(J/64)*(Exp(R)-1)
- fmovem.x (a7)+,fp2/fp3 ...fp2 restored
- FADD.S (a1),fp0 ...accurate 2^(J/64)
-
- FADD.X fp1,fp0 ...2^(J/64) + 2^(J/64)*...
- MOVE.L ADJFLAG(a6),d0
-
-*--Step 6
- TST.L D0
- BEQ.B NORMAL
-ADJUST:
- FMUL.X ADJSCALE(a6),fp0
-NORMAL:
- FMOVE.L d1,FPCR ...restore user FPCR
- FMUL.X SCALE(a6),fp0 ...multiply 2^(M)
- bra t_frcinx
-
-EXPSM:
-*--Step 7
- FMOVEM.X (a0),fp0 ...in case X is denormalized
- FMOVE.L d1,FPCR
- FADD.S #:3F800000,fp0 ...1+X in user mode
- bra t_frcinx
-
-EXPBIG:
-*--Step 8
- CMPI.L #$400CB27C,d0 ...16480 log2
- BGT.B EXP2BIG
-*--Steps 8.2 -- 8.6
- FMOVE.X (a0),fp0 ...load input from (a0)
-
- FMOVE.X fp0,fp1
- FMUL.S #:42B8AA3B,fp0 ...64/log2 * X
- fmovem.x fp2/fp3,-(a7) ...save fp2
- MOVE.L #1,ADJFLAG(a6)
- FMOVE.L fp0,d0 ...N = int( X * 64/log2 )
- LEA EXPTBL,a1
- FMOVE.L d0,fp0 ...convert to floating-format
- MOVE.L d0,L_SCR1(a6) ...save N temporarily
- ANDI.L #$3F,d0 ...D0 is J = N mod 64
- LSL.L #4,d0
- ADDA.L d0,a1 ...address of 2^(J/64)
- MOVE.L L_SCR1(a6),d0
- ASR.L #6,d0 ...D0 is K
- MOVE.L d0,L_SCR1(a6) ...save K temporarily
- ASR.L #1,d0 ...D0 is M1
- SUB.L d0,L_SCR1(a6) ...a1 is M
- ADDI.W #$3FFF,d0 ...biased expo. of 2^(M1)
- MOVE.W d0,ADJSCALE(a6) ...ADJSCALE := 2^(M1)
- clr.w ADJSCALE+2(a6)
- move.l #$80000000,ADJSCALE+4(a6)
- clr.l ADJSCALE+8(a6)
- MOVE.L L_SCR1(a6),d0 ...D0 is M
- ADDI.W #$3FFF,d0 ...biased expo. of 2^(M)
- BRA.W EXPCONT1 ...go back to Step 3
-
-EXP2BIG:
-*--Step 9
- FMOVE.L d1,FPCR
- MOVE.L (a0),d0
- bclr.b #sign_bit,(a0) ...setox always returns positive
- TST.L d0
- BLT t_unfl
- BRA t_ovfl
-
- xdef setoxm1d
-setoxm1d:
-*--entry point for EXPM1(X), here X is denormalized
-*--Step 0.
- bra t_extdnrm
-
-
- xdef setoxm1
-setoxm1:
-*--entry point for EXPM1(X), here X is finite, non-zero, non-NaN
-
-*--Step 1.
-*--Step 1.1
- MOVE.L (a0),d0 ...load part of input X
- ANDI.L #$7FFF0000,d0 ...biased expo. of X
- CMPI.L #$3FFD0000,d0 ...1/4
- BGE.B EM1CON1 ...|X| >= 1/4
- BRA.W EM1SM
-
-EM1CON1:
-*--Step 1.3
-*--The case |X| >= 1/4
- MOVE.W 4(a0),d0 ...expo. and partial sig. of |X|
- CMPI.L #$4004C215,d0 ...70log2 rounded up to 16 bits
- BLE.B EM1MAIN ...1/4 <= |X| <= 70log2
- BRA.W EM1BIG
-
-EM1MAIN:
-*--Step 2.
-*--This is the case: 1/4 <= |X| <= 70 log2.
- FMOVE.X (a0),fp0 ...load input from (a0)
-
- FMOVE.X fp0,fp1
- FMUL.S #:42B8AA3B,fp0 ...64/log2 * X
- fmovem.x fp2/fp3,-(a7) ...save fp2
-* MOVE.W #$3F81,EM1A4 ...prefetch in CB mode
- FMOVE.L fp0,d0 ...N = int( X * 64/log2 )
- LEA EXPTBL,a1
- FMOVE.L d0,fp0 ...convert to floating-format
-
- MOVE.L d0,L_SCR1(a6) ...save N temporarily
- ANDI.L #$3F,d0 ...D0 is J = N mod 64
- LSL.L #4,d0
- ADDA.L d0,a1 ...address of 2^(J/64)
- MOVE.L L_SCR1(a6),d0
- ASR.L #6,d0 ...D0 is M
- MOVE.L d0,L_SCR1(a6) ...save a copy of M
-* MOVE.W #$3FDC,L2 ...prefetch L2 in CB mode
-
-*--Step 3.
-*--fp1,fp2 saved on the stack. fp0 is N, fp1 is X,
-*--a0 points to 2^(J/64), D0 and a1 both contain M
- FMOVE.X fp0,fp2
- FMUL.S #:BC317218,fp0 ...N * L1, L1 = lead(-log2/64)
- FMUL.X L2,fp2 ...N * L2, L1+L2 = -log2/64
- FADD.X fp1,fp0 ...X + N*L1
- FADD.X fp2,fp0 ...fp0 is R, reduced arg.
-* MOVE.W #$3FC5,EM1A2 ...load EM1A2 in cache
- ADDI.W #$3FFF,d0 ...D0 is biased expo. of 2^M
-
-*--Step 4.
-*--WE NOW COMPUTE EXP(R)-1 BY A POLYNOMIAL
-*-- R + R*R*(A1 + R*(A2 + R*(A3 + R*(A4 + R*(A5 + R*A6)))))
-*--TO FULLY UTILIZE THE PIPELINE, WE COMPUTE S = R*R
-*--[R*S*(A2+S*(A4+S*A6))] + [R+S*(A1+S*(A3+S*A5))]
-
- FMOVE.X fp0,fp1
- FMUL.X fp1,fp1 ...fp1 IS S = R*R
-
- FMOVE.S #:3950097B,fp2 ...fp2 IS a6
-* CLR.W 2(a1) ...load 2^(J/64) in cache
-
- FMUL.X fp1,fp2 ...fp2 IS S*A6
- FMOVE.X fp1,fp3
- FMUL.S #:3AB60B6A,fp3 ...fp3 IS S*A5
-
- FADD.D EM1A4,fp2 ...fp2 IS A4+S*A6
- FADD.D EM1A3,fp3 ...fp3 IS A3+S*A5
- MOVE.W d0,SC(a6) ...SC is 2^(M) in extended
- clr.w SC+2(a6)
- move.l #$80000000,SC+4(a6)
- clr.l SC+8(a6)
-
- FMUL.X fp1,fp2 ...fp2 IS S*(A4+S*A6)
- MOVE.L L_SCR1(a6),d0 ...D0 is M
- NEG.W D0 ...D0 is -M
- FMUL.X fp1,fp3 ...fp3 IS S*(A3+S*A5)
- ADDI.W #$3FFF,d0 ...biased expo. of 2^(-M)
- FADD.D EM1A2,fp2 ...fp2 IS A2+S*(A4+S*A6)
- FADD.S #:3F000000,fp3 ...fp3 IS A1+S*(A3+S*A5)
-
- FMUL.X fp1,fp2 ...fp2 IS S*(A2+S*(A4+S*A6))
- ORI.W #$8000,d0 ...signed/expo. of -2^(-M)
- MOVE.W d0,ONEBYSC(a6) ...OnebySc is -2^(-M)
- clr.w ONEBYSC+2(a6)
- move.l #$80000000,ONEBYSC+4(a6)
- clr.l ONEBYSC+8(a6)
- FMUL.X fp3,fp1 ...fp1 IS S*(A1+S*(A3+S*A5))
-* ...fp3 released
-
- FMUL.X fp0,fp2 ...fp2 IS R*S*(A2+S*(A4+S*A6))
- FADD.X fp1,fp0 ...fp0 IS R+S*(A1+S*(A3+S*A5))
-* ...fp1 released
-
- FADD.X fp2,fp0 ...fp0 IS EXP(R)-1
-* ...fp2 released
- fmovem.x (a7)+,fp2/fp3 ...fp2 restored
-
-*--Step 5
-*--Compute 2^(J/64)*p
-
- FMUL.X (a1),fp0 ...2^(J/64)*(Exp(R)-1)
-
-*--Step 6
-*--Step 6.1
- MOVE.L L_SCR1(a6),d0 ...retrieve M
- CMPI.L #63,d0
- BLE.B MLE63
-*--Step 6.2 M >= 64
- FMOVE.S 12(a1),fp1 ...fp1 is t
- FADD.X ONEBYSC(a6),fp1 ...fp1 is t+OnebySc
- FADD.X fp1,fp0 ...p+(t+OnebySc), fp1 released
- FADD.X (a1),fp0 ...T+(p+(t+OnebySc))
- BRA.B EM1SCALE
-MLE63:
-*--Step 6.3 M <= 63
- CMPI.L #-3,d0
- BGE.B MGEN3
-MLTN3:
-*--Step 6.4 M <= -4
- FADD.S 12(a1),fp0 ...p+t
- FADD.X (a1),fp0 ...T+(p+t)
- FADD.X ONEBYSC(a6),fp0 ...OnebySc + (T+(p+t))
- BRA.B EM1SCALE
-MGEN3:
-*--Step 6.5 -3 <= M <= 63
- FMOVE.X (a1)+,fp1 ...fp1 is T
- FADD.S (a1),fp0 ...fp0 is p+t
- FADD.X ONEBYSC(a6),fp1 ...fp1 is T+OnebySc
- FADD.X fp1,fp0 ...(T+OnebySc)+(p+t)
-
-EM1SCALE:
-*--Step 6.6
- FMOVE.L d1,FPCR
- FMUL.X SC(a6),fp0
-
- bra t_frcinx
-
-EM1SM:
-*--Step 7 |X| < 1/4.
- CMPI.L #$3FBE0000,d0 ...2^(-65)
- BGE.B EM1POLY
-
-EM1TINY:
-*--Step 8 |X| < 2^(-65)
- CMPI.L #$00330000,d0 ...2^(-16312)
- BLT.B EM12TINY
-*--Step 8.2
- MOVE.L #$80010000,SC(a6) ...SC is -2^(-16382)
- move.l #$80000000,SC+4(a6)
- clr.l SC+8(a6)
- FMOVE.X (a0),fp0
- FMOVE.L d1,FPCR
- FADD.X SC(a6),fp0
-
- bra t_frcinx
-
-EM12TINY:
-*--Step 8.3
- FMOVE.X (a0),fp0
- FMUL.D TWO140,fp0
- MOVE.L #$80010000,SC(a6)
- move.l #$80000000,SC+4(a6)
- clr.l SC+8(a6)
- FADD.X SC(a6),fp0
- FMOVE.L d1,FPCR
- FMUL.D TWON140,fp0
-
- bra t_frcinx
-
-EM1POLY:
-*--Step 9 exp(X)-1 by a simple polynomial
- FMOVE.X (a0),fp0 ...fp0 is X
- FMUL.X fp0,fp0 ...fp0 is S := X*X
- fmovem.x fp2/fp3,-(a7) ...save fp2
- FMOVE.S #:2F30CAA8,fp1 ...fp1 is B12
- FMUL.X fp0,fp1 ...fp1 is S*B12
- FMOVE.S #:310F8290,fp2 ...fp2 is B11
- FADD.S #:32D73220,fp1 ...fp1 is B10+S*B12
-
- FMUL.X fp0,fp2 ...fp2 is S*B11
- FMUL.X fp0,fp1 ...fp1 is S*(B10 + ...
-
- FADD.S #:3493F281,fp2 ...fp2 is B9+S*...
- FADD.D EM1B8,fp1 ...fp1 is B8+S*...
-
- FMUL.X fp0,fp2 ...fp2 is S*(B9+...
- FMUL.X fp0,fp1 ...fp1 is S*(B8+...
-
- FADD.D EM1B7,fp2 ...fp2 is B7+S*...
- FADD.D EM1B6,fp1 ...fp1 is B6+S*...
-
- FMUL.X fp0,fp2 ...fp2 is S*(B7+...
- FMUL.X fp0,fp1 ...fp1 is S*(B6+...
-
- FADD.D EM1B5,fp2 ...fp2 is B5+S*...
- FADD.D EM1B4,fp1 ...fp1 is B4+S*...
-
- FMUL.X fp0,fp2 ...fp2 is S*(B5+...
- FMUL.X fp0,fp1 ...fp1 is S*(B4+...
-
- FADD.D EM1B3,fp2 ...fp2 is B3+S*...
- FADD.X EM1B2,fp1 ...fp1 is B2+S*...
-
- FMUL.X fp0,fp2 ...fp2 is S*(B3+...
- FMUL.X fp0,fp1 ...fp1 is S*(B2+...
-
- FMUL.X fp0,fp2 ...fp2 is S*S*(B3+...)
- FMUL.X (a0),fp1 ...fp1 is X*S*(B2...
-
- FMUL.S #:3F000000,fp0 ...fp0 is S*B1
- FADD.X fp2,fp1 ...fp1 is Q
-* ...fp2 released
-
- fmovem.x (a7)+,fp2/fp3 ...fp2 restored
-
- FADD.X fp1,fp0 ...fp0 is S*B1+Q
-* ...fp1 released
-
- FMOVE.L d1,FPCR
- FADD.X (a0),fp0
-
- bra t_frcinx
-
-EM1BIG:
-*--Step 10 |X| > 70 log2
- MOVE.L (a0),d0
- TST.L d0
- BGT.W EXPC1
-*--Step 10.2
- FMOVE.S #:BF800000,fp0 ...fp0 is -1
- FMOVE.L d1,FPCR
- FADD.S #:00800000,fp0 ...-1 + 2^(-126)
-
- bra t_frcinx
-
- end
diff --git a/sys/arch/m68k/fpsp/sgetem.sa b/sys/arch/m68k/fpsp/sgetem.sa
deleted file mode 100644
index 9268321a89e..00000000000
--- a/sys/arch/m68k/fpsp/sgetem.sa
+++ /dev/null
@@ -1,167 +0,0 @@
-* $OpenBSD: sgetem.sa,v 1.2 1996/05/29 21:05:37 niklas Exp $
-* $NetBSD: sgetem.sa,v 1.2 1994/10/26 07:49:45 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* sgetem.sa 3.1 12/10/90
-*
-* The entry point sGETEXP returns the exponent portion
-* of the input argument. The exponent bias is removed
-* and the exponent value is returned as an extended
-* precision number in fp0. sGETEXPD handles denormalized
-* numbers.
-*
-* The entry point sGETMAN extracts the mantissa of the
-* input argument. The mantissa is converted to an
-* extended precision number and returned in fp0. The
-* range of the result is [1.0 - 2.0).
-*
-*
-* Input: Double-extended number X in the ETEMP space in
-* the floating-point save stack.
-*
-* Output: The functions return exp(X) or man(X) in fp0.
-*
-* Modified: fp0.
-*
-
-SGETEM IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
- xref nrm_set
-
-*
-* This entry point is used by the unimplemented instruction exception
-* handler. It points a0 to the input operand.
-*
-*
-*
-* SGETEXP
-*
-
- xdef sgetexp
-sgetexp:
- move.w LOCAL_EX(a0),d0 ;get the exponent
- bclr.l #15,d0 ;clear the sign bit
- sub.w #$3fff,d0 ;subtract off the bias
- fmove.w d0,fp0 ;move the exp to fp0
- rts
-
- xdef sgetexpd
-sgetexpd:
- bclr.b #sign_bit,LOCAL_EX(a0)
- bsr nrm_set ;normalize (exp will go negative)
- move.w LOCAL_EX(a0),d0 ;load resulting exponent into d0
- sub.w #$3fff,d0 ;subtract off the bias
- fmove.w d0,fp0 ;move the exp to fp0
- rts
-*
-*
-* This entry point is used by the unimplemented instruction exception
-* handler. It points a0 to the input operand.
-*
-*
-*
-* SGETMAN
-*
-*
-* For normalized numbers, leave the mantissa alone, simply load
-* with an exponent of +/- $3fff.
-*
- xdef sgetman
-sgetman:
- move.l USER_FPCR(a6),d0
- andi.l #$ffffff00,d0 ;clear rounding precision and mode
- fmove.l d0,fpcr ;this fpcr setting is used by the 882
- move.w LOCAL_EX(a0),d0 ;get the exp (really just want sign bit)
- or.w #$7fff,d0 ;clear old exp
- bclr.l #14,d0 ;make it the new exp +-3fff
- move.w d0,LOCAL_EX(a0) ;move the sign & exp back to fsave stack
- fmove.x (a0),fp0 ;put new value back in fp0
- rts
-
-*
-* For denormalized numbers, shift the mantissa until the j-bit = 1,
-* then load the exponent with +/1 $3fff.
-*
- xdef sgetmand
-sgetmand:
- move.l LOCAL_HI(a0),d0 ;load ms mant in d0
- move.l LOCAL_LO(a0),d1 ;load ls mant in d1
- bsr shft ;shift mantissa bits till msbit is set
- move.l d0,LOCAL_HI(a0) ;put ms mant back on stack
- move.l d1,LOCAL_LO(a0) ;put ls mant back on stack
- bra.b sgetman
-
-*
-* SHFT
-*
-* Shifts the mantissa bits until msbit is set.
-* input:
-* ms mantissa part in d0
-* ls mantissa part in d1
-* output:
-* shifted bits in d0 and d1
-shft:
- tst.l d0 ;if any bits set in ms mant
- bne.b upper ;then branch
-* ;else no bits set in ms mant
- tst.l d1 ;test if any bits set in ls mant
- bne.b cont ;if set then continue
- bra.b shft_end ;else return
-cont:
- move.l d3,-(a7) ;save d3
- exg d0,d1 ;shift ls mant to ms mant
- bfffo d0{0:32},d3 ;find first 1 in ls mant to d0
- lsl.l d3,d0 ;shift first 1 to integer bit in ms mant
- move.l (a7)+,d3 ;restore d3
- bra.b shft_end
-upper:
-
- movem.l d3/d5/d6,-(a7) ;save registers
- bfffo d0{0:32},d3 ;find first 1 in ls mant to d0
- lsl.l d3,d0 ;shift ms mant until j-bit is set
- move.l d1,d6 ;save ls mant in d6
- lsl.l d3,d1 ;shift ls mant by count
- move.l #32,d5
- sub.l d3,d5 ;sub 32 from shift for ls mant
- lsr.l d5,d6 ;shift off all bits but those that will
-* ;be shifted into ms mant
- or.l d6,d0 ;shift the ls mant bits into the ms mant
- movem.l (a7)+,d3/d5/d6 ;restore registers
-shft_end:
- rts
-
- end
diff --git a/sys/arch/m68k/fpsp/sint.sa b/sys/arch/m68k/fpsp/sint.sa
deleted file mode 100644
index 19a96c2dce3..00000000000
--- a/sys/arch/m68k/fpsp/sint.sa
+++ /dev/null
@@ -1,273 +0,0 @@
-* $OpenBSD: sint.sa,v 1.2 1996/05/29 21:05:38 niklas Exp $
-* $NetBSD: sint.sa,v 1.2 1994/10/26 07:49:48 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* sint.sa 3.1 12/10/90
-*
-* The entry point sINT computes the rounded integer
-* equivalent of the input argument, sINTRZ computes
-* the integer rounded to zero of the input argument.
-*
-* Entry points sint and sintrz are called from do_func
-* to emulate the fint and fintrz unimplemented instructions,
-* respectively. Entry point sintdo is used by bindec.
-*
-* Input: (Entry points sint and sintrz) Double-extended
-* number X in the ETEMP space in the floating-point
-* save stack.
-* (Entry point sintdo) Double-extended number X in
-* location pointed to by the address register a0.
-* (Entry point sintd) Double-extended denormalized
-* number X in the ETEMP space in the floating-point
-* save stack.
-*
-* Output: The function returns int(X) or intrz(X) in fp0.
-*
-* Modifies: fp0.
-*
-* Algorithm: (sint and sintrz)
-*
-* 1. If exp(X) >= 63, return X.
-* If exp(X) < 0, return +/- 0 or +/- 1, according to
-* the rounding mode.
-*
-* 2. (X is in range) set rsc = 63 - exp(X). Unnormalize the
-* result to the exponent $403e.
-*
-* 3. Round the result in the mode given in USER_FPCR. For
-* sintrz, force round-to-zero mode.
-*
-* 4. Normalize the rounded result; store in fp0.
-*
-* For the denormalized cases, force the correct result
-* for the given sign and rounding mode.
-*
-* Sign(X)
-* RMODE + -
-* ----- --------
-* RN +0 -0
-* RZ +0 -0
-* RM +0 -1
-* RP +1 -0
-*
-
-SINT IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
- xref dnrm_lp
- xref nrm_set
- xref round
- xref t_inx2
- xref ld_pone
- xref ld_mone
- xref ld_pzero
- xref ld_mzero
- xref snzrinx
-
-*
-* FINT
-*
- xdef sint
-sint:
- bfextu FPCR_MODE(a6){2:2},d1 ;use user's mode for rounding
-* ;implicity has extend precision
-* ;in upper word.
- move.l d1,L_SCR1(a6) ;save mode bits
- bra.b sintexc
-
-*
-* FINT with extended denorm inputs.
-*
- xdef sintd
-sintd:
- btst.b #5,FPCR_MODE(a6)
- beq snzrinx ;if round nearest or round zero, +/- 0
- btst.b #4,FPCR_MODE(a6)
- beq.b rnd_mns
-rnd_pls:
- btst.b #sign_bit,LOCAL_EX(a0)
- bne.b sintmz
- bsr ld_pone ;if round plus inf and pos, answer is +1
- bra t_inx2
-rnd_mns:
- btst.b #sign_bit,LOCAL_EX(a0)
- beq.b sintpz
- bsr ld_mone ;if round mns inf and neg, answer is -1
- bra t_inx2
-sintpz:
- bsr ld_pzero
- bra t_inx2
-sintmz:
- bsr ld_mzero
- bra t_inx2
-
-*
-* FINTRZ
-*
- xdef sintrz
-sintrz:
- move.l #1,L_SCR1(a6) ;use rz mode for rounding
-* ;implicity has extend precision
-* ;in upper word.
- bra.b sintexc
-*
-* SINTDO
-*
-* Input: a0 points to an IEEE extended format operand
-* Output: fp0 has the result
-*
-* Exeptions:
-*
-* If the subroutine results in an inexact operation, the inx2 and
-* ainx bits in the USER_FPSR are set.
-*
-*
- xdef sintdo
-sintdo:
- bfextu FPCR_MODE(a6){2:2},d1 ;use user's mode for rounding
-* ;implicitly has ext precision
-* ;in upper word.
- move.l d1,L_SCR1(a6) ;save mode bits
-*
-* Real work of sint is in sintexc
-*
-sintexc:
- bclr.b #sign_bit,LOCAL_EX(a0) ;convert to internal extended
-* ;format
- sne LOCAL_SGN(a0)
- cmp.w #$403e,LOCAL_EX(a0) ;check if (unbiased) exp > 63
- bgt.b out_rnge ;branch if exp < 63
- cmp.w #$3ffd,LOCAL_EX(a0) ;check if (unbiased) exp < 0
- bgt.w in_rnge ;if 63 >= exp > 0, do calc
-*
-* Input is less than zero. Restore sign, and check for directed
-* rounding modes. L_SCR1 contains the rmode in the lower byte.
-*
-un_rnge:
- btst.b #1,L_SCR1+3(a6) ;check for rn and rz
- beq.b un_rnrz
- tst.b LOCAL_SGN(a0) ;check for sign
- bne.b un_rmrp_neg
-*
-* Sign is +. If rp, load +1.0, if rm, load +0.0
-*
- cmpi.b #3,L_SCR1+3(a6) ;check for rp
- beq.b un_ldpone ;if rp, load +1.0
- bsr ld_pzero ;if rm, load +0.0
- bra t_inx2
-un_ldpone:
- bsr ld_pone
- bra t_inx2
-*
-* Sign is -. If rm, load -1.0, if rp, load -0.0
-*
-un_rmrp_neg:
- cmpi.b #2,L_SCR1+3(a6) ;check for rm
- beq.b un_ldmone ;if rm, load -1.0
- bsr ld_mzero ;if rp, load -0.0
- bra t_inx2
-un_ldmone:
- bsr ld_mone
- bra t_inx2
-*
-* Rmode is rn or rz; return signed zero
-*
-un_rnrz:
- tst.b LOCAL_SGN(a0) ;check for sign
- bne.b un_rnrz_neg
- bsr ld_pzero
- bra t_inx2
-un_rnrz_neg:
- bsr ld_mzero
- bra t_inx2
-
-*
-* Input is greater than 2^63. All bits are significant. Return
-* the input.
-*
-out_rnge:
- bfclr LOCAL_SGN(a0){0:8} ;change back to IEEE ext format
- beq.b intps
- bset.b #sign_bit,LOCAL_EX(a0)
-intps:
- fmove.l fpcr,-(sp)
- fmove.l #0,fpcr
- fmove.x LOCAL_EX(a0),fp0 ;if exp > 63
-* ;then return X to the user
-* ;there are no fraction bits
- fmove.l (sp)+,fpcr
- rts
-
-in_rnge:
-* ;shift off fraction bits
- clr.l d0 ;clear d0 - initial g,r,s for
-* ;dnrm_lp
- move.l #$403e,d1 ;set threshold for dnrm_lp
-* ;assumes a0 points to operand
- bsr dnrm_lp
-* ;returns unnormalized number
-* ;pointed by a0
-* ;output d0 supplies g,r,s
-* ;used by round
- move.l L_SCR1(a6),d1 ;use selected rounding mode
-*
-*
- bsr round ;round the unnorm based on users
-* ;input a0 ptr to ext X
-* ; d0 g,r,s bits
-* ; d1 PREC/MODE info
-* ;output a0 ptr to rounded result
-* ;inexact flag set in USER_FPSR
-* ;if initial grs set
-*
-* normalize the rounded result and store value in fp0
-*
- bsr nrm_set ;normalize the unnorm
-* ;Input: a0 points to operand to
-* ;be normalized
-* ;Output: a0 points to normalized
-* ;result
- bfclr LOCAL_SGN(a0){0:8}
- beq.b nrmrndp
- bset.b #sign_bit,LOCAL_EX(a0) ;return to IEEE extended format
-nrmrndp:
- fmove.l fpcr,-(sp)
- fmove.l #0,fpcr
- fmove.x LOCAL_EX(a0),fp0 ;move result to fp0
- fmove.l (sp)+,fpcr
- rts
-
- end
diff --git a/sys/arch/m68k/fpsp/skeleton.sa b/sys/arch/m68k/fpsp/skeleton.sa
deleted file mode 100644
index 322830b05de..00000000000
--- a/sys/arch/m68k/fpsp/skeleton.sa
+++ /dev/null
@@ -1,483 +0,0 @@
-* $OpenBSD: skeleton.sa,v 1.3 2001/09/20 17:02:30 mpech Exp $
-* $NetBSD: skeleton.sa,v 1.3 1994/10/26 07:49:50 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* skeleton.sa 3.2 4/26/91
-*
-* This file contains code that is system dependent and will
-* need to be modified to install the FPSP.
-*
-* Each entry point for exception 'xxxx' begins with a 'jmp fpsp_xxxx'.
-* Put any target system specific handling that must be done immediately
-* before the jump instruction. If there no handling necessary, then
-* the 'fpsp_xxxx' handler entry point should be placed in the exception
-* table so that the 'jmp' can be eliminated. If the FPSP determines that the
-* exception is one that must be reported then there will be a
-* return from the package by a 'jmp real_xxxx'. At that point
-* the machine state will be identical to the state before
-* the FPSP was entered. In particular, whatever condition
-* that caused the exception will still be pending when the FPSP
-* package returns. Thus, there will be system specific code
-* to handle the exception.
-*
-* If the exception was completely handled by the package, then
-* the return will be via a 'jmp fpsp_done'. Unless there is
-* OS specific work to be done (such as handling a context switch or
-* interrupt) the user program can be resumed via 'rte'.
-*
-* In the following skeleton code, some typical 'real_xxxx' handling
-* code is shown. This code may need to be moved to an appropriate
-* place in the target system, or rewritten.
-*
-
-SKELETON IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 15
-*
-* The following counters are used for standalone testing
-*
-sigunimp dc.l 0
-sigbsun dc.l 0
-siginex dc.l 0
-sigdz dc.l 0
-sigunfl dc.l 0
-sigovfl dc.l 0
-sigoperr dc.l 0
-sigsnan dc.l 0
-sigunsupp dc.l 0
-
- section 8
-
- include fpsp.h
-
- xref b1238_fix
-
-*
-* Divide by Zero exception
-*
-* All dz exceptions are 'real', hence no fpsp_dz entry point.
-*
- xdef dz
- xdef real_dz
-dz:
-real_dz:
- link a6,#-LOCAL_SIZE
- fsave -(sp)
- bclr.b #E1,E_BYTE(a6)
- frestore (sp)+
- unlk a6
-
- add.l #1,sigdz ;for standalone testing
-
- rte
-*
-* Inexact exception
-*
-* All inexact exceptions are real, but the 'real' handler
-* will probably want to clear the pending exception.
-* The provided code will clear the E3 exception (if pending),
-* otherwise clear the E1 exception. The frestore is not really
-* necessary for E1 exceptions.
-*
-* Code following the 'inex' label is to handle bug #1232. In this
-* bug, if an E1 snan, ovfl, or unfl occurred, and the process was
-* swapped out before taking the exception, the exception taken on
-* return was inex, rather than the correct exception. The snan, ovfl,
-* and unfl exception to be taken must not have been enabled. The
-* fix is to check for E1, and the existence of one of snan, ovfl,
-* or unfl bits set in the fpsr. If any of these are set, branch
-* to the appropriate handler for the exception in the fpsr. Note
-* that this fix is only for d43b parts, and is skipped if the
-* version number is not $40.
-*
-*
- xdef real_inex
- xdef inex
-inex:
- link a6,#-LOCAL_SIZE
- fsave -(sp)
- cmpi.b #VER_40,(sp) ;test version number
- bne.b not_fmt40
- fmove.l fpsr,-(sp)
- btst.b #E1,E_BYTE(a6) ;test for E1 set
- beq.b not_b1232
- btst.b #snan_bit,2(sp) ;test for snan
- beq inex_ckofl
- add.l #4,sp
- frestore (sp)+
- unlk a6
- bra snan
-inex_ckofl:
- btst.b #ovfl_bit,2(sp) ;test for ovfl
- beq inex_ckufl
- add.l #4,sp
- frestore (sp)+
- unlk a6
- bra ovfl
-inex_ckufl:
- btst.b #unfl_bit,2(sp) ;test for unfl
- beq not_b1232
- add.l #4,sp
- frestore (sp)+
- unlk a6
- bra unfl
-
-*
-* We do not have the bug 1232 case. Clean up the stack and call
-* real_inex.
-*
-not_b1232:
- add.l #4,sp
- frestore (sp)+
- unlk a6
-
-real_inex:
-
- add.l #1,siginex ;for standalone testing
-
- link a6,#-LOCAL_SIZE
- fsave -(sp)
-not_fmt40:
- bclr.b #E3,E_BYTE(a6) ;clear and test E3 flag
- beq.b inex_cke1
-*
-* Clear dirty bit on dest resister in the frame before branching
-* to b1238_fix.
-*
- movem.l d0/d1,USER_DA(a6)
- bfextu CMDREG1B(a6){6:3},d0 ;get dest reg no
- bclr.b d0,FPR_DIRTY_BITS(a6) ;clr dest dirty bit
- bsr.l b1238_fix ;test for bug1238 case
- movem.l USER_DA(a6),d0/d1
- bra.b inex_done
-inex_cke1:
- bclr.b #E1,E_BYTE(a6)
-inex_done:
- frestore (sp)+
- unlk a6
- rte
-
-*
-* Overflow exception
-*
- xref fpsp_ovfl
- xdef real_ovfl
- xdef ovfl
-ovfl:
- jmp fpsp_ovfl
-real_ovfl:
-
- add.l #1,sigovfl ;for standalone testing
-
- link a6,#-LOCAL_SIZE
- fsave -(sp)
- bclr.b #E3,E_BYTE(a6) ;clear and test E3 flag
- bne.b ovfl_done
- bclr.b #E1,E_BYTE(a6)
-ovfl_done:
- frestore (sp)+
- unlk a6
- rte
-
-*
-* Underflow exception
-*
- xref fpsp_unfl
- xdef real_unfl
- xdef unfl
-unfl:
- jmp fpsp_unfl
-real_unfl:
-
- add.l #1,sigunfl ;for standalone testing
-
- link a6,#-LOCAL_SIZE
- fsave -(sp)
- bclr.b #E3,E_BYTE(a6) ;clear and test E3 flag
- bne.b unfl_done
- bclr.b #E1,E_BYTE(a6)
-unfl_done:
- frestore (sp)+
- unlk a6
- rte
-
-*
-* Signalling NAN exception
-*
- xref fpsp_snan
- xdef real_snan
- xdef snan
-snan:
- jmp fpsp_snan
-real_snan:
- link a6,#-LOCAL_SIZE
- fsave -(sp)
- bclr.b #E1,E_BYTE(a6) ;snan is always an E1 exception
- frestore (sp)+
- unlk a6
-
- add.l #1,sigsnan ;for standalone testing
- rte
-
-*
-* Operand Error exception
-*
- xref fpsp_operr
- xdef real_operr
- xdef operr
-operr:
- jmp fpsp_operr
-real_operr:
- link a6,#-LOCAL_SIZE
- fsave -(sp)
- bclr.b #E1,E_BYTE(a6) ;operr is always an E1 exception
- frestore (sp)+
- unlk a6
-
- add.l #1,sigoperr ;for standalone testing
-
- rte
-
-*
-* BSUN exception
-*
-* This sample handler simply clears the nan bit in the FPSR.
-*
- xref fpsp_bsun
- xdef real_bsun
- xdef bsun
-bsun:
- jmp fpsp_bsun
-real_bsun:
- link a6,#-LOCAL_SIZE
- fsave -(sp)
- bclr.b #E1,E_BYTE(a6) ;bsun is always an E1 exception
- fmove.l FPSR,-(sp)
- bclr.b #nan_bit,(sp)
- fmove.l (sp)+,FPSR
- frestore (sp)+
- unlk a6
-
- add.l #1,sigbsun ;for standalone testing
-
- rte
-
-*
-* F-line exception
-*
-* A 'real' F-line exception is one that the FPSP isn't supposed to
-* handle. E.g. an instruction with a co-processor ID that is not 1.
-*
-*
- xref fpsp_fline
- xdef real_fline
- xdef fline
-fline:
- jmp fpsp_fline
-real_fline:
-
- add.l #1,sigunimp ;for standalone testing
-
- rte
-
-*
-* Unsupported data type exception
-*
- xref fpsp_unsupp
- xdef real_unsupp
- xdef unsupp
-unsupp:
- jmp fpsp_unsupp
-real_unsupp:
- link a6,#-LOCAL_SIZE
- fsave -(sp)
- bclr.b #E1,E_BYTE(a6) ;unsupp is always an E1 exception
- frestore (sp)+
- unlk a6
-
- add.l #1,sigunsupp ;for standalone testing
-
- rte
-
-*
-* Trace exception
-*
- xdef real_trace
-real_trace:
- rte
-
-*
-* fpsp_fmt_error --- exit point for frame format error
-*
-* The fpu stack frame does not match the frames existing
-* or planned at the time of this writing. The fpsp is
-* unable to handle frame sizes not in the following
-* version:size pairs:
-*
-* {4060, 4160} - busy frame
-* {4028, 4130} - unimp frame
-* {4000, 4100} - idle frame
-*
-* This entry point simply holds an f-line illegal value.
-* Replace this with a call to your kernel panic code or
-* code to handle future revisions of the fpu.
-*
- xdef fpsp_fmt_error
-fpsp_fmt_error:
-
- dc.l $f27f0000 ;f-line illegal
-
-*
-* fpsp_done --- FPSP exit point
-*
-* The exception has been handled by the package and we are ready
-* to return to user mode, but there may be OS specific code
-* to execute before we do. If there is, do it now.
-*
-*
- xdef fpsp_done
-fpsp_done:
- rte
-
-*
-* mem_write --- write to user or supervisor address space
-*
-* Writes to memory while in supervisor mode. copyout accomplishes
-* this via a 'moves' instruction. copyout is a UNIX SVR3 (and later) function.
-* If you don't have copyout, use the local copy of the function below.
-*
-* a0 - supervisor source address
-* a1 - user destination address
-* d0 - number of bytes to write (maximum count is 12)
-*
-* The supervisor source address is guaranteed to point into the supervisor
-* stack. The result is that a UNIX
-* process is allowed to sleep as a consequence of a page fault during
-* copyout. The probability of a page fault is exceedingly small because
-* the 68040 always reads the destination address and thus the page
-* faults should have already been handled.
-*
-* If the EXC_SR shows that the exception was from supervisor space,
-* then just do a dumb (and slow) memory move. In a UNIX environment
-* there shouldn't be any supervisor mode floating point exceptions.
-*
- xdef mem_write
-mem_write:
- btst.b #5,EXC_SR(a6) ;check for supervisor state
- beq.b user_write
-super_write:
- move.b (a0)+,(a1)+
- subq.l #1,d0
- bne.b super_write
- rts
-user_write:
- move.l d1,-(sp) ;preserve d1 just in case
- move.l d0,-(sp)
- move.l a1,-(sp)
- move.l a0,-(sp)
- jsr copyout
- add.l #12,sp
- move.l (sp)+,d1
- rts
-*
-* mem_read --- read from user or supervisor address space
-*
-* Reads from memory while in supervisor mode. copyin accomplishes
-* this via a 'moves' instruction. copyin is a UNIX SVR3 (and later) function.
-* If you don't have copyin, use the local copy of the function below.
-*
-* The FPSP calls mem_read to read the original F-line instruction in order
-* to extract the data register number when the 'Dn' addressing mode is
-* used.
-*
-*Input:
-* a0 - user source address
-* a1 - supervisor destination address
-* d0 - number of bytes to read (maximum count is 12)
-*
-* Like mem_write, mem_read always reads with a supervisor
-* destination address on the supervisor stack. Also like mem_write,
-* the EXC_SR is checked and a simple memory copy is done if reading
-* from supervisor space is indicated.
-*
- xdef mem_read
-mem_read:
- btst.b #5,EXC_SR(a6) ;check for supervisor state
- beq.b user_read
-super_read:
- move.b (a0)+,(a1)+
- subq.l #1,d0
- bne.b super_read
- rts
-user_read:
- move.l d1,-(sp) ;preserve d1 just in case
- move.l d0,-(sp)
- move.l a1,-(sp)
- move.l a0,-(sp)
- jsr copyin
- add.l #12,sp
- move.l (sp)+,d1
- rts
-
-*
-* Use these routines if your kernel doesn't have copyout/copyin equivalents.
-* Assumes that D0/D1/A0/A1 are scratch registers. copyout overwrites DFC,
-* and copyin overwrites SFC.
-*
-copyout:
- move.l 4(sp),a0 ; source
- move.l 8(sp),a1 ; destination
- move.l 12(sp),d0 ; count
- sub.l #1,d0 ; dec count by 1 for dbra
- move.l #1,d1
- movec d1,DFC ; set dfc for user data space
-moreout:
- move.b (a0)+,d1 ; fetch supervisor byte
- moves.b d1,(a1)+ ; write user byte
- dbf.w d0,moreout
- rts
-
-copyin:
- move.l 4(sp),a0 ; source
- move.l 8(sp),a1 ; destination
- move.l 12(sp),d0 ; count
- sub.l #1,d0 ; dec count by 1 for dbra
- move.l #1,d1
- movec d1,SFC ; set sfc for user space
-morein:
- moves.b (a0)+,d1 ; fetch user byte
- move.b d1,(a1)+ ; write supervisor byte
- dbf.w d0,morein
- rts
-
- end
diff --git a/sys/arch/m68k/fpsp/slog2.sa b/sys/arch/m68k/fpsp/slog2.sa
deleted file mode 100644
index 4153978e6bb..00000000000
--- a/sys/arch/m68k/fpsp/slog2.sa
+++ /dev/null
@@ -1,214 +0,0 @@
-* $OpenBSD: slog2.sa,v 1.2 1996/05/29 21:05:39 niklas Exp $
-* $NetBSD: slog2.sa,v 1.2 1994/10/26 07:49:52 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* slog2.sa 3.1 12/10/90
-*
-* The entry point slog10 computes the base-10
-* logarithm of an input argument X.
-* slog10d does the same except the input value is a
-* denormalized number.
-* sLog2 and sLog2d are the base-2 analogues.
-*
-* INPUT: Double-extended value in memory location pointed to
-* by address register a0.
-*
-* OUTPUT: log_10(X) or log_2(X) returned in floating-point
-* register fp0.
-*
-* ACCURACY and MONOTONICITY: The returned result is within 1.7
-* ulps in 64 significant bit, i.e. within 0.5003 ulp
-* to 53 bits if the result is subsequently rounded
-* to double precision. The result is provably monotonic
-* in double precision.
-*
-* SPEED: Two timings are measured, both in the copy-back mode.
-* The first one is measured when the function is invoked
-* the first time (so the instructions and data are not
-* in cache), and the second one is measured when the
-* function is reinvoked at the same input argument.
-*
-* ALGORITHM and IMPLEMENTATION NOTES:
-*
-* slog10d:
-*
-* Step 0. If X < 0, create a NaN and raise the invalid operation
-* flag. Otherwise, save FPCR in D1; set FpCR to default.
-* Notes: Default means round-to-nearest mode, no floating-point
-* traps, and precision control = double extended.
-*
-* Step 1. Call slognd to obtain Y = log(X), the natural log of X.
-* Notes: Even if X is denormalized, log(X) is always normalized.
-*
-* Step 2. Compute log_10(X) = log(X) * (1/log(10)).
-* 2.1 Restore the user FPCR
-* 2.2 Return ans := Y * INV_L10.
-*
-*
-* slog10:
-*
-* Step 0. If X < 0, create a NaN and raise the invalid operation
-* flag. Otherwise, save FPCR in D1; set FpCR to default.
-* Notes: Default means round-to-nearest mode, no floating-point
-* traps, and precision control = double extended.
-*
-* Step 1. Call sLogN to obtain Y = log(X), the natural log of X.
-*
-* Step 2. Compute log_10(X) = log(X) * (1/log(10)).
-* 2.1 Restore the user FPCR
-* 2.2 Return ans := Y * INV_L10.
-*
-*
-* sLog2d:
-*
-* Step 0. If X < 0, create a NaN and raise the invalid operation
-* flag. Otherwise, save FPCR in D1; set FpCR to default.
-* Notes: Default means round-to-nearest mode, no floating-point
-* traps, and precision control = double extended.
-*
-* Step 1. Call slognd to obtain Y = log(X), the natural log of X.
-* Notes: Even if X is denormalized, log(X) is always normalized.
-*
-* Step 2. Compute log_10(X) = log(X) * (1/log(2)).
-* 2.1 Restore the user FPCR
-* 2.2 Return ans := Y * INV_L2.
-*
-*
-* sLog2:
-*
-* Step 0. If X < 0, create a NaN and raise the invalid operation
-* flag. Otherwise, save FPCR in D1; set FpCR to default.
-* Notes: Default means round-to-nearest mode, no floating-point
-* traps, and precision control = double extended.
-*
-* Step 1. If X is not an integer power of two, i.e., X != 2^k,
-* go to Step 3.
-*
-* Step 2. Return k.
-* 2.1 Get integer k, X = 2^k.
-* 2.2 Restore the user FPCR.
-* 2.3 Return ans := convert-to-double-extended(k).
-*
-* Step 3. Call sLogN to obtain Y = log(X), the natural log of X.
-*
-* Step 4. Compute log_2(X) = log(X) * (1/log(2)).
-* 4.1 Restore the user FPCR
-* 4.2 Return ans := Y * INV_L2.
-*
-
-SLOG2 IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- xref t_frcinx
- xref t_operr
- xref slogn
- xref slognd
-
-INV_L10 DC.L $3FFD0000,$DE5BD8A9,$37287195,$00000000
-
-INV_L2 DC.L $3FFF0000,$B8AA3B29,$5C17F0BC,$00000000
-
- xdef slog10d
-slog10d:
-*--entry point for Log10(X), X is denormalized
- move.l (a0),d0
- blt.w invalid
- move.l d1,-(sp)
- clr.l d1
- bsr slognd ...log(X), X denorm.
- fmove.l (sp)+,fpcr
- fmul.x INV_L10,fp0
- bra t_frcinx
-
- xdef slog10
-slog10:
-*--entry point for Log10(X), X is normalized
-
- move.l (a0),d0
- blt.w invalid
- move.l d1,-(sp)
- clr.l d1
- bsr slogn ...log(X), X normal.
- fmove.l (sp)+,fpcr
- fmul.x INV_L10,fp0
- bra t_frcinx
-
-
- xdef slog2d
-slog2d:
-*--entry point for Log2(X), X is denormalized
-
- move.l (a0),d0
- blt.w invalid
- move.l d1,-(sp)
- clr.l d1
- bsr slognd ...log(X), X denorm.
- fmove.l (sp)+,fpcr
- fmul.x INV_L2,fp0
- bra t_frcinx
-
- xdef slog2
-slog2:
-*--entry point for Log2(X), X is normalized
- move.l (a0),d0
- blt.w invalid
-
- move.l 8(a0),d0
- bne.b continue ...X is not 2^k
-
- move.l 4(a0),d0
- and.l #$7FFFFFFF,d0
- tst.l d0
- bne.b continue
-
-*--X = 2^k.
- move.w (a0),d0
- and.l #$00007FFF,d0
- sub.l #$3FFF,d0
- fmove.l d1,fpcr
- fmove.l d0,fp0
- bra t_frcinx
-
-continue:
- move.l d1,-(sp)
- clr.l d1
- bsr slogn ...log(X), X normal.
- fmove.l (sp)+,fpcr
- fmul.x INV_L2,fp0
- bra t_frcinx
-
-invalid:
- bra t_operr
-
- end
diff --git a/sys/arch/m68k/fpsp/slogn.sa b/sys/arch/m68k/fpsp/slogn.sa
deleted file mode 100644
index 10f41a9d86b..00000000000
--- a/sys/arch/m68k/fpsp/slogn.sa
+++ /dev/null
@@ -1,618 +0,0 @@
-* $OpenBSD: slogn.sa,v 1.3 2003/11/07 10:36:10 miod Exp $
-* $NetBSD: slogn.sa,v 1.3 1994/10/26 07:49:54 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* slogn.sa 3.1 12/10/90
-*
-* slogn computes the natural logarithm of an
-* input value. slognd does the same except the input value is a
-* denormalized number. slognp1 computes log(1+X), and slognp1d
-* computes log(1+X) for denormalized X.
-*
-* Input: Double-extended value in memory location pointed to by address
-* register a0.
-*
-* Output: log(X) or log(1+X) returned in floating-point register Fp0.
-*
-* Accuracy and Monotonicity: The returned result is within 2 ulps in
-* 64 significant bit, i.e. within 0.5001 ulp to 53 bits if the
-* result is subsequently rounded to double precision. The
-* result is provably monotonic in double precision.
-*
-* Speed: The program slogn takes approximately 190 cycles for input
-* argument X such that |X-1| >= 1/16, which is the usual
-* situation. For those arguments, slognp1 takes approximately
-* 210 cycles. For the less common arguments, the program will
-* run no worse than 10% slower.
-*
-* Algorithm:
-* LOGN:
-* Step 1. If |X-1| < 1/16, approximate log(X) by an odd polynomial in
-* u, where u = 2(X-1)/(X+1). Otherwise, move on to Step 2.
-*
-* Step 2. X = 2**k * Y where 1 <= Y < 2. Define F to be the first seven
-* significant bits of Y plus 2**(-7), i.e. F = 1.xxxxxx1 in base
-* 2 where the six "x" match those of Y. Note that |Y-F| <= 2**(-7).
-*
-* Step 3. Define u = (Y-F)/F. Approximate log(1+u) by a polynomial in u,
-* log(1+u) = poly.
-*
-* Step 4. Reconstruct log(X) = log( 2**k * Y ) = k*log(2) + log(F) + log(1+u)
-* by k*log(2) + (log(F) + poly). The values of log(F) are calculated
-* beforehand and stored in the program.
-*
-* lognp1:
-* Step 1: If |X| < 1/16, approximate log(1+X) by an odd polynomial in
-* u where u = 2X/(2+X). Otherwise, move on to Step 2.
-*
-* Step 2: Let 1+X = 2**k * Y, where 1 <= Y < 2. Define F as done in Step 2
-* of the algorithm for LOGN and compute log(1+X) as
-* k*log(2) + log(F) + poly where poly approximates log(1+u),
-* u = (Y-F)/F.
-*
-* Implementation Notes:
-* Note 1. There are 64 different possible values for F, thus 64 log(F)'s
-* need to be tabulated. Moreover, the values of 1/F are also
-* tabulated so that the division in (Y-F)/F can be performed by a
-* multiplication.
-*
-* Note 2. In Step 2 of lognp1, in order to preserved accuracy, the value
-* Y-F has to be calculated carefully when 1/2 <= X < 3/2.
-*
-* Note 3. To fully exploit the pipeline, polynomials are usually separated
-* into two parts evaluated independently before being added up.
-*
-
-slogn IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
-BOUNDS1 DC.L $3FFEF07D,$3FFF8841
-BOUNDS2 DC.L $3FFE8000,$3FFFC000
-
-LOGOF2 DC.L $3FFE0000,$B17217F7,$D1CF79AC,$00000000
-
-one DC.L $3F800000
-zero DC.L $00000000
-infty DC.L $7F800000
-negone DC.L $BF800000
-
-LOGA6 DC.L $3FC2499A,$B5E4040B
-LOGA5 DC.L $BFC555B5,$848CB7DB
-
-LOGA4 DC.L $3FC99999,$987D8730
-LOGA3 DC.L $BFCFFFFF,$FF6F7E97
-
-LOGA2 DC.L $3FD55555,$555555A4
-LOGA1 DC.L $BFE00000,$00000008
-
-LOGB5 DC.L $3F175496,$ADD7DAD6
-LOGB4 DC.L $3F3C71C2,$FE80C7E0
-
-LOGB3 DC.L $3F624924,$928BCCFF
-LOGB2 DC.L $3F899999,$999995EC
-
-LOGB1 DC.L $3FB55555,$55555555
-TWO DC.L $40000000,$00000000
-
-LTHOLD DC.L $3f990000,$80000000,$00000000,$00000000
-
-LOGTBL:
- DC.L $3FFE0000,$FE03F80F,$E03F80FE,$00000000
- DC.L $3FF70000,$FF015358,$833C47E2,$00000000
- DC.L $3FFE0000,$FA232CF2,$52138AC0,$00000000
- DC.L $3FF90000,$BDC8D83E,$AD88D549,$00000000
- DC.L $3FFE0000,$F6603D98,$0F6603DA,$00000000
- DC.L $3FFA0000,$9CF43DCF,$F5EAFD48,$00000000
- DC.L $3FFE0000,$F2B9D648,$0F2B9D65,$00000000
- DC.L $3FFA0000,$DA16EB88,$CB8DF614,$00000000
- DC.L $3FFE0000,$EF2EB71F,$C4345238,$00000000
- DC.L $3FFB0000,$8B29B775,$1BD70743,$00000000
- DC.L $3FFE0000,$EBBDB2A5,$C1619C8C,$00000000
- DC.L $3FFB0000,$A8D839F8,$30C1FB49,$00000000
- DC.L $3FFE0000,$E865AC7B,$7603A197,$00000000
- DC.L $3FFB0000,$C61A2EB1,$8CD907AD,$00000000
- DC.L $3FFE0000,$E525982A,$F70C880E,$00000000
- DC.L $3FFB0000,$E2F2A47A,$DE3A18AF,$00000000
- DC.L $3FFE0000,$E1FC780E,$1FC780E2,$00000000
- DC.L $3FFB0000,$FF64898E,$DF55D551,$00000000
- DC.L $3FFE0000,$DEE95C4C,$A037BA57,$00000000
- DC.L $3FFC0000,$8DB956A9,$7B3D0148,$00000000
- DC.L $3FFE0000,$DBEB61EE,$D19C5958,$00000000
- DC.L $3FFC0000,$9B8FE100,$F47BA1DE,$00000000
- DC.L $3FFE0000,$D901B203,$6406C80E,$00000000
- DC.L $3FFC0000,$A9372F1D,$0DA1BD17,$00000000
- DC.L $3FFE0000,$D62B80D6,$2B80D62C,$00000000
- DC.L $3FFC0000,$B6B07F38,$CE90E46B,$00000000
- DC.L $3FFE0000,$D3680D36,$80D3680D,$00000000
- DC.L $3FFC0000,$C3FD0329,$06488481,$00000000
- DC.L $3FFE0000,$D0B69FCB,$D2580D0B,$00000000
- DC.L $3FFC0000,$D11DE0FF,$15AB18CA,$00000000
- DC.L $3FFE0000,$CE168A77,$25080CE1,$00000000
- DC.L $3FFC0000,$DE1433A1,$6C66B150,$00000000
- DC.L $3FFE0000,$CB8727C0,$65C393E0,$00000000
- DC.L $3FFC0000,$EAE10B5A,$7DDC8ADD,$00000000
- DC.L $3FFE0000,$C907DA4E,$871146AD,$00000000
- DC.L $3FFC0000,$F7856E5E,$E2C9B291,$00000000
- DC.L $3FFE0000,$C6980C69,$80C6980C,$00000000
- DC.L $3FFD0000,$82012CA5,$A68206D7,$00000000
- DC.L $3FFE0000,$C4372F85,$5D824CA6,$00000000
- DC.L $3FFD0000,$882C5FCD,$7256A8C5,$00000000
- DC.L $3FFE0000,$C1E4BBD5,$95F6E947,$00000000
- DC.L $3FFD0000,$8E44C60B,$4CCFD7DE,$00000000
- DC.L $3FFE0000,$BFA02FE8,$0BFA02FF,$00000000
- DC.L $3FFD0000,$944AD09E,$F4351AF6,$00000000
- DC.L $3FFE0000,$BD691047,$07661AA3,$00000000
- DC.L $3FFD0000,$9A3EECD4,$C3EAA6B2,$00000000
- DC.L $3FFE0000,$BB3EE721,$A54D880C,$00000000
- DC.L $3FFD0000,$A0218434,$353F1DE8,$00000000
- DC.L $3FFE0000,$B92143FA,$36F5E02E,$00000000
- DC.L $3FFD0000,$A5F2FCAB,$BBC506DA,$00000000
- DC.L $3FFE0000,$B70FBB5A,$19BE3659,$00000000
- DC.L $3FFD0000,$ABB3B8BA,$2AD362A5,$00000000
- DC.L $3FFE0000,$B509E68A,$9B94821F,$00000000
- DC.L $3FFD0000,$B1641795,$CE3CA97B,$00000000
- DC.L $3FFE0000,$B30F6352,$8917C80B,$00000000
- DC.L $3FFD0000,$B7047551,$5D0F1C61,$00000000
- DC.L $3FFE0000,$B11FD3B8,$0B11FD3C,$00000000
- DC.L $3FFD0000,$BC952AFE,$EA3D13E1,$00000000
- DC.L $3FFE0000,$AF3ADDC6,$80AF3ADE,$00000000
- DC.L $3FFD0000,$C2168ED0,$F458BA4A,$00000000
- DC.L $3FFE0000,$AD602B58,$0AD602B6,$00000000
- DC.L $3FFD0000,$C788F439,$B3163BF1,$00000000
- DC.L $3FFE0000,$AB8F69E2,$8359CD11,$00000000
- DC.L $3FFD0000,$CCECAC08,$BF04565D,$00000000
- DC.L $3FFE0000,$A9C84A47,$A07F5638,$00000000
- DC.L $3FFD0000,$D2420487,$2DD85160,$00000000
- DC.L $3FFE0000,$A80A80A8,$0A80A80B,$00000000
- DC.L $3FFD0000,$D7894992,$3BC3588A,$00000000
- DC.L $3FFE0000,$A655C439,$2D7B73A8,$00000000
- DC.L $3FFD0000,$DCC2C4B4,$9887DACC,$00000000
- DC.L $3FFE0000,$A4A9CF1D,$96833751,$00000000
- DC.L $3FFD0000,$E1EEBD3E,$6D6A6B9E,$00000000
- DC.L $3FFE0000,$A3065E3F,$AE7CD0E0,$00000000
- DC.L $3FFD0000,$E70D785C,$2F9F5BDC,$00000000
- DC.L $3FFE0000,$A16B312E,$A8FC377D,$00000000
- DC.L $3FFD0000,$EC1F392C,$5179F283,$00000000
- DC.L $3FFE0000,$9FD809FD,$809FD80A,$00000000
- DC.L $3FFD0000,$F12440D3,$E36130E6,$00000000
- DC.L $3FFE0000,$9E4CAD23,$DD5F3A20,$00000000
- DC.L $3FFD0000,$F61CCE92,$346600BB,$00000000
- DC.L $3FFE0000,$9CC8E160,$C3FB19B9,$00000000
- DC.L $3FFD0000,$FB091FD3,$8145630A,$00000000
- DC.L $3FFE0000,$9B4C6F9E,$F03A3CAA,$00000000
- DC.L $3FFD0000,$FFE97042,$BFA4C2AD,$00000000
- DC.L $3FFE0000,$99D722DA,$BDE58F06,$00000000
- DC.L $3FFE0000,$825EFCED,$49369330,$00000000
- DC.L $3FFE0000,$9868C809,$868C8098,$00000000
- DC.L $3FFE0000,$84C37A7A,$B9A905C9,$00000000
- DC.L $3FFE0000,$97012E02,$5C04B809,$00000000
- DC.L $3FFE0000,$87224C2E,$8E645FB7,$00000000
- DC.L $3FFE0000,$95A02568,$095A0257,$00000000
- DC.L $3FFE0000,$897B8CAC,$9F7DE298,$00000000
- DC.L $3FFE0000,$94458094,$45809446,$00000000
- DC.L $3FFE0000,$8BCF55DE,$C4CD05FE,$00000000
- DC.L $3FFE0000,$92F11384,$0497889C,$00000000
- DC.L $3FFE0000,$8E1DC0FB,$89E125E5,$00000000
- DC.L $3FFE0000,$91A2B3C4,$D5E6F809,$00000000
- DC.L $3FFE0000,$9066E68C,$955B6C9B,$00000000
- DC.L $3FFE0000,$905A3863,$3E06C43B,$00000000
- DC.L $3FFE0000,$92AADE74,$C7BE59E0,$00000000
- DC.L $3FFE0000,$8F1779D9,$FDC3A219,$00000000
- DC.L $3FFE0000,$94E9BFF6,$15845643,$00000000
- DC.L $3FFE0000,$8DDA5202,$37694809,$00000000
- DC.L $3FFE0000,$9723A1B7,$20134203,$00000000
- DC.L $3FFE0000,$8CA29C04,$6514E023,$00000000
- DC.L $3FFE0000,$995899C8,$90EB8990,$00000000
- DC.L $3FFE0000,$8B70344A,$139BC75A,$00000000
- DC.L $3FFE0000,$9B88BDAA,$3A3DAE2F,$00000000
- DC.L $3FFE0000,$8A42F870,$5669DB46,$00000000
- DC.L $3FFE0000,$9DB4224F,$FFE1157C,$00000000
- DC.L $3FFE0000,$891AC73A,$E9819B50,$00000000
- DC.L $3FFE0000,$9FDADC26,$8B7A12DA,$00000000
- DC.L $3FFE0000,$87F78087,$F78087F8,$00000000
- DC.L $3FFE0000,$A1FCFF17,$CE733BD4,$00000000
- DC.L $3FFE0000,$86D90544,$7A34ACC6,$00000000
- DC.L $3FFE0000,$A41A9E8F,$5446FB9F,$00000000
- DC.L $3FFE0000,$85BF3761,$2CEE3C9B,$00000000
- DC.L $3FFE0000,$A633CD7E,$6771CD8B,$00000000
- DC.L $3FFE0000,$84A9F9C8,$084A9F9D,$00000000
- DC.L $3FFE0000,$A8489E60,$0B435A5E,$00000000
- DC.L $3FFE0000,$83993052,$3FBE3368,$00000000
- DC.L $3FFE0000,$AA59233C,$CCA4BD49,$00000000
- DC.L $3FFE0000,$828CBFBE,$B9A020A3,$00000000
- DC.L $3FFE0000,$AC656DAE,$6BCC4985,$00000000
- DC.L $3FFE0000,$81848DA8,$FAF0D277,$00000000
- DC.L $3FFE0000,$AE6D8EE3,$60BB2468,$00000000
- DC.L $3FFE0000,$80808080,$80808081,$00000000
- DC.L $3FFE0000,$B07197A2,$3C46C654,$00000000
-
-ADJK equ L_SCR1
-
-X equ FP_SCR1
-XDCARE equ X+2
-XFRAC equ X+4
-
-F equ FP_SCR2
-FFRAC equ F+4
-
-KLOG2 equ FP_SCR3
-
-SAVEU equ FP_SCR4
-
- xref t_frcinx
- xref t_extdnrm
- xref t_operr
- xref t_dz
-
- xdef slognd
-slognd:
-*--ENTRY POINT FOR LOG(X) FOR DENORMALIZED INPUT
-
- MOVE.L #-100,ADJK(a6) ...INPUT = 2^(ADJK) * FP0
-
-*----normalize the input value by left shifting k bits (k to be determined
-*----below), adjusting exponent and storing -k to ADJK
-*----the value TWOTO100 is no longer needed.
-*----Note that this code assumes the denormalized input is NON-ZERO.
-
- MoveM.L D2-D7,-(A7) ...save some registers
- Clr.L D3 ...D3 is exponent of smallest norm. #
- Move.L 4(A0),D4
- Move.L 8(A0),D5 ...(D4,D5) is (Hi_X,Lo_X)
- Clr.L D2 ...D2 used for holding K
-
- Tst.L D4
- BNE.B HiX_not0
-
-HiX_0:
- Move.L D5,D4
- Clr.L D5
- Move.L #32,D2
- Clr.L D6
- BFFFO D4{0:32},D6
- LSL.L D6,D4
- Add.L D6,D2 ...(D3,D4,D5) is normalized
-
- Move.L D3,X(a6)
- Move.L D4,XFRAC(a6)
- Move.L D5,XFRAC+4(a6)
- Neg.L D2
- Move.L D2,ADJK(a6)
- FMove.X X(a6),FP0
- MoveM.L (A7)+,D2-D7 ...restore registers
- LEA X(a6),A0
- Bra.B LOGBGN ...begin regular log(X)
-
-
-HiX_not0:
- Clr.L D6
- BFFFO D4{0:32},D6 ...find first 1
- Move.L D6,D2 ...get k
- LSL.L D6,D4
- Move.L D5,D7 ...a copy of D5
- LSL.L D6,D5
- Neg.L D6
- AddI.L #32,D6
- LSR.L D6,D7
- Or.L D7,D4 ...(D3,D4,D5) normalized
-
- Move.L D3,X(a6)
- Move.L D4,XFRAC(a6)
- Move.L D5,XFRAC+4(a6)
- Neg.L D2
- Move.L D2,ADJK(a6)
- FMove.X X(a6),FP0
- MoveM.L (A7)+,D2-D7 ...restore registers
- LEA X(a6),A0
- Bra.B LOGBGN ...begin regular log(X)
-
-
- xdef slogn
-slogn:
-*--ENTRY POINT FOR LOG(X) FOR X FINITE, NON-ZERO, NOT NAN'S
-
- FMOVE.X (A0),FP0 ...LOAD INPUT
- CLR.L ADJK(a6)
-
-LOGBGN:
-*--FPCR SAVED AND CLEARED, INPUT IS 2^(ADJK)*FP0, FP0 CONTAINS
-*--A FINITE, NON-ZERO, NORMALIZED NUMBER.
-
- move.l (a0),d0
- move.w 4(a0),d0
-
- move.l (a0),X(a6)
- move.l 4(a0),X+4(a6)
- move.l 8(a0),X+8(a6)
-
- TST.L D0 ...CHECK IF X IS NEGATIVE
- BLT.W LOGNEG ...LOG OF NEGATIVE ARGUMENT IS INVALID
- CMP2.L BOUNDS1,D0 ...X IS POSITIVE, CHECK IF X IS NEAR 1
- BCC.W LOGNEAR1 ...BOUNDS IS ROUGHLY [15/16, 17/16]
-
-LOGMAIN:
-*--THIS SHOULD BE THE USUAL CASE, X NOT VERY CLOSE TO 1
-
-*--X = 2^(K) * Y, 1 <= Y < 2. THUS, Y = 1.XXXXXXXX....XX IN BINARY.
-*--WE DEFINE F = 1.XXXXXX1, I.E. FIRST 7 BITS OF Y AND ATTACH A 1.
-*--THE IDEA IS THAT LOG(X) = K*LOG2 + LOG(Y)
-*-- = K*LOG2 + LOG(F) + LOG(1 + (Y-F)/F).
-*--NOTE THAT U = (Y-F)/F IS VERY SMALL AND THUS APPROXIMATING
-*--LOG(1+U) CAN BE VERY EFFICIENT.
-*--ALSO NOTE THAT THE VALUE 1/F IS STORED IN A TABLE SO THAT NO
-*--DIVISION IS NEEDED TO CALCULATE (Y-F)/F.
-
-*--GET K, Y, F, AND ADDRESS OF 1/F.
- ASR.L #8,D0
- ASR.L #8,D0 ...SHIFTED 16 BITS, BIASED EXPO. OF X
- SUBI.L #$3FFF,D0 ...THIS IS K
- ADD.L ADJK(a6),D0 ...ADJUST K, ORIGINAL INPUT MAY BE DENORM.
- LEA LOGTBL,A0 ...BASE ADDRESS OF 1/F AND LOG(F)
- FMOVE.L D0,FP1 ...CONVERT K TO FLOATING-POINT FORMAT
-
-*--WHILE THE CONVERSION IS GOING ON, WE GET F AND ADDRESS OF 1/F
- MOVE.L #$3FFF0000,X(a6) ...X IS NOW Y, I.E. 2^(-K)*X
- MOVE.L XFRAC(a6),FFRAC(a6)
- ANDI.L #$FE000000,FFRAC(a6) ...FIRST 7 BITS OF Y
- ORI.L #$01000000,FFRAC(a6) ...GET F: ATTACH A 1 AT THE EIGHTH BIT
- MOVE.L FFRAC(a6),D0 ...READY TO GET ADDRESS OF 1/F
- ANDI.L #$7E000000,D0
- ASR.L #8,D0
- ASR.L #8,D0
- ASR.L #4,D0 ...SHIFTED 20, D0 IS THE DISPLACEMENT
- ADDA.L D0,A0 ...A0 IS THE ADDRESS FOR 1/F
-
- FMOVE.X X(a6),FP0
- move.l #$3fff0000,F(a6)
- clr.l F+8(a6)
- FSUB.X F(a6),FP0 ...Y-F
- FMOVEm.X FP2/fp3,-(sp) ...SAVE FP2 WHILE FP0 IS NOT READY
-*--SUMMARY: FP0 IS Y-F, A0 IS ADDRESS OF 1/F, FP1 IS K
-*--REGISTERS SAVED: FPCR, FP1, FP2
-
-LP1CONT1:
-*--AN RE-ENTRY POINT FOR LOGNP1
- FMUL.X (A0),FP0 ...FP0 IS U = (Y-F)/F
- FMUL.X LOGOF2,FP1 ...GET K*LOG2 WHILE FP0 IS NOT READY
- FMOVE.X FP0,FP2
- FMUL.X FP2,FP2 ...FP2 IS V=U*U
- FMOVE.X FP1,KLOG2(a6) ...PUT K*LOG2 IN MEMEORY, FREE FP1
-
-*--LOG(1+U) IS APPROXIMATED BY
-*--U + V*(A1+U*(A2+U*(A3+U*(A4+U*(A5+U*A6))))) WHICH IS
-*--[U + V*(A1+V*(A3+V*A5))] + [U*V*(A2+V*(A4+V*A6))]
-
- FMOVE.X FP2,FP3
- FMOVE.X FP2,FP1
-
- FMUL.D LOGA6,FP1 ...V*A6
- FMUL.D LOGA5,FP2 ...V*A5
-
- FADD.D LOGA4,FP1 ...A4+V*A6
- FADD.D LOGA3,FP2 ...A3+V*A5
-
- FMUL.X FP3,FP1 ...V*(A4+V*A6)
- FMUL.X FP3,FP2 ...V*(A3+V*A5)
-
- FADD.D LOGA2,FP1 ...A2+V*(A4+V*A6)
- FADD.D LOGA1,FP2 ...A1+V*(A3+V*A5)
-
- FMUL.X FP3,FP1 ...V*(A2+V*(A4+V*A6))
- ADDA.L #16,A0 ...ADDRESS OF LOG(F)
- FMUL.X FP3,FP2 ...V*(A1+V*(A3+V*A5)), FP3 RELEASED
-
- FMUL.X FP0,FP1 ...U*V*(A2+V*(A4+V*A6))
- FADD.X FP2,FP0 ...U+V*(A1+V*(A3+V*A5)), FP2 RELEASED
-
- FADD.X (A0),FP1 ...LOG(F)+U*V*(A2+V*(A4+V*A6))
- FMOVEm.X (sp)+,FP2/fp3 ...RESTORE FP2
- FADD.X FP1,FP0 ...FP0 IS LOG(F) + LOG(1+U)
-
- fmove.l d1,fpcr
- FADD.X KLOG2(a6),FP0 ...FINAL ADD
- bra t_frcinx
-
-
-LOGNEAR1:
-*--REGISTERS SAVED: FPCR, FP1. FP0 CONTAINS THE INPUT.
- FMOVE.X FP0,FP1
- FSUB.S one,FP1 ...FP1 IS X-1
- FADD.S one,FP0 ...FP0 IS X+1
- FADD.X FP1,FP1 ...FP1 IS 2(X-1)
-*--LOG(X) = LOG(1+U/2)-LOG(1-U/2) WHICH IS AN ODD POLYNOMIAL
-*--IN U, U = 2(X-1)/(X+1) = FP1/FP0
-
-LP1CONT2:
-*--THIS IS AN RE-ENTRY POINT FOR LOGNP1
- FDIV.X FP0,FP1 ...FP1 IS U
- FMOVEm.X FP2/fp3,-(sp) ...SAVE FP2
-*--REGISTERS SAVED ARE NOW FPCR,FP1,FP2,FP3
-*--LET V=U*U, W=V*V, CALCULATE
-*--U + U*V*(B1 + V*(B2 + V*(B3 + V*(B4 + V*B5)))) BY
-*--U + U*V*( [B1 + W*(B3 + W*B5)] + [V*(B2 + W*B4)] )
- FMOVE.X FP1,FP0
- FMUL.X FP0,FP0 ...FP0 IS V
- FMOVE.X FP1,SAVEU(a6) ...STORE U IN MEMORY, FREE FP1
- FMOVE.X FP0,FP1
- FMUL.X FP1,FP1 ...FP1 IS W
-
- FMOVE.D LOGB5,FP3
- FMOVE.D LOGB4,FP2
-
- FMUL.X FP1,FP3 ...W*B5
- FMUL.X FP1,FP2 ...W*B4
-
- FADD.D LOGB3,FP3 ...B3+W*B5
- FADD.D LOGB2,FP2 ...B2+W*B4
-
- FMUL.X FP3,FP1 ...W*(B3+W*B5), FP3 RELEASED
-
- FMUL.X FP0,FP2 ...V*(B2+W*B4)
-
- FADD.D LOGB1,FP1 ...B1+W*(B3+W*B5)
- FMUL.X SAVEU(a6),FP0 ...FP0 IS U*V
-
- FADD.X FP2,FP1 ...B1+W*(B3+W*B5) + V*(B2+W*B4), FP2 RELEASED
- FMOVEm.X (sp)+,FP2/fp3 ...FP2 RESTORED
-
- FMUL.X FP1,FP0 ...U*V*( [B1+W*(B3+W*B5)] + [V*(B2+W*B4)] )
-
- fmove.l d1,fpcr
- FADD.X SAVEU(a6),FP0
- bra t_frcinx
- rts
-
-LOGNEG:
-*--REGISTERS SAVED FPCR. LOG(-VE) IS INVALID
- bra t_operr
-
- xdef slognp1d
-slognp1d:
-*--ENTRY POINT FOR LOG(1+Z) FOR DENORMALIZED INPUT
-* Simply return the denorm
-
- bra t_extdnrm
-
- xdef slognp1
-slognp1:
-*--ENTRY POINT FOR LOG(1+X) FOR X FINITE, NON-ZERO, NOT NAN'S
-
- FMOVE.X (A0),FP0 ...LOAD INPUT
- fabs.x fp0 ;test magnitude
- fcmp.x LTHOLD,fp0 ;compare with min threshold
- fbgt.w LP1REAL ;if greater, continue
- fmove.l #0,fpsr ;clr N flag from compare
- fmove.l d1,fpcr
- fmove.x (a0),fp0 ;return signed argument
- bra t_frcinx
-
-LP1REAL:
- FMOVE.X (A0),FP0 ...LOAD INPUT
- CLR.L ADJK(a6)
- FMOVE.X FP0,FP1 ...FP1 IS INPUT Z
- FADD.S one,FP0 ...X := ROUND(1+Z)
- FMOVE.X FP0,X(a6)
- MOVE.W XFRAC(a6),XDCARE(a6)
- MOVE.L X(a6),D0
- TST.L D0
- BLE.W LP1NEG0 ...LOG OF ZERO OR -VE
- CMP2.L BOUNDS2,D0
- BCS.W LOGMAIN ...BOUNDS2 IS [1/2,3/2]
-*--IF 1+Z > 3/2 OR 1+Z < 1/2, THEN X, WHICH IS ROUNDING 1+Z,
-*--CONTAINS AT LEAST 63 BITS OF INFORMATION OF Z. IN THAT CASE,
-*--SIMPLY INVOKE LOG(X) FOR LOG(1+Z).
-
-LP1NEAR1:
-*--NEXT SEE IF EXP(-1/16) < X < EXP(1/16)
- CMP2.L BOUNDS1,D0
- BCS.B LP1CARE
-
-LP1ONE16:
-*--EXP(-1/16) < X < EXP(1/16). LOG(1+Z) = LOG(1+U/2) - LOG(1-U/2)
-*--WHERE U = 2Z/(2+Z) = 2Z/(1+X).
- FADD.X FP1,FP1 ...FP1 IS 2Z
- FADD.S one,FP0 ...FP0 IS 1+X
-*--U = FP1/FP0
- BRA.W LP1CONT2
-
-LP1CARE:
-*--HERE WE USE THE USUAL TABLE DRIVEN APPROACH. CARE HAS TO BE
-*--TAKEN BECAUSE 1+Z CAN HAVE 67 BITS OF INFORMATION AND WE MUST
-*--PRESERVE ALL THE INFORMATION. BECAUSE 1+Z IS IN [1/2,3/2],
-*--THERE ARE ONLY TWO CASES.
-*--CASE 1: 1+Z < 1, THEN K = -1 AND Y-F = (2-F) + 2Z
-*--CASE 2: 1+Z > 1, THEN K = 0 AND Y-F = (1-F) + Z
-*--ON RETURNING TO LP1CONT1, WE MUST HAVE K IN FP1, ADDRESS OF
-*--(1/F) IN A0, Y-F IN FP0, AND FP2 SAVED.
-
- MOVE.L XFRAC(a6),FFRAC(a6)
- ANDI.L #$FE000000,FFRAC(a6)
- ORI.L #$01000000,FFRAC(a6) ...F OBTAINED
- CMPI.L #$3FFF8000,D0 ...SEE IF 1+Z > 1
- BGE.B KISZERO
-
-KISNEG1:
- FMOVE.S TWO,FP0
- move.l #$3fff0000,F(a6)
- clr.l F+8(a6)
- FSUB.X F(a6),FP0 ...2-F
- MOVE.L FFRAC(a6),D0
- ANDI.L #$7E000000,D0
- ASR.L #8,D0
- ASR.L #8,D0
- ASR.L #4,D0 ...D0 CONTAINS DISPLACEMENT FOR 1/F
- FADD.X FP1,FP1 ...GET 2Z
- FMOVEm.X FP2/fp3,-(sp) ...SAVE FP2
- FADD.X FP1,FP0 ...FP0 IS Y-F = (2-F)+2Z
- LEA LOGTBL,A0 ...A0 IS ADDRESS OF 1/F
- ADDA.L D0,A0
- FMOVE.S negone,FP1 ...FP1 IS K = -1
- BRA.W LP1CONT1
-
-KISZERO:
- FMOVE.S one,FP0
- move.l #$3fff0000,F(a6)
- clr.l F+8(a6)
- FSUB.X F(a6),FP0 ...1-F
- MOVE.L FFRAC(a6),D0
- ANDI.L #$7E000000,D0
- ASR.L #8,D0
- ASR.L #8,D0
- ASR.L #4,D0
- FADD.X FP1,FP0 ...FP0 IS Y-F
- FMOVEm.X FP2/fp3,-(sp) ...FP2 SAVED
- LEA LOGTBL,A0
- ADDA.L D0,A0 ...A0 IS ADDRESS OF 1/F
- FMOVE.S zero,FP1 ...FP1 IS K = 0
- BRA.W LP1CONT1
-
-LP1NEG0:
-*--FPCR SAVED. D0 IS X IN COMPACT FORM.
- TST.L D0
- BLT.B LP1NEG
-LP1ZERO:
- FMOVE.S negone,FP0
-
- fmove.l d1,fpcr
- bra t_dz
-
-LP1NEG:
- FMOVE.S zero,FP0
-
- fmove.l d1,fpcr
- bra t_operr
-
- end
diff --git a/sys/arch/m68k/fpsp/smovecr.sa b/sys/arch/m68k/fpsp/smovecr.sa
deleted file mode 100644
index e80750c203d..00000000000
--- a/sys/arch/m68k/fpsp/smovecr.sa
+++ /dev/null
@@ -1,188 +0,0 @@
-* $OpenBSD: smovecr.sa,v 1.2 1996/05/29 21:05:40 niklas Exp $
-* $NetBSD: smovecr.sa,v 1.2 1994/10/26 07:49:57 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* smovecr.sa 3.1 12/10/90
-*
-* The entry point sMOVECR returns the constant at the
-* offset given in the instruction field.
-*
-* Input: An offset in the instruction word.
-*
-* Output: The constant rounded to the user's rounding
-* mode unchecked for overflow.
-*
-* Modified: fp0.
-*
-
-SMOVECR IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
- xref nrm_set
- xref round
- xref PIRN
- xref PIRZRM
- xref PIRP
- xref SMALRN
- xref SMALRZRM
- xref SMALRP
- xref BIGRN
- xref BIGRZRM
- xref BIGRP
-
-FZERO dc.l 00000000
-*
-* FMOVECR
-*
- xdef smovcr
-smovcr:
- bfextu CMDREG1B(a6){9:7},d0 ;get offset
- bfextu USER_FPCR(a6){26:2},d1 ;get rmode
-*
-* check range of offset
-*
- tst.b d0 ;if zero, offset is to pi
- beq.b PI_TBL ;it is pi
- cmpi.b #$0a,d0 ;check range $01 - $0a
- ble.b Z_VAL ;if in this range, return zero
- cmpi.b #$0e,d0 ;check range $0b - $0e
- ble.b SM_TBL ;valid constants in this range
- cmpi.b #$2f,d0 ;check range $10 - $2f
- ble.b Z_VAL ;if in this range, return zero
- cmpi.b #$3f,d0 ;check range $30 - $3f
- ble BG_TBL ;valid constants in this range
-Z_VAL:
- fmove.s FZERO,fp0
- rts
-PI_TBL:
- tst.b d1 ;offset is zero, check for rmode
- beq.b PI_RN ;if zero, rn mode
- cmpi.b #$3,d1 ;check for rp
- beq.b PI_RP ;if 3, rp mode
-PI_RZRM:
- lea.l PIRZRM,a0 ;rmode is rz or rm, load PIRZRM in a0
- bra set_finx
-PI_RN:
- lea.l PIRN,a0 ;rmode is rn, load PIRN in a0
- bra set_finx
-PI_RP:
- lea.l PIRP,a0 ;rmode is rp, load PIRP in a0
- bra set_finx
-SM_TBL:
- subi.l #$b,d0 ;make offset in 0 - 4 range
- tst.b d1 ;check for rmode
- beq.b SM_RN ;if zero, rn mode
- cmpi.b #$3,d1 ;check for rp
- beq.b SM_RP ;if 3, rp mode
-SM_RZRM:
- lea.l SMALRZRM,a0 ;rmode is rz or rm, load SMRZRM in a0
- cmpi.b #$2,d0 ;check if result is inex
- ble set_finx ;if 0 - 2, it is inexact
- bra no_finx ;if 3, it is exact
-SM_RN:
- lea.l SMALRN,a0 ;rmode is rn, load SMRN in a0
- cmpi.b #$2,d0 ;check if result is inex
- ble set_finx ;if 0 - 2, it is inexact
- bra no_finx ;if 3, it is exact
-SM_RP:
- lea.l SMALRP,a0 ;rmode is rp, load SMRP in a0
- cmpi.b #$2,d0 ;check if result is inex
- ble set_finx ;if 0 - 2, it is inexact
- bra no_finx ;if 3, it is exact
-BG_TBL:
- subi.l #$30,d0 ;make offset in 0 - f range
- tst.b d1 ;check for rmode
- beq.b BG_RN ;if zero, rn mode
- cmpi.b #$3,d1 ;check for rp
- beq.b BG_RP ;if 3, rp mode
-BG_RZRM:
- lea.l BIGRZRM,a0 ;rmode is rz or rm, load BGRZRM in a0
- cmpi.b #$1,d0 ;check if result is inex
- ble set_finx ;if 0 - 1, it is inexact
- cmpi.b #$7,d0 ;second check
- ble no_finx ;if 0 - 7, it is exact
- bra set_finx ;if 8 - f, it is inexact
-BG_RN:
- lea.l BIGRN,a0 ;rmode is rn, load BGRN in a0
- cmpi.b #$1,d0 ;check if result is inex
- ble set_finx ;if 0 - 1, it is inexact
- cmpi.b #$7,d0 ;second check
- ble no_finx ;if 0 - 7, it is exact
- bra set_finx ;if 8 - f, it is inexact
-BG_RP:
- lea.l BIGRP,a0 ;rmode is rp, load SMRP in a0
- cmpi.b #$1,d0 ;check if result is inex
- ble set_finx ;if 0 - 1, it is inexact
- cmpi.b #$7,d0 ;second check
- ble no_finx ;if 0 - 7, it is exact
-* bra set_finx ;if 8 - f, it is inexact
-set_finx:
- or.l #inx2a_mask,USER_FPSR(a6) ;set inex2/ainex
-no_finx:
- mulu.l #12,d0 ;use offset to point into tables
- move.l d1,L_SCR1(a6) ;load mode for round call
- bfextu USER_FPCR(a6){24:2},d1 ;get precision
- tst.l d1 ;check if extended precision
-*
-* Precision is extended
-*
- bne.b not_ext ;if extended, do not call round
- fmovem.x (a0,d0),fp0 ;return result in fp0
- rts
-*
-* Precision is single or double
-*
-not_ext:
- swap d1 ;rnd prec in upper word of d1
- add.l L_SCR1(a6),d1 ;merge rmode in low word of d1
- move.l (a0,d0),FP_SCR1(a6) ;load first word to temp storage
- move.l 4(a0,d0),FP_SCR1+4(a6) ;load second word
- move.l 8(a0,d0),FP_SCR1+8(a6) ;load third word
- clr.l d0 ;clear g,r,s
- lea FP_SCR1(a6),a0
- btst.b #sign_bit,LOCAL_EX(a0)
- sne LOCAL_SGN(a0) ;convert to internal ext. format
-
- bsr round ;go round the mantissa
-
- bfclr LOCAL_SGN(a0){0:8} ;convert back to IEEE ext format
- beq.b fin_fcr
- bset.b #sign_bit,LOCAL_EX(a0)
-fin_fcr:
- fmovem.x (a0),fp0
- rts
-
- end
diff --git a/sys/arch/m68k/fpsp/srem_mod.sa b/sys/arch/m68k/fpsp/srem_mod.sa
deleted file mode 100644
index eeca1fd8ee8..00000000000
--- a/sys/arch/m68k/fpsp/srem_mod.sa
+++ /dev/null
@@ -1,447 +0,0 @@
-* $OpenBSD: srem_mod.sa,v 1.2 1996/05/29 21:05:41 niklas Exp $
-* $NetBSD: srem_mod.sa,v 1.3 1994/10/26 07:49:58 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* srem_mod.sa 3.1 12/10/90
-*
-* The entry point sMOD computes the floating point MOD of the
-* input values X and Y. The entry point sREM computes the floating
-* point (IEEE) REM of the input values X and Y.
-*
-* INPUT
-* -----
-* Double-extended value Y is pointed to by address in register
-* A0. Double-extended value X is located in -12(A0). The values
-* of X and Y are both nonzero and finite; although either or both
-* of them can be denormalized. The special cases of zeros, NaNs,
-* and infinities are handled elsewhere.
-*
-* OUTPUT
-* ------
-* FREM(X,Y) or FMOD(X,Y), depending on entry point.
-*
-* ALGORITHM
-* ---------
-*
-* Step 1. Save and strip signs of X and Y: signX := sign(X),
-* signY := sign(Y), X := |X|, Y := |Y|,
-* signQ := signX EOR signY. Record whether MOD or REM
-* is requested.
-*
-* Step 2. Set L := expo(X)-expo(Y), k := 0, Q := 0.
-* If (L < 0) then
-* R := X, go to Step 4.
-* else
-* R := 2^(-L)X, j := L.
-* endif
-*
-* Step 3. Perform MOD(X,Y)
-* 3.1 If R = Y, go to Step 9.
-* 3.2 If R > Y, then { R := R - Y, Q := Q + 1}
-* 3.3 If j = 0, go to Step 4.
-* 3.4 k := k + 1, j := j - 1, Q := 2Q, R := 2R. Go to
-* Step 3.1.
-*
-* Step 4. At this point, R = X - QY = MOD(X,Y). Set
-* Last_Subtract := false (used in Step 7 below). If
-* MOD is requested, go to Step 6.
-*
-* Step 5. R = MOD(X,Y), but REM(X,Y) is requested.
-* 5.1 If R < Y/2, then R = MOD(X,Y) = REM(X,Y). Go to
-* Step 6.
-* 5.2 If R > Y/2, then { set Last_Subtract := true,
-* Q := Q + 1, Y := signY*Y }. Go to Step 6.
-* 5.3 This is the tricky case of R = Y/2. If Q is odd,
-* then { Q := Q + 1, signX := -signX }.
-*
-* Step 6. R := signX*R.
-*
-* Step 7. If Last_Subtract = true, R := R - Y.
-*
-* Step 8. Return signQ, last 7 bits of Q, and R as required.
-*
-* Step 9. At this point, R = 2^(-j)*X - Q Y = Y. Thus,
-* X = 2^(j)*(Q+1)Y. set Q := 2^(j)*(Q+1),
-* R := 0. Return signQ, last 7 bits of Q, and R.
-*
-
-SREM_MOD IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
-Mod_Flag equ L_SCR3
-SignY equ FP_SCR3+4
-SignX equ FP_SCR3+8
-SignQ equ FP_SCR3+12
-Sc_Flag equ FP_SCR4
-
-Y equ FP_SCR1
-Y_Hi equ Y+4
-Y_Lo equ Y+8
-
-R equ FP_SCR2
-R_Hi equ R+4
-R_Lo equ R+8
-
-
-Scale DC.L $00010000,$80000000,$00000000,$00000000
-
- xref t_avoid_unsupp
-
- xdef smod
-smod:
-
- Clr.L Mod_Flag(a6)
- BRA.B Mod_Rem
-
- xdef srem
-srem:
-
- Move.L #1,Mod_Flag(a6)
-
-Mod_Rem:
-*..Save sign of X and Y
- MoveM.L D2-D7,-(A7) ...save data registers
- Move.W (A0),D3
- Move.W D3,SignY(a6)
- AndI.L #$00007FFF,D3 ...Y := |Y|
-
-*
- Move.L 4(A0),D4
- Move.L 8(A0),D5 ...(D3,D4,D5) is |Y|
-
- Tst.L D3
- BNE.B Y_Normal
-
- Move.L #$00003FFE,D3 ...$3FFD + 1
- Tst.L D4
- BNE.B HiY_not0
-
-HiY_0:
- Move.L D5,D4
- CLR.L D5
- SubI.L #32,D3
- CLR.L D6
- BFFFO D4{0:32},D6
- LSL.L D6,D4
- Sub.L D6,D3 ...(D3,D4,D5) is normalized
-* ...with bias $7FFD
- BRA.B Chk_X
-
-HiY_not0:
- CLR.L D6
- BFFFO D4{0:32},D6
- Sub.L D6,D3
- LSL.L D6,D4
- Move.L D5,D7 ...a copy of D5
- LSL.L D6,D5
- Neg.L D6
- AddI.L #32,D6
- LSR.L D6,D7
- Or.L D7,D4 ...(D3,D4,D5) normalized
-* ...with bias $7FFD
- BRA.B Chk_X
-
-Y_Normal:
- AddI.L #$00003FFE,D3 ...(D3,D4,D5) normalized
-* ...with bias $7FFD
-
-Chk_X:
- Move.W -12(A0),D0
- Move.W D0,SignX(a6)
- Move.W SignY(a6),D1
- EOr.L D0,D1
- AndI.L #$00008000,D1
- Move.W D1,SignQ(a6) ...sign(Q) obtained
- AndI.L #$00007FFF,D0
- Move.L -8(A0),D1
- Move.L -4(A0),D2 ...(D0,D1,D2) is |X|
- Tst.L D0
- BNE.B X_Normal
- Move.L #$00003FFE,D0
- Tst.L D1
- BNE.B HiX_not0
-
-HiX_0:
- Move.L D2,D1
- CLR.L D2
- SubI.L #32,D0
- CLR.L D6
- BFFFO D1{0:32},D6
- LSL.L D6,D1
- Sub.L D6,D0 ...(D0,D1,D2) is normalized
-* ...with bias $7FFD
- BRA.B Init
-
-HiX_not0:
- CLR.L D6
- BFFFO D1{0:32},D6
- Sub.L D6,D0
- LSL.L D6,D1
- Move.L D2,D7 ...a copy of D2
- LSL.L D6,D2
- Neg.L D6
- AddI.L #32,D6
- LSR.L D6,D7
- Or.L D7,D1 ...(D0,D1,D2) normalized
-* ...with bias $7FFD
- BRA.B Init
-
-X_Normal:
- AddI.L #$00003FFE,D0 ...(D0,D1,D2) normalized
-* ...with bias $7FFD
-
-Init:
-*
- Move.L D3,L_SCR1(a6) ...save biased expo(Y)
- move.l d0,L_SCR2(a6) ;save d0
- Sub.L D3,D0 ...L := expo(X)-expo(Y)
-* Move.L D0,L ...D0 is j
- CLR.L D6 ...D6 := carry <- 0
- CLR.L D3 ...D3 is Q
- MoveA.L #0,A1 ...A1 is k; j+k=L, Q=0
-
-*..(Carry,D1,D2) is R
- Tst.L D0
- BGE.B Mod_Loop
-
-*..expo(X) < expo(Y). Thus X = mod(X,Y)
-*
- move.l L_SCR2(a6),d0 ;restore d0
- BRA.W Get_Mod
-
-*..At this point R = 2^(-L)X; Q = 0; k = 0; and k+j = L
-
-
-Mod_Loop:
- Tst.L D6 ...test carry bit
- BGT.B R_GT_Y
-
-*..At this point carry = 0, R = (D1,D2), Y = (D4,D5)
- Cmp.L D4,D1 ...compare hi(R) and hi(Y)
- BNE.B R_NE_Y
- Cmp.L D5,D2 ...compare lo(R) and lo(Y)
- BNE.B R_NE_Y
-
-*..At this point, R = Y
- BRA.W Rem_is_0
-
-R_NE_Y:
-*..use the borrow of the previous compare
- BCS.B R_LT_Y ...borrow is set iff R < Y
-
-R_GT_Y:
-*..If Carry is set, then Y < (Carry,D1,D2) < 2Y. Otherwise, Carry = 0
-*..and Y < (D1,D2) < 2Y. Either way, perform R - Y
- Sub.L D5,D2 ...lo(R) - lo(Y)
- SubX.L D4,D1 ...hi(R) - hi(Y)
- CLR.L D6 ...clear carry
- AddQ.L #1,D3 ...Q := Q + 1
-
-R_LT_Y:
-*..At this point, Carry=0, R < Y. R = 2^(k-L)X - QY; k+j = L; j >= 0.
- Tst.L D0 ...see if j = 0.
- BEQ.B PostLoop
-
- Add.L D3,D3 ...Q := 2Q
- Add.L D2,D2 ...lo(R) = 2lo(R)
- AddX.L D1,D1 ...hi(R) = 2hi(R) + carry
- SCS D6 ...set Carry if 2(R) overflows
- AddQ.L #1,A1 ...k := k+1
- SubQ.L #1,D0 ...j := j - 1
-*..At this point, R=(Carry,D1,D2) = 2^(k-L)X - QY, j+k=L, j >= 0, R < 2Y.
-
- BRA.B Mod_Loop
-
-PostLoop:
-*..k = L, j = 0, Carry = 0, R = (D1,D2) = X - QY, R < Y.
-
-*..normalize R.
- Move.L L_SCR1(a6),D0 ...new biased expo of R
- Tst.L D1
- BNE.B HiR_not0
-
-HiR_0:
- Move.L D2,D1
- CLR.L D2
- SubI.L #32,D0
- CLR.L D6
- BFFFO D1{0:32},D6
- LSL.L D6,D1
- Sub.L D6,D0 ...(D0,D1,D2) is normalized
-* ...with bias $7FFD
- BRA.B Get_Mod
-
-HiR_not0:
- CLR.L D6
- BFFFO D1{0:32},D6
- BMI.B Get_Mod ...already normalized
- Sub.L D6,D0
- LSL.L D6,D1
- Move.L D2,D7 ...a copy of D2
- LSL.L D6,D2
- Neg.L D6
- AddI.L #32,D6
- LSR.L D6,D7
- Or.L D7,D1 ...(D0,D1,D2) normalized
-
-*
-Get_Mod:
- CmpI.L #$000041FE,D0
- BGE.B No_Scale
-Do_Scale:
- Move.W D0,R(a6)
- clr.w R+2(a6)
- Move.L D1,R_Hi(a6)
- Move.L D2,R_Lo(a6)
- Move.L L_SCR1(a6),D6
- Move.W D6,Y(a6)
- clr.w Y+2(a6)
- Move.L D4,Y_Hi(a6)
- Move.L D5,Y_Lo(a6)
- FMove.X R(a6),fp0 ...no exception
- Move.L #1,Sc_Flag(a6)
- BRA.B ModOrRem
-No_Scale:
- Move.L D1,R_Hi(a6)
- Move.L D2,R_Lo(a6)
- SubI.L #$3FFE,D0
- Move.W D0,R(a6)
- clr.w R+2(a6)
- Move.L L_SCR1(a6),D6
- SubI.L #$3FFE,D6
- Move.L D6,L_SCR1(a6)
- FMove.X R(a6),fp0
- Move.W D6,Y(a6)
- Move.L D4,Y_Hi(a6)
- Move.L D5,Y_Lo(a6)
- Clr.L Sc_Flag(a6)
-
-*
-
-
-ModOrRem:
- Move.L Mod_Flag(a6),D6
- BEQ.B Fix_Sign
-
- Move.L L_SCR1(a6),D6 ...new biased expo(Y)
- SubQ.L #1,D6 ...biased expo(Y/2)
- Cmp.L D6,D0
- BLT.B Fix_Sign
- BGT.B Last_Sub
-
- Cmp.L D4,D1
- BNE.B Not_EQ
- Cmp.L D5,D2
- BNE.B Not_EQ
- BRA.W Tie_Case
-
-Not_EQ:
- BCS.B Fix_Sign
-
-Last_Sub:
-*
- FSub.X Y(a6),fp0 ...no exceptions
- AddQ.L #1,D3 ...Q := Q + 1
-
-*
-
-Fix_Sign:
-*..Get sign of X
- Move.W SignX(a6),D6
- BGE.B Get_Q
- FNeg.X fp0
-
-*..Get Q
-*
-Get_Q:
- clr.l d6
- Move.W SignQ(a6),D6 ...D6 is sign(Q)
- Move.L #8,D7
- LSR.L D7,D6
- AndI.L #$0000007F,D3 ...7 bits of Q
- Or.L D6,D3 ...sign and bits of Q
- Swap D3
- FMove.L fpsr,D6
- AndI.L #$FF00FFFF,D6
- Or.L D3,D6
- FMove.L D6,fpsr ...put Q in fpsr
-
-*
-Restore:
- MoveM.L (A7)+,D2-D7
- FMove.L USER_FPCR(a6),fpcr
- Move.L Sc_Flag(a6),D0
- BEQ.B Finish
- FMul.X Scale(pc),fp0 ...may cause underflow
- bra t_avoid_unsupp ;check for denorm as a
-* ;result of the scaling
-
-Finish:
- fmove.x fp0,fp0 ;capture exceptions & round
- rts
-
-Rem_is_0:
-*..R = 2^(-j)X - Q Y = Y, thus R = 0 and quotient = 2^j (Q+1)
- AddQ.L #1,D3
- CmpI.L #8,D0 ...D0 is j
- BGE.B Q_Big
-
- LSL.L D0,D3
- BRA.B Set_R_0
-
-Q_Big:
- CLR.L D3
-
-Set_R_0:
- FMove.S #:00000000,fp0
- Clr.L Sc_Flag(a6)
- BRA.W Fix_Sign
-
-Tie_Case:
-*..Check parity of Q
- Move.L D3,D6
- AndI.L #$00000001,D6
- Tst.L D6
- BEq.W Fix_Sign ...Q is even
-
-*..Q is odd, Q := Q + 1, signX := -signX
- AddQ.L #1,D3
- Move.W SignX(a6),D6
- EOrI.L #$00008000,D6
- Move.W D6,SignX(a6)
- BRA.W Fix_Sign
-
- End
diff --git a/sys/arch/m68k/fpsp/ssin.sa b/sys/arch/m68k/fpsp/ssin.sa
deleted file mode 100644
index 6f14e49bcb6..00000000000
--- a/sys/arch/m68k/fpsp/ssin.sa
+++ /dev/null
@@ -1,772 +0,0 @@
-* $OpenBSD: ssin.sa,v 1.4 2007/11/25 16:40:04 jmc Exp $
-* $NetBSD: ssin.sa,v 1.3 1994/10/26 07:50:01 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* ssin.sa 3.3 7/29/91
-*
-* The entry point sSIN computes the sine of an input argument
-* sCOS computes the cosine, and sSINCOS computes both. The
-* corresponding entry points with a "d" computes the same
-* corresponding function values for denormalized inputs.
-*
-* Input: Double-extended number X in location pointed to
-* by address register a0.
-*
-* Output: The function value sin(X) or cos(X) returned in Fp0 if SIN or
-* COS is requested. Otherwise, for SINCOS, sin(X) is returned
-* in Fp0, and cos(X) is returned in Fp1.
-*
-* Modifies: Fp0 for SIN or COS; both Fp0 and Fp1 for SINCOS.
-*
-* Accuracy and Monotonicity: The returned result is within 1 ulp in
-* 64 significant bit, i.e. within 0.5001 ulp to 53 bits if the
-* result is subsequently rounded to double precision. The
-* result is provably monotonic in double precision.
-*
-* Speed: The programs sSIN and sCOS take approximately 150 cycles for
-* input argument X such that |X| < 15Pi, which is the usual
-* situation. The speed for sSINCOS is approximately 190 cycles.
-*
-* Algorithm:
-*
-* SIN and COS:
-* 1. If SIN is invoked, set AdjN := 0; otherwise, set AdjN := 1.
-*
-* 2. If |X| >= 15Pi or |X| < 2**(-40), go to 7.
-*
-* 3. Decompose X as X = N(Pi/2) + r where |r| <= Pi/4. Let
-* k = N mod 4, so in particular, k = 0,1,2,or 3. Overwirte
-* k by k := k + AdjN.
-*
-* 4. If k is even, go to 6.
-*
-* 5. (k is odd) Set j := (k-1)/2, sgn := (-1)**j. Return sgn*cos(r)
-* where cos(r) is approximated by an even polynomial in r,
-* 1 + r*r*(B1+s*(B2+ ... + s*B8)), s = r*r.
-* Exit.
-*
-* 6. (k is even) Set j := k/2, sgn := (-1)**j. Return sgn*sin(r)
-* where sin(r) is approximated by an odd polynomial in r
-* r + r*s*(A1+s*(A2+ ... + s*A7)), s = r*r.
-* Exit.
-*
-* 7. If |X| > 1, go to 9.
-*
-* 8. (|X|<2**(-40)) If SIN is invoked, return X; otherwise return 1.
-*
-* 9. Overwrite X by X := X rem 2Pi. Now that |X| <= Pi, go back to 3.
-*
-* SINCOS:
-* 1. If |X| >= 15Pi or |X| < 2**(-40), go to 6.
-*
-* 2. Decompose X as X = N(Pi/2) + r where |r| <= Pi/4. Let
-* k = N mod 4, so in particular, k = 0,1,2,or 3.
-*
-* 3. If k is even, go to 5.
-*
-* 4. (k is odd) Set j1 := (k-1)/2, j2 := j1 (EOR) (k mod 2), i.e.
-* j1 exclusive or with the l.s.b. of k.
-* sgn1 := (-1)**j1, sgn2 := (-1)**j2.
-* SIN(X) = sgn1 * cos(r) and COS(X) = sgn2*sin(r) where
-* sin(r) and cos(r) are computed as odd and even polynomials
-* in r, respectively. Exit
-*
-* 5. (k is even) Set j1 := k/2, sgn1 := (-1)**j1.
-* SIN(X) = sgn1 * sin(r) and COS(X) = sgn1*cos(r) where
-* sin(r) and cos(r) are computed as odd and even polynomials
-* in r, respectively. Exit
-*
-* 6. If |X| > 1, go to 8.
-*
-* 7. (|X|<2**(-40)) SIN(X) = X and COS(X) = 1. Exit.
-*
-* 8. Overwrite X by X := X rem 2Pi. Now that |X| <= Pi, go back to 2.
-*
-
-SSIN IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
-BOUNDS1 DC.L $3FD78000,$4004BC7E
-TWOBYPI DC.L $3FE45F30,$6DC9C883
-
-SINA7 DC.L $BD6AAA77,$CCC994F5
-SINA6 DC.L $3DE61209,$7AAE8DA1
-
-SINA5 DC.L $BE5AE645,$2A118AE4
-SINA4 DC.L $3EC71DE3,$A5341531
-
-SINA3 DC.L $BF2A01A0,$1A018B59,$00000000,$00000000
-
-SINA2 DC.L $3FF80000,$88888888,$888859AF,$00000000
-
-SINA1 DC.L $BFFC0000,$AAAAAAAA,$AAAAAA99,$00000000
-
-COSB8 DC.L $3D2AC4D0,$D6011EE3
-COSB7 DC.L $BDA9396F,$9F45AC19
-
-COSB6 DC.L $3E21EED9,$0612C972
-COSB5 DC.L $BE927E4F,$B79D9FCF
-
-COSB4 DC.L $3EFA01A0,$1A01D423,$00000000,$00000000
-
-COSB3 DC.L $BFF50000,$B60B60B6,$0B61D438,$00000000
-
-COSB2 DC.L $3FFA0000,$AAAAAAAA,$AAAAAB5E
-COSB1 DC.L $BF000000
-
-INVTWOPI DC.L $3FFC0000,$A2F9836E,$4E44152A
-
-TWOPI1 DC.L $40010000,$C90FDAA2,$00000000,$00000000
-TWOPI2 DC.L $3FDF0000,$85A308D4,$00000000,$00000000
-
- xref PITBL
-
-INARG equ FP_SCR4
-
-X equ FP_SCR5
-XDCARE equ X+2
-XFRAC equ X+4
-
-RPRIME equ FP_SCR1
-SPRIME equ FP_SCR2
-
-POSNEG1 equ L_SCR1
-TWOTO63 equ L_SCR1
-
-ENDFLAG equ L_SCR2
-N equ L_SCR2
-
-ADJN equ L_SCR3
-
- xref t_frcinx
- xref t_extdnrm
- xref sto_cos
-
- xdef ssind
-ssind:
-*--SIN(X) = X FOR DENORMALIZED X
- bra t_extdnrm
-
- xdef scosd
-scosd:
-*--COS(X) = 1 FOR DENORMALIZED X
-
- FMOVE.S #:3F800000,FP0
-*
-* 9D25B Fix: Sometimes the previous fmove.s sets fpsr bits
-*
- fmove.l #0,fpsr
-*
- bra t_frcinx
-
- xdef ssin
-ssin:
-*--SET ADJN TO 0
- CLR.L ADJN(a6)
- BRA.B SINBGN
-
- xdef scos
-scos:
-*--SET ADJN TO 1
- MOVE.L #1,ADJN(a6)
-
-SINBGN:
-*--SAVE FPCR, FP1. CHECK IF |X| IS TOO SMALL OR LARGE
-
- FMOVE.X (a0),FP0 ...LOAD INPUT
-
- MOVE.L (A0),D0
- MOVE.W 4(A0),D0
- FMOVE.X FP0,X(a6)
- ANDI.L #$7FFFFFFF,D0 ...COMPACTIFY X
-
- CMPI.L #$3FD78000,D0 ...|X| >= 2**(-40)?
- BGE.B SOK1
- BRA.W SINSM
-
-SOK1:
- CMPI.L #$4004BC7E,D0 ...|X| < 15 PI?
- BLT.B SINMAIN
- BRA.W REDUCEX
-
-SINMAIN:
-*--THIS IS THE USUAL CASE, |X| <= 15 PI.
-*--THE ARGUMENT REDUCTION IS DONE BY TABLE LOOK UP.
- FMOVE.X FP0,FP1
- FMUL.D TWOBYPI,FP1 ...X*2/PI
-
-*--HIDE THE NEXT THREE INSTRUCTIONS
- LEA PITBL+$200,A1 ...TABLE OF N*PI/2, N = -32,...,32
-
-
-*--FP1 IS NOW READY
- FMOVE.L FP1,N(a6) ...CONVERT TO INTEGER
-
- MOVE.L N(a6),D0
- ASL.L #4,D0
- ADDA.L D0,A1 ...A1 IS THE ADDRESS OF N*PIBY2
-* ...WHICH IS IN TWO PIECES Y1 & Y2
-
- FSUB.X (A1)+,FP0 ...X-Y1
-*--HIDE THE NEXT ONE
- FSUB.S (A1),FP0 ...FP0 IS R = (X-Y1)-Y2
-
-SINCONT:
-*--continuation from REDUCEX
-
-*--GET N+ADJN AND SEE IF SIN(R) OR COS(R) IS NEEDED
- MOVE.L N(a6),D0
- ADD.L ADJN(a6),D0 ...SEE IF D0 IS ODD OR EVEN
- ROR.L #1,D0 ...D0 WAS ODD IFF D0 IS NEGATIVE
- TST.L D0
- BLT.W COSPOLY
-
-SINPOLY:
-*--LET J BE THE LEAST SIG. BIT OF D0, LET SGN := (-1)**J.
-*--THEN WE RETURN SGN*SIN(R). SGN*SIN(R) IS COMPUTED BY
-*--R' + R'*S*(A1 + S(A2 + S(A3 + S(A4 + ... + SA7)))), WHERE
-*--R' = SGN*R, S=R*R. THIS CAN BE REWRITTEN AS
-*--R' + R'*S*( [A1+T(A3+T(A5+TA7))] + [S(A2+T(A4+TA6))])
-*--WHERE T=S*S.
-*--NOTE THAT A3 THROUGH A7 ARE STORED IN DOUBLE PRECISION
-*--WHILE A1 AND A2 ARE IN DOUBLE-EXTENDED FORMAT.
- FMOVE.X FP0,X(a6) ...X IS R
- FMUL.X FP0,FP0 ...FP0 IS S
-*---HIDE THE NEXT TWO WHILE WAITING FOR FP0
- FMOVE.D SINA7,FP3
- FMOVE.D SINA6,FP2
-*--FP0 IS NOW READY
- FMOVE.X FP0,FP1
- FMUL.X FP1,FP1 ...FP1 IS T
-*--HIDE THE NEXT TWO WHILE WAITING FOR FP1
-
- ROR.L #1,D0
- ANDI.L #$80000000,D0
-* ...LEAST SIG. BIT OF D0 IN SIGN POSITION
- EOR.L D0,X(a6) ...X IS NOW R'= SGN*R
-
- FMUL.X FP1,FP3 ...TA7
- FMUL.X FP1,FP2 ...TA6
-
- FADD.D SINA5,FP3 ...A5+TA7
- FADD.D SINA4,FP2 ...A4+TA6
-
- FMUL.X FP1,FP3 ...T(A5+TA7)
- FMUL.X FP1,FP2 ...T(A4+TA6)
-
- FADD.D SINA3,FP3 ...A3+T(A5+TA7)
- FADD.X SINA2,FP2 ...A2+T(A4+TA6)
-
- FMUL.X FP3,FP1 ...T(A3+T(A5+TA7))
-
- FMUL.X FP0,FP2 ...S(A2+T(A4+TA6))
- FADD.X SINA1,FP1 ...A1+T(A3+T(A5+TA7))
- FMUL.X X(a6),FP0 ...R'*S
-
- FADD.X FP2,FP1 ...[A1+T(A3+T(A5+TA7))]+[S(A2+T(A4+TA6))]
-*--FP3 RELEASED, RESTORE NOW AND TAKE SOME ADVANTAGE OF HIDING
-*--FP2 RELEASED, RESTORE NOW AND TAKE FULL ADVANTAGE OF HIDING
-
-
- FMUL.X FP1,FP0 ...SIN(R')-R'
-*--FP1 RELEASED.
-
- FMOVE.L d1,FPCR ;restore users exceptions
- FADD.X X(a6),FP0 ;last inst - possible exception set
- bra t_frcinx
-
-
-COSPOLY:
-*--LET J BE THE LEAST SIG. BIT OF D0, LET SGN := (-1)**J.
-*--THEN WE RETURN SGN*COS(R). SGN*COS(R) IS COMPUTED BY
-*--SGN + S'*(B1 + S(B2 + S(B3 + S(B4 + ... + SB8)))), WHERE
-*--S=R*R AND S'=SGN*S. THIS CAN BE REWRITTEN AS
-*--SGN + S'*([B1+T(B3+T(B5+TB7))] + [S(B2+T(B4+T(B6+TB8)))])
-*--WHERE T=S*S.
-*--NOTE THAT B4 THROUGH B8 ARE STORED IN DOUBLE PRECISION
-*--WHILE B2 AND B3 ARE IN DOUBLE-EXTENDED FORMAT, B1 IS -1/2
-*--AND IS THEREFORE STORED AS SINGLE PRECISION.
-
- FMUL.X FP0,FP0 ...FP0 IS S
-*---HIDE THE NEXT TWO WHILE WAITING FOR FP0
- FMOVE.D COSB8,FP2
- FMOVE.D COSB7,FP3
-*--FP0 IS NOW READY
- FMOVE.X FP0,FP1
- FMUL.X FP1,FP1 ...FP1 IS T
-*--HIDE THE NEXT TWO WHILE WAITING FOR FP1
- FMOVE.X FP0,X(a6) ...X IS S
- ROR.L #1,D0
- ANDI.L #$80000000,D0
-* ...LEAST SIG. BIT OF D0 IN SIGN POSITION
-
- FMUL.X FP1,FP2 ...TB8
-*--HIDE THE NEXT TWO WHILE WAITING FOR THE XU
- EOR.L D0,X(a6) ...X IS NOW S'= SGN*S
- ANDI.L #$80000000,D0
-
- FMUL.X FP1,FP3 ...TB7
-*--HIDE THE NEXT TWO WHILE WAITING FOR THE XU
- ORI.L #$3F800000,D0 ...D0 IS SGN IN SINGLE
- MOVE.L D0,POSNEG1(a6)
-
- FADD.D COSB6,FP2 ...B6+TB8
- FADD.D COSB5,FP3 ...B5+TB7
-
- FMUL.X FP1,FP2 ...T(B6+TB8)
- FMUL.X FP1,FP3 ...T(B5+TB7)
-
- FADD.D COSB4,FP2 ...B4+T(B6+TB8)
- FADD.X COSB3,FP3 ...B3+T(B5+TB7)
-
- FMUL.X FP1,FP2 ...T(B4+T(B6+TB8))
- FMUL.X FP3,FP1 ...T(B3+T(B5+TB7))
-
- FADD.X COSB2,FP2 ...B2+T(B4+T(B6+TB8))
- FADD.S COSB1,FP1 ...B1+T(B3+T(B5+TB7))
-
- FMUL.X FP2,FP0 ...S(B2+T(B4+T(B6+TB8)))
-*--FP3 RELEASED, RESTORE NOW AND TAKE SOME ADVANTAGE OF HIDING
-*--FP2 RELEASED.
-
-
- FADD.X FP1,FP0
-*--FP1 RELEASED
-
- FMUL.X X(a6),FP0
-
- FMOVE.L d1,FPCR ;restore users exceptions
- FADD.S POSNEG1(a6),FP0 ;last inst - possible exception set
- bra t_frcinx
-
-
-SINBORS:
-*--IF |X| > 15PI, WE USE THE GENERAL ARGUMENT REDUCTION.
-*--IF |X| < 2**(-40), RETURN X OR 1.
- CMPI.L #$3FFF8000,D0
- BGT.B REDUCEX
-
-
-SINSM:
- MOVE.L ADJN(a6),D0
- TST.L D0
- BGT.B COSTINY
-
-SINTINY:
- CLR.W XDCARE(a6) ...JUST IN CASE
- FMOVE.L d1,FPCR ;restore users exceptions
- FMOVE.X X(a6),FP0 ;last inst - possible exception set
- bra t_frcinx
-
-
-COSTINY:
- FMOVE.S #:3F800000,FP0
-
- FMOVE.L d1,FPCR ;restore users exceptions
- FSUB.S #:00800000,FP0 ;last inst - possible exception set
- bra t_frcinx
-
-
-REDUCEX:
-*--WHEN REDUCEX IS USED, THE CODE WILL INEVITABLY BE SLOW.
-*--THIS REDUCTION METHOD, HOWEVER, IS MUCH FASTER THAN USING
-*--THE REMAINDER INSTRUCTION WHICH IS NOW IN SOFTWARE.
-
- FMOVEM.X FP2-FP5,-(A7) ...save FP2 through FP5
- MOVE.L D2,-(A7)
- FMOVE.S #:00000000,FP1
-*--If compact form of abs(arg) in d0=$7ffeffff, argument is so large that
-*--there is a danger of unwanted overflow in first LOOP iteration. In this
-*--case, reduce argument by one remainder step to make subsequent reduction
-*--safe.
- cmpi.l #$7ffeffff,d0 ;is argument dangerously large?
- bne.b LOOP
- move.l #$7ffe0000,FP_SCR2(a6) ;yes
-* ;create 2**16383*PI/2
- move.l #$c90fdaa2,FP_SCR2+4(a6)
- clr.l FP_SCR2+8(a6)
- ftst.x fp0 ;test sign of argument
- move.l #$7fdc0000,FP_SCR3(a6) ;create low half of 2**16383*
-* ;PI/2 at FP_SCR3
- move.l #$85a308d3,FP_SCR3+4(a6)
- clr.l FP_SCR3+8(a6)
- fblt.w red_neg
- or.w #$8000,FP_SCR2(a6) ;positive arg
- or.w #$8000,FP_SCR3(a6)
-red_neg:
- fadd.x FP_SCR2(a6),fp0 ;high part of reduction is exact
- fmove.x fp0,fp1 ;save high result in fp1
- fadd.x FP_SCR3(a6),fp0 ;low part of reduction
- fsub.x fp0,fp1 ;determine low component of result
- fadd.x FP_SCR3(a6),fp1 ;fp0/fp1 are reduced argument.
-
-*--ON ENTRY, FP0 IS X, ON RETURN, FP0 IS X REM PI/2, |X| <= PI/4.
-*--integer quotient will be stored in N
-*--Intermeditate remainder is 66-bit long; (R,r) in (FP0,FP1)
-
-LOOP:
- FMOVE.X FP0,INARG(a6) ...+-2**K * F, 1 <= F < 2
- MOVE.W INARG(a6),D0
- MOVE.L D0,A1 ...save a copy of D0
- ANDI.L #$00007FFF,D0
- SUBI.L #$00003FFF,D0 ...D0 IS K
- CMPI.L #28,D0
- BLE.B LASTLOOP
-CONTLOOP:
- SUBI.L #27,D0 ...D0 IS L := K-27
- CLR.L ENDFLAG(a6)
- BRA.B WORK
-LASTLOOP:
- CLR.L D0 ...D0 IS L := 0
- MOVE.L #1,ENDFLAG(a6)
-
-WORK:
-*--FIND THE REMAINDER OF (R,r) W.R.T. 2**L * (PI/2). L IS SO CHOSEN
-*--THAT INT( X * (2/PI) / 2**(L) ) < 2**29.
-
-*--CREATE 2**(-L) * (2/PI), SIGN(INARG)*2**(63),
-*--2**L * (PIby2_1), 2**L * (PIby2_2)
-
- MOVE.L #$00003FFE,D2 ...BIASED EXPO OF 2/PI
- SUB.L D0,D2 ...BIASED EXPO OF 2**(-L)*(2/PI)
-
- MOVE.L #$A2F9836E,FP_SCR1+4(a6)
- MOVE.L #$4E44152A,FP_SCR1+8(a6)
- MOVE.W D2,FP_SCR1(a6) ...FP_SCR1 is 2**(-L)*(2/PI)
-
- FMOVE.X FP0,FP2
- FMUL.X FP_SCR1(a6),FP2
-*--WE MUST NOW FIND INT(FP2). SINCE WE NEED THIS VALUE IN
-*--FLOATING POINT FORMAT, THE TWO FMOVE'S FMOVE.L FP <--> N
-*--WILL BE TOO INEFFICIENT. THE WAY AROUND IT IS THAT
-*--(SIGN(INARG)*2**63 + FP2) - SIGN(INARG)*2**63 WILL GIVE
-*--US THE DESIRED VALUE IN FLOATING POINT.
-
-*--HIDE SIX CYCLES OF INSTRUCTION
- MOVE.L A1,D2
- SWAP D2
- ANDI.L #$80000000,D2
- ORI.L #$5F000000,D2 ...D2 IS SIGN(INARG)*2**63 IN SGL
- MOVE.L D2,TWOTO63(a6)
-
- MOVE.L D0,D2
- ADDI.L #$00003FFF,D2 ...BIASED EXPO OF 2**L * (PI/2)
-
-*--FP2 IS READY
- FADD.S TWOTO63(a6),FP2 ...THE FRACTIONAL PART OF FP1 IS ROUNDED
-
-*--HIDE 4 CYCLES OF INSTRUCTION; creating 2**(L)*Piby2_1 and 2**(L)*Piby2_2
- MOVE.W D2,FP_SCR2(a6)
- CLR.W FP_SCR2+2(a6)
- MOVE.L #$C90FDAA2,FP_SCR2+4(a6)
- CLR.L FP_SCR2+8(a6) ...FP_SCR2 is 2**(L) * Piby2_1
-
-*--FP2 IS READY
- FSUB.S TWOTO63(a6),FP2 ...FP2 is N
-
- ADDI.L #$00003FDD,D0
- MOVE.W D0,FP_SCR3(a6)
- CLR.W FP_SCR3+2(a6)
- MOVE.L #$85A308D3,FP_SCR3+4(a6)
- CLR.L FP_SCR3+8(a6) ...FP_SCR3 is 2**(L) * Piby2_2
-
- MOVE.L ENDFLAG(a6),D0
-
-*--We are now ready to perform (R+r) - N*P1 - N*P2, P1 = 2**(L) * Piby2_1 and
-*--P2 = 2**(L) * Piby2_2
- FMOVE.X FP2,FP4
- FMul.X FP_SCR2(a6),FP4 ...W = N*P1
- FMove.X FP2,FP5
- FMul.X FP_SCR3(a6),FP5 ...w = N*P2
- FMove.X FP4,FP3
-*--we want P+p = W+w but |p| <= half ulp of P
-*--Then, we need to compute A := R-P and a := r-p
- FAdd.X FP5,FP3 ...FP3 is P
- FSub.X FP3,FP4 ...W-P
-
- FSub.X FP3,FP0 ...FP0 is A := R - P
- FAdd.X FP5,FP4 ...FP4 is p = (W-P)+w
-
- FMove.X FP0,FP3 ...FP3 A
- FSub.X FP4,FP1 ...FP1 is a := r - p
-
-*--Now we need to normalize (A,a) to "new (R,r)" where R+r = A+a but
-*--|r| <= half ulp of R.
- FAdd.X FP1,FP0 ...FP0 is R := A+a
-*--No need to calculate r if this is the last loop
- TST.L D0
- BGT.W RESTORE
-
-*--Need to calculate r
- FSub.X FP0,FP3 ...A-R
- FAdd.X FP3,FP1 ...FP1 is r := (A-R)+a
- BRA.W LOOP
-
-RESTORE:
- FMOVE.L FP2,N(a6)
- MOVE.L (A7)+,D2
- FMOVEM.X (A7)+,FP2-FP5
-
-
- MOVE.L ADJN(a6),D0
- CMPI.L #4,D0
-
- BLT.W SINCONT
- BRA.B SCCONT
-
- xdef ssincosd
-ssincosd:
-*--SIN AND COS OF X FOR DENORMALIZED X
-
- FMOVE.S #:3F800000,FP1
- bsr sto_cos ;store cosine result
- bra t_extdnrm
-
- xdef ssincos
-ssincos:
-*--SET ADJN TO 4
- MOVE.L #4,ADJN(a6)
-
- FMOVE.X (a0),FP0 ...LOAD INPUT
-
- MOVE.L (A0),D0
- MOVE.W 4(A0),D0
- FMOVE.X FP0,X(a6)
- ANDI.L #$7FFFFFFF,D0 ...COMPACTIFY X
-
- CMPI.L #$3FD78000,D0 ...|X| >= 2**(-40)?
- BGE.B SCOK1
- BRA.W SCSM
-
-SCOK1:
- CMPI.L #$4004BC7E,D0 ...|X| < 15 PI?
- BLT.B SCMAIN
- BRA.W REDUCEX
-
-
-SCMAIN:
-*--THIS IS THE USUAL CASE, |X| <= 15 PI.
-*--THE ARGUMENT REDUCTION IS DONE BY TABLE LOOK UP.
- FMOVE.X FP0,FP1
- FMUL.D TWOBYPI,FP1 ...X*2/PI
-
-*--HIDE THE NEXT THREE INSTRUCTIONS
- LEA PITBL+$200,A1 ...TABLE OF N*PI/2, N = -32,...,32
-
-
-*--FP1 IS NOW READY
- FMOVE.L FP1,N(a6) ...CONVERT TO INTEGER
-
- MOVE.L N(a6),D0
- ASL.L #4,D0
- ADDA.L D0,A1 ...ADDRESS OF N*PIBY2, IN Y1, Y2
-
- FSUB.X (A1)+,FP0 ...X-Y1
- FSUB.S (A1),FP0 ...FP0 IS R = (X-Y1)-Y2
-
-SCCONT:
-*--continuation point from REDUCEX
-
-*--HIDE THE NEXT TWO
- MOVE.L N(a6),D0
- ROR.L #1,D0
-
- TST.L D0 ...D0 < 0 IFF N IS ODD
- BGE.W NEVEN
-
-NODD:
-*--REGISTERS SAVED SO FAR: D0, A0, FP2.
-
- FMOVE.X FP0,RPRIME(a6)
- FMUL.X FP0,FP0 ...FP0 IS S = R*R
- FMOVE.D SINA7,FP1 ...A7
- FMOVE.D COSB8,FP2 ...B8
- FMUL.X FP0,FP1 ...SA7
- MOVE.L d2,-(A7)
- MOVE.L D0,d2
- FMUL.X FP0,FP2 ...SB8
- ROR.L #1,d2
- ANDI.L #$80000000,d2
-
- FADD.D SINA6,FP1 ...A6+SA7
- EOR.L D0,d2
- ANDI.L #$80000000,d2
- FADD.D COSB7,FP2 ...B7+SB8
-
- FMUL.X FP0,FP1 ...S(A6+SA7)
- EOR.L d2,RPRIME(a6)
- MOVE.L (A7)+,d2
- FMUL.X FP0,FP2 ...S(B7+SB8)
- ROR.L #1,D0
- ANDI.L #$80000000,D0
-
- FADD.D SINA5,FP1 ...A5+S(A6+SA7)
- MOVE.L #$3F800000,POSNEG1(a6)
- EOR.L D0,POSNEG1(a6)
- FADD.D COSB6,FP2 ...B6+S(B7+SB8)
-
- FMUL.X FP0,FP1 ...S(A5+S(A6+SA7))
- FMUL.X FP0,FP2 ...S(B6+S(B7+SB8))
- FMOVE.X FP0,SPRIME(a6)
-
- FADD.D SINA4,FP1 ...A4+S(A5+S(A6+SA7))
- EOR.L D0,SPRIME(a6)
- FADD.D COSB5,FP2 ...B5+S(B6+S(B7+SB8))
-
- FMUL.X FP0,FP1 ...S(A4+...)
- FMUL.X FP0,FP2 ...S(B5+...)
-
- FADD.D SINA3,FP1 ...A3+S(A4+...)
- FADD.D COSB4,FP2 ...B4+S(B5+...)
-
- FMUL.X FP0,FP1 ...S(A3+...)
- FMUL.X FP0,FP2 ...S(B4+...)
-
- FADD.X SINA2,FP1 ...A2+S(A3+...)
- FADD.X COSB3,FP2 ...B3+S(B4+...)
-
- FMUL.X FP0,FP1 ...S(A2+...)
- FMUL.X FP0,FP2 ...S(B3+...)
-
- FADD.X SINA1,FP1 ...A1+S(A2+...)
- FADD.X COSB2,FP2 ...B2+S(B3+...)
-
- FMUL.X FP0,FP1 ...S(A1+...)
- FMUL.X FP2,FP0 ...S(B2+...)
-
-
-
- FMUL.X RPRIME(a6),FP1 ...R'S(A1+...)
- FADD.S COSB1,FP0 ...B1+S(B2...)
- FMUL.X SPRIME(a6),FP0 ...S'(B1+S(B2+...))
-
- move.l d1,-(sp) ;restore users mode & precision
- andi.l #$ff,d1 ;mask off all exceptions
- fmove.l d1,FPCR
- FADD.X RPRIME(a6),FP1 ...COS(X)
- bsr sto_cos ;store cosine result
- FMOVE.L (sp)+,FPCR ;restore users exceptions
- FADD.S POSNEG1(a6),FP0 ...SIN(X)
-
- bra t_frcinx
-
-
-NEVEN:
-*--REGISTERS SAVED SO FAR: FP2.
-
- FMOVE.X FP0,RPRIME(a6)
- FMUL.X FP0,FP0 ...FP0 IS S = R*R
- FMOVE.D COSB8,FP1 ...B8
- FMOVE.D SINA7,FP2 ...A7
- FMUL.X FP0,FP1 ...SB8
- FMOVE.X FP0,SPRIME(a6)
- FMUL.X FP0,FP2 ...SA7
- ROR.L #1,D0
- ANDI.L #$80000000,D0
- FADD.D COSB7,FP1 ...B7+SB8
- FADD.D SINA6,FP2 ...A6+SA7
- EOR.L D0,RPRIME(a6)
- EOR.L D0,SPRIME(a6)
- FMUL.X FP0,FP1 ...S(B7+SB8)
- ORI.L #$3F800000,D0
- MOVE.L D0,POSNEG1(a6)
- FMUL.X FP0,FP2 ...S(A6+SA7)
-
- FADD.D COSB6,FP1 ...B6+S(B7+SB8)
- FADD.D SINA5,FP2 ...A5+S(A6+SA7)
-
- FMUL.X FP0,FP1 ...S(B6+S(B7+SB8))
- FMUL.X FP0,FP2 ...S(A5+S(A6+SA7))
-
- FADD.D COSB5,FP1 ...B5+S(B6+S(B7+SB8))
- FADD.D SINA4,FP2 ...A4+S(A5+S(A6+SA7))
-
- FMUL.X FP0,FP1 ...S(B5+...)
- FMUL.X FP0,FP2 ...S(A4+...)
-
- FADD.D COSB4,FP1 ...B4+S(B5+...)
- FADD.D SINA3,FP2 ...A3+S(A4+...)
-
- FMUL.X FP0,FP1 ...S(B4+...)
- FMUL.X FP0,FP2 ...S(A3+...)
-
- FADD.X COSB3,FP1 ...B3+S(B4+...)
- FADD.X SINA2,FP2 ...A2+S(A3+...)
-
- FMUL.X FP0,FP1 ...S(B3+...)
- FMUL.X FP0,FP2 ...S(A2+...)
-
- FADD.X COSB2,FP1 ...B2+S(B3+...)
- FADD.X SINA1,FP2 ...A1+S(A2+...)
-
- FMUL.X FP0,FP1 ...S(B2+...)
- fmul.x fp2,fp0 ...s(a1+...)
-
-
-
- FADD.S COSB1,FP1 ...B1+S(B2...)
- FMUL.X RPRIME(a6),FP0 ...R'S(A1+...)
- FMUL.X SPRIME(a6),FP1 ...S'(B1+S(B2+...))
-
- move.l d1,-(sp) ;save users mode & precision
- andi.l #$ff,d1 ;mask off all exceptions
- fmove.l d1,FPCR
- FADD.S POSNEG1(a6),FP1 ...COS(X)
- bsr sto_cos ;store cosine result
- FMOVE.L (sp)+,FPCR ;restore users exceptions
- FADD.X RPRIME(a6),FP0 ...SIN(X)
-
- bra t_frcinx
-
-SCBORS:
- CMPI.L #$3FFF8000,D0
- BGT.W REDUCEX
-
-
-SCSM:
- CLR.W XDCARE(a6)
- FMOVE.S #:3F800000,FP1
-
- move.l d1,-(sp) ;save users mode & precision
- andi.l #$ff,d1 ;mask off all exceptions
- fmove.l d1,FPCR
- FSUB.S #:00800000,FP1
- bsr sto_cos ;store cosine result
- FMOVE.L (sp)+,FPCR ;restore users exceptions
- FMOVE.X X(a6),FP0
- bra t_frcinx
-
- end
diff --git a/sys/arch/m68k/fpsp/ssinh.sa b/sys/arch/m68k/fpsp/ssinh.sa
deleted file mode 100644
index 71aa2a88d2d..00000000000
--- a/sys/arch/m68k/fpsp/ssinh.sa
+++ /dev/null
@@ -1,161 +0,0 @@
-* $OpenBSD: ssinh.sa,v 1.2 1996/05/29 21:05:42 niklas Exp $
-* $NetBSD: ssinh.sa,v 1.3 1994/10/26 07:50:05 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* ssinh.sa 3.1 12/10/90
-*
-* The entry point sSinh computes the hyperbolic sine of
-* an input argument; sSinhd does the same except for denormalized
-* input.
-*
-* Input: Double-extended number X in location pointed to
-* by address register a0.
-*
-* Output: The value sinh(X) returned in floating-point register Fp0.
-*
-* Accuracy and Monotonicity: The returned result is within 3 ulps in
-* 64 significant bit, i.e. within 0.5001 ulp to 53 bits if the
-* result is subsequently rounded to double precision. The
-* result is provably monotonic in double precision.
-*
-* Speed: The program sSINH takes approximately 280 cycles.
-*
-* Algorithm:
-*
-* SINH
-* 1. If |X| > 16380 log2, go to 3.
-*
-* 2. (|X| <= 16380 log2) Sinh(X) is obtained by the formulae
-* y = |X|, sgn = sign(X), and z = expm1(Y),
-* sinh(X) = sgn*(1/2)*( z + z/(1+z) ).
-* Exit.
-*
-* 3. If |X| > 16480 log2, go to 5.
-*
-* 4. (16380 log2 < |X| <= 16480 log2)
-* sinh(X) = sign(X) * exp(|X|)/2.
-* However, invoking exp(|X|) may cause premature overflow.
-* Thus, we calculate sinh(X) as follows:
-* Y := |X|
-* sgn := sign(X)
-* sgnFact := sgn * 2**(16380)
-* Y' := Y - 16381 log2
-* sinh(X) := sgnFact * exp(Y').
-* Exit.
-*
-* 5. (|X| > 16480 log2) sinh(X) must overflow. Return
-* sign(X)*Huge*Huge to generate overflow and an infinity with
-* the appropriate sign. Huge is the largest finite number in
-* extended format. Exit.
-*
-
-SSINH IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
-T1 DC.L $40C62D38,$D3D64634 ... 16381 LOG2 LEAD
-T2 DC.L $3D6F90AE,$B1E75CC7 ... 16381 LOG2 TRAIL
-
- xref t_frcinx
- xref t_ovfl
- xref t_extdnrm
- xref setox
- xref setoxm1
-
- xdef ssinhd
-ssinhd:
-*--SINH(X) = X FOR DENORMALIZED X
-
- bra t_extdnrm
-
- xdef ssinh
-ssinh:
- FMOVE.x (a0),FP0 ...LOAD INPUT
-
- move.l (a0),d0
- move.w 4(a0),d0
- move.l d0,a1 save a copy of original (compacted) operand
- AND.L #$7FFFFFFF,D0
- CMP.L #$400CB167,D0
- BGT.B SINHBIG
-
-*--THIS IS THE USUAL CASE, |X| < 16380 LOG2
-*--Y = |X|, Z = EXPM1(Y), SINH(X) = SIGN(X)*(1/2)*( Z + Z/(1+Z) )
-
- FABS.X FP0 ...Y = |X|
-
- movem.l a1/d1,-(sp)
- fmovem.x fp0,(a0)
- clr.l d1
- bsr setoxm1 ...FP0 IS Z = EXPM1(Y)
- fmove.l #0,fpcr
- movem.l (sp)+,a1/d1
-
- FMOVE.X FP0,FP1
- FADD.S #:3F800000,FP1 ...1+Z
- FMOVE.X FP0,-(sp)
- FDIV.X FP1,FP0 ...Z/(1+Z)
- MOVE.L a1,d0
- AND.L #$80000000,D0
- OR.L #$3F000000,D0
- FADD.X (sp)+,FP0
- MOVE.L D0,-(sp)
-
- fmove.l d1,fpcr
- fmul.s (sp)+,fp0 ;last fp inst - possible exceptions set
-
- bra t_frcinx
-
-SINHBIG:
- cmp.l #$400CB2B3,D0
- bgt t_ovfl
- FABS.X FP0
- FSUB.D T1(pc),FP0 ...(|X|-16381LOG2_LEAD)
- clr.l -(sp)
- move.l #$80000000,-(sp)
- move.l a1,d0
- AND.L #$80000000,D0
- OR.L #$7FFB0000,D0
- MOVE.L D0,-(sp) ...EXTENDED FMT
- FSUB.D T2(pc),FP0 ...|X| - 16381 LOG2, ACCURATE
-
- move.l d1,-(sp)
- clr.l d1
- fmovem.x fp0,(a0)
- bsr setox
- fmove.l (sp)+,fpcr
-
- fmul.x (sp)+,fp0 ;possible exception
- bra t_frcinx
-
- end
diff --git a/sys/arch/m68k/fpsp/stan.sa b/sys/arch/m68k/fpsp/stan.sa
deleted file mode 100644
index 9b8707e09e3..00000000000
--- a/sys/arch/m68k/fpsp/stan.sa
+++ /dev/null
@@ -1,481 +0,0 @@
-* $OpenBSD: stan.sa,v 1.3 2003/11/07 10:36:10 miod Exp $
-* $NetBSD: stan.sa,v 1.3 1994/10/26 07:50:10 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* stan.sa 3.3 7/29/91
-*
-* The entry point stan computes the tangent of
-* an input argument;
-* stand does the same except for denormalized input.
-*
-* Input: Double-extended number X in location pointed to
-* by address register a0.
-*
-* Output: The value tan(X) returned in floating-point register Fp0.
-*
-* Accuracy and Monotonicity: The returned result is within 3 ulp in
-* 64 significant bit, i.e. within 0.5001 ulp to 53 bits if the
-* result is subsequently rounded to double precision. The
-* result is provably monotonic in double precision.
-*
-* Speed: The program sTAN takes approximately 170 cycles for
-* input argument X such that |X| < 15Pi, which is the usual
-* situation.
-*
-* Algorithm:
-*
-* 1. If |X| >= 15Pi or |X| < 2**(-40), go to 6.
-*
-* 2. Decompose X as X = N(Pi/2) + r where |r| <= Pi/4. Let
-* k = N mod 2, so in particular, k = 0 or 1.
-*
-* 3. If k is odd, go to 5.
-*
-* 4. (k is even) Tan(X) = tan(r) and tan(r) is approximated by a
-* rational function U/V where
-* U = r + r*s*(P1 + s*(P2 + s*P3)), and
-* V = 1 + s*(Q1 + s*(Q2 + s*(Q3 + s*Q4))), s = r*r.
-* Exit.
-*
-* 4. (k is odd) Tan(X) = -cot(r). Since tan(r) is approximated by a
-* rational function U/V where
-* U = r + r*s*(P1 + s*(P2 + s*P3)), and
-* V = 1 + s*(Q1 + s*(Q2 + s*(Q3 + s*Q4))), s = r*r,
-* -Cot(r) = -V/U. Exit.
-*
-* 6. If |X| > 1, go to 8.
-*
-* 7. (|X|<2**(-40)) Tan(X) = X. Exit.
-*
-* 8. Overwrite X by X := X rem 2Pi. Now that |X| <= Pi, go back to 2.
-*
-
-STAN IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
-BOUNDS1 DC.L $3FD78000,$4004BC7E
-TWOBYPI DC.L $3FE45F30,$6DC9C883
-
-TANQ4 DC.L $3EA0B759,$F50F8688
-TANP3 DC.L $BEF2BAA5,$A8924F04
-
-TANQ3 DC.L $BF346F59,$B39BA65F,$00000000,$00000000
-
-TANP2 DC.L $3FF60000,$E073D3FC,$199C4A00,$00000000
-
-TANQ2 DC.L $3FF90000,$D23CD684,$15D95FA1,$00000000
-
-TANP1 DC.L $BFFC0000,$8895A6C5,$FB423BCA,$00000000
-
-TANQ1 DC.L $BFFD0000,$EEF57E0D,$A84BC8CE,$00000000
-
-INVTWOPI DC.L $3FFC0000,$A2F9836E,$4E44152A,$00000000
-
-TWOPI1 DC.L $40010000,$C90FDAA2,$00000000,$00000000
-TWOPI2 DC.L $3FDF0000,$85A308D4,$00000000,$00000000
-
-*--N*PI/2, -32 <= N <= 32, IN A LEADING TERM IN EXT. AND TRAILING
-*--TERM IN SGL. NOTE THAT PI IS 64-BIT LONG, THUS N*PI/2 IS AT
-*--MOST 69 BITS LONG.
- xdef PITBL
-PITBL:
- DC.L $C0040000,$C90FDAA2,$2168C235,$21800000
- DC.L $C0040000,$C2C75BCD,$105D7C23,$A0D00000
- DC.L $C0040000,$BC7EDCF7,$FF523611,$A1E80000
- DC.L $C0040000,$B6365E22,$EE46F000,$21480000
- DC.L $C0040000,$AFEDDF4D,$DD3BA9EE,$A1200000
- DC.L $C0040000,$A9A56078,$CC3063DD,$21FC0000
- DC.L $C0040000,$A35CE1A3,$BB251DCB,$21100000
- DC.L $C0040000,$9D1462CE,$AA19D7B9,$A1580000
- DC.L $C0040000,$96CBE3F9,$990E91A8,$21E00000
- DC.L $C0040000,$90836524,$88034B96,$20B00000
- DC.L $C0040000,$8A3AE64F,$76F80584,$A1880000
- DC.L $C0040000,$83F2677A,$65ECBF73,$21C40000
- DC.L $C0030000,$FB53D14A,$A9C2F2C2,$20000000
- DC.L $C0030000,$EEC2D3A0,$87AC669F,$21380000
- DC.L $C0030000,$E231D5F6,$6595DA7B,$A1300000
- DC.L $C0030000,$D5A0D84C,$437F4E58,$9FC00000
- DC.L $C0030000,$C90FDAA2,$2168C235,$21000000
- DC.L $C0030000,$BC7EDCF7,$FF523611,$A1680000
- DC.L $C0030000,$AFEDDF4D,$DD3BA9EE,$A0A00000
- DC.L $C0030000,$A35CE1A3,$BB251DCB,$20900000
- DC.L $C0030000,$96CBE3F9,$990E91A8,$21600000
- DC.L $C0030000,$8A3AE64F,$76F80584,$A1080000
- DC.L $C0020000,$FB53D14A,$A9C2F2C2,$1F800000
- DC.L $C0020000,$E231D5F6,$6595DA7B,$A0B00000
- DC.L $C0020000,$C90FDAA2,$2168C235,$20800000
- DC.L $C0020000,$AFEDDF4D,$DD3BA9EE,$A0200000
- DC.L $C0020000,$96CBE3F9,$990E91A8,$20E00000
- DC.L $C0010000,$FB53D14A,$A9C2F2C2,$1F000000
- DC.L $C0010000,$C90FDAA2,$2168C235,$20000000
- DC.L $C0010000,$96CBE3F9,$990E91A8,$20600000
- DC.L $C0000000,$C90FDAA2,$2168C235,$1F800000
- DC.L $BFFF0000,$C90FDAA2,$2168C235,$1F000000
- DC.L $00000000,$00000000,$00000000,$00000000
- DC.L $3FFF0000,$C90FDAA2,$2168C235,$9F000000
- DC.L $40000000,$C90FDAA2,$2168C235,$9F800000
- DC.L $40010000,$96CBE3F9,$990E91A8,$A0600000
- DC.L $40010000,$C90FDAA2,$2168C235,$A0000000
- DC.L $40010000,$FB53D14A,$A9C2F2C2,$9F000000
- DC.L $40020000,$96CBE3F9,$990E91A8,$A0E00000
- DC.L $40020000,$AFEDDF4D,$DD3BA9EE,$20200000
- DC.L $40020000,$C90FDAA2,$2168C235,$A0800000
- DC.L $40020000,$E231D5F6,$6595DA7B,$20B00000
- DC.L $40020000,$FB53D14A,$A9C2F2C2,$9F800000
- DC.L $40030000,$8A3AE64F,$76F80584,$21080000
- DC.L $40030000,$96CBE3F9,$990E91A8,$A1600000
- DC.L $40030000,$A35CE1A3,$BB251DCB,$A0900000
- DC.L $40030000,$AFEDDF4D,$DD3BA9EE,$20A00000
- DC.L $40030000,$BC7EDCF7,$FF523611,$21680000
- DC.L $40030000,$C90FDAA2,$2168C235,$A1000000
- DC.L $40030000,$D5A0D84C,$437F4E58,$1FC00000
- DC.L $40030000,$E231D5F6,$6595DA7B,$21300000
- DC.L $40030000,$EEC2D3A0,$87AC669F,$A1380000
- DC.L $40030000,$FB53D14A,$A9C2F2C2,$A0000000
- DC.L $40040000,$83F2677A,$65ECBF73,$A1C40000
- DC.L $40040000,$8A3AE64F,$76F80584,$21880000
- DC.L $40040000,$90836524,$88034B96,$A0B00000
- DC.L $40040000,$96CBE3F9,$990E91A8,$A1E00000
- DC.L $40040000,$9D1462CE,$AA19D7B9,$21580000
- DC.L $40040000,$A35CE1A3,$BB251DCB,$A1100000
- DC.L $40040000,$A9A56078,$CC3063DD,$A1FC0000
- DC.L $40040000,$AFEDDF4D,$DD3BA9EE,$21200000
- DC.L $40040000,$B6365E22,$EE46F000,$A1480000
- DC.L $40040000,$BC7EDCF7,$FF523611,$21E80000
- DC.L $40040000,$C2C75BCD,$105D7C23,$20D00000
- DC.L $40040000,$C90FDAA2,$2168C235,$A1800000
-
-INARG equ FP_SCR4
-
-TWOTO63 equ L_SCR1
-ENDFLAG equ L_SCR2
-N equ L_SCR3
-
- xref t_frcinx
- xref t_extdnrm
-
- xdef stand
-stand:
-*--TAN(X) = X FOR DENORMALIZED X
-
- bra t_extdnrm
-
- xdef stan
-stan:
- FMOVE.X (a0),FP0 ...LOAD INPUT
-
- MOVE.L (A0),D0
- MOVE.W 4(A0),D0
- ANDI.L #$7FFFFFFF,D0
-
- CMPI.L #$3FD78000,D0 ...|X| >= 2**(-40)?
- BGE.B TANOK1
- BRA.W TANSM
-TANOK1:
- CMPI.L #$4004BC7E,D0 ...|X| < 15 PI?
- BLT.B TANMAIN
- BRA.W REDUCEX
-
-
-TANMAIN:
-*--THIS IS THE USUAL CASE, |X| <= 15 PI.
-*--THE ARGUMENT REDUCTION IS DONE BY TABLE LOOK UP.
- FMOVE.X FP0,FP1
- FMUL.D TWOBYPI,FP1 ...X*2/PI
-
-*--HIDE THE NEXT TWO INSTRUCTIONS
- lea.l PITBL+$200,a1 ...TABLE OF N*PI/2, N = -32,...,32
-
-*--FP1 IS NOW READY
- FMOVE.L FP1,D0 ...CONVERT TO INTEGER
-
- ASL.L #4,D0
- ADDA.L D0,a1 ...ADDRESS N*PIBY2 IN Y1, Y2
-
- FSUB.X (a1)+,FP0 ...X-Y1
-*--HIDE THE NEXT ONE
-
- FSUB.S (a1),FP0 ...FP0 IS R = (X-Y1)-Y2
-
- ROR.L #5,D0
- ANDI.L #$80000000,D0 ...D0 WAS ODD IFF D0 < 0
-
-TANCONT:
-
- TST.L D0
- BLT.W NODD
-
- FMOVE.X FP0,FP1
- FMUL.X FP1,FP1 ...S = R*R
-
- FMOVE.D TANQ4,FP3
- FMOVE.D TANP3,FP2
-
- FMUL.X FP1,FP3 ...SQ4
- FMUL.X FP1,FP2 ...SP3
-
- FADD.D TANQ3,FP3 ...Q3+SQ4
- FADD.X TANP2,FP2 ...P2+SP3
-
- FMUL.X FP1,FP3 ...S(Q3+SQ4)
- FMUL.X FP1,FP2 ...S(P2+SP3)
-
- FADD.X TANQ2,FP3 ...Q2+S(Q3+SQ4)
- FADD.X TANP1,FP2 ...P1+S(P2+SP3)
-
- FMUL.X FP1,FP3 ...S(Q2+S(Q3+SQ4))
- FMUL.X FP1,FP2 ...S(P1+S(P2+SP3))
-
- FADD.X TANQ1,FP3 ...Q1+S(Q2+S(Q3+SQ4))
- FMUL.X FP0,FP2 ...RS(P1+S(P2+SP3))
-
- FMUL.X FP3,FP1 ...S(Q1+S(Q2+S(Q3+SQ4)))
-
-
- FADD.X FP2,FP0 ...R+RS(P1+S(P2+SP3))
-
-
- FADD.S #:3F800000,FP1 ...1+S(Q1+...)
-
- FMOVE.L d1,fpcr ;restore users exceptions
- FDIV.X FP1,FP0 ;last inst - possible exception set
-
- bra t_frcinx
-
-NODD:
- FMOVE.X FP0,FP1
- FMUL.X FP0,FP0 ...S = R*R
-
- FMOVE.D TANQ4,FP3
- FMOVE.D TANP3,FP2
-
- FMUL.X FP0,FP3 ...SQ4
- FMUL.X FP0,FP2 ...SP3
-
- FADD.D TANQ3,FP3 ...Q3+SQ4
- FADD.X TANP2,FP2 ...P2+SP3
-
- FMUL.X FP0,FP3 ...S(Q3+SQ4)
- FMUL.X FP0,FP2 ...S(P2+SP3)
-
- FADD.X TANQ2,FP3 ...Q2+S(Q3+SQ4)
- FADD.X TANP1,FP2 ...P1+S(P2+SP3)
-
- FMUL.X FP0,FP3 ...S(Q2+S(Q3+SQ4))
- FMUL.X FP0,FP2 ...S(P1+S(P2+SP3))
-
- FADD.X TANQ1,FP3 ...Q1+S(Q2+S(Q3+SQ4))
- FMUL.X FP1,FP2 ...RS(P1+S(P2+SP3))
-
- FMUL.X FP3,FP0 ...S(Q1+S(Q2+S(Q3+SQ4)))
-
-
- FADD.X FP2,FP1 ...R+RS(P1+S(P2+SP3))
- FADD.S #:3F800000,FP0 ...1+S(Q1+...)
-
-
- FMOVE.X FP1,-(sp)
- EORI.L #$80000000,(sp)
-
- FMOVE.L d1,fpcr ;restore users exceptions
- FDIV.X (sp)+,FP0 ;last inst - possible exception set
-
- bra t_frcinx
-
-TANBORS:
-*--IF |X| > 15PI, WE USE THE GENERAL ARGUMENT REDUCTION.
-*--IF |X| < 2**(-40), RETURN X OR 1.
- CMPI.L #$3FFF8000,D0
- BGT.B REDUCEX
-
-TANSM:
-
- FMOVE.X FP0,-(sp)
- FMOVE.L d1,fpcr ;restore users exceptions
- FMOVE.X (sp)+,FP0 ;last inst - posibble exception set
-
- bra t_frcinx
-
-
-REDUCEX:
-*--WHEN REDUCEX IS USED, THE CODE WILL INEVITABLY BE SLOW.
-*--THIS REDUCTION METHOD, HOWEVER, IS MUCH FASTER THAN USING
-*--THE REMAINDER INSTRUCTION WHICH IS NOW IN SOFTWARE.
-
- FMOVEM.X FP2-FP5,-(A7) ...save FP2 through FP5
- MOVE.L D2,-(A7)
- FMOVE.S #:00000000,FP1
-
-*--If compact form of abs(arg) in d0=$7ffeffff, argument is so large that
-*--there is a danger of unwanted overflow in first LOOP iteration. In this
-*--case, reduce argument by one remainder step to make subsequent reduction
-*--safe.
- cmpi.l #$7ffeffff,d0 ;is argument dangerously large?
- bne.b LOOP
- move.l #$7ffe0000,FP_SCR2(a6) ;yes
-* ;create 2**16383*PI/2
- move.l #$c90fdaa2,FP_SCR2+4(a6)
- clr.l FP_SCR2+8(a6)
- ftst.x fp0 ;test sign of argument
- move.l #$7fdc0000,FP_SCR3(a6) ;create low half of 2**16383*
-* ;PI/2 at FP_SCR3
- move.l #$85a308d3,FP_SCR3+4(a6)
- clr.l FP_SCR3+8(a6)
- fblt.w red_neg
- or.w #$8000,FP_SCR2(a6) ;positive arg
- or.w #$8000,FP_SCR3(a6)
-red_neg:
- fadd.x FP_SCR2(a6),fp0 ;high part of reduction is exact
- fmove.x fp0,fp1 ;save high result in fp1
- fadd.x FP_SCR3(a6),fp0 ;low part of reduction
- fsub.x fp0,fp1 ;determine low component of result
- fadd.x FP_SCR3(a6),fp1 ;fp0/fp1 are reduced argument.
-
-*--ON ENTRY, FP0 IS X, ON RETURN, FP0 IS X REM PI/2, |X| <= PI/4.
-*--integer quotient will be stored in N
-*--Intermeditate remainder is 66-bit long; (R,r) in (FP0,FP1)
-
-LOOP:
- FMOVE.X FP0,INARG(a6) ...+-2**K * F, 1 <= F < 2
- MOVE.W INARG(a6),D0
- MOVE.L D0,A1 ...save a copy of D0
- ANDI.L #$00007FFF,D0
- SUBI.L #$00003FFF,D0 ...D0 IS K
- CMPI.L #28,D0
- BLE.B LASTLOOP
-CONTLOOP:
- SUBI.L #27,D0 ...D0 IS L := K-27
- CLR.L ENDFLAG(a6)
- BRA.B WORK
-LASTLOOP:
- CLR.L D0 ...D0 IS L := 0
- MOVE.L #1,ENDFLAG(a6)
-
-WORK:
-*--FIND THE REMAINDER OF (R,r) W.R.T. 2**L * (PI/2). L IS SO CHOSEN
-*--THAT INT( X * (2/PI) / 2**(L) ) < 2**29.
-
-*--CREATE 2**(-L) * (2/PI), SIGN(INARG)*2**(63),
-*--2**L * (PIby2_1), 2**L * (PIby2_2)
-
- MOVE.L #$00003FFE,D2 ...BIASED EXPO OF 2/PI
- SUB.L D0,D2 ...BIASED EXPO OF 2**(-L)*(2/PI)
-
- MOVE.L #$A2F9836E,FP_SCR1+4(a6)
- MOVE.L #$4E44152A,FP_SCR1+8(a6)
- MOVE.W D2,FP_SCR1(a6) ...FP_SCR1 is 2**(-L)*(2/PI)
-
- FMOVE.X FP0,FP2
- FMUL.X FP_SCR1(a6),FP2
-*--WE MUST NOW FIND INT(FP2). SINCE WE NEED THIS VALUE IN
-*--FLOATING POINT FORMAT, THE TWO FMOVE'S FMOVE.L FP <--> N
-*--WILL BE TOO INEFFICIENT. THE WAY AROUND IT IS THAT
-*--(SIGN(INARG)*2**63 + FP2) - SIGN(INARG)*2**63 WILL GIVE
-*--US THE DESIRED VALUE IN FLOATING POINT.
-
-*--HIDE SIX CYCLES OF INSTRUCTION
- MOVE.L A1,D2
- SWAP D2
- ANDI.L #$80000000,D2
- ORI.L #$5F000000,D2 ...D2 IS SIGN(INARG)*2**63 IN SGL
- MOVE.L D2,TWOTO63(a6)
-
- MOVE.L D0,D2
- ADDI.L #$00003FFF,D2 ...BIASED EXPO OF 2**L * (PI/2)
-
-*--FP2 IS READY
- FADD.S TWOTO63(a6),FP2 ...THE FRACTIONAL PART OF FP1 IS ROUNDED
-
-*--HIDE 4 CYCLES OF INSTRUCTION; creating 2**(L)*Piby2_1 and 2**(L)*Piby2_2
- MOVE.W D2,FP_SCR2(a6)
- CLR.W FP_SCR2+2(a6)
- MOVE.L #$C90FDAA2,FP_SCR2+4(a6)
- CLR.L FP_SCR2+8(a6) ...FP_SCR2 is 2**(L) * Piby2_1
-
-*--FP2 IS READY
- FSUB.S TWOTO63(a6),FP2 ...FP2 is N
-
- ADDI.L #$00003FDD,D0
- MOVE.W D0,FP_SCR3(a6)
- CLR.W FP_SCR3+2(a6)
- MOVE.L #$85A308D3,FP_SCR3+4(a6)
- CLR.L FP_SCR3+8(a6) ...FP_SCR3 is 2**(L) * Piby2_2
-
- MOVE.L ENDFLAG(a6),D0
-
-*--We are now ready to perform (R+r) - N*P1 - N*P2, P1 = 2**(L) * Piby2_1 and
-*--P2 = 2**(L) * Piby2_2
- FMOVE.X FP2,FP4
- FMul.X FP_SCR2(a6),FP4 ...W = N*P1
- FMove.X FP2,FP5
- FMul.X FP_SCR3(a6),FP5 ...w = N*P2
- FMove.X FP4,FP3
-*--we want P+p = W+w but |p| <= half ulp of P
-*--Then, we need to compute A := R-P and a := r-p
- FAdd.X FP5,FP3 ...FP3 is P
- FSub.X FP3,FP4 ...W-P
-
- FSub.X FP3,FP0 ...FP0 is A := R - P
- FAdd.X FP5,FP4 ...FP4 is p = (W-P)+w
-
- FMove.X FP0,FP3 ...FP3 A
- FSub.X FP4,FP1 ...FP1 is a := r - p
-
-*--Now we need to normalize (A,a) to "new (R,r)" where R+r = A+a but
-*--|r| <= half ulp of R.
- FAdd.X FP1,FP0 ...FP0 is R := A+a
-*--No need to calculate r if this is the last loop
- TST.L D0
- BGT.W RESTORE
-
-*--Need to calculate r
- FSub.X FP0,FP3 ...A-R
- FAdd.X FP3,FP1 ...FP1 is r := (A-R)+a
- BRA.W LOOP
-
-RESTORE:
- FMOVE.L FP2,N(a6)
- MOVE.L (A7)+,D2
- FMOVEM.X (A7)+,FP2-FP5
-
-
- MOVE.L N(a6),D0
- ROR.L #1,D0
-
-
- BRA.W TANCONT
-
- end
diff --git a/sys/arch/m68k/fpsp/stanh.sa b/sys/arch/m68k/fpsp/stanh.sa
deleted file mode 100644
index 03fb9ea3869..00000000000
--- a/sys/arch/m68k/fpsp/stanh.sa
+++ /dev/null
@@ -1,211 +0,0 @@
-* $OpenBSD: stanh.sa,v 1.2 1996/05/29 21:05:43 niklas Exp $
-* $NetBSD: stanh.sa,v 1.3 1994/10/26 07:50:12 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* stanh.sa 3.1 12/10/90
-*
-* The entry point sTanh computes the hyperbolic tangent of
-* an input argument; sTanhd does the same except for denormalized
-* input.
-*
-* Input: Double-extended number X in location pointed to
-* by address register a0.
-*
-* Output: The value tanh(X) returned in floating-point register Fp0.
-*
-* Accuracy and Monotonicity: The returned result is within 3 ulps in
-* 64 significant bit, i.e. within 0.5001 ulp to 53 bits if the
-* result is subsequently rounded to double precision. The
-* result is provably monotonic in double precision.
-*
-* Speed: The program stanh takes approximately 270 cycles.
-*
-* Algorithm:
-*
-* TANH
-* 1. If |X| >= (5/2) log2 or |X| <= 2**(-40), go to 3.
-*
-* 2. (2**(-40) < |X| < (5/2) log2) Calculate tanh(X) by
-* sgn := sign(X), y := 2|X|, z := expm1(Y), and
-* tanh(X) = sgn*( z/(2+z) ).
-* Exit.
-*
-* 3. (|X| <= 2**(-40) or |X| >= (5/2) log2). If |X| < 1,
-* go to 7.
-*
-* 4. (|X| >= (5/2) log2) If |X| >= 50 log2, go to 6.
-*
-* 5. ((5/2) log2 <= |X| < 50 log2) Calculate tanh(X) by
-* sgn := sign(X), y := 2|X|, z := exp(Y),
-* tanh(X) = sgn - [ sgn*2/(1+z) ].
-* Exit.
-*
-* 6. (|X| >= 50 log2) Tanh(X) = +-1 (round to nearest). Thus, we
-* calculate Tanh(X) by
-* sgn := sign(X), Tiny := 2**(-126),
-* tanh(X) := sgn - sgn*Tiny.
-* Exit.
-*
-* 7. (|X| < 2**(-40)). Tanh(X) = X. Exit.
-*
-
-STANH IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
-X equ FP_SCR5
-XDCARE equ X+2
-XFRAC equ X+4
-
-SGN equ L_SCR3
-
-V equ FP_SCR6
-
-BOUNDS1 DC.L $3FD78000,$3FFFDDCE ... 2^(-40), (5/2)LOG2
-
- xref t_frcinx
- xref t_extdnrm
- xref setox
- xref setoxm1
-
- xdef stanhd
-stanhd:
-*--TANH(X) = X FOR DENORMALIZED X
-
- bra t_extdnrm
-
- xdef stanh
-stanh:
- FMOVE.X (a0),FP0 ...LOAD INPUT
-
- FMOVE.X FP0,X(a6)
- move.l (a0),d0
- move.w 4(a0),d0
- MOVE.L D0,X(a6)
- AND.L #$7FFFFFFF,D0
- CMP2.L BOUNDS1(pc),D0 ...2**(-40) < |X| < (5/2)LOG2 ?
- BCS.B TANHBORS
-
-*--THIS IS THE USUAL CASE
-*--Y = 2|X|, Z = EXPM1(Y), TANH(X) = SIGN(X) * Z / (Z+2).
-
- MOVE.L X(a6),D0
- MOVE.L D0,SGN(a6)
- AND.L #$7FFF0000,D0
- ADD.L #$00010000,D0 ...EXPONENT OF 2|X|
- MOVE.L D0,X(a6)
- AND.L #$80000000,SGN(a6)
- FMOVE.X X(a6),FP0 ...FP0 IS Y = 2|X|
-
- move.l d1,-(a7)
- clr.l d1
- fmovem.x fp0,(a0)
- bsr setoxm1 ...FP0 IS Z = EXPM1(Y)
- move.l (a7)+,d1
-
- FMOVE.X FP0,FP1
- FADD.S #:40000000,FP1 ...Z+2
- MOVE.L SGN(a6),D0
- FMOVE.X FP1,V(a6)
- EOR.L D0,V(a6)
-
- FMOVE.L d1,FPCR ;restore users exceptions
- FDIV.X V(a6),FP0
- bra t_frcinx
-
-TANHBORS:
- CMP.L #$3FFF8000,D0
- BLT.W TANHSM
-
- CMP.L #$40048AA1,D0
- BGT.W TANHHUGE
-
-*-- (5/2) LOG2 < |X| < 50 LOG2,
-*--TANH(X) = 1 - (2/[EXP(2X)+1]). LET Y = 2|X|, SGN = SIGN(X),
-*--TANH(X) = SGN - SGN*2/[EXP(Y)+1].
-
- MOVE.L X(a6),D0
- MOVE.L D0,SGN(a6)
- AND.L #$7FFF0000,D0
- ADD.L #$00010000,D0 ...EXPO OF 2|X|
- MOVE.L D0,X(a6) ...Y = 2|X|
- AND.L #$80000000,SGN(a6)
- MOVE.L SGN(a6),D0
- FMOVE.X X(a6),FP0 ...Y = 2|X|
-
- move.l d1,-(a7)
- clr.l d1
- fmovem.x fp0,(a0)
- bsr setox ...FP0 IS EXP(Y)
- move.l (a7)+,d1
- move.l SGN(a6),d0
- FADD.S #:3F800000,FP0 ...EXP(Y)+1
-
- EOR.L #$C0000000,D0 ...-SIGN(X)*2
- FMOVE.S d0,FP1 ...-SIGN(X)*2 IN SGL FMT
- FDIV.X FP0,FP1 ...-SIGN(X)2 / [EXP(Y)+1 ]
-
- MOVE.L SGN(a6),D0
- OR.L #$3F800000,D0 ...SGN
- FMOVE.S d0,FP0 ...SGN IN SGL FMT
-
- FMOVE.L d1,FPCR ;restore users exceptions
- FADD.X fp1,FP0
-
- bra t_frcinx
-
-TANHSM:
- CLR.W XDCARE(a6)
-
- FMOVE.L d1,FPCR ;restore users exceptions
- FMOVE.X X(a6),FP0 ;last inst - possible exception set
-
- bra t_frcinx
-
-TANHHUGE:
-*---RETURN SGN(X) - SGN(X)EPS
- MOVE.L X(a6),D0
- AND.L #$80000000,D0
- OR.L #$3F800000,D0
- FMOVE.S d0,FP0
- AND.L #$80000000,D0
- EOR.L #$80800000,D0 ...-SIGN(X)*EPS
-
- FMOVE.L d1,FPCR ;restore users exceptions
- FADD.S d0,FP0
-
- bra t_frcinx
-
- end
diff --git a/sys/arch/m68k/fpsp/sto_res.sa b/sys/arch/m68k/fpsp/sto_res.sa
deleted file mode 100644
index f2c1d52bbf9..00000000000
--- a/sys/arch/m68k/fpsp/sto_res.sa
+++ /dev/null
@@ -1,124 +0,0 @@
-* $OpenBSD: sto_res.sa,v 1.3 2003/11/07 10:36:10 miod Exp $
-* $NetBSD: sto_res.sa,v 1.3 1994/10/26 07:50:14 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* sto_res.sa 3.1 12/10/90
-*
-* Takes the result and puts it in where the user expects it.
-* Library functions return result in fp0. If fp0 is not the
-* users destination register then fp0 is moved to the
-* correct floating-point destination register. fp0 and fp1
-* are then restored to the original contents.
-*
-* Input: result in fp0,fp1
-*
-* d2 & a0 should be kept unmodified
-*
-* Output: moves the result to the true destination reg or mem
-*
-* Modifies: destination floating point register
-*
-
-STO_RES IDNT 2,1 Motorola 040 Floating Point Software Package
-
-
- section 8
-
- include fpsp.h
-
- xdef sto_cos
-sto_cos:
- bfextu CMDREG1B(a6){13:3},d0 ;extract cos destination
- cmpi.b #3,d0 ;check for fp0/fp1 cases
- ble.b c_fp0123
- fmovem.x fp1,-(a7)
- moveq.l #7,d1
- sub.l d0,d1 ;d1 = 7- (dest. reg. no.)
- clr.l d0
- bset.l d1,d0 ;d0 is dynamic register mask
- fmovem.x (a7)+,d0
- rts
-c_fp0123:
- tst.b d0
- beq.b c_is_fp0
- cmpi.b #1,d0
- beq.b c_is_fp1
- cmpi.b #2,d0
- beq.b c_is_fp2
-c_is_fp3:
- fmovem.x fp1,USER_FP3(a6)
- rts
-c_is_fp2:
- fmovem.x fp1,USER_FP2(a6)
- rts
-c_is_fp1:
- fmovem.x fp1,USER_FP1(a6)
- rts
-c_is_fp0:
- fmovem.x fp1,USER_FP0(a6)
- rts
-
-
- xdef sto_res
-sto_res:
- bfextu CMDREG1B(a6){6:3},d0 ;extract destination register
- cmpi.b #3,d0 ;check for fp0/fp1 cases
- ble.b fp0123
- fmovem.x fp0,-(a7)
- moveq.l #7,d1
- sub.l d0,d1 ;d1 = 7- (dest. reg. no.)
- clr.l d0
- bset.l d1,d0 ;d0 is dynamic register mask
- fmovem.x (a7)+,d0
- rts
-fp0123:
- tst.b d0
- beq.b is_fp0
- cmpi.b #1,d0
- beq.b is_fp1
- cmpi.b #2,d0
- beq.b is_fp2
-is_fp3:
- fmovem.x fp0,USER_FP3(a6)
- rts
-is_fp2:
- fmovem.x fp0,USER_FP2(a6)
- rts
-is_fp1:
- fmovem.x fp0,USER_FP1(a6)
- rts
-is_fp0:
- fmovem.x fp0,USER_FP0(a6)
- rts
-
- end
diff --git a/sys/arch/m68k/fpsp/stwotox.sa b/sys/arch/m68k/fpsp/stwotox.sa
deleted file mode 100644
index 96fbe94dc4f..00000000000
--- a/sys/arch/m68k/fpsp/stwotox.sa
+++ /dev/null
@@ -1,453 +0,0 @@
-* $OpenBSD: stwotox.sa,v 1.2 1996/05/29 21:05:44 niklas Exp $
-* $NetBSD: stwotox.sa,v 1.3 1994/10/26 07:50:15 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* stwotox.sa 3.1 12/10/90
-*
-* stwotox --- 2**X
-* stwotoxd --- 2**X for denormalized X
-* stentox --- 10**X
-* stentoxd --- 10**X for denormalized X
-*
-* Input: Double-extended number X in location pointed to
-* by address register a0.
-*
-* Output: The function values are returned in Fp0.
-*
-* Accuracy and Monotonicity: The returned result is within 2 ulps in
-* 64 significant bit, i.e. within 0.5001 ulp to 53 bits if the
-* result is subsequently rounded to double precision. The
-* result is provably monotonic in double precision.
-*
-* Speed: The program stwotox takes approximately 190 cycles and the
-* program stentox takes approximately 200 cycles.
-*
-* Algorithm:
-*
-* twotox
-* 1. If |X| > 16480, go to ExpBig.
-*
-* 2. If |X| < 2**(-70), go to ExpSm.
-*
-* 3. Decompose X as X = N/64 + r where |r| <= 1/128. Furthermore
-* decompose N as
-* N = 64(M + M') + j, j = 0,1,2,...,63.
-*
-* 4. Overwrite r := r * log2. Then
-* 2**X = 2**(M') * 2**(M) * 2**(j/64) * exp(r).
-* Go to expr to compute that expression.
-*
-* tentox
-* 1. If |X| > 16480*log_10(2) (base 10 log of 2), go to ExpBig.
-*
-* 2. If |X| < 2**(-70), go to ExpSm.
-*
-* 3. Set y := X*log_2(10)*64 (base 2 log of 10). Set
-* N := round-to-int(y). Decompose N as
-* N = 64(M + M') + j, j = 0,1,2,...,63.
-*
-* 4. Define r as
-* r := ((X - N*L1)-N*L2) * L10
-* where L1, L2 are the leading and trailing parts of log_10(2)/64
-* and L10 is the natural log of 10. Then
-* 10**X = 2**(M') * 2**(M) * 2**(j/64) * exp(r).
-* Go to expr to compute that expression.
-*
-* expr
-* 1. Fetch 2**(j/64) from table as Fact1 and Fact2.
-*
-* 2. Overwrite Fact1 and Fact2 by
-* Fact1 := 2**(M) * Fact1
-* Fact2 := 2**(M) * Fact2
-* Thus Fact1 + Fact2 = 2**(M) * 2**(j/64).
-*
-* 3. Calculate P where 1 + P approximates exp(r):
-* P = r + r*r*(A1+r*(A2+...+r*A5)).
-*
-* 4. Let AdjFact := 2**(M'). Return
-* AdjFact * ( Fact1 + ((Fact1*P) + Fact2) ).
-* Exit.
-*
-* ExpBig
-* 1. Generate overflow by Huge * Huge if X > 0; otherwise, generate
-* underflow by Tiny * Tiny.
-*
-* ExpSm
-* 1. Return 1 + X.
-*
-
-STWOTOX IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
-BOUNDS1 DC.L $3FB98000,$400D80C0 ... 2^(-70),16480
-BOUNDS2 DC.L $3FB98000,$400B9B07 ... 2^(-70),16480 LOG2/LOG10
-
-L2TEN64 DC.L $406A934F,$0979A371 ... 64LOG10/LOG2
-L10TWO1 DC.L $3F734413,$509F8000 ... LOG2/64LOG10
-
-L10TWO2 DC.L $BFCD0000,$C0219DC1,$DA994FD2,$00000000
-
-LOG10 DC.L $40000000,$935D8DDD,$AAA8AC17,$00000000
-
-LOG2 DC.L $3FFE0000,$B17217F7,$D1CF79AC,$00000000
-
-EXPA5 DC.L $3F56C16D,$6F7BD0B2
-EXPA4 DC.L $3F811112,$302C712C
-EXPA3 DC.L $3FA55555,$55554CC1
-EXPA2 DC.L $3FC55555,$55554A54
-EXPA1 DC.L $3FE00000,$00000000,$00000000,$00000000
-
-HUGE DC.L $7FFE0000,$FFFFFFFF,$FFFFFFFF,$00000000
-TINY DC.L $00010000,$FFFFFFFF,$FFFFFFFF,$00000000
-
-EXPTBL
- DC.L $3FFF0000,$80000000,$00000000,$3F738000
- DC.L $3FFF0000,$8164D1F3,$BC030773,$3FBEF7CA
- DC.L $3FFF0000,$82CD8698,$AC2BA1D7,$3FBDF8A9
- DC.L $3FFF0000,$843A28C3,$ACDE4046,$3FBCD7C9
- DC.L $3FFF0000,$85AAC367,$CC487B15,$BFBDE8DA
- DC.L $3FFF0000,$871F6196,$9E8D1010,$3FBDE85C
- DC.L $3FFF0000,$88980E80,$92DA8527,$3FBEBBF1
- DC.L $3FFF0000,$8A14D575,$496EFD9A,$3FBB80CA
- DC.L $3FFF0000,$8B95C1E3,$EA8BD6E7,$BFBA8373
- DC.L $3FFF0000,$8D1ADF5B,$7E5BA9E6,$BFBE9670
- DC.L $3FFF0000,$8EA4398B,$45CD53C0,$3FBDB700
- DC.L $3FFF0000,$9031DC43,$1466B1DC,$3FBEEEB0
- DC.L $3FFF0000,$91C3D373,$AB11C336,$3FBBFD6D
- DC.L $3FFF0000,$935A2B2F,$13E6E92C,$BFBDB319
- DC.L $3FFF0000,$94F4EFA8,$FEF70961,$3FBDBA2B
- DC.L $3FFF0000,$96942D37,$20185A00,$3FBE91D5
- DC.L $3FFF0000,$9837F051,$8DB8A96F,$3FBE8D5A
- DC.L $3FFF0000,$99E04593,$20B7FA65,$BFBCDE7B
- DC.L $3FFF0000,$9B8D39B9,$D54E5539,$BFBEBAAF
- DC.L $3FFF0000,$9D3ED9A7,$2CFFB751,$BFBD86DA
- DC.L $3FFF0000,$9EF53260,$91A111AE,$BFBEBEDD
- DC.L $3FFF0000,$A0B0510F,$B9714FC2,$3FBCC96E
- DC.L $3FFF0000,$A2704303,$0C496819,$BFBEC90B
- DC.L $3FFF0000,$A43515AE,$09E6809E,$3FBBD1DB
- DC.L $3FFF0000,$A5FED6A9,$B15138EA,$3FBCE5EB
- DC.L $3FFF0000,$A7CD93B4,$E965356A,$BFBEC274
- DC.L $3FFF0000,$A9A15AB4,$EA7C0EF8,$3FBEA83C
- DC.L $3FFF0000,$AB7A39B5,$A93ED337,$3FBECB00
- DC.L $3FFF0000,$AD583EEA,$42A14AC6,$3FBE9301
- DC.L $3FFF0000,$AF3B78AD,$690A4375,$BFBD8367
- DC.L $3FFF0000,$B123F581,$D2AC2590,$BFBEF05F
- DC.L $3FFF0000,$B311C412,$A9112489,$3FBDFB3C
- DC.L $3FFF0000,$B504F333,$F9DE6484,$3FBEB2FB
- DC.L $3FFF0000,$B6FD91E3,$28D17791,$3FBAE2CB
- DC.L $3FFF0000,$B8FBAF47,$62FB9EE9,$3FBCDC3C
- DC.L $3FFF0000,$BAFF5AB2,$133E45FB,$3FBEE9AA
- DC.L $3FFF0000,$BD08A39F,$580C36BF,$BFBEAEFD
- DC.L $3FFF0000,$BF1799B6,$7A731083,$BFBCBF51
- DC.L $3FFF0000,$C12C4CCA,$66709456,$3FBEF88A
- DC.L $3FFF0000,$C346CCDA,$24976407,$3FBD83B2
- DC.L $3FFF0000,$C5672A11,$5506DADD,$3FBDF8AB
- DC.L $3FFF0000,$C78D74C8,$ABB9B15D,$BFBDFB17
- DC.L $3FFF0000,$C9B9BD86,$6E2F27A3,$BFBEFE3C
- DC.L $3FFF0000,$CBEC14FE,$F2727C5D,$BFBBB6F8
- DC.L $3FFF0000,$CE248C15,$1F8480E4,$BFBCEE53
- DC.L $3FFF0000,$D06333DA,$EF2B2595,$BFBDA4AE
- DC.L $3FFF0000,$D2A81D91,$F12AE45A,$3FBC9124
- DC.L $3FFF0000,$D4F35AAB,$CFEDFA1F,$3FBEB243
- DC.L $3FFF0000,$D744FCCA,$D69D6AF4,$3FBDE69A
- DC.L $3FFF0000,$D99D15C2,$78AFD7B6,$BFB8BC61
- DC.L $3FFF0000,$DBFBB797,$DAF23755,$3FBDF610
- DC.L $3FFF0000,$DE60F482,$5E0E9124,$BFBD8BE1
- DC.L $3FFF0000,$E0CCDEEC,$2A94E111,$3FBACB12
- DC.L $3FFF0000,$E33F8972,$BE8A5A51,$3FBB9BFE
- DC.L $3FFF0000,$E5B906E7,$7C8348A8,$3FBCF2F4
- DC.L $3FFF0000,$E8396A50,$3C4BDC68,$3FBEF22F
- DC.L $3FFF0000,$EAC0C6E7,$DD24392F,$BFBDBF4A
- DC.L $3FFF0000,$ED4F301E,$D9942B84,$3FBEC01A
- DC.L $3FFF0000,$EFE4B99B,$DCDAF5CB,$3FBE8CAC
- DC.L $3FFF0000,$F281773C,$59FFB13A,$BFBCBB3F
- DC.L $3FFF0000,$F5257D15,$2486CC2C,$3FBEF73A
- DC.L $3FFF0000,$F7D0DF73,$0AD13BB9,$BFB8B795
- DC.L $3FFF0000,$FA83B2DB,$722A033A,$3FBEF84B
- DC.L $3FFF0000,$FD3E0C0C,$F486C175,$BFBEF581
-
-N equ L_SCR1
-
-X equ FP_SCR1
-XDCARE equ X+2
-XFRAC equ X+4
-
-ADJFACT equ FP_SCR2
-
-FACT1 equ FP_SCR3
-FACT1HI equ FACT1+4
-FACT1LOW equ FACT1+8
-
-FACT2 equ FP_SCR4
-FACT2HI equ FACT2+4
-FACT2LOW equ FACT2+8
-
- xref t_unfl
- xref t_ovfl
- xref t_frcinx
-
- xdef stwotoxd
-stwotoxd:
-*--ENTRY POINT FOR 2**(X) FOR DENORMALIZED ARGUMENT
-
- fmove.l d1,fpcr ...set user's rounding mode/precision
- Fmove.S #:3F800000,FP0 ...RETURN 1 + X
- move.l (a0),d0
- or.l #$00800001,d0
- fadd.s d0,fp0
- bra t_frcinx
-
- xdef stwotox
-stwotox:
-*--ENTRY POINT FOR 2**(X), HERE X IS FINITE, NON-ZERO, AND NOT NAN'S
- FMOVEM.X (a0),FP0 ...LOAD INPUT, do not set cc's
-
- MOVE.L (A0),D0
- MOVE.W 4(A0),D0
- FMOVE.X FP0,X(a6)
- ANDI.L #$7FFFFFFF,D0
-
- CMPI.L #$3FB98000,D0 ...|X| >= 2**(-70)?
- BGE.B TWOOK1
- BRA.W EXPBORS
-
-TWOOK1:
- CMPI.L #$400D80C0,D0 ...|X| > 16480?
- BLE.B TWOMAIN
- BRA.W EXPBORS
-
-
-TWOMAIN:
-*--USUAL CASE, 2^(-70) <= |X| <= 16480
-
- FMOVE.X FP0,FP1
- FMUL.S #:42800000,FP1 ...64 * X
-
- FMOVE.L FP1,N(a6) ...N = ROUND-TO-INT(64 X)
- MOVE.L d2,-(sp)
- LEA EXPTBL,a1 ...LOAD ADDRESS OF TABLE OF 2^(J/64)
- FMOVE.L N(a6),FP1 ...N --> FLOATING FMT
- MOVE.L N(a6),D0
- MOVE.L D0,d2
- ANDI.L #$3F,D0 ...D0 IS J
- ASL.L #4,D0 ...DISPLACEMENT FOR 2^(J/64)
- ADDA.L D0,a1 ...ADDRESS FOR 2^(J/64)
- ASR.L #6,d2 ...d2 IS L, N = 64L + J
- MOVE.L d2,D0
- ASR.L #1,D0 ...D0 IS M
- SUB.L D0,d2 ...d2 IS M', N = 64(M+M') + J
- ADDI.L #$3FFF,d2
- MOVE.W d2,ADJFACT(a6) ...ADJFACT IS 2^(M')
- MOVE.L (sp)+,d2
-*--SUMMARY: a1 IS ADDRESS FOR THE LEADING PORTION OF 2^(J/64),
-*--D0 IS M WHERE N = 64(M+M') + J. NOTE THAT |M| <= 16140 BY DESIGN.
-*--ADJFACT = 2^(M').
-*--REGISTERS SAVED SO FAR ARE (IN ORDER) FPCR, D0, FP1, a1, AND FP2.
-
- FMUL.S #:3C800000,FP1 ...(1/64)*N
- MOVE.L (a1)+,FACT1(a6)
- MOVE.L (a1)+,FACT1HI(a6)
- MOVE.L (a1)+,FACT1LOW(a6)
- MOVE.W (a1)+,FACT2(a6)
- clr.w FACT2+2(a6)
-
- FSUB.X FP1,FP0 ...X - (1/64)*INT(64 X)
-
- MOVE.W (a1)+,FACT2HI(a6)
- clr.w FACT2HI+2(a6)
- clr.l FACT2LOW(a6)
- ADD.W D0,FACT1(a6)
-
- FMUL.X LOG2,FP0 ...FP0 IS R
- ADD.W D0,FACT2(a6)
-
- BRA.W expr
-
-EXPBORS:
-*--FPCR, D0 SAVED
- CMPI.L #$3FFF8000,D0
- BGT.B EXPBIG
-
-EXPSM:
-*--|X| IS SMALL, RETURN 1 + X
-
- FMOVE.L d1,FPCR ;restore users exceptions
- FADD.S #:3F800000,FP0 ...RETURN 1 + X
-
- bra t_frcinx
-
-EXPBIG:
-*--|X| IS LARGE, GENERATE OVERFLOW IF X > 0; ELSE GENERATE UNDERFLOW
-*--REGISTERS SAVE SO FAR ARE FPCR AND D0
- MOVE.L X(a6),D0
- TST.L D0
- BLT.B EXPNEG
-
- bclr.b #7,(a0) ;t_ovfl expects positive value
- bra t_ovfl
-
-EXPNEG:
- bclr.b #7,(a0) ;t_unfl expects positive value
- bra t_unfl
-
- xdef stentoxd
-stentoxd:
-*--ENTRY POINT FOR 10**(X) FOR DENORMALIZED ARGUMENT
-
- fmove.l d1,fpcr ...set user's rounding mode/precision
- Fmove.S #:3F800000,FP0 ...RETURN 1 + X
- move.l (a0),d0
- or.l #$00800001,d0
- fadd.s d0,fp0
- bra t_frcinx
-
- xdef stentox
-stentox:
-*--ENTRY POINT FOR 10**(X), HERE X IS FINITE, NON-ZERO, AND NOT NAN'S
- FMOVEM.X (a0),FP0 ...LOAD INPUT, do not set cc's
-
- MOVE.L (A0),D0
- MOVE.W 4(A0),D0
- FMOVE.X FP0,X(a6)
- ANDI.L #$7FFFFFFF,D0
-
- CMPI.L #$3FB98000,D0 ...|X| >= 2**(-70)?
- BGE.B TENOK1
- BRA.W EXPBORS
-
-TENOK1:
- CMPI.L #$400B9B07,D0 ...|X| <= 16480*log2/log10 ?
- BLE.B TENMAIN
- BRA.W EXPBORS
-
-TENMAIN:
-*--USUAL CASE, 2^(-70) <= |X| <= 16480 LOG 2 / LOG 10
-
- FMOVE.X FP0,FP1
- FMUL.D L2TEN64,FP1 ...X*64*LOG10/LOG2
-
- FMOVE.L FP1,N(a6) ...N=INT(X*64*LOG10/LOG2)
- MOVE.L d2,-(sp)
- LEA EXPTBL,a1 ...LOAD ADDRESS OF TABLE OF 2^(J/64)
- FMOVE.L N(a6),FP1 ...N --> FLOATING FMT
- MOVE.L N(a6),D0
- MOVE.L D0,d2
- ANDI.L #$3F,D0 ...D0 IS J
- ASL.L #4,D0 ...DISPLACEMENT FOR 2^(J/64)
- ADDA.L D0,a1 ...ADDRESS FOR 2^(J/64)
- ASR.L #6,d2 ...d2 IS L, N = 64L + J
- MOVE.L d2,D0
- ASR.L #1,D0 ...D0 IS M
- SUB.L D0,d2 ...d2 IS M', N = 64(M+M') + J
- ADDI.L #$3FFF,d2
- MOVE.W d2,ADJFACT(a6) ...ADJFACT IS 2^(M')
- MOVE.L (sp)+,d2
-
-*--SUMMARY: a1 IS ADDRESS FOR THE LEADING PORTION OF 2^(J/64),
-*--D0 IS M WHERE N = 64(M+M') + J. NOTE THAT |M| <= 16140 BY DESIGN.
-*--ADJFACT = 2^(M').
-*--REGISTERS SAVED SO FAR ARE (IN ORDER) FPCR, D0, FP1, a1, AND FP2.
-
- FMOVE.X FP1,FP2
-
- FMUL.D L10TWO1,FP1 ...N*(LOG2/64LOG10)_LEAD
- MOVE.L (a1)+,FACT1(a6)
-
- FMUL.X L10TWO2,FP2 ...N*(LOG2/64LOG10)_TRAIL
-
- MOVE.L (a1)+,FACT1HI(a6)
- MOVE.L (a1)+,FACT1LOW(a6)
- FSUB.X FP1,FP0 ...X - N L_LEAD
- MOVE.W (a1)+,FACT2(a6)
-
- FSUB.X FP2,FP0 ...X - N L_TRAIL
-
- clr.w FACT2+2(a6)
- MOVE.W (a1)+,FACT2HI(a6)
- clr.w FACT2HI+2(a6)
- clr.l FACT2LOW(a6)
-
- FMUL.X LOG10,FP0 ...FP0 IS R
-
- ADD.W D0,FACT1(a6)
- ADD.W D0,FACT2(a6)
-
-expr:
-*--FPCR, FP2, FP3 ARE SAVED IN ORDER AS SHOWN.
-*--ADJFACT CONTAINS 2**(M'), FACT1 + FACT2 = 2**(M) * 2**(J/64).
-*--FP0 IS R. THE FOLLOWING CODE COMPUTES
-*-- 2**(M'+M) * 2**(J/64) * EXP(R)
-
- FMOVE.X FP0,FP1
- FMUL.X FP1,FP1 ...FP1 IS S = R*R
-
- FMOVE.D EXPA5,FP2 ...FP2 IS A5
- FMOVE.D EXPA4,FP3 ...FP3 IS A4
-
- FMUL.X FP1,FP2 ...FP2 IS S*A5
- FMUL.X FP1,FP3 ...FP3 IS S*A4
-
- FADD.D EXPA3,FP2 ...FP2 IS A3+S*A5
- FADD.D EXPA2,FP3 ...FP3 IS A2+S*A4
-
- FMUL.X FP1,FP2 ...FP2 IS S*(A3+S*A5)
- FMUL.X FP1,FP3 ...FP3 IS S*(A2+S*A4)
-
- FADD.D EXPA1,FP2 ...FP2 IS A1+S*(A3+S*A5)
- FMUL.X FP0,FP3 ...FP3 IS R*S*(A2+S*A4)
-
- FMUL.X FP1,FP2 ...FP2 IS S*(A1+S*(A3+S*A5))
- FADD.X FP3,FP0 ...FP0 IS R+R*S*(A2+S*A4)
-
- FADD.X FP2,FP0 ...FP0 IS EXP(R) - 1
-
-
-*--FINAL RECONSTRUCTION PROCESS
-*--EXP(X) = 2^M*2^(J/64) + 2^M*2^(J/64)*(EXP(R)-1) - (1 OR 0)
-
- FMUL.X FACT1(a6),FP0
- FADD.X FACT2(a6),FP0
- FADD.X FACT1(a6),FP0
-
- FMOVE.L d1,FPCR ;restore users exceptions
- clr.w ADJFACT+2(a6)
- move.l #$80000000,ADJFACT+4(a6)
- clr.l ADJFACT+8(a6)
- FMUL.X ADJFACT(a6),FP0 ...FINAL ADJUSTMENT
-
- bra t_frcinx
-
- end
diff --git a/sys/arch/m68k/fpsp/tbldo.sa b/sys/arch/m68k/fpsp/tbldo.sa
deleted file mode 100644
index b5b85dafa00..00000000000
--- a/sys/arch/m68k/fpsp/tbldo.sa
+++ /dev/null
@@ -1,580 +0,0 @@
-* $OpenBSD: tbldo.sa,v 1.2 1996/05/29 21:05:45 niklas Exp $
-* $NetBSD: tbldo.sa,v 1.2 1994/10/26 07:50:18 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* tbldo.sa 3.1 12/10/90
-*
-* Modified:
-* 8/16/90 chinds The table was constructed to use only one level
-* of indirection in do_func for monoadic
-* functions. Dyadic functions require two
-* levels, and the tables are still contained
-* in do_func. The table is arranged for
-* index with a 10-bit index, with the first
-* 7 bits the opcode, and the remaining 3
-* the stag. For dyadic functions, all
-* valid addresses are to the generic entry
-* point.
-*
-
-TBLDO IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- xref ld_pinf,ld_pone,ld_ppi2
- xref t_dz2,t_operr
- xref serror,sone,szero,sinf,snzrinx
- xref sopr_inf,spi_2,src_nan,szr_inf
-
- xref smovcr
- xref pmod,prem,pscale
- xref satanh,satanhd
- xref sacos,sacosd,sasin,sasind,satan,satand
- xref setox,setoxd,setoxm1,setoxm1d,setoxm1i
- xref sgetexp,sgetexpd,sgetman,sgetmand
- xref sint,sintd,sintrz
- xref ssincos,ssincosd,ssincosi,ssincosnan,ssincosz
- xref scos,scosd,ssin,ssind,stan,stand
- xref scosh,scoshd,ssinh,ssinhd,stanh,stanhd
- xref sslog10,sslog2,sslogn,sslognp1
- xref sslog10d,sslog2d,sslognd,slognp1d
- xref stentox,stentoxd,stwotox,stwotoxd
-
-* instruction ;opcode-stag Notes
- xdef tblpre
-tblpre:
- dc.l smovcr ;$00-0 fmovecr all
- dc.l smovcr ;$00-1 fmovecr all
- dc.l smovcr ;$00-2 fmovecr all
- dc.l smovcr ;$00-3 fmovecr all
- dc.l smovcr ;$00-4 fmovecr all
- dc.l smovcr ;$00-5 fmovecr all
- dc.l smovcr ;$00-6 fmovecr all
- dc.l smovcr ;$00-7 fmovecr all
-
- dc.l sint ;$01-0 fint norm
- dc.l szero ;$01-1 fint zero
- dc.l sinf ;$01-2 fint inf
- dc.l src_nan ;$01-3 fint nan
- dc.l sintd ;$01-4 fint denorm inx
- dc.l serror ;$01-5 fint ERROR
- dc.l serror ;$01-6 fint ERROR
- dc.l serror ;$01-7 fint ERROR
-
- dc.l ssinh ;$02-0 fsinh norm
- dc.l szero ;$02-1 fsinh zero
- dc.l sinf ;$02-2 fsinh inf
- dc.l src_nan ;$02-3 fsinh nan
- dc.l ssinhd ;$02-4 fsinh denorm
- dc.l serror ;$02-5 fsinh ERROR
- dc.l serror ;$02-6 fsinh ERROR
- dc.l serror ;$02-7 fsinh ERROR
-
- dc.l sintrz ;$03-0 fintrz norm
- dc.l szero ;$03-1 fintrz zero
- dc.l sinf ;$03-2 fintrz inf
- dc.l src_nan ;$03-3 fintrz nan
- dc.l snzrinx ;$03-4 fintrz denorm inx
- dc.l serror ;$03-5 fintrz ERROR
- dc.l serror ;$03-6 fintrz ERROR
- dc.l serror ;$03-7 fintrz ERROR
-
- dc.l serror ;$04-0 ERROR - illegal extension
- dc.l serror ;$04-1 ERROR - illegal extension
- dc.l serror ;$04-2 ERROR - illegal extension
- dc.l serror ;$04-3 ERROR - illegal extension
- dc.l serror ;$04-4 ERROR - illegal extension
- dc.l serror ;$04-5 ERROR - illegal extension
- dc.l serror ;$04-6 ERROR - illegal extension
- dc.l serror ;$04-7 ERROR - illegal extension
-
- dc.l serror ;$05-0 ERROR - illegal extension
- dc.l serror ;$05-1 ERROR - illegal extension
- dc.l serror ;$05-2 ERROR - illegal extension
- dc.l serror ;$05-3 ERROR - illegal extension
- dc.l serror ;$05-4 ERROR - illegal extension
- dc.l serror ;$05-5 ERROR - illegal extension
- dc.l serror ;$05-6 ERROR - illegal extension
- dc.l serror ;$05-7 ERROR - illegal extension
-
- dc.l sslognp1 ;$06-0 flognp1 norm
- dc.l szero ;$06-1 flognp1 zero
- dc.l sopr_inf ;$06-2 flognp1 inf
- dc.l src_nan ;$06-3 flognp1 nan
- dc.l slognp1d ;$06-4 flognp1 denorm
- dc.l serror ;$06-5 flognp1 ERROR
- dc.l serror ;$06-6 flognp1 ERROR
- dc.l serror ;$06-7 flognp1 ERROR
-
- dc.l serror ;$07-0 ERROR - illegal extension
- dc.l serror ;$07-1 ERROR - illegal extension
- dc.l serror ;$07-2 ERROR - illegal extension
- dc.l serror ;$07-3 ERROR - illegal extension
- dc.l serror ;$07-4 ERROR - illegal extension
- dc.l serror ;$07-5 ERROR - illegal extension
- dc.l serror ;$07-6 ERROR - illegal extension
- dc.l serror ;$07-7 ERROR - illegal extension
-
- dc.l setoxm1 ;$08-0 fetoxm1 norm
- dc.l szero ;$08-1 fetoxm1 zero
- dc.l setoxm1i ;$08-2 fetoxm1 inf
- dc.l src_nan ;$08-3 fetoxm1 nan
- dc.l setoxm1d ;$08-4 fetoxm1 denorm
- dc.l serror ;$08-5 fetoxm1 ERROR
- dc.l serror ;$08-6 fetoxm1 ERROR
- dc.l serror ;$08-7 fetoxm1 ERROR
-
- dc.l stanh ;$09-0 ftanh norm
- dc.l szero ;$09-1 ftanh zero
- dc.l sone ;$09-2 ftanh inf
- dc.l src_nan ;$09-3 ftanh nan
- dc.l stanhd ;$09-4 ftanh denorm
- dc.l serror ;$09-5 ftanh ERROR
- dc.l serror ;$09-6 ftanh ERROR
- dc.l serror ;$09-7 ftanh ERROR
-
- dc.l satan ;$0a-0 fatan norm
- dc.l szero ;$0a-1 fatan zero
- dc.l spi_2 ;$0a-2 fatan inf
- dc.l src_nan ;$0a-3 fatan nan
- dc.l satand ;$0a-4 fatan denorm
- dc.l serror ;$0a-5 fatan ERROR
- dc.l serror ;$0a-6 fatan ERROR
- dc.l serror ;$0a-7 fatan ERROR
-
- dc.l serror ;$0b-0 ERROR - illegal extension
- dc.l serror ;$0b-1 ERROR - illegal extension
- dc.l serror ;$0b-2 ERROR - illegal extension
- dc.l serror ;$0b-3 ERROR - illegal extension
- dc.l serror ;$0b-4 ERROR - illegal extension
- dc.l serror ;$0b-5 ERROR - illegal extension
- dc.l serror ;$0b-6 ERROR - illegal extension
- dc.l serror ;$0b-7 ERROR - illegal extension
-
- dc.l sasin ;$0c-0 fasin norm
- dc.l szero ;$0c-1 fasin zero
- dc.l t_operr ;$0c-2 fasin inf
- dc.l src_nan ;$0c-3 fasin nan
- dc.l sasind ;$0c-4 fasin denorm
- dc.l serror ;$0c-5 fasin ERROR
- dc.l serror ;$0c-6 fasin ERROR
- dc.l serror ;$0c-7 fasin ERROR
-
- dc.l satanh ;$0d-0 fatanh norm
- dc.l szero ;$0d-1 fatanh zero
- dc.l t_operr ;$0d-2 fatanh inf
- dc.l src_nan ;$0d-3 fatanh nan
- dc.l satanhd ;$0d-4 fatanh denorm
- dc.l serror ;$0d-5 fatanh ERROR
- dc.l serror ;$0d-6 fatanh ERROR
- dc.l serror ;$0d-7 fatanh ERROR
-
- dc.l ssin ;$0e-0 fsin norm
- dc.l szero ;$0e-1 fsin zero
- dc.l t_operr ;$0e-2 fsin inf
- dc.l src_nan ;$0e-3 fsin nan
- dc.l ssind ;$0e-4 fsin denorm
- dc.l serror ;$0e-5 fsin ERROR
- dc.l serror ;$0e-6 fsin ERROR
- dc.l serror ;$0e-7 fsin ERROR
-
- dc.l stan ;$0f-0 ftan norm
- dc.l szero ;$0f-1 ftan zero
- dc.l t_operr ;$0f-2 ftan inf
- dc.l src_nan ;$0f-3 ftan nan
- dc.l stand ;$0f-4 ftan denorm
- dc.l serror ;$0f-5 ftan ERROR
- dc.l serror ;$0f-6 ftan ERROR
- dc.l serror ;$0f-7 ftan ERROR
-
- dc.l setox ;$10-0 fetox norm
- dc.l ld_pone ;$10-1 fetox zero
- dc.l szr_inf ;$10-2 fetox inf
- dc.l src_nan ;$10-3 fetox nan
- dc.l setoxd ;$10-4 fetox denorm
- dc.l serror ;$10-5 fetox ERROR
- dc.l serror ;$10-6 fetox ERROR
- dc.l serror ;$10-7 fetox ERROR
-
- dc.l stwotox ;$11-0 ftwotox norm
- dc.l ld_pone ;$11-1 ftwotox zero
- dc.l szr_inf ;$11-2 ftwotox inf
- dc.l src_nan ;$11-3 ftwotox nan
- dc.l stwotoxd ;$11-4 ftwotox denorm
- dc.l serror ;$11-5 ftwotox ERROR
- dc.l serror ;$11-6 ftwotox ERROR
- dc.l serror ;$11-7 ftwotox ERROR
-
- dc.l stentox ;$12-0 ftentox norm
- dc.l ld_pone ;$12-1 ftentox zero
- dc.l szr_inf ;$12-2 ftentox inf
- dc.l src_nan ;$12-3 ftentox nan
- dc.l stentoxd ;$12-4 ftentox denorm
- dc.l serror ;$12-5 ftentox ERROR
- dc.l serror ;$12-6 ftentox ERROR
- dc.l serror ;$12-7 ftentox ERROR
-
- dc.l serror ;$13-0 ERROR - illegal extension
- dc.l serror ;$13-1 ERROR - illegal extension
- dc.l serror ;$13-2 ERROR - illegal extension
- dc.l serror ;$13-3 ERROR - illegal extension
- dc.l serror ;$13-4 ERROR - illegal extension
- dc.l serror ;$13-5 ERROR - illegal extension
- dc.l serror ;$13-6 ERROR - illegal extension
- dc.l serror ;$13-7 ERROR - illegal extension
-
- dc.l sslogn ;$14-0 flogn norm
- dc.l t_dz2 ;$14-1 flogn zero
- dc.l sopr_inf ;$14-2 flogn inf
- dc.l src_nan ;$14-3 flogn nan
- dc.l sslognd ;$14-4 flogn denorm
- dc.l serror ;$14-5 flogn ERROR
- dc.l serror ;$14-6 flogn ERROR
- dc.l serror ;$14-7 flogn ERROR
-
- dc.l sslog10 ;$15-0 flog10 norm
- dc.l t_dz2 ;$15-1 flog10 zero
- dc.l sopr_inf ;$15-2 flog10 inf
- dc.l src_nan ;$15-3 flog10 nan
- dc.l sslog10d ;$15-4 flog10 denorm
- dc.l serror ;$15-5 flog10 ERROR
- dc.l serror ;$15-6 flog10 ERROR
- dc.l serror ;$15-7 flog10 ERROR
-
- dc.l sslog2 ;$16-0 flog2 norm
- dc.l t_dz2 ;$16-1 flog2 zero
- dc.l sopr_inf ;$16-2 flog2 inf
- dc.l src_nan ;$16-3 flog2 nan
- dc.l sslog2d ;$16-4 flog2 denorm
- dc.l serror ;$16-5 flog2 ERROR
- dc.l serror ;$16-6 flog2 ERROR
- dc.l serror ;$16-7 flog2 ERROR
-
- dc.l serror ;$17-0 ERROR - illegal extension
- dc.l serror ;$17-1 ERROR - illegal extension
- dc.l serror ;$17-2 ERROR - illegal extension
- dc.l serror ;$17-3 ERROR - illegal extension
- dc.l serror ;$17-4 ERROR - illegal extension
- dc.l serror ;$17-5 ERROR - illegal extension
- dc.l serror ;$17-6 ERROR - illegal extension
- dc.l serror ;$17-7 ERROR - illegal extension
-
- dc.l serror ;$18-0 ERROR - illegal extension
- dc.l serror ;$18-1 ERROR - illegal extension
- dc.l serror ;$18-2 ERROR - illegal extension
- dc.l serror ;$18-3 ERROR - illegal extension
- dc.l serror ;$18-4 ERROR - illegal extension
- dc.l serror ;$18-5 ERROR - illegal extension
- dc.l serror ;$18-6 ERROR - illegal extension
- dc.l serror ;$18-7 ERROR - illegal extension
-
- dc.l scosh ;$19-0 fcosh norm
- dc.l ld_pone ;$19-1 fcosh zero
- dc.l ld_pinf ;$19-2 fcosh inf
- dc.l src_nan ;$19-3 fcosh nan
- dc.l scoshd ;$19-4 fcosh denorm
- dc.l serror ;$19-5 fcosh ERROR
- dc.l serror ;$19-6 fcosh ERROR
- dc.l serror ;$19-7 fcosh ERROR
-
- dc.l serror ;$1a-0 ERROR - illegal extension
- dc.l serror ;$1a-1 ERROR - illegal extension
- dc.l serror ;$1a-2 ERROR - illegal extension
- dc.l serror ;$1a-3 ERROR - illegal extension
- dc.l serror ;$1a-4 ERROR - illegal extension
- dc.l serror ;$1a-5 ERROR - illegal extension
- dc.l serror ;$1a-6 ERROR - illegal extension
- dc.l serror ;$1a-7 ERROR - illegal extension
-
- dc.l serror ;$1b-0 ERROR - illegal extension
- dc.l serror ;$1b-1 ERROR - illegal extension
- dc.l serror ;$1b-2 ERROR - illegal extension
- dc.l serror ;$1b-3 ERROR - illegal extension
- dc.l serror ;$1b-4 ERROR - illegal extension
- dc.l serror ;$1b-5 ERROR - illegal extension
- dc.l serror ;$1b-6 ERROR - illegal extension
- dc.l serror ;$1b-7 ERROR - illegal extension
-
- dc.l sacos ;$1c-0 facos norm
- dc.l ld_ppi2 ;$1c-1 facos zero
- dc.l t_operr ;$1c-2 facos inf
- dc.l src_nan ;$1c-3 facos nan
- dc.l sacosd ;$1c-4 facos denorm
- dc.l serror ;$1c-5 facos ERROR
- dc.l serror ;$1c-6 facos ERROR
- dc.l serror ;$1c-7 facos ERROR
-
- dc.l scos ;$1d-0 fcos norm
- dc.l ld_pone ;$1d-1 fcos zero
- dc.l t_operr ;$1d-2 fcos inf
- dc.l src_nan ;$1d-3 fcos nan
- dc.l scosd ;$1d-4 fcos denorm
- dc.l serror ;$1d-5 fcos ERROR
- dc.l serror ;$1d-6 fcos ERROR
- dc.l serror ;$1d-7 fcos ERROR
-
- dc.l sgetexp ;$1e-0 fgetexp norm
- dc.l szero ;$1e-1 fgetexp zero
- dc.l t_operr ;$1e-2 fgetexp inf
- dc.l src_nan ;$1e-3 fgetexp nan
- dc.l sgetexpd ;$1e-4 fgetexp denorm
- dc.l serror ;$1e-5 fgetexp ERROR
- dc.l serror ;$1e-6 fgetexp ERROR
- dc.l serror ;$1e-7 fgetexp ERROR
-
- dc.l sgetman ;$1f-0 fgetman norm
- dc.l szero ;$1f-1 fgetman zero
- dc.l t_operr ;$1f-2 fgetman inf
- dc.l src_nan ;$1f-3 fgetman nan
- dc.l sgetmand ;$1f-4 fgetman denorm
- dc.l serror ;$1f-5 fgetman ERROR
- dc.l serror ;$1f-6 fgetman ERROR
- dc.l serror ;$1f-7 fgetman ERROR
-
- dc.l serror ;$20-0 ERROR - illegal extension
- dc.l serror ;$20-1 ERROR - illegal extension
- dc.l serror ;$20-2 ERROR - illegal extension
- dc.l serror ;$20-3 ERROR - illegal extension
- dc.l serror ;$20-4 ERROR - illegal extension
- dc.l serror ;$20-5 ERROR - illegal extension
- dc.l serror ;$20-6 ERROR - illegal extension
- dc.l serror ;$20-7 ERROR - illegal extension
-
- dc.l pmod ;$21-0 fmod all
- dc.l pmod ;$21-1 fmod all
- dc.l pmod ;$21-2 fmod all
- dc.l pmod ;$21-3 fmod all
- dc.l pmod ;$21-4 fmod all
- dc.l serror ;$21-5 fmod ERROR
- dc.l serror ;$21-6 fmod ERROR
- dc.l serror ;$21-7 fmod ERROR
-
- dc.l serror ;$22-0 ERROR - illegal extension
- dc.l serror ;$22-1 ERROR - illegal extension
- dc.l serror ;$22-2 ERROR - illegal extension
- dc.l serror ;$22-3 ERROR - illegal extension
- dc.l serror ;$22-4 ERROR - illegal extension
- dc.l serror ;$22-5 ERROR - illegal extension
- dc.l serror ;$22-6 ERROR - illegal extension
- dc.l serror ;$22-7 ERROR - illegal extension
-
- dc.l serror ;$23-0 ERROR - illegal extension
- dc.l serror ;$23-1 ERROR - illegal extension
- dc.l serror ;$23-2 ERROR - illegal extension
- dc.l serror ;$23-3 ERROR - illegal extension
- dc.l serror ;$23-4 ERROR - illegal extension
- dc.l serror ;$23-5 ERROR - illegal extension
- dc.l serror ;$23-6 ERROR - illegal extension
- dc.l serror ;$23-7 ERROR - illegal extension
-
- dc.l serror ;$24-0 ERROR - illegal extension
- dc.l serror ;$24-1 ERROR - illegal extension
- dc.l serror ;$24-2 ERROR - illegal extension
- dc.l serror ;$24-3 ERROR - illegal extension
- dc.l serror ;$24-4 ERROR - illegal extension
- dc.l serror ;$24-5 ERROR - illegal extension
- dc.l serror ;$24-6 ERROR - illegal extension
- dc.l serror ;$24-7 ERROR - illegal extension
-
- dc.l prem ;$25-0 frem all
- dc.l prem ;$25-1 frem all
- dc.l prem ;$25-2 frem all
- dc.l prem ;$25-3 frem all
- dc.l prem ;$25-4 frem all
- dc.l serror ;$25-5 frem ERROR
- dc.l serror ;$25-6 frem ERROR
- dc.l serror ;$25-7 frem ERROR
-
- dc.l pscale ;$26-0 fscale all
- dc.l pscale ;$26-1 fscale all
- dc.l pscale ;$26-2 fscale all
- dc.l pscale ;$26-3 fscale all
- dc.l pscale ;$26-4 fscale all
- dc.l serror ;$26-5 fscale ERROR
- dc.l serror ;$26-6 fscale ERROR
- dc.l serror ;$26-7 fscale ERROR
-
- dc.l serror ;$27-0 ERROR - illegal extension
- dc.l serror ;$27-1 ERROR - illegal extension
- dc.l serror ;$27-2 ERROR - illegal extension
- dc.l serror ;$27-3 ERROR - illegal extension
- dc.l serror ;$27-4 ERROR - illegal extension
- dc.l serror ;$27-5 ERROR - illegal extension
- dc.l serror ;$27-6 ERROR - illegal extension
- dc.l serror ;$27-7 ERROR - illegal extension
-
- dc.l serror ;$28-0 ERROR - illegal extension
- dc.l serror ;$28-1 ERROR - illegal extension
- dc.l serror ;$28-2 ERROR - illegal extension
- dc.l serror ;$28-3 ERROR - illegal extension
- dc.l serror ;$28-4 ERROR - illegal extension
- dc.l serror ;$28-5 ERROR - illegal extension
- dc.l serror ;$28-6 ERROR - illegal extension
- dc.l serror ;$28-7 ERROR - illegal extension
-
- dc.l serror ;$29-0 ERROR - illegal extension
- dc.l serror ;$29-1 ERROR - illegal extension
- dc.l serror ;$29-2 ERROR - illegal extension
- dc.l serror ;$29-3 ERROR - illegal extension
- dc.l serror ;$29-4 ERROR - illegal extension
- dc.l serror ;$29-5 ERROR - illegal extension
- dc.l serror ;$29-6 ERROR - illegal extension
- dc.l serror ;$29-7 ERROR - illegal extension
-
- dc.l serror ;$2a-0 ERROR - illegal extension
- dc.l serror ;$2a-1 ERROR - illegal extension
- dc.l serror ;$2a-2 ERROR - illegal extension
- dc.l serror ;$2a-3 ERROR - illegal extension
- dc.l serror ;$2a-4 ERROR - illegal extension
- dc.l serror ;$2a-5 ERROR - illegal extension
- dc.l serror ;$2a-6 ERROR - illegal extension
- dc.l serror ;$2a-7 ERROR - illegal extension
-
- dc.l serror ;$2b-0 ERROR - illegal extension
- dc.l serror ;$2b-1 ERROR - illegal extension
- dc.l serror ;$2b-2 ERROR - illegal extension
- dc.l serror ;$2b-3 ERROR - illegal extension
- dc.l serror ;$2b-4 ERROR - illegal extension
- dc.l serror ;$2b-5 ERROR - illegal extension
- dc.l serror ;$2b-6 ERROR - illegal extension
- dc.l serror ;$2b-7 ERROR - illegal extension
-
- dc.l serror ;$2c-0 ERROR - illegal extension
- dc.l serror ;$2c-1 ERROR - illegal extension
- dc.l serror ;$2c-2 ERROR - illegal extension
- dc.l serror ;$2c-3 ERROR - illegal extension
- dc.l serror ;$2c-4 ERROR - illegal extension
- dc.l serror ;$2c-5 ERROR - illegal extension
- dc.l serror ;$2c-6 ERROR - illegal extension
- dc.l serror ;$2c-7 ERROR - illegal extension
-
- dc.l serror ;$2d-0 ERROR - illegal extension
- dc.l serror ;$2d-1 ERROR - illegal extension
- dc.l serror ;$2d-2 ERROR - illegal extension
- dc.l serror ;$2d-3 ERROR - illegal extension
- dc.l serror ;$2d-4 ERROR - illegal extension
- dc.l serror ;$2d-5 ERROR - illegal extension
- dc.l serror ;$2d-6 ERROR - illegal extension
- dc.l serror ;$2d-7 ERROR - illegal extension
-
- dc.l serror ;$2e-0 ERROR - illegal extension
- dc.l serror ;$2e-1 ERROR - illegal extension
- dc.l serror ;$2e-2 ERROR - illegal extension
- dc.l serror ;$2e-3 ERROR - illegal extension
- dc.l serror ;$2e-4 ERROR - illegal extension
- dc.l serror ;$2e-5 ERROR - illegal extension
- dc.l serror ;$2e-6 ERROR - illegal extension
- dc.l serror ;$2e-7 ERROR - illegal extension
-
- dc.l serror ;$2f-0 ERROR - illegal extension
- dc.l serror ;$2f-1 ERROR - illegal extension
- dc.l serror ;$2f-2 ERROR - illegal extension
- dc.l serror ;$2f-3 ERROR - illegal extension
- dc.l serror ;$2f-4 ERROR - illegal extension
- dc.l serror ;$2f-5 ERROR - illegal extension
- dc.l serror ;$2f-6 ERROR - illegal extension
- dc.l serror ;$2f-7 ERROR - illegal extension
-
- dc.l ssincos ;$30-0 fsincos norm
- dc.l ssincosz ;$30-1 fsincos zero
- dc.l ssincosi ;$30-2 fsincos inf
- dc.l ssincosnan ;$30-3 fsincos nan
- dc.l ssincosd ;$30-4 fsincos denorm
- dc.l serror ;$30-5 fsincos ERROR
- dc.l serror ;$30-6 fsincos ERROR
- dc.l serror ;$30-7 fsincos ERROR
-
- dc.l ssincos ;$31-0 fsincos norm
- dc.l ssincosz ;$31-1 fsincos zero
- dc.l ssincosi ;$31-2 fsincos inf
- dc.l ssincosnan ;$31-3 fsincos nan
- dc.l ssincosd ;$31-4 fsincos denorm
- dc.l serror ;$31-5 fsincos ERROR
- dc.l serror ;$31-6 fsincos ERROR
- dc.l serror ;$31-7 fsincos ERROR
-
- dc.l ssincos ;$32-0 fsincos norm
- dc.l ssincosz ;$32-1 fsincos zero
- dc.l ssincosi ;$32-2 fsincos inf
- dc.l ssincosnan ;$32-3 fsincos nan
- dc.l ssincosd ;$32-4 fsincos denorm
- dc.l serror ;$32-5 fsincos ERROR
- dc.l serror ;$32-6 fsincos ERROR
- dc.l serror ;$32-7 fsincos ERROR
-
- dc.l ssincos ;$33-0 fsincos norm
- dc.l ssincosz ;$33-1 fsincos zero
- dc.l ssincosi ;$33-2 fsincos inf
- dc.l ssincosnan ;$33-3 fsincos nan
- dc.l ssincosd ;$33-4 fsincos denorm
- dc.l serror ;$33-5 fsincos ERROR
- dc.l serror ;$33-6 fsincos ERROR
- dc.l serror ;$33-7 fsincos ERROR
-
- dc.l ssincos ;$34-0 fsincos norm
- dc.l ssincosz ;$34-1 fsincos zero
- dc.l ssincosi ;$34-2 fsincos inf
- dc.l ssincosnan ;$34-3 fsincos nan
- dc.l ssincosd ;$34-4 fsincos denorm
- dc.l serror ;$34-5 fsincos ERROR
- dc.l serror ;$34-6 fsincos ERROR
- dc.l serror ;$34-7 fsincos ERROR
-
- dc.l ssincos ;$35-0 fsincos norm
- dc.l ssincosz ;$35-1 fsincos zero
- dc.l ssincosi ;$35-2 fsincos inf
- dc.l ssincosnan ;$35-3 fsincos nan
- dc.l ssincosd ;$35-4 fsincos denorm
- dc.l serror ;$35-5 fsincos ERROR
- dc.l serror ;$35-6 fsincos ERROR
- dc.l serror ;$35-7 fsincos ERROR
-
- dc.l ssincos ;$36-0 fsincos norm
- dc.l ssincosz ;$36-1 fsincos zero
- dc.l ssincosi ;$36-2 fsincos inf
- dc.l ssincosnan ;$36-3 fsincos nan
- dc.l ssincosd ;$36-4 fsincos denorm
- dc.l serror ;$36-5 fsincos ERROR
- dc.l serror ;$36-6 fsincos ERROR
- dc.l serror ;$36-7 fsincos ERROR
-
- dc.l ssincos ;$37-0 fsincos norm
- dc.l ssincosz ;$37-1 fsincos zero
- dc.l ssincosi ;$37-2 fsincos inf
- dc.l ssincosnan ;$37-3 fsincos nan
- dc.l ssincosd ;$37-4 fsincos denorm
- dc.l serror ;$37-5 fsincos ERROR
- dc.l serror ;$37-6 fsincos ERROR
- dc.l serror ;$37-7 fsincos ERROR
-
- end
diff --git a/sys/arch/m68k/fpsp/util.sa b/sys/arch/m68k/fpsp/util.sa
deleted file mode 100644
index d7ca7421cf2..00000000000
--- a/sys/arch/m68k/fpsp/util.sa
+++ /dev/null
@@ -1,775 +0,0 @@
-* $OpenBSD: util.sa,v 1.3 2013/02/02 13:32:05 miod Exp $
-* $NetBSD: util.sa,v 1.3 1994/10/26 07:50:20 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* util.sa 3.7 7/29/91
-*
-* This file contains routines used by other programs.
-*
-* ovf_res: used by overflow to force the correct
-* result. ovf_r_k, ovf_r_x2, ovf_r_x3 are
-* derivatives of this routine.
-* get_fline: get user's opcode word
-* g_dfmtou: returns the destination format.
-* g_opcls: returns the opclass of the float instruction.
-* g_rndpr: returns the rounding precision.
-* reg_dest: write byte, word, or long data to Dn
-*
-
-UTIL IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
- xref mem_read
-
- xdef g_dfmtou
- xdef g_opcls
- xdef g_rndpr
- xdef get_fline
- xdef reg_dest
-
-*
-* Final result table for ovf_res. Note that the negative counterparts
-* are unnecessary as ovf_res always returns the sign separately from
-* the exponent.
-* ;+inf
-EXT_PINF dc.l $7fff0000,$00000000,$00000000,$00000000
-* ;largest +ext
-EXT_PLRG dc.l $7ffe0000,$ffffffff,$ffffffff,$00000000
-* ;largest magnitude +sgl in ext
-SGL_PLRG dc.l $407e0000,$ffffff00,$00000000,$00000000
-* ;largest magnitude +dbl in ext
-DBL_PLRG dc.l $43fe0000,$ffffffff,$fffff800,$00000000
-* ;largest -ext
-
-tblovfl:
- dc.l EXT_RN
- dc.l EXT_RZ
- dc.l EXT_RM
- dc.l EXT_RP
- dc.l SGL_RN
- dc.l SGL_RZ
- dc.l SGL_RM
- dc.l SGL_RP
- dc.l DBL_RN
- dc.l DBL_RZ
- dc.l DBL_RM
- dc.l DBL_RP
- dc.l error
- dc.l error
- dc.l error
- dc.l error
-
-
-*
-* ovf_r_k --- overflow result calculation
-*
-* This entry point is used by kernel_ex.
-*
-* This forces the destination precision to be extended
-*
-* Input: operand in ETEMP
-* Output: a result is in ETEMP (internal extended format)
-*
- xdef ovf_r_k
-ovf_r_k:
- lea ETEMP(a6),a0 ;a0 points to source operand
- bclr.b #sign_bit,ETEMP_EX(a6)
- sne ETEMP_SGN(a6) ;convert to internal IEEE format
-
-*
-* ovf_r_x2 --- overflow result calculation
-*
-* This entry point used by x_ovfl. (opclass 0 and 2)
-*
-* Input a0 points to an operand in the internal extended format
-* Output a0 points to the result in the internal extended format
-*
-* This sets the round precision according to the user's FPCR unless the
-* instruction is fsgldiv or fsglmul or fsadd, fdadd, fsub, fdsub, fsmul,
-* fdmul, fsdiv, fddiv, fssqrt, fsmove, fdmove, fsabs, fdabs, fsneg, fdneg.
-* If the instruction is fsgldiv of fsglmul, the rounding precision must be
-* extended. If the instruction is not fsgldiv or fsglmul but a force-
-* precision instruction, the rounding precision is then set to the force
-* precision.
-
- xdef ovf_r_x2
-ovf_r_x2:
- btst.b #E3,E_BYTE(a6) ;check for nu exception
- beq.l ovf_e1_exc ;it is cu exception
-ovf_e3_exc:
- move.w CMDREG3B(a6),d0 ;get the command word
- andi.w #$00000060,d0 ;clear all bits except 6 and 5
- cmpi.l #$00000040,d0
- beq.l ovff_sgl ;force precision is single
- cmpi.l #$00000060,d0
- beq.l ovff_dbl ;force precision is double
- move.w CMDREG3B(a6),d0 ;get the command word again
- andi.l #$7f,d0 ;clear all except operation
- cmpi.l #$33,d0
- beq.l ovf_fsgl ;fsglmul or fsgldiv
- cmpi.l #$30,d0
- beq.l ovf_fsgl
- bra ovf_fpcr ;instruction is none of the above
-* ;use FPCR
-ovf_e1_exc:
- move.w CMDREG1B(a6),d0 ;get command word
- andi.l #$00000044,d0 ;clear all bits except 6 and 2
- cmpi.l #$00000040,d0
- beq.l ovff_sgl ;the instruction is force single
- cmpi.l #$00000044,d0
- beq.l ovff_dbl ;the instruction is force double
- move.w CMDREG1B(a6),d0 ;again get the command word
- andi.l #$0000007f,d0 ;clear all except the op code
- cmpi.l #$00000027,d0
- beq.l ovf_fsgl ;fsglmul
- cmpi.l #$00000024,d0
- beq.l ovf_fsgl ;fsgldiv
- bra ovf_fpcr ;none of the above, use FPCR
-*
-*
-* Inst is either fsgldiv or fsglmul. Force extended precision.
-*
-ovf_fsgl:
- clr.l d0
- bra.b short_ovf_res
-
-ovff_sgl:
- move.l #$00000001,d0 ;set single
- bra.b short_ovf_res
-ovff_dbl:
- move.l #$00000002,d0 ;set double
- bra.b short_ovf_res
-*
-* The precision is in the fpcr.
-*
-ovf_fpcr:
- bfextu FPCR_MODE(a6){0:2},d0 ;set round precision
- bra.b short_ovf_res
-
-*
-*
-* ovf_r_x3 --- overflow result calculation
-*
-* This entry point used by x_ovfl. (opclass 3 only)
-*
-* Input a0 points to an operand in the internal extended format
-* Output a0 points to the result in the internal extended format
-*
-* This sets the round precision according to the destination size.
-*
- xdef ovf_r_x3
-ovf_r_x3:
- bsr g_dfmtou ;get dest fmt in d0{1:0}
-* ;for fmovout, the destination format
-* ;is the rounding precision
-
-*
-* ovf_res --- overflow result calculation
-*
-* Input:
-* a0 points to operand in internal extended format
-* Output:
-* a0 points to result in internal extended format
-*
- xdef ovf_res
-ovf_res:
-short_ovf_res:
- lsl.l #2,d0 ;move round precision to d0{3:2}
- bfextu FPCR_MODE(a6){2:2},d1 ;set round mode
- or.l d1,d0 ;index is fmt:mode in d0{3:0}
- lea.l tblovfl,a1 ;load a1 with table address
- move.l (a1,d0*4),a1 ;use d0 as index to the table
- jmp (a1) ;go to the correct routine
-*
-*case DEST_FMT = EXT
-*
-EXT_RN:
- lea.l EXT_PINF,a1 ;answer is +/- infinity
- bset.b #inf_bit,FPSR_CC(a6)
- bra set_sign ;now go set the sign
-EXT_RZ:
- lea.l EXT_PLRG,a1 ;answer is +/- large number
- bra set_sign ;now go set the sign
-EXT_RM:
- tst.b LOCAL_SGN(a0) ;if negative overflow
- beq.b e_rm_pos
-e_rm_neg:
- lea.l EXT_PINF,a1 ;answer is negative infinity
- or.l #neginf_mask,USER_FPSR(a6)
- bra end_ovfr
-e_rm_pos:
- lea.l EXT_PLRG,a1 ;answer is large positive number
- bra end_ovfr
-EXT_RP:
- tst.b LOCAL_SGN(a0) ;if negative overflow
- beq.b e_rp_pos
-e_rp_neg:
- lea.l EXT_PLRG,a1 ;answer is large negative number
- bset.b #neg_bit,FPSR_CC(a6)
- bra end_ovfr
-e_rp_pos:
- lea.l EXT_PINF,a1 ;answer is positive infinity
- bset.b #inf_bit,FPSR_CC(a6)
- bra end_ovfr
-*
-*case DEST_FMT = DBL
-*
-DBL_RN:
- lea.l EXT_PINF,a1 ;answer is +/- infinity
- bset.b #inf_bit,FPSR_CC(a6)
- bra set_sign
-DBL_RZ:
- lea.l DBL_PLRG,a1 ;answer is +/- large number
- bra set_sign ;now go set the sign
-DBL_RM:
- tst.b LOCAL_SGN(a0) ;if negative overflow
- beq.b d_rm_pos
-d_rm_neg:
- lea.l EXT_PINF,a1 ;answer is negative infinity
- or.l #neginf_mask,USER_FPSR(a6)
- bra end_ovfr ;inf is same for all precisions (ext,dbl,sgl)
-d_rm_pos:
- lea.l DBL_PLRG,a1 ;answer is large positive number
- bra end_ovfr
-DBL_RP:
- tst.b LOCAL_SGN(a0) ;if negative overflow
- beq.b d_rp_pos
-d_rp_neg:
- lea.l DBL_PLRG,a1 ;answer is large negative number
- bset.b #neg_bit,FPSR_CC(a6)
- bra end_ovfr
-d_rp_pos:
- lea.l EXT_PINF,a1 ;answer is positive infinity
- bset.b #inf_bit,FPSR_CC(a6)
- bra end_ovfr
-*
-*case DEST_FMT = SGL
-*
-SGL_RN:
- lea.l EXT_PINF,a1 ;answer is +/- infinity
- bset.b #inf_bit,FPSR_CC(a6)
- bra.b set_sign
-SGL_RZ:
- lea.l SGL_PLRG,a1 ;anwer is +/- large number
- bra.b set_sign
-SGL_RM:
- tst.b LOCAL_SGN(a0) ;if negative overflow
- beq.b s_rm_pos
-s_rm_neg:
- lea.l EXT_PINF,a1 ;answer is negative infinity
- or.l #neginf_mask,USER_FPSR(a6)
- bra.b end_ovfr
-s_rm_pos:
- lea.l SGL_PLRG,a1 ;answer is large positive number
- bra.b end_ovfr
-SGL_RP:
- tst.b LOCAL_SGN(a0) ;if negative overflow
- beq.b s_rp_pos
-s_rp_neg:
- lea.l SGL_PLRG,a1 ;answer is large negative number
- bset.b #neg_bit,FPSR_CC(a6)
- bra.b end_ovfr
-s_rp_pos:
- lea.l EXT_PINF,a1 ;answer is postive infinity
- bset.b #inf_bit,FPSR_CC(a6)
- bra.b end_ovfr
-
-set_sign:
- tst.b LOCAL_SGN(a0) ;if negative overflow
- beq.b end_ovfr
-neg_sign:
- bset.b #neg_bit,FPSR_CC(a6)
-
-end_ovfr:
- move.w LOCAL_EX(a1),LOCAL_EX(a0) ;do not overwrite sign
- move.l LOCAL_HI(a1),LOCAL_HI(a0)
- move.l LOCAL_LO(a1),LOCAL_LO(a0)
- rts
-
-
-*
-* ERROR
-*
-error:
- rts
-*
-* get_fline --- get f-line opcode of interrupted instruction
-*
-* Returns opcode in the low word of d0.
-*
-get_fline:
- move.l USER_FPIAR(a6),a0 ;opcode address
- clr.l -(a7) ;reserve a word on the stack
- lea.l 2(a7),a1 ;point to low word of temporary
- move.l #2,d0 ;count
- bsr.l mem_read
- move.l (a7)+,d0
- rts
-*
-* g_rndpr --- put rounding precision in d0{1:0}
-*
-* valid return codes are:
-* 00 - extended
-* 01 - single
-* 10 - double
-*
-* begin
-* get rounding precision (cmdreg3b{6:5})
-* begin
-* case opclass = 011 (move out)
-* get destination format - this is the also the rounding precision
-*
-* case opclass = 0x0
-* if E3
-* *case RndPr(from cmdreg3b{6:5} = 11 then RND_PREC = DBL
-* *case RndPr(from cmdreg3b{6:5} = 10 then RND_PREC = SGL
-* case RndPr(from cmdreg3b{6:5} = 00 | 01
-* use precision from FPCR{7:6}
-* case 00 then RND_PREC = EXT
-* case 01 then RND_PREC = SGL
-* case 10 then RND_PREC = DBL
-* else E1
-* use precision in FPCR{7:6}
-* case 00 then RND_PREC = EXT
-* case 01 then RND_PREC = SGL
-* case 10 then RND_PREC = DBL
-* end
-*
-g_rndpr:
- bsr.w g_opcls ;get opclass in d0{2:0}
- cmp.w #$0003,d0 ;check for opclass 011
- bne.b op_0x0
-
-*
-* For move out instructions (opclass 011) the destination format
-* is the same as the rounding precision. Pass results from g_dfmtou.
-*
- bsr.w g_dfmtou
- rts
-op_0x0:
- btst.b #E3,E_BYTE(a6)
- beq.l unf_e1_exc ;branch to e1 underflow
-unf_e3_exc:
- move.l CMDREG3B(a6),d0 ;rounding precision in d0{10:9}
- bfextu d0{9:2},d0 ;move the rounding prec bits to d0{1:0}
- cmpi.l #$2,d0
- beq.l unff_sgl ;force precision is single
- cmpi.l #$3,d0 ;force precision is double
- beq.l unff_dbl
- move.w CMDREG3B(a6),d0 ;get the command word again
- andi.l #$7f,d0 ;clear all except operation
- cmpi.l #$33,d0
- beq.l unf_fsgl ;fsglmul or fsgldiv
- cmpi.l #$30,d0
- beq.l unf_fsgl ;fsgldiv or fsglmul
- bra unf_fpcr
-unf_e1_exc:
- move.l CMDREG1B(a6),d0 ;get 32 bits off the stack, 1st 16 bits
-* ;are the command word
- andi.l #$00440000,d0 ;clear all bits except bits 6 and 2
- cmpi.l #$00400000,d0
- beq.l unff_sgl ;force single
- cmpi.l #$00440000,d0 ;force double
- beq.l unff_dbl
- move.l CMDREG1B(a6),d0 ;get the command word again
- andi.l #$007f0000,d0 ;clear all bits except the operation
- cmpi.l #$00270000,d0
- beq.l unf_fsgl ;fsglmul
- cmpi.l #$00240000,d0
- beq.l unf_fsgl ;fsgldiv
- bra unf_fpcr
-
-*
-* Convert to return format. The values from cmdreg3b and the return
-* values are:
-* cmdreg3b return precision
-* -------- ------ ---------
-* 00,01 0 ext
-* 10 1 sgl
-* 11 2 dbl
-* Force single
-*
-unff_sgl:
- move.l #1,d0 ;return 1
- rts
-*
-* Force double
-*
-unff_dbl:
- move.l #2,d0 ;return 2
- rts
-*
-* Force extended
-*
-unf_fsgl:
- clr.l d0
- rts
-*
-* Get rounding precision set in FPCR{7:6}.
-*
-unf_fpcr:
- move.l USER_FPCR(a6),d0 ;rounding precision bits in d0{7:6}
- bfextu d0{24:2},d0 ;move the rounding prec bits to d0{1:0}
- rts
-*
-* g_opcls --- put opclass in d0{2:0}
-*
-g_opcls:
- btst.b #E3,E_BYTE(a6)
- beq.b opc_1b ;if set, go to cmdreg1b
-opc_3b:
- clr.l d0 ;if E3, only opclass 0x0 is possible
- rts
-opc_1b:
- move.l CMDREG1B(a6),d0
- bfextu d0{0:3},d0 ;shift opclass bits d0{31:29} to d0{2:0}
- rts
-*
-* g_dfmtou --- put destination format in d0{1:0}
-*
-* If E1, the format is from cmdreg1b{12:10}
-* If E3, the format is extended.
-*
-* Dest. Fmt.
-* extended 010 -> 00
-* single 001 -> 01
-* double 101 -> 10
-*
-g_dfmtou:
- btst.b #E3,E_BYTE(a6)
- beq.b op011
- clr.l d0 ;if E1, size is always ext
- rts
-op011:
- move.l CMDREG1B(a6),d0
- bfextu d0{3:3},d0 ;dest fmt from cmdreg1b{12:10}
- cmp.b #1,d0 ;check for single
- bne.b not_sgl
- move.l #1,d0
- rts
-not_sgl:
- cmp.b #5,d0 ;check for double
- bne.b not_dbl
- move.l #2,d0
- rts
-not_dbl:
- clr.l d0 ;must be extended
- rts
-
-*
-*
-* Final result table for unf_sub. Note that the negative counterparts
-* are unnecessary as unf_sub always returns the sign separately from
-* the exponent.
-* ;+zero
-EXT_PZRO dc.l $00000000,$00000000,$00000000,$00000000
-* ;+zero
-SGL_PZRO dc.l $3f810000,$00000000,$00000000,$00000000
-* ;+zero
-DBL_PZRO dc.l $3c010000,$00000000,$00000000,$00000000
-* ;smallest +ext denorm
-EXT_PSML dc.l $00000000,$00000000,$00000001,$00000000
-* ;smallest +sgl denorm
-SGL_PSML dc.l $3f810000,$00000100,$00000000,$00000000
-* ;smallest +dbl denorm
-DBL_PSML dc.l $3c010000,$00000000,$00000800,$00000000
-*
-* UNF_SUB --- underflow result calculation
-*
-* Input:
-* d0 contains round precision
-* a0 points to input operand in the internal extended format
-*
-* Output:
-* a0 points to correct internal extended precision result.
-*
-
-tblunf:
- dc.l uEXT_RN
- dc.l uEXT_RZ
- dc.l uEXT_RM
- dc.l uEXT_RP
- dc.l uSGL_RN
- dc.l uSGL_RZ
- dc.l uSGL_RM
- dc.l uSGL_RP
- dc.l uDBL_RN
- dc.l uDBL_RZ
- dc.l uDBL_RM
- dc.l uDBL_RP
- dc.l uDBL_RN
- dc.l uDBL_RZ
- dc.l uDBL_RM
- dc.l uDBL_RP
-
- xdef unf_sub
-unf_sub:
- lsl.l #2,d0 ;move round precision to d0{3:2}
- bfextu FPCR_MODE(a6){2:2},d1 ;set round mode
- or.l d1,d0 ;index is fmt:mode in d0{3:0}
- lea.l tblunf,a1 ;load a1 with table address
- move.l (a1,d0*4),a1 ;use d0 as index to the table
- jmp (a1) ;go to the correct routine
-*
-*case DEST_FMT = EXT
-*
-uEXT_RN:
- lea.l EXT_PZRO,a1 ;answer is +/- zero
- bset.b #z_bit,FPSR_CC(a6)
- bra uset_sign ;now go set the sign
-uEXT_RZ:
- lea.l EXT_PZRO,a1 ;answer is +/- zero
- bset.b #z_bit,FPSR_CC(a6)
- bra uset_sign ;now go set the sign
-uEXT_RM:
- tst.b LOCAL_SGN(a0) ;if negative underflow
- beq.b ue_rm_pos
-ue_rm_neg:
- lea.l EXT_PSML,a1 ;answer is negative smallest denorm
- bset.b #neg_bit,FPSR_CC(a6)
- bra end_unfr
-ue_rm_pos:
- lea.l EXT_PZRO,a1 ;answer is positive zero
- bset.b #z_bit,FPSR_CC(a6)
- bra end_unfr
-uEXT_RP:
- tst.b LOCAL_SGN(a0) ;if negative underflow
- beq.b ue_rp_pos
-ue_rp_neg:
- lea.l EXT_PZRO,a1 ;answer is negative zero
- ori.l #negz_mask,USER_FPSR(a6)
- bra end_unfr
-ue_rp_pos:
- lea.l EXT_PSML,a1 ;answer is positive smallest denorm
- bra end_unfr
-*
-*case DEST_FMT = DBL
-*
-uDBL_RN:
- lea.l DBL_PZRO,a1 ;answer is +/- zero
- bset.b #z_bit,FPSR_CC(a6)
- bra uset_sign
-uDBL_RZ:
- lea.l DBL_PZRO,a1 ;answer is +/- zero
- bset.b #z_bit,FPSR_CC(a6)
- bra uset_sign ;now go set the sign
-uDBL_RM:
- tst.b LOCAL_SGN(a0) ;if negative overflow
- beq.b ud_rm_pos
-ud_rm_neg:
- lea.l DBL_PSML,a1 ;answer is smallest denormalized negative
- bset.b #neg_bit,FPSR_CC(a6)
- bra end_unfr
-ud_rm_pos:
- lea.l DBL_PZRO,a1 ;answer is positive zero
- bset.b #z_bit,FPSR_CC(a6)
- bra end_unfr
-uDBL_RP:
- tst.b LOCAL_SGN(a0) ;if negative overflow
- beq.b ud_rp_pos
-ud_rp_neg:
- lea.l DBL_PZRO,a1 ;answer is negative zero
- ori.l #negz_mask,USER_FPSR(a6)
- bra end_unfr
-ud_rp_pos:
- lea.l DBL_PSML,a1 ;answer is smallest denormalized negative
- bra end_unfr
-*
-*case DEST_FMT = SGL
-*
-uSGL_RN:
- lea.l SGL_PZRO,a1 ;answer is +/- zero
- bset.b #z_bit,FPSR_CC(a6)
- bra.b uset_sign
-uSGL_RZ:
- lea.l SGL_PZRO,a1 ;answer is +/- zero
- bset.b #z_bit,FPSR_CC(a6)
- bra.b uset_sign
-uSGL_RM:
- tst.b LOCAL_SGN(a0) ;if negative overflow
- beq.b us_rm_pos
-us_rm_neg:
- lea.l SGL_PSML,a1 ;answer is smallest denormalized negative
- bset.b #neg_bit,FPSR_CC(a6)
- bra.b end_unfr
-us_rm_pos:
- lea.l SGL_PZRO,a1 ;answer is positive zero
- bset.b #z_bit,FPSR_CC(a6)
- bra.b end_unfr
-uSGL_RP:
- tst.b LOCAL_SGN(a0) ;if negative overflow
- beq.b us_rp_pos
-us_rp_neg:
- lea.l SGL_PZRO,a1 ;answer is negative zero
- ori.l #negz_mask,USER_FPSR(a6)
- bra.b end_unfr
-us_rp_pos:
- lea.l SGL_PSML,a1 ;answer is smallest denormalized positive
- bra.b end_unfr
-
-uset_sign:
- tst.b LOCAL_SGN(a0) ;if negative overflow
- beq.b end_unfr
-uneg_sign:
- bset.b #neg_bit,FPSR_CC(a6)
-
-end_unfr:
- move.w LOCAL_EX(a1),LOCAL_EX(a0) ;be careful not to overwrite sign
- move.l LOCAL_HI(a1),LOCAL_HI(a0)
- move.l LOCAL_LO(a1),LOCAL_LO(a0)
- rts
-*
-* reg_dest --- write byte, word, or long data to Dn
-*
-*
-* Input:
-* L_SCR1: Data
-* d1: data size and dest register number formatted as:
-*
-* 32 5 4 3 2 1 0
-* -----------------------------------------------
-* | 0 | Size | Dest Reg # |
-* -----------------------------------------------
-*
-* Size is:
-* 0 - Byte
-* 1 - Word
-* 2 - Long/Single
-*
-pregdst:
- dc.l byte_d0
- dc.l byte_d1
- dc.l byte_d2
- dc.l byte_d3
- dc.l byte_d4
- dc.l byte_d5
- dc.l byte_d6
- dc.l byte_d7
- dc.l word_d0
- dc.l word_d1
- dc.l word_d2
- dc.l word_d3
- dc.l word_d4
- dc.l word_d5
- dc.l word_d6
- dc.l word_d7
- dc.l long_d0
- dc.l long_d1
- dc.l long_d2
- dc.l long_d3
- dc.l long_d4
- dc.l long_d5
- dc.l long_d6
- dc.l long_d7
-
-reg_dest:
- lea.l pregdst,a0
- move.l (a0,d1*4),a0
- jmp (a0)
-
-byte_d0:
- move.b L_SCR1(a6),USER_D0+3(a6)
- rts
-byte_d1:
- move.b L_SCR1(a6),USER_D1+3(a6)
- rts
-byte_d2:
- move.b L_SCR1(a6),d2
- rts
-byte_d3:
- move.b L_SCR1(a6),d3
- rts
-byte_d4:
- move.b L_SCR1(a6),d4
- rts
-byte_d5:
- move.b L_SCR1(a6),d5
- rts
-byte_d6:
- move.b L_SCR1(a6),d6
- rts
-byte_d7:
- move.b L_SCR1(a6),d7
- rts
-word_d0:
- move.w L_SCR1(a6),USER_D0+2(a6)
- rts
-word_d1:
- move.w L_SCR1(a6),USER_D1+2(a6)
- rts
-word_d2:
- move.w L_SCR1(a6),d2
- rts
-word_d3:
- move.w L_SCR1(a6),d3
- rts
-word_d4:
- move.w L_SCR1(a6),d4
- rts
-word_d5:
- move.w L_SCR1(a6),d5
- rts
-word_d6:
- move.w L_SCR1(a6),d6
- rts
-word_d7:
- move.w L_SCR1(a6),d7
- rts
-long_d0:
- move.l L_SCR1(a6),USER_D0(a6)
- rts
-long_d1:
- move.l L_SCR1(a6),USER_D1(a6)
- rts
-long_d2:
- move.l L_SCR1(a6),d2
- rts
-long_d3:
- move.l L_SCR1(a6),d3
- rts
-long_d4:
- move.l L_SCR1(a6),d4
- rts
-long_d5:
- move.l L_SCR1(a6),d5
- rts
-long_d6:
- move.l L_SCR1(a6),d6
- rts
-long_d7:
- move.l L_SCR1(a6),d7
- rts
- end
diff --git a/sys/arch/m68k/fpsp/x_bsun.sa b/sys/arch/m68k/fpsp/x_bsun.sa
deleted file mode 100644
index 4b69c136f54..00000000000
--- a/sys/arch/m68k/fpsp/x_bsun.sa
+++ /dev/null
@@ -1,73 +0,0 @@
-* $OpenBSD: x_bsun.sa,v 1.3 2002/01/23 19:16:09 fgsch Exp $
-* $NetBSD: x_bsun.sa,v 1.2 1994/10/26 07:50:22 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* x_bsun.sa 3.3 7/1/91
-*
-* fpsp_bsun --- FPSP handler for branch/set on unordered exception
-*
-* Copy the PC to FPIAR to maintain 881/882 compatibility
-*
-* The real_bsun handler will need to perform further corrective
-* measures as outlined in the 040 User's Manual on pages
-* 9-41f, section 9.8.3.
-*
-
-X_BSUN IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
- xref real_bsun
-
- xdef fpsp_bsun
-fpsp_bsun:
-*
- link a6,#-LOCAL_SIZE
- fsave -(a7)
- movem.l d0-d1/a0-a1,USER_DA(a6)
- fmovem.x fp0-fp3,USER_FP0(a6)
- fmovem.l fpcr/fpsr/fpiar,USER_FPCR(a6)
-
-*
- move.l EXC_PC(a6),USER_FPIAR(a6)
-*
- movem.l USER_DA(a6),d0-d1/a0-a1
- fmovem.x USER_FP0(a6),fp0-fp3
- fmovem.l USER_FPCR(a6),fpcr/fpsr/fpiar
- frestore (a7)+
- unlk a6
- bra.l real_bsun
-*
- end
diff --git a/sys/arch/m68k/fpsp/x_fline.sa b/sys/arch/m68k/fpsp/x_fline.sa
deleted file mode 100644
index b3dacdc7eac..00000000000
--- a/sys/arch/m68k/fpsp/x_fline.sa
+++ /dev/null
@@ -1,130 +0,0 @@
-* $OpenBSD: x_fline.sa,v 1.2 1996/05/29 21:05:46 niklas Exp $
-* $NetBSD: x_fline.sa,v 1.2 1994/10/26 07:50:23 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* x_fline.sa 3.3 1/10/91
-*
-* fpsp_fline --- FPSP handler for fline exception
-*
-* First determine if the exception is one of the unimplemented
-* floating point instructions. If so, let fpsp_unimp handle it.
-* Next, determine if the instruction is an fmovecr with a non-zero
-* <ea> field. If so, handle here and return. Otherwise, it
-* must be a real F-line exception.
-*
-
-X_FLINE IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
- xref real_fline
- xref fpsp_unimp
- xref uni_2
- xref mem_read
- xref fpsp_fmt_error
-
- xdef fpsp_fline
-fpsp_fline:
-*
-* check for unimplemented vector first. Use EXC_VEC-4 because
-* the equate is valid only after a 'link a6' has pushed one more
-* long onto the stack.
-*
- cmp.w #UNIMP_VEC,EXC_VEC-4(a7)
- beq.l fpsp_unimp
-
-*
-* fmovecr with non-zero <ea> handling here
-*
- sub.l #4,a7 ;4 accounts for 2-word difference
-* ;between six word frame (unimp) and
-* ;four word frame
- link a6,#-LOCAL_SIZE
- fsave -(a7)
- movem.l d0-d1/a0-a1,USER_DA(a6)
- movea.l EXC_PC+4(a6),a0 ;get address of fline instruction
- lea.l L_SCR1(a6),a1 ;use L_SCR1 as scratch
- move.l #4,d0
- add.l #4,a6 ;to offset the sub.l #4,a7 above so that
-* ;a6 can point correctly to the stack frame
-* ;before branching to mem_read
- bsr.l mem_read
- sub.l #4,a6
- move.l L_SCR1(a6),d0 ;d0 contains the fline and command word
- bfextu d0{4:3},d1 ;extract coprocessor id
- cmpi.b #1,d1 ;check if cpid=1
- bne.w not_mvcr ;exit if not
- bfextu d0{16:6},d1
- cmpi.b #$17,d1 ;check if it is an FMOVECR encoding
- bne.w not_mvcr
-* ;if an FMOVECR instruction, fix stack
-* ;and go to FPSP_UNIMP
-fix_stack:
- cmpi.b #VER_40,(a7) ;test for orig unimp frame
- bne.b ck_rev
- sub.l #UNIMP_40_SIZE-4,a7 ;emulate an orig fsave
- move.b #VER_40,(a7)
- move.b #UNIMP_40_SIZE-4,1(a7)
- clr.w 2(a7)
- bra.b fix_con
-ck_rev:
- cmpi.b #VER_41,(a7) ;test for rev unimp frame
- bne.l fpsp_fmt_error ;if not $40 or $41, exit with error
- sub.l #UNIMP_41_SIZE-4,a7 ;emulate a rev fsave
- move.b #VER_41,(a7)
- move.b #UNIMP_41_SIZE-4,1(a7)
- clr.w 2(a7)
-fix_con:
- move.w EXC_SR+4(a6),EXC_SR(a6) ;move stacked sr to new position
- move.l EXC_PC+4(a6),EXC_PC(a6) ;move stacked pc to new position
- fmove.l EXC_PC(a6),FPIAR ;point FPIAR to fline inst
- move.l #4,d1
- add.l d1,EXC_PC(a6) ;increment stacked pc value to next inst
- move.w #$202c,EXC_VEC(a6) ;reformat vector to unimp
- clr.l EXC_EA(a6) ;clear the EXC_EA field
- move.w d0,CMDREG1B(a6) ;move the lower word into CMDREG1B
- clr.l E_BYTE(a6)
- bset.b #UFLAG,T_BYTE(a6)
- movem.l USER_DA(a6),d0-d1/a0-a1 ;restore data registers
- bra.l uni_2
-
-not_mvcr:
- movem.l USER_DA(a6),d0-d1/a0-a1 ;restore data registers
- frestore (a7)+
- unlk a6
- add.l #4,a7
- bra.l real_fline
-
- end
diff --git a/sys/arch/m68k/fpsp/x_operr.sa b/sys/arch/m68k/fpsp/x_operr.sa
deleted file mode 100644
index f1d6cc0072f..00000000000
--- a/sys/arch/m68k/fpsp/x_operr.sa
+++ /dev/null
@@ -1,382 +0,0 @@
-* $OpenBSD: x_operr.sa,v 1.3 2001/09/20 17:02:30 mpech Exp $
-* $NetBSD: x_operr.sa,v 1.4 1994/10/26 07:50:24 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* x_operr.sa 3.5 7/1/91
-*
-* fpsp_operr --- FPSP handler for operand error exception
-*
-* See 68040 User's Manual pp. 9-44f
-*
-* Note 1: For trap disabled 040 does the following:
-* If the dest is a fp reg, then an extended precision non_signaling
-* NAN is stored in the dest reg. If the dest format is b, w, or l and
-* the source op is a NAN, then garbage is stored as the result (actually
-* the upper 32 bits of the mantissa are sent to the integer unit). If
-* the dest format is integer (b, w, l) and the operr is caused by
-* integer overflow, or the source op is inf, then the result stored is
-* garbage.
-* There are three cases in which operr is incorrectly signaled on the
-* 040. This occurs for move_out of format b, w, or l for the largest
-* negative integer (-2^7 for b, -2^15 for w, -2^31 for l).
-*
-* On opclass = 011 fmove.(b,w,l) that causes a conversion
-* overflow -> OPERR, the exponent in wbte (and fpte) is:
-* byte 56 - (62 - exp)
-* word 48 - (62 - exp)
-* long 32 - (62 - exp)
-*
-* where exp = (true exp) - 1
-*
-* So, wbtemp and fptemp will contain the following on erroneoulsy
-* signalled operr:
-* fpts = 1
-* fpte = $4000 (15 bit externally)
-* byte fptm = $ffffffff ffffff80
-* word fptm = $ffffffff ffff8000
-* long fptm = $ffffffff 80000000
-*
-* Note 2: For trap enabled 040 does the following:
-* If the inst is move_out, then same as Note 1.
-* If the inst is not move_out, the dest is not modified.
-* The exceptional operand is not defined for integer overflow
-* during a move_out.
-*
-
-X_OPERR IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
- xref mem_write
- xref real_operr
- xref real_inex
- xref get_fline
- xref fpsp_done
- xref reg_dest
-
- xdef fpsp_operr
-fpsp_operr:
-*
- link a6,#-LOCAL_SIZE
- fsave -(a7)
- movem.l d0-d1/a0-a1,USER_DA(a6)
- fmovem.x fp0-fp3,USER_FP0(a6)
- fmovem.l fpcr/fpsr/fpiar,USER_FPCR(a6)
-
-*
-* Check if this is an opclass 3 instruction.
-* If so, fall through, else branch to operr_end
-*
- btst.b #TFLAG,T_BYTE(a6)
- beq.b operr_end
-
-*
-* If the destination size is B,W,or L, the operr must be
-* handled here.
-*
- move.l CMDREG1B(a6),d0
- bfextu d0{3:3},d0 ;0=long, 4=word, 6=byte
- tst.b d0 ;determine size; check long
- beq.w operr_long
- cmpi.b #4,d0 ;check word
- beq.w operr_word
- cmpi.b #6,d0 ;check byte
- beq.w operr_byte
-
-*
-* The size is not B,W,or L, so the operr is handled by the
-* kernel handler. Set the operr bits and clean up, leaving
-* only the integer exception frame on the stack, and the
-* fpu in the original exceptional state.
-*
-operr_end:
- bset.b #operr_bit,FPSR_EXCEPT(a6)
- bset.b #aiop_bit,FPSR_AEXCEPT(a6)
-
- movem.l USER_DA(a6),d0-d1/a0-a1
- fmovem.x USER_FP0(a6),fp0-fp3
- fmovem.l USER_FPCR(a6),fpcr/fpsr/fpiar
- frestore (a7)+
- unlk a6
- bra.l real_operr
-
-operr_long:
- moveq.l #4,d1 ;write size to d1
- move.b STAG(a6),d0 ;test stag for nan
- andi.b #$e0,d0 ;clr all but tag
- cmpi.b #$60,d0 ;check for nan
- beq operr_nan
- cmpi.l #$80000000,FPTEMP_LO(a6) ;test if ls lword is special
- bne.b chklerr ;if not equal, check for incorrect operr
- bsr check_upper ;check if exp and ms mant are special
- tst.l d0
- bne.b chklerr ;if d0 is true, check for incorrect operr
- move.l #$80000000,d0 ;store special case result
- bsr operr_store
- bra.w not_enabled ;clean and exit
-*
-* CHECK FOR INCORRECTLY GENERATED OPERR EXCEPTION HERE
-*
-chklerr:
- move.w FPTEMP_EX(a6),d0
- and.w #$7FFF,d0 ;ignore sign bit
- cmp.w #$3FFE,d0 ;this is the only possible exponent value
- bne.b chklerr2
-fixlong:
- move.l FPTEMP_LO(a6),d0
- bsr operr_store
- bra.w not_enabled
-chklerr2:
- move.w FPTEMP_EX(a6),d0
- and.w #$7FFF,d0 ;ignore sign bit
- cmp.w #$4000,d0
- bcc.w store_max ;exponent out of range
-
- move.l FPTEMP_LO(a6),d0
- and.l #$7FFF0000,d0 ;look for all 1's on bits 30-16
- cmp.l #$7FFF0000,d0
- beq.b fixlong
-
- tst.l FPTEMP_LO(a6)
- bpl.b chklepos
- cmp.l #$FFFFFFFF,FPTEMP_HI(a6)
- beq.b fixlong
- bra.w store_max
-chklepos:
- tst.l FPTEMP_HI(a6)
- beq.b fixlong
- bra.w store_max
-
-operr_word:
- moveq.l #2,d1 ;write size to d1
- move.b STAG(a6),d0 ;test stag for nan
- andi.b #$e0,d0 ;clr all but tag
- cmpi.b #$60,d0 ;check for nan
- beq.w operr_nan
- cmpi.l #$ffff8000,FPTEMP_LO(a6) ;test if ls lword is special
- bne.b chkwerr ;if not equal, check for incorrect operr
- bsr check_upper ;check if exp and ms mant are special
- tst.l d0
- bne.b chkwerr ;if d0 is true, check for incorrect operr
- move.l #$80000000,d0 ;store special case result
- bsr operr_store
- bra.w not_enabled ;clean and exit
-*
-* CHECK FOR INCORRECTLY GENERATED OPERR EXCEPTION HERE
-*
-chkwerr:
- move.w FPTEMP_EX(a6),d0
- and.w #$7FFF,d0 ;ignore sign bit
- cmp.w #$3FFE,d0 ;this is the only possible exponent value
- bne.b store_max
- move.l FPTEMP_LO(a6),d0
- swap d0
- bsr operr_store
- bra.w not_enabled
-
-operr_byte:
- moveq.l #1,d1 ;write size to d1
- move.b STAG(a6),d0 ;test stag for nan
- andi.b #$e0,d0 ;clr all but tag
- cmpi.b #$60,d0 ;check for nan
- beq.b operr_nan
- cmpi.l #$ffffff80,FPTEMP_LO(a6) ;test if ls lword is special
- bne.b chkberr ;if not equal, check for incorrect operr
- bsr check_upper ;check if exp and ms mant are special
- tst.l d0
- bne.b chkberr ;if d0 is true, check for incorrect operr
- move.l #$80000000,d0 ;store special case result
- bsr operr_store
- bra.w not_enabled ;clean and exit
-*
-* CHECK FOR INCORRECTLY GENERATED OPERR EXCEPTION HERE
-*
-chkberr:
- move.w FPTEMP_EX(a6),d0
- and.w #$7FFF,d0 ;ignore sign bit
- cmp.w #$3FFE,d0 ;this is the only possible exponent value
- bne.b store_max
- move.l FPTEMP_LO(a6),d0
- asl.l #8,d0
- swap d0
- bsr operr_store
- bra.w not_enabled
-
-*
-* This operr condition is not of the special case. Set operr
-* and aiop and write the portion of the nan to memory for the
-* given size.
-*
-operr_nan:
- or.l #opaop_mask,USER_FPSR(a6) ;set operr & aiop
-
- move.l ETEMP_HI(a6),d0 ;output will be from upper 32 bits
- bsr operr_store
- bra end_operr
-*
-* Store_max loads the max pos or negative for the size, sets
-* the operr and aiop bits, and clears inex and ainex, incorrectly
-* set by the 040.
-*
-store_max:
- or.l #opaop_mask,USER_FPSR(a6) ;set operr & aiop
- bclr.b #inex2_bit,FPSR_EXCEPT(a6)
- bclr.b #ainex_bit,FPSR_AEXCEPT(a6)
- fmove.l #0,FPSR
-
- tst.w FPTEMP_EX(a6) ;check sign
- blt.b load_neg
- move.l #$7fffffff,d0
- bsr operr_store
- bra end_operr
-load_neg:
- move.l #$80000000,d0
- bsr operr_store
- bra end_operr
-
-*
-* This routine stores the data in d0, for the given size in d1,
-* to memory or data register as required. A read of the fline
-* is required to determine the destination.
-*
-operr_store:
- move.l d0,L_SCR1(a6) ;move write data to L_SCR1
- move.l d1,-(a7) ;save register size
- bsr.l get_fline ;fline returned in d0
- move.l (a7)+,d1
- bftst d0{26:3} ;if mode is zero, dest is Dn
- bne.b dest_mem
-*
-* Destination is Dn. Get register number from d0. Data is on
-* the stack at (a7). D1 has size: 1=byte,2=word,4=long/single
-*
- andi.l #7,d0 ;isolate register number
- cmpi.l #4,d1
- beq.b op_long ;the most frequent case
- cmpi.l #2,d1
- bne.b op_con
- or.l #8,d0
- bra.b op_con
-op_long:
- or.l #$10,d0
-op_con:
- move.l d0,d1 ;format size:reg for reg_dest
- bra.l reg_dest ;call to reg_dest returns to caller
-* ;of operr_store
-*
-* Destination is memory. Get <ea> from integer exception frame
-* and call mem_write.
-*
-dest_mem:
- lea.l L_SCR1(a6),a0 ;put ptr to write data in a0
- move.l EXC_EA(a6),a1 ;put user destination address in a1
- move.l d1,d0 ;put size in d0
- bsr.l mem_write
- rts
-*
-* Check the exponent for $c000 and the upper 32 bits of the
-* mantissa for $ffffffff. If both are true, return d0 clr
-* and store the lower n bits of the least lword of FPTEMP
-* to d0 for write out. If not, it is a real operr, and set d0.
-*
-check_upper:
- cmpi.l #$ffffffff,FPTEMP_HI(a6) ;check if first byte is all 1's
- bne.b true_operr ;if not all 1's then was true operr
- cmpi.w #$c000,FPTEMP_EX(a6) ;check if incorrectly signalled
- beq.b not_true_operr ;branch if not true operr
- cmpi.w #$bfff,FPTEMP_EX(a6) ;check if incorrectly signalled
- beq.b not_true_operr ;branch if not true operr
-true_operr:
- move.l #1,d0 ;signal real operr
- rts
-not_true_operr:
- clr.l d0 ;signal no real operr
- rts
-
-*
-* End_operr tests for operr enabled. If not, it cleans up the stack
-* and does an rte. If enabled, it cleans up the stack and branches
-* to the kernel operr handler with only the integer exception
-* frame on the stack and the fpu in the original exceptional state
-* with correct data written to the destination.
-*
-end_operr:
- btst.b #operr_bit,FPCR_ENABLE(a6)
- beq.b not_enabled
-enabled:
- movem.l USER_DA(a6),d0-d1/a0-a1
- fmovem.x USER_FP0(a6),fp0-fp3
- fmovem.l USER_FPCR(a6),fpcr/fpsr/fpiar
- frestore (a7)+
- unlk a6
- bra.l real_operr
-
-not_enabled:
-*
-* It is possible to have either inex2 or inex1 exceptions with the
-* operr. If the inex enable bit is set in the FPCR, and either
-* inex2 or inex1 occurred, we must clean up and branch to the
-* real inex handler.
-*
-ck_inex:
- move.b FPCR_ENABLE(a6),d0
- and.b FPSR_EXCEPT(a6),d0
- andi.b #$3,d0
- beq.w operr_exit
-*
-* Inexact enabled and reported, and we must take an inexact exception.
-*
-take_inex:
- move.b #INEX_VEC,EXC_VEC+1(a6)
- move.l USER_FPSR(a6),FPSR_SHADOW(a6)
- or.l #sx_mask,E_BYTE(a6)
- movem.l USER_DA(a6),d0-d1/a0-a1
- fmovem.x USER_FP0(a6),fp0-fp3
- fmovem.l USER_FPCR(a6),fpcr/fpsr/fpiar
- frestore (a7)+
- unlk a6
- bra.l real_inex
-*
-* Since operr is only an E1 exception, there is no need to frestore
-* any state back to the fpu.
-*
-operr_exit:
- movem.l USER_DA(a6),d0-d1/a0-a1
- fmovem.x USER_FP0(a6),fp0-fp3
- fmovem.l USER_FPCR(a6),fpcr/fpsr/fpiar
- unlk a6
- bra.l fpsp_done
-
- end
diff --git a/sys/arch/m68k/fpsp/x_ovfl.sa b/sys/arch/m68k/fpsp/x_ovfl.sa
deleted file mode 100644
index a58eda43d9b..00000000000
--- a/sys/arch/m68k/fpsp/x_ovfl.sa
+++ /dev/null
@@ -1,211 +0,0 @@
-* $OpenBSD: x_ovfl.sa,v 1.3 2001/09/20 17:02:30 mpech Exp $
-* $NetBSD: x_ovfl.sa,v 1.2 1994/10/26 07:50:26 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* x_ovfl.sa 3.5 7/1/91
-*
-* fpsp_ovfl --- FPSP handler for overflow exception
-*
-* Overflow occurs when a floating-point intermediate result is
-* too large to be represented in a floating-point data register,
-* or when storing to memory, the contents of a floating-point
-* data register are too large to be represented in the
-* destination format.
-*
-* Trap disabled results
-*
-* If the instruction is move_out, then garbage is stored in the
-* destination. If the instruction is not move_out, then the
-* destination is not affected. For 68881 compatibility, the
-* following values should be stored at the destination, based
-* on the current rounding mode:
-*
-* RN Infinity with the sign of the intermediate result.
-* RZ Largest magnitude number, with the sign of the
-* intermediate result.
-* RM For pos overflow, the largest pos number. For neg overflow,
-* -infinity
-* RP For pos overflow, +infinity. For neg overflow, the largest
-* neg number
-*
-* Trap enabled results
-* All trap disabled code applies. In addition the exceptional
-* operand needs to be made available to the users exception handler
-* with a bias of $6000 subtracted from the exponent.
-*
-
-X_OVFL IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
- xref ovf_r_x2
- xref ovf_r_x3
- xref store
- xref real_ovfl
- xref real_inex
- xref fpsp_done
- xref g_opcls
- xref b1238_fix
-
- xdef fpsp_ovfl
-fpsp_ovfl:
- link a6,#-LOCAL_SIZE
- fsave -(a7)
- movem.l d0-d1/a0-a1,USER_DA(a6)
- fmovem.x fp0-fp3,USER_FP0(a6)
- fmovem.l fpcr/fpsr/fpiar,USER_FPCR(a6)
-
-*
-* The 040 doesn't set the AINEX bit in the FPSR, the following
-* line temporarily rectifies this error.
-*
- bset.b #ainex_bit,FPSR_AEXCEPT(a6)
-*
- bsr.l ovf_adj ;denormalize, round & store interm op
-*
-* if overflow traps not enabled check for inexact exception
-*
- btst.b #ovfl_bit,FPCR_ENABLE(a6)
- beq.b ck_inex
-*
- btst.b #E3,E_BYTE(a6)
- beq.b no_e3_1
- bfextu CMDREG3B(a6){6:3},d0 ;get dest reg no
- bclr.b d0,FPR_DIRTY_BITS(a6) ;clr dest dirty bit
- bsr.l b1238_fix
- move.l USER_FPSR(a6),FPSR_SHADOW(a6)
- or.l #sx_mask,E_BYTE(a6)
-no_e3_1:
- movem.l USER_DA(a6),d0-d1/a0-a1
- fmovem.x USER_FP0(a6),fp0-fp3
- fmovem.l USER_FPCR(a6),fpcr/fpsr/fpiar
- frestore (a7)+
- unlk a6
- bra.l real_ovfl
-*
-* It is possible to have either inex2 or inex1 exceptions with the
-* ovfl. If the inex enable bit is set in the FPCR, and either
-* inex2 or inex1 occurred, we must clean up and branch to the
-* real inex handler.
-*
-ck_inex:
-* move.b FPCR_ENABLE(a6),d0
-* and.b FPSR_EXCEPT(a6),d0
-* andi.b #$3,d0
- btst.b #inex2_bit,FPCR_ENABLE(a6)
- beq.b ovfl_exit
-*
-* Inexact enabled and reported, and we must take an inexact exception.
-*
-take_inex:
- btst.b #E3,E_BYTE(a6)
- beq.b no_e3_2
- bfextu CMDREG3B(a6){6:3},d0 ;get dest reg no
- bclr.b d0,FPR_DIRTY_BITS(a6) ;clr dest dirty bit
- bsr.l b1238_fix
- move.l USER_FPSR(a6),FPSR_SHADOW(a6)
- or.l #sx_mask,E_BYTE(a6)
-no_e3_2:
- move.b #INEX_VEC,EXC_VEC+1(a6)
- movem.l USER_DA(a6),d0-d1/a0-a1
- fmovem.x USER_FP0(a6),fp0-fp3
- fmovem.l USER_FPCR(a6),fpcr/fpsr/fpiar
- frestore (a7)+
- unlk a6
- bra.l real_inex
-
-ovfl_exit:
- bclr.b #E3,E_BYTE(a6) ;test and clear E3 bit
- beq.b e1_set
-*
-* Clear dirty bit on dest resister in the frame before branching
-* to b1238_fix.
-*
- bfextu CMDREG3B(a6){6:3},d0 ;get dest reg no
- bclr.b d0,FPR_DIRTY_BITS(a6) ;clr dest dirty bit
- bsr.l b1238_fix ;test for bug1238 case
-
- move.l USER_FPSR(a6),FPSR_SHADOW(a6)
- or.l #sx_mask,E_BYTE(a6)
- movem.l USER_DA(a6),d0-d1/a0-a1
- fmovem.x USER_FP0(a6),fp0-fp3
- fmovem.l USER_FPCR(a6),fpcr/fpsr/fpiar
- frestore (a7)+
- unlk a6
- bra.l fpsp_done
-e1_set:
- movem.l USER_DA(a6),d0-d1/a0-a1
- fmovem.x USER_FP0(a6),fp0-fp3
- fmovem.l USER_FPCR(a6),fpcr/fpsr/fpiar
- unlk a6
- bra.l fpsp_done
-
-*
-* ovf_adj
-*
-ovf_adj:
-*
-* Have a0 point to the correct operand.
-*
- btst.b #E3,E_BYTE(a6) ;test E3 bit
- beq.b ovf_e1
-
- lea WBTEMP(a6),a0
- bra.b ovf_com
-ovf_e1:
- lea ETEMP(a6),a0
-
-ovf_com:
- bclr.b #sign_bit,LOCAL_EX(a0)
- sne LOCAL_SGN(a0)
-
- bsr.l g_opcls ;returns opclass in d0
- cmpi.w #3,d0 ;check for opclass3
- bne.b not_opc011
-
-*
-* FPSR_CC is saved and restored because ovf_r_x3 affects it. The
-* CCs are defined to be 'not affected' for the opclass3 instruction.
-*
- move.b FPSR_CC(a6),L_SCR1(a6)
- bsr.l ovf_r_x3 ;returns a0 pointing to result
- move.b L_SCR1(a6),FPSR_CC(a6)
- bra.l store ;stores to memory or register
-
-not_opc011:
- bsr.l ovf_r_x2 ;returns a0 pointing to result
- bra.l store ;stores to memory or register
-
- end
diff --git a/sys/arch/m68k/fpsp/x_snan.sa b/sys/arch/m68k/fpsp/x_snan.sa
deleted file mode 100644
index 668580723ce..00000000000
--- a/sys/arch/m68k/fpsp/x_snan.sa
+++ /dev/null
@@ -1,303 +0,0 @@
-* $OpenBSD: x_snan.sa,v 1.3 2001/09/20 17:02:30 mpech Exp $
-* $NetBSD: x_snan.sa,v 1.3 1994/10/26 07:50:28 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* x_snan.sa 3.3 7/1/91
-*
-* fpsp_snan --- FPSP handler for signalling NAN exception
-*
-* SNAN for float -> integer conversions (integer conversion of
-* an SNAN) is a non-maskable run-time exception.
-*
-* For trap disabled the 040 does the following:
-* If the dest data format is s, d, or x, then the SNAN bit in the NAN
-* is set to one and the resulting non-signaling NAN (truncated if
-* necessary) is transferred to the dest. If the dest format is b, w,
-* or l, then garbage is written to the dest (actually the upper 32 bits
-* of the mantissa are sent to the integer unit).
-*
-* For trap enabled the 040 does the following:
-* If the inst is move_out, then the results are the same as for trap
-* disabled with the exception posted. If the instruction is not move_
-* out, the dest. is not modified, and the exception is posted.
-*
-
-X_SNAN IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
- xref get_fline
- xref mem_write
- xref real_snan
- xref real_inex
- xref fpsp_done
- xref reg_dest
-
- xdef fpsp_snan
-fpsp_snan:
- link a6,#-LOCAL_SIZE
- fsave -(a7)
- movem.l d0-d1/a0-a1,USER_DA(a6)
- fmovem.x fp0-fp3,USER_FP0(a6)
- fmovem.l fpcr/fpsr/fpiar,USER_FPCR(a6)
-
-*
-* Check if trap enabled
-*
- btst.b #snan_bit,FPCR_ENABLE(a6)
- bne.b ena ;If enabled, then branch
-
- bsr.l move_out ;else SNAN disabled
-*
-* It is possible to have an inex1 exception with the
-* snan. If the inex enable bit is set in the FPCR, and either
-* inex2 or inex1 occurred, we must clean up and branch to the
-* real inex handler.
-*
-ck_inex:
- move.b FPCR_ENABLE(a6),d0
- and.b FPSR_EXCEPT(a6),d0
- andi.b #$3,d0
- beq.w end_snan
-*
-* Inexact enabled and reported, and we must take an inexact exception.
-*
-take_inex:
- move.b #INEX_VEC,EXC_VEC+1(a6)
- movem.l USER_DA(a6),d0-d1/a0-a1
- fmovem.x USER_FP0(a6),fp0-fp3
- fmovem.l USER_FPCR(a6),fpcr/fpsr/fpiar
- frestore (a7)+
- unlk a6
- bra.l real_inex
-*
-* SNAN is enabled. Check if inst is move_out.
-* Make any corrections to the 040 output as necessary.
-*
-ena:
- btst.b #5,CMDREG1B(a6) ;if set, inst is move out
- beq.w not_out
-
- bsr.l move_out
-
-report_snan:
- move.b (a7),VER_TMP(a6)
- cmpi.b #VER_40,(a7) ;test for orig unimp frame
- bne.b ck_rev
- moveq.l #13,d0 ;need to zero 14 lwords
- bra.b rep_con
-ck_rev:
- moveq.l #11,d0 ;need to zero 12 lwords
-rep_con:
- clr.l (a7)
-loop1:
- clr.l -(a7) ;clear and dec a7
- dbra.w d0,loop1
- move.b VER_TMP(a6),(a7) ;format a busy frame
- move.b #BUSY_SIZE-4,1(a7)
- move.l USER_FPSR(a6),FPSR_SHADOW(a6)
- or.l #sx_mask,E_BYTE(a6)
- movem.l USER_DA(a6),d0-d1/a0-a1
- fmovem.x USER_FP0(a6),fp0-fp3
- fmovem.l USER_FPCR(a6),fpcr/fpsr/fpiar
- frestore (a7)+
- unlk a6
- bra.l real_snan
-*
-* Exit snan handler by expanding the unimp frame into a busy frame
-*
-end_snan:
- bclr.b #E1,E_BYTE(a6)
-
- move.b (a7),VER_TMP(a6)
- cmpi.b #VER_40,(a7) ;test for orig unimp frame
- bne.b ck_rev2
- moveq.l #13,d0 ;need to zero 14 lwords
- bra.b rep_con2
-ck_rev2:
- moveq.l #11,d0 ;need to zero 12 lwords
-rep_con2:
- clr.l (a7)
-loop2:
- clr.l -(a7) ;clear and dec a7
- dbra.w d0,loop2
- move.b VER_TMP(a6),(a7) ;format a busy frame
- move.b #BUSY_SIZE-4,1(a7) ;write busy size
- move.l USER_FPSR(a6),FPSR_SHADOW(a6)
- or.l #sx_mask,E_BYTE(a6)
- movem.l USER_DA(a6),d0-d1/a0-a1
- fmovem.x USER_FP0(a6),fp0-fp3
- fmovem.l USER_FPCR(a6),fpcr/fpsr/fpiar
- frestore (a7)+
- unlk a6
- bra.l fpsp_done
-
-*
-* Move_out
-*
-move_out:
- move.l EXC_EA(a6),a0 ;get <ea> from exc frame
-
- bfextu CMDREG1B(a6){3:3},d0 ;move rx field to d0{2:0}
- tst.l d0 ;check for long
- beq.b sto_long ;branch if move_out long
-
- cmpi.l #4,d0 ;check for word
- beq.b sto_word ;branch if move_out word
-
- cmpi.l #6,d0 ;check for byte
- beq.b sto_byte ;branch if move_out byte
-
-*
-* Not byte, word or long
-*
- rts
-*
-* Get the 32 most significant bits of etemp mantissa
-*
-sto_long:
- move.l ETEMP_HI(a6),d1
- move.l #4,d0 ;load byte count
-*
-* Set signalling nan bit
-*
- bset.l #30,d1
-*
-* Store to the users destination address
-*
- tst.l a0 ;check if <ea> is 0
- beq.b wrt_dn ;destination is a data register
-
- move.l d1,-(a7) ;move the snan onto the stack
- move.l a0,a1 ;load dest addr into a1
- move.l a7,a0 ;load src addr of snan into a0
- bsr.l mem_write ;write snan to user memory
- move.l (a7)+,d1 ;clear off stack
- rts
-*
-* Get the 16 most significant bits of etemp mantissa
-*
-sto_word:
- move.l ETEMP_HI(a6),d1
- move.l #2,d0 ;load byte count
-*
-* Set signalling nan bit
-*
- bset.l #30,d1
-*
-* Store to the users destination address
-*
- tst.l a0 ;check if <ea> is 0
- beq.b wrt_dn ;destination is a data register
-
- move.l d1,-(a7) ;move the snan onto the stack
- move.l a0,a1 ;load dest addr into a1
- move.l a7,a0 ;point to low word
- bsr.l mem_write ;write snan to user memory
- move.l (a7)+,d1 ;clear off stack
- rts
-*
-* Get the 8 most significant bits of etemp mantissa
-*
-sto_byte:
- move.l ETEMP_HI(a6),d1
- move.l #1,d0 ;load byte count
-*
-* Set signalling nan bit
-*
- bset.l #30,d1
-*
-* Store to the users destination address
-*
- tst.l a0 ;check if <ea> is 0
- beq.b wrt_dn ;destination is a data register
- move.l d1,-(a7) ;move the snan onto the stack
- move.l a0,a1 ;load dest addr into a1
- move.l a7,a0 ;point to source byte
- bsr.l mem_write ;write snan to user memory
- move.l (a7)+,d1 ;clear off stack
- rts
-
-*
-* wrt_dn --- write to a data register
-*
-* We get here with D1 containing the data to write and D0 the
-* number of bytes to write: 1=byte,2=word,4=long.
-*
-wrt_dn:
- move.l d1,L_SCR1(a6) ;data
- move.l d0,-(a7) ;size
- bsr.l get_fline ;returns fline word in d0
- move.l d0,d1
- andi.l #$7,d1 ;d1 now holds register number
- move.l (sp)+,d0 ;get original size
- cmpi.l #4,d0
- beq.b wrt_long
- cmpi.l #2,d0
- bne.b wrt_byte
-wrt_word:
- or.l #$8,d1
- bra.l reg_dest
-wrt_long:
- or.l #$10,d1
- bra.l reg_dest
-wrt_byte:
- bra.l reg_dest
-*
-* Check if it is a src nan or dst nan
-*
-not_out:
- move.l DTAG(a6),d0
- bfextu d0{0:3},d0 ;isolate dtag in lsbs
-
- cmpi.b #3,d0 ;check for nan in destination
- bne.b issrc ;destination nan has priority
-dst_nan:
- btst.b #6,FPTEMP_HI(a6) ;check if dest nan is an snan
- bne.b issrc ;no, so check source for snan
- move.w FPTEMP_EX(a6),d0
- bra.b cont
-issrc:
- move.w ETEMP_EX(a6),d0
-cont:
- btst.l #15,d0 ;test for sign of snan
- beq.b clr_neg
- bset.b #neg_bit,FPSR_CC(a6)
- bra.w report_snan
-clr_neg:
- bclr.b #neg_bit,FPSR_CC(a6)
- bra.w report_snan
-
- end
diff --git a/sys/arch/m68k/fpsp/x_store.sa b/sys/arch/m68k/fpsp/x_store.sa
deleted file mode 100644
index 8736695fe30..00000000000
--- a/sys/arch/m68k/fpsp/x_store.sa
+++ /dev/null
@@ -1,283 +0,0 @@
-* $OpenBSD: x_store.sa,v 1.3 2013/02/02 13:32:05 miod Exp $
-* $NetBSD: x_store.sa,v 1.3 1994/10/26 07:50:29 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* x_store.sa 3.2 1/24/91
-*
-* store --- store operand to memory or register
-*
-* Used by underflow and overflow handlers.
-*
-* a6 = points to fp value to be stored.
-*
-
-X_STORE IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
-fpreg_mask:
- dc.b $80,$40,$20,$10,$08,$04,$02,$01
-
- include fpsp.h
-
- xref mem_write
- xref get_fline
- xref g_opcls
- xref g_dfmtou
- xref reg_dest
-
- xdef dest_ext
- xdef dest_dbl
- xdef dest_sgl
-
- xdef store
-store:
- btst.b #E3,E_BYTE(a6)
- beq.b E1_sto
-E3_sto:
- move.l CMDREG3B(a6),d0
- bfextu d0{6:3},d0 ;isolate dest. reg from cmdreg3b
-sto_fp:
- lea fpreg_mask,a1
- move.b (a1,d0.w),d0 ;convert reg# to dynamic register mask
- tst.b LOCAL_SGN(a0)
- beq.b is_pos
- bset.b #sign_bit,LOCAL_EX(a0)
-is_pos:
- fmovem.x (a0),d0 ;move to correct register
-*
-* if fp0-fp3 is being modified, we must put a copy
-* in the USER_FPn variable on the stack because all exception
-* handlers restore fp0-fp3 from there.
-*
- cmp.b #$80,d0
- bne.b not_fp0
- fmovem.x fp0,USER_FP0(a6)
- rts
-not_fp0:
- cmp.b #$40,d0
- bne.b not_fp1
- fmovem.x fp1,USER_FP1(a6)
- rts
-not_fp1:
- cmp.b #$20,d0
- bne.b not_fp2
- fmovem.x fp2,USER_FP2(a6)
- rts
-not_fp2:
- cmp.b #$10,d0
- bne.b not_fp3
- fmovem.x fp3,USER_FP3(a6)
- rts
-not_fp3:
- rts
-
-E1_sto:
- bsr.l g_opcls ;returns opclass in d0
- cmpi.b #3,d0
- beq opc011 ;branch if opclass 3
- move.l CMDREG1B(a6),d0
- bfextu d0{6:3},d0 ;extract destination register
- bra.b sto_fp
-
-opc011:
- bsr.l g_dfmtou ;returns dest format in d0
-* ;ext=00, sgl=01, dbl=10
- move.l a0,a1 ;save source addr in a1
- move.l EXC_EA(a6),a0 ;get the address
- tst.l d0 ;if dest format is extended
- beq.w dest_ext ;then branch
- cmpi.l #1,d0 ;if dest format is single
- beq.b short_dest_sgl ;then branch
-*
-* fall through to dest_dbl
-*
-
-*
-* dest_dbl --- write double precision value to user space
-*
-*Input
-* a0 -> destination address
-* a1 -> source in extended precision
-*Output
-* a0 -> destroyed
-* a1 -> destroyed
-* d0 -> 0
-*
-*Changes extended precision to double precision.
-* Note: no attempt is made to round the extended value to double.
-* dbl_sign = ext_sign
-* dbl_exp = ext_exp - $3fff(ext bias) + $7ff(dbl bias)
-* get rid of ext integer bit
-* dbl_mant = ext_mant{62:12}
-*
-* --------------- --------------- ---------------
-* extended -> |s| exp | |1| ms mant | | ls mant |
-* --------------- --------------- ---------------
-* 95 64 63 62 32 31 11 0
-* | |
-* | |
-* | |
-* v v
-* --------------- ---------------
-* double -> |s|exp| mant | | mant |
-* --------------- ---------------
-* 63 51 32 31 0
-*
-dest_dbl:
- clr.l d0 ;clear d0
- move.w LOCAL_EX(a1),d0 ;get exponent
- sub.w #$3fff,d0 ;subtract extended precision bias
- cmp.w #$4000,d0 ;check if inf
- beq.b inf ;if so, special case
- add.w #$3ff,d0 ;add double precision bias
- swap d0 ;d0 now in upper word
- lsl.l #4,d0 ;d0 now in proper place for dbl prec exp
- tst.b LOCAL_SGN(a1)
- beq.b get_mant ;if postive, go process mantissa
- bset.l #31,d0 ;if negative, put in sign information
-* ; before continuing
- bra.b get_mant ;go process mantissa
-inf:
- move.l #$7ff00000,d0 ;load dbl inf exponent
- clr.l LOCAL_HI(a1) ;clear msb
- tst.b LOCAL_SGN(a1)
- beq.b dbl_inf ;if positive, go ahead and write it
- bset.l #31,d0 ;if negative put in sign information
-dbl_inf:
- move.l d0,LOCAL_EX(a1) ;put the new exp back on the stack
- bra.b dbl_wrt
-get_mant:
- move.l LOCAL_HI(a1),d1 ;get ms mantissa
- bfextu d1{1:20},d1 ;get upper 20 bits of ms
- or.l d1,d0 ;put these bits in ms word of double
- move.l d0,LOCAL_EX(a1) ;put the new exp back on the stack
- move.l LOCAL_HI(a1),d1 ;get ms mantissa
- move.l #21,d0 ;load shift count
- lsl.l d0,d1 ;put lower 11 bits in upper bits
- move.l d1,LOCAL_HI(a1) ;build lower lword in memory
- move.l LOCAL_LO(a1),d1 ;get ls mantissa
- bfextu d1{0:21},d0 ;get ls 21 bits of double
- or.l d0,LOCAL_HI(a1) ;put them in double result
-dbl_wrt:
- move.l #$8,d0 ;byte count for double precision number
- exg a0,a1 ;a0=supervisor source, a1=user dest
- bsr.l mem_write ;move the number to the user's memory
- rts
-*
-* dest_sgl --- write single precision value to user space
-*
-*Input
-* a0 -> destination address
-* a1 -> source in extended precision
-*
-*Output
-* a0 -> destroyed
-* a1 -> destroyed
-* d0 -> 0
-*
-*Changes extended precision to single precision.
-* sgl_sign = ext_sign
-* sgl_exp = ext_exp - $3fff(ext bias) + $7f(sgl bias)
-* get rid of ext integer bit
-* sgl_mant = ext_mant{62:12}
-*
-* --------------- --------------- ---------------
-* extended -> |s| exp | |1| ms mant | | ls mant |
-* --------------- --------------- ---------------
-* 95 64 63 62 40 32 31 12 0
-* | |
-* | |
-* | |
-* v v
-* ---------------
-* single -> |s|exp| mant |
-* ---------------
-* 31 22 0
-*
-dest_sgl:
-short_dest_sgl:
- clr.l d0
- move.w LOCAL_EX(a1),d0 ;get exponent
- sub.w #$3fff,d0 ;subtract extended precision bias
- cmp.w #$4000,d0 ;check if inf
- beq.b sinf ;if so, special case
- add.w #$7f,d0 ;add single precision bias
- swap d0 ;put exp in upper word of d0
- lsl.l #7,d0 ;shift it into single exp bits
- tst.b LOCAL_SGN(a1)
- beq.b get_sman ;if positive, continue
- bset.l #31,d0 ;if negative, put in sign first
- bra.b get_sman ;get mantissa
-sinf:
- move.l #$7f800000,d0 ;load single inf exp to d0
- tst.b LOCAL_SGN(a1)
- beq.b sgl_wrt ;if positive, continue
- bset.l #31,d0 ;if negative, put in sign info
- bra.b sgl_wrt
-
-get_sman:
- move.l LOCAL_HI(a1),d1 ;get ms mantissa
- bfextu d1{1:23},d1 ;get upper 23 bits of ms
- or.l d1,d0 ;put these bits in ms word of single
-
-sgl_wrt:
- move.l d0,L_SCR1(a6) ;put the new exp back on the stack
- move.l #$4,d0 ;byte count for single precision number
- tst.l a0 ;users destination address
- beq.b sgl_Dn ;destination is a data register
- exg a0,a1 ;a0=supervisor source, a1=user dest
- lea.l L_SCR1(a6),a0 ;point a0 to data
- bsr.l mem_write ;move the number to the user's memory
- rts
-sgl_Dn:
- bsr.l get_fline ;returns fline word in d0
- and.w #$7,d0 ;isolate register number
- move.l d0,d1 ;d1 has size:reg formatted for reg_dest
- or.l #$10,d1 ;reg_dest wants size added to reg#
- bra.l reg_dest ;size is X, rts in reg_dest will
-* ;return to caller of dest_sgl
-
-dest_ext:
- tst.b LOCAL_SGN(a1) ;put back sign into exponent word
- beq.b dstx_cont
- bset.b #sign_bit,LOCAL_EX(a1)
-dstx_cont:
- clr.b LOCAL_SGN(a1) ;clear out the sign byte
-
- move.l #$0c,d0 ;byte count for extended number
- exg a0,a1 ;a0=supervisor source, a1=user dest
- bsr.l mem_write ;move the number to the user's memory
- rts
-
- end
diff --git a/sys/arch/m68k/fpsp/x_unfl.sa b/sys/arch/m68k/fpsp/x_unfl.sa
deleted file mode 100644
index 90823298db2..00000000000
--- a/sys/arch/m68k/fpsp/x_unfl.sa
+++ /dev/null
@@ -1,295 +0,0 @@
-* $OpenBSD: x_unfl.sa,v 1.4 2007/09/12 13:56:40 chl Exp $
-* $NetBSD: x_unfl.sa,v 1.3 1994/10/26 07:50:30 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* x_unfl.sa 3.4 7/1/91
-*
-* fpsp_unfl --- FPSP handler for underflow exception
-*
-* Trap disabled results
-* For 881/2 compatibility, sw must denormalize the intermediate
-* result, then store the result. Denormalization is accomplished
-* by taking the intermediate result (which is always normalized) and
-* shifting the mantissa right while incrementing the exponent until
-* it is equal to the denormalized exponent for the destination
-* format. After denormalization, the result is rounded to the
-* destination format.
-*
-* Trap enabled results
-* All trap disabled code applies. In addition the exceptional
-* operand needs to made available to the user with a bias of $6000
-* added to the exponent.
-*
-
-X_UNFL IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
- xref denorm
- xref round
- xref store
- xref g_rndpr
- xref g_opcls
- xref g_dfmtou
- xref real_unfl
- xref real_inex
- xref fpsp_done
- xref b1238_fix
-
- xdef fpsp_unfl
-fpsp_unfl:
- link a6,#-LOCAL_SIZE
- fsave -(a7)
- movem.l d0-d1/a0-a1,USER_DA(a6)
- fmovem.x fp0-fp3,USER_FP0(a6)
- fmovem.l fpcr/fpsr/fpiar,USER_FPCR(a6)
-
-*
- bsr.l unf_res ;denormalize, round & store interm op
-*
-* If underflow exceptions are not enabled, check for inexact
-* exception
-*
- btst.b #unfl_bit,FPCR_ENABLE(a6)
- beq.b ck_inex
-
- btst.b #E3,E_BYTE(a6)
- beq.b no_e3_1
-*
-* Clear dirty bit on dest resister in the frame before branching
-* to b1238_fix.
-*
- bfextu CMDREG3B(a6){6:3},d0 ;get dest reg no
- bclr.b d0,FPR_DIRTY_BITS(a6) ;clr dest dirty bit
- bsr.l b1238_fix ;test for bug1238 case
- move.l USER_FPSR(a6),FPSR_SHADOW(a6)
- or.l #sx_mask,E_BYTE(a6)
-no_e3_1:
- movem.l USER_DA(a6),d0-d1/a0-a1
- fmovem.x USER_FP0(a6),fp0-fp3
- fmovem.l USER_FPCR(a6),fpcr/fpsr/fpiar
- frestore (a7)+
- unlk a6
- bra.l real_unfl
-*
-* It is possible to have either inex2 or inex1 exceptions with the
-* unfl. If the inex enable bit is set in the FPCR, and either
-* inex2 or inex1 occurred, we must clean up and branch to the
-* real inex handler.
-*
-ck_inex:
- move.b FPCR_ENABLE(a6),d0
- and.b FPSR_EXCEPT(a6),d0
- andi.b #$3,d0
- beq.b unfl_done
-
-*
-* Inexact enabled and reported, and we must take an inexact exception
-*
-take_inex:
- btst.b #E3,E_BYTE(a6)
- beq.b no_e3_2
-*
-* Clear dirty bit on dest resister in the frame before branching
-* to b1238_fix.
-*
- bfextu CMDREG3B(a6){6:3},d0 ;get dest reg no
- bclr.b d0,FPR_DIRTY_BITS(a6) ;clr dest dirty bit
- bsr.l b1238_fix ;test for bug1238 case
- move.l USER_FPSR(a6),FPSR_SHADOW(a6)
- or.l #sx_mask,E_BYTE(a6)
-no_e3_2:
- move.b #INEX_VEC,EXC_VEC+1(a6)
- movem.l USER_DA(a6),d0-d1/a0-a1
- fmovem.x USER_FP0(a6),fp0-fp3
- fmovem.l USER_FPCR(a6),fpcr/fpsr/fpiar
- frestore (a7)+
- unlk a6
- bra.l real_inex
-
-unfl_done:
- bclr.b #E3,E_BYTE(a6)
- beq.b e1_set ;if set then branch
-*
-* Clear dirty bit on dest resister in the frame before branching
-* to b1238_fix.
-*
- bfextu CMDREG3B(a6){6:3},d0 ;get dest reg no
- bclr.b d0,FPR_DIRTY_BITS(a6) ;clr dest dirty bit
- bsr.l b1238_fix ;test for bug1238 case
- move.l USER_FPSR(a6),FPSR_SHADOW(a6)
- or.l #sx_mask,E_BYTE(a6)
- movem.l USER_DA(a6),d0-d1/a0-a1
- fmovem.x USER_FP0(a6),fp0-fp3
- fmovem.l USER_FPCR(a6),fpcr/fpsr/fpiar
- frestore (a7)+
- unlk a6
- bra.l fpsp_done
-e1_set:
- movem.l USER_DA(a6),d0-d1/a0-a1
- fmovem.x USER_FP0(a6),fp0-fp3
- fmovem.l USER_FPCR(a6),fpcr/fpsr/fpiar
- unlk a6
- bra.l fpsp_done
-*
-* unf_res --- underflow result calculation
-*
-unf_res:
- bsr.l g_rndpr ;returns RND_PREC in d0 0=ext,
-* ;1=sgl, 2=dbl
-* ;we need the RND_PREC in the
-* ;upper word for round
- clr.w -(a7)
- move.w d0,-(a7) ;copy RND_PREC to stack
-*
-*
-* If the exception bit set is E3, the exceptional operand from the
-* fpu is in WBTEMP; else it is in FPTEMP.
-*
- btst.b #E3,E_BYTE(a6)
- beq.b unf_E1
-unf_E3:
- lea WBTEMP(a6),a0 ;a0 now points to operand
-*
-* Test for fsgldiv and fsglmul. If the inst was one of these, then
-* force the precision to extended for the denorm routine. Use
-* the user's precision for the round routine.
-*
- move.w CMDREG3B(a6),d1 ;check for fsgldiv or fsglmul
- andi.w #$7f,d1
- cmpi.w #$30,d1 ;check for sgldiv
- beq.b unf_sgl
- cmpi.w #$33,d1 ;check for sglmul
- bne.b unf_cont ;if not, use fpcr prec in round
-unf_sgl:
- clr.l d0
- move.w #$1,(a7) ;override g_rndpr precision
-* ;force single
- bra.b unf_cont
-unf_E1:
- lea FPTEMP(a6),a0 ;a0 now points to operand
-unf_cont:
- bclr.b #sign_bit,LOCAL_EX(a0) ;clear sign bit
- sne LOCAL_SGN(a0) ;store sign
-
- bsr.l denorm ;returns denorm, a0 points to it
-*
-* WARNING:
-* ;d0 has guard,round sticky bit
-* ;make sure that it is not corrupted
-* ;before it reaches the round subroutine
-* ;also ensure that a0 isn't corrupted
-
-*
-* Set up d1 for round subroutine d1 contains the PREC/MODE
-* information respectively on upper/lower register halves.
-*
- bfextu FPCR_MODE(a6){2:2},d1 ;get mode from FPCR
-* ;mode in lower d1
- add.l (a7)+,d1 ;merge PREC/MODE
-*
-* WARNING: a0 and d0 are assumed to be intact between the denorm and
-* round subroutines. All code between these two subroutines
-* must not corrupt a0 and d0.
-*
-*
-* Perform Round
-* Input: a0 points to input operand
-* d0{31:29} has guard, round, sticky
-* d1{01:00} has rounding mode
-* d1{17:16} has rounding precision
-* Output: a0 points to rounded operand
-*
-
- bsr.l round ;returns rounded denorm at (a0)
-*
-* Differentiate between store to memory vs. store to register
-*
-unf_store:
- bsr.l g_opcls ;returns opclass in d0{2:0}
- cmpi.b #$3,d0
- bne.b not_opc011
-*
-* At this point, a store to memory is pending
-*
-opc011:
- bsr.l g_dfmtou
- tst.b d0
- beq.b ext_opc011 ;If extended, do not subtract
-* ;If destination format is sgl/dbl,
- tst.b LOCAL_HI(a0) ;If rounded result is normal,don't
-* ;subtract
- bmi.b ext_opc011
- subq.w #1,LOCAL_EX(a0) ;account for denorm bias vs.
-* ;normalized bias
-* ; normalized denormalized
-* ;single $7f $7e
-* ;double $3ff $3fe
-*
-ext_opc011:
- bsr.l store ;stores to memory
- bra.b unf_done ;finish up
-
-*
-* At this point, a store to a float register is pending
-*
-not_opc011:
- bsr.l store ;stores to float register
-* ;a0 is not corrupted on a store to a
-* ;float register.
-*
-* Set the condition codes according to result
-*
- tst.l LOCAL_HI(a0) ;check upper mantissa
- bne.b ck_sgn
- tst.l LOCAL_LO(a0) ;check lower mantissa
- bne.b ck_sgn
- bset.b #z_bit,FPSR_CC(a6) ;set condition codes if zero
-ck_sgn:
- btst.b #sign_bit,LOCAL_EX(a0) ;check the sign bit
- beq.b unf_done
- bset.b #neg_bit,FPSR_CC(a6)
-
-*
-* Finish.
-*
-unf_done:
- btst.b #inex2_bit,FPSR_EXCEPT(a6)
- beq.b no_aunfl
- bset.b #aunfl_bit,FPSR_AEXCEPT(a6)
-no_aunfl:
- rts
-
- end
diff --git a/sys/arch/m68k/fpsp/x_unimp.sa b/sys/arch/m68k/fpsp/x_unimp.sa
deleted file mode 100644
index 707bf6468a5..00000000000
--- a/sys/arch/m68k/fpsp/x_unimp.sa
+++ /dev/null
@@ -1,103 +0,0 @@
-* $OpenBSD: x_unimp.sa,v 1.2 1996/05/29 21:05:50 niklas Exp $
-* $NetBSD: x_unimp.sa,v 1.2 1994/10/26 07:50:32 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* x_unimp.sa 3.3 7/1/91
-*
-* fpsp_unimp --- FPSP handler for unimplemented instruction
-* exception.
-*
-* Invoked when the user program encounters a floating-point
-* op-code that hardware does not support. Trap vector# 11
-* (See table 8-1 MC68030 User's Manual).
-*
-*
-* Note: An fsave for an unimplemented inst. will create a short
-* fsave stack.
-*
-* Input: 1. Six word stack frame for unimplemented inst, four word
-* for illegal
-* (See table 8-7 MC68030 User's Manual).
-* 2. Unimp (short) fsave state frame created here by fsave
-* instruction.
-*
-
-X_UNIMP IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
- xref get_op
- xref do_func
- xref sto_res
- xref gen_except
- xref fpsp_fmt_error
-
- xdef fpsp_unimp
- xdef uni_2
-fpsp_unimp:
- link a6,#-LOCAL_SIZE
- fsave -(a7)
-uni_2:
- movem.l d0-d1/a0-a1,USER_DA(a6)
- fmovem.x fp0-fp3,USER_FP0(a6)
- fmovem.l fpcr/fpsr/fpiar,USER_FPCR(a6)
- move.b (a7),d0 ;test for valid version num
- andi.b #$f0,d0 ;test for $4x
- cmpi.b #VER_4,d0 ;must be $4x or exit
- bne.l fpsp_fmt_error
-*
-* Temporary D25B Fix
-* The following lines are used to ensure that the FPSR
-* exception byte and condition codes are clear before proceeding
-*
- move.l USER_FPSR(a6),d0
- and.l #$FF00FF,d0 ;clear all but accrued exceptions
- move.l d0,USER_FPSR(a6)
- fmove.l #0,FPSR ;clear all user bits
- fmove.l #0,FPCR ;clear all user exceptions for FPSP
-
- clr.b UFLG_TMP(a6) ;clr flag for unsupp data
-
- bsr.l get_op ;go get operand(s)
- clr.b STORE_FLG(a6)
- bsr.l do_func ;do the function
- fsave -(a7) ;capture possible exc state
- tst.b STORE_FLG(a6)
- bne.b no_store ;if STORE_FLG is set, no store
- bsr.l sto_res ;store the result in user space
-no_store:
- bra.l gen_except ;post any exceptions and return
-
- end
diff --git a/sys/arch/m68k/fpsp/x_unsupp.sa b/sys/arch/m68k/fpsp/x_unsupp.sa
deleted file mode 100644
index 4bacb2dc4b0..00000000000
--- a/sys/arch/m68k/fpsp/x_unsupp.sa
+++ /dev/null
@@ -1,108 +0,0 @@
-* $OpenBSD: x_unsupp.sa,v 1.2 1996/05/29 21:05:50 niklas Exp $
-* $NetBSD: x_unsupp.sa,v 1.2 1994/10/26 07:50:33 cgd Exp $
-
-* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
-* M68000 Hi-Performance Microprocessor Division
-* M68040 Software Package
-*
-* M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
-* All rights reserved.
-*
-* THE SOFTWARE is provided on an "AS IS" basis and without warranty.
-* To the maximum extent permitted by applicable law,
-* MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
-* INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
-* PARTICULAR PURPOSE and any warranty against infringement with
-* regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
-* and any accompanying written materials.
-*
-* To the maximum extent permitted by applicable law,
-* IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
-* (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
-* PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
-* OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
-* SOFTWARE. Motorola assumes no responsibility for the maintenance
-* and support of the SOFTWARE.
-*
-* You are hereby granted a copyright license to use, modify, and
-* distribute the SOFTWARE so long as this entire notice is retained
-* without alteration in any modified and/or redistributed versions,
-* and that such modified versions are clearly identified as such.
-* No licenses are granted by implication, estoppel or otherwise
-* under any patents or trademarks of Motorola, Inc.
-
-*
-* x_unsupp.sa 3.3 7/1/91
-*
-* fpsp_unsupp --- FPSP handler for unsupported data type exception
-*
-* Trap vector #55 (See table 8-1 Mc68030 User's manual).
-* Invoked when the user program encounters a data format (packed) that
-* hardware does not support or a data type (denormalized numbers or un-
-* normalized numbers).
-* Normalizes denorms and unnorms, unpacks packed numbers then stores
-* them back into the machine to let the 040 finish the operation.
-*
-* Unsupp calls two routines:
-* 1. get_op - gets the operand(s)
-* 2. res_func - restore the function back into the 040 or
-* if fmove.p fpm,<ea> then pack source (fpm)
-* and store in users memory <ea>.
-*
-* Input: Long fsave stack frame
-*
-
-X_UNSUPP IDNT 2,1 Motorola 040 Floating Point Software Package
-
- section 8
-
- include fpsp.h
-
- xref get_op
- xref res_func
- xref gen_except
- xref fpsp_fmt_error
-
- xdef fpsp_unsupp
-fpsp_unsupp:
-*
- link a6,#-LOCAL_SIZE
- fsave -(a7)
- movem.l d0-d1/a0-a1,USER_DA(a6)
- fmovem.x fp0-fp3,USER_FP0(a6)
- fmovem.l fpcr/fpsr/fpiar,USER_FPCR(a6)
-
-
- move.b (a7),VER_TMP(a6) ;save version number
- move.b (a7),d0 ;test for valid version num
- andi.b #$f0,d0 ;test for $4x
- cmpi.b #VER_4,d0 ;must be $4x or exit
- bne.l fpsp_fmt_error
-
- fmove.l #0,FPSR ;clear all user status bits
- fmove.l #0,FPCR ;clear all user control bits
-*
-* The following lines are used to ensure that the FPSR
-* exception byte and condition codes are clear before proceeding,
-* except in the case of fmove, which leaves the cc's intact.
-*
-unsupp_con:
- move.l USER_FPSR(a6),d1
- btst #5,CMDREG1B(a6) ;looking for fmove out
- bne fmove_con
- and.l #$FF00FF,d1 ;clear all but aexcs and qbyte
- bra.b end_fix
-fmove_con:
- and.l #$0FFF40FF,d1 ;clear all but cc's, snan bit, aexcs, and qbyte
-end_fix:
- move.l d1,USER_FPSR(a6)
-
- st UFLG_TMP(a6) ;set flag for unsupp data
-
- bsr.l get_op ;everything okay, go get operand(s)
- bsr.l res_func ;fix up stack frame so can restore it
- clr.l -(a7)
- move.b VER_TMP(a6),(a7) ;move idle fmt word to top of stack
- bra.l gen_except
-*
- end
diff --git a/sys/arch/m68k/include/_float.h b/sys/arch/m68k/include/_float.h
deleted file mode 100644
index bd7da098613..00000000000
--- a/sys/arch/m68k/include/_float.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* $OpenBSD: _float.h,v 1.1 2012/06/26 16:12:44 deraadt Exp $ */
-
-/*
- * Copyright (c) 1989 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _MACHINE__FLOAT_H_
-#define _MACHINE__FLOAT_H_
-
-#define __FLT_RADIX 2 /* b */
-#define __FLT_ROUNDS __flt_rounds()
-#define __FLT_EVAL_METHOD 2 /* long double */
-
-#define __FLT_MANT_DIG 24 /* p */
-#define __FLT_EPSILON 1.19209290E-07F /* b**(1-p) */
-#define __FLT_DIG 6 /* floor((p-1)*log10(b))+(b == 10) */
-#define __FLT_MIN_EXP (-125) /* emin */
-#define __FLT_MIN 1.17549435E-38F /* b**(emin-1) */
-#define __FLT_MIN_10_EXP (-37) /* ceil(log10(b**(emin-1))) */
-#define __FLT_MAX_EXP 128 /* emax */
-#define __FLT_MAX 3.40282347E+38F /* (1-b**(-p))*b**emax */
-#define __FLT_MAX_10_EXP 38 /* floor(log10((1-b**(-p))*b**emax)) */
-
-#define __DBL_MANT_DIG 53
-#define __DBL_EPSILON 2.2204460492503131E-16
-#define __DBL_DIG 15
-#define __DBL_MIN_EXP (-1021)
-#define __DBL_MIN 2.2250738585072014E-308
-#define __DBL_MIN_10_EXP (-307)
-#define __DBL_MAX_EXP 1024
-#define __DBL_MAX 1.7976931348623157E+308
-#define __DBL_MAX_10_EXP 308
-
-#define __LDBL_MANT_DIG 64
-#define __LDBL_EPSILON 1.08420217248550443401e-19L
-#define __LDBL_DIG 18
-#define __LDBL_MIN_EXP (-16381)
-#define __LDBL_MIN 3.36210314311209350626e-4932L
-#define __LDBL_MIN_10_EXP (-4931)
-#define __LDBL_MAX_EXP 16384
-#define __LDBL_MAX 1.18973149535723176502e+4932L
-#define __LDBL_MAX_10_EXP 4932
-
-#define __DECIMAL_DIG 21
-
-#endif /* _MACHINE__FLOAT_H_ */
diff --git a/sys/arch/m68k/include/_types.h b/sys/arch/m68k/include/_types.h
deleted file mode 100644
index c4c81954adc..00000000000
--- a/sys/arch/m68k/include/_types.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/* $OpenBSD: _types.h,v 1.17 2013/12/18 16:41:01 deraadt Exp $ */
-
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)types.h 8.3 (Berkeley) 1/5/94
- * @(#)ansi.h 8.2 (Berkeley) 1/4/94
- */
-
-#ifndef _M68K__TYPES_H_
-#define _M68K__TYPES_H_
-
-#if defined(_KERNEL)
-typedef struct label_t {
- long val[15]; /* consistent with HP-UX */
-} label_t;
-#endif
-
-/*
- * _ALIGN(p) rounds p (pointer or byte index) up to a correctly-aligned
- * value for all data types (int, long, ...). The result is an
- * unsigned long and must be cast to any desired pointer type.
- *
- * _ALIGNED_POINTER is a boolean macro that checks whether an address
- * is valid to fetch data elements of type t from on this architecture.
- * This does not reflect the optimal alignment, just the possibility
- * (within reasonable limits).
- */
-#define _ALIGNBYTES (sizeof(int) - 1)
-#define _STACKALIGNBYTES _ALIGNBYTES
-#define _ALIGN(p) (((unsigned long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
-#define _ALIGNED_POINTER(p,t) ((((unsigned long)(p)) & (sizeof(t) - 1)) == 0)
-
-/* 7.18.1.1 Exact-width integer types */
-typedef __signed char __int8_t;
-typedef unsigned char __uint8_t;
-typedef short __int16_t;
-typedef unsigned short __uint16_t;
-typedef int __int32_t;
-typedef unsigned int __uint32_t;
-/* LONGLONG */
-typedef long long __int64_t;
-/* LONGLONG */
-typedef unsigned long long __uint64_t;
-
-/* 7.18.1.2 Minimum-width integer types */
-typedef __int8_t __int_least8_t;
-typedef __uint8_t __uint_least8_t;
-typedef __int16_t __int_least16_t;
-typedef __uint16_t __uint_least16_t;
-typedef __int32_t __int_least32_t;
-typedef __uint32_t __uint_least32_t;
-typedef __int64_t __int_least64_t;
-typedef __uint64_t __uint_least64_t;
-
-/* 7.18.1.3 Fastest minimum-width integer types */
-typedef __int32_t __int_fast8_t;
-typedef __uint32_t __uint_fast8_t;
-typedef __int32_t __int_fast16_t;
-typedef __uint32_t __uint_fast16_t;
-typedef __int32_t __int_fast32_t;
-typedef __uint32_t __uint_fast32_t;
-typedef __int64_t __int_fast64_t;
-typedef __uint64_t __uint_fast64_t;
-#define __INT_FAST8_MIN INT32_MIN
-#define __INT_FAST16_MIN INT32_MIN
-#define __INT_FAST32_MIN INT32_MIN
-#define __INT_FAST64_MIN INT64_MIN
-#define __INT_FAST8_MAX INT32_MAX
-#define __INT_FAST16_MAX INT32_MAX
-#define __INT_FAST32_MAX INT32_MAX
-#define __INT_FAST64_MAX INT64_MAX
-#define __UINT_FAST8_MAX UINT32_MAX
-#define __UINT_FAST16_MAX UINT32_MAX
-#define __UINT_FAST32_MAX UINT32_MAX
-#define __UINT_FAST64_MAX UINT64_MAX
-
-/* 7.18.1.4 Integer types capable of holding object pointers */
-typedef long __intptr_t;
-typedef unsigned long __uintptr_t;
-
-/* 7.18.1.5 Greatest-width integer types */
-typedef __int64_t __intmax_t;
-typedef __uint64_t __uintmax_t;
-
-/* Register size */
-typedef long __register_t;
-
-/* VM system types */
-typedef unsigned long __vaddr_t;
-typedef unsigned long __paddr_t;
-typedef unsigned long __vsize_t;
-typedef unsigned long __psize_t;
-
-/* Standard system types */
-typedef long double __double_t;
-typedef long double __float_t;
-typedef long __ptrdiff_t;
-typedef unsigned long __size_t;
-typedef long __ssize_t;
-#if defined(__GNUC__) && __GNUC__ >= 3
-typedef __builtin_va_list __va_list;
-#else
-typedef char * __va_list;
-#endif
-
-/* Wide character support types */
-#ifndef __cplusplus
-typedef int __wchar_t;
-#endif
-typedef int __wint_t;
-typedef int __rune_t;
-typedef void * __wctrans_t;
-typedef void * __wctype_t;
-
-#endif /* _M68K__TYPES_H_ */
diff --git a/sys/arch/m68k/include/asm.h b/sys/arch/m68k/include/asm.h
deleted file mode 100644
index fc0fae490af..00000000000
--- a/sys/arch/m68k/include/asm.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/* $OpenBSD: asm.h,v 1.12 2013/03/28 17:41:04 martynas Exp $ */
-/* $NetBSD: asm.h,v 1.13 1997/04/24 22:49:39 thorpej Exp $ */
-
-/*
- * Copyright (c) 1997 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1994 Allen Briggs
- * All rights reserved.
- *
- * Gleaned from locore.s and sun3 asm.h which had the following copyrights:
- * locore.s:
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1990 The Regents of the University of California.
- * sun3/include/asm.h:
- * Copyright (c) 1993 Adam Glass
- * Copyright (c) 1990 The Regents of the University of California.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _M68K_ASM_H_
-#define _M68K_ASM_H_
-
-#if defined(__PIC__)
-#define PIC_PLT(name) name@PLTPC
-#else
-#define PIC_PLT(name) name
-#endif
-
-#define _C_LABEL(name) name
-#define _ASM_LABEL(name) name
-
-#ifndef _KERNEL
-#define _ENTRY(name) \
- .text; .even; .globl name; .type name,@function; name:
-#else
-#define _ENTRY(name) \
- .text; .even; .globl name; name:
-#endif
-
-#ifdef GPROF
-#define _PROF_PROLOG link %a6,#0; jbsr mcount; unlk %a6
-#else
-#define _PROF_PROLOG
-#endif
-
-#define ENTRY(name) _ENTRY(_C_LABEL(name)) _PROF_PROLOG
-#define ASENTRY(name) _ENTRY(_ASM_LABEL(name)) _PROF_PROLOG
-
-#define ENTRY_NOPROFILE(name) _ENTRY(_C_LABEL(name))
-#define ASENTRY_NOPROFILE(name) _ENTRY(_ASM_LABEL(name))
-
-/*
- * The m68k ALTENTRY macro is very different than the traditional
- * implementation used by other OpenBSD ports. Usually ALTENTRY
- * simply provides an alternate function entry point. The m68k
- * definition takes a second argument and jumps inside the second
- * function when profiling is enabled.
- *
- * The m68k behavior is similar to the ENTRY2 macro found in
- * solaris' asm_linkage.h.
- *
- * Providing ENTRY2 and changing all the code that uses ALTENTRY
- * to use it would be a desirable change.
- */
-#ifdef PROF
-#define ALTENTRY(name, rname) ENTRY(name); jra _C_LABEL(rname)+12
-#else
-#define ALTENTRY(name, rname) _ENTRY(_C_LABEL(name))
-#endif
-
-#define RCSID(x) .text ; \
- .asciz x ; \
- .even
-
-#define STRONG_ALIAS(alias,sym) \
- .global alias; \
- alias = sym
-
-#define WEAK_ALIAS(alias,sym) \
- .weak alias; \
- alias = sym
-
-/*
- * Global variables of whatever sort.
- */
-#define GLOBAL(x) \
- .globl _C_LABEL(x) ; \
- _C_LABEL(x):
-
-#define ASGLOBAL(x) \
- .globl _ASM_LABEL(x) ; \
- _ASM_LABEL(x):
-
-/*
- * ...and local variables.
- */
-#define LOCAL(x) \
- _C_LABEL(x):
-
-#define ASLOCAL(x) \
- _ASM_LABEL(x):
-
-/*
- * Items in the BSS segment.
- */
-#define BSS(name, size) \
- .comm _C_LABEL(name),size
-
-#define ASBSS(name, size) \
- .comm _ASM_LABEL(name),size
-
-#ifdef _KERNEL
-/*
- * Shorthand for calling panic().
- * Note the side-effect: it uses up the 9: label, so be careful!
- */
-#define PANIC(x) \
- pea 9f ; \
- jbsr _C_LABEL(panic) ; \
- 9: .asciz x ; \
- .even
-
-/*
- * Shorthand for defining vectors for the vector table.
- */
-#define VECTOR(x) \
- .long _C_LABEL(x)
-
-#define ASVECTOR(x) \
- .long _ASM_LABEL(x)
-
-#define VECTOR_UNUSED \
- .long 0
-
-#define CURPROC _C_LABEL(cpu_info_store) + CI_CURPROC
-
-#endif /* _KERNEL */
-
-#endif /* _M68K_ASM_H_ */
diff --git a/sys/arch/m68k/include/atomic.h b/sys/arch/m68k/include/atomic.h
deleted file mode 100644
index 46c7688f64f..00000000000
--- a/sys/arch/m68k/include/atomic.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* $OpenBSD: atomic.h,v 1.4 2011/03/23 16:54:35 pirofti Exp $ */
-
-/* Public Domain */
-
-#ifndef _M68K_ATOMIC_H_
-#define _M68K_ATOMIC_H_
-
-#if defined(_KERNEL)
-
-static __inline void
-atomic_setbits_int(__volatile unsigned int *uip, unsigned int v)
-{
- unsigned int witness, old, new;
-
- do {
- witness = old = *uip;
- new = old | v;
- __asm__ __volatile__ (
- "casl %0, %2, %1" : "+d"(old), "=m"(*uip) : "d"(new));
- } while (old != witness);
-}
-
-static __inline void
-atomic_clearbits_int(__volatile unsigned int *uip, unsigned int v)
-{
- unsigned int witness, old, new;
-
- do {
- witness = old = *uip;
- new = old & ~v;
- __asm__ __volatile__ (
- "casl %0, %2, %1" : "+d"(old), "=m"(*uip) : "d"(new));
- } while (old != witness);
-}
-
-#endif /* defined(_KERNEL) */
-#endif /* _M68K_ATOMIC_H_ */
diff --git a/sys/arch/m68k/include/cdefs.h b/sys/arch/m68k/include/cdefs.h
deleted file mode 100644
index 44374d27d64..00000000000
--- a/sys/arch/m68k/include/cdefs.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* $OpenBSD: cdefs.h,v 1.11 2013/03/28 17:30:45 martynas Exp $ */
-
-/*
- * Written by J.T. Conklin <jtc@wimsey.com> 01/17/95.
- * Public domain.
- */
-
-#ifndef _M68K_CDEFS_H_
-#define _M68K_CDEFS_H_
-
-#define __strong_alias(alias,sym) \
- __asm__(".global " __STRING(alias) " ; " \
- __STRING(alias) " = " __STRING(sym))
-#define __weak_alias(alias,sym) \
- __asm__(".weak " __STRING(alias) " ; " \
- __STRING(alias) " = " __STRING(sym))
-#define __warn_references(sym,msg) \
- __asm__(".section .gnu.warning." __STRING(sym) \
- " ; .ascii \"" msg "\" ; .text")
-
-#endif /* !_M68K_CDEFS_H_ */
diff --git a/sys/arch/m68k/include/cpu.h b/sys/arch/m68k/include/cpu.h
deleted file mode 100644
index 02c99c399a7..00000000000
--- a/sys/arch/m68k/include/cpu.h
+++ /dev/null
@@ -1,266 +0,0 @@
-/* $OpenBSD: cpu.h,v 1.29 2013/03/12 09:37:16 mpi Exp $ */
-/* $NetBSD: cpu.h,v 1.3 1997/02/02 06:56:57 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: cpu.h 1.16 91/03/25$
- *
- * @(#)cpu.h 8.4 (Berkeley) 1/5/94
- */
-
-#ifndef _M68K_CPU_H_
-#define _M68K_CPU_H_
-
-/*
- * Exported definitions common to Motorola m68k-based ports.
- */
-
-#ifdef _KERNEL
-#ifndef _LOCORE
-#include <sys/queue.h>
-#include <sys/sched.h>
-
-struct cpu_info {
- struct proc *ci_curproc;
-
- struct schedstate_percpu ci_schedstate;
- u_int32_t ci_randseed;
-#ifdef DIAGNOSTIC
- int ci_mutex_level;
-#endif
-#ifdef GPROF
- struct gmonparam *ci_gmon;
-#endif
-};
-
-extern struct cpu_info cpu_info_store;
-
-#define curcpu() (&cpu_info_store)
-
-#define CPU_IS_PRIMARY(ci) 1
-#define CPU_INFO_ITERATOR int
-#define CPU_INFO_FOREACH(cii, ci) \
- for (cii = 0, ci = curcpu(); ci != NULL; ci = NULL)
-#define CPU_INFO_UNIT(ci) 0
-#define MAXCPUS 1
-#define cpu_unidle(ci)
-
-#define cpu_number() 0
-
-/*
- * All m68k ports must provide these globals.
- */
-extern int cputype; /* CPU on this host */
-extern int ectype; /* external cache on this host */
-extern int fputype; /* FPU on this host */
-extern int mmutype; /* MMU on this host */
-
-#endif /* !_LOCORE */
-#endif /* _KERNEL */
-
-/* values for cputype */
-#define CPU_68020 0 /* 68020 */
-#define CPU_68030 1 /* 68030 */
-#define CPU_68040 2 /* 68040 */
-#define CPU_68060 3 /* 68060 */
-
-/* values for ectype */
-#define EC_PHYS -1 /* external physical address cache */
-#define EC_NONE 0 /* no external cache */
-#define EC_VIRT 1 /* external virtual address cache */
-
-/* values for fputype */
-#define FPU_NONE 0 /* no FPU */
-#define FPU_68881 1 /* 68881 FPU */
-#define FPU_68882 2 /* 68882 FPU */
-#define FPU_68040 3 /* 68040 on-chip FPU */
-#define FPU_68060 4 /* 68060 on-chip FPU */
-#define FPU_UNKNOWN 5 /* placeholder; unknown FPU */
-
-/* values for mmutype (assigned for quick testing) */
-#define MMU_68060 -3 /* 68060 on-chip MMU */
-#define MMU_68040 -2 /* 68040 on-chip MMU */
-#define MMU_68030 -1 /* 68030 on-chip subset of 68851 */
-#define MMU_68851 1 /* Motorola 68851 */
-
-/*
- * 68851 and 68030 MMU
- */
-#define PMMU_LVLMASK 0x0007
-#define PMMU_INV 0x0400
-#define PMMU_WP 0x0800
-#define PMMU_ALV 0x1000
-#define PMMU_SO 0x2000
-#define PMMU_LV 0x4000
-#define PMMU_BE 0x8000
-#define PMMU_FAULT (PMMU_WP|PMMU_INV)
-
-/*
- * 68040 MMU
- */
-#define MMU40_RES 0x001
-#define MMU40_TTR 0x002
-#define MMU40_WP 0x004
-#define MMU40_MOD 0x010
-#define MMU40_CMMASK 0x060
-#define MMU40_SUP 0x080
-#define MMU40_U0 0x100
-#define MMU40_U1 0x200
-#define MMU40_GLB 0x400
-#define MMU40_BE 0x800
-
-/* 680X0 function codes */
-#define FC_USERD 1 /* user data space */
-#define FC_USERP 2 /* user program space */
-#define FC_PURGE 3 /* HPMMU: clear TLB entries */
-#define FC_SUPERD 5 /* supervisor data space */
-#define FC_SUPERP 6 /* supervisor program space */
-#define FC_CPU 7 /* CPU space */
-
-/* fields in the 68020 cache control register */
-#define IC_ENABLE 0x0001 /* enable instruction cache */
-#define IC_FREEZE 0x0002 /* freeze instruction cache */
-#define IC_CE 0x0004 /* clear instruction cache entry */
-#define IC_CLR 0x0008 /* clear entire instruction cache */
-
-/* additional fields in the 68030 cache control register */
-#define IC_BE 0x0010 /* instruction burst enable */
-#define DC_ENABLE 0x0100 /* data cache enable */
-#define DC_FREEZE 0x0200 /* data cache freeze */
-#define DC_CE 0x0400 /* clear data cache entry */
-#define DC_CLR 0x0800 /* clear entire data cache */
-#define DC_BE 0x1000 /* data burst enable */
-#define DC_WA 0x2000 /* write allocate */
-
-/* fields in the 68040 cache control register */
-#define IC40_ENABLE 0x00008000 /* instruction cache enable bit */
-#define DC40_ENABLE 0x80000000 /* data cache enable bit */
-
-/* additional fields in the 68060 cache control register */
-#define DC60_NAD 0x40000000 /* no allocate mode, data cache */
-#define DC60_ESB 0x20000000 /* enable store buffer */
-#define DC60_DPI 0x10000000 /* disable CPUSH invalidation */
-#define DC60_FOC 0x08000000 /* four kB data cache mode (else 8) */
-
-#define IC60_EBC 0x00800000 /* enable branch cache */
-#define IC60_CABC 0x00400000 /* clear all branch cache entries */
-#define IC60_CUBC 0x00200000 /* clear user branch cache entries */
-
-#define IC60_NAI 0x00004000 /* no allocate mode, instr. cache */
-#define IC60_FIC 0x00002000 /* four kB instr. cache (else 8) */
-
-#define CACHE_ON (DC_WA|DC_BE|DC_CLR|DC_ENABLE|IC_BE|IC_CLR|IC_ENABLE)
-#define CACHE_OFF (DC_CLR|IC_CLR)
-#define CACHE_CLR (CACHE_ON)
-#define IC_CLEAR (DC_WA|DC_BE|DC_ENABLE|IC_BE|IC_CLR|IC_ENABLE)
-#define DC_CLEAR (DC_WA|DC_BE|DC_CLR|DC_ENABLE|IC_BE|IC_ENABLE)
-
-#define CACHE40_ON (IC40_ENABLE|DC40_ENABLE)
-#define CACHE40_OFF (0x00000000)
-
-#define CACHE60_ON (CACHE40_ON|IC60_CABC|IC60_EBC|DC60_ESB)
-#define CACHE60_OFF (CACHE40_OFF|IC60_CABC)
-
-/* bits in the 68060 Processor Control Register */
-#define PCR_IDSHIFT 16
-#define PCR_IDMASK 0xffff
-#define PCR_68060 0x430
-#define PCR_68060LC 0x431
-#define PCR_REVSHIFT 8
-#define PCR_REVMASK 0xff
-#define PCR_DEBUG 0x80
-#define PCR_FPUDIS 0x02
-#define PCR_SUPERSCALAR 0x01
-
-#ifdef _KERNEL
-struct frame;
-struct fpframe;
-struct pcb;
-struct proc;
-struct trapframe;
-
-void copypage(void *fromaddr, void *toaddr);
-void zeropage(void *addr);
-
-/* locore.s */
-void TBIS(vaddr_t);
-void TBIAS(void);
-void TBIAU(void);
-void ICIA(void);
-void DCIA(void);
-void DCIS(void);
-void DCIU(void);
-#if defined(M68040) || defined(M68060)
-void ICPA(void);
-void DCFA(void);
-void ICPL(paddr_t);
-void ICPP(paddr_t);
-void DCPL(paddr_t);
-void DCPP(paddr_t);
-void DCFL(paddr_t);
-void DCFP(paddr_t);
-#endif
-
-u_long getdfc(void);
-u_long getsfc(void);
-void loadustp(int);
-void m68881_restore(struct fpframe *);
-void m68881_save(struct fpframe *);
-void proc_trampoline(void);
-void savectx(struct pcb *);
-int suline(caddr_t, caddr_t);
-void switch_exit(struct proc *);
-
-/* regdump.c */
-void regdump(struct trapframe *, int);
-
-/* sys_machdep.c */
-int cachectl(struct proc *, int, vaddr_t, int);
-#define CC_PURGE 0x00000001
-#define CC_FLUSH 0x00000002
-#define CC_IPURGE 0x00000004
-#define CC_EXTPURGE 0x80000000
-
-/*
- * This is used during profiling to integrate system time.
- */
-#define PROC_PC(p) (((struct trapframe *)((p)->p_md.md_regs))->tf_pc)
-#define PROC_STACK(p) (((struct trapframe *)((p)->p_md.md_regs))->tf_regs[15])
-
-#define cpu_idle_enter() do { /* nothing */ } while (0)
-#define cpu_idle_leave() do { /* nothing */ } while (0)
-
-#endif /* _KERNEL */
-
-#endif /* _M68K_CPU_H_ */
diff --git a/sys/arch/m68k/include/db_machdep.h b/sys/arch/m68k/include/db_machdep.h
deleted file mode 100644
index b1e12ac59d7..00000000000
--- a/sys/arch/m68k/include/db_machdep.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* $OpenBSD: db_machdep.h,v 1.13 2014/03/16 20:31:46 guenther Exp $ */
-/* $NetBSD: db_machdep.h,v 1.20 1997/06/26 01:26:58 thorpej Exp $ */
-
-/*
- * Mach Operating System
- * Copyright (c) 1992 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- */
-
-/*
- * Machine-dependent defines for new kernel debugger.
- */
-#ifndef _M68K_DB_MACHDEP_H_
-#define _M68K_DB_MACHDEP_H_
-
-#include <sys/types.h>
-
-/*
- * XXX - Would rather not pull in vm headers, but need boolean_t,
- * at least until boolean_t moves to <sys/types.h> or someplace.
- */
-#include <uvm/uvm_param.h>
-
-#include <machine/frame.h>
-#include <machine/psl.h>
-#include <machine/trap.h>
-
-typedef vaddr_t db_addr_t; /* address - unsigned */
-typedef long db_expr_t; /* expression - signed */
-typedef struct trapframe db_regs_t;
-
-extern db_regs_t ddb_regs; /* register state */
-#define DDB_REGS (&ddb_regs)
-
-#define PC_REGS(regs) ((db_addr_t)(regs)->tf_pc)
-#define SET_PC_REGS(regs, value) (regs)->tf_pc = (unsigned int)(value)
-
-#define BKPT_INST 0x4e4f /* breakpoint instruction */
-#define BKPT_SIZE (2) /* size of breakpoint inst */
-#define BKPT_SET(inst) (BKPT_INST)
-
-#define FIXUP_PC_AFTER_BREAK(regs) ((regs)->tf_pc -= BKPT_SIZE)
-
-#define db_clear_single_step(regs) ((regs)->tf_sr &= ~PSL_T)
-#define db_set_single_step(regs) ((regs)->tf_sr |= PSL_T)
-
-#define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BREAKPOINT)
-#ifdef T_WATCHPOINT
-#define IS_WATCHPOINT_TRAP(type, code) ((type) == T_WATCHPOINT)
-#else
-#define IS_WATCHPOINT_TRAP(type, code) 0
-#endif
-
-#define M_RTS 0xffff0000
-#define I_RTS 0x4e750000
-#define M_JSR 0xffc00000
-#define I_JSR 0x4e800000
-#define M_BSR 0xff000000
-#define I_BSR 0x61000000
-#define M_RTE 0xffff0000
-#define I_RTE 0x4e730000
-
-#define inst_trap_return(ins) (((ins)&M_RTE) == I_RTE)
-#define inst_return(ins) (((ins)&M_RTS) == I_RTS)
-#define inst_call(ins) (((ins)&M_JSR) == I_JSR || \
- ((ins)&M_BSR) == I_BSR)
-
-/*
- * Things needed by kgdb:
- */
-typedef long kgdb_reg_t;
-#define KGDB_NUMREGS (16+2)
-#define KGDB_BUFLEN 512
-
-#ifdef _KERNEL
-
-#define KGDB_ENTER __asm __volatile("trap #15")
-
-void Debugger(void); /* XXX */
-void kdb_kintr(db_regs_t *);
-int kdb_trap(int, db_regs_t *);
-
-#endif /* _KERNEL */
-
-#endif /* _M68K_DB_MACHDEP_H_ */
diff --git a/sys/arch/m68k/include/endian.h b/sys/arch/m68k/include/endian.h
deleted file mode 100644
index 76881edb8e4..00000000000
--- a/sys/arch/m68k/include/endian.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* $OpenBSD: endian.h,v 1.18 2011/03/23 16:54:35 pirofti Exp $ */
-
-/*-
- * Copyright (c) 1997 Niklas Hallqvist. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _M68K_ENDIAN_H_
-#define _M68K_ENDIAN_H_
-
-#ifdef __GNUC__
-
-#define __swap64md __swap64gen
-
-#define __swap32md(x) __statement({ \
- u_int32_t __swap32md_x = (x); \
- \
- __asm ("rorw #8, %0; swap %0; rorw #8, %0" : \
- "=d" (__swap32md_x) : "0" (__swap32md_x)); \
- __swap32md_x; \
-})
-
-#define __swap16md(x) __statement({ \
- u_int16_t __swap16md_x = (x); \
- \
- __asm ("rorw #8, %0" : "=d" (__swap16md_x) : \
- "0" (__swap16md_x)); \
- __swap16md_x; \
-})
-
-/* Tell sys/endian.h we have MD variants of the swap macros. */
-#define MD_SWAP
-
-#endif /* __GNUC__ */
-
-#define _BYTE_ORDER _BIG_ENDIAN
-#include <sys/endian.h>
-
-#endif /* _M68K_ENDIAN_H_ */
diff --git a/sys/arch/m68k/include/exec.h b/sys/arch/m68k/include/exec.h
deleted file mode 100644
index 46c806e70e3..00000000000
--- a/sys/arch/m68k/include/exec.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* $OpenBSD: exec.h,v 1.7 2013/10/17 08:02:16 deraadt Exp $ */
-/* $NetBSD: exec.h,v 1.8 1994/11/21 21:33:39 gwr Exp $ */
-
-/*
- * Copyright (c) 1993 Christopher G. Demetriou
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _M68K_EXEC_H_
-#define _M68K_EXEC_H_
-
-#define __LDPGSZ 8192
-
-#define ARCH_ELFSIZE 32
-
-#define ELF_TARG_CLASS ELFCLASS32
-#define ELF_TARG_DATA ELFDATA2MSB
-#define ELF_TARG_MACH EM_68K
-
-#define _NLIST_DO_ELF
-#define _KERN_DO_ELF
-
-#endif /* _M68K_EXEC_H_ */
diff --git a/sys/arch/m68k/include/fenv.h b/sys/arch/m68k/include/fenv.h
deleted file mode 100644
index 33e7374b688..00000000000
--- a/sys/arch/m68k/include/fenv.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* $OpenBSD: fenv.h,v 1.3 2011/05/25 21:46:49 martynas Exp $ */
-
-/*
- * Copyright (c) 2011 Martynas Venckus <martynas@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef _M68K_FENV_H_
-#define _M68K_FENV_H_
-
-/*
- * Each symbol representing a floating point exception expands to an integer
- * constant expression with values, such that bitwise-inclusive ORs of _all
- * combinations_ of the constants result in distinct values.
- *
- * We use such values that allow direct bitwise operations on FPU registers.
- */
-#define FE_INEXACT 0x08
-#define FE_DIVBYZERO 0x10
-#define FE_UNDERFLOW 0x20
-#define FE_OVERFLOW 0x40
-#define FE_INVALID 0x80
-
-/*
- * The following symbol is simply the bitwise-inclusive OR of all floating-point
- * exception constants defined above.
- */
-#define FE_ALL_EXCEPT (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | \
- FE_OVERFLOW | FE_INVALID)
-#define _MASK_SHIFT 6
-
-/*
- * Each symbol representing the rounding direction, expands to an integer
- * constant expression whose value is distinct non-negative value.
- *
- * We use such values that allow direct bitwise operations on FPU registers.
- */
-#define FE_TONEAREST 0x00
-#define FE_TOWARDZERO 0x10
-#define FE_DOWNWARD 0x20
-#define FE_UPWARD 0x30
-
-/*
- * The following symbol is simply the bitwise-inclusive OR of all floating-point
- * rounding direction constants defined above.
- */
-#define _ROUND_MASK (FE_TONEAREST | FE_TOWARDZERO | FE_DOWNWARD | \
- FE_UPWARD)
-
-/*
- * fenv_t represents the entire floating-point environment.
- */
-typedef struct {
- unsigned int __control; /* Control register */
- unsigned int __status; /* Status register */
-} fenv_t;
-
-/*
- * The following constant represents the default floating-point environment
- * (that is, the one installed at program startup) and has type pointer to
- * const-qualified fenv_t.
- *
- * It can be used as an argument to the functions within the <fenv.h> header
- * that manage the floating-point environment, namely fesetenv() and
- * feupdateenv().
- */
-__BEGIN_DECLS
-extern fenv_t __fe_dfl_env;
-__END_DECLS
-#define FE_DFL_ENV ((const fenv_t *)&__fe_dfl_env)
-
-/*
- * fexcept_t represents the floating-point status flags collectively, including
- * any status the implementation associates with the flags.
- *
- * A floating-point status flag is a system variable whose value is set (but
- * never cleared) when a floating-point exception is raised, which occurs as a
- * side effect of exceptional floating-point arithmetic to provide auxiliary
- * information.
- *
- * A floating-point control mode is a system variable whose value may be set by
- * the user to affect the subsequent behavior of floating-point arithmetic.
- */
-typedef unsigned int fexcept_t;
-
-#endif /* !_M68K_FENV_H_ */
diff --git a/sys/arch/m68k/include/frame.h b/sys/arch/m68k/include/frame.h
deleted file mode 100644
index b2eaa751aec..00000000000
--- a/sys/arch/m68k/include/frame.h
+++ /dev/null
@@ -1,309 +0,0 @@
-/* $OpenBSD: frame.h,v 1.8 2003/11/16 20:30:06 avsm Exp $ */
-/* $NetBSD: frame.h,v 1.15 1997/05/03 12:49:05 mycroft Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: frame.h 1.8 92/12/20$
- *
- * @(#)frame.h 8.1 (Berkeley) 6/10/93
- */
-
-#ifndef _M68K_FRAME_H_
-#define _M68K_FRAME_H_
-
-struct frame {
- struct trapframe {
- int tf_regs[16];
- short tf_pad;
- short tf_stackadj;
- u_short tf_sr;
- u_int tf_pc;
- u_short tf_format:4,
- tf_vector:12;
- } __packed F_t;
- union F_u {
- struct fmt2 {
- u_int f_iaddr;
- } F_fmt2;
-
- struct fmt3 {
- u_int f_ea;
- } F_fmt3;
-
- struct fmt4 {
- u_int f_fa;
- u_int f_fslw;
- /* for 060FP type 4 FP disabled frames: */
-#define f_fea f_fa
-#define f_pcfi f_fslw
- } F_fmt4;
-
- struct fmt7 {
- u_int f_ea;
- u_short f_ssw;
- u_short f_wb3s, f_wb2s, f_wb1s;
- u_int f_fa;
- u_int f_wb3a, f_wb3d;
- u_int f_wb2a, f_wb2d;
- u_int f_wb1a, f_wb1d;
-#define f_pd0 f_wb1d
- u_int f_pd1, f_pd2, f_pd3;
- } F_fmt7;
-
- struct fmt9 {
- u_int f_iaddr;
- u_short f_iregs[4];
- } F_fmt9;
-
- struct fmtA {
- u_short f_ir0;
- u_short f_ssw;
- u_short f_ipsc;
- u_short f_ipsb;
- u_int f_dcfa;
- u_short f_ir1, f_ir2;
- u_int f_dob;
- u_short f_ir3, f_ir4;
- } F_fmtA;
-
- struct fmtB {
- u_short f_ir0;
- u_short f_ssw;
- u_short f_ipsc;
- u_short f_ipsb;
- u_int f_dcfa;
- u_short f_ir1, f_ir2;
- u_int f_dob;
- u_short f_ir3, f_ir4;
- u_short f_ir5, f_ir6;
- u_int f_sba;
- u_short f_ir7, f_ir8;
- u_int f_dib;
- u_short f_iregs[22];
- } F_fmtB;
- } F_u;
-};
-
-#define f_regs F_t.tf_regs
-#define f_pad F_t.tf_pad
-#define f_stackadj F_t.tf_stackadj
-#define f_sr F_t.tf_sr
-#define f_pc F_t.tf_pc
-#define f_format F_t.tf_format
-#define f_vector F_t.tf_vector
-#define f_fmt2 F_u.F_fmt2
-#define f_fmt3 F_u.F_fmt3
-#define f_fmt4 F_u.F_fmt4
-#define f_fmt7 F_u.F_fmt7
-#define f_fmt9 F_u.F_fmt9
-#define f_fmtA F_u.F_fmtA
-#define f_fmtB F_u.F_fmtB
-
-struct switchframe {
- u_int sf_pc;
-};
-
-/* common frame size */
-#define CFSIZE (sizeof(struct frame) - sizeof(union F_u))
-#define NFMTSIZE 9
-
-#define FMT0 0x0
-#define FMT1 0x1
-#define FMT2 0x2
-#define FMT3 0x3
-#define FMT4 0x4
-#define FMT7 0x7
-#define FMT9 0x9
-#define FMTA 0xA
-#define FMTB 0xB
-
-/* frame specific info sizes */
-#define FMT0SIZE 0
-#define FMT1SIZE 0
-#define FMT2SIZE sizeof(struct fmt2)
-#define FMT3SIZE sizeof(struct fmt3)
-#define FMT4SIZE sizeof(struct fmt4)
-#define FMT7SIZE sizeof(struct fmt7)
-#define FMT9SIZE sizeof(struct fmt9)
-#define FMTASIZE sizeof(struct fmtA)
-#define FMTBSIZE sizeof(struct fmtB)
-
-#define V_BUSERR 0x008
-#define V_ADDRERR 0x00C
-#define V_TRAP1 0x084
-
-/* 68020/68030 SSW bits */
-#define SSW_RC 0x2000
-#define SSW_RB 0x1000
-#define SSW_DF 0x0100
-#define SSW_RM 0x0080
-#define SSW_RW 0x0040
-#define SSW_FCMASK 0x0007
-
-/* 68040 SSW bits */
-#define SSW4_CP 0x8000
-#define SSW4_CU 0x4000
-#define SSW4_CT 0x2000
-#define SSW4_CM 0x1000
-#define SSW4_MA 0x0800
-#define SSW4_ATC 0x0400
-#define SSW4_LK 0x0200
-#define SSW4_RW 0x0100
-#define SSW4_WBSV 0x0080 /* really in WB status, not SSW */
-#define SSW4_SZMASK 0x0060
-#define SSW4_SZLW 0x0000
-#define SSW4_SZB 0x0020
-#define SSW4_SZW 0x0040
-#define SSW4_SZLN 0x0060
-#define SSW4_TTMASK 0x0018
-#define SSW4_TTNOR 0x0000
-#define SSW4_TTM16 0x0008
-#define SSW4_TMMASK 0x0007
-#define SSW4_TMDCP 0x0000
-#define SSW4_TMUD 0x0001
-#define SSW4_TMUC 0x0002
-#define SSW4_TMKD 0x0005
-#define SSW4_TMKC 0x0006
-
-/* 060 Fault Status Long Word (FPSP) */
-
-#define FSLW_MA 0x08000000
-#define FSLW_LK 0x02000000
-#define FSLW_RW 0x01800000
-
-#define FSLW_RW_R 0x01000000
-#define FSLW_RW_W 0x00800000
-
-#define FSLW_SIZE 0x00600000
-/*
- * We better define the FSLW_SIZE values here, as the table given in the
- * MC68060UM/AD rev. 0/1 p. 8-23 is wrong, and was corrected in the errata
- * document.
- */
-#define FSLW_SIZE_LONG 0x00000000
-#define FSLW_SIZE_BYTE 0x00200000
-#define FSLW_SIZE_WORD 0x00400000
-#define FSLW_SIZE_MV16 0x00600000
-
-#define FLSW_TT 0x00180000
-#define FSLW_TM 0x00070000
-#define FSLW_TM_SV 0x00040000
-
-
-
-#define FSLW_IO 0x00008000
-#define FSLW_PBE 0x00004000
-#define FSLW_SBE 0x00002000
-#define FSLW_PTA 0x00001000
-#define FSLW_PTB 0x00000800
-#define FSLW_IL 0x00000400
-#define FSLW_PF 0x00000200
-#define FSLW_SP 0x00000100
-#define FSLW_WP 0x00000080
-#define FSLW_TWE 0x00000040
-#define FSLW_RE 0x00000020
-#define FSLW_WE 0x00000010
-#define FSLW_TTR 0x00000008
-#define FSLW_BPE 0x00000004
-#define FSLW_SEE 0x00000001
-
-struct fpframe {
- union FPF_u1 {
- u_int FPF_null;
- struct {
- u_char FPF_version;
- u_char FPF_fsize;
- u_short FPF_res1;
- } FPF_nonnull;
- } FPF_u1;
- union FPF_u2 {
- struct fpidle {
- u_short fpf_ccr;
- u_short fpf_res2;
- u_int fpf_iregs1[8];
- u_int fpf_xops[3];
- u_int fpf_opreg;
- u_int fpf_biu;
- } FPF_idle;
-
- struct fpbusy {
- u_int fpf_iregs[53];
- } FPF_busy;
-
- struct fpunimp {
- u_int fpf_state[10];
- } FPF_unimp;
- } FPF_u2;
- u_int fpf_regs[8*3];
- u_int fpf_fpcr;
- u_int fpf_fpsr;
- u_int fpf_fpiar;
-};
-
-#define fpf_null FPF_u1.FPF_null
-#define fpf_version FPF_u1.FPF_nonnull.FPF_version
-#define fpf_fsize FPF_u1.FPF_nonnull.FPF_fsize
-#define fpf_res1 FPF_u1.FPF_nonnull.FPF_res1
-#define fpf_idle FPF_u2.FPF_idle
-#define fpf_busy FPF_u2.FPF_busy
-#define fpf_unimp FPF_u2.FPF_unimp
-
-/*
- * This is incompatible with the earlier one; expecially, an earlier frame
- * must not be FRESTOREd on a 060 or vv, because a frame error exception is
- * not guaranteed.
- */
-
-
-struct fpframe060 {
- u_short fpf6_excp_exp;
- u_char fpf6_frmfmt;
-#define FPF6_FMT_NULL 0x00
-#define FPF6_FMT_IDLE 0x60
-#define FPF6_FMT_EXCP 0xe0
-
- u_char fpf6_v;
-#define FPF6_V_BSUN 0
-#define FPF6_V_INEX12 1
-#define FPF6_V_DZ 2
-#define FPF6_V_UNFL 3
-#define FPF6_V_OPERR 4
-#define FPF6_V_OVFL 5
-#define FPF6_V_SNAN 6
-#define FPF6_V_UNSUP 7
-
- u_long fpf6_upper, fpf6_lower;
-};
-
-#endif /* _M68K_FRAME_H_ */
diff --git a/sys/arch/m68k/include/ieee.h b/sys/arch/m68k/include/ieee.h
deleted file mode 100644
index 3ed9aad9885..00000000000
--- a/sys/arch/m68k/include/ieee.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/* $OpenBSD: ieee.h,v 1.4 2008/09/07 20:36:06 martynas Exp $ */
-/* $NetBSD: ieee.h,v 1.2 1994/11/20 20:53:10 deraadt Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)ieee.h 8.1 (Berkeley) 6/11/93
- */
-
-/*
- * ieee.h defines the machine-dependent layout of the machine's IEEE
- * floating point. It does *not* define (yet?) any of the rounding
- * mode bits, exceptions, and so forth.
- */
-
-/*
- * Define the number of bits in each fraction and exponent.
- *
- * k k+1
- * Note that 1.0 x 2 == 0.1 x 2 and that denorms are represented
- *
- * (-exp_bias+1)
- * as fractions that look like 0.fffff x 2 . This means that
- *
- * -126
- * the number 0.10000 x 2 , for instance, is the same as the normalized
- *
- * -127 -128
- * float 1.0 x 2 . Thus, to represent 2 , we need one leading zero
- *
- * -129
- * in the fraction; to represent 2 , we need two, and so on. This
- *
- * (-exp_bias-fracbits+1)
- * implies that the smallest denormalized number is 2
- *
- * for whichever format we are talking about: for single precision, for
- *
- * -126 -149
- * instance, we get .00000000000000000000001 x 2 , or 1.0 x 2 , and
- *
- * -149 == -127 - 23 + 1.
- */
-#define SNG_EXPBITS 8
-#define SNG_FRACBITS 23
-
-#define DBL_EXPBITS 11
-#define DBL_FRACHBITS 20
-#define DBL_FRACLBITS 32
-#define DBL_FRACBITS 52
-
-#define EXT_EXPBITS 15
-#define EXT_FRACHBITS 32
-#define EXT_FRACLBITS 32
-#define EXT_FRACBITS 64
-
-#define EXT_TO_ARRAY32(p, a) do { \
- (a)[0] = (uint32_t)(p)->ext_fracl; \
- (a)[1] = (uint32_t)(p)->ext_frach; \
-} while(0)
-
-struct ieee_single {
- u_int sng_sign:1;
- u_int sng_exp:8;
- u_int sng_frac:23;
-};
-
-struct ieee_double {
- u_int dbl_sign:1;
- u_int dbl_exp:11;
- u_int dbl_frach:20;
- u_int dbl_fracl;
-};
-
-struct ieee_ext {
- u_int ext_sign:1;
- u_int ext_exp:15;
- u_int ext_zero:16;
- u_int ext_frach;
- u_int ext_fracl;
-};
-
-/*
- * Floats whose exponent is in [1..INFNAN) (of whatever type) are
- * `normal'. Floats whose exponent is INFNAN are either Inf or NaN.
- * Floats whose exponent is zero are either zero (iff all fraction
- * bits are zero) or subnormal values.
- *
- * A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its
- * high fraction; if the bit is set, it is a `quiet NaN'.
- */
-#define SNG_EXP_INFNAN 255
-#define DBL_EXP_INFNAN 2047
-#define EXT_EXP_INFNAN 32767
-
-#if 0
-#define SNG_QUIETNAN (1 << 22)
-#define DBL_QUIETNAN (1 << 19)
-#define EXT_QUIETNAN (1 << 30)
-#endif
-
-/*
- * Exponent biases.
- */
-#define SNG_EXP_BIAS 127
-#define DBL_EXP_BIAS 1023
-#define EXT_EXP_BIAS 16383
diff --git a/sys/arch/m68k/include/ieeefp.h b/sys/arch/m68k/include/ieeefp.h
deleted file mode 100644
index 96f825742d7..00000000000
--- a/sys/arch/m68k/include/ieeefp.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* $OpenBSD: ieeefp.h,v 1.2 1996/05/29 18:38:32 niklas Exp $ */
-/*
- * Written by J.T. Conklin, Apr 6, 1995
- * Public domain.
- */
-
-#ifndef _M68K_IEEEFP_H_
-#define _M68K_IEEEFP_H_
-
-typedef int fp_except;
-#define FP_X_IMP 0x01 /* imprecise (loss of precision) */
-#define FP_X_DZ 0x02 /* divide-by-zero exception */
-#define FP_X_UFL 0x04 /* underflow exception */
-#define FP_X_OFL 0x08 /* overflow exception */
-#define FP_X_INV 0x10 /* invalid operation exception */
-
-typedef enum {
- FP_RN=0, /* round to nearest representable number */
- FP_RZ=1, /* round to zero (truncate) */
- FP_RM=2, /* round toward negative infinity */
- FP_RP=3 /* round toward positive infinity */
-} fp_rnd;
-
-#endif /* _M68K_IEEEFP_H_ */
diff --git a/sys/arch/m68k/include/intr.h b/sys/arch/m68k/include/intr.h
deleted file mode 100644
index b8258f4a270..00000000000
--- a/sys/arch/m68k/include/intr.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* $OpenBSD: intr.h,v 1.2 2010/12/21 14:56:24 claudio Exp $ */
-/*
- * Copyright (c) 2001 Wasabi Systems, Inc.
- * All rights reserved.
- *
- * Written by Jason R. Thorpe for Wasabi Systems, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project by
- * Wasabi Systems, Inc.
- * 4. The name of Wasabi Systems, Inc. may not be used to endorse
- * or promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _M68K_INTR_H_
-#define _M68K_INTR_H_
-
-#ifdef _KERNEL
-#ifndef _LOCORE
-
-/* SPL asserts */
-#ifdef DIAGNOSTIC
-/*
- * Although this function is implemented in MI code, it must be in this MD
- * header because we don't want this header to include MI includes.
- */
-void splassert_fail(int, int, const char *);
-extern int splassert_ctl;
-void splassert_check(int, const char *);
-#define splassert(__wantipl) do { \
- if (splassert_ctl > 0) { \
- splassert_check(__wantipl, __func__); \
- } \
-} while (0)
-#define splsoftassert(wantipl) splassert(IPL_SOFTINT)
-#else
-#define splassert(wantipl) do { /* nothing */ } while (0)
-#define splsoftassert(wantipl) do { /* nothing */ } while (0)
-#endif
-
-/*
- * Generic software interrupt support for all m68k platforms.
- */
-
-#define IPL_SOFT 0
-#define IPL_SOFTCLOCK 1
-#define IPL_SOFTNET 2
-#define IPL_SOFTTTY 3
-
-#define SI_SOFT 0 /* for IPL_SOFT */
-#define SI_SOFTCLOCK 1 /* for IPL_SOFTCLOCK */
-#define SI_SOFTNET 2 /* for IPL_SOFTNET */
-#define SI_SOFTTTY 3 /* for IPL_SOFTTTY */
-
-#define SI_NQUEUES 4
-
-#include <machine/mutex.h>
-#include <sys/queue.h>
-
-struct soft_intrhand {
- TAILQ_ENTRY(soft_intrhand) sih_list;
- void (*sih_func)(void *);
- void *sih_arg;
- struct soft_intrq *sih_siq;
- int sih_pending;
-};
-
-struct soft_intrq {
- TAILQ_HEAD(, soft_intrhand) siq_list;
- int siq_si;
- struct mutex siq_mtx;
-};
-
-void *softintr_establish(int, void (*)(void *), void *);
-void softintr_disestablish(void *);
-void softintr_init(void);
-void softintr_dispatch(int);
-void softintr_schedule(void *);
-
-extern int softpending;
-
-#endif /* _LOCORE */
-
-#endif /* _KERNEL */
-#endif /* _M68K_INTR_H_ */
diff --git a/sys/arch/m68k/include/kcore.h b/sys/arch/m68k/include/kcore.h
deleted file mode 100644
index 7245009a41b..00000000000
--- a/sys/arch/m68k/include/kcore.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* $OpenBSD: kcore.h,v 1.2 2001/05/15 01:43:14 millert Exp $ */
-/* $NetBSD: kcore.h,v 1.1 1996/03/10 21:55:18 leo Exp $ */
-
-/*
- * Copyright (c) 1996 Leo Weppelman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Leo Weppelman.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _M68K_KCORE_H_
-#define _M68K_KCORE_H_
-
-#define NPHYS_RAM_SEGS 8
-
-typedef struct cpu_kcore_hdr {
- paddr_t kernel_pa; /* Phys. address of kernel VA 0 */
- st_entry_t *sysseg_pa; /* Phys. address of Sysseg */
- int mmutype;
- phys_ram_seg_t ram_segs[NPHYS_RAM_SEGS];
-} cpu_kcore_hdr_t;
-
-#endif /* _M68K_KCORE_H_ */
diff --git a/sys/arch/m68k/include/limits.h b/sys/arch/m68k/include/limits.h
deleted file mode 100644
index 4552b2cb637..00000000000
--- a/sys/arch/m68k/include/limits.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* $OpenBSD: limits.h,v 1.11 2013/08/07 15:34:01 kettenis Exp $ */
-/* $NetBSD: limits.h,v 1.9 1994/10/26 07:50:48 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)limits.h 7.2 (Berkeley) 6/28/90
- */
-
-#include <sys/cdefs.h>
-
-#if __POSIX_VISIBLE || __XPG_VISIBLE
-#ifndef SIZE_MAX
-#define SIZE_MAX ULONG_MAX /* max value for a size_t */
-#endif
-#define SSIZE_MAX LONG_MAX /* max value for a ssize_t */
-#endif
-
-#if __BSD_VISIBLE
-#define SIZE_T_MAX ULONG_MAX /* max value for a size_t (historic) */
-
-#define UQUAD_MAX 0xffffffffffffffffULL /* max unsigned quad */
-#define QUAD_MAX 0x7fffffffffffffffLL /* max signed quad */
-#define QUAD_MIN (-0x7fffffffffffffffLL-1) /* min signed quad */
-
-#endif /* __BSD_VISIBLE */
-
diff --git a/sys/arch/m68k/include/lock.h b/sys/arch/m68k/include/lock.h
deleted file mode 100644
index 93c49df117a..00000000000
--- a/sys/arch/m68k/include/lock.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* $OpenBSD: lock.h,v 1.3 2013/05/21 20:05:30 tedu Exp $ */
-
-/* public domain */
-
-#ifndef _M68K_LOCK_H_
-#define _M68K_LOCK_H_
-
-#include <machine/atomic.h>
-
-#endif /* _M68K_LOCK_H_ */
diff --git a/sys/arch/m68k/include/mutex.h b/sys/arch/m68k/include/mutex.h
deleted file mode 100644
index 1840ec3856c..00000000000
--- a/sys/arch/m68k/include/mutex.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* $OpenBSD: mutex.h,v 1.2 2011/03/23 16:54:35 pirofti Exp $ */
-
-/*
- * Copyright (c) 2004 Artur Grabowski <art@openbsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _M68K_MUTEX_H_
-#define _M68K_MUTEX_H_
-
-/*
- * Simple non-mp implementation.
- */
-struct mutex {
- int mtx_lock;
- int mtx_wantipl;
- int mtx_oldipl;
-};
-
-void mtx_init(struct mutex *, int);
-
-#define MUTEX_INITIALIZER(ipl) { 0, ipl, 0 }
-
-#ifdef DIAGNOSTIC
-#define MUTEX_ASSERT_LOCKED(mtx) do { \
- if ((mtx)->mtx_lock == 0) \
- panic("mutex %p not held in %s", (mtx), __func__); \
-} while (0)
-
-#define MUTEX_ASSERT_UNLOCKED(mtx) do { \
- if ((mtx)->mtx_lock != 0) \
- panic("mutex %p held in %s", (mtx), __func__); \
-} while (0)
-#else
-#define MUTEX_ASSERT_LOCKED(mtx) do { } while (0)
-#define MUTEX_ASSERT_UNLOCKED(mtx) do { } while (0)
-#endif
-
-#define MUTEX_OLDIPL(mtx) (mtx)->mtx_oldipl
-
-#endif
diff --git a/sys/arch/m68k/include/param.h b/sys/arch/m68k/include/param.h
deleted file mode 100644
index 8ac504a3545..00000000000
--- a/sys/arch/m68k/include/param.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* $OpenBSD: param.h,v 1.31 2013/03/26 05:04:10 deraadt Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _M68K_PARAM_H_
-#define _M68K_PARAM_H_
-
-#define _MACHINE_ARCH m68k
-#define MACHINE_ARCH "m68k"
-#define MID_MACHINE MID_M68K
-
-#define PAGE_SIZE (1 << PAGE_SHIFT)
-#define PAGE_MASK (PAGE_SIZE - 1)
-
-#ifdef _KERNEL
-
-#define NPTEPG (PAGE_SIZE / (sizeof(pt_entry_t)))
-
-#define BTOPKERNBASE ((u_long)KERNBASE >> PAGE_SHIFT)
-
-#define NBPG PAGE_SIZE
-#define PGSHIFT PAGE_SHIFT
-#define PGOFSET PAGE_MASK
-
-#define UPAGES 2 /* pages of u-area */
-#define USPACE (UPAGES * PAGE_SIZE) /* total size of u-area */
-#define USPACE_ALIGN 0 /* u-area alignment 0-none */
-
-#define NMBCLUSTERS 4096 /* map size, max cluster allocation */
-
-/*
- * Maximum size of the kernel malloc arena in PAGE_SIZE-sized
- * logical pages.
- */
-#define NKMEMPAGES_MAX_DEFAULT ((64 * 1024 * 1024) >> PAGE_SHIFT)
-
-#include <machine/cpu.h>
-
-#endif /* _KERNEL */
-
-#endif /* _M68K_PARAM_H_ */
diff --git a/sys/arch/m68k/include/pcb.h b/sys/arch/m68k/include/pcb.h
deleted file mode 100644
index d5298e83e90..00000000000
--- a/sys/arch/m68k/include/pcb.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* $OpenBSD: pcb.h,v 1.2 2010/06/29 20:30:32 guenther Exp $ */
-/* $NetBSD: pcb.h,v 1.8 1995/05/12 12:55:17 mycroft Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: pcb.h 1.14 91/03/25$
- *
- * @(#)pcb.h 8.1 (Berkeley) 6/10/93
- */
-
-#ifndef _M68K_PCB_H_
-#define _M68K_PCB_H_
-
-#include <machine/frame.h>
-
-/*
- * m68k process control block
- */
-struct pcb {
- short pcb_flags; /* misc. process flags */
- short pcb_ps; /* processor status word */
- int pcb_ustp; /* user segment table pointer */
- int pcb_usp; /* user stack pointer */
- int pcb_regs[12]; /* D2-D7, A2-A7 */
- caddr_t pcb_onfault; /* for copyin/out faults */
- struct fpframe pcb_fpregs; /* 68881/2 context save area */
-};
-
-/*
- * No additional data needed for core dumps.
- */
-struct md_coredump {
-};
-
-#endif /* _M68K_PCB_H_ */
diff --git a/sys/arch/m68k/include/pmap_motorola.h b/sys/arch/m68k/include/pmap_motorola.h
deleted file mode 100644
index 9c727ddb697..00000000000
--- a/sys/arch/m68k/include/pmap_motorola.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/* $OpenBSD: pmap_motorola.h,v 1.27 2014/01/30 18:16:41 miod Exp $ */
-
-/*
- * Copyright (c) 1987 Carnegie-Mellon University
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pmap.h 8.1 (Berkeley) 6/10/93
- */
-
-#ifndef _M68K_M68K_PMAP_MOTOROLA_H_
-#define _M68K_M68K_PMAP_MOTOROLA_H_
-
-#if !defined(_LOCORE)
-#include <machine/pte.h>
-#endif
-
-#ifdef _KERNEL
-
-#include <machine/cpu.h>
-
-/*
- * Pmap stuff
- */
-struct pmap {
- pt_entry_t *pm_ptab; /* KVA of page table */
- st_entry_t *pm_stab; /* KVA of segment table */
- int pm_stfree; /* 040: free lev2 blocks */
- st_entry_t *pm_stpa; /* 040: ST phys addr */
- short pm_sref; /* segment table ref count */
- short pm_count; /* pmap reference count */
- struct simplelock pm_lock; /* lock on pmap */
- struct pmap_statistics pm_stats; /* pmap statistics */
- long pm_ptpages; /* more stats: PT pages */
-};
-
-typedef struct pmap *pmap_t;
-
-/*
- * On the 040 we keep track of which level 2 blocks are already in use
- * with the pm_stfree mask. Bits are arranged from LSB (block 0) to MSB
- * (block 31). For convenience, the level 1 table is considered to be
- * block 0.
- *
- * MAX[KU]L2SIZE control how many pages of level 2 descriptors are allowed.
- * for the kernel and users. 8 implies only the initial "segment table"
- * page is used. WARNING: don't change MAXUL2SIZE unless you can allocate
- * physically contiguous pages for the ST in pmap.c!
- */
-#define MAXKL2SIZE 32
-#define MAXUL2SIZE 8
-#define l2tobm(n) (1 << (n))
-#define bmtol2(n) (ffs(n) - 1)
-
-/*
- * Macros for speed
- */
-#define PMAP_ACTIVATE(pmap, loadhw) \
-{ \
- if ((loadhw)) \
- loadustp(atop((paddr_t)(pmap)->pm_stpa)); \
-}
-
-/* XXX - struct pv_entry moved to vmparam.h because of include ordering issues */
-
-extern struct pmap kernel_pmap_store;
-
-#define pmap_kernel() (&kernel_pmap_store)
-#define active_pmap(pm) \
- ((pm) == pmap_kernel() || (pm) == curproc->p_vmspace->vm_map.pmap)
-#define active_user_pmap(pm) \
- (curproc && \
- (pm) != pmap_kernel() && (pm) == curproc->p_vmspace->vm_map.pmap)
-
-extern struct pv_entry *pv_table; /* array of entries, one per page */
-
-#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count)
-#define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count)
-
-#define pmap_copy(dp,sp,d,l,s) do { /* nothing */ } while (0)
-#define pmap_update(pmap) do { /* nothing (yet) */ } while (0)
-#define pmap_unuse_final(p) do { /* nothing */ } while (0)
-#define pmap_remove_holes(map) do { /* nothing */ } while (0)
-
-extern pt_entry_t *Sysmap;
-extern char *vmmap; /* map for mem, dumps, etc. */
-
-int pmap_enter_cache(pmap_t, vaddr_t, paddr_t, vm_prot_t, int, pt_entry_t);
-void pmap_kenter_cache(vaddr_t, paddr_t, pt_entry_t);
-
-#define PMAP_GROWKERNEL /* turn on pmap_growkernel interface */
-
-#endif /* _KERNEL */
-
-#ifndef _LOCORE
-
-struct pv_entry {
- struct pv_entry *pv_next; /* next pv_entry */
- struct pmap *pv_pmap; /* pmap where mapping lies */
- vaddr_t pv_va; /* virtual address for mapping */
- st_entry_t *pv_ptste; /* non-zero if VA maps a PT page */
- struct pmap *pv_ptpmap; /* if pv_ptste, pmap for PT page */
- int pv_flags; /* flags */
-};
-
-/*
- * pv_flags carries some PTE permission bits as well - make sure extra flags
- * values are > (1 << PG_SHIFT)
- */
-/* header: all entries are cache inhibited */
-#define PV_CI (0x01 << PG_SHIFT)
-/* header: entry maps a page table page */
-#define PV_PTPAGE (0x02 << PG_SHIFT)
-
-struct vm_page_md {
- struct pv_entry pvent;
-};
-
-#define VM_MDPAGE_INIT(pg) do { \
- (pg)->mdpage.pvent.pv_next = NULL; \
- (pg)->mdpage.pvent.pv_pmap = NULL; \
- (pg)->mdpage.pvent.pv_va = 0; \
- (pg)->mdpage.pvent.pv_ptste = NULL; \
- (pg)->mdpage.pvent.pv_ptpmap = NULL; \
- (pg)->mdpage.pvent.pv_flags = 0; \
-} while (0)
-
-#endif /* _LOCORE */
-
-#endif /* !_M68K_M68K_PMAP_MOTOROLA_H_ */
diff --git a/sys/arch/m68k/include/proc.h b/sys/arch/m68k/include/proc.h
deleted file mode 100644
index dc4799d7a16..00000000000
--- a/sys/arch/m68k/include/proc.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* $OpenBSD: proc.h,v 1.1 2003/10/09 21:48:47 miod Exp $ */
-
-/*
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)proc.h 8.1 (Berkeley) 6/10/93
- */
-
-#ifndef _M68K_PROC_H_
-#define _M68K_PROC_H_
-
-/*
- * Machine-dependent part of the proc structure for m68k.
- */
-struct mdproc {
- int *md_regs; /* registers on current frame */
- int md_flags; /* machine-dependent flags */
-};
-
-/* md_flags */
-#define MDP_STACKADJ 0x0002 /* frame SP adjusted; undo when syscall does ERESTART */
-#define MDP_HPUXMMAP 0x0008 /* VA space is multiply mapped */
-#define MDP_CCBDATA 0x0010 /* copyback caching of data (68040) */
-#define MDP_CCBSTACK 0x0020 /* copyback caching of stack (68040) */
-#define MDP_UNCACHE_WX 0x0040 /* The process might modify code, so
- don't cache writeable executable pages. */
-
-#endif /* _M68K_PROC_H_ */
diff --git a/sys/arch/m68k/include/profile.h b/sys/arch/m68k/include/profile.h
deleted file mode 100644
index c1e42123f80..00000000000
--- a/sys/arch/m68k/include/profile.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* $OpenBSD: profile.h,v 1.7 2013/02/02 13:32:06 miod Exp $ */
-/* $NetBSD: profile.h,v 1.3 1995/03/26 17:08:37 briggs Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)profile.h 8.1 (Berkeley) 6/10/93
- */
-
-#define _MCOUNT_DECL static __inline void _mcount
-
-#define MCOUNT \
-extern void mcount(void) __asm("__mcount"); void mcount() { \
- int selfpc, frompcindex; \
- __asm("movl %%a6@(4),%0" : "=r" (selfpc)); \
- __asm("movl %%a6@(0)@(4),%0" : "=r" (frompcindex)); \
- _mcount(frompcindex, selfpc); \
-}
-
-#ifdef _KERNEL
-/*
- * The following two macros do splhigh and splx respectively.
- * They have to be defined this way because these are real
- * functions on the HP, and we do not want to invoke mcount
- * recursively.
- */
-#define MCOUNT_ENTER \
- __asm("movw %%sr,%0" : "=g" (s)); \
- __asm("movw #0x2700,%sr")
-
-#define MCOUNT_EXIT \
- __asm("movw %0,%%sr" : : "g" (s))
-#endif /* _KERNEL */
diff --git a/sys/arch/m68k/include/psl.h b/sys/arch/m68k/include/psl.h
deleted file mode 100644
index 8b9d5c42ca6..00000000000
--- a/sys/arch/m68k/include/psl.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/* $OpenBSD: psl.h,v 1.10 2013/02/02 13:32:06 miod Exp $ */
-/* $NetBSD: psl.h,v 1.5 1994/10/26 07:50:50 cgd Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)psl.h 8.1 (Berkeley) 6/10/93
- */
-
-#ifndef _M68K_PSL_H_
-#define _M68K_PSL_H_
-
-/*
- * MC680x0 program status word
- */
-
-#define PSL_C 0x0001 /* carry bit */
-#define PSL_V 0x0002 /* overflow bit */
-#define PSL_Z 0x0004 /* zero bit */
-#define PSL_N 0x0008 /* negative bit */
-#define PSL_X 0x0010 /* extend bit */
-#define PSL_ALLCC 0x001F /* all cc bits - unlikely */
-#define PSL_IPL0 0x0000 /* interrupt priority level 0 */
-#define PSL_IPL1 0x0100 /* interrupt priority level 1 */
-#define PSL_IPL2 0x0200 /* interrupt priority level 2 */
-#define PSL_IPL3 0x0300 /* interrupt priority level 3 */
-#define PSL_IPL4 0x0400 /* interrupt priority level 4 */
-#define PSL_IPL5 0x0500 /* interrupt priority level 5 */
-#define PSL_IPL6 0x0600 /* interrupt priority level 6 */
-#define PSL_IPL7 0x0700 /* interrupt priority level 7 */
-#define PSL_M 0x1000 /* master (kernel) sp vs intr sp */
-#define PSL_S 0x2000 /* supervisor enable bit */
-/* PSL_T0 0x4000 ??? T0 on 68020, 8000 is T1 */
-#define PSL_T 0x8000 /* trace enable bit */
-
-#define PSL_LOWIPL (PSL_S)
-#define PSL_HIGHIPL (PSL_S | PSL_IPL7)
-#define PSL_IPL (PSL_IPL7)
-#define PSL_USER (0)
-
-#define PSL_MBZ 0xFFFF58E0 /* must be zero bits */
-
-#define PSL_USERSET (0)
-#define PSL_USERCLR (PSL_S | PSL_IPL7 | PSL_MBZ)
-
-#define USERMODE(ps) (((ps) & PSL_S) == 0)
-
-#ifdef _KERNEL
-
-/*
- * Convert PSL values to CPU IPLs and vice-versa.
- */
-#define PSLTOIPL(x) (((x) >> 8) & 0x7)
-#define IPLTOPSL(x) ((((x) & 0x7) << 8) | PSL_S)
-
-/*
- * spl functions; all but spl0 are done in-line
- */
-
-#define _spl(s) \
-({ \
- register int _spl_r; \
- \
- __asm __volatile ("clrl %0; movew %%sr,%0; movew %1,%%sr" : \
- "=&d" (_spl_r) : "di" (s)); \
- _spl_r; \
-})
-
-#define _splraise(s) \
-({ \
- register int _spl_r; \
- \
- __asm __volatile (" \
- clrl %%d0 ; \
- movw %%sr,%%d0 ; \
- movl %%d0,%0 ; \
- andw #0x700,%%d0 ; \
- movw %1,%%d1 ; \
- andw #0x700,%%d1 ; \
- cmpw %%d0,%%d1 ; \
- jle 1f ; \
- movw %1,%%sr ; \
- 1:" : \
- "=&d" (_spl_r) : \
- "di" (s) : \
- "d0", "d1"); \
- _spl_r; \
-})
-
-#endif /* _KERNEL */
-
-#endif /* _M68K_PSL_H_ */
diff --git a/sys/arch/m68k/include/pte_motorola.h b/sys/arch/m68k/include/pte_motorola.h
deleted file mode 100644
index 3a124fb1ac9..00000000000
--- a/sys/arch/m68k/include/pte_motorola.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/* $OpenBSD: pte_motorola.h,v 1.8 2013/03/25 18:21:02 deraadt Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: pte.h 1.13 92/01/20$
- *
- * @(#)pte.h 8.1 (Berkeley) 6/10/93
- */
-
-#ifndef _M68K_M68K_M68K_PTE_MOTOROLA_H_
-#define _M68K_M68K_M68K_PTE_MOTOROLA_H_
-
-/*
- * m68k hardware with motorola MMU segment/page table entries
- */
-
-typedef int st_entry_t; /* segment table entry */
-typedef int pt_entry_t; /* Mach page table entry */
-
-#define PT_ENTRY_NULL ((pt_entry_t *) 0)
-#define ST_ENTRY_NULL ((st_entry_t *) 0)
-
-#define SG_V 0x00000002 /* segment is valid */
-#define SG_NV 0x00000000
-#define SG_PROT 0x00000004 /* access protection mask */
-#define SG_RO 0x00000004
-#define SG_RW 0x00000000
-#define SG_U 0x00000008 /* modified bit (68040) */
-#define SG_FRAME 0xfffff000
-#define SG_IMASK 0xffc00000
-#define SG_ISHIFT 22
-#define SG_PMASK 0x003ff000
-#define SG_PSHIFT 12
-
-/* 68040 additions */
-#define SG4_MASK1 0xfe000000
-#define SG4_SHIFT1 25
-#define SG4_MASK2 0x01fc0000
-#define SG4_SHIFT2 18
-#define SG4_MASK3 0x0003f000
-#define SG4_SHIFT3 12
-#define SG4_ADDR1 0xfffffe00
-#define SG4_ADDR2 0xffffff00
-#define SG4_LEV1SIZE 128
-#define SG4_LEV2SIZE 128
-#define SG4_LEV3SIZE 64
-
-#define PG_V 0x00000001
-#define PG_NV 0x00000000
-#define PG_PROT 0x00000004
-#define PG_U 0x00000008
-#define PG_M 0x00000010
-#define PG_W 0x00000100
-#define PG_RO 0x00000004
-#define PG_RW 0x00000000
-#define PG_FRAME 0xfffff000
-#define PG_CI 0x00000040
-#define PG_SHIFT 12
-#define PG_PFNUM(x) (((x) & PG_FRAME) >> PG_SHIFT)
-
-/* 68040 additions */
-#define PG_CMASK 0x00000060 /* cache mode mask */
-#define PG_CWT 0x00000000 /* writethrough caching */
-#define PG_CCB 0x00000020 /* copyback caching */
-#define PG_CIS 0x00000040 /* cache inhibited serialized */
-#define PG_CIN 0x00000060 /* cache inhibited nonserialized */
-#define PG_SO 0x00000080 /* supervisor only */
-
-#define M68K_STSIZE (MAXUL2SIZE*SG4_LEV2SIZE*sizeof(st_entry_t))
- /* user process segment table size */
-#define M68K_MAX_PTSIZE 0x400000 /* max size of UPT */
-#define M68K_MAX_KPTSIZE 0x100000 /* max memory to allocate to KPT */
-#define M68K_PTBASE 0x10000000 /* UPT map base address */
-#define M68K_PTMAXSIZE 0x70000000 /* UPT map maximum size */
-
-/*
- * Kernel virtual address to page table entry and to physical address.
- */
-#define kvtopte(va) \
- (&Sysmap[((unsigned)(va) - VM_MIN_KERNEL_ADDRESS) >> PAGE_SHIFT])
-
-#define SEGSHIFT020 (34 - PAGE_SHIFT)
-#define SEGSHIFT040 (18)
-#ifndef SEGSHIFT
-#if defined(M68040) || defined(M68060)
-#if defined(M68020) || defined(M68030)
-#define SEGSHIFT ((mmutype <= MMU_68040) ? SEGSHIFT040 : SEGSHIFT020)
-#else
-#define SEGSHIFT SEGSHIFT040
-#endif
-#else
-#define SEGSHIFT SEGSHIFT020
-#endif
-#define NBSEG (1 << SEGSHIFT)
-#define SEGOFSET (NBSEG - 1)
-#endif
-
-#define m68k_round_seg(x) ((((unsigned)(x)) + SEGOFSET) & ~SEGOFSET)
-#define m68k_trunc_seg(x) ((unsigned)(x) & ~SEGOFSET)
-
-#endif /* !_M68K_M68K_M68K_PTE_MOTOROLA_H_ */
diff --git a/sys/arch/m68k/include/ptrace.h b/sys/arch/m68k/include/ptrace.h
deleted file mode 100644
index 64e982d526e..00000000000
--- a/sys/arch/m68k/include/ptrace.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* $OpenBSD: ptrace.h,v 1.2 1996/05/29 18:38:35 niklas Exp $ */
-/* $NetBSD: ptrace.h,v 1.7 1995/01/26 19:47:10 mycroft Exp $ */
-
-/*
- * Copyright (c) 1993 Christopher G. Demetriou
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christopher G. Demetriou.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _M68K_PTRACE_H_
-#define _M68K_PTRACE_H_
-
-/*
- * m68k-dependent ptrace definitions
- */
-#define PT_STEP (PT_FIRSTMACH + 0)
-#define PT_GETREGS (PT_FIRSTMACH + 1)
-#define PT_SETREGS (PT_FIRSTMACH + 2)
-#define PT_GETFPREGS (PT_FIRSTMACH + 3)
-#define PT_SETFPREGS (PT_FIRSTMACH + 4)
-
-#endif /* !_M68K_PTRACE_H_ */
diff --git a/sys/arch/m68k/include/reg.h b/sys/arch/m68k/include/reg.h
deleted file mode 100644
index 7688399519d..00000000000
--- a/sys/arch/m68k/include/reg.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* $OpenBSD: reg.h,v 1.7 2005/09/25 22:26:13 miod Exp $ */
-/* $NetBSD: reg.h,v 1.12 1996/12/17 19:24:31 gwr Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: reg.h 1.1 90/07/09
- *
- * @(#)reg.h 7.2 (Berkeley) 11/3/90
- */
-
-#ifndef _M68K_REG_H_
-#define _M68K_REG_H_
-
-/*
- * Register set accessible via ptrace()
- */
-struct reg {
- int r_regs[16]; /* D0-D7/A0-A7 */
- int r_sr;
- int r_pc;
-};
-
-struct fpreg {
- int r_regs[8*3]; /* FP0-FP7 */
- int r_fpcr;
- int r_fpsr;
- int r_fpiar;
-};
-
-#ifdef _KERNEL
-
-/* XXX this is historical (but it can't be deprecated quite yet) */
-
-/*
- * Location of the users' stored registers relative to D0.
- */
-#define D0 (0)
-#define D1 (1)
-#define D2 (2)
-#define D3 (3)
-#define D4 (4)
-#define D5 (5)
-#define D6 (6)
-#define D7 (7)
-#define A0 (8)
-#define A1 (9)
-#define A2 (10)
-#define A3 (11)
-#define A4 (12)
-#define A5 (13)
-#define A6 (14)
-#define A7 (15)
-
-#define SP A7
-#define PS (16)
-#define PC (17)
-
-#endif
-
-#endif /* !_M68K_REG_H_ */
diff --git a/sys/arch/m68k/include/reloc.h b/sys/arch/m68k/include/reloc.h
deleted file mode 100644
index a718b9a5973..00000000000
--- a/sys/arch/m68k/include/reloc.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* $OpenBSD: reloc.h,v 1.1 2013/02/02 13:32:06 miod Exp $ */
-/* $NetBSD: elf_machdep.h,v 1.8 2009/05/30 05:56:52 skrll Exp $ */
-
-/* m68k relocation types */
-#define R_68K_NONE 0
-#define R_68K_32 1
-#define R_68K_16 2
-#define R_68K_8 3
-#define R_68K_PC32 4
-#define R_68K_PC16 5
-#define R_68K_PC8 6
-#define R_68K_GOT32 7
-#define R_68K_GOT16 8
-#define R_68K_GOT8 9
-#define R_68K_GOT32O 10
-#define R_68K_GOT16O 11
-#define R_68K_GOT8O 12
-#define R_68K_PLT32 13
-#define R_68K_PLT16 14
-#define R_68K_PLT8 15
-#define R_68K_PLT32O 16
-#define R_68K_PLT16O 17
-#define R_68K_PLT8O 18
-#define R_68K_COPY 19
-#define R_68K_GLOB_DAT 20
-#define R_68K_JMP_SLOT 21
-#define R_68K_RELATIVE 22
-
-/* TLS relocations */
-#define R_68K_TLS_GD32 25
-#define R_68K_TLS_GD16 26
-#define R_68K_TLS_GD8 27
-#define R_68K_TLS_LDM32 28
-#define R_68K_TLS_LDM16 29
-#define R_68K_TLS_LDM8 30
-#define R_68K_TLS_LDO32 31
-#define R_68K_TLS_LDO16 32
-#define R_68K_TLS_LDO8 33
-#define R_68K_TLS_IE32 34
-#define R_68K_TLS_IE16 35
-#define R_68K_TLS_IE8 36
-#define R_68K_TLS_LE32 37
-#define R_68K_TLS_LE16 38
-#define R_68K_TLS_LE8 39
-#define R_68K_TLS_DTPMOD32 40
-#define R_68K_TLS_DTPREL32 41
-#define R_68K_TLS_TPREL32 42
diff --git a/sys/arch/m68k/include/setjmp.h b/sys/arch/m68k/include/setjmp.h
deleted file mode 100644
index cf358816c46..00000000000
--- a/sys/arch/m68k/include/setjmp.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $OpenBSD: setjmp.h,v 1.2 1996/05/29 18:38:36 niklas Exp $ */
-/* $NetBSD: setjmp.h,v 1.1 1994/12/20 10:36:49 cgd Exp $ */
-
-/*
- * machine/setjmp.h: machine dependent setjmp-related information.
- */
-
-#define _JBLEN 17 /* size, in longs, of a jmp_buf */
diff --git a/sys/arch/m68k/include/signal.h b/sys/arch/m68k/include/signal.h
deleted file mode 100644
index b0cc07c865e..00000000000
--- a/sys/arch/m68k/include/signal.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* $OpenBSD: signal.h,v 1.7 2013/04/01 17:18:20 deraadt Exp $ */
-/* $NetBSD: signal.h,v 1.4 1995/01/10 19:01:31 jtc Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1989, 1991 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)signal.h 7.16 (Berkeley) 3/17/91
- */
-
-#ifndef _M68K_SIGNAL_H_
-#define _M68K_SIGNAL_H_
-
-#include <sys/cdefs.h>
-
-typedef int sig_atomic_t;
-
-#ifdef _KERNEL
-/*
- * Get the "code" values
- */
-#include <machine/trap.h>
-#endif
-
-#if __BSD_VISIBLE || __XPG_VISIBLE >= 420
-/*
- * Information pushed on stack when a signal is delivered.
- * This is used by the kernel to restore state following
- * execution of the signal handler. It is also made available
- * to the handler to allow it to restore state properly if
- * a non-standard exit is performed.
- */
-struct sigcontext {
- int __sc_unused;
- int sc_mask; /* signal mask to restore */
- int sc_sp; /* sp to restore */
- int sc_fp; /* fp to restore */
- int sc_ap; /* ap to restore */
- int sc_pc; /* pc to restore */
- int sc_ps; /* psl to restore */
-};
-#endif /* __BSD_VISIBLE || __XPG_VISIBLE >= 420 */
-#endif /* !_M68K_SIGNAL_H_ */
diff --git a/sys/arch/m68k/include/spinlock.h b/sys/arch/m68k/include/spinlock.h
deleted file mode 100644
index 30ba8fbdb70..00000000000
--- a/sys/arch/m68k/include/spinlock.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* $OpenBSD: spinlock.h,v 1.3 2013/06/01 20:47:40 tedu Exp $ */
-
-#ifndef _M68K_SPINLOCK_H_
-#define _M68K_SPINLOCK_H_
-
-#define _ATOMIC_LOCK_UNLOCKED (0)
-#define _ATOMIC_LOCK_LOCKED (1)
-typedef int _atomic_lock_t;
-
-#ifndef _KERNEL
-int _atomic_lock(volatile _atomic_lock_t *);
-#endif
-
-#endif
diff --git a/sys/arch/m68k/include/stdarg.h b/sys/arch/m68k/include/stdarg.h
deleted file mode 100644
index 3a44a425b42..00000000000
--- a/sys/arch/m68k/include/stdarg.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* $OpenBSD: stdarg.h,v 1.12 2014/03/11 19:45:27 guenther Exp $ */
-/* $NetBSD: stdarg.h,v 1.14 1995/12/25 23:15:33 mycroft Exp $ */
-
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)stdarg.h 8.1 (Berkeley) 6/10/93
- */
-
-#ifndef _M68K_STDARG_H_
-#define _M68K_STDARG_H_
-
-#include <sys/cdefs.h>
-#include <machine/_types.h>
-
-typedef __va_list va_list;
-
-#define __va_size(type) \
- (((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long))
-
-#define va_start(ap, last) \
- ((ap) = (va_list)__builtin_next_arg(last))
-
-#define va_arg(ap, type) \
- (*(type *)((ap) += __va_size(type), \
- (ap) - (sizeof(type) < sizeof(long) && \
- sizeof(type) != __va_size(type) ? \
- sizeof(type) : __va_size(type))))
-
-#if __ISO_C_VISIBLE >= 1999
-#define __va_copy(dest, src) \
- ((dest) = (src))
-#endif
-
-#define va_end(ap)
-
-#endif /* !_M68K_STDARG_H_ */
diff --git a/sys/arch/m68k/include/tcb.h b/sys/arch/m68k/include/tcb.h
deleted file mode 100644
index 03109f8a103..00000000000
--- a/sys/arch/m68k/include/tcb.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* $OpenBSD: tcb.h,v 1.1 2011/10/27 04:01:17 guenther Exp $ */
-
-/*
- * Copyright (c) 2011 Philip Guenther <guenther@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef _MACHINE_TCB_H_
-#define _MACHINE_TCB_H_
-
-#ifdef _KERNEL
-
-#error "not yet"
-
-#else /* _KERNEL */
-
-/* Not ELF, so for now use a big TCB to save a memory reference for errno */
-#define TLS_VARIANT 2
-
-#endif /* _KERNEL */
-
-#endif /* _MACHINE_TCB_H_ */
diff --git a/sys/arch/m68k/include/trap.h b/sys/arch/m68k/include/trap.h
deleted file mode 100644
index 14380f5f0ca..00000000000
--- a/sys/arch/m68k/include/trap.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* $OpenBSD: trap.h,v 1.3 2003/06/02 23:27:48 millert Exp $ */
-/* $NetBSD: trap.h,v 1.8 1994/10/26 07:50:56 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: trap.h 1.7 91/03/25$
- *
- * @(#)trap.h 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * Trap codes
- */
-
-#define T_BUSERR 0
-#define T_ADDRERR 1
-#define T_ILLINST 2
-#define T_ZERODIV 3
-#define T_CHKINST 4
-#define T_TRAPVINST 5
-#define T_PRIVINST 6
-#define T_TRACE 7
-#define T_MMUFLT 8
-#define T_SSIR 9
-#define T_FMTERR 10
-#define T_FPERR 11
-#define T_COPERR 12
-#define T_ASTFLT 13
-#define T_TRAP15 15
-#define T_BREAKPOINT T_TRAP15
-#define T_FPEMULI 16
-#define T_FPEMULD 17
-
-#define T_USER 0x80 /* user-mode flag or'ed with type */
-
diff --git a/sys/arch/m68k/include/varargs.h b/sys/arch/m68k/include/varargs.h
deleted file mode 100644
index 95cbae0ae75..00000000000
--- a/sys/arch/m68k/include/varargs.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* $OpenBSD: varargs.h,v 1.5 2003/06/02 23:27:48 millert Exp $ */
-/* $NetBSD: varargs.h,v 1.14 1995/12/26 01:16:28 mycroft Exp $ */
-
-/*-
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)varargs.h 8.2 (Berkeley) 3/22/94
- */
-
-#ifndef _M68K_VARARGS_H_
-#define _M68K_VARARGS_H_
-
-#include <machine/stdarg.h>
-
-#if __GNUC__ == 1
-#define __va_ellipsis
-#else
-#define __va_ellipsis ...
-#endif
-
-#define va_alist __builtin_va_alist
-#define va_dcl long __builtin_va_alist; __va_ellipsis
-
-#undef va_start
-#define va_start(ap) \
- ((ap) = (va_list)&__builtin_va_alist)
-
-#endif /* !_M68K_VARARGS_H_ */
diff --git a/sys/arch/m68k/include/vmparam.h b/sys/arch/m68k/include/vmparam.h
deleted file mode 100644
index c68ac178126..00000000000
--- a/sys/arch/m68k/include/vmparam.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/* $OpenBSD: vmparam.h,v 1.13 2014/01/30 18:16:41 miod Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Machine dependent constants for m68k-based platforms.
- */
-#ifndef _M68K_VMPARAM_H_
-#define _M68K_VMPARAM_H_
-
-/*
- * USRTEXT is the start of the user text/data space, while USRSTACK
- * is the top (end) of the user stack.
- *
- * NOTE: the ONLY reason that USRSTACK is 0xfff00000 instead of -USIZE
- * was for HPUX compatibility. That's been removed, so this could
- * change now.
- */
-#define USRTEXT 8192
-#define USRSTACK 0xfff00000 /* Start of user stack */
-
-/*
- * Virtual memory related constants, all in bytes
- */
-#ifndef MAXTSIZ
-#define MAXTSIZ (8*1024*1024) /* max text size */
-#endif
-#ifndef DFLDSIZ
-#define DFLDSIZ (32*1024*1024) /* initial data size limit */
-#endif
-#ifndef MAXDSIZ
-#define MAXDSIZ (64*1024*1024) /* max data size */
-#endif
-#ifndef BRKSIZ
-#define BRKSIZ MAXDSIZ /* heap gap size */
-#endif
-#ifndef DFLSSIZ
-#define DFLSSIZ (2*1024*1024) /* initial stack size limit */
-#endif
-#ifndef MAXSSIZ
-#define MAXSSIZ MAXDSIZ /* max stack size */
-#endif
-
-#define STACKGAP_RANDOM 256*1024
-
-/*
- * Sizes of the system and user portions of the system page table.
- */
-#define USRPTSIZE (1 * NPTEPG) /* 4mb */
-
-/*
- * PTEs for mapping user space into the kernel for physio operations.
- * One page is enough to handle 4Mb of simultaneous raw IO operations.
- */
-#ifndef USRIOSIZE
-#define USRIOSIZE (1 * NPTEPG) /* 4mb */
-#endif
-
-/*
- * PTEs for system V style shared memory.
- * This is basically slop for kmempt which we actually allocate (malloc) from.
- */
-#ifndef SHMMAXPGS
-#define SHMMAXPGS 1024 /* 4mb */
-#endif
-
-/* user/kernel map constants */
-#define VM_MIN_ADDRESS ((vaddr_t)0)
-#define VM_MAXUSER_ADDRESS ((vaddr_t)(USRSTACK))
-#define VM_MAX_ADDRESS ((vaddr_t)(0-(UPAGES*PAGE_SIZE)))
-#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)0)
-#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)(0-PAGE_SIZE))
-
-/* virtual sizes (bytes) for various kernel submaps */
-#define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE)
-
-/* # of kernel PT pages (initial only, can grow dynamically) */
-#define VM_KERNEL_PT_PAGES ((vsize_t)2)
-
-/*
- * Constants which control the way the VM system deals with memory segments.
- */
-#define VM_PHYSSEG_NOADD
-
-#endif /* !_M68K_VMPARAM_H_ */
diff --git a/sys/arch/m68k/m68k/bcopy.s b/sys/arch/m68k/m68k/bcopy.s
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/sys/arch/m68k/m68k/bcopy.s
+++ /dev/null
diff --git a/sys/arch/m68k/m68k/cachectl.c b/sys/arch/m68k/m68k/cachectl.c
deleted file mode 100644
index e0bb39e0df2..00000000000
--- a/sys/arch/m68k/m68k/cachectl.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/* $OpenBSD: cachectl.c,v 1.2 2010/06/29 20:30:32 guenther Exp $ */
-/* $NetBSD: sys_machdep.c,v 1.17 1997/05/19 10:15:00 veego Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)sys_machdep.c 8.2 (Berkeley) 1/13/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/kernel.h>
-
-#include <machine/cpu.h>
-
-#include <uvm/uvm_extern.h>
-
-/*
- * Note that what we do here for a 68040 is different than HP-UX.
- *
- * In HP-UX they either act on a line (len == 16), a page (len == NBPG)
- * or the whole cache (len == anything else).
- *
- * In BSD we attempt to be more optimal when acting on "odd" sizes.
- * For lengths up to 1024 we do all affected lines, up to 2 * NBPG we
- * do pages, above that we do the entire cache.
- */
-/*ARGSUSED1*/
-int
-cachectl(struct proc *p, int req, vaddr_t addr, int len)
-{
- int error = 0;
-
-#if defined(M68040) || defined(M68060)
- if (mmutype <= MMU_68040) {
- int inc = 0;
- int doall = 0;
- paddr_t pa = 0;
- vaddr_t end = 0;
-
- if (addr == 0 ||
- ((req & ~CC_EXTPURGE) != CC_PURGE && len > 2*NBPG))
- doall = 1;
-
- if (!doall) {
- end = addr + len;
- if (len <= 1024) {
- addr = addr & ~0xF;
- inc = 16;
- } else {
- addr = addr & ~PGOFSET;
- inc = NBPG;
- }
- }
- do {
- /*
- * Convert to physical address if needed.
- * If translation fails, we perform operation on
- * entire cache (XXX is this a rational thing to do?)
- */
- if (!doall &&
- (pa == 0 || ((int)addr & PGOFSET) == 0)) {
- if (pmap_extract(
- p->p_vmspace->vm_map.pmap,
- addr, &pa) == FALSE)
- doall = 1;
- }
- switch (req) {
- case CC_EXTPURGE|CC_IPURGE:
- case CC_IPURGE:
- if (doall) {
- DCFA();
- ICPA();
- } else if (inc == 16) {
- DCFL(pa);
- ICPL(pa);
- } else if (inc == NBPG) {
- DCFP(pa);
- ICPP(pa);
- }
- break;
-
- case CC_EXTPURGE|CC_PURGE:
- case CC_PURGE:
- if (doall)
- DCFA(); /* note: flush not purge */
- else if (inc == 16)
- DCPL(pa);
- else if (inc == NBPG)
- DCPP(pa);
- break;
-
- case CC_EXTPURGE|CC_FLUSH:
- case CC_FLUSH:
- if (doall)
- DCFA();
- else if (inc == 16)
- DCFL(pa);
- else if (inc == NBPG)
- DCFP(pa);
- break;
-
- default:
- error = EINVAL;
- break;
- }
- if (doall)
- break;
- pa += inc;
- addr += inc;
- } while (addr < end);
- return (error);
- }
-#endif
- switch (req) {
- case CC_EXTPURGE|CC_PURGE:
- case CC_EXTPURGE|CC_FLUSH:
-#if defined(CACHE_HAVE_PAC)
- if (ectype == EC_PHYS)
- PCIA();
- /* FALLTHROUGH */
-#endif
- case CC_PURGE:
- case CC_FLUSH:
- DCIU();
- break;
- case CC_EXTPURGE|CC_IPURGE:
-#if defined(CACHE_HAVE_PAC)
- if (ectype == EC_PHYS)
- PCIA();
- else
-#endif
- DCIU();
- /* FALLTHROUGH */
- case CC_IPURGE:
- ICIA();
- break;
- default:
- error = EINVAL;
- break;
- }
- return (error);
-}
diff --git a/sys/arch/m68k/m68k/copy.s b/sys/arch/m68k/m68k/copy.s
deleted file mode 100644
index 3820f117907..00000000000
--- a/sys/arch/m68k/m68k/copy.s
+++ /dev/null
@@ -1,339 +0,0 @@
-/* $OpenBSD: copy.s,v 1.19 2013/02/02 13:32:06 miod Exp $ */
-/* $NetBSD: copy.s,v 1.30 1998/03/04 06:39:14 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1998 Jason R. Thorpe. All rights reserved.
- * Copyright (c) 1994, 1995 Charles Hannum.
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * This file contains the functions for user-space access:
- * copyin/copyout, etc.
- */
-
-#include <machine/asm.h>
-
-#include "assym.h"
-
- .file "copy.s"
- .text
-
-#ifdef DEBUG
-/*
- * The following routines all use the "moves" instruction to access
- * memory with "user" privilege while running in supervisor mode.
- * The "function code" registers actually determine what type of
- * access "moves" does, and the kernel arranges to leave them set
- * for "user data" access when these functions are called.
- *
- * The diagnostics: CHECK_SFC, CHECK_DFC
- * will verify that the sfc/dfc register values are correct.
- */
-Lbadfc:
- PANIC("copy.s: bad sfc or dfc")
- bra Lbadfc
-#define CHECK_SFC movec sfc,d0; subql #FC_USERD,d0; bne Lbadfc
-#define CHECK_DFC movec dfc,d0; subql #FC_USERD,d0; bne Lbadfc
-#else /* DEBUG */
-#define CHECK_SFC
-#define CHECK_DFC
-#endif /* DEBUG */
-
-/*
- * copyin(caddr_t from, caddr_t to, size_t len);
- * Copy len bytes from the user's address space.
- *
- * This is probably not the best we can do, but it is still 2-10 times
- * faster than the C version in the portable gen directory.
- *
- * Things that might help:
- * - unroll the longword copy loop (might not be good for a 68020)
- * - longword align when possible (only on the 68020)
- */
-ENTRY(copyin)
- CHECK_SFC
- movl %sp@(12),%d0 | check count
- beq Lciret | == 0, don't do anything
- movl %d2,%sp@- | save scratch register
- movl _C_LABEL(curpcb),%a0 | set fault handler
- movl #Lcifault,%a0@(PCB_ONFAULT)
- movl %sp@(8),%a0 | src address
- movl %sp@(12),%a1 | dest address
- movl %a0,%d1
- btst #0,%d1 | src address odd?
- beq Lcieven | no, skip alignment
- movsb %a0@+,%d2 | yes, copy a byte
- movb %d2,%a1@+
- subql #1,%d0 | adjust count
- beq Lcidone | count 0, all done
-Lcieven:
- movl %a1,%d1
- btst #0,%d1 | dest address odd?
- bne Lcibytes | yes, must copy bytes
- movl %d0,%d1 | OK, both even. Get count
- lsrl #2,%d1 | and convert to longwords
- beq Lcibytes | count 0, skip longword loop
- subql #1,%d1 | predecrement for dbf
-Lcilloop:
- movsl %a0@+,%d2 | copy a longword
- movl %d2,%a1@+
- dbf %d1,Lcilloop | decrement low word of count
- subil #0x10000,%d1 | decrement high word of count
- bcc Lcilloop
- andl #3,%d0 | what remains
- beq Lcidone | nothing, all done
-Lcibytes:
- subql #1,%d0 | predecrement for dbf
-Lcibloop:
- movsb %a0@+,%d2 | copy a byte
- movb %d2,%a1@+
- dbf %d0,Lcibloop | decrement low word of count
- subil #0x10000,%d0 | decrement high word of count
- bcc Lcibloop
- clrl %d0 | no error
-Lcidone:
- movl _C_LABEL(curpcb),%a0 | clear fault handler
- clrl %a0@(PCB_ONFAULT)
- movl %sp@+,%d2 | restore scratch register
-Lciret:
- rts
-Lcifault:
- moveq #EFAULT,%d0 | got a fault
- bra Lcidone
-
-/*
- * copyout(caddr_t from, caddr_t to, size_t len);
- * Copy len bytes into the user's address space.
- *
- * This is probably not the best we can do, but it is still 2-10 times
- * faster than the C version in the portable gen directory.
- *
- * Things that might help:
- * - unroll the longword copy loop (might not be good for a 68020)
- * - longword align when possible (only on the 68020)
- */
-ENTRY(copyout)
- CHECK_DFC
- movl %sp@(12),%d0 | check count
- beq Lcoret | == 0, don't do anything
- movl %d2,%sp@- | save scratch register
- movl _C_LABEL(curpcb),%a0 | set fault handler
- movl #Lcofault,%a0@(PCB_ONFAULT)
- movl %sp@(8),%a0 | src address
- movl %sp@(12),%a1 | dest address
- movl %a0,%d1
- btst #0,%d1 | src address odd?
- beq Lcoeven | no, skip alignment
- movb %a0@+,%d2 | yes, copy a byte
- movsb %d2,%a1@+
- subql #1,%d0 | adjust count
- beq Lcodone | count 0, all done
-Lcoeven:
- movl %a1,%d1
- btst #0,%d1 | dest address odd?
- bne Lcobytes | yes, must copy bytes
- movl %d0,%d1 | OK, both even. Get count
- lsrl #2,%d1 | and convert to longwords
- beq Lcobytes | count 0, skip longword loop
- subql #1,%d1 | predecrement for dbf
-Lcolloop:
- movl %a0@+,%d2 | copy a longword
- movsl %d2,%a1@+
- dbf %d1,Lcolloop | decrement low word of count
- subil #0x10000,%d1 | decrement high word of count
- bcc Lcolloop
- andl #3,%d0 | what remains
- beq Lcodone | nothing, all done
-Lcobytes:
- subql #1,%d0 | predecrement for dbf
-Lcobloop:
- movb %a0@+,%d2 | copy a byte
- movsb %d2,%a1@+
- dbf %d0,Lcobloop | decrement low word of count
- subil #0x10000,%d0 | decrement high word of count
- bcc Lcobloop
- clrl %d0 | no error
-Lcodone:
- movl _C_LABEL(curpcb),%a0 | clear fault handler
- clrl %a0@(PCB_ONFAULT)
- movl %sp@+,%d2 | restore scratch register
-Lcoret:
- rts
-Lcofault:
- moveq #EFAULT,%d0
- bra Lcodone
-
-/*
- * copystr(caddr_t from, caddr_t to, size_t maxlen, size_t *lencopied);
- * Copy a NUL-terminated string, at most maxlen characters long. Return the
- * number of characters copied (including the NUL) in *lencopied. If the
- * string is too long, return ENAMETOOLONG; else return 0.
- */
-ENTRY(copystr)
- movl %sp@(4),%a0 | a0 = fromaddr
- movl %sp@(8),%a1 | a1 = toaddr
- clrl %d0
- movl %sp@(12),%d1 | count
- beq Lcsdone | nothing to copy
- subql #1,%d1 | predecrement for dbeq
-Lcsloop:
- movb %a0@+,%a1@+ | copy a byte
- dbeq %d1,Lcsloop | decrement low word of count
- beq Lcsdone | copied null, exit
- subil #0x10000,%d1 | decrement high word of count
- bcc Lcsloop | more room, keep going
- moveq #ENAMETOOLONG,%d0 | ran out of space
-Lcsdone:
- tstl %sp@(16) | length desired?
- beq Lcsret
- subl %sp@(4),%a0 | yes, calculate length copied
- movl %sp@(16),%a1 | store at return location
- movl %a0,%a1@
-Lcsret:
- rts
-
-/*
- * copyinstr(caddr_t from, caddr_t to, size_t maxlen, size_t *lencopied);
- * Copy a NUL-terminated string, at most maxlen characters long, from the
- * user's address space. Return the number of characters copied (including
- * the NUL) in *lencopied. If the string is too long, return ENAMETOOLONG;
- * else return 0 or EFAULT.
- */
-ENTRY(copyinstr)
- CHECK_SFC
- movl _C_LABEL(curpcb),%a0 | set fault handler
- movl #Lcisfault,%a0@(PCB_ONFAULT)
- movl %sp@(4),%a0 | a0 = fromaddr
- movl %sp@(8),%a1 | a1 = toaddr
- clrl %d0
- movl %sp@(12),%d1 | count
- beq Lcistoolong | nothing to copy
- subql #1,%d1 | predecrement for dbeq
-Lcisloop:
- movsb %a0@+,%d0 | copy a byte
- movb %d0,%a1@+
- dbeq %d1,Lcisloop | decrement low word of count
- beq Lcisdone | copied null, exit
- subil #0x10000,%d1 | decrement high word of count
- bcc Lcisloop | more room, keep going
-Lcistoolong:
- moveq #ENAMETOOLONG,%d0 | ran out of space
-Lcisnull:
- cmpl %sp@(8),%a1 | do not attempt to clear last byte
- beq Lcisdone | if we faulted on first write
- subql #1, %a1
- clrb %a1@+ | clear last byte
-Lcisdone:
- tstl %sp@(16) | length desired?
- beq Lcisexit
- subl %sp@(4),%a0 | yes, calculate length copied
- movl %sp@(16),%a1 | store at return location
- movl %a0,%a1@
-Lcisexit:
- movl _C_LABEL(curpcb),%a0 | clear fault handler
- clrl %a0@(PCB_ONFAULT)
- rts
-Lcisfault:
- moveq #EFAULT,%d0
- bra Lcisnull
-
-/*
- * copyoutstr(caddr_t from, caddr_t to, size_t maxlen, size_t *lencopied);
- * Copy a NUL-terminated string, at most maxlen characters long, into the
- * user's address space. Return the number of characters copied (including
- * the NUL) in *lencopied. If the string is too long, return ENAMETOOLONG;
- * else return 0 or EFAULT.
- */
-ENTRY(copyoutstr)
- CHECK_DFC
- movl _C_LABEL(curpcb),%a0 | set fault handler
- movl #Lcosfault,%a0@(PCB_ONFAULT)
- movl %sp@(4),%a0 | a0 = fromaddr
- movl %sp@(8),%a1 | a1 = toaddr
- clrl %d0
- movl %sp@(12),%d1 | count
- beq Lcostoolong | nothing to copy
- subql #1,%d1 | predecrement for dbeq
-Lcosloop:
- movb %a0@+,%d0 | copy a byte
- movsb %d0,%a1@+
- dbeq %d1,Lcosloop | decrement low word of count
- beq Lcosdone | copied null, exit
- subil #0x10000,%d1 | decrement high word of count
- bcc Lcosloop | more room, keep going
-Lcostoolong:
- moveq #ENAMETOOLONG,%d0 | ran out of space
-Lcosdone:
- tstl %sp@(16) | length desired?
- beq Lcosexit
- subl %sp@(4),%a0 | yes, calculate length copied
- movl %sp@(16),%a1 | store at return location
- movl %a0,%a1@
-Lcosexit:
- movl _C_LABEL(curpcb),%a0 | clear fault handler
- clrl %a0@(PCB_ONFAULT)
- rts
-Lcosfault:
- moveq #EFAULT,%d0
- bra Lcosdone
-
-/*
- * kcopy(const void *src, void *dst, size_t len);
- *
- * Copy len bytes from src to dst, aborting if we encounter a fatal
- * page fault.
- *
- * kcopy() _must_ save and restore the old fault handler since it is
- * called by uiomove(), which may be in the path of servicing a non-fatal
- * page fault.
- */
-ENTRY(kcopy)
- link %a6,#-4
- movl _C_LABEL(curpcb),%a0 | set fault handler
- movl %a0@(PCB_ONFAULT),%a6@(-4) | save old handler first
- movl #Lkcfault,%a0@(PCB_ONFAULT)
- movl %a6@(16),%sp@- | push len
- movl %a6@(12),%sp@- | push dst
- movl %a6@(8),%sp@- | push src
- jbsr _C_LABEL(bcopy) | copy it
- addl #12,%sp | pop args
- clrl %d0 | success!
-Lkcdone:
- movl _C_LABEL(curpcb),%a0 | restore fault handler
- movl %a6@(-4),%a0@(PCB_ONFAULT)
- unlk %a6
- rts
-Lkcfault:
- addl #16,%sp | pop args and return address
- moveq #EFAULT,%d0 | indicate a fault
- bra Lkcdone
diff --git a/sys/arch/m68k/m68k/copypage.s b/sys/arch/m68k/m68k/copypage.s
deleted file mode 100644
index e931bc9766c..00000000000
--- a/sys/arch/m68k/m68k/copypage.s
+++ /dev/null
@@ -1,112 +0,0 @@
-/* $OpenBSD: copypage.s,v 1.6 2013/02/02 13:32:06 miod Exp $ */
-/* $NetBSD: copypage.s,v 1.4 1997/05/30 01:34:49 jtc Exp $ */
-
-/*-
- * Copyright (c) 1997 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by J.T. Conklin <jtc@netbsd.org> and
- * by Hiroshi Horitomo <horimoto@cs-aoi.cs.sist.ac.jp>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Optimized functions for copying/clearing a whole page.
- */
-
-#include <machine/asm.h>
-#include "assym.h"
-
- .file "copypage.s"
- .text
-
-/*
- * copypage040(fromaddr, toaddr)
- *
- * Optimized version of bcopy for a single page-aligned NBPG byte copy,
- * using instructions only available on the mc68040 and later.
- */
-#if defined(M68040) || defined(M68060)
-ENTRY(copypage040)
- movl %sp@(4),%a0 | source address
- movl %sp@(8),%a1 | destination address
- movw #NBPG/32-1,%d0 | number of 32 byte chunks - 1
-Lm16loop:
- .long 0xf6209000 | move16 a0@+,a1@+
- .long 0xf6209000 | move16 a0@+,a1@+
- dbf %d0,Lm16loop
- rts
-#endif /* M68040 || M68060 */
-
-/*
- * copypage(fromaddr, toaddr)
- *
- * Optimized version of bcopy for a single page-aligned NBPG byte copy.
- */
-ENTRY(copypage)
- movl %sp@(4),%a0 | source address
- movl %sp@(8),%a1 | destination address
- movw #NBPG/32-1,%d0 | number of 32 byte chunks - 1
-Lmlloop:
- movl %a0@+,%a1@+
- movl %a0@+,%a1@+
- movl %a0@+,%a1@+
- movl %a0@+,%a1@+
- movl %a0@+,%a1@+
- movl %a0@+,%a1@+
- movl %a0@+,%a1@+
- movl %a0@+,%a1@+
- dbf %d0,Lmlloop
- rts
-
-/*
- * zeropage(addr)
- *
- * Optimized version of bzero for a single page-aligned NBPG byte zero.
- */
-ENTRY(zeropage)
- movl %sp@(4),%a0 | dest address
- movql #NBPG/256-1,%d0 | number of 256 byte chunks - 1
- movml %d2-%d7,%sp@-
- movql #0,%d1
- movql #0,%d2
- movql #0,%d3
- movql #0,%d4
- movql #0,%d5
- movql #0,%d6
- movql #0,%d7
- movl %d1,%a1
- lea %a0@(NBPG),%a0
-Lzloop:
- movml %d1-%d7/%a1,%a0@-
- movml %d1-%d7/%a1,%a0@-
- movml %d1-%d7/%a1,%a0@-
- movml %d1-%d7/%a1,%a0@-
- movml %d1-%d7/%a1,%a0@-
- movml %d1-%d7/%a1,%a0@-
- movml %d1-%d7/%a1,%a0@-
- movml %d1-%d7/%a1,%a0@-
- dbf %d0,Lzloop
- movml %sp@+,%d2-%d7
- rts
diff --git a/sys/arch/m68k/m68k/db_disasm.c b/sys/arch/m68k/m68k/db_disasm.c
deleted file mode 100644
index 8074603083b..00000000000
--- a/sys/arch/m68k/m68k/db_disasm.c
+++ /dev/null
@@ -1,3229 +0,0 @@
-/* $OpenBSD: db_disasm.c,v 1.12 2012/11/21 21:28:26 miod Exp $ */
-/* $NetBSD: db_disasm.c,v 1.19 1996/10/30 08:22:39 is Exp $ */
-
-/*
- * Copyright (c) 1994 Christian E. Hopps
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christian E. Hopps.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * Notes:
- *
- * Much can be done with this format, with a lot of hacking even
- * a moto emul. could be built. However things like symbol lookup
- * and reference are needed right away.
- *
- * the only functions that use the "get_xxx()" notation should be
- * ones that modify things in a dis_buffer_t besides the buffers.
- * (namely the used field)
- *
- * An attempt has been made to *always* increment dbuf->used++ immediately
- * after referencing a value beyond the current "short *" address.
- * this meant either only referencing the value once or placing it in
- * a local var. If you play with this keep this style. Its very useful
- * in eliminating a very easy to make hard to find logic error.
- *
- * I broke style in 2 ways with one macro ``addchar()''
- * However it makes sense, consider that it is called *a lot* and
- * commonly with things like ","'s
- *
- * *dbuf->casm++ = ','; || ADDCHAR(dbuf,','); || addchar(dbuf,',');
- * I chose:
- * addchar(',');
- *
- * If this is not enough to convince you, please load up you emacs or
- * vi and do a fancy regex-replace, and compare for yourself.
- * (The 2 rules of style I broke if you failed to notice are:
- * 1: lower case macro name 2: implicit reference to local var name.)
- *
- * (chopps - March 1, 1994)
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-
-#include <machine/db_machdep.h>
-
-#include <ddb/db_sym.h>
-#include <ddb/db_output.h>
-#include <m68k/m68k/db_disasm.h>
-
-void get_modregstr(dis_buffer_t *, int, int, int, int);
-void get_immed(dis_buffer_t *, int);
-void get_fpustdGEN(dis_buffer_t *, u_short, const char *);
-void addstr(dis_buffer_t *, const char *s);
-void prints(dis_buffer_t *, int, int);
-void printu(dis_buffer_t *, u_int, int);
-void prints_wb(dis_buffer_t *, int, int, int);
-void printu_wb(dis_buffer_t *, u_int, int, int);
-void prints_bf(dis_buffer_t *, int, int, int);
-void printu_bf(dis_buffer_t *, u_int, int, int);
-void iaddstr(dis_buffer_t *, const char *s);
-void iprints(dis_buffer_t *, int, int);
-void iprintu(dis_buffer_t *, u_int, int);
-void iprints_wb(dis_buffer_t *, int, int, int);
-void iprintu_wb(dis_buffer_t *, u_int, int, int);
-void make_cond(dis_buffer_t *, int , char *);
-void print_fcond(dis_buffer_t *, char);
-void print_mcond(dis_buffer_t *, char);
-void print_disp(dis_buffer_t *, int, int, int);
-void print_addr(dis_buffer_t *, u_long, int);
-void print_reglist(dis_buffer_t *, int, u_short);
-void print_freglist(dis_buffer_t *, int, u_short, int);
-void print_fcode(dis_buffer_t *, u_short);
-
-/* groups */
-void opcode_bitmanip(dis_buffer_t *, u_short);
-void opcode_move(dis_buffer_t *, u_short);
-void opcode_misc(dis_buffer_t *, u_short);
-void opcode_branch(dis_buffer_t *, u_short);
-void opcode_coproc(dis_buffer_t *, u_short);
-void opcode_0101(dis_buffer_t *, u_short);
-void opcode_1000(dis_buffer_t *, u_short);
-void opcode_addsub(dis_buffer_t *, u_short);
-void opcode_1010(dis_buffer_t *, u_short);
-void opcode_1011(dis_buffer_t *, u_short);
-void opcode_1100(dis_buffer_t *, u_short);
-void opcode_1110(dis_buffer_t *, u_short);
-void opcode_fpu(dis_buffer_t *, u_short);
-void opcode_mmu(dis_buffer_t *, u_short);
-void opcode_mmu040(dis_buffer_t *, u_short);
-void opcode_move16(dis_buffer_t *, u_short);
-
-/* subs of groups */
-void opcode_movec(dis_buffer_t *, u_short);
-void opcode_divmul(dis_buffer_t *, u_short);
-void opcode_movem(dis_buffer_t *, u_short);
-void opcode_fmove_ext(dis_buffer_t *, u_short, u_short);
-void opcode_pmove(dis_buffer_t *, u_short, u_short);
-void opcode_pflush(dis_buffer_t *, u_short, u_short);
-
-#define addchar(ch) (*dbuf->casm++ = ch)
-#define iaddchar(ch) (*dbuf->cinfo++ = ch)
-
-typedef void dis_func_t(dis_buffer_t *, u_short);
-
-dis_func_t *const opcode_map[16] = {
- opcode_bitmanip, opcode_move, opcode_move, opcode_move,
- opcode_misc, opcode_0101, opcode_branch, opcode_move,
- opcode_1000, opcode_addsub, opcode_1010, opcode_1011,
- opcode_1100, opcode_addsub, opcode_1110, opcode_coproc
-};
-
-const char *const cc_table[16] = {
- "t", "f", "hi", "ls",
- "cc", "cs", "ne", "eq",
- "vc", "vs", "pl", "mi",
- "ge", "lt", "gt", "le"
-};
-
-const char *const fpcc_table[32] = {
- "f", "eq", "ogt", "oge", "olt", "ole", "ogl", "or",
- "un", "ueq", "ugt", "uge", "ult", "ule", "ne", "t",
- "sf", "seq", "gt", "ge", "lt", "le", "gl", "gle",
- "ngle", "ngl", "nle", "nlt", "nge", "ngt", "sne", "st" };
-
-const char *const mmcc_table[16] = {
- "bs", "bc", "ls", "lc", "ss", "sc", "as", "sc",
- "ws", "wc", "is", "ic", "gs", "gc", "cs", "cc" };
-
-
-const char *const aregs[8] = {"a0","a1","a2","a3","a4","a5","a6","sp"};
-const char *const dregs[8] = {"d0","d1","d2","d3","d4","d5","d6","d7"};
-const char *const fpregs[8] = {
- "fp0","fp1","fp2","fp3","fp4","fp5","fp6","fp7" };
-const char *const fpcregs[3] = { "fpiar", "fpsr", "fpcr" };
-
-/*
- * Disassemble intruction at location ``loc''.
- * Returns location of next instruction.
- */
-
-static char asm_buffer[256];
-static char info_buffer[256];
-
-db_addr_t
-db_disasm(loc, moto_syntax)
- db_addr_t loc;
- boolean_t moto_syntax;
-{
- u_short opc;
- dis_func_t *func;
- dis_buffer_t dbuf;
-
- dbuf.casm = dbuf.dasm = asm_buffer;
- dbuf.cinfo = dbuf.info = info_buffer;
- dbuf.used = 0;
- dbuf.val = (short *)loc;
- dbuf.mit = moto_syntax ? 0 : 1;
-
- dbuf.dasm[0] = 0;
- dbuf.info[0] = 0;
-
- opc = *dbuf.val;
- dbuf.used++;
-
- func = opcode_map[OPCODE_MAP(opc)];
- func(&dbuf, opc);
-
- db_printf("%s",asm_buffer);
- if (info_buffer[0])
- db_printf("\t[%s]\n",info_buffer);
- else
- db_printf("\n");
- return (loc + sizeof(short)*dbuf.used);
-}
-/*
- * Bit manipulation/MOVEP/Immediate.
- */
-void
-opcode_bitmanip(dbuf, opc)
- dis_buffer_t *dbuf;
- u_short opc;
-{
- char *tmp;
- u_short ext;
- int sz;
-
- tmp = NULL;
-
- switch (opc) {
- case ANDITOCCR_INST:
- tmp = "andib\t";
- break;
- case ANDIROSR_INST:
- tmp = "andiw\t";
- break;
- case EORITOCCR_INST:
- tmp = "eorib\t";
- break;
- case EORITOSR_INST:
- tmp = "eoriw\t";
- break;
- case ORITOCCR_INST:
- tmp = "orib\t";
- break;
- case ORITOSR_INST:
- tmp = "oriw\t";
- break;
- }
- if (tmp) {
- addstr(dbuf, tmp);
- if (ISBITSET(opc,6)) {
- get_immed(dbuf, SIZE_WORD);
- addstr(dbuf, ",sr");
- } else {
- get_immed(dbuf, SIZE_BYTE);
- addstr(dbuf, ",ccr");
- }
- return;
- }
-
- if (IS_INST(RTM,opc)) {
- addstr(dbuf, "rtm\t");
- if (ISBITSET(opc,3))
- PRINT_AREG(dbuf, BITFIELD(opc,2,0));
- else
- PRINT_DREG(dbuf, BITFIELD(opc,2,0));
- return;
- }
-
- if (IS_INST(MOVEP,opc)) {
- addstr(dbuf, "movp");
- if (ISBITSET(opc,6))
- addchar('l');
- else
- addchar('w');
- addchar('\t');
- if (ISBITSET(opc,7)) {
- PRINT_DREG(dbuf, BITFIELD(opc, 11, 9));
- addchar(',');
- }
- PRINT_AREG(dbuf, BITFIELD(opc, 2, 0));
- addchar('@');
- addchar('(');
- print_disp(dbuf, *(dbuf->val + 1), SIZE_WORD,
- BITFIELD(opc, 2, 0));
- dbuf->used++;
- addchar(')');
- if (!ISBITSET(opc,7)) {
- addchar(',');
- PRINT_DREG(dbuf, BITFIELD(opc, 11, 9));
- }
- return;
- }
-
- switch (opc & BCHGD_MASK) {
- case BCHGD_INST:
- tmp = "bchg\t";
- break;
- case BCLRD_INST:
- tmp = "bclr\t";
- break;
- case BSETD_INST:
- tmp = "bset\t";
- break;
- case BTSTD_INST:
- tmp = "btst\t";
- break;
- }
- if (tmp) {
- addstr(dbuf, tmp);
- PRINT_DREG(dbuf, BITFIELD(opc,11,9));
- addchar(',');
- get_modregstr(dbuf,5,GETMOD_BEFORE,0,0);
- return;
- }
-
- switch (opc & BCHGS_MASK) {
- case BCHGS_INST:
- tmp = "bchg\t";
- break;
- case BCLRS_INST:
- tmp = "bclr\t";
- break;
- case BSETS_INST:
- tmp = "bset\t";
- break;
- case BTSTS_INST:
- tmp = "btst\t";
- break;
- }
- if (tmp) {
- addstr(dbuf, tmp);
- get_immed(dbuf, SIZE_BYTE);
- addchar(',');
- get_modregstr(dbuf, 5, GETMOD_BEFORE, 0, 1);
- return;
- }
-
- if (IS_INST(CAS2,opc)) {
- u_short ext2;
-
- ext = *(dbuf->val + 1);
- ext2 = *(dbuf->val + 2);
- dbuf->used += 2;
-
- if (ISBITSET(opc,9))
- addstr(dbuf, "cas2l\t");
- else
- addstr(dbuf, "cas2w\t");
-
- PRINT_DREG(dbuf, BITFIELD(ext,2,0));
- addchar(':');
- PRINT_DREG(dbuf, BITFIELD(ext2,2,0));
- addchar(',');
-
- PRINT_DREG(dbuf, BITFIELD(ext,8,6));
- addchar(':');
- PRINT_DREG(dbuf, BITFIELD(ext2,8,6));
- addchar(',');
-
- if (ISBITSET(ext,15))
- PRINT_AREG(dbuf, BITFIELD(ext,14,12));
- else
- PRINT_DREG(dbuf, BITFIELD(ext,14,12));
- addchar('@');
- addchar(':');
- if (ISBITSET(ext2,15))
- PRINT_AREG(dbuf, BITFIELD(ext2,14,12));
- else
- PRINT_DREG(dbuf, BITFIELD(ext2,14,12));
- addchar('@');
- return;
- }
-
- switch (opc & CAS_MASK) {
- case CAS_INST:
- ext = *(dbuf->val + 1);
- dbuf->used++;
-
- addstr(dbuf,"cas");
- sz = BITFIELD(opc,10,9);
- if (sz == 0) {
- sz = SIZE_BYTE;
- addchar('b');
- } else if (sz == 1) {
- sz = SIZE_WORD;
- addchar('w');
- } else {
- sz = SIZE_LONG;
- addchar('l');
- }
- addchar('\t');
- PRINT_DREG(dbuf, BITFIELD(ext, 2, 0));
- addchar(',');
- PRINT_DREG(dbuf, BITFIELD(ext, 8, 6));
- addchar(',');
- get_modregstr(dbuf, 5, GETMOD_BEFORE, sz, 1);
- return;
- case CHK2_INST:
- /* case CMP2_INST: */
- ext = *(dbuf->val + 1);
- dbuf->used++;
-
- if (ISBITSET(ext,11))
- addstr(dbuf,"chk2");
- else
- addstr(dbuf,"cmp2");
-
- sz = BITFIELD(opc,10,9);
- if (sz == 0) {
- sz = SIZE_BYTE;
- addchar('b');
- } else if (sz == 1) {
- sz = SIZE_WORD;
- addchar('w');
- } else {
- sz = SIZE_LONG;
- addchar('l');
- }
- addchar('\t');
- get_modregstr(dbuf, 5, GETMOD_BEFORE, sz, 1);
-
- addchar(',');
- if(ISBITSET(ext,15))
- PRINT_AREG(dbuf, BITFIELD(ext, 14, 12));
- else
- PRINT_DREG(dbuf, BITFIELD(ext, 14, 12));
- return;
- }
-
- switch (ADDI_MASK & opc) {
- case MOVES_INST:
- addstr(dbuf, "movs");
- sz = BITFIELD(opc,7,6);
- if (sz == 0) {
- addchar('b');
- sz = SIZE_BYTE;
- } else if (sz == 1) {
- addchar('w');
- sz = SIZE_WORD;
- } else {
- addchar ('l');
- sz = SIZE_LONG;
- }
- addchar('\t');
-
- ext = *(dbuf->val + 1);
- dbuf->used++;
-
- if (ISBITSET(ext,11)) {
- if (ISBITSET(ext,15))
- PRINT_AREG(dbuf,BITFIELD(ext,14,12));
- else
- PRINT_DREG(dbuf,BITFIELD(ext,14,12));
- addchar(',');
- get_modregstr(dbuf, 5, GETMOD_BEFORE, sz, 1);
- } else {
- get_modregstr(dbuf, 5, GETMOD_BEFORE, sz, 1);
- addchar(',');
- if (ISBITSET(ext,15))
- PRINT_AREG(dbuf,BITFIELD(ext,14,12));
- else
- PRINT_DREG(dbuf,BITFIELD(ext,14,12));
- }
- return;
- case ADDI_INST:
- tmp = "addi";
- break;
- case ANDI_INST:
- tmp = "andi";
- break;
- case CMPI_INST:
- tmp = "cmpi";
- break;
- case EORI_INST:
- tmp = "eori";
- break;
- case ORI_INST:
- tmp = "ori";
- break;
- case SUBI_INST:
- tmp = "subi";
- break;
- }
- if (tmp) {
- addstr(dbuf, tmp);
- sz = BITFIELD(opc,7,6);
- switch (sz) {
- case 0:
- addchar('b');
- addchar('\t');
- sz = SIZE_BYTE;
- break;
- case 1:
- addchar('w');
- addchar('\t');
- sz = SIZE_WORD;
- break;
- case 2:
- addchar ('l');
- addchar('\t');
- get_immed(dbuf,SIZE_LONG);
- addchar(',');
- get_modregstr(dbuf,5,GETMOD_BEFORE,SIZE_LONG,2);
- return;
- }
- get_immed(dbuf,sz);
- addchar(',');
- get_modregstr(dbuf,5,GETMOD_BEFORE,sz,1);
- return;
- }
-}
-
-/*
- * move byte/word/long and q
- * 00xx (01==.b 10==.l 11==.w) and 0111(Q)
- */
-void
-opcode_move(dbuf, opc)
- dis_buffer_t *dbuf;
- u_short opc;
-{
- int sz, lused;
-
- sz = 0;
- switch (OPCODE_MAP(opc)) {
- case 0x1: /* move.b */
- sz = SIZE_BYTE;
- break;
- case 0x3: /* move.w */
- sz = SIZE_WORD;
- break;
- case 0x2: /* move.l */
- sz = SIZE_LONG;
- break;
- case 0x7: /* moveq */
- addstr(dbuf, "movq\t#");
- prints_bf(dbuf, opc, 7, 0);
- addchar(',');
- PRINT_DREG(dbuf,BITFIELD(opc,11,9));
- return;
- }
- addstr(dbuf, "mov");
-
- if (BITFIELD(opc,8,6) == AR_DIR)
- addchar('a');
-
- if (sz == SIZE_BYTE)
- addchar('b');
- else if (sz == SIZE_WORD)
- addchar('w');
- else
- addchar('l');
-
- addchar('\t');
- lused = dbuf->used;
- get_modregstr(dbuf, 5, GETMOD_BEFORE, sz, 0);
- addchar(',');
- get_modregstr(dbuf, 11, GETMOD_AFTER, sz, dbuf->used - lused);
-}
-
-/*
- * misc opcodes.
- */
-void
-opcode_misc(dbuf, opc)
- dis_buffer_t *dbuf;
- u_short opc;
-{
- char *tmp;
- int sz;
-
- tmp = NULL;
-
- /* Check against no option instructions */
- switch (opc) {
- case BGND_INST:
- tmp = "bgnd";
- break;
- case ILLEGAL_INST:
- tmp = "illegal";
- break;
- case MOVEFRC_INST:
- case MOVETOC_INST:
- opcode_movec(dbuf, opc);
- return;
- case NOP_INST:
- tmp = "nop";
- break;
- case RESET_INST:
- tmp = "reset";
- break;
- case RTD_INST:
- addstr(dbuf, "rtd\t");
- get_immed(dbuf, SIZE_WORD);
- return;
- case RTE_INST:
- tmp = "rte";
- break;
- case RTR_INST:
- tmp = "rtr";
- break;
- case RTS_INST:
- tmp = "rts";
- break;
- case STOP_INST:
- addstr(dbuf, "stop\t");
- get_immed(dbuf, SIZE_WORD);
- return;
- case TRAPV_INST:
- tmp = "trapv";
- break;
- default:
- break;
- }
- if (tmp) {
- addstr(dbuf, tmp);
- return;
- }
-
- switch (opc & BKPT_MASK) {
- case BKPT_INST:
- addstr(dbuf, "bkpt\t#");
- printu_bf(dbuf, opc, 2, 0);
- return;
- case EXTBW_INST:
- addstr(dbuf, "extw\t");
- get_modregstr(dbuf,2,DR_DIR,0,0);
- return;
- case EXTWL_INST:
- addstr(dbuf, "extl\t");
- get_modregstr(dbuf,2,DR_DIR,0,0);
- return;
- case EXTBL_INST:
- addstr(dbuf, "extbl\t");
- get_modregstr(dbuf,2,DR_DIR,0,0);
- return;
- case LINKW_INST:
- case LINKL_INST:
- if ((LINKW_MASK & opc) == LINKW_INST) {
- addstr(dbuf, "linkw\t");
- get_modregstr(dbuf, 2, AR_DIR, 0, 1);
- } else {
- addstr(dbuf, "linkl\t");
- get_modregstr(dbuf, 2, AR_DIR, 0, 2);
- }
- addchar(',');
- if ((LINKW_MASK & opc) == LINKW_INST)
- get_immed(dbuf, SIZE_WORD);
- else
- get_immed(dbuf,SIZE_LONG);
- return;
- case MOVETOUSP_INST:
- case MOVEFRUSP_INST:
- addstr(dbuf, "movl\t");
- if (!ISBITSET(opc,3)) {
- get_modregstr(dbuf, 2, AR_DIR, 0, 0);
- addchar(',');
- }
- addstr(dbuf, "usp");
- if (ISBITSET(opc,3)) {
- addchar(',');
- get_modregstr(dbuf, 2, AR_DIR, 0, 0);
- }
- return;
- case SWAP_INST:
- addstr(dbuf, "swap\t");
- get_modregstr(dbuf, 2, DR_DIR, 0, 0);
- return;
- case UNLK_INST:
- addstr(dbuf, "unlk\t");
- get_modregstr(dbuf, 2, AR_DIR, 0, 0);
- return;
- }
-
- if ((opc & TRAP_MASK) == TRAP_INST) {
- addstr(dbuf, "trap\t#");
- printu_bf(dbuf, opc, 3, 0);
- return;
- }
-
- sz = 0;
- switch (DIVSL_MASK & opc) {
- case DIVSL_INST:
- case MULSL_INST:
- opcode_divmul(dbuf, opc);
- return;
- case JMP_INST:
- tmp = "jmp\t";
- break;
- case JSR_INST:
- tmp = "jsr\t";
- break;
- case MOVEFRCCR_INST:
- tmp = "mov\tccr,";
- break;
- case MOVEFRSR_INST:
- tmp = "mov\tsr,";
- break;
- case NBCD_INST:
- tmp = "nbcd\t";
- break;
- case PEA_INST:
- tmp = "pea\t";
- break;
- case TAS_INST:
- tmp = "tas\t";
- break;
- case MOVETOCCR_INST:
- case MOVETOSR_INST:
- tmp = "mov\t";
- sz = SIZE_WORD;
- break;
- }
- if (tmp) {
- addstr(dbuf, tmp);
- get_modregstr(dbuf,5, GETMOD_BEFORE, sz, 0);
- if(IS_INST(MOVETOSR,opc))
- addstr(dbuf, ",sr");
- else if(IS_INST(MOVETOCCR,opc))
- addstr(dbuf, ",ccr");
- return;
- }
-
- if ((opc & MOVEM_MASK) == MOVEM_INST) {
- opcode_movem(dbuf, opc);
- return;
- }
-
- switch (opc & CLR_MASK) {
- case CLR_INST:
- tmp = "clr";
- break;
- case NEG_INST:
- tmp = "neg";
- break;
- case NEGX_INST:
- tmp = "negx";
- break;
- case NOT_INST:
- tmp = "not";
- break;
- case TST_INST:
- tmp = "tst";
- break;
- }
- if (tmp) {
- int sz, msz;
-
- addstr(dbuf, tmp);
-
- msz = BITFIELD(opc,7,6);
- if (msz == 0) {
- tmp = "b\t";
- sz = SIZE_BYTE;
- } else if (msz == 1) {
- tmp = "w\t";
- sz = SIZE_WORD;
- } else {
- tmp = "l\t";
- sz = SIZE_LONG;
- }
- addstr(dbuf, tmp);
- get_modregstr(dbuf, 5, GETMOD_BEFORE, sz, 0);
- return;
- }
-
- if ((opc & LEA_MASK) == LEA_INST) {
- addstr(dbuf, "lea\t");
- get_modregstr(dbuf, 5, GETMOD_BEFORE, SIZE_LONG, 0);
- addchar(',');
- get_modregstr(dbuf, 11, AR_DIR, 0, 0);
- return;
- } else if ((opc & CHK_MASK) == CHK_INST) {
- if (BITFIELD(opc,8,7) == 0x3) {
- addstr(dbuf, "chkw\t");
- get_modregstr(dbuf, 5, GETMOD_BEFORE, SIZE_WORD, 0);
- } else {
- addstr(dbuf, "chkl\t");
- get_modregstr(dbuf, 5, GETMOD_BEFORE, SIZE_LONG, 0);
- }
- addchar(',');
- get_modregstr(dbuf, 11, DR_DIR, 0, 0);
- return;
- }
-}
-
-/*
- * ADDQ/SUBQ/Scc/DBcc/TRAPcc
- */
-void
-opcode_0101(dbuf, opc)
- dis_buffer_t *dbuf;
- u_short opc;
-{
- int data;
-
- if (IS_INST(TRAPcc, opc) && BITFIELD(opc,2,0) > 1) {
- int opmode;
-
- opmode = BITFIELD(opc,2,0);
- make_cond(dbuf,11,"trap");
-
- if (opmode == 0x2) {
- addchar('w');
- addchar('\t');
- get_immed(dbuf, SIZE_WORD);
- } else if (opmode == 0x3) {
- addchar('l');
- addchar('\t');
- get_immed(dbuf, SIZE_LONG);
- }
- return;
- } else if (IS_INST(DBcc, opc)) {
- make_cond(dbuf,11,"db");
- addchar('\t');
- PRINT_DREG(dbuf, BITFIELD(opc,2,0));
- addchar(',');
- print_disp(dbuf, *(dbuf->val + 1), SIZE_WORD, -1);
- dbuf->used++;
- return;
- } else if (IS_INST(Scc,opc)) {
- make_cond(dbuf,11,"s");
- addchar('\t');
- get_modregstr(dbuf, 5, GETMOD_BEFORE, SIZE_BYTE, 0);
- return;
- } else if (IS_INST(ADDQ, opc) || IS_INST(SUBQ, opc)) {
- int size = BITFIELD(opc,7,6);
-
- if (IS_INST(SUBQ, opc))
- addstr(dbuf, "subq");
- else
- addstr(dbuf, "addq");
-
- if (size == 0x1)
- addchar('w');
- else if (size == 0x2)
- addchar('l');
- else
- addchar('b');
-
- addchar('\t');
- addchar('#');
- data = BITFIELD(opc,11,9);
- if (data == 0)
- data = 8;
- printu(dbuf, data, SIZE_BYTE);
- addchar(',');
- get_modregstr(dbuf, 5, GETMOD_BEFORE, 0, 0);
-
- return;
- }
-}
-
-/*
- * Bcc/BSR/BRA
- */
-void
-opcode_branch(dbuf, opc)
- dis_buffer_t *dbuf;
- u_short opc;
-{
- int disp, sz;
-
- if (IS_INST(BRA,opc))
- addstr(dbuf, "bra");
- else if (IS_INST(BSR,opc))
- addstr(dbuf, "bsr");
- else
- make_cond(dbuf,11,"b");
-
- disp = BITFIELD(opc,7,0);
- if (disp == 0) {
- /* 16-bit signed displacement */
- disp = *(dbuf->val + 1);
- dbuf->used++;
- sz = SIZE_WORD;
- addchar('w');
- } else if (disp == 0xff) {
- /* 32-bit signed displacement */
- disp = *(long *)(dbuf->val + 1);
- dbuf->used += 2;
- sz = SIZE_LONG;
- addchar('l');
- } else {
- /* 8-bit signed displacement in opcode. */
- /* Needs to be sign-extended... */
- if (ISBITSET(disp,7))
- disp -= 256;
- sz = SIZE_BYTE;
- addchar('b');
- }
- addchar('\t');
- print_addr(dbuf, disp + (u_long)dbuf->val + 2, 0);
-}
-
-/*
- * ADD/ADDA/ADDX/SUB/SUBA/SUBX
- */
-void
-opcode_addsub(dbuf, opc)
- dis_buffer_t *dbuf;
- u_short opc;
-{
- int sz, ch, amode;
-
- sz = BITFIELD(opc,7,6);
- amode = 0;
-
- if (sz == 0) {
- ch = 'b';
- sz = SIZE_BYTE;
- } else if (sz == 1) {
- ch = 'w';
- sz = SIZE_WORD;
- } else if (sz == 2) {
- ch = 'l';
- sz = SIZE_LONG;
- } else {
- amode = 1;
- if (!ISBITSET(opc,8)) {
- sz = SIZE_WORD;
- ch = 'w';
- } else {
- sz = SIZE_LONG;
- ch = 'l';
- }
- }
-
- if (!amode && (IS_INST(ADDX,opc) || IS_INST(SUBX,opc))) {
- if (IS_INST(ADDX,opc))
- addstr(dbuf,"addx");
- else
- addstr(dbuf,"subx");
-
- addchar(ch);
- addchar('\t');
-
- if (ISBITSET(opc,3)) {
- PRINT_AREG(dbuf,BITFIELD(opc,2,0));
- addchar('@');
- addchar('-');
- addchar(',');
- PRINT_AREG(dbuf,BITFIELD(opc,11,9));
- addchar('@');
- addchar('-');
- } else {
- PRINT_DREG(dbuf,BITFIELD(opc,2,0));
- addchar(',');
- PRINT_DREG(dbuf,BITFIELD(opc,11,9));
- }
- } else {
- if (IS_INST(ADD,opc))
- addstr(dbuf, "add");
- else
- addstr(dbuf, "sub");
-
- if (amode)
- addchar('a');
- addchar(ch);
- addchar('\t');
-
- if (ISBITSET(opc,8) && amode == 0) {
- PRINT_DREG(dbuf,BITFIELD(opc,11,9));
- addchar(',');
- get_modregstr(dbuf, 5, GETMOD_BEFORE, sz, 0);
- } else {
- get_modregstr(dbuf, 5, GETMOD_BEFORE, sz, 0);
- addchar(',');
- if (amode)
- PRINT_AREG(dbuf,BITFIELD(opc,11,9));
- else
- PRINT_DREG(dbuf,BITFIELD(opc,11,9));
- }
- }
- return;
-}
-
-/*
- * Shift/Rotate/Bit Field
- */
-void
-opcode_1110(dbuf, opc)
- dis_buffer_t *dbuf;
- u_short opc;
-{
- char *tmp;
- u_short ext;
- int type, sz;
-
- tmp = NULL;
-
- switch (opc & BFCHG_MASK) {
- case BFCHG_INST:
- tmp = "bfchg";
- break;
- case BFCLR_INST:
- tmp = "bfclr";
- break;
- case BFEXTS_INST:
- tmp = "bfexts";
- break;
- case BFEXTU_INST:
- tmp = "bfextu";
- break;
- case BFFFO_INST:
- tmp = "bfffo";
- break;
- case BFINS_INST:
- tmp = "bfins";
- break;
- case BFSET_INST:
- tmp = "bfset";
- break;
- case BFTST_INST:
- tmp = "bftst";
- break;
- }
- if (tmp) {
- short bf;
-
- addstr(dbuf, tmp);
- addchar('\t');
-
- ext = *(dbuf->val + 1);
- dbuf->used++;
-
- if (IS_INST(BFINS,opc)) {
- PRINT_DREG(dbuf, BITFIELD(ext,14,12));
- addchar(',');
- }
- get_modregstr(dbuf, 5, GETMOD_BEFORE, 0, 1);
- addchar('{');
-
- bf = BITFIELD(ext,10,6);
- if (ISBITSET(ext, 11))
- PRINT_DREG(dbuf, bf);
- else
- printu_wb(dbuf, bf, SIZE_BYTE, 10);
-
- addchar(':');
-
- bf = BITFIELD(ext, 4, 0);
- if (ISBITSET(ext, 5))
- PRINT_DREG(dbuf, bf);
- else {
- if (bf == 0)
- bf = 32;
- printu_wb(dbuf, bf, SIZE_BYTE, 10);
- }
- addchar('}');
- if (ISBITSET(opc,8) && !IS_INST(BFINS,opc)) {
- addchar(',');
- PRINT_DREG(dbuf, BITFIELD(ext,14,12));
- } else
- *dbuf->casm = 0;
- return;
- }
- sz = BITFIELD(opc,7,6);
- if (sz == 0x3)
- type = BITFIELD(opc, 10, 9);
- else
- type = BITFIELD(opc, 4, 3);
-
- switch (type) {
- case AS_TYPE:
- addchar('a');
- addchar('s');
- break;
- case LS_TYPE:
- addchar('l');
- addchar('s');
- break;
- case RO_TYPE:
- addchar('r');
- addchar('o');
- break;
- case ROX_TYPE:
- addchar('r');
- addchar('o');
- addchar('x');
- break;
- }
-
- if (ISBITSET(opc,8))
- addchar('l');
- else
- addchar('r');
-
- switch (sz) {
- case 0:
- sz = SIZE_BYTE;
- addchar('b');
- break;
- case 3:
- case 1:
- sz = SIZE_WORD;
- addchar('w');
- break;
- case 2:
- sz = SIZE_LONG;
- addchar('l');
- break;
-
- }
- addchar('\t');
- if(BITFIELD(opc,7,6) == 0x3) {
- get_modregstr(dbuf, 5, GETMOD_BEFORE, sz, 0);
- return;
- } else if (ISBITSET(opc,5))
- PRINT_DREG(dbuf, BITFIELD(opc,11,9));
- else {
- addchar('#');
- sz = BITFIELD(opc,11,9);
- if (sz == 0)
- sz = 8;
- printu_wb(dbuf, sz, SIZE_BYTE, 10);
- }
- addchar(',');
- PRINT_DREG(dbuf, BITFIELD(opc,2,0));
- return;
-}
-
-/*
- * CMP/CMPA/EOR
- */
-void
-opcode_1011(dbuf, opc)
- dis_buffer_t *dbuf;
- u_short opc;
-{
- int sz;
-
- if (IS_INST(CMPA,opc)) {
- addstr(dbuf, "cmpa");
-
- if (ISBITSET(opc, 8)) {
- addchar('l');
- sz = SIZE_LONG;
- } else {
- addchar('w');
- sz = SIZE_WORD;
- }
- addchar('\t');
- } else {
- if (IS_INST(CMP, opc))
- addstr(dbuf, "cmp");
- else
- addstr(dbuf, "eor");
-
- sz = BITFIELD(opc,7,6);
- switch (sz) {
- case 0:
- addchar('b');
- sz = SIZE_BYTE;
- break;
- case 1:
- addchar('w');
- sz = SIZE_WORD;
- break;
- case 2:
- addchar('l');
- sz = SIZE_LONG;
- break;
- }
- addchar('\t');
- if (IS_INST(EOR,opc)) {
- PRINT_DREG(dbuf, BITFIELD(opc,11,9));
- addchar(',');
- }
- }
- get_modregstr(dbuf, 5, GETMOD_BEFORE, sz, 0);
-
- if (IS_INST(CMPA,opc)) {
- addchar(',');
- PRINT_AREG(dbuf, BITFIELD(opc,11,9));
- } else if (IS_INST(CMP,opc)) {
- addchar(',');
- PRINT_DREG(dbuf, BITFIELD(opc,11,9));
- }
- return;
-}
-
-/*
- * OR/DIV/SBCD
- */
-void
-opcode_1000(dbuf, opc)
- dis_buffer_t *dbuf;
- u_short opc;
-{
- int sz;
-
- if (IS_INST(UNPKA,opc)) {
- addstr(dbuf, "unpk\t");
- PRINT_AREG(dbuf,BITFIELD(opc,2,0));
- addstr(dbuf, "@-,");
- PRINT_AREG(dbuf,BITFIELD(opc,11,9));
- addstr(dbuf, "@-,");
- get_immed(dbuf,SIZE_WORD);
- } else if (IS_INST(UNPKD,opc)) {
- addstr(dbuf, "unpk\t");
- PRINT_DREG(dbuf,BITFIELD(opc,2,0));
- addchar(',');
- PRINT_DREG(dbuf,BITFIELD(opc,11,9));
- addchar(',');
- get_immed(dbuf,SIZE_WORD);
- } else if (IS_INST(SBCDA,opc)) {
- addstr(dbuf, "sbcd\t");
- PRINT_AREG(dbuf,BITFIELD(opc,2,0));
- addstr(dbuf, "@-,");
- PRINT_AREG(dbuf,BITFIELD(opc,11,9));
- addstr(dbuf, "@-");
- } else if (IS_INST(SBCDA,opc)) {
- addstr(dbuf, "sbcd\t");
- PRINT_DREG(dbuf,BITFIELD(opc,2,0));
- addchar(',');
- PRINT_DREG(dbuf,BITFIELD(opc,11,9));
- } else if (IS_INST(DIVSW,opc) || IS_INST(DIVUW,opc)) {
- if (IS_INST(DIVSW,opc))
- addstr(dbuf, "divsw\t");
- else
- addstr(dbuf, "divuw\t");
- get_modregstr(dbuf, 5, GETMOD_BEFORE, SIZE_WORD, 0);
- addchar(',');
- PRINT_DREG(dbuf, BITFIELD(opc,11,9));
- } else {
- addstr(dbuf, "or");
-
- sz = BITFIELD(opc,7,6);
- switch (sz) {
- case 0:
- addchar('b');
- sz = SIZE_BYTE;
- break;
- case 1:
- addchar('w');
- sz = SIZE_WORD;
- break;
- case 2:
- addchar('l');
- sz = SIZE_LONG;
- break;
- }
- addchar('\t');
- if (ISBITSET(opc,8)) {
- PRINT_DREG(dbuf, BITFIELD(opc,11,9));
- addchar(',');
- }
- get_modregstr(dbuf, 5, GETMOD_BEFORE, sz, 0);
- if (!ISBITSET(opc,8)) {
- addchar(',');
- PRINT_DREG(dbuf, BITFIELD(opc,11,9));
- }
- }
-}
-
-/*
- * AND/MUL/ABCD/EXG (1100)
- */
-void
-opcode_1100(dbuf, opc)
- dis_buffer_t *dbuf;
- u_short opc;
-{
- int sz;
-
- if (IS_INST(ABCDA,opc)) {
- addstr(dbuf, "abcd\t");
- PRINT_AREG(dbuf,BITFIELD(opc,2,0));
- addstr(dbuf, "@-,");
- PRINT_AREG(dbuf,BITFIELD(opc,11,9));
- addstr(dbuf, "@-");
- } else if (IS_INST(ABCDA,opc)) {
- addstr(dbuf, "abcd\t");
- PRINT_DREG(dbuf,BITFIELD(opc,2,0));
- addchar(',');
- PRINT_DREG(dbuf,BITFIELD(opc,11,9));
- } else if (IS_INST(MULSW,opc) || IS_INST(MULUW,opc)) {
- if (IS_INST(MULSW,opc))
- addstr(dbuf, "mulsw\t");
- else
- addstr(dbuf, "muluw\t");
- get_modregstr(dbuf, 5, GETMOD_BEFORE, SIZE_WORD, 0);
- addchar(',');
- PRINT_DREG(dbuf, BITFIELD(opc,11,9));
- } else if (IS_INST(EXG,opc)) {
- addstr(dbuf, "exg\t");
- if (ISBITSET(opc,7)) {
- PRINT_DREG(dbuf,BITFIELD(opc,11,9));
- addchar(',');
- PRINT_AREG(dbuf,BITFIELD(opc,2,0));
- } else if (ISBITSET(opc,3)) {
- PRINT_AREG(dbuf,BITFIELD(opc,11,9));
- addchar(',');
- PRINT_AREG(dbuf,BITFIELD(opc,2,0));
- } else {
- PRINT_DREG(dbuf,BITFIELD(opc,11,9));
- addchar(',');
- PRINT_DREG(dbuf,BITFIELD(opc,2,0));
- }
- } else {
- addstr(dbuf, "and");
-
- sz = BITFIELD(opc,7,6);
- switch (sz) {
- case 0:
- addchar('b');
- sz = SIZE_BYTE;
- break;
- case 1:
- addchar('w');
- sz = SIZE_WORD;
- break;
- case 2:
- addchar('l');
- sz = SIZE_LONG;
- break;
- }
- addchar('\t');
-
- if (ISBITSET(opc,8)) {
- PRINT_DREG(dbuf, BITFIELD(opc,11,9));
- addchar(',');
- }
- get_modregstr(dbuf, 5, GETMOD_BEFORE, sz, 0);
- if (!ISBITSET(opc,8)) {
- addchar(',');
- PRINT_DREG(dbuf, BITFIELD(opc,11,9));
- }
- }
-}
-
-/*
- * Coprocessor instruction
- */
-void
-opcode_coproc(dbuf, opc)
- dis_buffer_t *dbuf;
- u_short opc;
-{
- switch (BITFIELD(*dbuf->val,11,9)) {
- case 1:
- opcode_fpu(dbuf, opc);
- return;
- case 0:
- opcode_mmu(dbuf, opc);
- return;
- case 2:
- opcode_mmu040(dbuf, opc);
- return;
- case 3:
- opcode_move16(dbuf, opc);
- return;
- }
- switch (BITFIELD(opc,8,6)) {
- case 0:
- dbuf->used++;
- break;
- case 3:
- dbuf->used++;
- /*FALLTHROUGH*/
- case 2:
- dbuf->used++;
- break;
- case 1:
- dbuf->used++;
- case 4:
- case 5:
- default:
- break;
- }
- addstr(dbuf, "UNKNOWN COPROC OPCODE");
- return;
-}
-
-/*
- * Resvd
- */
-void
-opcode_1010(dbuf, opc)
- dis_buffer_t *dbuf;
- u_short opc;
-{
- addstr(dbuf, "RSVD");
- dbuf->used++;
-}
-
-void
-opcode_fpu(dbuf, opc)
- dis_buffer_t *dbuf;
- u_short opc;
-{
- u_short ext;
- int type, opmode;
-
- type = BITFIELD(opc,8,6);
- switch (type) {
- /* cpGEN */
- case 0:
- ext = *(dbuf->val + 1);
- dbuf->used++;
- opmode = BITFIELD(ext,5,0);
-
- if (BITFIELD(opc,5,0) == 0 && BITFIELD(ext,15,10) == 0x17) {
- addstr(dbuf,"fmovcrx #");
- printu(dbuf,BITFIELD(ext,6,0),SIZE_BYTE);
- return;
- }
- if (ISBITSET(ext,15) || ISBITSET(ext,13)) {
- opcode_fmove_ext(dbuf, opc, ext);
- return;
- }
-
- switch(opmode) {
- case FMOVE:
- get_fpustdGEN(dbuf,ext,"fmov");
- return;
- case FABS:
- get_fpustdGEN(dbuf,ext,"fabs");
- return;
- case FACOS:
- get_fpustdGEN(dbuf,ext,"facos");
- return;
- case FADD:
- get_fpustdGEN(dbuf,ext,"fadd");
- return;
- case FASIN:
- get_fpustdGEN(dbuf,ext,"fasin");
- return;
- case FATAN:
- get_fpustdGEN(dbuf,ext,"fatan");
- return;
- case FATANH:
- get_fpustdGEN(dbuf,ext,"fatanh");
- return;
- case FCMP:
- get_fpustdGEN(dbuf,ext,"fcmp");
- return;
- case FCOS:
- get_fpustdGEN(dbuf,ext,"fcos");
- return;
- case FCOSH:
- get_fpustdGEN(dbuf,ext,"fcosh");
- return;
- case FDIV:
- get_fpustdGEN(dbuf,ext,"fdiv");
- return;
- case FETOX:
- get_fpustdGEN(dbuf,ext,"fetox");
- return;
- case FGETEXP:
- get_fpustdGEN(dbuf,ext,"fgetexp");
- return;
- case FGETMAN:
- get_fpustdGEN(dbuf,ext,"fgetman");
- return;
- case FINT:
- get_fpustdGEN(dbuf,ext,"fint");
- return;
- case FINTRZ:
- get_fpustdGEN(dbuf,ext,"fintrz");
- return;
- case FLOG10:
- get_fpustdGEN(dbuf,ext,"flog10");
- return;
- case FLOG2:
- get_fpustdGEN(dbuf,ext,"flog2");
- return;
- case FLOGN:
- get_fpustdGEN(dbuf,ext,"flogn");
- return;
- case FLOGNP1:
- get_fpustdGEN(dbuf,ext,"flognp1");
- return;
- case FMOD:
- get_fpustdGEN(dbuf,ext,"fmod");
- return;
- case FMUL:
- get_fpustdGEN(dbuf,ext,"fmul");
- return;
- case FNEG:
- get_fpustdGEN(dbuf,ext,"fneg");
- return;
- case FREM:
- get_fpustdGEN(dbuf,ext,"frem");
- return;
- case FSCALE:
- get_fpustdGEN(dbuf,ext,"fscale");
- return;
- case FSGLDIV:
- get_fpustdGEN(dbuf,ext,"fsgldiv");
- return;
- case FSGLMUL:
- get_fpustdGEN(dbuf,ext,"fsglmul");
- return;
- case FSIN:
- get_fpustdGEN(dbuf,ext,"fsin");
- return;
- case FSINH:
- get_fpustdGEN(dbuf,ext,"fsinh");
- return;
- case FSQRT:
- get_fpustdGEN(dbuf,ext,"fsqrt");
- return;
- case FSUB:
- get_fpustdGEN(dbuf,ext,"fsub");
- return;
- case FTAN:
- get_fpustdGEN(dbuf,ext,"ftan");
- return;
- case FTANH:
- get_fpustdGEN(dbuf,ext,"ftanh");
- return;
- case FTENTOX:
- get_fpustdGEN(dbuf,ext,"ftentox");
- return;
- case FTST:
- get_fpustdGEN(dbuf,ext,"ftst");
- return;
- case FTWOTOX:
- get_fpustdGEN(dbuf,ext,"ftwotox");
- return;
-
- }
- /* cpBcc */
- case 2:
- if (BITFIELD(opc,5,0) == 0 && *(dbuf->val + 1) == 0) {
- dbuf->used++;
- addstr (dbuf, "fnop");
- return;
- }
- case 3:
- addstr(dbuf, "fb");
- print_fcond(dbuf, BITFIELD(opc,5,0));
- if (type == 2) {
- addchar('w');
- addchar('\t');
- print_disp(dbuf,*(dbuf->val + 1), SIZE_WORD, -1);
- dbuf->used++;
- } else {
- addchar('l');
- addchar('\t');
- print_disp(dbuf,*(long *)(dbuf->val + 1), SIZE_LONG,
- -1);
- dbuf->used += 2;
- }
- return;
- /* cpDBcc/cpScc/cpTrap */
- case 1:
- ext = *(dbuf->val + 1);
- dbuf->used++;
-
- if (BITFIELD(opc,5,3) == 0x1) {
- /* fdbcc */
- addstr(dbuf,"fdb");
- print_fcond(dbuf,BITFIELD(ext,5,0));
- addchar('\t');
- PRINT_DREG(dbuf, BITFIELD(opc,2,0));
- addchar(',');
- print_disp(dbuf, *(dbuf->val + 2), SIZE_WORD, -1);
- dbuf->used++;
- } else if (BITFIELD(opc,5,3) == 0x7 &&
- BITFIELD(opc,2,0) > 1) {
- addstr(dbuf,"ftrap");
- print_fcond(dbuf,BITFIELD(ext,5,0));
-
- if (BITFIELD(opc,2,0) == 0x2) {
- addchar('w');
- addchar('\t');
- dbuf->val++;
- get_immed(dbuf, SIZE_WORD);
- dbuf->val--;
- } else if (BITFIELD(opc,2,0) == 0x3) {
- addchar('l');
- addchar('\t');
- dbuf->val++;
- get_immed(dbuf, SIZE_LONG);
- dbuf->val--;
- }
- } else {
- addstr(dbuf,"fs");
- print_fcond(dbuf,BITFIELD(ext,5,0));
- addchar('\t');
- get_modregstr(dbuf, 5, GETMOD_BEFORE, SIZE_BYTE, 1);
- }
- return;
- case 4:
- addstr(dbuf,"fsave\t");
- get_modregstr(dbuf, 5, GETMOD_BEFORE, 0, 0);
- return;
- case 5:
- addstr(dbuf,"frestor\t");
- get_modregstr(dbuf, 5, GETMOD_BEFORE, 0, 0);
- return;
- }
-}
-
-/*
- * XXX - This screws up on: fmovem a0@(312),fpcr/fpsr/fpi
- */
-void
-opcode_fmove_ext(dbuf, opc, ext)
- dis_buffer_t *dbuf;
- u_short opc, ext;
-{
- int sz;
-
- sz = 0;
- if (BITFIELD(ext,15,13) == 3) {
- /* fmove r ==> m */
- addstr(dbuf, "fmov");
- switch (BITFIELD(ext,12,10)) {
- case 0:
- addchar('l');
- sz = SIZE_LONG;
- break;
- case 1:
- addchar('s');
- sz = SIZE_SINGLE;
- break;
- case 2:
- addchar('x');
- sz = SIZE_EXTENDED;
- break;
- case 7:
- case 3:
- addchar('p');
- sz = SIZE_PACKED;
- break;
- case 4:
- addchar('w');
- sz = SIZE_WORD;
- break;
- case 5:
- addchar('d');
- sz = SIZE_DOUBLE;
- break;
- case 6:
- addchar('b');
- sz = SIZE_BYTE;
- break;
- }
- addchar('\t');
- PRINT_FPREG(dbuf, BITFIELD(ext,9,7));
- addchar(',');
- get_modregstr(dbuf, 5, GETMOD_BEFORE, sz, 1);
- if (sz == SIZE_PACKED) {
- addchar('{');
- if (ISBITSET(ext,12)) {
- PRINT_DREG(dbuf,BITFIELD(ext,6,4));
- } else {
- addchar('#');
- prints_bf(dbuf, ext, 6, 4);
- }
- addchar('}');
- }
- return;
- }
- addstr(dbuf,"fmovm");
-
- if (!ISBITSET(ext,14)) {
- /* fmove[m] control reg */
- addchar('l');
- addchar('\t');
-
- if (ISBITSET(ext,13)) {
- print_freglist(dbuf, AR_DEC, BITFIELD(ext,12,10), 1);
- addchar(',');
- }
- get_modregstr(dbuf, 5, GETMOD_BEFORE, SIZE_LONG, 1);
- if (!ISBITSET(ext,13)) {
- addchar(',');
- print_freglist(dbuf, AR_DEC, BITFIELD(ext,12,10), 1);
- }
- return;
- }
- addchar('x');
- addchar('\t');
-
- if (ISBITSET(ext,11)) {
- if (ISBITSET(ext,13)) {
- PRINT_DREG(dbuf,BITFIELD(ext,6,4));
- addchar(',');
- }
- get_modregstr(dbuf, 5, GETMOD_BEFORE, SIZE_EXTENDED, 1);
- if (!ISBITSET(ext,13)) {
- addchar(',');
- PRINT_DREG(dbuf,BITFIELD(ext,6,4));
- }
- } else {
- if (ISBITSET(ext,13)) {
- print_freglist(dbuf, BITFIELD(opc,5,3),
- BITFIELD(ext,7,0), 0);
- addchar(',');
- }
- get_modregstr(dbuf, 5, GETMOD_BEFORE, SIZE_EXTENDED, 1);
- if (!ISBITSET(ext,13)) {
- addchar(',');
- print_freglist(dbuf, BITFIELD(opc,5,3),
- BITFIELD(ext,7,0), 0);
- }
- }
-}
-
-void
-opcode_mmu(dbuf, opc)
- dis_buffer_t *dbuf;
- u_short opc;
-{
- u_short ext;
- int type;
-
- type = BITFIELD(opc,8,6);
- switch (type) {
- /* cpGEN? */
- case 0:
- ext = *(dbuf->val + 1);
- dbuf->used++;
-
- switch(BITFIELD(ext,15,13)) {
- case 5:
- case 1:
- opcode_pflush(dbuf, opc, ext);
- return;
- case 0:
- case 3:
- case 2:
- opcode_pmove(dbuf, opc, ext);
- return;
- case 4:
- addstr(dbuf, "ptest");
- if (ISBITSET(ext,9))
- addchar('r');
- else
- addchar('w');
- addchar('\t');
- print_fcode(dbuf, BITFIELD(ext, 5, 0));
- addchar(',');
- get_modregstr(dbuf, 5, GETMOD_BEFORE, 0, 1);
- addchar(',');
- addchar('#');
- printu_bf(dbuf, ext, 12, 10);
- if (ISBITSET(ext, 8)) {
- addchar(',');
- PRINT_AREG(dbuf, BITFIELD(ext, 7, 5));
- }
- }
- return;
- case 2:
- case 3:
- addstr(dbuf, "pb");
- print_mcond(dbuf, BITFIELD(opc,5,0));
- if (type == 2) {
- addchar('w');
- addchar('\t');
- print_disp(dbuf,*(dbuf->val + 1), SIZE_WORD, -1);
- dbuf->used++;
- } else {
- addchar('l');
- addchar('\t');
- print_disp(dbuf,*(long *)(dbuf->val + 1), SIZE_LONG,
- -1);
- dbuf->used += 2;
- }
- return;
- case 1:
- ext = *(dbuf->val + 1);
- dbuf->used++;
-
- if (BITFIELD(opc,5,3) == 0x1) {
- /* fdbcc */
- addstr(dbuf,"pdb");
- print_fcond(dbuf,BITFIELD(ext,5,0));
- addchar('\t');
- PRINT_DREG(dbuf, BITFIELD(opc,2,0));
- addchar(',');
- print_disp(dbuf, *(dbuf->val + 2), SIZE_WORD, -1);
- dbuf->used++;
- } else if (BITFIELD(opc,5,3) == 0x7 &&
- BITFIELD(opc,2,0) > 1) {
- addstr(dbuf,"ptrap");
- print_fcond(dbuf,BITFIELD(ext,5,0));
-
- if (BITFIELD(opc,2,0) == 0x2) {
- addchar('w');
- addchar('\t');
- dbuf->val++;
- get_immed(dbuf, SIZE_WORD);
- dbuf->val--;
- } else if (BITFIELD(opc,2,0) == 0x3) {
- addchar('l');
- addchar('\t');
- dbuf->val++;
- get_immed(dbuf, SIZE_LONG);
- dbuf->val--;
- }
- } else {
- addstr(dbuf,"ps");
- print_fcond(dbuf,BITFIELD(ext,5,0));
- addchar('\t');
- get_modregstr(dbuf, 5, GETMOD_BEFORE, SIZE_BYTE, 1);
- }
- return;
- case 4:
- addstr(dbuf,"psave\t");
- get_modregstr(dbuf, 5, GETMOD_BEFORE, 0, 0);
- return;
- case 5:
- addstr(dbuf,"prestore\t");
- get_modregstr(dbuf, 5, GETMOD_BEFORE, 0, 0);
- return;
- }
-}
-
-void
-opcode_pflush(dbuf, opc, ext)
- dis_buffer_t *dbuf;
- u_short opc, ext;
-{
- u_short mode, mask, fc;
-
- mode = BITFIELD(ext,12,10);
- mask = BITFIELD(ext,8,5);
- fc = BITFIELD(ext, 5, 0);
-
- if (ext == 0xa000) {
- addstr(dbuf,"pflushr\t");
- get_modregstr(dbuf, 5, GETMOD_BEFORE, SIZE_LONG, 1);
- return;
- }
-
- if (mode == 0) {
- addstr(dbuf,"pload");
- if (ISBITSET(ext,9))
- addchar('r');
- else
- addchar('w');
- addchar(' ');
- print_fcode(dbuf, fc);
- }
-
- addstr(dbuf,"pflush");
- switch (mode) {
- case 1:
- addchar('a');
- *dbuf->casm = 0;
- break;
- case 7:
- case 5:
- addchar('s');
- /*FALLTHROUGH*/
- case 6:
- case 4:
- addchar('\t');
- print_fcode(dbuf, fc);
- addchar(',');
- addchar('#');
- printu(dbuf, mask, SIZE_BYTE);
- if (!ISBITSET(mode,1))
- break;
- addchar(',');
- get_modregstr(dbuf, 5, GETMOD_BEFORE, SIZE_LONG, 1);
- }
-}
-
-void
-opcode_pmove(dbuf, opc, ext)
- dis_buffer_t *dbuf;
- u_short opc, ext;
-{
- const char *reg;
- int rtom, sz, preg;
-
- reg = "???";
- sz = 0;
- rtom = ISBITSET(ext, 9);
- preg = BITFIELD(ext, 12, 10);
-
- addstr(dbuf,"pmov");
- if (ISBITSET(ext,8)) {
- addchar('f');
- addchar('d');
- }
- switch (BITFIELD(ext, 15, 13)) {
- case 0: /* tt regs 030o */
- switch (preg) {
- case 2:
- reg = "tt0";
- break;
- case 3:
- reg = "tt1";
- break;
- }
- sz = SIZE_LONG;
- break;
- case 2:
- switch (preg) {
- case 0:
- reg = "tc";
- sz = SIZE_LONG;
- break;
- case 1:
- reg = "drp";
- sz = SIZE_QUAD;
- break;
- case 2:
- reg = "srp";
- sz = SIZE_QUAD;
- break;
- case 3:
- reg = "crp";
- sz = SIZE_QUAD;
- break;
- case 4:
- reg = "cal";
- sz = SIZE_BYTE;
- break;
- case 5:
- reg = "val";
- sz = SIZE_BYTE;
- break;
- case 6:
- reg = "scc";
- sz = SIZE_BYTE;
- break;
- case 7:
- reg = "ac";
- sz = SIZE_WORD;
- }
- break;
- case 3:
- switch (preg) {
- case 0:
- reg = "mmusr";
- break;
- case 1:
- reg = "pcsr";
- break;
- case 4:
- reg = "bad";
- break;
- case 5:
- reg = "bac";
- break;
- }
- sz = SIZE_WORD;
- break;
- }
- switch (sz) {
- case SIZE_BYTE:
- addchar ('b');
- break;
- case SIZE_WORD:
- addchar ('w');
- break;
- case SIZE_LONG:
- addchar ('l');
- break;
- case SIZE_QUAD:
- addchar ('d');
- break;
- }
- addchar('\t');
-
- if (!rtom) {
- get_modregstr(dbuf, 5, GETMOD_BEFORE, sz, 1);
- addchar(',');
- }
- addstr(dbuf, reg);
- if (BITFIELD(ext, 15, 13) == 3 && preg > 1)
- printu_bf(dbuf, ext, 4, 2);
- if (rtom) {
- addchar(',');
- get_modregstr(dbuf, 5, GETMOD_BEFORE, sz, 1);
- }
- return;
-}
-
-void
-print_fcode(dbuf, fc)
- dis_buffer_t *dbuf;
- u_short fc;
-{
- if (ISBITSET(fc, 4))
- printu_bf(dbuf, fc, 3, 0);
- else if (ISBITSET(fc, 3))
- PRINT_DREG(dbuf, BITFIELD(fc, 2, 0));
- else if (fc == 1)
- addstr(dbuf, "sfc");
- else
- addstr(dbuf, "dfc");
-}
-void
-opcode_mmu040(dbuf, opc)
- dis_buffer_t *dbuf;
- u_short opc;
-{
- if (ISBITSET(opc, 6)) {
- addstr(dbuf, "ptest");
- if (ISBITSET(opc, 5))
- addchar('r');
- else
- addchar('w');
- addchar('\t');
- PRINT_AREG(dbuf, BITFIELD(opc,2,0));
- addchar('@');
- } else {
- addstr(dbuf, "pflush");
- switch (BITFIELD(opc, 4, 3)) {
- case 3:
- addchar('a');
- break;
- case 2:
- addchar('a');
- addchar('n');
- break;
- case 0:
- addchar('n');
- /*FALLTHROUGH*/
- case 1:
- addchar('\t');
- PRINT_AREG(dbuf, BITFIELD(opc,2,0));
- addchar('@');
- break;
- }
- }
- *dbuf->casm = 0;
-}
-
-
-/*
- * disassemble long format (64b) divs/muls divu/mulu opcode.
- * Note: opcode's dbuf->used already accounted for.
- */
-void
-opcode_divmul(dbuf, opc)
- dis_buffer_t *dbuf;
- u_short opc;
-{
- u_short ext;
- int iq, hr;
-
- ext = *(dbuf->val + 1);
- dbuf->used++;
-
- iq = BITFIELD(ext,14,12);
- hr = BITFIELD(ext,2,0);
-
- if (IS_INST(DIVSL,opc))
- addstr(dbuf, "div");
- else
- addstr(dbuf, "mul");
- if (ISBITSET(ext,11))
- addchar('s');
- else
- addchar('u');
- addchar('l');
- if (IS_INST(DIVSL,opc) && !ISBITSET(ext,10) && iq != hr)
- addchar('l');
- addchar('\t');
-
- get_modregstr(dbuf,5,GETMOD_BEFORE,SIZE_LONG,1);
- addchar(',');
-
- if (ISBITSET(ext,10) ||
- (iq != hr && IS_INST(DIVSL,opc))) {
- /* 64 bit version */
- PRINT_DREG(dbuf, hr);
- if (dbuf->mit)
- addchar(',');
- else
- addchar(':');
- }
- PRINT_DREG(dbuf, iq);
-}
-
-void
-print_reglist(dbuf, mod, rl)
- dis_buffer_t *dbuf;
- int mod;
- u_short rl;
-{
- const char *const regs[16] = {
- "d0","d1","d2","d3","d4","d5","d6","d7",
- "a0","a1","a2","a3","a4","a5","a6","a7" };
- int bit, list;
-
- if (mod == AR_DEC) {
- list = rl;
- rl = 0;
- /* I am sure there is some trick... */
- for (bit = 0; bit < 16; bit++)
- if (list & (1 << bit))
- rl |= (0x8000 >> bit);
- }
- for (bit = 0, list = 0; bit < 16; bit++) {
- if (ISBITSET(rl,bit) && bit != 8) {
- if (list == 0) {
- list = 1;
- addstr(dbuf, regs[bit]);
- } else if (list == 1) {
- list++;
- addchar('-');
- }
- } else {
- if (list) {
- if (list > 1)
- addstr(dbuf, regs[bit-1]);
- addchar('/');
- list = 0;
- }
- if (ISBITSET(rl,bit)) {
- addstr(dbuf, regs[bit]);
- list = 1;
- }
- }
- }
- if (list > 1)
- addstr(dbuf, regs[15]);
-
- if (dbuf->casm[-1] == '/' || dbuf->casm[-1] == '-')
- dbuf->casm--;
- *dbuf->casm = 0;
-}
-
-void
-print_freglist(dbuf, mod, rl, cntl)
- dis_buffer_t *dbuf;
- int mod, cntl;
- u_short rl;
-{
- const char *const * regs;
- int bit, list, upper;
-
- regs = cntl ? fpcregs : fpregs;
- upper = cntl ? 3 : 8;
-
- if (!cntl && mod != AR_DEC) {
- list = rl;
- rl = 0;
- /* I am sure there is some trick... */
- for (bit = 0; bit < upper; bit++)
- if (list & (1 << bit))
- rl |= (0x80 >> bit);
- }
- for (bit = 0, list = 0; bit < upper; bit++) {
- if (ISBITSET(rl,bit)) {
- if (list == 0) {
- addstr(dbuf, regs[bit]);
- if (cntl)
- addchar('/');
- else
- list = 1;
- } else if (list == 1) {
- list++;
- addchar('-');
- }
- } else {
- if (list) {
- if (list > 1)
- addstr(dbuf, regs[bit-1]);
- addchar('/');
- list = 0;
- }
- }
- }
- if (list > 1)
- addstr(dbuf, regs[upper-1]);
-
- if (dbuf->casm[-1] == '/' || dbuf->casm[-1] == '-')
- dbuf->casm--;
- *dbuf->casm = 0;
-}
-
-/*
- * disassemble movem opcode.
- */
-void
-opcode_movem(dbuf, opc)
- dis_buffer_t *dbuf;
- u_short opc;
-{
- u_short rl;
-
- rl = *(dbuf->val + 1);
- dbuf->used++;
-
- if (ISBITSET(opc,6))
- addstr(dbuf, "movml\t");
- else
- addstr(dbuf, "movmw\t");
- if (ISBITSET(opc,10)) {
- get_modregstr(dbuf, 5, GETMOD_BEFORE, 0, 1);
- addchar(',');
- print_reglist(dbuf, BITFIELD(opc,5,3), rl);
- } else {
- print_reglist(dbuf, BITFIELD(opc,5,3), rl);
- addchar(',');
- get_modregstr(dbuf, 5, GETMOD_BEFORE, 0, 1);
- }
-}
-
-/*
- * disassemble movec opcode.
- */
-void
-opcode_movec(dbuf, opc)
- dis_buffer_t *dbuf;
- u_short opc;
-{
- char *tmp;
- u_short ext;
-
- ext = *(dbuf->val + 1);
- dbuf->used++;
-
- addstr(dbuf, "movc\t");
- if (ISBITSET(opc,0)) {
- dbuf->val++;
- if (ISBITSET(ext,15))
- get_modregstr(dbuf,14,AR_DIR,0,0);
- else
- get_modregstr(dbuf,14,DR_DIR,0,0);
- dbuf->val--;
- addchar(',');
- }
- switch (BITFIELD(ext,11,0)) {
- /* 010/020/030/040/CPU32/060 */
- case 0x000:
- tmp = "sfc";
- break;
- case 0x001:
- tmp = "dfc";
- break;
- case 0x800:
- tmp = "usp";
- break;
- case 0x801:
- tmp = "vbr";
- break;
- /* 020/030 */
- case 0x802:
- tmp = "caar";
- break;
- /* 020/030/040/060 */
- case 0x002:
- tmp = "cacr";
- break;
- /* 020/030/040 */
- case 0x803:
- tmp = "msp";
- break;
- case 0x804:
- tmp = "isp";
- break;
- /* 040/060 */
- case 0x003:
- tmp = "tc";
- break;
- case 0x004:
- tmp = "itt0";
- break;
- case 0x005:
- tmp = "itt1";
- break;
- case 0x006:
- tmp = "dtt0";
- break;
- case 0x007:
- tmp = "dtt1";
- break;
- /* 040 */
- case 0x805:
- tmp = "mmusr";
- break;
- /* 040/060 */
- case 0x806:
- tmp = "urp";
- break;
- case 0x807:
- tmp = "srp";
- break;
- /* 060 */
- case 0x008:
- tmp = "buscr";
- break;
- case 0x808:
- tmp = "pcr";
- break;
- default:
- tmp = "INVALID";
- break;
- }
- addstr(dbuf, tmp);
- if (!ISBITSET(opc,0)) {
- dbuf->val++;
- addchar(',');
- if (ISBITSET(ext,15))
- get_modregstr(dbuf,14,AR_DIR,0,0);
- else
- get_modregstr(dbuf,14,DR_DIR,0,0);
- dbuf->val--;
- }
-}
-
-void
-opcode_move16(dbuf, opc)
- dis_buffer_t *dbuf;
- u_short opc;
-{
- u_short ext;
-
- addstr(dbuf, "move16\t");
-
- if (ISBITSET(opc, 5)) {
- PRINT_AREG(dbuf, BITFIELD(opc,2,0));
- addstr(dbuf, "@+,");
- ext = *(dbuf->val + 1);
- PRINT_AREG(dbuf, BITFIELD(ext,14,12));
- addstr(dbuf, "@+");
- dbuf->used++;
- } else {
- switch (BITFIELD(opc,4,3)) {
- case 0:
- PRINT_AREG(dbuf, BITFIELD(opc,2,0));
- addstr(dbuf, "@+,");
- get_immed(dbuf, SIZE_LONG);
- break;
- case 1:
- get_immed(dbuf, SIZE_LONG);
- addchar(',');
- PRINT_AREG(dbuf, BITFIELD(opc,2,0));
- addstr(dbuf, "@+");
- break;
- case 2:
- PRINT_AREG(dbuf, BITFIELD(opc,2,0));
- addstr(dbuf, "@,");
- get_immed(dbuf, SIZE_LONG);
- break;
- case 3:
- get_immed(dbuf, SIZE_LONG);
- addchar(',');
- PRINT_AREG(dbuf, BITFIELD(opc,2,0));
- addchar('@');
- break;
- }
- }
-}
-
-/*
- * copy const string 's' into ``dbuf''->casm
- */
-void
-addstr(dbuf, s)
- dis_buffer_t *dbuf;
- const char *s;
-{
- while ((*dbuf->casm++ = *s++))
- ;
- dbuf->casm--;
-}
-
-/*
- * copy const string 's' into ``dbuf''->cinfo
- */
-void
-iaddstr(dbuf, s)
- dis_buffer_t *dbuf;
- const char *s;
-{
- while ((*dbuf->cinfo++ = *s++))
- ;
- dbuf->cinfo--;
-}
-
-void
-get_modregstr_moto(dbuf, bit, mod, sz, dd)
- dis_buffer_t *dbuf;
- int bit, mod, sz, dd;
-{
- u_char scale, idx;
- const short *nval;
- u_short ext;
- int disp, odisp, bd, od, reg;
-
- odisp = 0;
-
- /* check to see if we have been given the mod */
- if (mod != GETMOD_BEFORE && mod != GETMOD_AFTER)
- reg = BITFIELD(*dbuf->val, bit, bit-2);
- else if (mod == GETMOD_BEFORE) {
- mod = BITFIELD(*dbuf->val, bit, bit-2);
- reg = BITFIELD(*dbuf->val, bit-3, bit-5);
- } else {
- reg = BITFIELD(*dbuf->val, bit, bit-2);
- mod = BITFIELD(*dbuf->val, bit-3, bit-5);
- }
- switch (mod) {
- case DR_DIR:
- case AR_DIR:
- if (mod == DR_DIR)
- PRINT_DREG(dbuf, reg);
- else
- PRINT_AREG(dbuf, reg);
- break;
- case AR_DIS:
- print_disp(dbuf, *(dbuf->val + 1 + dd), SIZE_WORD,reg);
- dbuf->used++;
- /*FALLTHROUGH*/
- case AR_IND:
- case AR_INC:
- case AR_DEC:
- if (mod == AR_DEC)
- addchar('-');
- addchar('(');
- PRINT_AREG(dbuf, reg);
- addchar(')');
- if (mod == AR_INC)
- addchar('+');
- break;
- /* mod 6 & 7 are the biggies. */
- case MOD_SPECIAL:
- if (reg == 0) {
- /* abs short addr */
- print_addr(dbuf, *(dbuf->val + 1 + dd), 0);
- dbuf->used++;
- addchar('.');
- addchar('w');
- break;
- } else if (reg == 1) {
- /* abs long addr */
- print_addr(dbuf, *(u_long *)(dbuf->val + 1 + dd), 0);
- dbuf->used += 2;
- addchar('.');
- addchar('l');
- break;
- } else if (reg == 2) {
- /* pc ind displ. xxx(PC) */
- dbuf->used++;
- print_disp(dbuf, *(dbuf->val + 1 + dd), SIZE_WORD,
- -1);
- addstr(dbuf,"(pc)");
- break;
- } else if (reg == 4) {
- /* uses ``sz'' to figure immediate data. */
- if (sz == SIZE_BYTE) {
- addchar('#');
- prints(dbuf,
- *((char *)dbuf->val + 3+ (dd * 2)), sz);
- dbuf->used++;
- } else if (sz == SIZE_WORD) {
- addchar('#');
- prints(dbuf, *(dbuf->val + 1 + dd), sz);
- dbuf->used++;
- } else if (sz == SIZE_LONG) {
- print_addr(dbuf, *(u_long *)(dbuf->val + 1 + dd),
- 1);
- dbuf->used += 2;
- } else if (sz == SIZE_QUAD) {
- dbuf->used += 4;
- addstr(dbuf,"#<quad>");
- } else if (sz == SIZE_SINGLE) {
- dbuf->used += 2;
- addstr(dbuf,"#<single>");
- } else if (sz == SIZE_DOUBLE) {
- dbuf->used += 4;
- addstr(dbuf,"#<double>");
- } else if (sz == SIZE_PACKED) {
- dbuf->used += 6;
- addstr(dbuf,"#<packed>");
- } else if (sz == SIZE_EXTENDED) {
- dbuf->used += 6;
- addstr(dbuf,"#<extended>");
- }
- break;
- }
- /* standrd PC stuff. */
- /*FALLTHROUGH*/
- case AR_IDX:
- ext = *(dbuf->val + 1 + dd);
- dbuf->used++;
- nval = dbuf->val + 2 + dd; /* set to possible displacements */
- scale = BITFIELD(ext,10,9);
- idx = BITFIELD(ext,14,12);
-
- if (ISBITSET(ext,8)) {
- /* either base disp, or memory indirect */
- bd = BITFIELD(ext,5,4);
- od = BITFIELD(ext,1,0);
- if (bd == 1)
- disp = 0;
- else if (bd == 2) {
- dbuf->used++;
- disp = *nval++;
- } else {
- dbuf->used += 2;
- disp = *(long *)nval;
- nval += 2;
- }
-
- if (od == 1)
- odisp = 0;
- else if (od == 2) {
- dbuf->used++;
- odisp = *nval++;
- } else if (od == 3) {
- dbuf->used += 2;
- odisp = *(long *)nval;
- nval += 2;
- }
- } else {
- /*
- * We set od and bd to zero, these values are
- * not allowed in opcodes that use base and
- * outer displacement, e.g. we can tell if we
- * are using on of those modes by checking
- * `bd' and `od'.
- */
- od = 0;
- bd = 0;
- disp = (char)BITFIELD(ext,7,0);
- }
- /*
- * write everything into buf
- */
- addchar('(');
- if (od)
- addchar('['); /* begin memory indirect xxx-indexed */
- prints(dbuf, disp,
- bd == 2 ? SIZE_WORD :
- bd == 3 ? SIZE_LONG :
- SIZE_BYTE);
- addchar(',');
- if (bd && ISBITSET(ext,7)) {
- addchar('z');
- if (mod != MOD_SPECIAL)
- PRINT_AREG(dbuf,reg);
- else {
- addchar('p');
- addchar('c');
- }
- } else if (mod == AR_IDX)
- PRINT_AREG(dbuf, reg);
- else {
- addchar('p');
- addchar('c');
- }
-
- if (od && ISBITSET(ext,2))
- addchar(']'); /* post-indexed. */
- addchar(',');
- if (bd && ISBITSET(ext,6))
- addchar('0');
- else {
- if (0x8000 & ext)
- PRINT_AREG(dbuf, idx);
- else
- PRINT_DREG(dbuf, idx);
- addchar('.');
- addchar(0x800 & ext ? 'l' : 'w');
- if (scale) {
- addchar('*');
- addchar('0' + (1 << scale));
- }
- }
- if (od) {
- if (!ISBITSET(ext,2))
- addchar(']'); /* pre-indexed */
- addchar(',');
- prints(dbuf, odisp,
- od == 2 ? SIZE_WORD :
- od == 3 ? SIZE_LONG :
- SIZE_BYTE);
- }
- addchar(')');
- break;
- }
- *dbuf->casm = 0;
-}
-
-/* mit syntax makes for spaghetti parses */
-void
-get_modregstr_mit(dbuf, bit, mod, sz, dd)
- dis_buffer_t *dbuf;
- int bit, mod, sz, dd;
-{
- u_char scale, idx;
- const short *nval;
- u_short ext;
- int disp, odisp, bd, od, reg;
-
- disp = odisp = 0;
- /* check to see if we have been given the mod */
- if (mod != GETMOD_BEFORE && mod != GETMOD_AFTER)
- reg = BITFIELD(*dbuf->val, bit, bit-2);
- else if (mod == GETMOD_BEFORE) {
- mod = BITFIELD(*dbuf->val, bit, bit-2);
- reg = BITFIELD(*dbuf->val, bit-3, bit-5);
- } else {
- reg = BITFIELD(*dbuf->val, bit, bit-2);
- mod = BITFIELD(*dbuf->val, bit-3, bit-5);
- }
- switch (mod) {
- case DR_DIR:
- case AR_DIR:
- if (mod == DR_DIR)
- PRINT_DREG(dbuf, reg);
- else
- PRINT_AREG(dbuf, reg);
- break;
- case AR_DIS:
- dbuf->used++; /* tell caller we used an ext word. */
- disp = *(dbuf->val + 1 + dd);
- /*FALLTHROUGH*/
- case AR_IND:
- case AR_INC:
- case AR_DEC:
- PRINT_AREG(dbuf, reg);
- addchar('@' );
- if (mod == AR_DEC)
- addchar('-');
- else if (mod == AR_INC)
- addchar('+');
- else if (mod == AR_DIS) {
- addchar('(');
- print_disp(dbuf, disp, SIZE_WORD, reg);
- addchar(')');
- }
- break;
- /* mod 6 & 7 are the biggies. */
- case MOD_SPECIAL:
- if (reg == 0) {
- /* abs short addr */
- print_addr(dbuf, *(dbuf->val + 1 + dd), 0);
- dbuf->used++;
- break;
- } else if (reg == 1) {
- /* abs long addr */
- print_addr(dbuf, *(u_long *)(dbuf->val + 1 + dd), 0);
- dbuf->used += 2;
- break;
- } else if (reg == 2) {
- /* pc ind displ. pc@(xxx) */
- addstr(dbuf,"pc@(");
- print_disp(dbuf, *(dbuf->val + 1 + dd), SIZE_WORD, -1);
- dbuf->used++;
- addchar(')');
- break;
- } else if (reg == 4) {
- /* uses ``sz'' to figure immediate data. */
- if (sz == SIZE_BYTE) {
- addchar('#');
- prints(dbuf,
- *((char *)dbuf->val + 3 + (dd * 2)), sz);
- dbuf->used++;
- } else if (sz == SIZE_WORD) {
- addchar('#');
- prints(dbuf, *(dbuf->val + 1 + dd), sz);
- dbuf->used++;
- } else if (sz == SIZE_LONG) {
- print_addr(dbuf, *(u_long *)(dbuf->val + 1 + dd),
- 1);
- dbuf->used += 2;
- } else if (sz == SIZE_QUAD) {
- dbuf->used += 4;
- addstr(dbuf,"#<quad>");
- } else if (sz == SIZE_SINGLE) {
- dbuf->used += 2;
- addstr(dbuf,"#<single>");
- } else if (sz == SIZE_DOUBLE) {
- dbuf->used += 4;
- addstr(dbuf,"#<double>");
- } else if (sz == SIZE_PACKED) {
- dbuf->used += 6;
- addstr(dbuf,"#<packed>");
- } else if (sz == SIZE_EXTENDED) {
- dbuf->used += 6;
- addstr(dbuf,"#<extended>");
- }
- break;
- }
- /* standrd PC stuff. */
- /*FALLTHROUGH*/
- case AR_IDX:
- dbuf->used++; /* indicate use of ext word. */
- ext = *(dbuf->val + 1 + dd);
- nval = dbuf->val + 2 + dd; /* set to possible displacements */
- scale = BITFIELD(ext,10,9);
- idx = BITFIELD(ext,14,12);
-
- if (ISBITSET(ext,8)) {
- /* either base disp, or memory indirect */
- bd = BITFIELD(ext,5,4);
- od = BITFIELD(ext,1,0);
- if (bd == 1)
- disp = 0;
- else if (bd == 2) {
- dbuf->used++;
- disp = *nval++;
- } else {
- dbuf->used += 2;
- disp = *(long *)nval;
- nval += 2;
- }
-
- if (od == 1)
- odisp = 0;
- else if (od == 2) {
- dbuf->used++;
- odisp = *nval++;
- } else if (od == 3) {
- dbuf->used += 2;
- odisp = *(long *)nval;
- nval += 2;
- }
- } else {
- /*
- * We set od and bd to zero, these values are
- * not allowed in opcodes that use base and
- * outer displacement, e.g. we can tell if we
- * are using on of those modes by checking
- * `bd' and `od'.
- */
- od = 0;
- bd = 0;
- disp = (char)BITFIELD(ext,7,0);
- }
- /*
- * write everything into buf
- */
- /* if base register not suppresed */
- if (mod == AR_IDX && (!bd || !ISBITSET(ext,7)))
- PRINT_AREG(dbuf, reg);
- else if (mod == MOD_SPECIAL && ISBITSET(ext,7)) {
- addchar('z');
- addchar('p');
- addchar('c');
- } else if (mod == MOD_SPECIAL) {
- addchar('p');
- addchar('c');
- }
- addchar('@');
- addchar('(');
-
- if (bd && bd != 1) {
- prints(dbuf, disp,
- bd == 2 ? SIZE_WORD :
- bd == 3 ? SIZE_LONG :
- SIZE_BYTE);
- if (od && !ISBITSET(ext,6) && !ISBITSET(ext,2))
- /* Pre-indexed and not suppressing index */
- addchar(',');
- else if (od && ISBITSET(ext,2)) {
- /* Post-indexed */
- addchar(')');
- addchar('@');
- addchar('(');
- } else if (!od)
- addchar(',');
- } else if (!bd) {
- /* don't forget simple 8 bit displacement. */
- prints(dbuf, disp,
- bd == 2 ? SIZE_WORD :
- bd == 3 ? SIZE_LONG :
- SIZE_BYTE);
- addchar(',');
- }
-
- /* Post-indexed? */
- if (od && ISBITSET(ext,2)) {
- /* have displacement? */
- if (od != 1) {
- prints(dbuf, odisp,
- od == 2 ? SIZE_WORD :
- od == 3 ? SIZE_LONG :
- SIZE_BYTE);
- addchar(',');
- }
- }
-
- if (!bd || !ISBITSET(ext,6)) {
- if (ISBITSET(ext,15))
- PRINT_AREG(dbuf,idx);
- else
- PRINT_DREG(dbuf,idx);
- addchar(':');
- addchar(ISBITSET(ext,11) ? 'l' : 'w');
- if (scale) {
- addchar(':');
- addchar('0' + (1 << scale));
- }
- }
- /* pre-indexed? */
- if (od && !ISBITSET(ext,2)) {
- if (od != 1) {
- addchar(')');
- addchar('@');
- addchar('(');
- prints(dbuf, odisp,
- od == 2 ? SIZE_WORD :
- od == 3 ? SIZE_LONG :
- SIZE_BYTE);
- }
- }
- addchar(')');
- break;
- }
- *dbuf->casm = 0;
-}
-
-/*
- * Given a disassembly buffer ``dbuf'' and a starting bit of the
- * mod|reg field ``bit'' (or just a reg field if ``mod'' is not
- * GETMOD_BEFORE or GETMOD_AFTER), disassemble and write into ``dbuf''
- * the mod|reg pair.
- */
-void get_modregstr(dbuf, bit, mod, sz, dispdisp)
- dis_buffer_t *dbuf;
- int bit, mod, sz, dispdisp;
-{
- if (dbuf->mit)
- get_modregstr_mit(dbuf,bit,mod,sz,dispdisp);
- else
- get_modregstr_moto(dbuf,bit,mod,sz,dispdisp);
-}
-
-/*
- * given a bit position ``bit'' in the current ``dbuf''->val
- * and the ``base'' string of the opcode, append the full
- * opcode name including condition found at ``bit''.
- */
-void
-make_cond(dbuf, bit, base)
- dis_buffer_t *dbuf;
- int bit;
- char *base;
-{
- int cc;
- const char *ccs;
-
- cc = BITFIELD(*dbuf->val,bit,bit-3);
- ccs = cc_table[cc&15];
-
- addstr(dbuf, base);
- addstr(dbuf, ccs);
-}
-
-void
-print_fcond(dbuf, cp)
- dis_buffer_t *dbuf;
- char cp;
-{
- addstr(dbuf,fpcc_table[cp&31]); /* XXX - not 63 ?*/
-}
-
-void
-print_mcond(dbuf, cp)
- dis_buffer_t *dbuf;
- char cp;
-{
- addstr(dbuf,mmcc_table[cp&15]);
-}
-
-/*
- * given dis_buffer_t ``dbuf'' get the immediate value from the
- * extension words following current instruction, output a
- * hash (``#'') sign and the value. Increment the ``dbuf''->used
- * field accordingly.
- */
-void
-get_immed(dbuf,sz)
- dis_buffer_t *dbuf;
- int sz;
-{
- addchar('#');
- switch (sz) {
- case SIZE_BYTE:
- prints(dbuf, BITFIELD(*(dbuf->val + 1),7,0), SIZE_BYTE);
- dbuf->used++;
- break;
- case SIZE_WORD:
- prints(dbuf, *(dbuf->val + 1), SIZE_WORD);
- dbuf->used++;
- break;
- case SIZE_LONG:
- prints(dbuf, *(long *)(dbuf->val + 1), SIZE_LONG);
- dbuf->used += 2;
- break;
- }
- return;
-}
-
-void
-get_fpustdGEN(dbuf,ext,name)
- dis_buffer_t *dbuf;
- u_short ext;
- const char *name;
-{
- int sz;
-
- /*
- * If bit seven is set, its a 040 s/d opcode, then if bit 2 is
- * set its "d". This is not documented, however thats the way
- * it is.
- */
-
- sz = 0;
- addchar(*name++);
- if (ISBITSET(ext,7)) {
- if(ISBITSET(ext,2))
- addchar('d');
- else
- addchar('s');
- }
- addstr(dbuf,name);
-
- if (ISBITSET(ext,14)) {
- switch (BITFIELD(ext,12,10)) {
- case 0:
- addchar('l');
- sz = SIZE_LONG;
- break;
- case 1:
- addchar('s');
- sz = SIZE_SINGLE;
- break;
- case 2:
- addchar('x');
- sz = SIZE_EXTENDED;
- break;
- case 3:
- addchar('p');
- sz = SIZE_PACKED;
- break;
- case 4:
- addchar('w');
- sz = SIZE_WORD;
- break;
- case 5:
- addchar('d');
- sz = SIZE_DOUBLE;
- break;
- case 6:
- addchar('b');
- sz = SIZE_BYTE;
- break;
- }
- addchar('\t');
- get_modregstr(dbuf, 5, GETMOD_BEFORE, sz, 1);
- if (BITFIELD(ext,6,3) == 6) {
- addchar(',');
- PRINT_FPREG(dbuf, BITFIELD(ext,2,0));
- addchar(':');
- PRINT_FPREG(dbuf, BITFIELD(ext,9,7));
- } else if (BITFIELD(ext,5,0) != FTST) {
- addchar(',');
- PRINT_FPREG(dbuf, BITFIELD(ext,9,7));
- }
- } else {
- addchar('x');
- addchar('\t');
- PRINT_FPREG(dbuf, BITFIELD(ext,12,10));
- if (BITFIELD(ext,6,3) == 6) {
- addchar(',');
- PRINT_FPREG(dbuf, BITFIELD(ext,2,0));
- addchar(':');
- PRINT_FPREG(dbuf, BITFIELD(ext,9,7));
- } else if (BITFIELD(ext,5,0) != FTST) {
- addchar(',');
- PRINT_FPREG(dbuf, BITFIELD(ext,9,7));
- }
- }
-}
-
-u_long
-get_areg_val(reg)
- int reg;
-{
- return (0);
-}
-
-/*
- * given value ``disp'' print it to ``dbuf''->buf. ``rel'' is a
- * register number 0-7 (a0-a7), or -1 (pc). Thus possible extra info
- * could be output to the ``dbuf''->info buffer.
- */
-void
-print_disp(dbuf, disp, sz, rel)
- dis_buffer_t *dbuf;
- int disp, sz, rel;
-{
- db_expr_t diff;
- db_sym_t sym;
- char *symname;
- u_long nv;
-
- prints(dbuf, disp, sz);
-
- if (rel == -1)
- /* XXX This may be wrong for a couple inst. */
- nv = disp + (u_int)dbuf->val + 2;
- else
- return; /* nv = get_areg_val(rel); */
-
- diff = INT_MAX;
- symname = NULL;
- sym = db_search_symbol(nv, DB_STGY_PROC, &diff);
- db_symbol_values(sym, &symname, 0);
-
- if (symname) {
- iaddstr(dbuf, "disp:");
- iaddstr(dbuf, symname);
- iaddchar('+');
- iprintu(dbuf, diff, SIZE_LONG);
- iaddchar(' ');
- *dbuf->cinfo = 0;
- }
-}
-
-void
-print_addr(dbuf, addr, wantexact)
- dis_buffer_t *dbuf;
- u_long addr;
- int wantexact;
-{
- db_expr_t diff;
- db_sym_t sym;
- char *symname;
-
- diff = INT_MAX;
- symname = NULL;
- sym = db_search_symbol(addr, DB_STGY_ANY, &diff);
- if (wantexact && diff != 0)
- symname = NULL;
- else
- db_symbol_values(sym, &symname, 0);
-
- if (symname) {
- if (diff == 0)
- addstr(dbuf,symname);
- else {
- addchar('<');
- addstr(dbuf,symname);
- addchar('+');
- printu(dbuf, diff, SIZE_LONG);
- addchar('>');
- *dbuf->casm = 0;
- }
- iaddstr(dbuf,"addr:");
- iprintu(dbuf, addr, SIZE_LONG);
- iaddchar(' ');
- *dbuf->cinfo = 0;
- } else {
- printu(dbuf, addr, SIZE_LONG);
- }
-}
-
-void
-prints(dbuf, val, sz)
- dis_buffer_t *dbuf;
- int val;
- int sz;
-{
- extern int db_radix;
-
- if (val == 0) {
- dbuf->casm[0] = '0';
- dbuf->casm[1] = 0;
- } else if (sz == SIZE_BYTE)
- prints_wb(dbuf, (char)val, sz, db_radix);
- else if (sz == SIZE_WORD)
- prints_wb(dbuf, (short)val, sz, db_radix);
- else
- prints_wb(dbuf, (long)val, sz, db_radix);
-
- dbuf->casm = &dbuf->casm[strlen(dbuf->casm)];
-}
-
-void
-iprints(dbuf, val, sz)
- dis_buffer_t *dbuf;
- int val;
- int sz;
-{
- extern int db_radix;
-
- if (val == 0) {
- dbuf->cinfo[0] = '0';
- dbuf->cinfo[1] = 0;
- } else if (sz == SIZE_BYTE)
- iprints_wb(dbuf, (char)val, sz, db_radix);
- else if (sz == SIZE_WORD)
- iprints_wb(dbuf, (short)val, sz, db_radix);
- else
- iprints_wb(dbuf, (long)val, sz, db_radix);
-
- dbuf->cinfo = &dbuf->cinfo[strlen(dbuf->cinfo)];
-}
-
-void
-printu(dbuf, val, sz)
- dis_buffer_t *dbuf;
- u_int val;
- int sz;
-{
- extern int db_radix;
-
- if (val == 0) {
- dbuf->casm[0] = '0';
- dbuf->casm[1] = 0;
- } else if (sz == SIZE_BYTE)
- printu_wb(dbuf, (u_char)val, sz, db_radix);
- else if (sz == SIZE_WORD)
- printu_wb(dbuf, (u_short)val, sz, db_radix);
- else
- printu_wb(dbuf, (u_long)val, sz, db_radix);
- dbuf->casm = &dbuf->casm[strlen(dbuf->casm)];
-}
-
-void
-iprintu(dbuf, val, sz)
- dis_buffer_t *dbuf;
- u_int val;
- int sz;
-{
- extern int db_radix;
-
- if (val == 0) {
- dbuf->cinfo[0] = '0';
- dbuf->cinfo[1] = 0;
- } else if (sz == SIZE_BYTE)
- iprintu_wb(dbuf, (u_char)val, sz, db_radix);
- else if (sz == SIZE_WORD)
- iprintu_wb(dbuf, (u_short)val, sz, db_radix);
- else
- iprintu_wb(dbuf, (u_long)val, sz, db_radix);
- dbuf->cinfo = &dbuf->cinfo[strlen(dbuf->cinfo)];
-}
-
-void
-printu_wb(dbuf, val, sz, base)
- dis_buffer_t *dbuf;
- u_int val;
- int sz, base;
-{
- static char buf[sizeof(long) * NBBY / 3 + 2];
- char *p, ch;
-
- if (base != 10) {
- addchar('0');
- if (base != 8) {
- base = 16;
- addchar('x');
- }
- }
-
- p = buf;
- do {
- *++p = "0123456789abcdef"[val % base];
- } while (val /= base);
-
- while ((ch = *p--))
- addchar(ch);
-
- *dbuf->casm = 0;
-}
-
-void
-prints_wb(dbuf, val, sz, base)
- dis_buffer_t *dbuf;
- int val;
- int sz, base;
-{
- if (val < 0) {
- addchar('-');
- val = -val;
- }
- printu_wb(dbuf, val, sz, base);
-}
-
-void
-iprintu_wb(dbuf, val, sz, base)
- dis_buffer_t *dbuf;
- u_int val;
- int sz, base;
-{
- static char buf[sizeof(long) * NBBY / 3 + 2];
- char *p, ch;
-
- if (base != 10) {
- iaddchar('0');
- if (base != 8) {
- base = 16;
- iaddchar('x');
- }
- }
-
- p = buf;
- do {
- *++p = "0123456789abcdef"[val % base];
- } while (val /= base);
-
- while ((ch = *p--))
- iaddchar(ch);
-
- *dbuf->cinfo = 0;
-}
-
-void
-iprints_wb(dbuf, val, sz, base)
- dis_buffer_t *dbuf;
- int val;
- int sz, base;
-{
- if (val < 0) {
- iaddchar('-');
- val = -val;
- }
- iprintu_wb(dbuf, val, sz, base);
-}
-
-
-void
-prints_bf(dbuf, val, sb, eb)
- dis_buffer_t *dbuf;
- int val, sb, eb;
-{
- if (ISBITSET(val,sb))
- val = (~0 & ~BITFIELD(~0, sb, eb)) | BITFIELD(val, sb, eb);
- else
- val = BITFIELD(val,sb,eb);
-
- prints(dbuf, val, SIZE_LONG);
-}
-
-void
-printu_bf(dbuf, val, sb, eb)
- dis_buffer_t *dbuf;
- u_int val;
- int sb, eb;
-{
- printu(dbuf,BITFIELD(val,sb,eb),SIZE_LONG);
-}
diff --git a/sys/arch/m68k/m68k/db_disasm.h b/sys/arch/m68k/m68k/db_disasm.h
deleted file mode 100644
index 3b576e3dd70..00000000000
--- a/sys/arch/m68k/m68k/db_disasm.h
+++ /dev/null
@@ -1,432 +0,0 @@
-/* $OpenBSD: db_disasm.h,v 1.4 2002/03/14 01:26:34 millert Exp $ */
-/* $NetBSD: db_disasm.h,v 1.4 1996/04/01 01:38:12 briggs Exp $ */
-
-/*
- * Copyright (c) 1994 Christian E. Hopps
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christian E. Hopps.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define ENCB(b7,b6,b5,b4,b3,b2,b1,b0) \
- ((b7 << 7) | (b6 << 6) | (b5 << 5) | (b4 << 4) | \
- (b3 << 3) | (b2 << 2) | (b1 << 1) | (b0))
-
-
-#define ENCW(b15,b14,b13,b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1,b0) \
- ((ENCB(b15,b14,b13,b12,b11,b10,b9,b8) << 8) |\
- ENCB(b7,b6,b5,b4,b3,b2,b1,b0))
-
-/*
- * Group Bit-manip (0000)
- */
-#define ANDITOCCR_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1)
-#define ANDIROSR_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1)
-#define EORITOCCR_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1)
-#define EORITOSR_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1)
-#define ORITOCCR_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1)
-#define ORITOSR_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1)
-#define ANDITOCCR_INST ENCW(0,0,0,0, 0,0,1,0, 0,0,1,1, 1,1,0,0)
-#define ANDIROSR_INST ENCW(0,0,0,0, 0,0,1,0, 0,1,1,1, 1,1,0,0)
-#define EORITOCCR_INST ENCW(0,0,0,0, 1,0,1,0, 0,0,1,1, 1,1,0,0)
-#define EORITOSR_INST ENCW(0,0,0,0, 1,0,1,0, 0,1,1,1, 1,1,0,0)
-#define ORITOCCR_INST ENCW(0,0,0,0, 0,0,0,0, 0,0,1,1, 1,1,0,0)
-#define ORITOSR_INST ENCW(0,0,0,0, 0,0,0,0, 0,1,1,1, 1,1,0,0)
-
-/*
- * RTM: this is what gas *and* my amiga assembler spit out, however
- * my moto manual disagrees, another 030 manual I have also has
- * something different from all of the above!
- *
- * BTW there may be a consipircy, as many may recognize
- * from the acronym associated with this opcode's name. *grin*
- */
-#define RTM_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,1,1, 0,0,0,0)
-#define RTM_INST ENCW(0,0,0,0, 0,1,1,0, 1,1,0,0, 0,0,0,0)
-
-/* Note: bit eight being 1 here allows these to be check before all else */
-
-/* Note: for movp bits 5-3, specify a mode An, which all the other
- * bit 8 set commands do not, so have check first. */
-#define MOVEP_MASK ENCW(1,1,1,1, 0,0,0,1, 0,0,1,1, 1,0,0,0)
-#define MOVEP_INST ENCW(0,0,0,0, 0,0,0,1, 0,0,0,0, 1,0,0,0)
-
-#define BCHGD_MASK ENCW(1,1,1,1, 0,0,0,1, 1,1,0,0, 0,0,0,0)
-#define BCLRD_MASK ENCW(1,1,1,1, 0,0,0,1, 1,1,0,0, 0,0,0,0)
-#define BSETD_MASK ENCW(1,1,1,1, 0,0,0,1, 1,1,0,0, 0,0,0,0)
-#define BTSTD_MASK ENCW(1,1,1,1, 0,0,0,1, 1,1,0,0, 0,0,0,0)
-#define BCHGD_INST ENCW(0,0,0,0, 0,0,0,1, 0,1,0,0, 0,0,0,0)
-#define BCLRD_INST ENCW(0,0,0,0, 0,0,0,1, 1,0,0,0, 0,0,0,0)
-#define BSETD_INST ENCW(0,0,0,0, 0,0,0,1, 1,1,0,0, 0,0,0,0)
-#define BTSTD_INST ENCW(0,0,0,0, 0,0,0,1, 0,0,0,0, 0,0,0,0)
-
-#define BCHGS_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0)
-#define BCLRS_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0)
-#define BSETS_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0)
-#define BTSTS_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0)
-#define BCHGS_INST ENCW(0,0,0,0, 1,0,0,0, 0,1,0,0, 0,0,0,0)
-#define BCLRS_INST ENCW(0,0,0,0, 1,0,0,0, 1,0,0,0, 0,0,0,0)
-#define BSETS_INST ENCW(0,0,0,0, 1,0,0,0, 1,1,0,0, 0,0,0,0)
-#define BTSTS_INST ENCW(0,0,0,0, 1,0,0,0, 0,0,0,0, 0,0,0,0)
-
-#define CAS2_MASK ENCW(1,1,1,1, 1,1,0,1, 1,1,1,1, 1,1,1,1)
-#define CAS2_INST ENCW(0,0,0,0, 1,1,0,0, 1,1,1,1, 1,1,0,0)
-
-#define CAS_MASK ENCW(1,1,1,1, 1,0,0,1, 1,1,0,0, 0,0,0,0)
-#define CHK2_MASK ENCW(1,1,1,1, 1,0,0,1, 1,1,0,0, 0,0,0,0)
-#define CMP2_MASK ENCW(1,1,1,1, 1,0,0,1, 1,1,0,0, 0,0,0,0)
-#define CAS_INST ENCW(0,0,0,0, 1,0,0,0, 1,1,0,0, 0,0,0,0)
-#define CHK2_INST ENCW(0,0,0,0, 0,0,0,0, 1,1,0,0, 0,0,0,0)
-#define CMP2_INST ENCW(0,0,0,0, 0,0,0,0, 1,1,0,0, 0,0,0,0)
-
-/* close ties with Bxxx but bit eight here is 0 and there 1 */
-/* also above (cas,chk2,cmp2) bits 7-6 here are size and never 11 */
-#define ADDI_MASK ENCW(1,1,1,1, 1,1,1,1, 0,0,0,0, 0,0,0,0)
-#define ANDI_MASK ENCW(1,1,1,1, 1,1,1,1, 0,0,0,0, 0,0,0,0)
-#define CMPI_MASK ENCW(1,1,1,1, 1,1,1,1, 0,0,0,0, 0,0,0,0)
-#define EORI_MASK ENCW(1,1,1,1, 1,1,1,1, 0,0,0,0, 0,0,0,0)
-#define MOVES_MASK ENCW(1,1,1,1, 1,1,1,1, 0,0,0,0, 0,0,0,0)
-#define ORI_MASK ENCW(1,1,1,1, 1,1,1,1, 0,0,0,0, 0,0,0,0)
-#define SUBI_MASK ENCW(1,1,1,1, 1,1,1,1, 0,0,0,0, 0,0,0,0)
-#define ADDI_INST ENCW(0,0,0,0, 0,1,1,0, 0,0,0,0, 0,0,0,0)
-#define ANDI_INST ENCW(0,0,0,0, 0,0,1,0, 0,0,0,0, 0,0,0,0)
-#define CMPI_INST ENCW(0,0,0,0, 1,1,0,0, 0,0,0,0, 0,0,0,0)
-#define EORI_INST ENCW(0,0,0,0, 1,0,1,0, 0,0,0,0, 0,0,0,0)
-#define MOVES_INST ENCW(0,0,0,0, 1,1,1,0, 0,0,0,0, 0,0,0,0)
-#define ORI_INST ENCW(0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0)
-#define SUBI_INST ENCW(0,0,0,0, 0,1,0,0, 0,0,0,0, 0,0,0,0)
-
-/*
- * Group misc. (0100)
- */
-#define BGND_MASK 0xffff
-#define ILLEGAL_MASK 0xffff
-#define MOVEFRC_MASK 0xffff
-#define MOVETOC_MASK 0xffff
-#define NOP_MASK 0xffff
-#define RESET_MASK 0xffff
-#define RTD_MASk 0xffff
-#define RTE_MASK 0xffff
-#define RTR_MASK 0xffff
-#define RTS_MASK 0xffff
-#define STOP_MASK 0xffff
-#define TRAPV_MASK 0xffff
-#define BGND_INST ENCW(0,1,0,0, 1,0,1,0, 1,1,1,1, 1,0,1,0)
-#define ILLEGAL_INST ENCW(0,1,0,0, 1,0,1,0, 1,1,1,1, 1,1,0,0)
-#define MOVEFRC_INST ENCW(0,1,0,0, 1,1,1,0, 0,1,1,1, 1,0,1,0)
-#define MOVETOC_INST ENCW(0,1,0,0, 1,1,1,0, 0,1,1,1, 1,0,1,1)
-#define NOP_INST ENCW(0,1,0,0, 1,1,1,0, 0,1,1,1, 0,0,0,1)
-#define RESET_INST ENCW(0,1,0,0, 1,1,1,0, 0,1,1,1, 0,0,0,0)
-#define RTD_INST ENCW(0,1,0,0, 1,1,1,0, 0,1,1,1, 0,1,0,0)
-#define RTE_INST ENCW(0,1,0,0, 1,1,1,0, 0,1,1,1, 0,0,1,1)
-#define RTR_INST ENCW(0,1,0,0, 1,1,1,0, 0,1,1,1, 0,1,1,1)
-#define RTS_INST ENCW(0,1,0,0, 1,1,1,0, 0,1,1,1, 0,1,0,1)
-#define STOP_INST ENCW(0,1,0,0, 1,1,1,0, 0,1,1,1, 0,0,1,0)
-#define TRAPV_INST ENCW(0,1,0,0, 1,1,1,0, 0,1,1,1, 0,1,1,0)
-#define SWAP_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,1,1, 1,0,0,0)
-#define SWAP_INST ENCW(0,1,0,0, 1,0,0,0, 0,1,0,0, 0,0,0,0)
-
-#define BKPT_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,1,1, 1,0,0,0)
-#define EXTBW_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,1,1, 1,0,0,0)
-#define EXTWL_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,1,1, 1,0,0,0)
-#define EXTBL_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,1,1, 1,0,0,0)
-#define LINKW_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,1,1, 1,0,0,0)
-#define LINKL_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,1,1, 1,0,0,0)
-#define MOVEFRUSP_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,1,1, 1,0,0,0)
-#define MOVETOUSP_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,1,1, 1,0,0,0)
-#define UNLK_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,1,1, 1,0,0,0)
-#undef BKPT_INST
-#define BKPT_INST ENCW(0,1,0,0, 1,0,0,0, 0,1,0,0, 1,0,0,0)
-#define EXTBW_INST ENCW(0,1,0,0, 1,0,0,0, 1,0,0,0, 0,0,0,0)
-#define EXTWL_INST ENCW(0,1,0,0, 1,0,0,0, 1,1,0,0, 0,0,0,0)
-#define EXTBL_INST ENCW(0,1,0,0, 1,0,0,1, 1,1,0,0, 0,0,0,0)
-#define LINKW_INST ENCW(0,1,0,0, 1,1,1,0, 0,1,0,1, 0,0,0,0)
-#define LINKL_INST ENCW(0,1,0,0, 1,0,0,0, 0,0,0,0, 1,0,0,0)
-#define MOVETOUSP_INST ENCW(0,1,0,0, 1,1,1,0, 0,1,1,0, 0,0,0,0)
-#define MOVEFRUSP_INST ENCW(0,1,0,0, 1,1,1,0, 0,1,1,0, 1,0,0,0)
-#define UNLK_INST ENCW(0,1,0,0, 1,1,1,0, 0,1,0,1, 1,0,0,0)
-
-#define TRAP_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,1,1, 0,0,0,0)
-#define TRAP_INST ENCW(0,1,0,0, 1,1,1,0, 0,1,0,0, 0,0,0,0)
-
-#define DIVSL_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0)
-#define DIVUL_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0)
-#define JMP_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0)
-#define JSR_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0)
-#define MOVEFRCCR_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0)
-#define MOVETOCCR_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0)
-#define MOVEFRSR_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0)
-#define MOVETOSR_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0)
-#define MULSL_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0)
-#define MULUL_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0)
-#define NBCD_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0)
-#define PEA_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0)
-#define TAS_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0)
-#define DIVSL_INST ENCW(0,1,0,0, 1,1,0,0, 0,1,0,0, 0,0,0,0)
-#define DIVUL_INST DIVSL_INST
-#define JMP_INST ENCW(0,1,0,0, 1,1,1,0, 1,1,0,0, 0,0,0,0)
-#define JSR_INST ENCW(0,1,0,0, 1,1,1,0, 1,0,0,0, 0,0,0,0)
-#define MOVEFRCCR_INST ENCW(0,1,0,0, 0,0,1,0, 1,1,0,0, 0,0,0,0)
-#define MOVETOCCR_INST ENCW(0,1,0,0, 0,1,0,0, 1,1,0,0, 0,0,0,0)
-#define MOVEFRSR_INST ENCW(0,1,0,0, 0,0,0,0, 1,1,0,0, 0,0,0,0)
-#define MOVETOSR_INST ENCW(0,1,0,0, 0,1,1,0, 1,1,0,0, 0,0,0,0)
-#define MULSL_INST ENCW(0,1,0,0, 1,1,0,0, 0,0,0,0, 0,0,0,0)
-#define MULUL_INST MULSL_INST
-#define NBCD_INST ENCW(0,1,0,0, 1,0,0,0, 0,0,0,0, 0,0,0,0)
-#define PEA_INST ENCW(0,1,0,0, 1,0,0,0, 0,1,0,0, 0,0,0,0)
-#define TAS_INST ENCW(0,1,0,0, 1,0,1,0, 1,1,0,0, 0,0,0,0)
-
-#define MOVEM_MASK ENCW(1,1,1,1, 1,0,1,1, 1,0,0,0, 0,0,0,0)
-#define MOVEM_INST ENCW(0,1,0,0, 1,0,0,0, 1,0,0,0, 0,0,0,0)
-
-#define CLR_MASK ENCW(1,1,1,1, 1,1,1,1, 0,0,0,0, 0,0,0,0)
-#define NEG_MASK ENCW(1,1,1,1, 1,1,1,1, 0,0,0,0, 0,0,0,0)
-#define NEGX_MASK ENCW(1,1,1,1, 1,1,1,1, 0,0,0,0, 0,0,0,0)
-#define NOT_MASK ENCW(1,1,1,1, 1,1,1,1, 0,0,0,0, 0,0,0,0)
-#define TST_MASK ENCW(1,1,1,1, 1,1,1,1, 0,0,0,0, 0,0,0,0)
-#define CLR_INST ENCW(0,1,0,0, 0,0,1,0, 0,0,0,0, 0,0,0,0)
-#define NEG_INST ENCW(0,1,0,0, 0,1,0,0, 0,0,0,0, 0,0,0,0)
-#define NEGX_INST ENCW(0,1,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0)
-#define NOT_INST ENCW(0,1,0,0, 0,1,1,0, 0,0,0,0, 0,0,0,0)
- /* Note: very similatr to MOVEM but bit 9 differentiates. */
-#define TST_INST ENCW(0,1,0,0, 1,0,1,0, 0,0,0,0, 0,0,0,0)
-
-#define LEA_MASK ENCW(1,1,1,1, 0,0,0,1, 1,1,0,0, 0,0,0,0)
-#define LEA_INST ENCW(0,1,0,0, 0,0,0,1, 1,1,0,0, 0,0,0,0)
-
-#define CHK_MASK ENCW(1,1,1,1, 0,0,0,1, 0,1,0,0, 0,0,0,0)
-#define CHK_INST ENCW(0,1,0,0, 0,0,0,1, 0,0,0,0, 0,0,0,0)
-
-/*
- * Group bitfield/Shift/Rotate. (1110)
- */
-#define BFCHG_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0)
-#define BFCLR_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0)
-#define BFEXTS_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0)
-#define BFEXTU_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0)
-#define BFFFO_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0)
-#define BFINS_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0)
-#define BFSET_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0)
-#define BFTST_MASK ENCW(1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0)
-
-#define BFCHG_INST ENCW(1,1,1,0, 1,0,1,0, 1,1,0,0, 0,0,0,0)
-#define BFCLR_INST ENCW(1,1,1,0, 1,1,0,0, 1,1,0,0, 0,0,0,0)
-#define BFEXTS_INST ENCW(1,1,1,0, 1,0,1,1, 1,1,0,0, 0,0,0,0)
-#define BFEXTU_INST ENCW(1,1,1,0, 1,0,0,1, 1,1,0,0, 0,0,0,0)
-#define BFFFO_INST ENCW(1,1,1,0, 1,1,0,1, 1,1,0,0, 0,0,0,0)
-#define BFINS_INST ENCW(1,1,1,0, 1,1,1,1, 1,1,0,0, 0,0,0,0)
-#define BFSET_INST ENCW(1,1,1,0, 1,1,1,0, 1,1,0,0, 0,0,0,0)
-#define BFTST_INST ENCW(1,1,1,0, 1,0,0,0, 1,1,0,0, 0,0,0,0)
-
-#define AS_TYPE 0x0
-#define LS_TYPE 0x1
-#define RO_TYPE 0x3
-#define ROX_TYPE 0x2
-
-/*
- * Group DBcc/TRAPcc/ADDQ/SUBQ (0101)
- */
-#define DBcc_MASK ENCW(1,1,1,1, 0,0,0,0, 1,1,1,1, 1,0,0,0)
-#define TRAPcc_MASK ENCW(1,1,1,1, 0,0,0,0, 1,1,1,1, 1,0,0,0)
-#define Scc_MASK ENCW(1,1,1,1, 0,0,0,0, 1,1,0,0, 0,0,0,0)
-#define ADDQ_MASK ENCW(1,1,1,1, 0,0,0,1, 0,0,0,0, 0,0,0,0)
-#define SUBQ_MASK ENCW(1,1,1,1, 0,0,0,1, 0,0,0,0, 0,0,0,0)
-#define DBcc_INST ENCW(0,1,0,1, 0,0,0,0, 1,1,0,0, 1,0,0,0)
-#define TRAPcc_INST ENCW(0,1,0,1, 0,0,0,0, 1,1,1,1, 1,0,0,0)
-#define Scc_INST ENCW(0,1,0,1, 0,0,0,0, 1,1,0,0, 0,0,0,0)
-#define ADDQ_INST ENCW(0,1,0,1, 0,0,0,0, 0,0,0,0, 0,0,0,0)
-#define SUBQ_INST ENCW(0,1,0,1, 0,0,0,1, 0,0,0,0, 0,0,0,0)
-
-/*
- * Group ADD/ADDX (1101)
- */
-#define ADDX_MASK ENCW(1,1,1,1, 0,0,0,1, 0,0,1,1, 0,0,0,0)
-#define ADDX_INST ENCW(1,1,0,1, 0,0,0,1, 0,0,0,0, 0,0,0,0)
-#define ADD_MASK ENCW(1,1,1,1, 0,0,0,0, 0,0,0,0, 0,0,0,0)
-#define ADD_INST ENCW(1,1,0,1, 0,0,0,0, 0,0,0,0, 0,0,0,0)
-
-/*
- * Group SUB/SUBX (1001)
- */
-#define SUBX_MASK ENCW(1,1,1,1, 0,0,0,1, 0,0,1,1, 0,0,0,0)
-#define SUBX_INST ENCW(1,0,0,1, 0,0,0,1, 0,0,0,0, 0,0,0,0)
-#define SUB_MASK ENCW(1,1,1,1, 0,0,0,0, 0,0,0,0, 0,0,0,0)
-#define SUB_INST ENCW(1,0,0,1, 0,0,0,0, 0,0,0,0, 0,0,0,0)
-
-/*
- * Group CMP/CMPA/EOR (1011)
- */
-#define CMPA_MASK ENCW(1,1,1,1, 0,0,0,0, 1,1,0,0, 0,0,0,0)
-#define CMPA_INST ENCW(1,0,1,1, 0,0,0,0, 1,1,0,0, 0,0,0,0)
-
-#define CMP_MASK ENCW(1,1,1,1, 0,0,0,1, 0,0,0,0, 0,0,0,0)
-#define CMP_INST ENCW(1,0,1,1, 0,0,0,0, 0,0,0,0, 0,0,0,0)
-
-#define EOR_MASK ENCW(1,1,1,1, 0,0,0,1, 0,0,0,0, 0,0,0,0)
-#define EOR_INST ENCW(1,0,1,1, 0,0,0,1, 0,0,0,0, 0,0,0,0)
-
-/*
- * Group branch. (0110)
- */
-#define BRA_MASK ENCW(1,1,1,1, 1,1,1,1, 0,0,0,0, 0,0,0,0)
-#define BSR_MASK ENCW(1,1,1,1, 1,1,1,1, 0,0,0,0, 0,0,0,0)
-#define Bcc_MASK ENCW(1,1,1,1, 0,0,0,0, 0,0,0,0, 0,0,0,0)
-#define BRA_INST ENCW(0,1,1,0, 0,0,0,0, 0,0,0,0, 0,0,0,0)
-#define BSR_INST ENCW(0,1,1,0, 0,0,0,1, 0,0,0,0, 0,0,0,0)
-#define Bcc_INST ENCW(0,1,1,0, 0,0,0,0, 0,0,0,0, 0,0,0,0)
-
-
-/*
- * Group SBCD/DIVx/OR (1000)
- */
-
-#define UNPKA_MASK ENCW(1,1,1,1, 0,0,0,1, 1,1,1,1, 1,0,0,0)
-#define UNPKD_MASK ENCW(1,1,1,1, 0,0,0,1, 1,1,1,1, 1,0,0,0)
-#define UNPKA_INST ENCW(1,0,0,0, 0,0,0,1, 1,0,0,0, 1,0,0,0)
-#define UNPKD_INST ENCW(1,0,0,0, 0,0,0,1, 1,0,0,0, 0,0,0,0)
-#define SBCDA_MASK ENCW(1,1,1,1, 0,0,0,1, 1,1,1,1, 1,0,0,0)
-#define SBCDD_MASK ENCW(1,1,1,1, 0,0,0,1, 1,1,1,1, 1,0,0,0)
-#define SBCDA_INST ENCW(1,0,0,0, 0,0,0,1, 0,0,0,0, 1,1,1,1)
-#define SBCDD_INST ENCW(1,0,0,0, 0,0,0,1, 0,0,0,0, 0,1,1,1)
-
-#define DIVSW_MASK ENCW(1,1,1,1, 0,0,0,1, 1,1,0,0, 0,0,0,0)
-#define DIVUW_MASK ENCW(1,1,1,1, 0,0,0,1, 1,1,0,0, 0,0,0,0)
-#define DIVSW_INST ENCW(1,0,0,0, 0,0,0,1, 1,1,0,0, 0,0,0,0)
-#define DIVUW_INST ENCW(1,0,0,0, 0,0,0,0, 1,1,0,0, 0,0,0,0)
-
-#define OR_MASK ENCW(1,1,1,1, 0,0,0,0, 0,0,0,0, 0,0,0,0)
-#define OR_INST ENCW(1,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0)
-
-/*
- * Group AND/MUL/ABCD/EXG (1100)
- */
-#define ABCDA_MASK ENCW(1,1,1,1, 0,0,0,1, 1,1,1,1, 1,0,0,0)
-#define ABCDD_MASK ENCW(1,1,1,1, 0,0,0,1, 1,1,1,1, 1,0,0,0)
-#define ABCDA_INST ENCW(1,1,0,0, 0,0,0,1, 0,0,0,0, 1,0,0,0)
-#define ABCDD_INST ENCW(1,1,0,0, 0,0,0,1, 0,0,0,0, 0,0,0,0)
-
-#define MULSW_MASK ENCW(1,1,1,1, 0,0,0,1, 1,1,0,0, 0,0,0,0)
-#define MULUW_MASK ENCW(1,1,1,1, 0,0,0,1, 1,1,0,0, 0,0,0,0)
-#define MULSW_INST ENCW(1,1,0,0, 0,0,0,1, 1,1,0,0, 0,0,0,0)
-#define MULUW_INST ENCW(1,1,0,0, 0,0,0,0, 1,1,0,0, 0,0,0,0)
-
-#define EXG_MASK ENCW(1,1,1,1, 0,0,0,1, 0,0,1,1, 0,0,0,0)
-#define EXG_INST ENCW(1,1,0,0, 0,0,0,1, 0,0,0,0, 0,0,0,0)
-
-#define AND_MASK ENCW(1,1,1,1, 0,0,0,0, 0,0,0,0, 0,0,0,0)
-#define AND_INST ENCW(1,1,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0)
-
-#define ENCFT(b5,b4,b3,b2,b1,b0) ENCB(0,0,b5,b4,b3,b2,b1,b0)
-
-#define FABS ENCFT(0,1,1,0,0,0)
-#define FACOS ENCFT(0,1,1,1,0,0)
-#define FADD ENCFT(1,0,0,0,1,0)
-#define FASIN ENCFT(0,0,1,1,0,0)
-#define FATAN ENCFT(0,0,1,0,1,0)
-#define FATANH ENCFT(0,0,1,1,0,1)
-#define FCMP ENCFT(1,1,1,0,0,0)
-#define FCOS ENCFT(0,1,1,1,0,1)
-#define FCOSH ENCFT(0,1,1,0,0,1)
-#define FDIV ENCFT(1,0,0,0,0,0)
-#define FETOX ENCFT(0,1,0,0,0,0)
-#define FGETEXP ENCFT(0,1,1,1,1,0)
-#define FGETMAN ENCFT(0,1,1,1,1,1)
-#define FINT ENCFT(0,0,0,0,0,1)
-#define FINTRZ ENCFT(0,0,0,0,1,1)
-#define FLOG10 ENCFT(0,1,0,1,0,1)
-#define FLOG2 ENCFT(0,1,0,1,1,0)
-#define FLOGN ENCFT(0,1,0,1,0,0)
-#define FLOGNP1 ENCFT(0,0,0,1,1,0)
-#define FMOD ENCFT(1,0,0,0,0,1)
-#define FMOVE ENCFT(0,0,0,0,0,0)
-#define FMUL ENCFT(1,0,0,0,1,1)
-#define FNEG ENCFT(0,1,1,0,1,0)
-#define FREM ENCFT(1,0,0,1,0,1)
-#undef FSCALE
-#define FSCALE ENCFT(1,0,0,1,1,0)
-#define FSGLDIV ENCFT(1,0,0,1,0,0)
-#define FSGLMUL ENCFT(1,0,0,1,1,1)
-#define FSIN ENCFT(0,0,1,1,1,0)
-#define FSINH ENCFT(0,0,0,0,1,0)
-#define FSQRT ENCFT(0,0,0,1,0,0)
-#define FSUB ENCFT(1,0,1,0,0,0)
-#define FTAN ENCFT(0,0,1,1,1,1)
-#define FTANH ENCFT(0,0,1,0,0,1)
-#define FTENTOX ENCFT(0,1,0,0,1,0)
-#define FTST ENCFT(1,1,1,0,1,0)
-#define FTWOTOX ENCFT(0,1,0,0,0,1)
-
-enum getmod_flag { GETMOD_BEFORE = -1, GETMOD_AFTER = -2 };
-
-enum opcode_flags {
- CPU_000 = 0x1, CPU_010 = 0x2, CPU_020 = 0x4, CPU_030 = 0x8,
- CPU_040 = 0x10, FPU_881 = 0x40, FPU_882 = 0x80, FPU_040 = 0x100,
- MMU_851 = 0x400, MMU_030 = 0x800, MMU_040 = 0x1000,
-
- CPU_ANY = CPU_000 | CPU_010 | CPU_020 | CPU_030 | CPU_040,
- FPU_ANY = FPU_881 | FPU_882 | FPU_040,
- MMU_ANY = MMU_851 | MMU_030 | MMU_040,
- CPU_020UP = CPU_020 | CPU_030 | CPU_040,
-};
-
-enum mod_types {
- DR_DIR = 0,
- AR_DIR, AR_IND, AR_INC, AR_DEC,
- AR_DIS, AR_IDX, MOD_SPECIAL
-};
-
-enum sizes { SIZE_BYTE = sizeof(char), SIZE_WORD = sizeof(short),
- SIZE_LONG = sizeof(long), SIZE_SINGLE = 5, SIZE_QUAD = 6,
- SIZE_DOUBLE = SIZE_QUAD, SIZE_EXTENDED = 7, SIZE_PACKED = 8 };
-
-struct dis_buffer {
- short *val; /* pointer to memory. */
- char *dasm; /* actual dasm. */
- char *casm; /* current position in dasm. */
- char *info; /* extra info. */
- char *cinfo; /* current position in info. */
- int used; /* length used. */
- int mit; /* use mit sytanx. */
-};
-typedef struct dis_buffer dis_buffer_t;
-
-#define ISBITSET(val,b) ((val) & (1 << (b)))
-#define BITFIELD_MASK(sb,eb) (((1 << ((sb) + 1))-1) & (~((1 << (eb))-1)))
-#define BITFIELD(val,sb,eb) ((BITFIELD_MASK(sb,eb) & (val)) >> (eb))
-#define OPCODE_MAP(x) (BITFIELD(x,15,12))
-#ifdef __STDC__
-#define IS_INST(inst,val) ((inst ## _MASK & (val)) == inst ## _INST)
-#else
-#define IS_INST(inst,val) ((inst/**/_MASK & (val)) == inst/**/_INST)
-#endif
-#define PRINT_FPREG(dbuf, reg) addstr(dbuf, fpregs[reg])
-#define PRINT_DREG(dbuf, reg) addstr(dbuf, dregs[reg])
-#define PRINT_AREG(dbuf, reg) addstr(dbuf, aregs[reg])
-
-db_addr_t db_disasm(db_addr_t loc, boolean_t moto_syntax);
-void get_modregstr_moto(dis_buffer_t *dbuf, int bit, int mod, int sz, int dd);
-void get_modregstr_mit(dis_buffer_t *dbuf, int bit, int mod, int sz, int dd);
-u_long get_areg_val(int reg);
diff --git a/sys/arch/m68k/m68k/db_interface.c b/sys/arch/m68k/m68k/db_interface.c
deleted file mode 100644
index c8146d17480..00000000000
--- a/sys/arch/m68k/m68k/db_interface.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/* $OpenBSD: db_interface.c,v 1.13 2005/05/01 09:55:49 miod Exp $ */
-/* $NetBSD: db_interface.c,v 1.24 1997/02/18 22:27:32 gwr Exp $ */
-
-/*
- * Mach Operating System
- * Copyright (c) 1992 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- */
-
-/*
- * Interface to the "ddb" kernel debugger.
- */
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/reboot.h>
-#include <sys/systm.h> /* just for boothowto --eichin */
-
-#include <uvm/uvm_extern.h>
-
-#include <dev/cons.h>
-
-#include <machine/trap.h>
-#include <machine/db_machdep.h>
-
-#include <ddb/db_command.h>
-#include <ddb/db_var.h>
-#include <ddb/db_sym.h>
-#include <ddb/db_extern.h>
-
-
-extern label_t *db_recover;
-
-int db_active = 0;
-db_regs_t ddb_regs;
-
-static void kdbprinttrap(int, int);
-
-/*
- * Received keyboard interrupt sequence.
- */
-void
-kdb_kintr(regs)
- register db_regs_t *regs;
-{
- if (db_active == 0 && (boothowto & RB_KDB)) {
- printf("\n\nkernel: keyboard interrupt\n");
- kdb_trap(-1, regs);
- }
-}
-
-/*
- * kdb_trap - field a TRACE or BPT trap
- * Return non-zero if we "handled" the trap.
- */
-int
-kdb_trap(type, regs)
- int type;
- register db_regs_t *regs;
-{
-
- switch (type) {
- case T_TRACE: /* single-step */
- case T_BREAKPOINT: /* breakpoint */
-/* case T_WATCHPOINT:*/
- break;
- case -1:
- break;
- default:
- if (!db_panic)
- return (0);
-
- kdbprinttrap(type, 0);
- if (db_recover != 0) {
- /* This will longjmp back to db_command_loop */
- db_error("Caught exception in ddb.\n");
- /*NOTREACHED*/
- }
- /*
- * Tell caller "We did NOT handle the trap."
- * Caller should panic or whatever.
- */
- return (0);
- }
-
- /*
- * We'd like to be on a separate debug stack here, but
- * that's easier to do in locore.s before we get here.
- * See sun3/locore.s:T_TRACE for stack switch code.
- */
-
- ddb_regs = *regs;
-
- db_active++;
- cnpollc(TRUE); /* set polling mode, unblank video */
-
- db_trap(type, 0); /* where the work happens */
-
- cnpollc(FALSE); /* resume interrupt mode */
- db_active--;
-
- *regs = ddb_regs;
-
- /*
- * Indicate that single_step is for KDB.
- * But lock out interrupts to prevent TRACE_KDB from setting the
- * trace bit in the current SR (and trapping while exiting KDB).
- */
- (void) splhigh();
-
- /*
- * Tell caller "We HAVE handled the trap."
- * Caller will return to locore and rte.
- */
- return(1);
-}
-
-extern char *trap_type[];
-extern int trap_types;
-
-/*
- * Print trap reason.
- */
-static void
-kdbprinttrap(type, code)
- int type, code;
-{
- printf("kernel: ");
- if (type >= trap_types || type < 0)
- printf("type %d", type);
- else
- printf("%s", trap_type[type]);
- printf(" trap\n");
-}
-
-void
-Debugger()
-{
- __asm ("trap #15");
-}
-
diff --git a/sys/arch/m68k/m68k/db_memrw.c b/sys/arch/m68k/m68k/db_memrw.c
deleted file mode 100644
index 95077c35f1b..00000000000
--- a/sys/arch/m68k/m68k/db_memrw.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/* $OpenBSD: db_memrw.c,v 1.4 2002/03/14 03:15:54 millert Exp $ */
-/* $NetBSD: db_memrw.c,v 1.1 1996/02/22 23:23:35 gwr Exp $ */
-
-/*
- * Mach Operating System
- * Copyright (c) 1992 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- */
-
-/*
- * Interface to the debugger for virtual memory read/write.
- * This is a simple version for kernels with writable text.
- * For an example of read-only kernel text, see the file:
- * sys/arch/sun3/sun3/db_memrw.c
- *
- * ALERT! If you want to access device registers with a
- * specific size, then the read/write functions have to
- * make sure to do the correct sized pointer access.
- */
-
-#include <sys/param.h>
-#include <sys/proc.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/db_machdep.h>
-
-#include <ddb/db_access.h>
-
-/*
- * Read bytes from kernel address space for debugger.
- */
-void
-db_read_bytes(addr, size, data)
- db_addr_t addr;
- register size_t size;
- register char *data;
-{
- register char *src = (char *)addr;
-
- if (size == 4) {
- *((int *)data) = *((int *)src);
- return;
- }
-
- if (size == 2) {
- *((short *)data) = *((short *)src);
- return;
- }
-
- while (size > 0) {
- --size;
- *data++ = *src++;
- }
-}
-
-/*
- * Write bytes to kernel address space for debugger.
- */
-void
-db_write_bytes(addr, size, data)
- db_addr_t addr;
- register size_t size;
- register char *data;
-{
- register char *dst = (char *)addr;
-
- if (size == 4) {
- *((int *)dst) = *((int *)data);
- return;
- }
-
- if (size == 2) {
- *((short *)dst) = *((short *)data);
- return;
- }
-
- while (size > 0) {
- --size;
- *dst++ = *data++;
- }
-}
-
diff --git a/sys/arch/m68k/m68k/db_trace.c b/sys/arch/m68k/m68k/db_trace.c
deleted file mode 100644
index c69caa9a0d2..00000000000
--- a/sys/arch/m68k/m68k/db_trace.c
+++ /dev/null
@@ -1,619 +0,0 @@
-/* $OpenBSD: db_trace.c,v 1.17 2002/05/18 09:49:17 art Exp $ */
-/* $NetBSD: db_trace.c,v 1.20 1997/02/05 05:10:25 scottr Exp $ */
-
-/*
- * Mach Operating System
- * Copyright (c) 1992 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- */
-
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/systm.h>
-
-#include <machine/db_machdep.h>
-
-#include <ddb/db_interface.h>
-#include <ddb/db_output.h>
-#include <ddb/db_access.h>
-#include <ddb/db_sym.h>
-#include <ddb/db_variables.h>
-
-extern label_t *db_recover;
-
-/*
- * Register list
- */
-static int db_var_short(struct db_variable *, db_expr_t *, int);
-
-struct db_variable db_regs[] = {
- /* D0-D7 */
- { "d0", (long *)&ddb_regs.tf_regs[0], FCN_NULL },
- { "d1", (long *)&ddb_regs.tf_regs[1], FCN_NULL },
- { "d2", (long *)&ddb_regs.tf_regs[2], FCN_NULL },
- { "d3", (long *)&ddb_regs.tf_regs[3], FCN_NULL },
- { "d4", (long *)&ddb_regs.tf_regs[4], FCN_NULL },
- { "d5", (long *)&ddb_regs.tf_regs[5], FCN_NULL },
- { "d6", (long *)&ddb_regs.tf_regs[6], FCN_NULL },
- { "d7", (long *)&ddb_regs.tf_regs[7], FCN_NULL },
- /* A0-A7 */
- { "a0", (long *)&ddb_regs.tf_regs[8+0], FCN_NULL },
- { "a1", (long *)&ddb_regs.tf_regs[8+1], FCN_NULL },
- { "a2", (long *)&ddb_regs.tf_regs[8+2], FCN_NULL },
- { "a3", (long *)&ddb_regs.tf_regs[8+3], FCN_NULL },
- { "a4", (long *)&ddb_regs.tf_regs[8+4], FCN_NULL },
- { "a5", (long *)&ddb_regs.tf_regs[8+5], FCN_NULL },
- { "a6", (long *)&ddb_regs.tf_regs[8+6], FCN_NULL },
- { "sp", (long *)&ddb_regs.tf_regs[8+7], FCN_NULL },
- /* misc. */
- { "pc", (long *)&ddb_regs.tf_pc, FCN_NULL },
- { "sr", (long *)&ddb_regs.tf_sr, db_var_short }
-};
-struct db_variable *db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]);
-
-static int
-db_var_short(varp, valp, op)
- struct db_variable *varp;
- db_expr_t *valp;
- int op;
-{
- if (op == DB_VAR_GET)
- *valp = (db_expr_t) *((short *)varp->valuep);
- else
- *((short *)varp->valuep) = (short) *valp;
- return(0);
-}
-
-#define MAXINT 0x7fffffff
-
-#if 0
-#define INKERNEL(va) (((vaddr_t)(va)) >= VM_MIN_KERNEL_ADDRESS && \
- (((vaddr_t)(va)) < (USRSTACK - MAXSSIZ) || \
- ((vaddr_t)(va)) >= USRSTACK))
-#else
-/* XXX - Slight hack... */
-extern int curpcb;
-#define INKERNEL(va) (((int)(va) > curpcb) && \
- ((int)(va) < (curpcb + USPACE)))
-#endif
-
-#define get(addr, space) \
- (db_get_value((db_addr_t)(addr), sizeof(int), FALSE))
-#define get16(addr, space) \
- (db_get_value((db_addr_t)(addr), sizeof(u_short), FALSE))
-
-#define NREGISTERS 16
-
-struct stackpos {
- int k_pc;
- int k_fp;
- int k_nargs;
- int k_entry;
- int k_caller;
- int k_flags;
- int k_regloc[NREGISTERS];
-};
-
-static void findentry(struct stackpos *);
-static void findregs(struct stackpos *, db_addr_t);
-static int nextframe(struct stackpos *, int);
-static void stacktop(db_regs_t *, struct stackpos *);
-
-
-#define FR_SAVFP 0
-#define FR_SAVPC 4
-#define K_CALLTRAMP 1 /* for k_flags: caller is __sigtramp */
-#define K_SIGTRAMP 2 /* for k_flags: this is __sigtramp */
-
-static void
-stacktop(regs, sp)
- db_regs_t *regs;
- struct stackpos *sp;
-{
- int i;
-
- /* Note: leave out a6, a7 */
- for (i = 0; i < (8+6); i++) {
- sp->k_regloc[i] = (int) &regs->tf_regs[i];
- }
-
- sp->k_fp = get(&regs->tf_regs[8+6], 0);
- /* skip sp (a7) */
- sp->k_pc = get(&regs->tf_pc, 0);
- sp->k_flags = 0;
-
- findentry(sp);
-}
-
-
-/*
- * The VAX has a very nice calling convention, and it is quite easy to
- * find saved registers, and the number of parameters. We are not nearly
- * so lucky. We must grub around in code for much of this information
- * (remember the PDP-11?), and the saved register list seems to be
- * especially hard to find.
- */
-
-#define HIWORD 0xffff0000
-#define LOWORD 0x0000ffff
-#define LINKLA6 0x480e0000 /* linkl a6,#x */
-#define LINKWA6 0x4e560000 /* linkw a6,#x */
-#define ADDLSP 0xdffc0000 /* addl #x,sp */
-#define ADDWSP 0xdefc0000 /* addw #x,sp */
-#define LEASP 0x4fef0000 /* lea sp@(x),sp*/
-#define TSTBSP 0x4a2f0000 /* tstb sp@(x) */
-#define INSMSK 0xfff80000
-#define MOVLSP 0x2e800000 /* movl dx,sp@ */
-#define MOVLD0 0x20000000 /* movl d0,dx */
-#define MOVLA0 0x20400000 /* movl d0,ax */
-#define MVLMSK 0xf1ff0000
-#define MOVEML 0x48d70000 /* moveml #x,sp@ */
-#define JSR 0x4eb80000 /* jsr x.[WL] */
-#define JSRPC 0x4eba0000 /* jsr PC@( ) */
-#define LONGBIT 0x00010000
-#define BSR 0x61000000 /* bsr x */
-#define BSRL 0x61ff0000 /* bsrl x */
-#define BYTE3 0x0000ff00
-#define LOBYTE 0x000000ff
-#define ADQMSK 0xf1ff0000
-#define ADDQSP 0x508f0000 /* addql #x,sp */
-#define ADDQWSP 0x504f0000 /* addqw #x,sp */
-
-struct nlist * trampsym = 0;
-struct nlist * funcsym = 0;
-
-static int
-nextframe(sp, kerneltrace)
- struct stackpos *sp;
- int kerneltrace;
-{
- int i;
- db_addr_t addr;
- db_addr_t calladdr;
- db_addr_t oldfp = sp->k_fp;
-
- /*
- * Find our entry point. Then find out
- * which registers we saved, and map them.
- * Our entry point is the address our caller called.
- */
-
- calladdr = sp->k_caller;
- addr = sp->k_entry;
- if (sp->k_flags & K_CALLTRAMP) {
-#if 0
- /* we never set CALLTRAMP */
- /*
- * Caller was sigtramp. Therefore:
- * - no registers were saved;
- * - no new frame-pointer
- * - caller found in sigcontext structure.
- * - WE become sigtramp
- * - we have no parameters
- * MUCH MAGIC USED IN FINDING CALLER'S PC.
- */
- sp->k_pc = sp->k_caller;
- sp->k_entry = trampsym->n_value;
- sp->k_flags = 0;
- addr = get(sp->k_fp + sizeof(int) * 11, DSP);
- sp->k_nargs = 0;
-#if DEBUG
- db_printf("nextframe: sigcontext at 0x%x, signaled at 0x%x\n",
- addr, sp->k_caller);
-#endif
- errflg = 0;
-#endif /* 0 */
- } else {
- if (addr == MAXINT) {
- /* we don't know what registers are involved here--
- invalidate all */
- for (i = 0; i < NREGISTERS; i++)
- sp->k_regloc[i] = -1;
- } else
- findregs(sp, addr);
-
- /* find caller's pc and fp */
- sp->k_pc = calladdr;
- sp->k_fp = get(sp->k_fp + FR_SAVFP, DSP);
-
- /*
- * Now that we have assumed the identity of our caller, find
- * how many longwords of argument WE were called with.
- */
- sp->k_flags = 0;
-
- /*
- * Don't dig around in user stack to find no. of args and
- * entry point if just tracing the kernel
- */
- if (kerneltrace && !INKERNEL(sp->k_fp)) {
- sp->k_nargs = 0;
- sp->k_entry = MAXINT;
- } else
- findentry(sp);
- }
-
- if (sp->k_fp == 0 || oldfp == sp->k_fp)
- return 0;
- return (sp->k_fp);
-}
-
-static void
-findentry(sp)
- struct stackpos *sp;
-{
- /*
- * Set the k_nargs and k_entry fields in the stackpos structure. This
- * is called from stacktop() and from nextframe(). Our caller will do
- * an addq or addl or addw to sp just after we return to pop off our
- * arguments. Find that instruction and extract the value.
- */
- int instruc;
- int val;
- db_addr_t addr, nextword;
- label_t db_jmpbuf;
- label_t *savejmp;
-
- savejmp = db_recover;
- db_recover = &db_jmpbuf;
- if (setjmp(&db_jmpbuf)) {
- /* oops -- we touched something we ought not to have */
- /* cannot trace caller of "start" */
- sp->k_entry = MAXINT;
- sp->k_nargs = 0;
- db_recover = savejmp;
- return;
- }
-
- addr = get(sp->k_fp + FR_SAVPC, DSP);
- if (addr == 0) {
- /* oops -- we touched something we ought not to have */
- /* cannot trace caller of "start" */
- sp->k_entry = MAXINT;
- sp->k_nargs = 0;
- db_recover = savejmp;
- return;
- }
- instruc = get(addr - 6, ISP);
- nextword = get(addr - 4, ISP);
-
- db_recover = savejmp;
-
- if ((instruc & HIWORD) == (JSR | LONGBIT)) {
- /* longword offset here */
- sp->k_caller = addr - 6;
- sp->k_entry = nextword;
- } else if ((instruc & HIWORD) == BSRL) {
- /* longword self-relative offset */
- sp->k_caller = addr - 6;
- sp->k_entry = nextword + (addr - 4);
- } else {
- instruc = nextword;
- if ((instruc & HIWORD) == JSR) {
- /* short word offset */
- sp->k_caller = addr - 4;
- sp->k_entry = instruc & LOWORD;
- } else if ((instruc & HIWORD) == BSR) {
- /* short word, self-relative offset */
- sp->k_caller = addr - 4;
- sp->k_entry = (addr - 2) + (short)(instruc & LOWORD);
- } else if ((instruc & HIWORD) == JSRPC) {
- /* PC-relative, short word offset */
- sp->k_caller = addr - 4;
- sp->k_entry = (addr - 2) + (instruc & LOWORD);
- } else {
- if ((instruc & BYTE3) == (BSR >> 16)) {
- /* byte, self-relative offset */
- sp->k_caller = addr - 2;
- sp->k_entry = addr + (char)(instruc & LOBYTE);
- } else {
- /* was a call through a proc parameter */
- sp->k_caller = addr - 2;
- sp->k_entry = MAXINT;
- /*
- * We know that sigtramp calls your signal
- * catcher this way -- see if this is the
- * tramp: if so then:
- * - set the K_CALLTRAMP flag, for use by
- * nextframe();
- * - take k_entry from __sigfunc array.
- */
-#if 0
- /* not in kernel */
- /*
- * The number (9) in the below expression is
- * magic: it is the number of stack items below
- * callee`s fp and sigtramp`s copy of the
- * signal number.
- */
- if (trampsym &&
- (findsym(sp->k_caller, ISYM), cursym == trampsym)) {
- int signl;
- sp->k_flags |= K_CALLTRAMP;
- if (funcsym) {
- signl = get(sp->k_fp + sizeof(int) * 9, DSP);
- sp->k_entry = get(funcsym->n_value+(sizeof(int(*)()))*signl, DSP);
- } else
- sp->k_entry = -1;
-
- errflg = 0;
-#ifdef DEBUG
- db_printf("Caller is sigtramp: signal is %d: entry is %x\n",
- signl, sp->k_entry);
-#endif
- }
-#ifdef DEBUG
- else
- db_printf("Non-tramp jsr a0@\n");
-#endif
-#endif /* 0 */
- }
- }
- }
- instruc = get(addr, ISP);
- /* on bad days, the compiler dumps a register move here */
- if ((instruc & MVLMSK) == MOVLA0 ||
- (instruc & MVLMSK) == MOVLD0)
- instruc = get(addr += 2, ISP);
- if ((instruc & ADQMSK) == ADDQSP ||
- (instruc & ADQMSK) == ADDQWSP) {
- val = 0;
- do {
- int n;
- n = (instruc >> (16+9)) & 07;
- if (n == 0)
- n = 8;
- val += n;
- instruc = get(addr += 2, ISP);
- } while ((instruc & ADQMSK) == ADDQSP ||
- (instruc & ADQMSK) == ADDQWSP);
- } else if ((instruc & HIWORD) == ADDLSP)
- val = get(addr + 2, ISP);
- else if ((instruc & HIWORD) == ADDWSP ||
- (instruc & HIWORD) == LEASP)
- val = instruc & LOWORD;
- else
- val = 20;
- sp->k_nargs = val / 4;
-}
-
-/*
- * Look at the procedure prolog of the current called procedure.
- * Figure out which registers we saved, and where they are
- */
-static void
-findregs(sp, addr)
- struct stackpos *sp;
- db_addr_t addr;
-{
- long instruc, val, i;
- int regp;
-
- regp = 0;
- instruc = get(addr, ISP);
- if ((instruc & HIWORD) == LINKLA6) {
- instruc = get(addr + 2, ISP);
- addr += 6;
- regp = sp->k_fp + instruc;
- } else if ((instruc & HIWORD) == LINKWA6) {
- addr += 4;
- if ((instruc &= LOWORD) == 0) {
- /* look for addl */
- instruc = get(addr, ISP);
- if ((instruc & HIWORD) == ADDLSP) {
- instruc = get(addr + 2, ISP);
- addr += 6;
- }
- /* else frame is really size 0 */
- } else {
- /* link offset was non-zero -- sign extend it */
- instruc <<= 16;
- instruc >>= 16;
- }
- /* we now have the negative frame size */
- regp = sp->k_fp + instruc;
- }
-
- /* find which registers were saved */
- /* (expecting probe instruction next) */
- instruc = get(addr, ISP);
- if ((instruc & HIWORD) == TSTBSP)
- addr += 4;
-
- /* now we expect either a moveml or a movl */
- instruc = get(addr, ISP);
- if ((instruc & INSMSK) == MOVLSP) {
- /* only saving one register */
- i = (instruc >> 16) & 07;
- sp->k_regloc[i] = regp;
- } else if ((instruc & HIWORD) == MOVEML) {
- /* saving multiple registers or unoptimized code */
- val = instruc & LOWORD;
- i = 0;
- while (val) {
- if (val & 1) {
- sp->k_regloc[i] = regp;
- regp += sizeof(int);
- }
- val >>= 1;
- i++;
- }
- }
- /* else no registers saved */
-}
-
-/*
- * Frame tracing.
- */
-void
-db_stack_trace_print(addr, have_addr, count, modif, pr)
- db_expr_t addr;
- int have_addr;
- db_expr_t count;
- char *modif;
- int (*pr)(const char *, ...);
-{
- int i, nargs;
- long val;
- db_addr_t regp;
- char * name;
- struct stackpos pos;
- boolean_t kernel_only = TRUE;
- int fault_pc = 0;
-
- {
- char *cp = modif;
- char c;
-
- while ((c = *cp++) != 0)
- if (c == 'u')
- kernel_only = FALSE;
- }
-
- if (count == -1)
- count = 65535;
-
- if (!have_addr)
- stacktop(&ddb_regs, &pos);
-#if 0
- else {
-
- /*
- * Only have user register state.
- */
- pcb_t t_pcb;
- db_regs_t *user_regs;
-
- t_pcb = (pcb_t) get(&th->pcb, 0);
- user_regs = (db_regs_t *)
- get(&t_pcb->user_regs, 0);
-
- stacktop(user_regs, &pos);
-
- /* foo*/
- }
-#endif
- else {
- pos.k_flags = 0;
- pos.k_fp = addr;
-
- pos.k_nargs = 0;
- pos.k_pc = MAXINT;
- pos.k_entry = MAXINT;
- /* sorry, we cannot find our registers without knowing our pc */
- for (i = 0; i < NREGISTERS; i++)
- pos.k_regloc[i] = 0;
- findentry(&pos);
- }
-
- while (count) {
- count--;
-
- /* HACK */
- if (pos.k_pc == MAXINT) {
- name = "?";
- pos.k_pc = 0;
- } else {
- db_find_sym_and_offset(pos.k_pc, &name, &val);
- if (name == 0) {
- val = MAXINT;
- name = "?";
- }
- }
-
- /*
- * Since faultstkadj doesn't set up a valid stack frame,
- * we would assume it was the source of the fault. To
- * get around this we peek at the fourth argument of
- * "trap()" (the stack frame at the time of the fault)
- * to determine the _real_ value of PC when things wen
- * wrong.
- *
- * NOTE: If the argument list for 'trap()' ever changes,
- * we lose.
- */
- if (strcmp("_trap", name) == 0) {
- int tfp;
-
- /* Point to 'trap()'s 4th argument (frame structure) */
- tfp = pos.k_fp + FR_SAVFP + 4 + (4 * 4);
-
- /* Determine if fault was from kernel or user mode */
- regp = tfp + offsetof(struct frame, f_sr);
- if (!USERMODE(get16(regp, DSP))) {
- /*
- * Definitely a kernel mode fault,
- * so get the PC at the time of the fault.
- */
- regp = tfp + offsetof(struct frame, f_pc);
- fault_pc = get(regp, DSP);
- }
- } else
- if (fault_pc) {
- if (strcmp("faultstkadj", name) == 0) {
- db_find_sym_and_offset(fault_pc, &name, &val);
- if (name == 0) {
- val = MAXINT;
- name = "?";
- }
- }
- fault_pc = 0;
- }
-
- (*pr)("%s", name);
- if (pos.k_entry != MAXINT && name) {
- char * entry_name;
- long e_val;
-
- db_find_sym_and_offset(pos.k_entry, &entry_name,
- &e_val);
- if (entry_name != 0 && entry_name != name &&
- e_val != val) {
- (*pr)("(?)\n%s", entry_name);
- }
- }
- (*pr)("(");
- regp = pos.k_fp + FR_SAVFP + 4;
- if ((nargs = pos.k_nargs)) {
- while (nargs--) {
- (*pr)("%lx", get(regp += 4, DSP));
- if (nargs)
- (*pr)(",");
- }
- }
- if (val == MAXINT)
- (*pr)(") at %x\n", pos.k_pc);
- else
- (*pr)(") + %lx\n", val);
-
- /*
- * Stop tracing if frame ptr no longer points into kernel
- * stack.
- */
- if (kernel_only && !INKERNEL(pos.k_fp))
- break;
- if (nextframe(&pos, kernel_only) == 0)
- break;
- }
-}
-
diff --git a/sys/arch/m68k/m68k/genassym.cf b/sys/arch/m68k/m68k/genassym.cf
deleted file mode 100644
index e2af1464032..00000000000
--- a/sys/arch/m68k/m68k/genassym.cf
+++ /dev/null
@@ -1,151 +0,0 @@
-# $OpenBSD: genassym.cf,v 1.14 2011/11/01 21:20:55 miod Exp $
-
-#
-# Copyright (c) 1995 Theo de Raadt
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
-# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
-# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# Copyright (c) 1982, 1990, 1993
-# The Regents of the University of California. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. Neither the name of the University nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# @(#)genassym.c 8.3 (Berkeley) 1/4/94
-#
-
-include <sys/param.h>
-include <sys/buf.h>
-include <sys/proc.h>
-include <sys/mbuf.h>
-include <sys/msgbuf.h>
-include <sys/syscall.h>
-include <sys/types.h>
-include <sys/user.h>
-
-include <machine/cpu.h>
-include <machine/psl.h>
-
-# general constants
-export NBPG
-
-# proc fields and values
-struct proc
-member p_stat
-member p_vmspace
-member p_addr
-
-export SONPROC
-
-# contexts
-export FC_SUPERD
-export FC_USERD
-
-# PSL values
-export PSL_HIGHIPL
-
-# pcb fields
-struct pcb
-member pcb_onfault
-
-# exception frame offsets
-struct frame
-member FR_SP f_regs[15]
-member FR_HW f_sr
-member FR_ADJ f_stackadj
-
-# FP frame offsets
-struct fpframe
-member fpf_regs fpf_regs[0]
-member fpf_fpcr
-member fpf_fpsr
-member fpf_fpi fpf_fpiar
-
-# interrupt/fault metering
-struct uvmexp UVMEXP_
-member intrs
-
-# system calls
-export SYS_exit
-export SYS_sigreturn
-
-# errno
-export EFAULT
-export ENAMETOOLONG
-
-# MMU types
-export MMU_68851
-export MMU_68030
-export MMU_68040
-export MMU_68060
-
-# CPU types
-export CPU_68020
-export CPU_68030
-export CPU_68040
-export CPU_68060
-
-# FPU types
-export FPU_NONE
-export FPU_68881
-export FPU_68882
-export FPU_68040
-export FPU_68060
-export FPU_UNKNOWN
-
-# cache settings
-export CACHE_ON
-export CACHE_OFF
-export CACHE_CLR
-export CACHE40_ON
-export CACHE40_OFF
-export CACHE60_ON
-export CACHE60_OFF
-export IC_CLEAR
-export DC_CLEAR
-export IC60_CUBC
-export IC60_CABC
-
-# cpuinfo
-struct cpu_info
-member ci_curproc
diff --git a/sys/arch/m68k/m68k/in_cksum.c b/sys/arch/m68k/m68k/in_cksum.c
deleted file mode 100644
index 32863926116..00000000000
--- a/sys/arch/m68k/m68k/in_cksum.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/* $OpenBSD: in_cksum.c,v 1.4 2003/06/02 23:27:48 millert Exp $ */
-/* $NetBSD: in_cksum.c,v 1.6 1996/04/30 11:57:05 briggs Exp $ */
-
-/*
- * Copyright (c) 1988, 1990 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: in_cksum.c 1.1 90/07/09
- *
- * @(#)in_cksum.c 7.3 (Berkeley) 12/16/90
- */
-
-/*
- * in_cksum - checksum routine for the Internet Protocol family.
- */
-
-#include <sys/param.h>
-#include <sys/mbuf.h>
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-
-extern int oc_cksum(char *buffer, int length, int startingval);
-
-/*
- * Checksum routine for the Internet Protocol family.
- *
- * This isn't as bad as it looks. For ip headers the "while" isn't
- * executed and we just drop through to the return statement at the
- * end. For the usual tcp or udp packet (a single header mbuf
- * chained onto a cluster of data, we make exactly one trip through
- * the while (for the header mbuf) and never do the hairy code
- * inside the "if". If fact, if m_copydata & sb_compact are doing
- * their job, we should never do the hairy code inside the "if".
- */
-int
-in_cksum(m, len)
- register struct mbuf *m;
- register int len;
-{
- register int sum = 0;
- register int i;
-
- while (len > m->m_len) {
- sum = oc_cksum(mtod(m, u_char *), i = m->m_len, sum);
- m = m->m_next;
- len -= i;
- if (i & 1) {
- /*
- * ouch - we ended on an odd byte with more
- * to do. This xfer is obviously not interested
- * in performance so finish things slowly.
- */
- register u_char *cp;
-
- while (len > m->m_len) {
- cp = mtod(m, u_char *);
- if (i & 1) {
- i = m->m_len - 1;
- --len;
- sum += *cp++;
- } else
- i = m->m_len;
-
- sum = oc_cksum(cp, i, sum);
- m = m->m_next;
- len -= i;
- }
- if (i & 1) {
- cp = mtod(m, u_char *);
- sum += *cp++;
- return (0xffff & ~oc_cksum(cp, len - 1, sum));
- }
- }
- }
- return (0xffff & ~oc_cksum(mtod(m, u_char *), len, sum));
-}
diff --git a/sys/arch/m68k/m68k/kgdb_m68k.c b/sys/arch/m68k/m68k/kgdb_m68k.c
deleted file mode 100644
index eea13227548..00000000000
--- a/sys/arch/m68k/m68k/kgdb_m68k.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/* $OpenBSD: kgdb_m68k.c,v 1.2 2003/06/02 23:27:48 millert Exp $ */
-/* $NetBSD: kgdb_m68k.c,v 1.1 1997/02/12 00:58:01 gwr Exp $ */
-
-/*
- * Copyright (c) 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratories.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)kgdb_stub.c 8.4 (Berkeley) 1/12/94
- */
-
-/*
- * Machine-dependent (m68k) part of the KGDB remote "stub"
- */
-
-#include <sys/param.h>
-#include <sys/kgdb.h>
-
-#include <machine/frame.h>
-#include <machine/trap.h>
-
-/*
- * Translate a trap number into a unix compatible signal value.
- * (gdb only understands unix signal numbers).
- */
-int
-kgdb_signal(type)
- int type;
-{
- int sigval;
-
- switch (type) {
-
- case T_ASTFLT:
- case T_SSIR:
- sigval = SIGINT;
- break;
-
- case T_ILLINST:
- case T_PRIVINST:
- case T_FMTERR:
- sigval = SIGILL;
- break;
-
- case T_TRACE:
- case T_TRAP15:
- sigval = SIGTRAP;
- break;
-
- case T_ZERODIV:
- case T_CHKINST:
- case T_TRAPVINST:
- case T_FPERR:
- case T_COPERR:
- sigval = SIGFPE;
- break;
-
- case T_BUSERR:
- case T_ADDRERR:
- sigval = SIGBUS;
- break;
-
- case T_MMUFLT:
- sigval = SIGSEGV;
- break;
-
- default:
- sigval = SIGEMT;
- break;
- }
- return (sigval);
-}
-
-/*
- * Definitions exported from gdb.
- */
-/* KGDB_NUMREGS == 18 */
-
-#define GDB_SR 16
-#define GDB_PC 17
-
-
-/*
- * Translate the values stored in the kernel regs struct to/from
- * the format understood by gdb.
- *
- * There is a short pad word between SP (A7) and SR which keeps the
- * kernel stack long word aligned (note that this is in addition to
- * the stack adjust short that we treat as the upper half of the SR
- * (always zero). We must skip this when copying to/from gdb regs.
- */
-
-void
-kgdb_getregs(regs, gdb_regs)
- db_regs_t *regs;
- kgdb_reg_t *gdb_regs;
-{
- int i;
-
- for (i = 0; i < 16; i++)
- gdb_regs[i] = regs->tf_regs[i];
- gdb_regs[GDB_SR] = regs->tf_sr;
- gdb_regs[GDB_PC] = regs->tf_pc;
-}
-
-void
-kgdb_setregs(regs, gdb_regs)
- db_regs_t *regs;
- kgdb_reg_t *gdb_regs;
-{
- int i;
-
- for (i = 0; i < 16; i++)
- regs->tf_regs[i] = gdb_regs[i];
- regs->tf_sr = gdb_regs[GDB_SR] |
- (regs->tf_sr & PSL_T);
- regs->tf_pc = gdb_regs[GDB_PC];
-}
diff --git a/sys/arch/m68k/m68k/m68k_machdep.c b/sys/arch/m68k/m68k/m68k_machdep.c
deleted file mode 100644
index a0f8fd0b99f..00000000000
--- a/sys/arch/m68k/m68k/m68k_machdep.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/* $OpenBSD: m68k_machdep.c,v 1.18 2012/08/07 17:17:46 guenther Exp $ */
-/* $NetBSD: m68k_machdep.c,v 1.3 1997/06/12 09:57:04 veego Exp $ */
-
-/*-
- * Copyright (c) 1997 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Bernd Ernesti.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/exec.h>
-#include <sys/proc.h>
-#include <sys/syscall.h>
-#include <sys/syscall_mi.h>
-#include <sys/user.h>
-
-#include <machine/cpu.h>
-#include <machine/frame.h>
-#include <machine/reg.h>
-
-struct cpu_info cpu_info_store;
-
-/*
- * Set registers on exec.
- */
-void
-setregs(p, pack, stack, retval)
- struct proc *p;
- struct exec_package *pack;
- u_long stack;
- register_t *retval;
-{
- struct frame *frame = (struct frame *)p->p_md.md_regs;
-
- frame->f_sr = PSL_USERSET;
- frame->f_pc = pack->ep_entry & ~1;
- bzero(frame->f_regs, 15 * sizeof(register_t));
- frame->f_regs[A2] = (int)PS_STRINGS;
- frame->f_regs[SP] = stack;
-
- /* restore a null state frame */
- p->p_addr->u_pcb.pcb_fpregs.fpf_null = 0;
- if (fputype != FPU_NONE) {
- m68881_restore(&p->p_addr->u_pcb.pcb_fpregs);
- }
-
- retval[1] = 0;
-}
-
-/*
- * Process the tail end of a fork() for the child
- */
-void
-child_return(arg)
- void *arg;
-{
- struct proc *p = (struct proc *)arg;
- struct frame *f = (struct frame *)p->p_md.md_regs;
-
- f->f_regs[D0] = 0;
- f->f_sr &= ~PSL_C; /* carry bit */
- f->f_format = FMT0;
-
- mi_child_return(p);
-}
diff --git a/sys/arch/m68k/m68k/mutex.c b/sys/arch/m68k/m68k/mutex.c
deleted file mode 100644
index 6116a320e03..00000000000
--- a/sys/arch/m68k/m68k/mutex.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* $OpenBSD: mutex.c,v 1.8 2011/04/21 04:34:12 miod Exp $ */
-
-/*
- * Copyright (c) 2004 Artur Grabowski <art@openbsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/mutex.h>
-#include <sys/systm.h>
-
-#include <machine/psl.h>
-#include <machine/intr.h>
-
-#ifdef MULTIPROCESSOR
-#error This code needs work
-#endif
-
-/*
- * Single processor systems don't need any mutexes, but they need the spl
- * raising semantics of the mutexes.
- */
-void
-mtx_init(struct mutex *mtx, int wantipl)
-{
- mtx->mtx_oldipl = 0;
- mtx->mtx_wantipl = wantipl;
- mtx->mtx_lock = 0;
-}
-
-void
-mtx_enter(struct mutex *mtx)
-{
- if (mtx->mtx_wantipl != IPL_NONE)
- mtx->mtx_oldipl = _splraise(MD_IPLTOPSL(mtx->mtx_wantipl));
-
- MUTEX_ASSERT_UNLOCKED(mtx);
- mtx->mtx_lock = 1;
-#ifdef DIAGNOSTIC
- curcpu()->ci_mutex_level++;
-#endif
-}
-
-int
-mtx_enter_try(struct mutex *mtx)
-{
- if (mtx->mtx_wantipl != IPL_NONE)
- mtx->mtx_oldipl = _splraise(MD_IPLTOPSL(mtx->mtx_wantipl));
- MUTEX_ASSERT_UNLOCKED(mtx);
- mtx->mtx_lock = 1;
-#ifdef DIAGNOSTIC
- curcpu()->ci_mutex_level++;
-#endif
-
- return 1;
-}
-
-void
-mtx_leave(struct mutex *mtx)
-{
- MUTEX_ASSERT_LOCKED(mtx);
-#ifdef DIAGNOSTIC
- curcpu()->ci_mutex_level--;
-#endif
- mtx->mtx_lock = 0;
- if (mtx->mtx_wantipl != IPL_NONE)
- splx(mtx->mtx_oldipl);
-}
diff --git a/sys/arch/m68k/m68k/oc_cksum.s b/sys/arch/m68k/m68k/oc_cksum.s
deleted file mode 100644
index ae94906f28f..00000000000
--- a/sys/arch/m68k/m68k/oc_cksum.s
+++ /dev/null
@@ -1,184 +0,0 @@
-| $OpenBSD: oc_cksum.s,v 1.4 2013/02/02 13:32:06 miod Exp $
-| $NetBSD: oc_cksum.s,v 1.4 1994/10/26 07:51:13 cgd Exp $
-
-| Copyright (c) 1988 Regents of the University of California.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions
-| are met:
-| 1. Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| 2. Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| 3. Neither the name of the University nor the names of its contributors
-| may be used to endorse or promote products derived from this software
-| without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-| ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-| IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-| ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-| FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-| DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-| OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-| LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-| OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-| SUCH DAMAGE.
-|
-| @(#)oc_cksum.s 7.2 (Berkeley) 11/3/90
-|
-|
-| oc_cksum: ones complement 16 bit checksum for MC68020.
-|
-| oc_cksum (buffer, count, strtval)
-|
-| Do a 16 bit one's complement sum of 'count' bytes from 'buffer'.
-| 'strtval' is the starting value of the sum (usually zero).
-|
-| It simplifies life in in_cksum if strtval can be >= 2^16.
-| This routine will work as long as strtval is < 2^31.
-|
-| Performance
-| -----------
-| This routine is intended for MC 68020s but should also work
-| for 68030s. It (deliberately) doesn't worry about the alignment
-| of the buffer so will only work on a 68010 if the buffer is
-| aligned on an even address. (Also, a routine written to use
-| 68010 "loop mode" would almost certainly be faster than this
-| code on a 68010).
-|
-| We don't worry about alignment because this routine is frequently
-| called with small counts: 20 bytes for IP header checksums and 40
-| bytes for TCP ack checksums. For these small counts, testing for
-| bad alignment adds ~10% to the per-call cost. Since, by the nature
-| of the kernel's allocator, the data we're called with is almost
-| always longword aligned, there is no benefit to this added cost
-| and we're better off letting the loop take a big performance hit
-| in the rare cases where we're handed an unaligned buffer.
-|
-| Loop unrolling constants of 2, 4, 8, 16, 32 and 64 times were
-| tested on random data on four different types of processors (see
-| list below -- 64 was the largest unrolling because anything more
-| overflows the 68020 Icache). On all the processors, the
-| throughput asymptote was located between 8 and 16 (closer to 8).
-| However, 16 was substantially better than 8 for small counts.
-| (It's clear why this happens for a count of 40: unroll-8 pays a
-| loop branch cost and unroll-16 doesn't. But the tests also showed
-| that 16 was better than 8 for a count of 20. It's not obvious to
-| me why.) So, since 16 was good for both large and small counts,
-| the loop below is unrolled 16 times.
-|
-| The processors tested and their average time to checksum 1024 bytes
-| of random data were:
-| Sun 3/50 (15MHz) 190 us/KB
-| Sun 3/180 (16.6MHz) 175 us/KB
-| Sun 3/60 (20MHz) 134 us/KB
-| Sun 3/280 (25MHz) 95 us/KB
-|
-| The cost of calling this routine was typically 10% of the per-
-| kilobyte cost. E.g., checksumming zero bytes on a 3/60 cost 9us
-| and each additional byte cost 125ns. With the high fixed cost,
-| it would clearly be a gain to "inline" this routine -- the
-| subroutine call adds 400% overhead to an IP header checksum.
-| However, in absolute terms, inlining would only gain 10us per
-| packet -- a 1% effect for a 1ms ethernet packet. This is not
-| enough gain to be worth the effort.
-
-#include <m68k/asm.h>
-
- .text
-
-ENTRY(oc_cksum)
- movl %sp@(4),%a0 | get buffer ptr
- movl %sp@(8),%d1 | get byte count
- movl %sp@(12),%d0 | get starting value
- movl %d2,%sp@- | free a reg
-
- | test for possible 1, 2 or 3 bytes of excess at end
- | of buffer. The usual case is no excess (the usual
- | case is header checksums) so we give that the faster
- | 'not taken' leg of the compare. (We do the excess
- | first because we're about the trash the low order
- | bits of the count in d1.)
-
- btst #0,%d1
- jne L5 | if one or three bytes excess
- btst #1,%d1
- jne L7 | if two bytes excess
-L1:
- movl %d1,%d2
- lsrl #6,%d1 | make cnt into # of 64 byte chunks
- andl #0x3c,%d2 | then find fractions of a chunk
- negl %d2
- andb #0xf,%cc | clear X
- jmp %pc@(L3-.-2:b,%d2)
-L2:
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
-L3:
- dbra %d1,L2 | (NB- dbra doesn't affect X)
-
- movl %d0,%d1 | fold 32 bit sum to 16 bits
- swap %d1 | (NB- swap doesn't affect X)
- addxw %d1,%d0
- jcc L4
- addw #1,%d0
-L4:
- andl #0xffff,%d0
- movl %sp@+,%d2
- rts
-
-L5: | deal with 1 or 3 excess bytes at the end of the buffer.
- btst #1,%d1
- jeq L6 | if 1 excess
-
- | 3 bytes excess
- clrl %d2
- movw %a0@(-3,%d1:l),%d2 | add in last full word then drop
- addl %d2,%d0 | through to pick up last byte
-
-L6: | 1 byte excess
- clrl %d2
- movb %a0@(-1,%d1:l),%d2
- lsll #8,%d2
- addl %d2,%d0
- jra L1
-
-L7: | 2 bytes excess
- clrl %d2
- movw %a0@(-2,%d1:l),%d2
- addl %d2,%d0
- jra L1
diff --git a/sys/arch/m68k/m68k/pmap_bootstrap.c b/sys/arch/m68k/m68k/pmap_bootstrap.c
deleted file mode 100644
index 15212f42291..00000000000
--- a/sys/arch/m68k/m68k/pmap_bootstrap.c
+++ /dev/null
@@ -1,561 +0,0 @@
-/* $OpenBSD: pmap_bootstrap.c,v 1.20 2013/01/01 01:01:08 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * Copyright (c) 1999 Steve Murphree, Jr. (68060 support)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pmap_bootstrap.c 8.1 (Berkeley) 6/10/93
- */
-
-/*
- * NOTICE: This is not a standalone file. To use it, #include it in
- * your port's pmap_bootstrap.c, like so:
- *
- * #include <m68k/m68k/pmap_bootstrap.c>
- *
- * after having defined the following macros:
- * RELOC relocate a variable
- * PA2VA simple crude mapping for bootstraping
- * PMAP_MD_LOCALS local variable declaration
- * PMAP_MD_RELOC1() early variable relocation
- * PMAP_MD_RELOC2() internal IO space variable relocation
- * PMAP_MD_RELOC3() general purpose kernel virtual addresses relocation
- * PMAP_MD_MAPIOSPACE() setup machine-specific internal iospace components
- * PMAP_MD_MEMSIZE() compute avail_end
- */
-
-extern char *etext;
-extern int Sysptsize;
-extern char *proc0paddr;
-extern st_entry_t *Sysseg;
-extern pt_entry_t *Sysptmap, *Sysmap;
-
-extern int physmem;
-extern paddr_t avail_start, avail_end;
-extern vaddr_t virtual_avail, virtual_end;
-
-void pmap_bootstrap(paddr_t, paddr_t);
-
-/*
- * Special purpose kernel virtual addresses, used for mapping
- * physical pages for a variety of temporary or permanent purposes:
- *
- * CADDR1, CADDR2: pmap zero/copy operations
- * vmmap: /dev/mem, crash dumps, parity error checking
- */
-#ifndef __HAVE_PMAP_DIRECT
-caddr_t CADDR1, CADDR2;
-#endif
-caddr_t vmmap;
-
-/*
- * Bootstrap the VM system.
- *
- * Ideally called with MMU off, but not necessarily. All global references
- * are relocated by `firstpa' to ensure this works. Of course, it is not
- * possible to call any other functions from there. `nextpa' is the first
- * available physical memory address. Returns an updated first PA reflecting
- * the memory we have allocated. MMU is still in the same state when we
- * return.
- *
- * XXX assumes sizeof(u_int) == sizeof(pt_entry_t)
- * XXX a PIC compiler would make this much easier.
- */
-void
-pmap_bootstrap(nextpa, firstpa)
- paddr_t nextpa;
- paddr_t firstpa;
-{
- paddr_t kstpa, kptpa, iiopa, eiopa, kptmpa, lkptpa, p0upa;
- vaddr_t iiobase, eiobase;
- u_int nptpages, kstsize;
- st_entry_t protoste, *ste;
- pt_entry_t protopte, *pte, *epte;
- int num;
- PMAP_MD_LOCALS
-
- /*
- * Calculate important physical addresses:
- *
- * kstpa kernel segment table 1 page (020/030)
- * N pages (040/060)
- *
- * kptpa statically allocated
- * kernel PT pages Sysptsize+ pages
- *
- * iiopa internal IO space
- * PT pages MACHINE_IIOMAPSIZE pages
- *
- * eiopa external IO space
- * PT pages MACHINE_EIOMAPSIZE pages
- *
- * [ Sysptsize is the number of pages of PT, MACHINE_IIOMAPSIZE and
- * MACHINE_EIOMAPSIZE are the number of PTEs, hence we need to round
- * the total to a page boundary with IO maps at the end. ]
- *
- * kptmpa kernel PT map 1 page
- *
- * lkptpa last kernel PT page 1 page
- *
- * p0upa proc 0 u-area UPAGES pages
- *
- * The KVA corresponding to any of these PAs is:
- * (PA - firstpa + KERNBASE).
- */
- if (RELOC(mmutype, int) <= MMU_68040)
- kstsize = MAXKL2SIZE / (NPTEPG/SG4_LEV2SIZE);
- else
- kstsize = 1;
- kstpa = nextpa;
- nextpa += kstsize * NBPG;
- kptpa = nextpa;
-
- iiopa = nextpa + RELOC(Sysptsize, int) * NBPG;
- iiobase = ptoa(RELOC(Sysptsize, int) * NPTEPG);
- eiopa = iiopa + MACHINE_IIOMAPSIZE * sizeof(pt_entry_t);
- eiobase = iiobase + ptoa(MACHINE_IIOMAPSIZE);
-
- /*
- * Compute how many PT pages we will need to have initialized.
- * We need to have enough of them for the vm system to initialize
- * up to the point we can use it to allocate more PT pages - i.e.
- * when we can afford using pmap_enter_ptpage().
- *
- * Aside from the IO maps, we need to be able to successfully
- * allocate:
- * - nkmempages_max pages in kmeminit().
- * - PAGER_MAP_SIZE bytes in uvm_pager_init().
- * - 93.75 % of physmem anons in amap_init().
- * - 4 * uvm_km_pages.lowat pages in uvm_km_page_init().
- *
- * We'll compute this size in bytes, then round it to pages,
- * then to a multiple of NPTEPG.
- */
-
- nptpages = ptoa(MACHINE_IIOMAPSIZE + MACHINE_EIOMAPSIZE);
-
- num = RELOC(physmem, int) / 4;
- if (num > NKMEMPAGES_MAX_DEFAULT)
- num = NKMEMPAGES_MAX_DEFAULT;
- nptpages += ptoa(num);
-
- nptpages += PAGER_MAP_SIZE;
-
- nptpages += (RELOC(physmem, int) * 15 * sizeof(struct vm_anon)) / 16;
-
-#if !defined(__HAVE_PMAP_DIRECT)
- {
- if ((num = RELOC(uvm_km_pages.lowat, int)) == 0) {
- num = RELOC(physmem, int) / 256;
- if (num < 16)
- num = 32;
- else if (num < 128) {
- num = 128;
- if (num > UVM_KM_PAGES_LOWAT_MAX)
- num = UVM_KM_PAGES_LOWAT_MAX;
- }
- }
- }
- nptpages += ptoa(4 * num);
-#endif
-
- nptpages = (atop(round_page(nptpages)) + NPTEPG - 1) / NPTEPG;
-
- nextpa += nptpages * NBPG;
-
- kptmpa = nextpa;
- nextpa += NBPG;
- lkptpa = nextpa;
- nextpa += NBPG;
- p0upa = nextpa;
- nextpa += USPACE;
-
- PMAP_MD_RELOC1();
-
- /*
- * Initialize segment table and kernel page table map.
- *
- * On 68030s and earlier MMUs the two are identical except for
- * the valid bits so both are initialized with essentially the
- * same values. On the 680[46]0, which have a mandatory 3-level
- * structure, the segment table holds the level 1 table and part
- * (or all) of the level 2 table and hence is considerably
- * different. Here the first level consists of 128 descriptors
- * (512 bytes) each mapping 32mb of address space. Each of these
- * points to blocks of 128 second level descriptors (512 bytes)
- * each mapping 256kb. Note that there may be additional "segment
- * table" pages depending on how large MAXKL2SIZE is.
- *
- * Portions of the last segment of KVA space (0xFFF00000 -
- * 0xFFFFFFFF) are mapped for a couple of purposes. 0xFFF00000
- * for UPAGES is used for mapping the current process u-area
- * (u + kernel stack). The very last page (0xFFFFF000) is mapped
- * to the last physical page of RAM to give us a region in which
- * PA == VA. We use the first part of this page for enabling
- * and disabling mapping. The last part of this page also contains
- * info left by the boot ROM.
- *
- * XXX cramming two levels of mapping into the single "segment"
- * table on the 68040 is intended as a temporary hack to get things
- * working. The 224mb of address space that this allows will most
- * likely be insufficient in the future (at least for the kernel).
- */
- if (RELOC(mmutype, int) <= MMU_68040) {
- /*
- * First invalidate the entire "segment table" pages
- * (levels 1 and 2 have the same "invalid" value).
- */
- pte = PA2VA(kstpa, u_int *);
- epte = &pte[kstsize * NPTEPG];
- while (pte < epte)
- *pte++ = SG_NV;
- /*
- * Initialize level 2 descriptors (which immediately
- * follow the level 1 table). We need:
- * NPTEPG / SG4_LEV3SIZE
- * level 2 descriptors to map each of the nptpages+1
- * pages of PTEs. Note that we set the "used" bit
- * now to save the HW the expense of doing it.
- */
- num = (nptpages + 1) * (NPTEPG / SG4_LEV3SIZE);
- pte = &(PA2VA(kstpa, u_int *))[SG4_LEV1SIZE];
- epte = &pte[num];
- protoste = kptpa | SG_U | SG_RW | SG_V;
- while (pte < epte) {
- *pte++ = protoste;
- protoste += (SG4_LEV3SIZE * sizeof(st_entry_t));
- }
- /*
- * Initialize level 1 descriptors. We need:
- * roundup(num, SG4_LEV2SIZE) / SG4_LEV2SIZE
- * level 1 descriptors to map the `num' level 2's.
- */
- pte = PA2VA(kstpa, u_int *);
- epte = &pte[roundup(num, SG4_LEV2SIZE) / SG4_LEV2SIZE];
- protoste = (u_int)&pte[SG4_LEV1SIZE] | SG_U | SG_RW | SG_V;
- while (pte < epte) {
- *pte++ = protoste;
- protoste += (SG4_LEV2SIZE * sizeof(st_entry_t));
- }
- /*
- * Initialize the final level 1 descriptor to map the last
- * block of level 2 descriptors.
- */
- ste = &(PA2VA(kstpa, u_int *))[SG4_LEV1SIZE-1];
- pte = &(PA2VA(kstpa, u_int *))[kstsize*NPTEPG - SG4_LEV2SIZE];
- *ste = (u_int)pte | SG_U | SG_RW | SG_V;
- /*
- * Now initialize the final portion of that block of
- * descriptors to map the "last PT page".
- */
- pte = &(PA2VA(kstpa, u_int *))
- [kstsize*NPTEPG - NPTEPG/SG4_LEV3SIZE];
- epte = &pte[NPTEPG/SG4_LEV3SIZE];
- protoste = lkptpa | SG_U | SG_RW | SG_V;
- while (pte < epte) {
- *pte++ = protoste;
- protoste += (SG4_LEV3SIZE * sizeof(st_entry_t));
- }
- /*
- * Initialize Sysptmap
- */
- pte = PA2VA(kptmpa, u_int *);
- epte = &pte[nptpages+1];
- protopte = kptpa | PG_RW | PG_CI | PG_V | PG_U;
- while (pte < epte) {
- *pte++ = protopte;
- protopte += NBPG;
- }
- /*
- * Invalidate all but the last remaining entry.
- */
- epte = &(PA2VA(kptmpa, u_int *))[NPTEPG-1];
- while (pte < epte) {
- *pte++ = PG_NV;
- }
- /*
- * Initialize the last to point to the page
- * table page allocated earlier.
- */
- *pte = lkptpa | PG_RW | PG_CI | PG_V | PG_U;
- } else {
- /*
- * Map the page table pages in both the HW segment table
- * and the software Sysptmap. Note that Sysptmap is also
- * considered a PT page hence the +1.
- */
- ste = PA2VA(kstpa, u_int *);
- pte = PA2VA(kptmpa, u_int *);
- epte = &pte[nptpages+1];
- protoste = kptpa | SG_RW | SG_V;
- protopte = kptpa | PG_RW | PG_CI | PG_V;
- while (pte < epte) {
- *ste++ = protoste;
- *pte++ = protopte;
- protoste += NBPG;
- protopte += NBPG;
- }
- /*
- * Invalidate all but the last remaining entries in both.
- */
- epte = &(PA2VA(kptmpa, u_int *))[NPTEPG-1];
- while (pte < epte) {
- *ste++ = SG_NV;
- *pte++ = PG_NV;
- }
- /*
- * Initialize the last to point to point to the page
- * table page allocated earlier.
- */
- *ste = lkptpa | SG_RW | SG_V;
- *pte = lkptpa | PG_RW | PG_CI | PG_V;
- }
- /*
- * Invalidate all but the final entry in the last kernel PT page
- * (u-area PTEs will be validated later). The final entry maps
- * the last page of physical memory.
- */
- pte = PA2VA(lkptpa, u_int *);
- epte = &pte[NPTEPG-1];
- while (pte < epte)
- *pte++ = PG_NV;
-#ifdef MAXADDR
- /*
- * Temporary double-map for machines with physmem at the end of
- * memory
- */
- *pte = MAXADDR | PG_RW | PG_CI | PG_V | PG_U;
-#else
- *pte = PG_NV;
-#endif
- /*
- * Initialize kernel page table.
- * Start by invalidating the `nptpages' that we have allocated.
- */
- pte = PA2VA(kptpa, u_int *);
- epte = &pte[nptpages * NPTEPG];
- while (pte < epte)
- *pte++ = PG_NV;
-
- /*
- * Validate PTEs for kernel text (RO). The first page
- * of kernel text will remain invalid to force *NULL in the
- * kernel to fault.
- */
- pte = &(PA2VA(kptpa, u_int *))[atop(KERNBASE)];
- epte = &pte[atop(trunc_page((vaddr_t)&etext))];
-
-#if defined(KGDB) || defined(DDB)
- protopte = firstpa | PG_RW | PG_V | PG_U; /* XXX RW for now */
-#else
- protopte = firstpa | PG_RO | PG_V | PG_U;
-#endif
- *pte++ = PG_NV; /* make *NULL fail in the kernel */
- protopte += PAGE_SIZE;
- while (pte < epte) {
- *pte++ = protopte;
- protopte += PAGE_SIZE;
- }
- /*
- * Validate PTEs for kernel data/bss, dynamic data allocated
- * by us so far (nextpa - firstpa bytes), and pages for proc0
- * u-area and page table allocated below (RW).
- */
- epte = &(PA2VA(kptpa, u_int *))[atop(nextpa - firstpa)];
- protopte = (protopte & ~PG_PROT) | PG_RW | PG_U;
- /*
- * Enable copy-back caching of data pages on 040, and write-through
- * caching on 060
- */
- if (RELOC(mmutype, int) == MMU_68040)
- protopte |= PG_CCB;
-#ifdef M68060
- else if (RELOC(mmutype, int) == MMU_68060)
- protopte |= PG_CWT;
-#endif
- while (pte < epte) {
- *pte++ = protopte;
- protopte += NBPG;
- }
-
- /*
- * Finally, validate the internal IO space PTEs (RW+CI).
- * We do this here since on hp300 machines with the HP MMU, the
- * the MMU registers (also used, but to a lesser extent, on other
- * models) are mapped in this range and it would be nice to be able
- * to access them after the MMU is turned on.
- */
- pte = PA2VA(iiopa, u_int *);
- epte = PA2VA(eiopa, u_int *);
- protopte = MACHINE_INTIOBASE | PG_RW | PG_CI | PG_V | PG_U;
- while (pte < epte) {
- *pte++ = protopte;
- protopte += NBPG;
- }
- PMAP_MD_MAPIOSPACE();
-
- /*
- * Calculate important exported kernel virtual addresses
- */
- /*
- * Sysseg: base of kernel segment table
- */
- RELOC(Sysseg, st_entry_t *) =
- (st_entry_t *)(kstpa - firstpa);
- /*
- * Sysptmap: base of kernel page table map
- */
- RELOC(Sysptmap, pt_entry_t *) =
- (pt_entry_t *)(kptmpa - firstpa);
- /*
- * Sysmap: kernel page table (as mapped through Sysptmap)
- * Immediately follows `nptpages' of static kernel page table.
- */
- RELOC(Sysmap, pt_entry_t *) =
- (pt_entry_t *)ptoa(nptpages * NPTEPG);
-
- PMAP_MD_RELOC2();
-
- /*
- * Setup u-area for process 0.
- */
-
- /* Zero the u-area (`pte' is not really a PTE here) */
- pte = PA2VA(p0upa, u_int *);
- for (num = USPACE / sizeof(u_int); num != 0; num--)
- *pte++ = 0;
-
- /*
- * Remember the u-area address so it can be loaded in the
- * proc struct p_addr field later.
- */
- RELOC(proc0paddr, char *) = (char *)(p0upa - firstpa);
-
- /*
- * VM data structures are now initialized, set up data for
- * the pmap module.
- *
- * Note about avail_end: msgbuf is initialized just after
- * avail_end in machdep.c. Since the last page is used
- * for rebooting the system (code is copied there and
- * excution continues from copied code before the MMU
- * is disabled), the msgbuf will get trounced between
- * reboots if it's placed in the last physical page.
- * To work around this, we move avail_end back one more
- * page so the msgbuf can be preserved.
- */
- RELOC(avail_start, paddr_t) = nextpa;
- PMAP_MD_MEMSIZE();
- RELOC(virtual_avail, vaddr_t) =
- VM_MIN_KERNEL_ADDRESS + (nextpa - firstpa);
- RELOC(virtual_end, vaddr_t) = VM_MAX_KERNEL_ADDRESS;
-
- /*
- * Kernel page/segment table allocated in locore,
- * just initialize pointers.
- */
- {
- struct pmap *kpm = &RELOC(kernel_pmap_store, struct pmap);
-
- kpm->pm_stab = RELOC(Sysseg, st_entry_t *);
- kpm->pm_ptab = RELOC(Sysmap, pt_entry_t *);
- simple_lock_init(&kpm->pm_lock);
- kpm->pm_count = 1;
- kpm->pm_stpa = (st_entry_t *)kstpa;
- /*
- * For the 040 and 060 we also initialize the free level 2
- * descriptor mask noting that we have used:
- * 0: level 1 table
- * 1 to `num': map page tables
- * MAXKL2SIZE-1: maps last-page page table
- */
- if (RELOC(mmutype, int) <= MMU_68040) {
- int num;
-
- kpm->pm_stfree = ~l2tobm(0);
- num = roundup((nptpages + 1) * (NPTEPG / SG4_LEV3SIZE),
- SG4_LEV2SIZE) / SG4_LEV2SIZE;
- while (num)
- kpm->pm_stfree &= ~l2tobm(num--);
- kpm->pm_stfree &= ~l2tobm(MAXKL2SIZE-1);
- for (num = MAXKL2SIZE;
- num < sizeof(kpm->pm_stfree)*NBBY;
- num++)
- kpm->pm_stfree &= ~l2tobm(num);
- }
- }
-
- /*
- * Allocate some fixed, special purpose kernel virtual addresses
- */
- {
- vaddr_t va = RELOC(virtual_avail, vaddr_t);
-
-#ifndef __HAVE_PMAP_DIRECT
- RELOC(CADDR1, caddr_t) = (caddr_t)va;
- va += NBPG;
- RELOC(CADDR2, caddr_t) = (caddr_t)va;
- va += NBPG;
-#endif
- RELOC(vmmap, caddr_t) = (caddr_t)va;
- va += NBPG;
-
- PMAP_MD_RELOC3();
-
- RELOC(msgbufp, struct msgbuf *) = (struct msgbuf *)va;
- va += MSGBUFSIZE;
- RELOC(virtual_avail, vaddr_t) = va;
- }
-}
diff --git a/sys/arch/m68k/m68k/pmap_motorola.c b/sys/arch/m68k/m68k/pmap_motorola.c
deleted file mode 100644
index 37771f1689d..00000000000
--- a/sys/arch/m68k/m68k/pmap_motorola.c
+++ /dev/null
@@ -1,2483 +0,0 @@
-/* $OpenBSD: pmap_motorola.c,v 1.69 2013/01/01 01:01:08 miod Exp $ */
-
-/*
- * Copyright (c) 1999 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pmap.c 8.6 (Berkeley) 5/27/94
- */
-
-/*
- * m68k series physical map management code.
- *
- * Supports:
- * 68020 with HP MMU
- * 68020 with 68851 MMU
- * 68030 with on-chip MMU
- * 68040 with on-chip MMU
- * 68060 with on-chip MMU
- *
- * Notes:
- * Don't even pay lip service to multiprocessor support.
- *
- * We assume TLB entries don't have process tags (except for the
- * supervisor/user distinction) so we only invalidate TLB entries
- * when changing mappings for the current (or kernel) pmap. This is
- * technically not true for the 68851 but we flush the TLB on every
- * context switch, so it effectively winds up that way.
- *
- * Bitwise and/or operations are significantly faster than bitfield
- * references so we use them when accessing STE/PTEs in the pmap_pte_*
- * macros. Note also that the two are not always equivalent; e.g.:
- * (*pte & PG_PROT) [4] != pte->pg_prot [1]
- * and a couple of routines that deal with protection and wiring take
- * some shortcuts that assume the and/or definitions.
- *
- * This implementation will only work for PAGE_SIZE == NBPG
- * (i.e. 4096 bytes).
- */
-
-/*
- * Manages physical address maps.
- *
- * In addition to hardware address maps, this
- * module is called upon to provide software-use-only
- * maps which may or may not be stored in the same
- * form as hardware maps. These pseudo-maps are
- * used to store intermediate results from copy
- * operations to and from address spaces.
- *
- * Since the information managed by this module is
- * also stored by the logical address mapping module,
- * this module may throw away valid virtual-to-physical
- * mappings at almost any time. However, invalidations
- * of virtual-to-physical mappings must be done as
- * requested.
- *
- * In order to cope with hardware architectures which
- * make virtual-to-physical map invalidates expensive,
- * this module may delay invalidate or reduced protection
- * operations until such time as they are actually
- * necessary. This module is given full information as
- * to which processors are currently using which maps,
- * and to when physical maps must be made correct.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/malloc.h>
-#include <sys/pool.h>
-
-#include <machine/pte.h>
-
-#include <uvm/uvm.h>
-
-#include <machine/cpu.h>
-
-#ifdef PMAP_DEBUG
-#define PDB_FOLLOW 0x0001
-#define PDB_INIT 0x0002
-#define PDB_ENTER 0x0004
-#define PDB_REMOVE 0x0008
-#define PDB_CREATE 0x0010
-#define PDB_PTPAGE 0x0020
-#define PDB_CACHE 0x0040
-#define PDB_BITS 0x0080
-#define PDB_COLLECT 0x0100
-#define PDB_PROTECT 0x0200
-#define PDB_SEGTAB 0x0400
-#define PDB_MULTIMAP 0x0800
-#define PDB_PARANOIA 0x2000
-#define PDB_WIRING 0x4000
-#define PDB_PVDUMP 0x8000
-#define PDB_ALL 0xFFFF
-
-int pmapdebug = PDB_PARANOIA;
-
-#define PMAP_DPRINTF(l, x) if (pmapdebug & (l)) printf x
-
-#if defined(M68040) || defined(M68060)
-int dowriteback = 1; /* 68040: enable writeback caching */
-int dokwriteback = 1; /* 68040: enable writeback caching of kernel AS */
-#endif
-#else
-#define PMAP_DPRINTF(l, x) /* nothing */
-#endif /* PMAP_DEBUG */
-
-/*
- * Get STEs and PTEs for user/kernel address space
- */
-#if defined(M68040) || defined(M68060)
-#define pmap_ste1(m, v) \
- (&((m)->pm_stab[(vaddr_t)(v) >> SG4_SHIFT1]))
-/* XXX assumes physically contiguous ST pages (if more than one) */
-#define pmap_ste2(m, v) \
- (&((m)->pm_stab[(st_entry_t *)(*(u_int *)pmap_ste1(m, v) & SG4_ADDR1) \
- - (m)->pm_stpa + (((v) & SG4_MASK2) >> SG4_SHIFT2)]))
-#define pmap_ste(m, v) \
- (&((m)->pm_stab[(vaddr_t)(v) \
- >> (mmutype <= MMU_68040 ? SG4_SHIFT1 : SG_ISHIFT)]))
-#define pmap_ste_v(m, v) \
- (mmutype <= MMU_68040 \
- ? ((*pmap_ste1(m, v) & SG_V) && \
- (*pmap_ste2(m, v) & SG_V)) \
- : (*pmap_ste(m, v) & SG_V))
-#else
-#define pmap_ste(m, v) (&((m)->pm_stab[(vaddr_t)(v) >> SG_ISHIFT]))
-#define pmap_ste_v(m, v) (*pmap_ste(m, v) & SG_V)
-#endif
-
-#define pmap_pte(m, v) (&((m)->pm_ptab[(vaddr_t)(v) >> PG_SHIFT]))
-#define pmap_pte_pa(pte) (*(pte) & PG_FRAME)
-#define pmap_pte_w(pte) (*(pte) & PG_W)
-#define pmap_pte_ci(pte) (*(pte) & PG_CI)
-#define pmap_pte_m(pte) (*(pte) & PG_M)
-#define pmap_pte_u(pte) (*(pte) & PG_U)
-#define pmap_pte_prot(pte) (*(pte) & PG_PROT)
-#define pmap_pte_v(pte) (*(pte) & PG_V)
-
-#define pmap_pte_set_w(pte, v) \
- if (v) *(pte) |= PG_W; else *(pte) &= ~PG_W
-#define pmap_pte_set_prot(pte, v) \
- if (v) *(pte) |= PG_PROT; else *(pte) &= ~PG_PROT
-#define pmap_pte_w_chg(pte, nw) ((nw) ^ pmap_pte_w(pte))
-#define pmap_pte_prot_chg(pte, np) ((np) ^ pmap_pte_prot(pte))
-
-/*
- * Given a map and a machine independent protection code,
- * convert to an m68k protection code.
- */
-#define pte_prot(p) ((p) & VM_PROT_WRITE ? PG_RW : PG_RO)
-
-/*
- * Kernel page table page management.
- */
-struct kpt_page {
- struct kpt_page *kpt_next; /* link on either used or free list */
- vaddr_t kpt_va; /* always valid kernel VA */
- paddr_t kpt_pa; /* PA of this page (for speed) */
-};
-struct kpt_page *kpt_free_list, *kpt_used_list;
-struct kpt_page *kpt_pages;
-
-/*
- * Kernel segment/page table and page table map.
- * The page table map gives us a level of indirection we need to dynamically
- * expand the page table. It is essentially a copy of the segment table
- * with PTEs instead of STEs. All are initialized in locore at boot time.
- * Sysmap will initially contain VM_KERNEL_PT_PAGES pages of PTEs.
- * Segtabzero is an empty segment table which all processes share til they
- * reference something.
- */
-st_entry_t *Sysseg;
-pt_entry_t *Sysmap, *Sysptmap;
-st_entry_t *Segtabzero, *Segtabzeropa;
-vsize_t Sysptsize = VM_KERNEL_PT_PAGES;
-
-#ifndef __HAVE_PMAP_DIRECT
-extern caddr_t CADDR1, CADDR2;
-pt_entry_t *caddr1_pte; /* PTE for CADDR1 */
-pt_entry_t *caddr2_pte; /* PTE for CADDR2 */
-#endif
-
-struct pmap kernel_pmap_store;
-struct vm_map *st_map, *pt_map;
-struct vm_map st_map_store, pt_map_store;
-
-paddr_t avail_start; /* PA of first available physical page */
-paddr_t avail_end; /* PA of last available physical page */
-vaddr_t virtual_avail; /* VA of first avail page (after kernel bss)*/
-vaddr_t virtual_end; /* VA of last avail page (end of kernel AS) */
-
-#if defined(M68040) || defined(M68060)
-int protostfree; /* prototype (default) free ST map */
-#endif
-
-struct pool pmap_pmap_pool; /* memory pool for pmap structures */
-struct pool pmap_pv_pool; /* memory pool for pv pages */
-
-/*
- * Internal routines
- */
-struct pv_entry *pmap_alloc_pv(void);
-void pmap_free_pv(struct pv_entry *);
-void pmap_remove_flags(pmap_t, vaddr_t, vaddr_t, int);
-void pmap_remove_mapping(pmap_t, vaddr_t, pt_entry_t *, int);
-boolean_t pmap_testbit(struct vm_page *, int);
-void pmap_changebit(struct vm_page *, int, int);
-int pmap_enter_ptpage(pmap_t, vaddr_t);
-void pmap_ptpage_addref(vaddr_t);
-int pmap_ptpage_delref(vaddr_t);
-void pmap_collect1(paddr_t, paddr_t);
-
-
-#ifdef PMAP_DEBUG
-void pmap_pvdump(paddr_t);
-void pmap_check_wiring(char *, vaddr_t);
-#endif
-
-/* pmap_remove_mapping flags */
-#define PRM_TFLUSH 0x01
-#define PRM_CFLUSH 0x02
-#define PRM_KEEPPTPAGE 0x04
-#define PRM_SKIPWIRED 0x08
-
-static struct pv_entry *pa_to_pvh(paddr_t);
-static struct pv_entry *pg_to_pvh(struct vm_page *);
-int pmap_largekva = 0;
-
-/*
- * Allow the kernel to grow up to Sysmap, until pmap_init has initialized.
- */
-vaddr_t
-pmap_growkernel(vaddr_t addr)
-{
- return pmap_largekva ? VM_MAX_KERNEL_ADDRESS : (vaddr_t)Sysmap;
-}
-
-static __inline struct pv_entry *
-pa_to_pvh(paddr_t pa)
-{
- struct vm_page *pg;
-
- pg = PHYS_TO_VM_PAGE(pa);
- return &pg->mdpage.pvent;
-}
-
-static __inline struct pv_entry *
-pg_to_pvh(struct vm_page *pg)
-{
- return &pg->mdpage.pvent;
-}
-
-#ifdef PMAP_STEAL_MEMORY
-vaddr_t
-pmap_steal_memory(size, vstartp, vendp)
- vsize_t size;
- vaddr_t *vstartp, *vendp;
-{
- vaddr_t va;
- u_int npg;
-
- size = round_page(size);
- npg = atop(size);
-
- /* m68k systems which define PMAP_STEAL_MEMORY only have one segment. */
-#ifdef DIAGNOSTIC
- if (vm_physmem[0].avail_end - vm_physmem[0].avail_start < npg)
- panic("pmap_steal_memory(%x): out of memory", size);
-#endif
-
- va = ptoa(vm_physmem[0].avail_start);
- vm_physmem[0].avail_start += npg;
- vm_physmem[0].start += npg;
-
- if (vstartp != NULL)
- *vstartp = virtual_avail;
- if (vendp != NULL)
- *vendp = virtual_end;
-
- bzero((void *)va, size);
- return (va);
-}
-#else
-/*
- * pmap_virtual_space: [ INTERFACE ]
- *
- * Report the range of available kernel virtual address
- * space to the VM system during bootstrap.
- *
- * This is only an interface function if we do not use
- * pmap_steal_memory()!
- *
- * Note: no locking is necessary in this function.
- */
-void
-pmap_virtual_space(vstartp, vendp)
- vaddr_t *vstartp, *vendp;
-{
-
- *vstartp = virtual_avail;
- *vendp = virtual_end;
-}
-#endif
-
-/*
- * pmap_init: [ INTERFACE ]
- *
- * Initialize the pmap module. Called by uvm_init(), to initialize any
- * structures that the pmap system needs to map virtual memory.
- *
- * Note: no locking is necessary in this function.
- */
-void
-pmap_init()
-{
- vaddr_t addr, addr2;
- vsize_t s;
- int rv;
- int npages;
-
- PMAP_DPRINTF(PDB_FOLLOW, ("pmap_init()\n"));
-
-#ifndef __HAVE_PMAP_DIRECT
- /*
- * Before we do anything else, initialize the PTE pointers
- * used by pmap_zero_page() and pmap_copy_page().
- */
- caddr1_pte = pmap_pte(pmap_kernel(), CADDR1);
- caddr2_pte = pmap_pte(pmap_kernel(), CADDR2);
-#endif
-
- /*
- * Now that kernel map has been allocated, we can mark as
- * unavailable regions which we have mapped in pmap_bootstrap().
- */
- PMAP_INIT_MD();
-
- PMAP_DPRINTF(PDB_INIT,
- (" pstart %lx, pend %lx, vstart %lx, vend %lx\n",
- avail_start, avail_end, virtual_avail, virtual_end));
-
- /*
- * Allocate memory the initial segment table.
- */
- addr = uvm_km_zalloc(kernel_map, round_page(MACHINE_STSIZE));
- if (addr == 0)
- panic("pmap_init: can't allocate data structures");
-
- Segtabzero = (st_entry_t *) addr;
- pmap_extract(pmap_kernel(), addr, (paddr_t *)&Segtabzeropa);
-#ifdef M68060
- if (mmutype == MMU_68060) {
- for (addr2 = addr; addr2 < addr + MACHINE_STSIZE;
- addr2 += PAGE_SIZE) {
- pt_entry_t *pte;
-
- pte = pmap_pte(pmap_kernel(), addr2);
- *pte = (*pte | PG_CI) & ~PG_CCB;
- TBIS(addr2);
- }
- DCIS();
- }
-#endif
- addr += MACHINE_STSIZE;
-
- PMAP_DPRINTF(PDB_INIT, ("pmap_init: s0 %p(%p)\n",
- Segtabzero, Segtabzeropa));
-
- /*
- * Allocate physical memory for kernel PT pages and their management.
- * We need 1 PT page per possible task plus some slop.
- */
- npages = min(atop(MACHINE_MAX_KPTSIZE), maxprocess+16);
- s = ptoa(npages) + round_page(npages * sizeof(struct kpt_page));
-
- /*
- * Now allocate the space and link the pages together to
- * form the KPT free list.
- */
- addr = uvm_km_zalloc(kernel_map, s);
- if (addr == 0)
- panic("pmap_init: cannot allocate KPT free list");
- s = ptoa(npages);
- addr2 = addr + s;
- kpt_pages = &((struct kpt_page *)addr2)[npages];
- kpt_free_list = NULL;
- do {
- addr2 -= PAGE_SIZE;
- (--kpt_pages)->kpt_next = kpt_free_list;
- kpt_free_list = kpt_pages;
- kpt_pages->kpt_va = addr2;
- pmap_extract(pmap_kernel(), addr2, &kpt_pages->kpt_pa);
-#ifdef M68060
- if (mmutype == MMU_68060) {
- pt_entry_t *pte;
-
- pte = pmap_pte(pmap_kernel(), addr2);
- *pte = (*pte | PG_CI) & ~PG_CCB;
- TBIS(addr2);
- }
-#endif
- } while (addr != addr2);
-#ifdef M68060
- if (mmutype == MMU_68060)
- DCIS();
-#endif
-
- PMAP_DPRINTF(PDB_INIT, ("pmap_init: KPT: %ld pages from %lx to %lx\n",
- atop(s), addr, addr + s));
-
- /*
- * Allocate the segment table map and the page table map.
- */
- s = maxprocess * MACHINE_STSIZE;
- st_map = uvm_km_suballoc(kernel_map, &addr, &addr2, s, 0, FALSE,
- &st_map_store);
-
- pmap_largekva = 1;
-
- addr = (vaddr_t) Sysmap;
- if (uvm_map(kernel_map, &addr, MACHINE_MAX_PTSIZE,
- NULL, UVM_UNKNOWN_OFFSET, 0,
- UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE,
- UVM_INH_NONE, UVM_ADV_RANDOM,
- UVM_FLAG_FIXED))) {
- /*
- * If this fails, it is probably because the static
- * portion of the kernel page table isn't big enough
- * and we overran the page table map.
- */
- panic("pmap_init: bogons in the VM system!");
- }
- PMAP_DPRINTF(PDB_INIT,
- ("pmap_init: Sysseg %p, Sysmap %p, Sysptmap %p\n",
- Sysseg, Sysmap, Sysptmap));
-
- addr = MACHINE_PTBASE;
- if ((MACHINE_PTMAXSIZE / MACHINE_MAX_PTSIZE) < maxprocess) {
- s = MACHINE_PTMAXSIZE;
- /*
- * XXX We don't want to hang when we run out of
- * page tables, so we lower maxprocess so that fork()
- * will fail instead. Note that root could still raise
- * this value via sysctl(3).
- */
- maxprocess = (MACHINE_PTMAXSIZE / MACHINE_MAX_PTSIZE);
- } else
- s = (maxprocess * MACHINE_MAX_PTSIZE);
- pt_map = uvm_km_suballoc(kernel_map, &addr, &addr2, s, 0,
- TRUE, &pt_map_store);
-
-#if defined(M68040) || defined(M68060)
- if (mmutype <= MMU_68040) {
- protostfree = ~l2tobm(0);
- for (rv = MAXUL2SIZE; rv < sizeof(protostfree)*NBBY; rv++)
- protostfree &= ~l2tobm(rv);
- }
-#endif
-
- /*
- * Initialize the pmap pools.
- */
- pool_init(&pmap_pmap_pool, sizeof(struct pmap), 0, 0, 0, "pmappl",
- NULL);
- pool_init(&pmap_pv_pool, sizeof(struct pv_entry), 0, 0, 0, "pvpl",
- NULL);
-}
-
-/*
- * pmap_alloc_pv:
- *
- * Allocate a pv_entry.
- */
-struct pv_entry *
-pmap_alloc_pv()
-{
- struct pv_entry *pv;
-
- pv = (struct pv_entry *)pool_get(&pmap_pv_pool, PR_NOWAIT);
- return pv;
-}
-
-/*
- * pmap_free_pv:
- *
- * Free a pv_entry.
- */
-void
-pmap_free_pv(pv)
- struct pv_entry *pv;
-{
- pool_put(&pmap_pv_pool, pv);
-}
-
-/*
- * pmap_create: [ INTERFACE ]
- *
- * Create and return a physical map.
- *
- * Note: no locking is necessary in this function.
- */
-pmap_t
-pmap_create()
-{
- pmap_t pmap;
-
- PMAP_DPRINTF(PDB_FOLLOW|PDB_CREATE,
- ("pmap_create\n"));
-
- pmap = pool_get(&pmap_pmap_pool, PR_WAITOK | PR_ZERO);
-
- /*
- * No need to allocate page table space yet but we do need a
- * valid segment table. Initially, we point everyone at the
- * "null" segment table. On the first pmap_enter, a real
- * segment table will be allocated.
- */
- pmap->pm_stab = Segtabzero;
- pmap->pm_stpa = Segtabzeropa;
-#if defined(M68040) || defined(M68060)
- if (mmutype <= MMU_68040)
- pmap->pm_stfree = protostfree;
-#endif
- pmap->pm_count = 1;
- simple_lock_init(&pmap->pm_lock);
-
- return pmap;
-}
-
-/*
- * pmap_destroy: [ INTERFACE ]
- *
- * Drop the reference count on the specified pmap, releasing
- * all resources if the reference count drops to zero.
- */
-void
-pmap_destroy(pmap)
- pmap_t pmap;
-{
- int count;
-
- PMAP_DPRINTF(PDB_FOLLOW, ("pmap_destroy(%p)\n", pmap));
- simple_lock(&pmap->pm_lock);
- count = --pmap->pm_count;
- simple_unlock(&pmap->pm_lock);
- if (count == 0) {
- if (pmap->pm_ptab) {
- pmap_remove(pmap_kernel(), (vaddr_t)pmap->pm_ptab,
- (vaddr_t)pmap->pm_ptab + MACHINE_MAX_PTSIZE);
- pmap_update(pmap_kernel());
- uvm_km_pgremove(uvm.kernel_object,
- (vaddr_t)pmap->pm_ptab,
- (vaddr_t)pmap->pm_ptab + MACHINE_MAX_PTSIZE);
- uvm_km_free_wakeup(pt_map, (vaddr_t)pmap->pm_ptab,
- MACHINE_MAX_PTSIZE);
- }
- KASSERT(pmap->pm_stab == Segtabzero);
- pool_put(&pmap_pmap_pool, pmap);
- }
-}
-
-/*
- * pmap_reference: [ INTERFACE ]
- *
- * Add a reference to the specified pmap.
- */
-void
-pmap_reference(pmap)
- pmap_t pmap;
-{
-
- PMAP_DPRINTF(PDB_FOLLOW, ("pmap_reference(%p)\n", pmap));
- simple_lock(&pmap->pm_lock);
- pmap->pm_count++;
- simple_unlock(&pmap->pm_lock);
-}
-
-/*
- * pmap_activate: [ INTERFACE ]
- *
- * Activate the pmap used by the specified process. This includes
- * reloading the MMU context of the current process, and marking
- * the pmap in use by the processor.
- *
- * Note: we may only use spin locks here, since we are called
- * by a critical section in cpu_switch()!
- */
-void
-pmap_activate(p)
- struct proc *p;
-{
- pmap_t pmap = p->p_vmspace->vm_map.pmap;
-
- PMAP_DPRINTF(PDB_FOLLOW|PDB_SEGTAB,
- ("pmap_activate(%p)\n", p));
-
- PMAP_ACTIVATE(pmap, p == curproc);
-}
-
-/*
- * pmap_deactivate: [ INTERFACE ]
- *
- * Mark that the pmap used by the specified process is no longer
- * in use by the processor.
- *
- * The comment above pmap_activate() wrt. locking applies here,
- * as well.
- */
-void
-pmap_deactivate(p)
- struct proc *p;
-{
-
- /* No action necessary in this pmap implementation. */
-}
-
-/*
- * pmap_remove: [ INTERFACE ]
- *
- * Remove the given range of addresses from the specified map.
- *
- * It is assumed that the start and end are properly
- * rounded to the page size.
- */
-void
-pmap_remove(pmap, sva, eva)
- pmap_t pmap;
- vaddr_t sva, eva;
-{
- int flags;
-
- PMAP_DPRINTF(PDB_FOLLOW|PDB_REMOVE|PDB_PROTECT,
- ("pmap_remove(%p, %lx, %lx)\n", pmap, sva, eva));
-
- flags = active_pmap(pmap) ? PRM_TFLUSH : 0;
- pmap_remove_flags(pmap, sva, eva, flags);
-}
-
-void
-pmap_remove_flags(pmap, sva, eva, flags)
- pmap_t pmap;
- vaddr_t sva, eva;
- int flags;
-{
- vaddr_t nssva;
- pt_entry_t *pte;
-
- while (sva < eva) {
- nssva = m68k_trunc_seg(sva) + NBSEG;
- if (nssva == 0 || nssva > eva)
- nssva = eva;
-
- /*
- * Invalidate every valid mapping within this segment.
- */
-
- pte = pmap_pte(pmap, sva);
- while (sva < nssva) {
-
- /*
- * If this segment is unallocated,
- * skip to the next segment boundary.
- */
-
- if (!pmap_ste_v(pmap, sva)) {
- sva = nssva;
- break;
- }
- if (pmap_pte_v(pte)) {
- if ((flags & PRM_SKIPWIRED) == 0 ||
- !pmap_pte_w(pte))
- pmap_remove_mapping(pmap, sva, pte,
- flags);
- }
- pte++;
- sva += PAGE_SIZE;
- }
- }
-}
-
-/*
- * pmap_page_protect: [ INTERFACE ]
- *
- * Lower the permission for all mappings to a given page to
- * the permissions specified.
- */
-void
-pmap_page_protect(pg, prot)
- struct vm_page *pg;
- vm_prot_t prot;
-{
- struct pv_entry *pv;
- int s;
-
-#ifdef PMAP_DEBUG
- if ((pmapdebug & (PDB_FOLLOW|PDB_PROTECT)) ||
- (prot == VM_PROT_NONE && (pmapdebug & PDB_REMOVE)))
- printf("pmap_page_protect(%lx, %x)\n", pg, prot);
-#endif
-
- if ((prot & VM_PROT_READ) == VM_PROT_NONE) {
- pv = pg_to_pvh(pg);
- s = splvm();
- while (pv->pv_pmap != NULL) {
- pt_entry_t *pte;
-
- pte = pmap_pte(pv->pv_pmap, pv->pv_va);
-#ifdef PMAP_DEBUG
- if (!pmap_ste_v(pv->pv_pmap, pv->pv_va) ||
- pmap_pte_pa(pte) != VM_PAGE_TO_PHYS(pg))
- panic("pmap_page_protect: bad mapping");
-#endif
- pmap_remove_mapping(pv->pv_pmap, pv->pv_va,
- pte, PRM_TFLUSH|PRM_CFLUSH);
- }
- splx(s);
- } else if ((prot & VM_PROT_WRITE) == VM_PROT_NONE)
- pmap_changebit(pg, PG_RO, ~0);
-}
-
-/*
- * pmap_protect: [ INTERFACE ]
- *
- * Set the physical protection on the specified range of this map
- * as requested.
- */
-void
-pmap_protect(pmap, sva, eva, prot)
- pmap_t pmap;
- vaddr_t sva, eva;
- vm_prot_t prot;
-{
- vaddr_t nssva;
- pt_entry_t *pte;
- boolean_t needtflush;
- int isro;
-
- PMAP_DPRINTF(PDB_FOLLOW|PDB_PROTECT,
- ("pmap_protect(%p, %lx, %lx, %x)\n",
- pmap, sva, eva, prot));
-
- if ((prot & VM_PROT_READ) == VM_PROT_NONE) {
- pmap_remove(pmap, sva, eva);
- return;
- }
-
- isro = pte_prot(prot);
- needtflush = active_pmap(pmap);
- while (sva < eva) {
- nssva = m68k_trunc_seg(sva) + NBSEG;
- if (nssva == 0 || nssva > eva)
- nssva = eva;
- /*
- * If VA belongs to an unallocated segment,
- * skip to the next segment boundary.
- */
- if (!pmap_ste_v(pmap, sva)) {
- sva = nssva;
- continue;
- }
- /*
- * Change protection on mapping if it is valid and doesn't
- * already have the correct protection.
- */
- pte = pmap_pte(pmap, sva);
- while (sva < nssva) {
- if (pmap_pte_v(pte) && pmap_pte_prot_chg(pte, isro)) {
-#if defined(M68040) || defined(M68060)
- /*
- * Clear caches if making RO (see section
- * "7.3 Cache Coherency" in the manual).
- */
- if (isro && mmutype <= MMU_68040) {
- paddr_t pa = pmap_pte_pa(pte);
-
- DCFP(pa);
- ICPP(pa);
- }
-#endif
- pmap_pte_set_prot(pte, isro);
- if (needtflush)
- TBIS(sva);
- }
- pte++;
- sva += PAGE_SIZE;
- }
- }
-}
-
-/*
- * pmap_enter: [ INTERFACE ]
- *
- * Insert the given physical page (pa) at
- * the specified virtual address (va) in the
- * target physical map with the protection requested.
- *
- * If specified, the page will be wired down, meaning
- * that the related pte cannot be reclaimed.
- *
- * Note: This is the only routine which MAY NOT lazy-evaluate
- * or lose information. That is, this routine must actually
- * insert this page into the given map NOW.
- */
-int
-pmap_enter(pmap, va, pa, prot, flags)
- pmap_t pmap;
- vaddr_t va;
- paddr_t pa;
- vm_prot_t prot;
- int flags;
-{
- pt_entry_t pte;
-
- pte = 0;
-#if defined(M68040) || defined(M68060)
- if (mmutype <= MMU_68040 && (pte_prot(prot) & PG_PROT) == PG_RW)
-#ifdef PMAP_DEBUG
- if (dowriteback && (dokwriteback || pmap != pmap_kernel()))
-#endif
- pte |= PG_CCB;
-#endif
- return (pmap_enter_cache(pmap, va, pa, prot, flags, pte));
-}
-
-/*
- * Similar to pmap_enter(), but allows the caller to control the
- * cacheability of the mapping. However if it is found that this mapping
- * needs to be cache inhibited, the cache bits from the caller are ignored.
- */
-int
-pmap_enter_cache(pmap, va, pa, prot, flags, template)
- pmap_t pmap;
- vaddr_t va;
- paddr_t pa;
- vm_prot_t prot;
- int flags;
- pt_entry_t template;
-{
- struct vm_page *pg;
- pt_entry_t *pte;
- int npte, error;
- paddr_t opa;
- boolean_t cacheable = TRUE;
- boolean_t wired = (flags & PMAP_WIRED) != 0;
-
- PMAP_DPRINTF(PDB_FOLLOW|PDB_ENTER,
- ("pmap_enter_cache(%p, %lx, %lx, %x, %x, %x)\n",
- pmap, va, pa, prot, wired, template));
-
-#ifdef DEBUG
-#ifndef __HAVE_PMAP_DIRECT
- /*
- * pmap_enter() should never be used for CADDR1 and CADDR2.
- */
- if (pmap == pmap_kernel() &&
- (va == (vaddr_t)CADDR1 || va == (vaddr_t)CADDR2))
- panic("pmap_enter: used for CADDR1 or CADDR2");
-#endif
-#endif
-
- /*
- * For user mapping, allocate kernel VM resources if necessary.
- */
- if (pmap->pm_ptab == NULL)
- pmap->pm_ptab = (pt_entry_t *)
- uvm_km_valloc_wait(pt_map, MACHINE_MAX_PTSIZE);
-
- /*
- * Segment table entry not valid, we need a new PT page
- */
- if (!pmap_ste_v(pmap, va)) {
- error = pmap_enter_ptpage(pmap, va);
- if (error != 0) {
- if (flags & PMAP_CANFAIL)
- return (error);
- else
- panic("pmap_enter: out of address space");
- }
- }
-
- pa = trunc_page(pa);
- pte = pmap_pte(pmap, va);
- opa = pmap_pte_pa(pte);
-
- PMAP_DPRINTF(PDB_ENTER, ("enter: pte %p, *pte %x\n", pte, *pte));
-
- /*
- * Mapping has not changed, must be protection or wiring change.
- */
- if (opa == pa) {
- /*
- * Wiring change, just update stats.
- * We don't worry about wiring PT pages as they remain
- * resident as long as there are valid mappings in them.
- * Hence, if a user page is wired, the PT page will be also.
- */
- if (pmap_pte_w_chg(pte, wired ? PG_W : 0)) {
- PMAP_DPRINTF(PDB_ENTER,
- ("enter: wiring change -> %x\n", wired));
- if (wired)
- pmap->pm_stats.wired_count++;
- else
- pmap->pm_stats.wired_count--;
- }
- /*
- * Retain cache inhibition status
- */
- if (pmap_pte_ci(pte))
- cacheable = FALSE;
- goto validate;
- }
-
- /*
- * Mapping has changed, invalidate old range and fall through to
- * handle validating new mapping.
- */
- if (opa) {
- PMAP_DPRINTF(PDB_ENTER,
- ("enter: removing old mapping %lx\n", va));
- pmap_remove_mapping(pmap, va, pte,
- PRM_TFLUSH|PRM_CFLUSH|PRM_KEEPPTPAGE);
- }
-
- /*
- * If this is a new user mapping, increment the wiring count
- * on this PT page. PT pages are wired down as long as there
- * is a valid mapping in the page.
- */
- if (pmap != pmap_kernel()) {
- pmap_ptpage_addref(trunc_page((vaddr_t)pte));
- }
-
- /*
- * Enter on the PV list if part of our managed memory
- * Note that we raise IPL while manipulating the PV list
- * since pmap_enter can be called at interrupt time.
- */
- pg = PHYS_TO_VM_PAGE(pa);
- if (pg != NULL) {
- struct pv_entry *pv, *npv;
- int s;
-
- pv = pg_to_pvh(pg);
- s = splvm();
- PMAP_DPRINTF(PDB_ENTER,
- ("enter: pv at %p: %lx/%p/%p\n",
- pv, pv->pv_va, pv->pv_pmap, pv->pv_next));
- /*
- * No entries yet, use header as the first entry
- */
- if (pv->pv_pmap == NULL) {
- pv->pv_va = va;
- pv->pv_pmap = pmap;
- pv->pv_next = NULL;
- pv->pv_ptste = NULL;
- pv->pv_ptpmap = NULL;
- pv->pv_flags = 0;
- }
- /*
- * There is at least one other VA mapping this page.
- * Place this entry after the header.
- */
- else {
-#ifdef PMAP_DEBUG
- for (npv = pv; npv; npv = npv->pv_next)
- if (pmap == npv->pv_pmap && va == npv->pv_va)
- panic("pmap_enter: already in pv_tab");
-#endif
- npv = pmap_alloc_pv();
- if (npv == NULL) {
- if (flags & PMAP_CANFAIL) {
- splx(s);
- return (ENOMEM);
- } else
- panic("pmap_enter: pmap_alloc_pv() failed");
- }
- npv->pv_va = va;
- npv->pv_pmap = pmap;
- npv->pv_next = pv->pv_next;
- npv->pv_ptste = NULL;
- npv->pv_ptpmap = NULL;
- npv->pv_flags = 0;
- pv->pv_next = npv;
- }
-
- /*
- * Speed pmap_is_referenced() or pmap_is_modified() based
- * on the hint provided in access_type.
- */
-#ifdef DIAGNOSTIC
- if ((flags & VM_PROT_ALL) & ~prot)
- panic("pmap_enter: access type exceeds prot");
-#endif
- if (flags & VM_PROT_WRITE)
- pv->pv_flags |= (PG_U|PG_M);
- else if (flags & VM_PROT_ALL)
- pv->pv_flags |= PG_U;
-
- splx(s);
- }
- /*
- * Assumption: if it is not part of our managed memory
- * then it must be device memory which may be volatile.
- */
- else
- cacheable = FALSE;
-
- /*
- * Increment counters
- */
- pmap->pm_stats.resident_count++;
- if (wired)
- pmap->pm_stats.wired_count++;
-
-validate:
- /*
- * Build the new PTE.
- */
- npte = pa | pte_prot(prot) | (*pte & (PG_M|PG_U)) | PG_V;
- if (wired)
- npte |= PG_W;
-
-#if defined(M68040) || defined(M68060)
- /* Don't cache if process can't take it, like SunOS ones. */
- if (mmutype <= MMU_68040 && pmap != pmap_kernel() &&
- (curproc->p_md.md_flags & MDP_UNCACHE_WX) &&
- (prot & VM_PROT_EXECUTE) && (prot & VM_PROT_WRITE))
- cacheable = FALSE;
-#endif
-
- if (!cacheable)
- npte |= PG_CI;
- else
- npte |= template;
-
- PMAP_DPRINTF(PDB_ENTER, ("enter: new pte value %x\n", npte));
-
- /*
- * Remember if this was a wiring-only change.
- * If so, we need not flush the TLB and caches.
- */
- wired = ((*pte ^ npte) == PG_W);
-#if defined(M68040) || defined(M68060)
- if (mmutype <= MMU_68040 && !wired) {
- DCFP(pa);
- ICPP(pa);
- }
-#endif
- *pte = npte;
- if (!wired && active_pmap(pmap))
- TBIS(va);
-#ifdef PMAP_DEBUG
- if ((pmapdebug & PDB_WIRING) && pmap != pmap_kernel())
- pmap_check_wiring("enter", trunc_page((vaddr_t)pte));
-#endif
-
- return (0);
-}
-
-void
-pmap_kenter_pa(va, pa, prot)
- vaddr_t va;
- paddr_t pa;
- vm_prot_t prot;
-{
- pt_entry_t pte;
-
- pte = pte_prot(prot);
-#if defined(M68040) || defined(M68060)
- if (mmutype <= MMU_68040 && (pte & (PG_PROT)) == PG_RW)
- pte |= PG_CCB;
-#endif
- pmap_kenter_cache(va, pa, pte);
-}
-
-/*
- * Similar to pmap_kenter_pa(), but allows the caller to control the
- * cacheability of the mapping.
- */
-void
-pmap_kenter_cache(va, pa, template)
- vaddr_t va;
- paddr_t pa;
- pt_entry_t template;
-{
- struct pmap *pmap = pmap_kernel();
- pt_entry_t *pte;
- int s, npte, error;
-
- PMAP_DPRINTF(PDB_FOLLOW|PDB_ENTER,
- ("pmap_kenter_cache(%lx, %lx, %x)\n", va, pa, prot));
-
- /*
- * Segment table entry not valid, we need a new PT page
- */
-
- if (!pmap_ste_v(pmap, va)) {
- s = splvm();
- error = pmap_enter_ptpage(pmap, va);
- if (error != 0)
- panic("pmap_kenter_cache: out of address space");
- splx(s);
- }
-
- pa = trunc_page(pa);
- pte = pmap_pte(pmap, va);
-
- PMAP_DPRINTF(PDB_ENTER, ("kenter: pte %p, *pte %x\n", pte, *pte));
- KASSERT(!pmap_pte_v(pte));
-
- /*
- * Increment counters
- */
-
- pmap->pm_stats.resident_count++;
- pmap->pm_stats.wired_count++;
-
- /*
- * Build the new PTE.
- */
-
- npte = pa | template | PG_V | PG_W;
-
- PMAP_DPRINTF(PDB_ENTER, ("kenter: new pte value %x\n", npte));
-#if defined(M68040) || defined(M68060)
- if (mmutype <= MMU_68040) {
- DCFP(pa);
- ICPP(pa);
- }
-#endif
- *pte = npte;
-}
-
-void
-pmap_kremove(va, len)
- vaddr_t va;
- vsize_t len;
-{
- struct pmap *pmap = pmap_kernel();
- vaddr_t sva, eva, nssva;
- pt_entry_t *pte;
-
- PMAP_DPRINTF(PDB_FOLLOW|PDB_REMOVE|PDB_PROTECT,
- ("pmap_kremove(%lx, %lx)\n", va, len));
-
- sva = va;
- eva = va + len;
- while (sva < eva) {
- nssva = m68k_trunc_seg(sva) + NBSEG;
- if (nssva == 0 || nssva > eva)
- nssva = eva;
-
- /*
- * If VA belongs to an unallocated segment,
- * skip to the next segment boundary.
- */
-
- if (!pmap_ste_v(pmap, sva)) {
- sva = nssva;
- continue;
- }
-
- /*
- * Invalidate every valid mapping within this segment.
- */
-
- pte = pmap_pte(pmap, sva);
- while (sva < nssva) {
- if (pmap_pte_v(pte)) {
-#ifdef PMAP_DEBUG
- struct pv_entry *pv;
- int s;
-
- pv = pa_to_pvh(pmap_pte_pa(pte));
- s = splvm();
- while (pv->pv_pmap != NULL) {
- KASSERT(pv->pv_pmap != pmap_kernel() ||
- pv->pv_va != sva);
- pv = pv->pv_next;
- if (pv == NULL) {
- break;
- }
- }
- splx(s);
-#endif
- /*
- * Update statistics
- */
-
- pmap->pm_stats.wired_count--;
- pmap->pm_stats.resident_count--;
-
- /*
- * Invalidate the PTE.
- */
-
- *pte = PG_NV;
- TBIS(sva);
- }
- pte++;
- sva += PAGE_SIZE;
- }
- }
-}
-
-/*
- * pmap_unwire: [ INTERFACE]
- *
- * Clear the wired attribute for a map/virtual-address pair.
- *
- * The mapping must already exist in the pmap.
- */
-void
-pmap_unwire(pmap, va)
- pmap_t pmap;
- vaddr_t va;
-{
- pt_entry_t *pte;
-
- PMAP_DPRINTF(PDB_FOLLOW, ("pmap_unwire(%p, %lx)\n", pmap, va));
-
- pte = pmap_pte(pmap, va);
-#ifdef PMAP_DEBUG
- /*
- * Page table page is not allocated.
- * Should this ever happen? Ignore it for now,
- * we don't want to force allocation of unnecessary PTE pages.
- */
- if (!pmap_ste_v(pmap, va)) {
- if (pmapdebug & PDB_PARANOIA)
- printf("pmap_unwire: invalid STE for %lx\n", va);
- return;
- }
- /*
- * Page not valid. Should this ever happen?
- * Just continue and change wiring anyway.
- */
- if (!pmap_pte_v(pte)) {
- if (pmapdebug & PDB_PARANOIA)
- printf("pmap_unwire: invalid PTE for %lx\n", va);
- }
-#endif
- /*
- * If wiring actually changed (always?) set the wire bit and
- * update the wire count. Note that wiring is not a hardware
- * characteristic so there is no need to invalidate the TLB.
- */
- if (pmap_pte_w_chg(pte, 0)) {
- pmap_pte_set_w(pte, 0);
- pmap->pm_stats.wired_count--;
- }
-}
-
-/*
- * pmap_extract: [ INTERFACE ]
- *
- * Extract the physical address associated with the given
- * pmap/virtual address pair.
- */
-boolean_t
-pmap_extract(pmap, va, pap)
- pmap_t pmap;
- vaddr_t va;
- paddr_t *pap;
-{
- boolean_t rv = FALSE;
- paddr_t pa;
- pt_entry_t *pte;
-
- PMAP_DPRINTF(PDB_FOLLOW,
- ("pmap_extract(%p, %lx) -> ", pmap, va));
-
-#ifdef __HAVE_PMAP_DIRECT
- if (pmap == pmap_kernel() && trunc_page(va) > VM_MAX_KERNEL_ADDRESS) {
- if (pap != NULL)
- *pap = va;
- return (TRUE);
- }
-#endif
-
- if (pmap_ste_v(pmap, va)) {
- pte = pmap_pte(pmap, va);
- if (pmap_pte_v(pte)) {
- pa = pmap_pte_pa(pte) | (va & ~PG_FRAME);
- if (pap != NULL)
- *pap = pa;
- rv = TRUE;
- }
- }
-#ifdef PMAP_DEBUG
- if (pmapdebug & PDB_FOLLOW) {
- if (rv)
- printf("%lx\n", pa);
- else
- printf("failed\n");
- }
-#endif
- return (rv);
-}
-
-/*
- * pmap_collect: [ INTERFACE ]
- *
- * Garbage collects the physical map system for pages which are no
- * longer used. Success need not be guaranteed -- that is, there
- * may well be pages which are not referenced, but others may be
- * collected.
- *
- * Called by the pageout daemon when pages are scarce.
- */
-void
-pmap_collect(pmap)
- pmap_t pmap;
-{
- int flags;
-
- PMAP_DPRINTF(PDB_FOLLOW, ("pmap_collect(%p)\n", pmap));
-
- if (pmap == pmap_kernel()) {
- int bank, s;
-
- /*
- * XXX This is very bogus. We should handle kernel PT
- * XXX pages much differently.
- */
-
- s = splvm();
- for (bank = 0; bank < vm_nphysseg; bank++)
- pmap_collect1(ptoa(vm_physmem[bank].start),
- ptoa(vm_physmem[bank].end));
- splx(s);
- } else {
- /*
- * This process is about to be swapped out; free all of
- * the PT pages by removing the physical mappings for its
- * entire address space. Note: pmap_remove() performs
- * all necessary locking.
- */
- flags = active_pmap(pmap) ? PRM_TFLUSH : 0;
- pmap_remove_flags(pmap, VM_MIN_ADDRESS, VM_MAX_ADDRESS,
- flags | PRM_SKIPWIRED);
- pmap_update(pmap);
- }
-}
-
-/*
- * pmap_collect1:
- *
- * Garbage-collect KPT pages. Helper for the above (bogus)
- * pmap_collect().
- *
- * Note: THIS SHOULD GO AWAY, AND BE REPLACED WITH A BETTER
- * WAY OF HANDLING PT PAGES!
- */
-void
-pmap_collect1(startpa, endpa)
- paddr_t startpa, endpa;
-{
- paddr_t pa;
- struct pv_entry *pv;
- pt_entry_t *pte;
- paddr_t kpa;
-#ifdef PMAP_DEBUG
- st_entry_t *ste;
- int opmapdebug = 0 /* XXX initialize to quiet gcc -Wall */;
-#endif
-
- for (pa = startpa; pa < endpa; pa += PAGE_SIZE) {
- struct kpt_page *kpt, **pkpt;
-
- /*
- * Locate physical pages which are being used as kernel
- * page table pages.
- */
- pv = pa_to_pvh(pa);
- if (pv->pv_pmap != pmap_kernel() || !(pv->pv_flags & PV_PTPAGE))
- continue;
- do {
- if (pv->pv_ptste && pv->pv_ptpmap == pmap_kernel())
- break;
- } while ((pv = pv->pv_next));
- if (pv == NULL)
- continue;
-#ifdef PMAP_DEBUG
- if (pv->pv_va < (vaddr_t)Sysmap ||
- pv->pv_va >= (vaddr_t)Sysmap + MACHINE_MAX_PTSIZE)
- printf("collect: kernel PT VA out of range\n");
- else
- goto ok;
- pmap_pvdump(pa);
- continue;
-ok:
-#endif
- pte = (pt_entry_t *)(pv->pv_va + PAGE_SIZE);
- while (--pte >= (pt_entry_t *)pv->pv_va && *pte == PG_NV)
- ;
- if (pte >= (pt_entry_t *)pv->pv_va)
- continue;
-
-#ifdef PMAP_DEBUG
- if (pmapdebug & (PDB_PTPAGE|PDB_COLLECT)) {
- printf("collect: freeing KPT page at %lx (ste %x@%p)\n",
- pv->pv_va, *pv->pv_ptste, pv->pv_ptste);
- opmapdebug = pmapdebug;
- pmapdebug |= PDB_PTPAGE;
- }
-
- ste = pv->pv_ptste;
-#endif
- /*
- * If all entries were invalid we can remove the page.
- * We call pmap_remove_entry to take care of invalidating
- * ST and Sysptmap entries.
- */
- pmap_extract(pmap_kernel(), pv->pv_va, &kpa);
- pmap_remove_mapping(pmap_kernel(), pv->pv_va, PT_ENTRY_NULL,
- PRM_TFLUSH|PRM_CFLUSH);
- /*
- * Use the physical address to locate the original
- * (kmem_alloc assigned) address for the page and put
- * that page back on the free list.
- */
- for (pkpt = &kpt_used_list, kpt = *pkpt;
- kpt != NULL;
- pkpt = &kpt->kpt_next, kpt = *pkpt)
- if (kpt->kpt_pa == kpa)
- break;
-#ifdef PMAP_DEBUG
- if (kpt == NULL)
- panic("pmap_collect: lost a KPT page");
- if (pmapdebug & (PDB_PTPAGE|PDB_COLLECT))
- printf("collect: %lx (%lx) to free list\n",
- kpt->kpt_va, kpa);
-#endif
- *pkpt = kpt->kpt_next;
- kpt->kpt_next = kpt_free_list;
- kpt_free_list = kpt;
-#ifdef PMAP_DEBUG
- if (pmapdebug & (PDB_PTPAGE|PDB_COLLECT))
- pmapdebug = opmapdebug;
-
- if (*ste & SG_V)
- printf("collect: kernel STE at %p still valid (%x)\n",
- ste, *ste);
- ste = &Sysptmap[ste - pmap_ste(pmap_kernel(), 0)];
- if (*ste & SG_V)
- printf("collect: kernel PTmap at %p still valid (%x)\n",
- ste, *ste);
-#endif
- }
-}
-
-/*
- * pmap_zero_page: [ INTERFACE ]
- *
- * Zero the specified (machine independent) page by mapping the page
- * into virtual memory and using bzero to clear its contents, one
- * machine dependent page at a time.
- *
- * Note: WE DO NOT CURRENTLY LOCK THE TEMPORARY ADDRESSES!
- */
-void
-pmap_zero_page(struct vm_page *pg)
-{
-#ifdef __HAVE_PMAP_DIRECT
- vaddr_t va = pmap_map_direct(pg);
- zeropage((void *)va);
-#else
- paddr_t phys = VM_PAGE_TO_PHYS(pg);
- int npte;
-
- PMAP_DPRINTF(PDB_FOLLOW, ("pmap_zero_page(%lx)\n", phys));
-
- npte = phys | PG_V;
-
-#if defined(M68040) || defined(M68060)
- if (mmutype <= MMU_68040) {
- /*
- * Set copyback caching on the page; this is required
- * for cache consistency (since regular mappings are
- * copyback as well).
- */
- npte |= PG_CCB;
- }
-#endif
-
- *caddr1_pte = npte;
- TBIS((vaddr_t)CADDR1);
-
- zeropage(CADDR1);
-
-#ifdef PMAP_DEBUG
- *caddr1_pte = PG_NV;
- TBIS((vaddr_t)CADDR1);
-#endif
-#endif /* __HAVE_PMAP_DIRECT */
-}
-
-/*
- * pmap_copy_page: [ INTERFACE ]
- *
- * Copy the specified (machine independent) page by mapping the page
- * into virtual memory and using bcopy to copy the page, one machine
- * dependent page at a time.
- *
- * Note: WE DO NOT CURRENTLY LOCK THE TEMPORARY ADDRESSES!
- */
-void
-pmap_copy_page(struct vm_page *srcpg, struct vm_page *dstpg)
-{
-#ifdef __HAVE_PMAP_DIRECT
- vaddr_t srcva = pmap_map_direct(srcpg);
- vaddr_t dstva = pmap_map_direct(dstpg);
- copypage((void *)srcva, (void *)dstva);
-#else
- paddr_t src = VM_PAGE_TO_PHYS(srcpg);
- paddr_t dst = VM_PAGE_TO_PHYS(dstpg);
-
- int npte1, npte2;
-
- PMAP_DPRINTF(PDB_FOLLOW, ("pmap_copy_page(%lx, %lx)\n", src, dst));
-
- npte1 = src | PG_RO | PG_V;
- npte2 = dst | PG_V;
-
-#if defined(M68040) || defined(M68060)
- if (mmutype <= MMU_68040) {
- /*
- * Set copyback caching on the pages; this is required
- * for cache consistency (since regular mappings are
- * copyback as well).
- */
- npte1 |= PG_CCB;
- npte2 |= PG_CCB;
- }
-#endif
-
- *caddr1_pte = npte1;
- TBIS((vaddr_t)CADDR1);
-
- *caddr2_pte = npte2;
- TBIS((vaddr_t)CADDR2);
-
- copypage(CADDR1, CADDR2);
-
-#ifdef PMAP_DEBUG
- *caddr1_pte = PG_NV;
- TBIS((vaddr_t)CADDR1);
-
- *caddr2_pte = PG_NV;
- TBIS((vaddr_t)CADDR2);
-#endif
-#endif /* __HAVE_PMAP_DIRECT */
-}
-
-/*
- * pmap_clear_modify: [ INTERFACE ]
- *
- * Clear the modify bits on the specified physical page.
- */
-boolean_t
-pmap_clear_modify(pg)
- struct vm_page *pg;
-{
- boolean_t rv;
-
- PMAP_DPRINTF(PDB_FOLLOW, ("pmap_clear_modify(%lx)\n", pg));
-
- rv = pmap_testbit(pg, PG_M);
- pmap_changebit(pg, 0, ~PG_M);
- return rv;
-}
-
-/*
- * pmap_clear_reference: [ INTERFACE ]
- *
- * Clear the reference bit on the specified physical page.
- */
-boolean_t
-pmap_clear_reference(pg)
- struct vm_page *pg;
-{
- boolean_t rv;
-
- PMAP_DPRINTF(PDB_FOLLOW, ("pmap_clear_reference(%lx)\n", pg));
-
- rv = pmap_testbit(pg, PG_U);
- pmap_changebit(pg, 0, ~PG_U);
- return rv;
-}
-
-/*
- * pmap_is_referenced: [ INTERFACE ]
- *
- * Return whether or not the specified physical page is referenced
- * by any physical maps.
- */
-boolean_t
-pmap_is_referenced(pg)
- struct vm_page *pg;
-{
-#ifdef PMAP_DEBUG
- if (pmapdebug & PDB_FOLLOW) {
- boolean_t rv = pmap_testbit(pg, PG_U);
- printf("pmap_is_referenced(%lx) -> %c\n", pg, "FT"[rv]);
- return(rv);
- }
-#endif
- return(pmap_testbit(pg, PG_U));
-}
-
-/*
- * pmap_is_modified: [ INTERFACE ]
- *
- * Return whether or not the specified physical page is modified
- * by any physical maps.
- */
-boolean_t
-pmap_is_modified(pg)
- struct vm_page *pg;
-{
-#ifdef PMAP_DEBUG
- if (pmapdebug & PDB_FOLLOW) {
- boolean_t rv = pmap_testbit(pg, PG_M);
- printf("pmap_is_modified(%lx) -> %c\n", pg, "FT"[rv]);
- return(rv);
- }
-#endif
- return(pmap_testbit(pg, PG_M));
-}
-
-/*
- * Miscellaneous support routines follow
- */
-
-/*
- * pmap_remove_mapping:
- *
- * Invalidate a single page denoted by pmap/va.
- *
- * If (pte != NULL), it is the already computed PTE for the page.
- *
- * If (flags & PRM_TFLUSH), we must invalidate any TLB information.
- *
- * If (flags & PRM_CFLUSH), we must flush/invalidate any cache
- * information.
- *
- * If (flags & PRM_KEEPPTPAGE), we don't free the page table page
- * if the reference drops to zero.
- */
-void
-pmap_remove_mapping(pmap, va, pte, flags)
- pmap_t pmap;
- vaddr_t va;
- pt_entry_t *pte;
- int flags;
-{
- struct vm_page *pg;
- paddr_t pa;
- struct pv_entry *pv, *prev, *cur;
- pmap_t ptpmap;
- st_entry_t *ste;
- int s, bits;
-#ifdef PMAP_DEBUG
- pt_entry_t opte;
-#endif
-
- PMAP_DPRINTF(PDB_FOLLOW|PDB_REMOVE|PDB_PROTECT,
- ("pmap_remove_mapping(%p, %lx, %p, %x)\n",
- pmap, va, pte, flags));
-
- /*
- * PTE not provided, compute it from pmap and va.
- */
-
- if (pte == PT_ENTRY_NULL) {
- pte = pmap_pte(pmap, va);
- if (*pte == PG_NV)
- return;
- }
- pa = pmap_pte_pa(pte);
-#ifdef PMAP_DEBUG
- opte = *pte;
-#endif
-
-#if defined(M68040) || defined(M68060)
- if ((mmutype <= MMU_68040) && (flags & PRM_CFLUSH)) {
- DCFP(pa);
- ICPP(pa);
- }
-#endif
-
- /*
- * Update statistics
- */
-
- if (pmap_pte_w(pte))
- pmap->pm_stats.wired_count--;
- pmap->pm_stats.resident_count--;
-
- /*
- * Invalidate the PTE after saving the reference modify info.
- */
-
- PMAP_DPRINTF(PDB_REMOVE, ("remove: invalidating pte at %p\n", pte));
- bits = *pte & (PG_U|PG_M);
- *pte = PG_NV;
- if ((flags & PRM_TFLUSH) && active_pmap(pmap))
- TBIS(va);
-
- /*
- * For user mappings decrement the wiring count on
- * the PT page.
- */
-
- if (pmap != pmap_kernel()) {
- vaddr_t ptpva = trunc_page((vaddr_t)pte);
- int refs = pmap_ptpage_delref(ptpva);
-#ifdef PMAP_DEBUG
- if (pmapdebug & PDB_WIRING)
- pmap_check_wiring("remove", ptpva);
-#endif
-
- /*
- * If reference count drops to zero, and we're not instructed
- * to keep it around, free the PT page.
- */
-
- if (refs == 0 && (flags & PRM_KEEPPTPAGE) == 0) {
-#ifdef DIAGNOSTIC
- struct pv_entry *pv;
-#endif
- paddr_t pa;
-
- pa = pmap_pte_pa(pmap_pte(pmap_kernel(), ptpva));
- pg = PHYS_TO_VM_PAGE(pa);
-#ifdef DIAGNOSTIC
- if (pg == NULL)
- panic("pmap_remove_mapping: unmanaged PT page");
- pv = pg_to_pvh(pg);
- if (pv->pv_ptste == NULL)
- panic("pmap_remove_mapping: ptste == NULL");
- if (pv->pv_pmap != pmap_kernel() ||
- pv->pv_va != ptpva ||
- pv->pv_next != NULL)
- panic("pmap_remove_mapping: "
- "bad PT page pmap %p, va 0x%lx, next %p",
- pv->pv_pmap, pv->pv_va, pv->pv_next);
-#endif
- pmap_remove_mapping(pmap_kernel(), ptpva,
- PT_ENTRY_NULL, PRM_TFLUSH|PRM_CFLUSH);
- uvm_pagefree(pg);
- PMAP_DPRINTF(PDB_REMOVE|PDB_PTPAGE,
- ("remove: PT page 0x%lx (0x%lx) freed\n",
- ptpva, pa));
- }
- }
-
- /*
- * If this isn't a managed page, we are all done.
- */
-
- pg = PHYS_TO_VM_PAGE(pa);
- if (pg == NULL)
- return;
-
- /*
- * Otherwise remove it from the PV table
- * (raise IPL since we may be called at interrupt time).
- */
-
- pv = pg_to_pvh(pg);
- s = splvm();
-
- /*
- * If it is the first entry on the list, it is actually
- * in the header and we must copy the following entry up
- * to the header. Otherwise we must search the list for
- * the entry. In either case we free the now unused entry.
- */
- if (pmap == pv->pv_pmap && va == pv->pv_va) {
- ste = pv->pv_ptste;
- ptpmap = pv->pv_ptpmap;
- cur = pv->pv_next;
- if (cur != NULL) {
- cur->pv_flags = pv->pv_flags;
- *pv = *cur;
- pmap_free_pv(cur);
- } else
- pv->pv_pmap = NULL;
- } else {
- prev = pv;
- for (cur = pv->pv_next; cur != NULL; cur = cur->pv_next) {
- if (pmap == cur->pv_pmap && va == cur->pv_va)
- break;
- prev = cur;
- }
-#ifdef PMAP_DEBUG
- if (cur == NULL)
- panic("pmap_remove: PA not in pv_tab");
-#endif
- ste = cur->pv_ptste;
- ptpmap = cur->pv_ptpmap;
- prev->pv_next = cur->pv_next;
- pmap_free_pv(cur);
- }
-
- /*
- * If this was a PT page we must also remove the
- * mapping from the associated segment table.
- */
-
- if (ste) {
- PMAP_DPRINTF(PDB_REMOVE|PDB_PTPAGE,
- ("remove: ste was %x@%p pte was %x@%p\n",
- *ste, ste, opte, pmap_pte(pmap, va)));
-#if defined(M68040) || defined(M68060)
- if (mmutype <= MMU_68040) {
- st_entry_t *este = &ste[NPTEPG/SG4_LEV3SIZE];
-
- while (ste < este)
- *ste++ = SG_NV;
-#ifdef PMAP_DEBUG
- ste -= NPTEPG/SG4_LEV3SIZE;
-#endif
- } else
-#endif
- *ste = SG_NV;
-
- /*
- * If it was a user PT page, we decrement the
- * reference count on the segment table as well,
- * freeing it if it is now empty.
- */
-
- if (ptpmap != pmap_kernel()) {
- PMAP_DPRINTF(PDB_REMOVE|PDB_SEGTAB,
- ("remove: stab %p, refcnt %d\n",
- ptpmap->pm_stab, ptpmap->pm_sref - 1));
-#ifdef PMAP_DEBUG
- if ((pmapdebug & PDB_PARANOIA) &&
- ptpmap->pm_stab != (st_entry_t *)trunc_page((vaddr_t)ste))
- panic("remove: bogus ste");
-#endif
- if (--(ptpmap->pm_sref) == 0) {
- PMAP_DPRINTF(PDB_REMOVE|PDB_SEGTAB,
- ("remove: free stab %p\n",
- ptpmap->pm_stab));
- pmap_remove(pmap_kernel(),
- (vaddr_t)ptpmap->pm_stab,
- (vaddr_t)ptpmap->pm_stab + MACHINE_STSIZE);
- pmap_update(pmap_kernel());
- uvm_pagefree(PHYS_TO_VM_PAGE((paddr_t)
- ptpmap->pm_stpa));
- uvm_km_free_wakeup(st_map,
- (vaddr_t)ptpmap->pm_stab,
- MACHINE_STSIZE);
- ptpmap->pm_stab = Segtabzero;
- ptpmap->pm_stpa = Segtabzeropa;
-#if defined(M68040) || defined(M68060)
- if (mmutype <= MMU_68040)
- ptpmap->pm_stfree = protostfree;
-#endif
-
- /*
- * XXX may have changed segment table
- * pointer for current process so
- * update now to reload hardware.
- */
-
- if (active_user_pmap(ptpmap))
- PMAP_ACTIVATE(ptpmap, 1);
- }
-#ifdef PMAP_DEBUG
- else if (ptpmap->pm_sref < 0)
- panic("remove: sref < 0");
-#endif
- }
-#if 0
- /*
- * XXX this should be unnecessary as we have been
- * flushing individual mappings as we go.
- */
- if (ptpmap == pmap_kernel())
- TBIAS();
- else
- TBIAU();
-#endif
- pv->pv_flags &= ~PV_PTPAGE;
- ptpmap->pm_ptpages--;
- }
-
- /*
- * Update saved attributes for managed page
- */
-
- pv->pv_flags |= bits;
- splx(s);
-}
-
-/*
- * pmap_testbit:
- *
- * Test the modified/referenced bits of a physical page.
- */
-boolean_t
-pmap_testbit(pg, bit)
- struct vm_page *pg;
- int bit;
-{
- struct pv_entry *pv, *pvl;
- pt_entry_t *pte;
- int s;
-
- s = splvm();
- pv = pg_to_pvh(pg);
-
- /*
- * Check saved info first
- */
-
- if (pv->pv_flags & bit) {
- splx(s);
- return(TRUE);
- }
- /*
- * Not found. Check current mappings, returning immediately if
- * found. Cache a hit to speed future lookups.
- */
- if (pv->pv_pmap != NULL) {
- for (pvl = pv; pvl != NULL; pvl = pvl->pv_next) {
- pte = pmap_pte(pvl->pv_pmap, pvl->pv_va);
- if (*pte & bit) {
- pv->pv_flags |= bit;
- splx(s);
- return(TRUE);
- }
- }
- }
- splx(s);
- return(FALSE);
-}
-
-/*
- * pmap_changebit:
- *
- * Change the modified/referenced bits, or other PTE bits,
- * for a physical page.
- */
-void
-pmap_changebit(pg, set, mask)
- struct vm_page *pg;
- int set, mask;
-{
- struct pv_entry *pv;
- pt_entry_t *pte, npte;
- vaddr_t va;
- int s;
-#if defined(M68040) || defined(M68060)
- paddr_t pa;
-#endif
-#if defined(M68040) || defined(M68060)
- boolean_t firstpage = TRUE;
-#endif
-
- PMAP_DPRINTF(PDB_BITS,
- ("pmap_changebit(%lx, %x, %x)\n", pg, set, mask));
-
- s = splvm();
- pv = pg_to_pvh(pg);
-
- /*
- * Clear saved attributes (modify, reference)
- */
-
- pv->pv_flags &= mask;
-
- /*
- * Loop over all current mappings setting/clearing as appropos
- * If setting RO do we need to clear the VAC?
- */
-
- if (pv->pv_pmap != NULL) {
-#ifdef PMAP_DEBUG
- int toflush = 0;
-#endif
- for (; pv; pv = pv->pv_next) {
-#ifdef PMAP_DEBUG
- toflush |= (pv->pv_pmap == pmap_kernel()) ? 2 : 1;
-#endif
- va = pv->pv_va;
- pte = pmap_pte(pv->pv_pmap, va);
- npte = (*pte | set) & mask;
- if (*pte != npte) {
-#if defined(M68040) || defined(M68060)
- /*
- * If we are changing caching status or
- * protection make sure the caches are
- * flushed (but only once).
- */
- if (firstpage && (mmutype <= MMU_68040) &&
- ((set == PG_RO) ||
- (set & PG_CMASK) ||
- (mask & PG_CMASK) == 0)) {
- firstpage = FALSE;
- pa = VM_PAGE_TO_PHYS(pg);
- DCFP(pa);
- ICPP(pa);
- }
-#endif
- *pte = npte;
- if (active_pmap(pv->pv_pmap))
- TBIS(va);
- }
- }
- }
- splx(s);
-}
-
-/*
- * pmap_enter_ptpage:
- *
- * Allocate and map a PT page for the specified pmap/va pair.
- */
-int
-pmap_enter_ptpage(pmap, va)
- pmap_t pmap;
- vaddr_t va;
-{
- paddr_t ptpa;
- struct vm_page *pg;
- struct pv_entry *pv;
- st_entry_t *ste;
- int s;
-#if defined(M68040) || defined(M68060)
- paddr_t stpa;
-#endif
-
- PMAP_DPRINTF(PDB_FOLLOW|PDB_ENTER|PDB_PTPAGE,
- ("pmap_enter_ptpage: pmap %p, va %lx\n", pmap, va));
-
- /*
- * Allocate a segment table if necessary. Note that it is allocated
- * from a private map and not pt_map. This keeps user page tables
- * aligned on segment boundaries in the kernel address space.
- * The segment table is wired down. It will be freed whenever the
- * reference count drops to zero.
- */
- if (pmap->pm_stab == Segtabzero) {
- pmap->pm_stab = (st_entry_t *)
- uvm_km_zalloc(st_map, MACHINE_STSIZE);
- pmap_extract(pmap_kernel(), (vaddr_t)pmap->pm_stab,
- (paddr_t *)&pmap->pm_stpa);
-#if defined(M68040) || defined(M68060)
- if (mmutype <= MMU_68040) {
-#ifdef PMAP_DEBUG
- if (dowriteback && dokwriteback) {
-#endif
- stpa = (paddr_t)pmap->pm_stpa;
-#if defined(M68060)
- if (mmutype == MMU_68060) {
- while (stpa < (paddr_t)pmap->pm_stpa +
- MACHINE_STSIZE) {
- pg = PHYS_TO_VM_PAGE(stpa);
- pmap_changebit(pg, PG_CI, ~PG_CCB);
- stpa += PAGE_SIZE;
- }
- DCIS(); /* XXX */
- } else
-#endif
- {
- pg = PHYS_TO_VM_PAGE(stpa);
- pmap_changebit(pg, 0, ~PG_CCB);
- }
-#ifdef PMAP_DEBUG
- }
-#endif
- pmap->pm_stfree = protostfree;
- }
-#endif
- /*
- * XXX may have changed segment table pointer for current
- * process so update now to reload hardware.
- */
- if (active_user_pmap(pmap))
- PMAP_ACTIVATE(pmap, 1);
-
- PMAP_DPRINTF(PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB,
- ("enter: pmap %p stab %p(%p)\n",
- pmap, pmap->pm_stab, pmap->pm_stpa));
- }
-
- ste = pmap_ste(pmap, va);
-#if defined(M68040) || defined(M68060)
- /*
- * Allocate level 2 descriptor block if necessary
- */
- if (mmutype <= MMU_68040) {
- if (*ste == SG_NV) {
- int ix;
- caddr_t addr;
-
- ix = bmtol2(pmap->pm_stfree);
- if (ix == -1) {
- return (ENOMEM);
- }
- pmap->pm_stfree &= ~l2tobm(ix);
- addr = (caddr_t)&pmap->pm_stab[ix*SG4_LEV2SIZE];
- bzero(addr, SG4_LEV2SIZE*sizeof(st_entry_t));
- addr = (caddr_t)&pmap->pm_stpa[ix*SG4_LEV2SIZE];
- *ste = (u_int)addr | SG_RW | SG_U | SG_V;
-
- PMAP_DPRINTF(PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB,
- ("enter: alloc ste2 %d(%p)\n", ix, addr));
- }
- ste = pmap_ste2(pmap, va);
- /*
- * Since a level 2 descriptor maps a block of SG4_LEV3SIZE
- * level 3 descriptors, we need a chunk of NPTEPG/SG4_LEV3SIZE
- * (16) such descriptors (PAGE_SIZE/SG4_LEV3SIZE bytes) to map a
- * PT page--the unit of allocation. We set `ste' to point
- * to the first entry of that chunk which is validated in its
- * entirety below.
- */
- ste = (st_entry_t *)((int)ste & ~(PAGE_SIZE/SG4_LEV3SIZE-1));
-
- PMAP_DPRINTF(PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB,
- ("enter: ste2 %p (%p)\n", pmap_ste2(pmap, va), ste));
- }
-#endif
- va = trunc_page((vaddr_t)pmap_pte(pmap, va));
-
- /*
- * In the kernel we allocate a page from the kernel PT page
- * free list and map it into the kernel page table map (via
- * pmap_enter).
- */
- if (pmap == pmap_kernel()) {
- struct kpt_page *kpt;
-
- s = splvm();
- if ((kpt = kpt_free_list) == NULL) {
- /*
- * No PT pages available.
- * Try once to free up unused ones.
- */
- PMAP_DPRINTF(PDB_COLLECT,
- ("enter: no KPT pages, collecting...\n"));
- pmap_collect(pmap_kernel());
- if ((kpt = kpt_free_list) == NULL) {
- splx(s);
- return (ENOMEM);
- }
- }
- kpt_free_list = kpt->kpt_next;
- kpt->kpt_next = kpt_used_list;
- kpt_used_list = kpt;
- ptpa = kpt->kpt_pa;
- pg = PHYS_TO_VM_PAGE(ptpa);
- bzero((caddr_t)kpt->kpt_va, PAGE_SIZE);
- pmap_enter(pmap, va, ptpa, VM_PROT_READ | VM_PROT_WRITE,
- VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED);
-#if defined(M68060)
- if (mmutype == MMU_68060)
- pmap_changebit(pg, PG_CI, ~PG_CCB);
-#endif
- pmap_update(pmap);
-#ifdef PMAP_DEBUG
- if (pmapdebug & (PDB_ENTER|PDB_PTPAGE)) {
- int ix = pmap_ste(pmap, va) - pmap_ste(pmap, 0);
-
- printf("enter: add &Sysptmap[%d]: %x (KPT page %lx)\n",
- ix, Sysptmap[ix], kpt->kpt_va);
- }
-#endif
- splx(s);
- } else {
-
- /*
- * For user processes we just allocate a page from the
- * VM system. Note that we set the page "wired" count to 1,
- * which is what we use to check if the page can be freed.
- * See pmap_remove_mapping().
- *
- * Count the segment table reference first so that we won't
- * lose the segment table when low on memory.
- */
-
- pmap->pm_sref++;
- PMAP_DPRINTF(PDB_ENTER|PDB_PTPAGE,
- ("enter: about to alloc UPT pg at %lx\n", va));
- while ((pg = uvm_pagealloc(uvm.kernel_object, va, NULL,
- UVM_PGA_ZERO)) == NULL) {
- uvm_wait("ptpage");
- }
- atomic_clearbits_int(&pg->pg_flags, PG_BUSY|PG_FAKE);
- UVM_PAGE_OWN(pg, NULL);
- ptpa = VM_PAGE_TO_PHYS(pg);
- pmap_enter(pmap_kernel(), va, ptpa,
- VM_PROT_READ | VM_PROT_WRITE,
- VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED);
- pmap_update(pmap_kernel());
- }
-#if defined(M68040) || defined(M68060)
- /*
- * Turn off copyback caching of page table pages,
- * could get ugly otherwise.
- */
-#ifdef PMAP_DEBUG
- if (dowriteback && dokwriteback)
-#endif
- if (mmutype <= MMU_68040) {
-#ifdef PMAP_DEBUG
- pt_entry_t *pte = pmap_pte(pmap_kernel(), va);
- if ((pmapdebug & PDB_PARANOIA) && (*pte & PG_CCB) == 0)
- printf("%s PT no CCB: kva=%lx ptpa=%lx pte@%p=%x\n",
- pmap == pmap_kernel() ? "Kernel" : "User",
- va, ptpa, pte, *pte);
-#endif
-#ifdef M68060
- if (mmutype == MMU_68060) {
- pmap_changebit(pg, PG_CI, ~PG_CCB);
- DCIS();
- } else
-#endif
- pmap_changebit(pg, 0, ~PG_CCB);
- }
-#endif
- /*
- * Locate the PV entry in the kernel for this PT page and
- * record the STE address. This is so that we can invalidate
- * the STE when we remove the mapping for the page.
- */
- pv = pg_to_pvh(pg);
- s = splvm();
- if (pv) {
- pv->pv_flags |= PV_PTPAGE;
- do {
- if (pv->pv_pmap == pmap_kernel() && pv->pv_va == va)
- break;
- } while ((pv = pv->pv_next));
- }
-#ifdef PMAP_DEBUG
- if (pv == NULL)
- panic("pmap_enter_ptpage: PT page not entered");
-#endif
- pv->pv_ptste = ste;
- pv->pv_ptpmap = pmap;
-
- PMAP_DPRINTF(PDB_ENTER|PDB_PTPAGE,
- ("enter: new PT page at PA %lx, ste at %p\n", ptpa, ste));
-
- /*
- * Map the new PT page into the segment table.
- * Also increment the reference count on the segment table if this
- * was a user page table page. Note that we don't use vm_map_pageable
- * to keep the count like we do for PT pages, this is mostly because
- * it would be difficult to identify ST pages in pmap_pageable to
- * release them. We also avoid the overhead of vm_map_pageable.
- */
-#if defined(M68040) || defined(M68060)
- if (mmutype <= MMU_68040) {
- st_entry_t *este;
-
- for (este = &ste[NPTEPG/SG4_LEV3SIZE]; ste < este; ste++) {
- *ste = ptpa | SG_U | SG_RW | SG_V;
- ptpa += SG4_LEV3SIZE * sizeof(st_entry_t);
- }
- } else
-#endif
- *ste = (ptpa & SG_FRAME) | SG_RW | SG_V;
- if (pmap != pmap_kernel()) {
- PMAP_DPRINTF(PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB,
- ("enter: stab %p refcnt %d\n",
- pmap->pm_stab, pmap->pm_sref));
- }
-
-#if defined(M68060)
- if (mmutype == MMU_68060) {
- /*
- * Flush stale TLB info.
- */
- if (pmap == pmap_kernel())
- TBIAS();
- else
- TBIAU();
- }
-#endif
- pmap->pm_ptpages++;
- splx(s);
- return (0);
-}
-
-/*
- * pmap_ptpage_addref:
- *
- * Add a reference to the specified PT page.
- */
-void
-pmap_ptpage_addref(ptpva)
- vaddr_t ptpva;
-{
- struct vm_page *pg;
-
- simple_lock(&uvm.kernel_object->vmobjlock);
- pg = uvm_pagelookup(uvm.kernel_object, ptpva - vm_map_min(kernel_map));
- pg->wire_count++;
- PMAP_DPRINTF(PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB,
- ("ptpage addref: pg %p now %d\n", pg, pg->wire_count));
- simple_unlock(&uvm.kernel_object->vmobjlock);
-}
-
-/*
- * pmap_ptpage_delref:
- *
- * Delete a reference to the specified PT page.
- */
-int
-pmap_ptpage_delref(ptpva)
- vaddr_t ptpva;
-{
- struct vm_page *pg;
- int rv;
-
- simple_lock(&uvm.kernel_object->vmobjlock);
- pg = uvm_pagelookup(uvm.kernel_object, ptpva - vm_map_min(kernel_map));
- rv = --pg->wire_count;
- PMAP_DPRINTF(PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB,
- ("ptpage delref: pg %p now %d\n", pg, pg->wire_count));
- simple_unlock(&uvm.kernel_object->vmobjlock);
- return (rv);
-}
-
-void
-pmap_proc_iflush(p, va, len)
- struct proc *p;
- vaddr_t va;
- vsize_t len;
-{
- (void)cachectl(p, CC_EXTPURGE | CC_IPURGE, va, len);
-}
-
-#ifdef PMAP_DEBUG
-/*
- * pmap_pvdump:
- *
- * Dump the contents of the PV list for the specified physical page.
- */
-void
-pmap_pvdump(pa)
- paddr_t pa;
-{
- struct pv_entry *pv;
-
- printf("pa %lx", pa);
- for (pv = pa_to_pvh(pa); pv; pv = pv->pv_next)
- printf(" -> pmap %p, va %lx, ptste %p, ptpmap %p, flags %x",
- pv->pv_pmap, pv->pv_va, pv->pv_ptste, pv->pv_ptpmap,
- pv->pv_flags);
- printf("\n");
-}
-
-/*
- * pmap_check_wiring:
- *
- * Count the number of valid mappings in the specified PT page,
- * and ensure that it is consistent with the number of wirings
- * to that page that the VM system has.
- */
-void
-pmap_check_wiring(str, va)
- char *str;
- vaddr_t va;
-{
- pt_entry_t *pte;
- paddr_t pa;
- struct vm_page *pg;
- int count;
-
- if (!pmap_ste_v(pmap_kernel(), va) ||
- !pmap_pte_v(pmap_pte(pmap_kernel(), va)))
- return;
-
- pa = pmap_pte_pa(pmap_pte(pmap_kernel(), va));
- pg = PHYS_TO_VM_PAGE(pa);
- if (pg->wire_count >= PAGE_SIZE / sizeof(pt_entry_t)) {
- printf("*%s*: 0x%lx: wire count %d\n", str, va, pg->wire_count);
- return;
- }
-
- count = 0;
- for (pte = (pt_entry_t *)va; pte < (pt_entry_t *)(va + PAGE_SIZE);
- pte++)
- if (*pte)
- count++;
- if (pg->wire_count != count)
- printf("*%s*: 0x%lx: w%d/a%d\n",
- str, va, pg->wire_count, count);
-}
-#endif /* PMAP_DEBUG */
diff --git a/sys/arch/m68k/m68k/process_machdep.c b/sys/arch/m68k/m68k/process_machdep.c
deleted file mode 100644
index c94debd4da6..00000000000
--- a/sys/arch/m68k/m68k/process_machdep.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/* $OpenBSD: process_machdep.c,v 1.6 2004/04/12 15:28:38 kettenis Exp $ */
-/* $NetBSD: process_machdep.c,v 1.17 1996/05/06 20:05:24 gwr Exp $ */
-
-/*
- * Copyright (c) 1993 Christopher G. Demetriou
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christopher G. Demetriou.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * This file may seem a bit stylized, but that so that it's easier to port.
- * Functions to be implemented here are:
- *
- * process_read_regs(proc, regs)
- * Get the current user-visible register set from the process
- * and copy it into the regs structure (<machine/reg.h>).
- * The process is stopped at the time read_regs is called.
- *
- * process_write_regs(proc, regs)
- * Update the current register set from the passed in regs
- * structure. Take care to avoid clobbering special CPU
- * registers or privileged bits in the PSL.
- * The process is stopped at the time write_regs is called.
- *
- * process_sstep(proc)
- * Arrange for the process to trap after executing a single instruction.
- *
- * process_set_pc(proc)
- * Set the process's program counter.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/vnode.h>
-#include <sys/ptrace.h>
-#include <machine/psl.h>
-#include <machine/reg.h>
-
-#define process_frame(p) (struct frame *)((p)->p_md.md_regs)
-#define process_fpframe(p) &((p)->p_addr->u_pcb.pcb_fpregs)
-
-int
-process_read_regs(p, regs)
- struct proc *p;
- struct reg *regs;
-{
- struct frame *frame = process_frame(p);
-
- bcopy(frame->f_regs, regs->r_regs, sizeof(frame->f_regs));
- regs->r_sr = frame->f_sr;
- regs->r_pc = frame->f_pc;
-
- return (0);
-}
-
-int
-process_read_fpregs(p, regs)
- struct proc *p;
- struct fpreg *regs;
-{
- struct fpframe *frame = process_fpframe(p);
-
- bcopy(frame->fpf_regs, regs->r_regs, sizeof(frame->fpf_regs));
- regs->r_fpcr = frame->fpf_fpcr;
- regs->r_fpsr = frame->fpf_fpsr;
- regs->r_fpiar = frame->fpf_fpiar;
-
- return (0);
-}
-
-#ifdef PTRACE
-
-int
-process_write_regs(p, regs)
- struct proc *p;
- struct reg *regs;
-{
- struct frame *frame = process_frame(p);
-
- /*
- * in the hp300 machdep.c _write_regs, PC alignment wasn't
- * checked. If an odd address is placed in the PC and the
- * program is allowed to run, it will cause an Address Error
- * which will be transmitted to the process by a SIGBUS.
- * No reasonable debugger would let this happen, but
- * it's not our problem.
- */
-
- /*
- * XXX
- * in hp300 machdep.c, it just cleared/set these bits
- * automatically. here, we barf. well-written programs
- * shouldn't munge them.
- */
- if ((regs->r_sr & PSL_USERCLR) != 0 ||
- (regs->r_sr & PSL_USERSET) != PSL_USERSET)
- return EPERM;
-
- bcopy(regs->r_regs, frame->f_regs, sizeof(frame->f_regs));
- frame->f_sr = regs->r_sr;
- frame->f_pc = regs->r_pc;
-
- return (0);
-}
-
-int
-process_write_fpregs(p, regs)
- struct proc *p;
- struct fpreg *regs;
-{
- struct fpframe *frame = process_fpframe(p);
-
- bcopy(regs->r_regs, frame->fpf_regs, sizeof(frame->fpf_regs));
- frame->fpf_fpcr = regs->r_fpcr;
- frame->fpf_fpsr = regs->r_fpsr;
- frame->fpf_fpiar = regs->r_fpiar;
-
- return (0);
-}
-
-int
-process_sstep(p, sstep)
- struct proc *p;
- int sstep;
-{
- struct frame *frame = process_frame(p);
-
- if (sstep)
- frame->f_sr |= PSL_T;
- else
- frame->f_sr &= ~PSL_T;
-
- return (0);
-}
-
-int
-process_set_pc(p, addr)
- struct proc *p;
- caddr_t addr;
-{
- struct frame *frame = process_frame(p);
-
- /*
- * in the hp300 machdep.c _set_pc, PC alignment is guaranteed
- * by chopping off the low order bit of the new pc.
- * If an odd address was placed in the PC and the program
- * is allowed to run, it will cause an Address Error
- * which will be transmitted to the process by a SIGBUS.
- * No reasonable debugger would let this happen, but
- * it's not our problem.
- */
- frame->f_pc = (u_int)addr;
-
- return (0);
-}
-
-#endif /* PTRACE */
diff --git a/sys/arch/m68k/m68k/regdump.c b/sys/arch/m68k/m68k/regdump.c
deleted file mode 100644
index c0cb560299b..00000000000
--- a/sys/arch/m68k/m68k/regdump.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/* $OpenBSD: regdump.c,v 1.6 2006/06/11 20:48:13 miod Exp $ */
-/* $NetBSD: regdump.c,v 1.1 1997/04/09 19:21:47 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: machdep.c 1.74 92/12/20
- * from: @(#)machdep.c 8.10 (Berkeley) 4/20/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-
-#include <machine/cpu.h>
-#include <machine/frame.h>
-#include <machine/reg.h>
-#include <machine/psl.h>
-
-void dumpmem(int *, int, int);
-char *hexstr(int, int);
-
-/*
- * Print a register and stack dump.
- */
-void
-regdump(tf, sbytes)
- struct trapframe *tf; /* must not be register */
- int sbytes;
-{
- static int doingdump = 0;
- register int i;
- int s;
-
- if (doingdump)
- return;
- s = splhigh();
- doingdump = 1;
- printf("pid = %d, pc = %s, ",
- curproc ? curproc->p_pid : -1, hexstr(tf->tf_pc, 8));
- printf("ps = %s, ", hexstr(tf->tf_sr, 4));
- printf("sfc = %s, ", hexstr(getsfc(), 4));
- printf("dfc = %s\n", hexstr(getdfc(), 4));
- printf("Registers:\n ");
- for (i = 0; i < 8; i++)
- printf(" %d", i);
- printf("\ndreg:");
- for (i = 0; i < 8; i++)
- printf(" %s", hexstr(tf->tf_regs[i], 8));
- printf("\nareg:");
- for (i = 0; i < 8; i++)
- printf(" %s", hexstr(tf->tf_regs[i+8], 8));
- if (sbytes > 0) {
- if (tf->tf_sr & PSL_S) {
- printf("\n\nKernel stack (%s):",
- hexstr((int)(((int *)&tf)-1), 8));
- dumpmem(((int *)&tf)-1, sbytes, 0);
- } else {
- printf("\n\nUser stack (%s):",
- hexstr(tf->tf_regs[SP], 8));
- dumpmem((int *)tf->tf_regs[SP], sbytes, 1);
- }
- }
- doingdump = 0;
- splx(s);
-}
-
-void
-dumpmem(ptr, sz, ustack)
- int *ptr;
- int sz, ustack;
-{
- int i, val;
- int limit;
-
- /* Stay in the same page */
- limit = ((int)ptr) | (NBPG-3);
-
- for (i = 0; i < sz; i++) {
- if ((i & 7) == 0)
- printf("\n%s: ", hexstr((int)ptr, 6));
- else
- printf(" ");
- if (ustack == 1) {
- if (copyin(ptr++, &val, sizeof(int)) != 0)
- break;
- } else {
- if (((int) ptr) >= limit)
- break;
- val = *ptr++;
- }
- printf("%s", hexstr(val, 8));
- }
- printf("\n");
-}
-
-char *
-hexstr(val, len)
- register int val;
- int len;
-{
- static char nbuf[9];
- register int x, i;
-
- if (len > 8)
- return("");
- nbuf[len] = '\0';
- for (i = len-1; i >= 0; --i) {
- x = val & 0xF;
- /* Isn't this a cool trick? */
- nbuf[i] = "0123456789ABCDEF"[x];
- val >>= 4;
- }
- return(nbuf);
-}
diff --git a/sys/arch/m68k/m68k/sig_machdep.c b/sys/arch/m68k/m68k/sig_machdep.c
deleted file mode 100644
index f3933fdf9d4..00000000000
--- a/sys/arch/m68k/m68k/sig_machdep.c
+++ /dev/null
@@ -1,397 +0,0 @@
-/* $OpenBSD: sig_machdep.c,v 1.27 2012/12/02 07:03:31 guenther Exp $ */
-/* $NetBSD: sig_machdep.c,v 1.3 1997/04/30 23:28:03 gwr Exp $ */
-
-/*
- * Copyright (c) 1997 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: machdep.c 1.74 92/12/20
- * from: @(#)machdep.c 8.10 (Berkeley) 4/20/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/exec.h>
-#include <sys/ioctl.h>
-#include <sys/mount.h>
-#include <sys/signal.h>
-#include <sys/signalvar.h>
-#include <sys/malloc.h>
-#include <sys/buf.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <sys/syscallargs.h>
-
-#include <machine/cpu.h>
-#include <machine/frame.h>
-#include <machine/reg.h>
-
-extern short exframesize[];
-
-#define SS_RTEFRAME 1
-#define SS_FPSTATE 2
-#define SS_USERREGS 4
-
-struct sigstate {
- int ss_flags; /* which of the following are valid */
- struct frame ss_frame; /* original exception frame */
- struct fpframe ss_fpstate; /* 68881/68882 state info */
-};
-
-/*
- * WARNING: code in locore.s assumes the layout shown for sf_signum
- * thru sf_handler so... don't screw with them!
- */
-struct sigframe {
- int sf_signum; /* signo for handler */
- siginfo_t *sf_sip; /* pointer to siginfo_t */
- struct sigcontext *sf_scp; /* context ptr for handler */
- sig_t sf_handler; /* handler addr for u_sigc */
- struct sigstate sf_state; /* state of the hardware */
- struct sigcontext sf_sc; /* actual context */
- siginfo_t sf_si;
-};
-
-#ifdef DEBUG
-int sigdebug = 0;
-pid_t sigpid = 0;
-#define SDB_FOLLOW 0x01
-#define SDB_KSTACK 0x02
-#define SDB_FPSTATE 0x04
-#endif
-
-/*
- * Send an interrupt to process.
- */
-void
-sendsig(catcher, sig, mask, code, type, val)
- sig_t catcher;
- int sig, mask;
- u_long code;
- int type;
- union sigval val;
-{
- struct proc *p = curproc;
- struct sigframe *fp, *kfp;
- struct frame *frame;
- struct sigacts *psp = p->p_sigacts;
- short ft;
- int fsize;
-
- frame = (struct frame *)p->p_md.md_regs;
- ft = frame->f_format;
-
- /*
- * Allocate and validate space for the signal handler
- * context. Note that if the stack is in P0 space, the
- * call to grow() is a nop, and the useracc() check
- * will fail if the process has not already allocated
- * the space with a `brk'.
- */
- fsize = sizeof(struct sigframe);
- if ((p->p_sigstk.ss_flags & SS_DISABLE) == 0 &&
- !sigonstack(frame->f_regs[SP]) &&
- (psp->ps_sigonstack & sigmask(sig)))
- fp = (struct sigframe *)(p->p_sigstk.ss_sp +
- p->p_sigstk.ss_size - fsize);
- else
- fp = (struct sigframe *)(frame->f_regs[SP] - fsize);
- if ((unsigned)fp <= USRSTACK - ptoa(p->p_vmspace->vm_ssize))
- (void)uvm_grow(p, (unsigned)fp);
-#ifdef DEBUG
- if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
- printf("sendsig(%d): sig %d ssp %p usp %p scp %p ft %d\n",
- p->p_pid, sig, &fsize, fp, &fp->sf_sc, ft);
-#endif
- kfp = (struct sigframe *)malloc((u_long)fsize, M_TEMP,
- M_WAITOK | M_CANFAIL | M_ZERO);
- if (kfp == NULL) {
- /* Better halt the process in its track than panicing */
- sigexit(p, SIGILL);
- /* NOTREACHED */
- }
-
- /*
- * Build the argument list for the signal handler.
- */
- kfp->sf_signum = sig;
- kfp->sf_sip = NULL;
- kfp->sf_scp = &fp->sf_sc;
- kfp->sf_handler = catcher;
-
- /*
- * Save necessary hardware state. Currently this includes:
- * - general registers
- * - original exception frame (if not a "normal" frame)
- * - FP coprocessor state
- */
- kfp->sf_state.ss_flags = SS_USERREGS;
- bcopy((caddr_t)frame->f_regs,
- (caddr_t)kfp->sf_state.ss_frame.f_regs, sizeof frame->f_regs);
- if (ft >= FMT7) {
-#ifdef DEBUG
- if (ft > 15 || exframesize[ft] < 0)
- panic("sendsig: bogus frame type");
-#endif
- kfp->sf_state.ss_flags |= SS_RTEFRAME;
- kfp->sf_state.ss_frame.f_format = frame->f_format;
- kfp->sf_state.ss_frame.f_vector = frame->f_vector;
- bcopy((caddr_t)&frame->F_u,
- (caddr_t)&kfp->sf_state.ss_frame.F_u, exframesize[ft]);
- /*
- * Leave an indicator that we need to clean up the kernel
- * stack. We do this by setting the "pad word" above the
- * hardware stack frame to the amount the stack must be
- * adjusted by.
- *
- * N.B. we increment rather than just set f_stackadj in
- * case we are called from syscall when processing a
- * sigreturn. In that case, f_stackadj may be non-zero.
- */
- frame->f_stackadj += exframesize[ft];
- frame->f_format = frame->f_vector = 0;
-#ifdef DEBUG
- if (sigdebug & SDB_FOLLOW)
- printf("sendsig(%d): copy out %d of frame %d\n",
- p->p_pid, exframesize[ft], ft);
-#endif
- }
-
- if (fputype) {
- kfp->sf_state.ss_flags |= SS_FPSTATE;
- m68881_save(&kfp->sf_state.ss_fpstate);
- }
-#ifdef DEBUG
- if ((sigdebug & SDB_FPSTATE) && *(char *)&kfp->sf_state.ss_fpstate)
- printf("sendsig(%d): copy out FP state (%x) to %p\n",
- p->p_pid, *(u_int *)&kfp->sf_state.ss_fpstate,
- &kfp->sf_state.ss_fpstate);
-#endif
- /*
- * Build the signal context to be used by sigreturn.
- */
- kfp->sf_sc.sc_mask = mask;
- kfp->sf_sc.sc_sp = frame->f_regs[SP];
- kfp->sf_sc.sc_fp = frame->f_regs[A6];
- kfp->sf_sc.sc_ap = (int)&fp->sf_state;
- kfp->sf_sc.sc_pc = frame->f_pc;
- kfp->sf_sc.sc_ps = frame->f_sr;
-
- if (psp->ps_siginfo & sigmask(sig)) {
- kfp->sf_sip = &fp->sf_si;
- initsiginfo(&kfp->sf_si, sig, code, type, val);
- }
-
- /* XXX do not copy out siginfo if not needed */
- if (copyout((caddr_t)kfp, (caddr_t)fp, fsize) != 0) {
-#ifdef DEBUG
- if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
- printf("sendsig(%d): copyout failed on sig %d\n",
- p->p_pid, sig);
-#endif
- /*
- * Process has trashed its stack; give it an illegal
- * instruction to halt it in its tracks.
- */
- free((caddr_t)kfp, M_TEMP);
- sigexit(p, SIGILL);
- /* NOTREACHED */
- }
- frame->f_regs[SP] = (int)fp;
-#ifdef DEBUG
- if (sigdebug & SDB_FOLLOW)
- printf("sendsig(%d): sig %d scp %p fp %p sc_sp %x sc_ap %x\n",
- p->p_pid, sig, kfp->sf_scp, fp,
- kfp->sf_sc.sc_sp, kfp->sf_sc.sc_ap);
-#endif
- /*
- * Signal trampoline code is at base of user stack.
- */
- frame->f_pc = p->p_sigcode;
-#ifdef DEBUG
- if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
- printf("sendsig(%d): sig %d returns\n",
- p->p_pid, sig);
-#endif
- free((caddr_t)kfp, M_TEMP);
-}
-
-/*
- * System call to cleanup state after a signal
- * has been taken. Reset signal mask and
- * stack state from context left by sendsig (above).
- * Return to previous pc and psl as specified by
- * context left by sendsig. Check carefully to
- * make sure that the user has not modified the
- * psl to gain improper privileges or to cause
- * a machine fault.
- */
-int
-sys_sigreturn(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
- struct sys_sigreturn_args /* {
- syscallarg(struct sigcontext *) sigcntxp;
- } */ *uap = v;
- register struct sigcontext *scp;
- register struct frame *frame;
- register int rf;
- struct sigcontext tsigc;
- struct sigstate tstate;
- int flags;
-
- scp = SCARG(uap, sigcntxp);
-#ifdef DEBUG
- if (sigdebug & SDB_FOLLOW)
- printf("sigreturn: pid %d, scp %p\n", p->p_pid, scp);
-#endif
- if ((int)scp & 1)
- return (EINVAL);
-
- /*
- * Test and fetch the context structure.
- * We grab it all at once for speed.
- */
- if (copyin((caddr_t)scp, (caddr_t)&tsigc, sizeof tsigc))
- return (EINVAL);
- scp = &tsigc;
- if ((scp->sc_ps & PSL_USERCLR) != 0 ||
- (scp->sc_ps & PSL_USERSET) != PSL_USERSET)
- return (EINVAL);
- /*
- * Restore the user supplied information
- */
- p->p_sigmask = scp->sc_mask &~ sigcantmask;
- frame = (struct frame *) p->p_md.md_regs;
- frame->f_regs[SP] = scp->sc_sp;
- frame->f_regs[A6] = scp->sc_fp;
- frame->f_pc = scp->sc_pc;
- frame->f_sr = scp->sc_ps;
-
- /*
- * Grab pointer to hardware state information.
- * If zero, the user is probably doing a longjmp.
- */
- if ((rf = scp->sc_ap) == 0)
- return (EJUSTRETURN);
- /*
- * See if there is anything to do before we go to the
- * expense of copying in close to 1/2K of data
- */
- if (copyin((caddr_t)rf, &flags, sizeof(int)) != 0)
- return (EINVAL);
-#ifdef DEBUG
- if (sigdebug & SDB_FOLLOW)
- printf("sigreturn(%d): sc_ap %x flags %x\n",
- p->p_pid, rf, flags);
-#endif
- if (flags == 0 || copyin((caddr_t)rf, (caddr_t)&tstate, sizeof tstate))
- return (EJUSTRETURN);
-#ifdef DEBUG
- if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
- printf("sigreturn(%d): ssp %p usp %x scp %p ft %d\n",
- p->p_pid, &flags, scp->sc_sp, SCARG(uap, sigcntxp),
- (flags&SS_RTEFRAME) ? tstate.ss_frame.f_format : -1);
-#endif
- /*
- * Restore most of the users registers except for A6 and SP
- * which were handled above.
- */
- if (flags & SS_USERREGS)
- bcopy((caddr_t)tstate.ss_frame.f_regs,
- (caddr_t)frame->f_regs, sizeof(frame->f_regs)-2*sizeof(int));
- /*
- * Restore long stack frames. Note that we do not copy
- * back the saved SR or PC, they were picked up above from
- * the sigcontext structure.
- */
- if (flags & SS_RTEFRAME) {
- register int sz;
-
- /* grab frame type and validate */
- sz = tstate.ss_frame.f_format;
- if (sz > 15 || (sz = exframesize[sz]) < 0)
- return (EINVAL);
- frame->f_stackadj -= sz;
- frame->f_format = tstate.ss_frame.f_format;
- frame->f_vector = tstate.ss_frame.f_vector;
- bcopy((caddr_t)&tstate.ss_frame.F_u, (caddr_t)&frame->F_u, sz);
-#ifdef DEBUG
- if (sigdebug & SDB_FOLLOW)
- printf("sigreturn(%d): copy in %d of frame type %d\n",
- p->p_pid, sz, tstate.ss_frame.f_format);
-#endif
- }
- /*
- * Finally we restore the original FP context
- */
- if (fputype && (flags & SS_FPSTATE))
- m68881_restore(&tstate.ss_fpstate);
-#ifdef DEBUG
- if ((sigdebug & SDB_FPSTATE) && *(char *)&tstate.ss_fpstate)
- printf("sigreturn(%d): copied in FP state (%x) at %p\n",
- p->p_pid, *(u_int *)&tstate.ss_fpstate,
- &tstate.ss_fpstate);
- if ((sigdebug & SDB_FOLLOW) ||
- ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid))
- printf("sigreturn(%d): returns\n", p->p_pid);
-#endif
- return (EJUSTRETURN);
-}
diff --git a/sys/arch/m68k/m68k/sigcode.s b/sys/arch/m68k/m68k/sigcode.s
deleted file mode 100644
index 8f14386ba0b..00000000000
--- a/sys/arch/m68k/m68k/sigcode.s
+++ /dev/null
@@ -1,77 +0,0 @@
-/* $OpenBSD: sigcode.s,v 1.4 2013/02/02 13:32:06 miod Exp $ */
-/* $NetBSD: sigcode.s,v 1.2 1997/04/25 02:22:03 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1980, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: locore.s 1.66 92/12/22$
- *
- * @(#)locore.s 8.6 (Berkeley) 5/27/94
- */
-
-/*
- * NOTICE: This is not a standalone file. To use it, #include it in
- * your port's locore.s, like so:
- *
- * #include <m68k/m68k/sigcode.s>
- */
-
-/*
- * Signal "trampoline" code (18 bytes). Invoked from RTE setup by sendsig().
- *
- * Stack looks like:
- *
- * sp+0 -> signal number
- * sp+4 signal specific code
- * sp+8 pointer to signal context frame (scp)
- * sp+12 address of handler
- * sp+16 saved hardware state
- * .
- * .
- * .
- * scp+0 -> beginning of signal context frame
- */
-
- .data
- .align 2
-GLOBAL(sigcode)
- movl %sp@(12),%a0 | signal handler addr (4 bytes)
- jsr %a0@ | call signal handler (2 bytes)
- addql #4,%sp | pop signal number (2 bytes)
-GLOBAL(sigcodetrap)
- trap #1 | special syscall entry (2 bytes)
- movl %d0,%sp@(4) | save errno (4 bytes)
- moveq #SYS_exit,%d0 | syscall == exit (2 bytes)
- trap #0 | exit(errno) (2 bytes)
- .align 2
-GLOBAL(esigcode)
diff --git a/sys/arch/m68k/m68k/sigreturn.s b/sys/arch/m68k/m68k/sigreturn.s
deleted file mode 100644
index 53e4a7c4e58..00000000000
--- a/sys/arch/m68k/m68k/sigreturn.s
+++ /dev/null
@@ -1,84 +0,0 @@
-/* $OpenBSD: sigreturn.s,v 1.4 2013/02/02 13:32:06 miod Exp $ */
-/* $NetBSD: sigreturn.s,v 1.2 1997/04/25 02:22:04 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1980, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: locore.s 1.66 92/12/22$
- *
- * @(#)locore.s 8.6 (Berkeley) 5/27/94
- */
-
-/*
- * NOTICE: This is not a standalone file. To use it, #include it in
- * your port's locore.s, like so:
- *
- * #include <m68k/m68k/sigreturn.s>
- */
-
-/*
- * The sigreturn() syscall comes here. It requires special handling
- * because we must open a hole in the stack to fill in the (possibly much
- * larger) original stack frame.
- */
-ASENTRY_NOPROFILE(sigreturn)
- lea %sp@(-84),%sp | leave enough space for largest frame
- movl %sp@(84),%sp@ | move up current 8 byte frame
- movl %sp@(88),%sp@(4)
- movl #84,%sp@- | default: adjust by 84 bytes
- moveml #0xFFFF,%sp@- | save user registers
- movl %usp,%a0 | save the user SP
- movl %a0,%sp@(FR_SP) | in the savearea
- movl #SYS_sigreturn,%sp@- | push syscall number
- jbsr _C_LABEL(syscall) | handle it
- addql #4,%sp | pop syscall#
- movl %sp@(FR_SP),%a0 | grab and restore
- movl %a0,%usp | user SP
- lea %sp@(FR_HW),%a1 | pointer to HW frame
- movw %sp@(FR_ADJ),%d0 | do we need to adjust the stack?
- jeq Lsigr1 | no, just continue
- moveq #92,%d1 | total size
- subw %d0,%d1 | - hole size = frame size
- lea %a1@(92),%a0 | destination
- addw %d1,%a1 | source
- lsrw #1,%d1 | convert to word count
- subqw #1,%d1 | minus 1 for dbf
-Lsigrlp:
- movw %a1@-,%a0@- | copy a word
- dbf %d1,Lsigrlp | continue
- movl %a0,%a1 | new HW frame base
-Lsigr1:
- movl %a1,%sp@(FR_SP) | new SP value
- moveml %sp@+,#0x7FFF | restore user registers
- movl %sp@,%sp | and our SP
- jra _ASM_LABEL(rei) | all done
diff --git a/sys/arch/m68k/m68k/softintr.c b/sys/arch/m68k/m68k/softintr.c
deleted file mode 100644
index 2aad54ef56a..00000000000
--- a/sys/arch/m68k/m68k/softintr.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/* $OpenBSD: softintr.c,v 1.2 2010/12/21 14:56:24 claudio Exp $ */
-/* $NetBSD: softintr.c,v 1.2 2003/07/15 00:24:39 lukem Exp $ */
-
-/*
- * Copyright (c) 2001 Wasabi Systems, Inc.
- * All rights reserved.
- *
- * Written by Jason R. Thorpe for Wasabi Systems, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project by
- * Wasabi Systems, Inc.
- * 4. The name of Wasabi Systems, Inc. may not be used to endorse
- * or promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/malloc.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/atomic.h>
-#include <machine/intr.h>
-
-struct soft_intrq soft_intrq[SI_NQUEUES];
-
-/*
- * Initialize the software interrupt system.
- */
-void
-softintr_init(void)
-{
- struct soft_intrq *siq;
- int i;
-
- for (i = 0; i < SI_NQUEUES; i++) {
- siq = &soft_intrq[i];
- TAILQ_INIT(&siq->siq_list);
- siq->siq_si = i;
- mtx_init(&siq->siq_mtx, IPL_HIGH);
- }
-}
-
-/*
- * Process pending software interrupts on the specified queue.
- *
- * NOTE: We must already be at the correct interrupt priority level.
- */
-void
-softintr_dispatch(int si)
-{
- struct soft_intrq *siq = &soft_intrq[si];
- struct soft_intrhand *sih;
-
- for (;;) {
- mtx_enter(&siq->siq_mtx);
- sih = TAILQ_FIRST(&siq->siq_list);
- if (sih == NULL) {
- mtx_leave(&siq->siq_mtx);
- break;
- }
-
- TAILQ_REMOVE(&siq->siq_list, sih, sih_list);
- sih->sih_pending = 0;
-
- uvmexp.softs++;
-
- mtx_leave(&siq->siq_mtx);
-
- (*sih->sih_func)(sih->sih_arg);
- }
-}
-
-/*
- * Register a software interrupt handler.
- */
-void *
-softintr_establish(int ipl, void (*func)(void *), void *arg)
-{
- struct soft_intrhand *sih;
- int si;
-
- switch (ipl) {
- case IPL_SOFT:
- si = SI_SOFT;
- break;
- case IPL_SOFTCLOCK:
- si = SI_SOFTCLOCK;
- break;
- case IPL_SOFTNET:
- si = SI_SOFTNET;
- break;
- case IPL_SOFTTTY:
- si = SI_SOFTTTY;
- break;
- default:
- printf("softintr_establish: unknown soft IPL %d\n", ipl);
- return NULL;
- }
-
- sih = malloc(sizeof(*sih), M_DEVBUF, M_NOWAIT);
- if (__predict_true(sih != NULL)) {
- sih->sih_func = func;
- sih->sih_arg = arg;
- sih->sih_siq = &soft_intrq[si];
- sih->sih_pending = 0;
- }
- return (sih);
-}
-
-/*
- * Unregister a software interrupt handler.
- */
-void
-softintr_disestablish(void *arg)
-{
- struct soft_intrhand *sih = arg;
- struct soft_intrq *siq = sih->sih_siq;
-
- mtx_enter(&siq->siq_mtx);
- if (sih->sih_pending) {
- TAILQ_REMOVE(&siq->siq_list, sih, sih_list);
- sih->sih_pending = 0;
- }
- mtx_leave(&siq->siq_mtx);
-
- free(sih, M_DEVBUF);
-}
-
-/*
- * Schedule a software interrupt.
- */
-void
-softintr_schedule(void *arg)
-{
- struct soft_intrhand *sih = (struct soft_intrhand *)arg;
- struct soft_intrq *siq = sih->sih_siq;
-
- mtx_enter(&siq->siq_mtx);
- if (sih->sih_pending == 0) {
- TAILQ_INSERT_TAIL(&siq->siq_list, sih, sih_list);
- sih->sih_pending = 1;
- atomic_setbits_int(&softpending, 1 << siq->siq_si);
- }
- mtx_leave(&siq->siq_mtx);
-}
diff --git a/sys/arch/m68k/m68k/support.s b/sys/arch/m68k/m68k/support.s
deleted file mode 100644
index 09c7112f17c..00000000000
--- a/sys/arch/m68k/m68k/support.s
+++ /dev/null
@@ -1,68 +0,0 @@
-/* $OpenBSD: support.s,v 1.4 2013/02/02 13:32:06 miod Exp $ */
-/* $NetBSD: support.s,v 1.1 1997/03/16 10:47:33 thorpej Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1980, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: locore.s 1.66 92/12/22$
- *
- * @(#)locore.s 8.6 (Berkeley) 5/27/94
- */
-
-/*
- * Miscellaneous support routines common to all m68k ports.
- */
-
-/*
- * NOTICE: This is not a standalone file. To use it, #include it in
- * your port's locore.s, like so:
- *
- * #include <m68k/m68k/support.s>
- */
-
-/*
- * non-local gotos
- */
-ENTRY(setjmp)
- movl %sp@(4),%a0 | savearea pointer
- moveml #0xFCFC,%a0@ | save d2-d7/a2-a7
- movl %sp@,%a0@(48) | and return address
- moveq #0,%d0 | return 0
- rts
-
-ENTRY(longjmp)
- movl %sp@(4),%a0
- moveml %a0@+,#0xFCFC
- movl %a0@,%sp@
- moveq #1,%d0
- rts
diff --git a/sys/arch/m68k/m68k/trap_subr.s b/sys/arch/m68k/m68k/trap_subr.s
deleted file mode 100644
index 4ed693c8b1b..00000000000
--- a/sys/arch/m68k/m68k/trap_subr.s
+++ /dev/null
@@ -1,155 +0,0 @@
-/* $OpenBSD: trap_subr.s,v 1.3 2013/02/02 13:32:06 miod Exp $ */
-/* $NetBSD: trap_subr.s,v 1.2 1997/06/04 22:12:43 is Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1980, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: locore.s 1.66 92/12/22$
- *
- * @(#)locore.s 8.6 (Berkeley) 5/27/94
- */
-
-/*
- * NOTICE: This is not a standalone file. To use it, #include it in
- * your port's locore.s, like so:
- *
- * #include <m68k/m68k/trap_subr.s>
- */
-
-/*
- * Common fault handling code. Called by exception vector handlers.
- * Registers have been saved, and type for trap() placed in d0.
- */
-ASENTRY_NOPROFILE(fault)
- movl %usp,%a0 | get and save
- movl %a0,%sp@(FR_SP) | the user stack pointer
- clrl %sp@- | no VA arg
- clrl %sp@- | or code arg
- movl %d0,%sp@- | push trap type
- jbsr _C_LABEL(trap) | handle trap
- lea %sp@(12),%sp | pop value args
- movl %sp@(FR_SP),%a0 | restore
- movl %a0,%usp | user SP
- moveml %sp@+,#0x7FFF | restore most user regs
- addql #8,%sp | pop SP and stack adjust
- jra _ASM_LABEL(rei) | all done
-
-/*
- * Similar to above, but will tidy up the stack, if necessary.
- */
-ASENTRY(faultstkadj)
- jbsr _C_LABEL(trap) | handle the error
-/* for 68060 Branch Prediction Error handler */
-_ASM_LABEL(faultstkadjnotrap):
- lea %sp@(12),%sp | pop value args
-/* for new 68060 Branch Prediction Error handler */
-_ASM_LABEL(faultstkadjnotrap2):
- movl %sp@(FR_SP),%a0 | restore user SP
- movl %a0,%usp | from save area
- movw %sp@(FR_ADJ),%d0 | need to adjust stack?
- jne 1f | yes, go to it
- moveml %sp@+,#0x7FFF | no, restore most user regs
- addql #8,%sp | toss SSP and stkadj
- jra _ASM_LABEL(rei) | all done
-1:
- lea %sp@(FR_HW),%a1 | pointer to HW frame
- addql #8,%a1 | source pointer
- movl %a1,%a0 | source
- addw %d0,%a0 | + hole size = dest pointer
- movl %a1@-,%a0@- | copy
- movl %a1@-,%a0@- | 8 bytes
- movl %a0,%sp@(FR_SP) | new SSP
- moveml %sp@+,#0x7FFF | restore user registers
- movl %sp@,%sp | and our SP
- jra _ASM_LABEL(rei) | all done
-
-/*
- * The following exceptions only cause four and six word stack frames
- * and require no post-trap stack adjustment.
- */
-ENTRY_NOPROFILE(illinst)
- clrl %sp@-
- moveml #0xFFFF,%sp@-
- moveq #T_ILLINST,%d0
- jra _ASM_LABEL(fault)
-
-ENTRY_NOPROFILE(zerodiv)
- clrl %sp@-
- moveml #0xFFFF,%sp@-
- moveq #T_ZERODIV,%d0
- jra _ASM_LABEL(fault)
-
-ENTRY_NOPROFILE(chkinst)
- clrl %sp@-
- moveml #0xFFFF,%sp@-
- moveq #T_CHKINST,%d0
- jra _ASM_LABEL(fault)
-
-ENTRY_NOPROFILE(trapvinst)
- clrl %sp@-
- moveml #0xFFFF,%sp@-
- moveq #T_TRAPVINST,%d0
- jra _ASM_LABEL(fault)
-
-ENTRY_NOPROFILE(privinst)
- clrl %sp@-
- moveml #0xFFFF,%sp@-
- moveq #T_PRIVINST,%d0
- jra _ASM_LABEL(fault)
-
-/*
- * Coprocessor and format errors can generate mid-instruction stack
- * frames and cause signal delivery, hence we need to check for potential
- * stack adjustment.
- */
-ENTRY_NOPROFILE(coperr)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@-
- movl %usp,%a0 | get and save
- movl %a0,%sp@(FR_SP) | the user stack pointer
- clrl %sp@- | no VA arg
- clrl %sp@- | or code arg
- movl #T_COPERR,%sp@- | push trap type
- jra _ASM_LABEL(faultstkadj) | call trap and deal with stack
- | adjustments
-
-ENTRY_NOPROFILE(fmterr)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@-
- movl %usp,%a0 | get and save
- movl %a0,%sp@(FR_SP) | the user stack pointer
- clrl %sp@- | no VA arg
- clrl %sp@- | or code arg
- movl #T_FMTERR,%sp@- | push trap type
- jra _ASM_LABEL(faultstkadj) | call trap and deal with stack
- | adjustments
diff --git a/sys/arch/m88k/include/proc.h b/sys/arch/m88k/include/proc.h
index 10921594bec..8b5ff9939f3 100644
--- a/sys/arch/m88k/include/proc.h
+++ b/sys/arch/m88k/include/proc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.h,v 1.6 2013/08/26 21:38:08 miod Exp $ */
+/* $OpenBSD: proc.h,v 1.7 2014/03/18 22:36:34 miod Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -47,7 +47,7 @@
struct trapframe;
/*
- * Machine-dependent part of the proc structure for mvme88k.
+ * Machine-dependent part of the proc structure for m88k.
*/
struct mdproc {
struct trapframe *md_tf; /* trap/syscall registers */
diff --git a/sys/arch/m88k/include/vmparam.h b/sys/arch/m88k/include/vmparam.h
index e7be94ff5c4..c788d1e6783 100644
--- a/sys/arch/m88k/include/vmparam.h
+++ b/sys/arch/m88k/include/vmparam.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmparam.h,v 1.14 2014/01/30 18:16:41 miod Exp $ */
+/* $OpenBSD: vmparam.h,v 1.15 2014/03/18 22:36:34 miod Exp $ */
/*
* Mach Operating System
* Copyright (c) 1992 Carnegie Mellon University
@@ -80,7 +80,7 @@
/*
* Constants which control the way the VM system deals with memory segments.
- * The mvme88k only has one physical memory segment.
+ * All m88k systems so far only have one physical memory segment.
*/
#define VM_PHYSSEG_MAX 1
#define VM_PHYSSEG_STRAT VM_PSTRAT_RANDOM
diff --git a/sys/arch/mvme68k/Makefile b/sys/arch/mvme68k/Makefile
deleted file mode 100644
index 8083e574bef..00000000000
--- a/sys/arch/mvme68k/Makefile
+++ /dev/null
@@ -1,45 +0,0 @@
-# $OpenBSD: Makefile,v 1.15 2013/12/08 14:46:39 espie Exp $
-
-S= ${.CURDIR}/../..
-KFILE= GENERIC
-.if exists(conf/GENERIC.MP)
-KFILE= GENERIC.MP
-.endif
-TDIRS= ${_arch} include
-TAGS= ${.CURDIR}/tags
-
-NOPROG=
-NOMAN=
-NOOBJ=
-SUBDIR= stand
-
-# config the fattest kernel we can find into a temporary dir
-# to create a Makefile. Then use make to pull some variables
-# out and push them into the sub-shell to expand the paths,
-# and finally run ctags.
-tags::
- TDIR=`mktemp -d /tmp/_tagXXXXXXXXXX` || exit 1; \
- eval "S=${S}" && \
- config -s ${S} -b $${TDIR} ${.CURDIR}/conf/${KFILE} && \
- eval "_arch=\"`make -V _arch -f $${TDIR}/Makefile`\"" && \
- eval "_mach=\"`make -V _mach -f $${TDIR}/Makefile`\"" && \
- eval "_machdir=\$S/arch/$${_mach}" && \
- eval "_archdir=\$S/arch/$${_arch}" && \
- eval "HFILES=\"`find $S \( -path $S/'arch' -o -path $S/stand -o -path $S/lib/libsa -o -path $S'/lib/libkern/arch' \) -prune -o -name '*.h'; find $${_machdir} $${_archdir} $S/lib/libkern/arch/$${_mach} \( -name boot -o -name stand \) -prune -o -name '*.h'`\"" && \
- eval "SFILES=\"`make -V SFILES -f $${TDIR}/Makefile`\"" && \
- eval "CFILES=\"`make -V CFILES -f $${TDIR}/Makefile`\"" && \
- eval "AFILES=\"`make -V AFILES -f $${TDIR}/Makefile`\"" && \
- ctags -wd -f ${TAGS} $${CFILES} $${HFILES} && \
- egrep "^[_A-Z]*ENTRY[_A-Z]*\(.*\)" $${SFILES} $${AFILES} | \
- sed "s;\\([^:]*\\):\\([^(]*\\)(\\([^, )]*\\)\\(.*\\);\\3 \\1 /^\\2(\\3\\4$$/;" \
- >> ${TAGS} && \
- sort -o ${TAGS} ${TAGS} && \
- rm -rf $${TDIR}
-
-links:
- -for i in conf ${TDIRS}; do \
- (cd $$i && rm -f tags; ln -s tags tags); done
-
-obj: _SUBDIRUSE
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/mvme68k/compile/.cvsignore b/sys/arch/mvme68k/compile/.cvsignore
deleted file mode 100644
index bfa78d8b9a5..00000000000
--- a/sys/arch/mvme68k/compile/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-GENERIC
-MVME147
-MVME162
-MVME167
-MVME177
-MINIROOT
-RAMDISK
diff --git a/sys/arch/mvme68k/conf/GENERIC b/sys/arch/mvme68k/conf/GENERIC
deleted file mode 100644
index 6fb6dd8d056..00000000000
--- a/sys/arch/mvme68k/conf/GENERIC
+++ /dev/null
@@ -1,121 +0,0 @@
-# $OpenBSD: GENERIC,v 1.37 2013/12/01 21:56:42 miod Exp $
-#
-# For further information on compiling OpenBSD kernels, see the config(8)
-# man page.
-#
-# For further information on hardware support for this architecture, see
-# the intro(4) man page. For further information about kernel options
-# for this architecture, see the options(4) man page. For an explanation
-# of each device driver in this file see the section 4 man page for the
-# device.
-
-machine mvme68k m68k
-include "../../../conf/GENERIC"
-maxusers 32 # estimated number of users
-
-option M68030 # support for 030
-option M68040 # support for 040
-option M68060 # support for 060
-option FPSP # MC68040 floating point support
-option M060SP # ...and MC68060 support package
-
-option MVME141 # (requires M68030)
-option MVME147 # (requires M68030)
-option MVME162 # (requires M68040, FPSP)
-option MVME165 # (requires M68040, FPSP)
-option MVME167 # includes 166 (requires M68040, FPSP)
-option MVME172 # (requires M68060, 060SP, FPSP)
-option MVME177 # includes 176 (requires M68060, 060SP, FPSP)
-
-
-config bsd swap generic
-
-mainbus0 at root
-
-# MVME141
-ofobio0 at mainbus0 addr 0xfff50000
-clock0 at ofobio0 ipl 5
-nvram0 at ofobio0 offset 0x00000
-#vsb0 at ofobio0 offset 0x50000
-vme0 at ofobio0 offset 0x60000
-dart0 at ofobio0 offset 0x20000 ipl 5
-
-# MVME147
-pcc0 at mainbus0 addr 0xfffe0000
-clock0 at pcc0 ipl 5
-nvram0 at pcc0 offset 0x0000
-zs0 at pcc0 offset 0x3000 ipl 4
-zs1 at pcc0 offset 0x3800 ipl 4
-zstty* at zs?
-le* at pcc0 offset 0x1800 ipl 3
-wdsc0 at pcc0 offset 0x4000 ipl 2
-lp0 at pcc0 ipl 1
-vme0 at pcc0 offset 0x2000
-
-# MVME162/172
-mc0 at mainbus0 addr 0xfff00000
-clock0 at mc0 ipl 5
-nvram0 at mc0 offset 0xc0000
-zs0 at mc0 offset 0x45000 ipl 4
-zs1 at mc0 offset 0x45800 ipl 4
-ie0 at mc0 offset 0x46000 ipl 3
-osiop0 at mc0 offset 0x47000 ipl 2
-memc0 at mc0 offset 0x43000
-memc1 at mc0 offset 0x43100
-ipic0 at mc0 offset 0xbc000
-vme0 at mc0 offset 0x40000
-flash0 at mainbus0 addr 0xffa00000
-sram0 at mainbus0 addr 0xffe00000
-
-# IndustryPack modules
-#fooip* at ipic? manu 0x11 prod 0x22 ipl 1
-
-# MVME165
-lrc0 at mainbus0 addr 0xfff90000
-clock0 at lrc0 ipl 5
-#vsb0 at lrc0 offset 0x10000 ipl 4
-vme0 at lrc0 offset 0x20000
-nvram0 at lrc0 offset 0x30000
-dart0 at lrc0 offset 0x40000 ipl 5
-
-# MVME166/167/176/177
-pcctwo0 at mainbus0 addr 0xfff00000
-clock0 at pcctwo0 ipl 5
-nvram0 at pcctwo0 offset 0xc0000
-ie0 at pcctwo0 offset 0x46000 ipl 3
-osiop0 at pcctwo0 offset 0x47000 ipl 2
-cl0 at pcctwo0 offset 0x45000 ipl 3
-vme0 at pcctwo0 offset 0x40000
-#lptwo0 at pcctwo0 ipl 1
-memc0 at pcctwo0 offset 0x43000
-memc1 at pcctwo0 offset 0x43100
-sram0 at mainbus0 addr 0xffe00000
-
-vmes0 at vme0
-
-# MVME327
-vsbic* at vmes0 addr 0xffffa600 ipl 2 vec 0x8c
-vsbic* at vmes0 addr 0xffffa700 ipl 2 vec 0x8d
-# MVME328, MVME328XT
-vs* at vmes0 addr 0xffff9000 ipl 2 vec 0x80
-vs* at vmes0 addr 0xffff9800 ipl 2 vec 0x82
-vs* at vmes0 addr 0xffff4800 ipl 2 vec 0x84
-vs* at vmes0 addr 0xffff5800 ipl 2 vec 0x86
-vs* at vmes0 addr 0xffff7000 ipl 2 vec 0x88
-vs* at vmes0 addr 0xffff7800 ipl 2 vec 0x8a
-# MVME376
-le* at vmes0 addr 0xffff1200 ipl 3 vec 0x74
-le* at vmes0 addr 0xffff1400 ipl 3 vec 0x75
-le* at vmes0 addr 0xffff1600 ipl 3 vec 0x76
-
-vmel0 at vme0
-
-
-scsibus* at scsi?
-sd* at scsibus?
-st* at scsibus?
-cd* at scsibus?
-ch* at scsibus?
-safte* at scsibus?
-ses* at scsibus?
-uk* at scsibus?
diff --git a/sys/arch/mvme68k/conf/MVME147 b/sys/arch/mvme68k/conf/MVME147
deleted file mode 100644
index 60bcc4f15ef..00000000000
--- a/sys/arch/mvme68k/conf/MVME147
+++ /dev/null
@@ -1,55 +0,0 @@
-# $OpenBSD: MVME147,v 1.27 2013/12/01 21:56:42 miod Exp $
-
-machine mvme68k m68k
-
-include "../../../conf/GENERIC"
-
-option M68030 # support for 030
-
-option MVME147 # (requires M68030)
-
-
-maxusers 16
-
-config bsd swap generic
-
-mainbus0 at root
-
-# MVME147
-pcc0 at mainbus0 addr 0xfffe0000
-clock0 at pcc0 ipl 5
-nvram0 at pcc0 offset 0x0000
-zs0 at pcc0 offset 0x3000 ipl 4
-zs1 at pcc0 offset 0x3800 ipl 4
-zstty* at zs?
-le* at pcc0 offset 0x1800 ipl 3
-wdsc0 at pcc0 offset 0x4000 ipl 2
-lp0 at pcc0 ipl 1
-vme0 at pcc0 offset 0x2000
-
-vmes0 at vme0
-
-## MVME327
-#vsbic* at vmes0 addr 0xffffa600 ipl 2 vec 0x8c
-#vsbic* at vmes0 addr 0xffffa700 ipl 2 vec 0x8d
-## MVME328, MVME328XT
-#vs* at vmes0 addr 0xffff9000 ipl 2 vec 0x80
-#vs* at vmes0 addr 0xffff9800 ipl 2 vec 0x82
-#vs* at vmes0 addr 0xffff4800 ipl 2 vec 0x84
-#vs* at vmes0 addr 0xffff5800 ipl 2 vec 0x86
-#vs* at vmes0 addr 0xffff7000 ipl 2 vec 0x88
-#vs* at vmes0 addr 0xffff7800 ipl 2 vec 0x8a
-# MVME376
-le* at vmes0 addr 0xffff1200 ipl 3 vec 0x74
-le* at vmes0 addr 0xffff1400 ipl 3 vec 0x75
-le* at vmes0 addr 0xffff1600 ipl 3 vec 0x76
-
-vmel0 at vme0
-
-
-scsibus* at scsi?
-sd* at scsibus?
-st* at scsibus?
-cd* at scsibus?
-ch* at scsibus?
-uk* at scsibus?
diff --git a/sys/arch/mvme68k/conf/MVME162 b/sys/arch/mvme68k/conf/MVME162
deleted file mode 100644
index 842bb88ee98..00000000000
--- a/sys/arch/mvme68k/conf/MVME162
+++ /dev/null
@@ -1,64 +0,0 @@
-# $OpenBSD: MVME162,v 1.30 2013/12/01 21:56:42 miod Exp $
-
-machine mvme68k m68k
-
-include "../../../conf/GENERIC"
-
-option M68040 # support for 040
-option FPSP # MC68040 floating point support
-
-option MVME162 # (requires M68040, FPSP)
-
-
-maxusers 32
-
-config bsd swap generic
-
-mainbus0 at root
-
-# MVME162
-mc0 at mainbus0 addr 0xfff00000
-clock0 at mc0 ipl 5
-nvram0 at mc0 offset 0xc0000
-zs0 at mc0 offset 0x45000 ipl 4
-zs1 at mc0 offset 0x45800 ipl 4
-zstty* at zs?
-ie0 at mc0 offset 0x46000 ipl 3
-osiop0 at mc0 offset 0x47000 ipl 2
-memc0 at mc0 offset 0x43000
-memc1 at mc0 offset 0x43100
-ipic0 at mc0 offset 0xbc000
-vme0 at mc0 offset 0x40000
-flash0 at mainbus0 addr 0xffa00000
-sram0 at mainbus0 addr 0xffe00000
-
-#fooip* at ipic? manu 0x11 prod 0x22 ipl 1
-
-vmes0 at vme0
-
-# MVME327
-vsbic* at vmes0 addr 0xffffa600 ipl 2 vec 0x8c
-vsbic* at vmes0 addr 0xffffa700 ipl 2 vec 0x8d
-# MVME328, MVME328XT
-vs* at vmes0 addr 0xffff9000 ipl 2 vec 0x80
-vs* at vmes0 addr 0xffff9800 ipl 2 vec 0x82
-vs* at vmes0 addr 0xffff4800 ipl 2 vec 0x84
-vs* at vmes0 addr 0xffff5800 ipl 2 vec 0x86
-vs* at vmes0 addr 0xffff7000 ipl 2 vec 0x88
-vs* at vmes0 addr 0xffff7800 ipl 2 vec 0x8a
-# MVME376
-le* at vmes0 addr 0xffff1200 ipl 3 vec 0x74
-le* at vmes0 addr 0xffff1400 ipl 3 vec 0x75
-le* at vmes0 addr 0xffff1600 ipl 3 vec 0x76
-
-vmel0 at vme0
-
-
-scsibus* at scsi?
-sd* at scsibus?
-st* at scsibus?
-cd* at scsibus?
-ch* at scsibus?
-safte* at scsibus?
-ses* at scsibus?
-uk* at scsibus?
diff --git a/sys/arch/mvme68k/conf/MVME167 b/sys/arch/mvme68k/conf/MVME167
deleted file mode 100644
index 71c6c4716db..00000000000
--- a/sys/arch/mvme68k/conf/MVME167
+++ /dev/null
@@ -1,59 +0,0 @@
-# $OpenBSD: MVME167,v 1.29 2011/06/29 20:52:09 matthew Exp $
-
-machine mvme68k m68k
-
-include "../../../conf/GENERIC"
-
-option M68040 # support for 040
-option FPSP # MC68040 floating point support
-
-option MVME167 # includes 166 (requires M68040, FPSP)
-
-
-maxusers 32
-
-config bsd swap generic
-
-mainbus0 at root
-
-# MVME166/167/177
-pcctwo0 at mainbus0 addr 0xfff00000
-clock0 at pcctwo0 ipl 5
-nvram0 at pcctwo0 offset 0xc0000
-ie0 at pcctwo0 offset 0x46000 ipl 3
-osiop0 at pcctwo0 offset 0x47000 ipl 2
-cl0 at pcctwo0 offset 0x45000 ipl 3
-vme0 at pcctwo0 offset 0x40000
-#lptwo0 at pcctwo0 ipl 1
-memc0 at pcctwo0 offset 0x43000
-memc1 at pcctwo0 offset 0x43100
-sram0 at mainbus0 addr 0xffe00000
-
-vmes0 at vme0
-
-# MVME327
-vsbic* at vmes0 addr 0xffffa600 ipl 2 vec 0x8c
-vsbic* at vmes0 addr 0xffffa700 ipl 2 vec 0x8d
-# MVME328, MVME328XT
-vs* at vmes0 addr 0xffff9000 ipl 2 vec 0x80
-vs* at vmes0 addr 0xffff9800 ipl 2 vec 0x82
-vs* at vmes0 addr 0xffff4800 ipl 2 vec 0x84
-vs* at vmes0 addr 0xffff5800 ipl 2 vec 0x86
-vs* at vmes0 addr 0xffff7000 ipl 2 vec 0x88
-vs* at vmes0 addr 0xffff7800 ipl 2 vec 0x8a
-# MVME376
-le* at vmes0 addr 0xffff1200 ipl 3 vec 0x74
-le* at vmes0 addr 0xffff1400 ipl 3 vec 0x75
-le* at vmes0 addr 0xffff1600 ipl 3 vec 0x76
-
-vmel0 at vme0
-
-
-scsibus* at scsi?
-sd* at scsibus?
-st* at scsibus?
-cd* at scsibus?
-ch* at scsibus?
-safte* at scsibus?
-ses* at scsibus?
-uk* at scsibus?
diff --git a/sys/arch/mvme68k/conf/MVME177 b/sys/arch/mvme68k/conf/MVME177
deleted file mode 100644
index cc1cc48e958..00000000000
--- a/sys/arch/mvme68k/conf/MVME177
+++ /dev/null
@@ -1,58 +0,0 @@
-# $OpenBSD: MVME177,v 1.18 2011/06/29 20:52:09 matthew Exp $
-
-machine mvme68k m68k
-
-include "../../../conf/GENERIC"
-
-option M68060 # support for 060
-option M060SP # ...and MC68060 support package
-
-option MVME177 # (requires M68060, 060SP, FPSP)
-
-maxusers 32
-
-config bsd swap generic
-
-mainbus0 at root
-
-# MVME166/167/177
-pcctwo0 at mainbus0 addr 0xfff00000
-clock0 at pcctwo0 ipl 5
-nvram0 at pcctwo0 offset 0xc0000
-ie0 at pcctwo0 offset 0x46000 ipl 3
-osiop0 at pcctwo0 offset 0x47000 ipl 2
-cl0 at pcctwo0 offset 0x45000 ipl 3
-vme0 at pcctwo0 offset 0x40000
-#lptwo0 at pcctwo0 ipl 1
-memc0 at pcctwo0 offset 0x43000
-memc1 at pcctwo0 offset 0x43100
-sram0 at mainbus0 addr 0xffe00000
-
-vmes0 at vme0
-
-# MVME327
-vsbic* at vmes0 addr 0xffffa600 ipl 2 vec 0x8c
-vsbic* at vmes0 addr 0xffffa700 ipl 2 vec 0x8d
-# MVME328, MVME328XT
-vs* at vmes0 addr 0xffff9000 ipl 2 vec 0x80
-vs* at vmes0 addr 0xffff9800 ipl 2 vec 0x82
-vs* at vmes0 addr 0xffff4800 ipl 2 vec 0x84
-vs* at vmes0 addr 0xffff5800 ipl 2 vec 0x86
-vs* at vmes0 addr 0xffff7000 ipl 2 vec 0x88
-vs* at vmes0 addr 0xffff7800 ipl 2 vec 0x8a
-# MVME376
-le* at vmes0 addr 0xffff1200 ipl 3 vec 0x74
-le* at vmes0 addr 0xffff1400 ipl 3 vec 0x75
-le* at vmes0 addr 0xffff1600 ipl 3 vec 0x76
-
-vmel0 at vme0
-
-
-scsibus* at scsi?
-sd* at scsibus?
-st* at scsibus?
-cd* at scsibus?
-ch* at scsibus?
-safte* at scsibus?
-ses* at scsibus?
-uk* at scsibus?
diff --git a/sys/arch/mvme68k/conf/Makefile.mvme68k b/sys/arch/mvme68k/conf/Makefile.mvme68k
deleted file mode 100644
index bd08d501929..00000000000
--- a/sys/arch/mvme68k/conf/Makefile.mvme68k
+++ /dev/null
@@ -1,172 +0,0 @@
-# $OpenBSD: Makefile.mvme68k,v 1.69 2013/10/15 19:23:28 guenther Exp $
-
-# For instructions on building kernels consult the config(8) and options(4)
-# manual pages.
-#
-# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
-# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
-# DEBUG is set to -g by config if debugging is requested (config -g).
-# PROF is set to -pg by config if profiling is requested (config -p).
-
-.include <bsd.own.mk>
-
-SIZE?= size
-STRIP?= strip
-
-# source tree is located via $S relative to the compilation directory
-.ifndef S
-S!= cd ../../../..; pwd
-.endif
-
-_machdir?= $S/arch/${_mach}
-_archdir?= $S/arch/${_arch}
-
-INCLUDES= -nostdinc -I$S -I. -I$S/arch
-CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D__${_mach}__ -MD -MP
-CWARNFLAGS= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
- -Wno-main -Wno-uninitialized -Wno-format \
- -Wstack-larger-than-2047
-
-CMACHFLAGS= -msoft-float
-CMACHFLAGS+= -fno-builtin-printf -fno-builtin-snprintf \
- -fno-builtin-vsnprintf -fno-builtin-log \
- -fno-builtin-log2 -fno-builtin-malloc
-.if ${IDENT:M-DNO_PROPOLICE}
-CMACHFLAGS+= -fno-stack-protector
-.endif
-
-COPTS?= -O2
-CFLAGS= ${DEBUG} ${CWARNFLAGS} ${CMACHFLAGS} ${COPTS} ${PIPE}
-AFLAGS= -D_LOCORE -x assembler-with-cpp ${CWARNFLAGS} ${CMACHFLAGS}
-LINKFLAGS= -Ttext 0x10000 -e start --warn-common -nopie
-
-.if ${IDENT:M-DDDB_STRUCT}
-DB_STRUCTINFO= db_structinfo.h
-.else
-DB_STRUCTINFO=
-.endif
-
-.include "${_archdir}/fpsp/Makefile.inc"
-.include "${_archdir}/060sp/Makefile.inc"
-
-HOSTCC?= ${CC}
-HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
-HOSTED_CFLAGS= ${CFLAGS}
-HOSTED_C= ${HOSTCC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
-
-NORMAL_C_NOP= ${CC} ${CFLAGS} ${CPPFLAGS} -c $<
-NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
-NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $<
-
-%OBJS
-
-%CFILES
-
-%SFILES
-
-# load lines for config "xxx" will be emitted as:
-# xxx: ${SYSTEM_DEP} swapxxx.o
-# ${SYSTEM_LD_HEAD}
-# ${SYSTEM_LD} swapxxx.o
-# ${SYSTEM_LD_TAIL}
-SYSTEM_HEAD= locore.o param.o ioconf.o ${FPSP} ${060SP}
-SYSTEM_OBJ= ${SYSTEM_HEAD} ${OBJS}
-SYSTEM_DEP= Makefile ${SYSTEM_OBJ}
-SYSTEM_LD_HEAD= @rm -f $@
-SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_HEAD} vers.o $${OBJS}'; \
- ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_HEAD} vers.o ${OBJS}
-SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@
-
-DEBUG?=
-.if ${DEBUG} == "-g"
-LINKFLAGS+= -X
-STRIPFLAGS= -g
-SYSTEM_LD_TAIL+=; \
- echo mv $@ $@.gdb; rm -f $@.gdb; mv $@ $@.gdb; \
- echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
- ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
-.else
-LINKFLAGS+= -S
-.endif
-
-%LOAD
-
-# cc's -MD puts the source and output paths in the dependency file;
-# since those are temp files here we need to fix it up. It also
-# puts the file in /tmp, so we use -MF to put it in the current
-# directory as assym.P and then generate assym.d from it with a
-# good target name
-assym.h: $S/kern/genassym.sh Makefile \
- ${_archdir}/${_arch}/genassym.cf ${_machdir}/${_mach}/genassym.cf
- cat ${_archdir}/${_arch}/genassym.cf ${_machdir}/${_mach}/genassym.cf | \
- sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} -MF assym.P > assym.h.tmp
- sed '1s/.*/assym.h: \\/' assym.P > assym.d
- sort -u assym.h.tmp > assym.h
-
-param.c: $S/conf/param.c
- rm -f param.c
- cp $S/conf/param.c .
-
-param.o: param.c Makefile
- ${NORMAL_C}
-
-mcount.o: $S/lib/libkern/mcount.c Makefile
- ${NORMAL_C_NOP}
-
-ioconf.o: ioconf.c
- ${NORMAL_C}
-
-vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
- sh $S/conf/newvers.sh
- ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
-
-clean::
- rm -f eddep *bsd *bsd.gdb tags *.[dio] [a-z]*.s \
- [Ee]rrs linterrs assym.h ${DB_STRUCTINFO}
-
-lint:
- @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
- ${CFILES} ioconf.c param.c | \
- grep -v 'static function .* unused'
-
-depend:
- @touch $@
-
-tags:
- @echo "see $S/kern/Makefile for tags"
-
-db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.pl
- ${CC} ${CFLAGS} ${CPPFLAGS} -MT $@ -gstabs -c $S/ddb/db_structinfo.c
- objdump -g db_structinfo.o | perl $S/ddb/parse_structinfo.pl > $@
- rm -f db_structinfo.o
-
-locore.o: ${_machdir}/${_mach}/locore.s assym.h
-copy.o copypage.o: assym.h
-
-# The install target can be redefined by putting a
-# install-kernel-${MACHINE_NAME} target into /etc/mk.conf
-MACHINE_NAME!= uname -n
-install: install-kernel-${MACHINE_NAME}
-.if !target(install-kernel-${MACHINE_NAME}})
-install-kernel-${MACHINE_NAME}:
- rm -f /obsd
- ln /bsd /obsd
- cp bsd /nbsd
- mv /nbsd /bsd
-.endif
-
-# pull in the dependency information
-.if !empty(DB_STRUCTINFO) && !exists(${DB_STRUCTINFO})
- ${SYSTEM_OBJ}: ${DB_STRUCTINFO}
-.endif
-.ifnmake clean
-. for o in ${SYSTEM_OBJ} assym.h ${DB_STRUCTINFO}
-. if exists(${o:R}.d)
-. include "${o:R}.d"
-. elif exists($o)
- .PHONY: $o
-. endif
-. endfor
-.endif
-
-%RULES
diff --git a/sys/arch/mvme68k/conf/RAMDISK b/sys/arch/mvme68k/conf/RAMDISK
deleted file mode 100644
index 9a1b31c8616..00000000000
--- a/sys/arch/mvme68k/conf/RAMDISK
+++ /dev/null
@@ -1,127 +0,0 @@
-# $OpenBSD: RAMDISK,v 1.17 2013/12/01 21:56:42 miod Exp $
-
-machine mvme68k m68k
-
-# 2 meg ramdisk
-option MINIROOTSIZE=4096
-option RAMDISK_HOOKS
-
-option M68030 # support for 030
-option M68040 # support for 040
-option M68060 # support for 060
-option FPSP # MC68040 floating point support
-option M060SP # ...and MC68060 support package
-
-option MVME141 # (requires M68030)
-option MVME147 # (requires M68030)
-option MVME162 # (requires M68040, FPSP)
-option MVME165 # (requires M68040, FPSP)
-option MVME167 # includes 166 (requires M68040, FPSP)
-option MVME172 # (requires M68060, 060SP, FPSP)
-option MVME177 # includes 176 (requires M68060, 060SP, FPSP)
-
-maxusers 32
-
-option SCSITERSE
-option SMALL_KERNEL
-option NO_PROPOLICE
-option TIMEZONE=0 # time zone to adjust RTC time by
-option DST=0 # daylight saving time used by RTC
-#makeoptions DEBUG="-g" # compile full symbol table
-option FFS # UFS
-option NFSCLIENT # Network File System client
-option CD9660 # ISO 9660 + Rock Ridge file system
-option INET # IP + ICMP + TCP + UDP
-option INET6
-option BOOT_CONFIG # boot-time kernel config
-
-config bsd root rd0a swap on rd0b
-
-mainbus0 at root
-
-# MVME141
-ofobio0 at mainbus0 addr 0xfff50000
-clock0 at ofobio0 ipl 5
-nvram0 at ofobio0 offset 0x00000
-#vsb0 at ofobio0 offset 0x50000
-vme0 at ofobio0 offset 0x60000
-dart0 at ofobio0 offset 0x20000 ipl 5
-
-# MVME147
-pcc0 at mainbus0 addr 0xfffe0000
-clock0 at pcc0 ipl 5
-nvram0 at pcc0 offset 0x0000
-zs0 at pcc0 offset 0x3000 ipl 4
-zs1 at pcc0 offset 0x3800 ipl 4
-zstty* at zs?
-le* at pcc0 offset 0x1800 ipl 3
-wdsc0 at pcc0 offset 0x4000 ipl 2
-#lp0 at pcc0 ipl 1
-vme0 at pcc0 offset 0x2000
-
-# MVME162
-mc0 at mainbus0 addr 0xfff00000
-clock0 at mc0 ipl 5
-nvram0 at mc0 offset 0xc0000
-zs0 at mc0 offset 0x45000 ipl 4
-zs1 at mc0 offset 0x45800 ipl 4
-ie0 at mc0 offset 0x46000 ipl 3
-osiop0 at mc0 offset 0x47000 ipl 2
-memc0 at mc0 offset 0x43000
-memc1 at mc0 offset 0x43100
-#ipic0 at mc0 offset 0xbc000
-vme0 at mc0 offset 0x40000
-#flash0 at mainbus0 addr 0xffa00000
-#sram0 at mainbus0 addr 0xffe00000
-
-#fooip* at ipic? manu 0x11 prod 0x22 ipl 1
-
-# MVME165
-lrc0 at mainbus0 addr 0xfff90000
-clock0 at lrc0 ipl 5
-#vsb0 at lrc0 offset 0x10000 ipl 4
-vme0 at lrc0 offset 0x20000
-nvram0 at lrc0 offset 0x30000
-dart0 at lrc0 offset 0x40000 ipl 5
-
-# MVME166/167/177
-pcctwo0 at mainbus0 addr 0xfff00000
-clock0 at pcctwo0 ipl 5
-nvram0 at pcctwo0 offset 0xc0000
-ie0 at pcctwo0 offset 0x46000 ipl 3
-osiop0 at pcctwo0 offset 0x47000 ipl 2
-cl0 at pcctwo0 offset 0x45000 ipl 3
-vme0 at pcctwo0 offset 0x40000
-#lptwo0 at pcctwo0 ipl 1
-memc0 at pcctwo0 offset 0x43000
-memc1 at pcctwo0 offset 0x43100
-#sram0 at mainbus0 addr 0xffe00000
-
-vmes0 at vme0
-
-# MVME327
-vsbic* at vmes0 addr 0xffffa600 ipl 2 vec 0x8c
-vsbic* at vmes0 addr 0xffffa700 ipl 2 vec 0x8d
-# MVME328, MVME328XT
-vs* at vmes0 addr 0xffff9000 ipl 2 vec 0x80
-vs* at vmes0 addr 0xffff9800 ipl 2 vec 0x82
-vs* at vmes0 addr 0xffff4800 ipl 2 vec 0x84
-vs* at vmes0 addr 0xffff5800 ipl 2 vec 0x86
-vs* at vmes0 addr 0xffff7000 ipl 2 vec 0x88
-vs* at vmes0 addr 0xffff7800 ipl 2 vec 0x8a
-# MVME376
-le* at vmes0 addr 0xffff1200 ipl 3 vec 0x74
-le* at vmes0 addr 0xffff1400 ipl 3 vec 0x75
-le* at vmes0 addr 0xffff1600 ipl 3 vec 0x76
-
-vmel0 at vme0
-
-
-scsibus* at scsi?
-sd* at scsibus?
-st* at scsibus?
-cd* at scsibus?
-
-pseudo-device loop 1 # network loopback
-pseudo-device bpfilter 1 # packet filter
-pseudo-device rd 1 # ramdisk
diff --git a/sys/arch/mvme68k/conf/files.mvme68k b/sys/arch/mvme68k/conf/files.mvme68k
deleted file mode 100644
index 11bb46e58fc..00000000000
--- a/sys/arch/mvme68k/conf/files.mvme68k
+++ /dev/null
@@ -1,162 +0,0 @@
-# $OpenBSD: files.mvme68k,v 1.38 2013/12/01 21:56:42 miod Exp $
-
-# config file for mvme68k
-
-# maxpartitions must be first item in files.${ARCH}
-maxpartitions 16
-
-maxusers 2 8 64
-
-device mainbus {[addr = -1]}
-attach mainbus at root
-file arch/mvme68k/dev/mainbus.c
-
-device pcc {[offset = -1], [ipl = 0]}
-attach pcc at mainbus
-file arch/mvme68k/dev/pcc.c pcc needs-count
-
-device pcctwo {[offset = -1], [ipl = 0]}
-attach pcctwo at mainbus
-file arch/mvme68k/dev/pcctwo.c pcctwo needs-count
-
-device mc {[offset = -1], [ipl = 0]}
-attach mc at mainbus
-file arch/mvme68k/dev/mc.c mc needs-count
-
-device lrc {[offset = -1], [ipl = 0]}
-attach lrc at mainbus
-file arch/mvme68k/dev/lrc.c lrc needs-flag
-
-device ofobio {[offset = -1], [ipl = 0]}
-attach ofobio at mainbus
-file arch/mvme68k/dev/ofobio.c ofobio needs-flag
-
-device clock
-attach clock at pcc, mc, pcctwo, lrc, ofobio
-file arch/mvme68k/dev/clock.c
-
-device zs {[channel = -1]}
-attach zs at pcc, mc
-file arch/mvme68k/dev/zs.c zs needs-flag
-file dev/ic/z8530sc.c zs
-
-device zstty: tty
-attach zstty at zs
-file dev/ic/z8530tty.c zstty needs-flag
-
-device cl: tty
-attach cl at pcctwo
-file arch/mvme68k/dev/cl.c cl needs-count
-
-device dart: tty
-attach dart at lrc with dartlrc
-attach dart at ofobio with dartofobio
-file arch/mvme68k/dev/dart.c dart needs-flag
-file arch/mvme68k/dev/dart_lrc.c dartlrc
-file arch/mvme68k/dev/dart_ofobio.c dartofobio
-
-device vme {}
-attach vme at pcc, mc, pcctwo, lrc, ofobio
-device vmes {[addr = -1], [vec = -1], [ipl = 0]}
-attach vmes at vme
-device vmel {[addr = -1], [vec = -1], [ipl = 0]}
-attach vmel at vme
-file arch/mvme68k/dev/vme.c vme | vmes | vmel
-file arch/mvme68k/dev/vmes.c vmes needs-count
-file arch/mvme68k/dev/vmel.c vmel needs-count
-
-#device vsb {}
-#attach vsb at lrc, ofobio
-#file arch/mvme68k/dev/vsb.c vsb needs-flag
-
-attach le at pcc, vmes: le24
-file arch/mvme68k/dev/if_le.c le
-
-attach ie at mc, pcctwo
-file arch/mvme68k/dev/if_ie.c ie
-
-include "scsi/files.scsi"
-
-device wdsc: wd33c93, scsi
-attach wdsc at pcc
-file arch/mvme68k/dev/wdsc.c wdsc
-
-device ipic {manu = -1, prod = -1, [vec = -1], [ipl = 0]}
-attach ipic at mc
-file arch/mvme68k/dev/ipic.c ipic
-
-device fooip
-attach fooip at ipic
-file arch/mvme68k/dev/fooip.c fooip
-
-attach osiop at mc with osiop_mc
-attach osiop at pcctwo with osiop_pcctwo
-file arch/mvme68k/dev/osiop_mvme68k.c osiop_mc | osiop_pcctwo
-
-device memc
-attach memc at mc, pcctwo
-file arch/mvme68k/dev/memc.c memc
-
-device flash
-attach flash at mainbus
-file arch/mvme68k/dev/flash.c flash needs-count
-
-device sram
-attach sram at mainbus
-device nvram
-attach nvram at pcc, mc, pcctwo, lrc, ofobio
-file arch/mvme68k/dev/sram.c sram needs-count
-file arch/mvme68k/dev/nvram.c nvram needs-count
-file arch/mvme68k/dev/memdevs.c nvram | sram
-
-device lp
-attach lp at pcc
-file arch/mvme68k/dev/lp.c lp needs-count
-
-device lptwo
-attach lptwo at pcctwo
-file arch/mvme68k/dev/lptwo.c lptwo needs-count
-
-#device xdc {target = -1}
-#attach xdc at vmes
-#device xd: disk
-#attach xd at xdc
-#file arch/mvme68k/dev/xd.c xd needs-flag
-
-major {sd = 4}
-major {cd = 6}
-major {vnd = 8}
-major {rd = 9}
-#major {xd = 10}
-
-file arch/mvme68k/mvme68k/autoconf.c
-file arch/mvme68k/mvme68k/bus_dma.c
-file arch/mvme68k/mvme68k/conf.c
-file arch/mvme68k/mvme68k/disksubr.c
-file arch/mvme68k/mvme68k/machdep.c
-file arch/mvme68k/mvme68k/mem.c
-file arch/m68k/m68k/pmap_motorola.c
-file arch/mvme68k/mvme68k/pmap_bootstrap.c
-file arch/mvme68k/mvme68k/sys_machdep.c
-file arch/mvme68k/mvme68k/trap.c
-file arch/mvme68k/mvme68k/vm_machdep.c
-file dev/cninit.c
-
-file arch/m68k/m68k/db_memrw.c ddb
-
-device wl: tty
-attach wl at vmes
-file arch/mvme68k/dev/wl.c wl needs-count
-
-define bpp
-file arch/mvme68k/dev/bpp.c bpp
-
-# MVME328
-device vs: scsi
-attach vs at vmes
-file arch/mvme68k/dev/vs.c vs
-
-# MVME327
-device vsbic: bpp, scsi
-attach vsbic at vmes
-file arch/mvme68k/dev/vsbic.c vsbic
diff --git a/sys/arch/mvme68k/dev/bpp.c b/sys/arch/mvme68k/dev/bpp.c
deleted file mode 100644
index 488220eb2e6..00000000000
--- a/sys/arch/mvme68k/dev/bpp.c
+++ /dev/null
@@ -1,368 +0,0 @@
-/* $OpenBSD: bpp.c,v 1.1 2009/02/17 22:28:40 miod Exp $ */
-
-/*
- * Copyright (c) 2008, 2009 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies. And
- * I won't mind if you keep the disclaimer below.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* BPP cards live in an A24/D16 world */
-#define __BUS_SPACE_RESTRICT_D16__
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-
-#include <machine/bus.h>
-
-#include <mvme68k/dev/bppvar.h>
-
-int bpp_csr_command(struct bpp_softc *, uint, bus_addr_t);
-
-void
-bpp_attach(struct bpp_softc *sc, bus_space_tag_t iot, bus_space_handle_t ioh)
-{
- sc->sc_iot = iot;
- sc->sc_ioh = ioh;
-}
-
-/*
- * CSR Command Protocol
- *
- * This protocol relies on atomic test-and-set instructions to claim the
- * device for ourselves, using the test-and-set register.
- *
- * However, OpenBSD expects to be the only software talking to the BPP
- * device, so it isn't really necessary to perform atomic operations here
- * (such operations are not provided by the bus_space API anyway).
- */
-
-/*
- * Send a command to the board through the (limited) CSR command protocol.
- */
-int
-bpp_csr_command(struct bpp_softc *sc, uint command, bus_addr_t addr)
-{
- uint16_t csr, tas;
-#if 1
- int tmo, tmo2, stat;
- vaddr_t tasaddr;
-
- tasaddr = (vaddr_t)bus_space_vaddr(sc->sc_iot, sc->sc_ioh) + CSR_TAS;
-#else
- int tmo, stat;
-#endif
-
-#if 1
- for (tmo = 1000; tmo != 0; tmo--) {
- /* wait for the BUSY bit to clear */
- for (tmo2 = 1000; tmo2 != 0; tmo2--) {
- csr = bus_space_read_2(sc->sc_iot, sc->sc_ioh,
- CSR_CONTROL);
- if (!ISSET(csr, CSR_BUSY))
- break;
- delay(100);
- }
- if (tmo2 == 0)
- return STATUS_ERRNO + EAGAIN;
-
- /*
- * Claim the TAS register.
- */
- __asm__ __volatile__
- ("clrl %0; tas %1; bmi 1f; movq #1, %0; 1:" :
- "=d" (stat), "+m"(tasaddr));
-
- if (stat != 0)
- break;
-
- delay(100);
- }
- if (tmo == 0)
- return STATUS_ERRNO + EAGAIN;
-#else
- /* wait for the BUSY bit to clear */
- for (tmo = 1000; tmo != 0; tmo--) {
- csr = bus_space_read_2(sc->sc_iot, sc->sc_ioh, CSR_CONTROL);
- if (!ISSET(csr, CSR_BUSY))
- break;
- delay(100);
- }
- if (tmo == 0)
- return STATUS_ERRNO + EAGAIN;
-
- /*
- * Claim the TAS register.
- */
- bus_space_write_2(sc->sc_iot, sc->sc_ioh, CSR_TAS, TAS_TAS);
-#endif
-
- /* write the command information */
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, CSR_ADDR, addr);
- bus_space_write_1(sc->sc_iot, sc->sc_ioh, CSR_ADDR_MOD, ADRM_EXT_S_D);
- bus_space_write_1(sc->sc_iot, sc->sc_ioh, CSR_DATA_WIDTH, MEMT_D32);
- bus_space_write_2(sc->sc_iot, sc->sc_ioh, CSR_TAS,
- TAS_TAS | TAS_VALID_COMMAND | command);
-
- /* signal the board */
- bpp_attention(sc);
-
- /* wait for the command to complete */
- for (tmo = 1000; tmo != 0; tmo--) {
- tas = bus_space_read_2(sc->sc_iot, sc->sc_ioh, CSR_TAS);
- if (ISSET(tas, TAS_VALID_STATUS))
- break;
- delay(100);
- }
- if (tmo == 0)
- return STATUS_ERRNO + EAGAIN;
-
- stat = bus_space_read_1(sc->sc_iot, sc->sc_ioh, CSR_STATUS);
-
- /* release the board */
- bus_space_write_2(sc->sc_iot, sc->sc_ioh, CSR_TAS,
- TAS_TAS | TAS_COMMAND_COMPLETE |
- bus_space_read_2(sc->sc_iot, sc->sc_ioh, CSR_TAS));
- bpp_attention(sc);
-
- /* wait for the TAS bit to clear */
- for (tmo = 1000; tmo != 0; tmo--) {
- tas = bus_space_read_2(sc->sc_iot, sc->sc_ioh, CSR_TAS);
- if (!ISSET(tas, TAS_TAS))
- break;
- delay(100);
- }
-#ifdef BPP_DEBUG
- if (tmo == 0)
- printf("warning: TAS failed to clear\n");
-#endif
-
- return (stat);
-}
-
-/*
- * Interrupt the board.
- */
-void
-bpp_attention(struct bpp_softc *sc)
-{
- bus_space_write_2(sc->sc_iot, sc->sc_ioh, CSR_CONTROL,
- bus_space_read_2(sc->sc_iot, sc->sc_ioh, CSR_CONTROL) |
- CSR_ATTENTION);
-}
-
-/*
- * Reset the board. This will take several seconds.
- */
-int
-bpp_reset(struct bpp_softc *sc)
-{
- uint16_t csr;
- int tmo;
-
- /* reset the board */
- bus_space_write_2(sc->sc_iot, sc->sc_ioh, CSR_CONTROL, CSR_RESET);
- delay(1000);
- bus_space_write_2(sc->sc_iot, sc->sc_ioh, CSR_CONTROL, 0);
-
- /* wait for BUSY to clear in 10s */
- for (tmo = 10000; tmo != 0; tmo--) {
- csr = bus_space_read_2(sc->sc_iot, sc->sc_ioh, CSR_CONTROL);
- if (!ISSET(csr, CSR_BUSY)) {
- return 0;
- }
-
- delay(1000);
- }
-
- return ENXIO;
-}
-
-/*
- * CSR operations
- */
-
-int
-bpp_create_channel(struct bpp_softc *sc, struct bpp_chan *chan, int pri,
- int ipl, int vec)
-{
- struct bpp_channel *channel = chan->ch;
- struct bpp_envelope *envcmd, *envsts;
-
- /*
- * Setup the initial null envelopes.
- */
-
- envcmd = bpp_get_envelope(sc);
- if (envcmd == NULL)
- return STATUS_ERRNO + ENOMEM;
- envsts = bpp_get_envelope(sc);
- if (envsts == NULL)
- return STATUS_ERRNO + ENOMEM;
-
- (*sc->bpp_env_sync)(sc, envcmd, BUS_DMASYNC_PREWRITE);
- (*sc->bpp_env_sync)(sc, envsts, BUS_DMASYNC_PREWRITE);
-
- /*
- * Setup channel header.
- */
-
- memset(channel, 0, sizeof (*channel));
- channel->ch_cmd_head = channel->ch_cmd_tail =
- htobe32((*sc->bpp_env_pa)(sc, envcmd));
- channel->ch_status_head = channel->ch_status_tail =
- htobe32((*sc->bpp_env_pa)(sc, envsts));
- channel->ch_ipl = ipl;
- channel->ch_ivec = vec;
- channel->ch_priority = pri;
- channel->ch_addrmod = ADRM_EXT_S_D;
- channel->ch_buswidth = MEMT_D32;
-
- (*sc->bpp_chan_sync)(sc, channel, BUS_DMASYNC_PREWRITE);
-
- chan->envcmd = envcmd;
- chan->envsts = envsts;
-
- return bpp_csr_command(sc, COMMAND_CHANNEL_CREATE,
- (*sc->bpp_chan_pa)(sc, channel));
-}
-
-/*
- * BPP operations and envelope management
- */
-
-/*
- * Initialize the free list as a set of contiguous envelopes.
- */
-void
-bpp_initialize_envelopes(struct bpp_softc *sc, struct bpp_envelope *env,
- uint cnt)
-{
- sc->sc_env_free = NULL;
- while (cnt-- != 0)
- bpp_put_envelope(sc, env++);
-}
-
-/*
- * Get a new envelope from the free list.
- */
-struct bpp_envelope *
-bpp_get_envelope(struct bpp_softc *sc)
-{
- struct bpp_envelope *env;
-
- env = sc->sc_env_free;
- if (env != NULL) {
- sc->sc_env_free = (struct bpp_envelope *)env->env_link;
- memset(env, 0, sizeof(*env));
- /* env->env_valid = ENVELOPE_INVALID; */
- }
-
- return env;
-}
-
-/*
- * Put an envelope into the free list.
- */
-void
-bpp_put_envelope(struct bpp_softc *sc, struct bpp_envelope *env)
-{
- env->env_link = (uint32_t)sc->sc_env_free;
- sc->sc_env_free = env;
-}
-
-/*
- * Send a command packet, replacing the NULL envelope with the given one,
- * and enqueue it to the command pipe.
- */
-void
-bpp_queue_envelope(struct bpp_softc *sc, struct bpp_chan *chan,
- struct bpp_envelope *tail, paddr_t cmdpa)
-{
- struct bpp_envelope *env;
- struct bpp_channel *channel;
- paddr_t tailpa;
-
- /* tail assumed to be unmodified since bpp_get_envelope(),
- no need to memset() */
- (*sc->bpp_env_sync)(sc, tail, BUS_DMASYNC_PREWRITE);
- tailpa = (*sc->bpp_env_pa)(sc, tail);
-
- /*
- * Update the existing NULL envelope with data.
- */
-
- env = chan->envcmd;
- env->env_link = htobe32(tailpa);
- env->env_pkt = htobe32(cmdpa);
- (*sc->bpp_env_sync)(sc, env, BUS_DMASYNC_PREWRITE); /* paranoia */
- env->env_valid = ENVELOPE_VALID;
- (*sc->bpp_env_sync)(sc, env, BUS_DMASYNC_PREWRITE);
-
- /*
- * Update the channel's command tail pointer to point to the
- * new envelope.
- */
-
- channel = chan->ch;
- channel->ch_cmd_tail = htobe32(tailpa);
- /* really necessary? */
- (*sc->bpp_chan_sync)(sc, channel, BUS_DMASYNC_PREWRITE);
-
- chan->envcmd = tail;
-
- bpp_attention(sc);
-}
-
-/*
- * Dequeue an envelope from the status pipe, and return the command it
- * was carrying. The envelope itself is returned to the free list.
- */
-int
-bpp_dequeue_envelope(struct bpp_softc *sc, struct bpp_chan *chan,
- paddr_t *cmdpa)
-{
- struct bpp_envelope *env;
- struct bpp_channel *channel;
- paddr_t headpa;
-
- /*
- * Look at the head envelope.
- */
-
- env = chan->envsts;
- (*sc->bpp_env_sync)(sc, env, BUS_DMASYNC_POSTREAD);
-
- if (env->env_valid == ENVELOPE_INVALID)
- return EAGAIN;
-
- /*
- * Dequeue the envelope, compute the new head envelope index, and
- * finally release the envelope.
- */
-
- headpa = betoh32(env->env_link);
- if (cmdpa != NULL)
- *cmdpa = betoh32(env->env_pkt);
- chan->envsts = (*sc->bpp_env_va)(sc, headpa);
-
- channel = chan->ch;
- channel->ch_status_head = htobe32(headpa);
- /* really necessary? */
- (*sc->bpp_chan_sync)(sc, channel, BUS_DMASYNC_PREWRITE);
-
- bpp_put_envelope(sc, env);
-
- return 0;
-}
diff --git a/sys/arch/mvme68k/dev/bppvar.h b/sys/arch/mvme68k/dev/bppvar.h
deleted file mode 100644
index b91cc1d15fa..00000000000
--- a/sys/arch/mvme68k/dev/bppvar.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/* $OpenBSD: bppvar.h,v 1.1 2009/02/17 22:28:40 miod Exp $ */
-
-/*
- * Copyright (c) 2008, 2009 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies. And
- * I won't mind if you keep the disclaimer below.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * Register and structure definitions for MVME boards using the Motorola
- * Buffered Pipe Protocol.
- */
-
-/*
- * Register layout (CSR space)
- */
-
-#define CSR_ADDR 0x00 /* 32 */
-#define CSR_ADDR_MOD 0x04 /* 8 */
-#define CSR_DATA_WIDTH 0x05 /* 8 */
-/* IPC control register */
-#define CSR_CONTROL 0x06 /* 16 */
-#define CSR_STATUS 0x08 /* 8 */
-#define CSR_DIAG 0x09 /* 8 */
-#define CSR_TAS 0x0e /* 16 */
-
-/* CSR bits */
-#define CSR_BUSY 0x8000 /* firmware busy */
-#define CSR_RESET 0x4000 /* reset board */
-#define CSR_ATTENTION 0x2000 /* interrupt firmware */
-#define CSR_INHIBIT_SYSFAIL 0x1000
-
-/* TAS bits */
-#define TAS_TAS 0x8000 /* test and set bit */
-#define TAS_VALID_COMMAND 0x4000
-#define TAS_VALID_STATUS 0x2000
-#define TAS_COMMAND_COMPLETE 0x1000
-#define TAS_COMMAND_MASK 0x0fff
-
-/* TAS commands */
-#define COMMAND_CHANNEL_CREATE 0x001
-#define COMMAND_CHANNEL_DELETE 0x002
-#define COMMAND_DUMP_MEMORY 0x101
-
-/* command status values */
-#define STATUS_OK 0x00
-#define STATUS_INVALID_COMMAND 0x01
-#define STATUS_READ_CHANNEL_HEADER 0x02
-#define STATUS_WRITE_CHANNEL_HEADER 0x03
-#define STATUS_DMA_READ 0x04
-#define STATUS_DMA_WRITE 0x05
-#define STATUS_NO_MORE_CHANNELS 0x06
-#define STATUS_NO_SUCH_CHANNEL 0x07
-/* catastrophic errors start here... */
-#define STATUS_LOCAL_ADDRESS_ERROR 0xaa
-#define STATUS_ACFAIL 0xac
-#define STATUS_LOCAL_BUS_ERROR 0xbb
-#define STATUS_CONFIDENCE_FAILED 0xcc
-#define STATUS_UNEXPECTED_ERROR 0xee
-#define STATUS_ERRNO 0x100 /* not from status reg */
-
-/*
- * BPP Channel header
- */
-
-struct bpp_channel {
- uint32_t ch_cmd_head; /* command pipe head */
- uint32_t ch_cmd_tail; /* command pipe tail */
- uint32_t ch_status_head; /* status pipe head */
- uint32_t ch_status_tail; /* status pipe tail */
- uint8_t ch_ipl; /* channel interrupt level */
- uint8_t ch_ivec; /* channel interrupt vector */
- uint8_t ch_priority; /* channel priority */
-#define BPP_PRIORITY_HIGHEST 0x00
-#define BPP_PRIORITY_LOWEST 0xff
- uint8_t ch_addrmod; /* envelope memory address modifier */
- uint8_t ch_num; /* set by firmware */
- uint8_t ch_valid; /* set by firmware */
- uint8_t ch_buswidth; /* unused */
- uint8_t reserved;
-};
-
-/*
- * BPP Envelope structure
- */
-
-struct bpp_envelope {
- uint32_t env_link; /* next envelope */
- uint32_t env_pkt; /* command packet physical address */
- uint8_t env_valid;
-#define ENVELOPE_INVALID 0x00
-#define ENVELOPE_VALID 0x01 /* any nonzero value will do */
- uint8_t reserved[3];
- /*
- * The following is not part of the envelope as defined by the
- * firmware, but is used to page the envelope to a 68040/88200
- * cache line boundary.
- */
- uint32_t pad;
- /* total size 0x10 bytes */
-};
-
-/*
- * Data bus width
- */
-
-#define MEMT_D16 1
-#define MEMT_D32 2
-
-/*
- * The following defines ought to be in a MI vme header file...
- */
-
-/*
- * VME addressing modes
- */
-
-#define ADRM_STD_S_P 0x3e /* standard supervisory program */
-#define ADRM_STD_S_D 0x3d /* standard supervisory data */
-#define ADRM_STD_N_P 0x3a /* standard normal program */
-#define ADRM_STD_N_D 0x39 /* standard normal data */
-#define ADRM_SHT_S_IO 0x2d /* short supervisory I/O */
-#define ADRM_SHT_N_IO 0x29 /* short normal I/O */
-#define ADRM_EXT_S_P 0x0e /* extended supervisory program */
-#define ADRM_EXT_S_D 0x0d /* extended supervisory data */
-#define ADRM_EXT_N_P 0x0a /* extended normal program */
-#define ADRM_EXT_N_D 0x09 /* extended normal data */
-#define ADRM_EXT_S_BM 0x0f /* extended supervisory block mode */
-#define ADRM_EXT_S_D64 0x0c /* extended supervisory D64 mode */
-
-/*
- * Per channel information
- */
-
-struct bpp_chan {
- struct bpp_channel *ch; /* bpp communication channel */
-
- struct bpp_envelope *envcmd; /* command tail envelope */
- struct bpp_envelope *envsts; /* status head envelope */
-};
-
-/*
- * Device superset
- */
-
-struct bpp_softc {
- struct device sc_dev;
-
- bus_space_tag_t sc_iot; /* CSR registers access */
- bus_space_handle_t sc_ioh;
-
- struct bpp_envelope *sc_env_free; /* head of free envelope list */
-
- /* channel function pointers */
- paddr_t (*bpp_chan_pa)(struct bpp_softc *, struct bpp_channel *);
- void (*bpp_chan_sync)(struct bpp_softc *, struct bpp_channel *, int);
-
- /* envelope function pointers */
- paddr_t (*bpp_env_pa)(struct bpp_softc *, struct bpp_envelope *);
- struct bpp_envelope *(*bpp_env_va)(struct bpp_softc *, paddr_t);
- void (*bpp_env_sync)(struct bpp_softc *, struct bpp_envelope *, int);
-};
-
-void bpp_attach(struct bpp_softc *, bus_space_tag_t, bus_space_handle_t);
-void bpp_attention(struct bpp_softc *);
-int bpp_create_channel(struct bpp_softc *, struct bpp_chan *,
- int, int, int);
-int bpp_dequeue_envelope(struct bpp_softc *, struct bpp_chan *, paddr_t *);
-struct bpp_envelope *
- bpp_get_envelope(struct bpp_softc *);
-void bpp_initialize_envelopes(struct bpp_softc *, struct bpp_envelope *,
- uint);
-void bpp_put_envelope(struct bpp_softc *, struct bpp_envelope *);
-void bpp_queue_envelope(struct bpp_softc *, struct bpp_chan *,
- struct bpp_envelope *, paddr_t);
-int bpp_reset(struct bpp_softc *);
diff --git a/sys/arch/mvme68k/dev/cl.c b/sys/arch/mvme68k/dev/cl.c
deleted file mode 100644
index a0d339306cd..00000000000
--- a/sys/arch/mvme68k/dev/cl.c
+++ /dev/null
@@ -1,2038 +0,0 @@
-/* $OpenBSD: cl.c,v 1.54 2013/10/07 17:53:57 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Dale Rahn. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* DMA mode still does not work!!! */
-
-#include <sys/param.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-#include <sys/uio.h>
-#include <sys/systm.h>
-#include <sys/time.h>
-#include <sys/device.h>
-#include <sys/syslog.h>
-
-#include <machine/autoconf.h>
-#include <machine/conf.h>
-#include <machine/cpu.h>
-
-#include <dev/cons.h>
-
-#include <mvme68k/dev/clreg.h>
-
-#include "cl.h"
-
-#ifdef DDB
-#include <ddb/db_var.h>
-#endif
-
-#include "pcctwo.h"
-
-#if NPCCTWO > 0
-#include <mvme68k/dev/pcctworeg.h>
-#endif
-
-#define splcl() spltty()
-#define USE_BUFFER
-
-/* min timeout 0xa, what is a good value */
-#define CL_TIMEOUT 0x10
-#define CL_FIFO_MAX 0x20
-#define CL_FIFO_CNT 0xc
-#define CL_RX_TIMEOUT 0x10
-
-#define CL_RXDMAINT 0x82
-#define CL_TXDMAINT 0x42
-#define CL_TXMASK 0x47
-#define CL_RXMASK 0x87
-#define CL_TXINTR 0x02
-#define CL_RXINTR 0x02
-
-struct cl_cons {
- paddr_t cl_paddr;
- struct clreg *cl_vaddr;
- volatile struct pcctworeg *pcctwoaddr;
- u_char channel;
-} cl_cons;
-
-struct cl_info {
- struct tty *tty;
- u_char cl_swflags;
- u_char cl_softchar;
- u_char cl_consio;
- u_char cl_speed;
- u_char cl_parstop; /* parity, stop bits. */
- u_char cl_rxmode;
- u_char cl_txmode;
- u_char cl_clen;
- u_char cl_parity;
- u_char transmitting;
- u_long txcnt;
- u_long rxcnt;
-
- void *rx[2];
- void *rxp[2];
- void *tx[2];
- void *txp[2];
-
- volatile u_char *pconsum;
- volatile u_char *psupply;
- volatile u_char *buffer;
- volatile int nchar;
-};
-#define CLCD_PORTS_PER_CHIP 4
-#define CL_BUFSIZE 256
-
-#ifndef DO_MALLOC
-/* four (4) buffers per port */
-char cl_dmabuf [CLCD_PORTS_PER_CHIP * CL_BUFSIZE * 4];
-#endif
-
-struct clsoftc {
- struct device sc_dev;
- time_t sc_rotime; /* time of last ring overrun */
- time_t sc_fotime; /* time of last fifo overrun */
- u_char *pbase;
- struct clreg *cl_reg;
- struct cl_info sc_cl[CLCD_PORTS_PER_CHIP];
- struct intrhand sc_ih_e;
- struct intrhand sc_ih_m;
- struct intrhand sc_ih_t;
- struct intrhand sc_ih_r;
- char sc_errintrname[16 + 4];
- char sc_mxintrname[16 + 3];
- char sc_rxintrname[16 + 3];
- char sc_txintrname[16 + 3];
- int sc_flags;
- void *sc_softih;
-};
-
-const struct {
- u_int speed;
- u_char divisor;
- u_char clock;
- u_char rx_timeout;
-} cl_clocks[] = {
- { 64000, 0x26, 0, 0x01},
- { 56000, 0x2c, 0, 0x01},
- { 38400, 0x40, 0, 0x01},
- { 19200, 0x81, 0, 0x02},
- { 9600, 0x40, 1, 0x04},
- { 7200, 0x56, 1, 0x04},
- { 4800, 0x81, 1, 0x08},
- { 3600, 0xad, 1, 0x08},
- { 2400, 0x40, 2, 0x10},
- { 1200, 0x81, 2, 0x20},
- { 600, 0x40, 3, 0x40},
- { 300, 0x81, 3, 0x80},
- { 150, 0x40, 3, 0x80},
- { 110, 0x58, 4, 0xff},
- { 50, 0xC2, 4, 0xff},
- { 0, 0x00, 0, 0},
-};
-
-/* prototypes */
-cons_decl(cl);
-u_char cl_clkdiv(int speed);
-u_char cl_clknum(int speed);
-u_char cl_clkrxtimeout(int speed);
-void clstart(struct tty *tp);
-void cl_unblock(struct tty *tp);
-int clccparam(struct clsoftc *sc, struct termios *par, int channel);
-
-int clparam(struct tty *tp, struct termios *t);
-int cl_mintr(void *);
-int cl_txintr(void *);
-int cl_rxintr(void *);
-void cl_overflow(struct clsoftc *sc, int channel, time_t *ptime, u_char *msg);
-void cl_parity(struct clsoftc *sc, int channel);
-void cl_frame(struct clsoftc *sc, int channel);
-void cl_break( struct clsoftc *sc, int channel);
-int clmctl(dev_t dev, int bits, int how);
-void cl_dumpport(int channel);
-
-int clprobe(struct device *parent, void *self, void *aux);
-void clattach(struct device *parent, struct device *self, void *aux);
-
-void cl_initchannel(struct clsoftc *sc, int channel);
-void clputc(struct clsoftc *sc, int unit, u_char c);
-u_char clgetc(struct clsoftc *sc, int *channel);
-void cloutput(struct tty *tp);
-void cl_softint(void *);
-void cl_appendbufn(struct clsoftc *sc, u_char channel, u_char *buf, u_short cnt);
-
-struct tty *cltty(dev_t);
-int cl_instat(struct clsoftc *);
-void clcnpollc(dev_t, int);
-void cl_break(struct clsoftc *, int);
-void cl_appendbuf(struct clsoftc *, u_char, u_char);
-
-struct cfattach cl_ca = {
- sizeof(struct clsoftc), clprobe, clattach
-};
-
-struct cfdriver cl_cd = {
- NULL, "cl", DV_TTY
-};
-
-#define CLCDBUF 80
-
-#define CL_UNIT(x) (minor(x) >> 2)
-#define CL_CHANNEL(x) (minor(x) & 3)
-#define CL_TTY(x) (minor(x))
-
-struct tty *
-cltty(dev)
- dev_t dev;
-{
- int unit, channel;
- struct clsoftc *sc;
- unit = CL_UNIT(dev);
- if (unit >= cl_cd.cd_ndevs ||
- (sc = (struct clsoftc *) cl_cd.cd_devs[unit]) == NULL) {
- return (NULL);
- }
- channel = CL_CHANNEL(dev);
- return sc->sc_cl[channel].tty;
-}
-
-int
-clprobe(parent, self, aux)
- struct device *parent;
- void *self;
- void *aux;
-{
- /* probing onboard 166/167/177/187 CL-cd2400
- * should be previously configured,
- * we can check the value before resetting the chip
- */
- struct clreg *cl_reg;
- struct confargs *ca = aux;
- int ret;
-
- switch (cputyp) {
- case CPU_166:
- case CPU_167:
- case CPU_176:
- case CPU_177:
- break;
- default:
- return 0;
- }
-
- cl_reg = (struct clreg *)ca->ca_vaddr;
-
-#if 0
- ret = !badvaddr(&cl_reg->cl_gfrcr,1);
-#else
- ret = 1;
-#endif
- return ret;
-}
-
-void
-clattach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- struct clsoftc *sc = (struct clsoftc *)self;
- struct confargs *ca = aux;
- int i;
-
- sc->cl_reg = (struct clreg *)ca->ca_vaddr;
-
- if (ca->ca_paddr == cl_cons.cl_paddr) {
- /* if this device is configured as console,
- * line cl_cons.channel is the console */
- sc->sc_cl[0].cl_consio = 1;
- printf(": console");
- } else {
- /* reset chip only if we are not console device */
- /* wait for GFRCR */
- }
- /* allow chip to settle before continuing */
- delay(800);
-
- /* set up global registers */
- sc->cl_reg->cl_tpr = CL_TIMEOUT;
- sc->cl_reg->cl_rpilr = 0x03;
- sc->cl_reg->cl_tpilr = 0x02;
- sc->cl_reg->cl_mpilr = 0x01;
-
-#ifdef DO_MALLOC
- sc->sc_cl[0].rx[0] = (void *)(dvma_malloc(16 * CL_BUFSIZE));
-#else
- sc->sc_cl[0].rx[0] = (void *) (&cl_dmabuf);
-#endif
- sc->sc_cl[0].rx[1] = (void *)(((int)sc->sc_cl[0].rx[0]) + CL_BUFSIZE);
- sc->sc_cl[1].rx[0] = (void *)(((int)sc->sc_cl[0].rx[1]) + CL_BUFSIZE);
- sc->sc_cl[1].rx[1] = (void *)(((int)sc->sc_cl[1].rx[0]) + CL_BUFSIZE);
-
- sc->sc_cl[2].rx[0] = (void *)(((int)sc->sc_cl[1].rx[1]) + CL_BUFSIZE);
- sc->sc_cl[2].rx[1] = (void *)(((int)sc->sc_cl[2].rx[0]) + CL_BUFSIZE);
- sc->sc_cl[3].rx[0] = (void *)(((int)sc->sc_cl[2].rx[1]) + CL_BUFSIZE);
- sc->sc_cl[3].rx[1] = (void *)(((int)sc->sc_cl[3].rx[0]) + CL_BUFSIZE);
-
- sc->sc_cl[0].tx[0] = (void *)(((int)sc->sc_cl[3].rx[1]) + CL_BUFSIZE);
- sc->sc_cl[0].tx[1] = (void *)(((int)sc->sc_cl[0].tx[0]) + CL_BUFSIZE);
- sc->sc_cl[1].tx[0] = (void *)(((int)sc->sc_cl[0].tx[1]) + CL_BUFSIZE);
- sc->sc_cl[1].tx[1] = (void *)(((int)sc->sc_cl[1].tx[0]) + CL_BUFSIZE);
-
- sc->sc_cl[2].tx[0] = (void *)(((int)sc->sc_cl[1].tx[1]) + CL_BUFSIZE);
- sc->sc_cl[2].tx[1] = (void *)(((int)sc->sc_cl[2].tx[0]) + CL_BUFSIZE);
- sc->sc_cl[3].tx[0] = (void *)(((int)sc->sc_cl[2].tx[1]) + CL_BUFSIZE);
- sc->sc_cl[3].tx[1] = (void *)(((int)sc->sc_cl[3].tx[0]) + CL_BUFSIZE);
-#ifdef USE_BUFFER
- /* receive buffer and dma buffer are "shared" */
- for (i = 0; i < CLCD_PORTS_PER_CHIP; i++) {
- sc->sc_cl[i].buffer = sc->sc_cl[i].rx[0];
- sc->sc_cl[i].pconsum = sc->sc_cl[i].buffer;
- sc->sc_cl[i].psupply = sc->sc_cl[i].buffer;
- sc->sc_cl[i].nchar = 0;
- }
- sc->sc_softih = softintr_establish(IPL_SOFTTTY, cl_softint, sc);
-#endif
- for (i = 0; i < CLCD_PORTS_PER_CHIP; i++) {
-#if 0
- int j;
-
- for (j = 0; j < 2 ; j++) {
- sc->sc_cl[i].rxp[j] = (void *)kvtop(sc->sc_cl[i].rx[j]);
- printf("cl[%d].rxbuf[%d] %x p %x\n",
- i, j, sc->sc_cl[i].rx[j], sc->sc_cl[i].rxp[j]);
- sc->sc_cl[i].txp[j] = (void *)kvtop(sc->sc_cl[i].tx[j]);
- printf("cl[%d].txbuf[%d] %x p %x\n",
- i, j, sc->sc_cl[i].tx[j], sc->sc_cl[i].txp[j]);
- }
-#endif
-
-#if 0
- sc->sc_cl[i].cl_rxmode =
- !(!((flags >> (i * CL_FLAG_BIT_PCH)) & 0x01));
- sc->sc_cl[i].cl_txmode =
- !(!((flags >> (i * CL_FLAG_BIT_PCH)) & 0x02));
- sc->sc_cl[i].cl_softchar =
- !(!((flags >> (i * CL_FLAG_BIT_PCH)) & 0x04));
-#endif
- cl_initchannel(sc, i);
- }
-
- /* enable interrupts */
- sc->sc_ih_e.ih_fn = cl_rxintr;
- sc->sc_ih_e.ih_arg = sc;
- sc->sc_ih_e.ih_ipl = ca->ca_ipl;
- sc->sc_ih_e.ih_wantframe = 0;
-
- sc->sc_ih_m.ih_fn = cl_mintr;
- sc->sc_ih_m.ih_arg = sc;
- sc->sc_ih_m.ih_ipl = ca->ca_ipl;
- sc->sc_ih_m.ih_wantframe = 0;
-
- sc->sc_ih_t.ih_fn = cl_txintr;
- sc->sc_ih_t.ih_arg = sc;
- sc->sc_ih_t.ih_ipl = ca->ca_ipl;
- sc->sc_ih_t.ih_wantframe = 0;
-
- sc->sc_ih_r.ih_fn = cl_rxintr;
- sc->sc_ih_r.ih_arg = sc;
- sc->sc_ih_r.ih_ipl = ca->ca_ipl;
- sc->sc_ih_r.ih_wantframe = 0;
-
- snprintf(sc->sc_errintrname, sizeof sc->sc_errintrname,
- "%s_err", self->dv_xname);
- snprintf(sc->sc_mxintrname, sizeof sc->sc_mxintrname,
- "%s_mx", self->dv_xname);
- snprintf(sc->sc_rxintrname, sizeof sc->sc_rxintrname,
- "%s_rx", self->dv_xname);
- snprintf(sc->sc_txintrname, sizeof sc->sc_txintrname,
- "%s_tx", self->dv_xname);
-
- pcctwointr_establish(PCC2V_SCC_RXE,&sc->sc_ih_e, sc->sc_errintrname);
- pcctwointr_establish(PCC2V_SCC_M,&sc->sc_ih_m, sc->sc_mxintrname);
- pcctwointr_establish(PCC2V_SCC_TX,&sc->sc_ih_t, sc->sc_txintrname);
- pcctwointr_establish(PCC2V_SCC_RX,&sc->sc_ih_r, sc->sc_rxintrname);
- sys_pcc2->pcc2_sccerr = 0x01; /* clear errors */
-
- /* enable all interrupts at ca_ipl */
- sys_pcc2->pcc2_sccirq = PCC2_IRQ_IEN | (ca->ca_ipl & 0x7);
- sys_pcc2->pcc2_scctx = PCC2_IRQ_IEN | (ca->ca_ipl & 0x7);
- sys_pcc2->pcc2_sccrx = PCC2_IRQ_IEN | (ca->ca_ipl & 0x7);
-
- printf("\n");
-}
-
-void
-cl_initchannel(sc, channel)
- struct clsoftc *sc;
- int channel;
-{
- int s;
- struct clreg *cl_reg = sc->cl_reg;
-
- /* set up option registers */
- sc->sc_cl[channel].tty = NULL;
- s = splhigh();
-
- cl_reg->cl_car = (u_char) channel;
- cl_reg->cl_livr = PCC2_VECBASE + 0xc;/* set vector base at 5C */
- cl_reg->cl_ier = 0x00;
-
- if (sc->sc_cl[channel].cl_consio == 0) {
- cl_reg->cl_cmr = 0x02;
- cl_reg->cl_cor1 = 0x17;
- cl_reg->cl_cor2 = 0x00;
- cl_reg->cl_cor3 = 0x02;
- cl_reg->cl_cor4 = 0xec;
- cl_reg->cl_cor5 = 0xec;
- cl_reg->cl_cor6 = 0x00;
- cl_reg->cl_cor7 = 0x00;
- cl_reg->cl_schr1 = 0x00;
- cl_reg->cl_schr2 = 0x00;
- cl_reg->cl_schr3 = 0x00;
- cl_reg->cl_schr4 = 0x00;
- cl_reg->cl_scrl = 0x00;
- cl_reg->cl_scrh = 0x00;
- cl_reg->cl_lnxt = 0x00;
- cl_reg->cl_rbpr = 0x40; /* 9600 */
- cl_reg->cl_rcor = 0x01;
- cl_reg->cl_tbpr = 0x40; /* 9600 */
- cl_reg->cl_tcor = 0x01 << 5;
- /* console port should be 0x88 already */
- cl_reg->cl_msvr_rts = 0x00;
- cl_reg->cl_msvr_dtr = 0x00;
- cl_reg->cl_rtprl = CL_RX_TIMEOUT;
- cl_reg->cl_rtprh = 0x00;
-
- sc->cl_reg->cl_ccr = 0x20;
- while (sc->cl_reg->cl_ccr != 0)
- ;
- }
-
- splx(s);
-}
-
-
-int cldefaultrate = TTYDEF_SPEED;
-
-int clmctl (dev, bits, how)
- dev_t dev;
- int bits;
- int how;
-{
- int s;
- struct clsoftc *sc;
- /* should only be called with valid device */
- sc = (struct clsoftc *) cl_cd.cd_devs[CL_UNIT(dev)];
- /*
- printf("mctl: dev %x, bits %x, how %x,\n",dev, bits, how);
- */
- /* settings are currently ignored */
- s = splcl();
- switch (how) {
- case DMSET:
- if( bits & TIOCM_RTS) {
- sc->cl_reg->cl_msvr_rts = 0x01;
- } else {
- sc->cl_reg->cl_msvr_rts = 0x00;
- }
- if( bits & TIOCM_DTR) {
- sc->cl_reg->cl_msvr_dtr = 0x02;
- } else {
- sc->cl_reg->cl_msvr_dtr = 0x00;
- }
- break;
-
- case DMBIC:
- if( bits & TIOCM_RTS) {
- sc->cl_reg->cl_msvr_rts = 0x00;
- }
- if( bits & TIOCM_DTR) {
- sc->cl_reg->cl_msvr_dtr = 0x00;
- }
- break;
-
- case DMBIS:
- if( bits & TIOCM_RTS) {
- sc->cl_reg->cl_msvr_rts = 0x01;
- }
- if( bits & TIOCM_DTR) {
- sc->cl_reg->cl_msvr_dtr = 0x02;
- }
- break;
-
- case DMGET:
- bits = 0;
-
- {
- u_char msvr;
- msvr = sc->cl_reg->cl_msvr_rts;
- if( msvr & 0x80) {
- bits |= TIOCM_DSR;
- }
- if( msvr & 0x40) {
- bits |= TIOCM_CD;
- }
- if( msvr & 0x20) {
- bits |= TIOCM_CTS;
- }
- if( msvr & 0x10) {
- bits |= TIOCM_DTR;
- }
- if( msvr & 0x02) {
- bits |= TIOCM_DTR;
- }
- if( msvr & 0x01) {
- bits |= TIOCM_RTS;
- }
-
- }
- break;
- }
- splx(s);
-#if 0
- bits = 0;
- /* proper defaults? */
- bits |= TIOCM_DTR;
- bits |= TIOCM_RTS;
- bits |= TIOCM_CTS;
- bits |= TIOCM_CD;
- /* bits |= TIOCM_RI; */
- bits |= TIOCM_DSR;
-#endif
-
- /*
- printf("retbits %x\n", bits);
- */
- return(bits);
-}
-
-int
-clopen(dev, flag, mode, p)
- dev_t dev;
- int flag;
- int mode;
- struct proc *p;
-{
- int s, unit, channel;
- struct cl_info *cl;
- struct clsoftc *sc;
- struct tty *tp;
-
- unit = CL_UNIT(dev);
- if (unit >= cl_cd.cd_ndevs ||
- (sc = (struct clsoftc *) cl_cd.cd_devs[unit]) == NULL) {
- return (ENODEV);
- }
- channel = CL_CHANNEL(dev);
- cl = &sc->sc_cl[channel];
- s = splcl();
- if (cl->tty) {
- tp = cl->tty;
- } else {
- tp = cl->tty = ttymalloc(0);
- }
- tp->t_oproc = clstart;
- tp->t_param = clparam;
- tp->t_dev = dev;
-
- if ((tp->t_state & TS_ISOPEN) == 0) {
- tp->t_state |= TS_WOPEN;
- ttychars(tp);
- if (tp->t_ispeed == 0) {
- /*
- * only when cleared do we reset to defaults.
- */
- tp->t_iflag = TTYDEF_IFLAG;
- tp->t_oflag = TTYDEF_OFLAG;
- tp->t_lflag = TTYDEF_LFLAG;
- tp->t_ispeed = tp->t_ospeed = cldefaultrate;
-
- if(sc->sc_cl[channel].cl_consio != 0) {
- /* console is 8N1 */
- tp->t_cflag = (CREAD | CS8 | HUPCL);
- } else {
- tp->t_cflag = TTYDEF_CFLAG;
- }
- }
- /*
- * do these all the time
- */
- if (cl->cl_swflags & TIOCFLAG_CLOCAL)
- tp->t_cflag |= CLOCAL;
- if (cl->cl_swflags & TIOCFLAG_CRTSCTS)
- tp->t_cflag |= CRTSCTS;
- if (cl->cl_swflags & TIOCFLAG_MDMBUF)
- tp->t_cflag |= MDMBUF;
- clparam(tp, &tp->t_termios);
- ttsetwater(tp);
-
- (void)clmctl(dev, TIOCM_DTR | TIOCM_RTS, DMSET);
-#ifdef XXX
- if ((cl->cl_swflags & TIOCFLAG_SOFTCAR) ||
- (clmctl(dev, 0, DMGET) & TIOCM_CD)) {
- tp->t_state |= TS_CARR_ON;
- } else {
- tp->t_state &= ~TS_CARR_ON;
- }
-#endif
- tp->t_state |= TS_CARR_ON;
- {
- u_char save = sc->cl_reg->cl_car;
- sc->cl_reg->cl_car = channel;
- sc->cl_reg->cl_ier = 0x88;
-#ifdef CL_DMA_WORKS
- {
- sc->cl_reg->cl_cmr =
- /* CL_TXDMAINT | */ CL_RXDMAINT;
- sc->cl_reg->cl_ier = 0xa8;
- sc->cl_reg->cl_licr = 0x00;
- }
- sc->cl_reg->cl_arbadrl =
- ((u_long)sc->sc_cl[channel].rxp[0]) & 0xffff;
- sc->cl_reg->cl_arbadru =
- ((u_long)sc->sc_cl[channel].rxp[0]) >> 16;
- sc->cl_reg->cl_brbadrl =
- ((u_long)sc->sc_cl[channel].rxp[1]) & 0xffff;
- sc->cl_reg->cl_brbadru =
- ((u_long)sc->sc_cl[channel].rxp[1]) >> 16;
- sc->cl_reg->cl_atbadrl =
- ((u_long)sc->sc_cl[channel].txp[0]) & 0xffff;
- sc->cl_reg->cl_atbadru =
- ((u_long)sc->sc_cl[channel].txp[0]) >> 16;
- sc->cl_reg->cl_btbadrl =
- ((u_long)sc->sc_cl[channel].txp[1]) & 0xffff;
- sc->cl_reg->cl_btbadru =
- ((u_long)sc->sc_cl[channel].txp[1]) >> 16;
- sc->cl_reg->cl_arbcnt = CL_BUFSIZE;
- sc->cl_reg->cl_brbcnt = CL_BUFSIZE;
- sc->cl_reg->cl_arbsts = 0x01;
- sc->cl_reg->cl_brbsts = 0x01;
-if (channel == 2) { /* test one channel now */
- /* shift for tx DMA */
- /* no shift for rx DMA */
-#if 0
- /* tx only */
- sc->cl_reg->cl_licr = (CL_DMAMODE << 4);
- sc->cl_reg->cl_cmr = 0x42;
-#endif
- /* rx only */
- sc->cl_reg->cl_licr = 0x00;
- sc->cl_reg->cl_cmr = 0x82;
-}
- sc->cl_reg->cl_ccr = 0x20;
- while (sc->cl_reg->cl_ccr != 0) {
- }
-#endif /* CL_DMA_WORKS */
- sc->cl_reg->cl_car = save;
- }
- } else if (tp->t_state & TS_XCLUDE && suser(p, 0) != 0) {
- splx(s);
- return(EBUSY);
- }
-#ifdef XXX
- /*
- * if NONBLOCK requested, ignore carrier
- */
- if (flag & O_NONBLOCK)
- goto done;
-#endif
-
- splx(s);
- /*
- * Reset the tty pointer, as there could have been a dialout
- * use of the tty with a dialin open waiting.
- */
- tp->t_dev = dev;
-#ifdef DEBUG
- cl_dumpport(channel);
-#endif
- return((*linesw[tp->t_line].l_open)(dev, tp, p));
-}
-int clparam(tp, t)
- struct tty *tp;
- struct termios *t;
-{
- int unit, channel;
- struct clsoftc *sc;
- int s;
- dev_t dev;
-
- dev = tp->t_dev;
- unit = CL_UNIT(dev);
- if (unit >= cl_cd.cd_ndevs ||
- (sc = (struct clsoftc *) cl_cd.cd_devs[unit]) == NULL) {
- return (ENODEV);
- }
- channel = CL_CHANNEL(dev);
- tp->t_ispeed = t->c_ispeed;
- tp->t_ospeed = t->c_ospeed;
- tp->t_cflag = t->c_cflag;
- clccparam(sc, t, channel);
- s = splcl();
- cl_unblock(tp);
- splx(s);
- return 0;
-}
-
-#if 0
-void cloutput(tp)
- struct tty *tp;
-{
- int cc, s, unit, cnt;
- u_char *tptr;
- int channel;
- struct clsoftc *sc;
- dev_t dev;
- u_char cl_obuffer[CLCDBUF+1];
-
- dev = tp->t_dev;
- unit = CL_UNIT(dev);
- if (unit >= cl_cd.cd_ndevs ||
- (sc = (struct clsoftc *) cl_cd.cd_devs[unit]) == NULL) {
- return;
- }
- channel = CL_CHANNEL(dev);
-
- if ((tp->t_state & TS_ISOPEN) == 0)
- return;
-
- s = splcl();
- cc = tp->t_outq.c_cc;
- while (cc > 0) {
-/*XXX*/
- cnt = min (CLCDBUF,cc);
- cnt = q_to_b(&tp->t_outq, cl_obuffer, cnt);
- if (cnt == 0) {
- break;
- }
- for (tptr = cl_obuffer; tptr < &cl_obuffer[cnt]; tptr++) {
- clputc(sc, channel, *tptr);
- }
- cc -= cnt;
- }
- splx(s);
-}
-#endif
-
-int
-clclose(dev, flag, mode, p)
- dev_t dev;
- int flag;
- int mode;
- struct proc *p;
-{
- int unit, channel;
- struct tty *tp;
- struct cl_info *cl;
- struct clsoftc *sc;
- int s;
- unit = CL_UNIT(dev);
- if (unit >= cl_cd.cd_ndevs ||
- (sc = (struct clsoftc *) cl_cd.cd_devs[unit]) == NULL) {
- return (ENODEV);
- }
- channel = CL_CHANNEL(dev);
- cl = &sc->sc_cl[channel];
- tp = cl->tty;
- (*linesw[tp->t_line].l_close)(tp, flag, p);
-
- s = splcl();
-
- sc->cl_reg->cl_car = channel;
- if(cl->cl_consio == 0 && (tp->t_cflag & HUPCL) != 0) {
- sc->cl_reg->cl_msvr_rts = 0x00;
- sc->cl_reg->cl_msvr_dtr = 0x00;
- sc->cl_reg->cl_ccr = 0x05;
- }
-
- splx(s);
- ttyclose(tp);
-
-#if 0
- cl->tty = NULL;
-#endif
-#ifdef DEBUG
- cl_dumpport(channel);
-#endif
-
- return 0;
-}
-
-int
-clread (dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- int unit, channel;
- struct tty *tp;
- struct cl_info *cl;
- struct clsoftc *sc;
- unit = CL_UNIT(dev);
- if (unit >= cl_cd.cd_ndevs ||
- (sc = (struct clsoftc *) cl_cd.cd_devs[unit]) == NULL) {
- return (ENODEV);
- }
- channel = CL_CHANNEL(dev);
- cl = &sc->sc_cl[channel];
- tp = cl->tty;
- if (!tp)
- return ENXIO;
- return((*linesw[tp->t_line].l_read)(tp, uio, flag));
-}
-
-int
-clwrite (dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- int unit, channel;
- struct tty *tp;
- struct cl_info *cl;
- struct clsoftc *sc;
- unit = CL_UNIT(dev);
- if (unit >= cl_cd.cd_ndevs ||
- (sc = (struct clsoftc *) cl_cd.cd_devs[unit]) == NULL) {
- return (ENODEV);
- }
- channel = CL_CHANNEL(dev);
- cl = &sc->sc_cl[channel];
- tp = cl->tty;
- if (!tp)
- return ENXIO;
- return((*linesw[tp->t_line].l_write)(tp, uio, flag));
-}
-
-int
-clioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- int error;
- int unit, channel;
- struct tty *tp;
- struct cl_info *cl;
- struct clsoftc *sc;
- unit = CL_UNIT(dev);
- if (unit >= cl_cd.cd_ndevs ||
- (sc = (struct clsoftc *) cl_cd.cd_devs[unit]) == NULL) {
- return (ENODEV);
- }
- channel = CL_CHANNEL(dev);
- cl = &sc->sc_cl[channel];
- tp = cl->tty;
- if (!tp)
- return ENXIO;
-
- error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
- if (error >= 0)
- return(error);
-
- error = ttioctl(tp, cmd, data, flag, p);
- if (error >= 0)
- return(error);
-
- switch (cmd) {
- case TIOCSBRK:
- /* */
- break;
-
- case TIOCCBRK:
- /* */
- break;
-
- case TIOCSDTR:
- (void) clmctl(dev, TIOCM_DTR | TIOCM_RTS, DMBIS);
- break;
-
- case TIOCCDTR:
- (void) clmctl(dev, TIOCM_DTR | TIOCM_RTS, DMBIC);
- break;
-
- case TIOCMSET:
- (void) clmctl(dev, *(int *) data, DMSET);
- break;
-
- case TIOCMBIS:
- (void) clmctl(dev, *(int *) data, DMBIS);
- break;
-
- case TIOCMBIC:
- (void) clmctl(dev, *(int *) data, DMBIC);
- break;
-
- case TIOCMGET:
- *(int *)data = clmctl(dev, 0, DMGET);
- break;
- case TIOCGFLAGS:
- *(int *)data = cl->cl_swflags;
- break;
- case TIOCSFLAGS:
- error = suser(p, 0);
- if (error != 0)
- return(EPERM);
-
- cl->cl_swflags = *(int *)data;
- cl->cl_swflags &= /* only allow valid flags */
- (TIOCFLAG_SOFTCAR | TIOCFLAG_CLOCAL | TIOCFLAG_CRTSCTS);
- break;
- default:
- return(ENOTTY);
- }
-
- return 0;
-}
-int
-clstop(tp, flag)
- struct tty *tp;
- int flag;
-{
- int s;
-
- s = splcl();
- if (tp->t_state & TS_BUSY) {
- if ((tp->t_state & TS_TTSTOP) == 0)
- tp->t_state |= TS_FLUSH;
- }
- splx(s);
- return 0;
-}
-
-void
-clcnprobe(cp)
- struct consdev *cp;
-{
- int maj;
-
- switch (cputyp) {
- case CPU_166:
- case CPU_167:
- case CPU_176:
- case CPU_177:
- break;
- default:
- return;
- }
-
- /* locate the major number */
- for (maj = 0; maj < nchrdev; maj++)
- if (cdevsw[maj].d_open == clopen)
- break;
- cp->cn_dev = makedev (maj, 0);
- cp->cn_pri = CN_LOWPRI;
-}
-
-void
-clcninit(cp)
- struct consdev *cp;
-{
- struct clreg *cl_reg;
-
- cl_cons.cl_paddr = 0xfff45000;
- cl_cons.cl_vaddr = (struct clreg *)IIOV(cl_cons.cl_paddr);
- cl_cons.pcctwoaddr = (void *)IIOV(0xfff42000);
- cl_reg = cl_cons.cl_vaddr;
-
- /* reset the chip? */
-#ifdef CLCD_DO_RESET
-#endif
-
-#if 1
- /* set up globals */
- cl_reg->cl_tftc = 0x10;
- cl_reg->cl_tpr = CL_TIMEOUT; /* is this correct?? */
- cl_reg->cl_rpilr = 0x03;
- cl_reg->cl_tpilr = 0x02;
- cl_reg->cl_mpilr = 0x01;
-
- /* set up the tty00 to be 9600 8N1 */
- cl_reg->cl_car = 0x00;
- cl_reg->cl_cor1 = 0x17; /* No parity, ignore parity, 8 bit char */
- cl_reg->cl_cor2 = 0x00;
- cl_reg->cl_cor3 = 0x02; /* 1 stop bit */
- cl_reg->cl_cor4 = 0x00;
- cl_reg->cl_cor5 = 0x00;
- cl_reg->cl_cor6 = 0x00;
- cl_reg->cl_cor7 = 0x00;
- cl_reg->cl_schr1 = 0x00;
- cl_reg->cl_schr2 = 0x00;
- cl_reg->cl_schr3 = 0x00;
- cl_reg->cl_schr4 = 0x00;
- cl_reg->cl_scrl = 0x00;
- cl_reg->cl_scrh = 0x00;
- cl_reg->cl_lnxt = 0x00;
- cl_reg->cl_cpsr = 0x00;
-#endif
-}
-
-int
-cl_instat(sc)
- struct clsoftc *sc;
-{
- struct clreg *cl_reg;
- if ( NULL == sc) {
- cl_reg = cl_cons.cl_vaddr;
- } else {
- cl_reg = sc->cl_reg;
- }
- return (cl_reg->cl_rir & 0x40);
-}
-int
-clcngetc(dev)
- dev_t dev;
-{
- u_char val, reoir, licr, isrl, data, fifo_cnt;
-#if 0
- u_char status;
-#endif
- int got_char = 0;
- u_char ier_old = 0xff;
- struct clreg *cl_reg = cl_cons.cl_vaddr;
- volatile struct pcctworeg *pcc2_base = cl_cons.pcctwoaddr;
-
- cl_reg->cl_car = 0;
- if (!(cl_reg->cl_ier & 0x08)) {
- ier_old = cl_reg->cl_ier;
- cl_reg->cl_ier = 0x08;
- }
- while (got_char == 0) {
- val = cl_reg->cl_rir;
- /* if no receive interrupt pending wait */
- if (!(val & 0x80)) {
- continue;
- }
- /* XXX do we need to suck the entire FIFO contents? */
- reoir = pcc2_base->pcc2_sccrxiack; /* receive PIACK */
- licr = cl_reg->cl_licr;
- if (((licr >> 2) & 0x3) == 0) {
- /* is the interrupt for us (port 0) */
- /* the character is for us yea. */
- isrl = cl_reg->cl_risrl;
-#if 0
- if (isrl & 0x01) {
- status = BREAK;
- }
- if (isrl & 0x02) {
- status = FRAME;
- }
- if (isrl & 0x04) {
- status = PARITY;
- }
- if (isrl & 0x08) {
- status = OVERFLOW;
- }
- /* we do not have special characters ;-) */
-#endif
- fifo_cnt = cl_reg->cl_rfoc;
- data = cl_reg->cl_rdr;
- if (ier_old != 0xff) {
- cl_reg->cl_ier = ier_old;
- }
- got_char = 1;
- cl_reg->cl_teoir = 0x00;
- } else {
- data = cl_reg->cl_rdr;
- cl_reg->cl_teoir = 0x00;
- }
-
- }
-
- return data;
-}
-
-void
-clcnputc(dev, c)
- dev_t dev;
- u_char c;
-{
- clputc(0, 0, c);
-}
-
-void
-clcnpollc(dev, on)
- dev_t dev;
- int on;
-{
- if (1 == on) {
- /* enable polling */
- } else {
- /* disable polling */
- }
- return;
-}
-
-void
-clputc(sc, unit, c)
- struct clsoftc *sc;
- int unit;
- u_char c;
-{
- int s;
- u_char schar;
- u_char oldchannel;
- struct clreg *cl_reg;
- if (0 == sc) {
- /* output on console */
- cl_reg = cl_cons.cl_vaddr;
- } else {
- cl_reg = sc->cl_reg;
- }
-#ifdef NEW_CLCD_STRUCT
- /* should we disable, flush and all that goo? */
- cl->car = unit;
- schar = cl->schr3;
- cl->schr3 = c;
- cl->stcr = 0x08 | 0x03; /* send special char, char 3 */
- while (0 != cl->stcr) {
- /* wait until cl notices the command
- * otherwise it may not notice the character
- * if we send characters too fast.
- */
- }
- cl->schr3 = schar;
-#else
-if (unit == 0) {
- s = splhigh();
- oldchannel = cl_reg->cl_car;
- cl_reg->cl_car = unit;
- schar = cl_reg->cl_schr3;
- cl_reg->cl_schr3 = c;
- cl_reg->cl_stcr = 0x08 | 0x03; /* send special char, char 3 */
- while (0 != cl_reg->cl_stcr) {
- /* wait until cl notices the command
- * otherwise it may not notice the character
- * if we send characters too fast.
- */
- }
- DELAY(5);
- cl_reg->cl_schr3 = schar;
- cl_reg->cl_car = oldchannel;
- splx(s);
-} else {
- s = splhigh();
- oldchannel = cl_reg->cl_car;
- cl_reg->cl_car = unit;
- if (cl_reg->cl_tftc > 0) {
- cl_reg->cl_tdr = c;
- }
- cl_reg->cl_car = oldchannel;
- splx(s);
-}
-#endif
- return;
-}
-
-u_char
-clgetc(sc, channel)
- struct clsoftc *sc;
- int *channel;
-{
- struct clreg *cl_reg;
- volatile struct pcctworeg *pcc2_base;
- u_char val, reoir, licr, isrl, fifo_cnt, data;
- if (sc == NULL) {
- cl_reg = cl_cons.cl_vaddr;
- pcc2_base = cl_cons.pcctwoaddr;
- } else {
- cl_reg = sc->cl_reg;
- pcc2_base = sys_pcc2;
- }
- val = cl_reg->cl_rir;
- /* if no receive interrupt pending wait */
- if (!(val & 0x80)) {
- return 0;
- }
- /* XXX do we need to suck the entire FIFO contents? */
- reoir = pcc2_base->pcc2_sccrxiack; /* receive PIACK */
- licr = cl_reg->cl_licr;
- *channel = (licr >> 2) & 0x3;
- /* is the interrupt for us (port 0) */
- /* the character is for us yea. */
- isrl = cl_reg->cl_risrl;
-#if 0
- if (isrl & 0x01) {
- status = BREAK;
- }
- if (isrl & 0x02) {
- status = FRAME;
- }
- if (isrl & 0x04) {
- status = PARITY;
- }
- if (isrl & 0x08) {
- status = OVERFLOW;
- }
- /* we do not have special characters ;-) */
-#endif
- fifo_cnt = cl_reg->cl_rfoc;
- if (fifo_cnt > 0) {
- data = cl_reg->cl_rdr;
- cl_reg->cl_teoir = 0x00;
- } else {
- data = 0;
- cl_reg->cl_teoir = 0x08;
- }
- return data;
-}
-int
-clccparam(sc, par, channel)
- struct clsoftc *sc;
- struct termios *par;
- int channel;
-{
- u_int divisor, clk, clen;
- int s, imask, ints;
-
- s = splcl();
- sc->cl_reg->cl_car = channel;
- if (par->c_ospeed == 0) {
- /* dont kill the console */
- if(sc->sc_cl[channel].cl_consio == 0) {
- /* disconnect, drop RTS DTR stop receiver */
- sc->cl_reg->cl_msvr_rts = 0x00;
- sc->cl_reg->cl_msvr_dtr = 0x00;
- sc->cl_reg->cl_ccr = 0x05;
- }
- splx(s);
- return (0xff);
- }
-
- sc->cl_reg->cl_msvr_rts = 0x03;
- sc->cl_reg->cl_msvr_dtr = 0x03;
-
- divisor = cl_clkdiv(par->c_ospeed);
- clk = cl_clknum(par->c_ospeed);
- sc->cl_reg->cl_tbpr = divisor;
- sc->cl_reg->cl_tcor = clk << 5;
- divisor = cl_clkdiv(par->c_ispeed);
- clk = cl_clknum(par->c_ispeed);
- sc->cl_reg->cl_rbpr = divisor;
- sc->cl_reg->cl_rcor = clk;
- sc->cl_reg->cl_rtprl = cl_clkrxtimeout(par->c_ispeed);
- sc->cl_reg->cl_rtprh = 0x00;
-
- switch (par->c_cflag & CSIZE) {
- case CS5:
- clen = 4; /* this is the mask for the chip. */
- imask = 0x1F;
- break;
- case CS6:
- clen = 5;
- imask = 0x3F;
- break;
- case CS7:
- clen = 6;
- imask = 0x7F;
- break;
- default:
- clen = 7;
- imask = 0xFF;
- }
- sc->cl_reg->cl_cor3 = par->c_cflag & PARENB ? 4 : 2;
-
- {
- u_char cor1;
- if (par->c_cflag & PARENB) {
- if (par->c_cflag & PARODD) {
- cor1 = 0xE0 | clen ; /* odd */
- } else {
- cor1 = 0x40 | clen ; /* even */
- }
- } else {
- cor1 = 0x10 | clen; /* ignore parity */
- }
- if (sc->cl_reg->cl_cor1 != cor1) {
- sc->cl_reg->cl_cor1 = cor1;
- sc->cl_reg->cl_ccr = 0x20;
- while (sc->cl_reg->cl_ccr != 0) {
- }
- }
- }
-
- if (sc->sc_cl[channel].cl_consio == 0 && (par->c_cflag & CREAD) == 0)
- sc->cl_reg->cl_ccr = 0x08;
- else
- sc->cl_reg->cl_ccr = 0x0a;
- while (sc->cl_reg->cl_ccr != 0) {
- }
- ints = 0;
-#define SCC_DSR 0x80
-#define SCC_DCD 0x40
-#define SCC_CTS 0x20
- if ((par->c_cflag & CLOCAL) == 0) {
- ints |= SCC_DCD;
- }
- if ((par->c_cflag & CCTS_OFLOW) != 0) {
- ints |= SCC_CTS;
- }
- if ((par->c_cflag & CRTSCTS) != 0) {
- ints |= SCC_CTS;
- }
-#ifdef DONT_LET_HARDWARE
- if ((par->c_cflag & CCTS_IFLOW) != 0) {
- ints |= SCC_DSR;
- }
-#endif
- sc->cl_reg->cl_cor4 = ints | CL_FIFO_CNT;
- sc->cl_reg->cl_cor5 = ints | CL_FIFO_CNT;
-
- return imask;
-}
-static int clknum = 0;
-u_char
-cl_clkdiv(speed)
- int speed;
-{
- int i = 0;
- if (cl_clocks[clknum].speed == speed) {
- return cl_clocks[clknum].divisor;
- }
- for (i = 0; cl_clocks[i].speed != 0; i++) {
- if (cl_clocks[i].speed == speed) {
- clknum = i;
- return cl_clocks[clknum].divisor;
- }
- }
- /* return some sane value if unknown speed */
- return cl_clocks[4].divisor;
-}
-u_char
-cl_clknum(speed)
- int speed;
-{
- int found = 0;
- int i = 0;
- if (cl_clocks[clknum].speed == speed) {
- return cl_clocks[clknum].clock;
- }
- for (i = 0; found != 0 && cl_clocks[i].speed != 0; i++) {
- if (cl_clocks[clknum].speed == speed) {
- clknum = i;
- return cl_clocks[clknum].clock;
- }
- }
- /* return some sane value if unknown speed */
- return cl_clocks[4].clock;
-}
-u_char
-cl_clkrxtimeout(speed)
- int speed;
-{
- int i = 0;
- if (cl_clocks[clknum].speed == speed) {
- return cl_clocks[clknum].rx_timeout;
- }
- for (i = 0; cl_clocks[i].speed != 0; i++) {
- if (cl_clocks[i].speed == speed) {
- clknum = i;
- return cl_clocks[clknum].rx_timeout;
- }
- }
- /* return some sane value if unknown speed */
- return cl_clocks[4].rx_timeout;
-}
-void
-cl_unblock(tp)
- struct tty *tp;
-{
- tp->t_state &= ~TS_FLUSH;
- if (tp->t_outq.c_cc != 0)
- clstart(tp);
-}
-void
-clstart(tp)
- struct tty *tp;
-{
- dev_t dev;
-#if 0
- u_char cbuf;
- int cnt;
-#endif
- struct clsoftc *sc;
- int channel, unit, s;
-
- dev = tp->t_dev;
- channel = CL_CHANNEL(dev);
-/* hack to test output on non console only */
-#if 0
- if (channel == 0) {
- cloutput(tp);
- return;
- }
-#endif
- unit = CL_UNIT(dev);
- if (unit >= cl_cd.cd_ndevs ||
- (sc = (struct clsoftc *) cl_cd.cd_devs[unit]) == NULL) {
- return;
- }
-
- if ((tp->t_state & TS_ISOPEN) == 0)
- return;
-
- s = splcl();
-#if 0
- if (sc->sc_cl[channel].transmitting == 1) {
- /* i'm busy, go away, I will get to it later. */
- splx(s);
- return;
- }
- cnt = q_to_b(&tp->t_outq, &cbuf, 1);
- if ( cnt != 0 ) {
- sc->sc_cl[channel].transmitting = 1;
- sc->cl_reg->cl_car = channel;
- sc->cl_reg->cl_tdr = cbuf;
- } else {
- sc->sc_cl[channel].transmitting = 0;
- }
-#else
- if ((tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP | TS_FLUSH)) == 0)
- {
- tp->t_state |= TS_BUSY;
- sc->cl_reg->cl_car = channel;
- sc->cl_reg->cl_ier = sc->cl_reg->cl_ier | 0x3;
- }
-#endif
- splx(s);
- return;
-}
-int
-cl_mintr(arg)
- void *arg;
-{
- struct clsoftc *sc = (struct clsoftc *)arg;
- u_char mir, misr, msvr;
- int channel;
- if(((mir = sc->cl_reg->cl_mir) & 0x40) == 0x0) {
- /* only if intr is not shared? */
- log(LOG_WARNING, "cl_mintr extra intr\n");
- return 0;
- }
-
- channel = mir & 0x03;
- misr = sc->cl_reg->cl_misr;
- msvr = sc->cl_reg->cl_msvr_rts;
- if (misr & 0x01) {
- /* timers are not currently used?? */
- log(LOG_WARNING, "cl_mintr: channel %x timer 1 unexpected\n",channel);
- }
- if (misr & 0x02) {
- /* timers are not currently used?? */
- log(LOG_WARNING, "cl_mintr: channel %x timer 2 unexpected\n",channel);
- }
- if (misr & 0x20) {
- struct tty *tp = sc->sc_cl[channel].tty;
-#ifdef VERBOSE_LOG_MESSAGES
- log(LOG_WARNING, "cl_mintr: channel %x cts %x\n",channel,
- ((msvr & 0x20) != 0x0)
- );
-#endif
- if (msvr & 0x20) {
- cl_unblock(tp);
- }
- }
- if (misr & 0x40) {
- struct tty *tp = sc->sc_cl[channel].tty;
-#ifdef VERBOSE_LOG_MESSAGES
- log(LOG_WARNING, "cl_mintr: channel %x cd %x\n",channel,
- ((msvr & 0x40) != 0x0)
- );
-#endif
- (*linesw[tp->t_line].l_modem)(tp, ((msvr & 0x40) != 0x0) );
- }
- if (misr & 0x80) {
-#ifdef VERBOSE_LOG_MESSAGES
- log(LOG_WARNING, "cl_mintr: channel %x dsr %x\n",channel,
- ((msvr & 0x80) != 0x0)
- );
-#endif
- }
- sc->cl_reg->cl_meoir = 0x00;
- return 1;
-}
-
-int
-cl_txintr(arg)
- void *arg;
-{
- struct clsoftc *sc = (struct clsoftc *)arg;
- static int empty = 0;
- u_char tir, cmr, teoir;
- u_char max;
- int channel;
- struct tty *tp;
- int cnt;
- u_char buffer[CL_FIFO_MAX +1];
- u_char *tptr;
- if(((tir = sc->cl_reg->cl_tir) & 0x40) == 0x0) {
- /* only if intr is not shared ??? */
- log(LOG_WARNING, "cl_txintr extra intr\n");
- return 0;
- }
-
- channel = tir & 0x03;
- cmr = sc->cl_reg->cl_cmr;
-
- sc->sc_cl[channel].txcnt ++;
-
- tp = sc->sc_cl[channel].tty;
- if (tp == NULL || (tp->t_state & TS_ISOPEN) == 0) {
- sc->cl_reg->cl_ier = sc->cl_reg->cl_ier & ~0x3;
- sc->cl_reg->cl_teoir = 0x08;
- return 1;
- }
- switch (cmr & CL_TXMASK) {
- case CL_TXDMAINT:
- {
- u_char dmabsts;
- int nbuf, busy, resid;
- void *pbuffer;
- dmabsts = sc->cl_reg->cl_dmabsts;
- log(LOG_WARNING, "cl_txintr: DMAMODE channel %x dmabsts %x\n",
- channel, dmabsts);
- nbuf = ((dmabsts & 0x8) >> 3) & 0x1;
- busy = ((dmabsts & 0x4) >> 2) & 0x1;
-
- do {
- pbuffer = sc->sc_cl[channel].tx[nbuf];
- resid = tp->t_outq.c_cc;
- cnt = min (CL_BUFSIZE,resid);
- log(LOG_WARNING, "cl_txintr: resid %x cnt %x pbuf %p\n",
- resid, cnt, pbuffer);
- if (cnt != 0) {
- cnt = q_to_b(&tp->t_outq, pbuffer, cnt);
- resid -= cnt;
- if (nbuf == 0) {
- sc->cl_reg->cl_atbadru =
- ((u_long) sc->sc_cl[channel].txp[nbuf]) >> 16;
- sc->cl_reg->cl_atbadrl =
- ((u_long) sc->sc_cl[channel].txp[nbuf]) & 0xffff;
- sc->cl_reg->cl_atbcnt = cnt;
- sc->cl_reg->cl_atbsts = 0x43;
- } else {
- sc->cl_reg->cl_btbadru =
- ((u_long) sc->sc_cl[channel].txp[nbuf]) >> 16;
- sc->cl_reg->cl_btbadrl =
- ((u_long) sc->sc_cl[channel].txp[nbuf]) & 0xffff;
- sc->cl_reg->cl_btbcnt = cnt;
- sc->cl_reg->cl_btbsts = 0x43;
- }
- teoir = 0x08;
- } else {
- teoir = 0x08;
- if (tp->t_state & TS_BUSY) {
- tp->t_state &= ~(TS_BUSY | TS_FLUSH);
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t) &tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- }
- sc->cl_reg->cl_ier = sc->cl_reg->cl_ier & ~0x3;
- }
- nbuf = ~nbuf & 0x1;
- busy--;
- } while (resid != 0 && busy != -1);/* if not busy do other buffer */
- log(LOG_WARNING, "cl_txintr: done\n");
- }
- break;
- case CL_TXINTR:
- max = sc->cl_reg->cl_tftc;
- cnt = min ((int)max,tp->t_outq.c_cc);
- if (cnt != 0) {
- cnt = q_to_b(&tp->t_outq, buffer, cnt);
- empty = 0;
- for (tptr = buffer; tptr < &buffer[cnt]; tptr++) {
- sc->cl_reg->cl_tdr = *tptr;
- }
- teoir = 0x00;
- } else {
- if (empty > 5 && ((empty % 20000 )== 0)) {
- log(LOG_WARNING, "cl_txintr to many empty intr %d channel %d\n",
- empty, channel);
- }
- empty++;
- teoir = 0x08;
- if (tp->t_state & TS_BUSY) {
- tp->t_state &= ~(TS_BUSY | TS_FLUSH);
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t) &tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- }
- sc->cl_reg->cl_ier = sc->cl_reg->cl_ier & ~0x3;
- }
- break;
- default:
- log(LOG_WARNING, "cl_txintr unknown mode %x\n", cmr);
- /* we probably will go to hell quickly now */
- teoir = 0x08;
- }
- sc->cl_reg->cl_teoir = teoir;
- return 1;
-}
-
-int
-cl_rxintr(arg)
- void *arg;
-{
- struct clsoftc *sc = (struct clsoftc *)arg;
- u_char rir, channel, cmr, risrl;
- u_char fifocnt;
- struct tty *tp;
- int i;
- u_char reoir;
- u_char buffer[CL_FIFO_MAX +1];
-#ifdef DDB
- int wantddb = 0;
-#endif
-
- rir = sc->cl_reg->cl_rir;
- if((rir & 0x40) == 0x0) {
- /* only if intr is not shared ??? */
- log(LOG_WARNING, "cl_rxintr extra intr\n");
- return 0;
- }
-
- channel = rir & 0x3;
- cmr = sc->cl_reg->cl_cmr;
- reoir = 0x08;
-
- sc->sc_cl[channel].rxcnt ++;
- risrl = sc->cl_reg->cl_risrl;
- if (risrl & 0x80) {
- /* timeout, no characters */
- reoir = 0x08;
- } else
- /* We don't need no sinkin special characters */
- if (risrl & 0x08) {
- cl_overflow (sc, channel, &sc->sc_fotime, "fifo");
- reoir = 0x08;
- } else
- if (risrl & 0x04) {
- cl_parity(sc, channel);
- reoir = 0x08;
- } else
- if (risrl & 0x02) {
- cl_frame(sc, channel);
- reoir = 0x08;
- } else
- if (risrl & 0x01) {
-#ifdef DDB
- if (sc->sc_cl[channel].cl_consio)
- wantddb = db_console;
-#endif
- cl_break(sc, channel);
- reoir = 0x08;
- }
-
- switch (cmr & CL_RXMASK) {
- case CL_RXDMAINT:
- {
- int nbuf;
- u_short cnt;
- int bufcomplete;
- u_char status, dmabsts;
- u_char risrh = sc->cl_reg->cl_risrh;
- dmabsts = sc->cl_reg->cl_dmabsts;
-#ifdef DMA_DEBUG
-log(LOG_WARNING, "cl_txintr: DMAMODE channel %x dmabsts %x risrl %x risrh %x\n",
- channel, dmabsts, risrl, risrh);
-#endif
- nbuf = (risrh & 0x08) ? 1 : 0;
- bufcomplete = (risrh & 0x20) ? 1 : 0;
- if (nbuf == 0) {
- cnt = sc->cl_reg->cl_arbcnt;
- status = sc->cl_reg->cl_arbsts;
- } else {
- cnt = sc->cl_reg->cl_brbcnt;
- status = sc->cl_reg->cl_brbsts;
- }
-#ifdef DMA_DEBUG
-log(LOG_WARNING, "cl_rxintr: 1channel %x buf %x cnt %x status %x\n",
-channel, nbuf, cnt, status);
-#endif
-#ifdef USE_BUFFER
- cl_appendbufn(sc, channel,
- sc->sc_cl[channel].rx[nbuf], cnt);
-#else
- {
- int i;
- u_char *pbuf;
- tp = sc->sc_cl[channel].tty;
- pbuf = sc->sc_cl[channel].rx[nbuf];
- /* this should be done at off level */
-{
- u_short rcbadru, rcbadrl;
- u_char arbsts, brbsts;
- u_char *pbufs, *pbufe;
- rcbadru = sc->cl_reg->cl_rcbadru;
- rcbadrl = sc->cl_reg->cl_rcbadrl;
- arbsts = sc->cl_reg->cl_arbsts;
- brbsts = sc->cl_reg->cl_brbsts;
- pbufs = sc->sc_cl[channel].rxp[nbuf];
- pbufe = (u_char *)(((u_long)rcbadru << 16) | (u_long)rcbadrl);
- cnt = pbufe - pbufs;
-#ifdef DMA_DEBUG
- log(LOG_WARNING, "cl_rxintr: rcbadru %x rcbadrl %x arbsts %x brbsts %x cnt %x\n",
- rcbadru, rcbadrl, arbsts, brbsts, cnt);
-#endif
-#ifdef DMA_DEBUG1
- log(LOG_WARNING, "cl_rxintr: buf %x cnt %x\n",
- nbuf, cnt);
-#endif
-}
- reoir = 0x0 | (bufcomplete) ? 0 : 0xd0;
- sc->cl_reg->cl_reoir = reoir;
-#ifdef DMA_DEBUG
-log(LOG_WARNING, "cl_rxintr: reoir %x\n", reoir);
-#endif
- delay(10); /* give the chip a moment */
-#ifdef DMA_DEBUG
-log(LOG_WARNING, "cl_rxintr: 2channel %x buf %x cnt %x status %x\n",
-channel, nbuf, cnt, status);
-#endif
- for (i = 0; i < cnt; i++) {
- u_char c;
- c = pbuf[i];
- (*linesw[tp->t_line].l_rint)(c,tp);
- }
- /* this should be done at off level */
- if (nbuf == 0) {
- sc->cl_reg->cl_arbcnt = CL_BUFSIZE;
- sc->cl_reg->cl_arbsts = 0x01;
- } else {
- sc->cl_reg->cl_brbcnt = CL_BUFSIZE;
- sc->cl_reg->cl_brbsts = 0x01;
- }
- }
-#endif
- }
- sc->cl_reg->cl_reoir = reoir;
- break;
- case CL_RXINTR:
- fifocnt = sc->cl_reg->cl_rfoc;
- tp = sc->sc_cl[channel].tty;
- for (i = 0; i < fifocnt; i++) {
- buffer[i] = sc->cl_reg->cl_rdr;
- }
- if (NULL == tp) {
- /* if the channel is not configured,
- * dont send characters upstream.
- * also fix problem with NULL dereference
- */
- reoir = 0x00;
- break;
- }
-
- sc->cl_reg->cl_reoir = reoir;
-#ifdef USE_BUFFER
- cl_appendbufn(sc, channel, buffer, fifocnt);
-#else
- for (i = 0; i < fifocnt; i++) {
- u_char c;
- c = buffer[i];
- /* does any restricitions exist on spl
- * for this call
- */
- (*linesw[tp->t_line].l_rint)(c,tp);
- reoir = 0x00;
- }
-#endif
- break;
- default:
- log(LOG_WARNING, "cl_rxintr unknown mode %x\n", cmr);
- /* we probably will go to hell quickly now */
- reoir = 0x08;
- sc->cl_reg->cl_reoir = reoir;
- }
-#ifdef DDB
- if (wantddb != 0)
- Debugger();
-#endif
- return 1;
-}
-
-void
-cl_overflow (sc, channel, ptime, msg)
-struct clsoftc *sc;
-int channel;
-time_t *ptime;
-u_char *msg;
-{
-/*
- if (*ptime != time_second) {
-*/
- {
-/*
- *ptime = time_second;
-*/
- log(LOG_WARNING, "%s%d[%d]: %s overrun\n", cl_cd.cd_name,
- 0 /* fix */, channel, msg);
- }
- return;
-}
-void
-cl_parity (sc, channel)
- struct clsoftc *sc;
- int channel;
-{
-#ifdef VERBOSE_LOG_MESSAGES
- log(LOG_WARNING, "%s%d[%d]: parity error\n", cl_cd.cd_name, 0, channel);
-#endif
- return;
-}
-void
-cl_frame (sc, channel)
- struct clsoftc *sc;
- int channel;
-{
-#ifdef VERBOSE_LOG_MESSAGES
- log(LOG_WARNING, "%s%d[%d]: frame error\n", cl_cd.cd_name, 0, channel);
-#endif
- return;
-}
-void
-cl_break (sc, channel)
- struct clsoftc *sc;
- int channel;
-{
-#ifdef VERBOSE_LOG_MESSAGES
- log(LOG_WARNING, "%s%d[%d]: break detected\n", cl_cd.cd_name, 0, channel);
-#endif
- return;
-}
-
-void
-cl_dumpport(channel)
- int channel;
-{
- u_char livr, cmr, cor1, cor2, cor3, cor4, cor5, cor6, cor7,
- schr1, schr2, schr3, schr4, scrl, scrh, lnxt,
- rbpr, rcor, tbpr, tcor, rpilr, rir, tpr, ier, ccr,
- dmabsts, arbsts, brbsts, atbsts, btbsts,
- csr, rts, dtr, rtprl, rtprh;
- volatile void * parbadru, *parbadrl, *parbsts, *parbcnt;
- u_short rcbadru, rcbadrl, arbadru, arbadrl, arbcnt,
- brbadru, brbadrl, brbcnt;
- u_short tcbadru, tcbadrl, atbadru, atbadrl, atbcnt,
- btbadru, btbadrl, btbcnt;
- struct clsoftc *sc;
-
- struct clreg *cl_reg;
- int s;
-
- cl_reg = cl_cons.cl_vaddr;
-
- sc = (struct clsoftc *) cl_cd.cd_devs[0];
-
- s = splcl();
- cl_reg->cl_car = (u_char) channel;
- livr = cl_reg->cl_livr;
- cmr = cl_reg->cl_cmr;
- cor1 = cl_reg->cl_cor1;
- cor2 = cl_reg->cl_cor2;
- cor3 = cl_reg->cl_cor3;
- cor4 = cl_reg->cl_cor4;
- cor5 = cl_reg->cl_cor5;
- cor6 = cl_reg->cl_cor6;
- cor7 = cl_reg->cl_cor7;
- schr1 = cl_reg->cl_schr1;
- schr2 = cl_reg->cl_schr2;
- schr3 = cl_reg->cl_schr3;
- schr4 = cl_reg->cl_schr4;
- scrl = cl_reg->cl_scrl;
- scrh = cl_reg->cl_scrh;
- lnxt = cl_reg->cl_lnxt;
- rbpr = cl_reg->cl_rbpr;
- rcor = cl_reg->cl_rcor;
- tbpr = cl_reg->cl_tbpr;
- rpilr = cl_reg->cl_rpilr;
- rir = cl_reg->cl_rir;
- ier = cl_reg->cl_ier;
- ccr = cl_reg->cl_ccr;
- tcor = cl_reg->cl_tcor;
- csr = cl_reg->cl_csr;
- tpr = cl_reg->cl_tpr;
- rts = cl_reg->cl_msvr_rts;
- dtr = cl_reg->cl_msvr_dtr;
- rtprl = cl_reg->cl_rtprl;
- rtprh = cl_reg->cl_rtprh;
- dmabsts = cl_reg->cl_dmabsts;
- tcbadru = cl_reg->cl_tcbadru;
- tcbadrl = cl_reg->cl_tcbadrl;
- rcbadru = cl_reg->cl_rcbadru;
- rcbadrl = cl_reg->cl_rcbadrl;
-
- parbadru = &(cl_reg->cl_arbadru);
- parbadrl = &(cl_reg->cl_arbadrl);
- parbcnt = &(cl_reg->cl_arbcnt);
- parbsts = &(cl_reg->cl_arbsts);
-
- arbadru = cl_reg->cl_arbadru;
- arbadrl = cl_reg->cl_arbadrl;
- arbcnt = cl_reg->cl_arbcnt;
- arbsts = cl_reg->cl_arbsts;
-
- brbadru = cl_reg->cl_brbadru;
- brbadrl = cl_reg->cl_brbadrl;
- brbcnt = cl_reg->cl_brbcnt;
- brbsts = cl_reg->cl_brbsts;
-
- atbadru = cl_reg->cl_atbadru;
- atbadrl = cl_reg->cl_atbadrl;
- atbcnt = cl_reg->cl_atbcnt;
- atbsts = cl_reg->cl_atbsts;
-
- btbadru = cl_reg->cl_btbadru;
- btbadrl = cl_reg->cl_btbadrl;
- btbcnt = cl_reg->cl_btbcnt;
- btbsts = cl_reg->cl_btbsts;
-
- splx(s);
-
- printf("{ port %x livr %x cmr %x\n",
- channel,livr, cmr);
- printf("cor1 %x cor2 %x cor3 %x cor4 %x cor5 %x cor6 %x cor7 %x\n",
- cor1, cor2, cor3, cor4, cor5, cor6, cor7);
- printf("schr1 %x schr2 %x schr3 %x schr4 %x\n",
- schr1, schr2, schr3, schr4);
- printf("scrl %x scrh %x lnxt %x\n",
- scrl, scrh, lnxt);
- printf("rbpr %x rcor %x tbpr %x tcor %x\n",
- rbpr, rcor, tbpr, tcor);
- printf("rpilr %x rir %x ier %x ccr %x\n",
- rpilr, rir, ier, ccr);
- printf("tpr %x csr %x rts %x dtr %x\n",
- tpr, csr, rts, dtr);
- printf("rtprl %x rtprh %x\n",
- rtprl, rtprh);
- printf("rxcnt %lx txcnt %lx\n",
- sc->sc_cl[channel].rxcnt, sc->sc_cl[channel].txcnt);
- printf("dmabsts %x, tcbadru %x, tcbadrl %x, rcbadru %x, rcbadrl %x,\n",
- dmabsts, tcbadru, tcbadrl, rcbadru, rcbadrl );
- printf("parbadru %p, parbadrl %p, parbcnt %p, parbsts %p\n",
- parbadru, parbadrl, parbcnt, parbsts);
- printf("arbadru %x, arbadrl %x, arbcnt %x, arbsts %x\n",
- arbadru, arbadrl, arbcnt, arbsts);
- printf("brbadru %x, brbadrl %x, brbcnt %x, brbsts %x\n",
- brbadru, brbadrl, brbcnt, brbsts);
- printf("atbadru %x, atbadrl %x, atbcnt %x, atbsts %x\n",
- atbadru, atbadrl, atbcnt, atbsts);
- printf("btbadru %x, btbadrl %x, btbcnt %x, btbsts %x\n",
- btbadru, btbadrl, btbcnt, btbsts);
- printf("}\n");
- return;
-}
-#ifdef USE_BUFFER
-void
-cl_appendbuf(sc, channel, c)
- struct clsoftc *sc;
- u_char channel;
- u_char c;
-{
- /* int s; */
- /* s = splcl(); */
- if (1 + sc->sc_cl[channel].nchar >= CL_BUFSIZE ) {
- cl_overflow (sc, channel, &sc->sc_fotime, "rbuf");
- /* just toss the character */
- return;
- }
- *(sc->sc_cl[channel].psupply++) = c;
- if (&(sc->sc_cl[channel].buffer[CL_BUFSIZE])
- == sc->sc_cl[channel].psupply) {
- sc->sc_cl[channel].psupply = sc->sc_cl[channel].buffer;
- }
- sc->sc_cl[channel].nchar ++;
- softintr_schedule(sc->sc_softih);
- /* splx (s); */
-
-}
-void
-cl_appendbufn(sc, channel, buf, cnt)
- struct clsoftc *sc;
- u_char channel;
- u_char *buf;
- u_short cnt;
-{
- /* int s; */
- int i;
- /* s = splcl(); */ /* should be called at splcl(). */
- if (cnt + sc->sc_cl[channel].nchar >= CL_BUFSIZE ) {
- cl_overflow (sc, channel, &sc->sc_fotime, "rbuf");
- /* just toss the character(s)
- * It could be argued that not all of the charactes
- * should be tossed, just the ones that actually
- * overflow the buffer. eh, O well.
- */
- return;
- }
- for (i = 0; i < cnt; i++) {
- *(sc->sc_cl[channel].psupply++) = buf[i];
- if (&(sc->sc_cl[channel].buffer[CL_BUFSIZE]) == sc->sc_cl[channel].psupply)
- {
- sc->sc_cl[channel].psupply = sc->sc_cl[channel].buffer;
- }
- sc->sc_cl[channel].nchar ++;
- }
- softintr_schedule(sc->sc_softih);
- /* splx (s); */
-}
-
-void
-cl_softint(arg)
- void *arg;
-{
- struct clsoftc *sc = (struct clsoftc *)arg;
- int i;
- int s;
- u_char c;
- struct tty *tp;
-
- for (i = 0 ; i < CLCD_PORTS_PER_CHIP; i ++) {
-/* printf("channel %x sc %x\n", i, sc); */
- tp = sc->sc_cl[i].tty;
-/* printf("channel %x pconsum %x\n", i, sc->sc_cl[i].pconsum); */
- while (sc->sc_cl[i].nchar > 0) {
- s = splcl();
- c = *(sc->sc_cl[i].pconsum++);
- if (&(sc->sc_cl[i].buffer[CL_BUFSIZE]) == sc->sc_cl[i].pconsum)
- {
- sc->sc_cl[i].pconsum = sc->sc_cl[i].buffer;
- }
- sc->sc_cl[i].nchar--;
- splx(s);
- (*linesw[tp->t_line].l_rint)(c,tp);
- }
- }
-}
-#endif
diff --git a/sys/arch/mvme68k/dev/clock.c b/sys/arch/mvme68k/dev/clock.c
deleted file mode 100644
index 2540be51ae6..00000000000
--- a/sys/arch/mvme68k/dev/clock.c
+++ /dev/null
@@ -1,762 +0,0 @@
-/* $OpenBSD: clock.c,v 1.17 2012/11/04 13:33:32 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)clock.c 8.1 (Berkeley) 6/11/93
- */
-
-#include <sys/param.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-#include <sys/timetc.h>
-
-#include <machine/psl.h>
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-
-#include "lrc.h"
-#include "mc.h"
-#include "ofobio.h"
-#include "pcc.h"
-#include "pcctwo.h"
-
-#if NLRC > 0
-#include <mvme68k/dev/lrcreg.h>
-#endif
-#if NMC > 0
-#include <mvme68k/dev/mcreg.h>
-#endif
-#if NOFOBIO > 0
-#include <mvme68k/dev/ofobioreg.h>
-#endif
-#if NPCC > 0
-#include <mvme68k/dev/pccreg.h>
-#endif
-#if NPCCTWO > 0
-#include <mvme68k/dev/pcctworeg.h>
-#include <mvme68k/dev/vme.h>
-extern struct vme2reg *sys_vme2;
-#endif
-
-/*
- * Statistics clock interval and variance, in usec. Variance must be a
- * power of two. Since this gives us an even number, not an odd number,
- * we discard one case and compensate. That is, a variance of 8192 would
- * give us offsets in [0..8191]. Instead, we take offsets in [1..8191].
- * This is symmetric about the point 2048, or statvar/2, and thus averages
- * to that value (assuming uniform random numbers).
- */
-int statvar = 8192;
-int statmin; /* statclock interval - 1/2*variance */
-
-struct clocksoftc {
- struct device sc_dev;
- struct intrhand sc_profih;
- struct intrhand sc_statih;
-};
-
-void clockattach(struct device *, struct device *, void *);
-int clockmatch(struct device *, void *, void *);
-
-struct cfattach clock_ca = {
- sizeof(struct clocksoftc), clockmatch, clockattach
-};
-
-struct cfdriver clock_cd = {
- NULL, "clock", DV_DULL
-};
-
-int clockintr(void *);
-int statintr(void *);
-
-int clockbus;
-u_char stat_reset, prof_reset;
-
-/*
- * Every machine must have a clock tick device of some sort; for this
- * platform this file manages it, no matter what form it takes.
- */
-int
-clockmatch(parent, vcf, args)
- struct device *parent;
- void *vcf, *args;
-{
- return (1);
-}
-
-void
-clockattach(parent, self, args)
- struct device *parent, *self;
- void *args;
-{
- struct confargs *ca = args;
- struct clocksoftc *sc = (struct clocksoftc *)self;
-
- sc->sc_profih.ih_fn = clockintr;
- sc->sc_profih.ih_arg = 0;
- sc->sc_profih.ih_wantframe = 1;
- sc->sc_profih.ih_ipl = ca->ca_ipl;
-
- sc->sc_statih.ih_fn = statintr;
- sc->sc_statih.ih_arg = 0;
- sc->sc_statih.ih_wantframe = 1;
- sc->sc_statih.ih_ipl = ca->ca_ipl;
-
- clockbus = ca->ca_bustype;
- switch (ca->ca_bustype) {
-#if NLRC > 0
- case BUS_LRC:
- /*
- * XXX once we have dynamic ipl levels, put clock at ipl 6,
- * move it to timer1, then use timer2/ipl5 for statclock.
- * But then time counters will need to be implemented
- * differently.
- */
- lrcintr_establish(LRCVEC_TIMER2, &sc->sc_profih, "clock");
- break;
-#endif
-#if NMC > 0
- case BUS_MC:
- prof_reset = ca->ca_ipl | MC_IRQ_IEN | MC_IRQ_ICLR;
- stat_reset = ca->ca_ipl | MC_IRQ_IEN | MC_IRQ_ICLR;
- mcintr_establish(MCV_TIMER1, &sc->sc_profih, "clock");
- mcintr_establish(MCV_TIMER2, &sc->sc_statih, "stat");
- break;
-#endif
-#if NOFOBIO > 0
- case BUS_OFOBIO:
- {
- extern struct timecounter ofobio_timecounter; /* below */
-
- ofobio_timecounter.tc_priv = sc;
- intr_establish(OFOBIOVEC_CLOCK, &sc->sc_profih, "clock");
- }
- break;
-#endif
-#if NPCC > 0
- case BUS_PCC:
- prof_reset = ca->ca_ipl | PCC_IRQ_IEN | PCC_TIMERACK;
- stat_reset = ca->ca_ipl | PCC_IRQ_IEN | PCC_TIMERACK;
- pccintr_establish(PCCV_TIMER1, &sc->sc_profih, "clock");
- pccintr_establish(PCCV_TIMER2, &sc->sc_statih, "stat");
- break;
-#endif
-#if NPCCTWO > 0
- case BUS_PCCTWO:
- prof_reset = ca->ca_ipl | PCC2_IRQ_IEN | PCC2_IRQ_ICLR;
- stat_reset = ca->ca_ipl | PCC2_IRQ_IEN | PCC2_IRQ_ICLR;
- pcctwointr_establish(PCC2V_TIMER1, &sc->sc_profih, "clock");
- pcctwointr_establish(PCC2V_TIMER2, &sc->sc_statih, "stat");
- break;
-#endif
- }
-
- printf("\n");
-}
-
-#if NLRC > 0
-u_int lrc_get_timecount(struct timecounter *);
-struct timecounter lrc_timecounter = {
- .tc_get_timecount = lrc_get_timecount,
- .tc_counter_mask = 0x00ffffff, /* 24-bit timer */
- .tc_frequency = 1000000, /* 1MHz */
- .tc_name = "lrc",
- .tc_quality = 100
-};
-
-u_int
-lrc_get_timecount(struct timecounter *tc)
-{
- /*
- * Because LRC timers start counting at one, we need to count
- * wraparounds, and subtract the number of wraparounds, since
- * we go from FFFFFF to 000001.
- */
- static u_int lrc_wraparounds = 0;
- static uint32_t lrc_last = 0;
- uint32_t lrc_cur;
-
- lrc_cur = sys_lrc->lrc_t1cnt & 0x00ffffff;
- if (lrc_cur < lrc_last)
- lrc_wraparounds++;
- lrc_last = lrc_cur;
-
- return lrc_cur - lrc_wraparounds;
-}
-#endif
-
-#if NMC > 0
-u_int mc_get_timecount(struct timecounter *);
-struct timecounter mc_timecounter = {
- .tc_get_timecount = mc_get_timecount,
- .tc_counter_mask = 0xffffffff, /* 32-bit timer */
- .tc_frequency = 1000000, /* 1MHz */
- .tc_name = "mc",
- .tc_quality = 100
-};
-
-u_int
-mc_get_timecount(struct timecounter *tc)
-{
- /*
- * Note that, theoretically, we ought to check for counter overflows.
- * However, this timer is free-running with a rollover period of 71.6
- * minutes - if two time counter readings are separated by more than
- * this amount, there are more important issues to take care of first.
- */
- return sys_mc->mc_t3count;
-}
-#endif
-
-#if NOFOBIO > 0
-u_int ofobio_get_timecount(struct timecounter *);
-struct timecounter ofobio_timecounter = {
- .tc_get_timecount = ofobio_get_timecount,
- .tc_counter_mask = 0xffffffff,
- /* .tc_frequency will be filled in */
- .tc_name = "ofobio",
- .tc_quality = 0
-};
-
-u_int
-ofobio_get_timecount(struct timecounter *tc)
-{
- struct clocksoftc *sc = tc->tc_priv;
-
- /*
- * XXX It should be possible to get a better resolution by
- * XXX peeking at the DART internal state, but the way this
- * XXX clock is wired is horrible enough as is.
- */
- return sc->sc_profih.ih_count.ec_count;
-}
-#endif
-
-#if NPCC > 0
-u_int pcc_get_timecount(struct timecounter *);
-uint32_t pcc_curcnt;
-struct timecounter pcc_timecounter = {
- .tc_get_timecount = pcc_get_timecount,
- .tc_counter_mask = 0xffffffff, /* 32-bit timer */
- .tc_frequency = PCC_TIMERFREQ,
- .tc_name = "pcc",
- .tc_quality = 100
-};
-
-u_int
-pcc_get_timecount(struct timecounter *tc)
-{
- uint16_t tcr1, tcr2, pload;
- uint8_t tctl;
- u_int cnt;
- int s;
-
- pload = sys_pcc->pcc_t1pload;
- s = splclock();
- tcr1 = sys_pcc->pcc_t1count;
- tctl = sys_pcc->pcc_t1ctl;
- /*
- * Since we can not freeze the counter while reading the count
- * and overflow registers, read them a second time; if the counter
- * has wrapped, pick the second reading.
- */
- tcr2 = sys_pcc->pcc_t1count;
- if (tcr2 < tcr1) {
- tcr1 = tcr2;
- tctl = sys_pcc->pcc_t1ctl;
- }
- cnt = pcc_curcnt;
- splx(s);
- tctl >>= PCC_TIMER_OVF_SHIFT;
- while (tctl-- != 0)
- cnt += 0x10000U - pload;
- cnt += tcr1 - pload;
-
- return cnt;
-}
-#endif
-
-#if NPCCTWO > 0
-u_int pcctwo_get_timecount(struct timecounter *);
-uint32_t pcctwo_curcnt;
-struct timecounter pcctwo_timecounter = {
- .tc_get_timecount = pcctwo_get_timecount,
- .tc_counter_mask = 0xffffffff, /* 32-bit timer */
- .tc_frequency = 1000000, /* 1MHz */
- .tc_name = "pcctwo",
- .tc_quality = 100
-};
-
-u_int
-pcctwo_get_timecount(struct timecounter *tc)
-{
- uint32_t tcr1, tcr2;
- uint8_t tctl;
- u_int cnt, cmp;
- int s;
-
- cmp = sys_pcc2->pcc2_t1cmp;
- s = splclock();
- tcr1 = sys_pcc2->pcc2_t1count;
- tctl = sys_pcc2->pcc2_t1ctl;
- /*
- * Since we can not freeze the counter while reading the count
- * and overflow registers, read them a second time; if the counter
- * has wrapped, pick the second reading.
- */
- tcr2 = sys_pcc2->pcc2_t1count;
- if (tcr2 < tcr1) {
- tcr1 = tcr2;
- tctl = sys_pcc2->pcc2_t1ctl;
- }
- cnt = pcctwo_curcnt;
- splx(s);
- tctl >>= PCC2_TCTL_OVF_SHIFT;
- while (tctl-- != 0)
- cnt += cmp;
- cnt += tcr1;
-
- return cnt;
-}
-#endif
-
-/*
- * clockintr: ack intr and call hardclock
- */
-int
-clockintr(arg)
- void *arg;
-{
- u_int oflow = 1;
-#if NMC > 0 || NPCC > 0 || NPCCTWO > 0
- uint32_t t1, t2;
- uint8_t c;
-#endif
-
- switch (clockbus) {
-#if NLRC > 0
- case BUS_LRC:
- /* nothing to do */
- break;
-#endif
-#if NOFOBIO > 0
- case BUS_OFOBIO:
- sys_ofobio->csr_c &= ~OFO_CSRC_TIMER_ACK;
- break;
-#endif
-#if NMC > 0
- case BUS_MC:
- /*
- * Since we can not freeze the counter while reading the count
- * and overflow registers, read them a second time; if the
- * counter has wrapped, pick the second reading.
- */
- t1 = sys_mc->mc_t1count;
- c = sys_mc->mc_t1ctl;
- t2 = sys_mc->mc_t1count;
- if (t2 < t1) /* just wrapped */
- c = sys_mc->mc_t1ctl;
- sys_mc->mc_t1ctl = MC_TCTL_CEN | MC_TCTL_COC | MC_TCTL_COVF;
- sys_mc->mc_t1irq = prof_reset;
- oflow = c >> MC_TCTL_OVF_SHIFT;
- break;
-#endif
-#if NPCC > 0
- case BUS_PCC:
- /*
- * Since we can not freeze the counter while reading the count
- * and overflow registers, read them a second time; if the
- * counter has wrapped, pick the second reading.
- */
- t1 = sys_pcc->pcc_t1count;
- c = sys_pcc->pcc_t1ctl;
- t2 = sys_pcc->pcc_t1count;
- if (t2 < t1) /* just wrapped */
- c = sys_pcc->pcc_t1ctl;
- sys_pcc->pcc_t1ctl = PCC_TIMER_COVF | PCC_TIMERSTART;
- sys_pcc->pcc_t1irq = prof_reset;
- oflow = c >> PCC_TIMER_OVF_SHIFT;
- pcc_curcnt += oflow * (0x10000 - sys_pcc->pcc_t1pload);
- break;
-#endif
-#if NPCCTWO > 0
- case BUS_PCCTWO:
- /*
- * Since we can not freeze the counter while reading the count
- * and overflow registers, read them a second time; if the
- * counter has wrapped, pick the second reading.
- */
- t1 = sys_pcc2->pcc2_t1count;
- c = sys_pcc2->pcc2_t1ctl;
- t2 = sys_pcc2->pcc2_t1count;
- if (t2 < t1) /* just wrapped */
- c = sys_pcc2->pcc2_t1ctl;
- sys_pcc2->pcc2_t1ctl = PCC2_TCTL_CEN | PCC2_TCTL_COC |
- PCC2_TCTL_COVF;
- sys_pcc2->pcc2_t1irq = prof_reset;
- oflow = c >> PCC2_TCTL_OVF_SHIFT;
- pcctwo_curcnt += oflow * sys_pcc2->pcc2_t1cmp;
- break;
-#endif
- }
-
- while (oflow-- != 0)
- hardclock(arg);
-
- return (1);
-}
-
-/*
- * Set up real-time and, if available, statistics clock.
- */
-void
-cpu_initclocks()
-{
- register int statint, minint;
-
- if (1000000 % hz) {
- printf("cannot get %d Hz clock; using 100 Hz\n", hz);
- hz = 100;
- tick = 1000000 / hz;
- }
- if (stathz == 0)
- stathz = hz;
- if (1000000 % stathz) {
- printf("cannot get %d Hz statclock; using 100 Hz\n", stathz);
- stathz = 100;
- }
- profhz = stathz; /* always */
-
- statint = 1000000 / stathz;
- minint = statint / 2 + 100;
- while (statvar > minint)
- statvar >>= 1;
- switch (clockbus) {
-#if NLRC > 0
- case BUS_LRC:
- profhz = stathz = 0; /* only one timer available for now */
-
- /*
- * LRC timer usage:
- * timer0 is used for delay().
- * timer1 is used for time counters.
- * timer2 is used for the scheduling clock.
- */
- sys_lrc->lrc_tcr0 = 0;
- sys_lrc->lrc_tcr1 = TCR_TLD1; /* reset to one */
- sys_lrc->lrc_tcr1 = TCR_TEN1 | TCR_TCYC1 | TCR_TIS_NONE;
-
- sys_lrc->lrc_t2base = tick + 1;
- sys_lrc->lrc_tcr2 = TCR_TLD2; /* reset to one */
- sys_lrc->lrc_tcr2 = TCR_TEN2 | TCR_TCYC2 | TCR_T2IE;
-
- tc_init(&lrc_timecounter);
- break;
-#endif
-#if NOFOBIO > 0
- case BUS_OFOBIO:
- profhz = stathz = 0; /* only one timer available */
-
- ofobio_clocksetup();
-
- ofobio_timecounter.tc_frequency = hz;
- tc_init(&ofobio_timecounter);
- break;
-#endif
-#if NMC > 0
- case BUS_MC:
- /*
- * MC timer usage:
- * timer1 is used for the scheduling clock.
- * timer2 is used for the statistics clock.
- * timer3 is used for time counters.
- */
-
- sys_mc->mc_t1ctl = 0;
- sys_mc->mc_t1cmp = mc_timer_us2lim(tick);
- sys_mc->mc_t1count = 0;
- sys_mc->mc_t1ctl = MC_TCTL_CEN | MC_TCTL_COC | MC_TCTL_COVF;
- sys_mc->mc_t1irq = prof_reset;
-
- sys_mc->mc_t2ctl = 0;
- sys_mc->mc_t2cmp = mc_timer_us2lim(statint);
- sys_mc->mc_t2count = 0;
- sys_mc->mc_t2ctl = MC_TCTL_CEN | MC_TCTL_COC | MC_TCTL_COVF;
- sys_mc->mc_t2irq = stat_reset;
-
- sys_mc->mc_t3ctl = 0;
- sys_mc->mc_t3cmp = 0;
- sys_mc->mc_t3count = 0;
- sys_mc->mc_t3ctl = MC_TCTL_CEN;
- sys_mc->mc_t3irq = 0;
- tc_init(&mc_timecounter);
- break;
-#endif
-#if NPCC > 0
- case BUS_PCC:
- sys_pcc->pcc_t1pload = pcc_timer_us2lim(tick);
- sys_pcc->pcc_t1ctl = PCC_TIMERCLEAR;
- sys_pcc->pcc_t1ctl = PCC_TIMERSTART;
- sys_pcc->pcc_t1irq = prof_reset;
-
- sys_pcc->pcc_t2pload = pcc_timer_us2lim(statint);
- sys_pcc->pcc_t2ctl = PCC_TIMERCLEAR;
- sys_pcc->pcc_t2ctl = PCC_TIMERSTART;
- sys_pcc->pcc_t2irq = stat_reset;
-
- tc_init(&pcc_timecounter);
- break;
-#endif
-#if NPCCTWO > 0
- case BUS_PCCTWO:
- /* profclock */
- sys_pcc2->pcc2_t1ctl = 0;
- sys_pcc2->pcc2_t1cmp = pcc2_timer_us2lim(tick);
- sys_pcc2->pcc2_t1count = 0;
- sys_pcc2->pcc2_t1ctl = PCC2_TCTL_CEN | PCC2_TCTL_COC |
- PCC2_TCTL_COVF;
- sys_pcc2->pcc2_t1irq = prof_reset;
-
- /* statclock */
- sys_pcc2->pcc2_t2ctl = 0;
- sys_pcc2->pcc2_t2cmp = pcc2_timer_us2lim(statint);
- sys_pcc2->pcc2_t2count = 0;
- sys_pcc2->pcc2_t2ctl = PCC2_TCTL_CEN | PCC2_TCTL_COC |
- PCC2_TCTL_COVF;
- sys_pcc2->pcc2_t2irq = stat_reset;
-
- tc_init(&pcctwo_timecounter);
- break;
-#endif
- }
- statmin = statint - (statvar >> 1);
-}
-
-void
-setstatclockrate(newhz)
- int newhz;
-{
-}
-
-int
-statintr(cap)
- void *cap;
-{
- register u_long newint, r, var;
-
- switch (clockbus) {
-#if NPCC > 0
- case BUS_PCC:
- sys_pcc->pcc_t2irq = stat_reset;
- break;
-#endif
-#if NMC > 0
- case BUS_MC:
- sys_mc->mc_t2irq = stat_reset;
- break;
-#endif
-#if NPCCTWO > 0
- case BUS_PCCTWO:
- sys_pcc2->pcc2_t2irq = stat_reset;
- break;
-#endif
- }
-
- statclock((struct clockframe *)cap);
-
- /*
- * Compute new randomized interval. The intervals are uniformly
- * distributed on [statint - statvar / 2, statint + statvar / 2],
- * and therefore have mean statint, giving a stathz frequency clock.
- */
- var = statvar;
- do {
- r = random() & (var - 1);
- } while (r == 0);
- newint = statmin + r;
-
- switch (clockbus) {
-#if NPCC > 0
- case BUS_PCC:
- sys_pcc->pcc_t2pload = pcc_timer_us2lim(newint);
- sys_pcc->pcc_t2ctl = PCC_TIMERCLEAR;
- sys_pcc->pcc_t2ctl = PCC_TIMERSTART;
- sys_pcc->pcc_t2irq = stat_reset;
- break;
-#endif
-#if NMC > 0
- case BUS_MC:
- sys_mc->mc_t2ctl = 0;
- sys_mc->mc_t2cmp = mc_timer_us2lim(newint);
- sys_mc->mc_t2count = 0; /* should I? */
- sys_mc->mc_t2irq = stat_reset;
- sys_mc->mc_t2ctl = MC_TCTL_CEN | MC_TCTL_COC;
- break;
-#endif
-#if NPCCTWO > 0
- case BUS_PCCTWO:
- sys_pcc2->pcc2_t2ctl = 0;
- sys_pcc2->pcc2_t2cmp = pcc2_timer_us2lim(newint);
- sys_pcc2->pcc2_t2count = 0; /* should I? */
- sys_pcc2->pcc2_t2irq = stat_reset;
- sys_pcc2->pcc2_t2ctl = PCC2_TCTL_CEN | PCC2_TCTL_COC;
- break;
-#endif
- }
- return (1);
-}
-
-void
-delay(us)
- int us;
-{
-#if NPCC > 0 || NOFOBIO > 0
- volatile register int c;
-#endif
-
- switch (clockbus) {
-#if NLRC > 0
- case BUS_LRC:
- {
- struct lrcreg *lrc;
-
- if (sys_lrc != NULL)
- lrc = sys_lrc;
- else
- lrc = (struct lrcreg *)IIOV(0xfff90000);
-
- /* use timer0 and wait for it to wrap */
- lrc->lrc_t0base = us + 1;
- lrc->lrc_tcr0 = TCR_TLD0; /* reset to one */
- lrc->lrc_stat = STAT_TMR0; /* clear latch */
- lrc->lrc_tcr0 = TCR_TEN0;
- while ((lrc->lrc_stat & STAT_TMR0) == 0)
- ;
- }
- break;
-#endif
-#if NMC > 0
- case BUS_MC:
- /*
- * Reset and restart a free-running timer 1MHz, watch
- * for it to reach the required count.
- */
- {
- struct mcreg *mc;
-
- if (sys_mc != NULL)
- mc = sys_mc;
- else
- mc = (struct mcreg *)IIOV(0xfff00000);
-
- mc->mc_t3irq = 0;
- mc->mc_t3ctl = 0;
- mc->mc_t3count = 0;
- mc->mc_t3ctl = MC_TCTL_CEN | MC_TCTL_COVF;
-
- while (mc->mc_t3count < us)
- ;
- }
- break;
-#endif
-#if NPCC > 0 || NOFOBIO > 0
- case BUS_PCC:
- case BUS_OFOBIO:
- /*
- * XXX MVME147 doesn't have a 3rd free-running timer,
- * so we use a stupid loop. Fix the code to watch t1:
- * the profiling timer.
- * MVME141 only has one timer, so there is no hope
- * either.
- */
- c = 2 * us;
- while (--c > 0)
- ;
- break;
-#endif
-#if NPCCTWO > 0
- case BUS_PCCTWO:
- /*
- * Use the first VMEChip2 timer in polling mode whenever
- * possible.
- */
- {
- struct vme2reg *vme2;
-
- if (sys_vme2 != NULL)
- vme2 = sys_vme2;
- else
- vme2 = (struct vme2reg *)IIOV(0xfff40000);
-
- vme2->vme2_t1cmp = 0xffffffff;
- vme2->vme2_t1count = 0;
- vme2->vme2_tctl |= VME2_TCTL_CEN;
-
- while (vme2->vme2_t1count < us)
- ;
-
- vme2->vme2_tctl &= ~VME2_TCTL_CEN;
- }
- break;
-#endif
- }
-}
diff --git a/sys/arch/mvme68k/dev/clreg.h b/sys/arch/mvme68k/dev/clreg.h
deleted file mode 100644
index e6086afd06d..00000000000
--- a/sys/arch/mvme68k/dev/clreg.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/* $OpenBSD: clreg.h,v 1.6 2003/06/03 21:09:01 deraadt Exp $ */
-
-/*
- * Copyright (c) 1995 Dale Rahn. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-struct clreg {
- volatile u_char anon1[0x7];
- volatile u_char cl_cor7; /* 0x07 */
- volatile u_char anon2[0x1];
- volatile u_char cl_livr; /* 0x09 */
- volatile u_char anon3[0x6];
- volatile u_char cl_cor1; /* 0x10 */
- volatile u_char cl_ier; /* 0x11 */
- volatile u_char cl_stcr; /* 0x12 */
- volatile u_char cl_ccr; /* 0x13 */
- volatile u_char cl_cor5; /* 0x14 */
- volatile u_char cl_cor4; /* 0x15 */
- volatile u_char cl_cor3; /* 0x16 */
- volatile u_char cl_cor2; /* 0x17 */
- volatile u_char cl_cor6; /* 0x18 */
- volatile u_char cl_dmabsts; /* 0x19 */
- volatile u_char cl_csr; /* 0x1a */
- volatile u_char cl_cmr; /* 0x1b */
- volatile u_char cl_schr4; /* 0x1c */
- volatile u_char cl_schr3; /* 0x1d */
- volatile u_char cl_schr2; /* 0x1e */
- volatile u_char cl_schr1; /* 0x1f */
- volatile u_char anon5[0x2];
- volatile u_char cl_scrh; /* 0x22 */
- volatile u_char cl_scrl; /* 0x23 */
-#define cl_rtpr rtpr.rtpr_rtpr
-#define cl_rtprh rtpr.hl.rtpr_rtprh
-#define cl_rtprl rtpr.hl.rtpr_rtprl
- union {
- volatile u_short rtpr_rtpr; /* 0x24 */
- struct {
- volatile u_char rtpr_rtprh; /* 0x24 */
- volatile u_char rtpr_rtprl; /* 0x25 */
- } hl;
- } rtpr;
- volatile u_char cl_licr; /* 0x26 */
- volatile u_char anon6[0x7];
- volatile u_char cl_lnxt; /* 0x2e */
- volatile u_char anon7[0x1];
- volatile u_char cl_rfoc; /* 0x30 */
- volatile u_char anon8[0x7];
- volatile u_short cl_tcbadru; /* 0x38 */
- volatile u_short cl_tcbadrl; /* 0x3a */
- volatile u_short cl_rcbadru; /* 0x3c */
- volatile u_short cl_rcbadrl; /* 0x3e */
- volatile u_short cl_arbadru; /* 0x40 */
- volatile u_short cl_arbadrl; /* 0x42 */
- volatile u_short cl_brbadru; /* 0x44 */
- volatile u_short cl_brbadrl; /* 0x46 */
- volatile u_short cl_brbcnt; /* 0x48 */
- volatile u_short cl_arbcnt; /* 0x4a */
- volatile u_char anoni[0x2];
- volatile u_char cl_brbsts; /* 0x4e */
- volatile u_char cl_arbsts; /* 0x4f */
-#define cl_atbadr atbadr.atbadr
-#define cl_atbadru atbadr.hl.atbadru
-#define cl_atbadrl atbadr.hl.atbadrl
- union {
- struct {
- volatile u_short atbadru; /* 0x50 */
- volatile u_short atbadrl; /* 0x52 */
- } hl;
- volatile u_long atbadr; /* 0x50 */
- } atbadr;
-#define cl_btbadr btbadr.btbadr
-#define cl_btbadru btbadr.hl.btbadru
-#define cl_btbadrl btbadr.hl.btbadrl
- union {
- struct {
- volatile u_short btbadru; /* 0x54 */
- volatile u_short btbadrl; /* 0x56 */
- } hl;
- volatile u_long btbadr; /* 0x54 */
- } btbadr;
- volatile u_short cl_btbcnt; /* 0x58 */
- volatile u_short cl_atbcnt; /* 0x5a */
- volatile u_char anono[0x2];
- volatile u_char cl_btbsts; /* 0x5e */
- volatile u_char cl_atbsts; /* 0x5f */
- volatile u_char anonp[0x20];
- volatile u_char cl_tftc; /* 0x80 */
- volatile u_char cl_gfrcr; /* 0x81 */
- volatile u_char anonq[0x2];
- volatile u_char cl_reoir; /* 0x84 */
- volatile u_char cl_teoir; /* 0x85 */
- volatile u_char cl_meoir; /* 0x86 */
- volatile u_char anonr[0x1];
-#define cl_risr risr.risr_risr
-#define cl_risrl risr.hl.risr_risrl
-#define cl_risrh risr.hl.risr_risrh
- union {
- volatile u_short risr_risr; /* 0x88 */
- struct {
- volatile u_char risr_risrh; /* 0x88 */
- volatile u_char risr_risrl; /* 0x89 */
- } hl;
- } risr;
- volatile u_char cl_tisr; /* 0x8a */
- volatile u_char cl_misr; /* 0x8b */
- volatile u_char anons[0x2];
- volatile u_char cl_bercnt; /* 0x8e */
- volatile u_char anont[0x31];
- volatile u_char cl_tcor; /* 0xc0 */
- volatile u_char anonu[0x2];
- volatile u_char cl_tbpr; /* 0xc3 */
- volatile u_char anonv[0x4];
- volatile u_char cl_rcor; /* 0xc8 */
- volatile u_char anonw[0x2];
- volatile u_char cl_rbpr; /* 0xcb */
- volatile u_char anonx[0xa];
- volatile u_char cl_cpsr; /* 0xd6 */
- volatile u_char anony[0x3];
- volatile u_char cl_tpr; /* 0xda */
- volatile u_char anonz[0x3];
- volatile u_char cl_msvr_rts; /* 0xde */
- volatile u_char cl_msvr_dtr; /* 0xdf */
- volatile u_char cl_tpilr; /* 0xe0 */
- volatile u_char cl_rpilr; /* 0xe1 */
- volatile u_char cl_stk; /* 0xe2 */
- volatile u_char cl_mpilr; /* 0xe3 */
- volatile u_char anonA[0x8];
- volatile u_char cl_tir; /* 0xec */
- volatile u_char cl_rir; /* 0xed */
- volatile u_char cl_car; /* 0xee */
- volatile u_char cl_mir; /* 0xef */
- volatile u_char anonB[0x6];
- volatile u_char cl_dmr; /* 0xf6 */
- volatile u_char anonC[0x1];
-#define cl_rdr cl_tdr
- volatile u_char cl_tdr; /* 0xf8 */
- volatile u_char anonD[7];
-};
diff --git a/sys/arch/mvme68k/dev/dart.c b/sys/arch/mvme68k/dev/dart.c
deleted file mode 100644
index d1e30fcf547..00000000000
--- a/sys/arch/mvme68k/dev/dart.c
+++ /dev/null
@@ -1,1039 +0,0 @@
-/* $OpenBSD: dart.c,v 1.8 2010/07/02 17:27:01 nicm Exp $ */
-
-/*
- * Mach Operating System
- * Copyright (c) 1993-1991 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON AND OMRON ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON AND OMRON DISCLAIM ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include <sys/param.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/syslog.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/conf.h>
-#include <machine/cpu.h>
-
-#include <dev/cons.h>
-
-#include <mvme68k/dev/dartreg.h>
-#include <mvme68k/dev/dartvar.h>
-
-#ifdef DDB
-#include <ddb/db_var.h>
-#endif
-
-struct cfdriver dart_cd = {
- NULL, "dart", DV_TTY
-};
-
-/* console is on the first port */
-#define CONS_PORT A_PORT
-struct dart_sv_reg dartcn_sv;
-
-/* prototypes */
-cons_decl(dart);
-int dart_speed(int);
-struct tty *darttty(dev_t);
-void dartstart(struct tty *);
-int dartmctl(struct dartsoftc *, int, int, int);
-int dartparam(struct tty *, struct termios *);
-void dartmodemtrans(struct dartsoftc *, unsigned int, unsigned int);
-void dartrint(struct dartsoftc *, int);
-void dartxint(struct dartsoftc *, int);
-
-/*
- * DUART registers are sometimes mapped as the least-significant byte
- * of 32-bit addresses. The following macros hide this.
- */
-
-static __inline uint8_t dart_read(struct dartsoftc *, uint);
-static __inline void dart_write(struct dartsoftc *, uint, uint);
-
-static __inline uint8_t
-dart_read(struct dartsoftc *sc, uint reg)
-{
- if (sc->sc_stride != 0)
- return bus_space_read_1(sc->sc_iot, sc->sc_ioh, 3 + (reg << 2));
- else
- return bus_space_read_1(sc->sc_iot, sc->sc_ioh, reg);
-}
-static __inline void
-dart_write(struct dartsoftc *sc, uint reg, uint val)
-{
- if (sc->sc_stride != 0)
- bus_space_write_1(sc->sc_iot, sc->sc_ioh, 3 + (reg << 2), val);
- else
- bus_space_write_1(sc->sc_iot, sc->sc_ioh, reg, val);
-}
-
-#define DART_CHIP(dev) (minor(dev) >> 1)
-#define DART_PORT(dev) (minor(dev) & 1)
-
-void
-dart_common_attach(struct dartsoftc *sc)
-{
- if (sc->sc_console) {
- sc->sc_sv_reg = &dartcn_sv;
-
- if (A_PORT != CONS_PORT) {
- sc->sc_sv_reg->sv_mr1[A_PORT] = PARDIS | RXRTS | CL8;
- sc->sc_sv_reg->sv_mr2[A_PORT] = /* TXCTS | */ SB1;
- sc->sc_sv_reg->sv_csr[A_PORT] = BD9600;
- sc->sc_sv_reg->sv_cr[A_PORT] = TXEN | RXEN;
- sc->sc_sv_reg->sv_opr |= OPDTRA | OPRTSA;
- } else {
- sc->sc_sv_reg->sv_mr1[B_PORT] = PARDIS | RXRTS | CL8;
- sc->sc_sv_reg->sv_mr2[B_PORT] = /* TXCTS | */ SB1;
- sc->sc_sv_reg->sv_csr[B_PORT] = BD9600;
- sc->sc_sv_reg->sv_cr[B_PORT] = TXEN | RXEN;
- sc->sc_sv_reg->sv_opr |= OPDTRB | OPRTSB;
- }
- } else {
- sc->sc_sv_reg = &sc->sc_sv_reg_storage;
-
- sc->sc_sv_reg->sv_mr1[A_PORT] = PARDIS | RXRTS | CL8;
- sc->sc_sv_reg->sv_mr2[A_PORT] = /* TXCTS | */ SB1;
- sc->sc_sv_reg->sv_csr[A_PORT] = BD9600;
- sc->sc_sv_reg->sv_cr[A_PORT] = TXEN | RXEN;
-
- sc->sc_sv_reg->sv_mr1[B_PORT] = PARDIS | RXRTS | CL8;
- sc->sc_sv_reg->sv_mr2[B_PORT] = /* TXCTS | */ SB1;
- sc->sc_sv_reg->sv_csr[B_PORT] = BD9600;
- sc->sc_sv_reg->sv_cr[B_PORT] = TXEN | RXEN;
-
- sc->sc_sv_reg->sv_opr = OPDTRA | OPRTSA | OPDTRB | OPRTSB;
-
- /* Start out with Tx and RX interrupts disabled */
- /* Enable input port change interrupt */
- sc->sc_sv_reg->sv_imr = IIPCHG;
- }
-
- /* reset port a */
- if (sc->sc_console == 0 || CONS_PORT != A_PORT) {
- dart_write(sc, DART_CRA, RXRESET | TXDIS | RXDIS);
- delay(1);
- dart_write(sc, DART_CRA, TXRESET | TXDIS | RXDIS);
- delay(1);
- dart_write(sc, DART_CRA, ERRRESET | TXDIS | RXDIS);
- delay(1);
- dart_write(sc, DART_CRA, BRKINTRESET | TXDIS | RXDIS);
- delay(1);
- dart_write(sc, DART_CRA, MRRESET | TXDIS | RXDIS);
-#if 0
- delay(1);
-#endif
-
- dart_write(sc, DART_MR1A, sc->sc_sv_reg->sv_mr1[A_PORT]);
- dart_write(sc, DART_MR2A, sc->sc_sv_reg->sv_mr2[A_PORT]);
- dart_write(sc, DART_CSRA, sc->sc_sv_reg->sv_csr[A_PORT]);
- dart_write(sc, DART_CRA, sc->sc_sv_reg->sv_cr[A_PORT]);
- }
-
- /* reset port b */
- if (sc->sc_console == 0 || CONS_PORT != B_PORT) {
- dart_write(sc, DART_CRB, RXRESET | TXDIS | RXDIS);
- delay(1);
- dart_write(sc, DART_CRB, TXRESET | TXDIS | RXDIS);
- delay(1);
- dart_write(sc, DART_CRB, ERRRESET | TXDIS | RXDIS);
- delay(1);
- dart_write(sc, DART_CRB, BRKINTRESET | TXDIS | RXDIS);
- delay(1);
- dart_write(sc, DART_CRB, MRRESET | TXDIS | RXDIS);
-#if 0
- delay(1);
-#endif
-
- dart_write(sc, DART_MR1B, sc->sc_sv_reg->sv_mr1[B_PORT]);
- dart_write(sc, DART_MR2B, sc->sc_sv_reg->sv_mr2[B_PORT]);
- dart_write(sc, DART_CSRB, sc->sc_sv_reg->sv_csr[B_PORT]);
- dart_write(sc, DART_CRB, sc->sc_sv_reg->sv_cr[B_PORT]);
- }
-
- /* initialize common register of a DUART */
- dart_write(sc, DART_OPRS, sc->sc_sv_reg->sv_opr);
-
-#if 0
- dart_write(sc, DART_CTUR, SLCTIM >> 8);
- dart_write(sc, DART_CTLR, SLCTIM & 0xff);
- dart_write(sc, DART_ACR, BDSET2 | CCLK16 | IPDCDIB | IPDCDIA);
-#else
- dart_write(sc, DART_ACR, IPDCDIB | IPDCDIA);
-#endif
- dart_write(sc, DART_IMR, sc->sc_sv_reg->sv_imr);
- dart_write(sc, DART_OPCR, OPSET);
-
- if (sc->sc_vec != 0)
- dart_write(sc, DART_IVR, sc->sc_vec);
-
- sc->sc_dart[A_PORT].tty = sc->sc_dart[B_PORT].tty = NULL;
- sc->sc_dart[A_PORT].dart_swflags = sc->sc_dart[B_PORT].dart_swflags = 0;
- if (sc->sc_console)
- sc->sc_dart[CONS_PORT].dart_swflags |= TIOCFLAG_SOFTCAR;
-
- printf("\n");
-}
-
-/* speed tables */
-const struct dart_s {
- int kspeed;
- int dspeed;
-} dart_speeds[] = {
- { B0, 0 }, /* 0 baud, special HUP condition */
- { B50, NOBAUD }, /* 50 baud, not implemented */
- { B75, BD75 }, /* 75 baud */
- { B110, BD110 }, /* 110 baud */
- { B134, BD134 }, /* 134.5 baud */
- { B150, BD150 }, /* 150 baud */
- { B200, NOBAUD }, /* 200 baud, not implemented */
- { B300, BD300 }, /* 300 baud */
- { B600, BD600 }, /* 600 baud */
- { B1200, BD1200 }, /* 1200 baud */
- { B1800, BD1800 }, /* 1800 baud */
- { B2400, BD2400 }, /* 2400 baud */
- { B4800, BD4800 }, /* 4800 baud */
- { B9600, BD9600 }, /* 9600 baud */
- { B19200, BD19200 }, /* 19200 baud */
- { -1, NOBAUD }, /* anything more is uncivilized */
-};
-
-int
-dart_speed(int speed)
-{
- const struct dart_s *ds;
-
- for (ds = dart_speeds; ds->kspeed != -1; ds++)
- if (ds->kspeed == speed)
- return ds->dspeed;
-
- return NOBAUD;
-}
-
-struct tty *
-darttty(dev_t dev)
-{
- u_int port, chip;
- struct dartsoftc *sc;
-
- chip = DART_CHIP(dev);
- port = DART_PORT(dev);
- if (dart_cd.cd_ndevs <= chip || port >= NDARTPORTS)
- return (NULL);
-
- sc = (struct dartsoftc *)dart_cd.cd_devs[chip];
- if (sc == NULL)
- return (NULL);
-
- return sc->sc_dart[port].tty;
-}
-
-void
-dartstart(struct tty *tp)
-{
- struct dartsoftc *sc;
- dev_t dev;
- int s;
- u_int port, chip;
- int c, tries;
- bus_addr_t ptaddr;
-
- if ((tp->t_state & TS_ISOPEN) == 0)
- return;
-
- dev = tp->t_dev;
- chip = DART_CHIP(dev);
- port = DART_PORT(dev);
- sc = (struct dartsoftc *)dart_cd.cd_devs[chip];
- ptaddr = port == A_PORT ? DART_A_BASE : DART_B_BASE;
-
- s = spltty();
-
- if (tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP))
- goto bail;
-
- ttwakeupwr(tp);
- if (tp->t_outq.c_cc == 0)
- goto bail;
-
- tp->t_state |= TS_BUSY;
- while (tp->t_outq.c_cc != 0) {
-
- /* load transmitter until it is full */
- for (tries = 10000; tries != 0; tries --)
- if (dart_read(sc, ptaddr + DART_SRA) & TXRDY)
- break;
-
- if (tries == 0) {
- timeout_add(&tp->t_rstrt_to, 1);
- tp->t_state |= TS_TIMEOUT;
- break;
- } else {
- c = getc(&tp->t_outq);
-
- dart_write(sc, ptaddr + DART_TBA, c & 0xff);
-
- sc->sc_sv_reg->sv_imr |=
- port == A_PORT ? ITXRDYA : ITXRDYB;
- dart_write(sc, DART_IMR, sc->sc_sv_reg->sv_imr);
- }
- }
- tp->t_state &= ~TS_BUSY;
-
-bail:
- splx(s);
-}
-
-int
-dartstop(struct tty *tp, int flag)
-{
- int s;
-
- s = spltty();
- if (tp->t_state & TS_BUSY) {
- if ((tp->t_state & TS_TTSTOP) == 0)
- tp->t_state |= TS_FLUSH;
- }
- splx(s);
-
- return 0;
-}
-
-/*
- * To be called at spltty - tty already locked.
- * Returns status of carrier.
- */
-int
-dartmctl(struct dartsoftc *sc, int port, int flags, int how)
-{
- int newflags, flagsmask;
- struct dart_info *dart;
- int s;
-
- dart = &sc->sc_dart[port];
-
- s = spltty();
-
- flagsmask = port == A_PORT ? (OPDTRA | OPRTSA) : (OPDTRB | OPRTSB);
- newflags = (flags & TIOCM_DTR ? (OPDTRA | OPDTRB) : 0) |
- (flags & TIOCM_RTS ? (OPRTSA | OPRTSB) : 0);
- newflags &= flagsmask; /* restrict to the port we are acting on */
-
- switch (how) {
- case DMSET:
- dart_write(sc, DART_OPRS, newflags);
- dart_write(sc, DART_OPRR, ~newflags);
- /* only replace the sv_opr bits for the port we are acting on */
- sc->sc_sv_reg->sv_opr &= ~flagsmask;
- sc->sc_sv_reg->sv_opr |= newflags;
- break;
- case DMBIS:
- dart_write(sc, DART_OPRS, newflags);
- sc->sc_sv_reg->sv_opr |= newflags;
- break;
- case DMBIC:
- dart_write(sc, DART_OPRR, newflags);
- sc->sc_sv_reg->sv_opr &= ~newflags;
- break;
- case DMGET:
- flags = 0;
- if (port == A_PORT) {
- if (sc->sc_sv_reg->sv_opr & OPDTRA)
- flags |= TIOCM_DTR;
- if (sc->sc_sv_reg->sv_opr & OPRTSA)
- flags |= TIOCM_RTS;
- } else {
- if (sc->sc_sv_reg->sv_opr & OPDTRB)
- flags |= TIOCM_DTR;
- if (sc->sc_sv_reg->sv_opr & OPRTSB)
- flags |= TIOCM_RTS;
- }
- break;
- }
-
- splx(s);
- return (flags);
-}
-
-int
-dartioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
-{
- int error;
- u_int port, chip;
- struct tty *tp;
- struct dart_info *dart;
- struct dartsoftc *sc;
-
- chip = DART_CHIP(dev);
- port = DART_PORT(dev);
- sc = (struct dartsoftc *)dart_cd.cd_devs[chip];
- dart = &sc->sc_dart[port];
-
- tp = dart->tty;
- if (tp == NULL)
- return (ENXIO);
-
- error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
- if (error >= 0)
- return(error);
-
- error = ttioctl(tp, cmd, data, flag, p);
- if (error >= 0)
- return(error);
-
- switch (cmd) {
- case TIOCSBRK:
- case TIOCCBRK:
- break;
- case TIOCSDTR:
- (void)dartmctl(sc, port, TIOCM_DTR | TIOCM_RTS, DMBIS);
- break;
- case TIOCCDTR:
- (void)dartmctl(sc, port, TIOCM_DTR | TIOCM_RTS, DMBIC);
- break;
- case TIOCMSET:
- (void)dartmctl(sc, port, *(int *) data, DMSET);
- break;
- case TIOCMBIS:
- (void)dartmctl(sc, port, *(int *) data, DMBIS);
- break;
- case TIOCMBIC:
- (void)dartmctl(sc, port, *(int *) data, DMBIC);
- break;
- case TIOCMGET:
- *(int *)data = dartmctl(sc, port, 0, DMGET);
- break;
- case TIOCGFLAGS:
- *(int *)data = dart->dart_swflags;
- break;
- case TIOCSFLAGS:
- error = suser(p, 0);
- if (error != 0)
- return (EPERM);
-
- dart->dart_swflags = *(int *)data;
- dart->dart_swflags &= /* only allow valid flags */
- (TIOCFLAG_SOFTCAR | TIOCFLAG_CLOCAL | TIOCFLAG_CRTSCTS);
- break;
- default:
- return (ENOTTY);
- }
-
- return (0);
-}
-
-int
-dartparam(struct tty *tp, struct termios *t)
-{
- int flags;
- u_int port, chip;
- int speeds;
- unsigned char mr1, mr2;
- struct dart_info *dart;
- struct dartsoftc *sc;
- dev_t dev;
- bus_addr_t ptaddr;
-
- dev = tp->t_dev;
- chip = DART_CHIP(dev);
- port = DART_PORT(dev);
- sc = (struct dartsoftc *)dart_cd.cd_devs[chip];
- dart = &sc->sc_dart[port];
- ptaddr = port == A_PORT ? DART_A_BASE : DART_B_BASE;
-
- tp->t_ispeed = t->c_ispeed;
- tp->t_ospeed = t->c_ospeed;
- tp->t_cflag = t->c_cflag;
-
- flags = tp->t_flags;
-
- /* Reset to make global changes*/
- /* disable Tx and Rx */
-
- if (sc->sc_console == 0 || CONS_PORT != port) {
- if (port == A_PORT)
- sc->sc_sv_reg->sv_imr &= ~(ITXRDYA | IRXRDYA);
- else
- sc->sc_sv_reg->sv_imr &= ~(ITXRDYB | IRXRDYB);
- dart_write(sc, DART_IMR, sc->sc_sv_reg->sv_imr);
-
- /* hang up on zero baud rate */
- if (tp->t_ispeed == 0) {
- dartmctl(sc, port, HUPCL, DMSET);
- return (0);
- } else {
- /* set baudrate */
- speeds = dart_speed(tp->t_ispeed);
- if (speeds == NOBAUD)
- speeds = sc->sc_sv_reg->sv_csr[port];
- dart_write(sc, ptaddr + DART_CSRA, speeds);
- sc->sc_sv_reg->sv_csr[port] = speeds;
- }
-
- /* get saved mode registers and clear set up parameters */
- mr1 = sc->sc_sv_reg->sv_mr1[port];
- mr1 &= ~(CLMASK | PARTYPEMASK | PARMODEMASK);
-
- mr2 = sc->sc_sv_reg->sv_mr2[port];
- mr2 &= ~SBMASK;
-
- /* set up character size */
- switch (t->c_cflag & CSIZE) {
- case CL8:
- mr1 |= CL8;
- break;
- case CL7:
- mr1 |= CL7;
- break;
- case CL6:
- mr1 |= CL6;
- break;
- case CL5:
- mr1 |= CL5;
- break;
- }
-
- /* set up stop bits */
- if (tp->t_ospeed == B110)
- mr2 |= SB2;
- else
- mr2 |= SB1;
-
- /* set up parity */
- if (t->c_cflag & PARENB) {
- mr1 |= PAREN;
- if (t->c_cflag & PARODD)
- mr1 |= ODDPAR;
- else
- mr1 |= EVENPAR;
- } else
- mr1 |= PARDIS;
-
- if (sc->sc_sv_reg->sv_mr1[port] != mr1 ||
- sc->sc_sv_reg->sv_mr2[port] != mr2) {
- /* write mode registers to duart */
- dart_write(sc, ptaddr + DART_CRA, MRRESET);
- dart_write(sc, ptaddr + DART_MR1A, mr1);
- dart_write(sc, ptaddr + DART_MR2A, mr2);
-
- /* save changed mode registers */
- sc->sc_sv_reg->sv_mr1[port] = mr1;
- sc->sc_sv_reg->sv_mr2[port] = mr2;
- }
- }
-
- /* enable transmitter? */
- if (tp->t_state & TS_BUSY) {
- sc->sc_sv_reg->sv_imr |= port == A_PORT ? ITXRDYA : ITXRDYB;
- dart_write(sc, DART_IMR, sc->sc_sv_reg->sv_imr);
- }
-
- /* re-enable the receiver */
-#if 0
- delay(1);
-#endif
- sc->sc_sv_reg->sv_imr |= port == A_PORT ? IRXRDYA : IRXRDYB;
- dart_write(sc, DART_IMR, sc->sc_sv_reg->sv_imr);
-
- return (0);
-}
-
-void
-dartmodemtrans(struct dartsoftc *sc, unsigned int ip, unsigned int ipcr)
-{
- unsigned int dcdstate;
- struct tty *tp;
- int port;
- struct dart_info *dart;
-
- /* input is inverted at port!!! */
- if (ipcr & IPCRDCDA) {
- port = A_PORT;
- dcdstate = !(ip & IPDCDA);
- } else if (ipcr & IPCRDCDB) {
- port = B_PORT;
- dcdstate = !(ip & IPDCDB);
- } else {
-#ifdef DIAGNOSTIC
- printf("dartmodemtrans: unknown transition ip=0x%x ipcr=0x%x\n",
- ip, ipcr);
-#endif
- return;
- }
-
- dart = &sc->sc_dart[port];
- tp = dart->tty;
- if (tp != NULL)
- ttymodem(tp, dcdstate);
-}
-
-int
-dartopen(dev_t dev, int flag, int mode, struct proc *p)
-{
- int s;
- u_int port, chip;
- struct dart_info *dart;
- struct dartsoftc *sc;
- struct tty *tp;
-
- chip = DART_CHIP(dev);
- port = DART_PORT(dev);
- if (dart_cd.cd_ndevs <= chip || port >= NDARTPORTS)
- return (ENODEV);
- sc = (struct dartsoftc *)dart_cd.cd_devs[chip];
- if (sc == NULL)
- return (ENODEV);
- dart = &sc->sc_dart[port];
-
- s = spltty();
- if (dart->tty != NULL)
- tp = dart->tty;
- else
- tp = dart->tty = ttymalloc(0);
-
- tp->t_oproc = dartstart;
- tp->t_param = dartparam;
- tp->t_dev = dev;
-
- if ((tp->t_state & TS_ISOPEN) == 0) {
- ttychars(tp);
-
- if (tp->t_ispeed == 0) {
- tp->t_iflag = TTYDEF_IFLAG;
- tp->t_oflag = TTYDEF_OFLAG;
- tp->t_lflag = TTYDEF_LFLAG;
- tp->t_ispeed = tp->t_ospeed = B9600;
- if (sc->sc_console && port == CONS_PORT) {
- /* console is 8N1 */
- tp->t_cflag = (CREAD | CS8 | HUPCL);
- } else {
- tp->t_cflag = TTYDEF_CFLAG;
- }
- }
-
- if (dart->dart_swflags & TIOCFLAG_CLOCAL)
- tp->t_cflag |= CLOCAL;
- if (dart->dart_swflags & TIOCFLAG_CRTSCTS)
- tp->t_cflag |= CRTSCTS;
- if (dart->dart_swflags & TIOCFLAG_MDMBUF)
- tp->t_cflag |= MDMBUF;
-
- dartparam(tp, &tp->t_termios);
- ttsetwater(tp);
-
- (void)dartmctl(sc, port, TIOCM_DTR | TIOCM_RTS, DMSET);
- tp->t_state |= TS_CARR_ON;
- } else if (tp->t_state & TS_XCLUDE && suser(p, 0) != 0) {
- splx(s);
- return (EBUSY);
- }
-
- /*
- * Reset the tty pointer, as there could have been a dialout
- * use of the tty with a dialin open waiting.
- */
- tp->t_dev = dev;
- splx(s);
- return ((*linesw[tp->t_line].l_open)(dev, tp, p));
-}
-
-int
-dartclose(dev_t dev, int flag, int mode, struct proc *p)
-{
- struct tty *tp;
- struct dart_info *dart;
- struct dartsoftc *sc;
- u_int port, chip;
-
- chip = DART_CHIP(dev);
- port = DART_PORT(dev);
- sc = (struct dartsoftc *)dart_cd.cd_devs[chip];
- dart = &sc->sc_dart[port];
-
- tp = dart->tty;
- (*linesw[tp->t_line].l_close)(tp, flag, p);
- ttyclose(tp);
-
- return (0);
-}
-
-int
-dartread(dev_t dev, struct uio *uio, int flag)
-{
- u_int port, chip;
- struct tty *tp;
- struct dart_info *dart;
- struct dartsoftc *sc;
-
- chip = DART_CHIP(dev);
- port = DART_PORT(dev);
- sc = (struct dartsoftc *)dart_cd.cd_devs[chip];
- dart = &sc->sc_dart[port];
-
- tp = dart->tty;
- if (tp == NULL)
- return (ENXIO);
- return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
-}
-
-int
-dartwrite(dev_t dev, struct uio *uio, int flag)
-{
- u_int port, chip;
- struct tty *tp;
- struct dart_info *dart;
- struct dartsoftc *sc;
-
- chip = DART_CHIP(dev);
- port = DART_PORT(dev);
- sc = (struct dartsoftc *)dart_cd.cd_devs[chip];
- dart = &sc->sc_dart[port];
-
- tp = dart->tty;
- if (tp == NULL)
- return (ENXIO);
- return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
-}
-
-void
-dartrint(struct dartsoftc *sc, int port)
-{
- struct tty *tp;
- unsigned char data, sr;
- struct dart_info *dart;
- bus_addr_t ptaddr;
-
- dart = &sc->sc_dart[port];
- ptaddr = port == A_PORT ? DART_A_BASE : DART_B_BASE;
- tp = dart->tty;
-
- /* read status reg */
- while ((sr = dart_read(sc, ptaddr + DART_SRA)) & RXRDY) {
- /* read data and reset receiver */
- data = dart_read(sc, ptaddr + DART_RBA);
-
- if ((tp->t_state & (TS_ISOPEN|TS_WOPEN)) == 0 &&
- (sc->sc_console == 0 || CONS_PORT != port)) {
- return;
- }
-
- if (sr & RBRK) {
- /* clear break state */
- dart_write(sc, ptaddr + DART_CRA, BRKINTRESET);
- delay(1);
- dart_write(sc, ptaddr + DART_CRA, ERRRESET);
-
-#if defined(DDB)
- if (db_console != 0 &&
- sc->sc_console && port == CONS_PORT)
- Debugger();
-#endif
- } else {
- if (sr & (FRERR | PERR | ROVRN)) { /* errors */
- if (sr & ROVRN)
- log(LOG_WARNING, "%s port %c: "
- "receiver overrun\n",
- sc->sc_dev.dv_xname, 'A' + port);
- if (sr & FRERR)
- log(LOG_WARNING, "%s port %c: "
- "framing error\n",
- sc->sc_dev.dv_xname, 'A' + port);
- if (sr & PERR)
- log(LOG_WARNING, "%s port %c: "
- "parity error\n",
- sc->sc_dev.dv_xname, 'A' + port);
- /* clear error state */
- dart_write(sc, ptaddr + DART_CRA, ERRRESET);
- } else {
- /* no errors */
- (*linesw[tp->t_line].l_rint)(data,tp);
- }
- }
- }
-}
-
-void
-dartxint(struct dartsoftc *sc, int port)
-{
- struct tty *tp;
- struct dart_info *dart;
-
- dart = &sc->sc_dart[port];
- tp = dart->tty;
-
- if ((tp->t_state & (TS_ISOPEN|TS_WOPEN))==0)
- goto out;
-
- if (tp->t_state & TS_BUSY) {
- tp->t_state &= ~(TS_BUSY | TS_FLUSH);
- dartstart(tp);
- if (tp->t_state & TS_BUSY) {
- /* do not disable transmitter, yet */
- return;
- }
- }
-out:
-
- /* disable transmitter */
- sc->sc_sv_reg->sv_imr &= port == A_PORT ? ~ITXRDYA : ~ITXRDYB;
- dart_write(sc, DART_IMR, sc->sc_sv_reg->sv_imr);
-}
-
-int
-dartintr(void *arg)
-{
- struct dartsoftc *sc = arg;
- unsigned char isr, imr;
- int port;
-
- /* read interrupt status register and mask with imr */
- isr = dart_read(sc, DART_ISR);
- imr = sc->sc_sv_reg->sv_imr;
-
- if ((isr & imr) == 0) {
- /*
- * We got an interrupt on a disabled condition (such as TX
- * ready change on a disabled port). This should not happen,
- * but we have to claim the interrupt anyway.
- */
-#ifdef DIAGNOSTIC
- printf("%s: spurious interrupt, isr %x imr %x\n",
- sc->sc_dev.dv_xname, isr, imr);
-#endif
- return (1);
- }
- isr &= imr;
-
- if (isr & IIPCHG) {
- unsigned int ip, ipcr;
-
- ip = dart_read(sc, DART_IP);
- ipcr = dart_read(sc, DART_IPCR);
- dartmodemtrans(sc, ip, ipcr);
- return (1);
- }
-
- if (isr & (IRXRDYA | ITXRDYA))
- port = 0;
-#ifdef DIAGNOSTIC
- else if ((isr & (IRXRDYB | ITXRDYB)) == 0) {
- printf("%s: spurious interrupt, isr %x\n",
- sc->sc_dev.dv_xname, isr);
- return (1); /* claim it anyway */
- }
-#endif
- else
- port = 1;
-
- if (isr & (IRXRDYA | IRXRDYB))
- dartrint(sc, port);
- if (isr & (ITXRDYA | ITXRDYB))
- dartxint(sc, port);
- if (isr & (port == A_PORT ? IBRKA : IBRKB))
- dart_write(sc, port == A_PORT ? DART_CRA : DART_CRB,
- BRKINTRESET);
-
- return (1);
-}
-
-/*
- * Console interface routines.
- */
-
-static vaddr_t dartcnva;
-static uint dartcnstride;
-
-static __inline uint8_t dart_cnread(uint);
-static __inline void dart_cnwrite(uint, uint);
-
-static __inline uint8_t
-dart_cnread(uint reg)
-{
- if (dartcnstride != 0)
- return *(volatile u_int8_t *)(dartcnva + 3 + (reg << 2));
- else
- return *(volatile u_int8_t *)(dartcnva + reg);
-}
-static __inline void
-dart_cnwrite(uint reg, uint val)
-{
- if (dartcnstride != 0)
- *(volatile u_int8_t *)(dartcnva + 3 + (reg << 2)) = val;
- else
- *(volatile u_int8_t *)(dartcnva + reg) = val;
-}
-
-
-void
-dartcnprobe(struct consdev *cp)
-{
- int maj;
-
- switch (cputyp) {
- case CPU_141:
- dartcnva = IIOV(MVME141_DART_BASE);
- dartcnstride = 0;
- break;
- case CPU_165:
- dartcnva = IIOV(MVME165_DART_BASE);
- dartcnstride = 2;
- break;
- default:
- return;
- }
-
- /* locate the major number */
- for (maj = 0; maj < nchrdev; maj++)
- if (cdevsw[maj].d_open == dartopen)
- break;
- if (maj == nchrdev)
- return;
-
- cp->cn_dev = makedev(maj, CONS_PORT);
- cp->cn_pri = CN_LOWPRI;
-}
-
-void
-dartcninit(cp)
- struct consdev *cp;
-{
- dartcn_sv.sv_mr1[CONS_PORT] = PARDIS | RXRTS | CL8;
- dartcn_sv.sv_mr2[CONS_PORT] = /* TXCTS | */ SB1;
- dartcn_sv.sv_csr[CONS_PORT] = BD9600;
- dartcn_sv.sv_cr[CONS_PORT] = TXEN | RXEN;
- dartcn_sv.sv_opr = CONS_PORT == A_PORT ? (OPDTRA | OPRTSA) :
- (OPDTRB | OPRTSB);
- dartcn_sv.sv_imr = IIPCHG;
-
- dart_cnwrite(DART_CRA, RXRESET | TXDIS | RXDIS);
- delay(1);
- dart_cnwrite(DART_CRA, TXRESET | TXDIS | RXDIS);
- delay(1);
- dart_cnwrite(DART_CRA, ERRRESET | TXDIS | RXDIS);
- delay(1);
- dart_cnwrite(DART_CRA, BRKINTRESET | TXDIS | RXDIS);
- delay(1);
- dart_cnwrite(DART_CRA, MRRESET | TXDIS | RXDIS);
- delay(1);
-
- dart_cnwrite(DART_MR1A, dartcn_sv.sv_mr1[CONS_PORT]);
- dart_cnwrite(DART_MR2A, dartcn_sv.sv_mr2[CONS_PORT]);
- dart_cnwrite(DART_CSRA, dartcn_sv.sv_csr[CONS_PORT]);
- dart_cnwrite(DART_CRA, dartcn_sv.sv_cr[CONS_PORT]);
-
- dart_cnwrite(DART_OPRS, dartcn_sv.sv_opr);
-
- dart_cnwrite(DART_IMR, dartcn_sv.sv_imr);
-}
-
-void
-dartcnputc(dev_t dev, int c)
-{
- int s;
- u_int port;
- bus_addr_t ptaddr;
-
- port = CONS_PORT;
- ptaddr = port == A_PORT ? DART_A_BASE : DART_B_BASE;
-
- s = spltty();
-
- /* inhibit interrupts on the chip */
- dart_cnwrite(DART_IMR, dartcn_sv.sv_imr &
- (CONS_PORT == A_PORT ? ~ITXRDYA : ~ITXRDYB));
- /* make sure transmitter is enabled */
-#if 0
- delay(1);
-#endif
- dart_cnwrite(ptaddr + DART_CRA, TXEN);
-
- while ((dart_cnread(ptaddr + DART_SRA) & TXRDY) == 0)
- ;
- dart_cnwrite(ptaddr + DART_TBA, c);
-
- /* wait for transmitter to empty */
- while ((dart_cnread(ptaddr + DART_SRA) & TXEMT) == 0)
- ;
-
- /* restore the previous state */
- dart_cnwrite(DART_IMR, dartcn_sv.sv_imr);
-#if 0
- delay(1);
-#endif
- dart_cnwrite(ptaddr + DART_CRA, dartcn_sv.sv_cr[0]);
-
- splx(s);
-}
-
-int
-dartcngetc(dev_t dev)
-{
- unsigned char sr; /* status reg of port a/b */
- u_char c; /* received character */
- int s;
- u_int port;
- bus_addr_t ptaddr;
-
- port = CONS_PORT;
- ptaddr = port == A_PORT ? DART_A_BASE : DART_B_BASE;
-
- s = spltty();
-
- /* enable receiver */
- dart_cnwrite(ptaddr + DART_CRA, RXEN);
-
- for (;;) {
- /* read status reg */
- sr = dart_cnread(ptaddr + DART_SRA);
-
- /* receiver interrupt handler*/
- if (sr & RXRDY) {
- /* read character from port */
- c = dart_cnread(ptaddr + DART_RBA);
-
- /* check break condition */
- if (sr & RBRK) {
- /* clear break state */
- dart_cnwrite(ptaddr + DART_CRA, BRKINTRESET);
- delay(2);
- dart_cnwrite(ptaddr + DART_CRA, ERRRESET);
- break;
- }
-
- if (sr & (FRERR | PERR | ROVRN)) {
- /* clear error state */
- dart_cnwrite(ptaddr + DART_CRA, ERRRESET);
- } else {
- break;
- }
- }
- }
- splx(s);
-
- return ((int)c);
-}
diff --git a/sys/arch/mvme68k/dev/dart_lrc.c b/sys/arch/mvme68k/dev/dart_lrc.c
deleted file mode 100644
index f0bc8d01b61..00000000000
--- a/sys/arch/mvme68k/dev/dart_lrc.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/* $OpenBSD: dart_lrc.c,v 1.2 2009/03/01 22:08:13 miod Exp $ */
-/*
- * Copyright (c) 2006, 2009, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-
-#include <mvme68k/dev/lrcreg.h>
-
-#include <mvme68k/dev/dartreg.h>
-#include <mvme68k/dev/dartvar.h>
-
-int dart_lrc_match(struct device *, void *, void *);
-void dart_lrc_attach(struct device *, struct device *, void *);
-
-struct cfattach dartlrc_ca = {
- sizeof(struct dartsoftc), dart_lrc_match, dart_lrc_attach
-};
-
-int
-dart_lrc_match(struct device *parent, void *cf, void *aux)
-{
- struct confargs *ca = aux;
-#if 0
- bus_space_handle_t ioh;
- int rc;
-#endif
-
- if (cputyp != CPU_165 || ca->ca_paddr != MVME165_DART_BASE)
- return (0);
-
-#if 0 /* overkill, this is the console so if we've run so far, it exists */
- if (bus_space_map(ca->ca_iot, ca->ca_paddr, DART_SIZE, 0, &ioh) != 0)
- return (0);
- rc = badvaddr((vaddr_t)bus_space_vaddr(ca->ca_iot, ioh) + 3, 1);
- bus_space_unmap(ca->ca_iot, ca->ca_paddr, DART_SIZE);
-
- return (rc == 0);
-#else
- return (1);
-#endif
-}
-
-void
-dart_lrc_attach(struct device *parent, struct device *self, void *aux)
-{
- struct dartsoftc *sc = (struct dartsoftc *)self;
- struct confargs *ca = aux;
- bus_space_handle_t ioh;
-
- if (ca->ca_ipl < 0)
- ca->ca_ipl = IPL_TTY;
-
- sc->sc_iot = ca->ca_iot;
- if (bus_space_map(sc->sc_iot, ca->ca_paddr, DART_SIZE, 0, &ioh) != 0) {
- printf(": can't map registers!\n");
- return;
- }
- sc->sc_ioh = ioh;
-
- sc->sc_console = 1; /* there can't be any other */
- printf(": console");
-
- /* enable interrupts */
- sc->sc_ih.ih_fn = dartintr;
- sc->sc_ih.ih_arg = sc;
- sc->sc_ih.ih_wantframe = 0;
- sc->sc_ih.ih_ipl = ca->ca_ipl;
-
- lrcintr_establish(LRCVEC_DART, &sc->sc_ih, self->dv_xname);
-
- sc->sc_vec = LRC_VECBASE + LRCVEC_DART;
- sc->sc_stride = 2;
- dart_common_attach(sc);
-}
diff --git a/sys/arch/mvme68k/dev/dart_ofobio.c b/sys/arch/mvme68k/dev/dart_ofobio.c
deleted file mode 100644
index 26b032ab5c8..00000000000
--- a/sys/arch/mvme68k/dev/dart_ofobio.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/* $OpenBSD: dart_ofobio.c,v 1.1 2009/03/01 22:08:13 miod Exp $ */
-/*
- * Copyright (c) 2006, 2009, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-
-#include <mvme68k/dev/ofobioreg.h>
-
-#include <mvme68k/dev/dartreg.h>
-#include <mvme68k/dev/dartvar.h>
-
-int dart_ofobio_match(struct device *, void *, void *);
-void dart_ofobio_attach(struct device *, struct device *, void *);
-
-struct cfattach dartofobio_ca = {
- sizeof(struct dartsoftc), dart_ofobio_match, dart_ofobio_attach
-};
-
-int
-dart_ofobio_match(struct device *parent, void *cf, void *aux)
-{
- struct confargs *ca = aux;
-#if 0
- bus_space_handle_t ioh;
- int rc;
-#endif
-
- if (cputyp != CPU_141 || ca->ca_paddr != MVME141_DART_BASE)
- return (0);
-
-#if 0 /* overkill, this is the console so if we've run so far, it exists */
- if (bus_space_map(ca->ca_iot, ca->ca_paddr, DART_SIZE, 0, &ioh) != 0)
- return (0);
- rc = badvaddr((vaddr_t)bus_space_vaddr(ca->ca_iot, ioh) + 3, 1);
- bus_space_unmap(ca->ca_iot, ca->ca_paddr, DART_SIZE);
-
- return (rc == 0);
-#else
- return (1);
-#endif
-}
-
-void
-dart_ofobio_attach(struct device *parent, struct device *self, void *aux)
-{
- struct dartsoftc *sc = (struct dartsoftc *)self;
- struct confargs *ca = aux;
- bus_space_handle_t ioh;
-
- if (ca->ca_ipl < 0)
- ca->ca_ipl = IPL_TTY;
-
- sc->sc_iot = ca->ca_iot;
- if (bus_space_map(sc->sc_iot, ca->ca_paddr, DART_SIZE, 0, &ioh) != 0) {
- printf(": can't map registers!\n");
- return;
- }
- sc->sc_ioh = ioh;
-
- sc->sc_console = 1; /* there can't be any other */
- printf(": console");
-
- /* enable interrupts */
- sc->sc_ih.ih_fn = dartintr;
- sc->sc_ih.ih_arg = sc;
- sc->sc_ih.ih_wantframe = 0;
- sc->sc_ih.ih_ipl = ca->ca_ipl;
-
- sc->sc_vec = OFOBIOVEC_DART;
- intr_establish(sc->sc_vec, &sc->sc_ih, self->dv_xname);
- sc->sc_stride = 0;
- dart_common_attach(sc);
-}
diff --git a/sys/arch/mvme68k/dev/dartreg.h b/sys/arch/mvme68k/dev/dartreg.h
deleted file mode 100644
index 35e9bebdbcb..00000000000
--- a/sys/arch/mvme68k/dev/dartreg.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/* $OpenBSD: dartreg.h,v 1.2 2009/03/01 22:08:13 miod Exp $ */
-
-#define MVME141_DART_BASE 0xfff70000
-#define MVME165_DART_BASE 0xfffd0000
-
-#define MAXPORTS 2 /* max count of PORTS/DUART */
-
-#define A_PORT 0
-#define B_PORT 1
-
-/*
- * MC68681 hardware registers.
- */
-
-#define DART_MR1A 0x00 /* RW: mode register A */
-#define DART_MR2A 0x00 /* RW: mode register A */
-#define DART_SRA 0x01 /* R: status register A */
-#define DART_CSRA 0x01 /* W: clock select register A */
-#define DART_CRA 0x02 /* W: command register A */
-#define DART_RBA 0x03 /* R: receiver buffer A */
-#define DART_TBA 0x03 /* W: transmit buffer A */
-#define DART_IPCR 0x04 /* R: input port change register */
-#define DART_ACR 0x04 /* W: auxiliary control register */
-#define DART_ISR 0x05 /* R: interrupt status register */
-#define DART_IMR 0x05 /* W: interrupt mask register */
-#define DART_CUR 0x06 /* R: count upper register */
-#define DART_CTUR 0x06 /* W: counter/timer upper register */
-#define DART_CLR 0x07 /* R: count lower register */
-#define DART_CTLR 0x07 /* W: counter/timer lower register */
-#define DART_MR1B 0x08 /* RW: mode register B */
-#define DART_MR2B 0x08 /* RW: mode register B */
-#define DART_SRB 0x09 /* R: status register B */
-#define DART_CSRB 0x09 /* W: clock select register B */
-#define DART_CRB 0x0a /* W: command register B */
-#define DART_RBB 0x0b /* R: receiver buffer B */
-#define DART_TBB 0x0b /* W: transmit buffer B */
-#define DART_IVR 0x0c /* RW: interrupt vector register */
-#define DART_IP 0x0d /* R: input port (unlatched) */
-#define DART_OPCR 0x0d /* W: output port configuration register */
-#define DART_CTSTART 0x0e /* R: start counter command */
-#define DART_OPRS 0x0e /* W: output port bit set */
-#define DART_CTSTOP 0x0f /* R: stop counter command */
-#define DART_OPRR 0x0f /* W: output port bit reset */
-
-#define DART_A_BASE 0x00
-#define DART_B_BASE 0x08
-
-/* mode register 1: MR1x operations */
-#define RXRTS 0x80 /* enable receiver RTS */
-#define PAREN 0x00 /* with parity */
-#define PARDIS 0x10 /* no parity */
-#define EVENPAR 0x00 /* even parity */
-#define ODDPAR 0x04 /* odd parity */
-#define CL5 0x00 /* 5 bits per char */
-#define CL6 0x01 /* 6 bits per char */
-#define CL7 0x02 /* 7 bits per char */
-#define CL8 0x03 /* 8 bits per char */
-#define PARMODEMASK 0x18 /* parity mode mask */
-#define PARTYPEMASK 0x04 /* parity type mask */
-#define CLMASK 0x03 /* character length mask */
-
-/* mode register 2: MR2x operations */
-#define TXRTS 0x20 /* enable transmitter RTS */
-#define TXCTS 0x10 /* enable transmitter CTS */
-#define SB2 0x0f /* 2 stop bits */
-#define SB1 0x07 /* 1 stop bit */
-#define SB1L5 0x00 /* 1 stop bit at 5 bits per character */
-
-#define SBMASK 0x0f /* stop bit mask */
-
-/* clock-select register: CSRx operations */
-#define NOBAUD -1 /* 50 and 200 baud are not possible */
- /* they are not in Baud register set 2 */
-#define BD75 0x00 /* 75 baud */
-#define BD110 0x11 /* 110 baud */
-#define BD134 0x22 /* 134.5 baud */
-#define BD150 0x33 /* 150 baud */
-#define BD300 0x44 /* 300 baud */
-#define BD600 0x55 /* 600 baud */
-#define BD1200 0x66 /* 1200 baud */
-#define BD1800 0xaa /* 1800 baud */
-#define BD2400 0x88 /* 2400 baud */
-#define BD4800 0x99 /* 4800 baud */
-#define BD9600 0xbb /* 9600 baud */
-#define BD19200 0xcc /* 19200 baud */
-
-/* channel command register: CRx operations */
-#define MRRESET 0x10 /* reset mr pointer to mr1 */
-#define RXRESET 0x20 /* reset receiver */
-#define TXRESET 0x30 /* reset transmitter */
-#define ERRRESET 0x40 /* reset error status */
-#define BRKINTRESET 0x50 /* reset channel's break interrupt */
-#define BRKSTART 0x60 /* start break */
-#define BRKSTOP 0x70 /* stop break */
-#define TXDIS 0x08 /* disable transmitter */
-#define TXEN 0x04 /* enable transmitter */
-#define RXDIS 0x02 /* disable receiver */
-#define RXEN 0x01 /* enable receiver */
-
-/* status register: SRx status */
-#define RBRK 0x80 /* received break */
-#define FRERR 0x40 /* frame error */
-#define PERR 0x20 /* parity error */
-#define ROVRN 0x10 /* receiver overrun error */
-#define TXEMT 0x08 /* transmitter empty */
-#define TXRDY 0x04 /* transmitter ready */
-#define FFULL 0x02 /* receiver FIFO full */
-#define RXRDY 0x01 /* receiver ready */
-
-/* output port configuration register: OPCR operations */
-#define OPSET 0x00 /* set all op lines to op function */
-#define OPSETTO 0x04 /* use OP3 for timer output */
-
-/* output port register: OP operations */
-#define OPDTRB 0x20 /* DTR line output b on the VME188, 181, 141 */
-#define OPDTRA 0x04 /* DTR line output a */
-#define OPRTSB 0x02 /* RTS line output b */
-#define OPRTSA 0x01 /* RTS line output a */
-
-/* auxiliary control register: ACR operations */
-#define BDSET1 0x00 /* baudrate generator set 1 */
-#define BDSET2 0x80 /* baudrate generator set 2 */
-#define CCLK1 0x60 /* timer clock: external rate. TA */
-#define CCLK16 0x30 /* counter clock: x1 clk divided by 16 */
-#define IPDCDIB 0x08 /* IP3 change == DCD input on port B */
-#define IPDCDIA 0x04 /* IP2 change == DCD input on port A */
-
-/* input port change register: IPCR operations */
-#define IPCRDCDB 0x80 /* IP3 change == DCD change on port B */
-#define IPCRDCDA 0x40 /* IP2 change == DCD change on port A */
-#define IPDCDB 0x20 /* DCD line input b */
-#define IPDCDA 0x10 /* DCD line input a */
-#define IPDSRB 0x08 /* DSR line input b */
-#define IPDSRA 0x04 /* DSR line input a */
-#define IPCTSB 0x02 /* CTS line input b */
-#define IPCTSA 0x01 /* CTS line input a */
-
-/* interrupt status and mask register: ISR status and IMR mask */
-#define IIPCHG 0x80 /* input port change */
-#define IBRKB 0x40 /* delta break b */
-#define IRXRDYB 0x20 /* receiver ready b */
-#define ITXRDYB 0x10 /* transmitter ready b */
-#define ITIMER 0x08 /* Enable timer interrupts. */
-#define IBRKA 0x04 /* delta break a */
-#define IRXRDYA 0x02 /* receiver ready a */
-#define ITXRDYA 0x01 /* transmitter ready a */
diff --git a/sys/arch/mvme68k/dev/dartvar.h b/sys/arch/mvme68k/dev/dartvar.h
deleted file mode 100644
index 3258e85911e..00000000000
--- a/sys/arch/mvme68k/dev/dartvar.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* $OpenBSD: dartvar.h,v 1.2 2009/03/01 22:08:13 miod Exp $ */
-
-/*
- * Mach Operating System
- * Copyright (c) 1993-1991 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON AND OMRON ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON AND OMRON DISCLAIM ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#define NDARTPORTS 2 /* Number of ports */
-
-struct dart_info {
- struct tty *tty;
- u_char dart_swflags;
-};
-
-/* saved registers */
-struct dart_sv_reg {
- u_int8_t sv_mr1[NDARTPORTS];
- u_int8_t sv_mr2[NDARTPORTS];
- u_int8_t sv_csr[NDARTPORTS];
- u_int8_t sv_cr[NDARTPORTS];
- u_int8_t sv_opr;
- u_int8_t sv_imr;
-};
-
-struct dartsoftc {
- struct device sc_dev;
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
- struct intrhand sc_ih;
-
- int sc_console;
- int sc_vec;
- uint sc_stride;
-
- struct dart_sv_reg *sc_sv_reg;
- struct dart_sv_reg sc_sv_reg_storage;
- struct dart_info sc_dart[NDARTPORTS];
-};
-
-void dart_common_attach(struct dartsoftc *);
-int dartintr(void *);
-
-#define DART_SIZE 0x40
diff --git a/sys/arch/mvme68k/dev/flash.c b/sys/arch/mvme68k/dev/flash.c
deleted file mode 100644
index d0be34b85f7..00000000000
--- a/sys/arch/mvme68k/dev/flash.c
+++ /dev/null
@@ -1,503 +0,0 @@
-/* $OpenBSD: flash.c,v 1.22 2010/12/26 15:40:59 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-#include <sys/uio.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/syslog.h>
-#include <sys/fcntl.h>
-#include <sys/device.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/autoconf.h>
-#include <machine/conf.h>
-#include <machine/cpu.h>
-#include <machine/mioctl.h>
-
-#include "mc.h"
-
-#if NMC > 0
-#include <mvme68k/dev/mcreg.h>
-#endif
-
-#include <mvme68k/dev/flashreg.h>
-
-struct flashsoftc {
- struct device sc_dev;
- paddr_t sc_paddr;
- volatile u_char *sc_vaddr;
- u_char sc_manu;
- u_char sc_ii;
- int sc_len;
- int sc_zonesize;
-};
-
-void flashattach(struct device *, struct device *, void *);
-int flashmatch(struct device *, void *, void *);
-
-struct cfattach flash_ca = {
- sizeof(struct flashsoftc), flashmatch, flashattach
-};
-
-struct cfdriver flash_cd = {
- NULL, "flash", DV_DULL
-};
-
-int flashwritebyte(struct flashsoftc *sc, int addr, u_char val);
-int flasherasezone(struct flashsoftc *sc, int addr);
-u_char *flashsavezone(struct flashsoftc *, int);
-int flashwritezone(struct flashsoftc *, u_char *, int);
-
-struct flashii intel_flashii[] = {
- { "28F008SA", FLII_INTEL_28F008SA, 1024*1024, 64*1024 },
- { "28F008SA-L", FLII_INTEL_28F008SA_L, 1024*1024, 64*1024 },
- { "28F016SA", FLII_INTEL_28F016SA, 1024*1024, 64*1024 },
- { NULL },
-};
-
-struct flashmanu {
- char *name;
- u_char manu;
- struct flashii *flashii;
-} flashmanu[] = {
- { "intel", FLMANU_INTEL, intel_flashii },
- { NULL, 0, NULL }
-};
-
-int
-flashmatch(parent, cf, args)
- struct device *parent;
- void *cf;
- void *args;
-{
- struct confargs *ca = args;
-
- switch (cputyp) {
-#ifdef MVME147
- case CPU_147:
- return (0);
-#endif
-#ifdef MVME165
- case CPU_165:
- return (0);
-#endif
-#ifdef MVME167
- case CPU_166:
- case CPU_167:
- /*
- * XXX: 166 has 4 byte-wide flash rams side-by-side, and
- * isn't supported (yet).
- */
- return (0);
-#endif
-#ifdef MVME177
- case CPU_176:
- case CPU_177:
- /*
- * XXX: 177 has no flash.
- */
- return (0);
-#endif
-#if defined(MVME162) || defined(MVME172)
- case CPU_162:
- case CPU_172:
- if (badpaddr(ca->ca_paddr, 1))
- return (0);
-
- if (!mc_hasflash())
- return 0;
- return (1);
-#endif
- default:
- return (0);
- }
-}
-
-void
-flashattach(parent, self, args)
- struct device *parent, *self;
- void *args;
-{
- struct flashsoftc *sc = (struct flashsoftc *)self;
- struct confargs *ca = args;
- int manu, ident;
-
- sc->sc_paddr = ca->ca_paddr;
- sc->sc_vaddr = (volatile u_char *)mapiodev(sc->sc_paddr, NBPG);
-
- switch (cputyp) {
-#ifdef MVME162
- case CPU_162:
- mc_enableflashwrite(1);
- break;
-#endif
-#ifdef MVME172
- case CPU_172:
- mc_enableflashwrite(1);
- break;
-#endif
- }
-
- /* read manufacturer and product identifier from flash */
- sc->sc_vaddr[0] = FLCMD_RESET;
- sc->sc_vaddr[0] = FLCMD_READII;
- sc->sc_manu = sc->sc_vaddr[0];
- sc->sc_ii = sc->sc_vaddr[1];
- sc->sc_vaddr[0] = FLCMD_RESET;
- for (manu = 0; flashmanu[manu].name; manu++)
- if (flashmanu[manu].manu == sc->sc_manu)
- break;
- if (flashmanu[manu].name == NULL) {
- printf(": unknown manu 0x%02x ident %02x\n",
- sc->sc_manu, sc->sc_ii);
- return;
- }
- for (ident = 0; flashmanu[manu].flashii[ident].name; ident++)
- if (flashmanu[manu].flashii[ident].ii == sc->sc_ii)
- break;
- if (flashmanu[manu].flashii[ident].name == NULL) {
- printf(": unknown manu %s ident 0x%02x\n",
- flashmanu[manu].name, sc->sc_ii);
- return;
- }
- sc->sc_len = flashmanu[manu].flashii[ident].size;
- sc->sc_zonesize = flashmanu[manu].flashii[ident].zonesize;
- printf(": %s %s len %d", flashmanu[manu].name,
- flashmanu[manu].flashii[ident].name, sc->sc_len);
-
- sc->sc_vaddr[0] = FLCMD_CLEARSTAT;
- sc->sc_vaddr[0] = FLCMD_RESET;
-
- unmapiodev((vaddr_t)sc->sc_vaddr, NBPG);
- sc->sc_vaddr = (volatile u_char *)mapiodev(sc->sc_paddr, sc->sc_len);
- if (sc->sc_vaddr == NULL) {
- sc->sc_len = 0;
- printf(" -- failed to map");
- }
- printf("\n");
-}
-
-u_char *
-flashsavezone(sc, start)
- struct flashsoftc *sc;
- int start;
-{
- u_char *zone;
-
- zone = (u_char *)malloc(sc->sc_zonesize, M_TEMP, M_WAITOK);
- sc->sc_vaddr[0] = FLCMD_RESET;
- bcopy((u_char *)&sc->sc_vaddr[start], zone, sc->sc_zonesize);
- return (zone);
-}
-
-int
-flashwritezone(sc, zone, start)
- struct flashsoftc *sc;
- u_char *zone;
- int start;
-{
- u_char sr;
- int i;
-
- for (i = 0; i < sc->sc_zonesize; i++) {
- if (zone[i] == 0xff)
- continue;
- sc->sc_vaddr[start + i] = FLCMD_WSETUP;
- sc->sc_vaddr[start + i] = zone[i];
- do {
- sc->sc_vaddr[0] = FLCMD_READSTAT;
- sr = sc->sc_vaddr[0];
- } while ((sr & FLSR_WSMS) == 0);
- if (sr & FLSR_BWS)
- return (i); /* write failed on this byte! */
- sc->sc_vaddr[0] = FLCMD_RESET;
- }
- free(zone, M_TEMP);
- return (0);
-}
-
-int
-flasherasezone(sc, addr)
- struct flashsoftc *sc;
- int addr;
-{
- u_char sr;
-
- printf("erasing zone at %d\n", addr);
-
- sc->sc_vaddr[addr] = FLCMD_ESETUP;
- sc->sc_vaddr[addr] = FLCMD_ECONFIRM;
-
- sc->sc_vaddr[0] = FLCMD_READSTAT;
- sr = sc->sc_vaddr[0];
- while ((sr & FLSR_WSMS) == 0) {
- sc->sc_vaddr[0] = FLCMD_READSTAT;
- sr = sc->sc_vaddr[0];
- }
- printf("sr=%2x\n", sr);
-
- sc->sc_vaddr[0] = FLCMD_RESET;
- if (sr & FLSR_ES)
- return (-1);
- return (0);
-}
-
-/*
- * Should add some light retry code. If a write fails see if an
- * erase helps the situation... eventually flash rams become
- * useless but perhaps we can get just one more cycle out of it.
- */
-int
-flashwritebyte(sc, addr, val)
- struct flashsoftc *sc;
- int addr;
- u_char val;
-{
- u_char sr;
-
- sc->sc_vaddr[addr] = FLCMD_CLEARSTAT;
- sr = sc->sc_vaddr[0];
- sc->sc_vaddr[addr] = FLCMD_WSETUP;
- sc->sc_vaddr[addr] = val;
- delay(9);
- do {
- sr = sc->sc_vaddr[addr];
- } while ((sr & FLSR_WSMS) == 0);
- printf("write status %2x\n", sr);
-
- sc->sc_vaddr[0] = FLCMD_RESET;
- if (sr & FLSR_BWS)
- return (-1); /* write failed! */
- return (0);
-}
-
-
-/*ARGSUSED*/
-int
-flashopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
-
- if (minor(dev) >= flash_cd.cd_ndevs ||
- flash_cd.cd_devs[minor(dev)] == NULL)
- return (ENODEV);
-
- return (0);
-}
-
-/*ARGSUSED*/
-int
-flashclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
-
- return (0);
-}
-
-/*ARGSUSED*/
-int
-flashioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- int unit = minor(dev);
- struct flashsoftc *sc = (struct flashsoftc *) flash_cd.cd_devs[unit];
- int error = 0;
-
- switch (cmd) {
- case MIOCGSIZ:
- *(int *)data = sc->sc_len;
- break;
- default:
- error = ENOTTY;
- break;
- }
- return (error);
-}
-
-/*ARGSUSED*/
-int
-flashread(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- int unit = minor(dev);
- struct flashsoftc *sc = (struct flashsoftc *) flash_cd.cd_devs[unit];
- vaddr_t v;
- int c;
- struct iovec *iov;
- int error = 0;
-
- while (uio->uio_resid > 0 && error == 0) {
- iov = uio->uio_iov;
- if (iov->iov_len == 0) {
- uio->uio_iov++;
- uio->uio_iovcnt--;
- if (uio->uio_iovcnt < 0)
- panic("flashrw");
- continue;
- }
-
- v = uio->uio_offset;
- c = min(iov->iov_len, MAXPHYS);
- if (v + c > sc->sc_len)
- c = sc->sc_len - v; /* till end of FLASH */
- if (c == 0)
- return (0);
- error = uiomove((u_char *)sc->sc_vaddr + v, c, uio);
- }
- return (error);
-}
-
-/*ARGSUSED*/
-int
-flashwrite(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- int unit = minor(dev);
- struct flashsoftc *sc = (struct flashsoftc *) flash_cd.cd_devs[unit];
- vaddr_t v;
- int c, i, r;
- struct iovec *iov;
- int error = 0;
- u_char *cmpbuf;
- int neederase = 0, needwrite = 0;
- int zonestart, zoneoff;
-
- cmpbuf = (u_char *)malloc(sc->sc_zonesize, M_TEMP, M_WAITOK);
-
- while (uio->uio_resid > 0 && error == 0) {
- iov = uio->uio_iov;
- if (iov->iov_len == 0) {
- uio->uio_iov++;
- uio->uio_iovcnt--;
- if (uio->uio_iovcnt < 0)
- panic("flashrw");
- continue;
- }
-
- /*
- * constrain to be at most a zone in size, and
- * aligned to be within that one zone only.
- */
- v = uio->uio_offset;
- zonestart = v & ~(sc->sc_zonesize - 1);
- zoneoff = v & (sc->sc_zonesize - 1);
- c = min(iov->iov_len, MAXPHYS);
- if (v + c > sc->sc_len)
- c = sc->sc_len - v; /* till end of FLASH */
- if (c > sc->sc_zonesize - zoneoff)
- c = sc->sc_zonesize - zoneoff; /* till end of zone */
- if (c == 0)
- return (0);
- error = uiomove((u_char *)cmpbuf, c, uio);
-
- /*
- * compare to see if we are going to need a block erase
- * operation.
- */
- sc->sc_vaddr[0] = FLCMD_RESET;
- for (i = 0; i < c; i++) {
- u_char x = sc->sc_vaddr[v + i];
- if (cmpbuf[i] & ~x)
- neederase = 1;
- if (cmpbuf[i] != x)
- needwrite = 1;
- }
- if (needwrite && !neederase) {
- /*
- * we don't need to erase. all the bytes being
- * written (thankfully) set bits.
- */
- for (i = 0; i < c; i++) {
- if (cmpbuf[i] == sc->sc_vaddr[v + i])
- continue;
- r = flashwritebyte(sc, v + i, cmpbuf[i]);
- if (r == 0)
- continue;
- /*
- * this doesn't make sense. we
- * thought we didn't need to erase,
- * but a write failed. let's try an
- * erase operation..
- */
- printf("%s: failed write at %d, trying erase\n",
- sc->sc_dev.dv_xname, i);
- goto tryerase;
- }
- } else if (neederase) {
- u_char *mem;
-
-tryerase:
- mem = flashsavezone(sc, zonestart);
- for (i = 0; i < c; i++)
- mem[zoneoff + i] = cmpbuf[i];
- flasherasezone(sc, zonestart);
- r = flashwritezone(sc, mem, zonestart);
- if (r) {
- printf("%s: failed at offset %x\n",
- sc->sc_dev.dv_xname, r);
- free(mem, M_TEMP);
- error = EIO;
- }
- }
- }
-
- free(cmpbuf, M_TEMP);
- return (error);
-}
-
-paddr_t
-flashmmap(dev, off, prot)
- dev_t dev;
- off_t off;
- int prot;
-{
- int unit = minor(dev);
- struct flashsoftc *sc = (struct flashsoftc *) flash_cd.cd_devs[unit];
-
- /* allow access only in RAM */
- if (off < 0 || off >= round_page(sc->sc_len))
- return (-1);
- return (sc->sc_paddr + off);
-}
diff --git a/sys/arch/mvme68k/dev/flashreg.h b/sys/arch/mvme68k/dev/flashreg.h
deleted file mode 100644
index c893654f203..00000000000
--- a/sys/arch/mvme68k/dev/flashreg.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* $OpenBSD: flashreg.h,v 1.6 2003/06/02 05:09:14 deraadt Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define FLCMD_RESET 0xff
-#define FLCMD_READII 0x90
-#define FLCMD_READSTAT 0x70
-#define FLCMD_CLEARSTAT 0x50
-#define FLCMD_ESETUP 0x20
-#define FLCMD_ECONFIRM 0xd0
-#define FLCMD_ESUSPEND 0xb0
-#define FLCMD_ERESUME 0xd0
-#define FLCMD_WSETUP 0x40
-#define FLCMD_AWSETUP 0x10
-
-#define FLSR_WSMS 0x80 /* write state machine status */
-#define FLSR_ESS 0x40 /* erase suspend status */
-#define FLSR_ES 0x20 /* erase status */
-#define FLSR_BWS 0x10 /* byte write status */
-#define FLSR_VPPS 0x08 /* Vpp status */
-
-/* manufacturers */
-#define FLMANU_INTEL 0x89
-
-/* intel parts */
-#define FLII_INTEL_28F020 0xbd
-#define FLII_INTEL_28F008SA 0xa1
-#define FLII_INTEL_28F008SA_L 0xa2
-#define FLII_INTEL_28F016SA 0xa0
-
-struct flashii {
- char *name;
- u_char ii;
- int size;
- int zonesize;
-};
diff --git a/sys/arch/mvme68k/dev/fooip.c b/sys/arch/mvme68k/dev/fooip.c
deleted file mode 100644
index abfb9b8e189..00000000000
--- a/sys/arch/mvme68k/dev/fooip.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/* $OpenBSD: fooip.c,v 1.10 2010/06/26 23:24:43 guenther Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * A sample framework for writing an IP module driver.
- */
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-#include <sys/uio.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/syslog.h>
-#include <sys/fcntl.h>
-#include <sys/device.h>
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-#include <mvme68k/dev/ipicreg.h>
-
-struct fooipregs {
- volatile u_char fooip_reg1;
- volatile u_char fooip_vec;
-};
-
-struct fooipsoftc {
- struct device sc_dev;
- struct ipicsoftc *sc_ipicsc;
- struct intrhand sc_ih;
-
- int sc_slot;
- struct fooipregs *sc_regs;
-};
-
-void fooipattach(struct device *, struct device *, void *);
-int fooipmatch(struct device *, void *, void *);
-
-struct cfattach fooip_ca = {
- sizeof(struct fooipsoftc), fooipmatch, fooipattach
-};
-
-struct cfdriver fooip_cd = {
- NULL, "fooip", DV_DULL
-};
-
-int fooipintr(void *);
-
-int
-fooipmatch(parent, cf, args)
- struct device *parent;
- void *cf;
- void *args;
-{
- return (1);
-}
-
-void
-fooipattach(parent, self, args)
- struct device *parent, *self;
- void *args;
-{
- struct fooipsoftc *sc = (struct fooipsoftc *)self;
- struct confargs *ca = args;
-
- sc->sc_ipicsc = (struct ipicsoftc *)parent;
- sc->sc_regs = (struct fooipregs *)(ca->ca_vaddr +
- IPIC_IP_REGOFFSET);
- sc->sc_slot = ca->ca_offset;
-
- /* this device uses only one interrupt */
- sc->sc_ih.ih_fn = fooipintr;
- sc->sc_ih.ih_arg = sc;
- sc->sc_ih.ih_ipl = ca->ca_ipl;
- ipicintr_establish(ca->ca_vec, &sc->sc_ih, self->dv_xname);
-
- sc->sc_regs->fooip_vec = ca->ca_vec;
- sc->sc_ipicsc->sc_ipic->ipic_irq[sc->sc_slot][0] = ca->ca_ipl |
- IPIC_IRQ_ICLR | IPIC_IRQ_IEN;
-
- printf("\n");
-}
-
-int
-fooipintr(arg)
- void *arg;
-{
- struct fooipsoftc *sc = arg;
-
- if (sc->sc_ipicsc->sc_ipic->ipic_irq[sc->sc_slot][0] & IPIC_IRQ_INT) {
- /* clear interrupt on device */
- return (1);
- }
- return (0);
-}
diff --git a/sys/arch/mvme68k/dev/i82596.h b/sys/arch/mvme68k/dev/i82596.h
deleted file mode 100644
index 87365560cd6..00000000000
--- a/sys/arch/mvme68k/dev/i82596.h
+++ /dev/null
@@ -1,307 +0,0 @@
-/* $OpenBSD: i82596.h,v 1.2 2003/06/02 05:09:14 deraadt Exp $ */
-
-/*-
- * Copyright (c) 1995 Theo de Raadt
- * Copyright (c) 1992, University of Vermont and State Agricultural College.
- * Copyright (c) 1992, Garrett A. Wollman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * Vermont and State Agricultural College and Garrett A. Wollman.
- * 4. Neither the name of the University nor the name of the author
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR AUTHOR BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Intel 82596 Ethernet chip
- * Register, bit, and structure definitions.
- *
- * Written by GAW with reference to the Clarkson Packet Driver code for this
- * chip written by Russ Nelson and others.
- *
- * Sun support added by Charles D. Cranor, 25-Oct-94
- *
- * Remade for 82596 in 32 bit mode by Per Fogelstrom.
- */
-
-struct ie_en_addr {
- u_char data[6];
-};
-
-/*
- * This is the master configuration block. It tells the hardware where all
- * the rest of the stuff is.
- */
-struct ie_sys_conf_ptr {
- u_char mbz1[3]; /* must be zero */
- u_char ie_bus_use; /* true if 8-bit only */
- u_char mbz2[4]; /* must be zero */
- u_int ie_iscp_ptr; /* physaddr of ISCP */
-};
-
-/*
- * The tells the hardware where all the rest of the stuff is, too.
- * FIXME: some of these should be re-commented after we figure out their
- * REAL function.
- */
-struct ie_int_sys_conf_ptr {
- u_char mbz1[1]; /* must be zero */
- u_char ie_busy; /* zeroed after init */
- u_short ie_mbz2; /* must be zero */
- u_int ie_base; /* 32-bit physaddr for all vars */
-};
-
-/*
- * This FINALLY tells the hardware what to do and where to put it.
- */
-struct ie_sys_ctl_block {
- u_short ie_status; /* status word */
- u_short ie_command; /* command word */
- u_int ie_command_list; /* 32-pointer to command block list */
- u_int ie_recv_list; /* 32-pointer to receive frame list */
- u_int ie_err_crc; /* CRC errors */
- u_int ie_err_align; /* Alignment errors */
- u_int ie_err_resource; /* Resource errors */
- u_int ie_err_overrun; /* Overrun errors */
- u_int ie_err_coll; /* Receive packets collision errors */
- u_int ie_err_short; /* Short frames recived errors */
- u_short ie_off_timer; /* Bus Throttle OFF timer */
- u_short ie_on_timer; /* Bus Throttle ON timer */
-};
-
-/* Command values */
-#define IE_RU_COMMAND 0x0070 /* mask for RU command */
-#define IE_RU_NOP 0 /* for completeness */
-#define IE_RU_START 0x0010 /* start receive unit command */
-#define IE_RU_ENABLE 0x0020 /* enable receiver command */
-#define IE_RU_DISABLE 0x0030 /* disable receiver command */
-#define IE_RU_ABORT 0x0040 /* abort current receive operation */
-
-#define IE_CU_COMMAND 0x0700 /* mask for CU command */
-#define IE_CU_NOP 0 /* included for completeness */
-#define IE_CU_START 0x0100 /* do-command command */
-#define IE_CU_RESUME 0x0200 /* resume a suspended cmd list */
-#define IE_CU_STOP 0x0300 /* SUSPEND was already taken */
-#define IE_CU_ABORT 0x0400 /* abort current command */
-#define IE_CU_THROTTLE 0x0500 /* load new throttle valuse */
-
-#define IE_ACK_COMMAND 0xf000 /* mask for ACK command */
-#define IE_ACK_CX 0x8000 /* ack IE_ST_DONE */
-#define IE_ACK_FR 0x4000 /* ack IE_ST_RECV */
-#define IE_ACK_CNA 0x2000 /* ack IE_ST_ALLDONE */
-#define IE_ACK_RNR 0x1000 /* ack IE_ST_RNR */
-
-#define IE_ACTION_COMMAND(x) (((x) & IE_CU_COMMAND) == IE_CU_START)
- /* is this command an action command? */
-
-/* Status values */
-#define IE_ST_WHENCE 0xf000 /* mask for cause of interrupt */
-#define IE_ST_DONE 0x8000 /* command with I bit completed */
-#define IE_ST_RECV 0x4000 /* frame received */
-#define IE_ST_ALLDONE 0x2000 /* all commands completed */
-#define IE_ST_RNR 0x1000 /* receive not ready */
-
-#define IE_CU_STATUS 0x700 /* mask for command unit status */
-#define IE_CU_ACTIVE 0x200 /* command unit is active */
-#define IE_CU_SUSPEND 0x100 /* command unit is suspended */
-
-#define IE_RU_STATUS 0x70 /* mask for receiver unit status */
-#define IE_RU_SUSPEND 0x10 /* receiver is suspended */
-#define IE_RU_NOSPACE 0x20 /* receiver has no resources */
-#define IE_RU_READY 0x40 /* reveiver is ready */
-
-/*
- * This is filled in partially by the chip, partially by us.
- */
-struct ie_recv_frame_desc {
- u_short ie_fd_status; /* status for this frame */
- u_short ie_fd_last; /* end of frame list flag */
- u_int ie_fd_next; /* 32-pointer to next RFD */
- u_int ie_fd_buf_desc; /* 32-pointer to list of buffer desc's */
- u_short ie_fd_actual; /* Actual count */
- u_short ie_fd_size; /* Size */
- struct ie_en_addr dest; /* destination ether */
- struct ie_en_addr src; /* source ether */
- u_short ie_length; /* 802 length/Ether type */
- u_short mbz; /* must be zero */
-};
-
-#define IE_FD_LAST 0x8000 /* last rfd in list */
-#define IE_FD_SUSP 0x4000 /* suspend RU after receipt */
-
-#define IE_FD_COMPLETE 0x8000 /* frame is complete */
-#define IE_FD_BUSY 0x4000 /* frame is busy */
-#define IE_FD_OK 0x2000 /* frame is bad */
-#define IE_FD_RNR 0x0200 /* receiver out of resources here */
-#define IE_FD_FLEX 0x0008 /* use flexible buffer scheeme */
-
-/*
- * linked list of buffers...
- */
-struct ie_recv_buf_desc {
- u_short ie_rbd_actual; /* status for this buffer */
- u_short ie_mbz1;
- u_int ie_rbd_next; /* pointer to next RBD */
- u_int ie_rbd_buffer; /* pointer to buffer for this RBD */
- u_short ie_rbd_length; /* length of the buffer */
- u_short mbz; /* must be zero */
-};
-
-#define IE_RBD_LAST 0x8000 /* last buffer */
-#define IE_RBD_USED 0x4000 /* this buffer has data */
-/*
- * All commands share this in common.
- */
-struct ie_cmd_common {
- u_short ie_cmd_status; /* status of this command */
- u_short ie_cmd_cmd; /* command word */
- u_int ie_cmd_link; /* link to next command */
-};
-
-#define IE_STAT_COMPL 0x8000 /* command is completed */
-#define IE_STAT_BUSY 0x4000 /* command is running now */
-#define IE_STAT_OK 0x2000 /* command completed successfully */
-#define IE_STAT_ABORT 0x1000 /* command was aborted */
-
-
-#define IE_CMD_NOP 0x0000 /* NOP */
-#define IE_CMD_IASETUP 0x0001 /* initial address setup */
-#define IE_CMD_CONFIG 0x0002 /* configure command */
-#define IE_CMD_MCAST 0x0003 /* multicast setup command */
-#define IE_CMD_XMIT 0x0004 /* transmit command */
-#define IE_CMD_TDR 0x0005 /* time-domain reflectometer command */
-#define IE_CMD_DUMP 0x0006 /* dump command */
-#define IE_CMD_DIAGNOSE 0x0007 /* diagnostics command */
-
-#define IE_CMD_LAST 0x8000 /* this is the last command in the list */
-#define IE_CMD_SUSPEND 0x4000 /* suspend CU after this command */
-#define IE_CMD_INTR 0x2000 /* post an interrupt after completion */
-#define IE_CMD_FLEX 0x0008 /* use flexible format */
-
-/*
- * This is the command to transmit a frame.
- */
-struct ie_xmit_cmd {
- struct ie_cmd_common com; /* common part */
-#define ie_xmit_status com.ie_cmd_status
-
- u_int ie_xmit_desc; /* pointer to buffer descriptor */
- u_short ie_xmit_count; /* Tcb count field */
- u_short ie_mbz1;
- struct ie_en_addr ie_xmit_addr; /* destination address */
-
- u_short ie_xmit_length; /* 802.3 length/Ether type field */
-};
-
-#define IE_XS_MAXCOLL 0x000f /* number of collisions during transmit */
-#define IE_XS_EXCMAX 0x0020 /* exceeded maximum number of collisions */
-#define IE_XS_SQE 0x0040 /* SQE positive */
-#define IE_XS_DEFERRED 0x0080 /* transmission deferred */
-#define IE_XS_UNDERRUN 0x0100 /* DMA underrun */
-#define IE_XS_LOSTCTS 0x0200 /* Lost CTS */
-#define IE_XS_NOCARRIER 0x0400 /* No Carrier */
-
-/*
- * This is a buffer descriptor for a frame to be transmitted.
- */
-
-struct ie_xmit_buf {
- u_short ie_xmit_flags; /* see below */
- u_short mbz1; /* Must be zero */
- u_int ie_xmit_next; /* pointer to next desc. */
- u_int ie_xmit_buf; /* pointer to the actual buffer */
-};
-
-#define IE_XMIT_LAST 0x8000 /* this TBD is the last one */
-/* The rest of the `flags' word is actually the length. */
-
-/*
- * Multicast setup command.
- */
-
-#define MAXMCAST 250 /* must fit in transmit buffer */
-
-struct ie_mcast_cmd {
- struct ie_cmd_common com; /* common part */
-#define ie_mcast_status com.ie_cmd_status
-
- u_short ie_mcast_bytes; /* size (in bytes) of multicast addresses */
- struct ie_en_addr ie_mcast_addrs[MAXMCAST + 1]; /* space for them */
-};
-
-/*
- * Time Domain Reflectometer command.
- */
-
-struct ie_tdr_cmd {
- struct ie_cmd_common com; /* common part */
-#define ie_tdr_status com.ie_cmd_status
-
- u_short ie_tdr_time; /* error bits and time */
- u_short ie_mbz1;
-};
-
-#define IE_TDR_SUCCESS 0x8000 /* TDR succeeded without error */
-#define IE_TDR_XCVR 0x4000 /* detected a transceiver problem */
-#define IE_TDR_OPEN 0x2000 /* detected an open */
-#define IE_TDR_SHORT 0x1000 /* TDR detected a short */
-#define IE_TDR_TIME 0x07ff /* mask for reflection time */
-
-/*
- * Initial Address Setup command
- */
-struct ie_iasetup_cmd {
- struct ie_cmd_common com;
-#define ie_iasetup_status com.ie_cmd_status
-
- struct ie_en_addr ie_address;
-
- u_short ie_mbz1;
-};
-
-/*
- * Configuration command
- */
-struct ie_config_cmd {
- struct ie_cmd_common com; /* common part */
-#define ie_config_status com.ie_cmd_status
-
- u_char ie_config_count; /* byte count (0x0c) */
- u_char ie_fifo; /* fifo (8) */
- u_char ie_save_bad; /* save bad frames (0x40) */
- u_char ie_addr_len; /* address length (0x2e) (AL-LOC==1) */
- u_char ie_priority; /* priority and backoff (0x0) */
- u_char ie_ifs; /* inter-frame spacing (0x60) */
- u_char ie_slot_low; /* slot time, LSB (0x0) */
- u_char ie_slot_high; /* slot time, MSN, and retries (0xf2) */
- u_char ie_promisc; /* 1 if promiscuous, else 0 */
- u_char ie_crs_cdt; /* CSMA/CD parameters (0x0) */
- u_char ie_min_len; /* min frame length (0x40) */
- u_char ie_junk; /* stuff for 82596 (0xff) */
- u_char ie_dplx;
- u_char ie_miabf;
-};
-
diff --git a/sys/arch/mvme68k/dev/if_ie.c b/sys/arch/mvme68k/dev/if_ie.c
deleted file mode 100644
index 0dbc9be09a3..00000000000
--- a/sys/arch/mvme68k/dev/if_ie.c
+++ /dev/null
@@ -1,1914 +0,0 @@
-/* $OpenBSD: if_ie.c,v 1.43 2013/11/30 20:24:45 miod Exp $ */
-
-/*-
- * Copyright (c) 1999 Steve Murphree, Jr.
- * Copyright (c) 1995 Theo de Raadt
- * Copyright (c) 1993, 1994, 1995 Charles Hannum.
- * Copyright (c) 1992, 1993, University of Vermont and State
- * Agricultural College.
- * Copyright (c) 1992, 1993, Garrett A. Wollman.
- *
- * Portions:
- * Copyright (c) 1994, 1995, Rafal K. Boni
- * Copyright (c) 1990, 1991, William F. Jolitz
- * Copyright (c) 1990, The Regents of the University of California
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Charles Hannum, by the
- * University of Vermont and State Agricultural College and Garrett A.
- * Wollman, by William F. Jolitz, and by the University of California,
- * Berkeley, Lawrence Berkeley Laboratory, and its contributors.
- * 4. Neither the names of the Universities nor the names of the authors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR AUTHORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Intel 82596 Ethernet chip
- * Register, bit, and structure definitions.
- *
- * Original StarLAN driver written by Garrett Wollman with reference to the
- * Clarkson Packet Driver code for this chip written by Russ Nelson and others.
- *
- * BPF support code taken from hpdev/if_le.c, supplied with tcpdump.
- *
- * 3C507 support is loosely based on code donated to NetBSD by Rafal Boni.
- *
- * Majorly cleaned up and 3C507 code merged by Charles Hannum.
- *
- * Converted to SUN ie driver by Charles D. Cranor,
- * October 1994, January 1995.
- * This sun version based on i386 version 1.30.
- */
-
-extern void *etherbuf;
-extern int etherlen;
-
-/*
-Mode of operation:
-
- We run the 82596 in a standard Ethernet mode. We keep NFRAMES
- received frame descriptors around for the receiver to use, and
- NRXBUF associated receive buffer descriptors, both in a circular
- list. Whenever a frame is received, we rotate both lists as
- necessary. (The 596 treats both lists as a simple queue.) We also
- keep a transmit command around so that packets can be sent off
- quickly.
-
- We configure the adapter in AL-LOC = 1 mode, which means that the
- Ethernet/802.3 MAC header is placed at the beginning of the receive
- buffer rather than being split off into various fields in the RFD.
- This also means that we must include this header in the transmit
- buffer as well.
-
- By convention, all transmit commands, and only transmit commands,
- shall have the I (IE_CMD_INTR) bit set in the command. This way,
- when an interrupt arrives at ieintr(), it is immediately possible
- to tell what precisely caused it. ANY OTHER command-sending
- routines should run at splnet(), and should post an acknowledgement
- to every interrupt they generate.
-
-*/
-
-#include "bpfilter.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/mbuf.h>
-#include <sys/buf.h>
-#include <sys/protosw.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/errno.h>
-#include <sys/syslog.h>
-#include <sys/device.h>
-
-#include <net/if.h>
-#include <net/if_types.h>
-#include <net/if_dl.h>
-#include <net/netisr.h>
-#include <net/route.h>
-
-#if NBPFILTER > 0
-#include <net/bpf.h>
-#include <net/bpfdesc.h>
-#endif
-
-#ifdef INET
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-#include <netinet/if_ether.h>
-#endif
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-#include <machine/pmap.h>
-
-#include "mc.h"
-#include "pcctwo.h"
-
-#if NMC > 0
-#include <mvme68k/dev/mcreg.h>
-#endif
-#if NPCCTWO > 0
-#include <mvme68k/dev/pcctworeg.h>
-#endif
-
-#include <mvme68k/dev/if_ie.h>
-#include <mvme68k/dev/i82596.h>
-
-static struct mbuf *last_not_for_us;
-struct vm_map *ie_map; /* for obio */
-
-#define IED_RINT 0x01
-#define IED_TINT 0x02
-#define IED_RNR 0x04
-#define IED_CNA 0x08
-#define IED_READFRAME 0x10
-#define IED_ALL 0x1f
-
-#define ETHER_MIN_LEN 64
-#define ETHER_MAX_LEN 1518
-#define ETHER_ADDR_LEN 6
-
-#define B_PER_F 3 /* recv buffers per frame */
-#define MXFRAMES 300 /* max number of recv frames */
-#define MXRXBUF (MXFRAMES*B_PER_F) /* number of buffers to allocate */
-#define IE_RBUF_SIZE 256 /* size of each receive buffer;
- MUST BE POWER OF TWO */
-#define NTXBUF 2 /* number of transmit commands */
-#define IE_TBUF_SIZE ETHER_MAX_LEN /* length of transmit buffer */
-
-struct ie_softc {
- struct device sc_dev; /* device structure */
- struct intrhand sc_ih, sc_failih; /* interrupt info */
- char sc_failintrname[16 + 4];
-
- caddr_t sc_iobase; /* KVA of base of 24 bit addr space */
- caddr_t sc_maddr; /* KVA of base of chip's RAM (16bit addr sp.)*/
- u_int sc_msize; /* how much RAM we have/use */
- vaddr_t sc_reg; /* KVA of car's register */
- int sc_bustype;
-
- struct arpcom sc_arpcom;/* system arpcom structure */
-
- void (*reset_596)(void *); /* card dependent reset function */
- void (*chan_attn)(void *); /* card dependent attn function */
- void (*run_596)(void *); /* card dependent "go on-line" func */
- void (*memcopy)(const void *, void *, size_t);
- /* card dependent memory copy function */
- void (*memzero)(void *, size_t);
- /* card dependent memory zero function */
- int want_mcsetup; /* mcsetup flag */
- int promisc; /* are we in promisc mode? */
-
- /*
- * pointers to the 3 major control structures
- */
-
- volatile struct ie_sys_conf_ptr *scp;
- volatile struct ie_int_sys_conf_ptr *iscp;
- volatile struct ie_sys_ctl_block *scb;
-
- /*
- * pointer and size of a block of KVA where the buffers
- * are to be allocated from
- */
-
- caddr_t buf_area;
- int buf_area_sz;
-
- /*
- * the actual buffers (recv and xmit)
- */
-
- volatile struct ie_recv_frame_desc *rframes[MXFRAMES];
- volatile struct ie_recv_buf_desc *rbuffs[MXRXBUF];
- volatile char *cbuffs[MXRXBUF];
- int rfhead, rftail, rbhead, rbtail;
-
- volatile struct ie_xmit_cmd *xmit_cmds[NTXBUF];
- volatile struct ie_xmit_buf *xmit_buffs[NTXBUF];
- u_char *xmit_cbuffs[NTXBUF];
- int xmit_busy;
- int xmit_free;
- int xchead, xctail;
-
- struct ie_en_addr mcast_addrs[MAXMCAST + 1];
- int mcast_count;
-
- int nframes; /* number of frames in use */
- int nrxbuf; /* number of recv buffs in use */
-
-#ifdef IEDEBUG
- int sc_debug;
-#endif
-};
-
-void ie_obreset(void *);
-void ie_obattend(void *);
-void ie_obrun(void *);
-
-void iewatchdog(struct ifnet *);
-int ieintr(void *);
-int iefailintr(void *);
-int ieinit(struct ie_softc *);
-int ieioctl(struct ifnet *, u_long, caddr_t);
-void iestart(struct ifnet *);
-void iereset(struct ie_softc *);
-void ie_readframe(struct ie_softc *, int);
-void ie_drop_packet_buffer(struct ie_softc *);
-int command_and_wait(struct ie_softc *, int,
- void volatile *, int);
-void ierint(struct ie_softc *);
-void ietint(struct ie_softc *);
-void setup_bufs(struct ie_softc *);
-int mc_setup(struct ie_softc *, void *);
-void mc_reset(struct ie_softc *);
-
-void ie_setup_config(volatile struct ie_config_cmd *, int, int);
-void ie_ack(struct ie_softc *, u_int);
-int ether_equal(u_char *, u_char *);
-int check_eh(struct ie_softc *, struct ether_header *, int *);
-int ie_buflen(struct ie_softc *, int);
-int ie_packet_len(struct ie_softc *);
-void iexmit(struct ie_softc *);
-int ieget(struct ie_softc *, struct mbuf **, struct ether_header *, int *);
-int ie_setupram(struct ie_softc *);
-void run_tdr(struct ie_softc *, struct ie_tdr_cmd *);
-void iestop(struct ie_softc *);
-
-#ifdef IEDEBUG
-void print_rbd(volatile struct ie_recv_buf_desc *);
-
-int in_ierint = 0;
-int in_ietint = 0;
-#endif
-
-int iematch(struct device *, void *, void *);
-void ieattach(struct device *, struct device *, void *);
-
-struct cfattach ie_ca = {
- sizeof(struct ie_softc), iematch, ieattach
-};
-
-struct cfdriver ie_cd = {
- NULL, "ie", DV_IFNET
-};
-
-/*
- * address generation macros
- */
-/* Make 32 bit value from swapped data (err counters access) */
-#define MK_32(ptr) ((((u_int)(ptr) >> 16) & 0xffff) | ((u_int)(ptr) << 16))
-
-#define MKADR_32(ptr) \
- ((caddr_t)((((u_int)(ptr) >> 16) & 0xffff) | \
- (((u_int)(ptr) << 16)) + UNCACHED_MEMORY_ADDR))
-
-/* *NOTE* The next macros also converts to physical address! */
-#define ASWAP(ptr) ((((u_int)(ptr) >> 16) & 0x1fff) | ((u_int)(ptr) << 16))
-
-#define SWT_32(to, from) { \
- u_int *t = (u_int *)&to; \
- *t = ((((u_int)from >> 16) & 0x1fff) | ((u_int)from << 16)); \
- }
-/*
- * Here are a few useful functions. We could have done these as macros, but
- * since we have the inline facility, it makes sense to use that instead.
- */
-void
-ie_setup_config(cmd, promiscuous, manchester)
- volatile struct ie_config_cmd *cmd;
- int promiscuous, manchester;
-{
-
- cmd->ie_config_count = 0x0e;
- cmd->ie_fifo = 0xc8;
- cmd->ie_save_bad = 0x40;
- cmd->ie_addr_len = 0x2e;
- cmd->ie_priority = 0;
- cmd->ie_ifs = 0x60;
- cmd->ie_slot_low = 0;
- cmd->ie_slot_high = 0xf2;
- cmd->ie_promisc = !!promiscuous | manchester << 2;
- cmd->ie_crs_cdt = 0;
- cmd->ie_min_len = 64;
- cmd->ie_junk = 0xff;
- cmd->ie_dplx = 0x00;
- cmd->ie_miabf = 0x3f;
-}
-
-void
-ie_ack(sc, mask)
- struct ie_softc *sc;
- u_int mask;
-{
- volatile struct ie_sys_ctl_block *scb = sc->scb;
-
- command_and_wait(sc, scb->ie_status & mask, 0, 0);
-}
-
-int
-iematch(parent, vcf, args)
- struct device *parent;
- void *vcf, *args;
-{
- struct confargs *ca = args;
-
- return (!badvaddr((vaddr_t)ca->ca_vaddr, 4));
-}
-
-/*
- * Deep Magic: reset it, then set SCP address again. Pray.
- */
-void
-ie_obreset(arg)
- void *arg;
-{
- struct ie_softc *sc = (struct ie_softc *)arg;
- volatile struct ieob *ieo = (struct ieob *)sc->sc_reg;
- volatile int t;
- u_long a;
-
- a = IE_PORT_RESET;
- ieo->porthigh = a & 0xffff;
- t = 0; t = 1;
- ieo->portlow = a >> 16;
- delay(1000);
-
- pmap_extract(pmap_kernel(), (vaddr_t)sc->scp, &a);
- a |= IE_PORT_NEWSCPADDR;
- ieo->porthigh = a & 0xffff;
- t = 0; t = 1;
- ieo->portlow = a >> 16;
- delay(1000);
-}
-
-void
-ie_obattend(arg)
- void *arg;
-{
- struct ie_softc *sc = (struct ie_softc *)arg;
- volatile struct ieob *ieo = (struct ieob *)sc->sc_reg;
-
- ieo->attn = 1;
-}
-
-/* ARGSUSED */
-void
-ie_obrun(arg)
- void *arg;
-{
-}
-
-/*
- * Taken almost exactly from Bill's if_is.c, then modified beyond recognition.
- */
-void
-ieattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct ie_softc *sc = (void *) self;
- struct confargs *ca = aux;
- struct ifnet *ifp = &sc->sc_arpcom.ac_if;
- extern void myetheraddr(u_char *); /* should be elsewhere */
- int pri = ca->ca_ipl;
- volatile struct ieob *ieo;
- paddr_t pa;
-
- sc->reset_596 = ie_obreset;
- sc->chan_attn = ie_obattend;
- sc->run_596 = ie_obrun;
- sc->memcopy = bcopy;
- sc->memzero = bzero;
- sc->sc_msize = etherlen;
- sc->sc_reg = ca->ca_vaddr;
- ieo = (volatile struct ieob *)sc->sc_reg;
-
- /* get the first available etherbuf */
- sc->sc_maddr = etherbuf; /* maddr = vaddr */
- if (sc->sc_maddr == NULL) panic("ie: too many ethernet boards");
- if (pmap_extract(pmap_kernel(), (vaddr_t)sc->sc_maddr, &pa) == FALSE)
- panic("ie: pmap_extract");
- sc->sc_iobase = (caddr_t)pa; /* iobase = paddr (24 bit) */
-
- /*printf("maddrP %x iobaseV %x\n", sc->sc_maddr, sc->sc_iobase);*/
-
- (sc->memzero)(sc->sc_maddr, sc->sc_msize);
- sc->iscp = (volatile struct ie_int_sys_conf_ptr *)
- sc->sc_maddr; /* @@ location zero */
- sc->scb = (volatile struct ie_sys_ctl_block *)
- roundup((int)sc->iscp + sizeof(struct ie_int_sys_conf_ptr), 16);
- sc->scp = (struct ie_sys_conf_ptr *)
- roundup((int)sc->scb + sizeof(struct ie_sys_ctl_block), 16);
- /*printf("scpV %x iscpV %x scbV %x\n", sc->scp, sc->iscp, sc->scb);*/
-
- sc->scp->ie_bus_use = 0x44;
- pmap_extract(pmap_kernel(), (vaddr_t)sc->iscp, &pa);
- SWT_32(sc->scp->ie_iscp_ptr, pa);
- /*
- * rest of first page is unused (wasted!), rest of ram
- * for buffers
- */
- sc->buf_area = sc->sc_maddr + NBPG;
- sc->buf_area_sz = sc->sc_msize - NBPG;
- myetheraddr(sc->sc_arpcom.ac_enaddr);
-
- if (ie_setupram(sc) == 0) {
- printf(": RAM CONFIG FAILED!\n");
- /* XXX should reclaim resources? */
- return;
- }
- bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ);
- ifp->if_softc = sc;
- ifp->if_start = iestart;
- ifp->if_ioctl = ieioctl;
- ifp->if_watchdog = iewatchdog;
- ifp->if_flags =
- IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS | IFF_MULTICAST;
-
- /* Attach the interface. */
- if_attach(ifp);
- ether_ifattach(ifp);
-
- printf(": address %s\n", ether_sprintf(sc->sc_arpcom.ac_enaddr));
-
- sc->sc_bustype = ca->ca_bustype;
-
- sc->sc_ih.ih_fn = ieintr;
- sc->sc_ih.ih_arg = sc;
- sc->sc_ih.ih_ipl = pri;
- sc->sc_failih.ih_fn = iefailintr;
- sc->sc_failih.ih_arg = sc;
- sc->sc_failih.ih_ipl = pri;
-
- snprintf(sc->sc_failintrname, sizeof sc->sc_failintrname, "%s_err", self->dv_xname);
-
- switch (sc->sc_bustype) {
-#if NMC > 0
- case BUS_MC:
- mcintr_establish(MCV_IE, &sc->sc_ih, self->dv_xname);
- sys_mc->mc_ieirq = pri | MC_SC_SNOOP | MC_IRQ_IEN |
- MC_IRQ_ICLR;
- mcintr_establish(MCV_IEFAIL, &sc->sc_failih,
- sc->sc_failintrname);
- sys_mc->mc_iefailirq = pri | MC_IRQ_IEN | MC_IRQ_ICLR;
- break;
-#endif
-#if NPCCTWO > 0
- case BUS_PCCTWO:
- pcctwointr_establish(PCC2V_IE, &sc->sc_ih, self->dv_xname);
- switch (cputyp) {
-#ifdef MVME177
- case CPU_176:
- case CPU_177:
- /* no snooping on 68060 */
- sys_pcc2->pcc2_ieirq = pri | PCC2_SC_INHIBIT |
- PCC2_IRQ_IEN | PCC2_IRQ_ICLR;
- break;
-#endif
- default:
- sys_pcc2->pcc2_ieirq = pri | PCC2_SC_SNOOP |
- PCC2_IRQ_IEN | PCC2_IRQ_ICLR;
- }
- pcctwointr_establish(PCC2V_IEFAIL, &sc->sc_failih,
- sc->sc_failintrname);
- sys_pcc2->pcc2_iefailirq = pri | PCC2_IRQ_IEN |
- PCC2_IRQ_ICLR;
- break;
-#endif
- }
-}
-
-/*
- * Device timeout/watchdog routine. Entered if the device neglects to generate
- * an interrupt after a transmit has been started on it.
- */
-void
-iewatchdog(ifp)
- struct ifnet *ifp;
-{
- struct ie_softc *sc = ifp->if_softc;
-
- log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname);
- ++sc->sc_arpcom.ac_if.if_oerrors;
-
- iereset(sc);
-}
-
-int
-iefailintr(v)
-void *v;
-{
- struct ie_softc *sc = v;
-
- switch (sc->sc_bustype) {
-#if NMC > 0
- case BUS_MC:
- sys_mc->mc_ieirq |= MC_IRQ_ICLR; /* safe: clear irq */
- sys_mc->mc_iefailirq |= MC_IRQ_ICLR; /* clear failure */
- sys_mc->mc_ieerr = MC_IEERR_SCLR; /* reset error */
- break;
-#endif
-#if NPCCTWO > 0
- case BUS_PCCTWO:
- sys_pcc2->pcc2_ieirq |= PCC2_IRQ_ICLR; /* safe: clear irq */
- sys_pcc2->pcc2_iefailirq |= PCC2_IRQ_ICLR; /* clear failure */
- sys_pcc2->pcc2_ieerr = PCC2_IEERR_SCLR; /* reset error */
- break;
-#endif
- }
-
- iereset(sc);
- return (1);
-}
-
-/*
- * What to do upon receipt of an interrupt.
- */
-int
-ieintr(v)
-void *v;
-{
- struct ie_softc *sc = v;
- register u_short status;
-
- status = sc->scb->ie_status;
-/*printf("I");*/
-
-loop:
- /* Ack interrupts FIRST in case we receive more during the ISR. */
- ie_ack(sc, IE_ST_WHENCE & status);
- switch (sc->sc_bustype) {
-#if NMC > 0
- case BUS_MC:
- sys_mc->mc_ieirq |= MC_IRQ_ICLR; /* clear irq */
- break;
-#endif
-#if NPCCTWO > 0
- case BUS_PCCTWO:
- sys_pcc2->pcc2_ieirq |= PCC2_IRQ_ICLR; /* clear irq */
- break;
-#endif
- }
-
- if (status & (IE_ST_RECV | IE_ST_RNR)) {
-#ifdef IEDEBUG
- in_ierint++;
- if (sc->sc_debug & IED_RINT)
- printf("%s: rint\n", sc->sc_dev.dv_xname);
-#endif
- ierint(sc);
-#ifdef IEDEBUG
- in_ierint--;
-#endif
- }
-
- if (status & IE_ST_DONE) {
-#ifdef IEDEBUG
- in_ietint++;
- if (sc->sc_debug & IED_TINT)
- printf("%s: tint\n", sc->sc_dev.dv_xname);
-#endif
- ietint(sc);
-#ifdef IEDEBUG
- in_ietint--;
-#endif
- }
-
- if (status & IE_ST_RNR) {
- printf("%s: receiver not ready\n", sc->sc_dev.dv_xname);
- sc->sc_arpcom.ac_if.if_ierrors++;
- iereset(sc);
- }
-
-#ifdef IEDEBUG
- if ((status & IE_ST_ALLDONE) && (sc->sc_debug & IED_CNA))
- printf("%s: cna\n", sc->sc_dev.dv_xname);
-#endif
-
- if ((status = sc->scb->ie_status) & IE_ST_WHENCE)
- goto loop;
-
- return 1;
-}
-
-/*
- * Process a received-frame interrupt.
- */
-void
-ierint(sc)
- struct ie_softc *sc;
-{
- volatile struct ie_sys_ctl_block *scb = sc->scb;
- int i, status;
- static int timesthru = 1024;
-
- i = sc->rfhead;
- for (;;) {
- status = sc->rframes[i]->ie_fd_status;
-
- if ((status & IE_FD_COMPLETE) && (status & IE_FD_OK)) {
- sc->sc_arpcom.ac_if.if_ipackets++;
- if (!--timesthru) {
- sc->sc_arpcom.ac_if.if_ierrors +=
- MK_32(scb->ie_err_crc) +
- MK_32(scb->ie_err_align) +
- MK_32(scb->ie_err_resource) +
- MK_32(scb->ie_err_overrun) +
- MK_32(scb->ie_err_coll) +
- MK_32(scb->ie_err_short);
- scb->ie_err_crc = 0;
- scb->ie_err_align = 0;
- scb->ie_err_resource = 0;
- scb->ie_err_overrun = 0;
- scb->ie_err_coll = 0;
- scb->ie_err_short = 0;
- timesthru = 1024;
- }
- ie_readframe(sc, i);
- } else {
- if ((status & IE_FD_RNR) != 0 &&
- (scb->ie_status & IE_RU_READY) == 0) {
- sc->rframes[0]->ie_fd_buf_desc = ASWAP(sc->rbuffs[0]);
- scb->ie_recv_list = ASWAP(sc->rframes[0]);
- command_and_wait(sc, IE_RU_START, 0, 0);
- }
- break;
- }
- i = (i + 1) % sc->nframes;
- }
-}
-
-/*
- * Process a command-complete interrupt. These are only generated by the
- * transmission of frames. This routine is deceptively simple, since most of
- * the real work is done by iestart().
- */
-void
-ietint(sc)
- struct ie_softc *sc;
-{
- int status;
-
- sc->sc_arpcom.ac_if.if_timer = 0;
- sc->sc_arpcom.ac_if.if_flags &= ~IFF_OACTIVE;
-
- status = sc->xmit_cmds[sc->xctail]->ie_xmit_status;
-
- if (!(status & IE_STAT_COMPL) || (status & IE_STAT_BUSY))
- printf("ietint: command still busy!\n");
-
- if (status & IE_STAT_OK) {
- sc->sc_arpcom.ac_if.if_opackets++;
- sc->sc_arpcom.ac_if.if_collisions += status & IE_XS_MAXCOLL;
- } else if (status & IE_STAT_ABORT) {
- sc->sc_arpcom.ac_if.if_oerrors++;
- } else if (status & IE_XS_NOCARRIER) {
- sc->sc_arpcom.ac_if.if_oerrors++;
- } else if (status & IE_XS_LOSTCTS) {
- sc->sc_arpcom.ac_if.if_oerrors++;
- } else if (status & IE_XS_UNDERRUN) {
- sc->sc_arpcom.ac_if.if_oerrors++;
- } else if (status & IE_XS_EXCMAX) {
- sc->sc_arpcom.ac_if.if_collisions += 16;
- sc->sc_arpcom.ac_if.if_oerrors++;
- }
-
- /*
- * If multicast addresses were added or deleted while transmitting,
- * mc_reset() set the want_mcsetup flag indicating that we should do
- * it.
- */
- if (sc->want_mcsetup) {
- mc_setup(sc, (caddr_t)sc->xmit_cbuffs[sc->xctail]);
- sc->want_mcsetup = 0;
- }
-
- /* Done with the buffer. */
- sc->xmit_free++;
- sc->xmit_busy = 0;
- sc->xctail = (sc->xctail + 1) % NTXBUF;
-
- iestart(&sc->sc_arpcom.ac_if);
-}
-
-/*
- * Compare two Ether/802 addresses for equality, inlined and unrolled for
- * speed. I'd love to have an inline assembler version of this...
- */
-int
-ether_equal(one, two)
- u_char *one, *two;
-{
-
- if (one[0] != two[0] || one[1] != two[1] || one[2] != two[2] ||
- one[3] != two[3] || one[4] != two[4] || one[5] != two[5])
- return 0;
- return 1;
-}
-
-/*
- * Check for a valid address. to_bpf is filled in with one of the following:
- * 0 -> BPF doesn't get this packet
- * 1 -> BPF does get this packet
- * 2 -> BPF does get this packet, but we don't
- * Return value is true if the packet is for us, and false otherwise.
- *
- * This routine is a mess, but it's also critical that it be as fast
- * as possible. It could be made cleaner if we can assume that the
- * only client which will fiddle with IFF_PROMISC is BPF. This is
- * probably a good assumption, but we do not make it here. (Yet.)
- */
-int
-check_eh(sc, eh, to_bpf)
- struct ie_softc *sc;
- struct ether_header *eh;
- int *to_bpf;
-{
- int i;
-
- switch(sc->promisc) {
- case IFF_ALLMULTI:
- /*
- * Receiving all multicasts, but no unicasts except those
- * destined for us.
- */
-#if NBPFILTER > 0
- *to_bpf = (sc->sc_arpcom.ac_if.if_bpf != 0); /* BPF gets this packet if anybody cares */
-#endif
- if (eh->ether_dhost[0] & 1)
- return 1;
- if (ether_equal(eh->ether_dhost, sc->sc_arpcom.ac_enaddr)) return 1;
- return 0;
-
- case IFF_PROMISC:
- /*
- * Receiving all packets. These need to be passed on to BPF.
- */
-#if NBPFILTER > 0
- *to_bpf = (sc->sc_arpcom.ac_if.if_bpf != 0) ||
- (sc->sc_arpcom.ac_if.if_bridgeport != NULL);
-#else
- *to_bpf = (sc->sc_arpcom.ac_if.if_bridgeport != NULL);
-#endif
- /* If for us, accept and hand up to BPF */
- if (ether_equal(eh->ether_dhost, sc->sc_arpcom.ac_enaddr)) return 1;
-
-#if NBPFILTER > 0
- if (*to_bpf && sc->sc_arpcom.ac_if.if_bridgeport == NULL)
- *to_bpf = 2; /* we don't need to see it */
-#endif
-
- /*
- * Not a multicast, so BPF wants to see it but we don't.
- */
- if (!(eh->ether_dhost[0] & 1))
- return 1;
-
- /*
- * If it's one of our multicast groups, accept it and pass it
- * up.
- */
- for (i = 0; i < sc->mcast_count; i++) {
- if (ether_equal(eh->ether_dhost, (u_char *)&sc->mcast_addrs[i])) {
-#if NBPFILTER > 0
- if (*to_bpf)
- *to_bpf = 1;
-#endif
- return 1;
- }
- }
- return 1;
-
- case IFF_ALLMULTI | IFF_PROMISC:
- /*
- * Acting as a multicast router, and BPF running at the same
- * time. Whew! (Hope this is a fast machine...)
- */
-#if NBPFILTER > 0
- *to_bpf = (sc->sc_arpcom.ac_if.if_bpf != 0) ||
- (sc->sc_arpcom.ac_if.if_bridgeport != NULL);
-#else
- *to_bpf = (sc->sc_arpcom.ac_if.if_bridgeport != NULL);
-#endif
- /* We want to see multicasts. */
- if (eh->ether_dhost[0] & 1)
- return 1;
-
- /* We want to see our own packets */
- if (ether_equal(eh->ether_dhost, sc->sc_arpcom.ac_enaddr))
- return 1;
-
- /* Anything else goes to BPF but nothing else. */
-#if NBPFILTER > 0
- if (*to_bpf && sc->sc_arpcom.ac_if.if_bridgeport == NULL)
- *to_bpf = 2;
-#endif
- return 1;
-
- default:
- /*
- * Only accept unicast packets destined for us, or multicasts
- * for groups that we belong to. For now, we assume that the
- * '596 will only return packets that we asked it for. This
- * isn't strictly true (it uses hashing for the multicast
- * filter), but it will do in this case, and we want to get out
- * of here as quickly as possible.
- */
-#if NBPFILTER > 0
- *to_bpf = (sc->sc_arpcom.ac_if.if_bpf != 0);
-#endif
- return 1;
- }
- return 0;
-}
-
-/*
- * We want to isolate the bits that have meaning... This assumes that
- * IE_RBUF_SIZE is an even power of two. If somehow the act_len exceeds
- * the size of the buffer, then we are screwed anyway.
- */
-int
-ie_buflen(sc, head)
- struct ie_softc *sc;
- int head;
-{
-
- return (sc->rbuffs[head]->ie_rbd_actual & (IE_RBUF_SIZE | (IE_RBUF_SIZE - 1)));
-}
-
-int
-ie_packet_len(sc)
- struct ie_softc *sc;
-{
- int i;
- int head = sc->rbhead;
- int acc = 0;
-
- do {
- if (!(sc->rbuffs[sc->rbhead]->ie_rbd_actual & IE_RBD_USED)) {
-#ifdef IEDEBUG
- print_rbd(sc->rbuffs[sc->rbhead]);
-#endif
- log(LOG_ERR, "%s: receive descriptors out of sync at %d\n",
- sc->sc_dev.dv_xname, sc->rbhead);
- iereset(sc);
- return -1;
- }
-
- i = sc->rbuffs[head]->ie_rbd_actual & IE_RBD_LAST;
-
- acc += ie_buflen(sc, head);
- head = (head + 1) % sc->nrxbuf;
- } while (!i);
-
- return acc;
-}
-
-/*
- * Setup all necessary artifacts for an XMIT command, and then pass the XMIT
- * command to the chip to be executed. On the way, if we have a BPF listener
- * also give him a copy.
- */
-void
-iexmit(sc)
- struct ie_softc *sc;
-{
-
-#if NBPFILTER > 0
- /*
- * If BPF is listening on this interface, let it see the packet before
- * we push it on the wire.
- */
- if (sc->sc_arpcom.ac_if.if_bpf)
- bpf_tap(sc->sc_arpcom.ac_if.if_bpf,
- sc->xmit_cbuffs[sc->xctail],
- sc->xmit_buffs[sc->xctail]->ie_xmit_flags,
- BPF_DIRECTION_OUT);
-#endif
-
-#if 0
-printf("iexmit base %x cmd %x bfd %x to %x\n",
-sc->sc_maddr,
-sc->xmit_cmds[sc->xctail],
-sc->xmit_buffs[sc->xctail],
-sc->xmit_cbuffs[sc->xctail]);
-#endif
- sc->xmit_buffs[sc->xctail]->ie_xmit_flags |= IE_XMIT_LAST;
- sc->xmit_buffs[sc->xctail]->ie_xmit_next = 0xffffffff;
- SWT_32(sc->xmit_buffs[sc->xctail]->ie_xmit_buf,
- sc->xmit_cbuffs[sc->xctail]);
-
- sc->xmit_cmds[sc->xctail]->com.ie_cmd_link = 0xffffffff;
- sc->xmit_cmds[sc->xctail]->com.ie_cmd_cmd =
- IE_CMD_XMIT | IE_CMD_INTR | IE_CMD_LAST | IE_CMD_FLEX;
-
- sc->xmit_cmds[sc->xctail]->ie_xmit_status = 0;
- sc->xmit_cmds[sc->xctail]->ie_xmit_desc =
- ASWAP(sc->xmit_buffs[sc->xctail]);
- sc->xmit_cmds[sc->xctail]->ie_xmit_count = 0;
-
- sc->scb->ie_command_list =
- ASWAP(sc->xmit_cmds[sc->xctail]);
- command_and_wait(sc, IE_CU_START, 0, 0);
-
- sc->xmit_busy = 1;
- sc->sc_arpcom.ac_if.if_timer = 5;
-}
-
-/*
- * Read data off the interface, and turn it into an mbuf chain.
- *
- * This code is DRAMATICALLY different from the previous version; this
- * version tries to allocate the entire mbuf chain up front, given the
- * length of the data available. This enables us to allocate mbuf
- * clusters in many situations where before we would have had a long
- * chain of partially-full mbufs. This should help to speed up the
- * operation considerably. (Provided that it works, of course.)
- */
-int
-ieget(sc, mp, ehp, to_bpf)
- struct ie_softc *sc;
- struct mbuf **mp;
- struct ether_header *ehp;
- int *to_bpf;
-{
- struct mbuf *m, *top, **mymp;
- int i;
- int offset = 0;
- int totlen, resid;
- int thismboff;
- int head;
-
- totlen = ie_packet_len(sc);
- if (totlen <= 0)
- return -1;
-
- i = sc->rbhead;
-
- /*
- * Snarf the Ethernet header.
- */
- (sc->memcopy)((caddr_t)sc->cbuffs[i], (caddr_t)ehp, sizeof *ehp);
-
- /*
- * As quickly as possible, check if this packet is for us.
- * If not, don't waste a single cycle copying the rest of the
- * packet in.
- * This is only a consideration when FILTER is defined; i.e., when
- * we are either running BPF or doing multicasting.
- */
- if (!check_eh(sc, ehp, to_bpf)) {
- ie_drop_packet_buffer(sc);
- sc->sc_arpcom.ac_if.if_ierrors--; /* just this case, it's not an error */
- return -1;
- }
-
- MGETHDR(*mp, M_DONTWAIT, MT_DATA);
- if (!*mp) {
- ie_drop_packet_buffer(sc);
- return -1;
- }
-
- m = *mp;
- m->m_pkthdr.rcvif = &sc->sc_arpcom.ac_if;
- m->m_len = MHLEN;
- resid = m->m_pkthdr.len = totlen;
- top = 0;
- mymp = &top;
-
- /*
- * This loop goes through and allocates mbufs for all the data we will
- * be copying in. It does not actually do the copying yet.
- */
- do { /* while (resid > 0) */
- /*
- * Try to allocate an mbuf to hold the data that we have. If
- * we already allocated one, just get another one and stick it
- * on the end (eventually). If we don't already have one, try
- * to allocate an mbuf cluster big enough to hold the whole
- * packet, if we think it's reasonable, or a single mbuf which
- * may or may not be big enough.
- * Got that?
- */
- if (top) {
- MGET(m, M_DONTWAIT, MT_DATA);
- if (!m) {
- m_freem(top);
- ie_drop_packet_buffer(sc);
- return -1;
- }
- m->m_len = MLEN;
- }
-
- if (resid >= MINCLSIZE) {
- MCLGET(m, M_DONTWAIT);
- if (m->m_flags & M_EXT)
- m->m_len = min(resid, MCLBYTES);
- } else {
- if (resid < m->m_len) {
- if (!top && resid + max_linkhdr <= m->m_len)
- m->m_data += max_linkhdr;
- m->m_len = resid;
- }
- }
- resid -= m->m_len;
- *mymp = m;
- mymp = &m->m_next;
- } while (resid > 0);
-
- resid = totlen;
- m = top;
- thismboff = 0;
- head = sc->rbhead;
-
- /*
- * Now we take the mbuf chain (hopefully only one mbuf most of the
- * time) and stuff the data into it. There are no possible failures at
- * or after this point.
- */
- while (resid > 0) { /* while there's stuff left */
- int thislen = ie_buflen(sc, head) - offset;
-
- /*
- * If too much data for the current mbuf, then fill the current
- * one up, go to the next one, and try again.
- */
- if (thislen > m->m_len - thismboff) {
- int newlen = m->m_len - thismboff;
- (sc->memcopy)((caddr_t)(sc->cbuffs[head] + offset),
- mtod(m, caddr_t) + thismboff, (u_int)newlen);
- m = m->m_next;
- thismboff = 0; /* new mbuf, so no offset */
- offset += newlen; /* we are now this far
- into the packet */
- resid -= newlen; /* so there is this much
- left to get */
- continue;
- }
-
- /*
- * If there is more than enough space in the mbuf to hold the
- * contents of this buffer, copy everything in, advance
- * pointers and so on.
- */
- if (thislen < m->m_len - thismboff) {
- (sc->memcopy)((caddr_t)(sc->cbuffs[head] + offset),
- mtod(m, caddr_t) + thismboff, (u_int)thislen);
- thismboff += thislen; /* we are this far into the mbuf */
- resid -= thislen; /* and this much is left */
- goto nextbuf;
- }
-
- /*
- * Otherwise, there is exactly enough space to put this
- * buffer's contents into the current mbuf. Do the combination
- * of the above actions.
- */
- (sc->memcopy)((caddr_t)(sc->cbuffs[head] + offset),
- mtod(m, caddr_t) + thismboff, (u_int)thislen);
- m = m->m_next;
- thismboff = 0; /* new mbuf, start at the beginning */
- resid -= thislen; /* and we are this far through */
-
- /*
- * Advance all the pointers. We can get here from either of
- * the last two cases, but never the first.
- */
- nextbuf:
- offset = 0;
- sc->rbuffs[head]->ie_rbd_actual = 0;
- sc->rbuffs[head]->ie_rbd_length |= IE_RBD_LAST;
- sc->rbhead = head = (head + 1) % sc->nrxbuf;
- sc->rbuffs[sc->rbtail]->ie_rbd_length &= ~IE_RBD_LAST;
- sc->rbtail = (sc->rbtail + 1) % sc->nrxbuf;
- }
-
- /*
- * Unless something changed strangely while we were doing the copy, we
- * have now copied everything in from the shared memory.
- * This means that we are done.
- */
- return 0;
-}
-
-/*
- * Read frame NUM from unit UNIT (pre-cached as IE).
- *
- * This routine reads the RFD at NUM, and copies in the buffers from the list
- * of RBD, then rotates the RBD and RFD lists so that the receiver doesn't
- * start complaining. Trailers are DROPPED---there's no point in wasting time
- * on confusing code to deal with them. Hopefully, this machine will never ARP
- * for trailers anyway.
- */
-void
-ie_readframe(sc, num)
- struct ie_softc *sc;
- int num; /* frame number to read */
-{
- int status;
- struct mbuf *m = 0;
- struct ether_header eh;
-#if NBPFILTER > 0
- int bpf_gets_it = 0;
-#endif
-
- status = sc->rframes[num]->ie_fd_status;
-
- /* Immediately advance the RFD list, since we have copied ours now. */
- sc->rframes[num]->ie_fd_status = 0;
- sc->rframes[num]->ie_fd_actual = 0;
- sc->rframes[num]->ie_fd_last |= IE_FD_LAST;
- sc->rframes[sc->rftail]->ie_fd_last &= ~IE_FD_LAST;
- sc->rftail = (sc->rftail + 1) % sc->nframes;
- sc->rfhead = (sc->rfhead + 1) % sc->nframes;
-
- if (status & IE_FD_OK) {
-#if NBPFILTER > 0
- if (ieget(sc, &m, &eh, &bpf_gets_it)) {
-#else
- if (ieget(sc, &m, &eh, 0)) {
-#endif
- sc->sc_arpcom.ac_if.if_ierrors++;
- return;
- }
- }
-
-#ifdef IEDEBUG
- if (sc->sc_debug & IED_READFRAME)
- printf("%s: frame from ether %s type %x\n", sc->sc_dev.dv_xname,
- ether_sprintf(eh.ether_shost), (u_int)eh.ether_type);
-#endif
-
- if (!m)
- return;
-
- if (last_not_for_us) {
- m_freem(last_not_for_us);
- last_not_for_us = 0;
- }
-
-#if NBPFILTER > 0
- /* Check for a BPF filter; if so, hand it up. */
- if (bpf_gets_it)
- bpf_mtap(sc->sc_arpcom.ac_if.if_bpf, m, BPF_DIRECTION_IN);
-
- /*
- * A signal passed up from the filtering code indicating that the
- * packet is intended for BPF but not for the protocol machinery.
- * We can save a few cycles by not handing it off to them.
- */
- if (bpf_gets_it == 2) {
- last_not_for_us = m;
- return;
- }
-#endif /* NBPFILTER > 0 */
-
- /*
- * In here there used to be code to check destination addresses upon
- * receipt of a packet. We have deleted that code, and replaced it
- * with code to check the address much earlier in the cycle, before
- * copying the data in; this saves us valuable cycles when operating
- * as a multicast router or when using BPF.
- */
-
- /*
- * Finally pass this packet up to higher layers.
- */
- ether_input_mbuf(&sc->sc_arpcom.ac_if, m);
-}
-
-void
-ie_drop_packet_buffer(sc)
- struct ie_softc *sc;
-{
- int i;
-
- do {
- /*
- * This means we are somehow out of sync. So, we reset the
- * adapter.
- */
- if (!(sc->rbuffs[sc->rbhead]->ie_rbd_actual & IE_RBD_USED)) {
-#ifdef IEDEBUG
- print_rbd(sc->rbuffs[sc->rbhead]);
-#endif
- log(LOG_ERR, "%s: receive descriptors out of sync at %d\n",
- sc->sc_dev.dv_xname, sc->rbhead);
- iereset(sc);
- return;
- }
-
- i = sc->rbuffs[sc->rbhead]->ie_rbd_actual & IE_RBD_LAST;
-
- sc->rbuffs[sc->rbhead]->ie_rbd_length |= IE_RBD_LAST;
- sc->rbuffs[sc->rbhead]->ie_rbd_actual = 0;
- sc->rbhead = (sc->rbhead + 1) % sc->nrxbuf;
- sc->rbuffs[sc->rbtail]->ie_rbd_length &= ~IE_RBD_LAST;
- sc->rbtail = (sc->rbtail + 1) % sc->nrxbuf;
- } while (!i);
-}
-
-
-/*
- * Start transmission on an interface.
- */
-void
-iestart(ifp)
- struct ifnet *ifp;
-{
- struct ie_softc *sc = ifp->if_softc;
- struct mbuf *m0, *m;
- u_char *buffer;
- u_short len;
-
-/*printf("iestart\n");*/
- if ((ifp->if_flags & IFF_RUNNING) == 0)
- return;
-
- if (sc->xmit_free == 0) {
- ifp->if_flags |= IFF_OACTIVE;
- if (!sc->xmit_busy)
- iexmit(sc);
- return;
- }
-
- do {
- IF_DEQUEUE(&sc->sc_arpcom.ac_if.if_snd, m);
- if (!m)
- break;
-
- len = 0;
- buffer = sc->xmit_cbuffs[sc->xchead];
-
- for (m0 = m; m && (len +m->m_len) < IE_TBUF_SIZE;
- m = m->m_next) {
- bcopy(mtod(m, caddr_t), buffer, m->m_len);
- buffer += m->m_len;
- len += m->m_len;
- }
- if (m)
- printf("%s: tbuf overflow\n", sc->sc_dev.dv_xname);
-
- m_freem(m0);
-
- if (len < ETHER_MIN_LEN - ETHER_CRC_LEN) {
- bzero(buffer, ETHER_MIN_LEN - ETHER_CRC_LEN - len);
- len = ETHER_MIN_LEN - ETHER_CRC_LEN;
- buffer += ETHER_MIN_LEN - ETHER_CRC_LEN;
- }
-
- sc->xmit_buffs[sc->xchead]->ie_xmit_flags = len;
-
- sc->xmit_free--;
- sc->xchead = (sc->xchead + 1) % NTXBUF;
- } while (sc->xmit_free > 0);
-
- /* If we stuffed any packets into the card's memory, send now. */
- if ((sc->xmit_free < NTXBUF) && (!sc->xmit_busy))
- iexmit(sc);
-
- return;
-}
-
-/*
- * set up IE's ram space
- */
-int
-ie_setupram(sc)
- struct ie_softc *sc;
-{
- volatile struct ie_int_sys_conf_ptr *iscp;
- volatile struct ie_sys_ctl_block *scb;
- int s;
-
- s = splnet();
-
- iscp = sc->iscp;
- (sc->memzero)((char *) iscp, sizeof *iscp);
-
- scb = sc->scb;
- (sc->memzero)((char *) scb, sizeof *scb);
- scb->ie_off_timer = 10;
- scb->ie_on_timer = 10000;
-
- iscp->ie_busy = 1; /* ie_busy == char */
- SWT_32(iscp->ie_base, sc->scb);
-
- (sc->reset_596) (sc);
- (sc->chan_attn) (sc);
-
- delay(100); /* wait a while... */
-
- if (iscp->ie_busy) {
- splx(s);
- return 0;
- }
- /*
- * Acknowledge any interrupts we may have caused...
- */
- ie_ack(sc, IE_ST_WHENCE);
- splx(s);
-
- return 1;
-}
-
-void
-iereset(sc)
- struct ie_softc *sc;
-{
- int s = splnet();
-
- printf("%s: reset\n", sc->sc_dev.dv_xname);
-
- /* Clear OACTIVE in case we're called from watchdog (frozen xmit). */
- sc->sc_arpcom.ac_if.if_flags &= ~(IFF_UP | IFF_OACTIVE);
- ieioctl(&sc->sc_arpcom.ac_if, SIOCSIFFLAGS, 0);
-
- /*
- * Stop i82596 dead in its tracks.
- */
- if (command_and_wait(sc, IE_RU_ABORT | IE_CU_ABORT, 0, 0))
- printf("%s: abort commands timed out\n", sc->sc_dev.dv_xname);
-
- if (command_and_wait(sc, IE_RU_DISABLE | IE_CU_STOP, 0, 0))
- printf("%s: disable commands timed out\n", sc->sc_dev.dv_xname);
-
-#ifdef notdef
- if (!check_ie_present(sc, sc->sc_maddr, sc->sc_msize))
- panic("ie disappeared!");
-#endif
-
- sc->sc_arpcom.ac_if.if_flags |= IFF_UP;
- ieioctl(&sc->sc_arpcom.ac_if, SIOCSIFFLAGS, 0);
-
- splx(s);
-}
-
-#if 0
-/*
- * This is called if we time out.
- */
-void
-chan_attn_timeout(rock)
- caddr_t rock;
-{
-
- *(int *)rock = 1;
-}
-#endif
-
-/*
- * Send a command to the controller and wait for it to either complete
- * or be accepted, depending on the command. If the command pointer
- * is null, then pretend that the command is not an action command.
- * If the command pointer is not null, and the command is an action
- * command, wait for
- * ((volatile struct ie_cmd_common *)pcmd)->ie_cmd_status & MASK
- * to become true.
- */
-int
-command_and_wait(sc, cmd, pcmd, mask)
- struct ie_softc *sc;
- int cmd;
- volatile void *pcmd;
- int mask;
-{
- volatile struct ie_cmd_common *cc = pcmd;
- volatile struct ie_sys_ctl_block *scb = sc->scb;
- volatile int timedout = 0;
-#if 0
- struct timeout chan_tmo;
- extern int hz;
-#endif
-
- scb->ie_command = (u_short)cmd;
-
- if (IE_ACTION_COMMAND(cmd) && pcmd) {
- (sc->chan_attn)(sc);
-
-#if 0
- /*
- * XXX
- * I don't think this timeout works on suns.
- * we are at splnet() in the loop, and the timeout
- * stuff runs at software spl (so it is masked off?).
- */
-
- /*
- * According to the packet driver, the minimum timeout should
- * be .369 seconds, which we round up to .4.
- */
- timeout_set(&chan_tmo, chan_attn_timeout, (caddr_t)&timedout);
- timeout_add(&chan_tmo, 2 * hz / 5);
-#endif
-
- /*
- * Now spin-lock waiting for status. This is not a very nice
- * thing to do, but I haven't figured out how, or indeed if, we
- * can put the process waiting for action to sleep. (We may
- * be getting called through some other timeout running in the
- * kernel.)
- */
- for (;;)
- if ((cc->ie_cmd_status & mask) || timedout)
- break;
-#if 0
- timeout_del(&chan_tmo);
-#endif
-
- return timedout;
- } else {
- /*
- * Otherwise, just wait for the command to be accepted.
- */
- (sc->chan_attn)(sc);
-
- while (scb->ie_command)
- ; /* XXX spin lock */
-
- return 0;
- }
-}
-
-/*
- * Run the time-domain reflectometer.
- */
-void
-run_tdr(sc, cmd)
- struct ie_softc *sc;
- struct ie_tdr_cmd *cmd;
-{
- int result;
-
- cmd->com.ie_cmd_status = 0;
- cmd->com.ie_cmd_cmd = IE_CMD_TDR | IE_CMD_LAST;
- cmd->com.ie_cmd_link = 0xffffffff;
-
- sc->scb->ie_command_list = ASWAP(cmd);
- cmd->ie_tdr_time = 0;
-
- if (command_and_wait(sc, IE_CU_START, cmd, IE_STAT_COMPL) ||
- !(cmd->com.ie_cmd_status & IE_STAT_OK))
- result = 0x10000; /* XXX */
- else
- result = cmd->ie_tdr_time;
-
- ie_ack(sc, IE_ST_WHENCE);
-
- if (result & IE_TDR_SUCCESS)
- return;
-
- if (result & 0x10000)
- printf("%s: TDR command failed\n", sc->sc_dev.dv_xname);
- else if (result & IE_TDR_XCVR) {
-#ifdef IEDEBUG
- printf("%s: transceiver problem\n", sc->sc_dev.dv_xname);
-#endif
- } else if (result & IE_TDR_OPEN)
- printf("%s: TDR detected an open %d clocks away\n",
- sc->sc_dev.dv_xname, result & IE_TDR_TIME);
- else if (result & IE_TDR_SHORT)
- printf("%s: TDR detected a short %d clocks away\n",
- sc->sc_dev.dv_xname, result & IE_TDR_TIME);
- else
- printf("%s: TDR returned unknown status %x\n",
- sc->sc_dev.dv_xname, result);
-}
-
-#ifdef notdef
-/* ALIGN works on 8 byte boundaries.... but 4 byte boundaries are ok for sun */
-#define _ALLOC(p, n) (bzero(p, n), p += n, p - n)
-#define ALLOC(p, n) _ALLOC(p, ALIGN(n)) /* XXX convert to this? */
-#endif
-
-#define Align(ptr) ((caddr_t)(((u_long)(ptr) + 3) & ~3L))
-
-/*
- * setup_bufs: set up the buffers
- *
- * we have a block of KVA at sc->buf_area which is of size sc->buf_area_sz.
- * this is to be used for the buffers. the chip indexs its control data
- * structures with 16 bit offsets, and it indexes actual buffers with
- * 24 bit addresses. so we should allocate control buffers first so that
- * we don't overflow the 16 bit offset field. The number of transmit
- * buffers is fixed at compile time.
- *
- * note: this function was written to be easy to understand, rather than
- * highly efficient (it isn't in the critical path).
- */
-void
-setup_bufs(sc)
- struct ie_softc *sc;
-{
- caddr_t ptr = sc->buf_area; /* memory pool */
- int n, r;
-
- /*
- * step 0: zero memory and figure out how many recv buffers and
- * frames we can have. XXX CURRENTLY HARDWIRED AT MAX
- */
- (sc->memzero)(ptr, sc->buf_area_sz);
- ptr = Align(ptr); /* set alignment and stick with it */
-
- n = (int)Align(sizeof(struct ie_xmit_cmd)) +
- (int)Align(sizeof(struct ie_xmit_buf)) + IE_TBUF_SIZE;
- n *= NTXBUF; /* n = total size of xmit area */
-
- n = sc->buf_area_sz - n;/* n = free space for recv stuff */
-
- r = (int)Align(sizeof(struct ie_recv_frame_desc)) +
- (((int)Align(sizeof(struct ie_recv_buf_desc)) + IE_RBUF_SIZE) * B_PER_F);
-
- /* r = size of one R frame */
-
- sc->nframes = n / r;
- if (sc->nframes <= 0)
- panic("ie: bogus buffer calc");
- if (sc->nframes > MXFRAMES)
- sc->nframes = MXFRAMES;
-
- sc->nrxbuf = sc->nframes * B_PER_F;
-
-#ifdef IEDEBUG
- printf("IEDEBUG: %d frames %d bufs\n", sc->nframes, sc->nrxbuf);
-#endif
-
- /*
- * step 1a: lay out and zero frame data structures for transmit and recv
- */
- for (n = 0; n < NTXBUF; n++) {
- sc->xmit_cmds[n] = (volatile struct ie_xmit_cmd *) ptr;
- ptr = Align(ptr + sizeof(struct ie_xmit_cmd));
- }
-
- for (n = 0; n < sc->nframes; n++) {
- sc->rframes[n] = (volatile struct ie_recv_frame_desc *) ptr;
- ptr = Align(ptr + sizeof(struct ie_recv_frame_desc));
- }
-
- /*
- * step 1b: link together the recv frames and set EOL on last one
- */
- for (n = 0; n < sc->nframes; n++) {
- sc->rframes[n]->ie_fd_last = IE_FD_FLEX;
- sc->rframes[n]->ie_fd_size = 0;
- sc->rframes[n]->ie_fd_next =
- ASWAP(sc->rframes[(n + 1) % sc->nframes]);
- }
- sc->rframes[sc->nframes - 1]->ie_fd_last |= IE_FD_LAST;
-
- /*
- * step 2a: lay out and zero frame buffer structures for xmit and recv
- */
- for (n = 0; n < NTXBUF; n++) {
- sc->xmit_buffs[n] = (volatile struct ie_xmit_buf *) ptr;
- ptr = Align(ptr + sizeof(struct ie_xmit_buf));
- }
-
- for (n = 0; n < sc->nrxbuf; n++) {
- sc->rbuffs[n] = (volatile struct ie_recv_buf_desc *) ptr;
- ptr = Align(ptr + sizeof(struct ie_recv_buf_desc));
- }
-
- /*
- * step 2b: link together recv bufs and set EOL on last one
- */
- for (n = 0; n < sc->nrxbuf; n++) {
- sc->rbuffs[n]->ie_rbd_next =
- ASWAP(sc->rbuffs[(n + 1) % sc->nrxbuf]);
- }
- sc->rbuffs[sc->nrxbuf - 1]->ie_rbd_length |= IE_RBD_LAST;
-
- /*
- * step 3: allocate the actual data buffers for xmit and recv
- * recv buffer gets linked into recv_buf_desc list here
- */
- for (n = 0; n < NTXBUF; n++) {
- sc->xmit_cbuffs[n] = (u_char *) ptr;
- ptr = Align(ptr + IE_TBUF_SIZE);
- }
-
- /* Pointers to last packet sent and next available transmit buffer. */
- sc->xchead = sc->xctail = 0;
-
- /* Clear transmit-busy flag and set number of free transmit buffers. */
- sc->xmit_busy = 0;
- sc->xmit_free = NTXBUF;
-
- for (n = 0; n < sc->nrxbuf; n++) {
- sc->cbuffs[n] = (char *) ptr; /* XXX why char vs uchar? */
- sc->rbuffs[n]->ie_rbd_length = IE_RBUF_SIZE;
- SWT_32(sc->rbuffs[n]->ie_rbd_buffer, ptr);
- ptr = Align(ptr + IE_RBUF_SIZE);
- }
-
- /*
- * step 4: set the head and tail pointers on receive to keep track of
- * the order in which RFDs and RBDs are used. link in recv frames
- * and buffer into the scb.
- */
-
- sc->rfhead = 0;
- sc->rftail = sc->nframes - 1;
- sc->rbhead = 0;
- sc->rbtail = sc->nrxbuf - 1;
-
- sc->scb->ie_recv_list = ASWAP(sc->rframes[0]);
- sc->rframes[0]->ie_fd_buf_desc = ASWAP(sc->rbuffs[0]);
-
-#ifdef IEDEBUG
- printf("IE_DEBUG: reserved %d bytes\n", ptr - sc->buf_area);
-#endif
-}
-
-/*
- * Run the multicast setup command.
- * Called at splnet().
- */
-int
-mc_setup(sc, ptr)
- struct ie_softc *sc;
- void *ptr;
-{
- volatile struct ie_mcast_cmd *cmd = ptr;
-
- cmd->com.ie_cmd_status = 0;
- cmd->com.ie_cmd_cmd = IE_CMD_MCAST | IE_CMD_LAST;
- cmd->com.ie_cmd_link = 0xffffffff;
-
- (sc->memcopy)((caddr_t)sc->mcast_addrs, (caddr_t)cmd->ie_mcast_addrs,
- sc->mcast_count * sizeof *sc->mcast_addrs);
-
- cmd->ie_mcast_bytes = sc->mcast_count * ETHER_ADDR_LEN; /* grrr... */
-
- sc->scb->ie_command_list = ASWAP(cmd);
- if (command_and_wait(sc, IE_CU_START, cmd, IE_STAT_COMPL) ||
- !(cmd->com.ie_cmd_status & IE_STAT_OK)) {
- printf("%s: multicast address setup command failed\n",
- sc->sc_dev.dv_xname);
- return 0;
- }
- return 1;
-}
-
-/*
- * This routine takes the environment generated by check_ie_present() and adds
- * to it all the other structures we need to operate the adapter. This
- * includes executing the CONFIGURE, IA-SETUP, and MC-SETUP commands, starting
- * the receiver unit, and clearing interrupts.
- *
- * THIS ROUTINE MUST BE CALLED AT splnet() OR HIGHER.
- */
-int
-ieinit(sc)
- struct ie_softc *sc;
-{
- volatile struct ie_sys_ctl_block *scb = sc->scb;
- void *ptr;
-
- ptr = sc->buf_area;
-
- /*
- * Set up bus throttles.
- */
-
- {
- if (command_and_wait(sc, IE_CU_THROTTLE, 0, 0)) {
- printf("%s: throttle set command failed\n",
- sc->sc_dev.dv_xname);
- return 0;
- }
- }
-
- /*
- * Send the configure command first.
- */
-
- {
- volatile struct ie_config_cmd *cmd = ptr;
-
- scb->ie_command_list = ASWAP(cmd);
- cmd->com.ie_cmd_status = 0;
- cmd->com.ie_cmd_cmd = IE_CMD_CONFIG | IE_CMD_LAST;
- cmd->com.ie_cmd_link = 0xffffffff;
-
- ie_setup_config(cmd, sc->promisc, 0);
-
- if (command_and_wait(sc, IE_CU_START, cmd, IE_STAT_COMPL) ||
- !(cmd->com.ie_cmd_status & IE_STAT_OK)) {
- printf("%s: configure command failed\n",
- sc->sc_dev.dv_xname);
- return 0;
- }
- }
-
- /*
- * Now send the Individual Address Setup command.
- */
- {
- volatile struct ie_iasetup_cmd *cmd = ptr;
-
- scb->ie_command_list = ASWAP(cmd);
- cmd->com.ie_cmd_status = 0;
- cmd->com.ie_cmd_cmd = IE_CMD_IASETUP | IE_CMD_LAST;
- cmd->com.ie_cmd_link = 0xffffffff;
-
- (sc->memcopy)(sc->sc_arpcom.ac_enaddr,
- (caddr_t)&cmd->ie_address, sizeof cmd->ie_address);
-
- if (command_and_wait(sc, IE_CU_START, cmd, IE_STAT_COMPL) ||
- !(cmd->com.ie_cmd_status & IE_STAT_OK)) {
- printf("%s: individual address setup command failed\n",
- sc->sc_dev.dv_xname);
- return 0;
- }
- }
-
- /*
- * Now run the time-domain reflectometer.
- */
- run_tdr(sc, ptr);
-
- /*
- * Acknowledge any interrupts we have generated thus far.
- */
- ie_ack(sc, IE_ST_WHENCE);
-
- /*
- * Set up the transmit and recv buffers.
- */
- setup_bufs(sc);
-
- sc->sc_arpcom.ac_if.if_flags |= IFF_RUNNING; /* tell higher levels that we are here */
-
- sc->scb->ie_recv_list = ASWAP(sc->rframes[0]);
- command_and_wait(sc, IE_RU_START, 0, 0);
-
- ie_ack(sc, IE_ST_WHENCE);
-
- if (sc->run_596)
- (sc->run_596)(sc);
-
- return 0;
-}
-
-void
-iestop(sc)
- struct ie_softc *sc;
-{
-
- command_and_wait(sc, IE_RU_DISABLE, 0, 0);
-}
-
-int
-ieioctl(ifp, cmd, data)
- register struct ifnet *ifp;
- u_long cmd;
- caddr_t data;
-{
- struct ie_softc *sc = ifp->if_softc;
- struct ifaddr *ifa = (struct ifaddr *)data;
- int s, error = 0;
-
- s = splnet();
-
- switch(cmd) {
- case SIOCSIFADDR:
- ifp->if_flags |= IFF_UP;
-
- switch(ifa->ifa_addr->sa_family) {
-#ifdef INET
- case AF_INET:
- ieinit(sc);
- arp_ifinit(&sc->sc_arpcom, ifa);
- break;
-#endif
- default:
- ieinit(sc);
- break;
- }
- break;
-
- case SIOCSIFFLAGS:
- sc->promisc = ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI);
- if ((ifp->if_flags & IFF_UP) == 0 &&
- (ifp->if_flags & IFF_RUNNING) != 0) {
- /*
- * If interface is marked down and it is running, then
- * stop it.
- */
- iestop(sc);
- ifp->if_flags &= ~IFF_RUNNING;
- } else if ((ifp->if_flags & IFF_UP) != 0 &&
- (ifp->if_flags & IFF_RUNNING) == 0) {
- /*
- * If interface is marked up and it is stopped, then
- * start it.
- */
- ieinit(sc);
- } else {
- /*
- * Reset the interface to pick up changes in any other
- * flags that affect hardware registers.
- */
- iestop(sc);
- ieinit(sc);
- }
-#ifdef IEDEBUG
- if (ifp->if_flags & IFF_DEBUG)
- sc->sc_debug = IED_ALL;
- else
- sc->sc_debug = 0;
-#endif
- break;
-
- default:
- error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data);
- }
-
- if (error == ENETRESET) {
- if (ifp->if_flags & IFF_RUNNING)
- mc_reset(sc);
- error = 0;
- }
-
- splx(s);
- return error;
-}
-
-void
-mc_reset(sc)
- struct ie_softc *sc;
-{
- struct arpcom *ac = &sc->sc_arpcom;
- struct ether_multi *enm;
- struct ether_multistep step;
-
- if (ac->ac_multirangecnt > 0) {
- ac->ac_if.if_flags |= IFF_ALLMULTI;
- ieioctl(&ac->ac_if, SIOCSIFFLAGS, (void *)0);
- goto setflag;
- }
-
- /*
- * Step through the list of addresses.
- */
- sc->mcast_count = 0;
- ETHER_FIRST_MULTI(step, ac, enm);
- while (enm) {
- if (sc->mcast_count >= MAXMCAST) {
- ac->ac_if.if_flags |= IFF_ALLMULTI;
- ieioctl(&ac->ac_if, SIOCSIFFLAGS, (void *)0);
- goto setflag;
- }
-
- bcopy(enm->enm_addrlo, &sc->mcast_addrs[sc->mcast_count], 6);
- sc->mcast_count++;
- ETHER_NEXT_MULTI(step, enm);
- }
-setflag:
- sc->want_mcsetup = 1;
-}
-
-#ifdef IEDEBUG
-void
-print_rbd(rbd)
- volatile struct ie_recv_buf_desc *rbd;
-{
-
- printf("RBD at %08lx:\nactual %04x, next %04x, buffer %08x\n"
- "length %04x, mbz %04x\n", (u_long)rbd, rbd->ie_rbd_actual,
- rbd->ie_rbd_next, rbd->ie_rbd_buffer, rbd->ie_rbd_length,
- rbd->mbz);
-}
-#endif
diff --git a/sys/arch/mvme68k/dev/if_ie.h b/sys/arch/mvme68k/dev/if_ie.h
deleted file mode 100644
index 5b5e0fb1e63..00000000000
--- a/sys/arch/mvme68k/dev/if_ie.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/* $OpenBSD: if_ie.h,v 1.5 2003/06/02 05:09:14 deraadt Exp $ */
-
-/* Copyright (c) 1998 Steve Murphree, Jr.
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * XXX where else is this from?
- * if_sunie.h
- *
- * sun's ie interface
- */
-
-/*
- * programming notes:
- *
- * the ie chip operates in a 24 bit address space.
- *
- * most ie interfaces appear to be divided into two parts:
- * - generic 586 stuff
- * - board specific
- *
- * generic:
- * the generic stuff of the ie chip is all done with data structures
- * that live in the chip's memory address space. the chip expects
- * its main data structure (the sys conf ptr -- SCP) to be at a
- * address loaded into the chip at init.
- *
- * the SCP points to another structure called the ISCP.
- * the ISCP points to another structure called the SCB.
- * the SCB has a status field, a linked list of "commands", and
- * a linked list of "receive buffers". these are data structures that
- * live in memory, not registers.
- *
- * board:
- * to get the chip to do anything, you first put a command in the
- * command data structure list. then you have to signal "attention"
- * to the chip to get it to look at the command. how you
- * signal attention depends on what board you have... on PC's
- * there is an i/o port number to do this, on sun's there is a
- * register bit you toggle.
- *
- * to get data from the chip you program it to interrupt...
- *
- * the VME boards lives in vme16 space. only 16 and 8 bit accesses
- * are allowed, so functions that copy data must be aware of this.
- *
- * the chip is an intel chip. this means that the byte order
- * on all the "short"s in the chip's data structures is wrong.
- * so, constants described in the intel docs are swapped for the sun.
- * that means that any buffer pointers you give the chip must be
- * swapped to intel format. yuck.
- *
- */
-
-/*
- * PART 1: VME/multibus defs
- */
-#define IEVME_PAGESIZE 1024 /* bytes */
-#define IEVME_PAGSHIFT 10 /* bits */
-#define IEVME_NPAGES 256 /* number of pages on chip */
-#define IEVME_MAPSZ 1024 /* number of entries in the map */
-
-/*
- * PTE for the page map
- */
-#define IEVME_SBORDR 0x8000 /* sun byte order */
-#define IEVME_IBORDR 0x0000 /* intel byte ordr */
-
-#define IEVME_P2MEM 0x2000 /* memory is on P2 */
-#define IEVME_OBMEM 0x0000 /* memory is on board */
-
-#define IEVME_PGMASK 0x0fff /* gives the physical page frame number */
-
-struct ievme {
- u_short pgmap[IEVME_MAPSZ];
- u_short xxx[32]; /* prom */
- u_short status; /* see below for bits */
- u_short xxx2; /* filler */
- u_short pectrl; /* parity control (see below) */
- u_short peaddr; /* low 16 bits of address */
-};
-
-/*
- * status bits
- */
-#define IEVME_RESET 0x8000 /* reset board */
-#define IEVME_ONAIR 0x4000 /* go out of loopback 'on-air' */
-#define IEVME_ATTEN 0x2000 /* attention */
-#define IEVME_IENAB 0x1000 /* interrupt enable */
-#define IEVME_PEINT 0x0800 /* parity error interrupt enable */
-#define IEVME_PERR 0x0200 /* parity error flag */
-#define IEVME_INT 0x0100 /* interrupt flag */
-#define IEVME_P2EN 0x0020 /* enable p2 bus */
-#define IEVME_256K 0x0010 /* 256kb rams */
-#define IEVME_HADDR 0x000f /* mask for bits 17-20 of address */
-
-/*
- * parity control
- */
-#define IEVME_PARACK 0x0100 /* parity error ack */
-#define IEVME_PARSRC 0x0080 /* parity error source */
-#define IEVME_PAREND 0x0040 /* which end of the data got the error */
-#define IEVME_PARADR 0x000f /* mask to get bits 17-20 of parity address */
-
-
-/*
- * PART 2: the on-board interface
- */
-struct ieob {
- u_short porthigh;
- u_short portlow;
- u_long attn;
-};
-#define IE_PORT_NEWSCPADDR 0x00000002
-#define IE_PORT_RESET 0x00000000
-
-#define IEOB_ADBASE 0xff000000 /* KVA base addr of 24 bit address space */
-
-/*
- * PART 3: the 3E board
- */
-
-/*
- * not supported (yet?)
- */
-
diff --git a/sys/arch/mvme68k/dev/if_le.c b/sys/arch/mvme68k/dev/if_le.c
deleted file mode 100644
index 46baff0a762..00000000000
--- a/sys/arch/mvme68k/dev/if_le.c
+++ /dev/null
@@ -1,371 +0,0 @@
-/* $OpenBSD: if_le.c,v 1.34 2013/09/24 20:10:46 miod Exp $ */
-
-/*-
- * Copyright (c) 1982, 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)if_le.c 8.2 (Berkeley) 10/30/93
- */
-
-#include "bpfilter.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/mbuf.h>
-#include <sys/syslog.h>
-#include <sys/socket.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-
-#include <net/if.h>
-
-#ifdef INET
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-#endif
-
-#include <net/if_media.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-
-#include <dev/ic/lancereg.h>
-#include <dev/ic/lancevar.h>
-#include <dev/ic/am7990reg.h>
-#include <dev/ic/am7990var.h>
-
-#include <mvme68k/dev/if_lereg.h>
-#include <mvme68k/dev/if_levar.h>
-#include <mvme68k/dev/vme.h>
-
-#include "pcc.h"
-#if NPCC > 0
-#include <mvme68k/dev/pccreg.h>
-#endif
-
-/* autoconfiguration driver */
-void leattach(struct device *, struct device *, void *);
-int lematch(struct device *, void *, void *);
-
-struct cfattach le_ca = {
- sizeof(struct le_softc), lematch, leattach
-};
-
-void lewrcsr(struct lance_softc *, uint16_t, uint16_t);
-uint16_t lerdcsr(struct lance_softc *, uint16_t);
-void vlewrcsr(struct lance_softc *, uint16_t, uint16_t);
-uint16_t vlerdcsr(struct lance_softc *, uint16_t);
-void nvram_cmd(struct lance_softc *, uint8_t, uint16_t);
-uint16_t nvram_read(struct lance_softc *, uint8_t);
-void vleetheraddr(struct lance_softc *);
-void vleinit(struct lance_softc *);
-void vlereset(struct lance_softc *);
-int vle_intr(void *);
-
-/* send command to the nvram controller */
-void
-nvram_cmd(struct lance_softc *sc, uint8_t cmd, uint16_t addr)
-{
- int i;
- struct vlereg1 *reg1 = (struct vlereg1 *)((struct le_softc *)sc)->sc_r1;
-
- for (i=0;i<8;i++) {
- reg1->ler1_ear=((cmd|(addr<<1))>>i);
- CDELAY;
- }
-}
-
-/* read nvram one bit at a time */
-uint16_t
-nvram_read(struct lance_softc *sc, uint8_t nvram_addr)
-{
- uint16_t val = 0, mask = 0x04000;
- uint16_t wbit;
- /* these used by macros DO NOT CHANGE!*/
- struct vlereg1 *reg1 = (struct vlereg1 *)((struct le_softc *)sc)->sc_r1;
- ((struct le_softc *)sc)->csr = 0x4f;
- ENABLE_NVRAM;
- nvram_cmd(sc, NVRAM_RCL, 0);
- DISABLE_NVRAM;
- CDELAY;
- ENABLE_NVRAM;
- nvram_cmd(sc, NVRAM_READ, nvram_addr);
- for (wbit=0; wbit<15; wbit++) {
- (reg1->ler1_ear & 0x01) ? (val = (val | mask)) : (val = (val & (~mask)));
- mask = mask>>1;
- CDELAY;
- }
- (reg1->ler1_ear & 0x01) ? (val = (val | 0x8000)) : (val = (val & 0x7FFF));
- CDELAY;
- DISABLE_NVRAM;
- return (val);
-}
-
-void
-vleetheraddr(struct lance_softc *sc)
-{
- uint8_t * cp = sc->sc_arpcom.ac_enaddr;
- uint16_t ival[3];
- uint8_t i;
-
- for (i=0; i<3; i++) {
- ival[i] = nvram_read(sc, i);
- }
- memcpy(cp, &ival[0], 6);
-}
-
-void
-lewrcsr(struct lance_softc *sc, uint16_t port, uint16_t val)
-{
- struct lereg1 *ler1 = (struct lereg1 *)((struct le_softc *)sc)->sc_r1;
-
- ler1->ler1_rap = port;
- ler1->ler1_rdp = val;
-}
-
-void
-vlewrcsr(struct lance_softc *sc, uint16_t port, uint16_t val)
-{
- struct vlereg1 *ler1 = (struct vlereg1 *)((struct le_softc *)sc)->sc_r1;
-
- ler1->ler1_rap = port;
- ler1->ler1_rdp = val;
-}
-
-uint16_t
-lerdcsr(struct lance_softc *sc, uint16_t port)
-{
- struct lereg1 *ler1 = (struct lereg1 *)((struct le_softc *)sc)->sc_r1;
- uint16_t val;
-
- ler1->ler1_rap = port;
- val = ler1->ler1_rdp;
- return (val);
-}
-
-uint16_t
-vlerdcsr(struct lance_softc *sc, uint16_t port)
-{
- struct vlereg1 *ler1 = (struct vlereg1 *)((struct le_softc *)sc)->sc_r1;
- uint16_t val;
-
- ler1->ler1_rap = port;
- val = ler1->ler1_rdp;
- return (val);
-}
-
-/* init MVME376, set ipl and vec */
-void
-vleinit(struct lance_softc *sc)
-{
- struct vlereg1 *reg1 = (struct vlereg1 *)((struct le_softc *)sc)->sc_r1;
- uint8_t vec = ((struct le_softc *)sc)->sc_vec;
- uint8_t ipl = ((struct le_softc *)sc)->sc_ipl;
- ((struct le_softc *)sc)->csr = 0x4f;
- WRITE_CSR_AND( ~ipl );
- SET_VEC(vec);
- return;
-}
-
-/* MVME376 hardware reset */
-void
-vlereset(struct lance_softc *sc)
-{
- struct vlereg1 *reg1 = (struct vlereg1 *)((struct le_softc *)sc)->sc_r1;
- RESET_HW;
-#ifdef LEDEBUG
- if (sc->sc_debug) {
- printf("\nle: hardware reset\n");
- }
-#endif
- SYSFAIL_CL;
- return;
-}
-
-int
-vle_intr(void *sc)
-{
- struct vlereg1 *reg1 = (struct vlereg1 *)((struct le_softc *)sc)->sc_r1;
- int rc;
- rc = am7990_intr(sc);
- ENABLE_INTR;
- return (rc);
-}
-
-int
-lematch(struct device *parent, void *vcf, void *args)
-{
- struct confargs *ca = args;
- bus_space_tag_t iot = ca->ca_iot;
- bus_space_handle_t ioh;
- int rc;
-
- switch (ca->ca_bustype) {
- case BUS_PCC:
- return (!badvaddr((vaddr_t)ca->ca_vaddr, 2));
- case BUS_VMES:
- if (bus_space_map(iot, ca->ca_paddr, VLEREGSIZE, 0, &ioh) != 0)
- return 0;
- rc = badvaddr((vaddr_t)bus_space_vaddr(iot, ioh), 2);
- bus_space_unmap(iot, ioh, VLEREGSIZE);
- return rc == 0;
- default:
- return 0;
- }
-}
-
-/*
- * Interface exists: make available by filling in network interface
- * record. System will initialize the interface when it is ready
- * to accept packets.
- */
-void
-leattach(struct device *parent, struct device *self, void *aux)
-{
- struct le_softc *lesc = (struct le_softc *)self;
- struct lance_softc *sc = &lesc->sc_am7990.lsc;
- struct confargs *ca = aux;
- int pri = ca->ca_ipl;
- extern void *etherbuf;
- paddr_t addr;
- int card;
- bus_space_tag_t iot = ca->ca_iot;
- bus_space_handle_t ioh, memh;
-
- /* XXX the following declarations should be elsewhere */
- extern void myetheraddr(uint8_t *);
-
- switch (ca->ca_bustype) {
- case BUS_VMES:
- /*
- * get the first available etherbuf. MVME376 uses its own
- * dual-ported RAM for etherbuf. It is set by dip switches
- * on board. We support the six Motorola address locations,
- * however, the board can be set up at any other address.
- * XXX These physical addresses should be mapped in extio!!!
- */
- switch (ca->ca_paddr) {
- case 0xffff1200:
- card = 0;
- break;
- case 0xffff1400:
- card = 1;
- break;
- case 0xffff1600:
- card = 2;
- break;
- case 0xffff5400:
- card = 3;
- break;
- case 0xffff5600:
- card = 4;
- break;
- case 0xffffa400:
- card = 5;
- break;
- default:
- printf(": unsupported address\n");
- return;
- }
-
- if (bus_space_map(iot, ca->ca_paddr, VLEREGSIZE, 0, &ioh) !=
- 0) {
- printf(": can't map registers!\n");
- return;
- }
-
- addr = VLEMEMBASE - (card * VLEMEMSIZE);
- if (bus_space_map(iot, addr, VLEMEMSIZE, BUS_SPACE_MAP_LINEAR,
- &memh) != 0) {
- printf(": can't map buffers!\n");
- bus_space_unmap(iot, ioh, VLEREGSIZE);
- return;
- }
- lesc->sc_r1 = (void *)bus_space_vaddr(iot, ioh);
- lesc->sc_ipl = ca->ca_ipl;
- lesc->sc_vec = ca->ca_vec;
-
- sc->sc_mem = (void *)bus_space_vaddr(iot, memh);
- sc->sc_memsize = VLEMEMSIZE;
- sc->sc_addr = addr & 0x00ffffff;
- sc->sc_conf3 = LE_C3_BSWP;
- sc->sc_hwreset = vlereset;
- sc->sc_rdcsr = vlerdcsr;
- sc->sc_wrcsr = vlewrcsr;
- sc->sc_hwinit = vleinit;
- sc->sc_copytodesc = lance_copytobuf_contig;
- sc->sc_copyfromdesc = lance_copyfrombuf_contig;
- sc->sc_copytobuf = lance_copytobuf_contig;
- sc->sc_copyfrombuf = lance_copyfrombuf_contig;
- sc->sc_zerobuf = lance_zerobuf_contig;
- /* get ether address */
- vleetheraddr(sc);
- break;
- case BUS_PCC:
- sc->sc_mem = etherbuf;
- lesc->sc_r1 = (void *)ca->ca_vaddr;
- sc->sc_conf3 = LE_C3_BSWP /*| LE_C3_ACON | LE_C3_BCON*/;
- sc->sc_addr = kvtop((vaddr_t)sc->sc_mem);
- sc->sc_memsize = LEMEMSIZE;
- sc->sc_rdcsr = lerdcsr;
- sc->sc_wrcsr = lewrcsr;
- sc->sc_hwreset = NULL;
- sc->sc_hwinit = NULL;
- sc->sc_copytodesc = lance_copytobuf_contig;
- sc->sc_copyfromdesc = lance_copyfrombuf_contig;
- sc->sc_copytobuf = lance_copytobuf_contig;
- sc->sc_copyfrombuf = lance_copyfrombuf_contig;
- sc->sc_zerobuf = lance_zerobuf_contig;
- /* get ether address */
- myetheraddr(sc->sc_arpcom.ac_enaddr);
- break;
- default:
- printf(": unknown bus type\n");
- return;
- }
-
- am7990_config(&lesc->sc_am7990);
-
- /* connect the interrupt */
- switch (ca->ca_bustype) {
- case BUS_VMES:
- lesc->sc_ih.ih_fn = vle_intr;
- lesc->sc_ih.ih_arg = sc;
- lesc->sc_ih.ih_ipl = pri;
- vmeintr_establish(ca->ca_vec + 0, &lesc->sc_ih, self->dv_xname);
- break;
-#if NPCC > 0
- case BUS_PCC:
- lesc->sc_ih.ih_fn = am7990_intr;
- lesc->sc_ih.ih_arg = sc;
- lesc->sc_ih.ih_ipl = pri;
- pccintr_establish(PCCV_LE, &lesc->sc_ih, self->dv_xname);
- sys_pcc->pcc_leirq = pri | PCC_IRQ_IEN;
- break;
-#endif
- }
-}
diff --git a/sys/arch/mvme68k/dev/if_lereg.h b/sys/arch/mvme68k/dev/if_lereg.h
deleted file mode 100644
index ceabacb9fe8..00000000000
--- a/sys/arch/mvme68k/dev/if_lereg.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* $OpenBSD: if_lereg.h,v 1.10 2009/02/17 22:28:40 miod Exp $ */
-
-/*-
- * Copyright (c) 1982, 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)if_lereg.h 8.2 (Berkeley) 10/30/93
- */
-
-#define LEMEMSIZE 0x4000
-
-/*
- * LANCE registers.
- */
-struct lereg1 {
- volatile u_int16_t ler1_rdp; /* data port */
- volatile u_int16_t ler1_rap; /* register select port */
-};
-
-#define VLEREGSIZE 0x200
-#define VLEMEMSIZE 0x00040000
-#define VLEMEMBASE 0xfd6c0000
-
-/*
- * LANCE registers for MVME376
- */
-struct vlereg1 {
- volatile u_int16_t ler1_csr; /* board control/status register */
- volatile u_int16_t ler1_vec; /* interrupt vector register */
- volatile u_int16_t ler1_rdp; /* data port */
- volatile u_int16_t ler1_rap; /* register select port */
- volatile u_int16_t ler1_ear; /* ethernet address register */
-};
-
-#define NVRAM_EN 0x0008 /* NVRAM enable bit */
-#define INTR_EN 0x0010 /* Interrupt enable bit */
-#define PARITYB 0x0020 /* Parity clear bit */
-#define HW_RS 0x0040 /* Hardware reset bit */
-#define SYSFAILB 0x0080 /* SYSFAIL bit */
-#define NVRAM_RWEL 0xE0 /* Reset write enable latch */
-#define NVRAM_STO 0x60 /* Store ram to eeprom */
-#define NVRAM_SLP 0xA0 /* Novram into low power mode */
-#define NVRAM_WRITE 0x20 /* Writes word from location x */
-#define NVRAM_SWEL 0xC0 /* Set write enable latch */
-#define NVRAM_RCL 0x40 /* Recall eeprom data into ram */
-#define NVRAM_READ 0x00 /* Reads word from location x */
-
-#define CDELAY delay(10000)
-#define WRITE_CSR_OR(x) reg1->ler1_csr=((struct le_softc *)sc)->csr|=x
-#define WRITE_CSR_AND(x) reg1->ler1_csr=((struct le_softc *)sc)->csr&=x
-#define ENABLE_NVRAM WRITE_CSR_AND(~NVRAM_EN)
-#define DISABLE_NVRAM WRITE_CSR_OR(NVRAM_EN)
-#define ENABLE_INTR WRITE_CSR_AND(~INTR_EN)
-#define DISABLE_INTR WRITE_CSR_OR(INTR_EN)
-#define RESET_HW WRITE_CSR_AND(~0xFF00);WRITE_CSR_AND(~HW_RS);CDELAY
-#define SET_IPL(x) WRITE_CSR_AND(~x)
-#define SET_VEC(x) reg1->ler1_vec=0;reg1->ler1_vec |=x;
-#define PARITY_CL WRITE_CSR_AND(~PARITYB)
-#define SYSFAIL_CL WRITE_CSR_AND(~SYSFAILB)
-#define NVRAM_CMD(c,a) for(i=0;i<8;i++){ \
- reg1->ler1_ear=((c|(a<<1))>>i); \
- CDELAY; \
- } \
- CDELAY;
-
-
diff --git a/sys/arch/mvme68k/dev/if_levar.h b/sys/arch/mvme68k/dev/if_levar.h
deleted file mode 100644
index ded8d952d14..00000000000
--- a/sys/arch/mvme68k/dev/if_levar.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* $OpenBSD: if_levar.h,v 1.7 2004/07/30 22:29:45 miod Exp $ */
-/* $NetBSD: if_levar.h,v 1.5 1996/05/07 01:27:32 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell and Rick Macklem.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)if_le.c 8.2 (Berkeley) 11/16/93
- */
-
-/*
- * Ethernet software status per interface.
- *
- * Each interface is referenced by a network interface structure,
- * arpcom.ac_if, which the routing code uses to locate the interface.
- * This structure contains the output queue for the interface, its address, ...
- */
-struct le_softc {
- struct am7990_softc sc_am7990; /* glue to MI code */
-
- struct intrhand sc_ih; /* interrupt vectoring */
- void *sc_r1; /* LANCE registers */
- u_short csr; /* Control/Status reg image */
- u_char sc_ipl;
- u_char sc_vec;
-};
-
diff --git a/sys/arch/mvme68k/dev/ipic.c b/sys/arch/mvme68k/dev/ipic.c
deleted file mode 100644
index f82c264985c..00000000000
--- a/sys/arch/mvme68k/dev/ipic.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/* $OpenBSD: ipic.c,v 1.18 2010/06/26 23:24:43 guenther Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-#include <sys/uio.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/syslog.h>
-#include <sys/fcntl.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-
-#include <mvme68k/dev/ipicreg.h>
-#include <mvme68k/dev/mcreg.h>
-
-void ipicattach(struct device *, struct device *, void *);
-int ipicmatch(struct device *, void *, void *);
-
-int ipicprint(void *, const char *);
-int ipicscan(struct device *, void *, void *);
-caddr_t ipicmap(struct ipicsoftc *, caddr_t, int);
-void ipicunmap(struct ipicsoftc *, caddr_t, int);
-
-struct cfattach ipic_ca = {
- sizeof(struct ipicsoftc), ipicmatch, ipicattach
-};
-
-struct cfdriver ipic_cd = {
- NULL, "ipic", DV_DULL
-};
-
-int
-ipicmatch(parent, cf, args)
- struct device *parent;
- void *cf;
- void *args;
-{
- struct confargs *ca = args;
- struct ipicreg *ipic = (struct ipicreg *)ca->ca_vaddr;
-
- if (badvaddr((vaddr_t)ipic, 1) || ipic->ipic_chipid != IPIC_CHIPID)
- return (0);
- return (1);
-}
-
-int
-ipicprint(args, bus)
- void *args;
- const char *bus;
-{
- struct confargs *ca = args;
-
- printf(" slot %d", ca->ca_offset);
- if (ca->ca_vec > 0)
- printf(" vec %d", ca->ca_vec);
- if (ca->ca_ipl > 0)
- printf(" ipl %d", ca->ca_ipl);
- return (UNCONF);
-}
-
-int
-ipicscan(parent, child, args)
- struct device *parent;
- void *child, *args;
-{
- struct cfdata *cf = child;
- struct ipicsoftc *sc = (struct ipicsoftc *)parent;
- struct confargs oca;
- int slot, n = 0;
- vaddr_t ipv;
- paddr_t ipp;
- struct ipid *ipid;
-
- /* XXX can we determine IPIC_IPSPACE automatically? */
- for (slot = 0; slot < sc->sc_nip; slot++) {
- ipp = sc->sc_ipspace + (slot * IPIC_IP_MODSIZE);
- if (badpaddr((paddr_t)ipp + IPIC_IP_IDOFFSET, 2))
- continue;
-
- ipv = mapiodev(ipp, NBPG);
- if (ipv == 0)
- continue;
-
- ipid = (struct ipid *)(ipv + IPIC_IP_IDOFFSET);
- if (ipid->ipid_A != 'A' || ipid->ipid_P != 'P' ||
- ipid->ipid_I != 'I' || ipid->ipid_C != 'C' ||
- (u_char)cf->cf_loc[0] != ipid->ipid_manu ||
- (u_char)cf->cf_loc[1] != ipid->ipid_prod) {
- unmapiodev(ipv, NBPG);
- continue;
- }
-
- bzero(&oca, sizeof oca);
- oca.ca_bustype = BUS_IP;
- oca.ca_offset = slot; /* slot number */
- oca.ca_paddr = ipp;
- oca.ca_vaddr = ipv;
- oca.ca_ipl = cf->cf_loc[2];
- oca.ca_vec = cf->cf_loc[3];
- if (oca.ca_ipl > 0 && oca.ca_vec == -1)
- oca.ca_vec = intr_findvec(255, 0);
-
- oca.ca_name = cf->cf_driver->cd_name;
-
- if ((*cf->cf_attach->ca_match)(parent, cf, &oca) == 0) {
- unmapiodev(ipv, NBPG);
- continue;
- }
- config_attach(parent, cf, &oca, ipicprint);
- n++;
- }
- return (n);
-}
-
-void
-ipicattach(parent, self, args)
- struct device *parent, *self;
- void *args;
-{
- struct ipicsoftc *sc = (struct ipicsoftc *)self;
- struct confargs *ca = args;
-
- sc->sc_ipic = (struct ipicreg *)ca->ca_vaddr;
- sc->sc_ipspace = IPIC_IPSPACE;
- sc->sc_nip = 2;
-
- /*
- * Bug in IP2 chip. ipic_chiprev should be 0x01 if
- * the MC chip is rev 1. XXX - smurph
- */
- if (sys_mc->mc_chiprev == 0x01)
- printf(": rev 1\n");
- else
- printf(": rev %d\n", sc->sc_ipic->ipic_chiprev);
-
- sc->sc_ipic->ipic_reset = IPIC_RESET;
- delay(2);
-
- config_search(ipicscan, self, args);
-}
-
-caddr_t
-ipicmap(sc, addr, len)
- struct ipicsoftc *sc;
- caddr_t addr;
- int len;
-{
- return (NULL);
-}
-
-void
-ipicunmap(sc, addr, len)
- struct ipicsoftc *sc;
- caddr_t addr;
- int len;
-{
-}
-
-int
-ipicintr_establish(vec, ih, name)
- int vec;
- struct intrhand *ih;
- const char *name;
-{
- return intr_establish(vec, ih, name);
-}
diff --git a/sys/arch/mvme68k/dev/ipicreg.h b/sys/arch/mvme68k/dev/ipicreg.h
deleted file mode 100644
index dc789263a6d..00000000000
--- a/sys/arch/mvme68k/dev/ipicreg.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/* $OpenBSD: ipicreg.h,v 1.7 2005/11/24 22:43:16 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-struct ipicreg {
- volatile u_char ipic_chipid;
-#define IPIC_CHIPID 0x23
- volatile u_char ipic_chiprev;
- volatile u_char x0[2];
- volatile u_short ipic_base[4]; /* [slot] */
- volatile u_char ipic_size[4]; /* [slot] */
- volatile u_char ipic_irq[4][2]; /* [slot][irq#] */
-#define IPIC_IRQ_PLTY 0x80 /* 1 = rising edge activated */
-#define IPIC_IRQ_EL 0x40 /* 1 = edge, 0 = level sensitive */
-#define IPIC_IRQ_INT 0x20 /* interrupt is active */
-#define IPIC_IRQ_IEN 0x10 /* enable interrupt */
-#define IPIC_IRQ_ICLR 0x08 /* clear interrupt */
-#define IPIC_IRQ_IPLMASK 0x07
- volatile u_char ipic_ctl[4]; /* [slot] */
-#define IPIC_CTL_ERR 0x80 /* error from IP module */
-#define IPIC_CTL_RTMASK 0x30 /* recovery time, measured in ms */
-#define IPIC_CTL_RT0MS 0x00
-#define IPIC_CTL_RT2MS 0x10
-#define IPIC_CTL_RT4MS 0x20
-#define IPIC_CTL_RT8MS 0x30
-#define IPIC_CTL_WIDTHMASK 0x0c /* bus width */
-#define IPIC_CTL_WIDTH32 0x00
-#define IPIC_CTL_WIDTH8 0x04
-#define IPIC_CTL_WIDTH16 0x08
-#define IPIC_CTL_MEN 0x01 /* ??? */
- volatile u_char x1[3];
- volatile u_char ipic_reset;
-#define IPIC_RESET 0x01 /* bit clears automatically after 1ms */
-};
-
-/*
- * the following macros convert the size in bytes to/from the
- * ipic_Xsize reg values. you should ensure your size in bytes
- * is a legal value, which are 16K, or all the powers of 2 from
- * 64K to 8M.
- */
-#define IPIC_SIZE_BTOR(x) \
- (((x) == 16*1024) ? (0xff) : (((x) / 64*1024) - 1))
-#define IPIC_SIZE_RTOB(x) \
- (((x) == 0xff) ? (16*1024) : (((x) + 1) * 64*1024))
-
-struct ipid {
- volatile u_char ipid_I; /* must be 'I' */
- volatile u_char :8;
- volatile u_char ipid_P; /* must be 'P' */
- volatile u_char :8;
- volatile u_char ipid_A; /* must be 'A' */
- volatile u_char :8;
- volatile u_char ipid_C; /* must be 'C' */
- volatile u_char :8;
- volatile u_char ipid_manu;
- volatile u_char :8;
- volatile u_char ipid_prod;
- volatile u_char :8;
- volatile u_char ipid_rev;
- volatile u_char :8;
- volatile u_char ipid_zero;
- volatile u_char :8;
- volatile u_char ipid_didl;
- volatile u_char :8;
- volatile u_char ipid_didh;
- volatile u_char :8;
- volatile u_char ipid_pspecn; /* # shorts in pack-spec id */
- volatile u_char :8;
- volatile u_char ipid_crc;
- volatile u_char :8;
- volatile u_char ipic_pspecbase; /* start of pack-spec id */
-};
-
-#define IPIC_IPSPACE 0xfff58000
-#define IPIC_IP_MODSIZE 0x00000100
-#define IPIC_IP_IDOFFSET 0x80
-#define IPIC_IP_REGOFFSET 0x00
-
-struct ipicsoftc {
- struct device sc_dev;
- struct ipicreg *sc_ipic;
-
- vaddr_t sc_ipspace;
- int sc_nip;
-};
-
-int ipicintr_establish(int, struct intrhand *, const char *);
diff --git a/sys/arch/mvme68k/dev/lp.c b/sys/arch/mvme68k/dev/lp.c
deleted file mode 100644
index 986c1c46fd7..00000000000
--- a/sys/arch/mvme68k/dev/lp.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/* $OpenBSD: lp.c,v 1.11 2010/06/26 23:24:43 guenther Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-#include <sys/uio.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/syslog.h>
-#include <sys/fcntl.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/conf.h>
-#include <machine/cpu.h>
-
-#include <mvme68k/dev/pccreg.h>
-
-struct lpsoftc {
- struct device sc_dev;
- struct intrhand sc_ih;
-};
-
-void lpattach(struct device *, struct device *, void *);
-int lpmatch(struct device *, void *, void *);
-
-struct cfattach lp_ca = {
- sizeof(struct lpsoftc), lpmatch, lpattach
-};
-
-struct cfdriver lp_cd = {
- NULL, "lp", DV_DULL
-};
-
-int lpintr(void *);
-
-/*
- * a PCC chip always has an lp attached to it.
- */
-int
-lpmatch(parent, cf, args)
- struct device *parent;
- void *cf;
- void *args;
-{
- return (1);
-}
-
-void
-lpattach(parent, self, args)
- struct device *parent, *self;
- void *args;
-{
- struct lpsoftc *sc = (struct lpsoftc *)self;
- struct confargs *ca = args;
-
- printf(": unsupported\n");
-
- sc->sc_ih.ih_fn = lpintr;
- sc->sc_ih.ih_arg = sc;
- sc->sc_ih.ih_ipl = ca->ca_ipl;
- pccintr_establish(PCCV_PRINTER, &sc->sc_ih, self->dv_xname);
-
- sys_pcc->pcc_lpirq = ca->ca_ipl | PCC_IRQ_IEN | PCC_LPIRQ_ACK;
-}
-
-int
-lpintr(dev)
- void *dev;
-{
- return (0);
-}
-
-/*ARGSUSED*/
-int
-lpopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
-
- return (0);
-}
-
-/*ARGSUSED*/
-int
-lpclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
-
- return (0);
-}
-
-/*ARGSUSED*/
-int
-lpwrite(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- return (EOPNOTSUPP);
-}
-
-int
-lpioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- return (EOPNOTSUPP);
-}
-
diff --git a/sys/arch/mvme68k/dev/lrc.c b/sys/arch/mvme68k/dev/lrc.c
deleted file mode 100644
index 05aa7417aea..00000000000
--- a/sys/arch/mvme68k/dev/lrc.c
+++ /dev/null
@@ -1,232 +0,0 @@
-/* $OpenBSD: lrc.c,v 1.1 2009/03/01 21:40:49 miod Exp $ */
-
-/*
- * Copyright (c) 2006, Miodrag Vallat.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * LRC Local Resource Controller, found on MVME165
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-
-#include <mvme68k/dev/lrcreg.h>
-
-struct lrcreg *sys_lrc;
-
-struct lrcsoftc {
- struct device sc_dev;
- struct lrcreg *sc_regs;
- vaddr_t sc_vaddr;
- paddr_t sc_paddr;
- struct intrhand sc_abortih;
-};
-
-int lrcabort(void *);
-void lrcattach(struct device *, struct device *, void *);
-int lrcmatch(struct device *, void *, void *);
-int lrcprint(void *, const char *);
-int lrcscan(struct device *, void *, void *);
-
-struct cfattach lrc_ca = {
- sizeof(struct lrcsoftc), lrcmatch, lrcattach
-};
-
-struct cfdriver lrc_cd = {
- NULL, "lrc", DV_DULL
-};
-
-int
-lrcmatch(struct device *parent, void *cf, void *aux)
-{
- if (cputyp != CPU_165 || sys_lrc != NULL)
- return (0);
-
- return (1);
-}
-
-void
-lrcattach(struct device *parent, struct device *self, void *aux)
-{
- struct confargs *ca = aux;
- struct lrcsoftc *sc = (struct lrcsoftc *)self;
-
- sc->sc_paddr = ca->ca_paddr;
- sc->sc_vaddr = IIOV(sc->sc_paddr);
- sys_lrc = sc->sc_regs = (struct lrcreg *)sc->sc_vaddr;
-
- printf("\n");
-
- /* sync serial clock with DUART */
- sc->sc_regs->lrc_gcr &= ~GCR_SCFREQ;
- /* disable VSB */
- sc->sc_regs->lrc_bcr &= ~(BCR_VA24 | BCR_VSBEN | BCR_ROEN);
- /* set up vector base */
- sc->sc_regs->lrc_icr1 = LRC_VECBASE;
- /* enable interrupts */
- sc->sc_regs->lrc_icr0 = ICR0_GIE;
-
- sc->sc_abortih.ih_fn = lrcabort;
- sc->sc_abortih.ih_ipl = IPL_HIGH;
- sc->sc_abortih.ih_wantframe = 1;
- lrcintr_establish(LRCVEC_ABORT, &sc->sc_abortih, self->dv_xname);
-
- config_search(lrcscan, self, aux);
-}
-
-int
-lrcprint(void *aux, const char *pnp)
-{
- struct confargs *ca = aux;
-
- if (ca->ca_offset != -1)
- printf(" offset 0x%x", ca->ca_offset);
- if (ca->ca_ipl > 0)
- printf(" ipl %d", ca->ca_ipl);
- return (UNCONF);
-}
-
-int
-lrcscan(struct device *parent, void *self, void *aux)
-{
- struct cfdata *cf = self;
- struct lrcsoftc *sc = (struct lrcsoftc *)parent;
- struct confargs *ca = aux;
- struct confargs oca;
-
- bzero(&oca, sizeof oca);
- oca.ca_iot = ca->ca_iot;
- oca.ca_dmat = ca->ca_dmat;
- oca.ca_offset = cf->cf_loc[0];
- oca.ca_ipl = cf->cf_loc[1];
- if (oca.ca_offset != -1 && ISIIOVA(sc->sc_vaddr + oca.ca_offset)) {
- oca.ca_vaddr = sc->sc_vaddr + oca.ca_offset;
- oca.ca_paddr = sc->sc_paddr + oca.ca_offset;
- } else {
- oca.ca_vaddr = (vaddr_t)-1;
- oca.ca_paddr = (paddr_t)-1;
- }
- oca.ca_bustype = BUS_LRC;
- oca.ca_name = cf->cf_driver->cd_name;
-
- if ((*cf->cf_attach->ca_match)(parent, cf, &oca) == 0)
- return (0);
-
- config_attach(parent, cf, &oca, lrcprint);
-
- return (1);
-}
-
-/*
- * Register an LRC interrupt.
- * This will take care of enabling the right interrupt source in the
- * interrupt controller.
- */
-int
-lrcintr_establish(u_int vec, struct intrhand *ih, const char *name)
-{
- int rc;
- const struct {
- u_int8_t icr0_bit;
- u_int8_t icr1_bit;
- } icr_bits[] = {
- { 0x00, 0x00 }, /* timer 0 done differently */
- { 0x00, 0x00 }, /* timer 1 done differently */
- { 0x00, 0x00 }, /* timer 2 done differently */
- { 0xff, 0xff },
- { ICR0_IRQ7G2IE, 0x00 },
- { ICR0_IRQ6G2IE, 0x00 },
- { 0xff, 0xff },
- { ICR0_IRQ3G2IE, 0x00 },
- { ICR0_IRQ7G2IE, 0x00 },
- { ICR0_IRQ4G2IE, 0x00 }, /* ICR0_IRQ6G4IE */
- { 0x00, ICR1_IRQ7G5IE },
- { 0x00, ICR1_IRQ7G6IE },
- { ICR0_IRQ5G2IE, 0x00 },
- { 0xff, 0xff },
- { 0xff, 0xff },
- { 0xff, 0xff }
- };
-
-#ifdef DIAGNOSTIC
- if (vec < 0 || vec >= LRC_NVEC || icr_bits[vec].icr0_bit == 0xff)
- panic("lrcintr_establish: illegal vector for %s: 0x%x",
- name, vec);
-#endif
-
- rc = intr_establish(LRC_VECBASE + vec, ih, name);
-
- if (rc == 0) {
- sys_lrc->lrc_icr0 |= icr_bits[vec].icr0_bit;
- sys_lrc->lrc_icr1 |= icr_bits[vec].icr1_bit;
- }
-
- return (rc);
-}
-
-int
-lrcabort(void *frame)
-{
- nmihand(frame);
-
- return (1);
-}
-
-/*
- * Figure out the speed of the board by measuring how many operations
- * can be issued in a given time, reusing the delay() logic.
- */
-int
-lrcspeed(struct lrcreg *lrc)
-{
- uint cnt;
- int speed;
-
- /* use timer0 and wait for it to wrap after 200msec */
- cnt = 0;
- lrc->lrc_t0base = 200000 + 1;
- lrc->lrc_tcr0 = TCR_TLD0; /* reset to one */
- lrc->lrc_stat = STAT_TMR0; /* clear latch */
- lrc->lrc_tcr0 = TCR_TEN0;
- while ((lrc->lrc_stat & STAT_TMR0) == 0)
- cnt++;
-
- /*
- * Empirically determined. However since there are only
- * 25MHz and 33MHz boards available, it is easy to draw
- * a line - cnt should be close to cpu MHz * 8000.
- */
- if (cnt > 30 * 8000)
- speed = 33;
- else
- speed = 25;
-
- return speed;
-}
diff --git a/sys/arch/mvme68k/dev/lrcreg.h b/sys/arch/mvme68k/dev/lrcreg.h
deleted file mode 100644
index 3ddd40d250e..00000000000
--- a/sys/arch/mvme68k/dev/lrcreg.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/* $OpenBSD: lrcreg.h,v 1.1 2009/03/01 21:40:49 miod Exp $ */
-
-/*
- * Copyright (c) 2006, Miodrag Vallat.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * LRC Local Resource Controller, found on MVME165
- */
-
-/*
- * Register layout.
- * Note that this chip is 24-bit internally, so the 8 high-order bits of
- * each register are undefined and likely set to ones.
- */
-struct lrcreg {
- /* timer constants */
- volatile u_int32_t lrc_t0base;
- volatile u_int32_t lrc_t1base;
- volatile u_int32_t lrc_t2base;
- /* timer counts */
- volatile u_int32_t lrc_t0cnt;
- volatile u_int32_t lrc_t1cnt;
- volatile u_int32_t lrc_t2cnt;
- /* timer control words */
- volatile u_int32_t lrc_tcr0;
- volatile u_int32_t lrc_tcr1;
- volatile u_int32_t lrc_tcr2;
- /* general control */
- volatile u_int32_t lrc_gcr;
- /* bus control */
- volatile u_int32_t lrc_bcr;
- /* interrupt control */
- volatile u_int32_t lrc_icr0;
- volatile u_int32_t lrc_icr1;
- /* status register */
- volatile u_int32_t lrc_stat;
- /* RAM address */
- volatile u_int32_t lrc_ramaddr;
- /* bus error status */
- volatile u_int32_t lrc_berrstat;
-};
-
-/* TCR0 bits */
-#define TCR_TEN0 0x80 /* timer0 enable */
-#define TCR_TLD0 0x40 /* timer0 reload */
-#define TCR_TCYC0 0x20 /* timer0 cycle */
-#define TCR_T0IE 0x10 /* time0 interrupt enable */
-#define TCR_TOS_MASK 0x0c /* timer output select */
-#define TCR_TOS_TMR0 0x00
-#define TCR_TOS_TMR1 0x04
-#define TCR_TOS_TMR2 0x08
-#define TCR_TOEN 0x02 /* timer output enable */
-#define TCR_TOMD 0x01 /* timer output mode: pulse / square wave */
-
-/* TCR1 bits */
-#define TCR_TEN1 0x80 /* timer1 enable */
-#define TCR_TLD1 0x40 /* timer1 reload */
-#define TCR_TCYC1 0x20 /* timer1 cycle */
-#define TCR_T1IE 0x10 /* timer1 interrupt enable */
-#define TCR_TIS_MASK 0x0c /* timer input select */
-#define TCR_TIS_TMR0 0x00
-#define TCR_TIS_TMR1 0x04
-#define TCR_TIS_TMR2 0x08
-#define TCR_TIS_NONE 0x0c
-#define TCR_TIEN 0x02 /* timer input enable */
-#define TCR_TIMD 0x01 /* timer input mode */
-
-/* TCR2 bits */
-#define TCR_TEN2 0x80 /* timer2 enable */
-#define TCR_TLD2 0x40 /* timer2 reload */
-#define TCR_TCYC2 0x20 /* timer2 cycle */
-#define TCR_T2IE 0x10 /* timer2 interrupt enable */
-#define TCR_TWD_MASK 0x0c /* timer watchdog select */
-#define TCR_TWD_TMR0 0x00
-#define TCR_TWD_TMR1 0x04
-#define TCR_TWD_TMR2 0x08
-#define TCR_TWD_NONE 0x0c
-#define TCR_TWDEN 0x02 /* timer watchdog enable */
-#define TCR_TTST 0x01 /* timer test (do not use) */
-
-/* GCR bits */
-#define GCR_SCFREQ 0x10 /* dart serial clock frequency */
-#define GCR_FAST 0x08 /* EPROM fast acknowledge */
-#define GCR_GPCTL1 0x04 /* write wrong parity */
-#define GCR_GPCTL0 0x02 /* parity error enable */
-#define GCR_RSTO 0x01 /* reset output */
-
-/* BCR bits */
-#define BCR_VA24 0x10 /* force VME A24 addressing for low 16MB */
-#define BCR_VSBEN 0x08 /* VSB enable */
-#define BCR_VSBMD 0x04 /* restricted VSB ranges */
-#define BCR_ROEN 0x02 /* VSB read only enable */
-#define BCR_ROMD 0x01 /* VSB read only mode uses VSBRO */
-
-/* ICR0 bits */
-#define ICR0_GIE 0x80 /* global interrupt enable */
-#define ICR0_IRQ3G2IE 0x40 /* DART tick timer, level 3 */
-#define ICR0_IRQ4G2IE 0x20 /* VSBIRQ, level 4 */
-#define ICR0_IRQ5G2IE 0x10 /* DART DUART irq */
-#define ICR0_IRQ6G2IE 0x08 /* DART tick timer, level 6 */
-#define ICR0_IRQ6G4IE 0x04 /* VSBIRQ, level 6 */
-#define ICR0_IRQ7G2IE 0x02 /* unused */
-#define ICR0_IRQ7G4IE 0x01 /* PARERR */
-
-/* ICR1 bits */
-#define ICR1_VEC_MASK 0xf0 /* interrupt vector significant nibble */
-#define ICR1_IRQ7G6IE 0x02 /* ACFAIL */
-#define ICR1_IRQ7G5IE 0x01 /* ABORT */
-
-/* STAT bits */
-#define STAT_WTS 0x020000 /* Watchdog timeout */
-#define STAT_IRQ7G6S 0x010000 /* ACFAIL */
-#define STAT_IRQ7G5S 0x008000 /* ABORT */
-#define STAT_GPSTATL 0x004000 /* SYSFAIL (latched) */
-#define STAT_GPSTATS 0x002000 /* SYSFAIL */
-#define STAT_PORS 0x001000 /* Power On Reset */
-#define STAT_IRQ3G2 0x000800 /* DART tick timer */
-#define STAT_IRQ4G2 0x000400 /* VSBIRQ */
-#define STAT_IRQ5G2 0x000200 /* DART irq */
-#define STAT_IRQ6G2 0x000100 /* DART tick timer */
-#define STAT_IRQ7G2 0x000080 /* unused */
-#define STAT_TMR2 0x000040 /* timer2 timeout */
-#define STAT_TMR1 0x000020 /* timer1 timeout */
-#define STAT_TMR0 0x000010 /* timer0 timeout */
-#define STAT_IRQ6G4 0x000008 /* VSBIRQ */
-#define STAT_IRQ7G4 0x000004 /* PARERR */
-#define STAT_IRQ7G5 0x000002 /* ABORT */
-#define STAT_IRQ7G6 0x000001 /* ACFAIL */
-
-/*
- * Fixed interrupt vectors
- */
-
-#define LRC_VECBASE 0x40
-#define LRC_NVEC 0x10
-
-#define LRCVEC_TIMER0 0x00
-#define LRCVEC_TIMER1 0x01
-#define LRCVEC_TIMER2 0x02
-#define LRCVEC_IRQ7G2 0x04 /* not used */
-#define LRCVEC_IRQ6G2 0x05
-#define LRCVEC_IRQ3G2 0x07
-#define LRCVEC_PARERR 0x08
-#define LRCVEC_VSBIRQ 0x09
-#define LRCVEC_ABORT 0x0a
-#define LRCVEC_ACFAIL 0x0b
-
-#define LRCVEC_DART 0x0c /* as set up by the BUG; not a fixed value */
-
-int lrcintr_establish(u_int, struct intrhand *, const char *);
-int lrcspeed(struct lrcreg *);
-
-extern struct lrcreg *sys_lrc;
diff --git a/sys/arch/mvme68k/dev/mainbus.c b/sys/arch/mvme68k/dev/mainbus.c
deleted file mode 100644
index 2d0ec308756..00000000000
--- a/sys/arch/mvme68k/dev/mainbus.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/* $OpenBSD: mainbus.c,v 1.2 2009/03/01 21:39:59 miod Exp $ */
-/*
- * Copyright (c) 1998 Steve Murphree, Jr.
- * Copyright (c) 2004, Miodrag Vallat.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/reboot.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/extent.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/bus.h>
-#include <machine/autoconf.h>
-
-void mainbus_attach(struct device *, struct device *, void *);
-int mainbus_match(struct device *, void *, void *);
-int mainbus_print(void *, const char *);
-int mainbus_scan(struct device *, void *, void *);
-
-/*
- * bus_space routines for 1:1 obio mappings
- */
-
-int mainbus_map(bus_addr_t, bus_size_t, int, bus_space_handle_t *);
-void mainbus_unmap(bus_space_handle_t, bus_size_t);
-int mainbus_subregion(bus_space_handle_t, bus_size_t, bus_size_t,
- bus_space_handle_t *);
-void *mainbus_vaddr(bus_space_handle_t);
-
-const struct mvme68k_bus_space_tag mainbus_bustag = {
- mainbus_map,
- mainbus_unmap,
- mainbus_subregion,
- mainbus_vaddr
-};
-
-extern struct extent *iomap_extent;
-extern struct vm_map *iomap_map;
-
-/*
- * Internal IO space (iiomapsize).
- *
- * Internal IO space is mapped in the kernel from ``intiobase'' to
- * ``intiolimit'' (defined in locore.s). Since it is always mapped,
- * conversion between physical and kernel virtual addresses is easy.
- */
-#if 0 /* in <machine/cpu.h> for now */
-#define ISIIOVA(va) \
- ((va) >= intiobase && (va) < intiolimit)
-#define IIOV(pa) ((pa) - iiomapbase + intiobase)
-#define IIOP(va) ((va) - intiobase + iiomapbase)
-#define IIOPOFF(pa) ((pa) - iiomapbase)
-#endif
-#define ISIIOPA(pa) ((uint)IIOPOFF(pa) < ptoa(iiomapsize))
-
-int
-mainbus_map(bus_addr_t addr, bus_size_t size, int flags,
- bus_space_handle_t *ret)
-{
- if (ISIIOPA(addr)) {
- *ret = (bus_space_handle_t)IIOV(addr);
- return (0);
- } else
- return (ENOMEM);
-}
-
-void
-mainbus_unmap(bus_space_handle_t handle, bus_size_t size)
-{
-}
-
-int
-mainbus_subregion(bus_space_handle_t handle, bus_addr_t offset,
- bus_size_t size, bus_space_handle_t *ret)
-{
- *ret = handle + offset;
- return (0);
-}
-
-void *
-mainbus_vaddr(bus_space_handle_t handle)
-{
- return (void *)handle;
-}
-
-/*
- * Configuration glue
- */
-
-struct cfattach mainbus_ca = {
- sizeof(struct device), mainbus_match, mainbus_attach
-};
-
-struct cfdriver mainbus_cd = {
- NULL, "mainbus", DV_DULL
-};
-
-int
-mainbus_match(parent, cf, args)
- struct device *parent;
- void *cf;
- void *args;
-{
- return (1);
-}
-
-int
-mainbus_print(args, bus)
- void *args;
- const char *bus;
-{
- struct confargs *ca = args;
-
- if (ca->ca_paddr != (paddr_t)-1)
- printf(" addr 0x%x", ca->ca_paddr);
- return (UNCONF);
-}
-
-int
-mainbus_scan(parent, child, args)
- struct device *parent;
- void *child, *args;
-{
- struct cfdata *cf = child;
- struct confargs oca;
-
- bzero(&oca, sizeof oca);
- oca.ca_iot = &mainbus_bustag;
- oca.ca_dmat = 0; /* XXX no need for a meaningful value yet */
- oca.ca_paddr = cf->cf_loc[0];
- oca.ca_vaddr = (vaddr_t)-1; /* XXX until it dies */
- oca.ca_ipl = -1;
- oca.ca_bustype = BUS_MAIN;
- oca.ca_name = cf->cf_driver->cd_name;
- if ((*cf->cf_attach->ca_match)(parent, cf, &oca) == 0)
- return (0);
- config_attach(parent, cf, &oca, mainbus_print);
- return (1);
-}
-
-void
-mainbus_attach(parent, self, args)
- struct device *parent, *self;
- void *args;
-{
- printf("\n");
-
- /* XXX
- * should have a please-attach-first list for mainbus,
- * to ensure that the pcc/vme2/mcc chips are attached
- * first.
- */
-
- (void)config_search(mainbus_scan, self, args);
-}
diff --git a/sys/arch/mvme68k/dev/mc.c b/sys/arch/mvme68k/dev/mc.c
deleted file mode 100644
index 10b91981ec0..00000000000
--- a/sys/arch/mvme68k/dev/mc.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/* $OpenBSD: mc.c,v 1.19 2010/06/26 23:24:43 guenther Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * VME162/VME172 MCchip
- */
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-#include <sys/uio.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/syslog.h>
-#include <sys/fcntl.h>
-#include <sys/device.h>
-#include <machine/cpu.h>
-#include <machine/autoconf.h>
-#include <dev/cons.h>
-
-#include <mvme68k/dev/mcreg.h>
-
-struct mcsoftc {
- struct device sc_dev;
- vaddr_t sc_vaddr;
- paddr_t sc_paddr;
- struct mcreg *sc_mc;
- struct intrhand sc_nmiih;
-};
-
-void mcattach(struct device *, struct device *, void *);
-int mcmatch(struct device *, void *, void *);
-int mcabort(void *);
-int mc_print(void *, const char *);
-int mc_scan(struct device *, void *, void *);
-
-struct cfattach mc_ca = {
- sizeof(struct mcsoftc), mcmatch, mcattach
-};
-
-struct cfdriver mc_cd = {
- NULL, "mc", DV_DULL
-};
-
-struct mcreg *sys_mc = NULL;
-
-int
-mcmatch(parent, vcf, args)
- struct device *parent;
- void *vcf, *args;
-{
- struct confargs *ca = args;
- struct mcreg *mc = (struct mcreg *)(IIOV(ca->ca_paddr) + MC_MCCHIP_OFF);
-
- if ((cputyp != CPU_172 && cputyp != CPU_162) ||
- badvaddr((vaddr_t)mc, 1) || mc->mc_chipid != MC_CHIPID)
- return (0);
- return (1);
-}
-
-int
-mc_print(args, bus)
- void *args;
- const char *bus;
-{
- struct confargs *ca = args;
-
- if (ca->ca_offset != -1)
- printf(" offset 0x%x", ca->ca_offset);
- if (ca->ca_ipl > 0)
- printf(" ipl %d", ca->ca_ipl);
- return (UNCONF);
-}
-
-int
-mc_scan(parent, child, args)
- struct device *parent;
- void *child, *args;
-{
- struct cfdata *cf = child;
- struct mcsoftc *sc = (struct mcsoftc *)parent;
- struct confargs *ca = args;
- struct confargs oca;
-
- bzero(&oca, sizeof oca);
- oca.ca_iot = ca->ca_iot;
- oca.ca_dmat = ca->ca_dmat;
- oca.ca_offset = cf->cf_loc[0];
- oca.ca_ipl = cf->cf_loc[1];
- if (oca.ca_offset != -1 && ISIIOVA(sc->sc_vaddr + oca.ca_offset)) {
- oca.ca_vaddr = sc->sc_vaddr + oca.ca_offset;
- oca.ca_paddr = sc->sc_paddr + oca.ca_offset;
- } else {
- oca.ca_vaddr = (vaddr_t)-1;
- oca.ca_paddr = (paddr_t)-1;
- }
- oca.ca_bustype = BUS_MC;
- oca.ca_name = cf->cf_driver->cd_name;
- if ((*cf->cf_attach->ca_match)(parent, cf, &oca) == 0)
- return (0);
- config_attach(parent, cf, &oca, mc_print);
- return (1);
-}
-
-void
-mcattach(parent, self, args)
- struct device *parent, *self;
- void *args;
-{
- struct confargs *ca = args;
- struct mcsoftc *sc = (struct mcsoftc *)self;
-
- if (sys_mc)
- panic("mc already attached!");
-
- /*
- * since we know ourself to land in intiobase land,
- * we must adjust our address
- */
- sc->sc_paddr = ca->ca_paddr;
- sc->sc_vaddr = IIOV(sc->sc_paddr);
- sc->sc_mc = (struct mcreg *)(sc->sc_vaddr + MC_MCCHIP_OFF);
- sys_mc = sc->sc_mc;
-
- printf(": rev %d\n", sc->sc_mc->mc_chiprev);
-
- sc->sc_nmiih.ih_fn = mcabort;
- sc->sc_nmiih.ih_ipl = 7;
- sc->sc_nmiih.ih_wantframe = 1;
- mcintr_establish(MCV_ABORT, &sc->sc_nmiih, self->dv_xname);
-
- sc->sc_mc->mc_abortirq = 7 | MC_IRQ_IEN | MC_IRQ_ICLR;
- sc->sc_mc->mc_vecbase = MC_VECBASE;
-
- sc->sc_mc->mc_genctl |= MC_GENCTL_IEN; /* global irq enable */
-
- config_search(mc_scan, self, args);
-}
-
-/*
- * MC interrupts land in a MC_NVEC sized hole starting at MC_VECBASE
- */
-int
-mcintr_establish(vec, ih, name)
- int vec;
- struct intrhand *ih;
- const char *name;
-{
-#ifdef DIAGNOSTIC
- if (vec < 0 || vec >= MC_NVEC)
- panic("mcintr_establish: illegal vector for %s: 0x%x",
- name, vec);
-#endif
-
- return intr_establish(MC_VECBASE + vec, ih, name);
-}
-
-int
-mcabort(frame)
- void *frame;
-{
- /* wait for it to debounce */
- while (sys_mc->mc_abortirq & MC_ABORT_ABS)
- ;
-
- sys_mc->mc_abortirq = sys_mc->mc_abortirq | MC_IRQ_ICLR;
-
- nmihand(frame);
- return (1);
-}
-
-#include "flash.h"
-
-#if NFLASH > 0
-void
-mc_enableflashwrite(on)
- int on;
-{
- struct mcsoftc *sc = (struct mcsoftc *) mc_cd.cd_devs[0];
- volatile u_char *ena, x;
- /*
- * Check MC chip revision, as the way to enable flash writes
- * has been changed from a memory location in BBRAM to a
- * bit in the Flash Control Reg. XXX - smurph
- */
- if (sc->sc_mc->mc_chiprev == 0x01) {
- if (on)
- sc->sc_mc->mc_flashctl |= MC_FLASHCTL_WRITE;
- else
- sc->sc_mc->mc_flashctl &= ~MC_FLASHCTL_WRITE;
- } else {
- ena = (u_char *)sc->sc_vaddr +
- (on ? MC_ENAFLASHWRITE_OFFSET : MC_DISFLASHWRITE_OFFSET);
- x = *ena;
- }
-}
-/*
- * Function to check if we booted from flash or prom.
- * If we booted from PROM, flash mem is available.
- */
-int
-mc_hasflash(void)
-{
- struct mcsoftc *sc = (struct mcsoftc *) mc_cd.cd_devs[0];
- if (sc->sc_mc->mc_input & MC_INPUT_PROM)
- return 1;
- else
- return 0;
-}
-#endif
diff --git a/sys/arch/mvme68k/dev/mcreg.h b/sys/arch/mvme68k/dev/mcreg.h
deleted file mode 100644
index 8aefb22893c..00000000000
--- a/sys/arch/mvme68k/dev/mcreg.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/* $OpenBSD: mcreg.h,v 1.11 2013/12/01 21:56:42 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * VME162 MCchip
- */
-struct mcreg {
-/*0x00*/ volatile u_char mc_chipid;
-/*0x01*/ volatile u_char mc_chiprev;
-/*0x02*/ volatile u_char mc_genctl;
-/*0x03*/ volatile u_char mc_vecbase;
-/*0x04*/ volatile u_long mc_t1cmp;
-/*0x08*/ volatile u_long mc_t1count;
-/*0x0C*/ volatile u_long mc_t2cmp;
-/*0x10*/ volatile u_long mc_t2count;
-/*0x14*/ volatile u_char mc_lsbprescale;
-/*0x15*/ volatile u_char mc_adjprescale;
-/*0x16*/ volatile u_char mc_t2ctl;
-/*0x17*/ volatile u_char mc_t1ctl;
-/*0x18*/ volatile u_char mc_t4irq;
-/*0x19*/ volatile u_char mc_t3irq;
-/*0x1A*/ volatile u_char mc_t2irq;
-/*0x1B*/ volatile u_char mc_t1irq;
-/*0x1C*/ volatile u_char mc_parity;
-/*0x1D*/ volatile u_char mc_zsirq;
-/*0x1E*/ volatile u_char mc_t4ctl;
-/*0x1F*/ volatile u_char mc_t3ctl;
-/*0x20*/ volatile u_short mc_drambase;
-/*0x22*/ volatile u_short mc_srambase;
-/*0x24*/ volatile u_char mc_dramsize;
-/*0x25*/ volatile u_char mc_memoptions;
- #define MC_MEMOPTIONS_SRAMMASK 0x18
- #define MC_MEMOPTIONS_SRAM128K 0x00
- #define MC_MEMOPTIONS_SRAM512K 0x08
- #define MC_MEMOPTIONS_SRAM1M 0x10
- #define MC_MEMOPTIONS_SRAM2M 0x18
- #define MC_MEMOPTIONS_DRAMMASK 0x07
- #define MC_MEMOPTIONS_DRAM1M 0x00
- #define MC_MEMOPTIONS_DRAM2M 0x01
- #define MC_MEMOPTIONS_DRAM4M 0x03
- #define MC_MEMOPTIONS_DRAM4M2 0x04
- #define MC_MEMOPTIONS_DRAM8M 0x05
- #define MC_MEMOPTIONS_DRAM16M 0x07
-/*0x26*/ volatile u_char mc_sramsize;
-/*0x27*/ volatile u_char mc_resv1;
-/*0x28*/ volatile u_char mc_ieerr;
-/*0x29*/ volatile u_char mc_resv2;
-/*0x2A*/ volatile u_char mc_ieirq;
-/*0x2B*/ volatile u_char mc_iefailirq;
-/*0x2C*/ volatile u_char mc_ncrerr;
-/*0x2D*/ volatile u_char mc_input;
- #define MC_INPUT_USR1 0x80
- #define MC_INPUT_USR2 0x40
- #define MC_INPUT_USR3 0x20
- #define MC_INPUT_USR4 0x10
- #define MC_INPUT_PROM 0x08
- #define MC_INPUT_BUG3 0x04
- #define MC_INPUT_BUG2 0x02
- #define MC_INPUT_BUG1 0x01
-/*0x2E*/ volatile u_char mc_ver;
-/*0x01*/ volatile u_char mc_ncrirq;
-/*0x01*/ volatile u_long mc_t3cmp;
-/*0x01*/ volatile u_long mc_t3count;
-/*0x01*/ volatile u_long mc_t4cmp;
-/*0x01*/ volatile u_long mc_t4count;
-/*0x01*/ volatile u_char mc_busclock;
-/*0x01*/ volatile u_char mc_promtime;
-/*0x01*/ volatile u_char mc_flashctl;
- #define MC_FLASHCTL_WRITE 0x08
-/*0x01*/ volatile u_char mc_abortirq;
-/*0x01*/ volatile u_char mc_resetctl;
-/*0x01*/ volatile u_char mc_watchdogctl;
-/*0x01*/ volatile u_char mc_watchdogtime;
-/*0x01*/ volatile u_char mc_resv3;
-/*0x01*/ volatile u_char mc_dramctl;
-/*0x01*/ volatile u_char mc_resv4;
-/*0x01*/ volatile u_char mc_mpustat;
-/*0x01*/ volatile u_char mc_resv5;
-/*0x01*/ volatile u_long mc_prescale;
-};
-#define MC_MCCHIP_OFF 0x42000
-#define MC_CHIPID 0x84
-
-/*
- * points to system's MCchip registers
- */
-extern struct mcreg *sys_mc;
-
-/*
- * for the console we need zs phys addr
- */
-#define ZS0_PHYS_162 (0xfff45000)
-#define ZS1_PHYS_162 (0xfff45800)
-
-/*
- * We lock off our interrupt vector at 0x50.
- */
-#define MC_VECBASE 0x50
-#define MC_NVEC 16
-
-#define MCV_ZS 0x00
-#define MCV_TIMER4 0x03
-#define MCV_TIMER3 0x04
-#define MCV_NCR 0x05
-#define MCV_IEFAIL 0x06
-#define MCV_IE 0x07
-#define MCV_TIMER2 0x08
-#define MCV_TIMER1 0x09
-#define MCV_PARITY 0x0b
-#define MCV_ABORT 0x0e
-
-#define MC_TCTL_CEN 0x01
-#define MC_TCTL_COC 0x02
-#define MC_TCTL_COVF 0x04
-#define MC_TCTL_OVF 0xf0
-#define MC_TCTL_OVF_SHIFT 4
-
-#define MC_ABORT_ABS 0x40
-
-#define mc_timer_us2lim(us) (us) /* timer increments in "us" */
-
-#define MC_IRQ_IPL 0x07
-#define MC_IRQ_ICLR 0x08
-#define MC_IRQ_IEN 0x10
-#define MC_IRQ_INT 0x20
-
-#define MC_GENCTL_IEN 0x02
-
-#define MC_IEERR_SCLR 0x01
-
-#define MC_SC_INHIBIT (0 << 6)
-#define MC_SC_SNOOP (1 << 6)
-#define MC_SC_INVAL (2 << 6)
-#define MC_SC_RESV (3 << 6)
-
-#define MC_VER_ISLX 0x40
-#define MC_VER_REAL040 0x10
-#define MC_VER_NOIE 0x08
-#define MC_VER_NONCR 0x04
-#define MC_VER_NOVME 0x02
-#define MC_VER_33MHZ 0x01
-
-void mc_enableflashwrite(int on);
-#define MC_ENAFLASHWRITE_OFFSET 0xcc000
-#define MC_DISFLASHWRITE_OFFSET 0xc8000
-int mc_hasflash(void);
-
-int mcintr_establish(int, struct intrhand *, const char *);
diff --git a/sys/arch/mvme68k/dev/memc.c b/sys/arch/mvme68k/dev/memc.c
deleted file mode 100644
index f1914a26441..00000000000
--- a/sys/arch/mvme68k/dev/memc.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/* $OpenBSD: memc.c,v 1.11 2010/06/26 23:24:43 guenther Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * MEMC/MCECC chips
- * these chips are rather similar in appearance except that the MEMC
- * does parity while the MCECC does ECC.
- */
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-#include <sys/uio.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/syslog.h>
-#include <sys/fcntl.h>
-#include <sys/device.h>
-#include <machine/cpu.h>
-#include <machine/autoconf.h>
-#include <dev/cons.h>
-
-#include <mvme68k/dev/memcreg.h>
-
-struct memcsoftc {
- struct device sc_dev;
- void * sc_vaddr;
- struct memcreg *sc_memc;
- struct intrhand sc_ih;
-};
-
-void memcattach(struct device *, struct device *, void *);
-int memcmatch(struct device *, void *, void *);
-
-struct cfattach memc_ca = {
- sizeof(struct memcsoftc), memcmatch, memcattach
-};
-
-struct cfdriver memc_cd = {
- NULL, "memc", DV_DULL
-};
-
-int memcintr(struct frame *frame);
-
-int
-memcmatch(parent, vcf, args)
- struct device *parent;
- void *vcf, *args;
-{
- struct confargs *ca = args;
- struct memcreg *memc = (struct memcreg *)ca->ca_vaddr;
-
- if (badvaddr((vaddr_t)memc, 1))
- return (0);
- if (memc->memc_chipid==MEMC_CHIPID || memc->memc_chipid==MCECC_CHIPID)
- return (1);
- return (0);
-}
-
-void
-memcattach(parent, self, args)
- struct device *parent, *self;
- void *args;
-{
- struct confargs *ca = args;
- struct memcsoftc *sc = (struct memcsoftc *)self;
-
- /*
- * since we know ourself to land in intiobase land,
- * we must adjust our address
- */
- sc->sc_memc = (struct memcreg *)ca->ca_vaddr;
-
- printf(": %s rev %d",
- (sc->sc_memc->memc_chipid == MEMC_CHIPID) ? "MEMC040" : "MCECC",
- sc->sc_memc->memc_chiprev);
-
-#if 0
- sc->sc_ih.ih_fn = memcintr;
- sc->sc_ih.ih_ipl = 7;
- sc->sc_ih.ih_wantframe = 1;
- mcintr_establish(xxx, &sc->sc_ih, self->dv_xname);
-#endif
-
- switch (sc->sc_memc->memc_chipid) {
- case MEMC_CHIPID:
- break;
- case MCECC_CHIPID:
- break;
- }
-
- printf("\n");
-}
-
-int
-memcintr(frame)
- struct frame *frame;
-{
- return (0);
-}
diff --git a/sys/arch/mvme68k/dev/memcreg.h b/sys/arch/mvme68k/dev/memcreg.h
deleted file mode 100644
index a11a5bbce0f..00000000000
--- a/sys/arch/mvme68k/dev/memcreg.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* $OpenBSD: memcreg.h,v 1.4 2003/06/02 05:09:14 deraadt Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * the MEMC's registers are a subset of the MCECC chip
- */
-struct memcreg {
- volatile u_char memc_chipid;
- volatile u_char xx0[3];
- volatile u_char memc_chiprev;
- volatile u_char xx1[3];
- volatile u_char memc_memconf;
-#define MEMC_MEMCONF_MSIZ 0x07
-#define MEMC_MEMCONF_RTOB(x) ((4*1024*1024) << ((x) & MEMC_MEMCONF_MSIZ))
- volatile u_char xx2[3];
- volatile u_char memc_x0;
- volatile u_char xx3[3];
- volatile u_char memc_x1;
- volatile u_char xx4[3];
- volatile u_char memc_baseaddr;
- volatile u_char xx5[3];
- volatile u_char memc_control;
- volatile u_char xx6[3];
- volatile u_char memc_bclk;
- volatile u_char xx7[3];
-
- /* the following registers only exist on the MCECC */
- volatile u_char memc_datactl;
- volatile u_char xx8[3];
- volatile u_char memc_scrubctl;
- volatile u_char xx9[3];
- volatile u_char memc_scrubperh;
- volatile u_char xx10[3];
- volatile u_char memc_scrubperl;
- volatile u_char xx11[3];
- volatile u_char memc_chipprescale;
- volatile u_char xx12[3];
- volatile u_char memc_scrubtime;
- volatile u_char xx13[3];
- volatile u_char memc_scrubprescaleh;
- volatile u_char xx14[3];
- volatile u_char memc_scrubprescalem;
- volatile u_char xx15[3];
- volatile u_char memc_scrubprescalel;
- volatile u_char xx16[3];
- volatile u_char memc_scrubtimeh;
- volatile u_char xx17[3];
- volatile u_char memc_scrubtimel;
- volatile u_char xx18[3];
- volatile u_char memc_scrubaddrhh;
- volatile u_char xx19[3];
- volatile u_char memc_scrubaddrhm;
- volatile u_char xx20[3];
- volatile u_char memc_scrubaddrlm;
- volatile u_char xx21[3];
- volatile u_char memc_scrubaddrll;
- volatile u_char xx22[3];
- volatile u_char memc_errlog;
- volatile u_char xx23[3];
- volatile u_char memc_errloghh;
- volatile u_char xx24[3];
- volatile u_char memc_errloghm;
- volatile u_char xx25[3];
- volatile u_char memc_errloglm;
- volatile u_char xx26[3];
- volatile u_char memc_errlogll;
- volatile u_char xx27[3];
- volatile u_char memc_errsyndrome;
- volatile u_char xx28[3];
- volatile u_char memc_defaults1;
- volatile u_char xx29[3];
- volatile u_char memc_defaults2;
- volatile u_char xx30[3];
-};
-
-#define MEMC_CHIPID 0x80
-#define MCECC_CHIPID 0x81
diff --git a/sys/arch/mvme68k/dev/memdevs.c b/sys/arch/mvme68k/dev/memdevs.c
deleted file mode 100644
index 7a70eebbd31..00000000000
--- a/sys/arch/mvme68k/dev/memdevs.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* $OpenBSD: memdevs.c,v 1.6 2005/11/24 22:43:16 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/buf.h>
-#include <sys/systm.h>
-#include <sys/uio.h>
-#include <sys/malloc.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-
-#include <mvme68k/dev/memdevs.h>
-
-/*ARGSUSED*/
-int
-memdevrw(base, len, uio, flags)
- vaddr_t base;
- int len;
- struct uio *uio;
- int flags;
-{
- vaddr_t v;
- int c;
- struct iovec *iov;
- int error = 0;
-
- while (uio->uio_resid > 0 && error == 0) {
- iov = uio->uio_iov;
- if (iov->iov_len == 0) {
- uio->uio_iov++;
- uio->uio_iovcnt--;
- if (uio->uio_iovcnt < 0)
- panic("memdevrw");
- continue;
- }
-
- v = uio->uio_offset;
- c = min(iov->iov_len, MAXPHYS);
- if (v + c > len)
- c = len - v; /* till end of dev */
- if (c == 0)
- return (0);
- error = uiomove((caddr_t)base + v, c, uio);
- }
- return (error);
-}
diff --git a/sys/arch/mvme68k/dev/memdevs.h b/sys/arch/mvme68k/dev/memdevs.h
deleted file mode 100644
index 0972a1956e1..00000000000
--- a/sys/arch/mvme68k/dev/memdevs.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* $OpenBSD: memdevs.h,v 1.3 2005/11/24 22:43:16 miod Exp $ */
-/*
- * Copyright (c) 2002, Miodrag Vallat.
- * All rights reserved.
- *
- * Permission to redistribute, use, copy, and modify this software
- * is hereby granted without fee, provided that the following
- * conditions are met:
- *
- * 1. This entire notice is included in all source code copies of any
- * software which is or includes a copy or modification of this
- * software.
- * 2. The name of the author may not be used to endorse or promote
- * products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-extern int memdevrw(vaddr_t, int, struct uio *, int);
diff --git a/sys/arch/mvme68k/dev/nvram.c b/sys/arch/mvme68k/dev/nvram.c
deleted file mode 100644
index 3070729010a..00000000000
--- a/sys/arch/mvme68k/dev/nvram.c
+++ /dev/null
@@ -1,465 +0,0 @@
-/* $OpenBSD: nvram.c,v 1.23 2013/07/02 04:39:04 guenther Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * 8/22/2000 BH Cleaned up year 2000 problems with calendar hardware.
- * This code will break again in 2068 or so - come dance on my grave.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/ioctl.h>
-#include <sys/device.h>
-#include <sys/timetc.h>
-
-#include <machine/autoconf.h>
-#include <machine/conf.h>
-#include <machine/cpu.h>
-#include <machine/mioctl.h>
-#include <machine/psl.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <mvme68k/dev/memdevs.h>
-#include <mvme68k/dev/nvramreg.h>
-
-struct nvramsoftc {
- struct device sc_dev;
- paddr_t sc_paddr;
- vaddr_t sc_vaddr;
- int sc_len;
- void *sc_clockregs;
-};
-
-void nvramattach(struct device *, struct device *, void *);
-int nvrammatch(struct device *, void *, void *);
-
-struct cfattach nvram_ca = {
- sizeof(struct nvramsoftc), nvrammatch, nvramattach
-};
-
-struct cfdriver nvram_cd = {
- NULL, "nvram", DV_DULL
-};
-
-int
-nvrammatch(parent, vcf, args)
- struct device *parent;
- void *vcf, *args;
-{
- struct confargs *ca = args;
-
-/*X*/ if (ca->ca_vaddr == (vaddr_t)-1)
-/*X*/ return (1);
- return (!badvaddr(ca->ca_vaddr, 1));
-}
-
-void
-nvramattach(parent, self, args)
- struct device *parent, *self;
- void *args;
-{
- struct confargs *ca = args;
- struct nvramsoftc *sc = (struct nvramsoftc *)self;
- vsize_t maplen;
-
- sc->sc_paddr = ca->ca_paddr;
- sc->sc_vaddr = (vaddr_t)ca->ca_vaddr;
-
- switch (cputyp) {
- default:
- sc->sc_len = MK48T08_SIZE;
- break;
-#ifdef MVME141
- case CPU_141:
- sc->sc_len = MK48T02_SIZE;
- break;
-#endif
-#ifdef MVME147
- case CPU_147:
- sc->sc_len = MK48T02_SIZE;
- break;
-#endif
- }
-
- /*
- * On the MVME165, the MK48T08 is mapped as one byte per longword,
- * thus spans four time as much address space.
- */
-#ifdef MVME165
- if (cputyp == CPU_165)
- maplen = 4 * sc->sc_len;
- else
-#endif
- maplen = sc->sc_len;
-
-/*X*/ if (sc->sc_vaddr == -1)
-/*X*/ sc->sc_vaddr = mapiodev(sc->sc_paddr, maplen);
-/*X*/ if (sc->sc_vaddr == 0)
-/*X*/ panic("failed to map!");
-
-#ifdef MVME165
- if (cputyp == CPU_165)
- sc->sc_clockregs = (void *)(sc->sc_vaddr + maplen -
- sizeof(struct clockreg_165));
- else
-#endif
- sc->sc_clockregs = (void *)(sc->sc_vaddr + sc->sc_len -
- sizeof(struct clockreg));
-
- printf(": MK48T0%d len %d\n", sc->sc_len / 1024, sc->sc_len);
-}
-
-/*
- * BCD to decimal and decimal to BCD.
- */
-#define FROMBCD(x) (((x) >> 4) * 10 + ((x) & 0xf))
-#define TOBCD(x) (((x) / 10 * 16) + ((x) % 10))
-
-#define SECYR (SECDAY * 365)
-#define LEAPYEAR(y) (((y) & 3) == 0)
-
-/*
- * This code is defunct after 2068.
- * Will Unix still be here then??
- */
-const short dayyr[12] =
-{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
-
-struct chiptime {
- int sec;
- int min;
- int hour;
- int wday;
- int day;
- int mon;
- int year;
-};
-
-time_t chiptotime(int, int, int, int, int, int);
-void timetochip(struct chiptime *);
-
-time_t
-chiptotime(sec, min, hour, day, mon, year)
- register int sec, min, hour, day, mon, year;
-{
- register int days, yr;
-
- sec = FROMBCD(sec);
- min = FROMBCD(min);
- hour = FROMBCD(hour);
- day = FROMBCD(day);
- mon = FROMBCD(mon);
- year = FROMBCD(year) + YEAR0;
-
- /* simple sanity checks */
- if (year>164 || mon<1 || mon>12 || day<1 || day>31)
- return (0);
- yr = 70;
- days = 0;
-
- if (year < 70) { /* 2000 <= year */
- for (; yr < 100; yr++) /* deal with first 30 years */
- days += LEAPYEAR(yr) ? 366 : 365;
- yr = 0;
- }
-
- for (; yr < year; yr++) /* deal with years left */
- days += LEAPYEAR(yr) ? 366 : 365;
-
- days += dayyr[mon - 1] + day - 1;
-
- if (LEAPYEAR(yr) && mon > 2)
- days++;
-
- /* now have days since Jan 1, 1970; the rest is easy... */
- return ((time_t)days * SECDAY + hour * 3600 + min * 60 + sec);
-}
-
-void
-timetochip(c)
- struct chiptime *c;
-{
- time_t t2, now = time_second;
- int t, t3;
-
- /* January 1 1970 was a Thursday (4 in unix wdays) */
- /* compute the days since the epoch */
- t2 = now / SECDAY;
-
- t3 = (t2 + 4) % 7; /* day of week */
- c->wday = TOBCD(t3 + 1);
-
- /* compute the year */
- t = 69;
- while (t2 >= 0) { /* whittle off years */
- t3 = t2;
- t++;
- t2 -= LEAPYEAR(t) ? 366 : 365;
- }
- c->year = t;
-
- /* t3 = month + day; separate */
- t = LEAPYEAR(t);
- for (t2 = 1; t2 < 12; t2++)
- if (t3 < (dayyr[t2] + ((t && (t2 > 1)) ? 1:0)))
- break;
-
- /* t2 is month */
- c->mon = t2;
- c->day = t3 - dayyr[t2 - 1] + 1;
- if (t && t2 > 2)
- c->day--;
-
- /* the rest is easy */
- t = now % SECDAY;
- c->hour = t / 3600;
- t %= 3600;
- c->min = t / 60;
- c->sec = t % 60;
-
- c->sec = TOBCD(c->sec);
- c->min = TOBCD(c->min);
- c->hour = TOBCD(c->hour);
- c->day = TOBCD(c->day);
- c->mon = TOBCD(c->mon);
- c->year = TOBCD((c->year - YEAR0) % 100);
-}
-
-/*
- * Set up the system's time, given a `reasonable' time value.
- */
-void
-inittodr(base)
- time_t base;
-{
- struct nvramsoftc *sc = (struct nvramsoftc *) nvram_cd.cd_devs[0];
- int sec, min, hour, day, mon, year;
- int badbase = 0, waszero = base == 0;
- struct timespec ts;
-
- ts.tv_sec = ts.tv_nsec = 0;
-
- if (base < (2012 - 1970) * SECYR) {
- /*
- * If base is 0, assume filesystem time is just unknown
- * instead of preposterous. Don't bark.
- */
- if (base != 0)
- printf("WARNING: preposterous time in file system\n");
- /* not going to use it anyway, if the chip is readable */
- base = (2012 - 1970) * SECYR;
- badbase = 1;
- }
-
-#ifdef MVME165
- if (cputyp == CPU_165) {
- struct clockreg_165 *cl = sc->sc_clockregs;
-
- cl->cl_csr |= CLK_READ; /* enable read (stop time) */
- sec = cl->cl_sec;
- min = cl->cl_min;
- hour = cl->cl_hour;
- day = cl->cl_mday;
- mon = cl->cl_month;
- year = cl->cl_year;
- cl->cl_csr &= ~CLK_READ; /* time wears on */
- } else
-#endif
- {
- struct clockreg *cl = sc->sc_clockregs;
-
- cl->cl_csr |= CLK_READ; /* enable read (stop time) */
- sec = cl->cl_sec;
- min = cl->cl_min;
- hour = cl->cl_hour;
- day = cl->cl_mday;
- mon = cl->cl_month;
- year = cl->cl_year;
- cl->cl_csr &= ~CLK_READ; /* time wears on */
- }
-
- if ((ts.tv_sec = chiptotime(sec, min, hour, day, mon, year)) == 0) {
- printf("WARNING: bad date in nvram");
- /*
- * Believe the time in the file system for lack of
- * anything better, resetting the clock.
- */
- ts.tv_sec = base;
- tc_setclock(&ts);
-
- if (!badbase)
- resettodr();
- } else {
- int deltat = ts.tv_sec - base;
-
- tc_setclock(&ts);
- if (deltat < 0)
- deltat = -deltat;
- if (waszero || deltat < 2 * SECDAY)
- return;
- printf("WARNING: clock %s %d days",
- ts.tv_sec < base ? "lost" : "gained", deltat / SECDAY);
- }
- printf(" -- CHECK AND RESET THE DATE!\n");
-}
-
-/*
- * Reset the clock based on the current time.
- * Used when the current clock is preposterous, when the time is changed,
- * and when rebooting. Do nothing if the time is not yet known, e.g.,
- * when crashing during autoconfig.
- */
-void
-resettodr()
-{
- struct nvramsoftc *sc = (struct nvramsoftc *)nvram_cd.cd_devs[0];
- struct chiptime c;
-
- if (!time_second || sc == NULL || sc->sc_clockregs == NULL)
- return;
- timetochip(&c);
-
-#ifdef MVME165
- if (cputyp == CPU_165) {
- struct clockreg_165 *cl = sc->sc_clockregs;
-
- cl->cl_csr |= CLK_WRITE; /* enable write */
- cl->cl_sec = c.sec;
- cl->cl_min = c.min;
- cl->cl_hour = c.hour;
- cl->cl_wday = c.wday;
- cl->cl_mday = c.day;
- cl->cl_month = c.mon;
- cl->cl_year = c.year;
- cl->cl_csr &= ~CLK_WRITE; /* load them up */
- } else
-#endif
- {
- struct clockreg *cl = sc->sc_clockregs;
-
- cl->cl_csr |= CLK_WRITE; /* enable write */
- cl->cl_sec = c.sec;
- cl->cl_min = c.min;
- cl->cl_hour = c.hour;
- cl->cl_wday = c.wday;
- cl->cl_mday = c.day;
- cl->cl_month = c.mon;
- cl->cl_year = c.year;
- cl->cl_csr &= ~CLK_WRITE; /* load them up */
- }
-}
-
-/*ARGSUSED*/
-int
-nvramopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- if (minor(dev) >= nvram_cd.cd_ndevs ||
- nvram_cd.cd_devs[minor(dev)] == NULL)
- return (ENODEV);
-#ifdef MVME165
- /* for now, do not allow userland to access the nvram on 165. */
- if (cputyp == CPU_165)
- return (ENXIO);
-#endif
- return (0);
-}
-
-/*ARGSUSED*/
-int
-nvramclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
-
- return (0);
-}
-
-/*ARGSUSED*/
-int
-nvramioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- int unit = minor(dev);
- struct nvramsoftc *sc = (struct nvramsoftc *) nvram_cd.cd_devs[unit];
- int error = 0;
-
- switch (cmd) {
- case MIOCGSIZ:
- *(int *)data = sc->sc_len;
- break;
- default:
- error = ENOTTY;
- break;
- }
- return (error);
-}
-
-/*ARGSUSED*/
-int
-nvramrw(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- int unit = minor(dev);
- struct nvramsoftc *sc = (struct nvramsoftc *) nvram_cd.cd_devs[unit];
-
- return (memdevrw(sc->sc_vaddr, sc->sc_len, uio, flags));
-}
-
-/*
- * If the NVRAM is of the 2K variety, an extra 2K of who-knows-what
- * will also be mmap'd, due to NBPG being 4K. On the MVME147 the NVRAM
- * repeats, so userland gets two copies back-to-back.
- */
-paddr_t
-nvrammmap(dev, off, prot)
- dev_t dev;
- off_t off;
- int prot;
-{
- int unit = minor(dev);
- struct nvramsoftc *sc = (struct nvramsoftc *) nvram_cd.cd_devs[unit];
-
- if (minor(dev) != 0)
- return (-1);
-
- /* allow access only in RAM */
- if (off < 0 || off >= round_page(sc->sc_len))
- return (-1);
- return (sc->sc_paddr + off);
-}
diff --git a/sys/arch/mvme68k/dev/nvramreg.h b/sys/arch/mvme68k/dev/nvramreg.h
deleted file mode 100644
index d430a2565f8..00000000000
--- a/sys/arch/mvme68k/dev/nvramreg.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* $OpenBSD: nvramreg.h,v 1.5 2009/03/01 21:40:49 miod Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Mostek MK48T02 clock.
- */
-struct clockreg {
- volatile u_char cl_csr; /* control register */
- volatile u_char cl_sec; /* seconds (0..59; BCD) */
- volatile u_char cl_min; /* minutes (0..59; BCD) */
- volatile u_char cl_hour; /* hour (0..23; BCD) */
- volatile u_char cl_wday; /* weekday (1..7) */
- volatile u_char cl_mday; /* day in month (1..31; BCD) */
- volatile u_char cl_month; /* month (1..12; BCD) */
- volatile u_char cl_year; /* year (0..99; BCD) */
-};
-
-/*
- * MK48T08 clock registers as found on MVME165 (sparse layout)
- */
-struct clockreg_165 {
- volatile u_char __cl_pad0[3];
- volatile u_char cl_csr; /* control register */
- volatile u_char __cl_pad1[3];
- volatile u_char cl_sec; /* seconds (0..59; BCD) */
- volatile u_char __cl_pad2[3];
- volatile u_char cl_min; /* minutes (0..59; BCD) */
- volatile u_char __cl_pad3[3];
- volatile u_char cl_hour; /* hour (0..23; BCD) */
- volatile u_char __cl_pad4[3];
- volatile u_char cl_wday; /* weekday (1..7) */
- volatile u_char __cl_pad5[3];
- volatile u_char cl_mday; /* day in month (1..31; BCD) */
- volatile u_char __cl_pad6[3];
- volatile u_char cl_month; /* month (1..12; BCD) */
- volatile u_char __cl_pad7[3];
- volatile u_char cl_year; /* year (0..99; BCD) */
-};
-
-/* bits in cl_csr */
-#define CLK_WRITE 0x80 /* want to write */
-#define CLK_READ 0x40 /* want to read (freeze clock) */
-
-/*
- * Motorola chose the year `1900' as their base count.
- */
-#define YEAR0 0
-
-#define MK48T02_SIZE 2*1024
-#define MK48T08_SIZE 8*1024
diff --git a/sys/arch/mvme68k/dev/ofobio.c b/sys/arch/mvme68k/dev/ofobio.c
deleted file mode 100644
index 83917603d7a..00000000000
--- a/sys/arch/mvme68k/dev/ofobio.c
+++ /dev/null
@@ -1,214 +0,0 @@
-/* $OpenBSD: ofobio.c,v 1.2 2012/06/16 19:59:58 miod Exp $ */
-
-/*
- * Copyright (c) 2009 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * MVME141 On-board resources (One-Four-One OBIO)
- *
- * Unlike other MVME boards supported under OpenBSD/mvme68k, there is no
- * specific ASIC (lrc, mc2, pcc, pcc2...) providing a solid base to which
- * all other devices are related.
- *
- * Instead, we have four registers, and no timers. The onboard devices
- * (MC6861 providing serial ports and the clock, VMEchip, VSBchip and
- * NVRAM) may as well attach to mainbus. We nevertheless attach them at
- * ofobio to make things simpler in the kernel.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-
-#include <mvme68k/dev/ofobioreg.h>
-#include <mvme68k/dev/dartreg.h>
-
-struct ofobioreg *sys_ofobio;
-
-struct ofobiosoftc {
- struct device sc_dev;
- struct ofobioreg *sc_regs;
- struct intrhand sc_abortih;
-};
-
-int ofobioabort(void *);
-void ofobioattach(struct device *, struct device *, void *);
-int ofobiomatch(struct device *, void *, void *);
-int ofobioprint(void *, const char *);
-int ofobioscan(struct device *, void *, void *);
-
-struct cfattach ofobio_ca = {
- sizeof(struct ofobiosoftc), ofobiomatch, ofobioattach
-};
-
-struct cfdriver ofobio_cd = {
- NULL, "ofobio", DV_DULL
-};
-
-int
-ofobiomatch(struct device *parent, void *cf, void *aux)
-{
- if (cputyp != CPU_141 || sys_ofobio != NULL)
- return (0);
-
- return (1);
-}
-
-void
-ofobioattach(struct device *parent, struct device *self, void *aux)
-{
-#if 0
- struct confargs *ca = aux;
-#endif
- struct ofobiosoftc *sc = (struct ofobiosoftc *)self;
-
- sys_ofobio = sc->sc_regs = (struct ofobioreg *)IIOV(OFOBIO_CSR_ADDR);
-
- /* disable VSB and timer interrupts */
- sc->sc_regs->csr_b |= OFO_CSRB_VSB_INTDIS | OFO_CSRB_TIMER_INTDIS;
- /* enable A32 addressing and device interrupts */
- sc->sc_regs->csr_b &= ~(OFO_CSRB_GLOBAL_INTDIS | OFO_CSRB_DISABLE_A24);
-
- /*
- * A note regarding the board cache: the on-board 32KB are used
- * during early BUG bootstrap, until off-board memory is found,
- * and is intended to be used by the operating system as cache
- * memory (in addition to the small instruction cache internal to
- * the 68030).
- *
- * The cache flush and cache invalidation routines in locore
- * are not modified to invalidate the board cache as well,
- * since its snooping appears to be good enough to make it
- * completely transparent (the fact that vsbic(4) works, relying
- * upon proper invalidate behaviour, is a good omen).
- */
-
- /* clear board cache, then enable it */
- sc->sc_regs->csr_a |= OFO_CSRA_CACHE_WDIS | OFO_CSRA_CACHE_RDIS;
- sc->sc_regs->csr_a |= OFO_CSRA_CACHE_CLEAR;
- sc->sc_regs->csr_a = OFO_CSRA_CACHE_MONITOR;
-
- printf(": board cache enabled\n");
-
- sc->sc_abortih.ih_fn = ofobioabort;
- sc->sc_abortih.ih_ipl = IPL_HIGH;
- sc->sc_abortih.ih_wantframe = 1;
- intr_establish(OFOBIOVEC_ABORT, &sc->sc_abortih, self->dv_xname);
-
- config_search(ofobioscan, self, aux);
-}
-
-int
-ofobioprint(void *aux, const char *pnp)
-{
- struct confargs *ca = aux;
-
- if (ca->ca_offset != -1)
- printf(" offset 0x%x", ca->ca_offset);
- if (ca->ca_ipl > 0)
- printf(" ipl %d", ca->ca_ipl);
- return (UNCONF);
-}
-
-int
-ofobioscan(struct device *parent, void *self, void *aux)
-{
- struct cfdata *cf = self;
-#if 0
- struct ofobiosoftc *sc = (struct ofobiosoftc *)parent;
-#endif
- struct confargs *ca = aux;
- struct confargs oca;
-
- bzero(&oca, sizeof oca);
- oca.ca_iot = ca->ca_iot;
- oca.ca_dmat = ca->ca_dmat;
- oca.ca_offset = cf->cf_loc[0];
- oca.ca_ipl = cf->cf_loc[1];
- if (oca.ca_offset != -1) {
- oca.ca_paddr = ca->ca_paddr + oca.ca_offset;
- oca.ca_vaddr = IIOV(oca.ca_paddr);
- } else {
- oca.ca_vaddr = (vaddr_t)-1;
- oca.ca_paddr = (paddr_t)-1;
- }
- oca.ca_bustype = BUS_OFOBIO;
- oca.ca_name = cf->cf_driver->cd_name;
-
- if ((*cf->cf_attach->ca_match)(parent, cf, &oca) == 0)
- return (0);
-
- config_attach(parent, cf, &oca, ofobioprint);
-
- return (1);
-}
-
-int
-ofobioabort(void *frame)
-{
- /*
- * Latch the condition; this will debounce the interrupt,
- * acknowledge it, and both the CSRD_ABORT and CRSD_ABORT_LATCH
- * bits will clear.
- */
- sys_ofobio->csr_d |= OFO_CSRD_ABORT_LATCH;
-
- nmihand(frame);
-
- return (1);
-}
-
-void
-ofobio_clocksetup()
-{
- volatile uint8_t *dartregs =
- (volatile uint8_t *)IIOV(MVME141_DART_BASE);
- uint limit;
- uint8_t dummy;
-
- /*
- * Note that the dart(4) driver already may have programmed the
- * OPCR register during attachment.
- * It is very unfortunate that we have to override this. However
- * since dart(4) never needs to change the setting of this register,
- * ve'll simply keep the serial-related bits and add our own.
- */
-
- /* disable timer output during programming */
- dartregs[DART_OPCR] = OPSET;
-
- /*
- * The DUART runs at 3.6864 MHz; by using the second waveform
- * generator we'll get a CLK/32 master rate.
- */
- limit = (3686400 / 32) / hz;
-
- dartregs[DART_CTUR] = limit >> 8;
- dartregs[DART_CTLR] = limit & 0xff;
- dartregs[DART_ACR] = BDSET2 | CCLK1 | IPDCDB | IPDCDA;
- dartregs[DART_OPCR] = OPSETTO;
- /* start counter */
- dummy = dartregs[DART_CTSTART];
-
- /* enable timer interrupts */
- sys_ofobio->csr_b &= ~OFO_CSRB_TIMER_INTDIS;
-}
diff --git a/sys/arch/mvme68k/dev/ofobioreg.h b/sys/arch/mvme68k/dev/ofobioreg.h
deleted file mode 100644
index 4da18cae65f..00000000000
--- a/sys/arch/mvme68k/dev/ofobioreg.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* $OpenBSD: ofobioreg.h,v 1.1 2009/03/01 22:08:13 miod Exp $ */
-
-/*
- * Copyright (c) 2009 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * MVME141 On-board resources (One-Four-One OBIO)
- */
-
-/*
- * Register layout.
- */
-struct ofobioreg {
- volatile uint8_t reg00; /* 0x32: cpu speed in MHz? */
- volatile uint8_t reg01; /* 0x18 */
- volatile uint8_t reg02; /* 0xfc */
- volatile uint8_t reg03; /* 0xfc */
- volatile uint8_t reg04; /* 0xa8 */
- volatile uint8_t reg05; /* 0x40 */
- volatile uint8_t reg06; /* 0x82 */
- volatile uint8_t reg07; /* 0x82 */
- volatile uint8_t csr_a;
- volatile uint8_t csr_b;
- volatile uint8_t reg0a; /* copy of csr_a */
- volatile uint8_t reg0b; /* copy of csr_b */
- volatile uint8_t csr_c;
- volatile uint8_t csr_d;
- volatile uint8_t reg0e;
- volatile uint8_t reg0f;
- volatile uint8_t reg10;
- volatile uint8_t reg11; /* 0x45 */
- volatile uint8_t reg12;
- volatile uint8_t reg13;
- volatile uint8_t reg14;
- volatile uint8_t reg15;
- volatile uint8_t reg16;
- volatile uint8_t reg17;
- volatile uint8_t reg18;
- volatile uint8_t reg19;
- volatile uint8_t reg1a;
- volatile uint8_t reg1b;
- volatile uint8_t reg1c;
- volatile uint8_t reg1d;
- volatile uint8_t reg1e;
- volatile uint8_t reg1f;
-};
-
-/* CSR A */
-#define OFO_CSRA_CACHE_MONITOR 0xe0 /* cache monitor control mask */
-#define OFO_CSRA_CACHE_CLEAR 0x10 /* clear board cache */
-#define OFO_CSRA_CACHE_WDIS 0x08 /* cache write disable */
-#define OFO_CSRA_CACHE_RDIS 0x04 /* cache read disable */
-
-/* CSR B */
-#define OFO_CSRB_GLOBAL_INTDIS 0x80 /* global interrupt disable */
-#define OFO_CSRB_VSB_INTDIS 0x40 /* VSB interrupt disable */
-#define OFO_CSRB_TIMER_INTDIS 0x20 /* OP3 timer interrupt disable */
-#define OFO_CSRB_DISABLE_A24 0x08 /* disable A24 mode */
-
-/* CSR C */
-#define OFO_CSRC_TIMER_ACK 0x80 /* OP3 timer acknowledge */
-
-/* CSR D */
-#define OFO_CSRD_ABORT 0x40 /* abort switch pressed */
-#define OFO_CSRD_ABORT_LATCH 0x04 /* abort switch condition, latched */
-
-extern struct ofobioreg *sys_ofobio;
-
-#define OFOBIO_CSR_ADDR 0xfff60000
-
-#define OFOBIOVEC_CLOCK 0x1e
-#define OFOBIOVEC_ABORT 0x42
-#define OFOBIOVEC_DART 0x44
-
-void ofobio_clocksetup(void);
diff --git a/sys/arch/mvme68k/dev/osiop_mvme68k.c b/sys/arch/mvme68k/dev/osiop_mvme68k.c
deleted file mode 100644
index bb7215e91df..00000000000
--- a/sys/arch/mvme68k/dev/osiop_mvme68k.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/* $OpenBSD: osiop_mvme68k.c,v 1.4 2010/11/18 21:13:19 miod Exp $ */
-/*
- * Copyright (c) 2004, Miodrag Vallat.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/disklabel.h>
-
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-
-#include <machine/bus.h>
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-
-#include <machine/prom.h>
-
-#include <dev/ic/osiopreg.h>
-#include <dev/ic/osiopvar.h>
-
-#include "mc.h"
-#include "pcctwo.h"
-
-#if NMC > 0
-#include <mvme68k/dev/mcreg.h>
-#endif
-#if NPCCTWO > 0
-#include <mvme68k/dev/pcctworeg.h>
-#endif
-
-void osiop_mvme68k_attach(struct device *, struct device *, void *);
-int osiop_mvme68k_intr(void *);
-int osiop_match(struct device *, void *, void *);
-
-struct osiop_mvme68k_softc {
- struct osiop_softc sc_osiop;
- struct intrhand sc_ih;
-};
-
-#if NMC > 0
-struct cfattach osiop_mc_ca = {
- sizeof(struct osiop_mvme68k_softc),
- osiop_match, osiop_mvme68k_attach
-};
-#endif
-
-#if NPCCTWO > 0
-struct cfattach osiop_pcctwo_ca = {
- sizeof(struct osiop_mvme68k_softc),
- osiop_match, osiop_mvme68k_attach
-};
-#endif
-
-int
-osiop_match(struct device *parent, void *cf, void *aux)
-{
- struct confargs *ca = aux;
-
- return (!badvaddr((vaddr_t)ca->ca_vaddr, 4));
-}
-
-void
-osiop_mvme68k_attach(struct device *parent, struct device *self, void *aux)
-{
- struct osiop_softc *sc = (struct osiop_softc *)self;
- struct osiop_mvme68k_softc *psc = (struct osiop_mvme68k_softc *)self;
- struct confargs *ca = aux;
- int tmp;
- extern int cpuspeed;
-
- sc->sc_bst = ca->ca_iot;
- sc->sc_dmat = ca->ca_dmat;
-
- if (bus_space_map(sc->sc_bst, (bus_addr_t)ca->ca_paddr, OSIOP_NREGS, 0,
- &sc->sc_reg) != 0) {
- printf(": couldn't map I/O ports\n");
- return;
- }
-
- switch (cputyp) {
-#ifdef MVME172
- case CPU_172: /* XXX this is a guess! Same as MVME177? */
-#endif
-#ifdef MVME177
- case CPU_176:
- case CPU_177:
-#endif
-#if defined(MVME172) || defined(MVME177)
- /* MVME177 clock documented as fixed 50MHz in VME177A/HX */
- sc->sc_clock_freq = 50;
-#if 0
- /* No select timeouts on MC68060 */
- /* XXX 177 works better with them! */
- sc->sc_ctest7 = OSIOP_CTEST7_SC0 | OSIOP_CTEST7_TT1 |
- OSIOP_CTEST7_STD;
-#else
- sc->sc_ctest7 = OSIOP_CTEST7_SC0 | OSIOP_CTEST7_TT1;
-#endif
- break;
-#endif
- default:
- /* XXX does the clock frequency change for 33MHz processors? */
- sc->sc_clock_freq = cpuspeed * 2;
- sc->sc_ctest7 = OSIOP_CTEST7_SC0 | OSIOP_CTEST7_TT1;
- break;
- }
-
- sc->sc_dcntl = OSIOP_DCNTL_EA;
- sc->sc_dmode = OSIOP_DMODE_BL4; /* burst length = 4 */
- sc->sc_flags = 0;
- sc->sc_id = 7; /* XXX should read from CNFG block in nvram */
-
- tmp = bootpart;
- if (ca->ca_paddr != bootaddr)
- bootpart = -1; /* never match */
-
- osiop_attach(sc);
-
- bootpart = tmp;
-
- psc->sc_ih.ih_fn = osiop_mvme68k_intr;
- psc->sc_ih.ih_arg = sc;
- psc->sc_ih.ih_wantframe = 0;
- psc->sc_ih.ih_ipl = ca->ca_ipl;
-
- /* enable device interrupts */
- switch (ca->ca_bustype) {
-#if NMC > 0
- case BUS_MC:
- mcintr_establish(MCV_NCR, &psc->sc_ih, self->dv_xname);
- sys_mc->mc_ncrirq = ca->ca_ipl | MC_IRQ_IEN;
- break;
-#endif
-#if NPCCTWO > 0
- case BUS_PCCTWO:
- pcctwointr_establish(PCC2V_NCR, &psc->sc_ih, self->dv_xname);
- sys_pcc2->pcc2_ncrirq = ca->ca_ipl | PCC2_IRQ_IEN;
- break;
-#endif
- }
-}
-
-int
-osiop_mvme68k_intr(void *arg)
-{
- struct osiop_softc *sc = arg;
- u_int8_t istat;
-
- if (sc->sc_flags & OSIOP_INTSOFF)
- return 0;
-
- istat = osiop_read_1(sc, OSIOP_ISTAT);
- if ((istat & (OSIOP_ISTAT_SIP | OSIOP_ISTAT_DIP)) == 0)
- return 0;
-
- /*
- * 53c710 manual recommends reading dstat and sstat0 at least
- * 12 clk cycles apart if reading as bytes (which is what
- * pcc2 permits). Stick in a 1us delay between accessing dstat and
- * sstat0 below.
- *
- * save interrupt status, DMA status, and SCSI status 0
- * (may need to deal with stacked interrupts?)
- */
- sc->sc_istat = istat;
- sc->sc_sstat0 = osiop_read_1(sc, OSIOP_SSTAT0);
- DELAY(25);
- sc->sc_dstat = osiop_read_1(sc, OSIOP_DSTAT);
-
- osiop_intr(sc);
-
- return 1;
-}
diff --git a/sys/arch/mvme68k/dev/pcc.c b/sys/arch/mvme68k/dev/pcc.c
deleted file mode 100644
index 85c502b6409..00000000000
--- a/sys/arch/mvme68k/dev/pcc.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/* $OpenBSD: pcc.c,v 1.18 2010/06/26 23:24:43 guenther Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * VME147 peripheral channel controller
- */
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-#include <sys/uio.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/syslog.h>
-#include <sys/fcntl.h>
-#include <sys/device.h>
-#include <machine/cpu.h>
-#include <machine/autoconf.h>
-#include <dev/cons.h>
-
-#include <mvme68k/dev/pccreg.h>
-
-struct pccsoftc {
- struct device sc_dev;
- vaddr_t sc_vaddr;
- paddr_t sc_paddr;
- struct pccreg *sc_pcc;
- struct intrhand sc_nmiih;
-};
-
-void pccattach(struct device *, struct device *, void *);
-int pccmatch(struct device *, void *, void *);
-int pccabort(void *);
-int pcc_print(void *, const char *);
-int pcc_scan(struct device *, void *, void *);
-
-struct cfattach pcc_ca = {
- sizeof(struct pccsoftc), pccmatch, pccattach
-};
-
-struct cfdriver pcc_cd = {
- NULL, "pcc", DV_DULL
-};
-
-struct pccreg *sys_pcc = NULL;
-
-int
-pccmatch(parent, vcf, args)
- struct device *parent;
- void *vcf, *args;
-{
- struct confargs *ca = args;
-
- /* the pcc only exist on vme147's */
- if (cputyp != CPU_147)
- return (0);
- return (!badvaddr(IIOV(ca->ca_paddr) + PCCSPACE_PCCCHIP_OFF, 1));
-}
-
-int
-pcc_print(args, bus)
- void *args;
- const char *bus;
-{
- struct confargs *ca = args;
-
- if (ca->ca_offset != -1)
- printf(" offset 0x%x", ca->ca_offset);
- if (ca->ca_ipl > 0)
- printf(" ipl %d", ca->ca_ipl);
- return (UNCONF);
-}
-
-int
-pcc_scan(parent, child, args)
- struct device *parent;
- void *child, *args;
-{
- struct cfdata *cf = child;
- struct pccsoftc *sc = (struct pccsoftc *)parent;
- struct confargs *ca = args;
- struct confargs oca;
-
- bzero(&oca, sizeof oca);
- oca.ca_iot = ca->ca_iot;
- oca.ca_dmat = ca->ca_dmat;
- oca.ca_offset = cf->cf_loc[0];
- oca.ca_ipl = cf->cf_loc[1];
- if (oca.ca_offset != -1) {
- oca.ca_vaddr = sc->sc_vaddr + oca.ca_offset;
- oca.ca_paddr = sc->sc_paddr + oca.ca_offset;
- } else {
- oca.ca_vaddr = (vaddr_t)-1;
- oca.ca_paddr = (paddr_t)-1;
- }
- oca.ca_bustype = BUS_PCC;
- oca.ca_name = cf->cf_driver->cd_name;
- if ((*cf->cf_attach->ca_match)(parent, cf, &oca) == 0)
- return (0);
- config_attach(parent, cf, &oca, pcc_print);
- return (1);
-}
-
-void
-pccattach(parent, self, args)
- struct device *parent, *self;
- void *args;
-{
- struct confargs *ca = args;
- struct pccsoftc *sc = (struct pccsoftc *)self;
-
- if (sys_pcc)
- panic("pcc already attached!");
-
- /*
- * since we know ourself to land in intiobase land,
- * we must adjust our address
- */
- sc->sc_paddr = ca->ca_paddr;
- sc->sc_vaddr = IIOV(sc->sc_paddr);
- sc->sc_pcc = (struct pccreg *)(sc->sc_vaddr + PCCSPACE_PCCCHIP_OFF);
- sys_pcc = sc->sc_pcc;
-
- printf(": rev %d\n", sc->sc_pcc->pcc_chiprev);
-
- sc->sc_nmiih.ih_fn = pccabort;
- sc->sc_nmiih.ih_ipl = 7;
- sc->sc_nmiih.ih_wantframe = 1;
- pccintr_establish(PCCV_ABORT, &sc->sc_nmiih, self->dv_xname);
-
- sc->sc_pcc->pcc_vecbase = PCC_VECBASE;
- sc->sc_pcc->pcc_abortirq = PCC_ABORT_IEN | PCC_ABORT_ACK;
- sc->sc_pcc->pcc_genctl |= PCC_GENCTL_IEN;
-
- /* XXX further init of PCC chip? */
-
- config_search(pcc_scan, self, args);
-}
-
-/*
- * PCC interrupts land in a PCC_NVEC sized hole starting at PCC_VECBASE
- */
-int
-pccintr_establish(vec, ih, name)
- int vec;
- struct intrhand *ih;
- const char *name;
-{
-#ifdef DIAGNOSTIC
- if (vec < 0 || vec >= PCC_NVEC)
- panic("pccintr_establish: illegal vector for %s: 0x%x",
- name, vec);
-#endif
-
- return intr_establish(PCC_VECBASE + vec, ih, name);
-}
-
-int
-pccabort(frame)
- void *frame;
-{
-#if 0
- /* XXX wait for it to debounce -- there is something wrong here */
- while (sys_pcc->pcc_abortirq & PCC_ABORT_ABS)
- ;
- delay(2);
-#endif
- sys_pcc->pcc_abortirq = PCC_ABORT_IEN | PCC_ABORT_ACK;
- nmihand(frame);
- return (1);
-}
-
-int
-pccspeed(pcc)
- struct pccreg *pcc;
-{
- volatile u_short lim = pcc_timer_us2lim(400);
- volatile u_short tmp;
- volatile int cnt;
- int speed;
-
- pcc->pcc_t1irq = 0; /* just in case */
- pcc->pcc_t1pload = 0;
- pcc->pcc_t1ctl = PCC_TIMERCLEAR;
- pcc->pcc_t1ctl = PCC_TIMERSTART;
-
- cnt = 0;
- for (;;) {
- tmp = pcc->pcc_t1count;
- if (tmp > lim)
- break;
- tmp = lim;
- cnt++;
- }
-
- pcc->pcc_t1ctl = PCC_TIMERCLEAR;
- printf("pccspeed cnt=%d\n", cnt);
-
- /*
- * Empirically determined. Unfortunately, because of various
- * memory board effects and such, it is rather unlikely that
- * we will find a nice formula.
- */
- if (cnt > 280000)
- speed = 50;
- else if (cnt > 210000)
- speed = 33;
- else if (cnt > 190000)
- speed = 25;
- else if (cnt > 170000) /* 171163, 170335 */
- speed = 20;
- else
- speed = 16;
- return (speed);
-}
diff --git a/sys/arch/mvme68k/dev/pccreg.h b/sys/arch/mvme68k/dev/pccreg.h
deleted file mode 100644
index 7886617e02f..00000000000
--- a/sys/arch/mvme68k/dev/pccreg.h
+++ /dev/null
@@ -1,156 +0,0 @@
-/* $OpenBSD: pccreg.h,v 1.8 2012/11/04 13:33:32 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * MVME147 PCC chip
- */
-struct pccreg {
- volatile u_long pcc_dmataddr; /* dma table address */
- volatile u_long pcc_dmadaddr; /* dma data address */
- volatile u_long pcc_dmabcnt; /* dma byte count */
- volatile u_long pcc_dmahold; /* dma data hold register */
- volatile u_short pcc_t1pload; /* timer1 preload */
- volatile u_short pcc_t1count; /* timer1 count */
- volatile u_short pcc_t2pload; /* timer2 preload */
- volatile u_short pcc_t2count; /* timer2 count */
- volatile u_char pcc_t1irq; /* timer1 interrupt ctrl */
- volatile u_char pcc_t1ctl; /* timer1 ctrl reg */
- volatile u_char pcc_t2irq; /* timer2 interrupt ctrl */
- volatile u_char pcc_t2ctl; /* timer2 ctrl reg */
- volatile u_char pcc_acfirq; /* acfail intr reg */
- volatile u_char pcc_dogirq; /* watchdog intr reg */
- volatile u_char pcc_lpirq; /* printer intr reg */
- volatile u_char pcc_lpctl; /* printer ctrl */
- volatile u_char pcc_dmairq; /* dma interrupt control */
- volatile u_char pcc_dmacsr; /* dma csr */
- volatile u_char pcc_busirq; /* bus error interrupt */
- volatile u_char pcc_dmasr; /* dma status register */
- volatile u_char pcc_abortirq; /* abort interrupt control reg */
- volatile u_char pcc_tafcr; /* table address function code reg */
- volatile u_char pcc_zsirq; /* serial interrupt reg */
- volatile u_char pcc_genctl; /* general control register */
- volatile u_char pcc_leirq; /* ethernet interrupt */
- volatile u_char pcc_gensr; /* general status */
- volatile u_char pcc_sbicirq; /* sbic interrupt reg */
- volatile u_char pcc_slavebase; /* slave base addr reg */
- volatile u_char pcc_sw1inq; /* software interrupt #1 cr */
- volatile u_char pcc_vecbase; /* interrupt base vector register */
- volatile u_char pcc_sw2irq; /* software interrupt #2 cr */
- volatile u_char pcc_chiprev; /* revision level */
-};
-#define PCCSPACE_PCCCHIP_OFF 0x1000
-
-/*
- * points to system's PCC. This is not active until the pcc0 device
- * has been attached.
- */
-extern struct pccreg *sys_pcc;
-
-/*
- * We lock off our interrupt vector at 0x40.
- */
-#define PCC_VECBASE 0x40
-#define PCC_NVEC 12
-
-/*
- * Vectors we use
- */
-#define PCCV_ACFAIL 0
-#define PCCV_BERR 1
-#define PCCV_ABORT 2
-#define PCCV_ZS 3
-#define PCCV_LE 4
-#define PCCV_SBIC 5
-#define PCCV_DMA 6
-#define PCCV_PRINTER 7
-#define PCCV_TIMER1 8
-#define PCCV_TIMER2 9
-#define PCCV_SOFT1 10
-#define PCCV_SOFT2 11
-
-#define PCC_DMABCNT_MAKEFC(fcn) ((fcn) << 24)
-#define PCC_DMABCNT_FCMASK 0x07000000
-#define PCC_DMABCNT_L 0x80000000
-#define PCC_DMABCNT_CNTMASK 0x00ffffff
-
-#define PCC_DMACSR_DONE 0x80
-#define PCC_DMACSR_ERR8BIT 0x40
-#define PCC_DMACSR_TNOT32 0x20
-#define PCC_DMACSR_DMAERRDATA 0x10
-#define PCC_DMACSR_DMAERRTABLE 0x08
-#define PCC_DMACSR_TOSCSI 0x04
-#define PCC_DMACSR_USETABLE 0x02
-#define PCC_DMACSR_DEN 0x01
-
-#define PCC_SBIC_RESETIRQ 0x40
-#define PCC_SBIC_RESETABS 0x20
-
-/*
- * Fairly standard irq register bits.
- */
-#define PCC_IRQ_IPL 0x07
-#define PCC_IRQ_IEN 0x08
-#define PCC_IRQ_INT 0x80
-
-#define PCC_LPIRQ_ACK 0x20
-
-/*
- * clock/timer
- */
-#define PCC_TIMERACK 0x80 /* ack intr */
-#define PCC_TIMERCLEAR 0x00 /* reset and clear timer */
-#define PCC_TIMERSTART 0x03 /* start timer */
-#define PCC_TIMER_COVF 0x04 /* clear overflow */
-#define PCC_TIMER_OVF_SHIFT 4
-
-#define PCC_TIMERFREQ 160000 /* 1000000 /6.25 */
-#define pcc_timer_hz2lim(hz) (65536 - (PCC_TIMERFREQ/(hz)))
-#define pcc_timer_us2lim(us) (65536 - (PCC_TIMERFREQ/(1000000/(us))))
-
-/*
- * serial control
- */
-#define PCC_ZS_PCCVEC 0x10 /* let PCC supply vector */
-
-/*
- * abort switch
- */
-#define PCC_ABORT_IEN 0x08 /* enable interrupt */
-#define PCC_ABORT_ABS 0x40 /* current state of switch */
-#define PCC_ABORT_ACK 0x80 /* intr active; or write to ack */
-
-/*
- * for the console we need zs phys addr
- */
-#define ZS0_PHYS_147 (INTIOBASE_147 + 0x3000)
-#define ZS1_PHYS_147 (INTIOBASE_147 + 0x3800)
-
-/* XXX */
-int pccintr_establish(int, struct intrhand *, const char *);
-int pccspeed(struct pccreg *);
-
-#define PCC_GENCTL_IEN 0x10
diff --git a/sys/arch/mvme68k/dev/pcctwo.c b/sys/arch/mvme68k/dev/pcctwo.c
deleted file mode 100644
index 5aba774b126..00000000000
--- a/sys/arch/mvme68k/dev/pcctwo.c
+++ /dev/null
@@ -1,183 +0,0 @@
-
-/* $OpenBSD: pcctwo.c,v 1.18 2010/06/26 23:24:43 guenther Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * VME16x PCC2 chip
- */
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-#include <sys/uio.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/syslog.h>
-#include <sys/fcntl.h>
-#include <sys/device.h>
-#include <machine/cpu.h>
-#include <machine/autoconf.h>
-#include <dev/cons.h>
-
-#include <mvme68k/dev/pcctworeg.h>
-
-struct pcctwosoftc {
- struct device sc_dev;
- vaddr_t sc_vaddr; /* PCC2 space */
- paddr_t sc_paddr;
- struct pcctworeg *sc_pcc2; /* the actual registers */
-};
-
-void pcctwoattach(struct device *, struct device *, void *);
-int pcctwomatch(struct device *, void *, void *);
-int pcctwo_print(void *, const char *);
-int pcctwo_scan(struct device *, void *, void *);
-
-struct cfattach pcctwo_ca = {
- sizeof(struct pcctwosoftc), pcctwomatch, pcctwoattach
-};
-
-struct cfdriver pcctwo_cd = {
- NULL, "pcctwo", DV_DULL
-};
-
-struct pcctworeg *sys_pcc2 = NULL;
-
-int
-pcctwomatch(parent, vcf, args)
- struct device *parent;
- void *vcf, *args;
-{
- struct confargs *ca = args;
- struct pcctworeg *pcc2;
-
- switch (cputyp) {
- case CPU_166:
- case CPU_167:
- case CPU_176:
- case CPU_177:
- break;
- default:
- return (0);
- }
-
- pcc2 = (struct pcctworeg *)(IIOV(ca->ca_paddr) + PCC2_PCC2CHIP_OFF);
- if (badvaddr((vaddr_t)pcc2, 1) || pcc2->pcc2_chipid != PCC2_CHIPID)
- return (0);
- return (1);
-}
-
-int
-pcctwo_print(args, bus)
- void *args;
- const char *bus;
-{
- struct confargs *ca = args;
-
- if (ca->ca_offset != -1)
- printf(" offset 0x%x", ca->ca_offset);
- if (ca->ca_ipl > 0)
- printf(" ipl %d", ca->ca_ipl);
- return (UNCONF);
-}
-
-int
-pcctwo_scan(parent, child, args)
- struct device *parent;
- void *child, *args;
-{
- struct cfdata *cf = child;
- struct pcctwosoftc *sc = (struct pcctwosoftc *)parent;
- struct confargs *ca = args;
- struct confargs oca;
-
- bzero(&oca, sizeof oca);
- oca.ca_iot = ca->ca_iot;
- oca.ca_dmat = ca->ca_dmat;
- oca.ca_offset = cf->cf_loc[0];
- oca.ca_ipl = cf->cf_loc[1];
- if (oca.ca_offset != -1 && ISIIOVA(sc->sc_vaddr + oca.ca_offset)) {
- oca.ca_vaddr = sc->sc_vaddr + oca.ca_offset;
- oca.ca_paddr = sc->sc_paddr + oca.ca_offset;
- } else {
- oca.ca_vaddr = (vaddr_t)-1;
- oca.ca_paddr = (paddr_t)-1;
- }
- oca.ca_bustype = BUS_PCCTWO;
- oca.ca_name = cf->cf_driver->cd_name;
- if ((*cf->cf_attach->ca_match)(parent, cf, &oca) == 0)
- return (0);
- config_attach(parent, cf, &oca, pcctwo_print);
- return (1);
-}
-
-void
-pcctwoattach(parent, self, args)
- struct device *parent, *self;
- void *args;
-{
- struct confargs *ca = args;
- struct pcctwosoftc *sc = (struct pcctwosoftc *)self;
-
- if (sys_pcc2)
- panic("pcc2 already attached!");
-
- /*
- * since we know ourself to land in intiobase land,
- * we must adjust our address
- */
- sc->sc_paddr = ca->ca_paddr;
- sc->sc_vaddr = IIOV(sc->sc_paddr);
- sc->sc_pcc2 = (struct pcctworeg *)(sc->sc_vaddr + PCC2_PCC2CHIP_OFF);
- sys_pcc2 = sc->sc_pcc2;
-
- printf(": rev %d\n", sc->sc_pcc2->pcc2_chiprev);
-
- sc->sc_pcc2->pcc2_vecbase = PCC2_VECBASE;
- sc->sc_pcc2->pcc2_genctl |= PCC2_GENCTL_IEN; /* global irq enable */
-
- config_search(pcctwo_scan, self, args);
-}
-
-/*
- * PCC2 interrupts land in a PCC2_NVEC sized hole starting at PCC2_VECBASE
- */
-int
-pcctwointr_establish(vec, ih, name)
- int vec;
- struct intrhand *ih;
- const char *name;
-{
-#ifdef DIAGNOSTIC
- if (vec < 0 || vec >= PCC2_NVEC)
- panic("pcctwointr_establish: illegal vector for %s: 0x%x",
- name, vec);
-#endif
-
- return intr_establish(PCC2_VECBASE + vec, ih, name);
-}
diff --git a/sys/arch/mvme68k/dev/pcctworeg.h b/sys/arch/mvme68k/dev/pcctworeg.h
deleted file mode 100644
index 4e2e36de79d..00000000000
--- a/sys/arch/mvme68k/dev/pcctworeg.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/* $OpenBSD: pcctworeg.h,v 1.7 2012/11/04 13:33:32 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * MVME16x PCC2 chip: sort of a confused mish-mash of the MC in the 162
- * and the PCC in the 147
- */
-struct pcctworeg {
- volatile u_char pcc2_chipid;
- volatile u_char pcc2_chiprev;
- volatile u_char pcc2_genctl;
- volatile u_char pcc2_vecbase; /* irq vector base */
- volatile u_long pcc2_t1cmp; /* timer1 compare */
- volatile u_long pcc2_t1count; /* timer1 count */
- volatile u_long pcc2_t2cmp; /* timer2 compare */
- volatile u_long pcc2_t2count; /* timer2 count */
- volatile u_char pcc2_pscalecnt; /* timer prescaler counter */
- volatile u_char pcc2_pscaleadj; /* timer prescaler adjust */
- volatile u_char pcc2_t2ctl; /* timer2 ctrl reg */
- volatile u_char pcc2_t1ctl; /* timer1 ctrl reg */
- volatile u_char pcc2_gpioirq; /* gpio irq */
- volatile u_char pcc2_gpio; /* gpio i/o */
- volatile u_char pcc2_t2irq;
- volatile u_char pcc2_t1irq;
- volatile u_char pcc2_sccerr;
- volatile u_char pcc2_sccirq;
- volatile u_char pcc2_scctx;
- volatile u_char pcc2_sccrx;
- volatile u_char :8;
- volatile u_char :8;
- volatile u_char :8;
- volatile u_char pcc2_sccmoiack;
- volatile u_char :8;
- volatile u_char pcc2_scctxiack;
- volatile u_char :8;
- volatile u_char pcc2_sccrxiack;
- volatile u_char pcc2_ieerr;
- volatile u_char :8;
- volatile u_char pcc2_ieirq;
- volatile u_char pcc2_iefailirq;
- volatile u_char pcc2_ncrerr;
- volatile u_char :8;
- volatile u_char :8;
- volatile u_char pcc2_ncrirq;
- volatile u_char pcc2_prtairq;
- volatile u_char pcc2_prtfirq;
- volatile u_char pcc2_prtsirq;
- volatile u_char pcc2_prtpirq;
- volatile u_char pcc2_prtbirq;
- volatile u_char :8;
- volatile u_char pcc2_prtstat;
- volatile u_char pcc2_prtctl;
- volatile u_short pcc2_speed; /* DO NOT USE */
- volatile u_short pcc2_prtdat;
- volatile u_short :16;
- volatile u_char pcc2_ipl;
- volatile u_char pcc2_mask;
-};
-#define PCC2_PCC2CHIP_OFF 0x42000
-#define PCC2_CHIPID 0x20
-
-/*
- * points to system's PCCTWO. This is not active until the pcctwo0
- * device has been attached.
- */
-extern struct pcctworeg *sys_pcc2;
-
-/*
- * We lock off our interrupt vector at 0x50.
- */
-#define PCC2_VECBASE 0x50
-#define PCC2_NVEC 16
-
-/*
- * Vectors we use
- */
-#define PCC2V_NCR 0x05
-#define PCC2V_IEFAIL 0x06
-#define PCC2V_IE 0x07
-#define PCC2V_TIMER2 0x08
-#define PCC2V_TIMER1 0x09
-#define PCC2V_GPIO 0x0a
-#define PCC2V_SCC_RXE 0x0c
-#define PCC2V_SCC_M 0x0d
-#define PCC2V_SCC_TX 0x0e
-#define PCC2V_SCC_RX 0x0f
-
-#define PCC2_TCTL_CEN 0x01
-#define PCC2_TCTL_COC 0x02
-#define PCC2_TCTL_COVF 0x04
-#define PCC2_TCTL_OVF 0xf0
-#define PCC2_TCTL_OVF_SHIFT 4
-
-#define PCC2_GPIO_PLTY 0x80
-#define PCC2_GPIO_EL 0x40
-
-#define PCC2_GPIOCR_OE 0x2
-#define PCC2_GPIOCR_O 0x1
-
-#define PCC2_SCC_AVEC 0x08
-#define PCC2_SCCRX_INHIBIT (0 << 6)
-#define PCC2_SCCRX_SNOOP (1 << 6)
-#define PCC2_SCCRX_INVAL (2 << 6)
-#define PCC2_SCCRX_RESV (3 << 6)
-
-#define pcc2_timer_us2lim(us) (us) /* timer increments in "us" */
-
-#define PCC2_IRQ_IPL 0x07
-#define PCC2_IRQ_ICLR 0x08
-#define PCC2_IRQ_IEN 0x10
-#define PCC2_IRQ_INT 0x20
-
-#define PCC2_IEERR_SCLR 0x01
-
-#define PCC2_GENCTL_FAST 0x01
-#define PCC2_GENCTL_IEN 0x02
-#define PCC2_GENCTL_C040 0x03
-
-#define PCC2_SC_INHIBIT (0 << 6)
-#define PCC2_SC_SNOOP (1 << 6)
-#define PCC2_SC_INVAL (2 << 6)
-#define PCC2_SC_RESV (3 << 6)
-
-int pcctwointr_establish(int, struct intrhand *, const char *);
diff --git a/sys/arch/mvme68k/dev/sram.c b/sys/arch/mvme68k/dev/sram.c
deleted file mode 100644
index 49aedc5d52a..00000000000
--- a/sys/arch/mvme68k/dev/sram.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/* $OpenBSD: sram.c,v 1.20 2010/12/26 15:40:59 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/ioctl.h>
-#include <sys/buf.h>
-#include <sys/systm.h>
-#include <sys/uio.h>
-#include <sys/malloc.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/conf.h>
-#include <machine/cpu.h>
-#include <machine/mioctl.h>
-
-#include <mvme68k/dev/memdevs.h>
-
-#include "mc.h"
-
-#if NMC > 0
-#include <mvme68k/dev/mcreg.h>
-#endif
-
-#include <uvm/uvm_extern.h>
-
-struct sramsoftc {
- struct device sc_dev;
- paddr_t sc_paddr;
- vaddr_t sc_vaddr;
- int sc_len;
-};
-
-void sramattach(struct device *, struct device *, void *);
-int srammatch(struct device *, void *, void *);
-
-struct cfattach sram_ca = {
- sizeof(struct sramsoftc), srammatch, sramattach
-};
-
-struct cfdriver sram_cd = {
- NULL, "sram", DV_DULL
-};
-
-int
-srammatch(parent, vcf, args)
- struct device *parent;
- void *vcf, *args;
-{
- struct confargs *ca = args;
-
- if (cputyp == CPU_147)
- return (0);
-
- return (!badpaddr(ca->ca_paddr, 1));
-}
-
-void
-sramattach(parent, self, args)
- struct device *parent, *self;
- void *args;
-{
- struct confargs *ca = args;
- struct sramsoftc *sc = (struct sramsoftc *)self;
-#if defined(MVME162) || defined(MVME172)
- struct mcreg *mc;
-#endif
-
- switch (cputyp) {
-#if defined(MVME162) || defined(MVME172)
- case CPU_162:
- case CPU_172:
- /* XXX this code will almost never be used. just in case. */
- mc = sys_mc;
- if (!mc)
- mc = (struct mcreg *)(IIOV(0xfff00000) + MC_MCCHIP_OFF);
-
- switch (mc->mc_memoptions & MC_MEMOPTIONS_SRAMMASK) {
- case MC_MEMOPTIONS_SRAM128K:
- sc->sc_len = 128*1024;
- break;
- case MC_MEMOPTIONS_SRAM512K:
- sc->sc_len = 512*1024;
- break;
- case MC_MEMOPTIONS_SRAM1M:
- sc->sc_len = 1024*1024;
- break;
- case MC_MEMOPTIONS_SRAM2M:
- sc->sc_len = 2048*1024;
- break;
- }
- break;
-#endif
-#ifdef MVME167
- case CPU_166:
- case CPU_167:
- sc->sc_len = 128*1024; /* always 128K */
- break;
-#endif
-#ifdef MVME177
- case CPU_176:
- case CPU_177:
- sc->sc_len = 128*1024; /* always 128K */
- break;
-#endif
- default:
- sc->sc_len = 0;
- break;
- }
-
- printf(": len %d", sc->sc_len);
-
- sc->sc_paddr = ca->ca_paddr;
- sc->sc_vaddr = mapiodev(sc->sc_paddr, sc->sc_len);
- if (sc->sc_vaddr == 0) {
- sc->sc_len = 0;
- printf(" -- failed to map");
- }
- printf("\n");
-}
-
-/*ARGSUSED*/
-int
-sramopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- if (minor(dev) >= sram_cd.cd_ndevs ||
- sram_cd.cd_devs[minor(dev)] == NULL)
- return (ENODEV);
- return (0);
-}
-
-/*ARGSUSED*/
-int
-sramclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
-
- return (0);
-}
-
-/*ARGSUSED*/
-int
-sramioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- int unit = minor(dev);
- struct sramsoftc *sc = (struct sramsoftc *) sram_cd.cd_devs[unit];
- int error = 0;
-
- switch (cmd) {
- case MIOCGSIZ:
- *(int *)data = sc->sc_len;
- break;
- default:
- error = ENOTTY;
- break;
- }
- return (error);
-}
-
-/*ARGSUSED*/
-int
-sramrw(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- int unit = minor(dev);
- struct sramsoftc *sc = (struct sramsoftc *) sram_cd.cd_devs[unit];
-
- return (memdevrw(sc->sc_vaddr, sc->sc_len, uio, flags));
-}
-
-paddr_t
-srammmap(dev, off, prot)
- dev_t dev;
- off_t off;
- int prot;
-{
- int unit = minor(dev);
- struct sramsoftc *sc = (struct sramsoftc *) sram_cd.cd_devs[unit];
-
- if (minor(dev) != 0)
- return (-1);
-
- /* allow access only in RAM */
- if (off < 0 || off >= round_page(sc->sc_len))
- return (-1);
- return (sc->sc_paddr + off);
-}
diff --git a/sys/arch/mvme68k/dev/vme.c b/sys/arch/mvme68k/dev/vme.c
deleted file mode 100644
index bfdeea0de8c..00000000000
--- a/sys/arch/mvme68k/dev/vme.c
+++ /dev/null
@@ -1,659 +0,0 @@
-/* $OpenBSD: vme.c,v 1.30 2011/04/07 15:30:15 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * Copyright (c) 2000 Steve Murphree, Jr.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-#include <sys/uio.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/syslog.h>
-#include <sys/fcntl.h>
-#include <sys/device.h>
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <mvme68k/dev/vme.h>
-
-#include "lrc.h"
-#include "mc.h"
-#include "ofobio.h"
-#include "pcc.h"
-#include "pcctwo.h"
-
-#if NLRC > 0
-#include <mvme68k/dev/lrcreg.h>
-#endif
-#if NMC > 0
-#include <mvme68k/dev/mcreg.h>
-#endif
-#if NPCC > 0
-#include <mvme68k/dev/pccreg.h>
-#endif
-#if NPCCTWO > 0
-#include <mvme68k/dev/pcctworeg.h>
-#endif
-
-int vmematch(struct device *, void *, void *);
-void vmeattach(struct device *, struct device *, void *);
-
-void vme1chip_init(struct vmesoftc *sc);
-void vme2chip_init(struct vmesoftc *sc);
-paddr_t vme2chip_map(u_long base, int len, int dwidth);
-int vme2abort(void *);
-
-void vmeunmap(vaddr_t, int);
-int vmeprint(void *, const char *);
-
-static int vmebustype;
-
-struct vme2reg *sys_vme2;
-
-struct cfattach vme_ca = {
- sizeof(struct vmesoftc), vmematch, vmeattach
-};
-
-struct cfdriver vme_cd = {
- NULL, "vme", DV_DULL
-};
-
-/*
- * bus_space routines for VME mappings
- */
-
-int vme_map(bus_addr_t, bus_size_t, int, bus_space_handle_t *);
-void vme_unmap(bus_space_handle_t, bus_size_t);
-int vme_subregion(bus_space_handle_t, bus_size_t, bus_size_t,
- bus_space_handle_t *);
-void * vme_vaddr(bus_space_handle_t);
-
-const struct mvme68k_bus_space_tag vme_bustag = {
- vme_map,
- vme_unmap,
- vme_subregion,
- vme_vaddr
-};
-
-/*
- * VME space mapping functions
- */
-
-int
-vme_map(bus_addr_t addr, bus_size_t size, int flags, bus_space_handle_t *ret)
-{
- vaddr_t map;
-
- map = (vaddr_t)mapiodev((paddr_t)addr, size);
- if (map == 0)
- return ENOMEM;
-
- *ret = (bus_space_handle_t)map;
- return 0;
-}
-
-void
-vme_unmap(bus_space_handle_t handle, bus_size_t size)
-{
- unmapiodev((vaddr_t)handle, size);
-}
-
-int
-vme_subregion(bus_space_handle_t handle, bus_addr_t offset, bus_size_t size,
- bus_space_handle_t *ret)
-{
- *ret = handle + offset;
- return (0);
-}
-
-void *
-vme_vaddr(bus_space_handle_t handle)
-{
- return (void *)handle;
-}
-
-/*
- * Extra D16 access functions
- *
- * D16 cards will trigger bus errors on attempting to read or write more
- * than 16 bits on the bus. Given how the m88k processor works, this means
- * basically that all long (D32) accesses must be carefully taken care of.
- *
- * Since the kernels bcopy() and bzero() routines will use 32 bit accesses
- * for performance, here are specific D16-compatible routines. They will
- * also revert to D8 operations if neither of the operands is properly
- * aligned.
- */
-
-void d16_bcopy(const void *, void *, size_t);
-void d16_bzero(void *, size_t);
-
-void
-d16_bcopy(const void *src, void *dst, size_t len)
-{
- if ((vaddr_t)src & 1 || (vaddr_t)dst & 1)
- bus_space_write_region_1(&vme_bustag, 0, (vaddr_t)dst,
- (void *)src, len);
- else {
- bus_space_write_region_2(&vme_bustag, 0, (vaddr_t)dst,
- (void *)src, len / 2);
- if (len & 1)
- bus_space_write_1(&vme_bustag, 0,
- dst + len - 1, *(u_int8_t *)(src + len - 1));
- }
-}
-
-void
-d16_bzero(void *dst, size_t len)
-{
- if ((vaddr_t)dst & 1)
- bus_space_set_region_1(&vme_bustag, 0, (vaddr_t)dst, 0, len);
- else {
- bus_space_set_region_2(&vme_bustag, 0, (vaddr_t)dst, 0, len / 2);
- if (len & 1)
- bus_space_write_1(&vme_bustag, 0, dst + len - 1, 0);
- }
-}
-
-/*
- * Configuration glue
- */
-
-int
-vmematch(parent, cf, args)
- struct device *parent;
- void *cf;
- void *args;
-{
-#if NMC > 0
- struct confargs *ca = args;
-
- if (ca->ca_bustype == BUS_MC) {
- if (sys_mc->mc_ver & MC_VER_NOVME)
- return (0);
- }
-#endif
- return (1);
-}
-
-#if defined(MVME162) || defined(MVME167) || defined(MVME172) || defined(MVME177)
-/*
- * make local addresses 1G-2G correspond to VME addresses 3G-4G,
- * as D32
- */
-#define VME2_D32STARTPHYS (1*1024*1024*1024UL)
-#define VME2_D32ENDPHYS (2*1024*1024*1024UL)
-#define VME2_D32STARTVME (3*1024*1024*1024UL)
-#define VME2_D32BITSVME (3*1024*1024*1024UL)
-
-/*
- * make local addresses 3G-3.75G correspond to VME addresses 3G-3.75G,
- * as D16
- */
-#define VME2_D16STARTPHYS (3*1024*1024*1024UL)
-#define VME2_D16ENDPHYS (3*1024*1024*1024UL + 768*1024*1024UL)
-#endif
-
-/*
- * Returns a physical address mapping for a VME address & length.
- * Note: on some hardware it is not possible to create certain
- * mappings, ie. the MVME147 cannot do 32 bit accesses to VME bus
- * addresses from 0 to physmem.
- */
-paddr_t
-vmepmap(sc, vmeaddr, len, bustype)
- struct vmesoftc *sc;
- paddr_t vmeaddr;
- int len;
- int bustype;
-{
- paddr_t base = vmeaddr;
-
- len = roundup(len, NBPG);
- switch (vmebustype) {
-#if NLRC > 0 || NOFOBIO > 0 || NPCC > 0
- case BUS_LRC:
- case BUS_OFOBIO:
- case BUS_PCC:
- switch (bustype) {
- case BUS_VMES:
-#ifdef DEBUG
- printf("base %8p/0x%8x len 0x%x\n",
- vmeaddr, base, len);
-#endif
- if (base > VME1_A16BASE &&
- (base+len - VME1_A16BASE) < VME1_A16D16LEN) {
- base = base - VME1_A16BASE + VME1_A16D16BASE;
-#ifdef DEBUG
- printf("vmes1: base = 0x%8x\n", base); /* 1:1 */
-#endif
- } else if (base > VME1_A32D16BASE &&
- base+len < VME1_A16BASE) {
- /* 1:1 mapped */
-#ifdef DEBUG
- printf("vmes2: base = 0x%8x\n", base);
-#endif
- } else {
- printf("%s: cannot map pa 0x%x len 0x%x\n",
- sc->sc_dev.dv_xname, base, len);
- return (0);
- }
- break;
- case BUS_VMEL:
- if (base >= physmem && (base+len) < VME1_A32D32LEN)
- base = base + VME1_A32D32BASE;
- else if (base+len < VME1_A32D16LEN) /* HACK! */
- base = base + VME1_A32D16BASE;
- else {
- printf("%s: cannot map pa 0x%x len 0x%x\n",
- sc->sc_dev.dv_xname, base, len);
- return (0);
- }
- break;
- }
- break;
-#endif
-#if NMC > 0 || NPCCTWO > 0
- case BUS_MC:
- case BUS_PCCTWO:
- switch (bustype) {
- case BUS_VMES:
-#ifdef DEBUG
- printf("base %x len %d\n", base, len);
-#endif
- if (base > VME2_A16BASE &&
- (base+len-VME2_A16BASE) < VME2_A16D16LEN) {
- /* XXX busted? */
- base = base - VME2_A16BASE + VME2_A16D16BASE;
- } else if (base > VME2_A24BASE &&
- (base+len-VME2_A24BASE) < VME2_A24D16LEN) {
- base = base - VME2_A24BASE + VME2_D16STARTPHYS;
- } else if ((base+len) < VME2_A32D16LEN) {
- /* XXX busted? */
- base = base + VME2_A32D16BASE;
- } else {
-#ifdef DEBUG
- printf("vme2chip_map\n");
-#endif
- base = vme2chip_map(base, len, 16);
- }
- break;
- case BUS_VMEL:
-#if 0
- if (base > VME2_A16BASE &&
- (base+len-VME2_A16BASE) < VME2_A16D32LEN)
- base = base - VME2_A16BASE + VME2_A16D32BASE;
-#endif
- base = vme2chip_map(base, len, 32);
- break;
- }
- break;
-#endif
- }
- return (base);
-}
-
-/* if successful, returns the va of a vme bus mapping */
-vaddr_t
-vmemap(sc, vmeaddr, len, bustype)
- struct vmesoftc *sc;
- paddr_t vmeaddr;
- int len;
- int bustype;
-{
- paddr_t pa;
- vaddr_t va;
-
- pa = vmepmap(sc, vmeaddr, len, bustype);
- if (pa == 0)
- return (0);
- va = mapiodev(pa, len);
- return (va);
-}
-
-void
-vmeunmap(va, len)
- vaddr_t va;
- int len;
-{
- unmapiodev(va, len);
-}
-
-int
-vmerw(sc, uio, flags, bus)
- struct vmesoftc *sc;
- struct uio *uio;
- int flags;
- int bus;
-{
- vaddr_t v;
- int c;
- struct iovec *iov;
- vaddr_t vme;
- int error = 0;
-
- while (uio->uio_resid > 0 && error == 0) {
- iov = uio->uio_iov;
- if (iov->iov_len == 0) {
- uio->uio_iov++;
- uio->uio_iovcnt--;
- if (uio->uio_iovcnt < 0)
- panic("vmerw");
- continue;
- }
-
- v = uio->uio_offset;
- c = min(iov->iov_len, MAXPHYS);
- if ((v & PGOFSET) + c > NBPG) /* max NBPG at a time */
- c = NBPG - (v & PGOFSET);
- if (c == 0)
- return (0);
- vme = vmemap(sc, trunc_page(v), NBPG, BUS_VMES);
- if (vme == 0) {
- error = EFAULT; /* XXX? */
- continue;
- }
- error = uiomove((void *)vme + (v & PGOFSET), c, uio);
- vmeunmap(vme, NBPG);
- }
- return (error);
-}
-
-int
-vmeprint(args, bus)
- void *args;
- const char *bus;
-{
- struct confargs *ca = args;
-
- printf(" addr 0x%x", ca->ca_paddr);
- if (ca->ca_ipl > 0)
- printf(" ipl %d", ca->ca_ipl);
- if (ca->ca_vec > 0)
- printf(" vec 0x%x", ca->ca_vec);
- return (UNCONF);
-}
-
-int
-vmescan(parent, child, args, bustype)
- struct device *parent;
- void *child, *args;
- int bustype;
-{
- struct cfdata *cf = child;
- struct confargs *ca = args;
- struct confargs oca;
-
- bzero(&oca, sizeof oca);
- oca.ca_iot = &vme_bustag;
- oca.ca_dmat = ca->ca_dmat;
- oca.ca_bustype = bustype;
- oca.ca_paddr = cf->cf_loc[0];
- oca.ca_vec = cf->cf_loc[1];
- oca.ca_ipl = cf->cf_loc[2];
- if (oca.ca_ipl > 0 && oca.ca_vec == -1)
- oca.ca_vec = intr_findvec(255, 0);
- oca.ca_offset = oca.ca_paddr;
- oca.ca_vaddr = (vaddr_t)-1; /* nothing mapped during probe */
- oca.ca_name = cf->cf_driver->cd_name;
-
- if ((*cf->cf_attach->ca_match)(parent, cf, &oca) == 0)
- return (0);
-
- config_attach(parent, cf, &oca, vmeprint);
- return (1);
-}
-
-void
-vmeattach(parent, self, args)
- struct device *parent, *self;
- void *args;
-{
- struct vmesoftc *sc = (struct vmesoftc *)self;
- struct confargs *ca = args;
-#if NLRC > 0 || NOFOBIO > 0 || NPCC > 0
- struct vme1reg *vme1;
-#endif
-#if NMC > 0 || NPCCTWO > 0
- struct vme2reg *vme2;
-#endif
-
- sc->sc_vaddr = ca->ca_vaddr;
-
- vmebustype = ca->ca_bustype;
- switch (ca->ca_bustype) {
-#if NLRC > 0 || NOFOBIO > 0 || NPCC > 0
- case BUS_LRC:
- case BUS_OFOBIO:
- case BUS_PCC:
- vme1 = (struct vme1reg *)sc->sc_vaddr;
- if (vme1->vme1_scon & VME1_SCON_SWITCH)
- printf(": system controller");
- printf("\n");
- vme1chip_init(sc);
- break;
-#endif
-#if NMC > 0 || NPCCTWO > 0
- case BUS_MC:
- case BUS_PCCTWO:
- vme2 = (struct vme2reg *)sc->sc_vaddr;
- if (vme2->vme2_tctl & VME2_TCTL_SCON)
- printf(": system controller");
- printf("\n");
- vme2chip_init(sc);
- break;
-#endif
- }
-
- while (config_found(self, args, NULL))
- ;
-}
-
-/*
- * On the VMEbus, only one cpu may be configured to respond to any
- * particular vme ipl. Therefore, it wouldn't make sense to globally
- * enable all the interrupts all the time -- it would not be possible
- * to put two cpu's and one vme card into a single cage. Rather, we
- * enable each vme interrupt only when we are attaching a device that
- * uses it. This makes it easier (though not trivial) to put two cpu
- * cards in one VME cage, and both can have some limited access to vme
- * interrupts (just can't share the same irq).
- * Obviously no check is made to see if another cpu is using that
- * interrupt. If you share you will lose.
- */
-int
-vmeintr_establish(vec, ih, name)
- int vec;
- struct intrhand *ih;
- const char *name;
-{
- struct vmesoftc *sc = (struct vmesoftc *) vme_cd.cd_devs[0];
-#if NLRC > 0 || NOFOBIO > 0 || NPCC > 0
- struct vme1reg *vme1;
-#endif
-#if NMC > 0 || NPCCTWO > 0
- struct vme2reg *vme2;
-#endif
- int x;
-
- x = intr_establish(vec, ih, name);
-
- switch (vmebustype) {
-#if NLRC > 0 || NOFOBIO > 0 || NPCC > 0
- case BUS_LRC:
- case BUS_OFOBIO:
- case BUS_PCC:
- vme1 = (struct vme1reg *)sc->sc_vaddr;
- vme1->vme1_irqen = vme1->vme1_irqen |
- VME1_IRQ_VME(ih->ih_ipl);
- break;
-#endif
-#if NMC > 0 || NPCCTWO > 0
- case BUS_MC:
- case BUS_PCCTWO:
- vme2 = (struct vme2reg *)sc->sc_vaddr;
- vme2->vme2_irqen = vme2->vme2_irqen |
- VME2_IRQ_VME(ih->ih_ipl);
- break;
-#endif
- }
- return (x);
-}
-
-#if defined(MVME141) || defined(MVME147) || defined(MVME165)
-void
-vme1chip_init(sc)
- struct vmesoftc *sc;
-{
- struct vme1reg *vme1 = (struct vme1reg *)sc->sc_vaddr;
-
- vme1->vme1_scon &= ~VME1_SCON_SYSFAIL; /* XXX doesn't work */
-}
-#endif
-
-
-#if defined(MVME162) || defined(MVME167) || defined(MVME172) || defined(MVME177)
-
-/*
- * XXX what AM bits should be used for the D32/D16 mappings?
- */
-void
-vme2chip_init(sc)
- struct vmesoftc *sc;
-{
- struct vme2reg *vme2 = (struct vme2reg *)sc->sc_vaddr;
- u_long ctl;
-
- sys_vme2 = vme2;
-
- /* turn off SYSFAIL LED */
- vme2->vme2_tctl &= ~VME2_TCTL_SYSFAIL;
-
- /*
- * Display the VMEChip2 decoder status.
- */
- printf("%s: using BUG parameters\n", sc->sc_dev.dv_xname);
- ctl = vme2->vme2_gcsrctl;
- if (ctl & VME2_GCSRCTL_MDEN1) {
- printf("%s: 1phys 0x%08lx-0x%08lx to VME 0x%08lx-0x%08lx\n",
- sc->sc_dev.dv_xname,
- vme2->vme2_master1 << 16, vme2->vme2_master1 & 0xffff0000,
- vme2->vme2_master1 << 16, vme2->vme2_master1 & 0xffff0000);
- }
- if (ctl & VME2_GCSRCTL_MDEN2) {
- printf("%s: 2phys 0x%08lx-0x%08lx to VME 0x%08lx-0x%08lx\n",
- sc->sc_dev.dv_xname,
- vme2->vme2_master2 << 16, vme2->vme2_master2 & 0xffff0000,
- vme2->vme2_master2 << 16, vme2->vme2_master2 & 0xffff0000);
- }
- if (ctl & VME2_GCSRCTL_MDEN3) {
- printf("%s: 3phys 0x%08lx-0x%08lx to VME 0x%08lx-0x%08lx\n",
- sc->sc_dev.dv_xname,
- vme2->vme2_master3 << 16, vme2->vme2_master3 & 0xffff0000,
- vme2->vme2_master3 << 16, vme2->vme2_master3 & 0xffff0000);
- }
- if (ctl & VME2_GCSRCTL_MDEN4) {
- printf("%s: 4phys 0x%08lx-0x%08lx to VME 0x%08lx-0x%08lx\n",
- sc->sc_dev.dv_xname,
- vme2->vme2_master4 << 16, vme2->vme2_master4 & 0xffff0000,
- (vme2->vme2_master4 << 16) + (vme2->vme2_master4mod << 16),
- (vme2->vme2_master4 & 0xffff0000) +
- (vme2->vme2_master4mod & 0xffff0000));
- }
-
- /*
- * Map the VME irq levels to the cpu levels 1:1.
- * This is rather inflexible, but much easier.
- */
- vme2->vme2_irql4 = (7 << VME2_IRQL4_VME7SHIFT) |
- (6 << VME2_IRQL4_VME6SHIFT) | (5 << VME2_IRQL4_VME5SHIFT) |
- (4 << VME2_IRQL4_VME4SHIFT) | (3 << VME2_IRQL4_VME3SHIFT) |
- (2 << VME2_IRQL4_VME2SHIFT) | (1 << VME2_IRQL4_VME1SHIFT);
-
-#if NPCCTWO > 0
- if (vmebustype == BUS_PCCTWO) {
- /*
- * pseudo driver, abort interrupt handler
- */
- sc->sc_abih.ih_fn = vme2abort;
- sc->sc_abih.ih_ipl = 7;
- sc->sc_abih.ih_wantframe = 1;
-
- intr_establish(110, &sc->sc_abih, sc->sc_dev.dv_xname); /* XXX 110 */
- vme2->vme2_irqen |= VME2_IRQ_AB;
- }
-#endif
- /*
- * Enable ACFAIL interrupt, but disable Timer 1 interrupt - we
- * prefer it without for delay().
- */
- vme2->vme2_irqen = (vme2->vme2_irqen | VME2_IRQ_ACF) & ~VME2_IRQ_TIC1;
-}
-
-/*
- * A32 accesses on the MVME1[67]x require setting up mappings in
- * the VME2 chip.
- * XXX VME address must be between 2G and 4G
- * XXX We only support D32 at the moment..
- */
-u_long
-vme2chip_map(base, len, dwidth)
- u_long base;
- int len, dwidth;
-{
- switch (dwidth) {
- case 16:
- if (base < VME2_D16STARTPHYS ||
- base + (u_long)len > VME2_D16ENDPHYS)
- return (0);
- return (base);
- case 32:
- if (base < VME2_D32STARTVME)
- return (0);
- return (base - VME2_D32STARTVME + VME2_D32STARTPHYS);
- default:
- return (0);
- }
-}
-
-#if NPCCTWO > 0
-int
-vme2abort(frame)
- void *frame;
-{
- if ((sys_vme2->vme2_irqstat & VME2_IRQ_AB) != 0)
- sys_vme2->vme2_irqclr = VME2_IRQ_AB;
-
- nmihand(frame);
- return (1);
-}
-#endif
-#endif
diff --git a/sys/arch/mvme68k/dev/vme.h b/sys/arch/mvme68k/dev/vme.h
deleted file mode 100644
index bf029f6dae2..00000000000
--- a/sys/arch/mvme68k/dev/vme.h
+++ /dev/null
@@ -1,337 +0,0 @@
-/* $OpenBSD: vme.h,v 1.13 2009/02/17 22:28:41 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-struct vmesoftc {
- struct device sc_dev;
- vaddr_t sc_vaddr;
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
- struct intrhand sc_abih; /* `abort' switch */
-};
-
-struct vmessoftc {
- struct device sc_dev;
- struct vmesoftc *sc_vme;
-};
-
-struct vmelsoftc {
- struct device sc_dev;
- struct vmesoftc *sc_vme;
-};
-
-/*
- * MVME147 vme configuration registers.
-*/
-struct vme1reg {
-/*01*/ volatile u_short vme1_scon;
-#define VME1_SCON_SWITCH 0x01 /* SCON jumper is set */
-#define VME1_SCON_SRESET 0x02 /* assert SRESET on bus */
-#define VME1_SCON_SYSFAIL 0x04 /* assert SYSFAIL on bus */
-#define VME1_SCON_ROBIN 0x08 /* round robin bus requests */
-/*03*/ volatile u_short vme1_reqconf;
-#define VME1_REQ_IPLMASK 0x03 /* interrupt level for requester */
-#define VME1_REQ_RNEVER 0x08
-#define VME1_REQ_RWD 0x10
-#define VME1_REQ_DHB 0x40
-#define VME1_REQ_DWB 0x80
-/*05*/ volatile u_short vme1_masconf;
-#define VME1_MAS_D16 0x01 /* force d8/16 accesses only */
-#define VME1_MAS_MASA24 0x02 /* send address mod for A24 access */
-#define VME1_MAS_MASA16 0x04 /* send address mod for A16 access */
-#define VME1_MAS_MASUAT 0x08 /* handle unaligned VME cycles */
-#define VME1_MAS_CFILL 0x10 /* DO NOT USE */
-#define VME1_MAS_MASWP 0x20 /* VME fast mode (DO NOT USE) */
-/*07*/ volatile u_short vme1_slconf;
-#define VME1_SLAVE_SLVD16 0x01 /* DO NOT USE */
-#define VME1_SLAVE_SLVWP 0x20 /* DO NOT USE */
-#define VME1_SLAVE_SLVEN 0x80 /* allow access to onboard DRAM */
-/*09*/ volatile u_short vme1_timerconf;
-#define VME1_TIMER_LOCAL_MASK 0x03
-#define VME1_TIMER_LOCAL_T0 0x00 /* local timeout 102 microsec */
-#define VME1_TIMER_LOCAL_T1 0x01 /* local timeout 205 microsec */
-#define VME1_TIMER_LOCAL_T2 0x02 /* local timeout 410 microsec */
-#define VME1_TIMER_LOCAL_T3 0x03 /* local timeout disabled */
-#define VME1_TIMER_VMEACC_MASK 0x0c
-#define VME1_TIMER_VMEACC_T0 0x00 /* VME access timeout 102 microsec */
-#define VME1_TIMER_VMEACC_T1 0x04 /* VME access timeout 1.6 millisec */
-#define VME1_TIMER_VMEACC_T2 0x08 /* VME access timeout 51 millisec */
-#define VME1_TIMER_VMEACC_T3 0x0c /* VME access timeout disabled */
-#define VME1_TIMER_VMEGLO_MASK 0x30
-#define VME1_TIMER_VMEGLO_T0 0x00 /* VME glob timeout 102 microsec */
-#define VME1_TIMER_VMEGLO_T1 0x10 /* VME glob timeout 205 microsec */
-#define VME1_TIMER_VMEGLO_T2 0x20 /* VME glob timeout 410 microsec */
-#define VME1_TIMER_VMEGLO_T3 0x30 /* VME glob timeout disabled */
-#define VME1_TIMER_ARBTO 0x40 /* enable VME arbitration timer */
-/*0b*/ volatile u_short vme1_sladdrmod;
-#define VME1_SLMOD_DATA 0x01
-#define VME1_SLMOD_PRGRM 0x02
-#define VME1_SLMOD_BLOCK 0x04
-#define VME1_SLMOD_SHORT 0x08
-#define VME1_SLMOD_STND 0x10
-#define VME1_SLMOD_EXTED 0x20
-#define VME1_SLMOD_USER 0x40
-#define VME1_SLMOD_SUPER 0x80
-/*0d*/ volatile u_short vme1_msaddrmod;
-#define VME1_MSMOD_AM_MASK 0x3f
-#define VME1_MSMOD_AMSEL 0x80
-/*0f*/ volatile u_short vme1_irqen;
-#define VME1_IRQ_VME(x) (1 << (x))
-/*11*/ volatile u_short vme1_uirqen;
-/*13*/ volatile u_short vme1_uirq;
-/*15*/ volatile u_short vme1_irq;
-/*17*/ volatile u_short vme1_vmeid;
-/*19*/ volatile u_short vme1_buserr;
-/*1b*/ volatile u_short vme1_gcsr;
-#define VME1_GCSR_OFF 0x0f
-/*1d*/ u_short :16;
-/*1f*/ u_short :16;
-/*21*/ volatile u_short vme1_gcsr_gr0;
-/*23*/ volatile u_short vme1_gcsr_gr1;
-/*25*/ volatile u_short vme1_gcsr_boardid;
-/*27*/ volatile u_short vme1_gcsr_gpr0;
-/*29*/ volatile u_short vme1_gcsr_gpr1;
-/*2b*/ volatile u_short vme1_gcsr_gpr2;
-/*2d*/ volatile u_short vme1_gcsr_gpr3;
-/*2f*/ volatile u_short vme1_gcsr_gpr4;
-};
-
-/*
- * Basic VME memory layout for the MVME147 follows:
- * - A32D32 accesses occur at memsize-0xefffffff. This makes it
- * impossible to do A32D32 accesses before the end of your onboard
- * memory. If you want to do low address A24D32 accesses, and you
- * have 16M or more onboard memory you'll find you cannot.
- * - A32D16 accesses can occur at 0xf0000000-0xff7fffff.
- * - A16D16 accesses can occur at 0xffff0000-0xffffffff.
- */
-#define VME1_A32D32BASE 0x00000000UL
-#define VME1_A32D32LEN 0xf0000000UL
-#define VME1_A32D16BASE 0xf0000000UL
-#define VME1_A32D16LEN 0x0f800000UL
-#define VME1_A16D16BASE 0xffff0000UL
-#define VME1_A16D16LEN 0x00010000UL
-#define VME1_A16BASE 0xffff0000UL
-
-/*
- * XXX: this chip has some rather insane access rules!
- */
-struct vme2reg {
-/*00*/ volatile u_long vme2_slaveaddr1;
-/*04*/ volatile u_long vme2_slaveaddr2;
-#define VME2_SADDR_END 0xffff0000 /* VME address END & START */
-#define VME2_SADDR_START 0x0000ffff
-/*08*/ volatile u_long vme2_slavelmod1;
-/*0c*/ volatile u_long vme2_slavelmod2;
-#define VME2_SADDR_LADDR 0xffff0000 /* local base address */
-#define VME2_SADDR_SIZE(mem) (0x1000 - (mem) >> 16) /* encoding of size */
-/*10*/ volatile u_long vme2_slavectl;
-#define VME2_SLAVE_CHOOSE(bits, num) ((bits) << (16*((num)-1)))
-#define VME2_SLAVECTL_WP 0x00000100 /* write posting */
-#define VME2_SLAVECTL_SNP_NO 0x00000000 /* no snooping */
-#define VME2_SLAVECTL_SNP_SINK 0x00000200 /* sink data */
-#define VME2_SLAVECTL_SNP_INVAL 0x00000400 /* invalidate */
-#define VME2_SLAVECTL_ADDER 0x00000800 /* use adder */
-#define VME2_SLAVECTL_SUP 0x00000080 /* modifier bit */
-#define VME2_SLAVECTL_USR 0x00000040 /* modifier bit */
-#define VME2_SLAVECTL_A32 0x00000020 /* modifier bit */
-#define VME2_SLAVECTL_A24 0x00000010 /* modifier bit */
-#define VME2_SLAVECTL_D64 0x00000008 /* modifier bit */
-#define VME2_SLAVECTL_BLK 0x00000004 /* modifier bit */
-#define VME2_SLAVECTL_PGM 0x00000002 /* modifier bit */
-#define VME2_SLAVECTL_DAT 0x00000001 /* modifier bit */
-/*14*/ volatile u_long vme2_master1;
-/*18*/ volatile u_long vme2_master2;
-/*1c*/ volatile u_long vme2_master3;
-/*20*/ volatile u_long vme2_master4;
-/*24*/ volatile u_long vme2_master4mod;
-/*28*/ volatile u_long vme2_masterctl;
-#define VME2_MASTERCTL_4SHIFT 24
-#define VME2_MASTERCTL_3SHIFT 16
-#define VME2_MASTERCTL_2SHIFT 8
-#define VME2_MASTERCTL_1SHIFT 0
-#define VME2_MASTERCTL_D16 0x80
-#define VME2_MASTERCTL_WP 0x40
-#define VME2_MASTERCTL_AM 0x3f
-#define VME2_MASTERCTL_AM24SB 0x3f /* A24 Supervisory Block Transfer */
-#define VME2_MASTERCTL_AM24SP 0x3e /* A24 Supervisory Program Access */
-#define VME2_MASTERCTL_AM24SD 0x3d /* A24 Supervisory Data Access */
-#define VME2_MASTERCTL_AM24UB 0x3b /* A24 Non-priv. Block Transfer */
-#define VME2_MASTERCTL_AM24UP 0x3a /* A24 Non-priv. Program Access */
-#define VME2_MASTERCTL_AM24UD 0x39 /* A24 Non-priv. Data Access */
-#define VME2_MASTERCTL_AM16S 0x2d /* A16 Supervisory Access */
-#define VME2_MASTERCTL_AM16U 0x29 /* A16 Non-priv. Access */
-#define VME2_MASTERCTL_AM32SB 0x0f /* A32 Supervisory Block Transfer */
-#define VME2_MASTERCTL_AM32SP 0x0e /* A32 Supervisory Program Access */
-#define VME2_MASTERCTL_AM32SD 0x0d /* A32 Supervisory Data Access */
-#define VME2_MASTERCTL_AM32UB 0x0b /* A32 Non-priv. Block Transfer */
-#define VME2_MASTERCTL_AM32UP 0x0a /* A32 Non-priv. Program Access */
-#define VME2_MASTERCTL_AM32UD 0x09 /* A32 Non-priv Data Access */
-
-#define VME2_MASTERCTL_ALL 0xff
-/*2c*/ volatile u_long vme2_gcsrctl;
-#define VME2_GCSRCTL_OFF 0xf0000000
-#define VME2_GCSRCTL_MDEN4 0x00080000
-#define VME2_GCSRCTL_MDEN3 0x00040000
-#define VME2_GCSRCTL_MDEN2 0x00020000
-#define VME2_GCSRCTL_MDEN1 0x00010000
-#define VME2_GCSRCTL_I2EN 0x00008000 /* F decode (A24D16/A32D16) on */
-#define VME2_GCSRCTL_I2WP 0x00004000 /* F decode write post */
-#define VME2_GCSRCTL_I2SU 0x00002000 /* F decode is supervisor */
-#define VME2_GCSRCTL_I2PD 0x00001000 /* F decode is program */
-#define VME2_GCSRCTL_I1EN 0x00000800 /* short decode (A16Dx) on */
-#define VME2_GCSRCTL_I1D16 0x00000400 /* short decode is D16 */
-#define VME2_GCSRCTL_I1WP 0x00000200 /* short decode write post */
-#define VME2_GCSRCTL_I1SU 0x00000100 /* short decode is supervisor */
-#define VME2_GCSRCTL_ROMSIZE 0x000000c0 /* size of ROM */
-#define VME2_GCSRCTL_ROMBSPD 0x00000038 /* speed of ROM */
-#define VME2_GCSRCTL_ROMASPD 0x00000007 /* speed of ROM */
-/*30*/ volatile u_long vme2_dmactl;
-/*34*/ volatile u_long vme2_dmamode;
-/*38*/ volatile u_long vme2_dmaladdr;
-/*3c*/ volatile u_long vme2_dmavmeaddr;
-/*40*/ volatile u_long vme2_dmacount;
-/*44*/ volatile u_long vme2_dmatable;
-/*48*/ volatile u_long vme2_dmastat;
-/*4c*/ volatile u_long vme2_vmejunk;
-/*50*/ volatile u_long vme2_t1cmp;
-/*54*/ volatile u_long vme2_t1count;
-/*58*/ volatile u_long vme2_t2cmp;
-/*5c*/ volatile u_long vme2_t2count;
-/*60*/ volatile u_long vme2_tctl;
-#define VME2_TCTL_CEN 0x01
-#define VME2_TCTL_COC 0x02
-#define VME2_TCTL_COVF 0x04
-#define VME2_TCTL_OVF 0xf0
-#define VME2_TCTL_SCON 0x40000000 /* we are SCON */
-#define VME2_TCTL_SYSFAIL 0x20000000 /* light SYSFAIL led */
-#define VME2_TCTL_SRST 0x00800000 /* system reset */
-/*64*/ volatile u_long vme2_prescale;
-/*68*/ volatile u_long vme2_irqstat;
-/*6c*/ volatile u_long vme2_irqen;
-/*70*/ volatile u_long vme2_setsoftirq; /* VME2_IRQ_SWx only */
-/*74*/ volatile u_long vme2_irqclr; /* except VME2_IRQ_VMEx */
-#define VME2_IRQ_ACF 0x80000000
-#define VME2_IRQ_AB 0x40000000
-#define VME2_IRQ_SYSF 0x20000000
-#define VME2_IRQ_MWP 0x10000000
-#define VME2_IRQ_PE 0x08000000
-#define VME2_IRQ_V1IE 0x04000000
-#define VME2_IRQ_TIC2 0x02000000
-#define VME2_IRQ_TIC1 0x01000000
-#define VME2_IRQ_VIA 0x00800000
-#define VME2_IRQ_DMA 0x00400000
-#define VME2_IRQ_SIG3 0x00200000
-#define VME2_IRQ_SIG2 0x00100000
-#define VME2_IRQ_SIG1 0x00080000
-#define VME2_IRQ_SIG0 0x00040000
-#define VME2_IRQ_LM1 0x00020000
-#define VME2_IRQ_LM0 0x00010000
-#define VME2_IRQ_SW7 0x00008000
-#define VME2_IRQ_SW6 0x00004000
-#define VME2_IRQ_SW5 0x00002000
-#define VME2_IRQ_SW4 0x00001000
-#define VME2_IRQ_SW3 0x00000800
-#define VME2_IRQ_SW2 0x00000400
-#define VME2_IRQ_SW1 0x00000200
-#define VME2_IRQ_SW0 0x00000100
-#define VME2_IRQ_SPARE 0x00000080
-#define VME2_IRQ_VME7 0x00000040
-#define VME2_IRQ_VME6 0x00000020
-#define VME2_IRQ_VME5 0x00000010
-#define VME2_IRQ_VME4 0x00000008
-#define VME2_IRQ_VME3 0x00000004
-#define VME2_IRQ_VME2 0x00000002
-#define VME2_IRQ_VME1 0x00000001
-#define VME2_IRQ_VME(x) (1 << ((x) - 1))
-/*78*/ volatile u_long vme2_irql1;
-#define VME2_IRQL1_ACFSHIFT 28
-#define VME2_IRQL1_ABSHIFT 24
-#define VME2_IRQL1_SYSFSHIFT 20
-#define VME2_IRQL1_WPESHIFT 16
-#define VME2_IRQL1_PESHIFT 12
-#define VME2_IRQL1_V1IESHIFT 8
-#define VME2_IRQL1_TIC2SHIFT 4
-#define VME2_IRQL1_TIC1SHIFT 0
-/*7c*/ volatile u_long vme2_irql2;
-#define VME2_IRQL2_VIASHIFT 28
-#define VME2_IRQL2_DMASHIFT 24
-#define VME2_IRQL2_SIG3SHIFT 20
-#define VME2_IRQL2_SIG2SHIFT 16
-#define VME2_IRQL2_SIG1SHIFT 12
-#define VME2_IRQL2_SIG0SHIFT 8
-#define VME2_IRQL2_LM1SHIFT 4
-#define VME2_IRQL2_LM0SHIFT 0
-/*80*/ volatile u_long vme2_irql3;
-#define VME2_IRQL3_SW7SHIFT 28
-#define VME2_IRQL3_SW6SHIFT 24
-#define VME2_IRQL3_SW5SHIFT 20
-#define VME2_IRQL3_SW4SHIFT 16
-#define VME2_IRQL3_SW3SHIFT 12
-#define VME2_IRQL3_SW2SHIFT 8
-#define VME2_IRQL3_SW1SHIFT 4
-#define VME2_IRQL3_SW0SHIFT 0
-/*84*/ volatile u_long vme2_irql4;
-#define VME2_IRQL4_SPARESHIFT 28
-#define VME2_IRQL4_VME7SHIFT 24
-#define VME2_IRQL4_VME6SHIFT 20
-#define VME2_IRQL4_VME5SHIFT 16
-#define VME2_IRQL4_VME4SHIFT 12
-#define VME2_IRQL4_VME3SHIFT 8
-#define VME2_IRQL4_VME2SHIFT 4
-#define VME2_IRQL4_VME1SHIFT 0
-/*88*/ volatile u_long vme2_vbr;
-#define VME2_VBR_0SHIFT 28
-#define VME2_VBR_1SHIFT 24
-#define VME2_VBR_GPOXXXX 0x00ffffff
-/*8c*/ volatile u_long vme2_misc;
-#define VME2_MISC_MPIRQEN 0x00000080 /* do not set */
-#define VME2_MISC_REVEROM 0x00000040 /* 167: dis eprom. 166: en flash */
-#define VME2_MISC_DISSRAM 0x00000020 /* do not set */
-#define VME2_MISC_DISMST 0x00000010
-#define VME2_MISC_NOELBBSY 0x00000008 /* do not set */
-#define VME2_MISC_DISBSYT 0x00000004 /* do not set */
-#define VME2_MISC_ENINT 0x00000002 /* do not set */
-#define VME2_MISC_DISBGN 0x00000001 /* do not set */
-};
-
-#define VME2_A16D32BASE 0xffff0000UL
-#define VME2_A16D32LEN 0x00010000UL
-#define VME2_A32D16BASE 0xf1000000UL
-#define VME2_A32D16LEN 0x01000000UL
-#define VME2_A16D16BASE 0xffff0000UL
-#define VME2_A16D16LEN 0x00010000UL
-#define VME2_A24D16BASE 0xf0000000UL
-#define VME2_A24D16LEN 0x01000000UL
-#define VME2_A16BASE 0xffff0000UL
-#define VME2_A24BASE 0xff000000UL
-
-paddr_t vmepmap(struct vmesoftc *sc, paddr_t vmeaddr, int len, int bustype);
-vaddr_t vmemap(struct vmesoftc *sc, paddr_t vmeaddr, int len, int bustype);
-int vmerw(struct vmesoftc *sc, struct uio *uio, int flags, int bus);
-
-int vmeintr_establish(int, struct intrhand *, const char *);
-int vmescan(struct device *, void *, void *, int);
diff --git a/sys/arch/mvme68k/dev/vmel.c b/sys/arch/mvme68k/dev/vmel.c
deleted file mode 100644
index 8ca896d0bd6..00000000000
--- a/sys/arch/mvme68k/dev/vmel.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/* $OpenBSD: vmel.c,v 1.18 2011/04/07 15:30:15 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/autoconf.h>
-#include <machine/conf.h>
-#include <machine/cpu.h>
-
-#include <mvme68k/dev/vme.h>
-
-/*
- * The VMEL driver deals with D32 transfers on the VME bus. The number
- * of address bits (A16, A24, A32) is irrelevant since the mapping
- * functions will decide how many address bits are relevant.
- */
-
-void vmelattach(struct device *, struct device *, void *);
-int vmelmatch(struct device *, void *, void *);
-
-int vmelscan(struct device *, void *, void *);
-
-struct cfattach vmel_ca = {
- sizeof(struct vmelsoftc), vmelmatch, vmelattach
-};
-
-struct cfdriver vmel_cd = {
- NULL, "vmel", DV_DULL
-};
-
-int
-vmelmatch(parent, cf, args)
- struct device *parent;
- void *cf, *args;
-{
- return (1);
-}
-
-int
-vmelscan(parent, child, args)
- struct device *parent;
- void *child, *args;
-{
- return (vmescan(parent, child, args, BUS_VMEL));
-}
-
-void
-vmelattach(parent, self, args)
- struct device *parent, *self;
- void *args;
-{
- struct vmelsoftc *sc = (struct vmelsoftc *)self;
-
- printf("\n");
-
- sc->sc_vme = (struct vmesoftc *)parent;
-
- config_search(vmelscan, self, args);
-}
-
-/*ARGSUSED*/
-int
-vmelopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- if (minor(dev) >= vmel_cd.cd_ndevs ||
- vmel_cd.cd_devs[minor(dev)] == NULL)
- return (ENODEV);
- return (0);
-}
-
-/*ARGSUSED*/
-int
-vmelclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
-
- return (0);
-}
-
-/*ARGSUSED*/
-int
-vmelioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- int error = 0;
-
- switch (cmd) {
- default:
- error = ENOTTY;
- break;
- }
- return (error);
-}
-
-int
-vmelread(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- int unit = minor(dev);
- struct vmelsoftc *sc = (struct vmelsoftc *) vmel_cd.cd_devs[unit];
-
- return (vmerw(sc->sc_vme, uio, flags, BUS_VMEL));
-}
-
-int
-vmelwrite(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- int unit = minor(dev);
- struct vmelsoftc *sc = (struct vmelsoftc *) vmel_cd.cd_devs[unit];
-
- return (vmerw(sc->sc_vme, uio, flags, BUS_VMEL));
-}
-
-paddr_t
-vmelmmap(dev, off, prot)
- dev_t dev;
- off_t off;
- int prot;
-{
- int unit = minor(dev);
- struct vmelsoftc *sc = (struct vmelsoftc *) vmel_cd.cd_devs[unit];
- paddr_t pa;
-
- pa = vmepmap(sc->sc_vme, (vaddr_t)off, NBPG, BUS_VMEL);
-#ifdef DEBUG
- printf("vmel %llx pa %p\n", off, pa);
-#endif
- if (pa == 0)
- return (-1);
- return (pa);
-}
diff --git a/sys/arch/mvme68k/dev/vmes.c b/sys/arch/mvme68k/dev/vmes.c
deleted file mode 100644
index e8743e18d10..00000000000
--- a/sys/arch/mvme68k/dev/vmes.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/* $OpenBSD: vmes.c,v 1.17 2010/12/26 15:40:59 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/autoconf.h>
-#include <machine/conf.h>
-#include <machine/cpu.h>
-
-#include <mvme68k/dev/vme.h>
-
-/*
- * The VMES driver deals with D16 transfers on the VME bus. The number
- * of address bits (A16, A24, A32) is irrelevant since the mapping
- * functions will decide how many address bits are relevant.
- */
-
-void vmesattach(struct device *, struct device *, void *);
-int vmesmatch(struct device *, void *, void *);
-
-int vmesscan(struct device *, void *, void *);
-
-struct cfattach vmes_ca = {
- sizeof(struct vmessoftc), vmesmatch, vmesattach
-};
-
-struct cfdriver vmes_cd = {
- NULL, "vmes", DV_DULL
-};
-
-int
-vmesmatch(parent, cf, args)
- struct device *parent;
- void *cf, *args;
-{
- return (1);
-}
-
-int
-vmesscan(parent, child, args)
- struct device *parent;
- void *child, *args;
-{
- return (vmescan(parent, child, args, BUS_VMES));
-}
-
-void
-vmesattach(parent, self, args)
- struct device *parent, *self;
- void *args;
-{
- struct vmessoftc *sc = (struct vmessoftc *)self;
-
- printf("\n");
-
- sc->sc_vme = (struct vmesoftc *)parent;
-
- config_search(vmesscan, self, args);
-}
-
-/*ARGSUSED*/
-int
-vmesopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- if (minor(dev) >= vmes_cd.cd_ndevs ||
- vmes_cd.cd_devs[minor(dev)] == NULL)
- return (ENODEV);
- return (0);
-}
-
-/*ARGSUSED*/
-int
-vmesclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
-
- return (0);
-}
-
-/*ARGSUSED*/
-int
-vmesioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- int error = 0;
-
- switch (cmd) {
- default:
- error = ENOTTY;
- break;
- }
- return (error);
-}
-
-int
-vmesread(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- int unit = minor(dev);
- struct vmessoftc *sc = (struct vmessoftc *) vmes_cd.cd_devs[unit];
-
- return (vmerw(sc->sc_vme, uio, flags, BUS_VMES));
-}
-
-int
-vmeswrite(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- int unit = minor(dev);
- struct vmessoftc *sc = (struct vmessoftc *) vmes_cd.cd_devs[unit];
-
- return (vmerw(sc->sc_vme, uio, flags, BUS_VMES));
-}
-
-paddr_t
-vmesmmap(dev, off, prot)
- dev_t dev;
- off_t off;
- int prot;
-{
- int unit = minor(dev);
- struct vmessoftc *sc = (struct vmessoftc *) vmes_cd.cd_devs[unit];
- paddr_t pa;
-
- pa = vmepmap(sc->sc_vme, (vaddr_t)off, NBPG, BUS_VMES);
- if (pa == 0)
- return (-1);
- return (pa);
-}
diff --git a/sys/arch/mvme68k/dev/vs.c b/sys/arch/mvme68k/dev/vs.c
deleted file mode 100644
index 6b3aad8101c..00000000000
--- a/sys/arch/mvme68k/dev/vs.c
+++ /dev/null
@@ -1,1364 +0,0 @@
-/* $OpenBSD: vs.c,v 1.37 2014/01/21 23:47:41 jsg Exp $ */
-
-/*
- * Copyright (c) 2004, 2009, Miodrag Vallat.
- * Copyright (c) 1999 Steve Murphree, Jr.
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * MVME328S SCSI adaptor driver
- */
-
-/* This card lives in D16 space */
-#define __BUS_SPACE_RESTRICT_D16__
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/disklabel.h>
-#include <sys/buf.h>
-#include <sys/malloc.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-
-#include <mvme68k/dev/vsreg.h>
-#include <mvme68k/dev/vsvar.h>
-#include <mvme68k/dev/vme.h>
-
-int vsmatch(struct device *, void *, void *);
-void vsattach(struct device *, struct device *, void *);
-void vs_minphys(struct buf *, struct scsi_link *);
-void vs_scsicmd(struct scsi_xfer *);
-
-struct scsi_adapter vs_scsiswitch = {
- vs_scsicmd,
- vs_minphys,
- 0, /* no lun support */
- 0, /* no lun support */
-};
-
-struct cfattach vs_ca = {
- sizeof(struct vs_softc), vsmatch, vsattach,
-};
-
-struct cfdriver vs_cd = {
- NULL, "vs", DV_DULL,
-};
-
-int do_vspoll(struct vs_softc *, struct scsi_xfer *, int);
-void thaw_queue(struct vs_softc *, int);
-void thaw_all_queues(struct vs_softc *);
-int vs_alloc_sg(struct vs_softc *);
-int vs_alloc_wq(struct vs_softc *);
-void vs_build_sg_list(struct vs_softc *, struct vs_cb *, bus_addr_t);
-void vs_chksense(struct vs_cb *, struct scsi_xfer *);
-int vs_eintr(void *);
-int vs_getcqe(struct vs_softc *, bus_addr_t *, bus_addr_t *);
-int vs_identify(struct vs_channel *, int);
-int vs_initialize(struct vs_softc *);
-int vs_intr(struct vs_softc *);
-int vs_load_command(struct vs_softc *, struct vs_cb *, bus_addr_t,
- bus_addr_t, struct scsi_link *, int, struct scsi_generic *, int,
- uint8_t *, int);
-int vs_nintr(void *);
-void vs_poll(struct vs_softc *, struct vs_cb *);
-void vs_print_addr(struct vs_softc *, struct scsi_xfer *);
-struct vs_cb *vs_find_queue(struct scsi_link *, struct vs_softc *);
-void vs_reset(struct vs_softc *, int);
-void vs_resync(struct vs_softc *);
-void vs_scsidone(struct vs_softc *, struct vs_cb *);
-int vs_unit_value(int, int, int);
-
-static __inline__ void vs_free(struct vs_softc *, struct vs_cb *);
-static __inline__ void vs_clear_return_info(struct vs_softc *);
-
-int
-vsmatch(struct device *device, void *cf, void *args)
-{
- struct confargs *ca = args;
- bus_space_tag_t iot = ca->ca_iot;
- bus_space_handle_t ioh;
- int rc;
- u_int16_t id;
-
- if (bus_space_map(iot, ca->ca_paddr, S_SHORTIO, 0, &ioh) != 0)
- return 0;
- rc = badvaddr((vaddr_t)bus_space_vaddr(iot, ioh) + sh_CSS + CSB_TYPE, 2);
- if (rc == 0) {
- id = bus_space_read_2(iot, ioh, sh_CSS + CSB_TYPE);
- if (id != JAGUAR && id != COUGAR)
- rc = 1;
- /*
- * Note that this will reject Cougar boards configured with
- * less than 2KB of short I/O memory.
- * Is it worth checking for a Cougar signature at lower
- * addresses, knowing that we can't really work unless
- * the board is jumped to enable the whole 2KB?
- */
- }
- bus_space_unmap(iot, ioh, S_SHORTIO);
-
- return rc == 0;
-}
-
-void
-vsattach(struct device *parent, struct device *self, void *args)
-{
- struct vs_softc *sc = (struct vs_softc *)self;
- struct vs_channel *vc;
- struct confargs *ca = args;
- struct scsi_link *sc_link;
- struct scsibus_attach_args saa;
-#ifdef notyet
- int evec, bus;
-#else
- int bus;
-#endif
- int tmp;
-
-#ifdef notyet
- /* get the next available vector for the error interrupt */
- evec = vme_findvec(ca->ca_vec);
-
- if (ca->ca_vec < 0 || evec < 0) {
- printf(": no more interrupts!\n");
- return;
- }
-#endif
- if (ca->ca_ipl < 0)
- ca->ca_ipl = IPL_BIO;
-
-#ifdef notyet
- printf(" vec 0x%x: ", evec);
-#else
- printf(": ");
-#endif
-
- sc->sc_dmat = ca->ca_dmat;
- sc->sc_iot = ca->ca_iot;
- if (bus_space_map(sc->sc_iot, ca->ca_paddr, S_SHORTIO, 0,
- &sc->sc_ioh) != 0) {
- printf("can't map registers!\n");
- return;
- }
-
- sc->sc_bid = csb_read(2, CSB_TYPE);
- sc->sc_ipl = ca->ca_ipl;
- sc->sc_nvec = ca->ca_vec;
-#ifdef notyet
- sc->sc_evec = evec;
-#else
- sc->sc_evec = ca->ca_vec;
-#endif
-
- if (vs_initialize(sc))
- return;
-
- sc->sc_ih_n.ih_fn = vs_nintr;
- sc->sc_ih_n.ih_arg = sc;
- sc->sc_ih_n.ih_wantframe = 0;
- sc->sc_ih_n.ih_ipl = ca->ca_ipl;
-
- sc->sc_ih_e.ih_fn = vs_eintr;
- sc->sc_ih_e.ih_arg = sc;
- sc->sc_ih_e.ih_wantframe = 0;
- sc->sc_ih_e.ih_ipl = ca->ca_ipl;
-
- vmeintr_establish(sc->sc_nvec, &sc->sc_ih_n, self->dv_xname);
-#ifdef notyet
- snprintf(sc->sc_intrname_e, sizeof sc->sc_intrname_e,
- "%s_err", self->dv_xname);
- vmeintr_establish(sc->sc_evec, &sc->sc_ih_e, sc->sc_intrname_e);
-#endif
-
- /*
- * Attach all scsi units on us, watching for boot device
- * (see device_register).
- */
- tmp = bootpart;
- if (ca->ca_paddr != bootaddr)
- bootpart = -1; /* invalid flag to device_register */
-
- for (bus = 0; bus < 2; bus++) {
- vc = &sc->sc_channel[bus];
- if (vc->vc_id < 0)
- continue;
-
- sc_link = &vc->vc_link;
- sc_link->adapter = &vs_scsiswitch;
- sc_link->adapter_buswidth = vc->vc_width;
- sc_link->adapter_softc = sc;
- sc_link->adapter_target = vc->vc_id;
- if (sc->sc_bid != JAGUAR)
- sc_link->luns = 1; /* not enough queues */
- sc_link->openings = 1;
- if (bus != 0)
- sc_link->flags = SDEV_2NDBUS;
-
- printf("%s: channel %d", sc->sc_dev.dv_xname, bus);
- switch (vc->vc_type) {
- case VCT_SE:
- printf(", single-ended");
- break;
- case VCT_DIFFERENTIAL:
- printf(", differential");
- break;
- }
- printf("\n");
-
- if (vc->vc_width == 0) {
- printf("%s: daughterboard disabled, "
- "not enough on-board memory\n",
- sc->sc_dev.dv_xname);
- continue;
- }
-
- bzero(&saa, sizeof(saa));
- saa.saa_sc_link = &vc->vc_link;
-
- bootbus = bus;
- config_found(self, &saa, scsiprint);
- }
-
- bootpart = tmp; /* restore old values */
- bootbus = 0;
-}
-
-void
-vs_minphys(struct buf *bp, struct scsi_link *sl)
-{
- if (bp->b_bcount > ptoa(MAX_SG_ELEMENTS))
- bp->b_bcount = ptoa(MAX_SG_ELEMENTS);
- minphys(bp);
-}
-
-void
-vs_print_addr(struct vs_softc *sc, struct scsi_xfer *xs)
-{
- if (xs == NULL)
- printf("%s: ", sc->sc_dev.dv_xname);
- else {
- sc_print_addr(xs->sc_link);
-
- /* print bus number too if appropriate */
- if (sc->sc_channel[1].vc_width >= 0)
- printf("(channel %d) ",
- !!(xs->sc_link->flags & SDEV_2NDBUS));
- }
-}
-
-int
-do_vspoll(struct vs_softc *sc, struct scsi_xfer *xs, int canreset)
-{
- int to;
- int crsw, bus;
-
- if (xs != NULL) {
- bus = !!(xs->sc_link->flags & SDEV_2NDBUS);
- to = xs->timeout;
- if (to == 0)
- to = 2000;
- } else {
- bus = -1;
- to = 2000;
- }
-
- while (((crsw = CRSW) & (M_CRSW_CRBV | M_CRSW_CC)) == 0) {
- if (to-- <= 0) {
- vs_print_addr(sc, xs);
- printf("command timeout, crsw 0x%x\n", crsw);
-
- if (canreset) {
- vs_reset(sc, bus);
- vs_resync(sc);
- }
- return 1;
- }
- delay(1000);
- }
-#ifdef VS_DEBUG
- printf("%s: crsw %04x to %d/%d\n",
- __func__, crsw, to, xs ? xs->timeout : 2000);
-#endif
- return 0;
-}
-
-void
-vs_poll(struct vs_softc *sc, struct vs_cb *cb)
-{
- struct scsi_xfer *xs;
- int s;
- int rc;
-
- xs = cb->cb_xs;
- rc = do_vspoll(sc, xs, 1);
-
- s = splbio();
- if (rc != 0) {
- xs->error = XS_SELTIMEOUT;
- xs->status = -1;
-#ifdef VS_DEBUG
- printf("%s: polled command timed out\n", __func__);
-#endif
- vs_free(sc, cb);
- scsi_done(xs);
- } else
- vs_scsidone(sc, cb);
- splx(s);
-
- if (CRSW & M_CRSW_ER)
- CRB_CLR_ER;
- CRB_CLR_DONE;
-
- vs_clear_return_info(sc);
-}
-
-void
-thaw_queue(struct vs_softc *sc, int target)
-{
- THAW(target);
-
- /* loop until thawed */
- while (THAW_REG & M_THAW_TWQE)
- ;
-}
-
-void
-thaw_all_queues(struct vs_softc *sc)
-{
- int i;
-
- for (i = 1; i <= sc->sc_nwq; i++)
- thaw_queue(sc, i);
-}
-
-void
-vs_scsidone(struct vs_softc *sc, struct vs_cb *cb)
-{
- struct scsi_xfer *xs = cb->cb_xs;
- u_int32_t len;
- int error;
-
- len = vs_read(4, sh_RET_IOPB + IOPB_LENGTH);
- xs->resid = xs->datalen - len;
-
- error = vs_read(2, sh_RET_IOPB + IOPB_STATUS);
-#ifdef VS_DEBUG
- printf("%s: queue %d, len %u (resid %d) error %d\n",
- __func__, cb->cb_q, len, xs->resid, error);
- if (error != 0)
- printf("%s: last select %d %d, phase %02x %02x\n",
- __func__, csb_read(1, CSB_LPDS), csb_read(1, CSB_LSDS),
- csb_read(1, CSB_PPS), csb_read(1, CSB_SPS));
-#endif
- if ((error & 0xff) == SCSI_SELECTION_TO) {
- xs->error = XS_SELTIMEOUT;
- xs->status = -1;
- } else {
- if (xs->flags & (SCSI_DATA_IN | SCSI_DATA_OUT)) {
- bus_dmamap_sync(sc->sc_dmat, cb->cb_dmamap, 0,
- cb->cb_dmalen, (xs->flags & SCSI_DATA_IN) ?
- BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
- bus_dmamap_unload(sc->sc_dmat, cb->cb_dmamap);
- }
-
- xs->status = error >> 8;
- }
-
- while (xs->status == SCSI_CHECK) {
- vs_chksense(cb, xs);
- }
-
- vs_free(sc, cb);
- scsi_done(xs);
-}
-
-void
-vs_scsicmd(struct scsi_xfer *xs)
-{
- struct scsi_link *slp = xs->sc_link;
- struct vs_softc *sc = slp->adapter_softc;
- int flags;
- bus_addr_t cqep, iopb;
- struct vs_cb *cb;
- int s;
- int rc;
-
- flags = xs->flags;
- if (flags & SCSI_POLL) {
- cb = sc->sc_cb;
- cqep = sh_MCE;
- iopb = sh_MCE_IOPB;
-
-#ifdef VS_DEBUG
- if (mce_read(2, CQE_QECR) & M_QECR_GO)
- printf("%s: master command queue busy\n",
- sc->sc_dev.dv_xname);
-#endif
- /* Wait until we can use the command queue entry. */
- while (mce_read(2, CQE_QECR) & M_QECR_GO)
- ;
-#ifdef VS_DEBUG
- if (cb->cb_xs != NULL) {
- printf("%s: master command not idle\n",
- sc->sc_dev.dv_xname);
- xs->error = XS_BUSY;
- scsi_done(xs);
- return;
- }
-#endif
- s = splbio();
- } else {
- s = splbio();
- cb = vs_find_queue(slp, sc);
- if (cb == NULL) {
- splx(s);
-#ifdef VS_DEBUG
- printf("%s: queue for target %d is busy\n",
- sc->sc_dev.dv_xname, slp->target);
-#endif
- xs->error = XS_NO_CCB;
- scsi_done(xs);
- }
- if (vs_getcqe(sc, &cqep, &iopb)) {
- /* XXX shouldn't happen since our queue is ready */
- splx(s);
-#ifdef VS_DEBUG
- printf("%s: no free CQEs\n", sc->sc_dev.dv_xname);
-#endif
- xs->error = XS_NO_CCB;
- scsi_done(xs);
- }
- }
-
-#ifdef VS_DEBUG
- printf("%s: sending SCSI command %02x (length %d) on queue %d\n",
- __func__, xs->cmd->opcode, xs->cmdlen, cb->cb_q);
-#endif
- rc = vs_load_command(sc, cb, cqep, iopb, slp, xs->flags,
- xs->cmd, xs->cmdlen, xs->data, xs->datalen);
- if (rc != 0) {
- printf("%s: unable to load DMA map: error %d\n",
- sc->sc_dev.dv_xname, rc);
- xs->error = XS_DRIVER_STUFFUP;
- scsi_done(xs);
- splx(s);
- return;
- }
-
- vs_write(1, cqep + CQE_WORK_QUEUE, cb->cb_q);
-
- cb->cb_xs = xs;
- splx(s);
-
- vs_write(4, cqep + CQE_CTAG, (u_int32_t)cb);
-
- if (crb_read(2, CRB_CRSW) & M_CRSW_AQ)
- vs_write(2, cqep + CQE_QECR, M_QECR_AA | M_QECR_GO);
- else
- vs_write(2, cqep + CQE_QECR, M_QECR_GO);
-
- if (flags & SCSI_POLL) {
- /* poll for the command to complete */
- vs_poll(sc, cb);
- }
-}
-
-int
-vs_load_command(struct vs_softc *sc, struct vs_cb *cb, bus_addr_t cqep,
- bus_addr_t iopb, struct scsi_link *slp, int flags,
- struct scsi_generic *cmd, int cmdlen, uint8_t *data, int datalen)
-{
- unsigned int iopb_len;
- int option;
- int rc;
-
- /*
- * We should only provide the iopb len if the controller is not
- * able to compute it from the SCSI command group.
- * Note that Jaguar has no knowledge of group 2.
- */
- switch ((cmd->opcode) >> 5) {
- case 0:
- case 1:
- case 5:
- iopb_len = 0;
- break;
- case 2:
- if (sc->sc_bid == COUGAR)
- iopb_len = 0;
- else
- /* FALLTHROUGH */
- default:
- iopb_len = IOPB_SHORT_SIZE + ((cmdlen + 1) >> 1);
- break;
- }
-
- vs_bzero(iopb, IOPB_LONG_SIZE);
- bus_space_write_region_1(sc->sc_iot, sc->sc_ioh, iopb + IOPB_SCSI_DATA,
- (u_int8_t *)cmd, cmdlen);
- vs_write(2, iopb + IOPB_CMD, IOPB_PASSTHROUGH);
- vs_write(2, iopb + IOPB_UNIT,
- vs_unit_value(slp->flags & SDEV_2NDBUS, slp->target, slp->lun));
-#ifdef VS_DEBUG
- printf("%s: target %d lun %d encoded as %04x\n",
- __func__, slp->target, slp->lun, (u_int)
- vs_unit_value(slp->flags & SDEV_2NDBUS, slp->target, slp->lun));
-#endif
- vs_write(1, iopb + IOPB_NVCT, sc->sc_nvec);
- vs_write(1, iopb + IOPB_EVCT, sc->sc_evec);
-
- /*
- * Setup DMA map for data transfer
- */
- if (flags & (SCSI_DATA_IN | SCSI_DATA_OUT)) {
- cb->cb_dmalen = (bus_size_t)datalen;
- rc = bus_dmamap_load(sc->sc_dmat, cb->cb_dmamap,
- data, cb->cb_dmalen, NULL,
- BUS_DMA_NOWAIT | BUS_DMA_STREAMING |
- ((flags & SCSI_DATA_IN) ? BUS_DMA_READ : BUS_DMA_WRITE));
- if (rc != 0)
- return rc;
-
- bus_dmamap_sync(sc->sc_dmat, cb->cb_dmamap, 0,
- cb->cb_dmalen, (flags & SCSI_DATA_IN) ?
- BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
- }
-
- option = 0;
- if (flags & SCSI_DATA_OUT)
- option |= M_OPT_DIR;
- if (slp->adapter_buswidth > 8)
- option |= M_OPT_GO_WIDE;
-
- if (flags & SCSI_POLL) {
- vs_write(2, iopb + IOPB_OPTION, option);
- vs_write(2, iopb + IOPB_LEVEL, 0);
- } else {
- vs_write(2, iopb + IOPB_OPTION, option | M_OPT_IE);
- vs_write(2, iopb + IOPB_LEVEL, sc->sc_ipl);
- }
- vs_write(2, iopb + IOPB_ADDR, ADDR_MOD);
-
- if (flags & (SCSI_DATA_IN | SCSI_DATA_OUT))
- vs_build_sg_list(sc, cb, iopb);
-
- vs_bzero(cqep, CQE_SIZE);
- vs_write(2, cqep + CQE_IOPB_ADDR, iopb);
- vs_write(1, cqep + CQE_IOPB_LENGTH, iopb_len);
- /* CQE_WORK_QUEUE to be filled by the caller */
-
- return 0;
-}
-
-void
-vs_chksense(struct vs_cb *cb, struct scsi_xfer *xs)
-{
- struct scsi_link *slp = xs->sc_link;
- struct vs_softc *sc = slp->adapter_softc;
- struct scsi_sense ss;
- int rc;
- int s;
-
-#ifdef VS_DEBUG
- printf("%s: target %d\n", __func__, slp->target);
-#endif
- /* ack and clear the error */
- if (CRSW & M_CRSW_ER)
- CRB_CLR_ER;
- CRB_CLR_DONE;
- xs->status = 0;
-
- /* Wait until we can use the command queue entry. */
- while (mce_read(2, CQE_QECR) & M_QECR_GO)
- ;
-
- bzero(&ss, sizeof ss);
- ss.opcode = REQUEST_SENSE;
- ss.byte2 = slp->lun << 5;
- ss.length = sizeof(xs->sense);
-
-#ifdef VS_DEBUG
- printf("%s: sending SCSI command %02x (length %d) on queue %d\n",
- __func__, ss.opcode, sizeof ss, 0);
-#endif
- rc = vs_load_command(sc, cb, sh_MCE, sh_MCE_IOPB, slp,
- SCSI_DATA_IN | SCSI_POLL,
- (struct scsi_generic *)&ss, sizeof ss, (uint8_t *)&xs->sense,
- sizeof(xs->sense));
- if (rc != 0) {
- printf("%s: unable to load DMA map: error %d\n",
- sc->sc_dev.dv_xname, rc);
- xs->error = XS_DRIVER_STUFFUP;
- xs->status = 0;
- return;
- }
-
- mce_write(1, CQE_WORK_QUEUE, 0);
- mce_write(2, CQE_QECR, M_QECR_GO);
-
- /* poll for the command to complete */
- s = splbio();
- do_vspoll(sc, xs, 1);
- xs->status = vs_read(2, sh_RET_IOPB + IOPB_STATUS) >> 8;
- splx(s);
-}
-
-int
-vs_getcqe(struct vs_softc *sc, bus_addr_t *cqep, bus_addr_t *iopbp)
-{
- bus_addr_t cqe, iopb;
- int qhdp;
-
- qhdp = mcsb_read(2, MCSB_QHDP);
- cqe = sh_CQE(qhdp);
- iopb = sh_IOPB(qhdp);
-
- if (vs_read(2, cqe + CQE_QECR) & M_QECR_GO) {
- /* queue still in use, should never happen */
- return EAGAIN;
- }
-
- if (++qhdp == NUM_CQE)
- qhdp = 0;
- mcsb_write(2, MCSB_QHDP, qhdp);
-
- vs_bzero(cqe, CQE_SIZE);
- *cqep = cqe;
- *iopbp = iopb;
- return (0);
-}
-
-int
-vs_identify(struct vs_channel *vc, int cid)
-{
- vc->vc_width = 0;
- vc->vc_type = VCT_UNKNOWN;
-
- if (vc->vc_id < 0)
- return (0);
-
- switch (cid) {
- case 0x00:
- vc->vc_width = 8;
- vc->vc_type = VCT_SE;
- break;
- case 0x01:
- vc->vc_width = 8;
- vc->vc_type = VCT_DIFFERENTIAL;
- break;
- case 0x02:
- vc->vc_width = 16;
- vc->vc_type = VCT_SE;
- break;
- case 0x03:
- case 0x0e:
- vc->vc_width = 16;
- vc->vc_type = VCT_DIFFERENTIAL;
- break;
- default:
- vc->vc_id = -1;
- return (0);
- }
-
- return (vc->vc_width - 1);
-}
-
-int
-vs_initialize(struct vs_softc *sc)
-{
- int i, msr, id, rc;
- u_int targets;
-
- /*
- * Reset the board, and wait for it to get ready.
- * The reset signal is applied for 70 usec, and the board status
- * is not tested until 100 usec after the reset signal has been
- * cleared, per the manual (MVME328/D1) pages 4-6 and 4-9.
- */
-
- mcsb_write(2, MCSB_MCR, M_MCR_RES | M_MCR_SFEN);
- delay(70);
- mcsb_write(2, MCSB_MCR, M_MCR_SFEN);
-
- delay(100);
- i = 0;
- for (;;) {
- msr = mcsb_read(2, MCSB_MSR);
- if ((msr & (M_MSR_BOK | M_MSR_CNA)) == M_MSR_BOK)
- break;
- if (++i > 5000) {
- printf("board reset failed, status %x\n", msr);
- return 1;
- }
- delay(1000);
- }
-
- /* describe the board */
- switch (sc->sc_bid) {
- default:
- case JAGUAR:
- printf("Jaguar");
- break;
- case COUGAR:
- id = csb_read(1, CSB_EXTID);
- switch (id) {
- case 0x00:
- printf("Cougar");
- break;
- case 0x02:
- printf("Cougar II");
- break;
- default:
- printf("unknown Cougar version %02x", id);
- break;
- }
- break;
- }
-
- /* initialize channels id */
- sc->sc_channel[0].vc_id = csb_read(1, CSB_PID);
- sc->sc_channel[1].vc_id = -1;
- switch (id = csb_read(1, CSB_DBID)) {
- case DBID_SCSI2:
- case DBID_SCSI:
- sc->sc_channel[1].vc_id = csb_read(1, CSB_SID);
- break;
- case DBID_PRINTER:
- printf(", printer port");
- break;
- case DBID_NONE:
- break;
- default:
- printf(", unknown daughterboard id %x", id);
- break;
- }
-
- printf("\n");
-
- /*
- * On cougar boards, find how many work queues we can use,
- * and whether we are on wide or narrow buses.
- */
- switch (sc->sc_bid) {
- case COUGAR:
- sc->sc_nwq = csb_read(2, CSB_NWQ);
- /*
- * Despite what the documentation says, this value is not
- * always provided. If it is invalid, decide on the number
- * of available work queues from the memory size, as the
- * firmware does.
- */
-#ifdef VS_DEBUG
- printf("%s: controller reports %d work queues\n",
- __func__, sc->sc_nwq);
-#endif
- if (sc->sc_nwq != 0x0f && sc->sc_nwq != 0xff) {
- if (csb_read(2, CSB_BSIZE) >= 0x0100)
- sc->sc_nwq = 0xff; /* >= 256KB, 255 WQ */
- else
- sc->sc_nwq = 0x0f; /* < 256KB, 15 WQ */
- }
-#ifdef VS_DEBUG
- printf("%s: driver deducts %d work queues\n",
- __func__, sc->sc_nwq);
-#endif
- if (sc->sc_nwq > NUM_WQ)
- sc->sc_nwq = NUM_WQ;
-
- targets = vs_identify(&sc->sc_channel[0],
- csb_read(1, CSB_PFECID));
- targets += vs_identify(&sc->sc_channel[1],
- csb_read(1, CSB_SFECID));
-
- if (sc->sc_nwq > targets)
- sc->sc_nwq = targets;
- else {
- /*
- * We can't drive the daughter board if there is not
- * enough on-board memory for all the work queues.
- * XXX This might work by moving everything off-board?
- */
- if (sc->sc_nwq < targets)
- sc->sc_channel[1].vc_width = 0;
- }
- break;
- default:
- case JAGUAR:
- sc->sc_nwq = JAGUAR_MAX_WQ;
- sc->sc_channel[0].vc_width = sc->sc_channel[1].vc_width = 8;
- break;
- }
-
- CRB_CLR_DONE;
- mcsb_write(2, MCSB_QHDP, 0);
-
- vs_bzero(sh_CIB, CIB_SIZE);
- cib_write(2, CIB_NCQE, NUM_CQE);
- cib_write(2, CIB_BURST, 0);
- cib_write(2, CIB_NVECT, (sc->sc_ipl << 8) | sc->sc_nvec);
- cib_write(2, CIB_EVECT, (sc->sc_ipl << 8) | sc->sc_evec);
- cib_write(2, CIB_PID, 0x08); /* use default */
- cib_write(2, CIB_SID, 0x08); /* use default */
- cib_write(2, CIB_CRBO, sh_CRB);
- cib_write(4, CIB_SELECT, SELECTION_TIMEOUT);
- cib_write(4, CIB_WQTIMO, 4);
- cib_write(4, CIB_VMETIMO, 0 /* VME_BUS_TIMEOUT */);
- cib_write(2, CIB_ERR_FLGS, M_ERRFLGS_RIN | M_ERRFLGS_RSE);
- cib_write(2, CIB_SBRIV, (sc->sc_ipl << 8) | sc->sc_evec);
- cib_write(1, CIB_SOF0, 0x15);
- cib_write(1, CIB_SRATE0, 100 / 4);
- cib_write(1, CIB_SOF1, 0);
- cib_write(1, CIB_SRATE1, 0);
-
- vs_bzero(sh_MCE_IOPB, IOPB_LONG_SIZE);
- mce_iopb_write(2, IOPB_CMD, CNTR_INIT);
- mce_iopb_write(2, IOPB_OPTION, 0);
- mce_iopb_write(1, IOPB_NVCT, sc->sc_nvec);
- mce_iopb_write(1, IOPB_EVCT, sc->sc_evec);
- mce_iopb_write(2, IOPB_LEVEL, 0 /* sc->sc_ipl */);
- mce_iopb_write(2, IOPB_ADDR, SHIO_MOD);
- mce_iopb_write(4, IOPB_BUFF, sh_CIB);
- mce_iopb_write(4, IOPB_LENGTH, CIB_SIZE);
-
- vs_bzero(sh_MCE, CQE_SIZE);
- mce_write(2, CQE_IOPB_ADDR, sh_MCE_IOPB);
- mce_write(1, CQE_IOPB_LENGTH, 0);
- mce_write(1, CQE_WORK_QUEUE, 0);
- mce_write(2, CQE_QECR, M_QECR_GO);
-
- /* poll for the command to complete */
- do_vspoll(sc, NULL, 1);
-
- if ((rc = vs_alloc_sg(sc)) != 0)
- return rc;
-
- if ((rc = vs_alloc_wq(sc)) != 0)
- return rc;
-
- /* initialize work queues */
-#ifdef VS_DEBUG
- printf("%s: initializing %d work queues\n",
- __func__, sc->sc_nwq);
-#endif
-
- for (i = 1; i <= sc->sc_nwq; i++) {
- /* Wait until we can use the command queue entry. */
- while (mce_read(2, CQE_QECR) & M_QECR_GO)
- ;
-
- vs_bzero(sh_MCE_IOPB, IOPB_LONG_SIZE);
- mce_iopb_write(2, WQCF_CMD, CNTR_INIT_WORKQ);
- mce_iopb_write(2, WQCF_OPTION, 0);
- mce_iopb_write(1, WQCF_NVCT, sc->sc_nvec);
- mce_iopb_write(1, WQCF_EVCT, sc->sc_evec);
- mce_iopb_write(2, WQCF_ILVL, 0 /* sc->sc_ipl */);
- mce_iopb_write(2, WQCF_WORKQ, i);
- mce_iopb_write(2, WQCF_WOPT, M_WOPT_FE | M_WOPT_IWQ);
- if (sc->sc_bid == JAGUAR)
- mce_iopb_write(2, WQCF_SLOTS, JAGUAR_MAX_Q_SIZ);
- mce_iopb_write(4, WQCF_CMDTO, 4); /* 1 second */
- if (sc->sc_bid != JAGUAR)
- mce_iopb_write(2, WQCF_UNIT,
- vs_unit_value(i > sc->sc_channel[0].vc_width,
- i - sc->sc_channel[0].vc_width, 0));
-
- vs_bzero(sh_MCE, CQE_SIZE);
- mce_write(2, CQE_IOPB_ADDR, sh_MCE_IOPB);
- mce_write(1, CQE_IOPB_LENGTH, 0);
- mce_write(1, CQE_WORK_QUEUE, 0);
- mce_write(2, CQE_QECR, M_QECR_GO);
-
- /* poll for the command to complete */
- do_vspoll(sc, NULL, 1);
- if (CRSW & M_CRSW_ER) {
- printf("%s: work queue %d initialization error 0x%x\n",
- sc->sc_dev.dv_xname, i,
- vs_read(2, sh_RET_IOPB + IOPB_STATUS));
- return ENXIO;
- }
- CRB_CLR_DONE;
- }
-
- /* start queue mode */
- mcsb_write(2, MCSB_MCR, mcsb_read(2, MCSB_MCR) | M_MCR_SQM);
-
- /* reset all SCSI buses */
- vs_reset(sc, -1);
- /* sync all devices */
- vs_resync(sc);
-
- return 0;
-}
-
-/*
- * Allocate memory for the scatter/gather lists.
- *
- * Since vs_minphys() makes sure we won't need more than flat lists of
- * up to MAX_SG_ELEMENTS entries, we need to allocate storage for one
- * such list per work queue.
- */
-int
-vs_alloc_sg(struct vs_softc *sc)
-{
- size_t sglen;
- int nseg;
- int rc;
-
- sglen = (sc->sc_nwq + 1) * MAX_SG_ELEMENTS * sizeof(struct vs_sg_entry);
- sglen = round_page(sglen);
-
- rc = bus_dmamem_alloc(sc->sc_dmat, sglen, 0, 0,
- &sc->sc_sgseg, 1, &nseg, BUS_DMA_NOWAIT);
- if (rc != 0) {
- printf("%s: unable to allocate s/g memory: error %d\n",
- sc->sc_dev.dv_xname, rc);
- goto fail1;
- }
- rc = bus_dmamem_map(sc->sc_dmat, &sc->sc_sgseg, nseg, sglen,
- (caddr_t *)&sc->sc_sgva, BUS_DMA_NOWAIT | BUS_DMA_COHERENT);
- if (rc != 0) {
- printf("%s: unable to map s/g memory: error %d\n",
- sc->sc_dev.dv_xname, rc);
- goto fail2;
- }
- rc = bus_dmamap_create(sc->sc_dmat, sglen, 1, sglen, 0,
- BUS_DMA_NOWAIT /* | BUS_DMA_ALLOCNOW */, &sc->sc_sgmap);
- if (rc != 0) {
- printf("%s: unable to create s/g dma map: error %d\n",
- sc->sc_dev.dv_xname, rc);
- goto fail3;
- }
- rc = bus_dmamap_load(sc->sc_dmat, sc->sc_sgmap, sc->sc_sgva,
- sglen, NULL, BUS_DMA_NOWAIT);
- if (rc != 0) {
- printf("%s: unable to load s/g dma map: error %d\n",
- sc->sc_dev.dv_xname, rc);
- goto fail4;
- }
-
- return 0;
-
-fail4:
- bus_dmamap_destroy(sc->sc_dmat, sc->sc_sgmap);
-fail3:
- bus_dmamem_unmap(sc->sc_dmat, (caddr_t)sc->sc_sgva, PAGE_SIZE);
-fail2:
- bus_dmamem_free(sc->sc_dmat, &sc->sc_sgseg, 1);
-fail1:
- return rc;
-}
-
-/*
- * Allocate one command block per work qeue.
- */
-int
-vs_alloc_wq(struct vs_softc *sc)
-{
- struct vs_cb *cb;
- u_int i;
- int rc;
-
- sc->sc_cb = malloc((sc->sc_nwq + 1) * sizeof(struct vs_cb), M_DEVBUF,
- M_ZERO | M_NOWAIT);
- if (sc->sc_cb == NULL) {
- printf("%s: unable to allocate %d work queues\n",
- sc->sc_dev.dv_xname, sc->sc_nwq);
- return ENOMEM;
- }
-
- for (i = 0, cb = sc->sc_cb; i <= sc->sc_nwq; i++, cb++) {
- cb->cb_q = i;
-
- rc = bus_dmamap_create(sc->sc_dmat, ptoa(MAX_SG_ELEMENTS),
- MAX_SG_ELEMENTS, MAX_SG_ELEMENT_SIZE, 0,
- BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, &cb->cb_dmamap);
- if (rc != 0) {
- printf("%s: unable to create dma map for queue %d"
- ": error %d\n",
- sc->sc_dev.dv_xname, i, rc);
- goto fail;
- }
- }
-
- return 0;
-
-fail:
- while (i != 0) {
- i--; cb--;
- bus_dmamap_destroy(sc->sc_dmat, cb->cb_dmamap);
- }
- free(sc->sc_cb, M_DEVBUF);
- sc->sc_cb = NULL;
-
- return rc;
-}
-
-void
-vs_resync(struct vs_softc *sc)
-{
- struct vs_channel *vc;
- int bus, target;
-
- for (bus = 0; bus < 2; bus++) {
- vc = &sc->sc_channel[bus];
- if (vc->vc_id < 0 || vc->vc_width == 0)
- break;
-
- for (target = 0; target < vc->vc_width; target++) {
- if (target == vc->vc_id)
- continue;
-
- /* Wait until we can use the command queue entry. */
- while (mce_read(2, CQE_QECR) & M_QECR_GO)
- ;
-
- vs_bzero(sh_MCE_IOPB, IOPB_SHORT_SIZE);
- mce_iopb_write(2, DRCF_CMD, CNTR_DEV_REINIT);
- mce_iopb_write(2, DRCF_OPTION, 0); /* prefer polling */
- mce_iopb_write(1, DRCF_NVCT, sc->sc_nvec);
- mce_iopb_write(1, DRCF_EVCT, sc->sc_evec);
- mce_iopb_write(2, DRCF_ILVL, 0);
- mce_iopb_write(2, DRCF_UNIT,
- vs_unit_value(bus, target, 0));
-
- vs_bzero(sh_MCE, CQE_SIZE);
- mce_write(2, CQE_IOPB_ADDR, sh_MCE_IOPB);
- mce_write(1, CQE_IOPB_LENGTH, 0);
- mce_write(1, CQE_WORK_QUEUE, 0);
- mce_write(2, CQE_QECR, M_QECR_GO);
-
- /* poll for the command to complete */
- do_vspoll(sc, NULL, 0);
- if (CRSW & M_CRSW_ER)
- CRB_CLR_ER;
- CRB_CLR_DONE;
- }
- }
-}
-
-void
-vs_reset(struct vs_softc *sc, int bus)
-{
- int b, s;
-
- s = splbio();
-
- for (b = 0; b < 2; b++) {
- if (bus >= 0 && b != bus)
- continue;
-
- /* Wait until we can use the command queue entry. */
- while (mce_read(2, CQE_QECR) & M_QECR_GO)
- ;
-
- vs_bzero(sh_MCE_IOPB, IOPB_SHORT_SIZE);
- mce_iopb_write(2, SRCF_CMD, IOPB_RESET);
- mce_iopb_write(2, SRCF_OPTION, 0); /* prefer polling */
- mce_iopb_write(1, SRCF_NVCT, sc->sc_nvec);
- mce_iopb_write(1, SRCF_EVCT, sc->sc_evec);
- mce_iopb_write(2, SRCF_ILVL, 0);
- mce_iopb_write(2, SRCF_BUSID, b << 15);
-
- vs_bzero(sh_MCE, CQE_SIZE);
- mce_write(2, CQE_IOPB_ADDR, sh_MCE_IOPB);
- mce_write(1, CQE_IOPB_LENGTH, 0);
- mce_write(1, CQE_WORK_QUEUE, 0);
- mce_write(2, CQE_QECR, M_QECR_GO);
-
- /* poll for the command to complete */
- for (;;) {
- do_vspoll(sc, NULL, 0);
- /* ack & clear scsi error condition cause by reset */
- if (CRSW & M_CRSW_ER) {
- CRB_CLR_DONE;
- vs_write(2, sh_RET_IOPB + IOPB_STATUS, 0);
- break;
- }
- CRB_CLR_DONE;
- }
- }
-
- thaw_all_queues(sc);
-
- splx(s);
-}
-
-/* free a cb and thaw its queue; invoked at splbio */
-static __inline__ void
-vs_free(struct vs_softc *sc, struct vs_cb *cb)
-{
- if (cb->cb_q != 0)
- thaw_queue(sc, cb->cb_q);
- cb->cb_xs = NULL;
-}
-
-/* normal interrupt routine */
-int
-vs_nintr(void *vsc)
-{
- struct vs_softc *sc = (struct vs_softc *)vsc;
- struct vs_cb *cb;
- int s;
-
-#ifndef notyet /* bogus! */
- if ((CRSW & CONTROLLER_ERROR) == CONTROLLER_ERROR)
- return vs_eintr(sc);
-#endif
-
- /* Got a valid interrupt on this device */
- s = splbio();
- cb = (struct vs_cb *)crb_read(4, CRB_CTAG);
-
- /*
- * If this is a controller error, there won't be a cb
- * pointer in the CTAG field. Bad things happen if you try
- * to point to address 0. But then, we should have caught
- * the controller error above.
- */
- if (cb != NULL) {
-#ifdef VS_DEBUG
- printf("%s: interrupt for queue %d\n", __func__, cb->cb_q);
-#endif
- vs_scsidone(sc, cb);
- } else {
-#ifdef VS_DEBUG
- printf("%s: normal interrupt but no related command???\n",
- __func__);
-#endif
- }
-
- /* ack the interrupt */
- if (CRSW & M_CRSW_ER)
- CRB_CLR_ER;
- CRB_CLR_DONE;
-
- vs_clear_return_info(sc);
- splx(s);
-
- return 1;
-}
-
-/* error interrupts */
-int
-vs_eintr(void *vsc)
-{
- struct vs_softc *sc = (struct vs_softc *)vsc;
- struct vs_cb *cb;
- struct scsi_xfer *xs;
- int crsw, ecode;
- int s;
-
- /* Got a valid interrupt on this device */
- s = splbio();
-
- crsw = vs_read(2, sh_CEVSB + CEVSB_CRSW);
- ecode = vs_read(1, sh_CEVSB + CEVSB_ERROR);
- cb = (struct vs_cb *)crb_read(4, CRB_CTAG);
- xs = cb != NULL ? cb->cb_xs : NULL;
-
-#ifdef VS_DEBUG
- printf("%s: error interrupt, crsw %04x, error %d, queue %d\n",
- __func__, (u_int)crsw, ecode, cb ? cb->cb_q : -1);
-#endif
- vs_print_addr(sc, xs);
-
- if (crsw & M_CRSW_RST) {
- printf("bus reset\n");
- } else {
- switch (ecode) {
- case CEVSB_ERR_TYPE:
- printf("IOPB type error\n");
- break;
- case CEVSB_ERR_TO:
- printf("timeout\n");
- break;
- case CEVSB_ERR_TR:
- printf("reconnect error\n");
- break;
- case CEVSB_ERR_OF:
- printf("overflow\n");
- break;
- case CEVSB_ERR_BD:
- printf("bad direction\n");
- break;
- case CEVSB_ERR_NR:
- printf("non-recoverable error\n");
- break;
- case CEVSB_ERR_PANIC:
- printf("board panic\n");
- break;
- default:
- printf("unexpected error %x\n", ecode);
- break;
- }
- }
-
- if (xs != NULL) {
- xs->error = XS_SELTIMEOUT;
- xs->status = -1;
- scsi_done(xs);
- }
-
- if (CRSW & M_CRSW_ER)
- CRB_CLR_ER;
- CRB_CLR_DONE;
-
- thaw_all_queues(sc);
- vs_clear_return_info(sc);
- splx(s);
-
- return 1;
-}
-
-static void
-vs_clear_return_info(struct vs_softc *sc)
-{
- vs_bzero(sh_RET_IOPB, CRB_SIZE + IOPB_LONG_SIZE);
-}
-
-/*
- * Choose the first available work queue (invoked at splbio).
- * We used a simple round-robin mechanism which is faster than rescanning
- * from the beginning if we have more than one target on the bus.
- */
-struct vs_cb *
-vs_find_queue(struct scsi_link *sl, struct vs_softc *sc)
-{
- struct vs_cb *cb;
- u_int q;
-
- /*
- * Map the target number (0-7/15) to the 1-7/15 range, target 0
- * picks the host adapter target number (since host adapter
- * commands are issued on queue #0).
- */
- q = sl->target;
- if (q == 0)
- q = sl->adapter_target;
- if (sl->flags & SDEV_2NDBUS)
- q += sc->sc_channel[0].vc_width - 1; /* map to 8-14 or 16-30 */
-
- if ((cb = sc->sc_cb + q)->cb_xs == NULL)
- return (cb);
-
- return (NULL);
-}
-
-/*
- * Encode a specific target.
- */
-int
-vs_unit_value(int bus, int tgt, int lun)
-{
- int unit = 0;
-
- if (bus != 0)
- unit |= M_UNIT_BUS; /* secondary bus */
-
- if (tgt > 7 || lun > 7) {
- /* extended addressing (for Cougar II-Wide only) */
- unit |= M_UNIT_EXT;
- unit |= (lun & 0x3f) << 8;
- unit |= (tgt & 0x0f) << 0;
- } else {
- unit |= lun << 3;
- unit |= tgt << 0;
- }
-
- return (unit);
-}
-
-/*
- * Build the scatter/gather list for the given control block and update
- * its IOPB.
- */
-void
-vs_build_sg_list(struct vs_softc *sc, struct vs_cb *cb, bus_addr_t iopb)
-{
- struct vs_sg_entry *sgentry;
- int segno;
- bus_dma_segment_t *seg = cb->cb_dmamap->dm_segs;
- bus_size_t sgoffs;
- bus_size_t len;
-
- /*
- * No need to build a scatter/gather chain if there is only
- * one contiguous physical area.
- */
- if (cb->cb_dmamap->dm_nsegs == 1) {
- vs_write(4, iopb + IOPB_BUFF, seg->ds_addr);
- vs_write(4, iopb + IOPB_LENGTH, cb->cb_dmalen);
- return;
- }
-
- /*
- * Otherwise, we need to build the flat s/g list.
- */
-
- sgentry = sc->sc_sgva + cb->cb_q * MAX_SG_ELEMENTS;
- sgoffs = (vaddr_t)sgentry - (vaddr_t)sc->sc_sgva;
-
- len = cb->cb_dmalen;
- for (segno = 0; segno < cb->cb_dmamap->dm_nsegs; seg++, segno++) {
- if (seg->ds_len > len) {
- sgentry->count.bytes = htobe16(len);
- len = 0;
- } else {
- sgentry->count.bytes = htobe16(seg->ds_len);
- len -= seg->ds_len;
- }
- sgentry->pa_high = htobe16(seg->ds_addr >> 16);
- sgentry->pa_low = htobe16(seg->ds_addr & 0xffff);
- sgentry->addr = htobe16(ADDR_MOD);
- sgentry++;
- }
-
- bus_dmamap_sync(sc->sc_dmat, sc->sc_sgmap, sgoffs,
- cb->cb_dmamap->dm_nsegs * sizeof(struct vs_sg_entry),
- BUS_DMASYNC_PREWRITE);
-
- vs_write(2, iopb + IOPB_OPTION,
- vs_read(2, iopb + IOPB_OPTION) | M_OPT_SG);
- vs_write(2, iopb + IOPB_ADDR,
- vs_read(2, iopb + IOPB_ADDR) | M_ADR_SG_LINK);
- vs_write(4, iopb + IOPB_BUFF,
- sc->sc_sgmap->dm_segs[0].ds_addr + sgoffs);
- vs_write(4, iopb + IOPB_LENGTH, cb->cb_dmamap->dm_nsegs);
- vs_write(4, iopb + IOPB_SGTTL, cb->cb_dmalen);
-}
diff --git a/sys/arch/mvme68k/dev/vsbic.c b/sys/arch/mvme68k/dev/vsbic.c
deleted file mode 100644
index 615d834b7f3..00000000000
--- a/sys/arch/mvme68k/dev/vsbic.c
+++ /dev/null
@@ -1,1627 +0,0 @@
-/* $OpenBSD: vsbic.c,v 1.8 2011/07/17 22:46:47 matthew Exp $ */
-
-/*
- * Copyright (c) 2008, 2009 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies. And
- * I won't mind if you keep the disclaimer below.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * MVME327A SCSI and floppy controller driver
- *
- * This driver is currently limited to the SCSI part of the board, which
- * is messy enough already.
- */
-
-/* This card lives in an A24/D16 world, but is A32/D32 capable */
-#define __BUS_SPACE_RESTRICT_D16__
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/buf.h> /* minphys */
-#include <sys/malloc.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-#include <scsi/scsi_message.h>
-
-#include <mvme68k/dev/vme.h>
-#include <mvme68k/dev/bppvar.h>
-
-/*
- * Channel packet structure
- */
-
-struct vsbic_pkt {
- /* Command fields, read by firmware */
- uint8_t cmd_cmd;
- uint8_t cmd_cmd_ctrl;
- uint8_t cmd_device;
-#define VSBIC_DEVICE_FLOPPY 0x01
-#define VSBIC_DEVICE_SCSI 0x05
-#define VSBIC_DEVICE_HOST 0x0f
- uint8_t cmd_unit;
-#define VSBIC_UNIT(tgt,lun) (((tgt) << 4) | (lun))
- uint16_t reserved;
- uint8_t cmd_addrmod;
- uint8_t cmd_buswidth;
- uint32_t cmd_addr1;
- uint32_t cmd_addr2;
-#define cmd_link cmd_addr2 /* used for free pkt linking */
- uint32_t cmd_xfer_count;
- uint16_t cmd_sg_count;
- uint16_t cmd_parm1;
- uint16_t cmd_parm2;
- uint16_t cmd_parm3;
-
- /* Status fields, written by firmware */
- uint8_t sts_error;
- uint8_t sts_recovered; /* error recovered by fw */
- uint16_t sts_status;
-#define sts_sense sts_status
- uint8_t sts_retries; /* # of retries performed */
- uint8_t reserved2;
- uint16_t sts_addr_high; /* not aligned... */
- uint16_t sts_addr_low;
- uint16_t sts_xfer_high; /* not aligned... */
- uint16_t sts_xfer_low;
- uint16_t sts_parm1;
- uint16_t sts_parm2;
- uint16_t sts_parm3;
- /* total size 0x30 bytes */
-};
-
-/*
- * Command values (cmd_cmd)
- */
-
-#define CMD_BPP_TEST 0x00
-#define CMD_READ 0x01
-#define CMD_WRITE 0x02
-#define CMD_READ_DESCRIPTOR 0x03
-#define CMD_WRITE_DESCRIPTOR 0x04
-#define CMD_FORMAT 0x05
-#define CMD_FIX_BAD_SPOT 0x06
-#define CMD_INQUIRY 0x09
-#define CMD_READ_STATUS 0x10
-#define CMD_LOAD_UNLOAD_RETENSION 0x11
-#define CMD_WRITE_FILEMARK 0x12
-#define CMD_REWIND 0x13
-#define CMD_ERASE 0x14
-#define CMD_SPACE 0x15
-#define CMD_ENABLE_TARGET 0x20
-#define CMD_DISABLE_TARGET 0x21
-#define CMD_RESERVE_UNIT 0x22
-#define CMD_RELEASE_UNIT 0x23
-#define CMD_RESET 0x25
-#define CMD_SCSI 0x26
-#define CMD_SELF_TEST 0x27
-#define CMD_TARGET_WAIT 0x28
-#define CMD_TARGET_EXECUTE 0x29
-#define CMD_DOWNLOAD 0x2a
-#define CMD_SET_SCSI_ADDRESS 0x2b
-#define CMD_OPEN 0x2d
-
-/*
- * Error values (sts_error, sts_status)
- */
-
-#define ERR_OK 0x00
-/* command parameter errors */
-#define ERR_BAD_DESCRIPTOR 0x01
-#define ERR_BAD_COMMAND 0x02
-#define ERR_UNIMPLEMENTED_COMMAND 0x03
-#define ERR_BAD_DRIVE 0x04
-#define ERR_BAD_LOGICAL_ADDRESS 0x05
-#define ERR_BAD_SG_TABLE 0x06
-#define ERR_UNIMPLEMENTED_DEVICE 0x07
-#define ERR_UNIT_NOT_INITIALIZED 0x08
-/* media errors */
-#define ERR_NO_ID 0x10
-#define ERR_SEEK 0x11
-#define ERR_RELOCATED_TRACK 0x12
-#define ERR_BAD_ID 0x13
-#define ERR_DATA_SYNC_FAULT 0x14
-#define ERR_ECC 0x15
-#define ERR_RECORD_NOT_FOUND 0x16
-#define ERR_MEDIA 0x17
-/* drive errors */
-#define ERR_DRIVE_FAULT 0x20
-#define ERR_WRITE_PROTECTED_MEDIA 0x21
-#define ERR_MOTOR_OFF 0x22
-#define ERR_DOOR_OPEN 0x23
-#define ERR_DRIVE_NOT_READY 0x24
-#define ERR_DRIVE_BUSY 0x25
-/* VME DMA errors */
-#define ERR_BUS 0x30
-#define ERR_ALIGNMENT 0x31
-#define ERR_BUS_TIMEOUT 0x32
-#define ERR_INVALID_XFER_COUNT 0x33
-/* disk format error */
-#define ERR_NOT_ENOUGH_ALTERNATES 0x40
-#define ERR_FORMAT_FAILED 0x41
-#define ERR_VERIFY 0x42
-#define ERR_BAD_FORMAT_PARAMETERS 0x43
-#define ERR_CANNOT_FIX_BAD_SPOT 0x44
-#define ERR_TOO_MANY_DEFECTS 0x45
-/* MVME327A specific errors */
-#define ERR_SCSI 0x80 /* additional status available*/
-#define ERR_INDETERMINATE_MEDIA 0x81 /* no additional status */
-#define ERR_INDETERMINATE_HARDWARE 0x82
-#define ERR_BLANK_CHECK 0x83
-#define ERR_INCOMPLETE_EXTENDED_MESSAGE 0x84
-#define ERR_INVALID_RESELECTION 0x85
-#define ERR_NO_STATUS_RETURNED 0x86
-#define ERR_MESSAGE_OUT_NOT_TRANSFERRED 0x87
-#define ERR_MESSAGE_IN_NOT_RECEIVED 0x88
-#define ERR_INCOMPLETE_DATA_READ 0x89
-#define ERR_INCOMPLETE_DATA_WRITE 0x8a
-#define ERR_INCORRECT_CDB_SIZE 0x8b
-#define ERR_UNDEFINED_SCSI_PHASE 0x8c
-#define ERR_SELECT_TIMEOUT 0x8d
-#define ERR_BUS_RESET 0x8e
-#define ERR_INVALID_MESSAGE_RECEIVED 0x8f
-#define ERR_COMMAND_NOT_RECEIVED 0x90
-#define ERR_UNEXPECTED_STATUS_PHASE 0x91
-#define ERR_SCSI_SCRIPT_MISMATCH 0x92
-#define ERR_UNEXPECTED_DISCONNECT 0x93
-#define ERR_REQUEST_SENSE_FAILED 0x94
-#define ERR_NO_WRITE_DESCRIPTOR 0x95
-#define ERR_INCOMPLETE_DATA_TRANSFER 0x96
-#define ERR_OUT_OF_LOCAL_RESOURCES 0x97
-#define ERR_LOCAL_MEMORY_RESOURCES_LOST 0x98
-#define ERR_CHANNEL_RESERVED 0x99
-#define ERR_DEVICE_RESERVED 0x9a
-#define ERR_ALREADY_ENABLED 0x9b
-#define ERR_TARGET_NOT_ENABLED 0x9c
-#define ERR_UNSUPPORTED_CONTROLLER_TYPE 0x9d
-#define ERR_UNSUPPORTED_DEVICE_TYPE 0x9e
-#define ERR_BLOCK_SIZE_MISMATCH 0x9f
-#define ERR_INVALID_CYL_IN_DEFECT_LIST 0xa0
-#define ERR_INVALID_HEAD_IN_DEFECT_LIST 0xa1
-#define ERR_BLOCK_SIZE_MISMATCH_NF 0xa2 /* non fatal */
-#define ERR_SCSI_ID_UNCHANGED 0xa3
-#define ERR_SCSI_ID_CHANGED 0xa4
-#define ERR_NO_TARGET_ENABLE 0xa5
-#define ERR_CANNOT_DO_D32 0xa6
-#define ERR_CANNOT_DO_DMA 0xa7
-#define ERR_INVALID_BLOCK_SIZE 0xa8
-#define ERR_SPT_MISMATCH 0xa9
-#define ERR_HEAD_MISMATCH 0xaa
-#define ERR_CYL_MISMATCH 0xab
-#define ERR_INVALID_FLOPPY_PARAMETERS 0xac
-#define ERR_ALREADY_RESERVED 0xad
-#define ERR_WAS_NOT_RESERVED 0xae
-#define ERR_INVALID_SECTOR_NUMBER 0xaf
-#define ERR_SELFTEST_FAILED 0xcc
-
-/*
- * SCSI specific command packet
- */
-
-struct vsbic_scsi {
- uint32_t link;
- uint16_t ctrl;
-#define SCSI_CTRL_DMA 0x8000 /* allow DMA operation */
-#define SCSI_CTRL_SYNC 0x4000 /* synchronous phase */
-#define SCSI_CTRL_PAR 0x2000 /* enable parity checking */
-#define SCSI_CTRL_SCHK 0x1000 /* manual status checking */
-#define SCSI_CTRL_D32 0x0800 /* use D32 mode for data transfer */
-#define SCSI_CTRL_BYTESWAP 0x0400 /* byteswap D16 words */
-#define SCSI_CTRL_SG 0x0200 /* use scatter/gather transfer list */
-#define SCSI_CTRL_LINK 0x0100 /* linked scsi command */
-#define SCSI_CTRL_NO_ATN 0x0080 /* do not assert ATN during select */
- uint8_t cmdlen;
- uint8_t reserved;
- uint8_t cdb[12];
- uint32_t datalen;
- uint32_t dataptr;
- uint8_t status;
- uint8_t initiator;
- uint8_t msgin_flag;
- uint8_t msgout_flag;
-#define SCSI_MSG_INTERNAL 0x00 /* bytes in structure */
-#define SCSI_MSG_EXTERNAL 0xff /* bytes pointed to by ptr */
- uint16_t msgin_len;
- uint16_t msgin_ptr_high; /* not aligned... */
- uint16_t msgin_ptr_low;
- uint8_t msgin[6];
- uint16_t msgout_len;
- uint16_t msgout_ptr_high; /* not aligned... */
- uint16_t msgout_ptr_low;
- uint8_t msgout[6];
- uint8_t script[8]; /* script phases */
-#define SCRIPT_DATA_OUT 0x00
-#define SCRIPT_DATA_IN 0x01
-#define SCRIPT_COMMAND 0x02
-#define SCRIPT_STATUS 0x03
-#define SCRIPT_MSG_OUT 0x06
-#define SCRIPT_MSG_IN 0x07
-#define SCRIPT_END 0x08
-#define SCRIPT_END_LINKED 0x09
- /* total size 0x40 bytes */
-};
-
-/*
- * Scatter/gather list element
- */
-
-struct vsbic_sg {
- uint32_t addr;
- uint32_t size;
-};
-
-#define VSBIC_MAXSG (MAXPHYS / PAGE_SIZE)
-
-/*
- * Complete SCSI command structure: packet, SCSI specific structure, S/G list.
- * Nothing needs them to be contiguous but it will make our life simpler
- * this way.
- */
-struct vsbic_cmd {
- struct vsbic_pkt pkt;
- struct vsbic_scsi scsi;
- struct vsbic_sg sg[VSBIC_MAXSG];
-};
-
-/*
- * The host firmware addresses the VME bus with A23 set to 1, and uses
- * an extension address register to provide the top 9 bits of the A32
- * address. We thus need to make sure that none of the structures we
- * share with the firmware cross a 8MB boundary.
- */
-
-#define VSBIC_MEM_BOUNDARY (1 << 23)
-
-/*
- * A note on resource usage:
- *
- * - this driver uses 9 channels; one per SCSI target, one for polled
- * commands (which does not cause interrupts); and a 9th one to issue
- * reset commands when necessary, with a higher priority than the other
- * channels.
- *
- * - for each target channel, there numopenings commands (packet, scsi
- * specific packet and s/g list) allocated.
- * - for the polling channel, there is only one command.
- * - for the reset channel, there is one command (packet) per target.
- *
- * - for each channel, there are as many envelopes as possible commands
- * on the channel, plus two (one NULL envelope per pipe) per channel.
- */
-
-#define VSBIC_NUMOPENINGS 2
-#define VSBIC_NTARGETS 7
-#define VSBIC_NCHANNELS (VSBIC_NTARGETS + 2)
-
-#define VSBIC_TARGET_CHANNEL(sc,tgt) (tgt) /* 0..7 */
-#define VSBIC_RESET_CHANNEL(sc) (sc->sc_id) /* within 0..7 */
-#define VSBIC_POLLING_CHANNEL(sc) (8)
-
-#define VSBIC_NPACKETS \
- ((VSBIC_NTARGETS * VSBIC_NUMOPENINGS) + VSBIC_NTARGETS + 1)
-#define VSBIC_NENVELOPES (VSBIC_NPACKETS + 2 * VSBIC_NCHANNELS)
-
-#define VSBIC_NCCBS (VSBIC_NTARGETS * VSBIC_NUMOPENINGS)
-
-/*
- * Per command information
- */
-struct vsbic_ccb {
- struct vsbic_ccb *ccb_next;
- struct vsbic_cmd *ccb_cmd; /* associated command */
-
- struct scsi_xfer *ccb_xs; /* associated request */
-
- int ccb_xsflags; /* copy of ccb_xs->flags */
- int ccb_flags;
-#define CCBF_SENSE 0x01 /* request sense sent */
-
- bus_dmamap_t ccb_dmamap; /* DMA map for data transfer */
- bus_size_t ccb_dmalen;
-};
-
-struct vsbic_softc {
- struct bpp_softc sc_bpp;
- bus_dma_tag_t sc_dmat;
-
- struct scsi_link sc_link;
- uint sc_id; /* host adapter ID */
-
- int sc_vec; /* interrupt vector */
- int sc_ipl; /* interrupt level */
- struct intrhand sc_ih;
-
- bus_dmamap_t sc_chanmap; /* channel pool */
- bus_dma_segment_t sc_chanseg;
-#define sc_chanpa sc_chanseg.ds_addr
- vaddr_t sc_chanva;
-
- bus_dmamap_t sc_envmap; /* envelope pool */
- bus_dma_segment_t sc_envseg;
-#define sc_envpa sc_envseg.ds_addr
- vaddr_t sc_envva;
-
- bus_dmamap_t sc_cmdmap; /* packet pool */
- bus_dma_segment_t sc_cmdseg;
-#define sc_cmdpa sc_cmdseg.ds_addr
- vaddr_t sc_cmdva;
-
- struct vsbic_cmd *sc_cmd_free; /* head of free cmd list */
- struct vsbic_ccb *sc_ccb_free; /* head of free ccb list */
- struct vsbic_ccb *sc_ccb_active; /* head of active ccb list */
-
- /* bpp channel array */
- struct bpp_chan sc_chan[VSBIC_NCHANNELS];
-};
-
-#define DEVNAME(sc) ((sc)->sc_bpp.sc_dev.dv_xname)
-
-void vsbic_activate_ccb(struct vsbic_softc *, struct vsbic_ccb *,
- struct vsbic_cmd *);
-int vsbic_alloc_physical(struct vsbic_softc *, bus_dmamap_t *,
- bus_dma_segment_t *, vaddr_t *, bus_size_t, const char *);
-void vsbic_attach(struct device *, struct device *, void *);
-int vsbic_channel_intr(struct vsbic_softc *, struct bpp_chan *);
-paddr_t vsbic_chan_pa(struct bpp_softc *, struct bpp_channel *);
-void vsbic_chan_sync(struct bpp_softc *, struct bpp_channel *, int);
-struct vsbic_ccb *
- vsbic_cmd_ccb(struct vsbic_softc *, struct vsbic_cmd *);
-int vsbic_create_ccbs(struct vsbic_softc *, uint);
-int vsbic_create_channels(struct vsbic_softc *, uint);
-int vsbic_create_cmds(struct vsbic_softc *, uint);
-struct vsbic_cmd *
- vsbic_dequeue_cmd(struct vsbic_softc *, struct bpp_chan *);
-paddr_t vsbic_env_pa(struct bpp_softc *, struct bpp_envelope *);
-void vsbic_env_sync(struct bpp_softc *, struct bpp_envelope *, int);
-struct bpp_envelope *
- vsbic_env_va(struct bpp_softc *, paddr_t);
-void vsbic_free_ccb(struct vsbic_softc *, struct vsbic_ccb *);
-struct vsbic_ccb *
- vsbic_get_ccb(struct vsbic_softc *);
-struct vsbic_cmd *
- vsbic_get_cmd(struct vsbic_softc *);
-int vsbic_intr(void *);
-int vsbic_load_command(struct vsbic_softc *, struct vsbic_ccb *,
- struct vsbic_cmd *, struct scsi_link *, struct scsi_generic *, int,
- uint8_t *, int);
-int vsbic_match(struct device *, void *, void *);
-void vsbic_poll(struct vsbic_softc *, struct vsbic_ccb *);
-void vsbic_put_cmd(struct vsbic_softc *, struct vsbic_cmd *);
-void vsbic_queue_cmd(struct vsbic_softc *, struct bpp_chan *,
- struct bpp_envelope *, struct vsbic_cmd *);
-int vsbic_request_sense(struct vsbic_softc *, struct vsbic_ccb *);
-void vsbic_reset_command(struct vsbic_softc *, struct vsbic_cmd *,
- struct scsi_link *);
-void vsbic_scsicmd(struct scsi_xfer *);
-int vsbic_scsireset(struct vsbic_softc *, struct scsi_xfer *);
-void vsbic_timeout(void *);
-void vsbic_wrapup(struct vsbic_softc *, struct vsbic_ccb *);
-
-const struct cfattach vsbic_ca = {
- sizeof(struct vsbic_softc), vsbic_match, vsbic_attach
-};
-
-struct cfdriver vsbic_cd = {
- NULL, "vsbic", DV_DULL
-};
-
-struct scsi_adapter vsbic_swtch = {
- vsbic_scsicmd,
- scsi_minphys
-};
-
-#define MVME327_CSR_ID 0xff
-#define MVME327_CSR_SIZE 0x100
-
-int
-vsbic_match(struct device *device, void *cf, void *args)
-{
- struct confargs *ca = args;
- bus_space_tag_t iot = ca->ca_iot;
- bus_space_handle_t ioh;
- int rc;
- uint8_t id;
-
- if (bus_space_map(iot, ca->ca_paddr, MVME327_CSR_SIZE, 0, &ioh) != 0)
- return 0;
-
- rc = badvaddr((vaddr_t)bus_space_vaddr(iot, ioh) + MVME327_CSR_ID, 1);
- if (rc == 0) {
- /* Check the SCSI ID is sane */
- id = bus_space_read_1(iot, ioh, MVME327_CSR_ID);
- if (id & ~0x07)
- rc = 1;
- }
- bus_space_unmap(iot, ioh, MVME327_CSR_SIZE);
-
- return (rc == 0);
-}
-
-void
-vsbic_attach(struct device *parent, struct device *self, void *args)
-{
- struct confargs *ca = args;
- struct vsbic_softc *sc = (struct vsbic_softc *)self;
- struct bpp_softc *bsc = &sc->sc_bpp;
- struct scsibus_attach_args saa;
- bus_space_handle_t ioh;
- int tmp;
-
- if (ca->ca_ipl < IPL_BIO)
- ca->ca_ipl = IPL_BIO;
-
- printf("\n");
-
- if (bus_space_map(ca->ca_iot, ca->ca_paddr, MVME327_CSR_SIZE,
- BUS_SPACE_MAP_LINEAR, &ioh) != 0) {
- printf("%s: can't map registers!\n", DEVNAME(sc));
- return;
- }
-
- bpp_attach(bsc, ca->ca_iot, ioh);
- sc->sc_ipl = ca->ca_ipl;
- sc->sc_vec = ca->ca_vec;
- sc->sc_dmat = ca->ca_dmat;
-
- /*
- * Setup envelope and channel memory utility functions.
- *
- * Since the MVME327 shares no memory with the host cpu, all the
- * resources will be allocated in physical memory, and will need
- * explicit cache operations.
- */
- bsc->bpp_chan_pa = vsbic_chan_pa;
- bsc->bpp_chan_sync = vsbic_chan_sync;
- bsc->bpp_env_pa = vsbic_env_pa;
- bsc->bpp_env_va = vsbic_env_va;
- bsc->bpp_env_sync = vsbic_env_sync;
-
- sc->sc_id = bus_space_read_1(bsc->sc_iot, bsc->sc_ioh, MVME327_CSR_ID);
-
- if (bpp_reset(bsc) != 0) {
- printf("%s: reset failed\n", DEVNAME(sc));
- return;
- }
-
- sc->sc_ih.ih_fn = vsbic_intr;
- sc->sc_ih.ih_arg = sc;
- sc->sc_ih.ih_wantframe = 0;
- sc->sc_ih.ih_ipl = ca->ca_ipl;
-
- /*
- * Allocate memory for the channel headers, envelopes and packets.
- */
-
- if (vsbic_alloc_physical(sc, &sc->sc_envmap, &sc->sc_envseg,
- &sc->sc_envva, VSBIC_NENVELOPES * sizeof(struct bpp_envelope),
- "envelope") != 0)
- return;
-
- bpp_initialize_envelopes(bsc, (struct bpp_envelope *)sc->sc_envva,
- VSBIC_NENVELOPES);
-
- if (vsbic_create_cmds(sc, VSBIC_NPACKETS) != STATUS_OK) {
- /* XXX free resources */
- return;
- }
-
- if (vsbic_create_ccbs(sc, VSBIC_NCCBS) != 0) {
- /* XXX free resources */
- return;
- }
-
- if (vsbic_create_channels(sc, VSBIC_NCHANNELS) != STATUS_OK) {
- /* XXX free resources */
- return;
- }
-
- vmeintr_establish(sc->sc_vec, &sc->sc_ih, DEVNAME(sc));
-
- sc->sc_link.adapter = &vsbic_swtch;
- sc->sc_link.adapter_buswidth = 8;
- sc->sc_link.adapter_softc = sc;
- sc->sc_link.adapter_target = sc->sc_id;
- sc->sc_link.openings = VSBIC_NUMOPENINGS;
-
- bzero(&saa, sizeof saa);
- saa.saa_sc_link = &sc->sc_link;
-
- tmp = bootpart;
- if (ca->ca_paddr != bootaddr)
- bootpart = -1;
- config_found(self, &saa, scsiprint);
- bootpart = tmp;
-}
-
-/*
- * Various simple routines to get the addresses of the various structures
- * shared with the MVME327, as well as to copyback caches.
- */
-
-paddr_t
-vsbic_chan_pa(struct bpp_softc *bsc, struct bpp_channel *va)
-{
- struct vsbic_softc *sc = (struct vsbic_softc *)bsc;
- paddr_t pa = sc->sc_chanpa + ((vaddr_t)va - sc->sc_chanva);
-
-#ifdef VSBIC_DEBUG
- printf("chan: va %p -> pa %p\n", va, pa);
-#endif
-
- return pa;
-}
-
-void
-vsbic_chan_sync(struct bpp_softc *bsc, struct bpp_channel *va, int fl)
-{
- struct vsbic_softc *sc = (struct vsbic_softc *)bsc;
-
- bus_dmamap_sync(sc->sc_dmat, sc->sc_chanmap,
- (vaddr_t)va - sc->sc_chanva, sizeof(struct bpp_channel), fl);
-}
-
-paddr_t
-vsbic_env_pa(struct bpp_softc *bsc, struct bpp_envelope *va)
-{
- struct vsbic_softc *sc = (struct vsbic_softc *)bsc;
- paddr_t pa = sc->sc_envpa + ((vaddr_t)va - sc->sc_envva);
-
-#ifdef VSBIC_DEBUG
- printf("env: va %p -> pa %p\n", va, pa);
-#endif
-
- return pa;
-}
-
-struct bpp_envelope *
-vsbic_env_va(struct bpp_softc *bsc, paddr_t pa)
-{
- struct vsbic_softc *sc = (struct vsbic_softc *)bsc;
- vaddr_t va = sc->sc_envva + (pa - sc->sc_envpa);
-
-#ifdef VSBIC_DEBUG
- printf("env: pa %p -> va %p\n", pa, va);
-#endif
-
- return (struct bpp_envelope *)va;
-}
-
-void
-vsbic_env_sync(struct bpp_softc *bsc, struct bpp_envelope *va, int fl)
-{
- struct vsbic_softc *sc = (struct vsbic_softc *)bsc;
-
- bus_dmamap_sync(sc->sc_dmat, sc->sc_envmap,
- (vaddr_t)va - sc->sc_envva, sizeof(struct bpp_envelope), fl);
-}
-
-static inline
-paddr_t vsbic_cmd_pa(struct vsbic_softc *sc, struct vsbic_cmd *va)
-{
- return sc->sc_cmdpa + ((vaddr_t)va - sc->sc_cmdva);
-}
-
-static inline
-struct vsbic_cmd *vsbic_cmd_va(struct vsbic_softc *sc, paddr_t pa)
-{
- return (struct vsbic_cmd *)(sc->sc_cmdva + (pa - sc->sc_cmdpa));
-}
-
-static inline
-void vsbic_cmd_sync(struct vsbic_softc *sc, struct vsbic_cmd *va, int fl)
-{
- bus_dmamap_sync(sc->sc_dmat, sc->sc_cmdmap,
- (vaddr_t)va - sc->sc_cmdva, sizeof(struct vsbic_cmd), fl);
-}
-
-/*
- * Allocate contiguous physical memory, not crossing 8 MB boundaries.
- */
-int
-vsbic_alloc_physical(struct vsbic_softc *sc, bus_dmamap_t *dmamap,
- bus_dma_segment_t *dmaseg, vaddr_t *va, bus_size_t len, const char *what)
-{
- int nseg;
- int rc;
-
- len = round_page(len);
-
- rc = bus_dmamem_alloc(sc->sc_dmat, len, 0, 0, dmaseg, 1, &nseg,
- BUS_DMA_NOWAIT);
- if (rc != 0) {
- printf("%s: unable to allocate %s memory: error %d\n",
- DEVNAME(sc), what, rc);
- goto fail1;
- }
-
- rc = bus_dmamem_map(sc->sc_dmat, dmaseg, nseg, len,
- (caddr_t *)va, BUS_DMA_NOWAIT | BUS_DMA_COHERENT);
- if (rc != 0) {
- printf("%s: unable to map %s memory: error %d\n",
- DEVNAME(sc), what, rc);
- goto fail2;
- }
-
- rc = bus_dmamap_create(sc->sc_dmat, len, 1, len, VSBIC_MEM_BOUNDARY,
- BUS_DMA_NOWAIT /* | BUS_DMA_ALLOCNOW */, dmamap);
- if (rc != 0) {
- printf("%s: unable to create %s dma map: error %d\n",
- DEVNAME(sc), what, rc);
- goto fail3;
- }
-
- rc = bus_dmamap_load(sc->sc_dmat, *dmamap, (void *)*va, len, NULL,
- BUS_DMA_NOWAIT);
- if (rc != 0) {
- printf("%s: unable to load %s dma map: error %d\n",
- DEVNAME(sc), what, rc);
- goto fail4;
- }
-
- return 0;
-
-fail4:
- bus_dmamap_destroy(sc->sc_dmat, *dmamap);
-fail3:
- bus_dmamem_unmap(sc->sc_dmat, (caddr_t)*va, PAGE_SIZE);
-fail2:
- bus_dmamem_free(sc->sc_dmat, dmaseg, 1);
-fail1:
- return rc;
-}
-
-/*
- * CSR operations
- */
-
-int
-vsbic_create_channels(struct vsbic_softc *sc, uint cnt)
-{
- struct bpp_softc *bsc = &sc->sc_bpp;
- struct bpp_chan *chan;
- struct bpp_channel *channel;
- int priority, ipl, vec;
- uint i;
- int rc;
-
- rc = vsbic_alloc_physical(sc, &sc->sc_chanmap, &sc->sc_chanseg,
- &sc->sc_chanva, cnt * sizeof(struct bpp_channel), "channel");
- if (rc != 0)
- return STATUS_ERRNO + rc;
-
- chan = sc->sc_chan;
- channel = (struct bpp_channel *)sc->sc_chanva;
- for (i = 0; i < cnt; i++, chan++, channel++) {
- chan->ch = channel;
-
- if (i == VSBIC_RESET_CHANNEL(sc))
- priority = BPP_PRIORITY_HIGHEST + 0x20;
- else
- priority = BPP_PRIORITY_HIGHEST + 0x40;
- if (i == VSBIC_POLLING_CHANNEL(sc)) {
- ipl = 0;
- vec = 0;
- } else {
- ipl = sc->sc_ipl;
- vec = sc->sc_vec;
- }
- rc = bpp_create_channel(bsc, chan, priority, ipl, vec);
-
- if (rc != STATUS_OK) {
- printf("%s: error creating channel for target %d: %x\n",
- DEVNAME(sc), i, rc);
- return rc;
- }
- }
-
- return STATUS_OK;
-}
-
-/*
- * Command (packet) management
- */
-
-/*
- * Create a set of commands, and put them on a free list.
- */
-int
-vsbic_create_cmds(struct vsbic_softc *sc, uint cnt)
-{
- struct vsbic_cmd *cmd;
- int rc;
-
- rc = vsbic_alloc_physical(sc, &sc->sc_cmdmap, &sc->sc_cmdseg,
- &sc->sc_cmdva, cnt * sizeof(struct vsbic_cmd), "packet");
- if (rc != 0)
- return STATUS_ERRNO + rc;
-
- sc->sc_cmd_free = NULL;
- cmd = (struct vsbic_cmd *)sc->sc_cmdva;
- while (cnt-- != 0)
- vsbic_put_cmd(sc, cmd++);
-
- return STATUS_OK;
-}
-
-/*
- * Get a new command from the free list.
- */
-struct vsbic_cmd *
-vsbic_get_cmd(struct vsbic_softc *sc)
-{
- struct vsbic_cmd *cmd;
-
- cmd = sc->sc_cmd_free;
- if (cmd != NULL) {
- sc->sc_cmd_free = (struct vsbic_cmd *)cmd->pkt.cmd_link;
- memset(cmd, 0, sizeof(*cmd));
- }
-
- return cmd;
-}
-
-/*
- * Put a command into the free list.
- */
-void
-vsbic_put_cmd(struct vsbic_softc *sc, struct vsbic_cmd *cmd)
-{
- cmd->pkt.cmd_link = (uint32_t)sc->sc_cmd_free;
- sc->sc_cmd_free = cmd;
-}
-
-/*
- * Dequeue an envelope from the status pipe, and return the command it
- * was carrying. The envelope itself is returned to the free list.
- */
-struct vsbic_cmd *
-vsbic_dequeue_cmd(struct vsbic_softc *sc, struct bpp_chan *chan)
-{
- struct bpp_softc *bsc = &sc->sc_bpp;
- struct vsbic_cmd *cmd;
- paddr_t cmdpa;
-
- if (bpp_dequeue_envelope(bsc, chan, &cmdpa) != 0)
- return NULL;
-
- cmd = vsbic_cmd_va(sc, cmdpa);
- vsbic_cmd_sync(sc, cmd, BUS_DMASYNC_POSTREAD);
-
-#ifdef VSBIC_DEBUG
- printf("%s: %s() -> %p\n", DEVNAME(sc), __func__, cmd);
-#endif
- return cmd;
-}
-
-/*
- * Send a command packet.
- */
-void
-vsbic_queue_cmd(struct vsbic_softc *sc, struct bpp_chan *chan,
- struct bpp_envelope *tail, struct vsbic_cmd *cmd)
-{
- struct bpp_softc *bsc = &sc->sc_bpp;
- paddr_t cmdpa;
-
- vsbic_cmd_sync(sc, cmd, BUS_DMASYNC_PREWRITE);
- cmdpa = vsbic_cmd_pa(sc, cmd);
-
-#ifdef VSBIC_DEBUG
- printf("%s: %s(%p)\n", DEVNAME(sc), __func__, cmd);
-#endif
-
- bpp_queue_envelope(bsc, chan, tail, cmdpa);
-}
-
-/*
- * CCB management
- */
-
-/*
- * Create a set of ccb, and put them on a free list.
- */
-int
-vsbic_create_ccbs(struct vsbic_softc *sc, uint cnt)
-{
- struct vsbic_ccb *ccb;
- int rc;
-
- ccb = (struct vsbic_ccb *)malloc(cnt * sizeof(struct vsbic_ccb),
- M_DEVBUF, M_ZERO | M_NOWAIT);
- if (ccb == NULL) {
- printf("%s: unable to allocate CCB memory\n", DEVNAME(sc));
- return ENOMEM;
- }
-
- sc->sc_ccb_free = NULL;
- sc->sc_ccb_active = NULL;
- while (cnt-- != 0) {
- /*
- * Create a DMA map for data transfers.
- */
- rc = bus_dmamap_create(sc->sc_dmat, MAXPHYS, VSBIC_MAXSG,
- MAXPHYS, VSBIC_MEM_BOUNDARY,
- BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, &ccb->ccb_dmamap);
- if (rc != 0) {
- printf("%s: unable to create CCB data dma map"
- ": error %d\n", DEVNAME(sc), rc);
- return rc;
- }
-
- vsbic_free_ccb(sc, ccb++);
- }
-
- return 0;
-}
-
-/*
- * Get a new ccb from the free list.
- */
-struct vsbic_ccb *
-vsbic_get_ccb(struct vsbic_softc *sc)
-{
- struct vsbic_ccb *ccb;
-
- ccb = sc->sc_ccb_free;
- if (ccb != NULL) {
- sc->sc_ccb_free = ccb->ccb_next;
- ccb->ccb_next = NULL;
- ccb->ccb_cmd = NULL;
- ccb->ccb_xs = NULL;
- ccb->ccb_flags = 0;
- }
-
- return ccb;
-}
-
-/*
- * Put a ccb into the free list.
- */
-void
-vsbic_free_ccb(struct vsbic_softc *sc, struct vsbic_ccb *ccb)
-{
- ccb->ccb_next = sc->sc_ccb_free;
- sc->sc_ccb_free = ccb;
-}
-
-/*
- * Retrieve the active ccb associated to a command, and remove it from
- * the active list.
- * Since there won't be many currently active commands, storing them
- * in a list is acceptable.
- */
-struct vsbic_ccb *
-vsbic_cmd_ccb(struct vsbic_softc *sc, struct vsbic_cmd *cmd)
-{
- struct vsbic_ccb *ccb, *prev;
-
- for (prev = NULL, ccb = sc->sc_ccb_active; ccb != NULL;
- prev = ccb, ccb = ccb->ccb_next) {
- if (ccb->ccb_cmd == cmd) {
- if (prev == NULL)
- sc->sc_ccb_active = ccb->ccb_next;
- else
- prev->ccb_next = ccb->ccb_next;
- break;
- }
- }
-
- return ccb;
-}
-
-/*
- * Put a ccb into the active list.
- */
-void
-vsbic_activate_ccb(struct vsbic_softc *sc, struct vsbic_ccb *ccb,
- struct vsbic_cmd *cmd)
-{
- struct vsbic_ccb *tmp;
-
- ccb->ccb_cmd = cmd;
-
- /* insert at end of list */
- if (sc->sc_ccb_active == NULL)
- sc->sc_ccb_active = ccb;
- else {
- for (tmp = sc->sc_ccb_active; tmp->ccb_next != NULL;
- tmp = tmp->ccb_next)
- ;
- tmp->ccb_next = ccb;
- }
-}
-
-/*
- * SCSI Layer Interface
- */
-
-/*
- * Setup a command packet according to the SCSI command to send
- */
-int
-vsbic_load_command(struct vsbic_softc *sc, struct vsbic_ccb *ccb,
- struct vsbic_cmd *c, struct scsi_link *sl, struct scsi_generic *cmd,
- int cmdlen, uint8_t *data, int datalen)
-{
- bus_dma_segment_t *seg;
- struct vsbic_sg *sgelem;
- int nsegs, segno;
- uint ctrl;
- uint8_t *msgout;
- uint8_t *script;
- int rc;
-
-#ifdef VSBIC_DEBUG
- printf("%s: command %02x len %d data %d tgt %d:%d\n",
- DEVNAME(sc), cmd->opcode, cmdlen, datalen,
- sl->target, sl->lun);
-#endif
-
- /*
- * Setup DMA map for data transfer.
- */
-
- if (ISSET(ccb->ccb_xsflags, SCSI_DATA_IN | SCSI_DATA_OUT)) {
- ccb->ccb_dmalen = (bus_size_t)datalen;
- rc = bus_dmamap_load(sc->sc_dmat, ccb->ccb_dmamap, data,
- ccb->ccb_dmalen, NULL, BUS_DMA_STREAMING |
- (ISSET(ccb->ccb_xsflags,SCSI_NOSLEEP) ?
- BUS_DMA_NOWAIT : BUS_DMA_WAITOK) |
- (ISSET(ccb->ccb_xsflags, SCSI_DATA_IN) ?
- BUS_DMA_READ : BUS_DMA_WRITE));
- if (rc != 0)
- return rc;
-
- bus_dmamap_sync(sc->sc_dmat, ccb->ccb_dmamap, 0,
- ccb->ccb_dmalen, ISSET(ccb->ccb_xsflags, SCSI_DATA_IN) ?
- BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
-
- nsegs = ccb->ccb_dmamap->dm_nsegs;
- } else
- nsegs = 0;
-
- /*
- * Setup command packet.
- */
-
- if (cmd->opcode == INQUIRY && nsegs == 1)
- c->pkt.cmd_cmd = CMD_INQUIRY;
- else
- c->pkt.cmd_cmd = CMD_SCSI;
- c->pkt.cmd_device = VSBIC_DEVICE_SCSI;
- c->pkt.cmd_unit = VSBIC_UNIT(sl->target, sl->lun);
- c->pkt.cmd_addrmod = ADRM_EXT_S_D;
- c->pkt.cmd_buswidth = MEMT_D32;
-
- if (c->pkt.cmd_cmd == CMD_INQUIRY) {
- c->pkt.cmd_cmd_ctrl = 0;
- seg = ccb->ccb_dmamap->dm_segs;
- c->pkt.cmd_addr2 = htobe32(seg->ds_addr);
- c->pkt.cmd_sg_count = 0;
- c->pkt.cmd_parm2 = htobe16(datalen >> 16);
- c->pkt.cmd_parm3 = htobe16(datalen & 0xffff);
- } else {
- c->pkt.cmd_addr1 = htobe32(vsbic_cmd_pa(sc, c) +
- offsetof(struct vsbic_cmd, scsi));
-
- /*
- * Setup SCSI specific packet.
- */
-
- ctrl = SCSI_CTRL_PAR | SCSI_CTRL_SCHK;
- if (nsegs != 0) {
- ctrl |= SCSI_CTRL_D32;
- /* manual recommands PIO for small transfers */
- if (datalen > 0x100)
- ctrl |= SCSI_CTRL_DMA;
- }
- if (cmd->opcode == REQUEST_SENSE)
- ctrl |= SCSI_CTRL_NO_ATN;
- c->scsi.cmdlen = cmdlen;
- memcpy(c->scsi.cdb, cmd, cmdlen);
- c->scsi.datalen = htobe32(datalen);
- c->scsi.msgin_flag = SCSI_MSG_INTERNAL;
- c->scsi.msgout_flag = SCSI_MSG_INTERNAL;
-
- /*
- * Setup scatter/gather information.
- */
-
- if (nsegs != 0) {
- seg = ccb->ccb_dmamap->dm_segs;
- if (nsegs == 1) {
- c->scsi.dataptr = htobe32(seg->ds_addr);
- } else {
- sgelem = c->sg;
- ctrl |= SCSI_CTRL_SG;
- for (segno = 0; segno < nsegs; seg++, segno++) {
- sgelem->addr = htobe32(seg->ds_addr);
- sgelem->size = htobe32(seg->ds_len);
- sgelem++;
- }
- c->pkt.cmd_sg_count = htobe16(nsegs);
- c->scsi.dataptr = htobe32(vsbic_cmd_pa(sc, c) +
- offsetof(struct vsbic_cmd, sg));
- }
- c->pkt.cmd_addr2 = c->scsi.dataptr;
- }
-
- c->scsi.ctrl = ctrl;
-
- /*
- * Setup SCSI ``script'' - really the list of phases to expect,
- * as well as the message bytes to send during the message out
- * phase if necessary.
- *
- * Since this driver doesn't support synchronous transfers yet,
- * this is really easy to build.
- */
-
- msgout = c->scsi.msgout;
- script = c->scsi.script;
-
- /* always message out unless the command is request sense */
- if (cmd->opcode != REQUEST_SENSE) {
- *script++ = SCRIPT_MSG_OUT;
- *msgout++ = MSG_IDENTIFY(sl->lun, 1);
- }
- *script++ = SCRIPT_COMMAND;
- if (ISSET(ccb->ccb_xsflags, SCSI_DATA_IN))
- *script++ = SCRIPT_DATA_IN;
- else if (ISSET(ccb->ccb_xsflags, SCSI_DATA_OUT))
- *script++ = SCRIPT_DATA_OUT;
- *script++ = SCRIPT_STATUS;
- *script++ = SCRIPT_MSG_IN;
- *script++ = SCRIPT_END;
-
- c->scsi.msgout_len = msgout - c->scsi.msgout;
- }
-
- return 0;
-}
-
-/*
- * Setup a reset command
- */
-void
-vsbic_reset_command(struct vsbic_softc *sc, struct vsbic_cmd *cmd,
- struct scsi_link *sl)
-{
- cmd->pkt.cmd_cmd = CMD_RESET;
- cmd->pkt.cmd_device = VSBIC_DEVICE_SCSI;
- if (sl != NULL) {
- /* the lun is ignored for reset commands */
- cmd->pkt.cmd_unit = VSBIC_UNIT(sl->target, 0 /* sl->lun */);
- } else {
- /* reset whole bus */
- cmd->pkt.cmd_unit = VSBIC_UNIT(8, 0);
- }
-}
-
-/*
- * Try and send a command to the board.
- */
-void
-vsbic_scsicmd(struct scsi_xfer *xs)
-{
- struct scsi_link *sl = xs->sc_link;
- struct vsbic_softc *sc = (struct vsbic_softc *)sl->adapter_softc;
- struct bpp_softc *bsc = &sc->sc_bpp;
- struct vsbic_ccb *ccb;
- struct bpp_envelope *env;
- struct vsbic_cmd *cmd;
- uint ch;
- int rc;
- int s;
-
- s = splbio();
-
-#ifdef DIAGNOSTIC
- /*
- * We shouldn't receive commands on the host adapter ID, this
- * channel is reserved for reset commands.
- */
- if (sl->target == sc->sc_id) {
- xs->error = XS_DRIVER_STUFFUP;
- scsi_done(xs);
- splx(s);
- return;
- }
-#endif
-
- /*
- * CDB larger than 12 bytes are not supported, as well as
- * odd-sized data transfers.
- * Sense data borrowed from gdt(4).
- */
- if (xs->cmdlen > 12 ||
- (ISSET(xs->flags, SCSI_DATA_IN | SCSI_DATA_OUT) &&
- (xs->datalen & 1) != 0)) {
-#ifdef VSBIC_DEBUG
- printf("%s: can't issue command, cdb len %d data len %x\n",
- DEVNAME(sc), xs->cmdlen, xs->datalen);
-#endif
- memset(&xs->sense, 0, sizeof(xs->sense));
- xs->sense.error_code = SSD_ERRCODE_VALID | SSD_ERRCODE_CURRENT;
- xs->sense.flags = SKEY_ILLEGAL_REQUEST;
- /* 0x20 illcmd, 0x24 illfield */
- xs->sense.add_sense_code = xs->cmdlen > 12 ? 0x20 : 0x24;
- xs->error = XS_SENSE;
- scsi_done(xs);
- splx(s);
- return;
- }
-
- /*
- * Get a CCB, an envelope and a command packet.
- */
-
- ccb = vsbic_get_ccb(sc);
- if (ccb == NULL) {
-#ifdef VSBIC_DEBUG
- printf("%s: no free CCB\n", DEVNAME(sc));
-#endif
- xs->error = XS_NO_CCB;
- scsi_done(xs);
- splx(s);
- return;
- }
-
- env = bpp_get_envelope(bsc);
- if (env == NULL) {
-#ifdef VSBIC_DEBUG
- printf("%s: no free envelope\n", DEVNAME(sc));
-#endif
- vsbic_free_ccb(sc, ccb);
- xs->error = XS_NO_CCB;
- scsi_done(xs);
- splx(s);
- return;
- }
- cmd = vsbic_get_cmd(sc);
- if (cmd == NULL) {
-#ifdef VSBIC_DEBUG
- printf("%s: no free command\n", DEVNAME(sc));
-#endif
- bpp_put_envelope(bsc, env);
- vsbic_free_ccb(sc, ccb);
- xs->error = XS_NO_CCB;
- scsi_done(xs);
- splx(s);
- return;
- }
-
- ccb->ccb_xs = xs;
- ccb->ccb_xsflags = xs->flags;
- timeout_set(&xs->stimeout, vsbic_timeout, ccb);
-
- /*
- * Build command script.
- */
-
- rc = vsbic_load_command(sc, ccb, cmd, sl, xs->cmd, xs->cmdlen,
- xs->data, xs->datalen);
- if (rc != 0) {
- printf("%s: unable to load DMA map: error %d\n",
- DEVNAME(sc), rc);
- vsbic_put_cmd(sc, cmd);
- bpp_put_envelope(bsc, env);
- vsbic_free_ccb(sc, ccb);
- xs->error = XS_DRIVER_STUFFUP;
- scsi_done(xs);
- splx(s);
- return;
- }
-
- /*
- * Send the command to the hardware.
- */
-
- vsbic_activate_ccb(sc, ccb, cmd);
- if (ISSET(xs->flags, SCSI_POLL))
- ch = VSBIC_POLLING_CHANNEL(sc);
- else
- ch = VSBIC_TARGET_CHANNEL(sc, sl->target);
- vsbic_queue_cmd(sc, &sc->sc_chan[ch], env, cmd);
-
- if (ISSET(xs->flags, SCSI_POLL)) {
- splx(s);
- vsbic_poll(sc, ccb);
- } else {
- timeout_add_msec(&xs->stimeout, xs->timeout);
- splx(s);
- }
-}
-
-/*
- * Send a request sense command. Invoked at splbio().
- */
-int
-vsbic_request_sense(struct vsbic_softc *sc, struct vsbic_ccb *ccb)
-{
- struct bpp_softc *bsc = &sc->sc_bpp;
- struct scsi_xfer *xs = ccb->ccb_xs;
- struct scsi_link *sl = xs->sc_link;
- struct bpp_envelope *env;
- struct vsbic_cmd *cmd;
- struct scsi_sense ss;
- int rc;
-
- env = bpp_get_envelope(bsc);
- if (env == NULL) {
-#ifdef VSBIC_DEBUG
- printf("%s: no free envelope\n", DEVNAME(sc));
-#endif
- return EAGAIN;
- }
- cmd = vsbic_get_cmd(sc);
- if (cmd == NULL) {
-#ifdef VSBIC_DEBUG
- printf("%s: no free command\n", DEVNAME(sc));
-#endif
- bpp_put_envelope(bsc, env);
- return EAGAIN;
- }
-
- memset(&ss, 0, sizeof ss);
- ss.opcode = REQUEST_SENSE;
- ss.byte2 = sl->lun << 5;
- ss.length = sizeof(xs->sense);
-
- ccb->ccb_xsflags = (ccb->ccb_xsflags & SCSI_NOSLEEP) |
- SCSI_DATA_IN | SCSI_POLL;
- rc = vsbic_load_command(sc, ccb, cmd, sl,
- (struct scsi_generic *)&ss, sizeof ss,
- (uint8_t *)&xs->sense, sizeof(xs->sense));
- if (rc != 0) {
- vsbic_put_cmd(sc, cmd);
- bpp_put_envelope(bsc, env);
- return rc;
- }
-
- vsbic_activate_ccb(sc, ccb, cmd);
- vsbic_queue_cmd(sc, &sc->sc_chan[VSBIC_POLLING_CHANNEL(sc)], env, cmd);
- if (xs->timeout > 1000)
- xs->timeout = 1000;
- vsbic_poll(sc, ccb);
-
- return 0;
-}
-
-/*
- * Reset a target. Invoked at splbio().
- */
-int
-vsbic_scsireset(struct vsbic_softc *sc, struct scsi_xfer *xs)
-{
- struct bpp_softc *bsc = &sc->sc_bpp;
- struct bpp_chan *chan;
- struct scsi_link *sl;
- struct bpp_envelope *env;
- struct vsbic_cmd *cmd;
-
- /*
- * Get an envelope and a command packet.
- */
-
- env = bpp_get_envelope(bsc);
- if (env == NULL) {
-#ifdef VSBIC_DEBUG
- printf("%s: no free envelope\n", DEVNAME(sc));
-#endif
- return EAGAIN;
- }
- cmd = vsbic_get_cmd(sc);
- if (cmd == NULL) {
-#ifdef VSBIC_DEBUG
- printf("%s: no free command\n", DEVNAME(sc));
-#endif
- bpp_put_envelope(bsc, env);
- return EAGAIN;
- }
-
- if (xs == NULL)
- sl = NULL;
- else
- sl = xs->sc_link;
-
- vsbic_reset_command(sc, cmd, sl);
-
- chan = &sc->sc_chan[VSBIC_RESET_CHANNEL(sc)];
- vsbic_queue_cmd(sc, chan, env, cmd);
-
- return 0;
-}
-
-/*
- * Wrapup task after a command has completed (or failed).
- */
-void
-vsbic_wrapup(struct vsbic_softc *sc, struct vsbic_ccb *ccb)
-{
- struct scsi_xfer *xs = ccb->ccb_xs;
-
- timeout_del(&xs->stimeout);
-
- if (xs->error == XS_NOERROR) {
- switch (xs->status) {
- case SCSI_OK:
- xs->error = XS_NOERROR;
- break;
- case SCSI_CHECK:
- /*
- * Send a request sense command. If we can't, or
- * it fails, don't insist and fail the command.
- */
- if (!ISSET(ccb->ccb_flags, CCBF_SENSE)) {
- SET(ccb->ccb_flags, CCBF_SENSE);
- xs->error = XS_SENSE;
- if (vsbic_request_sense(sc, ccb) == 0)
- return;
- }
- xs->error = XS_DRIVER_STUFFUP;
- break;
- default:
- xs->error = XS_DRIVER_STUFFUP;
- break;
- }
- }
-
- vsbic_free_ccb(sc, ccb);
- scsi_done(xs);
-}
-
-
-/*
- * Polled command operation.
- */
-
-void
-vsbic_poll(struct vsbic_softc *sc, struct vsbic_ccb *ccb)
-{
- struct bpp_chan *chan = &sc->sc_chan[VSBIC_POLLING_CHANNEL(sc)];
- struct scsi_xfer *xs = ccb->ccb_xs;
- int s;
- int tmo;
-
- tmo = ccb->ccb_xs->timeout;
- s = splbio();
- for (;;) {
- if (vsbic_channel_intr(sc, chan) != 0)
- if (ISSET(xs->flags, ITSDONE))
- break;
-
- /*
- * It is safe to lower spl while waiting, since the polling
- * channel never interrupts, and thus we do not risk
- * vsbic_intr() processing this request behind our back.
- */
- splx(s);
- delay(1000);
- tmo--;
- s = splbio();
- if (tmo == 0)
- break;
- }
-
- if (tmo == 0) {
- vsbic_timeout(ccb);
- if (!ISSET(xs->flags, ITSDONE)) {
- /*
- * We have sent a reset command. Poll for its
- * completion.
- */
- chan = &sc->sc_chan[VSBIC_RESET_CHANNEL(sc)];
- for (;;) {
- if (vsbic_channel_intr(sc, chan) != 0)
- if (ISSET(xs->flags, ITSDONE))
- break;
-
- delay(10000); /* 10ms */
- }
- }
- }
-
- /*
- * vsbic_intr() does not invoke vsbic_wrapup for polled
- * commands, since we need the scsi_xfer to remain valid
- * after the commands completes.
- */
- vsbic_wrapup(sc, ccb);
-
- splx(s);
-}
-
-void
-vsbic_timeout(void *v)
-{
- struct vsbic_ccb *ccb = (struct vsbic_ccb *)v;
- struct scsi_xfer *xs = ccb->ccb_xs;
- struct scsi_link *sl = xs->sc_link;
- struct vsbic_softc *sc = (struct vsbic_softc *)sl->adapter_softc;
- int s;
-
- sc_print_addr(sl);
- printf("SCSI command 0x%x timeout\n", xs->cmd->opcode);
-
- s = splbio();
-
- if (vsbic_scsireset(sc, xs) != 0) {
- sc_print_addr(sl);
- printf("unable to reset SCSI bus\n");
-
- xs->error = XS_TIMEOUT;
- xs->status = SCSI_TERMINATED;
- if (ISSET(ccb->ccb_xsflags, SCSI_POLL)) {
- SET(xs->flags, ITSDONE);
- /* caller will invoke vsbic_wrapup() later */
- } else
- vsbic_wrapup(sc, ccb);
-
- /*
- * This is very likely to hose at least this device,
- * until another SCSI bus reset is tried, since the
- * command will never complete...
- *
- * We could remember this situation and issue a bus
- * reset as soon as an envelope is available, but
- * the initial envelope number computation is supposed
- * to prevent this from occuring.
- */
- }
-
- /*
- * If we have been able to send the reset command, make
- * sure we are forcing an error condition, to report the
- * correct error.
- */
- xs->error = XS_TIMEOUT;
- xs->status = SCSI_TERMINATED;
-
- splx(s);
-}
-
-/*
- * Interrupt Handler
- */
-
-int
-vsbic_intr(void *arg)
-{
- struct vsbic_softc *sc = arg;
- struct bpp_chan *chan;
- uint ch;
-
- splassert(IPL_BIO);
-
- /*
- * There is no easy way to know which channel caused the interrupt
- * (unless we register as many different interrupts as channels...),
- * so check all of them.
- *
- * This means that we will sometimes dequeue commands before
- * receiving their channel interrupts... therefore, we always
- * claim the interrupt for the kernel not to be confused.
- */
-
- /*
- * Check the reset channel first, then check all real target channels.
- */
-
- chan = &sc->sc_chan[VSBIC_RESET_CHANNEL(sc)];
- (void)vsbic_channel_intr(sc, chan);
-
- for (ch = 0; ch < 8; ch++) {
- if (ch == VSBIC_RESET_CHANNEL(sc))
- continue;
- chan = &sc->sc_chan[ch];
- (void)vsbic_channel_intr(sc, chan);
- }
-
- return 1;
-}
-
-int
-vsbic_channel_intr(struct vsbic_softc *sc, struct bpp_chan *chan)
-{
- struct vsbic_cmd *cmd;
- struct vsbic_ccb *ccb;
- struct scsi_xfer *xs;
- uint32_t xferlen;
- uint error, status;
-
- cmd = vsbic_dequeue_cmd(sc, chan);
- if (cmd == NULL)
- return 0;
-
- /* retrieve associated ccb, if any */
- ccb = vsbic_cmd_ccb(sc, cmd);
-
- xferlen = (betoh16(cmd->pkt.sts_xfer_high) << 16) |
- betoh16(cmd->pkt.sts_xfer_low);
- error = cmd->pkt.sts_error;
- status = betoh16(cmd->pkt.sts_status);
-
-#ifdef VSBIC_DEBUG
- printf("channel %d: cmd %p ccb %p xfer %x error %02x\n",
- chan->ch->ch_num, cmd, ccb, xferlen, error);
- printf(" status %04x sts %02x parm3 %x",
- status, cmd->scsi.status, cmd->pkt.sts_parm3);
- if (error == ERR_OK && cmd->pkt.sts_recovered != ERR_OK)
- printf(" recovered error %02x tries %d",
- cmd->pkt.sts_recovered, cmd->pkt.sts_retries);
- printf("\n");
-#endif
-
- if (ccb != NULL) {
- xs = ccb->ccb_xs;
-
- if (ISSET(ccb->ccb_xsflags, SCSI_DATA_IN | SCSI_DATA_OUT)) {
- if (!ISSET(ccb->ccb_flags, CCBF_SENSE))
- xs->resid = xs->datalen - xferlen;
- bus_dmamap_sync(sc->sc_dmat, ccb->ccb_dmamap, 0,
- ccb->ccb_dmalen,
- ISSET(ccb->ccb_xsflags, SCSI_DATA_IN) ?
- BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
- bus_dmamap_unload(sc->sc_dmat, ccb->ccb_dmamap);
- }
-
- if (xs->error == XS_NOERROR) {
- switch (error) {
- case ERR_SELECT_TIMEOUT:
- xs->error = XS_SELTIMEOUT;
- break;
- case ERR_BUS_RESET:
- xs->error = XS_RESET;
- break;
- case ERR_REQUEST_SENSE_FAILED:
- xs->error = XS_SHORTSENSE;
- break;
- case ERR_INVALID_XFER_COUNT:
- if (status == ERR_INCOMPLETE_DATA_TRANSFER)
- xs->error = XS_NOERROR;
- else
- xs->error = XS_DRIVER_STUFFUP;
- break;
- case ERR_OK:
- xs->error = XS_NOERROR;
- xs->status = cmd->scsi.status;
- break;
- default:
- xs->error = XS_DRIVER_STUFFUP;
- break;
- }
- }
- }
-
- vsbic_put_cmd(sc, cmd);
-
- if (ccb != NULL) {
- if (ISSET(ccb->ccb_xsflags, SCSI_POLL)) {
- SET(xs->flags, ITSDONE);
- /* caller will invoke vsbic_wrapup() later */
- } else
- vsbic_wrapup(sc, ccb);
- }
-
- return 1;
-}
diff --git a/sys/arch/mvme68k/dev/vsreg.h b/sys/arch/mvme68k/dev/vsreg.h
deleted file mode 100644
index 1a44a7c0a2a..00000000000
--- a/sys/arch/mvme68k/dev/vsreg.h
+++ /dev/null
@@ -1,439 +0,0 @@
-/* $OpenBSD: vsreg.h,v 1.8 2009/02/17 22:28:41 miod Exp $ */
-/*
- * Copyright (c) 2004, Miodrag Vallat.
- * Copyright (c) 1999 Steve Murphree, Jr.
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from source contributed by Mark Bellon.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _MVME328_REG_H_
-#define _MVME328_REG_H_
-
-/*
- * JAGUAR specific device limits
- */
-
-#define JAGUAR_MIN_Q_SIZ 2
-#define JAGUAR_MAX_CTLR_CMDS 80 /* Interphase says so */
-#define JAGUAR_MAX_Q_SIZ (JAGUAR_MAX_CTLR_CMDS / JAGUAR_MAX_WQ)
-#define JAGUAR_MAX_WQ (2 * 7)
-
-/*
- * COUGAR specific device limits
- */
-
-#define COUGAR_MIN_Q_SIZ 2
-#define COUGAR_CMDS_PER_256K 42 /* Interphase says so */
-
-/*
- * Structures
- */
-
-#define NUM_CQE 10
-#define NUM_IOPB NUM_CQE
-#define NUM_WQ (2 * 15)
-
-/*
- * Master Control Status Block (MCSB)
- */
-
-#define MCSB_MSR 0x000000 /* master status register */
-#define M_MSR_QFC 0x0004 /* queue flush complete */
-#define M_MSR_BOK 0x0002 /* board OK */
-#define M_MSR_CNA 0x0001 /* controller not available */
-#define MCSB_MCR 0x000002 /* master control register */
-#define M_MCR_SFEN 0x2000 /* sysfail enable */
-#define M_MCR_RES 0x1000 /* reset controller */
-#define M_MCR_FLQ 0x0800 /* flush queue */
-#define M_MCR_FLQR 0x0004 /* flush queue and report */
-#define M_MCR_SQM 0x0001 /* start queue mode */
-#define MCSB_IQAR 0x000004 /* interrupt on queue avail */
-#define M_IQAR_IQEA 0x8000 /* interrupt on queue entry avail */
-#define M_IQAR_IQEH 0x4000 /* interrupt on queue half empty */
-#define M_IQAR_ILVL 0x0700 /* interrupt lvl on queue available */
-#define M_IQAR_IVCT 0x00ff /* interrupt vector on queue avail */
-#define MCSB_QHDP 0x000006 /* queue head pointer */
-#define MCSB_THAW 0x000008 /* thaw work queue */
-#define M_THAW_TWQN 0xff00 /* thaw work queue number */
-#define M_THAW_TWQE 0x0001 /* thaw work queue enable */
-#define MCSB_SIZE 0x000010
-
-/*
- * Host Semaphore Block (HSB)
- */
-
-#define HSB_INITQ 0x000000 /* init MCE flag */
-#define HSB_WORKQ 0x000002 /* work queue number */
-#define HSB_MAGIC 0x000004 /* magic word */
-#define HSB_SIZE 0x000008
-
-/*
- * Controller Initialization Block (CIB)
- */
-
-#define CIB_NCQE 0x000000 /* number of CQE */
-#define CIB_BURST 0x000002 /* DMA burst count */
-#define CIB_NVECT 0x000004 /* normal completion vector */
-#define CIB_EVECT 0x000006 /* error completion vector */
-#define M_VECT_ILVL 0x0700 /* Interrupt Level mask */
-#define M_VECT_IVCT 0x00ff /* Interrupt Vector mask */
-#define CIB_PID 0x000008 /* primary scsi bus id */
-#define CIB_SID 0x00000a /* secondary scsi bus id */
-#define M_PSID_DFT 0x0008 /* default ID enable */
-#define M_PSID_ID 0x0007 /* primary/secondary SCSI ID */
-#define CIB_CRBO 0x00000c /* CRB offset */
-#define CIB_SELECT 0x00000e /* selection timeout in ms */
-#define CIB_WQTIMO 0x000012 /* work queue timeout in 256ms */
-#define CIB_VMETIMO 0x000016 /* VME timeout in 32ms */
-#define CIB_OBMT 0x00001e /* offboard CRB mtype/xfer type/ad mod */
-#define CIB_OBADDR 0x000020 /* host mem address for offboard CRB */
-#define CIB_ERR_FLGS 0x000024 /* error recovery flags */
-#define M_ERRFLGS_FOSR 0x0001 /* Freeze on SCSI bus reset */
-#define M_ERRFLGS_RIN 0x0002 /* SCSI bus reset interrupt */
-#define M_ERRFLGS_RSE 0x0004 /* Report COUGAR SCSI errors */
-#define CIB_SBRIV 0x00002a /* scsi bus reset interrupt vector */
-#define CIB_SOF0 0x00002c /* synchronous offset (bus 0) */
-#define CIB_SRATE0 0x00002d /* sync negotiation rate (bus 0) */
-#define CIB_SOF1 0x00002e /* synchronous offset (bus 0) */
-#define CIB_SRATE1 0x00002f /* sync negotiation rate (bus 0) */
-#define CIB_SIZE 0x000030
-
-/*
- * Command Queue Entry (CQE)
- */
-
-#define CQE_QECR 0x000000 /* queue entry control reg */
-#define M_QECR_IOPB 0x0f00 /* IOPB type (must be zero) */
-#define M_QECR_HPC 0x0004 /* High Priority command */
-#define M_QECR_AA 0x0002 /* abort acknowledge */
-#define M_QECR_GO 0x0001 /* Go/Busy */
-#define CQE_IOPB_ADDR 0x000002 /* IOPB address */
-#define CQE_CTAG 0x000004 /* command tag */
-#define CQE_IOPB_LENGTH 0x000008 /* IOPB length */
-#define CQE_WORK_QUEUE 0x000009 /* work queue number */
-#define CQE_SIZE 0x00000c
-
-/*
- * Command Response Block (CRB)
- */
-
-#define CRB_CRSW 0x000000 /* status word */
-#define M_CRSW_SE 0x0800 /* SCSI error (COUGAR) */
-#define M_CRSW_RST 0x0400 /* SCSI Bus reset (COUGAR) */
-#define M_CRSW_SC 0x0080 /* status change */
-#define M_CRSW_CQA 0x0040 /* Command queue entry available */
-#define M_CRSW_QMS 0x0020 /* queue mode started */
-#define M_CRSW_AQ 0x0010 /* abort queue */
-#define M_CRSW_EX 0x0008 /* exception */
-#define M_CRSW_ER 0x0004 /* error */
-#define M_CRSW_CC 0x0002 /* command complete */
-#define M_CRSW_CRBV 0x0001 /* cmd response block valid/clear */
-#define CRB_CTAG 0x000004 /* command tag */
-#define CRB_IOPB_LENGTH 0x000008 /* IOPB length */
-#define CRB_WORK_QUEUE 0x000009 /* work queue number */
-#define CRB_SIZE 0x00000c
-
-/*
- * Controller Error Vector Status Block (CEVSB)
- * This is a variation of the CRB, _but larger_.
- */
-
-#define CONTROLLER_ERROR 0x0085
-#define NR_SCSI_ERROR 0x0885
-
-#define CEVSB_CRSW 0x000000 /* status word */
-#define CEVSB_TYPE 0x000002 /* IOPB type */
-#define CEVSB_CTAG 0x000004 /* command tag */
-#define CEVSB_IOPB_LENGTH 0x000008 /* IOPB length */
-#define CEVSB_WORK_QUEUE 0x000009 /* work queue number */
-#define CEVSB_ERROR 0x00000d /* error code */
-#define CEVSB_ERR_TYPE 0xc0 /* IOPB type error */
-#define CEVSB_ERR_TO 0xc1 /* IOPB timeout error */
-#define CEVSB_ERR_TR 0x82 /* Target Reconnect, no IOPB */
-#define CEVSB_ERR_OF 0x83 /* Overflow */
-#define CEVSB_ERR_BD 0x84 /* Bad direction */
-#define CEVSB_ERR_NR 0x86 /* Non-Recoverabl Error */
-#define CEVSB_ERR_PANIC 0xff /* Board Painc!!! */
-#define CEVSB_AUXERR 0x00000e /* cougar error code */
-#define CEVSB_SIZE 0x000010
-
-/*
- * Configuration Status Block (CSB)
- */
-
-#define CSB_TYPE 0x000000 /* board ID */
-#define COUGAR 0x4220
-#define JAGUAR 0x0000
-#define CSB_EXTID 0x000002 /* cougar extended ID */
-#define CSB_PCODE 0x000003 /* product code */
-#define CSB_PVAR 0x000009 /* product variation */
-#define CSB_FREV 0x00000d /* firmware revision level */
-#define CSB_FDATE 0x000012 /* firmware release date */
-#define CSB_SSIZE 0x00001a /* system memory size in KB */
-#define CSB_BSIZE 0x00001c /* buffer memory size in KB */
-#define CSB_NWQ 0x00001e /* number of work queues (C) */
-#define CSB_PFECID 0x000020 /* primary bus FEC id */
-#define CSB_SFECID 0x000021 /* secondary bus FEC id */
-#define CSB_PID 0x000022 /* primary bus id */
-#define CSB_SID 0x000023 /* secondary bus id */
-#define CSB_LPDS 0x000024 /* last primary device selected */
-#define CSB_LSDS 0x000025 /* last secondary device selected */
-#define CSB_PPS 0x000026 /* primary phase sense */
-#define CSB_SPS 0x000027 /* secondary phase sense */
-#define CSB_DBID 0x000029 /* daughter board id */
-#define DBID_SCSI2 0x02 /* modern SCSI ??? */
-#define DBID_PRINTER 0x04 /* printer daughter board */
-#define DBID_SCSI 0x06 /* SCSI daugter board */
-#define DBID_NONE 0x07 /* no daughter board */
-#define CSB_SDS 0x00002b /* software DIP switch */
-#define CSB_FWQR 0x00002e /* frozen work queues register */
-#define CSB_SIZE 0x000078
-
-/*
- * IOPB Format (IOPB)
- */
-
-#define IOPB_CMD 0x000000 /* command code */
-#define IOPB_OPTION 0x000002 /* option word */
-#define M_OPT_HEAD_TAG 0x3000 /* head of queue command queue tag */
-#define M_OPT_ORDERED_TAG 0x2000 /* order command queue tag */
-#define M_OPT_SIMPLE_TAG 0x1000 /* simple command queue tag */
-#define M_OPT_GO_WIDE 0x0800 /* use WIDE transfers */
-#define M_OPT_DIR 0x0100 /* VME direction bit */
-#define M_OPT_SG_BLOCK 0x0008 /* scatter/gather in 512 byte blocks */
-#define M_OPT_SS 0x0004 /* Suppress synchronous transfer */
-#define M_OPT_SG 0x0002 /* scatter/gather bit */
-#define M_OPT_IE 0x0001 /* Interrupt enable */
-#define IOPB_STATUS 0x000004 /* return status word */
-#define IOPB_NVCT 0x000008 /* normal completion vector */
-#define IOPB_EVCT 0x000009 /* error completion vector */
-#define IOPB_LEVEL 0x00000a /* interrupt level */
-#define IOPB_ADDR 0x00000e /* address type and modifier */
-#define M_ADR_TRANS 0x0c00 /* transfer type */
-#define M_ADR_MEMT 0x0300 /* memory type */
-#define M_ADR_MOD 0x00ff /* VME address modifier */
-#define M_ADR_SG_LINK 0x8000 /* Scatter/Gather Link bit */
-#define IOPB_BUFF 0x000010 /* buffer address */
-#define IOPB_LENGTH 0x000014 /* max transfer length */
-#define IOPB_SGTTL 0x000018 /* S/G total transfer length */
-#define IOPB_UNIT 0x00001e /* unit address on scsi bus */
-#define M_UNIT_EXT_LUN 0xff00 /* Extended Address */
-#define M_UNIT_EXT 0x0080 /* Extended Address Enable */
-#define M_UNIT_BUS 0x0040 /* SCSI Bus Selection */
-#define M_UNIT_LUN 0x0038 /* Logical Unit Number */
-#define M_UNIT_ID 0x0007 /* SCSI Device ID */
-#define IOPB_SCSI_DATA 0x000020 /* SCSI words for passthrough */
-#define IOPB_SHORT_SIZE 0x000020
-#define IOPB_LONG_SIZE 0x000040
-
-/*
- * Initialize Work Queue Command Format (WQCF)
- * This is a specific case of IOPB.
- */
-
-#define WQCF_CMD 0x000000 /* command code */
-#define M_WOPT_IWQ 0x8000 /* initialize work queue */
-#define M_WOPT_PE 0x0008 /* parity check enable */
-#define M_WOPT_FE 0x0004 /* freeze on error enable */
-#define M_WOPT_TM 0x0002 /* target mode enable */
-#define M_WOPT_AE 0x0001 /* abort enable */
-#define WQCF_OPTION 0x000002 /* option word */
-#define WQCF_STATUS 0x000004 /* return status word */
-#define WQCF_NVCT 0x000008 /* normal completion vector */
-#define WQCF_EVCT 0x000009 /* error completion vector */
-#define WQCF_ILVL 0x00000a /* interrupt level */
-#define WQCF_WORKQ 0x00001c /* work queue number */
-#define WQCF_WOPT 0x00001e /* work queue options */
-#define WQCF_SLOTS 0x000020 /* # of slots in work queues */
-#define WQCF_UNIT 0x000022 /* unit address (C) */
-#define WQCF_CMDTO 0x000024 /* command timeout */
-
-/*
- * SCSI Reset Command Format (SRCF)
- * This is a specific case of IOPB.
- */
-
-#define SRCF_CMD 0x000000 /* command code */
-#define SRCF_OPTION 0x000002 /* option word */
-#define SRCF_STATUS 0x000004 /* return status word */
-#define SRCF_NVCT 0x000008 /* normal completion vector */
-#define SRCF_EVCT 0x000009 /* error completion vector */
-#define SRCF_ILVL 0x00000a /* interrupt level */
-#define SRCF_BUSID 0x00001c /* scsi bus id to reset */
-
-/*
- * Device Reinitialize Command Format (DRCF)
- * This is a specific case of IOPB.
- */
-
-#define DRCF_CMD 0x000000 /* command code */
-#define DRCF_OPTION 0x000002 /* option word */
-#define DRCF_STATUS 0x000004 /* return status word */
-#define DRCF_NVCT 0x000008 /* normal completion vector */
-#define DRCF_EVCT 0x000009 /* error completion vector */
-#define DRCF_ILVL 0x00000a /* interrupt level */
-#define DRCF_UNIT 0x00001e /* unit address */
-
-/*
- * Short I/O memory layout
- */
-
-#define S_SHORTIO 0x000800
-
-#define sh_MCSB (0)
-#define sh_MCE (sh_MCSB + MCSB_SIZE)
-#define sh_CQE(x) (sh_MCE + CQE_SIZE + CQE_SIZE * (x))
-#define sh_IOPB(x) (sh_CQE(NUM_CQE) + IOPB_LONG_SIZE * (x))
-#define sh_MCE_IOPB (sh_IOPB(NUM_IOPB))
-#define sh_CIB (sh_MCE_IOPB + IOPB_LONG_SIZE)
-
-#define sh_CSS (S_SHORTIO - CSB_SIZE)
-#define sh_RET_IOPB (sh_CSS - IOPB_LONG_SIZE)
-#define sh_CRB (sh_RET_IOPB - CRB_SIZE)
-#define sh_CEVSB sh_CRB
-#define sh_HSB (sh_CRB - HSB_SIZE)
-
-#if (sh_CIB + CIB_SIZE > sh_HSB)
-#error invalid memory layout
-#endif
-
-#define SELECTION_TIMEOUT 250 /* milliseconds */
-#define VME_BUS_TIMEOUT 15 /* units of 30ms */
-#define M328_INFINITE_TIMEOUT 0 /* wait forever */
-
-/*
- * IOPB command codes
- */
-
-#define IOPB_PASSTHROUGH 0x20 /* SCSI passthrough commands */
-#define IOPB_PASSTHROUGH_EXT 0x21 /* SCSI passthrough extended */
-#define IOPB_RESET 0x22 /* reset bus */
-
-#define CNTR_DIAG 0x40 /* perform diagnostics */
-#define CNTR_INIT 0x41 /* initialize controller */
-#define CNTR_INIT_WORKQ 0x42 /* initialize work queue */
-#define CNTR_DUMP_INIT 0x43 /* dump initialization parameters */
-#define CNTR_DUMP_WORDQ 0x44 /* dump work queue parameters */
-#define CNTR_CANCEL_IOPB 0x48 /* cancel command tag */
-#define CNTR_FLUSH_WORKQ 0x49 /* flush work queue */
-#define CNTR_DEV_REINIT 0x4c /* reinitialize device */
-#define CNTR_ISSUE_ABORT 0x4e /* abort has been issued */
-#define CNTR_DOWNLOAD_FIRMWARE 0x4f /* download firmware (COUGAR) */
-
-/*
- * Memory types
- */
-
-#define MEMT_16BIT 1 /* 16 bit memory type */
-#define MEMT_32BIT 2 /* 32 bit memory type */
-#define MEMT_SHIO 3 /* short I/O memory type */
-#define MEMTYPE MEMT_32BIT
-
-/*
- * Transfer types
- */
-
-#define TT_NORMAL 0 /* normal mode transfers */
-#define TT_BLOCK 1 /* block mode transfers */
-#define TT_DISABLE_INC_ADDR 2 /* disable incrementing addresses */
-#define TT_D64 3 /* D64 mode transfers */
-
-/*
- * Error codes
- */
-
-#define MACSI_GOOD_STATUS 0x00
-#define MACSI_QUEUE_FULL 0x01
-#define MACSI_CMD_CODE_ERR 0x04
-#define MACSI_QUEUE_NUMBER_ERR 0x05
-
-#define RESET_BUS_STATUS 0x11 /* SCSI bus reset IOPB forced this */
-#define NO_SECONDARY_PORT 0x12 /* second SCSI bus not available */
-#define SCSI_DEVICE_IS_RESET 0x14
-#define CMD_ABORT_BY_RESET 0x15
-
-#define VME_BUS_ERROR 0x20
-#define VME_BUS_ACC_TIMEOUT 0x21
-#define VME_BUS_BAD_ADDR 0x23
-#define VME_BUS_BAD_MEM_TYPE 0x24
-#define VME_BUS_BAD_COUNT 0x25
-#define VME_BUS_FETCH_ERROR 0x26
-#define VME_BUS_FETCH_TIMEOUT 0x27
-#define VME_BUS_POST_ERROR 0x28
-#define VME_BUS_POST_TIMEOUT 0x29
-#define VME_BUS_BAD_FETCH_ADDR 0x2a
-#define VME_BUS_BAD_POST_ADDR 0x2b
-#define VME_BUS_SG_FETCH 0x2c
-#define VME_BUS_SG_TIMEOUT 0x2d
-#define VME_BUS_SG_COUNT 0x2e
-
-#define SCSI_SELECTION_TO 0x30
-#define SCSI_DISCONNECT_TIMEOUT 0x31
-#define SCSI_ABNORMAL_SEQ 0x32
-#define SCSI_DISCONNECT_ERR 0x33
-#define SCSI_XFER_EXCEPTION 0x34
-#define SCSI_PARITY_ERROR 0x35
-
-#define DEVICE_NO_IOPB 0x82
-#define IOPB_CTLR_EXH 0x83
-#define IOPB_DIR_ERROR 0x84
-#define COUGAR_ERROR 0x86
-#define MACSI_INCORRECT_HW 0x90
-#define MACSI_ILGL_IOPB_VAL 0x92
-#define MACSI_ILLEGAL_IMAGE 0x9c
-#define IOPB_TYPE_ERR 0xc0 /* IOPB type not 0 */
-#define IOPB_TIMEOUT 0xc1
-
-#define COUGAR_PANIC 0xff
-
-#define MACSI_INVALID_TIMEOUT 0x843
-
-/*
- * VME addressing modes
- */
-
-#define ADRM_STD_S_P 0x3e /* standard supervisory program */
-#define ADRM_STD_S_D 0x3d /* standard supervisory data */
-#define ADRM_STD_N_P 0x3a /* standard normal program */
-#define ADRM_STD_N_D 0x39 /* standard normal data */
-#define ADRM_SHT_S_IO 0x2d /* short supervisory I/O */
-#define ADRM_SHT_N_IO 0x29 /* short normal I/O */
-#define ADRM_EXT_S_P 0x0e /* extended supervisory program */
-#define ADRM_EXT_S_D 0x0d /* extended supervisory data */
-#define ADRM_EXT_N_P 0x0a /* extended normal program */
-#define ADRM_EXT_N_D 0x09 /* extended normal data */
-#define ADRM_EXT_S_BM 0x0f /* extended supervisory block mode */
-#define ADRM_EXT_S_D64 0x0c /* extended supervisory D64 mode */
-
-#define ADDR_MOD ((TT_NORMAL << 10) | (MEMTYPE << 8) | ADRM_EXT_S_D)
-#define BLOCK_MOD ((TT_BLOCK << 10) | (MEMTYPE << 8) | ADRM_EXT_S_BM)
-#define D64_MOD ((TT_D64 << 10) | (MEMTYPE << 8) | ADRM_EXT_S_D64)
-#define SHIO_MOD ((TT_NORMAL << 10) | (MEMT_SHIO << 8) | ADRM_SHT_N_IO)
-
-#endif /* _MVME328_REG_H_ */
diff --git a/sys/arch/mvme68k/dev/vsvar.h b/sys/arch/mvme68k/dev/vsvar.h
deleted file mode 100644
index 4997978d01a..00000000000
--- a/sys/arch/mvme68k/dev/vsvar.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/* $OpenBSD: vsvar.h,v 1.8 2009/02/17 22:28:41 miod Exp $ */
-/*
- * Copyright (c) 2004, 2009, Miodrag Vallat.
- * Copyright (c) 1999 Steve Murphree, Jr.
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#ifndef _VSVAR_H_
-#define _VSVAR_H_
-
-/*
- * Scatter/gather structures
- *
- * Each s/g element is 8 bytes long; a s/g list is limited to 64
- * entries. To afford larger lists, it is possible to use ``link''
- * entries, which can add up to 64 new entries (and contain link
- * entries themselves, too), by setting the M_ADR_SG_LINK bit in
- * the address modifier field.
- *
- * To keep things simple, this driver will use only use a flat list
- * of up to 64 entries, thereby limiting the maximum transfer to
- * 64 pages (worst case situation).
- */
-
-#define MAX_SG_ELEMENTS 64
-
-struct vs_sg_entry {
- union {
- uint16_t bytes; /* entry byte count */
- struct {
- uint8_t gather; /* count of linked entries */
- uint8_t reserved;
- } link;
- } count;
- uint16_t pa_high; /* 32-bit address field split... */
- uint16_t pa_low; /* ... due to alignment */
- uint16_t addr; /* address type and modifier */
-};
-
-/* largest power of two for the bytes field */
-#define MAX_SG_ELEMENT_SIZE (1U << 15)
-
-/*
- * Command control block
- */
-struct vs_cb {
- struct scsi_xfer *cb_xs; /* current command */
- u_int cb_q; /* controller queue it's in */
-
- bus_dmamap_t cb_dmamap;
- bus_size_t cb_dmalen;
-};
-
-/*
- * Per-channel information
- */
-struct vs_channel {
- int vc_id; /* host id */
- int vc_width; /* number of targets */
- int vc_type; /* channel type */
-#define VCT_UNKNOWN 0
-#define VCT_SE 1
-#define VCT_DIFFERENTIAL 2
- struct scsi_link vc_link;
-};
-
-struct vs_softc {
- struct device sc_dev;
-
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
- bus_dma_tag_t sc_dmat;
-
- int sc_bid; /* board id */
- struct vs_channel sc_channel[2];
-
- struct intrhand sc_ih_n; /* normal interrupt handler */
- int sc_nvec;
- struct intrhand sc_ih_e; /* error interrupt handler */
- int sc_evec;
- char sc_intrname_e[16 + 4];
- int sc_ipl;
-
- u_int sc_nwq; /* number of work queues */
- struct vs_cb *sc_cb;
-
- bus_dmamap_t sc_sgmap;
- bus_dma_segment_t sc_sgseg;
- struct vs_sg_entry *sc_sgva;
-};
-
-/* Access macros */
-
-#define vs_read(w,o) \
- bus_space_read_##w (sc->sc_iot, sc->sc_ioh, (o))
-#define vs_write(w,o,v) \
- bus_space_write_##w (sc->sc_iot, sc->sc_ioh, (o), (v))
-#define vs_bzero(o,s) \
- bus_space_set_region_2(sc->sc_iot, sc->sc_ioh, (o), 0, (s) / 2)
-
-#define cib_read(w,o) vs_read(w, sh_CIB + (o))
-#define cib_write(w,o,v) vs_write(w, sh_CIB + (o), (v))
-#define crb_read(w,o) vs_read(w, sh_CRB + (o))
-#define crb_write(w,o,v) vs_write(w, sh_CRB + (o), (v))
-#define csb_read(w,o) vs_read(w, sh_CSS + (o))
-#define mce_read(w,o) vs_read(w, sh_MCE + (o))
-#define mce_write(w,o,v) vs_write(w, sh_MCE + (o), (v))
-#define mce_iopb_read(w,o) vs_read(w, sh_MCE_IOPB + (o))
-#define mce_iopb_write(w,o,v) vs_write(w, sh_MCE_IOPB + (o), (v))
-#define mcsb_read(w,o) vs_read(w, sh_MCSB + (o))
-#define mcsb_write(w,o,v) vs_write(w, sh_MCSB + (o), (v))
-
-#define CRSW crb_read(2, CRB_CRSW)
-#define CRB_CLR_DONE crb_write(2, CRB_CRSW, 0)
-#define CRB_CLR_ER crb_write(2, CRB_CRSW, CRSW & ~M_CRSW_ER)
-
-#define THAW_REG mcsb_read(2, MCSB_THAW)
-#define THAW(x) \
- do { \
- mcsb_write(1, MCSB_THAW, (x)); \
- mcsb_write(1, MCSB_THAW + 1, M_THAW_TWQE); \
- } while (0)
-
-#endif /* _M328VAR_H */
diff --git a/sys/arch/mvme68k/dev/wdsc.c b/sys/arch/mvme68k/dev/wdsc.c
deleted file mode 100644
index 3bace51ef16..00000000000
--- a/sys/arch/mvme68k/dev/wdsc.c
+++ /dev/null
@@ -1,481 +0,0 @@
-/* $OpenBSD: wdsc.c,v 1.19 2013/11/30 20:25:47 miod Exp $ */
-
-/*
- * Copyright (c) 2013 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-/*
- * Copyright (c) 2001 Wayne Knowles
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Wayne Knowles
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * Copyright (c) 1996 Steve Woodford
- * Copyright (c) 1982, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)wdsc.c
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-
-#include <machine/autoconf.h>
-
-#include <mvme68k/dev/pccreg.h>
-#include <mvme68k/dev/wdscreg.h>
-
-#include <dev/ic/wd33c93reg.h>
-#include <dev/ic/wd33c93var.h>
-
-struct dma_table_entry {
- uint32_t dc_paddr;
- uint32_t dc_cnt;
-};
-
-struct wdsc_softc {
- struct wd33c93_softc sc_wd33c93;
- bus_dma_tag_t sc_dmat;
- bus_dmamap_t sc_dmamap;
- bus_dmamap_t sc_tablemap;
- bus_dma_segment_t sc_tableseg;
- vaddr_t sc_tableva;
- struct intrhand sc_dmaih;
- struct intrhand sc_wdscih;
- int sc_ipl;
- int sc_flags;
-#define WDSC_DMA_ACTIVE 0x01
-#define WDSC_DMA_MAPLOADED 0x02
- u_short sc_dmacmd;
-};
-
-int wdscmatch(struct device *, void *, void *);
-void wdscattach(struct device *, struct device *, void *);
-
-const struct cfattach wdsc_ca = {
- sizeof(struct wdsc_softc), wdscmatch, wdscattach
-};
-
-struct cfdriver wdsc_cd = {
- NULL, "wdsc", DV_DULL
-};
-
-int wdsc_dmasetup(struct wd33c93_softc *, void **, size_t *, int, size_t *);
-int wdsc_dmago(struct wd33c93_softc *);
-void wdsc_dmastop(struct wd33c93_softc *);
-
-int wdsc_alloc_physical(struct wdsc_softc *, bus_dmamap_t *,
- bus_dma_segment_t *, vaddr_t *, bus_size_t, const char *);
-int wdsc_dmaintr(void *);
-int wdsc_scsiintr(void *);
-
-struct scsi_adapter wdsc_switch = {
- wd33c93_scsi_cmd,
- scsi_minphys,
- NULL,
- NULL
-};
-
-/*
- * Match for SCSI devices on the onboard WD33C93 chip
- */
-int
-wdscmatch(struct device *parent, void *vcf, void *aux)
-{
- struct confargs *ca = (struct confargs *)aux;
-
- if (strcmp(ca->ca_name, wdsc_cd.cd_name) != 0)
- return 0;
- return 1;
-}
-
-/*
- * Attach the wdsc driver
- */
-void
-wdscattach(struct device *parent, struct device *self, void *aux)
-{
- struct wdsc_softc *wsc = (struct wdsc_softc *)self;
- struct confargs *ca = (struct confargs *)aux;
- struct wd33c93_softc *sc = &wsc->sc_wd33c93;
- int tmp;
-
- /*
- * Map address and data registers.
- */
-
- sc->sc_regt = ca->ca_iot;
- if (bus_space_map(ca->ca_iot, ca->ca_paddr + 0, 1, 0,
- &sc->sc_asr_regh) != 0) {
- printf(": failed to map asr register\n");
- return;
- }
- if (bus_space_map(ca->ca_iot, ca->ca_paddr + 1, 1, 0,
- &sc->sc_data_regh) != 0) {
- printf(": failed to map data register\n");
- return;
- }
-
- /*
- * Allocate DMA map for up to MAXPHYS bytes.
- */
-
- wsc->sc_dmat = ca->ca_dmat;
- if (bus_dmamap_create(ca->ca_dmat, MAXPHYS, 1 + atop(MAXPHYS),
- 0, 0, BUS_DMA_WAITOK, &wsc->sc_dmamap) != 0) {
- printf(": failed to create dmamap\n");
- return;
- }
-
- /*
- * Allocate table walk memory.
- */
- if (wdsc_alloc_physical(wsc, &wsc->sc_tablemap, &wsc->sc_tableseg,
- &wsc->sc_tableva,
- sizeof(struct dma_table_entry) * (1 + atop(MAXPHYS)),
- "dma table") != 0) {
- bus_dmamap_destroy(ca->ca_dmat, wsc->sc_dmamap);
- return;
- }
-
- sc->sc_dmasetup = wdsc_dmasetup;
- sc->sc_dmago = wdsc_dmago;
- sc->sc_dmastop = wdsc_dmastop;
- sc->sc_reset = NULL;
-
- /*
- * The onboard WD33C93 of the MVME147 is usually clocked at 10MHz...
- */
- sc->sc_clkfreq = 100;
- sc->sc_id = 7;
- sc->sc_dmamode = SBIC_CTL_DMA;
-
- wsc->sc_dmacmd = 0;
- wsc->sc_ipl = ca->ca_ipl;
-
- sys_pcc->pcc_sbicirq = ca->ca_ipl | PCC_IRQ_INT;
- sys_pcc->pcc_dmairq = ca->ca_ipl | PCC_IRQ_INT;
- sys_pcc->pcc_dmacsr = 0;
-
- /*
- * Register interrupt handlers for DMA and WDSC
- */
- wsc->sc_dmaih.ih_fn = wdsc_dmaintr;
- wsc->sc_dmaih.ih_arg = wsc;
- wsc->sc_dmaih.ih_ipl = ca->ca_ipl;
- pccintr_establish(PCCV_DMA, &wsc->sc_dmaih, self->dv_xname);
-
- wsc->sc_wdscih.ih_fn = wdsc_scsiintr;
- wsc->sc_wdscih.ih_arg = wsc;
- wsc->sc_wdscih.ih_ipl = ca->ca_ipl;
- pccintr_establish(PCCV_SBIC, &wsc->sc_wdscih, self->dv_xname);
-
- /*
- * Attach all SCSI devices on us, watching for boot device
- * (see device_register).
- */
- tmp = bootpart;
- if (ca->ca_paddr != bootaddr)
- bootpart = -1;
- wd33c93_attach(sc, &wdsc_switch);
- bootpart = tmp; /* restore old value */
-
- sys_pcc->pcc_sbicirq = ca->ca_ipl | PCC_IRQ_IEN | PCC_IRQ_INT;
-}
-
-/*
- * Prime the hardware for a DMA transfer
- */
-int
-wdsc_dmasetup(struct wd33c93_softc *sc, void **addr, size_t *len, int datain,
- size_t *dmasize)
-{
- struct wdsc_softc *wsc = (struct wdsc_softc *)sc;
- int count;
- int rc;
-
- KASSERT((wsc->sc_flags & WDSC_DMA_ACTIVE) == 0);
-
- count = *len;
- if (count) {
- KASSERT((wsc->sc_flags & WDSC_DMA_MAPLOADED) == 0);
-
- if (datain)
- wsc->sc_dmacmd = DMAC_CSR_ENABLE;
- else
- wsc->sc_dmacmd = DMAC_CSR_ENABLE | DMAC_CSR_WRITE;
-
- rc = bus_dmamap_load(wsc->sc_dmat, wsc->sc_dmamap,
- *addr, count, NULL, BUS_DMA_NOWAIT);
- if (rc != 0)
- panic("%s: bus_dmamap_load failed, rc=%d",
- sc->sc_dev.dv_xname, rc);
-
- bus_dmamap_sync(wsc->sc_dmat, wsc->sc_dmamap, 0,
- wsc->sc_dmamap->dm_mapsize, datain ?
- BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
-
- /*
- * Build dma table, unless transfer fits in one
- * contiguous chunk
- */
- if (wsc->sc_dmamap->dm_nsegs > 1) {
- struct dma_table_entry *entry;
- bus_dma_segment_t *seg;
- int i;
-
- entry = (struct dma_table_entry *)wsc->sc_tableva;
- seg = wsc->sc_dmamap->dm_segs;
- for (i = wsc->sc_dmamap->dm_nsegs; i != 0; i--) {
- entry->dc_paddr = seg->ds_addr;
- entry->dc_cnt = seg->ds_len |
- (FC_SUPERD << 24) | (1UL << 31);
- seg++;
- entry++;
- }
- (--entry)->dc_cnt &= ~(1UL << 31);
-
- wsc->sc_dmacmd |= DMAC_CSR_TABLE;
- }
-
- wsc->sc_flags |= WDSC_DMA_MAPLOADED;
- }
-
- return count;
-}
-
-/*
- * Trigger a DMA transfer
- */
-int
-wdsc_dmago(struct wd33c93_softc *sc)
-{
- struct wdsc_softc *wsc = (struct wdsc_softc *)sc;
-
- KASSERT((wsc->sc_flags & WDSC_DMA_ACTIVE) == 0);
- KASSERT((wsc->sc_flags & WDSC_DMA_MAPLOADED));
-
- wsc->sc_flags |= WDSC_DMA_ACTIVE;
-
- sys_pcc->pcc_dmacsr = 0;
- sys_pcc->pcc_dmairq = wsc->sc_ipl | PCC_IRQ_IEN | PCC_IRQ_INT;
- if (wsc->sc_dmamap->dm_nsegs > 1) {
- sys_pcc->pcc_tafcr = FC_SUPERD;
- sys_pcc->pcc_dmataddr = wsc->sc_tableseg.ds_addr;
- } else {
- sys_pcc->pcc_dmadaddr =
- (unsigned long)wsc->sc_dmamap->dm_segs[0].ds_addr;
- sys_pcc->pcc_dmabcnt = (FC_SUPERD << 24) |
- (unsigned long)wsc->sc_dmamap->dm_segs[0].ds_len;
- }
- sys_pcc->pcc_dmacsr = wsc->sc_dmacmd;
-
- return wsc->sc_dmamap->dm_mapsize;
-}
-
-/*
- * Stop DMA, and disable DMA interrupts
- */
-void
-wdsc_dmastop(struct wd33c93_softc *sc)
-{
- struct wdsc_softc *wsc = (struct wdsc_softc *)sc;
-
- if (wsc->sc_flags & WDSC_DMA_ACTIVE) {
- sys_pcc->pcc_dmacsr = 0;
- sys_pcc->pcc_dmairq = wsc->sc_ipl | PCC_IRQ_INT;
-
- bus_dmamap_sync(wsc->sc_dmat, wsc->sc_dmamap, 0,
- wsc->sc_dmamap->dm_mapsize,
- wsc->sc_dmacmd & DMAC_CSR_WRITE ?
- BUS_DMASYNC_POSTWRITE : BUS_DMASYNC_POSTREAD);
- }
- if (wsc->sc_flags & WDSC_DMA_MAPLOADED)
- bus_dmamap_unload(wsc->sc_dmat, wsc->sc_dmamap);
- wsc->sc_flags &= ~(WDSC_DMA_ACTIVE | WDSC_DMA_MAPLOADED);
-}
-
-/*
- * DMA completion interrupt
- */
-int
-wdsc_dmaintr(void *arg)
-{
- struct wdsc_softc *wsc = (struct wdsc_softc *)arg;
- int rc = -1;
-
- /*
- * Really a DMA interrupt?
- */
- if ((sys_pcc->pcc_dmairq & PCC_IRQ_INT) == 0)
- return 0;
-
- if (sys_pcc->pcc_dmacsr & DMAC_CSR_DONE) {
- rc = 1;
- /* acknowledge interrupt... */
- sys_pcc->pcc_dmairq = wsc->sc_ipl | PCC_IRQ_IEN | PCC_IRQ_INT;
- if (sys_pcc->pcc_dmacsr & (DMAC_CSR_TBUSERR | DMAC_CSR_DBUSERR |
- DMAC_CSR_TSIZE | DMAC_CSR_8BITS)) {
- printf("%s: DMA error, CSR=%02x\n",
- wsc->sc_wd33c93.sc_dev.dv_xname,
- sys_pcc->pcc_dmacsr);
- }
- sys_pcc->pcc_dmacsr = 0;
- sys_pcc->pcc_dmairq = wsc->sc_ipl | PCC_IRQ_INT;
- }
-
- return rc;
-}
-
-/*
- * SCSI interrupt
- */
-int
-wdsc_scsiintr(void *arg)
-{
- struct wdsc_softc *wsc = (struct wdsc_softc *)arg;
- int rc;
-
- /*
- * Really a SCSI interrupt?
- */
- if ((sys_pcc->pcc_sbicirq & PCC_IRQ_INT) == 0)
- return 0;
-
- rc = wd33c93_intr(&wsc->sc_wd33c93);
-
- /*
- * Acknowledge and clear the interrupt
- */
- sys_pcc->pcc_sbicirq = wsc->sc_ipl | PCC_IRQ_IEN | PCC_IRQ_INT;
-
- return rc;
-}
-
-/*
- * Allocate contiguous physical memory.
- */
-int
-wdsc_alloc_physical(struct wdsc_softc *wsc, bus_dmamap_t *dmamap,
- bus_dma_segment_t *dmaseg, vaddr_t *va, bus_size_t len, const char *what)
-{
- int nseg;
- int rc;
-
- len = round_page(len);
-
- rc = bus_dmamem_alloc(wsc->sc_dmat, len, 0, 0, dmaseg, 1, &nseg,
- BUS_DMA_NOWAIT);
- if (rc != 0) {
- printf("%s: unable to allocate %s memory: error %d\n",
- wsc->sc_wd33c93.sc_dev.dv_xname, what, rc);
- goto fail1;
- }
-
- rc = bus_dmamem_map(wsc->sc_dmat, dmaseg, nseg, len,
- (caddr_t *)va, BUS_DMA_NOWAIT | BUS_DMA_COHERENT);
- if (rc != 0) {
- printf("%s: unable to map %s memory: error %d\n",
- wsc->sc_wd33c93.sc_dev.dv_xname, what, rc);
- goto fail2;
- }
-
- rc = bus_dmamap_create(wsc->sc_dmat, len, 1, len, 0,
- BUS_DMA_NOWAIT /* | BUS_DMA_ALLOCNOW */, dmamap);
- if (rc != 0) {
- printf("%s: unable to create %s dma map: error %d\n",
- wsc->sc_wd33c93.sc_dev.dv_xname, what, rc);
- goto fail3;
- }
-
- rc = bus_dmamap_load(wsc->sc_dmat, *dmamap, (void *)*va, len, NULL,
- BUS_DMA_NOWAIT);
- if (rc != 0) {
- printf("%s: unable to load %s dma map: error %d\n",
- wsc->sc_wd33c93.sc_dev.dv_xname, what, rc);
- goto fail4;
- }
-
- return 0;
-
-fail4:
- bus_dmamap_destroy(wsc->sc_dmat, *dmamap);
-fail3:
- bus_dmamem_unmap(wsc->sc_dmat, (caddr_t)*va, PAGE_SIZE);
-fail2:
- bus_dmamem_free(wsc->sc_dmat, dmaseg, 1);
-fail1:
- return rc;
-}
diff --git a/sys/arch/mvme68k/dev/wdscreg.h b/sys/arch/mvme68k/dev/wdscreg.h
deleted file mode 100644
index 08f47b9d658..00000000000
--- a/sys/arch/mvme68k/dev/wdscreg.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* $OpenBSD: wdscreg.h,v 1.2 2003/06/02 23:27:50 millert Exp $ */
-
-/*
- * Copyright (c) 1994 Christian E. Hopps
- * Copyright (c) 1982, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)dmareg.h
- */
-#ifndef _MVME68K_DEV_WDSCREG_H_
-#define _MVME68K_DEV_WDSCREG_H_
-
-#define DMAC_CSR_ENABLE (1 << 0) /* Enable the DMAC */
-#define DMAC_CSR_TABLE (1 << 1) /* Select Table Mode */
-#define DMAC_CSR_WRITE (1 << 2) /* Write data from RAM to SCSI */
-#define DMAC_CSR_TBUSERR (1 << 3) /* Bus error during table walk */
-#define DMAC_CSR_DBUSERR (1 << 4) /* Bus error during data xfer */
-#define DMAC_CSR_TSIZE (1 << 5) /* Table addr. not in 32 bits */
-#define DMAC_CSR_8BITS (1 << 6) /* Non-8 bit handshake */
-#define DMAC_CSR_DONE (1 << 7) /* Transfer complete, or error */
-
-#define DMAC_SR_HOLDING 0x0f /* Data holding state */
-#define DMAC_SR_INCREMENT 0xf0 /* Increment value */
-
-#endif
diff --git a/sys/arch/mvme68k/dev/wl.c b/sys/arch/mvme68k/dev/wl.c
deleted file mode 100644
index bfcce5a85c0..00000000000
--- a/sys/arch/mvme68k/dev/wl.c
+++ /dev/null
@@ -1,1518 +0,0 @@
-/* $OpenBSD: wl.c,v 1.26 2013/10/07 17:53:57 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Dale Rahn. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-#include <sys/uio.h>
-#include <sys/systm.h>
-#include <sys/time.h>
-#include <sys/device.h>
-#include <sys/syslog.h>
-
-#include <machine/autoconf.h>
-#include <machine/conf.h>
-#include <machine/cpu.h>
-
-#include <mvme68k/dev/wlreg.h>
-#include <mvme68k/dev/vme.h>
-
-#include "cl.h"
-
-#include "vmes.h"
-
-#define splcl() spltty()
-
-/* min timeout 0xa, what is a good value */
-#define CL_TIMEOUT 0x10
-#define CL_FIFO_MAX 0x10
-#define CL_FIFO_CNT 0xc
-#define CL_RX_TIMEOUT 0x10
-
-#define CL_RXDMAINT 0x82
-#define CL_TXDMAINT 0x42
-#define CL_TXMASK 0x47
-#define CL_RXMASK 0x87
-#define CL_TXINTR 0x02
-#define CL_RXINTR 0x02
-
-#define WLRAMLEN (1 << 16)
-struct clboard {
- union {
- struct clreg clreg;
- volatile char xx[256];
- } chips[2];
- union {
- volatile u_char base;
- volatile char xx[256];
- } sram;
- union {
- volatile u_char val;
- volatile char xx[256];
- } ringstatus;
- union {
- volatile u_char val;
- volatile char xx[256];
- } ringreset;
- union {
- volatile u_char val;
- volatile char xx[256];
- } master;
- union {
- volatile u_char val;
- volatile char xx[256];
- } reset;
-};
-
-
-struct cl_info {
- struct tty *tty;
- u_char cl_swflags;
- u_char cl_softchar;
- u_char cl_speed;
- u_char cl_parstop; /* parity, stop bits. */
- u_char cl_rxmode;
- u_char cl_txmode;
- u_char cl_clen;
- u_char cl_parity;
- u_char transmitting;
- u_long txcnt;
- u_long rxcnt;
-
- volatile void *rx[2];
- volatile void *rxp[2];
- volatile void *tx[2];
- volatile void *txp[2];
-};
-#define CLCD_PORTS_PER_CHIP 4
-#define CL_BUFSIZE 128
-
-struct wlsoftc {
- struct device sc_dev;
- char sc_txintrname[16 + 3];
- char sc_rxintrname[16 + 3];
- char sc_mxintrname[16 + 3];
-
- time_t sc_rotime; /* time of last ring overrun */
- time_t sc_fotime; /* time of last fifo overrun */
-
- u_char sc_memv;
- paddr_t sc_memvme;
- void *sc_memp;
- vaddr_t sc_memkv;
-
- struct clreg *cl_reg;
- struct cl_info sc_cl[CLCD_PORTS_PER_CHIP];
- struct intrhand sc_ih_e;
- struct intrhand sc_ih_m;
- struct intrhand sc_ih_t;
- struct intrhand sc_ih_r;
- u_char sc_vec;
- int sc_flags;
-};
-
-struct {
- u_int speed;
- u_char divisor;
- u_char clock;
- u_char rx_timeout;
-} cl_clocks[] = {
- /* 30.000 MHz */
- { 64000, 0x3a, 0, 0x01 },
- { 56000, 0x42, 0, 0x01 },
- { 38400, 0x61, 0, 0x01 },
- { 19200, 0xc2, 0, 0x01 },
- { 9600, 0x61, 1, 0x02 },
- { 7200, 0x81, 1, 0x04 },
- { 4800, 0xc2, 1, 0x04 },
- { 3600, 0x40, 2, 0x08 },
- { 2400, 0x61, 2, 0x10 },
- { 1200, 0xc2, 2, 0x20 },
- { 600, 0x61, 3, 0x40 },
- { 300, 0xc2, 3, 0x80 },
- { 150, 0x61, 4, 0xa0 },
- { 110, 0x84, 4, 0xff },
- { 50, 0x00, 5, 0xff },
- { 0, 0x00, 0, 0},
-};
-
-/* prototypes */
-u_char cl_clkdiv(int speed);
-u_char cl_clknum(int speed);
-u_char cl_clkrxtimeout(int speed);
-void clstart(struct tty *tp);
-void cl_unblock(struct tty *tp);
-int clccparam(struct wlsoftc *sc, struct termios *par, int channel);
-
-int clparam(struct tty *tp, struct termios *t);
-int cl_intr(struct wlsoftc *sc, int);
-int cl_mintr(struct wlsoftc *sc);
-int cl_txintr(struct wlsoftc *sc);
-int cl_rxintr(struct wlsoftc *sc);
-void cl_overflow(struct wlsoftc *sc, int channel, time_t *ptime, u_char *msg);
-void cl_parity(struct wlsoftc *sc, int channel);
-void cl_frame(struct wlsoftc *sc, int channel);
-void cl_break( struct wlsoftc *sc, int channel);
-int clmctl(dev_t dev, int bits, int how);
-void cl_dumpport(int channel);
-
-int wlprobe(struct device *parent, void *self, void *aux);
-void wlattach(struct device *parent, struct device *self, void *aux);
-
-static void cl_initchannel(struct wlsoftc *sc, int channel);
-static void clputc(struct wlsoftc *sc, int unit, u_char c);
-static u_char clgetc(struct wlsoftc *sc, int *channel);
-static void cloutput(struct tty *tp);
-
-struct cfattach wl_ca = {
- sizeof(struct wlsoftc), wlprobe, wlattach
-};
-
-struct cfdriver wl_cd = {
- NULL, "wl", DV_TTY
-};
-
-#define CLCDBUF 80
-
-#define CL_UNIT(x) (minor(x) >> 2)
-#define CL_CHANNEL(x) (minor(x) & 3)
-#define CL_TTY(x) (minor(x))
-
-extern int cputyp;
-
-struct tty *
-wltty(dev)
- dev_t dev;
-{
- int unit = CL_UNIT(dev);
- int channel;
- struct wlsoftc *sc;
-
- if (unit >= wl_cd.cd_ndevs ||
- (sc = (struct wlsoftc *) wl_cd.cd_devs[unit]) == NULL)
- return (NULL);
- channel = CL_CHANNEL(dev);
- return sc->sc_cl[channel].tty;
-}
-
-int
-wlprobe(parent, self, aux)
- struct device *parent;
- void *self;
- void *aux;
-{
- struct confargs *ca = aux;
- struct wlsoftc *sc = self;
- struct clreg *cl_reg = (struct clreg *)ca->ca_vaddr;
-
- if (ca->ca_vec & 0x03) {
- printf("%s: bad vector\n", sc->sc_dev.dv_xname);
- return (0);
- }
- return (!badvaddr(&cl_reg->cl_gfrcr, 1));
-}
-
-void
-wlattach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- struct wlsoftc *sc = (struct wlsoftc *)self;
- struct confargs *ca = aux;
- struct clboard *clb = (struct clboard *)ca->ca_vaddr;
- void *p;
- int i, j, s;
-
- sc->cl_reg = (struct clreg *)&clb->chips[0].clreg;
- sc->sc_vec = ca->ca_vec;
-
- sc->sc_memv = 0xa5 + 0;
- sc->sc_memvme = ((0xff00 + sc->sc_memv) << 16);
-
- clb->reset.val = 0xff; /* reset card */
- DELAY(1000);
- clb->sram.base = (sc->sc_memvme >> 16) & 0xff;
- DELAY(1000);
- clb->master.val = 0x01; /* enable sram decoder */
- DELAY(1000);
-
- printf(":");
- /*printf(" va=%x sc=%x slot 0x%02x vmes 0x%08x", sc->cl_reg, sc,
- sc->sc_memv, sc->sc_memvme);*/
-
- while (sc->cl_reg->cl_gfrcr == 0x00)
- ;
- sc->cl_reg->cl_ccr = 0x10; /* reset it */
- while (sc->cl_reg->cl_gfrcr == 0x00)
- ;
- if (sc->cl_reg->cl_gfrcr <= 0x10)
- printf(" rev %c", 'A' + sc->cl_reg->cl_gfrcr);
- else
- printf(" rev 0x%02x", sc->cl_reg->cl_gfrcr);
- printf("\n");
-
- /* set up global registers */
- sc->cl_reg->cl_tpr = CL_TIMEOUT;
- sc->cl_reg->cl_rpilr = (ca->ca_ipl << 1) | 1;
- sc->cl_reg->cl_tpilr = (ca->ca_ipl << 1) | 1;
- sc->cl_reg->cl_mpilr = (ca->ca_ipl << 1) | 1;
-
- sc->sc_memkv = vmemap(((struct vmessoftc *)parent)->sc_vme,
- sc->sc_memvme, WLRAMLEN, BUS_VMES);
- sc->sc_memp = (void *)kvtop(sc->sc_memkv);
- if (sc->sc_memkv == 0)
- printf("%s: got no memory", sc->sc_dev.dv_xname);
- else if (badvaddr(sc->sc_memkv, 1))
- printf("%s: cannot tap 0x%08x", sc->sc_dev.dv_xname, sc->sc_memkv);
- else {
- u_char *x = (u_char *)sc->sc_memkv;
-
- /*printf("%s: pa 0x%08x va 0x%08x", sc->sc_dev.dv_xname,
- sc->sc_memp, sc->sc_memkv);*/
- x[0] = 0xaa;
- x[1] = 0x55;
- if (x[0] != 0xaa || x[1] != 0x55)
- printf(" 0x%02x 0x%02x", x[0], x[1]);
- x[0] = 0x55;
- x[1] = 0xaa;
- if (x[0] != 0x55 || x[1] != 0xaa)
- printf(" 0x%02x 0x%02x", x[0], x[1]);
- bzero(x, WLRAMLEN);
- }
-
- /* enable interrupts */
- sc->sc_ih_e.ih_fn = cl_intr;
- sc->sc_ih_e.ih_arg = sc;
- sc->sc_ih_e.ih_ipl = ca->ca_ipl;
- sc->sc_ih_e.ih_wantframe = 0;
-
- sc->sc_ih_m.ih_fn = cl_intr;
- sc->sc_ih_m.ih_arg = sc;
- sc->sc_ih_m.ih_ipl = ca->ca_ipl;
- sc->sc_ih_m.ih_wantframe = 0;
-
- sc->sc_ih_t.ih_fn = cl_intr;
- sc->sc_ih_t.ih_arg = sc;
- sc->sc_ih_t.ih_ipl = ca->ca_ipl;
- sc->sc_ih_t.ih_wantframe = 0;
-
- sc->sc_ih_r.ih_fn = cl_intr;
- sc->sc_ih_r.ih_arg = sc;
- sc->sc_ih_r.ih_ipl = ca->ca_ipl;
- sc->sc_ih_r.ih_wantframe = 0;
-
- snprintf(sc->sc_txintrname, sizeof sc->sc_txintrname,
- "%s_tx", self->dv_xname);
- snprintf(sc->sc_rxintrname, sizeof sc->sc_rxintrname,
- "%s_rx", self->dv_xname);
- snprintf(sc->sc_mxintrname, sizeof sc->sc_mxintrname,
- "%s_mx", self->dv_xname);
-
- vmeintr_establish(ca->ca_vec + 0, &sc->sc_ih_e, sc->sc_rxintrname);
- vmeintr_establish(ca->ca_vec + 1, &sc->sc_ih_m, sc->sc_mxintrname);
- vmeintr_establish(ca->ca_vec + 2, &sc->sc_ih_t, sc->sc_txintrname);
- vmeintr_establish(ca->ca_vec + 3, &sc->sc_ih_r, sc->sc_rxintrname);
-
- p = (void *)sc->sc_memkv;
- s = splhigh();
- for (i = 0; i < CLCD_PORTS_PER_CHIP; i++) {
- for (j = 0; j < 2; j++) {
- sc->sc_cl[i].rx[j] = p;
- sc->sc_cl[i].rxp[j] = (void *)(p - (void *)sc->sc_memkv);
- /*printf("%d:%d rx v %x p %x\n",
- i, j, sc->sc_cl[i].rx[j], sc->sc_cl[i].rxp[j]);*/
- p += CL_BUFSIZE;
- }
- for (j = 0; j < 2; j++) {
- sc->sc_cl[i].tx[j] = p;
- sc->sc_cl[i].txp[j] = (void *)(p - (void *)sc->sc_memkv);
- /*printf("%d:%d tx v %x p %x\n",
- i, j, sc->sc_cl[i].tx[j], sc->sc_cl[i].txp[j]);*/
- p += CL_BUFSIZE;
- }
- cl_initchannel(sc, i);
- }
- splx(s);
-}
-
-static void
-cl_initchannel(sc, channel)
- struct wlsoftc *sc;
- int channel;
-{
- struct clreg *cl_reg = sc->cl_reg;
-
- /* set up option registers */
- cl_reg->cl_car = channel;
- cl_reg->cl_livr = sc->sc_vec;
- cl_reg->cl_ier = 0x00;
- cl_reg->cl_cmr = 0x02;
- cl_reg->cl_cor1 = 0x17;
- cl_reg->cl_cor2 = 0x00;
- cl_reg->cl_cor3 = 0x02;
- cl_reg->cl_cor4 = 0xec;
- cl_reg->cl_cor5 = 0xec;
- cl_reg->cl_cor6 = 0x00;
- cl_reg->cl_cor7 = 0x00;
- cl_reg->cl_schr1 = 0x00;
- cl_reg->cl_schr2 = 0x00;
- cl_reg->cl_schr3 = 0x00;
- cl_reg->cl_schr4 = 0x00;
- cl_reg->cl_scrl = 0x00;
- cl_reg->cl_scrh = 0x00;
- cl_reg->cl_lnxt = 0x00;
- cl_reg->cl_rbpr = 0x40; /* 9600 */
- cl_reg->cl_rcor = 0x01;
- cl_reg->cl_tbpr = 0x40; /* 9600 */
- cl_reg->cl_tcor = 0x01 << 5;
- /* console port should be 0x88 already */
- cl_reg->cl_msvr_rts = 0x00;
- cl_reg->cl_msvr_dtr = 0x00;
- cl_reg->cl_rtprl = CL_RX_TIMEOUT;
- cl_reg->cl_rtprh = 0x00;
- sc->cl_reg->cl_ccr = 0x20;
- while (sc->cl_reg->cl_ccr != 0)
- ;
-}
-
-
-int cldefaultrate = TTYDEF_SPEED;
-
-int clmctl (dev, bits, how)
- dev_t dev;
- int bits;
- int how;
-{
- int s;
- struct wlsoftc *sc;
- /* should only be called with valid device */
- sc = (struct wlsoftc *) wl_cd.cd_devs[CL_UNIT(dev)];
- /*
- printf("mctl: dev %x, bits %x, how %x,\n",dev, bits, how);
- */
- /* settings are currently ignored */
- s = splcl();
- switch (how) {
- case DMSET:
- if( bits & TIOCM_RTS) {
- sc->cl_reg->cl_msvr_rts = 0x01;
- } else {
- sc->cl_reg->cl_msvr_rts = 0x00;
- }
- if( bits & TIOCM_DTR) {
- sc->cl_reg->cl_msvr_dtr = 0x02;
- } else {
- sc->cl_reg->cl_msvr_dtr = 0x00;
- }
- break;
-
- case DMBIC:
- if( bits & TIOCM_RTS) {
- sc->cl_reg->cl_msvr_rts = 0x00;
- }
- if( bits & TIOCM_DTR) {
- sc->cl_reg->cl_msvr_dtr = 0x00;
- }
- break;
-
- case DMBIS:
- if( bits & TIOCM_RTS) {
- sc->cl_reg->cl_msvr_rts = 0x01;
- }
- if( bits & TIOCM_DTR) {
- sc->cl_reg->cl_msvr_dtr = 0x02;
- }
- break;
-
- case DMGET:
- bits = 0;
-
- {
- u_char msvr;
- msvr = sc->cl_reg->cl_msvr_rts;
- if( msvr & 0x80) {
- bits |= TIOCM_DSR;
- }
- if( msvr & 0x40) {
- bits |= TIOCM_CD;
- }
- if( msvr & 0x20) {
- bits |= TIOCM_CTS;
- }
- if( msvr & 0x10) {
- bits |= TIOCM_DTR;
- }
- if( msvr & 0x02) {
- bits |= TIOCM_DTR;
- }
- if( msvr & 0x01) {
- bits |= TIOCM_RTS;
- }
-
- }
- break;
- }
- splx(s);
-#if 0
- bits = 0;
- /* proper defaults? */
- bits |= TIOCM_DTR;
- bits |= TIOCM_RTS;
- bits |= TIOCM_CTS;
- bits |= TIOCM_CD;
- /* bits |= TIOCM_RI; */
- bits |= TIOCM_DSR;
-#endif
-
- /*
- printf("retbits %x\n", bits);
- */
- return(bits);
-}
-
-int
-wlopen(dev, flag, mode, p)
- dev_t dev;
- int flag;
- int mode;
- struct proc *p;
-{
- int s, unit, channel;
- struct cl_info *cl;
- struct wlsoftc *sc;
- struct tty *tp;
-
- unit = CL_UNIT(dev);
- if (unit >= wl_cd.cd_ndevs ||
- (sc = (struct wlsoftc *) wl_cd.cd_devs[unit]) == NULL) {
- return (ENODEV);
- }
- channel = CL_CHANNEL(dev);
- cl = &sc->sc_cl[channel];
- s = splcl();
- if (cl->tty) {
- tp = cl->tty;
- } else {
- tp = cl->tty = ttymalloc(0);
- }
- tp->t_oproc = clstart;
- tp->t_param = clparam;
- tp->t_dev = dev;
-
- if ((tp->t_state & TS_ISOPEN) == 0) {
- tp->t_state |= TS_WOPEN;
- ttychars(tp);
- if (tp->t_ispeed == 0) {
- /*
- * only when cleared do we reset to defaults.
- */
- tp->t_iflag = TTYDEF_IFLAG;
- tp->t_oflag = TTYDEF_OFLAG;
- tp->t_lflag = TTYDEF_LFLAG;
- tp->t_ispeed = tp->t_ospeed = cldefaultrate;
-
- tp->t_cflag = TTYDEF_CFLAG;
- }
- /*
- * do these all the time
- */
- if (cl->cl_swflags & TIOCFLAG_CLOCAL)
- tp->t_cflag |= CLOCAL;
- if (cl->cl_swflags & TIOCFLAG_CRTSCTS)
- tp->t_cflag |= CRTSCTS;
- if (cl->cl_swflags & TIOCFLAG_MDMBUF)
- tp->t_cflag |= MDMBUF;
- clparam(tp, &tp->t_termios);
- ttsetwater(tp);
-
- (void)clmctl(dev, TIOCM_DTR | TIOCM_RTS, DMSET);
- tp->t_state |= TS_CARR_ON;
- {
- u_char save = sc->cl_reg->cl_car;
- sc->cl_reg->cl_car = channel;
- sc->cl_reg->cl_ier = IER_MDM | IER_RXD;
- sc->cl_reg->cl_car = save;
- }
- } else if (tp->t_state & TS_XCLUDE && suser(p, 0) != 0) {
- splx(s);
- return(EBUSY);
- }
-
- splx(s);
- /*
- * Reset the tty pointer, as there could have been a dialout
- * use of the tty with a dialin open waiting.
- */
- tp->t_dev = dev;
- return((*linesw[tp->t_line].l_open)(dev, tp, p));
-}
-
-int clparam(tp, t)
- struct tty *tp;
- struct termios *t;
-{
- int unit, channel;
- struct wlsoftc *sc;
- int s;
- dev_t dev;
-
- dev = tp->t_dev;
- unit = CL_UNIT(dev);
- if (unit >= wl_cd.cd_ndevs ||
- (sc = (struct wlsoftc *) wl_cd.cd_devs[unit]) == NULL) {
- return (ENODEV);
- }
- channel = CL_CHANNEL(dev);
- tp->t_ispeed = t->c_ispeed;
- tp->t_ospeed = t->c_ospeed;
- tp->t_cflag = t->c_cflag;
- clccparam(sc, t, channel);
- s = splcl();
- cl_unblock(tp);
- splx(s);
- return 0;
-}
-
-void cloutput(tp)
- struct tty *tp;
-{
- int cc, s, unit, cnt;
- u_char *tptr;
- int channel;
- struct wlsoftc *sc;
- dev_t dev;
- u_char cl_obuffer[CLCDBUF+1];
-
- dev = tp->t_dev;
- unit = CL_UNIT(dev);
- if (unit >= wl_cd.cd_ndevs ||
- (sc = (struct wlsoftc *) wl_cd.cd_devs[unit]) == NULL) {
- return;
- }
- channel = CL_CHANNEL(dev);
-
- if ((tp->t_state & TS_ISOPEN) == 0)
- return;
-
- s = splcl();
- cc = tp->t_outq.c_cc;
- while (cc > 0) {
-/*XXX*/
- cnt = min(CLCDBUF,cc);
- cnt = q_to_b(&tp->t_outq, cl_obuffer, cnt);
- if (cnt == 0) {
- break;
- }
- for (tptr = cl_obuffer; tptr < &cl_obuffer[cnt]; tptr++) {
- clputc(sc, channel, *tptr);
- }
- cc -= cnt;
- }
- splx(s);
-}
-
-int
-wlclose(dev, flag, mode, p)
- dev_t dev;
- int flag;
- int mode;
- struct proc *p;
-{
- int unit, channel;
- struct tty *tp;
- struct cl_info *cl;
- struct wlsoftc *sc;
- int s;
- unit = CL_UNIT(dev);
- if (unit >= wl_cd.cd_ndevs ||
- (sc = (struct wlsoftc *) wl_cd.cd_devs[unit]) == NULL) {
- return (ENODEV);
- }
- channel = CL_CHANNEL(dev);
- cl = &sc->sc_cl[channel];
- tp = cl->tty;
- (*linesw[tp->t_line].l_close)(tp, flag, p);
-
- s = splcl();
-
- sc->cl_reg->cl_car = channel;
- if((tp->t_cflag & HUPCL) != 0) {
- sc->cl_reg->cl_msvr_rts = 0x00;
- sc->cl_reg->cl_msvr_dtr = 0x00;
- sc->cl_reg->cl_ccr = 0x05;
- sc->cl_reg->cl_ier = 0x00;
- }
-
- splx(s);
- ttyclose(tp);
-
-#if 0
- cl->tty = NULL;
-#endif
- return (0);
-}
-
-int
-wlread(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- int unit, channel;
- struct tty *tp;
- struct cl_info *cl;
- struct wlsoftc *sc;
- unit = CL_UNIT(dev);
- if (unit >= wl_cd.cd_ndevs ||
- (sc = (struct wlsoftc *) wl_cd.cd_devs[unit]) == NULL) {
- return (ENODEV);
- }
- channel = CL_CHANNEL(dev);
- cl = &sc->sc_cl[channel];
- tp = cl->tty;
- if (!tp)
- return ENXIO;
- return((*linesw[tp->t_line].l_read)(tp, uio, flag));
-}
-int
-wlwrite(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- int unit, channel;
- struct tty *tp;
- struct cl_info *cl;
- struct wlsoftc *sc;
- unit = CL_UNIT(dev);
- if (unit >= wl_cd.cd_ndevs ||
- (sc = (struct wlsoftc *) wl_cd.cd_devs[unit]) == NULL) {
- return (ENODEV);
- }
- channel = CL_CHANNEL(dev);
- cl = &sc->sc_cl[channel];
- tp = cl->tty;
- if (!tp)
- return ENXIO;
- return((*linesw[tp->t_line].l_write)(tp, uio, flag));
-}
-int
-wlioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- int error;
- int unit, channel;
- struct tty *tp;
- struct cl_info *cl;
- struct wlsoftc *sc;
- unit = CL_UNIT(dev);
- if (unit >= wl_cd.cd_ndevs ||
- (sc = (struct wlsoftc *) wl_cd.cd_devs[unit]) == NULL) {
- return (ENODEV);
- }
- channel = CL_CHANNEL(dev);
- cl = &sc->sc_cl[channel];
- tp = cl->tty;
- if (!tp)
- return ENXIO;
-
- error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
- if (error >= 0)
- return(error);
-
- error = ttioctl(tp, cmd, data, flag, p);
- if (error >= 0)
- return(error);
-
- switch (cmd) {
- case TIOCSBRK:
- /* */
- break;
-
- case TIOCCBRK:
- /* */
- break;
-
- case TIOCSDTR:
- (void) clmctl(dev, TIOCM_DTR | TIOCM_RTS, DMBIS);
- break;
-
- case TIOCCDTR:
- (void) clmctl(dev, TIOCM_DTR | TIOCM_RTS, DMBIC);
- break;
-
- case TIOCMSET:
- (void) clmctl(dev, *(int *) data, DMSET);
- break;
-
- case TIOCMBIS:
- (void) clmctl(dev, *(int *) data, DMBIS);
- break;
-
- case TIOCMBIC:
- (void) clmctl(dev, *(int *) data, DMBIC);
- break;
-
- case TIOCMGET:
- *(int *)data = clmctl(dev, 0, DMGET);
- break;
- case TIOCGFLAGS:
- *(int *)data = cl->cl_swflags;
- break;
- case TIOCSFLAGS:
- error = suser(p, 0);
- if (error != 0)
- return(EPERM);
-
- cl->cl_swflags = *(int *)data;
- cl->cl_swflags &= /* only allow valid flags */
- (TIOCFLAG_SOFTCAR | TIOCFLAG_CLOCAL | TIOCFLAG_CRTSCTS);
- break;
- default:
- return(ENOTTY);
- }
-
- return 0;
-}
-int
-wlstop(tp, flag)
- struct tty *tp;
- int flag;
-{
- int s;
-
- s = splcl();
- if (tp->t_state & TS_BUSY) {
- if ((tp->t_state & TS_TTSTOP) == 0)
- tp->t_state |= TS_FLUSH;
- }
- splx(s);
- return 0;
-}
-
-static u_char
-clgetc(sc, channel)
- struct wlsoftc *sc;
- int *channel;
-{
- struct clreg *cl_reg;
- u_char reoir, licr, isrl, fifo_cnt, data;
-
- cl_reg = sc->cl_reg;
- /* if no receive interrupt pending wait */
- if ((cl_reg->cl_rir & RIR_REN) == 0) {
- return 0;
- }
- /* XXX do we need to suck the entire FIFO contents? */
- licr = cl_reg->cl_licr;
- *channel = (licr >> 2) & 0x3;
- /* is the interrupt for us (port 0) */
- /* the character is for us yea. */
- isrl = cl_reg->cl_risrl;
-#if 0
- if (isrl & 0x01) {
- status = BREAK;
- }
- if (isrl & 0x02) {
- status = FRAME;
- }
- if (isrl & 0x04) {
- status = PARITY;
- }
- if (isrl & 0x08) {
- status = OVERFLOW;
- }
- /* we do not have special characters ;-) */
-#endif
- fifo_cnt = cl_reg->cl_rfoc;
- if (fifo_cnt > 0) {
- data = cl_reg->cl_rdr;
- cl_reg->cl_teoir = 0x00;
- } else {
- data = 0;
- cl_reg->cl_teoir = 0x08;
- }
- return data;
-}
-
-int
-clccparam(sc, par, channel)
- struct wlsoftc *sc;
- struct termios *par;
- int channel;
-{
- u_int divisor, clk, clen;
- int s, imask, ints;
-
- s = splcl();
- sc->cl_reg->cl_car = channel;
- if (par->c_ospeed == 0) {
- /* disconnect, drop RTS DTR stop receiver */
- sc->cl_reg->cl_msvr_rts = 0x00;
- sc->cl_reg->cl_msvr_dtr = 0x00;
- sc->cl_reg->cl_ccr = 0x05;
- splx(s);
- return (0xff);
- }
-
- sc->cl_reg->cl_msvr_rts = 0x03;
- sc->cl_reg->cl_msvr_dtr = 0x03;
-
- divisor = cl_clkdiv(par->c_ospeed);
- clk = cl_clknum(par->c_ospeed);
- sc->cl_reg->cl_tbpr = divisor;
- sc->cl_reg->cl_tcor = clk << 5;
- divisor = cl_clkdiv(par->c_ispeed);
- clk = cl_clknum(par->c_ispeed);
- sc->cl_reg->cl_rbpr = divisor;
- sc->cl_reg->cl_rcor = clk;
- sc->cl_reg->cl_rtprl = cl_clkrxtimeout(par->c_ispeed);
- sc->cl_reg->cl_rtprh = 0x00;
-
- switch (par->c_cflag & CSIZE) {
- case CS5:
- clen = 4; /* this is the mask for the chip. */
- imask = 0x1F;
- break;
- case CS6:
- clen = 5;
- imask = 0x3F;
- break;
- case CS7:
- clen = 6;
- imask = 0x7F;
- break;
- default:
- clen = 7;
- imask = 0xFF;
- }
- sc->cl_reg->cl_cor3 = par->c_cflag & PARENB ? 4 : 2;
-
- {
- u_char cor1;
- if (par->c_cflag & PARENB) {
- if (par->c_cflag & PARODD) {
- cor1 = 0xE0 | clen ; /* odd */
- } else {
- cor1 = 0x40 | clen ; /* even */
- }
- } else {
- cor1 = 0x10 | clen; /* ignore parity */
- }
- if (sc->cl_reg->cl_cor1 != cor1) {
- sc->cl_reg->cl_cor1 = cor1;
- sc->cl_reg->cl_ccr = 0x20;
- while (sc->cl_reg->cl_ccr != 0)
- ;
- }
- }
-
- if ((par->c_cflag & CREAD) == 0) {
- sc->cl_reg->cl_ccr = 0x08;
- } else {
- sc->cl_reg->cl_ccr = 0x0a;
- }
- while (sc->cl_reg->cl_ccr != 0)
- ;
-
- ints = 0;
-#define SCC_DSR 0x80
-#define SCC_DCD 0x40
-#define SCC_CTS 0x20
- if ((par->c_cflag & CLOCAL) == 0) {
- ints |= SCC_DCD;
- }
- if ((par->c_cflag & CCTS_OFLOW) != 0) {
- ints |= SCC_CTS;
- }
- if ((par->c_cflag & CRTSCTS) != 0) {
- ints |= SCC_CTS;
- }
-#ifdef DONT_LET_HARDWARE
- if ((par->c_cflag & CCTS_IFLOW) != 0) {
- ints |= SCC_DSR;
- }
-#endif
- sc->cl_reg->cl_cor4 = ints | CL_FIFO_CNT;
- sc->cl_reg->cl_cor5 = ints | CL_FIFO_CNT;
-
- return imask;
-}
-
-static int clknum = 0;
-
-u_char
-cl_clkdiv(speed)
- int speed;
-{
- int i = 0;
-
- if (cl_clocks[clknum].speed == speed)
- return cl_clocks[clknum].divisor;
-
- for (i = 0; cl_clocks[i].speed != 0; i++) {
- if (cl_clocks[i].speed == speed) {
- clknum = i;
- return cl_clocks[clknum].divisor;
- }
- }
-
- /* return some sane value if unknown speed */
- clknum = 4;
- return cl_clocks[clknum].divisor;
-}
-u_char
-cl_clknum(speed)
- int speed;
-{
- int found = 0;
- int i = 0;
- if (cl_clocks[clknum].speed == speed) {
- return cl_clocks[clknum].clock;
- }
- for (i = 0; found != 0 && cl_clocks[i].speed != 0; i++) {
- if (cl_clocks[clknum].speed == speed) {
- clknum = i;
- return cl_clocks[clknum].clock;
- }
- }
- /* return some sane value if unknown speed */
- return cl_clocks[4].clock;
-}
-u_char
-cl_clkrxtimeout(speed)
- int speed;
-{
- int i = 0;
- if (cl_clocks[clknum].speed == speed) {
- return cl_clocks[clknum].rx_timeout;
- }
- for (i = 0; cl_clocks[i].speed != 0; i++) {
- if (cl_clocks[i].speed == speed) {
- clknum = i;
- return cl_clocks[clknum].rx_timeout;
- }
- }
- /* return some sane value if unknown speed */
- return cl_clocks[4].rx_timeout;
-}
-void
-cl_unblock(tp)
- struct tty *tp;
-{
- tp->t_state &= ~TS_FLUSH;
- if (tp->t_outq.c_cc != 0)
- clstart(tp);
-}
-void
-clstart(tp)
- struct tty *tp;
-{
- dev_t dev;
- u_char cbuf;
- struct wlsoftc *sc;
- int channel, unit, s, cnt;
-
- dev = tp->t_dev;
- channel = CL_CHANNEL(dev);
- unit = CL_UNIT(dev);
- if (unit >= wl_cd.cd_ndevs ||
- (sc = (struct wlsoftc *) wl_cd.cd_devs[unit]) == NULL) {
- return;
- }
-
- if ((tp->t_state & TS_ISOPEN) == 0)
- return;
-
- s = splcl();
- if ((tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP | TS_FLUSH)) == 0) {
- tp->t_state |= TS_BUSY;
- sc->cl_reg->cl_car = channel;
- sc->cl_reg->cl_ier = sc->cl_reg->cl_ier | IER_TXMPTY | IER_TXD;
-#if 0
- zscnputc(0, 'S');
-#endif
- }
- splx(s);
-}
-
-int
-cl_intr(sc, vec)
- struct wlsoftc *sc;
- int vec;
-{
- u_char livr = sc->cl_reg->cl_livr;
- u_char stk = sc->cl_reg->cl_stk;
- int i = 0;
-
- stk = ((stk & 0x80) >> 6) | (stk & 0x01);
-#if 1
- zscnputc(0, '[');
- zscnputc(0, '0' + vec - 0x70);
- zscnputc(0, '0' + livr - 0x70);
- zscnputc(0, '0' + stk);
- zscnputc(0, ']');
-#endif
-
- switch (stk & 3) {
- case 0:
-#if 0
- i += cl_rxintr(sc);
- i += cl_mintr(sc);
- i += cl_txintr(sc);
-#else
- i += cl_rxintr(sc);
-#endif
- break;
- case 1:
- i += cl_mintr(sc);
- break;
- case 2:
- i += cl_txintr(sc);
- break;
- case 3:
- i += cl_rxintr(sc);
- break;
- }
- return (i);
-}
-
-int
-cl_mintr(sc)
- struct wlsoftc *sc;
-{
- u_char mir, misr, msvr;
- int channel;
- struct tty *tp;
-
- mir = sc->cl_reg->cl_mir;
- if((mir & MIR_MACT) == 0)
- return 0;
- zscnputc(0, 'M');
-
- misr = sc->cl_reg->cl_misr;
- msvr = sc->cl_reg->cl_msvr_rts;
- channel = mir & MIR_MCM_M;
-
- printf("stk 0x%x mir 0x%x chan 0x%x\n",
- sc->cl_reg->cl_stk, mir, channel);
-
- if (misr & MISR_TIMER1) {
- /* timers are not currently used?? */
- log(LOG_WARNING, "cl_mintr: channel %x timer 1 unexpected\n",channel);
- }
- if (misr & MISR_TIMER2) {
- /* timers are not currently used?? */
- log(LOG_WARNING, "cl_mintr: channel %x timer 2 unexpected\n",channel);
- }
- if (misr & MISR_CTSCHG) {
- log(LOG_WARNING, "cl_mintr: channel %x cts %x\n",channel,
- ((msvr & 0x20) != 0x0));
- }
- if (misr & MISR_CDCHG) {
- struct tty *tp = sc->sc_cl[channel].tty;
- log(LOG_WARNING, "cl_mintr: channel %x cd %x\n",channel,
- ((msvr & 0x40) != 0x0));
- (*linesw[tp->t_line].l_modem)(tp, ((msvr & 0x40) != 0x0) );
- }
- if (misr & MISR_DSRCHG) {
- log(LOG_WARNING, "cl_mintr: channel %x dsr %x\n",channel,
- ((msvr & 0x80) != 0x0));
- }
- sc->cl_reg->cl_meoir = 0x00;
- return 1;
-}
-
-int
-cl_txintr(sc)
- struct wlsoftc *sc;
-{
- static int empty = 0;
- u_char tir, cmr, teoir, tisr, tftc;
- int chan;
- struct tty *tp;
- int cnt;
- u_char buffer[CL_FIFO_MAX +1];
- u_char *tptr;
- u_char dmabsts;
- int nbuf, busy, resid;
- void *pbuffer;
-
- tir = sc->cl_reg->cl_tir;
- if((tir & (TIR_TEN|TIR_TACT)) == 0)
- return 0;
-#if 0
- zscnputc(0, 'T');
-#endif
-
- cmr = sc->cl_reg->cl_cmr;
- chan = tir & TIR_TCN_M;
- tisr = sc->cl_reg->cl_tisr;
- tftc = sc->cl_reg->cl_tftc;
-
- printf("stk 0x%x tir 0x%x chan 0x%x cmr 0x%x tisr 0x%x tftc 0x%x\n",
- sc->cl_reg->cl_stk, tir, chan, cmr, tisr, tftc);
-
- sc->sc_cl[chan].txcnt++;
- tp = sc->sc_cl[chan].tty;
-
- if (tp == NULL || (tp->t_state & TS_ISOPEN) == 0) {
- sc->cl_reg->cl_ier = sc->cl_reg->cl_ier & ~(IER_TXMPTY|IER_TXD);
- sc->cl_reg->cl_teoir = TEOIR_NOTRANSF;
- return 1;
- }
-
- switch (cmr & CL_TXMASK) {
- case CL_TXINTR:
- cnt = min((int)tftc, tp->t_outq.c_cc);
- if (cnt != 0) {
- /*printf("s%d ", cnt);*/
- cnt = q_to_b(&tp->t_outq, buffer, cnt);
- /*printf("%d:", cnt);*/
- empty = 0;
- for (tptr = buffer; tptr < &buffer[cnt]; tptr++) {
- /*printf("%c", *tptr);*/
- sc->cl_reg->cl_tdr = *tptr;
- }
- /*printf("\n", cnt);*/
- teoir = 0;
- } else {
- if (empty > 5 && ((empty % 20000 )== 0))
- log(LOG_WARNING, "cl_txintr empty intr %d chan %d\n",
- empty, chan);
- empty++;
- teoir = TEOIR_NOTRANSF;
- if (tp->t_state & TS_BUSY) {
- tp->t_state &= ~(TS_BUSY | TS_FLUSH);
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t) &tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- }
- sc->cl_reg->cl_ier = sc->cl_reg->cl_ier & ~(IER_TXMPTY|IER_TXD);
- }
- break;
- default:
- log(LOG_WARNING, "cl_txintr unknown mode %x\n", cmr);
- /* we probably will go to hell quickly now */
- teoir = TEOIR_NOTRANSF;
- break;
- }
- sc->cl_reg->cl_teoir = teoir;
- return (1);
-}
-
-int
-cl_rxintr(sc)
- struct wlsoftc *sc;
-{
- u_char rir, chan, cmr, risrl;
- u_char buffer[CL_FIFO_MAX +1];
- u_char reoir = REOIR_NOTRANSF, fifocnt, c;
- struct tty *tp;
- int i;
-
- rir = sc->cl_reg->cl_rir;
- if((rir & RIR_RACT) == 0)
- return 0;
-#if 0
- zscnputc(0, 'R');
-#endif
-
- cmr = sc->cl_reg->cl_cmr;
- risrl = sc->cl_reg->cl_risrl;
- chan = rir & RIR_RCN_M;
-
- /*printf("stk 0x%x rir 0x%x chan 0x%x cmr 0x%x risrl 0x%x\n",
- sc->cl_reg->cl_stk, rir, chan, cmr, risrl);*/
-
- sc->sc_cl[chan].rxcnt++;
-
- if (risrl & RISRL_TIMEOUT) {
- reoir = REOIR_NOTRANSF;
- } else if (risrl & RISRL_OE) {
- cl_overflow(sc, chan, &sc->sc_fotime, "fifo");
- reoir = REOIR_NOTRANSF;
- } else if (risrl & RISRL_PE) {
- cl_parity(sc, chan);
- reoir = REOIR_NOTRANSF;
- } else if (risrl & RISRL_FE) {
- cl_frame(sc, chan);
- reoir = REOIR_NOTRANSF;
- } else if (risrl & RISRL_BREAK) {
- cl_break(sc, chan);
- reoir = REOIR_NOTRANSF;
- } else {
- switch (cmr & CL_RXMASK) {
- case CL_RXINTR:
- fifocnt = sc->cl_reg->cl_rfoc;
- tp = sc->sc_cl[chan].tty;
- for (i = 0; i < fifocnt; i++)
- buffer[i] = sc->cl_reg->cl_rdr;
- if (NULL == tp) {
- /*
- * if the channel is not configured,
- * dont send characters upstream.
- * also fix problem with NULL dereference
- */
- reoir = 0;
- break;
- }
-
- sc->cl_reg->cl_reoir = reoir;
- for (i = 0; i < fifocnt; i++) {
- u_char c = buffer[i];
-
- /* does any restricitions exist on spl for this call */
- (*linesw[tp->t_line].l_rint)(c, tp);
- reoir = 0;
- }
- break;
- default:
- log(LOG_WARNING, "cl_rxintr unknown mode %x\n", cmr);
- /* we probably will go to hell quickly now */
- reoir = REOIR_NOTRANSF;
- break;
- }
- }
- sc->cl_reg->cl_reoir = reoir;
- return (1);
-}
-
-void
-cl_overflow (sc, channel, ptime, msg)
-struct wlsoftc *sc;
-int channel;
-time_t *ptime;
-u_char *msg;
-{
-/*
- if (*ptime != time_second) {
-*/
- {
-/*
- *ptime = time_second;
-*/
- log(LOG_WARNING, "%s%d[%d]: %s overrun\n", wl_cd.cd_name,
- 0 /* fix */, channel, msg);
- }
-}
-
-void
-cl_parity (sc, channel)
- struct wlsoftc *sc;
- int channel;
-{
- log(LOG_WARNING, "%s%d[%d]: parity error\n", wl_cd.cd_name, 0, channel);
-}
-
-void
-cl_frame (sc, channel)
- struct wlsoftc *sc;
- int channel;
-{
- log(LOG_WARNING, "%s%d[%d]: frame error\n", wl_cd.cd_name, 0, channel);
-}
-
-void
-cl_break (sc, channel)
- struct wlsoftc *sc;
- int channel;
-{
- log(LOG_WARNING, "%s%d[%d]: break detected\n", wl_cd.cd_name, 0, channel);
-}
-
-void
-cl_dumpport0()
-{
- cl_dumpport(0);
-}
-
-void
-cl_dumpport1()
-{
- cl_dumpport(1);
-}
-
-void
-cl_dumpport2()
-{
- cl_dumpport(2);
-}
-
-void
-cl_dumpport3()
-{
- cl_dumpport(3);
-}
-
-void
-cl_dumpport(channel)
- int channel;
-{
- u_char livr, cmr, cor1, cor2, cor3, cor4, cor5, cor6, cor7,
- schr1, schr2, schr3, schr4, scrl, scrh, lnxt,
- rbpr, rcor, tbpr, tcor, rpilr, rir, tpr, ier, ccr,
- dmabsts, arbsts, brbsts, atbsts, btbsts,
- csr, rts, dtr, rtprl, rtprh;
- volatile void * parbadru, *parbadrl, *parbsts, *parbcnt;
- u_short rcbadru, rcbadrl, arbadru, arbadrl, arbcnt,
- brbadru, brbadrl, brbcnt;
- u_short tcbadru, tcbadrl, atbadru, atbadrl, atbcnt,
- btbadru, btbadrl, btbcnt;
- struct wlsoftc *sc;
-
- struct clreg *cl_reg;
- int s;
-
- sc = (struct wlsoftc *) wl_cd.cd_devs[0];
- cl_reg = sc->cl_reg;
-
- s = splcl();
- cl_reg->cl_car = (u_char) channel;
- livr = cl_reg->cl_livr;
- cmr = cl_reg->cl_cmr;
- cor1 = cl_reg->cl_cor1;
- cor2 = cl_reg->cl_cor2;
- cor3 = cl_reg->cl_cor3;
- cor4 = cl_reg->cl_cor4;
- cor5 = cl_reg->cl_cor5;
- cor6 = cl_reg->cl_cor6;
- cor7 = cl_reg->cl_cor7;
- schr1 = cl_reg->cl_schr1;
- schr2 = cl_reg->cl_schr2;
- schr3 = cl_reg->cl_schr3;
- schr4 = cl_reg->cl_schr4;
- scrl = cl_reg->cl_scrl;
- scrh = cl_reg->cl_scrh;
- lnxt = cl_reg->cl_lnxt;
- rbpr = cl_reg->cl_rbpr;
- rcor = cl_reg->cl_rcor;
- tbpr = cl_reg->cl_tbpr;
- rpilr = cl_reg->cl_rpilr;
- ier = cl_reg->cl_ier;
- ccr = cl_reg->cl_ccr;
- tcor = cl_reg->cl_tcor;
- csr = cl_reg->cl_csr;
- tpr = cl_reg->cl_tpr;
- rts = cl_reg->cl_msvr_rts;
- dtr = cl_reg->cl_msvr_dtr;
- rtprl = cl_reg->cl_rtprl;
- rtprh = cl_reg->cl_rtprh;
- dmabsts = cl_reg->cl_dmabsts;
- tcbadru = cl_reg->cl_tcbadru;
- tcbadrl = cl_reg->cl_tcbadrl;
- rcbadru = cl_reg->cl_rcbadru;
- rcbadrl = cl_reg->cl_rcbadrl;
-
- parbadru = &(cl_reg->cl_arbadru);
- parbadrl = &(cl_reg->cl_arbadrl);
- parbcnt = &(cl_reg->cl_arbcnt);
- parbsts = &(cl_reg->cl_arbsts);
-
- arbadru = cl_reg->cl_arbadru;
- arbadrl = cl_reg->cl_arbadrl;
- arbcnt = cl_reg->cl_arbcnt;
- arbsts = cl_reg->cl_arbsts;
-
- brbadru = cl_reg->cl_brbadru;
- brbadrl = cl_reg->cl_brbadrl;
- brbcnt = cl_reg->cl_brbcnt;
- brbsts = cl_reg->cl_brbsts;
-
- atbadru = cl_reg->cl_atbadru;
- atbadrl = cl_reg->cl_atbadrl;
- atbcnt = cl_reg->cl_atbcnt;
- atbsts = cl_reg->cl_atbsts;
-
- btbadru = cl_reg->cl_btbadru;
- btbadrl = cl_reg->cl_btbadrl;
- btbcnt = cl_reg->cl_btbcnt;
- btbsts = cl_reg->cl_btbsts;
-
- splx(s);
-
- printf("{ port %x livr %x cmr %x\n",
- channel,livr, cmr);
- printf("cor1 %x cor2 %x cor3 %x cor4 %x cor5 %x cor6 %x cor7 %x\n",
- cor1, cor2, cor3, cor4, cor5, cor6, cor7);
- printf("schr1 %x schr2 %x schr3 %x schr4 %x\n",
- schr1, schr2, schr3, schr4);
- printf("scrl %x scrh %x lnxt %x\n",
- scrl, scrh, lnxt);
- printf("rbpr %x rcor %x tbpr %x tcor %x\n",
- rbpr, rcor, tbpr, tcor);
- printf("rpilr %x rir %x ier %x ccr %x\n",
- rpilr, rir, ier, ccr);
- printf("tpr %x csr %x rts %x dtr %x\n",
- tpr, csr, rts, dtr);
- printf("rtprl %x rtprh %x\n",
- rtprl, rtprh);
- printf("rxcnt %x txcnt %x\n",
- sc->sc_cl[channel].rxcnt, sc->sc_cl[channel].txcnt);
- printf("dmabsts %x, tcbadru %x, tcbadrl %x, rcbadru %x, rcbadrl %x,\n",
- dmabsts, tcbadru, tcbadrl, rcbadru, rcbadrl );
- printf("parbadru %x, parbadrl %x, parbcnt %x, parbsts %x\n",
- parbadru, parbadrl, parbcnt, parbsts);
- printf("arbadru %x, arbadrl %x, arbcnt %x, arbsts %x\n",
- arbadru, arbadrl, arbcnt, arbsts);
- printf("brbadru %x, brbadrl %x, brbcnt %x, brbsts %x\n",
- brbadru, brbadrl, brbcnt, brbsts);
- printf("atbadru %x, atbadrl %x, atbcnt %x, atbsts %x\n",
- atbadru, atbadrl, atbcnt, atbsts);
- printf("btbadru %x, btbadrl %x, btbcnt %x, btbsts %x\n",
- btbadru, btbadrl, btbcnt, btbsts);
- printf("}\n");
-}
-
-static void
-clputc(sc, unit, c)
- struct wlsoftc *sc;
- int unit;
- u_char c;
-{
- int s;
- u_char schar;
- u_char oldchannel;
- struct clreg *cl_reg;
- cl_reg = sc->cl_reg;
-
- s = splhigh();
- oldchannel = cl_reg->cl_car;
- cl_reg->cl_car = unit;
- if (cl_reg->cl_tftc > 0) {
- cl_reg->cl_tdr = c;
- }
- cl_reg->cl_car = oldchannel;
- splx(s);
-}
diff --git a/sys/arch/mvme68k/dev/wlreg.h b/sys/arch/mvme68k/dev/wlreg.h
deleted file mode 100644
index 8d6bb88fd26..00000000000
--- a/sys/arch/mvme68k/dev/wlreg.h
+++ /dev/null
@@ -1,222 +0,0 @@
-/* $OpenBSD: wlreg.h,v 1.3 2003/06/04 16:36:14 deraadt Exp $ */
-
-/*
- * Copyright (c) 1995 Dale Rahn. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-struct clreg {
- volatile u_char anon1[0x7];
- volatile u_char cl_cor7; /* 0x07 */
- volatile u_char anon2[0x1];
- volatile u_char cl_livr; /* 0x09 */
- volatile u_char anon3[0x6];
- volatile u_char cl_cor1; /* 0x10 */
- volatile u_char cl_ier; /* 0x11 */
- volatile u_char cl_stcr; /* 0x12 */
- volatile u_char cl_ccr; /* 0x13 */
- volatile u_char cl_cor5; /* 0x14 */
- volatile u_char cl_cor4; /* 0x15 */
- volatile u_char cl_cor3; /* 0x16 */
- volatile u_char cl_cor2; /* 0x17 */
- volatile u_char cl_cor6; /* 0x18 */
- volatile u_char cl_dmabsts; /* 0x19 */
- volatile u_char cl_csr; /* 0x1a */
- volatile u_char cl_cmr; /* 0x1b */
- volatile u_char cl_schr4; /* 0x1c */
- volatile u_char cl_schr3; /* 0x1d */
- volatile u_char cl_schr2; /* 0x1e */
- volatile u_char cl_schr1; /* 0x1f */
- volatile u_char anon5[0x2];
- volatile u_char cl_scrh; /* 0x22 */
- volatile u_char cl_scrl; /* 0x23 */
-#define cl_rtpr rtpr.rtpr_rtpr
-#define cl_rtprh rtpr.hl.rtpr_rtprh
-#define cl_rtprl rtpr.hl.rtpr_rtprl
- union {
- volatile u_short rtpr_rtpr; /* 0x24 */
- struct {
- volatile u_char rtpr_rtprh; /* 0x24 */
- volatile u_char rtpr_rtprl; /* 0x25 */
- } hl;
- } rtpr;
- volatile u_char cl_licr; /* 0x26 */
- volatile u_char anon6[0x7];
- volatile u_char cl_lnxt; /* 0x2e */
- volatile u_char anon7[0x1];
- volatile u_char cl_rfoc; /* 0x30 */
- volatile u_char anon8[0x7];
- volatile u_short cl_tcbadru; /* 0x38 */
- volatile u_short cl_tcbadrl; /* 0x3a */
- volatile u_short cl_rcbadru; /* 0x3c */
- volatile u_short cl_rcbadrl; /* 0x3e */
- volatile u_short cl_arbadru; /* 0x40 */
- volatile u_short cl_arbadrl; /* 0x42 */
- volatile u_short cl_brbadru; /* 0x44 */
- volatile u_short cl_brbadrl; /* 0x46 */
- volatile u_short cl_brbcnt; /* 0x48 */
- volatile u_short cl_arbcnt; /* 0x4a */
- volatile u_char anoni[0x2];
- volatile u_char cl_brbsts; /* 0x4e */
- volatile u_char cl_arbsts; /* 0x4f */
-#define cl_atbadr atbadr.atbadr
-#define cl_atbadru atbadr.hl.atbadru
-#define cl_atbadrl atbadr.hl.atbadrl
- union {
- struct {
- volatile u_short atbadru; /* 0x50 */
- volatile u_short atbadrl; /* 0x52 */
- } hl;
- volatile u_long atbadr; /* 0x50 */
- } atbadr;
-#define cl_btbadr btbadr.btbadr
-#define cl_btbadru btbadr.hl.btbadru
-#define cl_btbadrl btbadr.hl.btbadrl
- union {
- struct {
- volatile u_short btbadru; /* 0x54 */
- volatile u_short btbadrl; /* 0x56 */
- } hl;
- volatile u_long btbadr; /* 0x54 */
- } btbadr;
- volatile u_short cl_btbcnt; /* 0x58 */
- volatile u_short cl_atbcnt; /* 0x5a */
- volatile u_char anono[0x2];
- volatile u_char cl_btbsts; /* 0x5e */
- volatile u_char cl_atbsts; /* 0x5f */
- volatile u_char anonp[0x20];
- volatile u_char cl_tftc; /* 0x80 */
- volatile u_char cl_gfrcr; /* 0x81 */
- volatile u_char anonq[0x2];
- volatile u_char cl_reoir; /* 0x84 */
- volatile u_char cl_teoir; /* 0x85 */
- volatile u_char cl_meoir; /* 0x86 */
- volatile u_char anonr[0x1];
-#define cl_risr risr.risr_risr
-#define cl_risrl risr.hl.risr_risrl
-#define cl_risrh risr.hl.risr_risrh
- union {
- volatile u_short risr_risr; /* 0x88 */
- struct {
- volatile u_char risr_risrh; /* 0x88 */
- volatile u_char risr_risrl; /* 0x89 */
- } hl;
- } risr;
- volatile u_char cl_tisr; /* 0x8a */
- volatile u_char cl_misr; /* 0x8b */
- volatile u_char anons[0x2];
- volatile u_char cl_bercnt; /* 0x8e */
- volatile u_char anont[0x31];
- volatile u_char cl_tcor; /* 0xc0 */
- volatile u_char anonu[0x2];
- volatile u_char cl_tbpr; /* 0xc3 */
- volatile u_char anonv[0x4];
- volatile u_char cl_rcor; /* 0xc8 */
- volatile u_char anonw[0x2];
- volatile u_char cl_rbpr; /* 0xcb */
- volatile u_char anonx[0xa];
- volatile u_char cl_cpsr; /* 0xd6 */
- volatile u_char anony[0x3];
- volatile u_char cl_tpr; /* 0xda */
- volatile u_char anonz[0x3];
- volatile u_char cl_msvr_rts; /* 0xde */
- volatile u_char cl_msvr_dtr; /* 0xdf */
- volatile u_char cl_tpilr; /* 0xe0 */
- volatile u_char cl_rpilr; /* 0xe1 */
- volatile u_char cl_stk; /* 0xe2 */
- volatile u_char cl_mpilr; /* 0xe3 */
- volatile u_char anonA[0x8];
- volatile u_char cl_tir; /* 0xec */
- volatile u_char cl_rir; /* 0xed */
- volatile u_char cl_car; /* 0xee */
- volatile u_char cl_mir; /* 0xef */
- volatile u_char anonB[0x6];
- volatile u_char cl_dmr; /* 0xf6 */
- volatile u_char anonC[0x1];
-#define cl_rdr cl_tdr
- volatile u_char cl_tdr; /* 0xf8 */
- volatile u_char anonD[7];
-};
-
-#define TIR_TEN 0x80 /* irq enable */
-#define TIR_TACT 0x40 /* irq active */
-#define TIR_TEOI 0x20
-#define TIR_TVCT_M 0x0c /* vector (mask) */
-#define TIR_TCN_M 0x03 /* channel number (mask) */
-
-#define TEOIR_TERMBUF 0x80
-#define TEOIR_EOF 0x40
-#define TEOIR_SETTM2 0x20
-#define TEOIR_SETTM1 0x10
-#define TEOIR_NOTRANSF 0x08
-
-#define REOIR_TERMBUFF 0x80
-#define REOIR_DISCEXC 0x40
-#define REOIR_SETTM2 0x20
-#define REOIR_SETTM1 0x10
-#define REOIR_NOTRANSF 0x08
-#define REOIR_GAP_M 0x07
-
-#define RISRH_BERR 0x80
-#define RISRH_EOF 0x40
-#define RISRH_EOB 0x20
-#define RISRH_BA_BB 0x08
-
-#define RISRL_TIMEOUT 0x80
-#define RISRL_SCDET_M 0x70
-#define RISRL_OE 0x08
-#define RISRL_PE 0x04
-#define RISRL_FE 0x02
-#define RISRL_BREAK 0x01
-
-#define RIR_REN 0x80
-#define RIR_RACT 0x40
-#define RIR_REOI 0x20
-#define RIR_RCVT_M 0x0c
-#define RIR_RCN_M 0x03
-
-#define IER_MDM 0x80
-#define IER_RET 0x20
-#define IER_RXD 0x08
-#define IER_TIMER 0x04
-#define IER_TXMPTY 0x02
-#define IER_TXD 0x01
-
-#define MIR_MER 0x80
-#define MIR_MACT 0x40
-#define MIR_MEO 0x20
-#define MIR_MVCT_M 0x0c
-#define MIR_MCM_M 0x03
-
-#define MISR_DSRCHG 0x80
-#define MISR_CDCHG 0x40
-#define MISR_CTSCHG 0x20
-#define MISR_TIMER2 0x02
-#define MISR_TIMER1 0x01
-
-#define TISR_BERR 0x80
-#define TISR_EOF 0x40
-#define TISR_EOB 0x20
-#define TISR_UE 0x10
-#define TISR_BABB 0x08
-#define TISR_TXEMPTY 0x02
-#define TISR_TXDAT 0x01
diff --git a/sys/arch/mvme68k/dev/zs.c b/sys/arch/mvme68k/dev/zs.c
deleted file mode 100644
index f36ff61a243..00000000000
--- a/sys/arch/mvme68k/dev/zs.c
+++ /dev/null
@@ -1,756 +0,0 @@
-/* $OpenBSD: zs.c,v 1.35 2013/12/01 21:56:42 miod Exp $ */
-/* $NetBSD: zs.c,v 1.29 2001/05/30 15:24:24 lukem Exp $ */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Gordon W. Ross.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Zilog Z8530 Dual UART driver (machine-dependent part)
- *
- * Runs two serial lines per chip using slave drivers.
- * Plain tty/async lines use the zstty slave.
- * Sun keyboard/mouse uses the zskbd/zsms slaves.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/file.h>
-#include <sys/ioctl.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-#include <sys/time.h>
-#include <sys/syslog.h>
-
-#include <machine/autoconf.h>
-#include <machine/conf.h>
-#include <machine/cpu.h>
-#include <machine/z8530var.h>
-
-#ifdef DDB
-#include <ddb/db_var.h>
-#endif
-
-#include <dev/cons.h>
-
-#include <dev/ic/z8530reg.h>
-
-#include "mc.h"
-#include "pcc.h"
-
-#if NPCC > 0
-#include <mvme68k/dev/pccreg.h>
-#endif
-#if NMC > 0
-#include <mvme68k/dev/mcreg.h>
-#endif
-
-#include "zs.h"
-
-/*
- * Some warts needed by z8530tty.c -
- * The default parity REALLY needs to be the same as the PROM uses,
- * or you can not see messages done with printf during boot-up...
- */
-int zs_def_cflag = (CREAD | CS8 | HUPCL);
-int zs_major = 12;
-
-#define PCLK_FREQ_147 5000000
-#define PCLK_FREQ_162 10000000
-
-#define ZS_DELAY()
-
-/* physical layout on the MVME147 */
-struct zschan_147 {
- volatile uint8_t zc_csr;
- volatile uint8_t zc_data;
-};
-
-/* physical layout on the MVME1x2 */
-struct zschan_162 {
- uint8_t zc_xxx0;
- volatile uint8_t zc_csr;
- uint8_t zc_xxx1;
- volatile uint8_t zc_data;
-};
-
-#if NMC > 0
-/*
- * MC rev 0x01 has a bug and can not access the data register directly.
- */
-int mc_rev1_bug = 0;
-#endif
-
-static uint8_t zs_init_reg[17] = {
- 0, /* 0: CMD (reset, etc.) */
- 0, /* 1: No interrupts yet. */
- 0, /* 2: IVECT */
- ZSWR3_RX_8 | ZSWR3_RX_ENABLE,
- ZSWR4_CLK_X16 | ZSWR4_ONESB,
- ZSWR5_TX_8 | ZSWR5_TX_ENABLE,
- 0, /* 6: TXSYNC/SYNCLO */
- 0, /* 7: RXSYNC/SYNCHI */
- 0, /* 8: alias for data port */
- ZSWR9_MASTER_IE ,
- 0, /*10: Misc. TX/RX control bits */
- ZSWR11_TXCLK_BAUD | ZSWR11_RXCLK_BAUD,
- 0, /*12: BAUDLO (default=9600) */
- 0, /*13: BAUDHI (default=9600) */
- ZSWR14_BAUD_ENA | ZSWR14_BAUD_FROM_PCLK,
- ZSWR15_BREAK_IE,
- ZSWR7P_TX_FIFO /*7': TX FIFO interrupt level */
-};
-
-/* Console ops */
-cons_decl(zs);
-struct consdev zs_consdev = {
- zscnprobe,
- zscninit,
- zscngetc,
- zscnputc,
- zscnpollc,
- NULL,
-};
-
-static int zs_consunit = -1;
-static int zs_conschan = -1;
-
-
-/****************************************************************
- * Autoconfig
- ****************************************************************/
-
-/* Definition of the driver for autoconfig. */
-int zs_match(struct device *, void *, void *);
-void zs_attach(struct device *, struct device *, void *);
-int zs_print(void *, const char *);
-
-struct cfdriver zs_cd = {
- NULL, "zs", DV_TTY
-};
-
-const struct cfattach zs_ca = {
- sizeof(struct zsc_softc), zs_match, zs_attach
-};
-
-/* Interrupt handlers. */
-int zshard(void *);
-void zssoft(void *);
-
-int zs_get_speed(struct zs_chanstate *);
-
-/*
- * Is the zs chip present?
- */
-int
-zs_match(struct device *parent, void *vcf, void *aux)
-{
- struct confargs *ca = aux;
- unsigned char *zstest = (unsigned char *)ca->ca_vaddr;
-
- /*
- * If zs1 is in the config, we must test to see if it really exists.
- * Some 162s only have one scc device, but the memory location for
- * the second scc still checks valid and every byte contains 0xFF. So
- * this is what we test with for now. XXX - smurph
- */
- if (!badvaddr((vaddr_t)ca->ca_vaddr, 1))
- if (*zstest == 0xFF)
- return (0);
- else
- return (1);
- else
- return (0);
-}
-
-void
-zs_attach(struct device *parent, struct device *self, void *aux)
-{
- struct zsc_softc *zsc = (void *)self;
- struct confargs *ca = aux;
- struct zsc_attach_args zsc_args;
- struct zs_chanstate *cs;
- int s, channel, has_fifo;
- int pclk;
- uint8_t ir;
-
- switch (cputyp) {
- default:
-#ifdef MVME147
- case CPU_147:
- pclk = PCLK_FREQ_147;
- break;
-#endif
-#if defined(MVME162) || defined(MVME172)
- case CPU_162:
- case CPU_172:
- pclk = PCLK_FREQ_162;
- break;
-#endif
- }
-
- switch (ca->ca_bustype) {
-#if NPCC > 0
- case BUS_PCC:
- zs_init_reg[9] |= ZSWR9_NO_VECTOR;
- break;
-#endif
-#if NMC > 0
- case BUS_MC:
- if (sys_mc->mc_chiprev != 0x01)
- mc_rev1_bug = 0;
- zs_init_reg[2] = MC_VECBASE + MCV_ZS;
- break;
-#endif
- }
-
- /*
- * Initialize software state for each channel.
- */
- for (channel = 0; channel < 2; channel++) {
- zsc_args.channel = channel;
- cs = &zsc->zsc_cs_store[channel];
- zsc->zsc_cs[channel] = cs;
-
- cs->cs_channel = channel;
- cs->cs_private = NULL;
- cs->cs_ops = &zsops_null;
- cs->cs_brg_clk = pclk / 16;
-
- switch (cputyp) {
- default:
-#ifdef MVME147
- case CPU_147:
- {
- struct zschan_147 *zc;
-
- zc = (struct zschan_147 *)ca->ca_vaddr;
- cs->cs_reg_csr = &zc[channel ^ 1].zc_csr;
- cs->cs_reg_data = &zc[channel ^ 1].zc_data;
- }
- break;
-#endif
-#if defined(MVME162) || defined(MVME172)
- case CPU_162:
- case CPU_172:
- {
- struct zschan_162 *zc;
-
- zc = (struct zschan_162 *)ca->ca_vaddr;
- cs->cs_reg_csr = &zc[channel ^ 1].zc_csr;
- cs->cs_reg_data = &zc[channel ^ 1].zc_data;
- }
- break;
-#endif
- }
-
- /*
- * Figure out whether this chip is a 8530 or a 85230.
- */
- if (channel == 0) {
- zs_write_reg(cs, 15, ZSWR15_ENABLE_ENHANCED);
- has_fifo = zs_read_reg(cs, 15) & ZSWR15_ENABLE_ENHANCED;
-
- if (has_fifo) {
- zs_write_reg(cs, 15, 0);
- printf(": 85230\n");
- } else
- printf(": 8530\n");
- }
-
- if (has_fifo)
- zs_init_reg[15] |= ZSWR15_ENABLE_ENHANCED;
- else
- zs_init_reg[15] &= ~ZSWR15_ENABLE_ENHANCED;
-
- if (self->dv_unit == zs_consunit && channel == zs_conschan) {
- zsc_args.consdev = &zs_consdev;
- zsc_args.hwflags =
- ZS_HWFLAG_CONSOLE | ZS_HWFLAG_USE_CONSDEV;
- } else {
- zsc_args.consdev = NULL;
- zsc_args.hwflags = 0;
- }
-
- bcopy(zs_init_reg, cs->cs_creg, 16);
- bcopy(zs_init_reg, cs->cs_preg, 16);
-
- cs->cs_defspeed = zs_get_speed(cs);
- cs->cs_defcflag = zs_def_cflag;
-
- /* Make these correspond to cs_defcflag (-crtscts) */
- cs->cs_rr0_dcd = ZSRR0_DCD;
- cs->cs_rr0_cts = 0;
- cs->cs_wr5_dtr = ZSWR5_DTR | ZSWR5_RTS;
- cs->cs_wr5_rts = 0;
-
- /*
- * Clear the master interrupt enable.
- * The INTENA is common to both channels,
- * so just do it on the A channel.
- */
- if (channel == 0) {
- zs_write_reg(cs, 9, 0);
- }
-
- /*
- * Look for a child driver for this channel.
- * The child attach will setup the hardware.
- */
- if (!config_found(&zsc->zsc_dev, (void *)&zsc_args, zs_print)) {
- /* No sub-driver. Just reset it. */
- u_char reset = (channel == 0) ?
- ZSWR9_A_RESET : ZSWR9_B_RESET;
- s = splzs();
- zs_write_reg(cs, 9, reset);
- splx(s);
- }
- }
-
- /*
- * Now safe to install interrupt handlers.
- */
- zsc->zsc_ih.ih_fn = zshard;
- zsc->zsc_ih.ih_arg = zsc;
- zsc->zsc_ih.ih_ipl = IPL_ZS;
- zsc->zsc_ih.ih_wantframe = 0;
-
- switch (ca->ca_bustype) {
-#if NPCC > 0
- case BUS_PCC:
- pccintr_establish(PCCV_ZS, &zsc->zsc_ih, self->dv_xname);
- break;
-#endif
-#if NMC > 0
- case BUS_MC:
- mcintr_establish(MCV_ZS, &zsc->zsc_ih, self->dv_xname);
- break;
-#endif
- }
-
- zsc->zsc_softih = softintr_establish(IPL_SOFTTTY, zssoft, zsc);
-
- /*
- * Set the master interrupt enable and interrupt vector.
- * (common to both channels, do it on A)
- */
- cs = zsc->zsc_cs[0];
- s = splhigh();
- /* interrupt vector */
- zs_write_reg(cs, 2, zs_init_reg[2]);
- /* master interrupt control (enable) */
- zs_write_reg(cs, 9, zs_init_reg[9]);
- splx(s);
-
- switch (ca->ca_bustype) {
-#if NPCC > 0
- case BUS_PCC:
- ir = sys_pcc->pcc_zsirq;
- if ((ir & PCC_IRQ_IPL) != 0 && (ir & PCC_IRQ_IPL) != IPL_ZS)
- panic("zs configured at different IPLs");
- sys_pcc->pcc_zsirq = IPL_ZS | PCC_IRQ_IEN | PCC_ZS_PCCVEC;
- break;
-#endif
-#if NMC > 0
- case BUS_MC:
- ir = sys_mc->mc_zsirq;
- if ((ir & MC_IRQ_IPL) != 0 && (ir & MC_IRQ_IPL) != IPL_ZS)
- panic("zs configured at different IPLs");
- sys_mc->mc_zsirq = IPL_ZS | MC_IRQ_IEN;
- break;
-#endif
- }
-}
-
-int
-zs_print(void *aux, const char *name)
-{
- struct zsc_attach_args *args = aux;
-
- if (name != NULL)
- printf("%s: ", name);
-
- if (args->channel != -1)
- printf(" channel %d", args->channel);
-
- return (UNCONF);
-}
-
-int
-zshard(void *arg)
-{
- struct zsc_softc *zsc = (struct zsc_softc *)arg;
- int rr3, rval;
-
- rval = 0;
- while ((rr3 = zsc_intr_hard(zsc))) {
- /* Count up the interrupts. */
- rval |= rr3;
- }
- if (((zsc->zsc_cs[0] && zsc->zsc_cs[0]->cs_softreq) ||
- (zsc->zsc_cs[1] && zsc->zsc_cs[1]->cs_softreq)) &&
- zsc->zsc_softih) {
- softintr_schedule(zsc->zsc_softih);
- }
- return (rval);
-}
-
-void
-zssoft(void *arg)
-{
- struct zsc_softc *zsc = (struct zsc_softc *)arg;
- int s;
-
- /* Make sure we call the tty layer at spltty. */
- s = spltty();
- zsc_intr_soft(zsc);
- splx(s);
-}
-
-/*
- * Compute the current baud rate given a ZS channel.
- */
-int
-zs_get_speed(struct zs_chanstate *cs)
-{
- int tconst;
-
- tconst = zs_read_reg(cs, 12);
- tconst |= zs_read_reg(cs, 13) << 8;
- return (TCONST_TO_BPS(cs->cs_brg_clk, tconst));
-}
-
-/*
- * MD functions for setting the baud rate and control modes.
- */
-int
-zs_set_speed(struct zs_chanstate *cs, int bps)
-{
- int tconst, real_bps;
-
- if (bps == 0)
- return (0);
-
-#ifdef DIAGNOSTIC
- if (cs->cs_brg_clk == 0)
- panic("zs_set_speed");
-#endif
-
- tconst = BPS_TO_TCONST(cs->cs_brg_clk, bps);
- if (tconst < 0)
- return (EINVAL);
-
- /* Convert back to make sure we can do it. */
- real_bps = TCONST_TO_BPS(cs->cs_brg_clk, tconst);
-
- /* XXX - Allow some tolerance here? */
- if (real_bps != bps)
- return (EINVAL);
-
- cs->cs_preg[12] = tconst;
- cs->cs_preg[13] = tconst >> 8;
-
- /* Caller will stuff the pending registers. */
- return (0);
-}
-
-int
-zs_set_modes(struct zs_chanstate *cs, int cflag)
-{
- int s;
-
- /*
- * Output hardware flow control on the chip is horrendous:
- * if carrier detect drops, the receiver is disabled, and if
- * CTS drops, the transmitter is stopped IN MID CHARACTER!
- * Therefore, NEVER set the HFC bit, and instead use the
- * status interrupt to detect CTS changes.
- */
- s = splzs();
- cs->cs_rr0_pps = 0;
- if ((cflag & (CLOCAL | MDMBUF)) != 0) {
- cs->cs_rr0_dcd = 0;
- if ((cflag & MDMBUF) == 0)
- cs->cs_rr0_pps = ZSRR0_DCD;
- } else
- cs->cs_rr0_dcd = ZSRR0_DCD;
- if ((cflag & CRTSCTS) != 0) {
- cs->cs_wr5_dtr = ZSWR5_DTR;
- cs->cs_wr5_rts = ZSWR5_RTS;
- cs->cs_rr0_cts = ZSRR0_CTS;
- } else if ((cflag & MDMBUF) != 0) {
- cs->cs_wr5_dtr = 0;
- cs->cs_wr5_rts = ZSWR5_DTR;
- cs->cs_rr0_cts = ZSRR0_DCD;
- } else {
- cs->cs_wr5_dtr = ZSWR5_DTR | ZSWR5_RTS;
- cs->cs_wr5_rts = 0;
- cs->cs_rr0_cts = 0;
- }
- splx(s);
-
- /* Caller will stuff the pending registers. */
- return (0);
-}
-
-
-/*
- * Read or write the chip with suitable delays.
- */
-
-uint8_t
-zs_read_reg(struct zs_chanstate *cs, uint8_t reg)
-{
- uint8_t val;
-
- *cs->cs_reg_csr = reg;
- ZS_DELAY();
- val = *cs->cs_reg_csr;
- ZS_DELAY();
- return (val);
-}
-
-void
-zs_write_reg(struct zs_chanstate *cs, uint8_t reg, uint8_t val)
-{
- *cs->cs_reg_csr = reg;
- ZS_DELAY();
- *cs->cs_reg_csr = val;
- ZS_DELAY();
-}
-
-uint8_t
-zs_read_csr(struct zs_chanstate *cs)
-{
- uint8_t val;
-
- val = *cs->cs_reg_csr;
- ZS_DELAY();
- return (val);
-}
-
-void
-zs_write_csr(struct zs_chanstate *cs, uint8_t val)
-{
- *cs->cs_reg_csr = val;
- ZS_DELAY();
-}
-
-uint8_t
-zs_read_data(struct zs_chanstate *cs)
-{
- uint8_t val;
-
-#if NMC > 0
- if (mc_rev1_bug)
- return zs_read_reg(cs, 8);
-#endif
- val = *cs->cs_reg_data;
- ZS_DELAY();
- return (val);
-}
-
-void
-zs_write_data(struct zs_chanstate *cs, uint8_t val)
-{
-#if NMC > 0
- if (mc_rev1_bug) {
- zs_write_reg(cs, 8, val);
- return;
- }
-#endif
- *cs->cs_reg_data = val;
- ZS_DELAY();
-}
-
-/*
- * Handle user request to enter kernel debugger.
- */
-void
-zs_abort(struct zs_chanstate *cs)
-{
- int rr0;
-
- /* Wait for end of break to avoid PROM abort. */
- /* XXX - Limit the wait? */
- do {
- rr0 = zs_read_csr(cs);
- } while (rr0 & ZSRR0_BREAK);
-
-#if defined(KGDB)
- zskgdb(cs);
-#elif defined(DDB)
- Debugger();
-#endif
-}
-
-/****************************************************************
- * Console support functions
- ****************************************************************/
-
-struct zs_consptr {
- volatile uint8_t *zc_csr;
- volatile uint8_t *zc_data;
-};
-
-static struct zs_consptr zs_consptr;
-
-void
-zscnprobe(struct consdev *cp)
-{
- switch (cputyp) {
- default:
- return;
-#ifdef MVME147
- case CPU_147:
- break;
-#endif
-#if defined(MVME162) || defined(MVME172)
- case CPU_162:
- case CPU_172:
- break;
-#endif
- }
-
- cp->cn_dev = makedev(zs_major, 0);
- cp->cn_pri = CN_LOWPRI;
-}
-
-void
-zscninit(struct consdev *cp)
-{
- switch (cputyp) {
- default:
-#ifdef MVME147
- case CPU_147:
- {
- struct zschan_147 *zc;
-
- zc = (struct zschan_147 *)IIOV(ZS0_PHYS_147);
- zs_consptr.zc_csr = &zc[1].zc_csr;
- zs_consptr.zc_data = &zc[1].zc_data;
- }
-#if NMC > 0
- mc_rev1_bug = 0;
-#endif
- break;
-#endif
-#if defined(MVME162) || defined(MVME172)
- case CPU_162:
- case CPU_172:
- {
- struct zschan_162 *zc;
-
- zc = (struct zschan_162 *)IIOV(ZS0_PHYS_162);
- zs_consptr.zc_csr = &zc[1].zc_csr;
- zs_consptr.zc_data = &zc[1].zc_data;
- }
- break;
-#endif
- }
-
- zs_consunit = 0;
- zs_conschan = 0;
-}
-
-/*
- * Polled console input putchar.
- */
-int
-zscngetc(dev_t dev)
-{
- struct zs_consptr *zc = &zs_consptr;
- int s, c, rr0;
-
- s = splhigh();
- /* Wait for a character to arrive. */
- do {
- rr0 = *zc->zc_csr;
- ZS_DELAY();
- } while ((rr0 & ZSRR0_RX_READY) == 0);
-
-#if NMC > 0
- if (mc_rev1_bug) {
- *zc->zc_csr = 8;
- ZS_DELAY();
- c = *zc->zc_csr;
- ZS_DELAY();
- } else
-#endif
- {
- c = *zc->zc_data;
- ZS_DELAY();
- }
- splx(s);
-
- return (c);
-}
-
-/*
- * Polled console output putchar.
- */
-void
-zscnputc(dev_t dev, int c)
-{
- struct zs_consptr *zc = &zs_consptr;
- int s, rr0;
-
- s = splhigh();
-
- /* Wait for transmitter to become ready. */
- do {
- rr0 = *zc->zc_csr;
- ZS_DELAY();
- } while ((rr0 & ZSRR0_TX_READY) == 0);
-
- /*
- * Send the next character.
- */
-#if NMC > 0
- if (mc_rev1_bug) {
- *zc->zc_csr = 8;
- ZS_DELAY();
- *zc->zc_csr = c;
- ZS_DELAY();
- } else
-#endif
- {
- *zc->zc_data = c;
- ZS_DELAY();
- }
-
- splx(s);
-}
-
-void
-zscnpollc(dev_t dev, int on)
-{
-}
diff --git a/sys/arch/mvme68k/include/_float.h b/sys/arch/mvme68k/include/_float.h
deleted file mode 100644
index 9a011ad04c6..00000000000
--- a/sys/arch/mvme68k/include/_float.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: _float.h,v 1.1 2012/06/26 16:12:44 deraadt Exp $ */
-
-#include <m68k/_float.h>
diff --git a/sys/arch/mvme68k/include/_types.h b/sys/arch/mvme68k/include/_types.h
deleted file mode 100644
index b68f0e855c1..00000000000
--- a/sys/arch/mvme68k/include/_types.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: _types.h,v 1.5 2012/11/05 19:39:34 miod Exp $ */
-
-/* public domain */
-#include <m68k/_types.h>
diff --git a/sys/arch/mvme68k/include/asm.h b/sys/arch/mvme68k/include/asm.h
deleted file mode 100644
index d8869e0c2d3..00000000000
--- a/sys/arch/mvme68k/include/asm.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: asm.h,v 1.3 1996/04/28 10:56:02 deraadt Exp $ */
-
-#include <m68k/asm.h>
diff --git a/sys/arch/mvme68k/include/atomic.h b/sys/arch/mvme68k/include/atomic.h
deleted file mode 100644
index acd3f628b99..00000000000
--- a/sys/arch/mvme68k/include/atomic.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* $OpenBSD: atomic.h,v 1.3 2011/03/23 16:54:36 pirofti Exp $ */
-
-/* Public Domain */
-
-#ifndef _MACHINE_ATOMIC_H_
-#define _MACHINE_ATOMIC_H_
-
-#include <m68k/atomic.h>
-
-#endif /* _MACHINE_ATOMIC_H_ */
diff --git a/sys/arch/mvme68k/include/autoconf.h b/sys/arch/mvme68k/include/autoconf.h
deleted file mode 100644
index 585a56ab988..00000000000
--- a/sys/arch/mvme68k/include/autoconf.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* $OpenBSD: autoconf.h,v 1.18 2011/03/23 16:54:36 pirofti Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_AUTOCONF_H_
-#define _MACHINE_AUTOCONF_H_
-
-#include <machine/bus.h>
-
-struct confargs {
- bus_space_tag_t ca_iot;
- bus_dma_tag_t ca_dmat;
- int ca_bustype;
- vaddr_t ca_vaddr; /* on-board (pcc,mc,pcctwo) only */
- paddr_t ca_paddr;
- int ca_offset;
- int ca_ipl;
- int ca_vec;
- char *ca_name;
-};
-
-#define BUS_MAIN 1
-#define BUS_PCC 2 /* VME147 PCC chip */
-#define BUS_MC 3 /* VME162/172 MC chip */
-#define BUS_PCCTWO 4 /* VME166/167/176/177 PCC2 chip */
-#define BUS_VMES 5 /* 16 bit VME access */
-#define BUS_VMEL 6 /* 32 bit VME access */
-#define BUS_IP 7 /* VME162/172 IP module bus */
-#define BUS_LRC 8 /* VME165 LRC chip */
-#define BUS_OFOBIO 9 /* VME141 */
-
-/* the following are from the prom/bootblocks */
-extern paddr_t bootaddr; /* PA of boot device */
-extern int bootctrllun; /* ctrl_lun of boot device */
-extern int bootdevlun; /* dev_lun of boot device */
-extern int bootpart; /* boot partition (disk) */
-extern int bootbus; /* scsi bus (disk) */
-
-vaddr_t mapiodev(paddr_t, int);
-void unmapiodev(vaddr_t, int);
-
-#endif
diff --git a/sys/arch/mvme68k/include/bus.h b/sys/arch/mvme68k/include/bus.h
deleted file mode 100644
index 484b7d476ef..00000000000
--- a/sys/arch/mvme68k/include/bus.h
+++ /dev/null
@@ -1,802 +0,0 @@
-/* $OpenBSD: bus.h,v 1.9 2012/12/03 07:00:11 jsg Exp $ */
-/*
- * Copyright (c) 2004, Miodrag Vallat.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Simple mvme68k bus_space and bus_dma implementation.
- *
- * Currently, we only need specific handling for 32 bit read/writes in D16
- * space, and this choice is made at compile time. As a result, all the
- * implementation can go through macros or inline functions, except for
- * the management functions.
- */
-
-#ifndef _MACHINE_BUS_H_
-#define _MACHINE_BUS_H_
-
-#include <sys/types.h>
-
-typedef u_long bus_addr_t;
-typedef u_long bus_size_t;
-
-typedef u_long bus_space_handle_t;
-
-struct mvme68k_bus_space_tag {
- int (*bs_map)(bus_addr_t, bus_size_t, int, bus_space_handle_t *);
- void (*bs_unmap)(bus_space_handle_t, bus_size_t);
- int (*bs_subregion)(bus_space_handle_t, bus_size_t, bus_size_t,
- bus_space_handle_t *);
- void * (*bs_vaddr)(bus_space_handle_t);
- /* alloc, free not implemented yet */
-};
-
-typedef const struct mvme68k_bus_space_tag *bus_space_tag_t;
-
-#define BUS_SPACE_BARRIER_READ 0x01
-#define BUS_SPACE_BARRIER_WRITE 0x02
-
-#define BUS_SPACE_MAP_CACHEABLE 0x01
-#define BUS_SPACE_MAP_LINEAR 0x02
-#define BUS_SPACE_MAP_PREFETCHABLE 0x04
-
-/*
- * General bus_space function set
- */
-
-#define bus_space_barrier(t,h,o,s,f) do { } while (0)
-#define bus_space_map(t,a,s,f,r) ((t)->bs_map(a,s,f,r))
-#define bus_space_unmap(t,h,s) ((t)->bs_unmap(h,s))
-#define bus_space_subregion(t,h,o,s,r) ((t)->bs_subregion(h,o,s,r))
-#define bus_space_vaddr(t,h) ((t)->bs_vaddr(h))
-
-/*
- * Read/Write/Region functions for D8 and D16 access.
- * Most of these are straightforward and assume that everything is properly
- * aligned.
- */
-
-#define bus_space_read_1(tag, handle, offset) \
- ((void)(tag), *(volatile u_int8_t *)((handle) + (offset)))
-#define bus_space_read_2(tag, handle, offset) \
- ((void)(tag), *(volatile u_int16_t *)((handle) + (offset)))
-
-static void bus_space_read_multi_1(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_read_multi_1(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- *dest++ = bus_space_read_1(tag, 0, offset);
-}
-
-static void bus_space_read_multi_2(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int16_t *, size_t);
-
-static __inline__ void
-bus_space_read_multi_2(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int16_t *dest, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- *dest++ = bus_space_read_2(tag, 0, offset);
-}
-
-static void bus_space_read_raw_multi_2(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_read_raw_multi_2(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t size)
-{
- offset += handle;
- size >>= 1;
- while ((int)--size >= 0) {
- *(u_int16_t *)dest =
- bus_space_read_2(tag, 0, offset);
- dest += 2;
- }
-}
-
-static void bus_space_read_region_1(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- *dest++ = bus_space_read_1(tag, 0, offset++);
-}
-
-static void bus_space_read_region_2(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int16_t *, size_t);
-
-static __inline__ void
-bus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int16_t *dest, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0) {
- *dest++ = bus_space_read_2(tag, 0, offset);
- offset += 2;
- }
-}
-
-static void bus_space_read_raw_region_2(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_read_raw_region_2(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t size)
-{
- size >>= 1;
- offset += handle;
- while ((int)--size >= 0) {
- *(u_int16_t *)dest = bus_space_read_2(tag, 0, offset);
- offset += 2;
- dest += 2;
- }
-}
-
-#define bus_space_write_1(tag, handle, offset, value) \
- ((void)(tag), *(volatile u_int8_t *)((handle) + (offset)) = (value))
-#define bus_space_write_2(tag, handle, offset, value) \
- ((void)(tag), *(volatile u_int16_t *)((handle) + (offset)) = (value))
-
-static void bus_space_write_multi_1(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_write_multi_1(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- bus_space_write_1(tag, 0, offset, *dest++);
-}
-
-static void bus_space_write_multi_2(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int16_t *, size_t);
-
-static __inline__ void
-bus_space_write_multi_2(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int16_t *dest, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- bus_space_write_2(tag, 0, offset, *dest++);
-}
-
-static void bus_space_write_raw_multi_2(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_write_raw_multi_2(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t size)
-{
- offset += handle;
- size >>= 1;
- while ((int)--size >= 0) {
- bus_space_write_2(tag, 0, offset, *(u_int16_t *)dest);
- dest += 2;
- }
-}
-
-static void bus_space_set_multi_1(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t, size_t);
-
-static __inline__ void
-bus_space_set_multi_1(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t value, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- bus_space_write_1(tag, 0, offset, value);
-}
-
-static void bus_space_set_multi_2(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int16_t, size_t);
-
-static __inline__ void
-bus_space_set_multi_2(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int16_t value, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- bus_space_write_2(tag, 0, offset, value);
-}
-
-static void bus_space_write_region_1(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_write_region_1(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- bus_space_write_1(tag, 0, offset++, *dest++);
-}
-
-static void bus_space_write_region_2(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int16_t *, size_t);
-
-static __inline__ void
-bus_space_write_region_2(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int16_t *dest, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0) {
- bus_space_write_2(tag, 0, offset, *dest++);
- offset += 2;
- }
-}
-
-static void bus_space_write_raw_region_2(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_write_raw_region_2(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t size)
-{
- offset += handle;
- size >>= 1;
- while ((int)--size >= 0) {
- bus_space_write_2(tag, 0, offset, *(u_int16_t *)dest);
- offset += 2;
- dest += 2;
- }
-}
-
-static void bus_space_set_region_1(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t, size_t);
-
-static __inline__ void
-bus_space_set_region_1(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t value, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- bus_space_write_1(tag, 0, offset++, value);
-}
-
-static void bus_space_set_region_2(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int16_t, size_t);
-
-static __inline__ void
-bus_space_set_region_2(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int16_t value, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0) {
- bus_space_write_2(tag, 0, offset, value);
- offset += 2;
- }
-}
-
-static void bus_space_copy_1(bus_space_tag_t, bus_space_handle_t, bus_addr_t,
- bus_space_handle_t, bus_addr_t, bus_size_t);
-
-static __inline__ void
-bus_space_copy_1(bus_space_tag_t tag, bus_space_handle_t h1, bus_addr_t o1,
- bus_space_handle_t h2, bus_addr_t o2, bus_size_t count)
-{
- o1 += h1;
- o2 += h2;
- while ((int)--count >= 0) {
- *(volatile u_int8_t *)o1 = *(volatile u_int8_t *)o2;
- o1++;
- o2++;
- }
-}
-
-static void bus_space_copy_2(bus_space_tag_t, bus_space_handle_t, bus_addr_t,
- bus_space_handle_t, bus_addr_t, bus_size_t);
-
-static __inline__ void
-bus_space_copy_2(bus_space_tag_t tag, bus_space_handle_t h1, bus_addr_t o1,
- bus_space_handle_t h2, bus_addr_t o2, bus_size_t count)
-{
- o1 += h1;
- o2 += h2;
- while ((int)--count >= 0) {
- *(volatile u_int16_t *)o1 = *(volatile u_int16_t *)o2;
- o1 += 2;
- o2 += 2;
- }
-}
-
-/*
- * Unrestricted D32 access
- */
-
-#ifndef __BUS_SPACE_RESTRICT_D16__
-
-#define bus_space_read_4(tag, handle, offset) \
- ((void)(tag), *(volatile u_int32_t *)((handle) + (offset)))
-
-static void bus_space_read_multi_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int32_t *, size_t);
-
-static __inline__ void
-bus_space_read_multi_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int32_t *dest, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- *dest++ = bus_space_read_4(tag, 0, offset);
-}
-
-static void bus_space_read_raw_multi_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_read_raw_multi_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t size)
-{
- offset += handle;
- size >>= 2;
- while ((int)--size >= 0) {
- *(u_int32_t *)dest =
- bus_space_read_4(tag, 0, offset);
- dest += 4;
- }
-}
-
-static void bus_space_read_region_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int32_t *, size_t);
-
-static __inline__ void
-bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int32_t *dest, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0) {
- *dest++ = bus_space_read_4(tag, 0, offset);
- offset += 4;
- }
-}
-
-static void bus_space_read_raw_region_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_read_raw_region_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t size)
-{
- size >>= 2;
- offset += handle;
- while ((int)--size >= 0) {
- *(u_int32_t *)dest = bus_space_read_4(tag, 0, offset);
- offset += 4;
- dest += 4;
- }
-}
-
-#define bus_space_write_4(tag, handle, offset, value) \
- ((void)(tag), *(volatile u_int32_t *)((handle) + (offset)) = (value))
-
-static void bus_space_write_multi_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int32_t *, size_t);
-
-static __inline__ void
-bus_space_write_multi_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int32_t *dest, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- bus_space_write_4(tag, 0, offset, *dest++);
-}
-
-static void bus_space_write_raw_multi_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_write_raw_multi_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t size)
-{
- offset += handle;
- size >>= 2;
- while ((int)--size >= 0) {
- bus_space_write_4(tag, 0, offset, *(u_int32_t *)dest);
- dest += 4;
- }
-}
-
-static void bus_space_set_multi_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int32_t, size_t);
-
-static __inline__ void
-bus_space_set_multi_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int32_t value, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- bus_space_write_4(tag, 0, offset, value);
-}
-
-static void bus_space_write_region_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int32_t *, size_t);
-
-static __inline__ void
-bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int32_t *dest, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0) {
- bus_space_write_4(tag, 0, offset, *dest++);
- offset += 4;
- }
-}
-
-static void bus_space_write_raw_region_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_write_raw_region_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t size)
-{
- offset += handle;
- size >>= 2;
- while ((int)--size >= 0) {
- bus_space_write_4(tag, 0, offset, *(u_int32_t *)dest);
- offset += 4;
- dest += 4;
- }
-}
-
-static void bus_space_set_region_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int32_t, size_t);
-
-static __inline__ void
-bus_space_set_region_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int32_t value, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0) {
- bus_space_write_4(tag, 0, offset, value);
- offset += 4;
- }
-}
-
-static void bus_space_copy_4(bus_space_tag_t, bus_space_handle_t, bus_addr_t,
- bus_space_handle_t, bus_addr_t, bus_size_t);
-
-static __inline__ void
-bus_space_copy_4(bus_space_tag_t tag, bus_space_handle_t h1, bus_addr_t o1,
- bus_space_handle_t h2, bus_addr_t o2, bus_size_t count)
-{
- o1 += h1;
- o2 += h2;
- while ((int)--count >= 0) {
- *(volatile u_int32_t *)o1 = *(volatile u_int32_t *)o2;
- o1 += 4;
- o2 += 4;
- }
-}
-
-#else /* __BUS_SPACE_RESTRICT_D16__ */
-
-/*
- * Restricted D32 access - done through two adjacent D16 access.
- *
- * The speed of the basic read and write routines is critical.
- * This implementation uses a temporary variable on stack, and does
- * two 16 bit load&store sequences. Since the stack is in Dcache, this
- * is faster and spills fewer register than a register-only sequence
- * (which would need to ld.h into two distinct registers, then extu
- * the second one into itself, and or both in the result register).
- */
-
-static u_int32_t d16_read_4(vaddr_t);
-static void d16_write_4(vaddr_t, u_int32_t);
-
-static __inline__ u_int32_t
-d16_read_4(vaddr_t va)
-{
- u_int32_t tmp;
-
- *(u_int16_t *)&tmp = *(volatile u_int16_t *)va;
- *(u_int16_t *)((vaddr_t)&tmp + 2) = *(volatile u_int16_t *)(va + 2);
-
- return tmp;
-}
-
-static __inline__ void
-d16_write_4(vaddr_t va, u_int32_t value)
-{
- u_int32_t tmp = value;
-
- *(volatile u_int16_t *)va = *(u_int16_t *)&tmp;
- *(volatile u_int16_t *)(va + 2) = *(u_int16_t *)((vaddr_t)&tmp + 2);
-}
-
-#define bus_space_read_4(tag, handle, offset) \
- ((void)(tag), d16_read_4((handle) + (offset)))
-
-static void bus_space_read_multi_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int32_t *, size_t);
-
-static __inline__ void
-bus_space_read_multi_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int32_t *dest, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- *dest++ = bus_space_read_4(tag, 0, offset);
-}
-
-static void bus_space_read_raw_multi_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_read_raw_multi_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t size)
-{
- offset += handle;
- size >>= 1;
- while ((int)--size >= 0) {
- *(u_int16_t *)dest = bus_space_read_2(tag, 0, offset);
- dest += 2;
- }
-}
-
-static void bus_space_read_region_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int32_t *, size_t);
-
-static __inline__ void
-bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int32_t *__dest, size_t count)
-{
- u_int16_t *dest = (u_int16_t *)__dest;
-
- offset += handle;
- count <<= 1;
- while ((int)--count >= 0) {
- *dest++ = bus_space_read_2(tag, 0, offset);
- offset += 2;
- }
-}
-
-static void bus_space_read_raw_region_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_read_raw_region_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t size)
-{
- size >>= 1;
- offset += handle;
- while ((int)--size >= 0) {
- *(u_int16_t *)dest = bus_space_read_2(tag, 0, offset);
- offset += 2;
- dest += 2;
- }
-}
-
-#define bus_space_write_4(tag, handle, offset, value) \
- ((void)(tag), d16_write_4((handle) + (offset), (value)))
-
-static void bus_space_write_multi_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int32_t *, size_t);
-
-static __inline__ void
-bus_space_write_multi_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int32_t *dest, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- bus_space_write_4(tag, 0, offset, *dest++);
-}
-
-static void bus_space_write_raw_multi_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_write_raw_multi_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t size)
-{
- offset += handle;
- size >>= 1;
- while ((int)--size >= 0) {
- bus_space_write_2(tag, 0, offset, *(u_int16_t *)dest);
- dest += 2;
- }
-}
-
-static void bus_space_set_multi_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int32_t, size_t);
-
-static __inline__ void
-bus_space_set_multi_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int32_t value, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- bus_space_write_4(tag, 0, offset, value);
-}
-
-static void bus_space_write_region_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int32_t *, size_t);
-
-static __inline__ void
-bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int32_t *__dest, size_t count)
-{
- u_int16_t *dest = (u_int16_t *)__dest;
-
- offset += handle;
- count <<= 1;
- while ((int)--count >= 0) {
- bus_space_write_2(tag, 0, offset, *dest++);
- offset += 2;
- }
-}
-
-static void bus_space_write_raw_region_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_write_raw_region_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t size)
-{
- offset += handle;
- size >>= 1;
- while ((int)--size >= 0) {
- bus_space_write_2(tag, 0, offset, *(u_int16_t *)dest);
- offset += 2;
- dest += 2;
- }
-}
-
-static void bus_space_set_region_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int32_t, size_t);
-
-static __inline__ void
-bus_space_set_region_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int32_t value, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0) {
- bus_space_write_4(tag, 0, offset, value);
- offset += 4;
- }
-}
-
-static void bus_space_copy_4(bus_space_tag_t, bus_space_handle_t, bus_addr_t,
- bus_space_handle_t, bus_addr_t, bus_size_t);
-
-static __inline__ void
-bus_space_copy_4(bus_space_tag_t tag, bus_space_handle_t h1, bus_addr_t o1,
- bus_space_handle_t h2, bus_addr_t o2, bus_size_t count)
-{
- o1 += h1;
- o2 += h2;
- count <<= 1;
- while ((int)--count >= 0) {
- *(volatile u_int16_t *)o1 = *(volatile u_int16_t *)o2;
- o1 += 2;
- o2 += 2;
- }
-}
-
-#endif /* __BUS_SPACE_RESTRICT_D16__ */
-
-/*
- * Extra D16 access functions (see vme.c)
- */
-
-void d16_bcopy(const void *, void *, size_t);
-void d16_bzero(void *, size_t);
-
-/*
- * Bus DMA implementation
- */
-
-#define BUS_DMA_WAITOK 0x000 /* safe to sleep (pseudo-flag) */
-#define BUS_DMA_NOWAIT 0x001 /* not safe to sleep */
-#define BUS_DMA_ALLOCNOW 0x002 /* perform resource allocation now */
-#define BUS_DMA_COHERENT 0x004 /* hint: map memory DMA coherent */
-#define BUS_DMA_BUS1 0x010 /* placeholders for bus functions... */
-#define BUS_DMA_BUS2 0x020
-#define BUS_DMA_BUS3 0x040
-#define BUS_DMA_BUS4 0x080
-#define BUS_DMA_READ 0x100 /* mapping is device -> memory only */
-#define BUS_DMA_WRITE 0x200 /* mapping is memory -> device only */
-#define BUS_DMA_STREAMING 0x400 /* hint: sequential, unidirectional */
-#define BUS_DMA_ZERO 0x800 /* zero memory in dmamem_alloc */
-
-#define BUS_DMASYNC_PREREAD 0x01
-#define BUS_DMASYNC_POSTREAD 0x02
-#define BUS_DMASYNC_PREWRITE 0x04
-#define BUS_DMASYNC_POSTWRITE 0x08
-
-typedef u_int32_t bus_dma_tag_t; /* ignored, really */
-
-/*
- * bus_dma_segment_t
- *
- * Describes a single contiguous DMA transaction. Values
- * are suitable for programming into DMA registers.
- */
-struct m68k_bus_dma_segment {
- bus_addr_t ds_addr; /* DMA address */
- bus_size_t ds_len; /* length of transfer */
-};
-typedef struct m68k_bus_dma_segment bus_dma_segment_t;
-
-/*
- * bus_dmamap_t
- *
- * Describes a DMA mapping.
- */
-struct m68k_bus_dmamap {
- bus_size_t _dm_size; /* largest DMA transfer mappable */
- int _dm_segcnt; /* number of segs this map can map */
- bus_size_t _dm_maxsegsz; /* largest possible segment */
- bus_size_t _dm_boundary; /* don't cross this */
-
- bus_size_t dm_mapsize; /* size of the mapping */
- int dm_nsegs; /* # valid segments in mapping */
- bus_dma_segment_t dm_segs[1]; /* segments; variable length */
-};
-typedef struct m68k_bus_dmamap *bus_dmamap_t;
-
-struct mbuf;
-struct proc;
-struct uio;
-
-int bus_dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_size_t,
- bus_size_t, int, bus_dmamap_t *);
-void bus_dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);
-int bus_dmamap_load(bus_dma_tag_t, bus_dmamap_t, void *,
- bus_size_t, struct proc *, int);
-int bus_dmamap_load_mbuf(bus_dma_tag_t, bus_dmamap_t,
- struct mbuf *, int);
-int bus_dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t,
- struct uio *, int);
-int bus_dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t, bus_dma_segment_t *,
- int, bus_size_t, int);
-void bus_dmamap_unload(bus_dma_tag_t, bus_dmamap_t);
-void bus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t,
- bus_size_t, int);
-
-int bus_dmamem_alloc(bus_dma_tag_t tag, bus_size_t size,
- bus_size_t alignment, bus_size_t boundary,
- bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags);
-void bus_dmamem_free(bus_dma_tag_t tag, bus_dma_segment_t *segs,
- int nsegs);
-int bus_dmamem_map(bus_dma_tag_t tag, bus_dma_segment_t *segs,
- int nsegs, size_t size, caddr_t *kvap, int flags);
-void bus_dmamem_unmap(bus_dma_tag_t tag, caddr_t kva,
- size_t size);
-paddr_t bus_dmamem_mmap(bus_dma_tag_t tag, bus_dma_segment_t *segs,
- int nsegs, off_t off, int prot, int flags);
-
-#endif /* _MACHINE_BUS_H_ */
diff --git a/sys/arch/mvme68k/include/cdefs.h b/sys/arch/mvme68k/include/cdefs.h
deleted file mode 100644
index 7ff575c6da4..00000000000
--- a/sys/arch/mvme68k/include/cdefs.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: cdefs.h,v 1.4 1997/03/31 00:23:58 downsj Exp $ */
-
-#include <m68k/cdefs.h>
diff --git a/sys/arch/mvme68k/include/conf.h b/sys/arch/mvme68k/include/conf.h
deleted file mode 100644
index 1c5ccb78f6b..00000000000
--- a/sys/arch/mvme68k/include/conf.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* $OpenBSD: conf.h,v 1.4 2009/03/01 21:40:49 miod Exp $ */
-/*
- * Copyright (c) 2002, Miodrag Vallat.
- * All rights reserved.
- *
- * Permission to redistribute, use, copy, and modify this software
- * is hereby granted without fee, provided that the following
- * conditions are met:
- *
- * 1. This entire notice is included in all source code copies of any
- * software which is or includes a copy or modification of this
- * software.
- * 2. The name of the author may not be used to endorse or promote
- * products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/conf.h>
-
-#define mmread mmrw
-#define mmwrite mmrw
-cdev_decl(mm);
-
-cdev_decl(vmel);
-cdev_decl(vmes);
-
-cdev_decl(flash);
-
-#define nvramread nvramrw
-#define nvramwrite nvramrw
-cdev_decl(nvram);
-
-#define sramread sramrw
-#define sramwrite sramrw
-cdev_decl(sram);
-
-cdev_decl(cl);
-cdev_decl(dart);
-cdev_decl(wl);
-cdev_decl(zs);
-
-cdev_decl(lp);
diff --git a/sys/arch/mvme68k/include/cpu.h b/sys/arch/mvme68k/include/cpu.h
deleted file mode 100644
index 27b6df9881a..00000000000
--- a/sys/arch/mvme68k/include/cpu.h
+++ /dev/null
@@ -1,218 +0,0 @@
-/* $OpenBSD: cpu.h,v 1.36 2013/03/23 16:12:25 deraadt Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: cpu.h 1.16 91/03/25$
- *
- * @(#)cpu.h 8.4 (Berkeley) 1/5/94
- */
-
-#ifndef _MACHINE_CPU_H_
-#define _MACHINE_CPU_H_
-
-/*
- * Exported definitions unique to mvme68k cpu support.
- */
-
-/*
- * Get common m68k CPU definiti÷ns.
- */
-#include <m68k/cpu.h>
-
-#ifdef _KERNEL
-
-/*
- * Get interrupt glue.
- */
-#include <machine/intr.h>
-
-/*
- * Arguments to hardclock and gatherstats encapsulate the previous
- * machine state in an opaque clockframe. On the m68k, we use
- * what the hardware pushes on an interrupt (frame format 0).
- */
-struct clockframe {
- u_short sr; /* sr at time of interrupt */
- u_long pc; /* pc at time of interrupt */
- u_short vo; /* vector offset (4-word frame) */
-};
-
-#define CLKF_USERMODE(framep) (((framep)->sr & PSL_S) == 0)
-#define CLKF_PC(framep) ((framep)->pc)
-#if 0
-/* We would like to do it this way... */
-#define CLKF_INTR(framep) (((framep)->sr & PSL_M) == 0)
-#else
-/* but until we start using PSL_M, we have to do this instead */
-#define CLKF_INTR(framep) (0) /* XXX */
-#endif
-
-
-/*
- * Preempt the current process if in interrupt from user mode,
- * or after the current trap/syscall if in system mode.
- */
-extern int want_resched;
-#define need_resched(ci) { want_resched = 1; aston(); }
-#define clear_resched(ci) want_resched = 0
-
-/*
- * Give a profiling tick to the current process when the user profiling
- * buffer pages are invalid. On the m68k, request an ast to send us
- * through trap, marking the proc as needing a profiling tick.
- */
-#define need_proftick(p) aston()
-
-/*
- * Notify the current process (p) that it has a signal pending,
- * process as soon as possible.
- */
-#define signotify(p) aston()
-
-extern int astpending;
-#define aston() (astpending = 1)
-
-#endif /* _KERNEL */
-
-/*
- * CTL_MACHDEP definitions.
- */
-#define CPU_CONSDEV 1 /* dev_t: console terminal device */
-#define CPU_MAXID 2 /* number of valid machdep ids */
-
-#define CTL_MACHDEP_NAMES { \
- { 0, 0 }, \
- { "console_device", CTLTYPE_STRUCT }, \
-}
-
-#ifdef _KERNEL
-
-extern vaddr_t intiobase, intiolimit;
-extern vaddr_t iiomapbase;
-extern int iiomapsize;
-
-/* physical memory sections for mvme141 */
-#define INTIOBASE_141 (0xfff50000)
-#define INTIOTOP_141 (0xfffc0000)
-#define INTIOSIZE_141 ((INTIOTOP_141-INTIOBASE_141)/PAGE_SIZE)
-
-/* physical memory sections for mvme147 */
-#define INTIOBASE_147 (0xfffe0000)
-#define INTIOTOP_147 (0xfffe5000)
-#define INTIOSIZE_147 ((INTIOTOP_147-INTIOBASE_147)/PAGE_SIZE)
-
-/* physical memory sections for mvme16x */
-#define INTIOBASE_162 (0xfff00000)
-#define INTIOTOP_162 (0xfffd0000) /* was 0xfff50000 */
-#define INTIOSIZE_162 ((INTIOTOP_162-INTIOBASE_162)/PAGE_SIZE)
-
-/* physical memory sections for mvme165 */
-#define INTIOBASE_165 (0xfff90000)
-#define INTIOTOP_165 (0xffff0000)
-#define INTIOSIZE_165 ((INTIOTOP_165-INTIOBASE_165)/PAGE_SIZE)
-
-/*
- * Internal IO space (iiomapsize).
- *
- * Internal IO space is mapped in the kernel from ``intiobase'' to
- * ``intiolimit'' (defined in locore.s). Since it is always mapped,
- * conversion between physical and kernel virtual addresses is easy.
- */
-#define ISIIOVA(va) \
- ((va) >= intiobase && (va) < intiolimit)
-#define IIOV(pa) ((pa) - iiomapbase + intiobase)
-#define IIOP(va) ((va) - intiobase + iiomapbase)
-#define IIOPOFF(pa) ((pa) - iiomapbase)
-
-extern int cputyp;
-#define CPU_141 0x141
-#define CPU_147 0x147
-#define CPU_162 0x162
-#define CPU_165 0x165
-#define CPU_166 0x166
-#define CPU_167 0x167
-#define CPU_172 0x172
-#define CPU_176 0x176
-#define CPU_177 0x177
-
-#include <sys/evcount.h>
-
-struct intrhand {
- SLIST_ENTRY(intrhand) ih_link;
- int (*ih_fn)(void *);
- void *ih_arg;
- int ih_ipl;
- int ih_wantframe;
- struct evcount ih_count;
-};
-
-int intr_establish(int, struct intrhand *, const char *);
-
-#define NVMEINTR 256
-
-/* locore.s */
-__dead void doboot(void);
-
-int badpaddr(paddr_t, int);
-int badvaddr(vaddr_t, int);
-void nmihand(void *);
-int intr_findvec(int, int);
-
-paddr_t kvtop(vaddr_t);
-
-#endif /* _KERNEL */
-#endif /* _MACHINE_CPU_H_ */
diff --git a/sys/arch/mvme68k/include/db_machdep.h b/sys/arch/mvme68k/include/db_machdep.h
deleted file mode 100644
index 0ce93d2c09f..00000000000
--- a/sys/arch/mvme68k/include/db_machdep.h
+++ /dev/null
@@ -1,6 +0,0 @@
-/* $OpenBSD: db_machdep.h,v 1.3 1996/04/28 10:56:08 deraadt Exp $ */
-
-#define DB_MACHINE_COMMANDS
-
-/* Just use the common m68k definition */
-#include <m68k/db_machdep.h>
diff --git a/sys/arch/mvme68k/include/disklabel.h b/sys/arch/mvme68k/include/disklabel.h
deleted file mode 100644
index 874fbed1317..00000000000
--- a/sys/arch/mvme68k/include/disklabel.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/* $OpenBSD: disklabel.h,v 1.12 2011/03/23 16:54:36 pirofti Exp $ */
-
-/*
- * Copyright (c) 1996 Nivas Madhur
- * Copyright (c) 1995 Dale Rahn.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_DISKLABEL_H_
-#define _MACHINE_DISKLABEL_H_
-
-#define LABELSECTOR 0 /* sector containing label */
-#define LABELOFFSET 0 /* offset of label in sector */
-#define MAXPARTITIONS 16 /* number of partitions */
-
-/*
- * a mvmedisklabel is a disklabel that the bug (prom) can understand
- * and live with. the bug works in terms of 256 byte blocks. in our
- * case the first two bug blocks make up the mvmedisklabel (which is 512
- * bytes [i.e. one sector] in length).
- *
- * we use a fixed layout the BSD disk structure (in 256 byte blocks):
- * block 0 = the volume ID block (part of mvmedisklabel)
- * block 1 = media configuration area (part of mvmedisklabel)
- * block 2 = start of first level OS bootstrap (continues ...)
- * block 31 = end of OS bootstrap
- * block 32 = BSD filesystem superblock
- *
- * this gives us 30 blocks (30*256 = 7680 bytes) for the bootstrap's text+data
- *
- * disksubr.c translates between mvmedisklabel and BSD disklabel.
- *
- * Note: this structure is exactly 512 bytes in size. If you move fields
- * around, make sure the various members are properly aligned and the
- * compiler won't do any additional padding.
- */
-struct mvmedisklabel {
- /* VID */
- u_char vid_id[4];
- u_char vid_0[16];
- u_int vid_oss;
- u_short vid_osl;
- u_char vid_1[4];
- u_short vid_osa_u;
- u_short vid_osa_l;
- u_char version;
- u_char vid_2[1];
- u_short checksum; /* 2 */
- u_short partitions;
- u_char vid_vd[16];
- u_long bbsize;
- u_long magic1; /* 4 */
- u_short type; /* 2 */
- u_short subtype; /* 2 */
- u_char packname[16]; /* 16 */
- u_long flags; /* 4 */
- u_long drivedata[5]; /* 4 */
- u_long spare[5]; /* 4 */
-
- u_long secpercyl; /* 4 */
- u_long secperunit; /* 4 */
- u_long headswitch; /* 4 */
-
- u_char vid_3[4];
- u_int vid_cas;
- u_char vid_cal;
- u_char vid_4_0[3];
- u_char vid_4[64];
- u_char vid_4_1[28];
- u_long sbsize;
- u_char vid_mot[8];
-
- /* CFG */
- u_char cfg_0[4];
- u_short cfg_atm;
- u_short cfg_prm;
- u_short cfg_atw;
- u_short cfg_rec;
-
- u_short sparespertrack;
- u_short sparespercyl;
- u_long acylinders;
- u_short rpm;
- u_short cylskew;
-
- u_char cfg_spt;
- u_char cfg_hds;
- u_short cfg_trk;
- u_char cfg_ilv;
- u_char cfg_sof;
- u_short cfg_psm;
- u_short cfg_shd;
- u_char cfg_2[2];
- u_short cfg_pcom;
- u_char cfg_3;
- u_char cfg_ssr;
- u_short cfg_rwcc;
- u_short cfg_ecc;
- u_short cfg_eatm;
- u_short cfg_eprm;
- u_short cfg_eatw;
- u_char cfg_gpb1;
- u_char cfg_gpb2;
- u_char cfg_gpb3;
- u_char cfg_gpb4;
- u_char cfg_ssc;
- u_char cfg_runit;
- u_short cfg_rsvc1;
- u_short cfg_rsvc2;
- u_long magic2;
- u_char cfg_4[192];
-};
-#endif /* _MACHINE_DISKLABEL_H_ */
diff --git a/sys/arch/mvme68k/include/endian.h b/sys/arch/mvme68k/include/endian.h
deleted file mode 100644
index 6a901224e75..00000000000
--- a/sys/arch/mvme68k/include/endian.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: endian.h,v 1.6 2011/03/15 18:23:38 deraadt Exp $ */
-
-/* Just use the common m68k definition */
-#include <m68k/endian.h>
diff --git a/sys/arch/mvme68k/include/exec.h b/sys/arch/mvme68k/include/exec.h
deleted file mode 100644
index 8d42927bff2..00000000000
--- a/sys/arch/mvme68k/include/exec.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* $OpenBSD: exec.h,v 1.8 2003/10/09 21:48:48 miod Exp $ */
-
-/*
- * Copyright (c) 1993 Christopher G. Demetriou
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <m68k/exec.h>
diff --git a/sys/arch/mvme68k/include/fenv.h b/sys/arch/mvme68k/include/fenv.h
deleted file mode 100644
index e0663cb85a3..00000000000
--- a/sys/arch/mvme68k/include/fenv.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: fenv.h,v 1.2 2013/06/01 21:20:54 jasper Exp $ */
-/* public domain */
-#include <m68k/fenv.h>
diff --git a/sys/arch/mvme68k/include/frame.h b/sys/arch/mvme68k/include/frame.h
deleted file mode 100644
index 4400bb910fd..00000000000
--- a/sys/arch/mvme68k/include/frame.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: frame.h,v 1.3 1996/04/28 10:56:19 deraadt Exp $ */
-
-#include <m68k/frame.h>
diff --git a/sys/arch/mvme68k/include/ieee.h b/sys/arch/mvme68k/include/ieee.h
deleted file mode 100644
index a71abb6e62c..00000000000
--- a/sys/arch/mvme68k/include/ieee.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: ieee.h,v 1.1 2001/09/06 00:07:10 millert Exp $ */
-
-#include <m68k/ieee.h>
diff --git a/sys/arch/mvme68k/include/ieeefp.h b/sys/arch/mvme68k/include/ieeefp.h
deleted file mode 100644
index 01b90b0a332..00000000000
--- a/sys/arch/mvme68k/include/ieeefp.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: ieeefp.h,v 1.3 1996/04/28 10:56:20 deraadt Exp $ */
-
-/* Just use the common m68k definition */
-#include <m68k/ieeefp.h>
diff --git a/sys/arch/mvme68k/include/intr.h b/sys/arch/mvme68k/include/intr.h
deleted file mode 100644
index 285811b556c..00000000000
--- a/sys/arch/mvme68k/include/intr.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* $OpenBSD: intr.h,v 1.22 2013/06/16 14:49:49 kettenis Exp $ */
-/*
- * Copyright (C) 2000 Steve Murphree, Jr.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_INTR_H_
-#define _MACHINE_INTR_H_
-
-#include <machine/psl.h>
-
-#ifdef _KERNEL
-
-/*
- * Interrupt "levels". These are a more abstract representation
- * of interrupt levels, and do not have the same meaning as m68k
- * CPU interrupt levels. They serve two purposes:
- *
- * - properly order ISRs in the list for that CPU ipl
- * - compute CPU PSL values for the spl*() calls.
- */
-#define IPL_NONE 0
-#define IPL_SOFTINT 1
-#define IPL_BIO 2
-#define IPL_NET 3
-#define IPL_TTY 5
-#define IPL_VM 5
-#define IPL_CLOCK 5
-#define IPL_STATCLOCK 5
-#define IPL_SCHED 7
-#define IPL_HIGH 7
-
-#define IPL_MPSAFE 0 /* no "mpsafe" interrupts */
-
-#define MD_IPLTOPSL(ipl) IPLTOPSL(ipl)
-
-#define splsoft() _splraise(PSL_S | PSL_IPL1)
-#define splsoftclock() splsoft()
-#define splsoftnet() splsoft()
-#define splbio() _splraise(PSL_S | PSL_IPL2)
-#define splnet() _splraise(PSL_S | PSL_IPL3)
-#define spltty() _splraise(PSL_S | PSL_IPL5)
-#define splvm() _splraise(PSL_S | PSL_IPL5)
-#define splclock() _splraise(PSL_S | PSL_IPL5)
-#define splstatclock() _splraise(PSL_S | PSL_IPL5)
-#define splhigh() _spl(PSL_S | PSL_IPL7)
-#define splsched() splhigh()
-
-/* watch out for side effects */
-#define splx(s) ((s) & PSL_IPL ? _spl(s) : spl0())
-
-#include <m68k/intr.h> /* soft interrupt support */
-
-/* locore.s */
-int spl0(void);
-
-#endif /* _KERNEL */
-#endif /* _MACHINE_INTR_H_ */
diff --git a/sys/arch/mvme68k/include/kcore.h b/sys/arch/mvme68k/include/kcore.h
deleted file mode 100644
index 178f05fc0a4..00000000000
--- a/sys/arch/mvme68k/include/kcore.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: kcore.h,v 1.1 1999/09/26 17:51:16 smurph Exp $ */
-
-#include<m68k/kcore.h>
diff --git a/sys/arch/mvme68k/include/limits.h b/sys/arch/mvme68k/include/limits.h
deleted file mode 100644
index 598d5e27f86..00000000000
--- a/sys/arch/mvme68k/include/limits.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* $OpenBSD: limits.h,v 1.4 1997/07/24 14:48:50 deraadt Exp $ */
-
-#ifndef _MACHINE_LIMITS_H_
-#define _MACHINE_LIMITS_H_
-
-/* Just use the common m68k definition */
-#include <m68k/limits.h>
-
-#endif /* _MACHINE_LIMITS_H_ */
diff --git a/sys/arch/mvme68k/include/loadfile_machdep.h b/sys/arch/mvme68k/include/loadfile_machdep.h
deleted file mode 100644
index 6ada208b58a..00000000000
--- a/sys/arch/mvme68k/include/loadfile_machdep.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* $OpenBSD: loadfile_machdep.h,v 1.2 2013/10/17 11:54:00 miod Exp $ */
-
-/*-
- * Copyright (c) 1999 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Christos Zoulas.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define BOOT_ELF
-
-#define LOAD_KERNEL LOAD_ALL
-#define COUNT_KERNEL COUNT_ALL
-
-#define LOADADDR(a) (((u_long)(a)) + offset)
-#define ALIGNENTRY(a) ((u_long)(a) & ~0x0fff)
-#define READ(f, b, c) read((f), (void *)LOADADDR(b), (c))
-#define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c))
-#define BZERO(d, c) memset((void *)LOADADDR(d), 0, (c))
-#define WARN(a) (void)(printf a, \
- printf((errno ? ": %s\n" : "\n"), \
- strerror(errno)))
-#define PROGRESS(a) (void) printf a
-#define ALLOC(a) alloc(a)
-#define FREE(a, b) free(a, b)
diff --git a/sys/arch/mvme68k/include/lock.h b/sys/arch/mvme68k/include/lock.h
deleted file mode 100644
index a83fd0016e1..00000000000
--- a/sys/arch/mvme68k/include/lock.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: lock.h,v 1.1 2007/05/01 18:56:30 miod Exp $ */
-/* public domain */
-#include <m68k/lock.h>
diff --git a/sys/arch/mvme68k/include/mioctl.h b/sys/arch/mvme68k/include/mioctl.h
deleted file mode 100644
index da850fe41db..00000000000
--- a/sys/arch/mvme68k/include/mioctl.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* $OpenBSD: mioctl.h,v 1.4 2003/06/02 05:09:14 deraadt Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define MIOCGSIZ _IOR('m', 1, int)
diff --git a/sys/arch/mvme68k/include/mutex.h b/sys/arch/mvme68k/include/mutex.h
deleted file mode 100644
index f899120c22e..00000000000
--- a/sys/arch/mvme68k/include/mutex.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: mutex.h,v 1.1 2007/02/03 20:08:50 miod Exp $ */
-/* public domain */
-#include <m68k/mutex.h>
diff --git a/sys/arch/mvme68k/include/nvram.h b/sys/arch/mvme68k/include/nvram.h
deleted file mode 100644
index e1029bc0835..00000000000
--- a/sys/arch/mvme68k/include/nvram.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* $OpenBSD: nvram.h,v 1.6 2011/03/23 16:54:36 pirofti Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_NVRAM_H_
-#define _MACHINE_NVRAM_H_
-
-struct nvram_147 {
- u_char user[0x400];
- u_char os[0x200];
- u_char bug[0x174];
- u_long emem;
- u_char ether[3];
- u_char memsizing;
- u_char other[124];
- /*struct clockreg cl; */
-};
-
-struct nvram_16x {
- u_char user[0x1000];
- u_char net[0x100];
- u_char os[1528];
- u_char bug[2048];
- struct nvram_16x_conf {
- u_char version[4];
- u_char serial[12];
- u_char id[16];
- u_char pwa[16];
- u_char speed[4];
- u_char ether[6];
- u_char fill[2];
- u_char lscsiid[2];
- u_char mem_pwb[8];
- u_char mem_serial[8];
- u_char port2_pwb[8];
- u_char port2_serial[8];
- u_char ipa_brdid[8];
- u_char ipa_serial[8];
- u_char ipa_pwb[8];
- u_char ipb_brdid[8];
- u_char ipb_serial[8];
- u_char ipb_pwb[8];
- u_char ipc_brdid[8];
- u_char ipc_serial[8];
- u_char ipc_pwb[8];
- u_char ipd_brdid[8];
- u_char ipd_serial[8];
- u_char ipd_pwb[8];
- u_char reserved[65];
- u_char cksum[1];
- } conf;
- /*struct clockreg cl; */
-};
-
-#endif
diff --git a/sys/arch/mvme68k/include/param.h b/sys/arch/mvme68k/include/param.h
deleted file mode 100644
index d95b7198a0c..00000000000
--- a/sys/arch/mvme68k/include/param.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* $OpenBSD: param.h,v 1.22 2013/03/23 16:12:25 deraadt Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_PARAM_H_
-#define _MACHINE_PARAM_H_
-
-#define _MACHINE "mvme68k"
-#define MACHINE "mvme68k"
-
-#define PAGE_SHIFT 12
-
-#define KERNBASE 0x00000000 /* start of kernel virtual */
-#define KERNTEXTOFF 0x00010000 /* start of kernel text */
-
-#define MSGBUFSIZE 4096
-
-#include <m68k/param.h>
-
-#if defined(_KERNEL) && !defined(_LOCORE)
-extern void delay(int);
-#define DELAY(n) delay(n)
-#endif /* _KERNEL && !_LOCORE */
-
-#endif /* _MACHINE_PARAM_H_ */
diff --git a/sys/arch/mvme68k/include/pcb.h b/sys/arch/mvme68k/include/pcb.h
deleted file mode 100644
index 18fb2816c61..00000000000
--- a/sys/arch/mvme68k/include/pcb.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* $OpenBSD: pcb.h,v 1.6 2003/10/09 21:48:48 miod Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: pcb.h 1.14 91/03/25$
- *
- * @(#)pcb.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <m68k/pcb.h>
diff --git a/sys/arch/mvme68k/include/pmap.h b/sys/arch/mvme68k/include/pmap.h
deleted file mode 100644
index 5ce273cca92..00000000000
--- a/sys/arch/mvme68k/include/pmap.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* $OpenBSD: pmap.h,v 1.12 2002/03/14 01:26:37 millert Exp $ */
-
-#ifndef _MACHINE_PMAP_H_
-#define _MACHINE_PMAP_H_
-
-#include <m68k/pmap_motorola.h>
-
-#ifdef _KERNEL
-void pmap_init_md(void);
-#define PMAP_INIT_MD() pmap_init_md()
-#endif
-
-#endif /* _MACHINE_PMAP_H_ */
diff --git a/sys/arch/mvme68k/include/proc.h b/sys/arch/mvme68k/include/proc.h
deleted file mode 100644
index 614e168d332..00000000000
--- a/sys/arch/mvme68k/include/proc.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* $OpenBSD: proc.h,v 1.7 2003/10/09 21:48:48 miod Exp $ */
-
-/*
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)proc.h 8.1 (Berkeley) 6/10/93
- */
-
-#include <m68k/proc.h>
diff --git a/sys/arch/mvme68k/include/profile.h b/sys/arch/mvme68k/include/profile.h
deleted file mode 100644
index ab458cc3623..00000000000
--- a/sys/arch/mvme68k/include/profile.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: profile.h,v 1.3 1996/04/28 10:56:26 deraadt Exp $ */
-
-#include <m68k/profile.h>
diff --git a/sys/arch/mvme68k/include/prom.h b/sys/arch/mvme68k/include/prom.h
deleted file mode 100644
index 5f660992dce..00000000000
--- a/sys/arch/mvme68k/include/prom.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/* $OpenBSD: prom.h,v 1.14 2013/02/02 13:36:05 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _MACHINE_PROM_H_
-#define _MACHINE_PROM_H_
-
-#define MVMEPROM_INCHR 0x00
-#define MVMEPROM_INSTAT 0x01
-#define MVMEPROM_INLN 0x02
-#define MVMEPROM_READSTR 0x03
-#define MVMEPROM_READLN 0x04
-#define MVMEPROM_OUTCHR 0x20
-#define MVMEPROM_OUTSTR 0x21
-#define MVMEPROM_DSKRD 0x10
-#define MVMEPROM_DSKWR 0x11
-#define MVMEPROM_DSKCFIG 0x12
-#define MVMEPROM_DSKFMT 0x14
-#define MVMEPROM_DSKCTRL 0x15
-#define MVMEPROM_NETCTRL 0x1d
-#define MVMEPROM_OUTSTRCRLF 0x22
-#define MVMEPROM_WRITE 0x23
-#define MVMEPROM_WRITELN 0x24
-#define MVMEPROM_DELAY 0x43
-#define MVMEPROM_RTC_RD 0x53
-#define MVMEPROM_EXIT 0x63
-#define MVMEPROM_GETBRDID 0x70
-#define MVMEPROM_ENVIRON 0x71
-
-#define NETCTRLCMD_GETETHER 1
-
-#define ENVIRONCMD_WRITE 1
-#define ENVIRONCMD_READ 2
-#define ENVIRONTYPE_EOL 0
-#define ENVIRONTYPE_START 1
-#define ENVIRONTYPE_DISKBOOT 2
-#define ENVIRONTYPE_ROMBOOT 3
-#define ENVIRONTYPE_NETBOOT 4
-#define ENVIRONTYPE_MEMSIZE 5
-
-#ifndef _LOCORE
-struct prom_netctrl {
- u_char dev;
- u_char ctrl;
- u_short status;
- u_long cmd;
- u_long addr;
- u_long len;
- u_long flags;
-};
-
-struct prom_environ_hdr {
- u_char type;
- u_char len;
-};
-
-struct mvmeprom_brdid {
- u_long eye_catcher;
- u_char rev;
- u_char month;
- u_char day;
- u_char year;
- u_short size;
- u_short rsv1;
- u_short model;
- u_short suffix;
- u_short options;
- u_char family;
- u_char cpu;
- u_short ctrlun;
- u_short devlun;
- u_short devtype;
- u_short devnum;
- u_long bug;
-
- /*
- * XXX: I have seen no documentation for these!
- *
- * The following (appears to) exist only on the MVME162 and
- * upwards. We should figure out what the other fields are.
- */
- u_char xx1[16];
- u_char xx2[4];
- u_char longname[12];
- u_char xx3[16];
- u_char speed[4];
- u_char xx4[12];
-};
-
-struct mvmeprom_time {
- u_char year_BCD;
- u_char month_BCD;
- u_char day_BCD;
- u_char wday_BCD;
- u_char hour_BCD;
- u_char min_BCD;
- u_char sec_BCD;
- u_char cal_BCD;
-};
-
-struct mvmeprom_dskio {
- u_char ctrl_lun;
- u_char dev_lun;
- u_short status;
- void *pbuffer;
- u_long blk_num;
- u_short blk_cnt;
- u_char flag;
-#define BUG_FILE_MARK 0x80
-#define IGNORE_FILENUM 0x02
-#define END_OF_FILE 0x01
- u_char addr_mod;
-};
-#define MVMEPROM_BLOCK_SIZE 256
-
-struct mvmeprom_args {
- u_int dev_lun;
- u_int ctrl_lun;
- u_int flags;
- u_int ctrl_addr;
- u_int entry;
- u_int conf_blk;
- char *arg_start;
- char *arg_end;
- char *nbarg_start;
- char *nbarg_end;
- u_int cputyp;
-};
-
-#endif
-
-#define MVMEPROM_CALL(x) \
- __asm__ __volatile__ ("trap #15; .short " __STRING(x))
-#define MVMEPROM_NOARG() \
- __asm__ __volatile__ ("clrl %sp@-")
-#define MVMEPROM_ARG1(arg) \
- __asm__ __volatile__ ("movel %0, %%sp@-"::"d" (arg))
-#define MVMEPROM_ARG2(arg) \
- __asm__ __volatile__ ("movel %0, %%sp@-"::"d" (arg))
-#define MVMEPROM_GETRES(ret) \
- __asm__ __volatile__ ("movel %%sp@+,%0": "=d" (ret):)
-#define MVMEPROM_RETURN(ret) \
- MVMEPROM_GETRES(ret); \
- return (ret); /* return a value (int) */
-#define MVMEPROM_RETURN_BYTE(ret) \
- MVMEPROM_GETRES(ret); \
- return((ret >> 24) & 0xff); /* return a byte, ret must be int */
-#define MVMEPROM_STATRET(ret) \
- MVMEPROM_GETRES(ret); \
- return (!(ret & 0x4)); /* return a 'status' */
-
-#define MVMEPROM_REG_DEVLUN %d0
-#define MVMEPROM_REG_CTRLLUN %d1
-#define MVMEPROM_REG_FLAGS %d4
-#define MVMEPROM_REG_CTRLADDR %a0
-#define MVMEPROM_REG_ENTRY %a1
-#define MVMEPROM_REG_CONFBLK %a2
-#define MVMEPROM_REG_NBARGSTART %a3
-#define MVMEPROM_REG_NBARGEND %a4
-#define MVMEPROM_REG_ARGSTART %a5
-#define MVMEPROM_REG_ARGEND %a6
-
-#ifndef RB_NOSYM
-#define RB_NOSYM 0x4000
-#endif
-
-#endif /* _MACHINE_PROM_H_ */
diff --git a/sys/arch/mvme68k/include/psl.h b/sys/arch/mvme68k/include/psl.h
deleted file mode 100644
index 9f1025d4977..00000000000
--- a/sys/arch/mvme68k/include/psl.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: psl.h,v 1.3 1996/04/28 10:56:28 deraadt Exp $ */
-
-#include <m68k/psl.h>
diff --git a/sys/arch/mvme68k/include/pte.h b/sys/arch/mvme68k/include/pte.h
deleted file mode 100644
index 7d9b9ed582d..00000000000
--- a/sys/arch/mvme68k/include/pte.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* $OpenBSD: pte.h,v 1.7 2002/02/22 22:45:34 miod Exp $ */
-
-#ifndef _MACHINE_PTE_H_
-#define _MACHINE_PTE_H_
-
-#include <m68k/pte_motorola.h>
-
-#define MACHINE_STSIZE M68K_STSIZE
-#define MACHINE_MAX_PTSIZE M68K_MAX_PTSIZE
-#define MACHINE_MAX_KPTSIZE M68K_MAX_KPTSIZE
-#define MACHINE_PTBASE M68K_PTBASE
-#define MACHINE_PTMAXSIZE M68K_PTMAXSIZE
-
-#endif /* _MACHINE_PTE_H_ */
diff --git a/sys/arch/mvme68k/include/ptrace.h b/sys/arch/mvme68k/include/ptrace.h
deleted file mode 100644
index 65ccefe48a7..00000000000
--- a/sys/arch/mvme68k/include/ptrace.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: ptrace.h,v 1.3 1996/04/28 10:56:30 deraadt Exp $ */
-
-/* Just use the common m68k definition */
-#include <m68k/ptrace.h>
diff --git a/sys/arch/mvme68k/include/reg.h b/sys/arch/mvme68k/include/reg.h
deleted file mode 100644
index ae0e25f7a31..00000000000
--- a/sys/arch/mvme68k/include/reg.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: reg.h,v 1.4 1997/03/31 00:24:08 downsj Exp $ */
-
-#include <m68k/reg.h>
diff --git a/sys/arch/mvme68k/include/reloc.h b/sys/arch/mvme68k/include/reloc.h
deleted file mode 100644
index deceec777c8..00000000000
--- a/sys/arch/mvme68k/include/reloc.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: reloc.h,v 1.1 2013/02/02 13:36:05 miod Exp $ */
-/* public domain */
-#include <m68k/reloc.h>
diff --git a/sys/arch/mvme68k/include/setjmp.h b/sys/arch/mvme68k/include/setjmp.h
deleted file mode 100644
index 4a14bb85055..00000000000
--- a/sys/arch/mvme68k/include/setjmp.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: setjmp.h,v 1.3 1996/04/28 10:56:32 deraadt Exp $ */
-
-#include <m68k/setjmp.h>
diff --git a/sys/arch/mvme68k/include/signal.h b/sys/arch/mvme68k/include/signal.h
deleted file mode 100644
index 07f41f12900..00000000000
--- a/sys/arch/mvme68k/include/signal.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: signal.h,v 1.3 1996/04/28 10:56:33 deraadt Exp $ */
-
-/* Just use the common m68k definition */
-#include <m68k/signal.h>
diff --git a/sys/arch/mvme68k/include/spinlock.h b/sys/arch/mvme68k/include/spinlock.h
deleted file mode 100644
index 46634aefed3..00000000000
--- a/sys/arch/mvme68k/include/spinlock.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: spinlock.h,v 1.1 1999/01/21 02:59:34 millert Exp $ */
-
-#include <m68k/spinlock.h>
diff --git a/sys/arch/mvme68k/include/stdarg.h b/sys/arch/mvme68k/include/stdarg.h
deleted file mode 100644
index 75510e1f514..00000000000
--- a/sys/arch/mvme68k/include/stdarg.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: stdarg.h,v 1.3 1996/04/28 10:56:33 deraadt Exp $ */
-
-/* Just use the common m68k definition */
-#include <m68k/stdarg.h>
diff --git a/sys/arch/mvme68k/include/tcb.h b/sys/arch/mvme68k/include/tcb.h
deleted file mode 100644
index 6b2b8157f85..00000000000
--- a/sys/arch/mvme68k/include/tcb.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: tcb.h,v 1.2 2013/06/01 21:20:54 jasper Exp $ */
-/* public domain */
-#include <m68k/tcb.h>
diff --git a/sys/arch/mvme68k/include/trap.h b/sys/arch/mvme68k/include/trap.h
deleted file mode 100644
index 22029ffd243..00000000000
--- a/sys/arch/mvme68k/include/trap.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: trap.h,v 1.3 1996/04/28 10:56:34 deraadt Exp $ */
-
-#include <m68k/trap.h>
diff --git a/sys/arch/mvme68k/include/varargs.h b/sys/arch/mvme68k/include/varargs.h
deleted file mode 100644
index 1cbbe78bc9c..00000000000
--- a/sys/arch/mvme68k/include/varargs.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: varargs.h,v 1.3 1996/04/28 10:56:36 deraadt Exp $ */
-
-/* Just use the common m68k definition */
-#include <m68k/varargs.h>
diff --git a/sys/arch/mvme68k/include/vmparam.h b/sys/arch/mvme68k/include/vmparam.h
deleted file mode 100644
index 7f46c6a3144..00000000000
--- a/sys/arch/mvme68k/include/vmparam.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* $OpenBSD: vmparam.h,v 1.17 2011/03/23 16:54:36 pirofti Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: vmparam.h 1.16 91/01/18$
- *
- * @(#)vmparam.h 8.2 (Berkeley) 4/19/94
- */
-
-#ifndef _MACHINE_VMPARAM_H_
-#define _MACHINE_VMPARAM_H_
-
-/*
- * Machine dependent constants for MVME68K
- */
-
-#include <m68k/vmparam.h>
-
-/*
- * External IO space map size.
- */
-#ifndef EIOMAPSIZE
-#define EIOMAPSIZE 1024 /* in pages */
-#endif
-
-/*
- * Constants which control the way the VM system deals with memory segments.
- * The mvme68k only has one physical memory segment.
- */
-#define VM_PHYSSEG_MAX 1
-#define VM_PHYSSEG_STRAT VM_PSTRAT_RANDOM
-
-#endif /* _MACHINE_VMPARAM_H_ */
diff --git a/sys/arch/mvme68k/include/z8530var.h b/sys/arch/mvme68k/include/z8530var.h
deleted file mode 100644
index e9e92eecadd..00000000000
--- a/sys/arch/mvme68k/include/z8530var.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* $OpenBSD: z8530var.h,v 1.1 2013/12/01 21:56:42 miod Exp $ */
-/* $NetBSD: z8530var.h,v 1.1 1997/10/18 00:01:30 gwr Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)zsvar.h 8.1 (Berkeley) 6/11/93
- */
-
-#include <dev/ic/z8530sc.h>
-
-struct zsc_softc {
- struct device zsc_dev; /* required first: base device */
- struct zs_chanstate *zsc_cs[2]; /* channel A and B soft state */
- struct zs_chanstate zsc_cs_store[2];
-
- struct intrhand zsc_ih;
- void *zsc_softih; /* softintr cookie */
-};
-
-/*
- * Functions to read and write individual registers in a channel.
- */
-
-uint8_t zs_read_reg(struct zs_chanstate *, uint8_t);
-uint8_t zs_read_csr(struct zs_chanstate *);
-uint8_t zs_read_data(struct zs_chanstate *);
-
-void zs_write_reg(struct zs_chanstate *, uint8_t, uint8_t);
-void zs_write_csr(struct zs_chanstate *, uint8_t);
-void zs_write_data(struct zs_chanstate *, uint8_t);
-
-#define splzs() _splraise(PSL_S | PSL_IPL4)
-#define IPL_ZS 4
diff --git a/sys/arch/mvme68k/mvme68k/autoconf.c b/sys/arch/mvme68k/mvme68k/autoconf.c
deleted file mode 100644
index b9267d142ff..00000000000
--- a/sys/arch/mvme68k/mvme68k/autoconf.c
+++ /dev/null
@@ -1,298 +0,0 @@
-/* $OpenBSD: autoconf.c,v 1.47 2011/04/07 15:30:15 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: autoconf.c 1.36 92/12/20$
- *
- * @(#)autoconf.c 8.2 (Berkeley) 1/12/94
- */
-
-/*
- * Setup the system to run on the current machine.
- *
- * cpu_configure() is called at boot time. Available
- * devices are determined (from possibilities mentioned in ioconf.c),
- * and the drivers are initialized.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/extent.h>
-#include <sys/malloc.h>
-#include <sys/buf.h>
-#include <sys/conf.h>
-#include <sys/reboot.h>
-#include <sys/device.h>
-#include <sys/disklabel.h>
-
-#include <machine/vmparam.h>
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-#include <machine/pte.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-#include <dev/cons.h>
-
-int mainbus_print(void *, const char *);
-int mainbus_scan(struct device *, void *, void *);
-
-extern void init_intrs(void);
-extern void dumpconf(void);
-
-int get_target(int *, int *, int *);
-
-/* boot device information */
-paddr_t bootaddr;
-int bootctrllun, bootdevlun;
-int bootpart, bootbus;
-struct device *bootdv;
-
-struct extent *extio;
-extern vaddr_t extiobase;
-
-/*
- * Determine mass storage and memory configuration for a machine.
- */
-void
-cpu_configure()
-{
- init_intrs();
-
- extio = extent_create("extio",
- (u_long)extiobase, (u_long)extiobase + ptoa(EIOMAPSIZE),
- M_DEVBUF, NULL, 0, EX_NOWAIT);
-
- if (config_rootfound("mainbus", NULL) == NULL)
- panic("autoconfig failed, no root");
-
- printf("boot device: %s\n",
- (bootdv) ? bootdv->dv_xname : "<unknown>");
- cold = 0;
-}
-
-void
-diskconf(void)
-{
- setroot(bootdv, bootpart, RB_USERREQ);
- dumpconf();
-}
-
-/*
- * Allocate/deallocate a cache-inhibited range of kernel virtual address
- * space mapping the indicated physical address range [pa - pa+size)
- */
-vaddr_t
-mapiodev(pa, size)
- paddr_t pa;
- int size;
-{
- int error;
- paddr_t base;
- vaddr_t va, iova;
-
- if (size <= 0)
- return 0;
-
- base = pa & PAGE_MASK;
- pa = trunc_page(pa);
- size = round_page(base + size);
-
- error = extent_alloc(extio, size, EX_NOALIGN, 0, EX_NOBOUNDARY,
- EX_NOWAIT | EX_MALLOCOK, &iova);
-
- if (error != 0)
- return 0;
-
- va = iova;
- while (size != 0) {
- pmap_kenter_cache(va, pa, PG_RW | PG_CI);
- size -= PAGE_SIZE;
- va += PAGE_SIZE;
- pa += PAGE_SIZE;
- }
- pmap_update(pmap_kernel());
- return (iova + base);
-}
-
-void
-unmapiodev(kva, size)
- vaddr_t kva;
- int size;
-{
- int error;
- vaddr_t va;
-
-#ifdef DEBUG
- if (kva < extiobase || kva + size >= extiobase + ptoa(EIOMAPSIZE))
- panic("unmapiodev: bad address");
-#endif
-
- va = trunc_page(kva);
- size = round_page(kva + size) - va;
- pmap_kremove(va, size);
- pmap_update(pmap_kernel());
-
- error = extent_free(extio, va, size, EX_NOWAIT);
-#ifdef DIAGNOSTIC
- if (error != 0)
- printf("unmapiodev: extent_free failed\n");
-#endif
-}
-
-void
-device_register(struct device *dev, void *aux)
-{
- if (bootpart == -1) /* ignore flag from controller driver? */
- return;
-
- /*
- * scsi: sd,cd
- */
- if (strcmp("sd", dev->dv_cfdata->cf_driver->cd_name) == 0 ||
- strcmp("cd", dev->dv_cfdata->cf_driver->cd_name) == 0) {
- struct scsi_attach_args *sa = aux;
- int target, bus, lun;
-
-#if defined(MVME141) || defined(MVME147)
- /*
- * Both 141 and 147 do not use the controller number to
- * identify the controller itself, but expect the
- * operating system to match it with its physical address
- * (bootaddr), which is indeed what we are doing.
- * Then the SCSI device id may be found in the controller
- * number, and the device number is zero (except on MVME141
- * when booting from MVME319/320/321/322, which we
- * do not support anyway).
- */
- if (cputyp == CPU_141 || cputyp == CPU_147) {
- target = bootctrllun;
- bus = lun = 0;
- } else
-#endif
- {
- if (get_target(&target, &bus, &lun) != 0)
- return;
-
- /* make sure we are on the expected scsibus */
- if (bootbus != bus)
- return;
- }
-
- if (sa->sa_sc_link->target == target &&
- sa->sa_sc_link->lun == lun) {
- bootdv = dev;
- return;
- }
- }
-
- /*
- * ethernet: ie,le
- */
- else if (strcmp("ie", dev->dv_cfdata->cf_driver->cd_name) == 0 ||
- strcmp("le", dev->dv_cfdata->cf_driver->cd_name) == 0) {
- struct confargs *ca = aux;
-
- if (ca->ca_paddr == bootaddr) {
- bootdv = dev;
- return;
- }
- }
-}
-
-/*
- * Returns the ID of the SCSI disk based on Motorola's CLUN/DLUN stuff
- * This handles SBC SCSI and MVME32[78].
- */
-int
-get_target(int *target, int *bus, int *lun)
-{
- switch (bootctrllun) {
- /* built-in controller */
- case 0x00:
- /* MVME327 */
- case 0x02:
- case 0x03:
- *bus = 0;
- *target = (bootdevlun & 0x70) >> 4;
- *lun = (bootdevlun & 0x07);
- return (0);
- /* MVME328 */
- case 0x06:
- case 0x07:
- case 0x16:
- case 0x17:
- case 0x18:
- case 0x19:
- *bus = (bootdevlun & 0x40) >> 6;
- *target = (bootdevlun & 0x38) >> 3;
- *lun = (bootdevlun & 0x07);
- return (0);
- default:
- return (ENODEV);
- }
-}
-
-struct nam2blk nam2blk[] = {
- { "sd", 4 },
- { "st", 7 },
- { "rd", 9 },
- { "vnd", 6 },
- { NULL, -1 }
-};
diff --git a/sys/arch/mvme68k/mvme68k/bus_dma.c b/sys/arch/mvme68k/mvme68k/bus_dma.c
deleted file mode 100644
index b458ad0c797..00000000000
--- a/sys/arch/mvme68k/mvme68k/bus_dma.c
+++ /dev/null
@@ -1,751 +0,0 @@
-/* $OpenBSD: bus_dma.c,v 1.9 2011/06/23 20:44:39 ariane Exp $ */
-/* $NetBSD: bus_dma.c,v 1.2 2001/06/10 02:31:25 briggs Exp $ */
-
-/*-
- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
- * NASA Ames Research Center.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/extent.h>
-#include <sys/buf.h>
-#include <sys/device.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/mount.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/bus.h>
-#include <machine/intr.h>
-
-int _bus_dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *,
- bus_size_t, struct proc *, int, paddr_t *, int *, int);
-
-int _bus_dmamem_alloc_range(bus_dma_tag_t, bus_size_t, bus_size_t,
- bus_size_t, bus_dma_segment_t *, int, int *, int, paddr_t, paddr_t);
-
-int cachectl_pa(paddr_t, psize_t, int);
-
-/*
- * Common function for DMA map creation. May be called by bus-specific
- * DMA map creation functions.
- */
-int
-bus_dmamap_create(t, size, nsegments, maxsegsz, boundary, flags, dmamp)
- bus_dma_tag_t t;
- bus_size_t size;
- int nsegments;
- bus_size_t maxsegsz;
- bus_size_t boundary;
- int flags;
- bus_dmamap_t *dmamp;
-{
- struct m68k_bus_dmamap *map;
- void *mapstore;
- size_t mapsize;
-
- /*
- * Allocate and initialize the DMA map. The end of the map
- * is a variable-sized array of segments, so we allocate enough
- * room for them in one shot.
- *
- * Note we don't preserve the WAITOK or NOWAIT flags. Preservation
- * of ALLOCNOW notifies others that we've reserved these resources,
- * and they are not to be freed.
- *
- * The bus_dmamap_t includes one bus_dma_segment_t, hence
- * the (nsegments - 1).
- */
- mapsize = sizeof(struct m68k_bus_dmamap) +
- (sizeof(bus_dma_segment_t) * (nsegments - 1));
- if ((mapstore = malloc(mapsize, M_DEVBUF, (flags & BUS_DMA_NOWAIT) ?
- (M_NOWAIT | M_ZERO) : (M_WAITOK | M_ZERO))) == NULL)
- return (ENOMEM);
-
- map = (struct m68k_bus_dmamap *)mapstore;
- map->_dm_size = size;
- map->_dm_segcnt = nsegments;
- map->_dm_maxsegsz = maxsegsz;
- map->_dm_boundary = boundary;
- map->dm_mapsize = 0; /* no valid mappings */
- map->dm_nsegs = 0;
-
- *dmamp = map;
- return (0);
-}
-
-/*
- * Common function for DMA map destruction. May be called by bus-specific
- * DMA map destruction functions.
- */
-void
-bus_dmamap_destroy(t, map)
- bus_dma_tag_t t;
- bus_dmamap_t map;
-{
-
- free(map, M_DEVBUF);
-}
-
-/*
- * Utility function to load a linear buffer. lastaddrp holds state
- * between invocations (for multiple-buffer loads). segp contains
- * the starting segment on entrance, and the ending segment on exit.
- * first indicates if this is the first invocation of this function.
- */
-int
-_bus_dmamap_load_buffer(t, map, buf, buflen, p, flags, lastaddrp, segp, first)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- void *buf;
- bus_size_t buflen;
- struct proc *p;
- int flags;
- paddr_t *lastaddrp;
- int *segp;
- int first;
-{
- bus_size_t sgsize;
- bus_addr_t curaddr, lastaddr, baddr, bmask;
- vaddr_t vaddr = (vaddr_t)buf;
- int seg;
- pmap_t pmap;
-
- if (p != NULL)
- pmap = vm_map_pmap(&p->p_vmspace->vm_map);
- else
- pmap = pmap_kernel();
-
- lastaddr = *lastaddrp;
- bmask = ~(map->_dm_boundary - 1);
-
- for (seg = *segp; buflen > 0 ; ) {
- /*
- * Get the physical address for this segment.
- */
- if (pmap_extract(pmap, vaddr, (paddr_t *)&curaddr) == FALSE)
- return (EINVAL);
-
- /*
- * Compute the segment size, and adjust counts.
- */
- sgsize = PAGE_SIZE - ((u_long)vaddr & PGOFSET);
- if (buflen < sgsize)
- sgsize = buflen;
-
- /*
- * Make sure we don't cross any boundaries.
- */
- if (map->_dm_boundary > 0) {
- baddr = (curaddr + map->_dm_boundary) & bmask;
- if (sgsize > (baddr - curaddr))
- sgsize = (baddr - curaddr);
- }
-
- /*
- * Insert chunk into a segment, coalescing with
- * the previous segment if possible.
- */
- if (first) {
- map->dm_segs[seg].ds_addr = curaddr;
- map->dm_segs[seg].ds_len = sgsize;
- first = 0;
- } else {
- if (curaddr == lastaddr &&
- (map->dm_segs[seg].ds_len + sgsize) <=
- map->_dm_maxsegsz &&
- (map->_dm_boundary == 0 ||
- (map->dm_segs[seg].ds_addr & bmask) ==
- (curaddr & bmask)))
- map->dm_segs[seg].ds_len += sgsize;
- else {
- if (++seg >= map->_dm_segcnt)
- break;
- map->dm_segs[seg].ds_addr = curaddr;
- map->dm_segs[seg].ds_len = sgsize;
- }
- }
-
- lastaddr = curaddr + sgsize;
- vaddr += sgsize;
- buflen -= sgsize;
- }
-
- *segp = seg;
- *lastaddrp = lastaddr;
-
- /*
- * Did we fit?
- */
- if (buflen != 0)
- return (EFBIG); /* XXX better return value here? */
-
- return (0);
-}
-
-/*
- * Common function for loading a DMA map with a linear buffer. May
- * be called by bus-specific DMA map load functions.
- */
-int
-bus_dmamap_load(t, map, buf, buflen, p, flags)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- void *buf;
- bus_size_t buflen;
- struct proc *p;
- int flags;
-{
- paddr_t lastaddr;
- int seg, error;
-
- /*
- * Make sure that on error condition we return "no valid mappings".
- */
- map->dm_mapsize = 0;
- map->dm_nsegs = 0;
-
- if (buflen > map->_dm_size)
- return (EINVAL);
-
- seg = 0;
- error = _bus_dmamap_load_buffer(t, map, buf, buflen, p, flags,
- &lastaddr, &seg, 1);
- if (error == 0) {
- map->dm_mapsize = buflen;
- map->dm_nsegs = seg + 1;
- }
- return (error);
-}
-
-/*
- * Like _bus_dmamap_load(), but for mbufs.
- */
-int
-bus_dmamap_load_mbuf(t, map, m0, flags)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- struct mbuf *m0;
- int flags;
-{
- paddr_t lastaddr;
- int seg, error, first;
- struct mbuf *m;
-
- /*
- * Make sure that on error condition we return "no valid mappings."
- */
- map->dm_mapsize = 0;
- map->dm_nsegs = 0;
-
-#ifdef DIAGNOSTIC
- if ((m0->m_flags & M_PKTHDR) == 0)
- panic("bus_dmamap_load_mbuf: no packet header");
-#endif
-
- if (m0->m_pkthdr.len > map->_dm_size)
- return (EINVAL);
-
- first = 1;
- seg = 0;
- error = 0;
- for (m = m0; m != NULL && error == 0; m = m->m_next) {
- if (m->m_len == 0)
- continue;
- error = _bus_dmamap_load_buffer(t, map, m->m_data, m->m_len,
- NULL, flags, &lastaddr, &seg, first);
- first = 0;
- }
- if (error == 0) {
- map->dm_mapsize = m0->m_pkthdr.len;
- map->dm_nsegs = seg + 1;
- }
- return (error);
-}
-
-/*
- * Like _bus_dmamap_load(), but for uios.
- */
-int
-bus_dmamap_load_uio(t, map, uio, flags)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- struct uio *uio;
- int flags;
-{
- paddr_t lastaddr;
- int seg, i, error, first;
- bus_size_t minlen, resid;
- struct proc *p = NULL;
- struct iovec *iov;
- caddr_t addr;
-
- /*
- * Make sure that on error condition we return "no valid mappings."
- */
- map->dm_mapsize = 0;
- map->dm_nsegs = 0;
-
- resid = uio->uio_resid;
- iov = uio->uio_iov;
-
- if (resid > map->_dm_size)
- return (EINVAL);
-
- if (uio->uio_segflg == UIO_USERSPACE) {
- p = uio->uio_procp;
-#ifdef DIAGNOSTIC
- if (p == NULL)
- panic("bus_dmamap_load_uio: USERSPACE but no proc");
-#endif
- }
-
- first = 1;
- seg = 0;
- error = 0;
- for (i = 0; i < uio->uio_iovcnt && resid != 0 && error == 0; i++) {
- /*
- * Now at the first iovec to load. Load each iovec
- * until we have exhausted the residual count.
- */
- minlen = resid < iov[i].iov_len ? resid : iov[i].iov_len;
- addr = (caddr_t)iov[i].iov_base;
-
- error = _bus_dmamap_load_buffer(t, map, addr, minlen,
- p, flags, &lastaddr, &seg, first);
- first = 0;
-
- resid -= minlen;
- }
- if (error == 0) {
- map->dm_mapsize = uio->uio_resid;
- map->dm_nsegs = seg + 1;
- }
- return (error);
-}
-
-/*
- * Like bus_dmamap_load(), but for raw memory allocated with
- * bus_dmamem_alloc().
- */
-int
-bus_dmamap_load_raw(t, map, segs, nsegs, size, flags)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- bus_dma_segment_t *segs;
- int nsegs;
- bus_size_t size;
- int flags;
-{
- if (nsegs > map->_dm_segcnt || size > map->_dm_size)
- return (EINVAL);
-
- /*
- * Make sure we don't cross any boundaries.
- */
- if (map->_dm_boundary) {
- bus_addr_t bmask = ~(map->_dm_boundary - 1);
- int i;
-
- for (i = 0; i < nsegs; i++) {
- if (segs[i].ds_len > map->_dm_maxsegsz)
- return (EINVAL);
- if ((segs[i].ds_addr & bmask) !=
- ((segs[i].ds_addr + segs[i].ds_len - 1) & bmask))
- return (EINVAL);
- }
- }
-
- bcopy(segs, map->dm_segs, nsegs * sizeof(*segs));
- map->dm_nsegs = nsegs;
- return (0);
-}
-
-/*
- * Common function for unloading a DMA map. May be called by
- * chipset-specific DMA map unload functions.
- */
-void
-bus_dmamap_unload(t, map)
- bus_dma_tag_t t;
- bus_dmamap_t map;
-{
-
- /*
- * No resources to free; just mark the mappings as
- * invalid.
- */
- map->dm_mapsize = 0;
- map->dm_nsegs = 0;
-}
-
-/*
- * Common function for DMA map synchronization. May be called
- * by chipset-specific DMA map synchronization functions.
- */
-
-void
-bus_dmamap_sync(t, map, offset, len, op)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- bus_addr_t offset;
- bus_size_t len;
- int op;
-{
- u_int nsegs;
- bus_dma_segment_t *seg;
-
- /* nothing to do for POSTWRITE */
- if ((op & ~BUS_DMASYNC_POSTWRITE) == 0)
- return;
-
- nsegs = map->dm_nsegs;
- seg = map->dm_segs;
- while (nsegs != 0 && len != 0) {
- if (offset >= seg->ds_len) {
- offset -= seg->ds_len;
- } else {
- bus_addr_t addr;
- bus_size_t sublen;
-
- addr = seg->ds_addr + offset;
- sublen = seg->ds_len - offset;
- if (sublen > len)
- sublen = len;
-
- if (cachectl_pa(addr, sublen, op) != 0)
- break;
-
- offset = 0;
- len -= sublen;
- }
- seg++;
- nsegs--;
- }
-}
-
-/*
- * Common function for DMA-safe memory allocation. May be called
- * by bus-specific DMA memory allocation functions.
- */
-int
-bus_dmamem_alloc(t, size, alignment, boundary, segs, nsegs, rsegs, flags)
- bus_dma_tag_t t;
- bus_size_t size, alignment, boundary;
- bus_dma_segment_t *segs;
- int nsegs;
- int *rsegs;
- int flags;
-{
- return _bus_dmamem_alloc_range(t, size, alignment, boundary, segs,
- nsegs, rsegs, flags, 0, -1);
-}
-
-/*
- * Common function for freeing DMA-safe memory. May be called by
- * bus-specific DMA memory free functions.
- */
-void
-bus_dmamem_free(t, segs, nsegs)
- bus_dma_tag_t t;
- bus_dma_segment_t *segs;
- int nsegs;
-{
- struct vm_page *m;
- bus_addr_t addr;
- struct pglist mlist;
- int curseg;
-
- /*
- * Build a list of pages to free back to the VM system.
- */
- TAILQ_INIT(&mlist);
- for (curseg = 0; curseg < nsegs; curseg++) {
- for (addr = segs[curseg].ds_addr;
- addr < (segs[curseg].ds_addr + segs[curseg].ds_len);
- addr += PAGE_SIZE) {
- m = PHYS_TO_VM_PAGE(addr);
- TAILQ_INSERT_TAIL(&mlist, m, pageq);
- }
- }
-
- uvm_pglistfree(&mlist);
-}
-
-/*
- * Common function for mapping DMA-safe memory. May be called by
- * bus-specific DMA memory map functions.
- */
-int
-bus_dmamem_map(t, segs, nsegs, size, kvap, flags)
- bus_dma_tag_t t;
- bus_dma_segment_t *segs;
- int nsegs;
- size_t size;
- caddr_t *kvap;
- int flags;
-{
- vaddr_t va, sva;
- size_t ssize;
- bus_addr_t addr;
- int curseg, error;
-
- size = round_page(size);
-
- va = uvm_km_valloc(kernel_map, size);
-
- if (va == 0)
- return (ENOMEM);
-
- *kvap = (caddr_t)va;
-
- sva = va;
- ssize = size;
- for (curseg = 0; curseg < nsegs; curseg++) {
- for (addr = segs[curseg].ds_addr;
- addr < (segs[curseg].ds_addr + segs[curseg].ds_len);
- addr += PAGE_SIZE, va += PAGE_SIZE, size -= PAGE_SIZE) {
- if (size == 0)
- panic("bus_dmamem_map: size botch");
- error = pmap_enter(pmap_kernel(), va, addr,
- VM_PROT_READ | VM_PROT_WRITE, VM_PROT_READ |
- VM_PROT_WRITE | PMAP_WIRED | PMAP_CANFAIL);
- if (error) {
- pmap_update(pmap_kernel());
- uvm_km_free(kernel_map, sva, ssize);
- return (error);
- }
- }
- }
- pmap_update(pmap_kernel());
-
- return (0);
-}
-
-/*
- * Common function for unmapping DMA-safe memory. May be called by
- * bus-specific DMA memory unmapping functions.
- */
-void
-bus_dmamem_unmap(t, kva, size)
- bus_dma_tag_t t;
- caddr_t kva;
- size_t size;
-{
-
-#ifdef DIAGNOSTIC
- if ((u_long)kva & PGOFSET)
- panic("bus_dmamem_unmap");
-#endif
-
- size = round_page(size);
- uvm_km_free(kernel_map, (vaddr_t)kva, size);
-}
-
-/*
- * Common function for mmap(2)'ing DMA-safe memory. May be called by
- * bus-specific DMA mmap(2)'ing functions.
- */
-paddr_t
-bus_dmamem_mmap(t, segs, nsegs, off, prot, flags)
- bus_dma_tag_t t;
- bus_dma_segment_t *segs;
- int nsegs;
- off_t off;
- int prot, flags;
-{
- int i;
-
- for (i = 0; i < nsegs; i++) {
-#ifdef DIAGNOSTIC
- if (off & PGOFSET)
- panic("bus_dmamem_mmap: offset unaligned");
- if (segs[i].ds_addr & PGOFSET)
- panic("bus_dmamem_mmap: segment unaligned");
- if (segs[i].ds_len & PGOFSET)
- panic("bus_dmamem_mmap: segment size not multiple"
- " of page size");
-#endif
- if (off >= segs[i].ds_len) {
- off -= segs[i].ds_len;
- continue;
- }
-
- return (segs[i].ds_addr + off);
- }
-
- /* Page not found. */
- return (-1);
-}
-
-/*
- * Allocate physical memory from the given physical address range.
- * Called by DMA-safe memory allocation methods.
- */
-int
-_bus_dmamem_alloc_range(t, size, alignment, boundary, segs, nsegs, rsegs,
- flags, low, high)
- bus_dma_tag_t t;
- bus_size_t size, alignment, boundary;
- bus_dma_segment_t *segs;
- int nsegs;
- int *rsegs;
- int flags;
- paddr_t low;
- paddr_t high;
-{
- paddr_t curaddr, lastaddr;
- struct vm_page *m;
- struct pglist mlist;
- int curseg, error, plaflag;
-
- /* Always round the size. */
- size = round_page(size);
-
- /*
- * Allocate pages from the VM system.
- */
- plaflag = flags & BUS_DMA_NOWAIT ? UVM_PLA_NOWAIT : UVM_PLA_WAITOK;
- if (flags & BUS_DMA_ZERO)
- plaflag |= UVM_PLA_ZERO;
-
- TAILQ_INIT(&mlist);
- error = uvm_pglistalloc(size, low, high, alignment, boundary,
- &mlist, nsegs, plaflag);
- if (error)
- return (error);
-
- /*
- * Compute the location, size, and number of segments actually
- * returned by the VM code.
- */
- m = TAILQ_FIRST(&mlist);
- curseg = 0;
- lastaddr = segs[curseg].ds_addr = VM_PAGE_TO_PHYS(m);
- segs[curseg].ds_len = PAGE_SIZE;
- m = TAILQ_NEXT(m, pageq);
-
- for (; m != TAILQ_END(&mlist); m = TAILQ_NEXT(m, pageq)) {
- curaddr = VM_PAGE_TO_PHYS(m);
-#ifdef DIAGNOSTIC
- if (curaddr < low || curaddr >= high) {
- panic("_bus_dmamem_alloc_range: uvm_pglistalloc "
- "returned non-sensical address 0x%lx\n", curaddr);
- }
-#endif
- if (curaddr == (lastaddr + PAGE_SIZE))
- segs[curseg].ds_len += PAGE_SIZE;
- else {
- curseg++;
- segs[curseg].ds_addr = curaddr;
- segs[curseg].ds_len = PAGE_SIZE;
- }
- lastaddr = curaddr;
- }
-
- *rsegs = curseg + 1;
-
- return (0);
-}
-
-/*
- * Helper function for bus_dmamap_sync(). Returns nonzero if the whole
- * cache has been affected.
- */
-int
-cachectl_pa(paddr_t pa, psize_t len, int op)
-{
-#if defined(M68040) || defined(M68060)
- if (mmutype <= MMU_68040) {
- int inc;
- paddr_t end;
-
- /*
- * 68040 and 68060 only have the ``write back and
- * invalidate'' (flush) and ``invalidate'' cache operations.
- *
- * The logic is thus:
- * BUS_DMASYNC_PREREAD: flush D$, purge I$
- * BUS_DMASYNC_PREWRITE: flush D$ (only write back necessary)
- * BUS_DMASYNC_POSTREAD: purge D$ and I$
- */
-
- /*
- * If the size is larger than two pages, don't try
- * to be smart and operate on the whole cache.
- * Remember the largest L1 cache is 8KB anyway (on 68060).
- */
- if (len >= 2 * PAGE_SIZE) {
- DCFA();
- if (op & (BUS_DMASYNC_PREREAD | BUS_DMASYNC_POSTREAD))
- ICPA();
- return 1;
- }
-
- end = pa + len;
- if (len <= 1024) {
- pa = pa & ~0x0f;
- inc = 16;
- } else {
- pa = pa & ~PAGE_MASK;
- inc = PAGE_SIZE;
- }
- do {
- if (op & (BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE)) {
- if (inc == 16)
- DCFL(pa);
- else
- DCFP(pa);
- } else {
- if (inc == 16)
- DCPL(pa);
- else
- DCPP(pa);
- }
- if (op & (BUS_DMASYNC_PREREAD | BUS_DMASYNC_POSTREAD)) {
- if (inc == 16)
- ICPL(pa);
- else
- ICPP(pa);
- }
- pa += inc;
- } while (pa < end);
-
- return 0;
- }
-#endif
-
- DCIA();
- ICIA();
- return 1;
-}
diff --git a/sys/arch/mvme68k/mvme68k/conf.c b/sys/arch/mvme68k/mvme68k/conf.c
deleted file mode 100644
index 404a9f6a064..00000000000
--- a/sys/arch/mvme68k/mvme68k/conf.c
+++ /dev/null
@@ -1,316 +0,0 @@
-/* $OpenBSD: conf.c,v 1.56 2013/12/01 21:56:42 miod Exp $ */
-
-/*-
- * Copyright (c) 1995 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)conf.c 7.9 (Berkeley) 5/28/91
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/vnode.h>
-
-#include <machine/conf.h>
-
-#include "st.h"
-#include "sd.h"
-#include "cd.h"
-#include "ch.h"
-#include "uk.h"
-#ifdef notyet
-#include "xd.h"
-bdev_decl(xd);
-#endif
-#include "vnd.h"
-#include "rd.h"
-
-struct bdevsw bdevsw[] =
-{
- bdev_notdef(), /* 0 */
- bdev_notdef(), /* 1 */
- bdev_notdef(), /* 2 */
- bdev_swap_init(1,sw), /* 3: swap pseudo-device */
- bdev_disk_init(NSD,sd), /* 4: SCSI disk */
- bdev_notdef(), /* 5: was: concatenated disk driver */
- bdev_disk_init(NVND,vnd), /* 6: vnode disk driver */
- bdev_tape_init(NST,st), /* 7: SCSI tape */
- bdev_disk_init(NCD,cd), /* 8: SCSI CD-ROM */
- bdev_disk_init(NRD,rd), /* 9: RAM disk - for install tape */
-#ifdef notyet
- bdev_disk_init(NXD,xd), /* 10: XD disk */
-#else
- bdev_notdef(), /* 10 */
-#endif
- bdev_notdef(), /* 11 */
- bdev_notdef(), /* 12 */
- bdev_lkm_dummy(), /* 13 */
- bdev_lkm_dummy(), /* 14 */
- bdev_lkm_dummy(), /* 15 */
- bdev_lkm_dummy(), /* 16 */
- bdev_lkm_dummy(), /* 17 */
- bdev_lkm_dummy(), /* 18 */
-};
-int nblkdev = nitems(bdevsw);
-
-#include "sram.h"
-#include "vmel.h"
-#include "vmes.h"
-#include "nvram.h"
-#include "flash.h"
-
-#include "bio.h"
-#include "pty.h"
-cdev_decl(fd);
-
-#include "cl.h"
-#include "dart.h"
-#include "wl.h"
-#include "zs.h"
-#include "zstty.h"
-
-/* open, close, write, ioctl */
-#define cdev_lp_init(c,n) { \
- dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
- dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
- 0, seltrue, (dev_type_mmap((*))) enodev }
-
-/* open, close, ioctl, mmap, ioctl */
-#define cdev_mdev_init(c,n) { \
- dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
- dev_init(c,n,write), dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, (dev_type_poll((*))) enodev, \
- dev_init(c,n,mmap) }
-
-#include "lp.h"
-#include "lptwo.h"
-cdev_decl(lptwo);
-#include "ksyms.h"
-
-#ifdef notyet
-cdev_decl(xd);
-#endif
-
-#include "bpfilter.h"
-#include "tun.h"
-
-#include "pf.h"
-
-#include "systrace.h"
-
-#include "vscsi.h"
-#include "pppx.h"
-#include "fuse.h"
-
-struct cdevsw cdevsw[] =
-{
- cdev_cn_init(1,cn), /* 0: virtual console */
- cdev_ctty_init(1,ctty), /* 1: controlling terminal */
- cdev_mm_init(1,mm), /* 2: /dev/{null,mem,kmem,...} */
- cdev_notdef(), /* 3 was /dev/drum */
- cdev_tty_init(NPTY,pts), /* 4: pseudo-tty slave */
- cdev_ptc_init(NPTY,ptc), /* 5: pseudo-tty master */
- cdev_log_init(1,log), /* 6: /dev/klog */
- cdev_mdev_init(NSRAM,sram), /* 7: /dev/sramX */
- cdev_disk_init(NSD,sd), /* 8: SCSI disk */
- cdev_disk_init(NCD,cd), /* 9: SCSI CD-ROM */
- cdev_mdev_init(NNVRAM,nvram), /* 10: /dev/nvramX */
- cdev_mdev_init(NFLASH,flash), /* 11: /dev/flashX */
- cdev_tty_init(NZSTTY,zs), /* 12: SCC serial (tty[a-d]) */
- cdev_tty_init(NCL,cl), /* 13: CL-CD2400 serial (tty0[0-3]) */
- cdev_tty_init(NDART,dart), /* 14: MC68681 serial (ttyd[0-1]) */
- cdev_notdef(), /* 15 */
- cdev_notdef(), /* 16 */
- cdev_notdef(), /* 17: was: concatenated disk */
- cdev_disk_init(NRD,rd), /* 18: ramdisk device */
- cdev_disk_init(NVND,vnd), /* 19: vnode disk */
- cdev_tape_init(NST,st), /* 20: SCSI tape */
- cdev_fd_init(1,filedesc), /* 21: file descriptor pseudo-dev */
- cdev_bpf_init(NBPFILTER,bpf), /* 22: berkeley packet filter */
- cdev_tun_init(NTUN,tun), /* 23: network tunnel */
- cdev_lkm_init(NLKM,lkm), /* 24: loadable module driver */
- cdev_notdef(), /* 25 */
-#ifdef notyet
- cdev_disk_init(NXD,xd), /* 26: XD disk */
-#else
- cdev_notdef(), /* 26 */
-#endif
- cdev_bio_init(NBIO,bio), /* 27: ioctl tunnel */
- cdev_lp_init(NLP,lp), /* 28: lp */
- cdev_lp_init(NLPTWO,lptwo), /* 29: lptwo */
- cdev_tty_init(NWL,wl), /* 30: WG CL-CD2400 serial (ttywX) */
- cdev_mdev_init(NVMEL,vmel), /* 31: /dev/vmelX */
- cdev_mdev_init(NVMES,vmes), /* 32: /dev/vmesX */
- cdev_lkm_dummy(), /* 33 */
- cdev_lkm_dummy(), /* 34 */
- cdev_lkm_dummy(), /* 35 */
- cdev_lkm_dummy(), /* 36 */
- cdev_lkm_dummy(), /* 37 */
- cdev_lkm_dummy(), /* 38 */
- cdev_pf_init(NPF,pf), /* 39: packet filter */
- cdev_random_init(1,random), /* 40: random data source */
- cdev_uk_init(NUK,uk), /* 41: unknown SCSI */
- cdev_notdef(), /* 42 */
- cdev_ksyms_init(NKSYMS,ksyms), /* 43: Kernel symbols device */
- cdev_ch_init(NCH,ch), /* 44: SCSI autochanger */
- cdev_lkm_dummy(), /* 45 */
- cdev_lkm_dummy(), /* 46 */
- cdev_lkm_dummy(), /* 47 */
- cdev_lkm_dummy(), /* 48 */
- cdev_lkm_dummy(), /* 49 */
- cdev_systrace_init(NSYSTRACE,systrace), /* 50 system call tracing */
- cdev_lkm_dummy(), /* 51 */
- cdev_ptm_init(NPTY,ptm), /* 52: pseudo-tty ptm device */
- cdev_vscsi_init(NVSCSI,vscsi), /* 53: vscsi */
- cdev_disk_init(1,diskmap), /* 54: disk mapper */
- cdev_pppx_init(NPPPX,pppx), /* 55: pppx */
- cdev_notdef(), /* 56: hotplug on hp300 */
- cdev_fuse_init(NFUSE,fuse), /* 57: fuse */
-};
-int nchrdev = nitems(cdevsw);
-
-int mem_no = 2; /* major device number of memory special file */
-
-/*
- * Swapdev is a fake device implemented
- * in sw.c used only internally to get to swstrategy.
- * It cannot be provided to the users, because the
- * swstrategy routine munches the b_dev and b_blkno entries
- * before calling the appropriate driver. This would horribly
- * confuse, e.g. the hashing routines. Instead, /dev/drum is
- * provided as a character (raw) device.
- */
-dev_t swapdev = makedev(3, 0);
-
-/*
- * Returns true if dev is /dev/mem or /dev/kmem.
- */
-int
-iskmemdev(dev)
- dev_t dev;
-{
-
- return (major(dev) == mem_no && minor(dev) < 2);
-}
-
-/*
- * Returns true if dev is /dev/zero.
- */
-int
-iszerodev(dev)
- dev_t dev;
-{
-
- return (major(dev) == mem_no && minor(dev) == 12);
-}
-
-dev_t
-getnulldev()
-{
- return makedev(mem_no, 2);
-}
-
-int chrtoblktbl[] = {
- /* XXXX This needs to be dynamic for LKMs. */
- /*VCHR*/ /*VBLK*/
- /* 0 */ NODEV,
- /* 1 */ NODEV,
- /* 2 */ NODEV,
- /* 3 */ NODEV,
- /* 4 */ NODEV,
- /* 5 */ NODEV,
- /* 6 */ NODEV,
- /* 7 */ NODEV,
- /* 8 */ 4, /* sd */
- /* 9 */ 8, /* cd */
- /* 10 */ NODEV,
- /* 11 */ NODEV,
- /* 12 */ NODEV,
- /* 13 */ NODEV,
- /* 14 */ NODEV,
- /* 15 */ NODEV,
- /* 16 */ NODEV,
- /* 17 */ NODEV,
- /* 18 */ 9, /* rd */
- /* 19 */ 6, /* vnd */
- /* 20 */ 7, /* st */
- /* 21 */ NODEV,
- /* 22 */ NODEV,
- /* 23 */ NODEV,
- /* 24 */ NODEV,
- /* 25 */ NODEV,
- /* 26 */ 10, /* xd */
-};
-int nchrtoblktbl = nitems(chrtoblktbl);
-
-#include <dev/cons.h>
-
-#define clcnpollc nullcnpollc
-cons_decl(cl);
-#define dartcnpollc nullcnpollc
-cons_decl(dart);
-#define zscnpollc nullcnpollc
-cons_decl(zs);
-
-struct consdev constab[] = {
-#if NCL > 0
- cons_init(cl),
-#endif
-#if NDART > 0
- cons_init(dart),
-#endif
-#if NZS > 0
- cons_init(zs),
-#endif
- { 0 },
-};
diff --git a/sys/arch/mvme68k/mvme68k/disksubr.c b/sys/arch/mvme68k/mvme68k/disksubr.c
deleted file mode 100644
index a31bfabe25d..00000000000
--- a/sys/arch/mvme68k/mvme68k/disksubr.c
+++ /dev/null
@@ -1,254 +0,0 @@
-/* $OpenBSD: disksubr.c,v 1.73 2011/10/21 13:08:01 miod Exp $ */
-/*
- * Copyright (c) 1998 Steve Murphree, Jr.
- * Copyright (c) 1995 Dale Rahn.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/disklabel.h>
-#include <sys/disk.h>
-
-void bsdtocpulabel(struct disklabel *, struct mvmedisklabel *);
-int cputobsdlabel(struct disklabel *, struct mvmedisklabel *);
-
-/*
- * Attempt to read a disk label from a device
- * using the indicated strategy routine.
- * The label must be partly set up before this:
- * secpercyl and anything required in the strategy routine
- * (e.g., sector size) must be filled in before calling us.
- */
-int
-readdisklabel(dev_t dev, void (*strat)(struct buf *),
- struct disklabel *lp, int spoofonly)
-{
- struct buf *bp = NULL;
- int error;
-
- if ((error = initdisklabel(lp)))
- goto done;
-
- /* get a buffer and initialize it */
- bp = geteblk((int)lp->d_secsize);
- bp->b_dev = dev;
-
- /* don't read the on-disk label if we are in spoofed-only mode */
- if (spoofonly)
- goto done;
-
- bp->b_blkno = LABELSECTOR;
- bp->b_bcount = lp->d_secsize;
- CLR(bp->b_flags, B_READ | B_WRITE | B_DONE);
- SET(bp->b_flags, B_BUSY | B_READ | B_RAW);
- (*strat)(bp);
- if (biowait(bp)) {
- error = bp->b_error;
- goto done;
- }
-
- error = cputobsdlabel(lp, (struct mvmedisklabel *)bp->b_data);
- if (error == 0)
- goto done;
-
-#if defined(CD9660)
- error = iso_disklabelspoof(dev, strat, lp);
- if (error == 0)
- goto done;
-#endif
-#if defined(UDF)
- error = udf_disklabelspoof(dev, strat, lp);
- if (error == 0)
- goto done;
-#endif
-
-done:
- if (bp) {
- bp->b_flags |= B_INVAL;
- brelse(bp);
- }
- disk_change = 1;
- return (error);
-}
-
-/*
- * Write disk label back to device after modification.
- */
-int
-writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp)
-{
- struct buf *bp = NULL;
- int error;
-
- /* get a buffer and initialize it */
- bp = geteblk((int)lp->d_secsize);
- bp->b_dev = dev;
-
- /* Read it in, slap the new label in, and write it back out */
- bp->b_blkno = LABELSECTOR;
- bp->b_bcount = lp->d_secsize;
- CLR(bp->b_flags, B_READ | B_WRITE | B_DONE);
- SET(bp->b_flags, B_BUSY | B_READ | B_RAW);
- (*strat)(bp);
- if ((error = biowait(bp)) != 0)
- goto done;
-
- bsdtocpulabel(lp, (struct mvmedisklabel *)bp->b_data);
-
- CLR(bp->b_flags, B_READ | B_WRITE | B_DONE);
- SET(bp->b_flags, B_BUSY | B_WRITE | B_RAW);
- (*strat)(bp);
- error = biowait(bp);
-
-done:
- if (bp) {
- bp->b_flags |= B_INVAL;
- brelse(bp);
- }
- disk_change = 1;
- return (error);
-}
-
-void
-bsdtocpulabel(struct disklabel *lp, struct mvmedisklabel *clp)
-{
- char *tmot = "MOTOROLA", *id = "M88K", *mot;
- int i;
- u_short osa_u, osa_l, osl;
- u_int oss;
-
- /* preserve existing VID boot code information */
- osa_u = clp->vid_osa_u;
- osa_l = clp->vid_osa_l;
- osl = clp->vid_osl;
- oss = clp->vid_oss;
- bzero(clp, sizeof(*clp));
- clp->vid_osa_u = osa_u;
- clp->vid_osa_l = osa_l;
- clp->vid_osl = osl;
- clp->vid_oss = oss;
- clp->vid_cas = clp->vid_cal = 1;
-
- clp->magic1 = lp->d_magic;
- clp->type = lp->d_type;
- clp->subtype = lp->d_subtype;
- strncpy(clp->vid_vd, lp->d_typename, 16);
- strncpy(clp->packname, lp->d_packname, 16);
- clp->cfg_psm = lp->d_secsize;
- clp->cfg_spt = lp->d_nsectors;
- clp->cfg_trk = lp->d_ncylinders; /* trk is really num of cyl! */
- clp->cfg_hds = lp->d_ntracks;
-
- clp->secpercyl = lp->d_secpercyl;
- clp->secperunit = DL_GETDSIZE(lp);
- clp->acylinders = lp->d_acylinders;
-
- clp->cfg_ilv = 1;
- clp->cfg_sof = 1;
- clp->cylskew = 1;
- clp->headswitch = 0;
- clp->cfg_ssr = 0;
- clp->flags = lp->d_flags;
- for (i = 0; i < NDDATA; i++)
- clp->drivedata[i] = lp->d_drivedata[i];
- for (i = 0; i < NSPARE; i++)
- clp->spare[i] = lp->d_spare[i];
-
- clp->magic2 = lp->d_magic2;
- clp->checksum = lp->d_checksum;
- clp->partitions = lp->d_npartitions;
- clp->bbsize = lp->d_bbsize;
- clp->sbsize = lp->d_sbsize;
- clp->checksum = lp->d_checksum;
- bcopy(&lp->d_partitions[0], clp->vid_4, sizeof(struct partition) * 4);
- bcopy(&lp->d_partitions[4], clp->cfg_4, sizeof(struct partition) * 12);
- clp->version = 2;
- bcopy(&lp->d_uid, clp->vid_4_1, sizeof(lp->d_uid));
-
- /* Put "MOTOROLA" in the VID. This makes it a valid boot disk. */
- for (mot = clp->vid_mot, i = 0; i < 8; i++)
- *mot++ = *tmot++;
-
- /* put volume id in the VID */
- for (mot = clp->vid_id, i = 0; i < 4; i++)
- *mot++ = *id++;
-}
-
-int
-cputobsdlabel(struct disklabel *lp, struct mvmedisklabel *clp)
-{
- int i;
-
- if (clp->magic1 != DISKMAGIC || clp->magic2 != DISKMAGIC)
- return (EINVAL); /* no disk label */
-
- lp->d_magic = clp->magic1;
- lp->d_type = clp->type;
- lp->d_subtype = clp->subtype;
- strncpy(lp->d_typename, clp->vid_vd, sizeof lp->d_typename);
- strncpy(lp->d_packname, clp->packname, sizeof lp->d_packname);
- lp->d_secsize = clp->cfg_psm;
- lp->d_nsectors = clp->cfg_spt;
- lp->d_ncylinders = clp->cfg_trk; /* trk is really num of cyl! */
- lp->d_ntracks = clp->cfg_hds;
-
- lp->d_secpercyl = clp->secpercyl;
- if (DL_GETDSIZE(lp) == 0)
- DL_SETDSIZE(lp, clp->secperunit);
- lp->d_acylinders = clp->acylinders;
- lp->d_flags = clp->flags;
- for (i = 0; i < NDDATA; i++)
- lp->d_drivedata[i] = clp->drivedata[i];
- for (i = 0; i < NSPARE; i++)
- lp->d_spare[i] = clp->spare[i];
-
- lp->d_magic2 = clp->magic2;
- lp->d_npartitions = clp->partitions;
- lp->d_bbsize = clp->bbsize;
- lp->d_sbsize = clp->sbsize;
-
- bcopy(clp->vid_4, &lp->d_partitions[0], sizeof(struct partition) * 4);
- bcopy(clp->cfg_4, &lp->d_partitions[4], sizeof(struct partition) * 12);
- bcopy(clp->vid_4_1, &lp->d_uid, sizeof(lp->d_uid));
-
- if (clp->version < 2) {
- struct __partitionv0 *v0pp = (struct __partitionv0 *)lp->d_partitions;
- struct partition *pp = lp->d_partitions;
-
- for (i = 0; i < lp->d_npartitions; i++, pp++, v0pp++) {
- pp->p_fragblock = DISKLABELV1_FFS_FRAGBLOCK(v0pp->
- p_fsize, v0pp->p_frag);
- pp->p_offseth = 0;
- pp->p_sizeh = 0;
- }
- }
-
- lp->d_version = 1;
- lp->d_checksum = 0;
- lp->d_checksum = dkcksum(lp);
- return (0);
-}
diff --git a/sys/arch/mvme68k/mvme68k/genassym.cf b/sys/arch/mvme68k/mvme68k/genassym.cf
deleted file mode 100644
index c1d498af3c7..00000000000
--- a/sys/arch/mvme68k/mvme68k/genassym.cf
+++ /dev/null
@@ -1,144 +0,0 @@
-# $OpenBSD: genassym.cf,v 1.23 2009/03/01 22:08:13 miod Exp $
-
-#
-# Copyright (c) 1995 Theo de Raadt
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
-# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
-# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# Copyright (c) 1982, 1990, 1993
-# The Regents of the University of California. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. Neither the name of the University nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-# @(#)genassym.c 8.3 (Berkeley) 1/4/94
-#
-
-include <sys/param.h>
-include <sys/buf.h>
-include <sys/proc.h>
-include <sys/mbuf.h>
-include <sys/msgbuf.h>
-include <sys/syscall.h>
-include <sys/types.h>
-include <sys/user.h>
-
-include <uvm/uvm_extern.h>
-
-include <machine/cpu.h>
-include <machine/psl.h>
-include <machine/nvram.h>
-include <machine/reg.h>
-include <machine/autoconf.h>
-include <machine/prom.h>
-include <machine/pte.h>
-
-# general constants
-export USPACE
-export PGSHIFT
-export USRSTACK
-
-# proc fields and values
-struct proc
-member P_MD_FLAGS p_md.md_flags
-member P_MD_REGS p_md.md_regs
-
-# PSL values
-export PSL_S
-export PSL_IPL7
-export PSL_LOWIPL
-export PSL_USER
-define SPL1 PSL_S | PSL_IPL1
-
-# pte/ste bits
-export PG_FRAME
-
-# pcb fields
-struct pcb
-member pcb_ps
-member pcb_usp
-member pcb_regs
-member PCB_FPCTX pcb_fpregs
-define SIZEOF_PCB sizeof(struct pcb)
-
-# exception frame size
-define FR_SIZE sizeof(struct trapframe)
-
-define SIZEOF_MVMEPROM_BRDID sizeof(struct mvmeprom_brdid)
-define MVMEPROM_BRDID_MODEL offsetof(struct mvmeprom_brdid, model)
-
-struct nvram_147 NVRAM_147_
-member ether
-member emem
-
-export INTIOBASE_141
-export INTIOBASE_147
-export INTIOBASE_162
-export INTIOBASE_165
-export INTIOSIZE_141
-export INTIOSIZE_147
-export INTIOSIZE_162
-export INTIOSIZE_165
-
-export CPU_141
-export CPU_147
-export CPU_162
-export CPU_165
-export CPU_166
-export CPU_167
-export CPU_172
-export CPU_176
-export CPU_177
-
-export BUS_LRC
-export BUS_MC
-export BUS_OFOBIO
-export BUS_PCC
-export BUS_PCCTWO
-
-struct prom_netctrl NETCTRL_
-member dev
-member ctrl
-member cmd
-member addr
-member len
diff --git a/sys/arch/mvme68k/mvme68k/locore.s b/sys/arch/mvme68k/mvme68k/locore.s
deleted file mode 100644
index 2bf8a421273..00000000000
--- a/sys/arch/mvme68k/mvme68k/locore.s
+++ /dev/null
@@ -1,1904 +0,0 @@
-/* $OpenBSD: locore.s,v 1.63 2013/02/02 13:36:05 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * Copyright (c) 1999 Steve Murphree, Jr. (68060 support)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1980, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: locore.s 1.66 92/12/22$
- *
- * @(#)locore.s 8.6 (Berkeley) 5/27/94
- */
-
-#include "assym.h"
-#include "ksyms.h"
-#include <machine/asm.h>
-#include <machine/prom.h>
-#include <machine/trap.h>
-
-/*
- * Relocate a symbol, used before MMU is enabled.
- */
-#define _RELOC(var, ar) \
- lea var,ar
-
-#define RELOC(var, ar) _RELOC(_C_LABEL(var), ar)
-#define ASRELOC(var, ar) _RELOC(_ASM_LABEL(var), ar)
-
-/*
- * Invoke a BUG routine.
- */
-#define BUGCALL(id) \
- trap #15; \
- .short id
-
-/*
- * Temporary stack for a variety of purposes.
- * Try and make this the first thing is the data segment so it
- * is page aligned. Note that if we overflow here, we run into
- * our text segment.
- */
- .data
- .space NBPG
-ASLOCAL(tmpstk)
-
-/*
- * Initialization
- *
- * The bootstrap loader loads us in starting at 0, and VBR is non-zero.
- * On entry, args on stack are boot device, boot filename, console unit,
- * boot flags (howto), boot device name, filesystem type name.
- */
-BSS(esym, 4)
-BSS(emini, 4)
-BSS(smini, 4)
-BSS(promvbr, 4)
-BSS(promcall, 4)
-
- .chip 68020
- .text
-/*
-GLOBAL(edata)
-GLOBAL(etext)
-GLOBAL(end)
-*/
-GLOBAL(kernel_text)
-
-ASENTRY_NOPROFILE(start)
- movw #PSL_HIGHIPL,%sr | no interrupts
- movl %sp@(4), %d7 | get boothowto
- movl %sp@(8), %d6 | get bootaddr
- movl %sp@(12),%d5 | get bootctrllun
- movl %sp@(16),%d4 | get bootdevlun
- movl %sp@(20),%d3 | get bootpart
- movl %sp@(24),%d2 | get esyms
- /* note: d2-d7 in use */
-
- ASRELOC(tmpstk, %a0)
- movl %a0,%sp | give ourselves a temporary stack
-
- RELOC(edata, %a0) | clear out BSS
- movl #_C_LABEL(end)-4,%d0 | (must be <= 256 kB)
- subl #_C_LABEL(edata),%d0
- lsrl #2,%d0
-1: clrl %a0@+
- dbra %d0,1b
-
- movc %vbr,%d0 | save prom's trap #15 vector
- RELOC(promvbr, %a0)
- movl %d0, %a0@
- RELOC(esym, %a0)
- movl %d2,%a0@ | store end of symbol table
- /* note: d2 now free, d3-d7 still in use */
-
- clrl %sp@-
- BUGCALL(MVMEPROM_GETBRDID)
- movl %sp@+, %a1
-
- movl #SIZEOF_MVMEPROM_BRDID, %d0 | copy to local variables
- RELOC(brdid, %a0)
-1: movb %a1@+, %a0@+
- subql #1, %d0
- bne 1b
-
- clrl %d0
- RELOC(brdid, %a1)
- movw %a1@(MVMEPROM_BRDID_MODEL), %d0
- RELOC(cputyp, %a0)
- movl %d0, %a0@ | init _cputyp
-
-#ifdef MVME141
- cmpw #CPU_141, %d0
- beq is141
-#endif
-
-#ifdef MVME147
- cmpw #CPU_147, %d0
- beq is147
-#endif
-
-#ifdef MVME162
- cmpw #CPU_162, %d0
- beq is162
-#endif
-
-#ifdef MVME165
- cmpw #CPU_165, %d0
- beq is165
-#endif
-
-#ifdef MVME167
- cmpw #CPU_166, %d0
- beq is167
- cmpw #CPU_167, %d0
- beq is167
-#endif
-
-#ifdef MVME177
- cmpw #CPU_176, %d0
- beq is177
- cmpw #CPU_177, %d0
- beq is177
-#endif
-
-#ifdef MVME172
- cmpw #CPU_172, %d0
- beq is172
-#endif
-
- .data
-notsup: .asciz "kernel does not support this model."
-notsupend:
- .even
- .text
-
- | first we bitch, then we die.
- movl #notsupend, %sp@-
- movl #notsup, %sp@-
- BUGCALL(MVMEPROM_OUTSTRCRLF)
- addql #8,%sp
-
- BUGCALL(MVMEPROM_EXIT) | return to m68kbug
- /*NOTREACHED*/
-
- .chip 68030
-
-#ifdef MVME141
-is141:
- RELOC(mmutype, %a0) | no, we have 68030
- movl #MMU_68030,%a0@ | set to reflect 68030 PMMU
-
- RELOC(cputype, %a0) | no, we have 68030
- movl #CPU_68030,%a0@ | set to reflect 68030 CPU
-
- RELOC(clockbus, %a0) | timer is on ofobio
- movl #BUS_OFOBIO, %a0@
-
- movl #CACHE_OFF,%d0
- movc %d0,%cacr | clear and disable on-chip cache(s)
-
- ASRELOC(memsize141, %a1) | how much memory?
- jbsr %a1@
- movl %d0, %d1
-
- RELOC(iiomapsize, %a1)
- movl #INTIOSIZE_141, %a1@
- RELOC(iiomapbase, %a1)
- movl #INTIOBASE_141, %a1@
- bra Lstart1
-#endif
-
-#ifdef MVME147
-is147:
- RELOC(mmutype, %a0) | no, we have 68030
- movl #MMU_68030,%a0@ | set to reflect 68030 PMMU
-
- RELOC(cputype, %a0) | no, we have 68030
- movl #CPU_68030,%a0@ | set to reflect 68030 CPU
-
- RELOC(clockbus, %a0) | timer is on pcc
- movl #BUS_PCC, %a0@
-
- movl #CACHE_OFF,%d0
- movc %d0,%cacr | clear and disable on-chip cache(s)
-
- movb #0, 0xfffe1026 | XXX serial interrupt off
- movb #0, 0xfffe1018 | XXX timer 1 off
- movb #0, 0xfffe1028 | XXX ethernet off
-
- movl #0xfffe0000, %a0 | mvme147 nvram base
- | move nvram component of etheraddr (only last 3 bytes)
- RELOC(myea, %a1)
- movw %a0@(NVRAM_147_ETHER+0), %a1@(3+0)
- movb %a0@(NVRAM_147_ETHER+2), %a1@(3+2)
- movl %a0@(NVRAM_147_EMEM), %d1 | pass memory size
-
- RELOC(iiomapsize, %a1)
- movl #INTIOSIZE_147, %a1@
- RELOC(iiomapbase, %a1)
- movl #INTIOBASE_147, %a1@
- bra Lstart1
-#endif
-
- .chip 68040
-
-#ifdef MVME162
-is162:
-#if 0
- | the following 3 things are "just in case". they won't make
- | the kernel work properly, but they will at least let it get
- | far enough that you can figure out that something had an
- | interrupt pending. which the bootrom shouldn't allow, i don't
- | think..
- clrb 0xfff42002 | XXX MCchip irq off
- clrl 0xfff42018 | XXX MCchip timers irq off
- clrb 0xfff4201d | XXX MCchip scc irq off
-#endif
- RELOC(memsize162, %a1) | how much memory?
- jbsr %a1@
- movl %d0, %d2
-
- RELOC(mmutype, %a0)
- movl #MMU_68040,%a0@ | with a 68040 MMU
-
- RELOC(cputype, %a0) | no, we have 68040
- movl #CPU_68040,%a0@ | set to reflect 68040 CPU
-
- RELOC(fputype, %a0)
- movl #FPU_68040,%a0@ | and a 68040 FPU
-
- RELOC(clockbus, %a0) | timer is on mc
- movl #BUS_MC, %a0@
-
- RELOC(vectab, %a1)
- movl #_C_LABEL(buserr40),%a1@(8)
- movl #_C_LABEL(addrerr4060),%a1@(12)
-
- bra is16x
-#endif
-
-#ifdef MVME165
-is165:
- movl #0xfffe0000, %a0 | MVME165 CSR
- movl %a0@, %d0
- movl #4*1024*1024, %d1
- btst #18, %d0 | 4MEG*
- jeq 1f | not set, this is a 4MB board.
- movl #16*1024*1024, %d1 | set, this is a 16MB board.
-
- RELOC(mmutype, %a0)
- movl #MMU_68040,%a0@ | with a 68040 MMU
-
- RELOC(cputype, %a0) | no, we have 68040
- movl #CPU_68040,%a0@ | set to reflect 68040 CPU
-
- RELOC(fputype, %a0)
- movl #FPU_68040,%a0@ | and a 68040 FPU
-
- RELOC(clockbus, %a0) | timer is on lrc
- movl #BUS_LRC, %a0@
-
- RELOC(vectab, %a1)
- movl #_C_LABEL(buserr40),%a1@(8)
- movl #_C_LABEL(addrerr4060),%a1@(12)
-
- RELOC(iiomapsize, %a1)
- movl #INTIOSIZE_165, %a1@
- RELOC(iiomapbase, %a1)
- movl #INTIOBASE_165, %a1@
-
- bra Lstart1
-#endif
-
-#ifdef MVME167
-is167:
- RELOC(memsize1x7, %a1) | how much memory?
- jbsr %a1@
-
- RELOC(mmutype, %a0)
- movl #MMU_68040,%a0@ | with a 68040 MMU
-
- RELOC(cputype, %a0) | no, we have 68040
- movl #CPU_68040,%a0@ | set to reflect 68040 CPU
-
- RELOC(fputype, %a0)
- movl #FPU_68040,%a0@ | and a 68040 FPU
-
- RELOC(clockbus, %a0) | timer is on pcctwo
- movl #BUS_PCCTWO, %a0@
-
- RELOC(vectab, %a1)
- movl #_C_LABEL(buserr40),%a1@(8)
- movl #_C_LABEL(addrerr4060),%a1@(12)
-
- bra is16x
-#endif
-
- .chip 68060
-
-#ifdef MVME172
-is172:
-
- RELOC(memsize162, %a1) | how much memory?
- jbsr %a1@
- movl %d0, %d2
-
- /* enable Super Scalar Dispatch */
- movec %pcr,%d0
- bset #0,%d0 | turn on bit 0.
- movec %d0,%pcr
-
- RELOC(mmutype, %a0)
- movl #MMU_68060,%a0@ | with a 68060 MMU
-
- RELOC(cputype, %a0) | no, we have 68060
- movl #CPU_68060,%a0@ | set to reflect 68060 CPU
-
- RELOC(fputype, %a0)
- movl #FPU_68060,%a0@ | and a 68060 FPU
-
- RELOC(clockbus, %a0) | timer is on mc
- movl #BUS_MC, %a0@
-
- RELOC(vectab, %a1)
- movl #_C_LABEL(buserr60),%a1@(8)
- movl #_C_LABEL(addrerr4060),%a1@(12)
-
- bra is16x
-#endif
-
-#ifdef MVME177
-is177:
- RELOC(memsize1x7, %a1) | how much memory?
- jbsr %a1@
-
- /* enable Super Scalar Dispatch */
- movc %pcr,%d0
- bset #0,%d0 | turn on bit 0.
- movc %d0,%pcr
-
- RELOC(mmutype, %a0)
- movl #MMU_68060,%a0@ | with a 68060 MMU
-
- RELOC(cputype, %a0) | no, we have 68060
- movl #CPU_68060,%a0@ | set to reflect 68060 CPU
-
- RELOC(fputype, %a0)
- movl #FPU_68060,%a0@ | and a 68060 FPU
-
- RELOC(clockbus, %a0) | timer is on pcctwo
- movl #BUS_PCCTWO, %a0@
-
- RELOC(vectab, %a1)
- movl #_C_LABEL(buserr60),%a1@(8)
- movl #_C_LABEL(addrerr4060),%a1@(12)
-
- bra is16x
-#endif
-
- .chip 68020
-
-#if defined(MVME162) || defined(MVME167) || defined(MVME177) || defined(MVME172)
-#define ROMPKT_LEN 200
-BSS(rompkt, ROMPKT_LEN)
- .even
- .text
-is16x:
- RELOC(iiomapsize, %a1)
- movl #INTIOSIZE_162, %a1@
- RELOC(iiomapbase, %a1)
- movl #INTIOBASE_162, %a1@
-
- /* get ethernet address */
- RELOC(rompkt, %a0) | build a .NETCTRL packet
- movb #0, %a0@(NETCTRL_DEV) | onboard ethernet
- movb #0, %a0@(NETCTRL_CTRL) | onboard ethernet
- movl #NETCTRLCMD_GETETHER, %a0@(NETCTRL_CMD)
- RELOC(myea, %a1)
- movl %a1, %a0@(NETCTRL_ADDR) | where to put it
- movl #6, %a0@(NETCTRL_LEN) | it is 6 bytes long
-
- movl %a0, %sp@-
- BUGCALL(MVMEPROM_NETCTRL) | ask the rom
- addl #4, %sp
-
- | if memory size is unknown, print a diagnostic and make an
- | assumption
- movl %d2, %d1
- cmpl #0, %d1
- bne Lstart1
-
- movl #unkmemend, %sp@-
- movl #unkmem, %sp@-
- BUGCALL(MVMEPROM_OUTSTRCRLF)
- addql #8,%sp
-
- movl #4*1024*1024, %d1 | XXX assume 4M of ram
- bra Lstart1
-
- .data
-unkmem: .asciz "could not figure out how much memory; assuming 4M."
-unkmemend:
- .even
- .text
-
-#endif
-
-Lstart1:
-/* initialize source/destination control registers for movs */
- moveq #FC_USERD,%d0 | user space
- movc %d0,%sfc | as source
- movc %d0,%dfc | and destination of transfers
- moveq #PGSHIFT,%d2
- lsrl %d2,%d1 | convert to pages
- RELOC(physmem, %a0)
- movl %d1,%a0@ | save as physmem
-
-/* configure kernel and proc0 VA space so we can get going */
-#if defined(DDB) || NKSYMS > 0
- RELOC(esym,%a0) | end of static kernel text/data/syms
- movl %a0@,%d2
- jne Lstart2
-#endif
- movl #_C_LABEL(end),%d2 | end of static kernel text/data
-Lstart2:
- addl #NBPG-1,%d2
- andl #PG_FRAME,%d2 | round to a page
- movl %d2,%a4
-
-/* do pmap_bootstrap stuff */
- clrl %sp@- | firstpa
- pea %a4@ | nextpa
- RELOC(pmap_bootstrap,%a0)
- jbsr %a0@ | pmap_bootstrap(firstpa, nextpa)
- addql #8,%sp
-
-#if defined(M68040) || defined(M68060)
-/*
- * While still running physical, override copypage() with the 68040
- * optimized version, copypage040(), if possible.
- * This relies upon the fact that copypage() immediately follows
- * copypage040() in memory.
- */
- RELOC(mmutype, %a0)
- cmpl #MMU_68040,%a0@
- jgt Lmmu_enable
- RELOC(copypage040, %a0)
- RELOC(copypage, %a1)
- movl %a1, %a2
-1:
- movw %a0@+, %a2@+
- cmpl %a0, %a1
- jgt 1b
-#endif
-
-/*
- * Enable the MMU.
- * Since the kernel is mapped logical == physical, we just turn it on.
- */
-Lmmu_enable:
- RELOC(Sysseg, %a0) | system segment table addr
- movl %a0@,%d1 | read value (a KVA)
- RELOC(mmutype, %a0)
- cmpl #MMU_68040,%a0@ | 68040 or 68060?
- jgt Lmotommu1 | no, skip
- .chip 68040
- movc %d1,%srp
- movc %d1,%urp
- jra Lstploaddone
- .chip 68020
-Lmotommu1:
- RELOC(protorp, %a0)
- movl #0x80000202,%a0@ | nolimit + share global + 4 byte PTEs
- movl %d1,%a0@(4) | + segtable address
- pmove %a0@,%srp | load the supervisor root pointer
- movl #0x80000002,%a0@ | reinit upper half for CRP loads
-Lstploaddone:
- RELOC(mmutype, %a0)
- cmpl #MMU_68040,%a0@ | 68040 or 68060?
- jgt Lmotommu2 | no, skip
-
- .chip 68040
- moveq #0,%d0 | ensure TT regs are disabled
- movc %d0,%itt0
- movc %d0,%itt1
- movc %d0,%dtt0
- movc %d0,%dtt1
- cinva %bc
- pflusha
- movl #0x8000,%d0
- movc %d0,%tc
- /* Enable 68060 extensions here */
- RELOC(mmutype, %a0)
- cmpl #MMU_68060,%a0@ | 68060?
- jne Lchache040
- movl #CACHE60_ON,%d0 | branch cache, etc...
- movc %d0,%cacr | turn on both caches
- jmp Lenab1
-Lchache040:
- movl #CACHE40_ON,%d0
- movc %d0,%cacr | turn on both caches
- jmp Lenab1
- .chip 68020
-Lmotommu2:
- movl #0x82c0aa00,%a2@ | value to load TC with
- pmove %a2@,%tc | load it
-Lenab1:
-
-/*
- * Should be running mapped from this point on
- */
-/* select the software page size now */
- lea _ASM_LABEL(tmpstk),%sp | temporary stack
- jbsr _C_LABEL(uvm_setpagesize) | select software page size
-/* set kernel stack, user SP, and initial pcb */
- movl _C_LABEL(proc0paddr),%a1| get proc0 pcb addr
- lea %a1@(USPACE-4),%sp | set kernel stack to end of area
- lea _C_LABEL(proc0), %a2 | initialize proc0.p_addr so that
- movl %a1,%a2@(P_ADDR) | we don't deref NULL in trap()
- movl #USRSTACK-4,%a2
- movl %a2,%usp | init user SP
- movl %a1,_C_LABEL(curpcb) | proc0 is running
-
- tstl _C_LABEL(fputype) | Have an FPU?
- jeq Lenab2 | No, skip.
- clrl %a1@(PCB_FPCTX) | ensure null FP context
- movl %a1,%sp@-
- jbsr _C_LABEL(m68881_restore) | restore it (does not kill a1)
- addql #4,%sp
-Lenab2:
-/* flush TLB and turn on caches */
- jbsr _ASM_LABEL(TBIA) | invalidate TLB
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040 or 68060?
- jle Lnocache0 | yes, cache already on
- movl #CACHE_ON,%d0
- movc %d0,%cacr | clear cache(s)
-Lnocache0:
-/* final setup for C code */
- movl #_C_LABEL(vectab),%d2 | set VBR
- movc %d2,%vbr
- movw #PSL_LOWIPL,%sr | lower SPL
- movl %d3, _C_LABEL(bootpart) | save bootpart
- movl %d4, _C_LABEL(bootdevlun) | save bootdevlun
- movl %d5, _C_LABEL(bootctrllun) | save bootctrllun
- movl %d6, _C_LABEL(bootaddr) | save bootaddr
- movl %d7, _C_LABEL(boothowto)| save boothowto
- /* d3-d7 now free */
-
-/* Final setup for call to main(). */
- jbsr _C_LABEL(mvme68k_init)
-
-/*
- * Create a fake exception frame so that cpu_fork() can copy it.
- * main() never returns; we exit to user mode from a forked process
- * later on.
- */
- clrw %sp@- | vector offset/frame type
- clrl %sp@- | PC - filled in by "execve"
- movw #PSL_USER,%sp@- | in user mode
- clrl %sp@- | stack adjust count and padding
- lea %sp@(-64),%sp | construct space for D0-D7/A0-A7
- lea _C_LABEL(proc0),%a0 | save pointer to frame
- movl %sp,%a0@(P_MD_REGS) | in proc0.p_md.md_regs
-
- jra _C_LABEL(main) | main()
- PANIC("main() returned")
- /* NOTREACHED */
-
-#if defined(MVME162) || defined(MVME167) || defined(MVME177) || defined(MVME172)
-/*
- * Figure out the size of onboard DRAM by querying the memory controller(s).
- * This has to be done in locore as badaddr() can not yet be used at this
- * point.
- */
-GLOBAL(memsize1x7)
- movl #0xfff43008,%a0 | MEMC040/MEMECC Controller #1
- jbsr memc040read
- movl %d0,%d2
-
- movl #0xfff43108,%a0 | MEMC040/MEMECC Controller #2
- jbsr memc040read
- addl %d0,%d2
-
- rts
-
-/*
- * Probe for a memory controller ASIC (MEMC040 or MEMECC) at the
- * address in a0. If found, return the size in bytes of any RAM
- * controller by the ASIC in d0. Otherwise return zero.
- */
-ASLOCAL(memc040read)
- moveml %d1-%d2/%a1-%a2,%sp@- | save scratch regs
- movc %vbr,%d2 | Save vbr
- RELOC(vectab,%a2) | Install our own vectab, temporarily
- movc %a2,%vbr
- ASRELOC(Lmemc040berr,%a1) | get address of bus error handler
- movl %a2@(8),%sp@- | Save current bus error handler addr
- movl %a1,%a2@(8) | Install our own handler
- movl %sp,%d0 | Save current stack pointer value
- movql #0x07,%d1
- andb %a0@,%d1 | Access MEMC040/MEMECC
- movl #0x400000,%d0
- lsll %d1,%d0 | Convert to memory size, in bytes
-Lmemc040ret:
- movc %d2,%vbr | Restore original vbr
- movl %sp@+,%a2@(8) | Restore original bus error handler
- moveml %sp@+,%d1-%d2/%a1-%a2
- rts
-/*
- * If the memory controller doesn't exist, we get a bus error trying
- * to access a0@ above. Control passes here, where we flag 'no bytes',
- * ditch the exception frame and return as normal.
- */
-Lmemc040berr:
- movl %d0,%sp | Get rid of the exception frame
- clrl %d0 | No ASIC at this location, then!
- jbra Lmemc040ret | Done
-
-#endif /* 162 | 167 | 172 | 177 */
-
-#ifdef MVME141
-ASLOCAL(memsize141)
- moveml %d1-%d3/%a0-%a2,%sp@- | save working registers
- movc %vbr,%d2 | save vbr
- RELOC(vectab,%a2)
- movc %a2,%vbr | install our own vectab
- ASRELOC(Lmem141sizeerr,%a1)
- movl %a2@(8),%sp@- | save bus error and
- movl %a2@(12),%sp@- | address error vectors
- movl %a1,%a2@(8) | and put ours in place
- movl %a1,%a2@(12)
- movl %sp,%d3 | save stack
- movql #0,%d0
- movl %d0,%a0 | starting test address
-Lmem141loop:
- movb %a0@,%d0 | try byte, word and long access
- movw %a0@,%d0
- movl %a0@,%d0
- movl %d0,%d1
- movl %a0@,%d0 | read it again
- cmp %d0,%d1 | and compare
- bne Lmem141ret | if they differ, it's not ram
- movel #(1024 * 1024),%d0
- addl %d0,%a0
- bra Lmem141loop
-Lmem141ret:
- movl %a0,%d0 | d0 = size in bytes
- movc %d2,%vbr | restore vbr
- movl %sp@+,%a2@(12) | and vectors
- movl %sp@+,%a2@(8)
- moveml %sp@+,%d1-%d3/%a0-%a2
- rts
-ASLOCAL(Lmem141sizeerr)
- movl %d3,%sp | get rid of the exception frame
- jbra Lmem141ret
-#endif /* MVME141 */
-
-/*
- * proc_trampoline: call function in register a2 with a3 as an arg
- * and then rei.
- */
-GLOBAL(proc_trampoline)
- movl %a3,%sp@- | push function arg
- jbsr %a2@ | call function
- addql #4,%sp | pop arg
- movl %sp@(FR_SP),%a0 | grab and load
- movl %a0,%usp | user SP
- moveml %sp@+,#0x7FFF | restore most user regs
- addql #8,%sp | toss SP and stack adjust
- jra _ASM_LABEL(rei) | and return
-
-
-/*
- * Trap/interrupt vector routines - new for 060
- */
-#include <m68k/m68k/trap_subr.s>
-
-#if defined(M68040) || defined(M68060)
-ENTRY_NOPROFILE(addrerr4060)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save user registers
- movl %usp,%a0 | save the user SP
- movl %a0,%sp@(FR_SP) | in the savearea
- movl %sp@(FR_HW+8),%sp@-
- clrl %sp@- | dummy code
- movl #T_ADDRERR,%sp@- | mark address error
- jra _ASM_LABEL(faultstkadj) | and deal with it
-#endif
-
-#if defined(M68060)
-ENTRY_NOPROFILE(buserr60)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save user registers
- movl %usp,%a0 | save the user SP
- movl %a0,%sp@(FR_SP) | in the savearea
- movel %sp@(FR_HW+12),%d0 | FSLW
- btst #2,%d0 | branch prediction error?
- jeq Lnobpe
- movc %cacr,%d2
- orl #IC60_CABC,%d2 | clear all branch cache entries
- movc %d2,%cacr
- movl %d0,%d1
- andl #0x7ffd,%d1
- jeq _ASM_LABEL(faultstkadjnotrap2)
-Lnobpe:
-| we need to adjust for misaligned addresses
- movl %sp@(FR_HW+8),%d1 | grab VA
- btst #27,%d0 | check for mis-aligned access
- jeq Lberr3 | no, skip
- addl #28,%d1 | yes, get into next page
- | operand case: 3,
- | instruction case: 4+12+12
- andl #PG_FRAME,%d1 | and truncate
-Lberr3:
- movl %d1,%sp@-
- movl %d0,%sp@- | code is FSLW now.
- andw #0x1f80,%d0
- jeq Lbuserr60 | no, handle as usual
- movl #T_MMUFLT,%sp@- | show that we are an MMU fault
- jra _ASM_LABEL(faultstkadj) | and deal with it
-Lbuserr60:
- tstl _C_LABEL(nofault) | device probe?
- jeq Lisberr | Bus Error?
- movl _C_LABEL(nofault),%sp@- | yes,
- jbsr _C_LABEL(longjmp) | longjmp(nofault)
-#endif
-#if defined(M68040)
-ENTRY_NOPROFILE(buserr40)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save user registers
- movl %usp,%a0 | save the user SP
- movl %a0,%sp@(FR_SP) | in the savearea
- movl %sp@(FR_HW+20),%d1 | get fault address
- moveq #0,%d0
- movw %sp@(FR_HW+12),%d0 | get SSW
- btst #11,%d0 | check for mis-aligned
- jeq Lbe1stpg | no skip
- addl #3,%d1 | get into next page
- andl #PG_FRAME,%d1 | and truncate
-Lbe1stpg:
- movl %d1,%sp@- | pass fault address.
- movl %d0,%sp@- | pass SSW as code
- btst #10,%d0 | test ATC
- jeq Lbuserr40 | no, handle as usual
- movl #T_MMUFLT,%sp@- | show that we are an MMU fault
- jra _ASM_LABEL(faultstkadj) | and deal with it
-Lbuserr40:
- tstl _C_LABEL(nofault) | device probe?
- jeq Lisberr | it is a bus error
- movl _C_LABEL(nofault),%sp@- | yes,
- jbsr _C_LABEL(longjmp) | longjmp(nofault)
- /* NOTREACHED */
-#endif
-
-ENTRY_NOPROFILE(busaddrerr2030)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save user registers
- movl %usp,%a0 | save the user SP
- movl %a0,%sp@(FR_SP) | in the savearea
- lea %sp@(FR_HW),%a1 | grab base of HW berr frame
- moveq #0,%d0
- movw %a1@(10),%d0 | grab SSW for fault processing
- btst #12,%d0 | RB set?
- jeq LbeX0 | no, test RC
- bset #14,%d0 | yes, must set FB
- movw %d0,%a1@(10) | for hardware too
-LbeX0:
- btst #13,%d0 | RC set?
- jeq LbeX1 | no, skip
- bset #15,%d0 | yes, must set FC
- movw %d0,%a1@(10) | for hardware too
-LbeX1:
- btst #8,%d0 | data fault?
- jeq Lbe0 | no, check for hard cases
- movl %a1@(16),%d1 | fault address is as given in frame
- jra Lbe10 | thats it
-Lbe0:
- btst #4,%a1@(6) | long (type B) stack frame?
- jne Lbe4 | yes, go handle
- movl %a1@(2),%d1 | no, can use save PC
- btst #14,%d0 | FB set?
- jeq Lbe3 | no, try FC
- addql #4,%d1 | yes, adjust address
- jra Lbe10 | done
-Lbe3:
- btst #15,%d0 | FC set?
- jeq Lbe10 | no, done
- addql #2,%d1 | yes, adjust address
- jra Lbe10 | done
-Lbe4:
- movl %a1@(36),%d1 | long format, use stage B address
- btst #15,%d0 | FC set?
- jeq Lbe10 | no, all done
- subql #2,%d1 | yes, adjust address
-Lbe10:
- movl %d1,%sp@- | push fault VA
- movl %d0,%sp@- | and padded SSW
- movw %a1@(6),%d0 | get frame format/vector offset
- andw #0x0FFF,%d0 | clear out frame format
- cmpw #12,%d0 | address error vector?
- jeq Lisaerr | yes, go to it
- movl %d1,%a0 | fault address
- movl %sp@,%d0 | function code from ssw
- btst #8,%d0 | data fault?
- jne Lbe10a
- movql #1,%d0 | user program access FC
- | (we dont separate data/program)
- btst #5,%a1@ | supervisor mode?
- jeq Lbe10a | if no, done
- movql #5,%d0 | else supervisor program access
-Lbe10a:
- ptestr %d0,%a0@,#7 | do a table search
- pmove %psr,%sp@ | save result
- movb %sp@,%d1
- btst #2,%d1 | invalid (incl. limit viol. and berr)?
- jeq Lmightnotbemerr | no -> wp check
- btst #7,%d1 | is it MMU table berr?
- jeq Lismerr | no, must be fast
- jra Lisberr1 | real bus err needs not be fast.
-Lmightnotbemerr:
- btst #3,%d1 | write protect bit set?
- jeq Lisberr1 | no: must be bus error
- movl %sp@,%d0 | ssw into low word of d0
- andw #0xc0,%d0 | Write protect is set on page:
- cmpw #0x40,%d0 | was it read cycle?
- jeq Lisberr1 | yes, was not WPE, must be bus err
-Lismerr:
- movl #T_MMUFLT,%sp@- | show that we are an MMU fault
- jra _ASM_LABEL(faultstkadj) | and deal with it
-Lisaerr:
- movl #T_ADDRERR,%sp@- | mark address error
- jra _ASM_LABEL(faultstkadj) | and deal with it
-Lisberr1:
- clrw %sp@ | re-clear pad word
- tstl _C_LABEL(nofault) | device probe?
- jeq Lisberr | it is a bus error
- movl _C_LABEL(nofault),%sp@- | yes,
- jbsr _C_LABEL(longjmp) | longjmp(nofault)
- /* NOTREACHED */
-Lisberr:
- movl #T_BUSERR,%sp@- | mark bus error
- jra _ASM_LABEL(faultstkadj) | and deal with it
-
-/*
- * FP exceptions.
- */
-ENTRY_NOPROFILE(fpfline)
-#if defined(M68040) || defined(M68060)
- cmpl #FPU_68040,_C_LABEL(fputype) | 68040 or 68060 FPU?
- jlt Lfp_unimp | no, skip FPSP
- cmpw #0x202c,%sp@(6) | format type 2?
- jne _C_LABEL(illinst) | no, not an FP emulation
-Ldofp_unimp:
-#ifdef FPSP
- jmp _ASM_LABEL(fpsp_unimp) | yes, go handle it
-#endif
-Lfp_unimp:
-#endif/* M68040 || M68060 */
-#ifdef FPU_EMULATE
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save registers
- moveq #T_FPEMULI,%d0 | denote as FP emulation trap
- jra _ASM_LABEL(fault) | do it
-#else
- jra _C_LABEL(illinst)
-#endif
-
-ENTRY_NOPROFILE(fpunsupp)
-#if defined(M68040) || defined(M68060)
- cmpl #FPU_68040,_C_LABEL(fputype) | 68040 or 68060 FPU?
- jlt _C_LABEL(illinst) | no, treat as illinst
-#ifdef FPSP
- jmp _ASM_LABEL(fpsp_unsupp) | yes, go handle it
-#endif
-Lfp_unsupp:
-#endif /* M68040 */
-#ifdef FPU_EMULATE
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save registers
- moveq #T_FPEMULD,%d0 | denote as FP emulation trap
- jra _ASM_LABEL(fault) | do it
-#else
- jra _C_LABEL(illinst)
-#endif
-
-/*
- * Handles all other FP coprocessor exceptions.
- * Note that since some FP exceptions generate mid-instruction frames
- * and may cause signal delivery, we need to test for stack adjustment
- * after the trap call.
- */
-ENTRY_NOPROFILE(fpfault)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save user registers
- movl %usp,%a0 | and save
- movl %a0,%sp@(FR_SP) | the user stack pointer
- clrl %sp@- | no VA arg
- movl _C_LABEL(curpcb),%a0 | current pcb
- lea %a0@(PCB_FPCTX),%a0 | address of FP savearea
- fsave %a0@ | save state
-#if defined(M68040) || defined(M68060)
- /* always null state frame on 68040, 68060 */
- cmpl #CPU_68040,_C_LABEL(cputype)
- jge Lfptnull
-#endif
- tstb %a0@ | null state frame?
- jeq Lfptnull | yes, safe
- clrw %d0 | no, need to tweak BIU
- movb %a0@(1),%d0 | get frame size
- bset #3,%a0@(0,%d0:w)| set exc_pend bit of BIU
-Lfptnull:
- fmovem %fpsr,%sp@- | push fpsr as code argument
- frestore %a0@ | restore state
- movl #T_FPERR,%sp@- | push type arg
- jra _ASM_LABEL(faultstkadj) | call trap and deal with stack cleanup
-
-/*
- * Other exceptions only cause four and six word stack frame and require
- * no post-trap stack adjustment.
- */
-ENTRY_NOPROFILE(hardtrap)
- moveml #0xC0C0,%sp@- | save scratch regs
- lea %sp@(16),%a1 | get pointer to frame
- movl %a1,%sp@-
- movw %sp@(26),%d0
- movl %d0,%sp@- | push exception vector info
- movl %sp@(26),%sp@- | and PC
- jbsr _C_LABEL(hardintr) | doit
- lea %sp@(12),%sp | pop args
- moveml %sp@+,#0x0303 | restore regs
- jra _ASM_LABEL(rei) | all done
-
-ENTRY_NOPROFILE(badtrap)
- moveml #0xC0C0,%sp@- | save scratch regs
- movw %sp@(22),%sp@- | push exception vector info
- clrw %sp@-
- movl %sp@(22),%sp@- | and PC
- jbsr _C_LABEL(straytrap) | report
- addql #8,%sp | pop args
- moveml %sp@+,#0x0303 | restore regs
- jra _ASM_LABEL(rei) | all done
-
-ENTRY_NOPROFILE(trap0)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@- | save user registers
- movl %usp,%a0 | save the user SP
- movl %a0,%sp@(FR_SP) | in the savearea
- movl %d0,%sp@- | push syscall number
- jbsr _C_LABEL(syscall) | handle it
- addql #4,%sp | pop syscall arg
- tstl _C_LABEL(astpending)
- jne Lrei2
- tstl _C_LABEL(softpending)
- jeq Ltrap1
- movw #SPL1,%sr
- tstl _C_LABEL(softpending)
- jne Lsir1
-Ltrap1:
- movl %sp@(FR_SP),%a0 | grab and restore
- movl %a0,%usp | user SP
- moveml %sp@+,#0x7FFF | restore most registers
- addql #8,%sp | pop SP and stack adjust
- rte
-
-/*
- * Trap 1 - sigreturn
- */
-ENTRY_NOPROFILE(trap1)
- jra _ASM_LABEL(sigreturn)
-
-/*
- * Trap 2 - trace trap
- */
-ENTRY_NOPROFILE(trap2)
- jra _C_LABEL(trace)
-
-/*
- * Trap 12 is the entry point for the cachectl "syscall"
- * cachectl(command, addr, length)
- * command in d0, addr in a1, length in d1
- */
-ENTRY_NOPROFILE(trap12)
- movl %d1,%sp@- | push length
- movl %a1,%sp@- | push addr
- movl %d0,%sp@- | push command
- movl CURPROC,%sp@- | push proc pointer
- jbsr _C_LABEL(cachectl) | do it
- lea %sp@(16),%sp | pop args
- jra _ASM_LABEL(rei) | all done
-
-/*
- * Trace (single-step) trap (trap 1 or 2) instruction. Kernel-mode is
- * special. User mode traps are simply passed on to trap().
- */
-ENTRY_NOPROFILE(trace)
- clrl %sp@-
- moveml #0xFFFF,%sp@-
- moveq #T_TRACE,%d0
-
- | Check PSW and see what happened.
- | T=0 S=0 (should not happen)
- | T=1 S=0 trace trap from user mode
- | T=0 S=1 trace trap on a trap instruction
- | T=0 S=0 trace trap from system mode (kernel breakpoint)
-
- movw %sp@(FR_HW),%d1 | get SSW
- notw %d1 | XXX no support for T0 on 680[234]0
- andw #PSL_S,%d1 | from system mode (T=1, S=1)?
- jeq Lkbrkpt | yes, kernel breakpoint
- jra _ASM_LABEL(fault) | no, user-mode fault
-
-/*
- * Trap 15 is used for:
- * - GDB breakpoints (in user programs)
- * - KGDB breakpoints (in the kernel)
- * - trace traps for SUN binaries (not fully supported yet)
- * - calling the prom, but only from the kernel
- * We just pass it on and let trap() sort it all out
- */
-ENTRY_NOPROFILE(trap15)
- clrl %sp@- | stack adjust count
- moveml #0xFFFF,%sp@-
-
- tstl _C_LABEL(promcall)
- jeq L_notpromcall
- moveml %sp@+,#0xFFFF
- addql #4, %sp
- | unwind stack to put to known value
- | this routine is from the 147 BUG manual
- | currently save and restore are excessive.
- subql #4,%sp
- link %a6,#0
- moveml #0xFFFE,%sp@-
- movl _C_LABEL(promvbr),%a0
- movw %a6@(14),%d0
- andl #0xfff,%d0
- movl %a0@(%d0:w),%a6@(4)
- moveml %sp@+,#0x7FFF
- unlk %a6
- rts
- | really jumps to the bug trap handler
-L_notpromcall:
- moveq #T_TRAP15,%d0
- movw %sp@(FR_HW),%d1 | get PSW
- andw #PSL_S,%d1 | from system mode?
- jne Lkbrkpt | yes, kernel breakpoint
- jra _ASM_LABEL(fault) | no, user-mode fault
-
-Lkbrkpt: | Kernel-mode breakpoint or trace trap. (d0=trap_type)
- | Save the system sp rather than the user sp.
- movw #PSL_HIGHIPL,%sr | lock out interrupts
- lea %sp@(FR_SIZE),%a6 | Save stack pointer
- movl %a6,%sp@(FR_SP) | from before trap
-
- | If we are not on tmpstk switch to it.
- | (so debugger can change the stack pointer)
- movl %a6,%d1
- cmpl #_ASM_LABEL(tmpstk),%d1
- jls Lbrkpt2 | already on tmpstk
- | Copy frame to the temporary stack
- movl %sp,%a0 | a0=src
- lea _ASM_LABEL(tmpstk)-96,%a1 | a1=dst
- movl %a1,%sp | sp=new frame
- moveq #FR_SIZE,%d1
-Lbrkpt1:
- movl %a0@+,%a1@+
- subql #4,%d1
- bgt Lbrkpt1
-
-Lbrkpt2:
- | Call the trap handler for the kernel debugger.
- | Do not call trap() to do it, so that we can
- | set breakpoints in trap() if we want. We know
- | the trap type is either T_TRACE or T_BREAKPOINT.
- | If we have both DDB and KGDB, let KGDB see it first,
- | because KGDB will just return 0 if not connected.
- | Save args in d2, a2
- movl %d0,%d2 | trap type
- movl %sp,%a2 | frame ptr
-#ifdef KGDB
- | Let KGDB handle it (if connected)
- movl %a2,%sp@- | push frame ptr
- movl %d2,%sp@- | push trap type
- jbsr _C_LABEL(kgdb_trap) | handle the trap
- addql #8,%sp | pop args
- cmpl #0,%d0 | did kgdb handle it?
- jne Lbrkpt3 | yes, done
-#endif
-#ifdef DDB
- | Let DDB handle it
- movl %a2,%sp@- | push frame ptr
- movl %d2,%sp@- | push trap type
- jbsr _C_LABEL(kdb_trap) | handle the trap
- addql #8,%sp | pop args
- cmpl #0,%d0 | did ddb handle it?
- jne Lbrkpt3 | yes, done
-#endif
- | Drop into the prom
- BUGCALL(MVMEPROM_EXIT)
-Lbrkpt3:
- | The stack pointer may have been modified, or
- | data below it modified (by kgdb push call),
- | so push the hardware frame at the current sp
- | before restoring registers and returning.
-
- movl %sp@(FR_SP),%a0 | modified sp
- lea %sp@(FR_SIZE),%a1 | end of our frame
- movl %a1@-,%a0@- | copy 2 longs with
- movl %a1@-,%a0@- | ... predecrement
- movl %a0,%sp@(FR_SP) | sp = h/w frame
- moveml %sp@+,#0x7FFF | restore all but sp
- movl %sp@,%sp | ... and sp
- rte | all done
-
-/* Use common m68k sigreturn */
-#include <m68k/m68k/sigreturn.s>
-
-/*
- * Interrupt handlers.
- * No device interrupts are auto-vectored.
- */
-
-ENTRY_NOPROFILE(spurintr)
- addql #1,_C_LABEL(uvmexp)+UVMEXP_INTRS
- jra _ASM_LABEL(rei) | all done
-
-/*
- * Emulation of VAX REI instruction.
- *
- * This code deals with checking for and servicing ASTs
- * (profiling, scheduling) and software interrupts (network, softclock).
- * We check for ASTs first, just like the VAX. To avoid excess overhead
- * the T_ASTFLT handling code will also check for software interrupts so we
- * do not have to do it here. After identifing that we need an AST we
- * drop the IPL to allow device interrupts.
- *
- * This code is complicated by the fact that sendsig may have been called
- * necessitating a stack cleanup.
- */
-
-BSS(softpending,4)
-
-ASENTRY_NOPROFILE(rei)
- tstl _C_LABEL(astpending) | AST pending?
- jeq Lchksir | no, go check for SIR
-Lrei1:
- btst #5,%sp@ | yes, are we returning to user mode?
- jne Lchksir | no, go check for SIR
- movw #PSL_LOWIPL,%sr | lower SPL
- clrl %sp@- | stack adjust
- moveml #0xFFFF,%sp@- | save all registers
- movl %usp,%a1 | including
- movl %a1,%sp@(FR_SP) | the users SP
-Lrei2:
- clrl %sp@- | VA == none
- clrl %sp@- | code == none
- movl #T_ASTFLT,%sp@- | type == async system trap
- jbsr _C_LABEL(trap) | go handle it
- lea %sp@(12),%sp | pop value args
- movl %sp@(FR_SP),%a0 | restore user SP
- movl %a0,%usp | from save area
- movw %sp@(FR_ADJ),%d0 | need to adjust stack?
- jne Laststkadj | yes, go to it
- moveml %sp@+,#0x7FFF | no, restore most user regs
- addql #8,%sp | toss SP and stack adjust
- rte | and do real RTE
-Laststkadj:
- lea %sp@(FR_HW),%a1 | pointer to HW frame
- addql #8,%a1 | source pointer
- movl %a1,%a0 | source
- addw %d0,%a0 | + hole size = dest pointer
- movl %a1@-,%a0@- | copy
- movl %a1@-,%a0@- | 8 bytes
- movl %a0,%sp@(FR_SP) | new SSP
- moveml %sp@+,#0x7FFF | restore user registers
- movl %sp@,%sp | and our SP
- rte | and do real RTE
-Lchksir:
- tstl _C_LABEL(softpending) | SIR pending?
- jeq Ldorte | no, all done
- movl %d0,%sp@- | need a scratch register
- movw %sp@(4),%d0 | get SR
- andw #PSL_IPL7,%d0 | mask all but IPL
- jne Lnosir | came from interrupt, no can do
- movl %sp@+,%d0 | restore scratch register
-Lgotsir:
- movw #SPL1,%sr | prevent others from servicing int
- tstl _C_LABEL(softpending) | too late?
- jeq Ldorte | yes, oh well...
- clrl %sp@- | stack adjust
- moveml #0xFFFF,%sp@- | save all registers
- movl %usp,%a1 | including
- movl %a1,%sp@(FR_SP) | the users SP
-Lsir1:
- clrl %sp@- | VA == none
- clrl %sp@- | code == none
- movl #T_SSIR,%sp@- | type == software interrupt
- jbsr _C_LABEL(trap) | go handle it
- lea %sp@(12),%sp | pop value args
- movl %sp@(FR_SP),%a0 | restore
- movl %a0,%usp | user SP
- moveml %sp@+,#0x7FFF | and all remaining registers
- addql #8,%sp | pop SP and stack adjust
- rte
-Lnosir:
- movl %sp@+,%d0 | restore scratch register
-Ldorte:
- rte | real return
-
-/*
- * Use common m68k signal trampoline.
- */
-#include <m68k/m68k/sigcode.s>
-
-/*
- * Use common m68k support routines.
- */
-#include <m68k/m68k/support.s>
-
- .data
-GLOBAL(curpcb)
- .long 0
-
-ASBSS(nullpcb,SIZEOF_PCB)
-
-ENTRY_NOPROFILE(cpu_idle_cycle)
- stop #PSL_LOWIPL
- rts
-
-/*
- * cpu_switchto(struct proc *oldproc, struct proc *newproc)
- *
- * NOTE: On the mc68851 we attempt to avoid flushing the
- * entire ATC. The effort involved in selective flushing may not be
- * worth it, maybe we should just flush the whole thing?
- *
- * NOTE 2: With the new VM layout we now no longer know if an inactive
- * user's PTEs have been changed (formerly denoted by the SPTECHG p_flag
- * bit). For now, we just always flush the full ATC.
- */
-ENTRY(cpu_switchto)
- movl %sp@(4), %d0 | oldproc
- beq Lswnofpsave | is NULL, don't save anything
-
- /*
- * Save state of previous process in its pcb.
- */
- movl _C_LABEL(curpcb),%a1
- movw %sr, %a1@(PCB_PS) | save sr before switching context
- moveml #0xFCFC,%a1@(PCB_REGS) | save non-scratch registers
- movl %usp,%a2 | grab USP (a2 has been saved)
- movl %a2,%a1@(PCB_USP) | and save it
-#ifdef FPU_EMULATE
- tstl _C_LABEL(fputype) | do we have any FPU?
- jeq Lswnofpsave | no, dont save
-#endif
- lea %a1@(PCB_FPCTX),%a2 | pointer to FP save area
- fsave %a2@ | save FP state
-#ifdef M68060
- cmpl #FPU_68060,_C_LABEL(fputype) | is 68060?
- jeq Lsavfp60 | yes, goto Lsavfp60
-#endif /* M68060 */
- tstb %a2@ | null state frame?
- jeq Lswnofpsave | yes, all done
- fmovem %fp0-%fp7,%a2@(FPF_REGS) | save FP general registers
- fmovem %fpcr/%fpsr/%fpi,%a2@(FPF_FPCR) | save FP control registers
-#ifdef M68060
- jra Lswnofpsave
-Lsavfp60:
- tstb %a2@(2) | null state frame?
- jeq Lswnofpsave | yes, all done
- fmovem %fp0-%fp7,%a2@(FPF_REGS)| save FP general registers
- fmovem %fpcr,%a2@(FPF_FPCR) | save FP control registers
- fmovem %fpsr,%a2@(FPF_FPSR)
- fmovem %fpi,%a2@(FPF_FPI)
-#endif /* M68060 */
-
-Lswnofpsave:
- movl %sp@(8), %a0 | newproc
-
- movl %a0, CURPROC
- movb #SONPROC,%a0@(P_STAT)
- movl %a0@(P_ADDR),%a1 | get p_addr
- movl %a1,_C_LABEL(curpcb)
-
- /*
- * Activate process's address space.
- * XXX Should remember the last USTP value loaded, and call this
- * XXX only of it has changed.
- */
- pea %a0@ | push proc
- jbsr _C_LABEL(pmap_activate) | pmap_activate(p)
- addql #4,%sp
- movl _C_LABEL(curpcb),%a1 | restore p_addr
-
- lea _ASM_LABEL(tmpstk),%sp | now goto a tmp stack for NMI
-
- moveml %a1@(PCB_REGS),#0xFCFC | and registers
- movl %a1@(PCB_USP),%a0
- movl %a0,%usp | and USP
-
-#ifdef FPU_EMULATE
- tstl _C_LABEL(fputype) | do we _have_ any fpu?
- jne Lresnonofpatall
- movw %a1@(PCB_PS),%sr | no, restore PS
- rts
-Lresnonofpatall:
-#endif
- lea %a1@(PCB_FPCTX),%a0 | pointer to FP save area
-#ifdef M68060
- cmpl #FPU_68060,_C_LABEL(fputype) | is 68060?
- jeq Lresfp60rest1 | yes, goto Lresfp60rest1
-#endif /* M68060 */
- tstb %a0@ | null state frame?
- jeq Lresfprest2 | yes, easy
- fmovem %a0@(FPF_FPCR),%fpcr/%fpsr/%fpi | restore FP control registers
- fmovem %a0@(FPF_REGS),%fp0-%fp7 | restore FP general registers
-Lresfprest2:
- frestore %a0@ | restore state
- movw %a1@(PCB_PS),%sr | no, restore PS
- rts
-
-#ifdef M68060
-Lresfp60rest1:
- tstb %a0@(2) | null state frame?
- jeq Lresfp60rest2 | yes, easy
- fmovem %a0@(FPF_FPCR),%fpcr | restore FP control registers
- fmovem %a0@(FPF_FPSR),%fpsr
- fmovem %a0@(FPF_FPI),%fpi
- fmovem %a0@(FPF_REGS),%fp0-%fp7 | restore FP general registers
-Lresfp60rest2:
- frestore %a0@ | restore state
- movw %a1@(PCB_PS),%sr | no, restore PS
- rts
-#endif /* M68060 */
-
-
-/*
- * savectx(pcb)
- * Update pcb, saving current processor state.
- */
-ENTRY(savectx)
- movl %sp@(4),%a1
- movw %sr,%a1@(PCB_PS)
- movl %usp,%a0 | grab USP
- movl %a0,%a1@(PCB_USP) | and save it
- moveml #0xFCFC,%a1@(PCB_REGS) | save non-scratch registers
-#ifdef FPU_EMULATE
- tstl _C_LABEL(fputype)
- jeq Lsavedone
-#endif
- lea %a1@(PCB_FPCTX),%a0 | pointer to FP save area
- fsave %a0@ | save FP state
-#ifdef M68060
- cmpl #FPU_68060,_C_LABEL(fputype) | is 68060?
- jeq Lsavctx60 | yes, goto Lsavctx60
-#endif
- tstb %a0@ | null state frame?
- jeq Lsavedone | yes, all done
- fmovem %fp0-%fp7,%a0@(FPF_REGS) | save FP general registers
- fmovem %fpcr/%fpsr/%fpi,%a0@(FPF_FPCR) | save FP control registers
- rts
-#ifdef M68060
-Lsavctx60:
- tstb %a0@(2)
- jeq Lsavedone
- fmovem %fp0-%fp7,%a0@(FPF_REGS) | save FP general registers
- fmovem %fpcr,%a0@(FPF_FPCR) | save FP control registers
- fmovem %fpsr,%a0@(FPF_FPSR)
- fmovem %fpi,%a0@(FPF_FPI)
-#endif
-Lsavedone:
- rts
-
-#if defined(M68040) || defined(M68060)
-ENTRY(suline)
- movl %sp@(4),%a0 | address to write
- movl _C_LABEL(curpcb),%a1 | current pcb
- movl #Lslerr,%a1@(PCB_ONFAULT) | where to return to on a fault
- movl %sp@(8),%a1 | address of line
- movl %a1@+,%d0 | get lword
- movsl %d0,%a0@+ | put lword
- nop | sync
- movl %a1@+,%d0 | get lword
- movsl %d0,%a0@+ | put lword
- nop | sync
- movl %a1@+,%d0 | get lword
- movsl %d0,%a0@+ | put lword
- nop | sync
- movl %a1@+,%d0 | get lword
- movsl %d0,%a0@+ | put lword
- nop | sync
- moveq #0,%d0 | indicate no fault
- jra Lsldone
-Lslerr:
- moveq #-1,%d0
-Lsldone:
- movl _C_LABEL(curpcb),%a1 | current pcb
- clrl %a1@(PCB_ONFAULT) | clear fault address
- rts
-#endif
-
-/*
- * Invalidate entire TLB.
- */
-ASENTRY_NOPROFILE(TBIA)
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040 or 68060?
- jle Ltbia040 | yes, goto Ltbia040
- pflusha | flush entire TLB
- tstl _C_LABEL(mmutype)
- jpl Lmc68851a | 68851 implies no d-cache
- movl #DC_CLEAR,%d0
- movc %d0,%cacr | invalidate on-chip d-cache
-Lmc68851a:
- rts
- .chip 68040
-Ltbia040:
- pflusha
-#ifdef M68060
- cmpl #MMU_68060,_C_LABEL(mmutype) | is 68060?
- jne Ltbiano60 | no, skip
- movc %cacr,%d0
- orl #IC60_CABC,%d0 | and clear all branch cache entries
- movc %d0,%cacr
-#endif
-Ltbiano60:
- .chip 68020
- rts
-
-
-/*
- * Invalidate any TLB entry for given VA (TB Invalidate Single)
- */
-ENTRY(TBIS)
- movl %sp@(4),%a0 | get addr to flush
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040 or 68060 ?
- jle Ltbis040 | yes, goto Ltbis040
- tstl _C_LABEL(mmutype)
- jpl Lmc68851b | is 68851?
- pflush #0,#0,%a0@ | flush address from both sides
- movl #DC_CLEAR,%d0
- movc %d0,%cacr | invalidate on-chip data cache
- rts
-Lmc68851b:
- pflushs #0,#0,%a0@ | flush address from both sides
- rts
- .chip 68040
-Ltbis040:
- moveq #FC_SUPERD,%d0 | select supervisor
- movc %d0,%dfc
- pflush %a0@
- moveq #FC_USERD,%d0 | select user
- movc %d0,%dfc
- pflush %a0@
-#ifdef M68060
- cmpl #MMU_68060,_C_LABEL(mmutype) | is 68060?
- jne Ltbisno60 | no, skip
- movc %cacr,%d0
- orl #IC60_CABC,%d0 | and clear all branch cache entries
- movc %d0,%cacr
-Ltbisno60:
-#endif
- .chip 68020
- rts
-
-/*
- * Invalidate supervisor side of TLB
- */
-#if defined(M68060)
- .chip 68040
-ENTRY(TBIAS)
- | 68060 cannot specify supervisor/user on pflusha, so we flush all
- pflusha
- movc %cacr,%d0
- orl #IC60_CABC,%d0 | and clear all branch cache entries
- movc %d0,%cacr
- rts
- .chip 68020
-#endif
-
-#if defined(M68060)
-/*
- * Invalidate user side of TLB
- */
-ENTRY(TBIAU)
- cmpl #MMU_68040,_C_LABEL(mmutype)
- jle Ltbiau040
- tstl _C_LABEL(mmutype)
- jpl Lmc68851d | 68851?
- pflush #0,#4 | flush user TLB entries
- movl #DC_CLEAR,%d0
- movc %d0,%cacr | invalidate on-chip d-cache
- rts
-Lmc68851d:
- pflushs #0,#4 | flush user TLB entries
- rts
- .chip 68040
-Ltbiau040:
-| 68040 cannot specify supervisor/user on pflusha, so we flush all
- pflusha
-#ifdef M68060
- cmpl #MMU_68060,_C_LABEL(mmutype)
- jne Ltbiauno60
- movc %cacr,%d0
- orl #IC60_CUBC,%d0 | but only user branch cache entries
- movc %d0,%cacr
-Ltbiauno60:
-#endif
- .chip 68020
- rts
-#endif /* defined(M68060) */
-
-/*
- * Invalidate instruction cache
- */
-ENTRY(ICIA)
-#if defined(M68040) || defined(M68060)
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040 or 68060?
- jgt 1f | no, skip
- .chip 68040
- cinva %ic
- rts
-1:
- .chip 68020
-#endif
- movl #IC_CLEAR,%d0
- movc %d0,%cacr | invalidate i-cache
- rts
-
-/*
- * Invalidate data cache.
- *
- * NOTE: we do not flush 68030 on-chip cache as there are no aliasing
- * problems with DC_WA. The only cases we have to worry about are context
- * switch and TLB changes, both of which are handled "in-line" in resume
- * and TBI*.
- * Because of this, since there is no way on 68040 and 68060 to flush
- * user and supervisor modes specfically, DCIS and DCIU are the same entry
- * point as DCIA.
- */
-ENTRY(DCIA)
-ENTRY(DCIS)
-ENTRY(DCIU)
-#if defined(M68040) || defined(M68060)
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040 or 68060?
- jgt 1f | no, skip
- .chip 68040
- cpusha %dc
-1:
- .chip 68020
-#endif
- rts
-
-#if defined(M68040) || defined(M68060)
- .chip 68040
-ENTRY(ICPA)
- cinva %ic
- rts
-ENTRY(DCFA)
- cpusha %dc
- rts
-ENTRY(ICPL)
- movl %sp@(4),%a0 | address
- cinvl %ic,%a0@
- rts
-ENTRY(ICPP)
- movl %sp@(4),%a0 | address
- cinvp %ic,%a0@
- rts
-ENTRY(DCPL)
- movl %sp@(4),%a0 | address
- cinvl %dc,%a0@
- rts
-ENTRY(DCPP)
- movl %sp@(4),%a0 | address
- cinvp %dc,%a0@
- rts
-ENTRY(DCFL)
- movl %sp@(4),%a0 | address
- cpushl %dc,%a0@
- rts
-ENTRY(DCFP)
- movl %sp@(4),%a0 | address
- cpushp %dc,%a0@
- rts
- .chip 68020
-#endif
-
-ENTRY(getsfc)
- movc %sfc,%d0
- rts
-
-ENTRY(getdfc)
- movc %dfc,%d0
- rts
-
-/*
- * Load a new user segment table pointer.
- */
-ENTRY(loadustp)
- movl %sp@(4),%d0 | new USTP
- moveq #PGSHIFT,%d1
- lsll %d1,%d0 | convert to addr
-#if defined(M68040) || defined(M68060)
- cmpl #MMU_68040,_C_LABEL(mmutype)
-#ifdef M68060
- jlt Lldustp060
-#endif
-#ifdef M68040
- jeq Lldustp040
-#endif
-#endif
- pflusha | flush entire TLB
- lea _C_LABEL(protorp),%a0 | CRP prototype
- movl %d0,%a0@(4) | stash USTP
- pmove %a0@,%crp | load root pointer
- movl #CACHE_CLR,%d0
- movc %d0,%cacr | invalidate cache(s)
- rts
-
- .chip 68040
-#ifdef M68060
-Lldustp060:
- movc %cacr,%d1
- orl #IC60_CUBC,%d1 | clear user branch cache entries
- movc %d1,%cacr
- /* FALLTHROUGH */
-#endif
-Lldustp040:
- pflusha
- movc %d0,%urp
- .chip 68020
- rts
-
-/*
- * Set processor priority level calls. Most are implemented with
- * inline asm expansions. However, spl0 requires special handling
- * as we need to check for our emulated software interrupts.
- */
-
-ENTRY(spl0)
- moveq #0,%d0
- movw %sr,%d0 | get old SR for return
- movw #PSL_LOWIPL,%sr | restore new SR
- tstl _C_LABEL(softpending) | software interrupt pending?
- jeq Lspldone | no, all done
- subql #4,%sp | make room for RTE frame
- movl %sp@(4),%sp@(2) | position return address
- clrw %sp@(6) | set frame type 0
- movw #PSL_LOWIPL,%sp@ | and new SR
- jra Lgotsir | go handle it
-Lspldone:
- rts
-
-/*
- * Save and restore 68881 state.
- * Pretty awful looking since our assembler does not
- * recognize FP mnemonics.
- */
-ENTRY(m68881_save)
- movl %sp@(4),%a0 | save area pointer
- fsave %a0@ | save state
-#ifdef M68060
- cmpl #FPU_68060,_C_LABEL(fputype) | is 68060?
- jeq Lm68060fpsave | yes, goto Lm68060fpsave
-#endif
- tstb %a0@ | null state frame?
- jeq Lm68881sdone | yes, all done
- fmovem %fp0-%fp7,%a0@(FPF_REGS) | save FP general registers
- fmovem %fpcr/%fpsr/%fpi,%a0@(FPF_FPCR) | save FP control registers
-Lm68881sdone:
- rts
-
-#ifdef M68060
-Lm68060fpsave:
- tstb %a0@(2) | null state frame?
- jeq Lm68060sdone | yes, all done
- fmovem %fp0-%fp7,%a0@(FPF_REGS)| save FP general registers
- fmovem %fpcr,%a0@(FPF_FPCR) | save FP control registers
- fmovem %fpsr,%a0@(FPF_FPSR)
- fmovem %fpi,%a0@(FPF_FPI)
-Lm68060sdone:
- rts
-#endif
-
-ENTRY(m68881_restore)
- movl %sp@(4),%a0 | save area pointer
-#ifdef M68060
- cmpl #FPU_68060,_C_LABEL(fputype) | is 68060?
- jeq Lm68060fprestore | yes, goto Lm68060fprestore
-#endif
- tstb %a0@ | null state frame?
- jeq Lm68881rdone | yes, easy
- fmovem %a0@(FPF_FPCR),%fpcr/%fpsr/%fpi | restore FP control registers
- fmovem %a0@(FPF_REGS),%fp0-%fp7 | restore FP general registers
-Lm68881rdone:
- frestore %a0@ | restore state
- rts
-
-#ifdef M68060
-Lm68060fprestore:
- tstb %a0@(2) | null state frame?
- jeq Lm68060fprdone | yes, easy
- fmovem %a0@(FPF_FPCR),%fpcr | restore FP control registers
- fmovem %a0@(FPF_FPSR),%fpsr
- fmovem %a0@(FPF_FPI),%fpi
- fmovem %a0@(FPF_REGS),%fp0-%fp7| restore FP general registers
-Lm68060fprdone:
- frestore %a0@ | restore state
- rts
-#endif
-
-/*
- * Handle the nitty-gritty of rebooting the machine.
- * Basically we just turn off the MMU and jump to the appropriate ROM routine.
- * XXX add support for rebooting -- that means looking at boothowto and doing
- * the right thing
- */
-ENTRY_NOPROFILE(doboot)
- lea _ASM_LABEL(tmpstk),%sp | physical SP in case of NMI
-#if defined(M68040) || defined(M68060)
- cmpl #MMU_68040,_C_LABEL(mmutype) | 68040?
- jgt Lbootnot040 | no, skip
- .chip 68040
- movl #0,%d0
- movc %d0,%cacr | caches off
- movc %d0,%tc | turn off MMU
- bra 1f
- .chip 68020
-Lbootnot040:
-#endif
- movl #CACHE_OFF,%d0
- movc %d0,%cacr | disable on-chip cache(s)
- movl #0,%a7@ | value for pmove to TC (turn off MMU)
- pmove %a7@,%tc | disable MMU
-
-1: movl #0,%d0
- movc %d0,%vbr | ROM VBR
-
- /*
- * We're going down. Make various sick attempts to reset the board.
- */
- RELOC(cputyp, %a0)
- movl %a0@,%d0
- cmpw #CPU_147,%d0
- bne not147
- movl #0xfffe2000,%a0 | MVME147: "struct vme1reg *"
-vmechipreset:
- movw %a0@,%d0
- movl %d0,%d1
- andw #0x0001,%d1 | is VME1_SCON_SWITCH set?
- beq 1f | not SCON. may not use SRESET.
- orw #0x0002,%d0 | ok, assert VME1_SCON_SRESET
- movw %d0,%a0@
-1:
- movl #0xff800000,%a0 | if we get here, SRESET did not work.
- movl %a0@(4),%a0 | try jumping directly to the ROM.
- jsr %a0@
- | still alive! just return to the prom..
- bra 3f
-
-not147:
- cmpw #CPU_165, %d0
- bne not165
- movl #0xfff90020,%a0 | disable timer2 (clock)
- movl #0, %a0@
- movl #0xfffb0000,%a0 | MVME165 VMEChip base address
- /* similar to MVME147 sequence above */
- bra vmechipreset
-
-not165:
- cmpw #CPU_141, %d0
- bne not141
- movl #0xfffb0000,%a0 | MVME141 VMEChip base address
- /* similar to MVME147 sequence above */
- bra vmechipreset
-
-not141:
- movl #0xfff40000,%a0 | MVME16x: "struct vme2reg *"
- movl %a0@(0x60),%d0
- movl %d0,%d1
- andl #0x40000000,%d1 | is VME2_TCTL_SCON set?
- beq 1f | not SCON. may not use SRESET.
- orl #0x00800000,%d0 | ok, assert VME2_TCTL_SRST
- movl %d0,%a0@(0x60)
-1:
- | lets try the local bus reset
- movl #0xfff40000,%a0 | MVME16x: "struct vme2reg *"
- movl %a0@(0x104),%d0
- orw #0x00000080,%d0
- movl %d0,%a0@(0x104)
- | lets try jumping off to rom.
- movl #0xff800000,%a0 | if we get here, SRESET did not work.
- movl %a0@(4),%a0 | try jumping directly to the ROM.
- jsr %a0@
- | still alive! just return to the prom..
-
-3: BUGCALL(MVMEPROM_EXIT) | return to m68kbug
- /*NOTREACHED*/
-
-#if defined(M68060) && defined(M060SP)
-GLOBAL(intemu60)
- jra _C_LABEL(I_CALL_TOP)+0x80+0x00
-GLOBAL(fpiemu60)
- jra _C_LABEL(FP_CALL_TOP)+0x80+0x30
-GLOBAL(fpdemu60)
- jra _C_LABEL(FP_CALL_TOP)+0x80+0x38
-GLOBAL(fpeaemu60)
- jra _C_LABEL(FP_CALL_TOP)+0x80+0x40
-#endif
-
- .data
- .p2align 2
-GLOBAL(mmutype)
- .long MMU_68030 | default to MMU_68030
-GLOBAL(cputype)
- .long CPU_68030 | default to CPU_68030
-GLOBAL(fputype)
- .long FPU_68881 | default to 68881 FPU
-GLOBAL(protorp)
- .long 0,0 | prototype root pointer
-GLOBAL(cold)
- .long 1 | cold start flag
-GLOBAL(proc0paddr)
- .long 0 | KVA of proc0 u-area
-GLOBAL(intiobase)
- .long 0 | KVA of base of internal IO space
-GLOBAL(intiolimit)
- .long 0 | KVA of end of internal IO space
-GLOBAL(extiobase)
- .long 0 | KVA of base of external IO space
-
-#include <mvme68k/mvme68k/vectors.s>
diff --git a/sys/arch/mvme68k/mvme68k/machdep.c b/sys/arch/mvme68k/mvme68k/machdep.c
deleted file mode 100644
index e8ca9b58c1f..00000000000
--- a/sys/arch/mvme68k/mvme68k/machdep.c
+++ /dev/null
@@ -1,939 +0,0 @@
-/* $OpenBSD: machdep.c,v 1.132 2014/03/13 03:52:55 dlg Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * Copyright (c) 1999 Steve Murphree, Jr. (68060 support)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: machdep.c 1.74 92/12/20$
- *
- * @(#)machdep.c 8.10 (Berkeley) 4/20/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/signalvar.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/buf.h>
-#include <sys/reboot.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/file.h>
-#include <sys/timeout.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/msgbuf.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/mount.h>
-#include <sys/user.h>
-#include <sys/exec.h>
-#include <sys/core.h>
-#include <sys/kcore.h>
-#include <sys/vnode.h>
-#include <sys/sysctl.h>
-#include <sys/syscallargs.h>
-#include <sys/evcount.h>
-
-#include <machine/atomic.h>
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-#include <machine/kcore.h>
-#include <machine/prom.h>
-#include <machine/psl.h>
-#include <machine/pte.h>
-#include <machine/reg.h>
-
-#ifdef MVME141
-#include <mvme68k/dev/ofobioreg.h>
-#endif
-#ifdef MVME147
-#include <mvme68k/dev/pccreg.h>
-#endif
-#ifdef MVME165
-#include <mvme68k/dev/lrcreg.h>
-#endif
-
-#include <dev/cons.h>
-
-#ifdef DDB
-#include <machine/db_machdep.h>
-#include <ddb/db_extern.h>
-#include <ddb/db_interface.h>
-#include <ddb/db_var.h>
-#endif
-
-#include <net/if.h>
-#include <uvm/uvm.h>
-
-/* the following is used externally (sysctl_hw) */
-char machine[] = MACHINE; /* cpu "architecture" */
-
-struct vm_map *exec_map = NULL;
-struct vm_map *phys_map = NULL;
-
-extern vaddr_t avail_end;
-
-int physmem; /* size of physical memory, in pages */
-
-struct uvm_constraint_range dma_constraint = { 0x0, (paddr_t)-1 };
-struct uvm_constraint_range *uvm_md_constraints[] = { NULL };
-
-/*
- * safepri is a safe priority for sleep to set for a spin-wait
- * during autoconfiguration or after a panic.
- */
-int safepri = PSL_LOWIPL;
-
-void dumpsys(void);
-void initvectors(void);
-void mvme68k_init(void);
-void identifycpu(void);
-int cpu_sysctl(int *, u_int, void *, size_t *, void *, size_t, struct proc *);
-void dumpconf(void);
-void straytrap(int, u_short);
-void netintr(void *);
-void myetheraddr(u_char *);
-int fpu_gettype(void);
-int memsize162(void);
-int memsize1x7(void); /* in locore */
-int memsize(void);
-
-void
-mvme68k_init()
-{
- extern vaddr_t avail_start;
-
- /*
- * Tell the VM system about available physical memory. The
- * mvme68k only has one segment.
- */
-
- uvmexp.pagesize = NBPG;
- uvm_setpagesize();
- uvm_page_physload(atop(avail_start), atop(avail_end),
- atop(avail_start), atop(avail_end), 0);
-
- /*
- * Put machine specific exception vectors in place.
- */
- initvectors();
-}
-
-/*
- * Console initialization: called early on from main,
- * before vm init or startup, but already running virtual.
- * Do enough configuration to choose and initialize a console.
- */
-void
-consinit()
-{
- /*
- * Initialize the console before we print anything out.
- */
- cninit();
-
-#ifdef DDB
- db_machine_init();
- ddb_init();
-
- if (boothowto & RB_KDB)
- Debugger();
-#endif
-}
-
-/*
- * cpu_startup: allocate memory for variable-sized tables,
- * initialize cpu, and do autoconfiguration.
- */
-void
-cpu_startup()
-{
- unsigned i;
- vaddr_t minaddr, maxaddr;
-#ifdef DEBUG
- extern int pmapdebug;
- int opmapdebug = pmapdebug;
-
- pmapdebug = 0;
-#endif
-
- /*
- * Initialize error message buffer (at end of core).
- * avail_end was pre-decremented in pmap_bootstrap to compensate.
- */
- for (i = 0; i < atop(MSGBUFSIZE); i++)
- pmap_kenter_pa((vaddr_t)msgbufp + i * PAGE_SIZE,
- avail_end + i * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE);
- pmap_update(pmap_kernel());
- initmsgbuf((caddr_t)msgbufp, round_page(MSGBUFSIZE));
-
- /*
- * Good {morning,afternoon,evening,night}.
- */
- printf("%s", version);
- identifycpu();
- printf("real mem = %u (%uMB)\n", ptoa(physmem),
- ptoa(physmem) / 1024 / 1024);
-
- /*
- * Allocate a submap for exec arguments. This map effectively
- * limits the number of processes exec'ing at any time.
- */
- minaddr = vm_map_min(kernel_map);
- exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
- 16*NCARGS, VM_MAP_PAGEABLE, FALSE, NULL);
-
- /*
- * Allocate a submap for physio.
- */
- phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
- VM_PHYS_SIZE, 0, FALSE, NULL);
-
-#ifdef DEBUG
- pmapdebug = opmapdebug;
-#endif
-
- /*
- * Set up buffers, so they can be used to read disk labels.
- */
- bufinit();
-
- printf("avail mem = %u (%uMB)\n",
- ptoa(uvmexp.free), ptoa(uvmexp.free) / 1024 / 1024);
-
- /*
- * Configure the system.
- */
- if (boothowto & RB_CONFIG) {
-#ifdef BOOT_CONFIG
- user_config();
-#else
- printf("kernel does not support -c; continuing..\n");
-#endif
- }
-}
-
-/*
- * Info for CTL_HW
- */
-char cpu_model[120];
-
-int cputyp;
-int cpuspeed;
-
-struct mvmeprom_brdid brdid;
-
-void
-identifycpu()
-{
- char mc;
- char speed[6];
- char suffix[30];
- int len;
-
- bzero(suffix, sizeof suffix);
-
- switch (mmutype) {
- case MMU_68060:
- mc = '6';
- break;
- case MMU_68040:
- mc = '4';
- break;
- case MMU_68030:
- mc = '3';
- break;
- default:
- mc = '2';
- }
-
- switch (cputyp) {
-#ifdef MVME141
- case CPU_141:
- snprintf(suffix, sizeof suffix, "MVME%x", brdid.model);
-#if 0
- cpuspeed = ofobiospeed((struct ofobioreg *)IIOV(0xfffb0000));
-#else
- cpuspeed = 50;
-#endif
- snprintf(speed, sizeof speed, "%02d", cpuspeed);
- break;
-#endif
-#ifdef MVME147
- case CPU_147:
- snprintf(suffix, sizeof suffix, "MVME%x", brdid.model);
- cpuspeed = pccspeed((struct pccreg *)IIOV(0xfffe1000));
- snprintf(speed, sizeof speed, "%02d", cpuspeed);
- break;
-#endif
-#if defined(MVME162) || defined(MVME167) || defined(MVME172) || defined(MVME177)
- case CPU_162:
- case CPU_166:
- case CPU_167:
- case CPU_172:
- case CPU_176:
- case CPU_177:
- bzero(speed, sizeof speed);
- speed[0] = brdid.speed[0];
- speed[1] = brdid.speed[1];
- if (brdid.speed[2] != '0' &&
- brdid.speed[3] != '0') {
- speed[2] = '.';
- speed[3] = brdid.speed[2];
- speed[4] = brdid.speed[3];
- }
- cpuspeed = (speed[0] - '0') * 10 + (speed[1] - '0');
- bcopy(brdid.longname, suffix, sizeof(brdid.longname));
- for (len = strlen(suffix)-1; len; len--) {
- if (suffix[len] == ' ')
- suffix[len] = '\0';
- else
- break;
- }
- break;
-#endif
-#ifdef MVME165
- case CPU_165:
- snprintf(suffix, sizeof suffix, "MVME%x", brdid.model);
- cpuspeed = lrcspeed((struct lrcreg *)IIOV(0xfff90000));
- snprintf(speed, sizeof speed, "%02d", cpuspeed);
- break;
-#endif
- }
- snprintf(cpu_model, sizeof cpu_model,
- "Motorola %s: %sMHz MC680%c0 CPU", suffix, speed, mc);
- switch (mmutype) {
-#if defined(M68040)
- case MMU_68040:
- /* FALLTHROUGH */
-#endif
-#if defined(M68060)
- case MMU_68060:
- /* FALLTHROUGH */
-#endif
- case MMU_68030:
- strlcat(cpu_model, "+MMU", sizeof cpu_model);
- break;
- case MMU_68851:
- strlcat(cpu_model, ", MC68851 MMU", sizeof cpu_model);
- break;
- default:
- printf("%s\n", cpu_model);
- panic("unknown MMU type %d", mmutype);
- }
-
- switch (mmutype) {
-#if defined(M68060)
- case MMU_68060:
- strlcat(cpu_model,"+FPU, 8k on-chip physical I/D caches",
- sizeof cpu_model);
- break;
-#endif
-#if defined(M68040)
- case MMU_68040:
- strlcat(cpu_model, "+FPU, 4k on-chip physical I/D caches",
- sizeof cpu_model);
- break;
-#endif
-#if defined(M68030) || defined(M68020)
- default:
- fputype = fpu_gettype();
-
- switch (fputype) {
- case FPU_NONE:
- break;
- case FPU_68881:
- case FPU_68882:
- len = strlen (cpu_model);
- snprintf(cpu_model + len, sizeof cpu_model - len,
- ", MC6888%d FPU", fputype);
- break;
- default:
- strlcat(cpu_model, ", unknown FPU", sizeof cpu_model);
- break;
- }
- break;
-#endif
- }
- printf("%s\n", cpu_model);
-}
-
-/*
- * machine dependent system variables.
- */
-int
-cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
- int *name;
- u_int namelen;
- void *oldp;
- size_t *oldlenp;
- void *newp;
- size_t newlen;
- struct proc *p;
-{
- dev_t consdev;
-
- /* all sysctl names at this level are terminal */
- if (namelen != 1)
- return (ENOTDIR); /* overloaded */
-
- switch (name[0]) {
- case CPU_CONSDEV:
- if (cn_tab != NULL)
- consdev = cn_tab->cn_dev;
- else
- consdev = NODEV;
- return (sysctl_rdstruct(oldp, oldlenp, newp, &consdev,
- sizeof consdev));
- default:
- return (EOPNOTSUPP);
- }
- /* NOTREACHED */
-}
-
-int waittime = -1;
-
-__dead void
-boot(howto)
- int howto;
-{
- struct device *mainbus;
-
- /* If system is cold, just halt. */
- if (cold) {
- /* (Unless the user explicitly asked for reboot.) */
- if ((howto & RB_USERREQ) == 0)
- howto |= RB_HALT;
- goto haltsys;
- }
-
- /* take a snap shot before clobbering any registers */
- if (curproc && curproc->p_addr)
- savectx(&curproc->p_addr->u_pcb);
-
- boothowto = howto;
- if ((howto & RB_NOSYNC) == 0 && waittime < 0) {
- extern struct proc proc0;
- /* do that another panic fly away */
- if (curproc == NULL)
- curproc = &proc0;
- waittime = 0;
- vfs_shutdown();
- /*
- * If we've been adjusting the clock, the todr
- * will be out of synch; adjust it now unless
- * the system was sitting in ddb.
- */
- if ((howto & RB_TIMEBAD) == 0) {
- resettodr();
- } else {
- printf("WARNING: not updating battery clock\n");
- }
- }
- if_downall();
-
- uvm_shutdown();
- splhigh(); /* Disable interrupts. */
-
- /* If rebooting and a dump is requested, do it. */
- if (howto & RB_DUMP)
- dumpsys();
-
-haltsys:
- doshutdownhooks();
- mainbus = device_mainbus();
- if (mainbus != NULL)
- config_suspend(mainbus, DVACT_POWERDOWN);
-
- if (howto & RB_HALT) {
- printf("System halted. Press any key to reboot...\n\n");
- cnpollc(1);
- cngetc();
- cnpollc(0);
- }
-
- doboot();
-
- for (;;);
- /*NOTREACHED*/
-}
-
-/*
- * These variables are needed by /sbin/savecore
- */
-u_long dumpmag = 0x8fca0101; /* magic number */
-int dumpsize = 0; /* pages */
-long dumplo = 0; /* blocks */
-cpu_kcore_hdr_t cpu_kcore_hdr;
-
-/*
- * This is called by configure to set dumplo and dumpsize.
- * Dumps always skip the first PAGE_SIZE of disk space
- * in case there might be a disk label stored there.
- * If there is extra space, put dump at the end to
- * reduce the chance that swapping trashes it.
- */
-void
-dumpconf(void)
-{
- int nblks; /* size of dump area */
-
- if (dumpdev == NODEV ||
- (nblks = (bdevsw[major(dumpdev)].d_psize)(dumpdev)) == 0)
- return;
- if (nblks <= ctod(1))
- return;
-
- dumpsize = physmem;
-
- /* mvme68k only uses a single segment. */
- cpu_kcore_hdr.ram_segs[0].start = 0;
- cpu_kcore_hdr.ram_segs[0].size = ptoa(physmem);
- cpu_kcore_hdr.mmutype = mmutype;
- cpu_kcore_hdr.kernel_pa = 0;
- cpu_kcore_hdr.sysseg_pa = pmap_kernel()->pm_stpa;
-
- /* Always skip the first block, in case there is a label there. */
- if (dumplo < ctod(1))
- dumplo = ctod(1);
-
- /* Put dump at end of partition, and make it fit. */
- if (dumpsize + 1 > dtoc(nblks - dumplo))
- dumpsize = dtoc(nblks - dumplo) - 1;
- if (dumplo < nblks - ctod(dumpsize) - 1)
- dumplo = nblks - ctod(dumpsize) - 1;
-}
-
-/*
- * Doadump comes here after turning off memory management and
- * getting on the dump stack, either when called above, or by
- * the auto-restart code.
- */
-void
-dumpsys()
-{
- int maj;
- int psize;
- daddr_t blkno; /* current block to write */
- /* dump routine */
- int (*dump)(dev_t, daddr_t, caddr_t, size_t);
- int pg; /* page being dumped */
- paddr_t maddr; /* PA being dumped */
- int error; /* error code from (*dump)() */
- kcore_seg_t *kseg_p;
- cpu_kcore_hdr_t *chdr_p;
- char dump_hdr[dbtob(1)]; /* XXX assume hdr fits in 1 block */
-
- extern int msgbufmapped;
-
- msgbufmapped = 0;
-
- /* Make sure dump device is valid. */
- if (dumpdev == NODEV)
- return;
- if (dumpsize == 0) {
- dumpconf();
- if (dumpsize == 0)
- return;
- }
- maj = major(dumpdev);
- if (dumplo < 0) {
- printf("\ndump to dev %u,%u not possible\n", maj,
- minor(dumpdev));
- return;
- }
- dump = bdevsw[maj].d_dump;
- blkno = dumplo;
-
- printf("\ndumping to dev %u,%u offset %ld\n", maj,
- minor(dumpdev), dumplo);
-
-#ifdef UVM_SWAP_ENCRYPT
- uvm_swap_finicrypt_all();
-#endif
-
- kseg_p = (kcore_seg_t *)dump_hdr;
- chdr_p = (cpu_kcore_hdr_t *)&dump_hdr[ALIGN(sizeof(*kseg_p))];
- bzero(dump_hdr, sizeof(dump_hdr));
-
- /*
- * Generate a segment header
- */
- CORE_SETMAGIC(*kseg_p, KCORE_MAGIC, MID_MACHINE, CORE_CPU);
- kseg_p->c_size = dbtob(1) - ALIGN(sizeof(*kseg_p));
-
- /*
- * Add the md header
- */
- *chdr_p = cpu_kcore_hdr;
-
- printf("dump ");
- psize = (*bdevsw[maj].d_psize)(dumpdev);
- if (psize == -1) {
- printf("area unavailable\n");
- return;
- }
-
- /* Dump the header. */
- error = (*dump) (dumpdev, blkno++, (caddr_t)dump_hdr, dbtob(1));
- if (error != 0)
- goto abort;
-
- maddr = (paddr_t)0;
- for (pg = 0; pg < dumpsize; pg++) {
-#define NPGMB (1024 * 1024 / PAGE_SIZE)
- /* print out how many MBs we have dumped */
- if (pg != 0 && (pg % NPGMB) == 0)
- printf("%d ", pg / NPGMB);
-#undef NPGMB
- pmap_kenter_pa((vaddr_t)vmmap, maddr, VM_PROT_READ);
- pmap_update(pmap_kernel());
- error = (*dump)(dumpdev, blkno, vmmap, PAGE_SIZE);
- pmap_kremove((vaddr_t)vmmap, PAGE_SIZE);
- pmap_update(pmap_kernel());
-
- if (error == 0) {
- maddr += PAGE_SIZE;
- blkno += btodb(PAGE_SIZE);
- } else
- break;
- }
-abort:
- switch (error) {
- case 0:
- printf("succeeded\n");
- break;
-
- case ENXIO:
- printf("device bad\n");
- break;
-
- case EFAULT:
- printf("device not ready\n");
- break;
-
- case EINVAL:
- printf("area improper\n");
- break;
-
- case EIO:
- printf("i/o error\n");
- break;
-
- case EINTR:
- printf("aborted from console\n");
- break;
-
- default:
- printf("error %d\n", error);
- break;
- }
-}
-
-#if defined(M68060)
-int m68060_pcr_init = 0x20 | PCR_SUPERSCALAR; /* make this patchable */
-#endif
-
-void
-initvectors()
-{
-#if defined(M68060)
- typedef void trapfun(void);
- extern trapfun *vectab[256];
-#if defined(M060SP)
- extern trapfun intemu60, fpiemu60, fpdemu60, fpeaemu60;
- extern u_int8_t FP_CALL_TOP[];
-#else
- extern trapfun illinst;
-#endif
- extern trapfun fpfault;
-#endif
-#if defined(M68040) && defined(FPSP)
- extern u_long fpvect_tab, fpvect_end, fpsp_tab;
-#endif
-
- switch (cputype) {
-#ifdef M68060
- case CPU_68060:
- asm volatile ("movl %0,%%d0; .word 0x4e7b,0x0808" : :
- "d"(m68060_pcr_init):"d0" );
-
-#if defined(M060SP)
- /* integer support */
- vectab[61] = intemu60/*(trapfun *)&I_CALL_TOP[128 + 0x00]*/;
-
- /* floating point support */
- /*
- * XXX maybe we really should run-time check for the
- * stack frame format here:
- */
- vectab[11] = fpiemu60/*(trapfun *)&FP_CALL_TOP[128 + 0x30]*/;
-
- vectab[55] = fpdemu60/*(trapfun *)&FP_CALL_TOP[128 + 0x38]*/;
- vectab[60] = fpeaemu60/*(trapfun *)&FP_CALL_TOP[128 + 0x40]*/;
-
- vectab[54] = (trapfun *)&FP_CALL_TOP[128 + 0x00];
- vectab[52] = (trapfun *)&FP_CALL_TOP[128 + 0x08];
- vectab[53] = (trapfun *)&FP_CALL_TOP[128 + 0x10];
- vectab[51] = (trapfun *)&FP_CALL_TOP[128 + 0x18];
- vectab[50] = (trapfun *)&FP_CALL_TOP[128 + 0x20];
- vectab[49] = (trapfun *)&FP_CALL_TOP[128 + 0x28];
-#else
- vectab[61] = illinst;
-#endif
- vectab[48] = fpfault;
- break;
-#endif
-#if defined(M68040) && defined(FPSP)
- case CPU_68040:
- bcopy(&fpsp_tab, &fpvect_tab,
- (&fpvect_end - &fpvect_tab) * sizeof (fpvect_tab));
- break;
-#endif
- default:
- break;
- }
-}
-
-void
-straytrap(pc, evec)
- int pc;
- u_short evec;
-{
- printf("unexpected trap (vector 0x%x) from %x\n",
- (evec & 0xFFF) >> 2, pc);
-}
-
-int *nofault;
-
-int
-badpaddr(addr, size)
- paddr_t addr;
- int size;
-{
- int off = (int)addr & PGOFSET;
- vaddr_t v;
- paddr_t p = trunc_page(addr);
- int x;
-
- v = mapiodev(p, NBPG);
- if (v == 0)
- return (1);
- x = badvaddr(v + off, size);
- unmapiodev(v, NBPG);
- return (x);
-}
-
-int
-badvaddr(addr, size)
- vaddr_t addr;
- int size;
-{
- int i;
- label_t faultbuf;
-
- nofault = (int *) &faultbuf;
- if (setjmp((label_t *)nofault)) {
- nofault = (int *)0;
- return (1);
- }
- switch (size) {
- case 1:
- i = *(volatile char *)addr;
- break;
- case 2:
- i = *(volatile short *)addr;
- break;
- case 4:
- i = *(volatile long *)addr;
- break;
- }
- nofault = (int *)0;
- return (0);
-}
-
-/*
- * Level 7 interrupts are normally caused by the ABORT switch,
- * drop into ddb.
- */
-void
-nmihand(frame)
- void *frame;
-{
- printf("Abort switch pressed\n");
-#ifdef DDB
- if (db_console)
- Debugger();
-#endif
-}
-
-u_char myea[6] = { 0x08, 0x00, 0x3e, 0xff, 0xff, 0xff};
-
-void
-myetheraddr(ether)
- u_char *ether;
-{
- bcopy(myea, ether, sizeof myea);
-}
-
-#if defined(M68030) || defined(M68020)
-int
-fpu_gettype()
-{
- /*
- * A 68881 idle frame is 28 bytes and a 68882's is 60 bytes.
- * We, of course, need to have enough room for either.
- */
- int fpframe[60 / sizeof(int)];
- label_t faultbuf;
- u_char b;
-
- nofault = (int *) &faultbuf;
- if (setjmp((label_t *)nofault)) {
- nofault = (int *)0;
- return (0); /* no FPU */
- }
-
- /*
- * Synchronize FPU or cause a fault.
- * This should leave the 881/882 in the IDLE state,
- * state, so we can determine which we have by
- * examining the size of the FP state frame
- */
- asm("fnop");
-
- nofault = (int *)0;
-
- /*
- * Presumably, this will not cause a fault--the fnop should
- * have if this will. We save the state in order to get the
- * size of the frame.
- */
- asm("movl %0, %%a0; fsave %%a0@" : : "a" (fpframe) : "a0" );
- b = *((u_char *) fpframe + 1);
-
- /*
- * Now, restore a NULL state to reset the FPU.
- */
- fpframe[0] = fpframe[1] = 0;
- m68881_restore((struct fpframe *)fpframe);
-
- if (b == 0x18)
- return (FPU_68881); /* The size of a 68881 IDLE frame is 0x18 */
- if (b == 0x38)
- return (FPU_68882); /* 68882 frame is 0x38 bytes long */
- return (FPU_UNKNOWN); /* unknown FPU type */
-}
-#endif
-
-
-#if defined(MVME162) || defined(MVME172)
-#include <mvme68k/dev/mcreg.h>
-/*
- * XXX
- * used by locore.s to figure out how much memory is on the machine.
- * At this stage we only know that our machine is a 162. It is very
- * unfortunate that the MCchip's address must be encoded here.
- */
-int
-memsize162()
-{
- struct mcreg *mc = (struct mcreg *)0xfff42000;
-
- switch (mc->mc_memoptions & MC_MEMOPTIONS_DRAMMASK) {
- case MC_MEMOPTIONS_DRAM1M:
- return (1*1024*1024);
- case MC_MEMOPTIONS_DRAM2M:
- return (2*1024*1024);
- case MC_MEMOPTIONS_DRAM4M:
- return (4*1024*1024);
- case MC_MEMOPTIONS_DRAM4M2:
- return (4*1024*1024);
- case MC_MEMOPTIONS_DRAM8M:
- return (8*1024*1024);
- case MC_MEMOPTIONS_DRAM16M:
- return (16*1024*1024);
- default:
- /*
- * XXX if the machine has no MC-controlled memory,
- * perhaps it has a MCECC or MEMC040 controller?
- */
- return (memsize1x7());
- }
-}
-#endif
-
-#ifdef DIAGNOSTIC
-void
-splassert_check(int wantipl, const char *func)
-{
- int oldipl;
-
- __asm __volatile ("movew %%sr,%0" : "=&d" (oldipl));
-
- oldipl = PSLTOIPL(oldipl);
-
- if (oldipl < wantipl) {
- splassert_fail(wantipl, oldipl, func);
- /*
- * If the splassert_ctl is set to not panic, raise the ipl
- * in a feeble attempt to reduce damage.
- */
- _spl(PSL_S | IPLTOPSL(wantipl));
- }
-}
-#endif
diff --git a/sys/arch/mvme68k/mvme68k/mem.c b/sys/arch/mvme68k/mvme68k/mem.c
deleted file mode 100644
index 26339c33602..00000000000
--- a/sys/arch/mvme68k/mvme68k/mem.c
+++ /dev/null
@@ -1,263 +0,0 @@
-/* $OpenBSD: mem.c,v 1.25 2010/12/26 15:40:59 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)mem.c 8.3 (Berkeley) 1/12/94
- */
-
-/*
- * Memory special file
- */
-
-#include <sys/param.h>
-#include <sys/buf.h>
-#include <sys/systm.h>
-#include <sys/uio.h>
-#include <sys/malloc.h>
-
-#include <machine/cpu.h>
-#include <machine/conf.h>
-
-#include <uvm/uvm_extern.h>
-
-static caddr_t devzeropage;
-
-/*ARGSUSED*/
-int
-mmopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
-
- switch (minor(dev)) {
- case 0:
- case 1:
- case 2:
- case 12:
- return (0);
- default:
- return (ENXIO);
- }
-}
-
-/*ARGSUSED*/
-int
-mmclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
-
- return (0);
-}
-
-/*ARGSUSED*/
-int
-mmrw(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- vaddr_t o, v;
- int c;
- struct iovec *iov;
- int error = 0;
- static int physlock;
-
- if (minor(dev) == 0) {
- /* lock against other uses of shared vmmap */
- while (physlock > 0) {
- physlock++;
- error = tsleep((caddr_t)&physlock, PZERO | PCATCH,
- "mmrw", 0);
- if (error)
- return (error);
- }
- physlock = 1;
- }
- while (uio->uio_resid > 0 && error == 0) {
- iov = uio->uio_iov;
- if (iov->iov_len == 0) {
- uio->uio_iov++;
- uio->uio_iovcnt--;
- if (uio->uio_iovcnt < 0)
- panic("mmrw");
- continue;
- }
- switch (minor(dev)) {
-
-/* minor device 0 is physical memory */
- case 0:
- v = uio->uio_offset;
-#ifndef DEBUG
- /* allow reads only in RAM (except for DEBUG) */
- if (v >= 0xFFFFFFFC || v < NBPG) {
- error = EFAULT;
- goto unlock;
- }
-#endif
-
- pmap_enter(pmap_kernel(), (vaddr_t)vmmap,
- trunc_page(v),
- uio->uio_rw == UIO_READ ? VM_PROT_READ : VM_PROT_WRITE,
- (uio->uio_rw == UIO_READ ? VM_PROT_READ : VM_PROT_WRITE) | PMAP_WIRED);
- pmap_update(pmap_kernel());
- o = uio->uio_offset & PGOFSET;
- c = min(uio->uio_resid, (int)(NBPG - o));
- error = uiomove((caddr_t)vmmap + o, c, uio);
- pmap_remove(pmap_kernel(), (vaddr_t)vmmap,
- (vaddr_t)vmmap + NBPG);
- pmap_update(pmap_kernel());
- continue;
-
-/* minor device 1 is kernel memory */
- case 1:
- v = uio->uio_offset;
- c = min(iov->iov_len, MAXPHYS);
- if (!uvm_kernacc((caddr_t)v, c,
- uio->uio_rw == UIO_READ ? B_READ : B_WRITE))
- return (EFAULT);
- if (v < NBPG)
- return (EFAULT);
- error = uiomove((caddr_t)v, c, uio);
- continue;
-
-/* minor device 2 is EOF/RATHOLE */
- case 2:
- if (uio->uio_rw == UIO_WRITE)
- uio->uio_resid = 0;
- return (0);
-
-/* minor device 12 (/dev/zero) is source of nulls on read, rathole on write */
- case 12:
- if (uio->uio_rw == UIO_WRITE) {
- c = iov->iov_len;
- break;
- }
- /*
- * On the first call, allocate and zero a page
- * of memory for use with /dev/zero.
- *
- * XXX on the mvme68k we already know where there
- * is a global zeroed page, the null segment table.
- */
- if (devzeropage == NULL) {
- extern caddr_t Segtabzero;
- devzeropage = Segtabzero;
- }
- c = min(iov->iov_len, PAGE_SIZE);
- error = uiomove(devzeropage, c, uio);
- continue;
-
- default:
- return (ENXIO);
- }
- if (error)
- break;
- iov->iov_base += c;
- iov->iov_len -= c;
- uio->uio_offset += c;
- uio->uio_resid -= c;
- }
- if (minor(dev) == 0) {
-unlock:
- if (physlock > 1)
- wakeup((caddr_t)&physlock);
- physlock = 0;
- }
- return (error);
-}
-
-paddr_t
-mmmmap(dev, off, prot)
- dev_t dev;
- off_t off;
- int prot;
-{
- /*
- * /dev/mem is the only one that makes sense through this
- * interface. For /dev/kmem any physaddr we return here
- * could be transient and hence incorrect or invalid at
- * a later time. /dev/null just doesn't make any sense
- * and /dev/zero is a hack that is handled via the default
- * pager in mmap().
- */
- if (minor(dev) != 0)
- return (-1);
- /*
- * Allow access only in RAM.
- *
- * XXX could be extended to allow access to IO space but must
- * be very careful.
- */
- if ((unsigned)off >= 0xFFFFFFFC || (unsigned)off < NBPG)
- return (-1);
- return (off);
-}
-
-/*ARGSUSED*/
-int
-mmioctl(dev, cmd, data, flags, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flags;
- struct proc *p;
-{
- return (EOPNOTSUPP);
-}
diff --git a/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c b/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c
deleted file mode 100644
index 3e3b564d102..00000000000
--- a/sys/arch/mvme68k/mvme68k/pmap_bootstrap.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/* $OpenBSD: pmap_bootstrap.c,v 1.24 2010/06/28 04:20:28 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * Copyright (c) 1999 Steve Murphree, Jr. (68060 support)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)pmap_bootstrap.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/msgbuf.h>
-
-#include <machine/cpu.h>
-#include <machine/frame.h>
-#include <machine/pte.h>
-#include <machine/vmparam.h>
-
-#include <uvm/uvm_extern.h>
-#include <uvm/uvm_km.h>
-
-vaddr_t iiomapbase;
-int iiomapsize;
-#define ETHERPAGES 16
-void *etherbuf;
-int etherlen;
-
-extern vaddr_t extiobase;
-extern int physmem;
-
-#define RELOC(v, t) *((t*)((u_int)&(v) + firstpa))
-#define PA2VA(v, t) *((t*)((u_int)&(v)))
-
-#define MACHINE_IIOMAPSIZE RELOC(iiomapsize, vaddr_t)
-#define MACHINE_INTIOBASE RELOC(iiomapbase, vaddr_t)
-#define MACHINE_EIOMAPSIZE EIOMAPSIZE
-
-#define PMAP_MD_LOCALS /* nothing */
-
-#define PMAP_MD_RELOC1() \
-do { \
- RELOC(etherbuf, void *) = (void *)nextpa; \
- nextpa += ETHERPAGES * NBPG; \
-} while (0)
-
-#define PMAP_MD_MAPIOSPACE() \
-do { \
- pte = &((u_int *)kptpa)[atop((vaddr_t)etherbuf)]; \
- epte = pte + ETHERPAGES; \
- while (pte < epte) { \
- *pte = (*pte & ~PG_CMASK) | PG_CIS | PG_U; \
- pte++; \
- } \
- RELOC(etherlen, int) = ETHERPAGES * NBPG; \
-} while (0)
-
- /*
- * intiobase, intiolimit: base and end of internal IO space.
- * MACHINE_IIOMAPSIZE pages prior to external IO space at end of
- * static kernel page table.
- * extiobase: base of external IO space.
- * MACHINE_EIOMAPSIZE pages at the end of the static kernel page table.
- */
-#define PMAP_MD_RELOC2() \
-do { \
- RELOC(intiobase, vaddr_t) = (vaddr_t)iiobase; \
- RELOC(intiolimit, vaddr_t) = (vaddr_t)eiobase; \
- RELOC(extiobase, vaddr_t) = (vaddr_t)eiobase; \
-} while (0)
-
-#define PMAP_MD_MEMSIZE() \
-do { \
- RELOC(avail_end, paddr_t) = ptoa(RELOC(physmem, int)) - \
- round_page(MSGBUFSIZE); \
-} while (0)
-
-#define PMAP_MD_RELOC3() /* nothing */
-
-#include <m68k/m68k/pmap_bootstrap.c>
-
-void
-pmap_init_md()
-{
- vaddr_t addr;
-
- /*
- * mark as unavailable the regions which we have mapped in
- * pmap_bootstrap().
- */
- addr = intiobase;
- if (uvm_map(kernel_map, &addr, ptoa(iiomapsize + EIOMAPSIZE),
- NULL, UVM_UNKNOWN_OFFSET, 0,
- UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE,
- UVM_INH_NONE, UVM_ADV_RANDOM, UVM_FLAG_FIXED)))
- panic("pmap_init: bogons in the VM system!");
-}
diff --git a/sys/arch/mvme68k/mvme68k/sys_machdep.c b/sys/arch/mvme68k/mvme68k/sys_machdep.c
deleted file mode 100644
index f236e2f6d99..00000000000
--- a/sys/arch/mvme68k/mvme68k/sys_machdep.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* $OpenBSD: sys_machdep.c,v 1.20 2009/02/21 20:33:24 miod Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)sys_machdep.c 8.2 (Berkeley) 1/13/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/ioctl.h>
-#include <sys/file.h>
-#include <sys/time.h>
-#include <sys/proc.h>
-#include <sys/signalvar.h>
-#include <sys/uio.h>
-#include <sys/kernel.h>
-#include <sys/mtio.h>
-#include <sys/buf.h>
-#include <sys/mount.h>
-
-#include <sys/syscallargs.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/cpu.h>
-
-int
-sys_sysarch(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
-#if 0
- struct sys_sysarch_args /* {
- syscallarg(int) op;
- syscallarg(char *) parms;
- } */ *uap = v;
-#endif
-
- return ENOSYS;
-}
diff --git a/sys/arch/mvme68k/mvme68k/trap.c b/sys/arch/mvme68k/mvme68k/trap.c
deleted file mode 100644
index 289d177fc90..00000000000
--- a/sys/arch/mvme68k/mvme68k/trap.c
+++ /dev/null
@@ -1,1079 +0,0 @@
-/* $OpenBSD: trap.c,v 1.78 2013/11/02 13:49:22 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * Copyright (c) 1999 Steve Murphree, Jr. (68060 support)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: trap.c 1.37 92/12/20$
- *
- * @(#)trap.c 8.5 (Berkeley) 1/4/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/acct.h>
-#include <sys/kernel.h>
-#include <sys/signalvar.h>
-#include <sys/resourcevar.h>
-#include <sys/syscall.h>
-#include <sys/syscall_mi.h>
-#include <sys/syslog.h>
-#include <sys/user.h>
-
-#include <machine/db_machdep.h>
-#include <machine/cpu.h>
-#include <machine/psl.h>
-#include <machine/reg.h>
-#include <machine/trap.h>
-
-#include <uvm/uvm_extern.h>
-#include <uvm/uvm_pmap.h>
-
-int astpending;
-int want_resched;
-
-char *trap_type[] = {
- "Bus error",
- "Address error",
- "Illegal instruction",
- "Zero divide",
- "CHK instruction",
- "TRAPV instruction",
- "Privilege violation",
- "Trace trap",
- "MMU fault",
- "SSIR trap",
- "Format error",
- "68881 exception",
- "Coprocessor violation",
- "Async system trap"
-};
-int trap_types = sizeof trap_type / sizeof trap_type[0];
-
-/*
- * Size of various exception stack frames (minus the standard 8 bytes)
- */
-short exframesize[] = {
- FMT0SIZE, /* type 0 - normal (68020/030/040/060) */
- FMT1SIZE, /* type 1 - throwaway (68020/030/040) */
- FMT2SIZE, /* type 2 - normal 6-word (68020/030/040/060) */
- FMT3SIZE, /* type 3 - FP post-instruction (68040/060) */
- FMT4SIZE, /* type 4 - access error/fp disabled (68060) */
- -1, -1, /* type 5-6 - undefined */
- FMT7SIZE, /* type 7 - access error (68040) */
- 58, /* type 8 - bus fault (68010) */
- FMT9SIZE, /* type 9 - coprocessor mid-instruction (68020/030) */
- FMTASIZE, /* type A - short bus fault (68020/030) */
- FMTBSIZE, /* type B - long bus fault (68020/030) */
- -1, -1, -1, -1 /* type C-F - undefined */
-};
-
-
-#if defined(M68040) || defined(M68060)
-#define KDFAULT(c) (mmutype == MMU_68060 ? ((c) & FSLW_TM_SV) : \
- mmutype == MMU_68040 ? ((c) & SSW4_TMMASK) == SSW4_TMKD : \
- ((c) & (SSW_DF|FC_SUPERD)) == (SSW_DF|FC_SUPERD))
-#define WRFAULT(c) (mmutype == MMU_68060 ? ((c) & FSLW_RW_W) : \
- mmutype == MMU_68040 ? ((c) & SSW4_RW) == 0 : \
- ((c) & (SSW_DF|SSW_RW)) == SSW_DF)
-#else
-#define KDFAULT(c) (((c) & (SSW_DF|SSW_FCMASK)) == (SSW_DF|FC_SUPERD))
-#define WRFAULT(c) (((c) & (SSW_DF|SSW_RW)) == SSW_DF)
-#endif
-
-#ifdef DEBUG
-int mmudebug = 0;
-int mmupid = -1;
-#define MDB_FOLLOW 1
-#define MDB_WBFOLLOW 2
-#define MDB_WBFAILED 4
-#define MDB_ISPID(p) (p) == mmupid
-#endif
-
-void trap(int, u_int, u_int, struct frame);
-void syscall(register_t, struct frame);
-void init_intrs(void);
-void hardintr(int, int, void *);
-int writeback(struct frame *);
-void wb_userret(struct proc *, struct frame *);
-
-#ifdef M68040
-/*
- * Handle writeback completion on 68040.
- */
-void
-wb_userret(struct proc *p, struct frame *fp)
-{
- /*
- * Deal with user mode writebacks (from trap, or from sigreturn).
- * If any writeback fails, go back and attempt signal delivery.
- * unless we have already been here and attempted the writeback
- * (e.g. bad address with user ignoring SIGSEGV). In that case
- * we just return to the user without successfully completing
- * the writebacks. Maybe we should just drop the sucker?
- */
- if (mmutype == MMU_68040 && fp->f_format == FMT7) {
- int sig;
- union sigval sv;
-
- if ((sig = writeback(fp)) != 0) {
- sv.sival_int = fp->f_fmt7.f_fa;
- trapsignal(p, sig, T_MMUFLT, SEGV_MAPERR, sv);
-
- userret(p);
- }
- }
-}
-#endif
-
-/*
- * Trap is called from locore to handle most types of processor traps,
- * including events such as simulated software interrupts/AST's.
- * System calls are broken out for efficiency.
- */
-/*ARGSUSED*/
-void
-trap(type, code, v, frame)
- int type;
- u_int code;
- register u_int v;
- struct frame frame;
-{
- register struct proc *p;
- register int i;
- u_int ucode;
- int typ = 0;
- register union sigval sv;
-
- uvmexp.traps++;
- p = curproc;
- ucode = 0;
- if (USERMODE(frame.f_sr)) {
- type |= T_USER;
- p->p_md.md_regs = frame.f_regs;
- }
- switch (type) {
- default:
-dopanic:
- printf("trap type %d, code = %x, v = %x\n", type, code, v);
-#ifdef DDB
- if (kdb_trap(type, (db_regs_t *)&frame))
- return;
-#endif
- regdump(&(frame.F_t), 128);
- type &= ~T_USER;
- if ((u_int)type < trap_types)
- panic(trap_type[type]);
- panic("trap");
-
- case T_BUSERR: /* kernel bus error */
- if (!p || !p->p_addr->u_pcb.pcb_onfault)
- goto dopanic;
-copyfault:
- /*
- * If we have arranged to catch this fault in any of the
- * copy to/from user space routines, set PC to return to
- * indicated location and set flag informing buserror code
- * that it may need to clean up stack frame.
- */
- frame.f_stackadj = exframesize[frame.f_format];
- frame.f_format = frame.f_vector = 0;
- frame.f_pc = (int) p->p_addr->u_pcb.pcb_onfault;
- return;
-
- case T_BUSERR|T_USER: /* bus error */
- typ = BUS_OBJERR;
- ucode = code & ~T_USER;
- i = SIGBUS;
- break;
- case T_ADDRERR|T_USER: /* address error */
- typ = BUS_ADRALN;
- ucode = code & ~T_USER;
- i = SIGBUS;
- break;
-
- case T_COPERR: /* kernel coprocessor violation */
- case T_FMTERR|T_USER: /* do all RTE errors come in as T_USER? */
- case T_FMTERR: /* ...just in case... */
- /*
- * The user has most likely trashed the RTE or FP state info
- * in the stack frame of a signal handler.
- */
- printf("pid %d: kernel %s exception\n", p->p_pid,
- type==T_COPERR ? "coprocessor" : "format");
- sigexit(p, SIGILL);
- /* NOTREACHED */
- break;
-
- case T_COPERR|T_USER: /* user coprocessor violation */
- /* What is a proper response here? */
- typ = FPE_FLTINV;
- ucode = 0;
- i = SIGFPE;
- break;
-
- case T_FPERR|T_USER: /* 68881 exceptions */
- typ = FPE_FLTRES;
- ucode = code;
- i = SIGFPE;
- v = frame.f_pc;
- break;
-
-#if defined(M68040) || defined(M68060)
- case T_FPEMULI|T_USER: /* unimplemented FP instruction */
- case T_FPEMULD|T_USER: /* unimplemented FP data type */
- /* XXX need to FSAVE */
- printf("pid %d(%s): unimplemented FP %s at %x (EA %x)\n",
- p->p_pid, p->p_comm,
- frame.f_format == 2 ? "instruction" : "data type",
- frame.f_pc, frame.f_fmt2.f_iaddr);
- /* XXX need to FRESTORE */
- typ = FPE_FLTINV;
- i = SIGFPE;
- v = frame.f_pc;
- break;
-#endif
-
- case T_ILLINST|T_USER: /* illegal instruction fault */
- ucode = frame.f_format; /* XXX was ILL_PRIVIN_FAULT */
- typ = ILL_ILLOPC;
- i = SIGILL;
- v = frame.f_pc;
- break;
-
- case T_PRIVINST|T_USER: /* privileged instruction fault */
- ucode = frame.f_format; /* XXX was ILL_PRIVIN_FAULT */
- typ = ILL_PRVOPC;
- i = SIGILL;
- v = frame.f_pc;
- break;
-
- case T_ZERODIV|T_USER: /* Divide by zero */
- ucode = frame.f_format; /* XXX was FPE_INTDIV_TRAP */
- typ = FPE_INTDIV;
- i = SIGFPE;
- v = frame.f_pc;
- break;
-
- case T_CHKINST|T_USER: /* CHK instruction trap */
- ucode = frame.f_format; /* XXX was FPE_SUBRNG_TRAP */
- typ = FPE_FLTSUB;
- i = SIGFPE;
- v = frame.f_pc;
- break;
-
- case T_TRAPVINST|T_USER: /* TRAPV instruction trap */
- ucode = frame.f_format; /* XXX was FPE_INTOVF_TRAP */
- typ = ILL_ILLTRP;
- i = SIGILL;
- v = frame.f_pc;
- break;
-
- /*
- * XXX: Trace traps are a nightmare.
- *
- * HP-UX uses trap #1 for breakpoints,
- * OpenBSD/m68k uses trap #2,
- * SUN 3.x uses trap #15,
- * KGDB uses trap #15 (for kernel breakpoints; handled elsewhere).
- *
- * OpenBSD and HP-UX traps both get mapped by locore.s into
- * T_TRACE.
- * SUN 3.x traps get passed through as T_TRAP15 and are not really
- * supported yet.
- */
- case T_TRAP15: /* kernel breakpoint */
-#ifdef DEBUG
- printf("unexpected kernel trace trap, type = %d\n", type);
- printf("program counter = 0x%x\n", frame.f_pc);
-#endif
- frame.f_sr &= ~PSL_T;
- return;
-
- case T_TRACE|T_USER: /* user trace trap */
- case T_TRACE:
- case T_TRAP15|T_USER: /* SUN user trace trap */
- frame.f_sr &= ~PSL_T;
- i = SIGTRAP;
- typ = TRAP_TRACE;
- break;
-
- case T_ASTFLT: /* system async trap, cannot happen */
- goto dopanic;
-
- case T_ASTFLT|T_USER: /* user async trap */
- astpending = 0;
- /*
- * We check for software interrupts first. This is because
- * they are at a higher level than ASTs, and on a VAX would
- * interrupt the AST. We assume that if we are processing
- * an AST that we must be at IPL0 so we don't bother to
- * check. Note that we ensure that we are at least at SIR
- * IPL while processing the SIR.
- */
- splsoft();
- /* FALLTHROUGH */
-
- case T_SSIR: /* software interrupt */
- case T_SSIR|T_USER:
- {
- int sir, q, mask;
-
- while ((sir = softpending) != 0) {
- atomic_clearbits_int(&softpending, sir);
-
- for (q = SI_NQUEUES - 1, mask = 1 << (SI_NQUEUES - 1);
- mask != 0; q--, mask >>= 1)
- if (mask & sir)
- softintr_dispatch(q);
- }
- }
-
- /*
- * If this was not an AST trap, we are all done.
- */
- if (type != (T_ASTFLT|T_USER)) {
- uvmexp.traps--;
- return;
- }
- spl0();
- if (p->p_flag & P_OWEUPC) {
- ADDUPROF(p);
- }
- if (type == (T_ASTFLT | T_USER) && want_resched) {
- preempt(NULL);
- }
- goto out;
-
- case T_MMUFLT: /* kernel mode page fault */
- case T_MMUFLT|T_USER: /* page fault */
- {
- vaddr_t va;
- struct vmspace *vm = NULL;
- struct vm_map *map;
- int rv;
- vm_prot_t ftype, vftype;
- extern struct vm_map *kernel_map;
-
- /* vmspace only significant if T_USER */
- if (p)
- vm = p->p_vmspace;
-
-#ifdef DEBUG
- if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid))
- printf("trap: T_MMUFLT pid=%d, code=%x, v=%x, pc=%x, sr=%x\n",
- p->p_pid, code, v, frame.f_pc, frame.f_sr);
-#endif
- /*
- * It is only a kernel address space fault iff:
- * 1. (type & T_USER) == 0 and
- * 2. pcb_onfault not set or
- * 3. pcb_onfault set but supervisor space data fault
- * The last can occur during an exec() copyin where the
- * argument space is lazy-allocated.
- */
- if (type == T_MMUFLT &&
- ((p && !p->p_addr->u_pcb.pcb_onfault) || KDFAULT(code)))
- map = kernel_map;
- else
- map = vm ? &vm->vm_map : kernel_map;
- if (WRFAULT(code)) {
- vftype = VM_PROT_WRITE;
- ftype = VM_PROT_READ | VM_PROT_WRITE;
- } else
- vftype = ftype = VM_PROT_READ;
- va = trunc_page((vaddr_t)v);
-
- if (map == kernel_map && va == 0) {
- printf("trap: bad kernel access at %x\n", v);
- goto dopanic;
- }
- rv = uvm_fault(map, va, 0, ftype);
-#ifdef DEBUG
- if (rv && MDB_ISPID(p->p_pid))
- printf("uvm_fault(%x, %x, 0, %x) -> %x\n",
- map, va, ftype, rv);
-#endif
- /*
- * If this was a stack access we keep track of the maximum
- * accessed stack size. Also, if vm_fault gets a protection
- * failure it is due to accessing the stack region outside
- * the current limit and we need to reflect that as an access
- * error.
- */
- if ((vm != NULL && (caddr_t)va >= vm->vm_maxsaddr)
- && map != kernel_map) {
- if (rv == 0)
- uvm_grow(p, va);
- else if (rv == EACCES)
- rv = EFAULT;
- }
- if (rv == 0) {
- if (type == T_MMUFLT) {
-#if defined(M68040)
- if (mmutype == MMU_68040)
- (void)writeback(&frame);
-#endif
- return;
- }
- goto out;
- }
- if (type == T_MMUFLT) {
- if (p && p->p_addr->u_pcb.pcb_onfault)
- goto copyfault;
- printf("uvm_fault(%p, %lx, 0, %x) -> %x\n",
- map, va, ftype, rv);
- printf(" type %x, code [mmu,,ssw]: %x\n",
- type, code);
- goto dopanic;
- }
- frame.f_pad = code & 0xffff;
- ucode = vftype;
- typ = SEGV_MAPERR;
- i = SIGSEGV;
- }
- break;
- }
- sv.sival_int = v;
- trapsignal(p, i, ucode, typ, sv);
-out:
- if ((type & T_USER) == 0)
- return;
- userret(p);
-#ifdef M68040
- wb_userret(p, &frame);
-#endif
-}
-
-#if defined(M68040)
-#ifdef DEBUG
-struct writebackstats {
- int calls;
- int cpushes;
- int move16s;
- int wb1s, wb2s, wb3s;
- int wbsize[4];
-} wbstats;
-
-char *f7sz[] = { "longword", "byte", "word", "line"};
-char *f7tt[] = { "normal", "MOVE16", "AFC", "ACK"};
-char *f7tm[] = { "d-push", "u-data", "u-code", "M-data",
- "M-code", "k-data", "k-code", "RES"};
-char wberrstr[] =
-"WARNING: pid %d(%s) writeback [%s] failed, pc=%x fa=%x wba=%x wbd=%x\n";
-#endif
-
-int
-writeback(struct frame *fp)
-{
- struct fmt7 *f = &fp->f_fmt7;
- struct proc *p = curproc;
- int err = 0;
- u_int fa;
- paddr_t pa;
- caddr_t oonfault = p->p_addr->u_pcb.pcb_onfault;
-
-#ifdef DEBUG
- if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid)) {
- printf(" pid=%d, fa=%x,", p->p_pid, f->f_fa);
- dumpssw(f->f_ssw);
- }
- wbstats.calls++;
-#endif
- /*
- * Deal with special cases first.
- */
- if ((f->f_ssw & SSW4_TMMASK) == SSW4_TMDCP) {
- /*
- * Dcache push fault.
- * Line-align the address and write out the push data to
- * the indicated physical address.
- */
-#ifdef DEBUG
- if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid)) {
- printf(" pushing %s to PA %x, data %x",
- f7sz[(f->f_ssw & SSW4_SZMASK) >> 5],
- f->f_fa, f->f_pd0);
- if ((f->f_ssw & SSW4_SZMASK) == SSW4_SZLN)
- printf("/%x/%x/%x",
- f->f_pd1, f->f_pd2, f->f_pd3);
- printf("\n");
- }
- if (f->f_wb1s & SSW4_WBSV)
- panic("writeback: cache push with WB1S valid");
- wbstats.cpushes++;
-#endif
- /*
- * XXX there are security problems if we attempt to do a
- * cache push after a signal handler has been called.
- */
- pmap_kenter_pa((vaddr_t)vmmap,
- trunc_page(f->f_fa), VM_PROT_WRITE);
- pmap_update(pmap_kernel());
- fa = (u_int)&vmmap[(f->f_fa & PGOFSET) & ~0x000f];
- bcopy((caddr_t)&f->f_pd0, (caddr_t)fa, 16);
- pmap_extract(pmap_kernel(), (vaddr_t)fa, &pa);
- DCFL(pa);
- pmap_kremove((vaddr_t)vmmap, PAGE_SIZE);
- pmap_update(pmap_kernel());
- } else if ((f->f_ssw & (SSW4_RW|SSW4_TTMASK)) == SSW4_TTM16) {
- /*
- * MOVE16 fault.
- * Line-align the address and write out the push data to
- * the indicated virtual address.
- */
-#ifdef DEBUG
- if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid))
- printf(" MOVE16 to VA %x(%x), data %x/%x/%x/%x\n",
- f->f_fa, f->f_fa & ~0xF, f->f_pd0, f->f_pd1,
- f->f_pd2, f->f_pd3);
- if (f->f_wb1s & SSW4_WBSV)
- panic("writeback: MOVE16 with WB1S valid");
- wbstats.move16s++;
-#endif
- if (KDFAULT(f->f_wb1s))
- bcopy((caddr_t)&f->f_pd0, (caddr_t)(f->f_fa & ~0xF), 16);
- else
- err = suline((caddr_t)(f->f_fa & ~0xF), (caddr_t)&f->f_pd0);
- if (err) {
- fa = f->f_fa & ~0xF;
-#ifdef DEBUG
- if (mmudebug & MDB_WBFAILED)
- printf(wberrstr, p->p_pid, p->p_comm,
- "MOVE16", fp->f_pc, f->f_fa,
- f->f_fa & ~0xF, f->f_pd0);
-#endif
- }
- } else if (f->f_wb1s & SSW4_WBSV) {
- /*
- * Writeback #1.
- * Position the "memory-aligned" data and write it out.
- */
- u_int wb1d = f->f_wb1d;
- int off;
-
-#ifdef DEBUG
- if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid))
- dumpwb(1, f->f_wb1s, f->f_wb1a, f->f_wb1d);
- wbstats.wb1s++;
- wbstats.wbsize[(f->f_wb2s&SSW4_SZMASK)>>5]++;
-#endif
- off = (f->f_wb1a & 3) * 8;
- switch (f->f_wb1s & SSW4_SZMASK) {
- case SSW4_SZLW:
- if (off)
- wb1d = (wb1d >> (32 - off)) | (wb1d << off);
- if (KDFAULT(f->f_wb1s))
- *(long *)f->f_wb1a = wb1d;
- else
- err = copyout(&wb1d,
- (caddr_t)f->f_wb1a, sizeof(int));
- break;
- case SSW4_SZB:
- off = 24 - off;
- if (off)
- wb1d >>= off;
- if (KDFAULT(f->f_wb1s))
- *(char *)f->f_wb1a = wb1d;
- else {
- char tmp = wb1d;
-
- err = copyout(&tmp,
- (caddr_t)f->f_wb1a, sizeof(char));
- }
- break;
- case SSW4_SZW:
- off = (off + 16) % 32;
- if (off)
- wb1d = (wb1d >> (32 - off)) | (wb1d << off);
- if (KDFAULT(f->f_wb1s))
- *(short *)f->f_wb1a = wb1d;
- else {
- short tmp = wb1d;
-
- err = copyout(&tmp,
- (caddr_t)f->f_wb1a, sizeof(short));
- }
- break;
- }
- if (err) {
- fa = f->f_wb1a;
-#ifdef DEBUG
- if (mmudebug & MDB_WBFAILED)
- printf(wberrstr, p->p_pid, p->p_comm,
- "#1", fp->f_pc, f->f_fa,
- f->f_wb1a, f->f_wb1d);
-#endif
- }
- }
- /*
- * Deal with the "normal" writebacks.
- *
- * XXX writeback2 is known to reflect a LINE size writeback after
- * a MOVE16 was already dealt with above. Ignore it.
- */
- if (err == 0 && (f->f_wb2s & SSW4_WBSV) &&
- (f->f_wb2s & SSW4_SZMASK) != SSW4_SZLN) {
-#ifdef DEBUG
- if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid))
- dumpwb(2, f->f_wb2s, f->f_wb2a, f->f_wb2d);
- wbstats.wb2s++;
- wbstats.wbsize[(f->f_wb2s&SSW4_SZMASK)>>5]++;
-#endif
- switch (f->f_wb2s & SSW4_SZMASK) {
- case SSW4_SZLW:
- if (KDFAULT(f->f_wb2s))
- *(long *)f->f_wb2a = f->f_wb2d;
- else
- err = copyout(&f->f_wb2d,
- (caddr_t)f->f_wb2a, sizeof(int));
- break;
- case SSW4_SZB:
- if (KDFAULT(f->f_wb2s))
- *(char *)f->f_wb2a = f->f_wb2d;
- else {
- char tmp = f->f_wb2d;
-
- err = copyout(&tmp,
- (caddr_t)f->f_wb2a, sizeof(char));
- }
- break;
- case SSW4_SZW:
- if (KDFAULT(f->f_wb2s))
- *(short *)f->f_wb2a = f->f_wb2d;
- else {
- short tmp = f->f_wb2d;
-
- err = copyout(&tmp,
- (caddr_t)f->f_wb2a, sizeof(short));
- }
- break;
- }
- if (err) {
- fa = f->f_wb2a;
-#ifdef DEBUG
- if (mmudebug & MDB_WBFAILED) {
- printf(wberrstr, p->p_pid, p->p_comm,
- "#2", fp->f_pc, f->f_fa,
- f->f_wb2a, f->f_wb2d);
- dumpssw(f->f_ssw);
- dumpwb(2, f->f_wb2s, f->f_wb2a, f->f_wb2d);
- }
-#endif
- }
- }
- if (err == 0 && (f->f_wb3s & SSW4_WBSV)) {
-#ifdef DEBUG
- if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid))
- dumpwb(3, f->f_wb3s, f->f_wb3a, f->f_wb3d);
- wbstats.wb3s++;
- wbstats.wbsize[(f->f_wb3s&SSW4_SZMASK)>>5]++;
-#endif
- switch (f->f_wb3s & SSW4_SZMASK) {
- case SSW4_SZLW:
- if (KDFAULT(f->f_wb3s))
- *(long *)f->f_wb3a = f->f_wb3d;
- else
- err = copyout(&f->f_wb3d,
- (caddr_t)f->f_wb3a, sizeof(int));
- break;
- case SSW4_SZB:
- if (KDFAULT(f->f_wb3s))
- *(char *)f->f_wb3a = f->f_wb3d;
- else {
- char tmp = f->f_wb3d;
-
- err = copyout(&tmp,
- (caddr_t)f->f_wb3a, sizeof(char));
- }
- break;
- case SSW4_SZW:
- if (KDFAULT(f->f_wb3s))
- *(short *)f->f_wb3a = f->f_wb3d;
- else {
- short tmp = f->f_wb3d;
-
- err = copyout(&tmp,
- (caddr_t)f->f_wb3a, sizeof(short));
- }
- break;
-#ifdef DEBUG
- case SSW4_SZLN:
- panic("writeback: wb3s indicates LINE write");
-#endif
- }
- if (err) {
- fa = f->f_wb3a;
-#ifdef DEBUG
- if (mmudebug & MDB_WBFAILED)
- printf(wberrstr, p->p_pid, p->p_comm,
- "#3", fp->f_pc, f->f_fa,
- f->f_wb3a, f->f_wb3d);
-#endif
- }
- }
- p->p_addr->u_pcb.pcb_onfault = oonfault;
- /*
- * Any problems are SIGSEGV's
- */
- if (err)
- err = SIGSEGV;
- return (err);
-}
-
-#ifdef DEBUG
-void
-dumpssw(ssw)
- register u_short ssw;
-{
- printf(" SSW: %x: ", ssw);
- if (ssw & SSW4_CP)
- printf("CP,");
- if (ssw & SSW4_CU)
- printf("CU,");
- if (ssw & SSW4_CT)
- printf("CT,");
- if (ssw & SSW4_CM)
- printf("CM,");
- if (ssw & SSW4_MA)
- printf("MA,");
- if (ssw & SSW4_ATC)
- printf("ATC,");
- if (ssw & SSW4_LK)
- printf("LK,");
- if (ssw & SSW4_RW)
- printf("RW,");
- printf(" SZ=%s, TT=%s, TM=%s\n",
- f7sz[(ssw & SSW4_SZMASK) >> 5],
- f7tt[(ssw & SSW4_TTMASK) >> 3],
- f7tm[ssw & SSW4_TMMASK]);
-}
-
-void
-dumpwb(num, s, a, d)
- int num;
- u_short s;
- u_int a, d;
-{
- register struct proc *p = curproc;
- paddr_t pa;
- int tmp;
-
- printf(" writeback #%d: VA %x, data %x, SZ=%s, TT=%s, TM=%s\n",
- num, a, d, f7sz[(s & SSW4_SZMASK) >> 5],
- f7tt[(s & SSW4_TTMASK) >> 3], f7tm[s & SSW4_TMMASK]);
- printf(" PA ");
- if (pmap_extract(p->p_vmspace->vm_map.pmap, (vaddr_t)a, &pa) == FALSE)
- printf("<invalid address>");
- else {
- if (copyin((caddr_t)a, &tmp, sizeof(int)) == 0)
- printf("%lx, current value %lx", pa, tmp);
- else
- printf("%lx, current value inaccessible", pa);
- }
- printf("\n");
-}
-#endif
-#endif
-
-/*
- * Process a system call.
- */
-void
-syscall(code, frame)
- register_t code;
- struct frame frame;
-{
- register caddr_t params;
- register struct sysent *callp;
- register struct proc *p;
- int error, opc, nsys;
- size_t argsize;
- register_t args[8], rval[2];
- uvmexp.syscalls++;
-
- if (!USERMODE(frame.f_sr))
- panic("syscall");
- p = curproc;
- p->p_md.md_regs = frame.f_regs;
- opc = frame.f_pc;
-
- nsys = p->p_emul->e_nsysent;
- callp = p->p_emul->e_sysent;
-
- params = (caddr_t)frame.f_regs[SP] + sizeof(int);
-
- switch (code) {
- case SYS_syscall:
- /*
- * Code is first argument, followed by actual args.
- */
- if (copyin(params, &code, sizeof(register_t)) != 0)
- code = -1;
- params += sizeof(int);
- /*
- * XXX sigreturn requires special stack manipulation
- * that is only done if entered via the sigreturn
- * trap. Cannot allow it here so make sure we fail.
- */
- if (code == SYS_sigreturn)
- code = nsys;
- break;
- case SYS___syscall:
- /*
- * Like syscall, but code is a quad, so as to maintain
- * quad alignment for the rest of the arguments.
- */
- if (callp != sysent)
- break;
- if ((error = copyin(params + _QUAD_LOWWORD * sizeof(int),
- &code, sizeof(register_t))))
- goto bad;
- params += sizeof(quad_t);
- break;
- default:
- break;
- }
- if (code < 0 || code >= nsys)
- callp += p->p_emul->e_nosys; /* illegal */
- else
- callp += code;
- argsize = callp->sy_argsize;
- if (argsize && (error = copyin(params, args, argsize)))
- goto bad;
-
- rval[0] = 0;
- rval[1] = frame.f_regs[D1];
-
- error = mi_syscall(p, code, callp, args, rval);
-
- switch (error) {
- case 0:
- frame.f_regs[D0] = rval[0];
- frame.f_regs[D1] = rval[1];
- frame.f_sr &= ~PSL_C; /* carry bit */
- break;
- case ERESTART:
- /*
- * We always enter through a `trap' instruction, which is 2
- * bytes, so adjust the pc by that amount.
- */
- frame.f_pc = opc - 2;
- break;
- case EJUSTRETURN:
- /* nothing to do */
- break;
- default:
- bad:
- frame.f_regs[D0] = error;
- frame.f_sr |= PSL_C; /* carry bit */
- break;
- }
-
- mi_syscall_return(p, code, error, rval);
-}
-
-typedef SLIST_HEAD(,intrhand) intrhand_t;
-intrhand_t intrs[NVMEINTR];
-
-void
-init_intrs()
-{
- int i;
- extern void netintr(void *);
-
- /* hard interrupts... */
- for (i = 0; i < NVMEINTR; i++)
- SLIST_INIT(&intrs[i]);
-
- /* soft interrupts... */
- softintr_init();
-}
-
-void
-hardintr(pc, evec, frame)
- int pc;
- int evec;
- void *frame;
-{
- extern void straytrap(int, u_short);
- int vec = (evec & 0xfff) >> 2; /* XXX should be m68k macro? */
- struct intrhand *ih;
- intrhand_t *list;
- int count = 0;
- int r;
-
- uvmexp.intrs++;
-
- list = &intrs[vec];
- if (SLIST_EMPTY(list)) {
- straytrap(pc, evec);
- } else {
- SLIST_FOREACH(ih, list, ih_link) {
- r = (*ih->ih_fn)(ih->ih_wantframe ? frame : ih->ih_arg);
- if (r != 0) {
- ih->ih_count.ec_count++;
- count++;
- }
- }
-
- if (count == 0) {
- printf("Unclaimed interrupt (vector %d) from %x\n",
- evec, pc);
- }
- }
-}
-
-/*
- * find a useable interrupt vector in the range start, end. It starts at
- * the end of the range, and searches backwards (to increase the chances
- * of not conflicting with more normal users)
- */
-int
-intr_findvec(start, end)
- int start, end;
-{
- extern u_long *vectab[], hardtrap, badtrap;
- int vec;
-
- if (start < 0 || end >= NVMEINTR || start > end)
- return (-1);
- for (vec = end; vec > start; --vec)
- if (vectab[vec] == &badtrap || vectab[vec] == &hardtrap)
- return (vec);
- return (-1);
-}
-
-/*
- * Chain the interrupt handler in. But first check if the vector
- * offset chosen is legal. It either must be a badtrap (not allocated
- * for a `system' purpose), or it must be a hardtrap (ie. already
- * allocated to deal with chained interrupt handlers).
- */
-int
-intr_establish(vec, ih, name)
- int vec;
- struct intrhand *ih;
- const char *name;
-{
- extern u_long *vectab[], hardtrap, badtrap;
- struct intrhand *intr;
- intrhand_t *list;
-
-#ifdef DIAGNOSTIC
- if (vec < 0 || vec >= NVMEINTR) {
- panic("intr_establish: vec (0x%x) out of bounds", vec);
- return (-1);
- }
-#endif
-
- if (vectab[vec] != &badtrap && vectab[vec] != &hardtrap) {
-#ifdef DIAGNOSTIC
- panic("intr_establish: vec (%x) unavailable for devices", vec);
-#endif
- return (-1);
- }
- vectab[vec] = &hardtrap;
-
- list = &intrs[vec];
- if (!SLIST_EMPTY(list)) {
- intr = SLIST_FIRST(list);
- if (intr->ih_ipl != ih->ih_ipl) {
-#ifdef DIAGNOSTIC
- panic("intr_establish: there are other handlers with "
- "vec (0x%x) at ipl %x, but you want it at %x",
- vec, intr->ih_ipl, ih->ih_ipl);
-#endif
- return (-1);
- }
- }
-
- evcount_attach(&ih->ih_count, name, &ih->ih_ipl);
- SLIST_INSERT_HEAD(list, ih, ih_link);
- return (0);
-}
-
-#ifdef DDB
-#include <sys/reboot.h>
-#include <machine/db_machdep.h>
-#include <ddb/db_command.h>
-
-void db_prom_cmd(db_expr_t, int, db_expr_t, char *);
-void db_machine_init(void);
-
-/* ARGSUSED */
-void
-db_prom_cmd(addr, have_addr, count, modif)
- db_expr_t addr;
- int have_addr;
- db_expr_t count;
- char *modif;
-{
- doboot();
-}
-
-struct db_command db_machine_cmds[] = {
- { "prom", db_prom_cmd, 0, 0},
- { (char *)0,}
-};
-
-void
-db_machine_init()
-{
- db_machine_commands_install(db_machine_cmds);
-}
-#endif /* DDB */
diff --git a/sys/arch/mvme68k/mvme68k/vectors.s b/sys/arch/mvme68k/mvme68k/vectors.s
deleted file mode 100644
index b5828d4abb7..00000000000
--- a/sys/arch/mvme68k/mvme68k/vectors.s
+++ /dev/null
@@ -1,171 +0,0 @@
-/* $OpenBSD: vectors.s,v 1.10 2004/03/02 22:55:55 miod Exp $ */
-
-| Copyright (c) 1995 Theo de Raadt
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions
-| are met:
-| 1. Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| 2. Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-|
-| THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
-| OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-| ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
-| DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-| DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-| OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-| LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-| OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-| SUCH DAMAGE.
-|
-| Copyright (c) 1988 University of Utah
-| Copyright (c) 1990, 1993
-| The Regents of the University of California. All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions
-| are met:
-| 1. Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| 2. Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| 3. All advertising materials mentioning features or use of this software
-| must display the following acknowledgement:
-| This product includes software developed by the University of
-| California, Berkeley and its contributors.
-| 4. Neither the name of the University nor the names of its contributors
-| may be used to endorse or promote products derived from this software
-| without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-| ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-| IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-| ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-| FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-| DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-| OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-| LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-| OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-| SUCH DAMAGE.
-|
-| @(#)vectors.s 8.2 (Berkeley) 1/21/94
-|
-
-#define BADTRAP16 \
- VECTOR(badtrap) ; VECTOR(badtrap) ; \
- VECTOR(badtrap) ; VECTOR(badtrap) ; \
- VECTOR(badtrap) ; VECTOR(badtrap) ; \
- VECTOR(badtrap) ; VECTOR(badtrap) ; \
- VECTOR(badtrap) ; VECTOR(badtrap) ; \
- VECTOR(badtrap) ; VECTOR(badtrap) ; \
- VECTOR(badtrap) ; VECTOR(badtrap) ; \
- VECTOR(badtrap) ; VECTOR(badtrap)
-
- .data
-GLOBAL(vectab)
- .long 0x12345678 /* 0: jmp 0x7400:w (unused reset SSP) */
- VECTOR_UNUSED /* 1: NOT USED (reset PC) */
- VECTOR(busaddrerr2030) /* 2: bus error */
- VECTOR(busaddrerr2030) /* 3: address error */
- VECTOR(illinst) /* 4: illegal instruction */
- VECTOR(zerodiv) /* 5: zero divide */
- VECTOR(chkinst) /* 6: CHK instruction */
- VECTOR(trapvinst) /* 7: TRAPV instruction */
- VECTOR(privinst) /* 8: privilege violation */
- VECTOR(trace) /* 9: trace */
- VECTOR(illinst) /* 10: line 1010 emulator */
- VECTOR(fpfline) /* 11: line 1111 emulator */
- VECTOR(badtrap) /* 12: unassigned, reserved */
- VECTOR(coperr) /* 13: coprocessor protocol violation */
- VECTOR(fmterr) /* 14: format error */
- VECTOR(badtrap) /* 15: uninitialized interrupt vector */
- VECTOR(badtrap) /* 16: unassigned, reserved */
- VECTOR(badtrap) /* 17: unassigned, reserved */
- VECTOR(badtrap) /* 18: unassigned, reserved */
- VECTOR(badtrap) /* 19: unassigned, reserved */
- VECTOR(badtrap) /* 20: unassigned, reserved */
- VECTOR(badtrap) /* 21: unassigned, reserved */
- VECTOR(badtrap) /* 22: unassigned, reserved */
- VECTOR(badtrap) /* 23: unassigned, reserved */
- VECTOR(spurintr) /* 24: spurious interrupt */
- VECTOR(badtrap) /* 25: level 1 interrupt autovector */
- VECTOR(badtrap) /* 26: level 2 interrupt autovector */
- VECTOR(badtrap) /* 27: level 3 interrupt autovector */
- VECTOR(badtrap) /* 28: level 4 interrupt autovector */
- VECTOR(badtrap) /* 29: level 5 interrupt autovector */
- VECTOR(badtrap) /* 30: level 6 interrupt autovector */
- VECTOR(badtrap) /* 31: level 7 interrupt autovector */
- VECTOR(trap0) /* 32: syscalls */
- VECTOR(trap1) /* 33: sigreturn syscall or breakpoint */
- VECTOR(trap2) /* 34: breakpoint or sigreturn syscall */
- VECTOR(illinst) /* 35: TRAP instruction vector */
- VECTOR(illinst) /* 36: TRAP instruction vector */
- VECTOR(illinst) /* 37: TRAP instruction vector */
- VECTOR(illinst) /* 38: TRAP instruction vector */
- VECTOR(illinst) /* 39: TRAP instruction vector */
- VECTOR(illinst) /* 40: TRAP instruction vector */
- VECTOR(illinst) /* 41: TRAP instruction vector */
- VECTOR(illinst) /* 42: TRAP instruction vector */
- VECTOR(illinst) /* 43: TRAP instruction vector */
- VECTOR(trap12) /* 44: TRAP instruction vector */
- VECTOR(illinst) /* 45: TRAP instruction vector */
- VECTOR(illinst) /* 46: TRAP instruction vector */
- VECTOR(trap15) /* 47: TRAP instruction vector */
-
- /*
- * 68881/68882: fpfault zone
- */
-GLOBAL(fpvect_tab)
- VECTOR(fpfault) /* 48: FPCP branch/set on unordered cond */
- VECTOR(fpfault) /* 49: FPCP inexact result */
- VECTOR(fpfault) /* 50: FPCP divide by zero */
- VECTOR(fpfault) /* 51: FPCP underflow */
- VECTOR(fpfault) /* 52: FPCP operand error */
- VECTOR(fpfault) /* 53: FPCP overflow */
- VECTOR(fpfault) /* 54: FPCP signalling NAN */
-GLOBAL(fpvect_end)
-
- VECTOR(fpunsupp) /* 55: FPCP unimplemented data type */
- VECTOR(badtrap) /* 56: unassigned, reserved */
- VECTOR(badtrap) /* 57: unassigned, reserved */
- VECTOR(badtrap) /* 58: unassigned, reserved */
- VECTOR(badtrap) /* 59: unassigned, reserved */
- VECTOR(badtrap) /* 60: unassigned, reserved */
- VECTOR(badtrap) /* 61: unassigned, reserved */
- VECTOR(badtrap) /* 62: unassigned, reserved */
- VECTOR(badtrap) /* 63: unassigned, reserved */
-
- BADTRAP16 /* 64-79: user interrupt vectors */
- BADTRAP16 /* 80-95: user interrupt vectors */
- BADTRAP16 /* 96-111: user interrupt vectors */
- BADTRAP16 /* 112-127: user interrupt vectors */
- BADTRAP16 /* 128-143: user interrupt vectors */
- BADTRAP16 /* 144-159: user interrupt vectors */
- BADTRAP16 /* 160-175: user interrupt vectors */
- BADTRAP16 /* 176-191: user interrupt vectors */
- BADTRAP16 /* 192-207: user interrupt vectors */
- BADTRAP16 /* 208-223: user interrupt vectors */
- BADTRAP16 /* 224-239: user interrupt vectors */
- BADTRAP16 /* 240-255: user interrupt vectors */
-
-
-#ifdef FPSP
- /*
- * 68040: this chunk of vectors is copied into the fpfault zone
- */
-GLOBAL(fpsp_tab)
- ASVECTOR(fpsp_bsun) /* 48: FPCP branch/set on unordered cond */
- ASVECTOR(inex) /* 49: FPCP inexact result */
- ASVECTOR(dz) /* 50: FPCP divide by zero */
- ASVECTOR(fpsp_unfl) /* 51: FPCP underflow */
- ASVECTOR(fpsp_operr) /* 52: FPCP operand error */
- ASVECTOR(fpsp_ovfl) /* 53: FPCP overflow */
- ASVECTOR(fpsp_snan) /* 54: FPCP signalling NAN */
-#endif /* FPSP */
diff --git a/sys/arch/mvme68k/mvme68k/vm_machdep.c b/sys/arch/mvme68k/mvme68k/vm_machdep.c
deleted file mode 100644
index 465a3f5be08..00000000000
--- a/sys/arch/mvme68k/mvme68k/vm_machdep.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/* $OpenBSD: vm_machdep.c,v 1.49 2013/01/16 19:04:43 miod Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah $Hdr: vm_machdep.c 1.21 91/04/06$
- *
- * @(#)vm_machdep.c 8.6 (Berkeley) 1/12/94
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/signalvar.h>
-#include <sys/malloc.h>
-#include <sys/buf.h>
-#include <sys/vnode.h>
-#include <sys/user.h>
-#include <sys/core.h>
-#include <sys/exec.h>
-#include <sys/ptrace.h>
-
-#include <machine/cpu.h>
-#include <machine/pte.h>
-#include <machine/reg.h>
-#include <machine/frame.h>
-
-#include <uvm/uvm_extern.h>
-
-/*
- * Finish a fork operation, with process p2 nearly set up.
- * Copy and update the kernel stack and pcb, making the child
- * ready to run, and marking it so that it can return differently
- * than the parent. Returns 1 in the child process, 0 in the parent.
- * We currently double-map the user area so that the stack is at the same
- * address in each process; in the future we will probably relocate
- * the frame pointers on the stack after copying.
- */
-
-void
-cpu_fork(p1, p2, stack, stacksize, func, arg)
- struct proc *p1, *p2;
- void *stack;
- size_t stacksize;
- void (*func)(void *);
- void *arg;
-{
- struct pcb *pcb = &p2->p_addr->u_pcb;
- struct trapframe *tf;
- struct switchframe *sf;
- extern struct pcb *curpcb;
-
- p2->p_md.md_flags = p1->p_md.md_flags;
-
- /* Copy pcb from proc p1 to p2. */
- if (p1 == curproc) {
- /* Sync the PCB before we copy it. */
- savectx(curpcb);
- }
-#ifdef DIAGNOSTIC
- else if (p1 != &proc0)
- panic("cpu_fork: curproc");
-#endif
- *pcb = p1->p_addr->u_pcb;
-
- /*
- * Copy the trap frame, and arrange for the child to return directly
- * through return_to_user().
- */
- tf = (struct trapframe *)((u_int)p2->p_addr + USPACE) - 1;
- p2->p_md.md_regs = (int *)tf;
- *tf = *(struct trapframe *)p1->p_md.md_regs;
-
- /*
- * If specified, give the child a different stack.
- */
- if (stack != NULL)
- tf->tf_regs[15] = (u_int)stack + stacksize;
-
- sf = (struct switchframe *)tf - 1;
- sf->sf_pc = (u_int)proc_trampoline;
- pcb->pcb_regs[6] = (int)func; /* A2 */
- pcb->pcb_regs[7] = (int)arg; /* A3 */
- pcb->pcb_regs[11] = (int)sf; /* SSP */
- pcb->pcb_ps = PSL_LOWIPL; /* start kthreads at IPL 0 */
-}
-
-/*
- * cpu_exit is called as the last action during exit.
- */
-void
-cpu_exit(p)
- struct proc *p;
-{
- pmap_deactivate(p);
- sched_exit(p);
-}
-
-/*
- * Dump the machine specific header information at the start of a core dump.
- */
-struct md_core {
- struct reg intreg;
- struct fpreg freg;
-};
-int
-cpu_coredump(p, vp, cred, chdr)
- struct proc *p;
- struct vnode *vp;
- struct ucred *cred;
- struct core *chdr;
-{
- struct md_core md_core;
- struct coreseg cseg;
- int error;
-
- CORE_SETMAGIC(*chdr, COREMAGIC, MID_MACHINE, 0);
- chdr->c_hdrsize = ALIGN(sizeof(*chdr));
- chdr->c_seghdrsize = ALIGN(sizeof(cseg));
- chdr->c_cpusize = sizeof(md_core);
-
- /* Save integer registers. */
- error = process_read_regs(p, &md_core.intreg);
- if (error)
- return error;
-
- if (fputype) {
- /* Save floating point registers. */
- error = process_read_fpregs(p, &md_core.freg);
- if (error)
- return error;
- } else {
- /* Make sure these are clear. */
- bzero((caddr_t)&md_core.freg, sizeof(md_core.freg));
- }
-
- CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_MACHINE, CORE_CPU);
- cseg.c_addr = 0;
- cseg.c_size = chdr->c_cpusize;
-
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&cseg, chdr->c_seghdrsize,
- (off_t)chdr->c_hdrsize, UIO_SYSSPACE, IO_UNIT, cred, NULL, p);
- if (error)
- return error;
-
- error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&md_core, sizeof(md_core),
- (off_t)(chdr->c_hdrsize + chdr->c_seghdrsize), UIO_SYSSPACE,
- IO_UNIT, cred, NULL, p);
- if (error)
- return error;
-
- chdr->c_nseg++;
- return 0;
-}
-
-/*
- * Convert kernel VA to physical address
- */
-paddr_t
-kvtop(addr)
- vaddr_t addr;
-{
- paddr_t pa;
-
- if (pmap_extract(pmap_kernel(), addr, &pa) == FALSE)
- panic("kvtop: zero page frame");
-
- return (pa);
-}
-
-/*
- * Map an IO request into kernel virtual address space.
- *
- * XXX we allocate KVA space by using kmem_alloc_wait which we know
- * allocates space without backing physical memory. This implementation
- * is a total crock, the multiple mappings of these physical pages should
- * be reflected in the higher-level VM structures to avoid problems.
- */
-void
-vmapbuf(bp, siz)
- struct buf *bp;
- vsize_t siz;
-{
- int npf;
- caddr_t addr;
- struct proc *p;
- int off;
- vaddr_t kva;
- paddr_t pa;
-
-#ifdef DIAGNOSTIC
- if ((bp->b_flags & B_PHYS) == 0)
- panic("vmapbuf");
-#endif
-
- addr = bp->b_saveaddr = bp->b_data;
- off = (int)addr & PGOFSET;
- p = bp->b_proc;
- npf = atop(round_page(bp->b_bcount + off));
- kva = uvm_km_valloc_wait(phys_map, ptoa(npf));
- bp->b_data = (caddr_t)(kva + off);
- while (npf--) {
- if (pmap_extract(vm_map_pmap(&p->p_vmspace->vm_map),
- (vaddr_t)addr, &pa) == FALSE)
- panic("vmapbuf: null page frame");
- pmap_enter(vm_map_pmap(phys_map), kva, trunc_page(pa),
- VM_PROT_READ|VM_PROT_WRITE, VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED);
- addr += PAGE_SIZE;
- kva += PAGE_SIZE;
- }
- pmap_update(pmap_kernel());
-}
-
-/*
- * Free the io map PTEs associated with this IO operation.
- */
-void
-vunmapbuf(bp, siz)
- struct buf *bp;
- vsize_t siz;
-{
- caddr_t addr;
- int npf;
- vaddr_t kva;
-
-#ifdef DIAGNOSTIC
- if ((bp->b_flags & B_PHYS) == 0)
- panic("vunmapbuf");
-#endif
-
- addr = bp->b_data;
- npf = atop(round_page(bp->b_bcount + ((int)addr & PGOFSET)));
- kva = (vaddr_t)((int)addr & ~PGOFSET);
- pmap_remove(vm_map_pmap(phys_map), kva, kva + ptoa(npf));
- pmap_update(vm_map_pmap(phys_map));
- uvm_km_free_wakeup(phys_map, kva, ptoa(npf));
- bp->b_data = bp->b_saveaddr;
- bp->b_saveaddr = NULL;
-}
diff --git a/sys/arch/mvme68k/stand/Makefile b/sys/arch/mvme68k/stand/Makefile
deleted file mode 100644
index d27eb82fd6b..00000000000
--- a/sys/arch/mvme68k/stand/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-# $OpenBSD: Makefile,v 1.6 2000/05/25 21:55:03 deraadt Exp $
-
-.if ${MACHINE} == "mvme68k"
-SUBDIR= bugcrt libbug libsa libz sboot netboot bootxx bootsd bootst \
- prtvid wrtvid
-.endif
-
-SUBDIR+=installboot
-
-.include <bsd.subdir.mk>
diff --git a/sys/arch/mvme68k/stand/Makefile.inc b/sys/arch/mvme68k/stand/Makefile.inc
deleted file mode 100644
index c7df5f59d38..00000000000
--- a/sys/arch/mvme68k/stand/Makefile.inc
+++ /dev/null
@@ -1,13 +0,0 @@
-# $OpenBSD: Makefile.inc,v 1.11 2013/05/12 08:10:07 miod Exp $
-
-MDEC_DIR?=/usr/mdec
-CFLAGS+=-Wall -Werror -fno-stack-protector
-CFLAGS+=-fno-builtin-printf -fno-builtin-putchar -fno-builtin-vprintf
-CFLAGS+=-DHEAP_START=${HEAP_START}
-
-# Load addresses for first and second stage bootstraps
-STAGE1_RELOC= 0x00100000
-STAGE2_RELOC= 0x005f0000
-
-# Base of the heap (ethernet buffers will be allocated below it)
-HEAP_START= 0x00700000
diff --git a/sys/arch/mvme68k/stand/bootsd/Makefile b/sys/arch/mvme68k/stand/bootsd/Makefile
deleted file mode 100644
index 840b2feb0c1..00000000000
--- a/sys/arch/mvme68k/stand/bootsd/Makefile
+++ /dev/null
@@ -1,39 +0,0 @@
-# from: @(#)Makefile 8.1 (Berkeley) 6/10/93
-# $OpenBSD: Makefile,v 1.19 2013/02/02 13:36:06 miod Exp $
-
-STRIP?= strip
-
-S= ${.CURDIR}/../../../..
-DEFS=
-INCPATH=-I${.CURDIR} -I${.CURDIR}/../libsa -I${.CURDIR}/../libbug \
- -I${.CURDIR}/../../include -I${S} -I${S}/lib/libsa
-CFLAGS+=-O2 ${INCPATH} ${DEFS} ${COPTS}
-LDFLAGS=-N -T ${S}/arch/mvme68k/stand/ld.script -Ttext ${STAGE2_RELOC}
-NOPIE=
-CLEANFILES+=bootsd bootsd.strip
-
-.include "${S}/arch/mvme68k/stand/bugcrt/Makefile.inc"
-.include "${S}/arch/mvme68k/stand/libbug/Makefile.inc"
-.include "${S}/arch/mvme68k/stand/libsa/Makefile.inc"
-.include "${S}/arch/mvme68k/stand/libz/Makefile.inc"
-
-SRCS= boot.c conf.c version.c
-
-LIBS= ${LIBSA} ${LIBBUG} ${LIBZ}
-
-OBJS= ${SRCS:N*.h:R:S/$/.o/g}
-
-BOOTS= bootsd
-ALL= ${BOOTS}
-
-all: ${ALL}
-
-bootsd: ${BUGCRT} ${OBJS} ${LIBS}
- ${LD} ${LDFLAGS} -o $@ \
- ${BUGCRT} ${OBJS} ${LIBS} `${CC} -print-libgcc-file-name`
-
-install: bootsd
- ${STRIP} -I a.out-m68k-netbsd -o bootsd.strip bootsd
- install -c -m 555 -g bin -o bin bootsd.strip ${DESTDIR}${MDEC_DIR}/bootsd
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/mvme68k/stand/bootsd/README b/sys/arch/mvme68k/stand/bootsd/README
deleted file mode 100644
index 86d2b194056..00000000000
--- a/sys/arch/mvme68k/stand/bootsd/README
+++ /dev/null
@@ -1,7 +0,0 @@
-In short:
- cd /usr/mdec
- cp bootsd /
- ./installboot -v /bootsd ./bootxx /dev/rsd0c
-
- (you will need to be single user to run installboot since it writes
- to a raw disk device)
diff --git a/sys/arch/mvme68k/stand/bootsd/boot.c b/sys/arch/mvme68k/stand/bootsd/boot.c
deleted file mode 100644
index 47b8001803b..00000000000
--- a/sys/arch/mvme68k/stand/bootsd/boot.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/* $OpenBSD: boot.c,v 1.13 2014/02/20 20:34:27 miod Exp $ */
-/* $NetBSD: boot.c,v 1.2 1995/09/23 03:42:52 gwr Exp $ */
-
-/*-
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)boot.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-#include <sys/stat.h>
-#define _KERNEL
-#include <sys/fcntl.h>
-#undef _KERNEL
-
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-
-int loadrandom(const char *, char *, size_t);
-
-int debug;
-int errno;
-extern char *version;
-extern char rnddata[BOOTRANDOM_MAX];
-char line[80];
-
-int
-main()
-{
- char *cp, *file;
- int flag, ret;
- int ask = 0;
- int rnd_loaded = 0;
-
- printf(">> OpenBSD MVME%x bootsd [%s]\n", bugargs.cputyp, version);
-
- ret = parse_args(&file, &flag);
-
- for (;;) {
- if (ask) {
- printf("boot: ");
- gets(line);
- if (line[0]) {
- bugargs.arg_start = line;
- cp = line;
- while (cp < (line + sizeof(line) -1) && *cp)
- cp++;
- bugargs.arg_end = cp;
- ret = parse_args(&file, &flag);
- }
- }
- if (ret) {
- printf("boot: -q returning to MVME-Bug\n");
- break;
- }
-
- if (rnd_loaded == 0)
- rnd_loaded = loadrandom(BOOTRANDOM, rnddata,
- sizeof(rnddata));
-
- exec_mvme(file, flag);
- printf("boot: %s: %s\n", file, strerror(errno));
- ask = 1;
- }
- return(0);
-}
-
-int
-loadrandom(const char *name, char *buf, size_t buflen)
-{
- struct stat sb;
- int fd;
- int rc = 0;
-
- fd = open(name, O_RDONLY);
- if (fd == -1) {
- if (errno != EPERM)
- printf("cannot open %s: %s\n", name, strerror(errno));
- return 0;
- }
- if (fstat(fd, &sb) == -1 || sb.st_uid != 0 || !S_ISREG(sb.st_mode) ||
- (sb.st_mode & (S_IWOTH|S_IROTH)))
- goto fail;
- (void) read(fd, buf, buflen);
- rc = 1;
-fail:
- close(fd);
- return rc;
-}
diff --git a/sys/arch/mvme68k/stand/bootsd/conf.c b/sys/arch/mvme68k/stand/bootsd/conf.c
deleted file mode 100644
index f230b5e9552..00000000000
--- a/sys/arch/mvme68k/stand/bootsd/conf.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* $OpenBSD: conf.c,v 1.2 2001/07/04 08:06:53 niklas Exp $ */
-/* $NetBSD: conf.c,v 1.1.1.1 1995/06/01 20:38:08 gwr Exp $ */
-
-#include <sys/types.h>
-#include <machine/prom.h>
-
-#include <stand.h>
-#include <ufs.h>
-#include "libsa.h"
-
-struct fs_ops file_system[] = {
- { ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat },
-};
-int nfsys = sizeof(file_system)/sizeof(struct fs_ops);
-
-struct devsw devsw[] = {
- { "bugsc", bugscstrategy, bugscopen, bugscclose, bugscioctl },
-};
-int ndevs = (sizeof(devsw)/sizeof(devsw[0]));
-
-
diff --git a/sys/arch/mvme68k/stand/bootsd/version.c b/sys/arch/mvme68k/stand/bootsd/version.c
deleted file mode 100644
index 64b3aa03427..00000000000
--- a/sys/arch/mvme68k/stand/bootsd/version.c
+++ /dev/null
@@ -1,9 +0,0 @@
-/* $OpenBSD: version.c,v 1.11 2014/02/20 20:34:27 miod Exp $ */
-
-/*
- * 1.11 /etc/random.seed support
- * 1.10 lower load address and heap location by 1MB to fit 8MB boards
- * 1.9 kernel loaded with loadfile, a.out and ELF formats
- */
-
-char *version = "1.11";
diff --git a/sys/arch/mvme68k/stand/bootst/Makefile b/sys/arch/mvme68k/stand/bootst/Makefile
deleted file mode 100644
index d22e4335be7..00000000000
--- a/sys/arch/mvme68k/stand/bootst/Makefile
+++ /dev/null
@@ -1,43 +0,0 @@
-# from: @(#)Makefile 8.1 (Berkeley) 6/10/93
-# $OpenBSD: Makefile,v 1.16 2013/11/06 19:37:06 miod Exp $
-
-STRIP?= strip
-
-S= ${.CURDIR}/../../../..
-DEFS= -DSTANDALONE -DCOMPAT_NOLABEL
-INCPATH=-I${.CURDIR} -I${.CURDIR}/../libsa -I${.CURDIR}/../libbug \
- -I${.CURDIR}/../../include -I${S} -I${S}/lib/libsa
-CFLAGS+=-O2 ${INCPATH} ${DEFS} ${COPTS}
-LDFLAGS=-N -T ${S}/arch/mvme68k/stand/ld.script -Ttext ${STAGE2_RELOC}
-NOPIE=
-CLEANFILES+=stboot bootst bootst.bug bootst.strip
-
-.include "${S}/arch/mvme68k/stand/wrtvid/Makefile.inc"
-.include "${S}/arch/mvme68k/stand/bugcrt/Makefile.inc"
-.include "${S}/arch/mvme68k/stand/libbug/Makefile.inc"
-.include "${S}/arch/mvme68k/stand/libsa/Makefile.inc"
-.include "${S}/arch/mvme68k/stand/libz/Makefile.inc"
-
-SRCS= boot.c conf.c dev_tape.c rawfs.c version.c
-
-LIBS= ${LIBSA} ${LIBBUG} ${LIBZ}
-
-OBJS= ${SRCS:N*.h:R:S/$/.o/g}
-
-BOOTS= bootst stboot
-ALL= ${BOOTS}
-
-all: ${ALL}
-
-bootst.bug: ${BUGCRT} ${OBJS} ${LIBS}
- ${LD} ${LDFLAGS} -o $@ \
- ${BUGCRT} ${OBJS} ${LIBS} `${CC} -print-libgcc-file-name`
-
-bootst stboot: bootst.bug ${WRTVID}
- ${STRIP} -I a.out-m68k-netbsd -o bootst.strip bootst.bug
- ${WRTVID} bootst.strip
-
-install: bootst stboot
- install -c -m 555 -g bin -o bin ${BOOTS} ${DESTDIR}${MDEC_DIR}
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/mvme68k/stand/bootst/boot.c b/sys/arch/mvme68k/stand/bootst/boot.c
deleted file mode 100644
index 141cb1d3ecb..00000000000
--- a/sys/arch/mvme68k/stand/bootst/boot.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* $OpenBSD: boot.c,v 1.5 2013/04/14 19:05:19 miod Exp $ */
-/* $NetBSD: boot.c,v 1.2 1995/10/17 22:58:14 gwr Exp $ */
-
-/*-
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)boot.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-
-extern char *version;
-extern int errno;
-
-int
-main()
-{
- char line[80];
- char *filename;
- int bflag = 0;
-
- printf(">> OpenBSD MVME%x tapeboot [%s]\n", bugargs.cputyp, version);
-
- parse_args(&filename, &bflag);
- filename = "2"; /* override */
-
- if (bflag & RB_ASKNAME) {
- printf("tapeboot: segment? [%s] ", filename);
- gets(line);
- if (line[0])
- filename = line;
- }
-
- exec_mvme(filename, bflag | RB_NOSYM);
-
- printf("tapeboot: %s: %s\n", filename, strerror(errno));
- return(0);
-}
diff --git a/sys/arch/mvme68k/stand/bootst/conf.c b/sys/arch/mvme68k/stand/bootst/conf.c
deleted file mode 100644
index 0e1576c6822..00000000000
--- a/sys/arch/mvme68k/stand/bootst/conf.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/* $OpenBSD: conf.c,v 1.3 2012/12/31 21:35:32 miod Exp $ */
-/* $NetBSD: conf.c,v 1.2 1995/10/17 22:58:17 gwr Exp $ */
-
-#include <stand.h>
-#include <rawfs.h>
-#include <dev_tape.h>
-
-struct fs_ops file_system[] = {
- {
- rawfs_open, rawfs_close, rawfs_read,
- rawfs_write, rawfs_seek, rawfs_stat,
- },
-};
-int nfsys = sizeof(file_system) / sizeof(file_system[0]);
-
-struct devsw devsw[] = {
- { "tape", tape_strategy, tape_open, tape_close, tape_ioctl },
-};
-int ndevs = sizeof(devsw) / sizeof(devsw[0]);
diff --git a/sys/arch/mvme68k/stand/bootst/dev_tape.c b/sys/arch/mvme68k/stand/bootst/dev_tape.c
deleted file mode 100644
index 8f3e97c090c..00000000000
--- a/sys/arch/mvme68k/stand/bootst/dev_tape.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/* $OpenBSD: dev_tape.c,v 1.5 2012/12/31 21:35:32 miod Exp $ */
-/* $NetBSD: dev_tape.c,v 1.2 1995/10/17 22:58:20 gwr Exp $ */
-
-/*
- * Copyright (c) 1993 Paul Kranenburg
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Paul Kranenburg.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * This module implements a "raw device" interface suitable for
- * use by the stand-alone I/O library UFS file-system code, and
- * possibly for direct access (i.e. boot from tape).
- */
-
-#include <sys/types.h>
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-
-struct mvmeprom_dskio tape_ioreq;
-
-/*
- * This is a special version of devopen() for tape boot.
- * In this version, the file name is a numeric string of
- * one digit, which is passed to the device open so it
- * can open the appropriate tape segment.
- */
-int
-devopen(f, fname, file)
- struct open_file *f;
- const char *fname; /* normally "1" */
- char **file;
-{
- struct devsw *dp;
-
- *file = (char *)fname;
- dp = &devsw[0];
- f->f_dev = dp;
-
- /* The following will call tape_open() */
- return (dp->dv_open(f, fname));
-}
-
-int
-tape_open(f, fname)
- struct open_file *f;
- char *fname; /* partition number, i.e. "1" */
-{
- int part;
- struct mvmeprom_dskio *ti;
-
- /*
- * Set the tape segment number to the one indicated
- * by the single digit fname passed in above.
- */
- if ((fname[0] < '0') && (fname[0] > '9')) {
- return ENOENT;
- }
- part = fname[0] - '0';
-
- /*
- * Setup our part of the saioreq.
- * (determines what gets opened)
- */
- ti = &tape_ioreq;
- bzero((caddr_t)ti, sizeof(*ti));
-
- ti->ctrl_lun = bugargs.ctrl_lun;
- ti->dev_lun = bugargs.dev_lun;
- ti->status = 0;
- ti->pbuffer = NULL;
- ti->blk_num = part;
- ti->blk_cnt = 0;
- ti->flag = 0;
- ti->addr_mod = 0;
-
- f->f_devdata = ti;
-
- return (0);
-}
-
-int
-tape_close(f)
- struct open_file *f;
-{
- struct mvmeprom_dskio *ti;
-
-
- ti = f->f_devdata;
- f->f_devdata = NULL;
- return 0;
-}
-
-#define MVMEPROM_SCALE (512/MVMEPROM_BLOCK_SIZE)
-
-int
-tape_strategy(devdata, flag, dblk, size, buf, rsize)
- void *devdata;
- int flag;
- daddr32_t dblk;
- u_int size;
- char *buf;
- u_int *rsize;
-{
- struct mvmeprom_dskio *ti;
- int ret;
-
- ti = devdata;
-
- if (flag != F_READ)
- return(EROFS);
-
- ti->status = 0;
- ti->pbuffer = buf;
- /* don't change block #, set in open */
- ti->blk_cnt = size / (512 / MVMEPROM_SCALE);
-
- ret = mvmeprom_diskrd(ti);
-
- if (ret != 0)
- return (EIO);
-
- *rsize = (ti->blk_cnt / MVMEPROM_SCALE) * 512;
- ti->flag |= IGNORE_FILENUM; /* ignore next time */
-
- return (0);
-}
-
-int
-tape_ioctl()
-{
- return EIO;
-}
-
diff --git a/sys/arch/mvme68k/stand/bootst/dev_tape.h b/sys/arch/mvme68k/stand/bootst/dev_tape.h
deleted file mode 100644
index 6c3fc658be8..00000000000
--- a/sys/arch/mvme68k/stand/bootst/dev_tape.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $OpenBSD: dev_tape.h,v 1.4 2011/03/13 00:13:53 deraadt Exp $ */
-
-
-int tape_open(struct open_file *, ...);
-int tape_close(struct open_file *);
-int tape_strategy(void *, int, daddr32_t, size_t, void *, size_t *);
-int tape_ioctl();
-
diff --git a/sys/arch/mvme68k/stand/bootst/rawfs.c b/sys/arch/mvme68k/stand/bootst/rawfs.c
deleted file mode 100644
index c36928672ab..00000000000
--- a/sys/arch/mvme68k/stand/bootst/rawfs.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/* $OpenBSD: rawfs.c,v 1.7 2013/04/14 19:05:19 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Gordon W. Ross
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- * 4. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Gordon W. Ross
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Raw file system - for stream devices like tapes.
- * No random access, only sequential read allowed.
- * This exists only to allow upper level code to be
- * shielded from the fact that the device must be
- * read only with whole block position and size.
- */
-
-#include <sys/param.h>
-#include <stand.h>
-#include <rawfs.h>
-
-/*
- * Must be a multiple of MVMEPROM_BLOCK_SIZE, and at least as large as
- * Z_BUFSIZE from libsa cread.c to be able to correctly emulate forward
- * seek.
- */
-#define RAWFS_BSIZE 4096
-
-/*
- * In-core open file.
- */
-struct cfile {
- off_t fs_bufpos; /* file position of fs_buf */
- int fs_len; /* amount left in f_buf */
- char * fs_ptr; /* read pointer into f_buf */
- char fs_buf[RAWFS_BSIZE];
-};
-
-static int rawfs_get_block(struct open_file *);
-static off_t rawfs_get_pos(struct cfile *);
-
-int
-rawfs_open(char *path, struct open_file *f)
-{
- struct cfile *fs;
-
- /*
- * The actual PROM driver has already been opened.
- * Just allocate the I/O buffer, etc.
- */
- fs = alloc(sizeof(struct cfile));
- fs->fs_bufpos = 0;
- fs->fs_len = 0;
- fs->fs_ptr = NULL; /* nothing read yet */
-
- f->f_fsdata = fs;
- return (0);
-}
-
-int
-rawfs_close(struct open_file *f)
-{
- struct cfile *fs;
-
- fs = (struct cfile *) f->f_fsdata;
- f->f_fsdata = NULL;
-
- if (fs != NULL)
- free(fs, sizeof(*fs));
-
- return (0);
-}
-
-int
-rawfs_read(struct open_file *f, void *start, size_t size, size_t *resid)
-{
- struct cfile *fs = (struct cfile *)f->f_fsdata;
- char *addr = start;
- int error = 0;
- size_t csize;
-
- while (size != 0) {
- if (fs->fs_len == 0)
- if ((error = rawfs_get_block(f)) != 0)
- break;
-
- if (fs->fs_len <= 0)
- break; /* EOF */
-
- csize = size;
- if (csize > fs->fs_len)
- csize = fs->fs_len;
-
- bcopy(fs->fs_ptr, addr, csize);
- fs->fs_ptr += csize;
- fs->fs_len -= csize;
- addr += csize;
- size -= csize;
- }
- if (resid)
- *resid = size;
- return (error);
-}
-
-int
-rawfs_write(struct open_file *f, void *start, size_t size, size_t *resid)
-{
- return (EROFS);
-}
-
-off_t
-rawfs_seek(struct open_file *f, off_t offset, int where)
-{
- struct cfile *fs = (struct cfile *)f->f_fsdata;
- off_t oldpos, basepos;
- int error;
-
- oldpos = rawfs_get_pos(fs);
- switch (where) {
- case SEEK_SET:
- break;
- case SEEK_CUR:
- offset += oldpos;
- break;
- default:
- case SEEK_END:
- return -1;
- }
-
- basepos = (offset / RAWFS_BSIZE) * RAWFS_BSIZE;
- offset %= RAWFS_BSIZE;
-
- /* backward seek are not possible */
- if (basepos < fs->fs_bufpos) {
- errno = EIO;
- return -1;
- }
-
- if (basepos == fs->fs_bufpos) {
- /* if we seek before the first read... */
- if (fs->fs_ptr == NULL) {
- if ((error = rawfs_get_block(f)) != 0) {
- errno = error;
- return -1;
- }
- }
- /* rewind to start of the buffer */
- fs->fs_len += (fs->fs_ptr - fs->fs_buf);
- fs->fs_ptr = fs->fs_buf;
- } else {
- while (basepos != fs->fs_bufpos)
- if ((error = rawfs_get_block(f)) != 0) {
- errno = error;
- return -1;
- }
- }
- /* now move forward within the buffer */
- if (offset > fs->fs_len)
- offset = fs->fs_len; /* EOF */
- fs->fs_len -= offset;
- fs->fs_ptr += offset;
-
- return rawfs_get_pos(fs);
-}
-
-int
-rawfs_stat(struct open_file *f, struct stat *sb)
-{
- return (EFTYPE);
-}
-
-/*
- * Read a block from the underlying stream device
- * (In our case, a tape drive.)
- */
-static int
-rawfs_get_block(struct open_file *f)
-{
- struct cfile *fs;
- int error;
- size_t len;
- off_t readpos;
-
- fs = (struct cfile *)f->f_fsdata;
-
- twiddle();
- if (fs->fs_ptr != NULL)
- readpos = fs->fs_bufpos + RAWFS_BSIZE;
- else
- readpos = fs->fs_bufpos; /* first read */
- error = f->f_dev->dv_strategy(f->f_devdata, F_READ,
- readpos / DEV_BSIZE, RAWFS_BSIZE, fs->fs_buf, &len);
-
- if (error == 0) {
- fs->fs_ptr = fs->fs_buf;
- fs->fs_len = len;
- fs->fs_bufpos = readpos;
- }
-
- return (error);
-}
-
-static off_t
-rawfs_get_pos(struct cfile *fs)
-{
- return fs->fs_bufpos + (fs->fs_ptr - fs->fs_buf);
-}
diff --git a/sys/arch/mvme68k/stand/bootst/rawfs.h b/sys/arch/mvme68k/stand/bootst/rawfs.h
deleted file mode 100644
index 2929a9e1d45..00000000000
--- a/sys/arch/mvme68k/stand/bootst/rawfs.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* $OpenBSD: rawfs.h,v 1.4 2006/01/16 18:03:54 deraadt Exp $ */
-/* $NetBSD: rawfs.h,v 1.1 1995/10/17 22:58:29 gwr Exp $ */
-
-/*
- * Raw file system - for stream devices like tapes.
- * No random access, only sequential read allowed.
- */
-
-int rawfs_open(char *path, struct open_file *f);
-int rawfs_close(struct open_file *f);
-int rawfs_read(struct open_file *f, void *buf,
- size_t size, size_t *resid);
-int rawfs_write(struct open_file *f, void *buf,
- size_t size, size_t *resid);
-off_t rawfs_seek(struct open_file *f, off_t offset, int where);
-int rawfs_stat(struct open_file *f, struct stat *sb);
diff --git a/sys/arch/mvme68k/stand/bootst/version.c b/sys/arch/mvme68k/stand/bootst/version.c
deleted file mode 100644
index 157523fdb88..00000000000
--- a/sys/arch/mvme68k/stand/bootst/version.c
+++ /dev/null
@@ -1,9 +0,0 @@
-/* $OpenBSD: version.c,v 1.6 2013/05/12 08:10:07 miod Exp $ */
-
-/*
- * 1.6 lower load address and heap location by 1MB to fit 8MB boards
- * 1.5 do not load kernel symbols to avoid seeking backwards
- * 1.4 kernel loaded with loadfile, a.out and ELF formats
- */
-
-char *version = "1.6";
diff --git a/sys/arch/mvme68k/stand/bootxx/Makefile b/sys/arch/mvme68k/stand/bootxx/Makefile
deleted file mode 100644
index 4ef2cb01702..00000000000
--- a/sys/arch/mvme68k/stand/bootxx/Makefile
+++ /dev/null
@@ -1,37 +0,0 @@
-# from: @(#)Makefile 8.1 (Berkeley) 6/10/93
-# $OpenBSD: Makefile,v 1.11 2013/02/02 13:36:06 miod Exp $
-
-S= ${.CURDIR}/../../../..
-DEFS=-DSTAGE2_RELOC=${STAGE2_RELOC}
-INCPATH=-I${.CURDIR} -I${.CURDIR}/../libsa -I${.CURDIR}/../libbug \
- -I${.CURDIR}/../../include -I${S} -I${S}/lib/libsa
-CFLAGS+=-O2 ${INCPATH} ${DEFS} ${COPTS}
-LDFLAGS=-S -N -T ${S}/arch/mvme68k/stand/ld.script -Ttext ${STAGE1_RELOC} \
- -e __bootxx_start
-NOPIE=
-CLEANFILES+=bootxx
-
-.include "${S}/arch/mvme68k/stand/bugcrt/Makefile.inc"
-.include "${S}/arch/mvme68k/stand/libbug/Makefile.inc"
-.include "${S}/arch/mvme68k/stand/libsa/Makefile.inc"
-.include "${S}/arch/mvme68k/stand/libz/Makefile.inc"
-
-SRCS= bootxx.c conf.c
-
-LIBS= ${LIBSA} ${LIBBUG} ${LIBZ}
-
-OBJS= ${SRCS:N*.h:R:S/$/.o/g}
-
-BOOTS= bootxx
-ALL= ${BOOTS}
-
-all: ${ALL}
-
-bootxx: ${OBJS} ${BUGCRT} ${LIBS}
- ${LD} ${LDFLAGS} -o $@ \
- ${BUGCRT} ${OBJS} ${LIBS} `${CC} -print-libgcc-file-name`
-
-install:
- install -c -m 555 -g bin -o bin ${BOOTS} ${DESTDIR}${MDEC_DIR}
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/mvme68k/stand/bootxx/bootxx.c b/sys/arch/mvme68k/stand/bootxx/bootxx.c
deleted file mode 100644
index 3d694b03537..00000000000
--- a/sys/arch/mvme68k/stand/bootxx/bootxx.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/* $OpenBSD: bootxx.c,v 1.9 2012/12/31 21:35:32 miod Exp $ */
-/* $NetBSD: bootxx.c,v 1.5 1995/10/13 21:44:57 gwr Exp $ */
-
-/*
- * Copyright (c) 1994 Paul Kranenburg
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Paul Kranenburg.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * This is a generic "first-stage" boot program.
- *
- * Note that this program has absolutely no filesystem knowledge!
- *
- * Instead, this uses a table of disk block numbers that are
- * filled in by the installboot program such that this program
- * can load the "second-stage" boot program.
- */
-
-#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/exec.h>
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-#include "libbug.h"
-
-/*
- * Boot device is derived from ROM provided information.
- */
-
-/* This determines the largest boot program we can load. */
-#define MAXBLOCKNUM 64
-
-/*
- * These three names are known by installboot.
- * The block_table contains starting block numbers,
- * in terms of 512-byte blocks. Each non-zero value
- * will result in a read of block_size bytes.
- */
-size_t block_size = 512; /* default */
-int block_count = MAXBLOCKNUM; /* length of table */
-daddr32_t block_table[MAXBLOCKNUM] = { 0 };
-
-int copyboot(struct open_file *, char *);
-
-int
-main()
-{
- struct open_file f;
- char *addr;
- int error;
-
-#ifdef DEBUG
- printf("Boot: bug device: ctrl=%d, dev=%d\n",
- bugargs.ctrl_lun, bugargs.dev_lun);
-#endif
-
- f.f_flags = F_RAW;
- if (devopen(&f, 0, &addr)) {
- printf("bootxx: open failed\n");
- _rtt();
- }
-
- addr = (char *)STAGE2_RELOC;
- error = copyboot(&f, addr);
- f.f_dev->dv_close(&f);
- if (!error) {
- bugexec((u_int *)addr);
- }
- /* copyboot had a problem... */
- _rtt();
- return (0);
-}
-
-int
-copyboot(struct open_file *fp, char *addr)
-{
- size_t n;
- int i, blknum;
- struct exec *x;
-
- addr -= sizeof(struct exec); /* assume OMAGIC, verify below */
- x = (struct exec *)addr;
-
- if (!block_count) {
- printf("bootxx: no data!?!\n");
- return -1;
- }
-
- for (i = 0; i < block_count; i++) {
-
- if ((blknum = block_table[i]) == 0)
- break;
-
-#ifdef DEBUG
- printf("bootxx: read block # %d = %d\n", i, blknum);
-#endif
- if ((fp->f_dev->dv_strategy)(fp->f_devdata, F_READ,
- blknum, block_size, addr, &n)) {
- printf("bootxx: read failed\n");
- return -1;
- }
- if (n != block_size) {
- printf("bootxx: short read\n");
- return -1;
- }
- addr += block_size;
- }
-
- if (N_GETMAGIC(*x) != OMAGIC) {
- printf("bootxx: secondary bootstrap isn't in OMAGIC format\n");
- return(-1);
- }
-
- return 0;
-}
diff --git a/sys/arch/mvme68k/stand/bootxx/conf.c b/sys/arch/mvme68k/stand/bootxx/conf.c
deleted file mode 100644
index f16cad1905b..00000000000
--- a/sys/arch/mvme68k/stand/bootxx/conf.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/* $OpenBSD: conf.c,v 1.2 2001/07/04 08:06:55 niklas Exp $ */
-/* $NetBSD: conf.c,v 1.2 1995/10/13 21:45:00 gwr Exp $ */
-
-#include <sys/types.h>
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-
-struct devsw devsw[] = {
- { "bugsc", bugscstrategy, bugscopen, bugscclose, bugscioctl },
-};
-int ndevs = (sizeof(devsw)/sizeof(devsw[0]));
-
-int debug;
diff --git a/sys/arch/mvme68k/stand/bugcrt/Makefile b/sys/arch/mvme68k/stand/bugcrt/Makefile
deleted file mode 100644
index 9f301468010..00000000000
--- a/sys/arch/mvme68k/stand/bugcrt/Makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-# $OpenBSD: Makefile,v 1.10 2012/12/31 21:35:32 miod Exp $
-S=${.CURDIR}/../../../..
-CFLAGS=-I${.CURDIR}/../../include -I${.CURDIR}/../libbug -I${S}/lib/libsa \
- -fomit-frame-pointer
-AFLAGS+=-D_LOCORE
-NOPIE=
-
-OBJS=bugcrt.o bugcrtS.o
-
-all: ${OBJS}
-
-install:
-
-lint tags:
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/mvme68k/stand/bugcrt/Makefile.inc b/sys/arch/mvme68k/stand/bugcrt/Makefile.inc
deleted file mode 100644
index 1e55f97904d..00000000000
--- a/sys/arch/mvme68k/stand/bugcrt/Makefile.inc
+++ /dev/null
@@ -1,14 +0,0 @@
-# $OpenBSD: Makefile.inc,v 1.4 2012/12/31 21:35:32 miod Exp $
-
-BUG_CRT_DIR=${S}/arch/mvme68k/stand/bugcrt
-
-BUGCRT_DIR!= cd ${BUG_CRT_DIR}; \
- printf "xxx:\n\techo \$${.OBJDIR}\n" | ${MAKE} -r -s -f - xxx
-
-BUGCRT=${BUGCRT_DIR}/bugcrtS.o ${BUGCRT_DIR}/bugcrt.o
-
-$(BUGCRT): .NOTMAIN __always_make_bugcrt
- @echo making sure the bugcrt is up to date...
- @(cd ${BUG_CRT_DIR}; ${MAKE})
-
-__always_make_bugcrt: .NOTMAIN
diff --git a/sys/arch/mvme68k/stand/bugcrt/bugcrt.c b/sys/arch/mvme68k/stand/bugcrt/bugcrt.c
deleted file mode 100644
index 21d97b7fb14..00000000000
--- a/sys/arch/mvme68k/stand/bugcrt/bugcrt.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/* $OpenBSD: bugcrt.c,v 1.6 2012/12/31 21:35:32 miod Exp $ */
-
-/*
- * Copyright (c) 2012 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/types.h>
-#include <machine/prom.h>
-
-#include "libbug.h"
-#include "stand.h"
-
-struct mvmeprom_args bugargs = { .cputyp = -1 }; /* force out of .bss */
-
-void __main(void);
-extern void main(void);
-
-void
-bugcrt_start(u_int dev_lun, u_int ctrl_lun, u_int flags, u_int ctrl_addr,
- u_int entry, u_int conf_blk, char *arg_start, char *arg_end,
- char *nbarg_start, char *nbarg_end)
-{
- extern int edata, end;
- struct mvmeprom_brdid *id;
-
-#ifdef DEBUG
- printf("BUG parameters: CLUN %x DLUN %x flags %x ctrl_addr %x\n",
- dev_lun, ctrl_lun, flags, ctrl_addr);
- printf("entry %x conf_blk %x\n", entry, conf_blk);
- printf("arg %p %p\n", arg_start, arg_end);
- printf("nbarg %p %p\n", nbarg_start, nbarg_end);
-#endif
-
- bugargs.dev_lun = dev_lun;
- bugargs.ctrl_lun = ctrl_lun;
- bugargs.flags = flags;
- bugargs.ctrl_addr = ctrl_addr;
- bugargs.entry = entry;
- bugargs.conf_blk = conf_blk;
- bugargs.arg_start = arg_start;
- bugargs.arg_end = arg_end;
- bugargs.nbarg_start = nbarg_start;
- bugargs.nbarg_end = nbarg_end;
-
- bzero(&edata, (int)&end-(int)&edata);
- *bugargs.arg_end = 0;
- id = mvmeprom_getbrdid();
- bugargs.cputyp = id->model;
- main();
-}
-
-extern void bugexec_final(u_int, u_int, u_int, u_int, u_int, u_int, char *,
- char *, char *, char *, u_int, u_int);
-
-void
-bugexec(u_int *addr)
-{
-#ifdef DEBUG
- printf("%s: code %x stack %x\n", __func__, addr[1], addr[0]);
-#endif
- bugexec_final(bugargs.dev_lun, bugargs.ctrl_lun, bugargs.flags,
- bugargs.ctrl_addr, bugargs.entry, bugargs.conf_blk,
- bugargs.arg_start, bugargs.arg_end, bugargs.nbarg_start,
- bugargs.nbarg_end, addr[1] /* pc */, addr[0] /* sp */);
-}
-
-void
-__main()
-{
-}
diff --git a/sys/arch/mvme68k/stand/bugcrt/bugcrtS.S b/sys/arch/mvme68k/stand/bugcrt/bugcrtS.S
deleted file mode 100644
index 09cd41a69bc..00000000000
--- a/sys/arch/mvme68k/stand/bugcrt/bugcrtS.S
+++ /dev/null
@@ -1,95 +0,0 @@
-/* $OpenBSD: bugcrtS.S,v 1.2 2013/02/02 13:36:06 miod Exp $ */
-
-/*
- * Copyright (c) 2012 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <machine/asm.h>
-#include <machine/prom.h>
-
- .text
-
-GLOBAL(__bootxx_start)
-ASLOCAL(__stack_end)
- .long _ASM_LABEL(__stack_end) | sp
- .long _C_LABEL(__start) | pc
-
-ENTRY(__start)
- /*
- * On entry, d0-d1, d4, a0-a6 contain the BUG incoming parameters.
- */
- /*
- * Set up stack. This is already done if booted by the BUG, but not
- * if invoked from an old bootxx' bugexec().
- */
- leal _ASM_LABEL(__stack_end):l, %sp
-
- /*
- * Push arguments on stack.
- */
- movl MVMEPROM_REG_NBARGEND, %sp@-
- movl MVMEPROM_REG_NBARGSTART, %sp@-
- movl MVMEPROM_REG_ARGEND, %sp@-
- movl MVMEPROM_REG_ARGSTART, %sp@-
- movl MVMEPROM_REG_CONFBLK, %sp@-
- movl MVMEPROM_REG_ENTRY, %sp@-
- movl MVMEPROM_REG_CTRLADDR, %sp@-
- movl MVMEPROM_REG_FLAGS, %sp@-
- movl MVMEPROM_REG_CTRLLUN, %sp@-
- movl MVMEPROM_REG_DEVLUN, %sp@-
-
- /*
- * Invoke the rest of the startup as C code.
- */
- bsr _C_LABEL(bugcrt_start)
-
- bsr _C_LABEL(_rtt)
- /* NOTREACHED */
-
-ENTRY(bugexec_final)
- /*
- * Pop arguments to the appropriate registers.
- */
- movl %sp@(4 * 1), MVMEPROM_REG_DEVLUN
- movl %sp@(4 * 2), MVMEPROM_REG_CTRLLUN
- movl %sp@(4 * 3), MVMEPROM_REG_FLAGS
- movl %sp@(4 * 4), MVMEPROM_REG_CTRLADDR
- movl %sp@(4 * 5), MVMEPROM_REG_ENTRY
- movl %sp@(4 * 6), MVMEPROM_REG_CONFBLK
- movl %sp@(4 * 7), MVMEPROM_REG_ARGSTART
- movl %sp@(4 * 8), MVMEPROM_REG_ARGEND
- movl %sp@(4 * 9), MVMEPROM_REG_NBARGSTART
- movl %sp@(4 * 10), MVMEPROM_REG_NBARGEND
-
- /*
- * Pop return address
- */
- movl %sp@(4 * 11), %d2
-
- /*
- * Pop stack address
- */
- movl %sp@(4 * 12), %sp
-
- /*
- * Push return address
- */
- movl _ASM_LABEL(bugexec_returned), %sp@-
- movl %d2, %sp@-
- rts
-
-ASLOCAL(bugexec_returned)
- bsr _C_LABEL(_rtt)
- /* NOTREACHED */
diff --git a/sys/arch/mvme68k/stand/installboot/Makefile b/sys/arch/mvme68k/stand/installboot/Makefile
deleted file mode 100644
index 11b8ec7ff80..00000000000
--- a/sys/arch/mvme68k/stand/installboot/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-# $OpenBSD: Makefile,v 1.6 2014/02/07 10:13:00 miod Exp $
-
-MAN= installboot.8
-MANSUBDIR=mvme68k
-
-.if ${MACHINE} == "mvme68k"
-SRCS= installboot.c nlist.c
-PROG= installboot
-BINDIR=/usr/mdec
-DPADD=${LIBUTIL}
-LDADD=-lutil
-LDSTATIC=-static
-.else
-NOPROG=
-.endif
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/mvme68k/stand/installboot/installboot.8 b/sys/arch/mvme68k/stand/installboot/installboot.8
deleted file mode 100644
index ad09d9a185a..00000000000
--- a/sys/arch/mvme68k/stand/installboot/installboot.8
+++ /dev/null
@@ -1,82 +0,0 @@
-.\" $OpenBSD: installboot.8,v 1.18 2013/09/29 21:30:49 jmc Exp $
-.\"
-.\" Copyright (c) 1994 Paul Kranenburg
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by Paul Kranenburg.
-.\" 4. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.\"
-.Dd $Mdocdate: September 29 2013 $
-.Dt INSTALLBOOT 8 mvme68k
-.Os
-.Sh NAME
-.Nm installboot
-.Nd install a bootstrap on an FFS disk
-.Sh SYNOPSIS
-.Nm installboot
-.Op Fl nv
-.Ar boot
-.Ar bootxx
-.Ar rawdev
-.Sh DESCRIPTION
-.Nm installboot
-is used to install a "first-stage" boot program into the boot area
-of an FFS disk partition, and initialize the table of block numbers the
-.Ar bootxx
-program uses to load the second-stage boot program.
-.Pp
-The options are as follows:
-.Bl -tag -width flag
-.It Fl n
-Do not actually write anything on the disk.
-.It Fl v
-Be verbose, printing out the block numbers that
-.Ar bootxx
-will use to load
-.Ar boot .
-.El
-.Pp
-The arguments are:
-.Bl -tag -width bootxx
-.It Ar boot
-The name of the second-stage boot program in the file system
-where the first-stage boot program is to be installed.
-.It Ar bootxx
-The name of the prototype file for the first stage boot program.
-.It Ar rawdev
-The name of the raw device in which the first-stage boot program
-is to be installed.
-This should correspond to the block device on which the file system containing
-.Ar boot
-is mounted.
-.El
-.Sh EXAMPLES
-.Bd -literal
-# cp /usr/mdec/bootsd /boot
-# /usr/mdec/installboot /boot /usr/mdec/bootxx /dev/rsd0a
-.Ed
-.Sh SEE ALSO
-.Xr disklabel 8 ,
-.Xr init 8
diff --git a/sys/arch/mvme68k/stand/installboot/installboot.c b/sys/arch/mvme68k/stand/installboot/installboot.c
deleted file mode 100644
index 32bafbed74f..00000000000
--- a/sys/arch/mvme68k/stand/installboot/installboot.c
+++ /dev/null
@@ -1,464 +0,0 @@
-/* $OpenBSD: installboot.c,v 1.17 2013/09/29 21:30:49 jmc Exp $ */
-/* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */
-
-/*
- * Copyright (c) 1994 Paul Kranenburg
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Paul Kranenburg.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/mount.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-#include <sys/disklabel.h>
-#include <ufs/ufs/dinode.h>
-#include <ufs/ufs/dir.h>
-#include <ufs/ffs/fs.h>
-#include <err.h>
-#include <a.out.h>
-#include <fcntl.h>
-#include <nlist.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <util.h>
-
-int verbose, nowrite, hflag;
-char *boot, *proto, *dev;
-char cdev[80];
-
-struct nlist nl[] = {
-#define X_BLOCK_SIZE 0
- { { "_block_size" } },
-#define X_BLOCK_COUNT 1
- { { "_block_count" } },
-#define X_BLOCK_TABLE 2
- { { "_block_table" } },
- { { NULL } }
-};
-
-int *block_size_p; /* block size var. in prototype image */
-int *block_count_p; /* block count var. in prototype image */
-daddr32_t *block_table; /* block number array in prototype image */
-int maxblocknum; /* size of this array */
-
-
-char *loadprotoblocks(char *, long *);
-int loadblocknums(char *, int);
-static void devread(int, void *, daddr32_t, size_t, char *);
-static void usage(void);
-int main(int, char *[]);
-static void vid_to_disklabel(char *, char *);
-
-static void
-usage(void)
-{
- fprintf(stderr,
- "usage: installboot [-nv] boot bootxx rawdev\n");
- exit(1);
-}
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- int c, devfd;
- char *protostore;
- long protosize;
-
- while ((c = getopt(argc, argv, "vnh")) != -1) {
- switch (c) {
- case 'h':
- /* Don't strip a.out header */
- hflag = 1;
- break;
- case 'n':
- /* Do not actually write the bootblock to disk */
- nowrite = 1;
- break;
- case 'v':
- /* Chat */
- verbose = 1;
- break;
- default:
- usage();
- }
- }
-
- if (argc - optind < 3) {
- usage();
- }
-
- boot = argv[optind];
- proto = argv[optind + 1];
- dev = argv[optind + 2];
- strlcpy(cdev, dev, sizeof cdev);
- cdev[strlen(cdev)-1] = 'c';
-
- if (verbose) {
- printf("boot: %s\n", boot);
- printf("proto: %s\n", proto);
- printf("device: %s\n", dev);
- printf("cdevice: %s\n", cdev);
- }
-
- /* Insert VID into disklabel */
- vid_to_disklabel(cdev, proto);
-
- /* Load proto blocks into core */
- if ((protostore = loadprotoblocks(proto, &protosize)) == NULL)
- exit(1);
-
- /* XXX - Paranoia: Make sure size is aligned! */
- if (protosize & (DEV_BSIZE - 1))
- err(1, "proto bootblock bad size=%ld", protosize);
-
- /* Open and check raw disk device */
- if ((devfd = open(dev, O_RDONLY, 0)) < 0)
- err(1, "open: %s", dev);
-
- /* Extract and load block numbers */
- if (loadblocknums(boot, devfd) != 0)
- exit(1);
-
- (void)close(devfd);
-
- if (nowrite)
- return 0;
-
- /* Write patched proto bootblocks into the superblock */
- if (protosize > SBSIZE - DEV_BSIZE)
- errx(1, "proto bootblocks too big");
-
- if ((devfd = open(cdev, O_RDWR, 0)) < 0)
- err(1, "open: %s", dev);
-
- if (lseek(devfd, DEV_BSIZE, SEEK_SET) != DEV_BSIZE)
- err(1, "lseek bootstrap");
-
- /* Sync filesystems (to clean in-memory superblock?) */
- sync();
-
- if (write(devfd, protostore, protosize) != protosize)
- err(1, "write bootstrap");
- (void)close(devfd);
- return 0;
-}
-
-char *
-loadprotoblocks(fname, size)
- char *fname;
- long *size;
-{
- int fd;
- size_t tdsize; /* text+data size */
- size_t bbsize; /* boot block size (block aligned) */
- char *bp;
- struct nlist *nlp;
- struct exec eh;
- long off;
-
- fd = -1;
- bp = NULL;
-
- /* Locate block number array in proto file */
- if (nlist(fname, nl) != 0) {
- warnx("nlist: %s: symbols not found", fname);
- return NULL;
- }
- /* Validate symbol types (global data). */
- for (nlp = nl; nlp->n_un.n_name; nlp++) {
- if (nlp->n_type != (N_DATA | N_EXT)) {
- warnx("nlist: %s: wrong type", nlp->n_un.n_name);
- return NULL;
- }
- }
-
- if ((fd = open(fname, O_RDONLY)) < 0) {
- warn("open: %s", fname);
- return NULL;
- }
- if (read(fd, &eh, sizeof(eh)) != sizeof(eh)) {
- warn("read: %s", fname);
- goto bad;
- }
- if (N_GETMAGIC(eh) != OMAGIC) {
- warn("bad magic: 0x%x", eh.a_midmag);
- goto bad;
- }
- /*
- * We have to include the exec header in the beginning of
- * the buffer, and leave extra space at the end in case
- * the actual write to disk wants to skip the header.
- */
- tdsize = eh.a_text + eh.a_data;
- bbsize = tdsize + sizeof(eh);
- bbsize = roundup(bbsize, DEV_BSIZE);
-
- /*
- * Allocate extra space here because the caller may copy
- * the boot block starting at the end of the exec header.
- * This prevents reading beyond the end of the buffer.
- */
- if ((bp = calloc(bbsize + sizeof(eh), 1)) == NULL) {
- warnx("malloc: %s: no memory", fname);
- goto bad;
- }
- /* Copy the exec header and read the rest of the file. */
- memcpy(bp, &eh, sizeof(eh));
- if (read(fd, bp+sizeof(eh), tdsize) != tdsize) {
- warn("read: %s", fname);
- goto bad;
- }
-
- *size = bbsize; /* aligned to DEV_BSIZE */
-
- /* Calculate the symbols' locations within the proto file */
- off = N_DATOFF(eh) - N_DATADDR(eh) - (eh.a_entry - N_TXTADDR(eh));
- block_size_p = (int *) (bp + nl[X_BLOCK_SIZE ].n_value + off);
- block_count_p = (int *) (bp + nl[X_BLOCK_COUNT].n_value + off);
- block_table = (daddr32_t *) (bp + nl[X_BLOCK_TABLE].n_value + off);
- maxblocknum = *block_count_p;
-
- if (verbose) {
- printf("%s: entry point %#x\n", fname, eh.a_entry);
- printf("proto bootblock size %ld\n", *size);
- printf("room for %d filesystem blocks at %#lx\n",
- maxblocknum, nl[X_BLOCK_TABLE].n_value);
- }
-
- close(fd);
- if (!hflag)
- bp += sizeof(struct exec);
- return bp;
-
- bad:
- if (bp)
- free(bp);
- if (fd >= 0)
- close(fd);
- return NULL;
-}
-
-static void
-devread(int fd, void *buf, daddr32_t blk, size_t size, char *msg)
-{
- if (lseek(fd, dbtob(blk), SEEK_SET) != dbtob(blk))
- err(1, "%s: devread: lseek", msg);
-
- if (read(fd, buf, size) != size)
- err(1, "%s: devread: read", msg);
-}
-
-static char sblock[SBSIZE];
-
-int
-loadblocknums(char *boot, int devfd)
-{
- int i, fd;
- struct stat statbuf;
- struct statfs statfsbuf;
- struct fs *fs;
- char *buf;
- daddr32_t blk, *ap;
- struct ufs1_dinode *ip;
- int ndb;
-
- /*
- * Open 2nd-level boot program and record the block numbers
- * it occupies on the filesystem represented by `devfd'.
- */
-
- /* Make sure the (probably new) boot file is on disk. */
- sync(); sleep(1);
-
- if ((fd = open(boot, O_RDONLY)) < 0)
- err(1, "open: %s", boot);
-
- if (fstatfs(fd, &statfsbuf) != 0)
- err(1, "statfs: %s", boot);
-
- if (strncmp(statfsbuf.f_fstypename, "ffs", MFSNAMELEN) &&
- strncmp(statfsbuf.f_fstypename, "ufs", MFSNAMELEN) ) {
- errx(1, "%s: must be on an FFS filesystem", boot);
- }
-
- if (fsync(fd) != 0)
- err(1, "fsync: %s", boot);
-
- if (fstat(fd, &statbuf) != 0)
- err(1, "fstat: %s", boot);
-
- close(fd);
-
- /* Read superblock */
- devread(devfd, sblock, SBLOCK, SBSIZE, "superblock");
- fs = (struct fs *)sblock;
-
- /* Sanity-check super-block. */
-
- if (fs->fs_magic != FS_MAGIC)
- errx(1, "Bad magic number in superblock");
-
- if (fs->fs_inopb <= 0)
- err(1, "Bad inopb=%d in superblock", fs->fs_inopb);
-
- /* Read inode */
- if ((buf = malloc(fs->fs_bsize)) == NULL)
- errx(1, "No memory for filesystem block");
-
- blk = fsbtodb(fs, ino_to_fsba(fs, statbuf.st_ino));
- devread(devfd, buf, blk, fs->fs_bsize, "inode");
- ip = (struct ufs1_dinode *)(buf) + ino_to_fsbo(fs, statbuf.st_ino);
-
- /*
- * Have the inode. Figure out how many blocks we need.
- */
- ndb = howmany(ip->di_size, fs->fs_bsize);
- if (ndb > maxblocknum)
- errx(1, "Too many blocks");
- *block_count_p = ndb;
- *block_size_p = fs->fs_bsize;
- if (verbose)
- printf("Will load %d blocks of size %d each.\n",
- ndb, fs->fs_bsize);
-
- /*
- * Get the block numbers; we don't handle fragments
- */
- ap = ip->di_db;
- for (i = 0; i < NDADDR && *ap && ndb; i++, ap++, ndb--) {
- blk = fsbtodb(fs, *ap);
- if (verbose)
- printf("%d: %d\n", i, blk);
- block_table[i] = blk;
- }
- if (ndb == 0)
- return 0;
-
- /*
- * Just one level of indirections; there isn't much room
- * for more in the 1st-level bootblocks anyway.
- */
- blk = fsbtodb(fs, ip->di_ib[0]);
- devread(devfd, buf, blk, fs->fs_bsize, "indirect block");
- ap = (daddr32_t *)buf;
- for (; i < NINDIR(fs) && *ap && ndb; i++, ap++, ndb--) {
- blk = fsbtodb(fs, *ap);
- if (verbose)
- printf("%d: %d\n", i, blk);
- block_table[i] = blk;
- }
-
- return 0;
-}
-
-static void
-vid_to_disklabel(char *dkname, char *bootproto)
-{
- char *specname;
- int exe_file, f;
- struct mvmedisklabel *pcpul;
- struct stat sb;
- unsigned int exe_addr;
-
- pcpul = (struct mvmedisklabel *)malloc(sizeof(struct mvmedisklabel));
- bzero(pcpul, sizeof(struct mvmedisklabel));
-
- if (verbose)
- printf("modifying vid.\n");
-
- exe_file = open(bootproto, O_RDONLY, 0444);
- if (exe_file == -1) {
- perror(bootproto);
- exit(2);
- }
-
- f = opendev(dkname, O_RDWR, OPENDEV_PART, &specname);
-
- if (lseek(f, 0, SEEK_SET) < 0 ||
- read(f, pcpul, sizeof(struct mvmedisklabel)) !=
- sizeof(struct mvmedisklabel))
- err(4, "%s", specname);
-
-
- pcpul->version = 1;
- strncpy(pcpul->vid_id, "M68K", 4);
-
- if (fstat(exe_file, &sb) == -1)
- err(1, "fstat: %s", bootproto);
- if (sb.st_size < 0x20)
- errx(1, "%s is too small", bootproto);
-
- /* size in 256 byte blocks round up after a.out header removed */
-
- pcpul->vid_oss = 2;
- pcpul->vid_osl = (((sb.st_size -0x20) +511) / 512) *2;
-
- lseek(exe_file, 0x14, SEEK_SET);
- read(exe_file, &exe_addr, 4);
-
- /* check this, it may not work in both endian. */
- /* No, it doesn't. Use a big endian machine for now. SPM */
-
- {
- union {
- struct s {
- unsigned short s1;
- unsigned short s2;
- } s;
- unsigned long l;
- } a;
- a.l = exe_addr;
- pcpul->vid_osa_u = a.s.s1;
- pcpul->vid_osa_l = a.s.s2;
-
- }
- pcpul->vid_cas = 1;
- pcpul->vid_cal = 1;
-
- /* do not want to write past end of structure, not null terminated */
-
- strncpy(pcpul->vid_mot, "MOTOROLA", 8);
-
- pcpul->cfg_rec = 0x100;
- pcpul->cfg_psm = 0x200;
-
- if (!nowrite) {
- if (lseek(f, 0, SEEK_SET) < 0 ||
- write(f, pcpul, sizeof(struct mvmedisklabel)) <
- sizeof(struct mvmedisklabel))
- err(4, "%s", specname);
- }
- free(pcpul);
-
- close(exe_file);
- close(f);
-}
diff --git a/sys/arch/mvme68k/stand/installboot/nlist.c b/sys/arch/mvme68k/stand/installboot/nlist.c
deleted file mode 100644
index 2b403232b70..00000000000
--- a/sys/arch/mvme68k/stand/installboot/nlist.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/* $OpenBSD: nlist.c,v 1.1 2014/02/07 10:13:00 miod Exp $ */
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <a.out.h> /* pulls in nlist.h */
-
-#define ISLAST(p) (p->n_un.n_name == 0 || p->n_un.n_name[0] == 0)
-
-int
-__aout_fdnlist(int fd, struct nlist *list)
-{
- struct nlist *p, *s;
- char *strtab;
- off_t symoff, stroff;
- u_long symsize;
- int nent, cc;
- int strsize, usemalloc = 0;
- struct nlist nbuf[1024];
- struct exec exec;
-
- if (pread(fd, &exec, sizeof(exec), (off_t)0) != sizeof(exec) ||
- N_BADMAG(exec) || exec.a_syms == 0)
- return (-1);
-
- stroff = N_STROFF(exec);
- symoff = N_SYMOFF(exec);
- symsize = exec.a_syms;
-
- /* Read in the size of the string table. */
- if (pread(fd, (void *)&strsize, sizeof(strsize), stroff) !=
- sizeof(strsize))
- return (-1);
- else
- stroff += sizeof(strsize);
-
- /*
- * Read in the string table. We try mmap, but that will fail
- * for /dev/ksyms so fall back on malloc. Since OpenBSD's malloc(3)
- * returns memory to the system on free this does not cause bloat.
- */
- strsize -= sizeof(strsize);
- strtab = mmap(NULL, (size_t)strsize, PROT_READ, MAP_SHARED|MAP_FILE,
- fd, stroff);
- if (strtab == MAP_FAILED) {
- usemalloc = 1;
- if ((strtab = (char *)malloc(strsize)) == NULL)
- return (-1);
- errno = EIO;
- if (pread(fd, strtab, strsize, stroff) != strsize) {
- nent = -1;
- goto aout_done;
- }
- }
-
- /*
- * clean out any left-over information for all valid entries.
- * Type and value defined to be 0 if not found; historical
- * versions cleared other and desc as well. Also figure out
- * the largest string length so don't read any more of the
- * string table than we have to.
- *
- * XXX clearing anything other than n_type and n_value violates
- * the semantics given in the man page.
- */
- nent = 0;
- for (p = list; !ISLAST(p); ++p) {
- p->n_type = 0;
- p->n_other = 0;
- p->n_desc = 0;
- p->n_value = 0;
- ++nent;
- }
-
- while (symsize > 0) {
- cc = MIN(symsize, sizeof(nbuf));
- if (pread(fd, nbuf, cc, symoff) != cc)
- break;
- symsize -= cc;
- symoff += cc;
- for (s = nbuf; cc > 0; ++s, cc -= sizeof(*s)) {
- char *sname = strtab + s->n_un.n_strx - sizeof(int);
-
- if (s->n_un.n_strx == 0 || (s->n_type & N_STAB) != 0)
- continue;
- for (p = list; !ISLAST(p); p++) {
- char *pname = p->n_un.n_name;
-
- if (*sname != '_' && *pname == '_')
- pname++;
- if (!strcmp(sname, pname)) {
- p->n_value = s->n_value;
- p->n_type = s->n_type;
- p->n_desc = s->n_desc;
- p->n_other = s->n_other;
- if (--nent <= 0)
- break;
- }
- }
- }
- }
-aout_done:
- if (usemalloc)
- free(strtab);
- else
- munmap(strtab, strsize);
- return (nent);
-}
-
-int
-nlist(const char *name, struct nlist *list)
-{
- int fd, n;
-
- fd = open(name, O_RDONLY, 0);
- if (fd < 0)
- return (-1);
- n = __aout_fdnlist(fd, list);
- (void)close(fd);
- return (n);
-}
diff --git a/sys/arch/mvme68k/stand/ld.script b/sys/arch/mvme68k/stand/ld.script
deleted file mode 100644
index 2e309cc4541..00000000000
--- a/sys/arch/mvme68k/stand/ld.script
+++ /dev/null
@@ -1,45 +0,0 @@
-/* $OpenBSD: ld.script,v 1.2 2013/02/10 20:27:18 miod Exp $ */
-
-/*
- * Copyright (c) 2012 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-OUTPUT_FORMAT("a.out-m68k-netbsd")
-OUTPUT_ARCH(m68k)
-ENTRY(__start)
-SECTIONS
-{
- .text :
- {
- *(.text)
- *(.rodata*)
- PROVIDE(etext = .);
- }
- .data :
- {
- *(.data)
- PROVIDE(edata = .);
- }
- .bss :
- {
- *(.bss)
- }
- PROVIDE(end = .);
- /DISCARD/ :
- {
- *(.debug*)
- *(.eh_frame)
- }
-}
diff --git a/sys/arch/mvme68k/stand/libbug/Makefile b/sys/arch/mvme68k/stand/libbug/Makefile
deleted file mode 100644
index 7a7bfcf411a..00000000000
--- a/sys/arch/mvme68k/stand/libbug/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-# $OpenBSD: Makefile,v 1.6 2012/08/21 14:46:19 pascal Exp $
-
-LIB=bug
-
-NOPIC=
-NOPROFILE=
-NOPIE=
-
-S=${.CURDIR}/../../../..
-DIR_SA=$S/lib/libsa
-
-CFLAGS+=-I${.CURDIR}/../../include -I${DIR_SA}
-
-SRCS= delay.c diskrd.c diskwr.c getbrdid.c inchr.c instat.c outln.c \
- outstr.c putchar.c return.c rtc_rd.c
-
-install:
-
-.include <bsd.lib.mk>
diff --git a/sys/arch/mvme68k/stand/libbug/Makefile.inc b/sys/arch/mvme68k/stand/libbug/Makefile.inc
deleted file mode 100644
index 879ba4bd431..00000000000
--- a/sys/arch/mvme68k/stand/libbug/Makefile.inc
+++ /dev/null
@@ -1,14 +0,0 @@
-# $OpenBSD: Makefile.inc,v 1.3 1997/10/20 00:33:46 deraadt Exp $
-
-LIB_BUG_DIR=${S}/arch/mvme68k/stand/libbug
-
-LIBBUG_DIR!= cd ${LIB_BUG_DIR}; \
- printf "xxx:\n\techo \$${.OBJDIR}\n" | ${MAKE} -r -s -f - xxx
-
-LIBBUG=${LIBBUG_DIR}/libbug.a
-
-$(LIBBUG): .NOTMAIN __always_make_libbug
- @echo making sure the libbug is up to date...
- @(cd ${LIB_BUG_DIR}; ${MAKE})
-
-__always_make_libbug: .NOTMAIN
diff --git a/sys/arch/mvme68k/stand/libbug/delay.c b/sys/arch/mvme68k/stand/libbug/delay.c
deleted file mode 100644
index f230d1409e3..00000000000
--- a/sys/arch/mvme68k/stand/libbug/delay.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/* $OpenBSD: delay.c,v 1.2 1996/05/16 02:25:41 chuck Exp $ */
-
-/*
- * bug routines -- assumes that the necessary sections of memory
- * are preserved.
- */
-#include <sys/types.h>
-#include <machine/prom.h>
-
-#include "libbug.h"
-
-/* BUG - timing routine */
-void
-mvmeprom_delay(msec)
- int msec;
-{
- MVMEPROM_ARG1(msec);
- MVMEPROM_CALL(MVMEPROM_DELAY);
-}
diff --git a/sys/arch/mvme68k/stand/libbug/diskrd.c b/sys/arch/mvme68k/stand/libbug/diskrd.c
deleted file mode 100644
index 76a859fe7ac..00000000000
--- a/sys/arch/mvme68k/stand/libbug/diskrd.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* $OpenBSD: diskrd.c,v 1.2 1996/05/16 02:25:40 chuck Exp $ */
-
-/*
- * bug routines -- assumes that the necessary sections of memory
- * are preserved.
- */
-#include <sys/types.h>
-#include <machine/prom.h>
-
-#include "libbug.h"
-
-/* returns 0: success, nonzero: error */
-int
-mvmeprom_diskrd(arg)
- struct mvmeprom_dskio *arg;
-{
- int ret;
-
- MVMEPROM_ARG1(arg);
- MVMEPROM_CALL(MVMEPROM_DSKRD);
- MVMEPROM_STATRET(ret);
-}
diff --git a/sys/arch/mvme68k/stand/libbug/diskwr.c b/sys/arch/mvme68k/stand/libbug/diskwr.c
deleted file mode 100644
index b4ecf66ca3b..00000000000
--- a/sys/arch/mvme68k/stand/libbug/diskwr.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* $OpenBSD: diskwr.c,v 1.2 1996/05/16 02:25:41 chuck Exp $ */
-
-/*
- * bug routines -- assumes that the necessary sections of memory
- * are preserved.
- */
-#include <sys/types.h>
-#include <machine/prom.h>
-
-#include "libbug.h"
-
-/* returns 0: success, nonzero: error */
-int
-mvmeprom_diskwr(arg)
- struct mvmeprom_dskio *arg;
-{
- int ret;
-
- MVMEPROM_ARG1(arg);
- MVMEPROM_CALL(MVMEPROM_DSKWR);
- MVMEPROM_STATRET(ret);
-}
diff --git a/sys/arch/mvme68k/stand/libbug/getbrdid.c b/sys/arch/mvme68k/stand/libbug/getbrdid.c
deleted file mode 100644
index db4c49c719e..00000000000
--- a/sys/arch/mvme68k/stand/libbug/getbrdid.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* $OpenBSD: getbrdid.c,v 1.2 1996/05/16 02:25:40 chuck Exp $ */
-
-/*
- * bug routines -- assumes that the necessary sections of memory
- * are preserved.
- */
-#include <sys/types.h>
-#include <machine/prom.h>
-
-#include "libbug.h"
-
-/* BUG - query board routines */
-struct mvmeprom_brdid *
-mvmeprom_getbrdid()
-{
- struct mvmeprom_brdid *id;
-
- MVMEPROM_NOARG();
- MVMEPROM_CALL(MVMEPROM_GETBRDID);
- MVMEPROM_RETURN(id);
-}
diff --git a/sys/arch/mvme68k/stand/libbug/inchr.c b/sys/arch/mvme68k/stand/libbug/inchr.c
deleted file mode 100644
index a2e691c89c1..00000000000
--- a/sys/arch/mvme68k/stand/libbug/inchr.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* $OpenBSD: inchr.c,v 1.1 1996/05/16 02:25:38 chuck Exp $ */
-
-/*
- * bug routines -- assumes that the necessary sections of memory
- * are preserved.
- */
-#include <sys/types.h>
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libbug.h"
-
-/* returns 0 if no characters ready to read */
-int
-getchar()
-{
- int ret;
-
- MVMEPROM_NOARG();
- MVMEPROM_CALL(MVMEPROM_INCHR);
- MVMEPROM_RETURN_BYTE(ret);
-}
diff --git a/sys/arch/mvme68k/stand/libbug/instat.c b/sys/arch/mvme68k/stand/libbug/instat.c
deleted file mode 100644
index 23b70a7446a..00000000000
--- a/sys/arch/mvme68k/stand/libbug/instat.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* $OpenBSD: instat.c,v 1.2 1996/05/16 02:25:42 chuck Exp $ */
-
-/*
- * bug routines -- assumes that the necessary sections of memory
- * are preserved.
- */
-#include <sys/types.h>
-#include <machine/prom.h>
-
-#include "libbug.h"
-
-/* returns 0 if no characters ready to read */
-int
-peekchar()
-{
- int ret;
-
- MVMEPROM_NOARG();
- MVMEPROM_CALL(MVMEPROM_INSTAT);
- MVMEPROM_STATRET(ret);
-}
diff --git a/sys/arch/mvme68k/stand/libbug/libbug.h b/sys/arch/mvme68k/stand/libbug/libbug.h
deleted file mode 100644
index 87f9c802e5f..00000000000
--- a/sys/arch/mvme68k/stand/libbug/libbug.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* $OpenBSD: libbug.h,v 1.5 2012/12/31 21:35:32 miod Exp $ */
-
-/*
- * prototypes and such. note that get/put char are in stand.h
- */
-
-
-void mvmeprom_delay(int);
-int mvmeprom_diskrd(struct mvmeprom_dskio *);
-int mvmeprom_diskwr(struct mvmeprom_dskio *);
-struct mvmeprom_brdid *mvmeprom_getbrdid(void);
-int peekchar(void);
-void mvmeprom_outln(char *, char *);
-void mvmeprom_outstr(char *, char *);
-void mvmeprom_rtc_rd(struct mvmeprom_time *);
-
-/*
- * bugcrt stuff
- */
-
-extern struct mvmeprom_args bugargs;
-
-void bugexec(u_int *);
diff --git a/sys/arch/mvme68k/stand/libbug/outln.c b/sys/arch/mvme68k/stand/libbug/outln.c
deleted file mode 100644
index 7db0a1f6583..00000000000
--- a/sys/arch/mvme68k/stand/libbug/outln.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/* $OpenBSD: outln.c,v 1.2 1996/05/16 02:25:40 chuck Exp $ */
-
-/*
- * bug routines -- assumes that the necessary sections of memory
- * are preserved.
- */
-#include <sys/types.h>
-#include <machine/prom.h>
-
-#include "libbug.h"
-
-void
-mvmeprom_outln(start, end)
- char *start, *end;
-{
- MVMEPROM_ARG1(end);
- MVMEPROM_ARG2(start);
- MVMEPROM_CALL(MVMEPROM_OUTSTRCRLF);
-}
diff --git a/sys/arch/mvme68k/stand/libbug/outstr.c b/sys/arch/mvme68k/stand/libbug/outstr.c
deleted file mode 100644
index 534f4aedaa5..00000000000
--- a/sys/arch/mvme68k/stand/libbug/outstr.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/* $OpenBSD: outstr.c,v 1.2 1996/05/16 02:25:42 chuck Exp $ */
-
-/*
- * bug routines -- assumes that the necessary sections of memory
- * are preserved.
- */
-#include <sys/types.h>
-#include <machine/prom.h>
-
-#include "libbug.h"
-
-void
-mvmeprom_outstr(start, end)
- char *start, *end;
-{
- MVMEPROM_ARG1(end);
- MVMEPROM_ARG2(start);
- MVMEPROM_CALL(MVMEPROM_OUTSTR);
-}
diff --git a/sys/arch/mvme68k/stand/libbug/putchar.c b/sys/arch/mvme68k/stand/libbug/putchar.c
deleted file mode 100644
index 892bd964691..00000000000
--- a/sys/arch/mvme68k/stand/libbug/putchar.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* $OpenBSD: putchar.c,v 1.1 1996/05/16 02:25:39 chuck Exp $ */
-
-/*
- * putchar: easier to do this with outstr than to add more macros to
- * handle byte passing on the stack
- */
-
-#include <sys/types.h>
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libbug.h"
-
-void
-putchar(c)
-
-int c;
-
-{
- char ca[2];
- if (c == '\n')
- putchar('\r');
- ca[0] = c;
- mvmeprom_outstr(&ca[0], &ca[1]);
-}
diff --git a/sys/arch/mvme68k/stand/libbug/return.c b/sys/arch/mvme68k/stand/libbug/return.c
deleted file mode 100644
index 808555f8568..00000000000
--- a/sys/arch/mvme68k/stand/libbug/return.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* $OpenBSD: return.c,v 1.2 1996/05/16 02:25:41 chuck Exp $ */
-
-/*
- * bug routines -- assumes that the necessary sections of memory
- * are preserved.
- */
-#include <sys/types.h>
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libbug.h"
-
-/* BUG - return to bug routine */
-__dead void
-_rtt()
-{
- MVMEPROM_CALL(MVMEPROM_EXIT);
- printf("_rtt: exit failed. spinning...");
- while (1) ;
- /*NOTREACHED*/
-}
diff --git a/sys/arch/mvme68k/stand/libbug/rtc_rd.c b/sys/arch/mvme68k/stand/libbug/rtc_rd.c
deleted file mode 100644
index e6be8c6c5d2..00000000000
--- a/sys/arch/mvme68k/stand/libbug/rtc_rd.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/* $OpenBSD: rtc_rd.c,v 1.2 1996/05/16 02:25:43 chuck Exp $ */
-
-/*
- * bug routines -- assumes that the necessary sections of memory
- * are preserved.
- */
-#include <sys/types.h>
-#include <machine/prom.h>
-
-#include "libbug.h"
-
-void
-mvmeprom_rtc_rd(ptime)
- struct mvmeprom_time *ptime;
-{
- MVMEPROM_ARG1(ptime);
- MVMEPROM_CALL(MVMEPROM_RTC_RD);
-}
diff --git a/sys/arch/mvme68k/stand/libsa/Makefile b/sys/arch/mvme68k/stand/libsa/Makefile
deleted file mode 100644
index 3bcbb664c9b..00000000000
--- a/sys/arch/mvme68k/stand/libsa/Makefile
+++ /dev/null
@@ -1,43 +0,0 @@
-# $OpenBSD: Makefile,v 1.23 2012/12/31 21:35:32 miod Exp $
-
-LIB=sa
-
-CLEANFILES+=SRT0.o
-
-NOPIC=nopic
-NOPROFILE=noprofile
-NOPIE=
-
-# Logically src/sys
-S=${.CURDIR}/../../../..
-
-SRCS+= bugdev.c clock.c parse_args.c exec_mvme.c
-
-.PATH: ${S}/lib/libsa
-SRCS+= alloc.c memcpy.c exit.c getfile.c gets.c globals.c \
- printf.c strerror.c memset.c memcmp.c strncpy.c strcmp.c strlen.c \
- strlcpy.c strlcat.c snprintf.c \
- close.c closeall.c dev.c dkcksum.c \
- lseek.c open.c nullfs.c read.c fstat.c \
- ufs.c cread.c
-SRCS+= arp.c ether.c in_cksum.c net.c netif.c rpc.c nfs.c \
- rarp.c bootparam.c
-SRCS+= loadfile.c
-
-.PATH: ${S}/lib/libkern
-SRCS+= ashrdi3.c muldi3.c
-
-# DBG= -DDEBUG -DNETIF_DEBUG -DNFS_DEBUG -DRPC_DEBUG \
-# -DNET_DEBUG -DRARP_DEBUG -DETHER_DEBUG
-
-#DEFS= -DCOMPAT_UFS
-DEFS= -D__INTERNAL_LIBSA_CREAD -D_STANDALONE
-#DEFS+=-DNETIF_DEBUG
-INCL= -I${.CURDIR} -I${.CURDIR}/../libbug -I${S}/lib/libsa -I${S}
-CFLAGS+= ${XCFLAGS} -O2 ${COPTS} ${DEFS} ${DBG} ${INCL}
-
-all: libsa.a SRT0.o
-
-install:
-
-.include <bsd.lib.mk>
diff --git a/sys/arch/mvme68k/stand/libsa/Makefile.inc b/sys/arch/mvme68k/stand/libsa/Makefile.inc
deleted file mode 100644
index c0a60387cfc..00000000000
--- a/sys/arch/mvme68k/stand/libsa/Makefile.inc
+++ /dev/null
@@ -1,15 +0,0 @@
-# $OpenBSD: Makefile.inc,v 1.6 2003/08/16 17:46:57 deraadt Exp $
-
-LIB_SA_DIR=${S}/arch/mvme68k/stand/libsa
-
-LIBSA_DIR!= cd ${LIB_SA_DIR}; \
- printf "xxx:\n\techo \$${.OBJDIR}\n" | ${MAKE} -r -s -f - xxx
-
-LIBSA=${LIBSA_DIR}/libsa.a
-SRTOBJ?= ${LIBSA_DIR}/SRT0.o
-
-$(LIBSA): .NOTMAIN __always_make_libsa
- @echo making sure the libsa is up to date...
- @(cd ${LIB_SA_DIR}; ${MAKE} "XCFLAGS=${CFLAGS}")
-
-__always_make_libsa: .NOTMAIN
diff --git a/sys/arch/mvme68k/stand/libsa/SRT0.S b/sys/arch/mvme68k/stand/libsa/SRT0.S
deleted file mode 100644
index 647e9df67a1..00000000000
--- a/sys/arch/mvme68k/stand/libsa/SRT0.S
+++ /dev/null
@@ -1,77 +0,0 @@
-| $OpenBSD: SRT0.S,v 1.8 2013/02/02 13:36:06 miod Exp $
-| $NetBSD: SRT0.S,v 1.2 1995/08/12 18:38:55 gwr Exp $
-
-| Copyright (c) 1995 Gordon W. Ross
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions
-| are met:
-| 1. Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| 2. Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| 3. The name of the author may not be used to endorse or promote products
-| derived from this software without specific prior written permission.
-| 4. All advertising materials mentioning features or use of this software
-| must display the following acknowledgement:
-| This product includes software developed by Gordon Ross
-|
-| THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-| IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-| OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-| IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-| INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-| NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-| THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-| this is a pre-startup wrapper for bugcrt which relocates the
-| code to the correct place before exec()ing.
-
-| SRT0.S - Stand-alone Run-Time startup code, part 0
- .file "SRT0.S"
- .text
- .globl __estack
-__estack:
- .globl xstart
-xstart:
-| first, relocate code to correct place without touching critical regs
-| (args are in: d0, d1, d4, a0, a1, a2, a3, a4, a5, a6)
-| [a3 and a4 only when netbooting]
- movl %a3, %d3 | SAVE a3 in d3
- movl %a4, %d5 | SAVE a4 in d5
- lea %pc@(xstart:w), %a3 | a3 = current addr (could be anywhere)
- lea xstart:l, %a4 | a4 = desired location (LINKADDR)
- cmpl %a3, %a4 | already there?
- beqs restart | short-circuit out
-
- | Relocate the code and data
- movl #edata,%d2 | Desired end of program
- subl %a4,%d2 | Calculate length, round up.
- lsrl #2,%d2
-Lcp:
- movl %a3@+, %a4@+
- dbra %d2, Lcp
-
-| Force a long jump to the relocated code (not pc-relative)
- lea restart:l, %a3
- jmp %a3@
-
-restart:
-| now in the relocated code
-
-| Set up stack (just before relocated text)
- lea __estack:l, %a3
- movl %a3, %sp
-
-| now that we have relocated, call the bugcrt (note we skip over the special
-| bug header which has a PC and SP in it)
- movl %d3, %a3 | RESTORE a3
- movl %d5, %a4 | RESTORE a4
- jmp __start
-
-| The end.
diff --git a/sys/arch/mvme68k/stand/libsa/bugdev.c b/sys/arch/mvme68k/stand/libsa/bugdev.c
deleted file mode 100644
index fc9bb95fc11..00000000000
--- a/sys/arch/mvme68k/stand/libsa/bugdev.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/* $OpenBSD: bugdev.c,v 1.9 2013/11/05 00:51:58 krw Exp $ */
-
-/*
- * Copyright (c) 1993 Paul Kranenburg
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Paul Kranenburg.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/disklabel.h>
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-
-void cputobsdlabel(struct disklabel *lp, struct mvmedisklabel *clp);
-
-int errno;
-
-struct bugsc_softc {
- int fd; /* Prom file descriptor */
- int poff; /* Partition offset */
- int psize; /* Partition size */
- short ctrl;
- short dev;
-} bugsc_softc[1];
-
-int
-devopen(struct open_file *f, const char *fname, char **file)
-{
- register struct bugsc_softc *pp = &bugsc_softc[0];
- size_t i;
- int error, pn = 0;
- char *dev, *cp;
- static char iobuf[MAXBSIZE];
- struct disklabel sdlabel;
-
- dev = bugargs.arg_start;
-
- /*
- * Extract partition # from boot device string.
- */
- for (cp = dev; *cp; cp++) /* void */;
- while (*cp != '/' && cp > dev) {
- if (*cp == ':')
- pn = *(cp+1) - 'a';
- --cp;
- }
-
- pp->fd = bugscopen(f);
-
- if (pp->fd < 0) {
- printf("Can't open device `%s'\n", dev);
- return (ENXIO);
- }
- error = bugscstrategy(pp, F_READ, LABELSECTOR, DEV_BSIZE, iobuf, &i);
- if (error)
- return (error);
- if (i != DEV_BSIZE)
- return (EINVAL);
-
- cputobsdlabel(&sdlabel, (struct mvmedisklabel *)iobuf);
- pp->poff = sdlabel.d_partitions[pn].p_offset;
- pp->psize = sdlabel.d_partitions[pn].p_size;
-
- f->f_dev = devsw;
- f->f_devdata = (void *)pp;
- *file = (char *)fname;
- return (0);
-}
-
-/* silly block scale factor */
-#define BUG_BLOCK_SIZE 256
-#define BUG_SCALE (512/BUG_BLOCK_SIZE)
-
-int
-bugscstrategy(void *devdata, int func, daddr32_t dblk, size_t size, void *buf,
- size_t *rsize)
-{
- struct mvmeprom_dskio dio;
- register struct bugsc_softc *pp = (struct bugsc_softc *)devdata;
- daddr32_t blk = dblk + pp->poff;
-
- twiddle();
-
- dio.ctrl_lun = pp->ctrl;
- dio.dev_lun = pp->dev;
- dio.status = 0;
- dio.pbuffer = buf;
- dio.blk_num = blk * BUG_SCALE;
- dio.blk_cnt = size / BUG_BLOCK_SIZE; /* assumed size in bytes */
- dio.flag = 0;
- dio.addr_mod = 0;
-#ifdef DEBUG
- printf("bugscstrategy: size=%d blk=%d buf=%x\n", size, blk, buf);
- printf("ctrl %d dev %d\n", dio.ctrl_lun, dio.dev_lun);
-#endif
- mvmeprom_diskrd(&dio);
-
- *rsize = dio.blk_cnt * BUG_BLOCK_SIZE;
-#ifdef DEBUG
- printf("rsize %d status %x\n", *rsize, dio.status);
-#endif
-
- if (dio.status)
- return (EIO);
- return (0);
-}
-
-int
-bugscopen(struct open_file *f, ...)
-{
-#ifdef DEBUG
- printf("bugscopen:\n");
-#endif
-
- f->f_devdata = (void *)bugsc_softc;
- bugsc_softc[0].ctrl = (short)bugargs.ctrl_lun;
- bugsc_softc[0].dev = (short)bugargs.dev_lun;
-#ifdef DEBUG
- printf("using mvmebug ctrl %d dev %d\n",
- bugsc_softc[0].ctrl, bugsc_softc[0].dev);
-#endif
- return (0);
-}
-
-int
-bugscclose(struct open_file *f)
-{
- return (EIO);
-}
-
-int
-bugscioctl(struct open_file *f, u_long cmd, void *data)
-{
- return (EIO);
-}
-
-void
-cputobsdlabel(struct disklabel *lp, struct mvmedisklabel *clp)
-{
- int i;
-
- lp->d_magic = clp->magic1;
- lp->d_type = clp->type;
- lp->d_subtype = clp->subtype;
- bcopy(clp->vid_vd, lp->d_typename, 16);
- bcopy(clp->packname, lp->d_packname, 16);
- lp->d_secsize = clp->cfg_psm;
- lp->d_nsectors = clp->cfg_spt;
- lp->d_ncylinders = clp->cfg_trk; /* trk is really num of cyl! */
- lp->d_ntracks = clp->cfg_hds;
-
- lp->d_secpercyl = clp->secpercyl;
- DL_SETDSIZE(lp, clp->secperunit);
- lp->d_acylinders = clp->acylinders;
- lp->d_flags = clp->flags;
- for (i = 0; i < NDDATA; i++)
- lp->d_drivedata[i] = clp->drivedata[i];
- for (i = 0; i < NSPARE; i++)
- lp->d_spare[i] = clp->spare[i];
- lp->d_magic2 = clp->magic2;
- lp->d_checksum = clp->checksum;
- lp->d_npartitions = clp->partitions;
- lp->d_bbsize = clp->bbsize;
- lp->d_sbsize = clp->sbsize;
- bcopy(clp->vid_4, &(lp->d_partitions[0]),sizeof (struct partition) * 4);
- bcopy(clp->cfg_4, &(lp->d_partitions[4]), sizeof (struct partition) *
- ((MAXPARTITIONS < 16) ? (MAXPARTITIONS - 4) : 12));
-}
diff --git a/sys/arch/mvme68k/stand/libsa/clock.c b/sys/arch/mvme68k/stand/libsa/clock.c
deleted file mode 100644
index cc9720d517e..00000000000
--- a/sys/arch/mvme68k/stand/libsa/clock.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* $OpenBSD: clock.c,v 1.5 2012/12/31 21:35:32 miod Exp $ */
-
-#include <sys/types.h>
-#include <sys/time.h>
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-
-#define LEAPYEAR(y) (((y) & 3) == 0)
-#define YEAR0 68
-
-
-/*
- * This code is defunct after 2068.
- * Will Unix still be here then??
- */
-const short dayyr[12] =
- {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
-
-static u_long
-chiptotime(int sec, int min, int hour, int day, int mon, int year)
-{
- register int days, yr;
-
- sec = FROMBCD(sec);
- min = FROMBCD(min);
- hour = FROMBCD(hour);
- day = FROMBCD(day);
- mon = FROMBCD(mon);
- year = FROMBCD(year) + YEAR0;
- if (year < 70)
- year = 70;
-
- /* simple sanity checks */
- if (year < 70 || mon < 1 || mon > 12 || day < 1 || day > 31)
- return (0);
- days = 0;
- for (yr = 70; yr < year; yr++)
- days += LEAPYEAR(yr) ? 366 : 365;
- days += dayyr[mon - 1] + day - 1;
- if (LEAPYEAR(yr) && mon > 2)
- days++;
- /* now have days since Jan 1, 1970; the rest is easy... */
- return (days * SECDAY + hour * 3600 + min * 60 + sec);
-}
-
-time_t
-getsecs(void)
-{
- struct mvmeprom_time m;
-
- mvmeprom_rtc_rd(&m);
- return (chiptotime(m.sec_BCD, m.min_BCD, m.hour_BCD, m.day_BCD,
- m.month_BCD, m.year_BCD));
-}
diff --git a/sys/arch/mvme68k/stand/libsa/exec_mvme.c b/sys/arch/mvme68k/stand/libsa/exec_mvme.c
deleted file mode 100644
index c2202970ba1..00000000000
--- a/sys/arch/mvme68k/stand/libsa/exec_mvme.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/* $OpenBSD: exec_mvme.c,v 1.11 2014/02/20 20:34:27 miod Exp $ */
-
-
-/*-
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)boot.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-
-#include <lib/libsa/loadfile.h>
-
-char rnddata[BOOTRANDOM_MAX]; /* set by bootsd only */
-
-/*ARGSUSED*/
-void
-exec_mvme(file, flag)
- char *file;
- int flag;
-{
- u_long marks[MARK_MAX];
- int options;
- int rc;
- void (*entry)(int, int, int, int, int, int);
- struct mvmeprom_brdid *id;
-
- id = mvmeprom_getbrdid();
- options = LOAD_KERNEL | COUNT_KERNEL;
- if ((flag & RB_NOSYM) != 0)
- options &= ~(LOAD_SYM | COUNT_SYM);
-
- marks[MARK_START] = 0;
- rc = loadfile(file, marks, options);
- if (rc != 0)
- return;
-
- printf("Start @ 0x%lx\n", marks[MARK_START]);
- printf("Controller Address 0x%x\n", bugargs.ctrl_addr);
- if (flag & RB_HALT)
- _rtt();
-
- entry = (void(*)(int, int, int, int, int, int))marks[MARK_START];
- (*entry)(flag, bugargs.ctrl_addr, bugargs.ctrl_lun, bugargs.dev_lun,
- 0 /* bootpart */, marks[MARK_END]);
-
- printf("exec: kernel returned!\n");
- return;
-}
diff --git a/sys/arch/mvme68k/stand/libsa/libsa.h b/sys/arch/mvme68k/stand/libsa/libsa.h
deleted file mode 100644
index 226e0e95db2..00000000000
--- a/sys/arch/mvme68k/stand/libsa/libsa.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* $OpenBSD: libsa.h,v 1.8 2012/12/31 21:35:32 miod Exp $ */
-
-/*
- * libsa prototypes
- */
-
-#include "libbug.h"
-
-/* bugdev.c */
-int bugscopen(struct open_file *, ...);
-int bugscclose(struct open_file *);
-int bugscioctl(struct open_file *, u_long, void *);
-int bugscstrategy(void *, int, daddr32_t, size_t, void *, size_t *);
-
-/* exec_mvme.c */
-void exec_mvme(char *, int);
-
-/* parse_args.c */
-int parse_args(char **, int *);
-
diff --git a/sys/arch/mvme68k/stand/libsa/parse_args.c b/sys/arch/mvme68k/stand/libsa/parse_args.c
deleted file mode 100644
index d88d5332df5..00000000000
--- a/sys/arch/mvme68k/stand/libsa/parse_args.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/* $OpenBSD: parse_args.c,v 1.8 2012/12/31 21:35:32 miod Exp $ */
-
-/*-
- * Copyright (c) 1995 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-#include <machine/prom.h>
-#include <a.out.h>
-
-#include "stand.h"
-#include "libsa.h"
-
-#define KERNEL_NAME "bsd"
-
-struct flags {
- char c;
- short bit;
-} bf[] = {
- { 'a', RB_ASKNAME },
- { 'b', RB_HALT },
- { 'c', RB_CONFIG },
- { 'd', RB_KDB },
- { 'm', RB_MINIROOT },
- { 's', RB_SINGLE },
- { 'y', RB_NOSYM }
-};
-
-int
-parse_args(filep, flagp)
-
-char **filep;
-int *flagp;
-
-{
- char *name = KERNEL_NAME, *ptr;
- int i, howto = 0;
- char c;
-
- if (bugargs.arg_start != bugargs.arg_end) {
- ptr = bugargs.arg_start;
- while ((c = *ptr) != '\0') {
- while (c == ' ')
- c = *++ptr;
- if (c == '\0')
- return (0);
- if (c != '-') {
- name = ptr;
- while ((c = *++ptr) && c != ' ')
- ;
- if (c)
- *ptr++ = 0;
- continue;
- }
- while ((c = *++ptr) && c != ' ') {
- if (c == 'q')
- return (1);
- for (i = 0; i < sizeof(bf)/sizeof(bf[0]); i++)
- if (bf[i].c == c) {
- howto |= bf[i].bit;
- }
- }
- }
- }
- *flagp = howto;
- *filep = name;
- return (0);
-}
diff --git a/sys/arch/mvme68k/stand/libz/Makefile b/sys/arch/mvme68k/stand/libz/Makefile
deleted file mode 100644
index 58559723b2a..00000000000
--- a/sys/arch/mvme68k/stand/libz/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2012/08/21 14:46:19 pascal Exp $
-
-S=${.CURDIR}/../../../..
-ZDST=${.OBJDIR}
-NOPIE=
-
-.PATH: ${S}/lib/libz
-
-.include "${S}/lib/libz/Makefile"
diff --git a/sys/arch/mvme68k/stand/libz/Makefile.inc b/sys/arch/mvme68k/stand/libz/Makefile.inc
deleted file mode 100644
index d58ceece6bd..00000000000
--- a/sys/arch/mvme68k/stand/libz/Makefile.inc
+++ /dev/null
@@ -1,14 +0,0 @@
-# $OpenBSD: Makefile.inc,v 1.2 1997/10/20 00:33:47 deraadt Exp $
-
-LIB_Z_DIR=${S}/arch/mvme68k/stand/libz
-
-LIBZ_DIR!= cd ${LIB_Z_DIR}; \
- printf "xxx:\n\techo \$${.OBJDIR}\n" | ${MAKE} -r -s -f - xxx
-
-LIBZ=${LIBZ_DIR}/libz.a
-
-$(LIBZ): .NOTMAIN __always_make_libz
- @echo making sure the libz is up to date...
- @(cd ${LIB_Z_DIR}; ${MAKE} "XCFLAGS=${CFLAGS}")
-
-__always_make_libz: .NOTMAIN
diff --git a/sys/arch/mvme68k/stand/netboot/Makefile b/sys/arch/mvme68k/stand/netboot/Makefile
deleted file mode 100644
index 1d09db10553..00000000000
--- a/sys/arch/mvme68k/stand/netboot/Makefile
+++ /dev/null
@@ -1,40 +0,0 @@
-# $OpenBSD: Makefile,v 1.18 2013/02/02 13:36:06 miod Exp $
-
-SIZE?= size
-STRIP?= strip
-
-S= ${.CURDIR}/../../../..
-DEFS= -DSUN_BOOTPARAMS
-#-DNETIF_DEBUG
-INCPATH=-I${.CURDIR} -I${.CURDIR}/../libsa -I${.CURDIR}/../libbug \
- -I${S} -I${S}/lib/libsa
-CFLAGS+=-O2 ${DEFS} ${INCPATH} ${COPTS}
-CLEANFILES+=netboot netboot.bin netboot.strip
-
-.include "${S}/arch/mvme68k/stand/bugcrt/Makefile.inc"
-.include "${S}/arch/mvme68k/stand/libbug/Makefile.inc"
-.include "${S}/arch/mvme68k/stand/libsa/Makefile.inc"
-.include "${S}/arch/mvme68k/stand/libz/Makefile.inc"
-
-SRCS= boot.c conf.c version.c devopen.c dev_net.c
-SRCS+= if_ie.c if_le.c
-OBJS= ${SRCS:S/.c/.o/g}
-LIBS= ${LIBSA} ${LIBBUG} ${LIBZ}
-LDFLAGS+=-N -T ${S}/arch/mvme68k/stand/ld.script -Ttext ${STAGE2_RELOC}
-NOPIE=
-
-all: netboot.bin
-
-netboot: ${SRTOBJ} ${BUGCRT} ${OBJS} ${LIBS}
- ${LD} ${LDFLAGS} -o $@ \
- ${SRTOBJ} ${BUGCRT} ${OBJS} ${LIBS} `${CC} -print-libgcc-file-name`
-
-netboot.bin: netboot
- ${STRIP} -I a.out-m68k-netbsd -o netboot.strip netboot
- dd ibs=32 skip=1 if=netboot.strip of=$@
-
-install:
- ${INSTALL} ${INSTALL_COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
- netboot.bin ${DESTDIR}${MDEC_DIR}/netboot
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/mvme68k/stand/netboot/boot.c b/sys/arch/mvme68k/stand/netboot/boot.c
deleted file mode 100644
index d29740b1fc7..00000000000
--- a/sys/arch/mvme68k/stand/netboot/boot.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/* $OpenBSD: boot.c,v 1.11 2012/12/31 21:35:32 miod Exp $ */
-
-/*-
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)boot.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-
-extern char *version;
-char line[80];
-
-int
-main()
-{
- char *cp, *file;
- int ask = 0, howto, ret;
-
- printf(">> OpenBSD MVME%x netboot [%s]\n", bugargs.cputyp, version);
-
- /* cycle in the correct args */
- bugargs.arg_start = bugargs.nbarg_start;
- bugargs.arg_end = bugargs.nbarg_end;
- *bugargs.arg_end = 0; /* ensure */
-
- ret = parse_args(&file, &howto);
-
- for (;;) {
- if (ask) {
- printf("boot: ");
- gets(line);
- if (line[0]) {
- bugargs.arg_start = line;
- cp = line;
- while (cp < (line + sizeof(line) - 1) && *cp)
- cp++;
- bugargs.arg_end = cp;
- ret =parse_args(&file, &howto);
- }
- }
- if (ret) {
- printf("boot: -q returning to MVME-Bug\n");
- break;
- }
- exec_mvme(file, howto);
- printf("boot: %s: %s\n", file, strerror(errno));
- ask = 1;
- }
- _rtt();
- return (0);
-}
diff --git a/sys/arch/mvme68k/stand/netboot/conf.c b/sys/arch/mvme68k/stand/netboot/conf.c
deleted file mode 100644
index 28f8b2b3073..00000000000
--- a/sys/arch/mvme68k/stand/netboot/conf.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* $OpenBSD: conf.c,v 1.6 2012/12/31 21:35:32 miod Exp $ */
-
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-
-#include <stand.h>
-#include <nfs.h>
-#include <dev_net.h>
-
-struct fs_ops file_system[] = {
- { nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat },
-};
-int nfsys = sizeof(file_system) / sizeof(file_system[0]);
-
-struct devsw devsw[] = {
- { "net", net_strategy, net_open, net_close, net_ioctl },
-};
-int ndevs = sizeof(devsw) / sizeof(devsw[0]);
-
-extern struct netif_driver le_driver;
-extern struct netif_driver ie_driver;
-
-struct netif_driver *netif_drivers[] = {
- &le_driver,
- &ie_driver,
-};
-int n_netif_drivers = sizeof(netif_drivers) / sizeof(netif_drivers[0]);
-
-
-/* XXX */
-int netif_debug;
-int debug;
-int errno;
diff --git a/sys/arch/mvme68k/stand/netboot/config.h b/sys/arch/mvme68k/stand/netboot/config.h
deleted file mode 100644
index 227306e7442..00000000000
--- a/sys/arch/mvme68k/stand/netboot/config.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* $OpenBSD: config.h,v 1.2 2003/06/04 04:11:37 deraadt Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* configuration information for base-line code */
-
-#define ETHER_ADDR_147 (0xfffe0778)
-#define ETHER_ADDR_16X (0xfffc0000+7980)
-#define ERAM_ADDR (0xfffe0774)
-#define LANCE_REG_ADDR (0xfffe1800)
-#define INTEL_REG_ADDR (0xfff46000)
-
-#define CPU_147 0x147
-#define CPU_162 0x162
-#define CPU_167 0x167
-#define CPU_172 0x172
-#define CPU_177 0x177
-
-struct brdid {
- u_long eye_catcher;
- u_char rev;
- u_char month;
- u_char day;
- u_char year;
- u_short size;
- u_short rsv1;
- u_short model;
- u_short suffix;
- u_short options;
- u_char family;
- u_char cpu;
- u_short ctrlun;
- u_short devlun;
- u_short devtype;
- u_short devnum;
- u_long bug;
-};
diff --git a/sys/arch/mvme68k/stand/netboot/dev_net.c b/sys/arch/mvme68k/stand/netboot/dev_net.c
deleted file mode 100644
index 9528515f4d2..00000000000
--- a/sys/arch/mvme68k/stand/netboot/dev_net.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/* $OpenBSD: dev_net.c,v 1.11 2013/02/02 13:36:06 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Gordon W. Ross
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- * 4. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Gordon W. Ross
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * This module implements a "raw device" interface suitable for
- * use by the stand-alone I/O library NFS code. This interface
- * does not support any "block" access, and exists only for the
- * purpose of initializing the network interface, getting boot
- * parameters, and performing the NFS mount.
- *
- * At open time, this does:
- *
- * find interface - netif_open()
- * RARP for IP address - rarp_getipaddress()
- * RPC/bootparams - callrpc(d, RPC_BOOTPARAMS, ...)
- * RPC/mountd - nfs_mount(sock, ip, path)
- *
- * the root file handle from mountd is saved in a global
- * for use by the NFS open code (NFS/lookup).
- */
-
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-#include <netinet/in_systm.h>
-
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-#include "net.h"
-#include "netif.h"
-#include "config.h"
-#include "bootparam.h"
-#include "nfs.h"
-
-extern int nfs_root_node[]; /* XXX - get from nfs_mount() */
-
-struct in_addr myip, rootip, gateip, mask;
-
-int netdev_sock = -1;
-static int open_count;
-
-int net_mountroot(struct open_file *, char *);
-
-/*
- * Called by devopen after it sets f->f_dev to our devsw entry.
- * This opens the low-level device and sets f->f_devdata.
- */
-int
-net_open(struct open_file *f, char *devname)
-{
- int error = 0;
-
- /* On first open, do netif open, mount, etc. */
- if (open_count == 0) {
- /* Find network interface. */
- if ((netdev_sock = netif_open(devname)) < 0)
- return (error=ENXIO);
- if ((error = net_mountroot(f, devname)) != 0)
- return (error);
- }
- open_count++;
- f->f_devdata = nfs_root_node;
- return (error);
-}
-
-int
-net_close(struct open_file *f)
-{
- /* On last close, do netif close, etc. */
- if (open_count > 0)
- if (--open_count == 0)
- netif_close(netdev_sock);
- f->f_devdata = NULL;
- return (0);
-}
-
-int
-net_ioctl(struct open_file *f, u_long cmd, void *data)
-{
- return EIO;
-}
-
-int
-net_strategy(void *devdata, int rw, daddr32_t blk, size_t size, void *buf,
- size_t *rsize)
-{
- return EIO;
-}
-
-
-int
-net_mountroot(struct open_file *f, char *devname)
-{
- int error;
-
-#ifdef DEBUG
- printf("net_mountroot: %s\n", devname);
-#endif
-
- /*
- * Get info for NFS boot: our IP address, our hostname,
- * server IP address, and our root path on the server.
- * There are two ways to do this: The old, Sun way,
- * and the more modern, BOOTP way. (RFC951, RFC1048)
- */
-
-#ifdef SUN_BOOTPARAMS
- /* Get boot info using RARP and Sun bootparams. */
-
- /* Get our IP address. (rarp.c) */
- if (rarp_getipaddress(netdev_sock) == -1)
- return (EIO);
- printf("boot: client IP address: %s\n", intoa(myip.s_addr));
-
- /* Get our hostname, server IP address. */
- if (bp_whoami(netdev_sock))
- return (EIO);
- printf("boot: client name: %s\n", hostname);
-
- /* Get the root pathname. */
- if (bp_getfile(netdev_sock, "root", &rootip, rootpath))
- return (EIO);
-
-#else
-
- /* Get boot info using BOOTP way. (RFC951, RFC1048) */
- bootp(netdev_sock);
-
- printf("Using IP address: %s\n", intoa(myip.s_addr));
-
- printf("myip: %s (%s)", hostname, intoa(myip));
- if (gateip)
- printf(", gateip: %s", intoa(gateip));
- if (mask)
- printf(", mask: %s", intoa(mask));
- printf("\n");
-
-#endif
-
- printf("root addr=%s path=%s\n", intoa(rootip.s_addr), rootpath);
-
- /* Get the NFS file handle (mount). */
- error = nfs_mount(netdev_sock, rootip, rootpath);
-
- return (error);
-}
-
-/*
- * machdep_common_ether: get ethernet address
- */
-void
-machdep_common_ether(u_char *ether)
-{
- u_char *ea;
-
- if (bugargs.cputyp == CPU_147) {
- ea = (u_char *) ETHER_ADDR_147;
-
- if ((*(int *) ea & 0x2fffff00) == 0x2fffff00)
- panic("ERROR: ethernet address not set!");
- ether[0] = 0x08;
- ether[1] = 0x00;
- ether[2] = 0x3e;
- ether[3] = ea[0];
- ether[4] = ea[1];
- ether[5] = ea[2];
- } else {
- ea = (u_char *) ETHER_ADDR_16X;
-
- if (ea[0] + ea[1] + ea[2] + ea[3] + ea[4] + ea[5] == 0)
- panic("ERROR: ethernet address not set!");
- ether[0] = ea[0];
- ether[1] = ea[1];
- ether[2] = ea[2];
- ether[3] = ea[3];
- ether[4] = ea[4];
- ether[5] = ea[5];
- }
-}
diff --git a/sys/arch/mvme68k/stand/netboot/dev_net.h b/sys/arch/mvme68k/stand/netboot/dev_net.h
deleted file mode 100644
index 648a99e084d..00000000000
--- a/sys/arch/mvme68k/stand/netboot/dev_net.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $OpenBSD: dev_net.h,v 1.6 2012/12/31 21:35:32 miod Exp $ */
-
-int net_open(struct open_file *, ...);
-int net_close(struct open_file *);
-int net_ioctl(struct open_file *, u_long, void *);
-int net_strategy(void *, int, daddr32_t, size_t, void *, size_t *);
-
-void machdep_common_ether(u_char *);
diff --git a/sys/arch/mvme68k/stand/netboot/devopen.c b/sys/arch/mvme68k/stand/netboot/devopen.c
deleted file mode 100644
index a4b7f7e93ba..00000000000
--- a/sys/arch/mvme68k/stand/netboot/devopen.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* $OpenBSD: devopen.c,v 1.3 2012/12/31 21:35:32 miod Exp $ */
-
-#include <sys/param.h>
-#include <stand.h>
-
-/*
- * Open the device named by the combined device/file name
- * given as the "fname" arg, something like: "sd()bsd"
- *
- * However, Sun PROMs don't really let you choose which
- * device you will talk to. You can only open the device
- * that was used to load the boot program. Therefore, we
- * do not accept a "device" part in the "fname" string.
- * Pass the PROM device name to open in case it needs it.
- */
-int
-devopen(f, fname, file)
- struct open_file *f;
- const char *fname;
- char **file;
-{
- struct devsw *dp;
- int error;
-
- *file = (char *)fname;
- dp = &devsw[0];
- f->f_dev = dp;
- error = (*dp->dv_open)(f, NULL);
-
- return (error);
-}
diff --git a/sys/arch/mvme68k/stand/netboot/i82586.h b/sys/arch/mvme68k/stand/netboot/i82586.h
deleted file mode 100644
index 989fa89acfc..00000000000
--- a/sys/arch/mvme68k/stand/netboot/i82586.h
+++ /dev/null
@@ -1,306 +0,0 @@
-/* $OpenBSD: i82586.h,v 1.3 1996/04/28 10:49:21 deraadt Exp $ */
-
-/*-
- * Copyright (c) 1995 Theo de Raadt
- * Copyright (c) 1992, University of Vermont and State Agricultural College.
- * Copyright (c) 1992, Garrett A. Wollman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * Vermont and State Agricultural College and Garrett A. Wollman.
- * 4. Neither the name of the University nor the name of the author
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR AUTHOR BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Intel 82586 Ethernet chip
- * Register, bit, and structure definitions.
- *
- * Written by GAW with reference to the Clarkson Packet Driver code for this
- * chip written by Russ Nelson and others.
- */
-
-struct ie_en_addr {
- u_char data[6];
-};
-/*
- * the only actual IE registers.
- */
-struct iereg {
- u_short ie_porthigh;
- u_short ie_portlow;
- u_long ie_attention;
-};
-#define IE_PORT_NEWSCP 0x00000002
-#define IE_PORT_RESET 0x00000000
-
-/*
- * This is the master configuration block. It tells the hardware where
- * all the rest of the stuff is.
- */
-struct ie_scp {
- u_char mbz1[3]; /* must be zero */
- u_char scp_sysbus; /* true if 8-bit only */
- u_char mbz2[4]; /* must be zero */
- u_short scp_iscp_low; /* 24-bit physaddr of ISCP */
- u_char mbz3[1];
- u_char scp_iscp_high; /* the rest of the physaddr.. */
-};
-/*
- * The tells the hardware where all the rest of the stuff is, too.
- * FIXME: some of these should be re-commented after we figure out their
- * REAL function.
- */
-struct ie_iscp {
- u_char mbz1[1];
- u_char iscp_busy; /* zeroed after init */
- u_short iscp_scboffset; /* 16-bit physaddr of next struct */
- u_short iscp_base_low; /* 24-bit physaddr for all 16-bit vars */
- u_char mbz2[1];
- u_char iscp_base_high; /* rest of physaddr ... */
-};
-/*
- * This FINALLY tells the hardware what to do and where to put it.
- */
-struct ie_scb {
- u_short ie_status; /* status word */
- u_short ie_command; /* command word */
- u_short ie_command_list;/* 16-pointer to command block list */
- u_short ie_recv_list; /* 16-pointer to receive frame list */
- u_short ie_err_crc; /* CRC errors */
- u_short ie_err_align; /* Alignment errors */
- u_short ie_err_resource;/* Resource errors */
- u_short ie_err_overrun; /* Overrun errors */
-};
-/* Command values */
-#define IE_RU_COMMAND 0x0070 /* mask for RU command */
-#define IE_RU_NOP 0 /* for completeness */
-#define IE_RU_START 0x0010 /* start receive unit command */
-#define IE_RU_ENABLE 0x0020 /* enable receiver command */
-#define IE_RU_DISABLE 0x0030 /* disable receiver command */
-#define IE_RU_ABORT 0x0040 /* abort current receive operation */
-
-#define IE_CU_COMMAND 0x0700 /* mask for CU command */
-#define IE_CU_NOP 0 /* included for completeness */
-#define IE_CU_START 0x0100 /* do-command command */
-#define IE_CU_RESUME 0x0200 /* resume a suspended cmd list */
-#define IE_CU_STOP 0x0300 /* SUSPEND was already taken */
-#define IE_CU_ABORT 0x0400 /* abort current command */
-
-#define IE_ACK_COMMAND 0xf000 /* mask for ACK command */
-#define IE_ACK_CX 0x8000 /* ack IE_ST_DONE */
-#define IE_ACK_FR 0x4000 /* ack IE_ST_RECV */
-#define IE_ACK_CNA 0x2000 /* ack IE_ST_ALLDONE */
-#define IE_ACK_RNR 0x1000 /* ack IE_ST_RNR */
-
-#define IE_ACTION_COMMAND(x) (((x) & IE_CU_COMMAND) == IE_CU_START)
- /* is this command an action command? */
-
-/* Status values */
-#define IE_ST_WHENCE 0xf000 /* mask for cause of interrupt */
-#define IE_ST_DONE 0x8000 /* command with I bit completed */
-#define IE_ST_RECV 0x4000 /* frame received */
-#define IE_ST_ALLDONE 0x2000 /* all commands completed */
-#define IE_ST_RNR 0x1000 /* receive not ready */
-
-#define IE_CU_STATUS 0x700 /* mask for command unit status */
-#define IE_CU_ACTIVE 0x200 /* command unit is active */
-#define IE_CU_SUSPEND 0x100 /* command unit is suspended */
-
-#define IE_RU_STATUS 0x70 /* mask for receiver unit status */
-#define IE_RU_SUSPEND 0x10 /* receiver is suspended */
-#define IE_RU_NOSPACE 0x20 /* receiver has no resources */
-#define IE_RU_READY 0x40 /* receiver is ready */
-
-/*
- * This is filled in partially by the chip, partially by us.
- */
-struct ie_recv_frame_desc {
- u_short ie_fd_status; /* status for this frame */
- u_short ie_fd_last; /* end of frame list flag */
- u_short ie_fd_next; /* 16-pointer to next RFD */
- u_short ie_fd_buf_desc; /* 16-pointer to list of buffer desc's */
- struct ie_en_addr dest; /* destination ether */
- struct ie_en_addr src; /* source ether */
- u_short ie_length; /* 802 length/Ether type */
- u_short mbz; /* must be zero */
-};
-#define IE_FD_LAST 0x8000 /* last rfd in list */
-#define IE_FD_SUSP 0x4000 /* suspend RU after receipt */
-
-#define IE_FD_COMPLETE 0x8000 /* frame is complete */
-#define IE_FD_BUSY 0x4000 /* frame is busy */
-#define IE_FD_OK 0x2000 /* frame is bad */
-#define IE_FD_RNR 0x0200 /* receiver out of resources here */
-
-/*
- * linked list of buffers...
- */
-struct ie_recv_buf_desc {
- u_short ie_rbd_actual; /* status for this buffer */
- u_short ie_rbd_next; /* 16-pointer to next RBD */
- u_short ie_rbd_buffer_low; /* 24-pointer to buffer for this RBD */
- u_short ie_rbd_buffer_high; /* 24-pointer to buffer for this RBD */
- u_short ie_rbd_length; /* length of the buffer */
- u_short mbz; /* must be zero */
-};
-#define IE_RBD_LAST 0x8000 /* last buffer */
-#define IE_RBD_USED 0x4000 /* this buffer has data */
-/*
- * All commands share this in common.
- */
-struct ie_cmd_common {
- u_short ie_cmd_status; /* status of this command */
- u_short ie_cmd_cmd; /* command word */
- u_short ie_cmd_link; /* link to next command */
-};
-#define IE_STAT_COMPL 0x8000 /* command is completed */
-#define IE_STAT_BUSY 0x4000 /* command is running now */
-#define IE_STAT_OK 0x2000 /* command completed successfully */
-#define IE_STAT_ABORT 0x1000 /* command was aborted */
-
-
-#define IE_CMD_NOP 0x0000 /* NOP */
-#define IE_CMD_IASETUP 0x0001 /* initial address setup */
-#define IE_CMD_CONFIG 0x0002 /* configure command */
-#define IE_CMD_MCAST 0x0003 /* multicast setup command */
-#define IE_CMD_XMIT 0x0004 /* transmit command */
-#define IE_CMD_TDR 0x0005 /* time-domain reflectometer command */
-#define IE_CMD_DUMP 0x0006 /* dump command */
-#define IE_CMD_DIAGNOSE 0x0007 /* diagnostics command */
-
-#define IE_CMD_LAST 0x8000 /* this is the last command in the list */
-#define IE_CMD_SUSPEND 0x4000 /* suspend CU after this command */
-#define IE_CMD_INTR 0x2000 /* post an interrupt after completion */
-
-/*
- * This is the command to transmit a frame.
- */
-struct ie_xmit_cmd {
- struct ie_cmd_common com; /* common part */
-#define ie_xmit_status com.ie_cmd_status
-
- u_short ie_xmit_desc; /* 16-pointer to buffer descriptor */
- struct ie_en_addr ie_xmit_addr; /* destination address */
-
- u_short ie_xmit_length; /* 802.3 length/Ether type field */
-};
-#define IE_XS_MAXCOLL 0x000f /* number of collisions during transmit */
-#define IE_XS_EXCMAX 0x0020 /* exceeded maximum number of collisions */
-#define IE_XS_SQE 0x0040 /* SQE positive */
-#define IE_XS_DEFERRED 0x0080 /* transmission deferred */
-#define IE_XS_UNDERRUN 0x0100 /* DMA underrun */
-#define IE_XS_LOSTCTS 0x0200 /* Lost CTS */
-#define IE_XS_NOCARRIER 0x0400 /* No Carrier */
-
-/*
- * This is a buffer descriptor for a frame to be transmitted.
- */
-
-struct ie_xmit_buf {
- u_short ie_xmit_flags; /* see below */
- u_short ie_xmit_next; /* 16-pointer to next desc. */
- u_short ie_xmit_buf_low;/* 24-pointer to the actual buffer */
- u_short ie_xmit_buf_high; /* 24-pointer to the actual buffer */
-};
-#define IE_XMIT_LAST 0x8000 /* this TBD is the last one */
-/* The rest of the `flags' word is actually the length. */
-
-/*
- * Multicast setup command.
- */
-
-#define MAXMCAST 250 /* must fit in transmit buffer */
-
-struct ie_mcast_cmd {
- struct ie_cmd_common com; /* common part */
-#define ie_mcast_status com.ie_cmd_status
-
- u_short ie_mcast_bytes; /* size (in bytes) of multicast addresses */
- struct ie_en_addr ie_mcast_addrs[MAXMCAST + 1]; /* space for them */
-};
-/*
- * Time Domain Reflectometer command.
- */
-
-struct ie_tdr_cmd {
- struct ie_cmd_common com; /* common part */
-#define ie_tdr_status com.ie_cmd_status
-
- u_short ie_tdr_time; /* error bits and time */
-};
-#define IE_TDR_SUCCESS 0x8000 /* TDR succeeded without error */
-#define IE_TDR_XCVR 0x4000 /* detected a transceiver problem */
-#define IE_TDR_OPEN 0x2000 /* detected an open */
-#define IE_TDR_SHORT 0x1000 /* TDR detected a short */
-#define IE_TDR_TIME 0x07ff /* mask for reflection time */
-
-/*
- * Initial Address Setup command
- */
-struct ie_iasetup_cmd {
- struct ie_cmd_common com;
-#define ie_iasetup_status com.ie_cmd_status
-
- struct ie_en_addr ie_address;
-};
-/*
- * Configuration command
- */
-struct ie_config_cmd {
- struct ie_cmd_common com; /* common part */
-#define ie_config_status com.ie_cmd_status
-
- u_char ie_config_count;/* byte count (0x0c) */
- u_char ie_fifo; /* fifo (8) */
- u_char ie_save_bad; /* save bad frames (0x40) */
- u_char ie_addr_len; /* address length (0x2e) (AL-LOC == 1) */
- u_char ie_priority; /* priority and backoff (0x0) */
- u_char ie_ifs; /* inter-frame spacing (0x60) */
- u_char ie_slot_low; /* slot time, LSB (0x0) */
- u_char ie_slot_high; /* slot time, MSN, and retries (0xf2) */
- u_char ie_promisc; /* 1 if promiscuous, else 0 */
- u_char ie_crs_cdt; /* CSMA/CD parameters (0x0) */
- u_char ie_min_len; /* min frame length (0x40) */
- u_char ie_junk; /* stuff for 82596 (0xff) */
-};
-
-struct iemem {
- volatile struct ie_scp im_scp;
- u_char xx1[4];
- volatile struct ie_iscp im_iscp;
-
- volatile struct ie_scb im_scb;
- volatile struct ie_config_cmd im_cc;
- volatile struct ie_iasetup_cmd im_ic;
- volatile struct ie_recv_frame_desc im_rfd[NRXBUF];
- volatile struct ie_recv_buf_desc im_rbd[NRXBUF];
- volatile struct ie_xmit_cmd im_xc[NTXBUF];
- volatile struct ie_xmit_buf im_xd[NTXBUF];
- volatile u_char im_rxbuf[NRXBUF * IE_RBUF_SIZE];
- volatile u_char im_txbuf[NTXBUF * ETHER_MAX_LEN];
-
-};
diff --git a/sys/arch/mvme68k/stand/netboot/if_ie.c b/sys/arch/mvme68k/stand/netboot/if_ie.c
deleted file mode 100644
index b647214f9b6..00000000000
--- a/sys/arch/mvme68k/stand/netboot/if_ie.c
+++ /dev/null
@@ -1,471 +0,0 @@
-/* $OpenBSD: if_ie.c,v 1.14 2012/12/31 21:35:32 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/types.h>
-
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-
-#define ETHER_MIN_LEN 64
-#define ETHER_MAX_LEN 1518
-#define ETHER_CRC_LEN 4
-
-#define NTXBUF 1
-#define NRXBUF 16
-#define IE_RBUF_SIZE ETHER_MAX_LEN
-
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-#include "netif.h"
-#include "config.h"
-#include "net.h"
-
-#include "i82586.h"
-#include "if_iereg.h"
-
-int ie_debug = 0;
-
-void ie_stop(struct netif *);
-void ie_end(struct netif *);
-void ie_error(struct netif *, char *, volatile struct iereg *);
-int ie_get(struct iodesc *, void *, size_t, time_t);
-void ie_init(struct iodesc *, void *);
-int ie_match(struct netif *, void *);
-int ie_poll(struct iodesc *, void *, int);
-int ie_probe(struct netif *, void *);
-int ie_put(struct iodesc *, void *, size_t);
-void ie_reset(struct netif *, u_char *);
-extern void machdep_common_ether(u_char *);
-
-struct netif_stats ie_stats;
-
-struct netif_dif ie0_dif = {
- 0, /* unit */
- 1, /* nsel */
- &ie_stats,
- 0,
- 0,
-};
-
-struct netif_driver ie_driver = {
- "ie", /* netif_bname */
- ie_match, /* match */
- ie_probe, /* probe */
- ie_init, /* init */
- ie_get, /* get */
- ie_put, /* put */
- ie_end, /* end */
- &ie0_dif, /* netif_ifs */
- 1, /* netif_nifs */
-};
-
-struct ie_configuration {
- u_int phys_addr;
- int used;
-} ie_config[] = {
- { INTEL_REG_ADDR, 0 }
-};
-
-int nie_config = sizeof(ie_config) / (sizeof(ie_config[0]));
-
-struct {
- struct iereg *sc_reg; /* IE registers */
- struct iemem *sc_mem; /* RAM */
-} ie_softc;
-
-int
-ie_match(struct netif *nif, void *machdep_hint)
-{
- char *name;
- int i, val = 0;
-
- if (bugargs.cputyp == CPU_147)
- return (0);
- name = machdep_hint;
- if (name && !bcmp(ie_driver.netif_bname, name, 2))
- val += 10;
- for (i = 0; i < nie_config; i++) {
- if (ie_config[i].used)
- continue;
- if (ie_debug)
- printf("ie%d: ie_match --> %d\n", i, val + 1);
- ie_config[i].used++;
- return (val + 1);
- }
- if (ie_debug)
- printf("ie%d: ie_match --> 0\n", i);
- return (0);
-}
-
-int
-ie_probe(struct netif *nif, void *machdep_hint)
-{
-
- /* the set unit is the current unit */
- if (ie_debug)
- printf("ie%d: ie_probe called\n", nif->nif_unit);
-
- if (bugargs.cputyp != CPU_147)
- return (0);
- return (1);
-}
-
-void
-ie_error(struct netif *nif, char *str, volatile struct iereg *ier)
-{
- panic("ie%d: unknown error", nif->nif_unit);
-}
-
-static void
-ieack(volatile struct iereg *ier, struct iemem *iem)
-{
- /* ack the `interrupt' */
- iem->im_scb.ie_command = iem->im_scb.ie_status & IE_ST_WHENCE;
- ier->ie_attention = 1; /* chan attention! */
- while (iem->im_scb.ie_command)
- ;
-}
-
-void
-ie_reset(struct netif *nif, u_char *myea)
-{
- volatile struct iereg *ier = ie_softc.sc_reg;
- struct iemem *iem = ie_softc.sc_mem;
- int timo = 10000, i;
- volatile int t;
- u_int a;
-
- if (ie_debug)
- printf("ie%d: ie_reset called\n", nif->nif_unit);
-
- /*printf("ier %x iem %x\n", ier, iem);*/
-
- *(u_char *)0xfff4202a = 0x40;
-
- bzero(iem, sizeof(*iem));
- iem->im_scp.scp_sysbus = 0;
- iem->im_scp.scp_iscp_low = (int) &iem->im_iscp & 0xffff;
- iem->im_scp.scp_iscp_high = (int) &iem->im_iscp >> 16;
-
- iem->im_iscp.iscp_scboffset = (int) &iem->im_scb - (int) iem;
- iem->im_iscp.iscp_busy = 1;
- iem->im_iscp.iscp_base_low = (int) iem & 0xffff;
- iem->im_iscp.iscp_base_high = (int) iem >> 16;
-
- /*
- * completely and utterly unlike what i expected, the
- * "write" order is:
- * 1st: d15-d0 -> high address
- * 2nd: d31-d16 -> low address
- */
-
- /* reset chip */
- a = IE_PORT_RESET;
- ier->ie_porthigh = a & 0xffff;
- t = 0;
- t = 1;
- ier->ie_portlow = a >> 16;
- for (t = timo; t--;)
- ;
-
- /* set new SCP pointer */
- a = (int) &iem->im_scp | IE_PORT_NEWSCP;
- ier->ie_porthigh = a & 0xffff;
- t = 0;
- t = 1;
- ier->ie_portlow = a >> 16;
- for (t = timo; t--;)
- ;
-
- ier->ie_attention = 1; /* chan attention! */
- for (t = timo * 10; t--;)
- ;
-
- /* send CONFIGURE command */
- iem->im_scb.ie_command = IE_CU_START;
- iem->im_scb.ie_command_list = (int) &iem->im_cc - (int) iem;
- iem->im_cc.com.ie_cmd_status = 0;
- iem->im_cc.com.ie_cmd_cmd = IE_CMD_CONFIG | IE_CMD_LAST;
- iem->im_cc.com.ie_cmd_link = 0xffff;
- iem->im_cc.ie_config_count = 0x0c;
- iem->im_cc.ie_fifo = 8;
- iem->im_cc.ie_save_bad = 0x40;
- iem->im_cc.ie_addr_len = 0x2e;
- iem->im_cc.ie_priority = 0;
- iem->im_cc.ie_ifs = 0x60;
- iem->im_cc.ie_slot_low = 0;
- iem->im_cc.ie_slot_high = 0xf2;
- iem->im_cc.ie_promisc = 0;
- iem->im_cc.ie_crs_cdt = 0;
- iem->im_cc.ie_min_len = 64;
- iem->im_cc.ie_junk = 0xff;
-
- ier->ie_attention = 1; /* chan attention! */
- for (t = timo * 10; t--;)
- ;
-
- ieack(ier, iem);
-
- /*printf("ic %x\n", &iem->im_ic);*/
- /* send IASETUP command */
- iem->im_scb.ie_command = IE_CU_START;
- iem->im_scb.ie_command_list = (int) &iem->im_ic - (int) iem;
- iem->im_ic.com.ie_cmd_status = 0;
- iem->im_ic.com.ie_cmd_cmd = IE_CMD_IASETUP | IE_CMD_LAST;
- iem->im_ic.com.ie_cmd_link = 0xffff;
- bcopy(myea, (void *)&iem->im_ic.ie_address, sizeof iem->im_ic.ie_address);
-
- ier->ie_attention = 1; /* chan attention! */
- for (t = timo * 10; t--;)
- ;
-
- ieack(ier, iem);
-
- /* setup buffers */
-
- for (i = 0; i < NRXBUF; i++) {
- iem->im_rfd[i].ie_fd_next = (int) &iem->im_rfd[(i+1) % NRXBUF] -
- (int) iem;
- iem->im_rbd[i].ie_rbd_next = (int) &iem->im_rbd[(i+1) % NRXBUF] -
- (int) iem;
- a = (int) &iem->im_rxbuf[i * IE_RBUF_SIZE];
- iem->im_rbd[i].ie_rbd_buffer_low = a & 0xffff;
- iem->im_rbd[i].ie_rbd_buffer_high = a >> 16;
- iem->im_rbd[i].ie_rbd_length = IE_RBUF_SIZE;
- }
- iem->im_rfd[NRXBUF-1].ie_fd_last |= IE_FD_LAST;
- iem->im_rbd[NRXBUF-1].ie_rbd_length |= IE_RBD_LAST;
- iem->im_rfd[0].ie_fd_buf_desc = (int) &iem->im_rbd[0] - (int) iem;
-
- /*printf("rfd[0] %x rbd[0] %x buf[0] %x\n", &iem->im_rfd, &iem->im_rbd,
- &iem->im_rxbuf);*/
-
- /* send receiver start command */
- iem->im_scb.ie_command = IE_RU_START;
- iem->im_scb.ie_command_list = 0;
- iem->im_scb.ie_recv_list = (int) &iem->im_rfd[0] - (int) iem;
- ier->ie_attention = 1; /* chan attention! */
- while (iem->im_scb.ie_command)
- ;
-
- ieack(ier, iem);
-}
-
-int
-ie_poll(struct iodesc *desc, void *pkt, int len)
-{
- volatile struct iereg *ier = ie_softc.sc_reg;
- struct iemem *iem = ie_softc.sc_mem;
- static int slot;
- int length = 0;
- u_short status;
-
- asm(".word 0xf518\n"); /* pflusha */
- status = iem->im_rfd[slot].ie_fd_status;
- if (status & IE_FD_BUSY)
- return (0);
-
- /* printf("slot %d: %x\n", slot, status); */
- if ((status & (IE_FD_COMPLETE | IE_FD_OK)) == (IE_FD_COMPLETE | IE_FD_OK)) {
- if (status & IE_FD_OK) {
- length = iem->im_rbd[slot].ie_rbd_actual & 0x3fff;
- if (length > len)
- length = len;
- bcopy((void *)&iem->im_rxbuf[slot * IE_RBUF_SIZE],
- pkt, length);
-
- iem->im_rfd[slot].ie_fd_status = 0;
- iem->im_rfd[slot].ie_fd_last |= IE_FD_LAST;
- iem->im_rfd[(slot+NRXBUF-1)%NRXBUF].ie_fd_last &=
- ~IE_FD_LAST;
- iem->im_rbd[slot].ie_rbd_actual = 0;
- iem->im_rbd[slot].ie_rbd_length |= IE_RBD_LAST;
- iem->im_rbd[(slot+NRXBUF-1)%NRXBUF].ie_rbd_length &=
- ~IE_RBD_LAST;
- /*printf("S%d\n", slot);*/
-
- } else {
- printf("shit\n");
- }
- slot++;
- /* should move descriptor onto end of queue... */
- }
- if ((iem->im_scb.ie_status & IE_RU_READY) == 0) {
- printf("RR\n");
-
- for (slot = 0; slot < NRXBUF; slot++) {
- iem->im_rbd[slot].ie_rbd_length &= ~IE_RBD_LAST;
- iem->im_rfd[slot].ie_fd_last &= ~IE_FD_LAST;
- }
- iem->im_rbd[NRXBUF-1].ie_rbd_length |= IE_RBD_LAST;
- iem->im_rfd[NRXBUF-1].ie_fd_last |= IE_FD_LAST;
-
- iem->im_rfd[0].ie_fd_buf_desc = (int)&iem->im_rbd[0] - (int)iem;
-
- iem->im_scb.ie_command = IE_RU_START;
- iem->im_scb.ie_command_list = 0;
- iem->im_scb.ie_recv_list = (int)&iem->im_rfd[0] - (int)iem;
- ier->ie_attention = 1; /* chan attention! */
- while (iem->im_scb.ie_command)
- ;
- slot = 0;
- }
- slot = slot % NRXBUF;
- return (length);
-}
-
-int
-ie_put(struct iodesc *desc, void *pkt, size_t len)
-{
- volatile struct iereg *ier = ie_softc.sc_reg;
- struct iemem *iem = ie_softc.sc_mem;
- u_char *p = pkt;
- u_int a;
- int xx = 0;
-
- /* send transmit command */
-
- while (iem->im_scb.ie_command)
- ;
-
- /* copy data */
- bcopy(p, (void *)&iem->im_txbuf[xx], len);
-
- if (len < ETHER_MIN_LEN - ETHER_CRC_LEN) {
- bzero((char *)&iem->im_txbuf[xx] + len,
- ETHER_MIN_LEN - ETHER_CRC_LEN - len);
- len = ETHER_MIN_LEN - ETHER_CRC_LEN;
- }
-
- /* build transmit descriptor */
- iem->im_xd[xx].ie_xmit_flags = len | IE_XMIT_LAST;
- iem->im_xd[xx].ie_xmit_next = 0xffff;
- a = (int) &iem->im_txbuf[xx];
- iem->im_xd[xx].ie_xmit_buf_low = a & 0xffff;
- iem->im_xd[xx].ie_xmit_buf_high = a >> 16;
-
- /* transmit command */
- iem->im_xc[xx].com.ie_cmd_status = 0;
- iem->im_xc[xx].com.ie_cmd_cmd = IE_CMD_XMIT | IE_CMD_LAST;
- iem->im_xc[xx].com.ie_cmd_link = 0xffff;
- iem->im_xc[xx].ie_xmit_desc = (int) &iem->im_xd[xx] - (int) iem;
- iem->im_xc[xx].ie_xmit_length = len;
- bcopy(p, (void *)&iem->im_xc[xx].ie_xmit_addr,
- sizeof iem->im_xc[xx].ie_xmit_addr);
-
- iem->im_scb.ie_command = IE_CU_START;
- iem->im_scb.ie_command_list = (int) &iem->im_xc[xx] - (int) iem;
-
- ier->ie_attention = 1; /* chan attention! */
-
- if (ie_debug) {
- printf("ie%d: send %ld to %x:%x:%x:%x:%x:%x\n",
- desc->io_netif->nif_unit, len,
- p[0], p[1], p[2], p[3], p[4], p[5]);
- }
- return (len);
-}
-
-int
-ie_get(struct iodesc *desc, void *pkt, size_t len, time_t timeout)
-{
- time_t t;
- int cc;
-
- t = getsecs();
- cc = 0;
- while (((getsecs() - t) < timeout) && !cc) {
- cc = ie_poll(desc, pkt, len);
- }
- return (cc);
-}
-/*
- * init ie device. return 0 on failure, 1 if ok.
- */
-void
-ie_init(struct iodesc *desc, void *machdep_hint)
-{
- struct netif *nif = desc->io_netif;
-
- if (ie_debug)
- printf("ie%d: ie_init called\n", desc->io_netif->nif_unit);
- machdep_common_ether(desc->myea);
- bzero(&ie_softc, sizeof(ie_softc));
- ie_softc.sc_reg =
- (struct iereg *) ie_config[desc->io_netif->nif_unit].phys_addr;
- /* use 64KB below HEAP as buffers */
- ie_softc.sc_mem = (struct iemem *)(HEAP_START - 0x10000);
- ie_reset(desc->io_netif, desc->myea);
- printf("device: %s%d attached to %s\n", nif->nif_driver->netif_bname,
- nif->nif_unit, ether_sprintf(desc->myea));
-}
-
-void
-ie_stop(struct netif *nif)
-{
- volatile struct iereg *ier = ie_softc.sc_reg;
- struct iemem *iem = ie_softc.sc_mem;
- int timo = 10000;
- volatile int t;
- u_int a;
-
- iem->im_iscp.iscp_busy = 1;
- /* reset chip */
- a = IE_PORT_RESET;
- ier->ie_porthigh = a & 0xffff;
- t = 0;
- t = 1;
- ier->ie_portlow = a >> 16;
- for (t = timo; t--;)
- ;
-
- /* reset chip again */
- a = IE_PORT_RESET;
- ier->ie_porthigh = a & 0xffff;
- t = 0;
- t = 1;
- ier->ie_portlow = a >> 16;
- for (t = timo; t--;)
- ;
-
- /*printf("status %x busy %x\n", iem->im_scb.ie_status,
- iem->im_iscp.iscp_busy);*/
-}
-
-void
-ie_end(struct netif *nif)
-{
- if (ie_debug)
- printf("ie%d: ie_end called\n", nif->nif_unit);
-
- ie_stop(nif);
-
- /* *(u_char *) 0xfff42002 = 0; */
-}
diff --git a/sys/arch/mvme68k/stand/netboot/if_iereg.h b/sys/arch/mvme68k/stand/netboot/if_iereg.h
deleted file mode 100644
index cf2aa11038e..00000000000
--- a/sys/arch/mvme68k/stand/netboot/if_iereg.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/* $OpenBSD: if_iereg.h,v 1.3 1996/04/28 10:49:23 deraadt Exp $ */
-
-/*
- * if_sunie.h
- *
- * sun's ie interface
- */
-
-/*
- * programming notes:
- *
- * the ie chip operates in a 24 bit address space.
- *
- * most ie interfaces appear to be divided into two parts:
- * - generic 586 stuff
- * - board specific
- *
- * generic:
- * the generic stuff of the ie chip is all done with data structures
- * that live in the chip's memory address space. the chip expects
- * its main data structure (the sys conf ptr -- SCP) to be at a fixed
- * address in its 24 bit space: 0xfffff4
- *
- * the SCP points to another structure called the ISCP.
- * the ISCP points to another structure called the SCB.
- * the SCB has a status field, a linked list of "commands", and
- * a linked list of "receive buffers". these are data structures that
- * live in memory, not registers.
- *
- * board:
- * to get the chip to do anything, you first put a command in the
- * command data structure list. then you have to signal "attention"
- * to the chip to get it to look at the command. how you
- * signal attention depends on what board you have... on PC's
- * there is an i/o port number to do this, on sun's there is a
- * register bit you toggle.
- *
- * to get data from the chip you program it to interrupt...
- *
- *
- * sun issues:
- *
- * there are 3 kinds of sun "ie" interfaces:
- * 1 - a VME/multibus card
- * 2 - an on-board interface (sun3's, sun-4/100's, and sun-4/200's)
- * 3 - another VME board called the 3E
- *
- * the VME boards lives in vme16 space. only 16 and 8 bit accesses
- * are allowed, so functions that copy data must be aware of this.
- *
- * the chip is an intel chip. this means that the byte order
- * on all the "short"s in the chip's data structures is wrong.
- * so, constants described in the intel docs are swapped for the sun.
- * that means that any buffer pointers you give the chip must be
- * swapped to intel format. yuck.
- *
- * VME/multibus interface:
- * for the multibus interface the board ignores the top 4 bits
- * of the chip address. the multibus interface seems to have its
- * own MMU like page map (without protections or valid bits, etc).
- * there are 256 pages of physical memory on the board (each page
- * is 1024 bytes). there are 1024 slots in the page map. so,
- * a 1024 byte page takes up 10 bits of address for the offset,
- * and if there are 1024 slots in the page that is another 10 bits
- * of the address. that makes a 20 bit address, and as stated
- * earlier the board ignores the top 4 bits, so that accounts
- * for all 24 bits of address.
- *
- * note that the last entry of the page map maps the top of the
- * 24 bit address space and that the SCP is supposed to be at
- * 0xfffff4 (taking into account allignment). so,
- * for multibus, that entry in the page map has to be used for the SCP.
- *
- * the page map effects BOTH how the ie chip sees the
- * memory, and how the host sees it.
- *
- * the page map is part of the "register" area of the board
- *
- * on-board interface:
- *
- * <fill in useful info later>
- *
- *
- * VME3E interface:
- *
- * <fill in useful info later>
- *
- */
-
-/*
- * PART 1: VME/multibus defs
- */
-#define IEVME_PAGESIZE 1024 /* bytes */
-#define IEVME_PAGSHIFT 10 /* bits */
-#define IEVME_NPAGES 256 /* number of pages on chip */
-#define IEVME_MAPSZ 1024 /* number of entries in the map */
-
-/*
- * PTE for the page map
- */
-#define IEVME_SBORDR 0x8000 /* sun byte order */
-#define IEVME_IBORDR 0x0000 /* intel byte ordr */
-
-#define IEVME_P2MEM 0x2000 /* memory is on P2 */
-#define IEVME_OBMEM 0x0000 /* memory is on board */
-
-#define IEVME_PGMASK 0x0fff /* gives the physical page frame number */
-
-struct ievme {
- u_short pgmap[IEVME_MAPSZ];
- u_short xxx[32]; /* prom */
- u_short status; /* see below for bits */
- u_short xxx2; /* filler */
- u_short pectrl; /* parity control (see below) */
- u_short peaddr; /* low 16 bits of address */
-};
-/*
- * status bits
- */
-#define IEVME_RESET 0x8000 /* reset board */
-#define IEVME_ONAIR 0x4000 /* go out of loopback 'on-air' */
-#define IEVME_ATTEN 0x2000 /* attention */
-#define IEVME_IENAB 0x1000 /* interrupt enable */
-#define IEVME_PEINT 0x0800 /* parity error interrupt enable */
-#define IEVME_PERR 0x0200 /* parity error flag */
-#define IEVME_INT 0x0100 /* interrupt flag */
-#define IEVME_P2EN 0x0020 /* enable p2 bus */
-#define IEVME_256K 0x0010 /* 256kb rams */
-#define IEVME_HADDR 0x000f /* mask for bits 17-20 of address */
-
-/*
- * parity control
- */
-#define IEVME_PARACK 0x0100 /* parity error ack */
-#define IEVME_PARSRC 0x0080 /* parity error source */
-#define IEVME_PAREND 0x0040 /* which end of the data got the error */
-#define IEVME_PARADR 0x000f /* mask to get bits 17-20 of parity address */
-
-
-/*
- * PART 2: the on-board interface
- */
-struct ieob {
- u_char obctrl;
-};
-#define IEOB_NORSET 0x80 /* don't reset the board */
-#define IEOB_ONAIR 0x40 /* put us on the air */
-#define IEOB_ATTEN 0x20 /* attention! */
-#define IEOB_IENAB 0x10 /* interrupt enable */
-#define IEOB_XXXXX 0x08 /* free bit */
-#define IEOB_XCVRL2 0x04 /* level 2 transceiver? */
-#define IEOB_BUSERR 0x02 /* bus error */
-#define IEOB_INT 0x01 /* interrupt */
-
-#define IEOB_ADBASE 0xff000000 /* KVA base addr of 24 bit address space */
-
-/*
- * PART 3: the 3E board
- */
-
-/*
- * not supported (yet?)
- */
diff --git a/sys/arch/mvme68k/stand/netboot/if_le.c b/sys/arch/mvme68k/stand/netboot/if_le.c
deleted file mode 100644
index 523273c2424..00000000000
--- a/sys/arch/mvme68k/stand/netboot/if_le.c
+++ /dev/null
@@ -1,456 +0,0 @@
-/* $OpenBSD: if_le.c,v 1.12 2012/12/31 21:35:32 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1993 Adam Glass
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Adam Glass.
- * 4. The name of the Author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/types.h>
-
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-#include "netif.h"
-#include "config.h"
-#include "net.h"
-
-#include "if_lereg.h"
-
-int le_debug = 0;
-
-void le_end(struct netif *);
-void le_error(struct netif *, char *, volatile struct lereg1 *);
-int le_get(struct iodesc *, void *, size_t, time_t);
-void le_init(struct iodesc *, void *);
-int le_match(struct netif *, void *);
-int le_poll(struct iodesc *, void *, int);
-int le_probe(struct netif *, void *);
-int le_put(struct iodesc *, void *, size_t);
-void le_reset(struct netif *, u_char *);
-extern void machdep_common_ether(u_char *);
-
-struct netif_stats le_stats;
-
-struct netif_dif le0_dif = {
- 0, /* unit */
- 1, /* nsel */
- &le_stats,
- 0,
- 0,
-};
-
-struct netif_driver le_driver = {
- "le", /* netif_bname */
- le_match, /* match */
- le_probe, /* probe */
- le_init, /* init */
- le_get, /* get */
- le_put, /* put */
- le_end, /* end */
- &le0_dif, /* netif_ifs */
- 1, /* netif_nifs */
-};
-
-struct le_configuration {
- unsigned int phys_addr;
- int used;
-} le_config[] = {
- { LANCE_REG_ADDR, 0 }
-};
-
-int nle_config = sizeof(le_config) / (sizeof(le_config[0]));
-
-struct {
- struct lereg1 *sc_r1; /* LANCE registers */
- struct lereg2 *sc_r2; /* RAM */
- int next_rmd;
- int next_tmd;
-} le_softc;
-
-int
-le_match(nif, machdep_hint)
- struct netif *nif;
- void *machdep_hint;
-{
- char *name;
- int i, val = 0;
-
- if (bugargs.cputyp != CPU_147)
- return (0);
- name = machdep_hint;
- if (name && !bcmp(le_driver.netif_bname, name, 2))
- val += 10;
- for (i = 0; i < nle_config; i++) {
- if (le_config[i].used)
- continue;
- if (le_debug)
- printf("le%d: le_match --> %d\n", i, val + 1);
- le_config[i].used++;
- return val + 1;
- }
- if (le_debug)
- printf("le%d: le_match --> 0\n", i);
- return 0;
-}
-
-int
-le_probe(nif, machdep_hint)
- struct netif *nif;
- void *machdep_hint;
-{
-
- /* the set unit is the current unit */
- if (le_debug)
- printf("le%d: le_probe called\n", nif->nif_unit);
-
- if (bugargs.cputyp == CPU_147)
- return 0;
- return 1;
-}
-
-void
-le_error(nif, str, ler1)
- struct netif *nif;
- char *str;
- volatile struct lereg1 *ler1;
-{
- /* ler1->ler1_rap = LE_CSRO done in caller */
- if (ler1->ler1_rdp & LE_C0_BABL)
- panic("le%d: been babbling, found by '%s'", nif->nif_unit, str);
- if (ler1->ler1_rdp & LE_C0_CERR) {
- le_stats.collision_error++;
- ler1->ler1_rdp = LE_C0_CERR;
- }
- if (ler1->ler1_rdp & LE_C0_MISS) {
- le_stats.missed++;
- ler1->ler1_rdp = LE_C0_MISS;
- }
- if (ler1->ler1_rdp & LE_C0_MERR) {
- printf("le%d: memory error in '%s'\n", nif->nif_unit, str);
- panic("memory error");
- }
-}
-
-void
-le_reset(nif, myea)
- struct netif *nif;
- u_char *myea;
-{
- struct lereg1 *ler1 = le_softc.sc_r1;
- struct lereg2 *ler2 = le_softc.sc_r2;
- unsigned int a;
- int timo = 100000, stat = 0, i;
-
- if (le_debug)
- printf("le%d: le_reset called\n", nif->nif_unit);
- ler1->ler1_rap = LE_CSR0;
- ler1->ler1_rdp = LE_C0_STOP; /* do nothing until we are finished */
-
- bzero(ler2, sizeof(*ler2));
-
- ler2->ler2_mode = LE_MODE_NORMAL;
- ler2->ler2_padr[0] = myea[1];
- ler2->ler2_padr[1] = myea[0];
- ler2->ler2_padr[2] = myea[3];
- ler2->ler2_padr[3] = myea[2];
- ler2->ler2_padr[4] = myea[5];
- ler2->ler2_padr[5] = myea[4];
-
-
- ler2->ler2_ladrf0 = 0;
- ler2->ler2_ladrf1 = 0;
-
- a = (u_int) ler2->ler2_rmd;
- ler2->ler2_rlen = LE_RLEN | (a >> 16);
- ler2->ler2_rdra = a & LE_ADDR_LOW_MASK;
-
- a = (u_int) ler2->ler2_tmd;
- ler2->ler2_tlen = LE_TLEN | (a >> 16);
- ler2->ler2_tdra = a & LE_ADDR_LOW_MASK;
-
- ler1->ler1_rap = LE_CSR1;
- a = (u_int) ler2;
- ler1->ler1_rdp = a & LE_ADDR_LOW_MASK;
- ler1->ler1_rap = LE_CSR2;
- ler1->ler1_rdp = a >> 16;
-
- for (i = 0; i < LERBUF; i++) {
- a = (u_int) & ler2->ler2_rbuf[i];
- ler2->ler2_rmd[i].rmd0 = a & LE_ADDR_LOW_MASK;
- ler2->ler2_rmd[i].rmd1_bits = LE_R1_OWN;
- ler2->ler2_rmd[i].rmd1_hadr = a >> 16;
- ler2->ler2_rmd[i].rmd2 = -LEMTU;
- ler2->ler2_rmd[i].rmd3 = 0;
- }
- for (i = 0; i < LETBUF; i++) {
- a = (u_int) & ler2->ler2_tbuf[i];
- ler2->ler2_tmd[i].tmd0 = a & LE_ADDR_LOW_MASK;
- ler2->ler2_tmd[i].tmd1_bits = 0;
- ler2->ler2_tmd[i].tmd1_hadr = a >> 16;
- ler2->ler2_tmd[i].tmd2 = 0;
- ler2->ler2_tmd[i].tmd3 = 0;
- }
-
- ler1->ler1_rap = LE_CSR3;
- ler1->ler1_rdp = LE_C3_BSWP;
-
- ler1->ler1_rap = LE_CSR0;
- ler1->ler1_rdp = LE_C0_INIT;
- do {
- if (--timo == 0) {
- printf("le%d: init timeout, stat = 0x%x\n",
- nif->nif_unit, stat);
- break;
- }
- stat = ler1->ler1_rdp;
- } while ((stat & LE_C0_IDON) == 0);
-
- ler1->ler1_rdp = LE_C0_IDON;
- le_softc.next_rmd = 0;
- le_softc.next_tmd = 0;
- ler1->ler1_rap = LE_CSR0;
- ler1->ler1_rdp = LE_C0_STRT;
-}
-
-int
-le_poll(desc, pkt, len)
- struct iodesc *desc;
- void *pkt;
- int len;
-{
- struct lereg1 *ler1 = le_softc.sc_r1;
- struct lereg2 *ler2 = le_softc.sc_r2;
- unsigned int a;
- int length;
- struct lermd *rmd;
-
-
- ler1->ler1_rap = LE_CSR0;
- if ((ler1->ler1_rdp & LE_C0_RINT) != 0)
- ler1->ler1_rdp = LE_C0_RINT;
- rmd = &ler2->ler2_rmd[le_softc.next_rmd];
- if (rmd->rmd1_bits & LE_R1_OWN) {
- return (0);
- }
- if (ler1->ler1_rdp & LE_C0_ERR)
- le_error(desc->io_netif, "le_poll", ler1);
- if (rmd->rmd1_bits & LE_R1_ERR) {
- printf("le%d_poll: rmd status 0x%x\n", desc->io_netif->nif_unit,
- rmd->rmd1_bits);
- length = 0;
- goto cleanup;
- }
- if ((rmd->rmd1_bits & (LE_R1_STP | LE_R1_ENP)) != (LE_R1_STP | LE_R1_ENP))
- panic("le_poll: chained packet");
-
- length = rmd->rmd3;
- if (length >= LEMTU) {
- length = 0;
- panic("csr0 when bad things happen: %x", ler1->ler1_rdp);
- goto cleanup;
- }
- if (!length)
- goto cleanup;
- length -= 4;
- if (length > 0) {
-
- /*
- * if buffer is smaller than the packet truncate it.
- * (is this wise?)
- */
- if (length > len)
- length = len;
-
- bcopy((void *)&ler2->ler2_rbuf[le_softc.next_rmd], pkt, length);
- }
-cleanup:
- a = (u_int) & ler2->ler2_rbuf[le_softc.next_rmd];
- rmd->rmd0 = a & LE_ADDR_LOW_MASK;
- rmd->rmd1_hadr = a >> 16;
- rmd->rmd2 = -LEMTU;
- le_softc.next_rmd =
- (le_softc.next_rmd == (LERBUF - 1)) ? 0 : (le_softc.next_rmd + 1);
- rmd->rmd1_bits = LE_R1_OWN;
- return length;
-}
-
-int
-le_put(desc, pkt, len)
- struct iodesc *desc;
- void *pkt;
- size_t len;
-{
- volatile struct lereg1 *ler1 = le_softc.sc_r1;
- volatile struct lereg2 *ler2 = le_softc.sc_r2;
- volatile struct letmd *tmd;
- int timo = 100000, stat = 0;
- unsigned int a;
-
- ler1->ler1_rap = LE_CSR0;
- if (ler1->ler1_rdp & LE_C0_ERR)
- le_error(desc->io_netif, "le_put(way before xmit)", ler1);
- tmd = &ler2->ler2_tmd[le_softc.next_tmd];
- while (tmd->tmd1_bits & LE_T1_OWN) {
- printf("le%d: output buffer busy\n", desc->io_netif->nif_unit);
- }
- bcopy(pkt, (void *)ler2->ler2_tbuf[le_softc.next_tmd], len);
- if (len < 64)
- tmd->tmd2 = -64;
- else
- tmd->tmd2 = -len;
- tmd->tmd3 = 0;
- if (ler1->ler1_rdp & LE_C0_ERR)
- le_error(desc->io_netif, "le_put(before xmit)", ler1);
- tmd->tmd1_bits = LE_T1_STP | LE_T1_ENP | LE_T1_OWN;
- a = (u_int) & ler2->ler2_tbuf[le_softc.next_tmd];
- tmd->tmd0 = a & LE_ADDR_LOW_MASK;
- tmd->tmd1_hadr = a >> 16;
- ler1->ler1_rdp = LE_C0_TDMD;
- if (ler1->ler1_rdp & LE_C0_ERR)
- le_error(desc->io_netif, "le_put(after xmit)", ler1);
- do {
- if (--timo == 0) {
- printf("le%d: transmit timeout, stat = 0x%x\n",
- desc->io_netif->nif_unit, stat);
- if (ler1->ler1_rdp & LE_C0_ERR)
- le_error(desc->io_netif, "le_put(timeout)", ler1);
- break;
- }
- stat = ler1->ler1_rdp;
- } while ((stat & LE_C0_TINT) == 0);
- ler1->ler1_rdp = LE_C0_TINT;
- if (ler1->ler1_rdp & LE_C0_ERR) {
- if ((ler1->ler1_rdp & (LE_C0_BABL | LE_C0_CERR | LE_C0_MISS |
- LE_C0_MERR)) !=
- LE_C0_CERR)
- printf("le_put: xmit error, buf %d\n", le_softc.next_tmd);
- le_error(desc->io_netif, "le_put(xmit error)", ler1);
- }
- le_softc.next_tmd = 0;
-/* (le_softc.next_tmd == (LETBUF - 1)) ? 0 : le_softc.next_tmd + 1;*/
- if (tmd->tmd1_bits & LE_T1_DEF)
- le_stats.deferred++;
- if (tmd->tmd1_bits & LE_T1_ONE)
- le_stats.collisions++;
- if (tmd->tmd1_bits & LE_T1_MORE)
- le_stats.collisions += 2;
- if (tmd->tmd1_bits & LE_T1_ERR) {
- printf("le%d: transmit error, error = 0x%x\n", desc->io_netif->nif_unit,
- tmd->tmd3);
- return -1;
- }
- if (le_debug) {
- printf("le%d: le_put() successful: sent %ld\n",
- desc->io_netif->nif_unit, len);
- printf("le%d: le_put(): tmd1_bits: %x tmd3: %x\n",
- desc->io_netif->nif_unit,
- (unsigned int) tmd->tmd1_bits,
- (unsigned int) tmd->tmd3);
- }
- return len;
-}
-
-int
-le_get(desc, pkt, len, timeout)
- struct iodesc *desc;
- void *pkt;
- size_t len;
- time_t timeout;
-{
- time_t t;
- int cc;
-
- t = getsecs();
- cc = 0;
- while (((getsecs() - t) < timeout) && !cc) {
- cc = le_poll(desc, pkt, len);
- }
- return cc;
-}
-/*
- * init le device. return 0 on failure, 1 if ok.
- */
-void
-le_init(desc, machdep_hint)
- struct iodesc *desc;
- void *machdep_hint;
-{
- struct netif *nif = desc->io_netif;
-
- if (le_debug)
- printf("le%d: le_init called\n", desc->io_netif->nif_unit);
- machdep_common_ether(desc->myea);
- bzero(&le_softc, sizeof(le_softc));
- le_softc.sc_r1 =
- (struct lereg1 *) le_config[desc->io_netif->nif_unit].phys_addr;
- le_softc.sc_r2 = (struct lereg2 *)(HEAP_START - LEMEMSIZE);
- le_reset(desc->io_netif, desc->myea);
- printf("device: %s%d attached to %s\n", nif->nif_driver->netif_bname,
- nif->nif_unit, ether_sprintf(desc->myea));
-}
-
-void
-le_end(nif)
- struct netif *nif;
-{
- struct lereg1 *ler1 = le_softc.sc_r1;
-
- if (le_debug)
- printf("le%d: le_end called\n", nif->nif_unit);
- ler1->ler1_rap = LE_CSR0;
- ler1->ler1_rdp = LE_C0_STOP;
-}
diff --git a/sys/arch/mvme68k/stand/netboot/if_lereg.h b/sys/arch/mvme68k/stand/netboot/if_lereg.h
deleted file mode 100644
index 3952102768d..00000000000
--- a/sys/arch/mvme68k/stand/netboot/if_lereg.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/* $OpenBSD: if_lereg.h,v 1.6 2009/02/17 18:42:06 miod Exp $ */
-
-/*-
- * Copyright (c) 1982, 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)if_lereg.h 8.2 (Berkeley) 10/30/93
- */
-
-#define LEMTU 1518
-#define LEMINSIZE 60 /* should be 64 if mode DTCR is set */
-#define LERBUF 8
-#define LERBUFLOG2 3
-#define LE_RLEN (LERBUFLOG2 << 13)
-#define LETBUF 1
-#define LETBUFLOG2 0
-#define LE_TLEN (LETBUFLOG2 << 13)
-
-#define LEMEMSIZE 16384 /* memory needed to fulfill above settings */
-
-/* Local Area Network Controller for Ethernet (LANCE) registers */
-struct lereg1 {
- volatile u_short ler1_rdp; /* register data port */
- volatile u_short ler1_rap; /* register address port */
-};
-/* register addresses */
-#define LE_CSR0 0 /* Control and status register */
-#define LE_CSR1 1 /* low address of init block */
-#define LE_CSR2 2 /* high address of init block */
-#define LE_CSR3 3 /* Bus master and control */
-
-/* Control and status register 0 (csr0) */
-#define LE_C0_ERR 0x8000 /* error summary */
-#define LE_C0_BABL 0x4000 /* transmitter timeout error */
-#define LE_C0_CERR 0x2000 /* collision */
-#define LE_C0_MISS 0x1000 /* missed a packet */
-#define LE_C0_MERR 0x0800 /* memory error */
-#define LE_C0_RINT 0x0400 /* receiver interrupt */
-#define LE_C0_TINT 0x0200 /* transmitter interrupt */
-#define LE_C0_IDON 0x0100 /* initialization done */
-#define LE_C0_INTR 0x0080 /* interrupt condition */
-#define LE_C0_INEA 0x0040 /* interrupt enable */
-#define LE_C0_RXON 0x0020 /* receiver on */
-#define LE_C0_TXON 0x0010 /* transmitter on */
-#define LE_C0_TDMD 0x0008 /* transmit demand */
-#define LE_C0_STOP 0x0004 /* disable all external activity */
-#define LE_C0_STRT 0x0002 /* enable external activity */
-#define LE_C0_INIT 0x0001 /* begin initialization */
-
-#define LE_C0_BITS \
- "\20\20ERR\17BABL\16CERR\15MISS\14MERR\13RINT\
-\12TINT\11IDON\10INTR\07INEA\06RXON\05TXON\04TDMD\03STOP\02STRT\01INIT"
-
-/* Control and status register 3 (csr3) */
-#define LE_C3_BSWP 0x4 /* byte swap */
-#define LE_C3_ACON 0x2 /* ALE control, eh? */
-#define LE_C3_BCON 0x1 /* byte control */
-/*
- * Current size is 13,758 bytes with 8 x 1518 receive buffers and
- * 1 x 1518 transmit buffer.
- */
-struct lereg2 {
- /* initialization block */
- volatile u_short ler2_mode; /* mode */
- volatile u_char ler2_padr[6]; /* physical address */
-#ifdef new_code
- volatile u_short ler2_ladrf[4]; /* logical address filter */
-#else
- volatile u_long ler2_ladrf0; /* logical address filter */
- volatile u_long ler2_ladrf1; /* logical address filter */
-#endif
- volatile u_short ler2_rdra; /* receive descriptor addr */
- volatile u_short ler2_rlen; /* rda high and ring size */
- volatile u_short ler2_tdra; /* transmit descriptor addr */
- volatile u_short ler2_tlen; /* tda high and ring size */
- /* receive message descriptors. bits/hadr are byte order dependent. */
- struct lermd {
- volatile u_short rmd0; /* low address of packet */
- volatile u_char rmd1_bits; /* descriptor bits */
- volatile u_char rmd1_hadr; /* high address of packet */
- volatile short rmd2; /* buffer byte count */
- volatile u_short rmd3; /* message byte count */
- } ler2_rmd[LERBUF];
- /* transmit message descriptors */
- struct letmd {
- volatile u_short tmd0; /* low address of packet */
- volatile u_char tmd1_bits; /* descriptor bits */
- volatile u_char tmd1_hadr; /* high address of packet */
- volatile short tmd2; /* buffer byte count */
- volatile u_short tmd3; /* transmit error bits */
- } ler2_tmd[LETBUF];
- volatile char ler2_rbuf[LERBUF][LEMTU];
- volatile char ler2_tbuf[LETBUF][LEMTU];
-};
-/* Initialzation block (mode) */
-#define LE_MODE_PROM 0x8000 /* promiscuous mode */
-/* 0x7f80 reserved, must be zero */
-#define LE_MODE_INTL 0x0040 /* internal loopback */
-#define LE_MODE_DRTY 0x0020 /* disable retry */
-#define LE_MODE_COLL 0x0010 /* force a collision */
-#define LE_MODE_DTCR 0x0008 /* disable transmit CRC */
-#define LE_MODE_LOOP 0x0004 /* loopback mode */
-#define LE_MODE_DTX 0x0002 /* disable transmitter */
-#define LE_MODE_DRX 0x0001 /* disable receiver */
-#define LE_MODE_NORMAL 0 /* none of the above */
-
-
-/* Receive message descriptor 1 (rmd1_bits) */
-#define LE_R1_OWN 0x80 /* LANCE owns the packet */
-#define LE_R1_ERR 0x40 /* error summary */
-#define LE_R1_FRAM 0x20 /* framing error */
-#define LE_R1_OFLO 0x10 /* overflow error */
-#define LE_R1_CRC 0x08 /* CRC error */
-#define LE_R1_BUFF 0x04 /* buffer error */
-#define LE_R1_STP 0x02 /* start of packet */
-#define LE_R1_ENP 0x01 /* end of packet */
-
-#define LE_R1_BITS \
- "\20\10OWN\7ERR\6FRAM\5OFLO\4CRC\3BUFF\2STP\1ENP"
-
-/* Transmit message descriptor 1 (tmd1_bits) */
-#define LE_T1_OWN 0x80 /* LANCE owns the packet */
-#define LE_T1_ERR 0x40 /* error summary */
-#define LE_T1_MORE 0x10 /* multiple collisions */
-#define LE_T1_ONE 0x08 /* single collision */
-#define LE_T1_DEF 0x04 /* defferred transmit */
-#define LE_T1_STP 0x02 /* start of packet */
-#define LE_T1_ENP 0x01 /* end of packet */
-
-#define LE_T1_BITS \
- "\20\10OWN\7ERR\6RES\5MORE\4ONE\3DEF\2STP\1ENP"
-
-/* Transmit message descriptor 3 (tmd3) */
-#define LE_T3_BUFF 0x8000 /* buffer error */
-#define LE_T3_UFLO 0x4000 /* underflow error */
-#define LE_T3_LCOL 0x1000 /* late collision */
-#define LE_T3_LCAR 0x0800 /* loss of carrier */
-#define LE_T3_RTRY 0x0400 /* retry error */
-#define LE_T3_TDR_MASK 0x03ff /* time domain reflectometry counter */
-
-#define LE_XMD2_ONES 0xf000
-
-#define LE_T3_BITS \
- "\20\20BUFF\17UFLO\16RES\15LCOL\14LCAR\13RTRY"
-
-
-#define LE_ADDR_LOW_MASK (0xffff)
diff --git a/sys/arch/mvme68k/stand/netboot/version.c b/sys/arch/mvme68k/stand/netboot/version.c
deleted file mode 100644
index a991e7920ac..00000000000
--- a/sys/arch/mvme68k/stand/netboot/version.c
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $OpenBSD: version.c,v 1.9 2013/05/12 08:10:07 miod Exp $ */
-
-/*
- * 1.9 lower load address and heap location by 1MB to fit 8MB boards
- * 1.8 kernel loaded with loadfile, a.out and ELF formats
- */
-
-char *version = "1.9";
diff --git a/sys/arch/mvme68k/stand/prtvid/Makefile b/sys/arch/mvme68k/stand/prtvid/Makefile
deleted file mode 100644
index 73edc4e6922..00000000000
--- a/sys/arch/mvme68k/stand/prtvid/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# $OpenBSD: Makefile,v 1.3 2012/08/21 14:46:19 pascal Exp $
-
-PROG= prtvid
-NOMAN=
-NOPIE=
-
-install:
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/mvme68k/stand/prtvid/prtvid.c b/sys/arch/mvme68k/stand/prtvid/prtvid.c
deleted file mode 100644
index 22b496b443c..00000000000
--- a/sys/arch/mvme68k/stand/prtvid/prtvid.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/* $OpenBSD: prtvid.c,v 1.8 2012/12/31 21:35:32 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Dale Rahn <drahn@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/types.h>
-#include <sys/disklabel.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#define __DBINTERFACE_PRIVATE
-#include <db.h>
-
-static void
-swabvid(struct mvmedisklabel *cdl)
-{
- M_32_SWAP(cdl->vid_oss);
- M_16_SWAP(cdl->vid_osl);
- M_16_SWAP(cdl->vid_osa_u);
- M_16_SWAP(cdl->vid_osa_l);
- M_32_SWAP(cdl->vid_cas);
-}
-
-static void
-swabcfg(struct mvmedisklabel *cdl)
-{
- printf("swapping cfg\n");
-
- M_16_SWAP(cdl->cfg_atm);
- M_16_SWAP(cdl->cfg_prm);
- M_16_SWAP(cdl->cfg_atm);
- M_16_SWAP(cdl->cfg_rec);
- M_16_SWAP(cdl->cfg_trk);
- M_16_SWAP(cdl->cfg_psm);
- M_16_SWAP(cdl->cfg_shd);
- M_16_SWAP(cdl->cfg_pcom);
- M_16_SWAP(cdl->cfg_rwcc);
- M_16_SWAP(cdl->cfg_ecc);
- M_16_SWAP(cdl->cfg_eatm);
- M_16_SWAP(cdl->cfg_eprm);
- M_16_SWAP(cdl->cfg_eatw);
- M_16_SWAP(cdl->cfg_rsvc1);
- M_16_SWAP(cdl->cfg_rsvc2);
-}
-
-int
-main(int argc, char *argv[])
-{
- struct mvmedisklabel *cdl;
-
- cdl = (struct mvmedisklabel *) malloc(sizeof (struct mvmedisklabel));
-
- fread(cdl, sizeof(struct mvmedisklabel), 1, stdin);
-
- if (BYTE_ORDER != BIG_ENDIAN)
- swabvid(cdl);
-
- printf("vid_id %s %lx\n", cdl->vid_id,
- (char *)&(cdl->vid_id[4]) - (char *)cdl);
- printf("vid_oss %x %lx\n", cdl->vid_oss,
- (char *)&(cdl->vid_oss) - (char *)cdl);
- printf("vid_osl %x %lx\n", cdl->vid_osl,
- (char *)&(cdl->vid_osl) - (char *)cdl);
- printf("vid_osa_u %x %lx\n", cdl->vid_osa_u,
- (char *)&(cdl->vid_osa_u) - (char *)cdl);
- printf("vid_osa_l %x %lx\n", cdl->vid_osa_l,
- (char *)&(cdl->vid_osa_l) - (char *)cdl);
- printf("vid_vd %lx\n",
- (char *)&(cdl->vid_vd) - (char *)cdl);
- printf("vid_cas %x %lx\n", cdl->vid_cas,
- (char *)&(cdl->vid_cas) - (char *)cdl);
- printf("vid_cal %x %lx\n", cdl->vid_cal,
- (char *)&(cdl->vid_cal) - (char *)cdl);
- printf("vid_moto %s %lx\n", cdl->vid_mot,
- (char *)&(cdl->vid_mot[0]) - (char *)cdl);
-
- if (BYTE_ORDER != BIG_ENDIAN)
- swabcfg(cdl);
-
- printf("cfg_atm %x %lx\n", cdl->cfg_atm,
- (char *)&(cdl->cfg_atm) - (char *)(cdl));
- printf("cfg_prm %x %lx\n", cdl->cfg_prm,
- (char *)&(cdl->cfg_prm) - (char *)(cdl));
- printf("cfg_atw %x %lx\n", cdl->cfg_atw,
- (char *)&(cdl->cfg_atw) - (char *)(cdl));
- printf("cfg_rec %lx %lx\n",(long)cdl->cfg_rec,
- (char *)&(cdl->cfg_rec) - (char *)(cdl));
- printf("cfg_spt %x %lx\n", cdl->cfg_spt,
- (char *)&(cdl->cfg_spt) - (char *)(cdl));
- printf("cfg_hds %x %lx\n", cdl->cfg_hds,
- (char *)&(cdl->cfg_hds) - (char *)(cdl));
- printf("cfg_trk %x %lx\n", cdl->cfg_trk,
- (char *)&(cdl->cfg_trk) - (char *)(cdl));
- printf("cfg_ilv %x %lx\n", cdl->cfg_ilv,
- (char *)&(cdl->cfg_ilv) - (char *)(cdl));
- printf("cfg_sof %x %lx\n", cdl->cfg_sof,
- (char *)&(cdl->cfg_sof) - (char *)(cdl));
- printf("cfg_psm %x %lx\n", cdl->cfg_psm,
- (char *)&(cdl->cfg_psm) - (char *)(cdl));
- printf("cfg_shd %x %lx\n", cdl->cfg_shd,
- (char *)&(cdl->cfg_shd) - (char *)(cdl));
- printf("cfg_pcom %x %lx\n", cdl->cfg_pcom,
- (char *)&(cdl->cfg_pcom) - (char *)(cdl));
- printf("cfg_ssr %x %lx\n", cdl->cfg_ssr,
- (char *)&(cdl->cfg_ssr) - (char *)(cdl));
- printf("cfg_rwcc %x %lx\n", cdl->cfg_rwcc,
- (char *)&(cdl->cfg_rwcc) - (char *)(cdl));
- printf("cfg_ecc %x %lx\n", cdl->cfg_ecc,
- (char *)&(cdl->cfg_ecc) - (char *)(cdl));
- printf("cfg_eatm %x %lx\n", cdl->cfg_eatm,
- (char *)&(cdl->cfg_eatm) - (char *)(cdl));
- printf("cfg_eprm %x %lx\n", cdl->cfg_eprm,
- (char *)&(cdl->cfg_eprm) - (char *)(cdl));
- printf("cfg_eatw %x %lx\n", cdl->cfg_eatw,
- (char *)&(cdl->cfg_eatw) - (char *)(cdl));
- printf("cfg_gpb1 %x %lx\n", cdl->cfg_gpb1,
- (char *)&(cdl->cfg_gpb1) - (char *)(cdl));
- printf("cfg_gpb2 %x %lx\n", cdl->cfg_gpb2,
- (char *)&(cdl->cfg_gpb2) - (char *)(cdl));
- printf("cfg_gpb3 %x %lx\n", cdl->cfg_gpb3,
- (char *)&(cdl->cfg_gpb3) - (char *)(cdl));
- printf("cfg_gpb4 %x %lx\n", cdl->cfg_gpb4,
- (char *)&(cdl->cfg_gpb4) - (char *)(cdl));
- printf("cfg_ssc %x %lx\n", cdl->cfg_ssc,
- (char *)&(cdl->cfg_ssc) - (char *)(cdl));
- printf("cfg_runit %x %lx\n", cdl->cfg_runit,
- (char *)&(cdl->cfg_runit) - (char *)(cdl));
- printf("cfg_rsvc1 %x %lx\n", cdl->cfg_rsvc1,
- (char *)&(cdl->cfg_rsvc1) - (char *)(cdl));
- printf("cfg_rsvc2 %x %lx\n", cdl->cfg_rsvc2,
- (char *)&(cdl->cfg_rsvc2) - (char *)(cdl));
-
- return 0;
-}
diff --git a/sys/arch/mvme68k/stand/sboot/Makefile b/sys/arch/mvme68k/stand/sboot/Makefile
deleted file mode 100644
index e79f7b05522..00000000000
--- a/sys/arch/mvme68k/stand/sboot/Makefile
+++ /dev/null
@@ -1,48 +0,0 @@
-# $OpenBSD: Makefile,v 1.13 2013/02/02 13:36:06 miod Exp $
-
-S= ${.CURDIR}/../../../..
-INCL?= -I${.CURDIR} -I${.CURDIR}/../libsa -I${S}/lib/libsa -I${S}
-HOSTCFLAGS?= ${CFLAGS}
-CFLAGS+=-D_STANDALONE
-CFLAGS+=-DSTAGE2_RELOC=${STAGE2_RELOC}
-COPTS?= ${DEFS} ${INCL}
-
-.include "${S}/arch/mvme68k/stand/libbug/Makefile.inc"
-.include "${S}/arch/mvme68k/stand/libsa/Makefile.inc"
-.include "${S}/arch/mvme68k/stand/libz/Makefile.inc"
-
-SRCS= sboot.c clock.c etherfun.c if_le.c
-
-OBJS= ${SRCS:S/.c/.o/g}
-LIBS= ${LIBSA} ${LIBBUG} ${LIBZ}
-LDFLAGS= -static -s -N -T ${S}/arch/mvme68k/stand/ld.script
-CLEANFILES+=XBUG.o XSRT0.o oc_cksum.o sboot.tmp rboot.tmp srec sboot rboot
-MDEC_DIR?=/usr/mdec
-NOPIE=
-
-all: sboot rboot
-
-sboot.tmp: XSRT0.o oc_cksum.o ${OBJS} ${LIBS}
- ${LD} ${LDFLAGS} -Ttext ${STAGE1_RELOC} XSRT0.o ${OBJS} oc_cksum.o -o $@ \
- ${LIBS} `${CC} -print-libgcc-file-name`
-
-rboot.tmp: XBUG.o XSRT0.o oc_cksum.o ${OBJS} ${LIBS}
- ${LD} ${LDFLAGS} -Ttext 0xffa00000 -Tdata 0x4000 XBUG.o XSRT0.o \
- ${OBJS} oc_cksum.o -o $@ ${LIBS} `${CC} -print-libgcc-file-name`
-
-srec: srec.c
- ${HOSTCC} ${HOSTCFLAGS} -o $@ ${.CURDIR}/srec.c
-
-sboot: sboot.tmp srec
- dd ibs=32 skip=1 if=sboot.tmp | ${.OBJDIR}/srec 4 ${STAGE1_RELOC} sboot > sboot
-
-rboot: rboot.tmp srec
- dd ibs=32 skip=1 if=rboot.tmp | ${.OBJDIR}/srec 4 0x4000 rboot > rboot
-
-install:
- ${INSTALL} ${INSTALL_COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
- sboot ${DESTDIR}${MDEC_DIR}/sboot
- ${INSTALL} ${INSTALL_COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
- rboot ${DESTDIR}${MDEC_DIR}/rboot
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/mvme68k/stand/sboot/XBUG.S b/sys/arch/mvme68k/stand/sboot/XBUG.S
deleted file mode 100644
index f79524fabf6..00000000000
--- a/sys/arch/mvme68k/stand/sboot/XBUG.S
+++ /dev/null
@@ -1,71 +0,0 @@
-/* $OpenBSD: XBUG.S,v 1.8 2013/02/02 13:36:06 miod Exp $ */
-
-/*
- * Copyright (c) 1989,1990,1995 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Theo says: I wrote a bootrom for the MVME147 *years* ago. To write
- * this ROM I copied a few chunks from the old bootrom, like this piece:
- *
- * "watch this, the moto bastard struck here, shouldn't have hired people
- * from intel I tried to tell them...
- * "BOOT"
- * offset from baseaddr to entry point.
- * offset from baseaddr to first word after checksum
- * garbage
- * checksum made with CS command
- * No need to change any of this unless you try to take our names out
- * of there. Ie. don't touch."
- */
-
- .text
-bootlabel: .ascii "BOOT"
- .long bootstart-0xffa00000 | for rom install
- .long bootlabelend - bootlabel
- .asciz "VME147 rboot Copyright (c) 1995 Theo de Raadt"
- .align 2
-bootstart: jmp bssclr
- .word 0x229c | XXX bitching cksum!
-bootlabelend:
- .word 0
-
- | clear bss and the kernel location
-bssclr: movl #edata,%a0
- movl #end,%d0
- subl #edata,%d0
-1: clrb %a0@+
- subql #1,%d0
- bpl 1b
-
- | rip the data segment from ROM into ram..
- movl #etext,%a2 | start of data
- movl #0x4000,%a1 | shovel address
- movl #edata,%d0
- subl #etext,%d0
-1: movb %a2@+,%a1@+
- subql #1,%d0
- bpl 1b
-
- bra __start
diff --git a/sys/arch/mvme68k/stand/sboot/XSRT0.S b/sys/arch/mvme68k/stand/sboot/XSRT0.S
deleted file mode 100644
index 17e73b0b1ff..00000000000
--- a/sys/arch/mvme68k/stand/sboot/XSRT0.S
+++ /dev/null
@@ -1,85 +0,0 @@
-/* $OpenBSD: XSRT0.S,v 1.6 2013/02/02 13:36:06 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1995 Charles D. Cranor
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Charles D. Cranor.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
- | start at 0x4000, load at 0xa000, stack at 0x9ff0.
- .text
- .globl __start
-__start: movb #0,reboot
- jra Ldoit
-restart: movb #1,reboot | fall through
-
-Ldoit: movl #0x00006ff0,%sp
- jsr main
-
- .globl __main
-__main: rts
-
-Lname:
- .ascii "sboot\0"
-
- .globl go
-go:
- clrl %d0 | dev lun
- clrl %d1 | ctrl lun
- movl #0x2c, %d4 | flags for IPL
- movl #0xfffe1800, %a0 | address of "disk" ctrl
- movl %sp@(4), %a1 | entry point of loaded program
- movl %d0, %a2 | media config block (NULL)
- movl %sp@(8), %a3 | nb args (start)
- movl %sp@(12), %a4 | nb end args
- movl #Lname, %a5 | args
- movl #Lname+5, %a6 | end args
- | SRT0 will set stack
- jmp %a1@ | GO!
diff --git a/sys/arch/mvme68k/stand/sboot/clock.c b/sys/arch/mvme68k/stand/sboot/clock.c
deleted file mode 100644
index d9a1b040c2e..00000000000
--- a/sys/arch/mvme68k/stand/sboot/clock.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/* $OpenBSD: clock.c,v 1.9 2012/12/31 21:35:32 miod Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- * Copyright (c) 1994 Gordon W. Ross
- * Copyright (c) 1993 Adam Glass
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)clock.c 8.1 (Berkeley) 6/11/93
- */
-
-/*
- * Clock driver.
- */
-
-#include <sys/types.h>
-#include <sys/time.h>
-#include "sboot.h"
-#include "clockreg.h"
-
-static struct clockreg *clockreg = (struct clockreg *) CLOCK_ADDR;
-
-#define LEAPYEAR(y) (((y) & 3) == 0)
-
-/*
- * This code is defunct after 2068.
- * Will Unix still be here then??
- */
-const unsigned short dayyr[12] =
- {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
-
-static unsigned long
-chiptotime(int sec, int min, int hour, int day, int mon, int year)
-{
- int days, yr;
-
- sec = FROMBCD(sec);
- min = FROMBCD(min);
- hour = FROMBCD(hour);
- day = FROMBCD(day);
- mon = FROMBCD(mon);
- year = FROMBCD(year) + YEAR0;
- if (year < 70)
- year = 70;
-
- /* simple sanity checks */
- if (year < 70 || mon < 1 || mon > 12 || day < 1 || day > 31)
- return (0);
- days = 0;
- for (yr = 70; yr < year; yr++)
- days += LEAPYEAR(yr) ? 366 : 365;
- days += dayyr[mon - 1] + day - 1;
- if (LEAPYEAR(yr) && mon > 2)
- days++;
- /* now have days since Jan 1, 1970; the rest is easy... */
- return (days * SECDAY + hour * 3600 + min * 60 + sec);
-}
-
-/*
- * Set up the system's time, given a `reasonable' time value.
- */
-unsigned long
-ttime()
-{
- struct clockreg *cl = clockreg;
- int sec, min, hour, day, mon, year;
-
- cl->cl_csr |= CLK_READ; /* enable read (stop time) */
- sec = cl->cl_sec;
- min = cl->cl_min;
- hour = cl->cl_hour;
- day = cl->cl_mday;
- mon = cl->cl_month;
- year = cl->cl_year;
- cl->cl_csr &= ~CLK_READ;/* time wears on */
- return (chiptotime(sec, min, hour, day, mon, year));
-}
diff --git a/sys/arch/mvme68k/stand/sboot/clockreg.h b/sys/arch/mvme68k/stand/sboot/clockreg.h
deleted file mode 100644
index 11694225b4f..00000000000
--- a/sys/arch/mvme68k/stand/sboot/clockreg.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* $OpenBSD: clockreg.h,v 1.4 2003/06/02 23:27:51 millert Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)clockreg.h 8.1 (Berkeley) 6/11/93
- */
-
-/*
- * Mostek MK48T02 clock.
- */
-struct clockreg {
- volatile u_char cl_csr; /* control register */
- volatile u_char cl_sec; /* seconds (0..59; BCD) */
- volatile u_char cl_min; /* minutes (0..59; BCD) */
- volatile u_char cl_hour; /* hour (0..23; BCD) */
- volatile u_char cl_wday; /* weekday (1..7) */
- volatile u_char cl_mday; /* day in month (1..31; BCD) */
- volatile u_char cl_month; /* month (1..12; BCD) */
- volatile u_char cl_year; /* year (0..99; BCD) */
-};
-
-/* bits in cl_csr */
-#define CLK_WRITE 0x80 /* want to write */
-#define CLK_READ 0x40 /* want to read (freeze clock) */
-
-/*
- * Sun chose the year `68' as their base count, so that
- * cl_year==0 means 1968.
- */
-#define YEAR0 68
diff --git a/sys/arch/mvme68k/stand/sboot/etherfun.c b/sys/arch/mvme68k/stand/sboot/etherfun.c
deleted file mode 100644
index 991f1f8efd3..00000000000
--- a/sys/arch/mvme68k/stand/sboot/etherfun.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/* $OpenBSD: etherfun.c,v 1.9 2012/12/31 21:35:32 miod Exp $ */
-
-/*
- *
- * Copyright (c) 1995 Charles D. Cranor and Seth Widoff
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Charles D. Cranor
- * and Seth Widoff.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/* etherfun.c */
-
-#include <sys/types.h>
-#include <stand.h>
-#include "sboot.h"
-#include "etherfun.h"
-
-/* Construct and send a rev arp packet */
-void
-do_rev_arp(void)
-{
- int i;
-
- for (i = 0; i < 6; i++)
- eh->ether_dhost[i] = 0xff;
-
- bcopy(myea, eh->ether_shost, 6);
- eh->ether_type = ETYPE_RARP;
-
- rarp->ar_hrd = 1; /* hardware type is 1 */
- rarp->ar_pro = PTYPE_IP;
- rarp->ar_hln = 6; /* length of hardware address is 6 bytes */
- rarp->ar_pln = 4; /* length of ip address is 4 byte */
- rarp->ar_op = OPCODE_RARP;
- bcopy(myea, rarp->arp_sha, sizeof(myea));
- bcopy(myea, rarp->arp_tha, sizeof(myea));
- for (i = 0; i < 4; i++)
- rarp->arp_spa[i] = rarp->arp_tpa[i] = 0x00;
-
- le_put(buf, 76);
-}
-
-/* Receive and disassemble the rev_arp reply */
-int
-get_rev_arp(void)
-{
- le_get(buf, sizeof(buf), 6);
- if (eh->ether_type == ETYPE_RARP && rarp->ar_op == OPCODE_REPLY) {
- bcopy(rarp->arp_tpa, myip, sizeof(rarp->arp_tpa));
- bcopy(rarp->arp_spa, servip, sizeof(rarp->arp_spa));
- bcopy(rarp->arp_sha, servea, sizeof(rarp->arp_sha));
- return (1);
- }
- return (0);
-}
-
-/* Try to get a reply to a rev arp request */
-int
-rev_arp(void)
-{
- int tries = 0;
- while (tries < 5) {
- do_rev_arp();
- if (get_rev_arp())
- return (1);
- tries++;
- }
- return (0);
-}
-
-/*
- * Send a tftp read request or acknowledgement
- * mesgtype 0 is a read request, 1 is an
- * acknowledgement
- */
-void
-do_send_tftp(int mesgtype)
-{
- u_long res, iptmp, lcv;
- char *tot;
-
- if (mesgtype == 0) {
- tot = tftp_r + (sizeof(MSG) - 1);
- myport = (u_short)ttime();
- if (myport < 1000)
- myport += 1000;
- servport = FTP_PORT; /* to start */
- } else {
- tot = (char *) tftp_a + 4;
- }
-
- bcopy(servea, eh->ether_dhost, sizeof(servea));
- bcopy(myea, eh->ether_shost, sizeof(myea));
- eh->ether_type = ETYPE_IP;
-
- iph->ip_v = IP_VERSION;
- iph->ip_hl = IP_HLEN;
- iph->ip_tos = 0; /* type of service is 0 */
- iph->ip_id = 0; /* id field is 0 */
- iph->ip_off = IP_DF;
- iph->ip_ttl = 3; /* time to live is 3 seconds/hops */
- iph->ip_p = IPP_UDP;
- bcopy(myip, iph->ip_src, sizeof(myip));
- bcopy(servip, iph->ip_dst, sizeof(servip));
- iph->ip_sum = 0;
- iph->ip_len = tot - (char *) iph;
- res = oc_cksum(iph, sizeof(struct ip), 0);
- iph->ip_sum = 0xffff & ~res;
- udph->uh_sport = myport;
- udph->uh_dport = servport;
- udph->uh_sum = 0;
-
- if (mesgtype) {
- tftp_a->op_code = FTPOP_ACKN;
- tftp_a->block = (u_short) (mesgtype);
- } else {
- bcopy(myip, &iptmp, sizeof(iptmp));
- bcopy(MSG, tftp_r, (sizeof(MSG) - 1));
- for (lcv = 9; lcv >= 2; lcv--) {
- tftp_r[lcv] = "0123456789ABCDEF"[iptmp & 0xF];
-
- iptmp = iptmp >> 4;
- }
- }
-
- udph->uh_ulen = tot - (char *) udph;
-
- le_put(buf, tot - buf);
-}
-
-/* Attempt to tftp a file and read it into memory */
-int
-do_get_file(void)
-{
- int fail = 0, oldlen;
- char *loadat = (char *)STAGE2_RELOC;
- last_ack = 0;
-
- do_send_tftp(READ);
- while (1) {
- if (le_get(buf, sizeof(buf), 5) == 0) {
- /* timeout occurred */
- if (last_ack)
- do_send_tftp(last_ack);
- else
- do_send_tftp(READ);
-
- fail++;
- if (fail > 5) {
- printf("\n");
- return (1);
- }
- } else {
- printf("%x \r", tftp->info.block * 512);
- if ((eh->ether_type != ETYPE_IP) || (iph->ip_p != IPP_UDP)) {
- fail++;
- continue;
- }
- if (servport == FTP_PORT)
- servport = udph->uh_sport;
- if (tftp->info.op_code == FTPOP_ERR) {
- printf("TFTP: Download error %d: %s\n",
- tftp->info.block, tftp->data);
- return (1);
- }
- if (tftp->info.block != last_ack + 1) {
- /* we received the wrong block */
- if (tftp->info.block < last_ack + 1) {
- /* nack whatever we received */
- do_send_tftp(tftp->info.block);
- } else {
- /* nack the last confirmed block */
- do_send_tftp(last_ack);
- }
- fail++;
- } else {/* we got the right block */
- fail = 0;
- last_ack++;
- oldlen = udph->uh_ulen;
- do_send_tftp(last_ack);
- /* printf("bcopy %x %x %d\n", &tftp->data,
- * loadat, oldlen - 12); */
- bcopy(&tftp->data, loadat, oldlen - 12);
- loadat += oldlen - 12;
- if (oldlen < (8 + 4 + 512)) {
- printf("\n");
- return (0);
- }
- }
- }
- }
- printf("\n");
- return (0);
-}
diff --git a/sys/arch/mvme68k/stand/sboot/etherfun.h b/sys/arch/mvme68k/stand/sboot/etherfun.h
deleted file mode 100644
index 97e3924d552..00000000000
--- a/sys/arch/mvme68k/stand/sboot/etherfun.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/* $OpenBSD: etherfun.h,v 1.2 1996/04/28 10:49:37 deraadt Exp $ */
-
-/*
- *
- * Copyright (c) 1995 Charles D. Cranor and Seth Widoff
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Charles D. Cranor
- * and Seth Widoff.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/* etherfun.h */
-
-/* constants */
-/* ether header */
-#define ETYPE_RARP 0x8035 /* ethertype is RARP */
-#define ETYPE_IP 0x800 /* ethertype is IP */
-
-/* rev arp */
-#define PTYPE_IP 0x800 /* Protocol type is IP */
-#define OPCODE_RARP 3 /* Optype is REVARP request */
-#define OPCODE_REPLY 4 /* Optype is REVARP reply */
-
-/* ip header */
-#define IPP_UDP 17 /* IP Protocol is UDP */
-#define IP_VERSION 4 /* IP version number */
-#define IP_HLEN 5 /* IP header length is a fixed 50 bytes */
-#define N 1536
-
-/* tftp header */
-#define FTPOP_ACKN 4 /* Opcode is acknowledge */
-#define FTPOP_ERR 5 /* Opcode is Error */
-#define FTP_PORT 69 /* Standard TFTP port number */
-#define MSG "\0\1xxxxxxxx.mvme68k\0octet\0" /* implicit NULL */
-
-/* data structures */
-
-struct ether_header {
- u_char ether_dhost[6];
- u_char ether_shost[6];
- u_short ether_type;
-};
-
-struct ether_arp {
- u_short ar_hrd; /* format of hardware address */
- u_short ar_pro; /* format of protocol address */
- u_char ar_hln; /* length of hardware address */
- u_char ar_pln; /* length of protocol address */
- u_short ar_op;
- u_char arp_sha[6]; /* sender hardware address */
- u_char arp_spa[4]; /* sender protocol address */
- u_char arp_tha[6]; /* target hardware address */
- u_char arp_tpa[4]; /* target protocol address */
-};
-
-struct ip {
- u_char ip_v:4, /* version */
- ip_hl:4; /* header length */
- u_char ip_tos; /* type of service */
- short ip_len; /* total length */
- u_short ip_id; /* identification */
- short ip_off; /* fragment offset field */
-#define IP_DF 0x4000 /* dont fragment flag */
-#define IP_MF 0x2000 /* more fragments flag */
-#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
- u_char ip_ttl; /* time to live */
- u_char ip_p; /* protocol */
- u_short ip_sum; /* checksum */
- u_char ip_src[4];
- u_char ip_dst[4]; /* source and dest address */
-};
-
-struct udp {
- u_short uh_sport;
- u_short uh_dport;
- short uh_ulen;
- u_short uh_sum;
-};
-
-struct tftph {
- u_short op_code;
- u_short block;
-};
-
-struct tftphr {
- struct tftph info;
- char data[1];
-};
-
-/* globals */
-int last_ack;
-char buf[N];
-struct ether_header *eh = (struct ether_header *)buf;
-struct ether_arp *rarp = (struct ether_arp *)
- (buf + sizeof(struct ether_header));
-struct ip *iph = (struct ip *)(buf + sizeof(struct ether_header));
-struct udp *udph = (struct udp *)
- (buf + sizeof(struct ether_header) + sizeof(struct ip));
-char *tftp_r = buf + sizeof(struct ether_header) + sizeof(struct ip) +
- sizeof(struct udp);
-struct tftph *tftp_a = (struct tftph *)(buf + sizeof(struct ether_header) +
- sizeof(struct ip) + sizeof(struct udp));
-struct tftphr *tftp = (struct tftphr *)(buf + sizeof(struct ether_header) +
- sizeof(struct ip) + sizeof(struct udp));
diff --git a/sys/arch/mvme68k/stand/sboot/if_le.c b/sys/arch/mvme68k/stand/sboot/if_le.c
deleted file mode 100644
index 2d502bbfb57..00000000000
--- a/sys/arch/mvme68k/stand/sboot/if_le.c
+++ /dev/null
@@ -1,340 +0,0 @@
-/* $OpenBSD: if_le.c,v 1.9 2012/12/31 21:35:32 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1993 Adam Glass
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Adam Glass.
- * 4. The name of the Author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/types.h>
-#include <stand.h>
-#include "sboot.h"
-#include "if_lereg.h"
-
-struct {
- struct lereg1 *sc_r1; /* LANCE registers */
- struct lereg2 *sc_r2; /* RAM */
- int next_rmd;
- int next_tmd;
-} le_softc;
-
-void
-le_error(char *str, struct lereg1 *ler1)
-{
- /* ler1->ler1_rap = LE_CSRO done in caller */
- if (ler1->ler1_rdp & LE_C0_BABL) {
- printf("le0: been babbling, found by '%s'\n", str);
- callrom();
- }
- if (ler1->ler1_rdp & LE_C0_CERR) {
- ler1->ler1_rdp = LE_C0_CERR;
- }
- if (ler1->ler1_rdp & LE_C0_MISS) {
- ler1->ler1_rdp = LE_C0_MISS;
- }
- if (ler1->ler1_rdp & LE_C0_MERR) {
- printf("le0: memory error in '%s'\n", str);
- callrom();
- }
-}
-
-void
-le_reset(u_char *myea)
-{
- struct lereg1 *ler1 = le_softc.sc_r1;
- struct lereg2 *ler2 = le_softc.sc_r2;
- unsigned int a;
- int timo = 100000, stat = 0, i;
-
- ler1->ler1_rap = LE_CSR0;
- ler1->ler1_rdp = LE_C0_STOP; /* do nothing until we are finished */
-
- bzero(ler2, sizeof(*ler2));
-
- ler2->ler2_mode = LE_MODE_NORMAL;
- ler2->ler2_padr[0] = myea[1];
- ler2->ler2_padr[1] = myea[0];
- ler2->ler2_padr[2] = myea[3];
- ler2->ler2_padr[3] = myea[2];
- ler2->ler2_padr[4] = myea[5];
- ler2->ler2_padr[5] = myea[4];
-
- ler2->ler2_ladrf0 = 0;
- ler2->ler2_ladrf1 = 0;
-
- a = (u_int) ler2->ler2_rmd;
- ler2->ler2_rlen = LE_RLEN | (a >> 16);
- ler2->ler2_rdra = a & LE_ADDR_LOW_MASK;
-
- a = (u_int) ler2->ler2_tmd;
- ler2->ler2_tlen = LE_TLEN | (a >> 16);
- ler2->ler2_tdra = a & LE_ADDR_LOW_MASK;
-
- ler1->ler1_rap = LE_CSR1;
- a = (u_int) ler2;
- ler1->ler1_rdp = a & LE_ADDR_LOW_MASK;
- ler1->ler1_rap = LE_CSR2;
- ler1->ler1_rdp = a >> 16;
-
- for (i = 0; i < LERBUF; i++) {
- a = (u_int) & ler2->ler2_rbuf[i];
- ler2->ler2_rmd[i].rmd0 = a & LE_ADDR_LOW_MASK;
- ler2->ler2_rmd[i].rmd1_bits = LE_R1_OWN;
- ler2->ler2_rmd[i].rmd1_hadr = a >> 16;
- ler2->ler2_rmd[i].rmd2 = -LEMTU;
- ler2->ler2_rmd[i].rmd3 = 0;
- }
- for (i = 0; i < LETBUF; i++) {
- a = (u_int) & ler2->ler2_tbuf[i];
- ler2->ler2_tmd[i].tmd0 = a & LE_ADDR_LOW_MASK;
- ler2->ler2_tmd[i].tmd1_bits = 0;
- ler2->ler2_tmd[i].tmd1_hadr = a >> 16;
- ler2->ler2_tmd[i].tmd2 = 0;
- ler2->ler2_tmd[i].tmd3 = 0;
- }
-
- ler1->ler1_rap = LE_CSR3;
- ler1->ler1_rdp = LE_C3_BSWP;
-
- ler1->ler1_rap = LE_CSR0;
- ler1->ler1_rdp = LE_C0_INIT;
- do {
- if (--timo == 0) {
- printf("le0: init timeout, stat = 0x%x\n", stat);
- break;
- }
- stat = ler1->ler1_rdp;
- } while ((stat & LE_C0_IDON) == 0);
-
- ler1->ler1_rdp = LE_C0_IDON;
- le_softc.next_rmd = 0;
- le_softc.next_tmd = 0;
- ler1->ler1_rap = LE_CSR0;
- ler1->ler1_rdp = LE_C0_STRT;
-}
-
-int
-le_poll(void *pkt, int len)
-{
- struct lereg1 *ler1 = le_softc.sc_r1;
- struct lereg2 *ler2 = le_softc.sc_r2;
- unsigned int a;
- int length;
- struct lermd *rmd;
-
- ler1->ler1_rap = LE_CSR0;
- if ((ler1->ler1_rdp & LE_C0_RINT) != 0)
- ler1->ler1_rdp = LE_C0_RINT;
- rmd = &ler2->ler2_rmd[le_softc.next_rmd];
- if (rmd->rmd1_bits & LE_R1_OWN) {
- return (0);
- }
- if (ler1->ler1_rdp & LE_C0_ERR)
- le_error("le_poll", ler1);
- if (rmd->rmd1_bits & LE_R1_ERR) {
- printf("le0_poll: rmd status 0x%x\n", rmd->rmd1_bits);
- length = 0;
- goto cleanup;
- }
- if ((rmd->rmd1_bits & (LE_R1_STP | LE_R1_ENP)) != (LE_R1_STP | LE_R1_ENP)) {
- printf("le_poll: chained packet\n");
- callrom();
- }
- length = rmd->rmd3;
- if (length >= LEMTU) {
- length = 0;
- printf("csr0 when bad things happen: %x\n", ler1->ler1_rdp);
- callrom();
- goto cleanup;
- }
- if (!length)
- goto cleanup;
- length -= 4;
- if (length > 0)
- bcopy((char *) &ler2->ler2_rbuf[le_softc.next_rmd], pkt, length);
-
-cleanup:
- a = (u_int) & ler2->ler2_rbuf[le_softc.next_rmd];
- rmd->rmd0 = a & LE_ADDR_LOW_MASK;
- rmd->rmd1_hadr = a >> 16;
- rmd->rmd2 = -LEMTU;
- le_softc.next_rmd =
- (le_softc.next_rmd == (LERBUF - 1)) ? 0 : (le_softc.next_rmd + 1);
- rmd->rmd1_bits = LE_R1_OWN;
- return length;
-}
-
-int
-le_put(u_char *pkt, size_t len)
-{
- struct lereg1 *ler1 = le_softc.sc_r1;
- struct lereg2 *ler2 = le_softc.sc_r2;
- struct letmd *tmd;
- int timo = 100000, stat = 0;
- unsigned int a;
-
- ler1->ler1_rap = LE_CSR0;
- if (ler1->ler1_rdp & LE_C0_ERR)
- le_error("le_put(way before xmit)", ler1);
- tmd = &ler2->ler2_tmd[le_softc.next_tmd];
- while (tmd->tmd1_bits & LE_T1_OWN) {
- printf("le0: output buffer busy\n");
- }
- bcopy(pkt, (char *) ler2->ler2_tbuf[le_softc.next_tmd], len);
- if (len < 64)
- tmd->tmd2 = -64;
- else
- tmd->tmd2 = -len;
- tmd->tmd3 = 0;
- if (ler1->ler1_rdp & LE_C0_ERR)
- le_error("le_put(before xmit)", ler1);
- tmd->tmd1_bits = LE_T1_STP | LE_T1_ENP | LE_T1_OWN;
- a = (u_int) & ler2->ler2_tbuf[le_softc.next_tmd];
- tmd->tmd0 = a & LE_ADDR_LOW_MASK;
- tmd->tmd1_hadr = a >> 16;
- ler1->ler1_rdp = LE_C0_TDMD;
- if (ler1->ler1_rdp & LE_C0_ERR)
- le_error("le_put(after xmit)", ler1);
- do {
- if (--timo == 0) {
- printf("le0: transmit timeout, stat = 0x%x\n",
- stat);
- if (ler1->ler1_rdp & LE_C0_ERR)
- le_error("le_put(timeout)", ler1);
- break;
- }
- stat = ler1->ler1_rdp;
- } while ((stat & LE_C0_TINT) == 0);
- ler1->ler1_rdp = LE_C0_TINT;
- if (ler1->ler1_rdp & LE_C0_ERR) {
- if ((ler1->ler1_rdp & (LE_C0_BABL | LE_C0_CERR | LE_C0_MISS | LE_C0_MERR)) !=
- LE_C0_CERR)
- printf("le_put: xmit error, buf %d\n", le_softc.next_tmd);
- le_error("le_put(xmit error)", ler1);
- }
- le_softc.next_tmd = 0;
-/* (le_softc.next_tmd == (LETBUF - 1)) ? 0 : le_softc.next_tmd + 1;*/
- if (tmd->tmd1_bits & LE_T1_ERR) {
- printf("le0: transmit error, error = 0x%x\n",
- tmd->tmd3);
- return -1;
- }
- return len;
-}
-
-int
-le_get(u_char *pkt, size_t len, u_long timeout)
-{
- int cc;
- int now, then;
- int stopat = ttime() + timeout;
- then = 0;
-
- cc = 0;
- while ((now = ttime()) < stopat && !cc) {
- cc = le_poll(pkt, len);
- if (then != now) {
-#ifdef LE_DEBUG
- printf("%d \r", stopat - now);
-#endif
- then = now;
- }
- if (cc && (pkt[0] != myea[0] || pkt[1] != myea[1] ||
- pkt[2] != myea[2] || pkt[3] != myea[3] ||
- pkt[4] != myea[4] || pkt[5] != myea[5])) {
- cc = 0; /* ignore broadcast / multicast */
-#ifdef LE_DEBUG
- printf("reject (%d sec left)\n", stopat - now);
-#endif
- }
- }
-#ifdef LE_DEBUG
- printf("\n");
-#endif
- return cc;
-}
-
-void
-le_init(void)
-{
- int *ea = (int *) LANCE_ADDR;
- u_long *eram = (u_long *) ERAM_ADDR;
- u_long e = *ea;
-
- if ((e & 0x2fffff00) == 0x2fffff00) {
- printf("ERROR: ethernet address not set! Use LSAD.\n");
- callrom();
- }
- myea[0] = 0x08;
- myea[1] = 0x00;
- myea[2] = 0x3e;
- e = e >> 8;
- myea[5] = e & 0xff;
- e = e >> 8;
- myea[4] = e & 0xff;
- e = e >> 8;
- myea[3] = e;
- printf("le0: ethernet address: %x:%x:%x:%x:%x:%x\n",
- myea[0], myea[1], myea[2], myea[3], myea[4], myea[5]);
- bzero(&le_softc, sizeof(le_softc));
- le_softc.sc_r1 = (struct lereg1 *) LANCE_REG_ADDR;
- le_softc.sc_r2 = (struct lereg2 *) (*eram - (1024 * 1024));
- le_reset(myea);
-}
-
-void
-le_end(void)
-{
- struct lereg1 *ler1 = le_softc.sc_r1;
-
- ler1->ler1_rap = LE_CSR0;
- ler1->ler1_rdp = LE_C0_STOP;
-}
diff --git a/sys/arch/mvme68k/stand/sboot/if_lereg.h b/sys/arch/mvme68k/stand/sboot/if_lereg.h
deleted file mode 100644
index 9adc3de7132..00000000000
--- a/sys/arch/mvme68k/stand/sboot/if_lereg.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/* $OpenBSD: if_lereg.h,v 1.5 2003/06/02 23:27:51 millert Exp $ */
-
-/*-
- * Copyright (c) 1982, 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)if_lereg.h 8.2 (Berkeley) 10/30/93
- */
-
-#define LEMTU 1518
-#define LEMINSIZE 60 /* should be 64 if mode DTCR is set */
-#define LERBUF 8
-#define LERBUFLOG2 3
-#define LE_RLEN (LERBUFLOG2 << 13)
-#define LETBUF 1
-#define LETBUFLOG2 0
-#define LE_TLEN (LETBUFLOG2 << 13)
-
-/* Local Area Network Controller for Ethernet (LANCE) registers */
-struct lereg1 {
- volatile u_short ler1_rdp; /* register data port */
- volatile u_short ler1_rap; /* register address port */
-};
-
-/* register addresses */
-#define LE_CSR0 0 /* Control and status register */
-#define LE_CSR1 1 /* low address of init block */
-#define LE_CSR2 2 /* high address of init block */
-#define LE_CSR3 3 /* Bus master and control */
-
-/* Control and status register 0 (csr0) */
-#define LE_C0_ERR 0x8000 /* error summary */
-#define LE_C0_BABL 0x4000 /* transmitter timeout error */
-#define LE_C0_CERR 0x2000 /* collision */
-#define LE_C0_MISS 0x1000 /* missed a packet */
-#define LE_C0_MERR 0x0800 /* memory error */
-#define LE_C0_RINT 0x0400 /* receiver interrupt */
-#define LE_C0_TINT 0x0200 /* transmitter interrupt */
-#define LE_C0_IDON 0x0100 /* initialization done */
-#define LE_C0_INTR 0x0080 /* interrupt condition */
-#define LE_C0_INEA 0x0040 /* interrupt enable */
-#define LE_C0_RXON 0x0020 /* receiver on */
-#define LE_C0_TXON 0x0010 /* transmitter on */
-#define LE_C0_TDMD 0x0008 /* transmit demand */
-#define LE_C0_STOP 0x0004 /* disable all external activity */
-#define LE_C0_STRT 0x0002 /* enable external activity */
-#define LE_C0_INIT 0x0001 /* begin initialization */
-
-#define LE_C0_BITS \
- "\20\20ERR\17BABL\16CERR\15MISS\14MERR\13RINT\
-\12TINT\11IDON\10INTR\07INEA\06RXON\05TXON\04TDMD\03STOP\02STRT\01INIT"
-
-/* Control and status register 3 (csr3) */
-#define LE_C3_BSWP 0x4 /* byte swap */
-#define LE_C3_ACON 0x2 /* ALE control, eh? */
-#define LE_C3_BCON 0x1 /* byte control */
-/*
- * Current size is 13,758 bytes with 8 x 1518 receive buffers and
- * 1 x 1518 transmit buffer.
- */
-struct lereg2 {
- /* initialization block */
- volatile u_short ler2_mode; /* mode */
- volatile u_char ler2_padr[6]; /* physical address */
-#ifdef new_code
- volatile u_short ler2_ladrf[4]; /* logical address filter */
-#else
- volatile u_long ler2_ladrf0; /* logical address filter */
- volatile u_long ler2_ladrf1; /* logical address filter */
-#endif
- volatile u_short ler2_rdra; /* receive descriptor addr */
- volatile u_short ler2_rlen; /* rda high and ring size */
- volatile u_short ler2_tdra; /* transmit descriptor addr */
- volatile u_short ler2_tlen; /* tda high and ring size */
- /* receive message descriptors. bits/hadr are byte order dependent. */
- struct lermd {
- volatile u_short rmd0; /* low address of packet */
- volatile u_char rmd1_bits; /* descriptor bits */
- volatile u_char rmd1_hadr; /* high address of packet */
- volatile short rmd2; /* buffer byte count */
- volatile u_short rmd3; /* message byte count */
- } ler2_rmd[LERBUF];
- /* transmit message descriptors */
- struct letmd {
- volatile u_short tmd0; /* low address of packet */
- volatile u_char tmd1_bits; /* descriptor bits */
- volatile u_char tmd1_hadr; /* high address of packet */
- volatile short tmd2; /* buffer byte count */
- volatile u_short tmd3; /* transmit error bits */
- } ler2_tmd[LETBUF];
- volatile char ler2_rbuf[LERBUF][LEMTU];
- volatile char ler2_tbuf[LETBUF][LEMTU];
-};
-
-/* Initialzation block (mode) */
-#define LE_MODE_PROM 0x8000 /* promiscuous mode */
-/* 0x7f80 reserved, must be zero */
-#define LE_MODE_INTL 0x0040 /* internal loopback */
-#define LE_MODE_DRTY 0x0020 /* disable retry */
-#define LE_MODE_COLL 0x0010 /* force a collision */
-#define LE_MODE_DTCR 0x0008 /* disable transmit CRC */
-#define LE_MODE_LOOP 0x0004 /* loopback mode */
-#define LE_MODE_DTX 0x0002 /* disable transmitter */
-#define LE_MODE_DRX 0x0001 /* disable receiver */
-#define LE_MODE_NORMAL 0 /* none of the above */
-
-
-/* Receive message descriptor 1 (rmd1_bits) */
-#define LE_R1_OWN 0x80 /* LANCE owns the packet */
-#define LE_R1_ERR 0x40 /* error summary */
-#define LE_R1_FRAM 0x20 /* framing error */
-#define LE_R1_OFLO 0x10 /* overflow error */
-#define LE_R1_CRC 0x08 /* CRC error */
-#define LE_R1_BUFF 0x04 /* buffer error */
-#define LE_R1_STP 0x02 /* start of packet */
-#define LE_R1_ENP 0x01 /* end of packet */
-
-#define LE_R1_BITS \
- "\20\10OWN\7ERR\6FRAM\5OFLO\4CRC\3BUFF\2STP\1ENP"
-
-/* Transmit message descriptor 1 (tmd1_bits) */
-#define LE_T1_OWN 0x80 /* LANCE owns the packet */
-#define LE_T1_ERR 0x40 /* error summary */
-#define LE_T1_MORE 0x10 /* multiple collisions */
-#define LE_T1_ONE 0x08 /* single collision */
-#define LE_T1_DEF 0x04 /* defferred transmit */
-#define LE_T1_STP 0x02 /* start of packet */
-#define LE_T1_ENP 0x01 /* end of packet */
-
-#define LE_T1_BITS \
- "\20\10OWN\7ERR\6RES\5MORE\4ONE\3DEF\2STP\1ENP"
-
-/* Transmit message descriptor 3 (tmd3) */
-#define LE_T3_BUFF 0x8000 /* buffer error */
-#define LE_T3_UFLO 0x4000 /* underflow error */
-#define LE_T3_LCOL 0x1000 /* late collision */
-#define LE_T3_LCAR 0x0800 /* loss of carrier */
-#define LE_T3_RTRY 0x0400 /* retry error */
-#define LE_T3_TDR_MASK 0x03ff /* time domain reflectometry counter */
-
-#define LE_XMD2_ONES 0xf000
-
-#define LE_T3_BITS \
- "\20\20BUFF\17UFLO\16RES\15LCOL\14LCAR\13RTRY"
-
-
-#define LE_ADDR_LOW_MASK (0xffff)
-
diff --git a/sys/arch/mvme68k/stand/sboot/oc_cksum.S b/sys/arch/mvme68k/stand/sboot/oc_cksum.S
deleted file mode 100644
index 2e14d08c778..00000000000
--- a/sys/arch/mvme68k/stand/sboot/oc_cksum.S
+++ /dev/null
@@ -1,183 +0,0 @@
-| $OpenBSD: oc_cksum.S,v 1.5 2013/02/02 13:36:06 miod Exp $
-
-| Copyright (c) 1988 Regents of the University of California.
-| All rights reserved.
-|
-| Redistribution and use in source and binary forms, with or without
-| modification, are permitted provided that the following conditions
-| are met:
-| 1. Redistributions of source code must retain the above copyright
-| notice, this list of conditions and the following disclaimer.
-| 2. Redistributions in binary form must reproduce the above copyright
-| notice, this list of conditions and the following disclaimer in the
-| documentation and/or other materials provided with the distribution.
-| 3. Neither the name of the University nor the names of its contributors
-| may be used to endorse or promote products derived from this software
-| without specific prior written permission.
-|
-| THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-| ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-| IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-| ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-| FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-| DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-| OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-| HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-| LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-| OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-| SUCH DAMAGE.
-|
-| @(#)oc_cksum.s 7.2 (Berkeley) 11/3/90
-|
-|
-| oc_cksum: ones complement 16 bit checksum for MC68020.
-|
-| oc_cksum (buffer, count, strtval)
-|
-| Do a 16 bit ones complement sum of 'count' bytes from 'buffer'.
-| 'strtval' is the starting value of the sum (usually zero).
-|
-| It simplifies life in in_cksum if strtval can be >= 2^16.
-| This routine will work as long as strtval is < 2^31.
-|
-| Performance
-| -----------
-| This routine is intended for MC 68020s but should also work
-| for 68030s. It (deliberately) does not worry about the alignment
-| of the buffer so will only work on a 68010 if the buffer is
-| aligned on an even address. (Also, a routine written to use
-| 68010 "loop mode" would almost certainly be faster than this
-| code on a 68010).
-|
-| We do not worry about alignment because this routine is frequently
-| called with small counts: 20 bytes for IP header checksums and 40
-| bytes for TCP ack checksums. For these small counts, testing for
-| bad alignment adds ~10% to the per-call cost. Since, by the nature
-| of the kernel allocator, the data we are called with is almost
-| always longword aligned, there is no benefit to this added cost
-| and we are better off letting the loop take a big performance hit
-| in the rare cases where we are handed an unaligned buffer.
-|
-| Loop unrolling constants of 2, 4, 8, 16, 32 and 64 times were
-| tested on random data on four different types of processors (see
-| list below -- 64 was the largest unrolling because anything more
-| overflows the 68020 Icache). On all the processors, the
-| throughput asymptote was located between 8 and 16 (closer to 8).
-| However, 16 was substantially better than 8 for small counts.
-| (It is clear why this happens for a count of 40: unroll-8 pays a
-| loop branch cost and unroll-16 does not. But the tests also showed
-| that 16 was better than 8 for a count of 20. It is not obvious to
-| me why.) So, since 16 was good for both large and small counts,
-| the loop below is unrolled 16 times.
-|
-| The processors tested and their average time to checksum 1024 bytes
-| of random data were:
-| Sun 3/50 (15MHz) 190 us/KB
-| Sun 3/180 (16.6MHz) 175 us/KB
-| Sun 3/60 (20MHz) 134 us/KB
-| Sun 3/280 (25MHz) 95 us/KB
-|
-| The cost of calling this routine was typically 10% of the per-
-| kilobyte cost. E.g., checksumming zero bytes on a 3/60 cost 9us
-| and each additional byte cost 125ns. With the high fixed cost,
-| it would clearly be a gain to "inline" this routine -- the
-| subroutine call adds 400% overhead to an IP header checksum.
-| However, in absolute terms, inlining would only gain 10us per
-| packet -- a 1% effect for a 1ms ethernet packet. This is not
-| enough gain to be worth the effort.
-
-#include <machine/asm.h>
-
- .text
-
-ENTRY(oc_cksum)
- movl %sp@(4),%a0 | get buffer ptr
- movl %sp@(8),%d1 | get byte count
- movl %sp@(12),%d0 | get starting value
- movl %d2,%sp@- | free a reg
-
- | test for possible 1, 2 or 3 bytes of excess at end
- | of buffer. The usual case is no excess (the usual
- | case is header checksums) so we give that the faster
- | 'not taken' leg of the compare. (We do the excess
- | first because we are about the trash the low order
- | bits of the count in d1.)
-
- btst #0,%d1
- jne L5 | if one or three bytes excess
- btst #1,%d1
- jne L7 | if two bytes excess
-L1:
- movl %d1,%d2
- lsrl #6,%d1 | make cnt into # of 64 byte chunks
- andl #0x3c,%d2 | then find fractions of a chunk
- negl %d2
- andb #0xf,%cc | clear X
- jmp %pc@(L3-.-2:b,%d2)
-L2:
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
- movl %a0@+,%d2
- addxl %d2,%d0
-L3:
- dbra %d1,L2 | (NB- dbra does not affect X)
-
- movl %d0,%d1 | fold 32 bit sum to 16 bits
- swap %d1 | (NB- swap does not affect X)
- addxw %d1,%d0
- jcc L4
- addw #1,%d0
-L4:
- andl #0xffff,%d0
- movl %sp@+,%d2
- rts
-
-L5: | deal with 1 or 3 excess bytes at the end of the buffer.
- btst #1,%d1
- jeq L6 | if 1 excess
-
- | 3 bytes excess
- clrl %d2
- movw %a0@(-3,%d1:l),%d2 | add in last full word then drop
- addl %d2,%d0 | through to pick up last byte
-
-L6: | 1 byte excess
- clrl %d2
- movb %a0@(-1,%d1:l),%d2
- lsll #8,%d2
- addl %d2,%d0
- jra L1
-
-L7: | 2 bytes excess
- clrl %d2
- movw %a0@(-2,%d1:l),%d2
- addl %d2,%d0
- jra L1
diff --git a/sys/arch/mvme68k/stand/sboot/sboot.c b/sys/arch/mvme68k/stand/sboot/sboot.c
deleted file mode 100644
index e5d042bd8a3..00000000000
--- a/sys/arch/mvme68k/stand/sboot/sboot.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/* $OpenBSD: sboot.c,v 1.12 2012/12/31 21:35:32 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1995 Charles D. Cranor and Seth Widoff
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Charles D. Cranor
- * and Seth Widoff.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/types.h>
-#include "stand.h"
-#include "sboot.h"
-
-int
-main(int argc, char *argv[])
-{
- char buf[128], *ebuf;
-
- buf[0] = '0';
- printf("\nsboot: MVME147 bootstrap program\n");
- while (1) {
- printf(">>> ");
- ebuf = ngets(buf, sizeof(buf));
- do_cmd(buf, ebuf);
- }
- /* not reached */
-}
-
-/*
- * exit to rom
- */
-void
-callrom(void)
-{
- asm("trap #15; .word 0x0063");
-}
-
-/*
- * do_cmd: do a command
- */
-void
-do_cmd(char *buf, char *ebuf)
-{
- switch (*buf) {
- case '\0':
- break;
- case 'a':
- if (rev_arp()) {
- printf("My ip address is: %d.%d.%d.%d\n", myip[0],
- myip[1], myip[2], myip[3]);
- printf("Server ip address is: %d.%d.%d.%d\n", servip[0],
- servip[1], servip[2], servip[3]);
- } else {
- printf("Failed.\n");
- }
- break;
- case 'q':
- printf("exiting to ROM\n");
- callrom();
- break;
- case 'f':
- if (do_get_file() == 1) {
- printf("Download Failed\n");
- } else {
- printf("Download was a success!\n");
- }
- break;
- case 'b':
- le_init();
- if (rev_arp()) {
- printf("client IP address %d.%d.%d.%d\n", myip[0],
- myip[1], myip[2], myip[3]);
- printf("server IP address %d.%d.%d.%d\n", servip[0],
- servip[1], servip[2], servip[3]);
- } else {
- printf("REVARP: Failed.\n");
- return;
- }
- if (do_get_file() == 1) {
- printf("Download Failed\n");
- return;
- } else {
- printf("received secondary boot program.\n");
- }
- if (*++buf == '\0')
- buf = " bsd";
- go(STAGE2_RELOC, buf+1, ebuf);
- break;
- case 'h':
- case '?':
- printf("valid commands\n");
- printf("a - send a RARP\n");
- printf("b - boot the system\n");
- printf("q - exit to ROM\n");
- printf("f - ftp the boot file\n");
- printf("g - execute the boot file\n");
- printf("h - help\n");
- printf("i - init LANCE enet chip\n");
- break;
- case 'i':
- le_init();
- break;
- case 'g':
- go(STAGE2_RELOC, buf+1, ebuf);
- break;
- default:
- printf("sboot: %s: Unknown command\n", buf);
- }
-}
-
-/*
- * ngets: get string from console
- */
-char *
-ngets(char * str, int size)
-{
- int i = 0;
-
- while ((i < size - 1) && (str[i] = getchar()) != '\r') {
- if (str[i] == '\b' || str[i] == 0x7F) {
- if (i == 0)
- continue;
- i--;
- printf("\b \b");
- continue;
- }
- putchar(str[i]);
- i++;
- }
- printf("\n");
- str[i] = '\0';
- return(&str[i]);
-}
diff --git a/sys/arch/mvme68k/stand/sboot/sboot.h b/sys/arch/mvme68k/stand/sboot/sboot.h
deleted file mode 100644
index 320d69a11d8..00000000000
--- a/sys/arch/mvme68k/stand/sboot/sboot.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* $OpenBSD: sboot.h,v 1.10 2012/12/31 21:35:32 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Charles D. Cranor and Seth Widoff
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Charles D. Cranor
- * and Seth Widoff.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * sboot.h: stuff for MVME147's serial line boot
- */
-
-void go(unsigned int, const char *, const char *);
-
-/* console */
-char *ngets(char *, int);
-
-/* sboot */
-void callrom(void);
-void do_cmd(char *, char *);
-
-/* le */
-#define LANCE_ADDR 0xfffe0778
-#define ERAM_ADDR 0xfffe0774
-#define LANCE_REG_ADDR 0xfffe1800
-void le_end(void);
-void le_init(void);
-int le_get(u_char *, size_t, u_long);
-int le_put(u_char *, size_t);
-
-/* etherfun */
-#define READ 0
-#define ACKN 1
-void do_rev_arp(void);
-int get_rev_arp(void);
-int rev_arp(void);
-void do_send_tftp(int);
-int do_get_file(void);
-void tftp_file(char *, u_long);
-
-/* clock */
-u_long ttime(void);
-
-/* checksum */
-u_long oc_cksum(void *, u_long, u_long);
-
-#define CONS_ZS_ADDR (0xfffe3002)
-#define CLOCK_ADDR (0xfffe07f8)
-
-unsigned char myea[6]; /* my ether addr */
-unsigned char myip[4];
-unsigned char servip[4];
-unsigned char servea[6];
-u_short myport;
-u_short servport;
-unsigned char reboot;
diff --git a/sys/arch/mvme68k/stand/sboot/srec.c b/sys/arch/mvme68k/stand/sboot/srec.c
deleted file mode 100644
index 7e7050c4650..00000000000
--- a/sys/arch/mvme68k/stand/sboot/srec.c
+++ /dev/null
@@ -1,170 +0,0 @@
-/* $OpenBSD: srec.c,v 1.7 2012/12/31 21:35:32 miod Exp $ */
-
-/*
- * Public domain, believed to be by Mike Price.
- *
- * convert binary file to Srecord format
- */
-#include <unistd.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
-size_t get32(char *, size_t);
-void put32(size_t, uint32_t, const char *, uint32_t, uint32_t);
-void sput(const char *);
-void put(int);
-int checksum(uint32_t, const char *, size_t, uint32_t);
-
-__dead void
-usage(const char *progname)
-{
- fprintf(stderr, "usage: %s {size} {hex_addr} {name}\n", progname);
- fprintf(stderr, "Size = 2, 3, or 4 byte address\n");
- exit(1);
-}
-
-int
-main(int argc, char *argv[])
-{
- char buf[32], *name;
- uint32_t base, addr, mask, size;
- size_t cc;
-
- if (argc != 4)
- usage(argv[0]);
- sscanf(argv[1], "%x", &size);
- sscanf(argv[2], "%x", &base);
- name = argv[3];
-
- switch (size) {
- case 2:
- printf("S0%02lX%04X", 2 + strlen(name) + 1, 0);
- mask = 0x0000ffff;
- break;
- case 3:
- printf("S0%02lX%06X", 3 + strlen(name) + 1, 0);
- mask = 0x00ffffff;
- break;
- case 4:
- printf("S0%02lX%08X", 4 + strlen(name) + 1, 0);
- mask = 0xffffffff;
- break;
- default:
- usage(argv[0]);
- /* NOTREACHED */
- }
- sput(name);
- printf("%02X\n", checksum(0, name, strlen(name), size));
-
- addr = base;
- for (;;) {
- cc = get32(buf, sizeof buf);
- if (cc > 0) {
- put32(cc, addr, buf, size, mask);
- addr += cc;
- } else
- break;
- }
-
- buf[0] = base >> 8;
- buf[1] = base;
- printf("S%d%02X", 11 - size, 2 + 1);
- switch (size) {
- default:
- case 2:
- printf("%04X", base & mask);
- break;
- case 3:
- printf("%06X", base & mask);
- break;
- case 4:
- printf("%08X", base & mask);
- break;
- }
-
- /*
- * kludge -> some sizes need an extra count (1 if size == 3, 2 if
- * size == 4). Don't ask why.
- */
- printf("%02X\n", checksum(base, (char *) 0, 0, size) + (size - 2));
- exit(0);
-}
-
-size_t
-get32(char *buf, size_t sz)
-{
- char *cp = buf;
- size_t i;
- int c;
-
- for (i = 0; i < sz; i++) {
- if ((c = getchar()) != EOF)
- *cp++ = c;
- else
- break;
- }
- return (cp - buf);
-}
-
-void
-put32(size_t len, uint32_t addr, const char *buf, uint32_t size, uint32_t mask)
-{
- const char *cp = buf;
- size_t i;
-
- switch (size) {
- case 2:
- printf("S1%02lX%04X", 2 + len + 1, addr & mask);
- break;
- case 3:
- printf("S2%02lX%06X", 3 + len + 1, addr & mask);
- break;
- case 4:
- printf("S3%02lX%08X", 4 + len + 1, addr & mask);
- break;
- }
- for (i = 0; i < len; ++i)
- put(*cp++);
- printf("%02X\n", checksum(addr, buf, len, size));
-}
-
-void
-sput(const char *s)
-{
- while (*s != '\0')
- put(*s++);
-}
-
-void
-put(int c)
-{
- printf("%02X", c & 0xff);
-}
-
-int
-checksum(uint32_t addr, const char *buf, size_t len, uint32_t size)
-{
- const char *cp = buf;
- int sum = 0xff - 1 - size - (len & 0xff);
- size_t i;
-
- switch (size) {
- case 4:
- sum -= (addr >> 24) & 0xff;
- /* FALLTHROUGH */
- case 3:
- sum -= (addr >> 16) & 0xff;
- /* FALLTHROUGH */
- case 2:
- sum -= (addr >> 8) & 0xff;
- sum -= addr & 0xff;
- break;
- }
- for (i = 0; i < len; ++i) {
- sum -= *cp++ & 0xff;
- }
- return (sum & 0xff);
-}
diff --git a/sys/arch/mvme68k/stand/wrtvid/Makefile b/sys/arch/mvme68k/stand/wrtvid/Makefile
deleted file mode 100644
index f5146f834cb..00000000000
--- a/sys/arch/mvme68k/stand/wrtvid/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# $OpenBSD: Makefile,v 1.3 2012/08/21 14:46:19 pascal Exp $
-
-PROG= wrtvid
-NOMAN=
-NOPIE=
-
-install:
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/mvme68k/stand/wrtvid/Makefile.inc b/sys/arch/mvme68k/stand/wrtvid/Makefile.inc
deleted file mode 100644
index 25be01dc734..00000000000
--- a/sys/arch/mvme68k/stand/wrtvid/Makefile.inc
+++ /dev/null
@@ -1,14 +0,0 @@
-# $OpenBSD: Makefile.inc,v 1.3 1997/10/20 00:33:50 deraadt Exp $
-
-WRTVID_BASE_DIR=${S}/arch/mvme68k/stand/wrtvid
-
-WRTVID_DIR!= cd ${WRTVID_BASE_DIR}; \
- printf "xxx:\n\techo \$${.OBJDIR}\n" | ${MAKE} -r -s -f - xxx
-
-WRTVID=${WRTVID_DIR}/wrtvid
-
-$(WRTVID): .NOTMAIN __always_make_WRTVID
- @echo making sure the wrtvid is up to date...
- @(cd ${WRTVID_BASE_DIR}; ${MAKE})
-
-__always_make_WRTVID: .NOTMAIN
diff --git a/sys/arch/mvme68k/stand/wrtvid/wrtvid.c b/sys/arch/mvme68k/stand/wrtvid/wrtvid.c
deleted file mode 100644
index 8dc74e75af4..00000000000
--- a/sys/arch/mvme68k/stand/wrtvid/wrtvid.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/* $OpenBSD: wrtvid.c,v 1.9 2014/02/23 12:30:15 jsg Exp $ */
-
-/*
- * Copyright (c) 1995 Dale Rahn <drahn@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/disklabel.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#define __DBINTERFACE_PRIVATE
-#include <db.h>
-
-#define BUF_SIZ 512
-static void
-copy_exe(int exe_file, int tape_exe)
-{
- char buf[BUF_SIZ];
- int cnt = 0;
-
- lseek (exe_file, 0x20, SEEK_SET);
- while (BUF_SIZ == (cnt = read(exe_file, buf, BUF_SIZ)))
- write(tape_exe, buf, cnt);
- bzero(&buf[cnt], BUF_SIZ-cnt);
- write(tape_exe, buf, BUF_SIZ);
-}
-
-static void
-swabvid(struct mvmedisklabel *pcpul)
-{
- M_32_SWAP(pcpul->vid_oss);
- M_16_SWAP(pcpul->vid_osl);
- /*
- M_16_SWAP(pcpul->vid_osa_u);
- M_16_SWAP(pcpul->vid_osa_l);
- */
- M_32_SWAP(pcpul->vid_cas);
-}
-
-static void
-swabcfg(struct mvmedisklabel *pcpul)
-{
- M_16_SWAP(pcpul->cfg_atm);
- M_16_SWAP(pcpul->cfg_prm);
- M_16_SWAP(pcpul->cfg_atm);
- M_16_SWAP(pcpul->cfg_rec);
- M_16_SWAP(pcpul->cfg_trk);
- M_16_SWAP(pcpul->cfg_psm);
- M_16_SWAP(pcpul->cfg_shd);
- M_16_SWAP(pcpul->cfg_pcom);
- M_16_SWAP(pcpul->cfg_rwcc);
- M_16_SWAP(pcpul->cfg_ecc);
- M_16_SWAP(pcpul->cfg_eatm);
- M_16_SWAP(pcpul->cfg_eprm);
- M_16_SWAP(pcpul->cfg_eatw);
- M_16_SWAP(pcpul->cfg_rsvc1);
- M_16_SWAP(pcpul->cfg_rsvc2);
-}
-
-int
-main(int argc, char *argv[])
-{
- struct mvmedisklabel *pcpul;
- struct stat stat;
- int exe_file;
- int tape_vid;
- int tape_exe;
- unsigned int exe_addr;
- char *filename;
- char fileext[256];
-
- if (argc == 0)
- filename = "a.out";
- else
- filename = argv[1];
-
- exe_file = open(filename, O_RDONLY,0444);
- if (exe_file == -1) {
- perror(filename);
- exit(2);
- }
- snprintf(fileext, sizeof fileext, "%c%cboot", filename[4], filename[5]);
- tape_vid = open(fileext, O_WRONLY|O_CREAT|O_TRUNC, 0644);
- snprintf(fileext, sizeof fileext, "boot%c%c", filename[4], filename[5]);
- tape_exe = open(fileext, O_WRONLY|O_CREAT|O_TRUNC,0644);
-
- pcpul = (struct mvmedisklabel *)malloc(sizeof(struct mvmedisklabel));
- bzero(pcpul, sizeof(struct mvmedisklabel));
-
- memcpy(pcpul->vid_id, "NBSD", sizeof pcpul->vid_id);
-
- fstat(exe_file, &stat);
- /* size in 256 byte blocks round up after a.out header removed */
-
- if (filename[5] == 't' ) {
- pcpul->vid_oss = 1;
- } else {
- pcpul->vid_oss = 2;
- }
- pcpul->vid_osl = (((stat.st_size -0x20) +511) / 512) *2;
-
- lseek(exe_file, 0x14, SEEK_SET);
- read(exe_file, &exe_addr, 4);
-
- /* check this, it may not work in both endian. */
- {
- union {
- struct s {
- unsigned short s1;
- unsigned short s2;
- } s;
- unsigned long l;
- } a;
- a.l = exe_addr;
- pcpul->vid_osa_u = a.s.s1;
- pcpul->vid_osa_l = a.s.s2;
-
- }
- pcpul->vid_cas = 1;
- pcpul->vid_cal = 1;
- /* do not want to write past end of structure, not null terminated */
- strncpy(pcpul->vid_mot, "MOTOROLA", 8);
-
- if (BYTE_ORDER != BIG_ENDIAN)
- swabvid(pcpul);
-
- pcpul->cfg_rec = 0x100;
- pcpul->cfg_psm = 0x200;
-
- if (BYTE_ORDER != BIG_ENDIAN)
- swabcfg(pcpul);
-
- write(tape_vid, pcpul, sizeof(struct mvmedisklabel));
-
- free(pcpul);
-
- copy_exe(exe_file, tape_exe);
- close(exe_file);
- close(tape_vid);
- close(tape_exe);
- return (0);
-}
diff --git a/sys/arch/mvme88k/Makefile b/sys/arch/mvme88k/Makefile
deleted file mode 100644
index 3fc7526c0c9..00000000000
--- a/sys/arch/mvme88k/Makefile
+++ /dev/null
@@ -1,45 +0,0 @@
-# $OpenBSD: Makefile,v 1.11 2013/12/08 14:46:39 espie Exp $
-
-S= ${.CURDIR}/../..
-KFILE= GENERIC
-.if exists(conf/GENERIC.MP)
-KFILE= GENERIC.MP
-.endif
-TDIRS= ${_arch} include
-TAGS= ${.CURDIR}/tags
-
-NOPROG=
-NOMAN=
-NOOBJ=
-SUBDIR= stand
-
-# config the fattest kernel we can find into a temporary dir
-# to create a Makefile. Then use make to pull some variables
-# out and push them into the sub-shell to expand the paths,
-# and finally run ctags.
-tags::
- TDIR=`mktemp -d /tmp/_tagXXXXXXXXXX` || exit 1; \
- eval "S=${S}" && \
- config -s ${S} -b $${TDIR} ${.CURDIR}/conf/${KFILE} && \
- eval "_arch=\"`make -V _arch -f $${TDIR}/Makefile`\"" && \
- eval "_mach=\"`make -V _mach -f $${TDIR}/Makefile`\"" && \
- eval "_machdir=\$S/arch/$${_mach}" && \
- eval "_archdir=\$S/arch/$${_arch}" && \
- eval "HFILES=\"`find $S \( -path $S/'arch' -o -path $S/stand -o -path $S/lib/libsa -o -path $S'/lib/libkern/arch' \) -prune -o -name '*.h'; find $${_machdir} $${_archdir} $S/lib/libkern/arch/$${_mach} \( -name boot -o -name stand \) -prune -o -name '*.h'`\"" && \
- eval "SFILES=\"`make -V SFILES -f $${TDIR}/Makefile`\"" && \
- eval "CFILES=\"`make -V CFILES -f $${TDIR}/Makefile`\"" && \
- eval "AFILES=\"`make -V AFILES -f $${TDIR}/Makefile`\"" && \
- ctags -wd -f ${TAGS} $${CFILES} $${HFILES} && \
- egrep "^[_A-Z]*ENTRY[_A-Z]*\(.*\)" $${SFILES} $${AFILES} | \
- sed "s;\\([^:]*\\):\\([^(]*\\)(\\([^, )]*\\)\\(.*\\);\\3 \\1 /^\\2(\\3\\4$$/;" \
- >> ${TAGS} && \
- sort -o ${TAGS} ${TAGS} && \
- rm -rf $${TDIR}
-
-links:
- -for i in conf ${TDIRS}; do \
- (cd $$i && rm -f tags; ln -s tags tags); done
-
-obj: _SUBDIRUSE
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/mvme88k/compile/.cvsignore b/sys/arch/mvme88k/compile/.cvsignore
deleted file mode 100644
index 2230f83179d..00000000000
--- a/sys/arch/mvme88k/compile/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-GENERIC
-GENERIC.MP
-M181
-M187
-M188
-M197
-RAMDISK
diff --git a/sys/arch/mvme88k/conf/GENERIC b/sys/arch/mvme88k/conf/GENERIC
deleted file mode 100644
index be54b20a3e5..00000000000
--- a/sys/arch/mvme88k/conf/GENERIC
+++ /dev/null
@@ -1,98 +0,0 @@
-# $OpenBSD: GENERIC,v 1.58 2013/05/23 21:20:12 miod Exp $
-#
-# For further information on compiling OpenBSD kernels, see the config(8)
-# man page.
-#
-# For further information on hardware support for this architecture, see
-# the intro(4) man page. For further information about kernel options
-# for this architecture, see the options(4) man page. For an explanation
-# of each device driver in this file see the section 4 man page for the
-# device.
-
-machine mvme88k m88k
-include "../../../conf/GENERIC"
-maxusers 32 # estimated number of users
-
-# Processor type
-option M88100
-option M88110
-option M88410
-
-option MVME181 # support for MVME181 (requires M88100)
-option MVME187 # support for MVME187 (requires M88100)
-option MVME188 # support for MVME188 (requires M88100)
-option MVME197 # support for MVME197 (requires M88110, M88410)
-
-# Define this if your M88100 processor has the xxx.usr bug (mask C82N)
-option ERRATA__XXX_USR
-
-
-config bsd swap generic
-
-#
-# devices
-#
-
-mainbus0 at root
-
-# MVME181 devices
-angelfire0 at mainbus0 addr 0xff800000
-vme0 at angelfire0 offset 0x680000
-dart0 at angelfire0 offset 0x640000 ipl 5
-dsrtc0 at angelfire0 offset 0x10000
-
-# MVME1x7 devices
-pcctwo0 at mainbus0 addr 0xfff00000 # MVME187
-bussw0 at mainbus0 addr 0xfff00000 # MVME197
-sram0 at mainbus0 addr 0xffe00000 # MVME187
-pcctwo0 at bussw0 offset 0x00000 # MVME197
-nvram0 at pcctwo0 offset 0xc0000
-vme0 at pcctwo0 offset 0x40000
-ie0 at pcctwo0 offset 0x46000 ipl 3
-osiop0 at pcctwo0 offset 0x47000 ipl 2
-cl0 at pcctwo0 offset 0x45000 ipl 3
-cl1 at pcctwo0 offset 0x45200 ipl 3 # M8120 only
-#lptwo0 at pcctwo0 offset 0x45000 ipl 1
-memc0 at pcctwo0 offset 0x43000
-memc1 at pcctwo0 offset 0x43100
-
-# MVME188 devices
-syscon0 at mainbus0 addr 0xfff00000 # MVME188
-nvram0 at syscon0 offset 0x80000
-dart0 at syscon0 offset 0x82000 ipl 3
-vme0 at syscon0 offset 0x85000
-
-vmes0 at vme0
-vmel0 at vme0
-
-# MVME327
-vsbic0 at vmes0 addr 0xffffa600 ipl 2
-vsbic1 at vmes0 addr 0xffffa700 ipl 2
-# MVME328, MVME328XT
-vs0 at vmes0 addr 0xffff9000 ipl 2
-vs1 at vmes0 addr 0xffff9800 ipl 2
-vs2 at vmes0 addr 0xffff4800 ipl 2
-vs3 at vmes0 addr 0xffff5800 ipl 2
-vs4 at vmes0 addr 0xffff7000 ipl 2
-vs5 at vmes0 addr 0xffff7800 ipl 2
-# MVME332XT
-vx0 at vmes0 addr 0xff780000 ipl 3
-vx1 at vmes0 addr 0xff790000 ipl 3
-vx2 at vmes0 addr 0xff7a0000 ipl 3
-vx3 at vmes0 addr 0xff7b0000 ipl 3
-# MVME376
-le0 at vmes0 addr 0xffff1200 ipl 3
-le1 at vmes0 addr 0xffff1400 ipl 3
-le2 at vmes0 addr 0xffff1600 ipl 3
-le3 at vmes0 addr 0xffff5400 ipl 3
-le4 at vmes0 addr 0xffff5600 ipl 3
-le5 at vmes0 addr 0xffffa400 ipl 3
-
-scsibus* at scsi?
-sd* at scsibus?
-st* at scsibus?
-cd* at scsibus?
-ch* at scsibus?
-safte* at scsibus?
-ses* at scsibus?
-uk* at scsibus?
diff --git a/sys/arch/mvme88k/conf/GENERIC.MP b/sys/arch/mvme88k/conf/GENERIC.MP
deleted file mode 100644
index 218480304ee..00000000000
--- a/sys/arch/mvme88k/conf/GENERIC.MP
+++ /dev/null
@@ -1,15 +0,0 @@
-# $OpenBSD: GENERIC.MP,v 1.1 2007/05/19 17:06:11 miod Exp $
-#
-# For further information on compiling OpenBSD kernels, see the config(8)
-# man page.
-#
-# For further information on hardware support for this architecture, see
-# the intro(4) man page. For further information about kernel options
-# for this architecture, see the options(4) man page. For an explanation
-# of each device driver in this file see the section 4 man page for the
-# device.
-
-include "arch/mvme88k/conf/GENERIC"
-
-option MULTIPROCESSOR
-#option MP_LOCKDEBUG
diff --git a/sys/arch/mvme88k/conf/M181 b/sys/arch/mvme88k/conf/M181
deleted file mode 100644
index f27262d33c5..00000000000
--- a/sys/arch/mvme88k/conf/M181
+++ /dev/null
@@ -1,72 +0,0 @@
-# $OpenBSD: M181,v 1.2 2013/05/23 21:20:12 miod Exp $
-#
-# For further information on compiling OpenBSD kernels, see the config(8)
-# man page.
-#
-# For further information on hardware support for this architecture, see
-# the intro(4) man page. For further information about kernel options
-# for this architecture, see the options(4) man page. For an explanation
-# of each device driver in this file see the section 4 man page for the
-# device.
-
-machine mvme88k m88k
-include "../../../conf/GENERIC"
-maxusers 32 # estimated number of users
-
-# Processor type
-option M88100
-
-option MVME181 # support for MVME181 (requires M88100)
-
-# Define this if your M88100 processor has the xxx.usr bug (mask C82N)
-option ERRATA__XXX_USR
-
-
-config bsd swap generic
-
-#
-# devices
-#
-
-mainbus0 at root
-
-# MVME181 devices
-angelfire0 at mainbus0 addr 0xff800000
-vme0 at angelfire0 offset 0x680000
-dart0 at angelfire0 offset 0x640000 ipl 5
-dsrtc0 at angelfire0 offset 0x10000
-
-vmes0 at vme0
-vmel0 at vme0
-
-# MVME327
-vsbic0 at vmes0 addr 0xffffa600 ipl 2
-vsbic1 at vmes0 addr 0xffffa700 ipl 2
-# MVME328, MVME328XT
-vs0 at vmes0 addr 0xffff9000 ipl 2
-vs1 at vmes0 addr 0xffff9800 ipl 2
-vs2 at vmes0 addr 0xffff4800 ipl 2
-vs3 at vmes0 addr 0xffff5800 ipl 2
-vs4 at vmes0 addr 0xffff7000 ipl 2
-vs5 at vmes0 addr 0xffff7800 ipl 2
-# MVME332XT
-vx0 at vmes0 addr 0xff780000 ipl 3
-vx1 at vmes0 addr 0xff790000 ipl 3
-vx2 at vmes0 addr 0xff7a0000 ipl 3
-vx3 at vmes0 addr 0xff7b0000 ipl 3
-# MVME376
-le0 at vmes0 addr 0xffff1200 ipl 3
-le1 at vmes0 addr 0xffff1400 ipl 3
-le2 at vmes0 addr 0xffff1600 ipl 3
-le3 at vmes0 addr 0xffff5400 ipl 3
-le4 at vmes0 addr 0xffff5600 ipl 3
-le5 at vmes0 addr 0xffffa400 ipl 3
-
-scsibus* at scsi?
-sd* at scsibus?
-st* at scsibus?
-cd* at scsibus?
-ch* at scsibus?
-safte* at scsibus?
-ses* at scsibus?
-uk* at scsibus?
diff --git a/sys/arch/mvme88k/conf/M187 b/sys/arch/mvme88k/conf/M187
deleted file mode 100644
index ca440d4eaa4..00000000000
--- a/sys/arch/mvme88k/conf/M187
+++ /dev/null
@@ -1,80 +0,0 @@
-# $OpenBSD: M187,v 1.39 2013/05/17 22:51:59 miod Exp $
-#
-# For further information on compiling OpenBSD kernels, see the config(8)
-# man page.
-#
-# For further information on hardware support for this architecture, see
-# the intro(4) man page. For further information about kernel options
-# for this architecture, see the options(4) man page. For an explanation
-# of each device driver in this file see the section 4 man page for the
-# device.
-
-machine mvme88k m88k
-include "../../../conf/GENERIC"
-maxusers 32 # estimated number of users
-
-# Processor type
-option M88100
-
-option MVME187 # support for MVME187 (requires M88100)
-
-# Define this if your processor has the xxx.usr bug (mask C82N)
-option ERRATA__XXX_USR
-
-
-config bsd swap generic
-
-#
-# devices
-#
-
-mainbus0 at root
-
-# MVME1x7 devices
-pcctwo0 at mainbus0 addr 0xfff00000
-sram0 at mainbus0 addr 0xffe00000
-nvram0 at pcctwo0 offset 0xc0000
-vme0 at pcctwo0 offset 0x40000
-ie0 at pcctwo0 offset 0x46000 ipl 3
-osiop0 at pcctwo0 offset 0x47000 ipl 2
-cl0 at pcctwo0 offset 0x45000 ipl 3
-cl1 at pcctwo0 offset 0x45200 ipl 3 # M8120 only
-#lptwo0 at pcctwo0 offset 0x45000 ipl 1
-memc0 at pcctwo0 offset 0x43000
-memc1 at pcctwo0 offset 0x43100
-
-vmes0 at vme0
-vmel0 at vme0
-
-# MVME327
-vsbic0 at vmes0 addr 0xffffa600 ipl 2
-vsbic1 at vmes0 addr 0xffffa700 ipl 2
-# MVME328, MVME328XT
-vs0 at vmes0 addr 0xffff9000 ipl 2
-vs1 at vmes0 addr 0xffff9800 ipl 2
-vs2 at vmes0 addr 0xffff4800 ipl 2
-vs3 at vmes0 addr 0xffff5800 ipl 2
-vs4 at vmes0 addr 0xffff7000 ipl 2
-vs5 at vmes0 addr 0xffff7800 ipl 2
-# MVME332XT
-vx0 at vmes0 addr 0xff780000 ipl 3
-vx1 at vmes0 addr 0xff790000 ipl 3
-vx2 at vmes0 addr 0xff7a0000 ipl 3
-vx3 at vmes0 addr 0xff7b0000 ipl 3
-# MVME376
-le0 at vmes0 addr 0xffff1200 ipl 3
-le1 at vmes0 addr 0xffff1400 ipl 3
-le2 at vmes0 addr 0xffff1600 ipl 3
-le3 at vmes0 addr 0xffff5400 ipl 3
-le4 at vmes0 addr 0xffff5600 ipl 3
-le5 at vmes0 addr 0xffffa400 ipl 3
-
-
-scsibus* at scsi?
-sd* at scsibus?
-st* at scsibus?
-cd* at scsibus?
-ch* at scsibus?
-safte* at scsibus?
-ses* at scsibus?
-uk* at scsibus?
diff --git a/sys/arch/mvme88k/conf/M188 b/sys/arch/mvme88k/conf/M188
deleted file mode 100644
index 988c4be5f8d..00000000000
--- a/sys/arch/mvme88k/conf/M188
+++ /dev/null
@@ -1,74 +0,0 @@
-# $OpenBSD: M188,v 1.32 2013/05/17 22:51:59 miod Exp $
-#
-# For further information on compiling OpenBSD kernels, see the config(8)
-# man page.
-#
-# For further information on hardware support for this architecture, see
-# the intro(4) man page. For further information about kernel options
-# for this architecture, see the options(4) man page. For an explanation
-# of each device driver in this file see the section 4 man page for the
-# device.
-
-machine mvme88k m88k
-include "../../../conf/GENERIC"
-maxusers 32 # estimated number of users
-
-# Processor type
-option M88100
-
-option MVME188 # support for MVME188 (requires M88100)
-
-# Define this if your processor has the xxx.usr bug (mask C82N)
-option ERRATA__XXX_USR
-
-option MULTIPROCESSOR # comment out if 1P64 model...
-
-config bsd swap generic
-
-#
-# devices
-#
-
-mainbus0 at root
-
-# MVME188 devices
-syscon0 at mainbus0 addr 0xfff00000
-nvram0 at syscon0 offset 0x80000
-dart0 at syscon0 offset 0x82000 ipl 3
-vme0 at syscon0 offset 0x85000
-
-vmes0 at vme0
-vmel0 at vme0
-
-# MVME327
-vsbic0 at vmes0 addr 0xffffa600 ipl 2
-vsbic1 at vmes0 addr 0xffffa700 ipl 2
-# MVME328, MVME328XT
-vs0 at vmes0 addr 0xffff9000 ipl 2
-vs1 at vmes0 addr 0xffff9800 ipl 2
-vs2 at vmes0 addr 0xffff4800 ipl 2
-vs3 at vmes0 addr 0xffff5800 ipl 2
-vs4 at vmes0 addr 0xffff7000 ipl 2
-vs5 at vmes0 addr 0xffff7800 ipl 2
-# MVME332XT
-vx0 at vmes0 addr 0xff780000 ipl 3
-vx1 at vmes0 addr 0xff790000 ipl 3
-vx2 at vmes0 addr 0xff7a0000 ipl 3
-vx3 at vmes0 addr 0xff7b0000 ipl 3
-# MVME376
-le0 at vmes0 addr 0xffff1200 ipl 3
-le1 at vmes0 addr 0xffff1400 ipl 3
-le2 at vmes0 addr 0xffff1600 ipl 3
-le3 at vmes0 addr 0xffff5400 ipl 3
-le4 at vmes0 addr 0xffff5600 ipl 3
-le5 at vmes0 addr 0xffffa400 ipl 3
-
-
-scsibus* at scsi?
-sd* at scsibus?
-st* at scsibus?
-cd* at scsibus?
-ch* at scsibus?
-safte* at scsibus?
-ses* at scsibus?
-uk* at scsibus?
diff --git a/sys/arch/mvme88k/conf/M197 b/sys/arch/mvme88k/conf/M197
deleted file mode 100644
index bbaba854b3d..00000000000
--- a/sys/arch/mvme88k/conf/M197
+++ /dev/null
@@ -1,76 +0,0 @@
-# $OpenBSD: M197,v 1.36 2013/05/17 22:51:59 miod Exp $
-#
-# For further information on compiling OpenBSD kernels, see the config(8)
-# man page.
-#
-# For further information on hardware support for this architecture, see
-# the intro(4) man page. For further information about kernel options
-# for this architecture, see the options(4) man page. For an explanation
-# of each device driver in this file see the section 4 man page for the
-# device.
-
-machine mvme88k m88k
-include "../../../conf/GENERIC"
-maxusers 32 # estimated number of users
-
-# Processor type
-option M88110
-option M88410
-
-option MVME197 # support for MVME197 (requires M88110, M88410)
-
-config bsd swap generic
-
-#
-# devices
-#
-
-mainbus0 at root
-
-# MVME1x7 devices
-bussw0 at mainbus0 addr 0xfff00000
-pcctwo0 at bussw0 offset 0x00000
-nvram0 at pcctwo0 offset 0xc0000
-vme0 at pcctwo0 offset 0x40000
-ie0 at pcctwo0 offset 0x46000 ipl 3
-osiop0 at pcctwo0 offset 0x47000 ipl 2
-cl0 at pcctwo0 offset 0x45000 ipl 3
-#lptwo0 at pcctwo0 offset 0x45000 ipl 1
-memc0 at pcctwo0 offset 0x43000
-memc1 at pcctwo0 offset 0x43100
-
-vmes0 at vme0
-vmel0 at vme0
-
-# MVME327
-vsbic0 at vmes0 addr 0xffffa600 ipl 2
-vsbic1 at vmes0 addr 0xffffa700 ipl 2
-# MVME328, MVME328XT
-vs0 at vmes0 addr 0xffff9000 ipl 2
-vs1 at vmes0 addr 0xffff9800 ipl 2
-vs2 at vmes0 addr 0xffff4800 ipl 2
-vs3 at vmes0 addr 0xffff5800 ipl 2
-vs4 at vmes0 addr 0xffff7000 ipl 2
-vs5 at vmes0 addr 0xffff7800 ipl 2
-# MVME332XT
-vx0 at vmes0 addr 0xff780000 ipl 3
-vx1 at vmes0 addr 0xff790000 ipl 3
-vx2 at vmes0 addr 0xff7a0000 ipl 3
-vx3 at vmes0 addr 0xff7b0000 ipl 3
-# MVME376
-le0 at vmes0 addr 0xffff1200 ipl 3
-le1 at vmes0 addr 0xffff1400 ipl 3
-le2 at vmes0 addr 0xffff1600 ipl 3
-le3 at vmes0 addr 0xffff5400 ipl 3
-le4 at vmes0 addr 0xffff5600 ipl 3
-le5 at vmes0 addr 0xffffa400 ipl 3
-
-
-scsibus* at scsi?
-sd* at scsibus?
-st* at scsibus?
-cd* at scsibus?
-ch* at scsibus?
-safte* at scsibus?
-ses* at scsibus?
-uk* at scsibus?
diff --git a/sys/arch/mvme88k/conf/Makefile.mvme88k b/sys/arch/mvme88k/conf/Makefile.mvme88k
deleted file mode 100644
index cb18dfa72a6..00000000000
--- a/sys/arch/mvme88k/conf/Makefile.mvme88k
+++ /dev/null
@@ -1,170 +0,0 @@
-# $OpenBSD: Makefile.mvme88k,v 1.81 2013/11/02 23:42:12 miod Exp $
-
-# For instructions on building kernels consult the config(8) and options(4)
-# manual pages.
-#
-# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
-# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
-# DEBUG is set to -g by config if debugging is requested (config -g).
-# PROF is set to -pg by config if profiling is requested (config -p).
-
-.include <bsd.own.mk>
-
-SIZE?= size
-STRIP?= strip
-
-# source tree is located via $S relative to the compilation directory
-.ifndef S
-S!= cd ../../../..; pwd
-.endif
-
-_machdir?= $S/arch/${_mach}
-_archdir?= $S/arch/${_arch}
-
-INCLUDES= -nostdinc -I$S -I. -I$S/arch
-CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D__${_mach}__ -MD -MP
-CWARNFLAGS= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
- -Wno-main -Wno-uninitialized -Wno-format \
- -Wstack-larger-than-2047
-
-CMACHFLAGS= -mno-check-zero-division -mmemcpy
-CMACHFLAGS+= -fno-builtin-printf -fno-builtin-snprintf \
- -fno-builtin-vsnprintf -fno-builtin-log \
- -fno-builtin-log2 -fno-builtin-malloc ${NOPIE_FLAGS}
-.if ${IDENT:M-DNO_PROPOLICE}
-CMACHFLAGS+= -fno-stack-protector
-.endif
-
-COPTS?= -O2
-CFLAGS= ${DEBUG} ${CWARNFLAGS} ${CMACHFLAGS} ${COPTS} ${PIPE}
-AFLAGS= -D_LOCORE -x assembler-with-cpp ${CWARNFLAGS} ${CMACHFLAGS}
-LINKFLAGS= -T ${_machdir}/conf/ld.script \
- -Ttext 0x80000 -e __start -X -N --warn-common -nopie
-
-.if ${IDENT:M-DDDB_STRUCT}
-DB_STRUCTINFO= db_structinfo.h
-.else
-DB_STRUCTINFO=
-.endif
-
-HOSTCC?= ${CC}
-HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
-HOSTED_CFLAGS= ${CFLAGS}
-HOSTED_C= ${HOSTCC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
-
-NORMAL_C_NOP= ${CC} ${CFLAGS} ${CPPFLAGS} -c $<
-NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
-NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $<
-
-%OBJS
-
-%CFILES
-
-%SFILES
-
-# load lines for config "xxx" will be emitted as:
-# xxx: ${SYSTEM_DEP} swapxxx.o
-# ${SYSTEM_LD_HEAD}
-# ${SYSTEM_LD} swapxxx.o
-# ${SYSTEM_LD_TAIL}
-SYSTEM_HEAD= locore.o param.o ioconf.o
-SYSTEM_OBJ= ${SYSTEM_HEAD} ${OBJS}
-SYSTEM_DEP= Makefile ${SYSTEM_OBJ}
-SYSTEM_LD_HEAD= @rm -f $@
-SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_HEAD} vers.o $${OBJS}'; \
- ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_HEAD} vers.o ${OBJS}
-SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@
-
-DEBUG?=
-.if ${DEBUG} == "-g"
-LINKFLAGS+= -X
-STRIPFLAGS= -g -x
-SYSTEM_LD_TAIL+=; \
- echo mv $@ $@.gdb; rm -f $@.gdb; mv $@ $@.gdb; \
- echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
- ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
-.else
-LINKFLAGS+= -S -x
-.endif
-
-%LOAD
-
-# cc's -MD puts the source and output paths in the dependency file;
-# since those are temp files here we need to fix it up. It also
-# puts the file in /tmp, so we use -MF to put it in the current
-# directory as assym.P and then generate assym.d from it with a
-# good target name
-assym.h: $S/kern/genassym.sh Makefile \
- ${_archdir}/${_arch}/genassym.cf ${_machdir}/${_mach}/genassym.cf
- cat ${_archdir}/${_arch}/genassym.cf ${_machdir}/${_mach}/genassym.cf | \
- sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} -MF assym.P > assym.h.tmp
- sed '1s/.*/assym.h: \\/' assym.P > assym.d
- sort -u assym.h.tmp > assym.h
-
-param.c: $S/conf/param.c
- rm -f param.c
- cp $S/conf/param.c .
-
-param.o: param.c Makefile
- ${NORMAL_C}
-
-mcount.o: $S/lib/libkern/mcount.c Makefile
- ${NORMAL_C_NOP}
-
-ioconf.o: ioconf.c
- ${NORMAL_C}
-
-vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
- sh $S/conf/newvers.sh
- ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
-
-clean::
- rm -f eddep *bsd *bsd.gdb tags *.[dio] [a-z]*.s \
- [Ee]rrs linterrs assym.h ${DB_STRUCTINFO}
-
-lint:
- @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
- ${CFILES} ioconf.c param.c | \
- grep -v 'static function .* unused'
-
-depend:
- @touch $@
-
-tags:
- @echo "see $S/kern/Makefile for tags"
-
-db_structinfo.h: $S/ddb/db_structinfo.c $S/ddb/parse_structinfo.pl
- ${CC} ${CFLAGS} ${CPPFLAGS} -MT $@ -gstabs -c $S/ddb/db_structinfo.c
- objdump -g db_structinfo.o | perl $S/ddb/parse_structinfo.pl > $@
- rm -f db_structinfo.o
-
-locore.o: ${_machdir}/${_mach}/locore.S assym.h
-eh.o m88100_fp.o mutex.o process.o subr.o: assym.h
-
-# The install target can be redefined by putting a
-# install-kernel-${MACHINE_NAME} target into /etc/mk.conf
-MACHINE_NAME!= uname -n
-install: install-kernel-${MACHINE_NAME}
-.if !target(install-kernel-${MACHINE_NAME}})
-install-kernel-${MACHINE_NAME}:
- rm -f /obsd
- ln /bsd /obsd
- cp bsd /nbsd
- mv /nbsd /bsd
-.endif
-
-# pull in the dependency information
-.if !empty(DB_STRUCTINFO) && !exists(${DB_STRUCTINFO})
- ${SYSTEM_OBJ}: ${DB_STRUCTINFO}
-.endif
-.ifnmake clean
-. for o in ${SYSTEM_OBJ} assym.h ${DB_STRUCTINFO}
-. if exists(${o:R}.d)
-. include "${o:R}.d"
-. elif exists($o)
- .PHONY: $o
-. endif
-. endfor
-.endif
-
-%RULES
diff --git a/sys/arch/mvme88k/conf/RAMDISK b/sys/arch/mvme88k/conf/RAMDISK
deleted file mode 100644
index 4d6e966d017..00000000000
--- a/sys/arch/mvme88k/conf/RAMDISK
+++ /dev/null
@@ -1,100 +0,0 @@
-# $OpenBSD: RAMDISK,v 1.37 2013/05/23 21:20:12 miod Exp $
-
-machine mvme88k m88k
-
-# 4 meg ramdisk
-option MINIROOTSIZE=4096
-option RAMDISK_HOOKS
-
-# Processor type
-option M88100
-option M88110
-option M88410
-
-option MVME181 # support for MVME181 (requires M88100)
-option MVME187 # support for MVME187 (requires M88100)
-option MVME188 # support for MVME188 (requires M88100)
-option MVME197 # support for MVME197 (requires M88110, M88410)
-
-# Define this if your processor has the xxx.usr bug (mask C82N)
-option ERRATA__XXX_USR
-
-maxusers 32
-
-#option SCSITERSE
-#option SMALL_KERNEL
-#option NO_PROPOLICE
-option TIMEZONE=0
-option DST=0
-option FFS
-option NFSCLIENT
-option CD9660
-option INET
-option INET6
-option BOOT_CONFIG
-
-config bsd root rd0a swap on rd0b
-
-mainbus0 at root
-
-# MVME181 devices
-angelfire0 at mainbus0 addr 0xff800000
-vme0 at angelfire0 offset 0x680000
-dart0 at angelfire0 offset 0x640000 ipl 5
-dsrtc0 at angelfire0 offset 0x10000
-
-# MVME1x7 devices
-pcctwo0 at mainbus0 addr 0xfff00000 # MVME187
-bussw0 at mainbus0 addr 0xfff00000 # MVME197
-#sram0 at mainbus0 addr 0xffe00000 # MVME187
-pcctwo0 at bussw0 offset 0x00000 # MVME197
-nvram0 at pcctwo0 offset 0xc0000
-vme0 at pcctwo0 offset 0x40000
-ie0 at pcctwo0 offset 0x46000 ipl 3
-osiop0 at pcctwo0 offset 0x47000 ipl 2
-cl0 at pcctwo0 offset 0x45000 ipl 3
-#cl1 at pcctwo0 offset 0x45200 ipl 3 # M8120 only
-#lptwo0 at pcctwo0 offset 0x45000 ipl 1
-memc0 at pcctwo0 offset 0x43000
-memc1 at pcctwo0 offset 0x43100
-
-# MVME188 devices
-syscon0 at mainbus0 addr 0xfff00000 # MVME188
-nvram0 at syscon0 offset 0x80000
-dart0 at syscon0 offset 0x82000 ipl 3
-vme0 at syscon0 offset 0x85000
-
-vmes0 at vme0
-vmel0 at vme0
-
-# MVME327
-vsbic0 at vmes0 addr 0xffffa600 ipl 2
-vsbic1 at vmes0 addr 0xffffa700 ipl 2
-# MVME328, MVME328XT
-vs0 at vmes0 addr 0xffff9000 ipl 2
-vs1 at vmes0 addr 0xffff9800 ipl 2
-vs2 at vmes0 addr 0xffff4800 ipl 2
-vs3 at vmes0 addr 0xffff5800 ipl 2
-vs4 at vmes0 addr 0xffff7000 ipl 2
-vs5 at vmes0 addr 0xffff7800 ipl 2
-# MVME332XT
-#vx0 at vmes0 addr 0xff780000 ipl 3
-#vx1 at vmes0 addr 0xff790000 ipl 3
-#vx2 at vmes0 addr 0xff7a0000 ipl 3
-#vx3 at vmes0 addr 0xff7b0000 ipl 3
-# MVME376
-le0 at vmes0 addr 0xffff1200 ipl 3
-le1 at vmes0 addr 0xffff1400 ipl 3
-le2 at vmes0 addr 0xffff1600 ipl 3
-le3 at vmes0 addr 0xffff5400 ipl 3
-le4 at vmes0 addr 0xffff5600 ipl 3
-le5 at vmes0 addr 0xffffa400 ipl 3
-
-scsibus* at scsi?
-sd* at scsibus?
-st* at scsibus?
-cd* at scsibus?
-
-pseudo-device loop 1
-pseudo-device bpfilter 1
-pseudo-device rd 1
diff --git a/sys/arch/mvme88k/conf/files.mvme88k b/sys/arch/mvme88k/conf/files.mvme88k
deleted file mode 100644
index e11c21fc414..00000000000
--- a/sys/arch/mvme88k/conf/files.mvme88k
+++ /dev/null
@@ -1,126 +0,0 @@
-# $OpenBSD: files.mvme88k,v 1.51 2013/09/24 20:10:47 miod Exp $
-#
-maxpartitions 16
-
-device mainbus {[addr = -1]}
-attach mainbus at root
-
-# MVME180/181 base logic
-device angelfire {[offset = -1], [ipl = 0]}
-attach angelfire at mainbus
-file arch/mvme88k/dev/angelfire.c angelfire
-
-# MVME197 BusSwitch system bus
-device bussw {[offset = -1], [ipl = 0]}
-attach bussw at mainbus
-file arch/mvme88k/dev/bussw.c bussw needs-count
-
-# MVME187 PCC2 system bus
-device pcctwo {[offset = -1], [ipl = 0]}
-attach pcctwo at bussw, mainbus
-file arch/mvme88k/dev/pcctwo.c pcctwo
-
-# MVME188 base logic
-device syscon {[offset = -1], [ipl = 0]}
-attach syscon at mainbus
-file arch/mvme88k/dev/syscon.c syscon
-
-device memc
-attach memc at pcctwo
-file arch/mvme88k/dev/memc.c memc
-
-device sram
-attach sram at mainbus
-file arch/mvme88k/dev/sram.c sram needs-count
-
-device nvram
-attach nvram at pcctwo, syscon
-file arch/mvme88k/dev/nvram.c nvram needs-count
-
-device dsrtc
-attach dsrtc at angelfire
-file arch/mvme88k/dev/ds1216.c dsrtc
-
-device cl: tty
-attach cl at pcctwo
-file arch/mvme88k/dev/cl.c cl needs-count
-
-device dart: tty
-file dev/ic/mc68681.c dart
-attach dart at angelfire, syscon
-file arch/mvme88k/dev/dart.c dart needs-count
-
-include "scsi/files.scsi"
-
-major {sd = 4}
-major {st = 5}
-major {cd = 6}
-major {rd = 7}
-major {vnd = 8}
-
-attach osiop at pcctwo with osiop_pcctwo
-file arch/mvme88k/dev/osiop_pcctwo.c osiop_pcctwo
-
-device vme {}
-attach vme at angelfire, pcctwo, syscon
-device vmes {[addr = -1], [vec = -1], [ipl = 0]}
-attach vmes at vme
-device vmel {[addr = -1], [vec = -1], [ipl = 0]}
-attach vmel at vme
-file arch/mvme88k/dev/vme.c vme | vmes | vmel
-file arch/mvme88k/dev/vmes.c vmes needs-count
-file arch/mvme88k/dev/vmel.c vmel needs-count
-
-# list of standard files
-file dev/cninit.c
-
-file arch/mvme88k/mvme88k/autoconf.c
-file arch/mvme88k/mvme88k/bus_dma.c
-file arch/mvme88k/mvme88k/clock.c
-file arch/mvme88k/mvme88k/conf.c
-file arch/mvme88k/mvme88k/db_machdep.c ddb
-file arch/mvme88k/mvme88k/disksubr.c
-file arch/mvme88k/mvme88k/eh.S
-file arch/mvme88k/mvme88k/machdep.c
-file arch/mvme88k/mvme88k/m181_machdep.c mvme181
-file arch/mvme88k/mvme88k/m187_machdep.c mvme187
-file arch/mvme88k/mvme88k/m188_machdep.c mvme188
-file arch/mvme88k/mvme88k/m197_machdep.c mvme197
-file arch/mvme88k/mvme88k/m1x7_machdep.c mvme187 | mvme197
-file arch/mvme88k/mvme88k/m88110.c m88110
-file arch/mvme88k/mvme88k/m8820x.c m88100
-file arch/mvme88k/mvme88k/m88410.c m88110
-file arch/mvme88k/mvme88k/pmap_table.c
-file arch/mvme88k/dev/bugio.c
-file arch/mvme88k/dev/mainbus.c
-file arch/mvme88k/dev/memdevs.c nvram | sram
-
-define bpp
-file arch/mvme88k/dev/bpp.c bpp
-
-attach ie at pcctwo: ifnet, ether
-file arch/mvme88k/dev/if_ie.c ie
-
-# MVME376
-attach le at vmes: le24
-file arch/mvme88k/dev/if_le.c le
-
-# MVME374
-#device vp: ether, ifnet, ifmedia
-#attach vp at vmes
-#file arch/mvme88k/dev/if_vp.c vp
-
-# MVME332
-device vx: tty
-attach vx at vmes
-file arch/mvme88k/dev/vx.c vx needs-count
-
-# MVME328
-device vs: scsi
-attach vs at vmes
-file arch/mvme88k/dev/vs.c vs
-
-# MVME327
-device vsbic: bpp, scsi
-attach vsbic at vmes
-file arch/mvme88k/dev/vsbic.c vsbic
diff --git a/sys/arch/mvme88k/conf/ld.script b/sys/arch/mvme88k/conf/ld.script
deleted file mode 100644
index d2c7645712e..00000000000
--- a/sys/arch/mvme88k/conf/ld.script
+++ /dev/null
@@ -1,50 +0,0 @@
-/* $OpenBSD: ld.script,v 1.2 2013/11/03 09:42:55 miod Exp $ */
-
-/*
- * Copyright (c) 2012 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-OUTPUT_FORMAT("elf32-m88k")
-OUTPUT_ARCH(m88k)
-ENTRY(__start)
-SECTIONS
-{
- .text :
- {
- *(.text)
- PROVIDE(etext = ABSOLUTE(.));
- }
- . = ALIGN(0x80000);
- .rodata :
- {
- *(.rodata*)
- PROVIDE(erodata = ABSOLUTE(.));
- }
- . = ALIGN(0x80000);
- .data :
- {
- *(.data)
- PROVIDE(edata = ABSOLUTE(.));
- }
- .bss :
- {
- *(.bss)
- }
- PROVIDE(end = ABSOLUTE(.));
- /DISCARD/ :
- {
- *(.comment)
- }
-}
diff --git a/sys/arch/mvme88k/dev/angelfire.c b/sys/arch/mvme88k/dev/angelfire.c
deleted file mode 100644
index b16de8b6c6d..00000000000
--- a/sys/arch/mvme88k/dev/angelfire.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/* $OpenBSD: angelfire.c,v 1.1 2013/05/17 22:51:59 miod Exp $ */
-
-/*
- * Copyright (c) 2013 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * Logical bus for the AngelFire System Controller and on-board resources
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-
-#include <machine/autoconf.h>
-#include <machine/board.h>
-#include <machine/cpu.h>
-
-#include <machine/mvme181.h>
-
-struct angelfiresoftc {
- struct device sc_dev;
-
- struct intrhand sc_abih; /* abort switch */
- struct intrhand sc_parih; /* parity error */
-};
-
-void angelfireattach(struct device *, struct device *, void *);
-int angelfirematch(struct device *, void *, void *);
-
-int angelfireprint(void *, const char *);
-int angelfirescan(struct device *, void *, void *);
-int angelfireabort(void *);
-int angelfireparerr(void *);
-
-const struct cfattach angelfire_ca = {
- sizeof(struct angelfiresoftc), angelfirematch, angelfireattach
-};
-
-struct cfdriver angelfire_cd = {
- NULL, "angelfire", DV_DULL
-};
-
-int
-angelfirematch(struct device *parent, void *vcf, void *aux)
-{
- switch (brdtyp) {
- case BRD_180:
- case BRD_181:
- return angelfire_cd.cd_ndevs == 0;
- default:
- return 0;
- }
-}
-
-void
-angelfireattach(struct device *parent, struct device *self, void *aux)
-{
- struct angelfiresoftc *sc = (struct angelfiresoftc *)self;
-
- printf("\n");
-
- sc->sc_abih.ih_fn = angelfireabort;
- sc->sc_abih.ih_arg = 0;
- sc->sc_abih.ih_wantframe = 1;
- sc->sc_abih.ih_ipl = IPL_ABORT;
- platform->intsrc_establish(INTSRC_ABORT, &sc->sc_abih, "abort");
-
- /*
- * Don't bother registering the parity error interrupt handler.
- * Parity error interrupts are asynchronous, and there is nothing
- * we can do but acknowledge them... and hope these were detected
- * during write cycles and the writes have been retried.
- * In any case, they don't seem to be harmful.
- */
-#if 0
- if (brdtyp != BRD_180) {
- sc->sc_parih.ih_fn = angelfireparerr;
- sc->sc_parih.ih_arg = 0;
- sc->sc_parih.ih_wantframe = 1;
- sc->sc_parih.ih_ipl = IPL_HIGH;
- platform->intsrc_establish(INTSRC_PARERR, &sc->sc_parih,
- "parity");
- }
-#endif
-
- config_search(angelfirescan, self, aux);
-}
-
-int
-angelfirescan(struct device *parent, void *child, void *args)
-{
- struct cfdata *cf = child;
- struct confargs oca, *ca = args;
-
- bzero(&oca, sizeof oca);
- oca.ca_iot = ca->ca_iot;
- oca.ca_dmat = ca->ca_dmat;
- oca.ca_offset = cf->cf_loc[0];
- oca.ca_ipl = cf->cf_loc[1];
- if (oca.ca_offset != -1)
- oca.ca_paddr = ca->ca_paddr + oca.ca_offset;
- else
- oca.ca_paddr = -1;
- oca.ca_bustype = BUS_ANGELFIRE;
- oca.ca_name = cf->cf_driver->cd_name;
-
- if ((*cf->cf_attach->ca_match)(parent, cf, &oca) == 0)
- return (0);
-
- config_attach(parent, cf, &oca, angelfireprint);
- return (1);
-}
-
-int
-angelfireprint(void *args, const char *bus)
-{
- struct confargs *ca = args;
-
- if (ca->ca_offset != -1)
- printf(" offset 0x%x", ca->ca_offset);
- if (ca->ca_ipl > 0)
- printf(" ipl %d", ca->ca_ipl);
- return (UNCONF);
-}
-
-int
-angelfireabort(void *eframe)
-{
- *(volatile u_int32_t *)M181_CLRABRT = 0xffffffff;
- (void)*(volatile u_int32_t *)M181_CLRABRT;
-
- nmihand(eframe);
-
- return 1;
-}
-
-int
-angelfireparerr(void *eframe)
-{
- struct trapframe *frame = (struct trapframe *)eframe;
- vaddr_t pc;
-
- *(volatile u_int32_t *)M181_CPEI = 0xffffffff;
- (void)*(volatile u_int32_t *)M181_CPEI;
-
- pc = PC_REGS(&frame->tf_regs);
- if (frame->tf_epsr & PSR_MODE)
- printf("kernel parity error, PC = %p\n", pc);
- else
- printf("%s: parity error, PC = %p\n", curproc->p_comm, pc);
-
- return 1;
-}
diff --git a/sys/arch/mvme88k/dev/bpp.c b/sys/arch/mvme88k/dev/bpp.c
deleted file mode 100644
index af8c506be2c..00000000000
--- a/sys/arch/mvme88k/dev/bpp.c
+++ /dev/null
@@ -1,375 +0,0 @@
-/* $OpenBSD: bpp.c,v 1.3 2013/01/05 11:20:56 miod Exp $ */
-
-/*
- * Copyright (c) 2008, 2009 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies. And
- * I won't mind if you keep the disclaimer below.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* BPP cards live in an A24/D16 world */
-#define __BUS_SPACE_RESTRICT_D16__
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-
-#include <machine/bus.h>
-
-#include <mvme88k/dev/bppvar.h>
-
-int bpp_csr_command(struct bpp_softc *, uint, bus_addr_t);
-
-void
-bpp_attach(struct bpp_softc *sc, bus_space_tag_t iot, bus_space_handle_t ioh)
-{
- sc->sc_iot = iot;
- sc->sc_ioh = ioh;
-}
-
-/*
- * CSR Command Protocol
- *
- * This protocol relies on atomic test-and-set instructions to claim the
- * device for ourselves, using the test-and-set register.
- *
- * However, OpenBSD expects to be the only software talking to the BPP
- * device, so it isn't really necessary to perform atomic operations here
- * (such operations are not provided by the bus_space API anyway).
- *
- * Moreover, some MVME197 boards with early BusSwitch version, can not
- * reliably perform test and set operations (xmem) on non-local memory
- * addresses. Fun fun fun.
- */
-
-/*
- * Send a command to the board through the (limited) CSR command protocol.
- */
-int
-bpp_csr_command(struct bpp_softc *sc, uint command, bus_addr_t addr)
-{
- uint16_t csr, tas;
-#if 1
- uint8_t tas8;
- int tmo, tmo2, stat;
- vaddr_t tasaddr;
-
- tasaddr = (vaddr_t)bus_space_vaddr(sc->sc_iot, sc->sc_ioh) + CSR_TAS;
-#else
- int tmo, stat;
-#endif
-
-#if 1
- for (tmo = 1000; tmo != 0; tmo--) {
- /* wait for the BUSY bit to clear */
- for (tmo2 = 1000; tmo2 != 0; tmo2--) {
- csr = bus_space_read_2(sc->sc_iot, sc->sc_ioh,
- CSR_CONTROL);
- if (!ISSET(csr, CSR_BUSY))
- break;
- delay(100);
- }
- if (tmo2 == 0)
- return STATUS_ERRNO + EAGAIN;
-
- /*
- * Claim the TAS register. Note that, since there is no
- * 16 bits modifier for xmem, we need to use the byte
- * version.
- */
- tas8 = TAS_TAS >> 8;
- __asm__ __volatile__ ("xmem.bu %0, %2, %%r0" :
- "+r"(tas8), "+m"(tasaddr) : "r"(tasaddr));
-
- if (!ISSET(tas8, TAS_TAS >> 8))
- break;
-
- delay(100);
- }
- if (tmo == 0)
- return STATUS_ERRNO + EAGAIN;
-#else
- /* wait for the BUSY bit to clear */
- for (tmo = 1000; tmo != 0; tmo--) {
- csr = bus_space_read_2(sc->sc_iot, sc->sc_ioh, CSR_CONTROL);
- if (!ISSET(csr, CSR_BUSY))
- break;
- delay(100);
- }
- if (tmo == 0)
- return STATUS_ERRNO + EAGAIN;
-
- /*
- * Claim the TAS register.
- */
- bus_space_write_2(sc->sc_iot, sc->sc_ioh, CSR_TAS, TAS_TAS);
-#endif
-
- /* write the command information */
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, CSR_ADDR, addr);
- bus_space_write_1(sc->sc_iot, sc->sc_ioh, CSR_ADDR_MOD, ADRM_EXT_S_D);
- bus_space_write_1(sc->sc_iot, sc->sc_ioh, CSR_DATA_WIDTH, MEMT_D32);
- bus_space_write_2(sc->sc_iot, sc->sc_ioh, CSR_TAS,
- TAS_TAS | TAS_VALID_COMMAND | command);
-
- /* signal the board */
- bpp_attention(sc);
-
- /* wait for the command to complete */
- for (tmo = 1000; tmo != 0; tmo--) {
- tas = bus_space_read_2(sc->sc_iot, sc->sc_ioh, CSR_TAS);
- if (ISSET(tas, TAS_VALID_STATUS))
- break;
- delay(100);
- }
- if (tmo == 0)
- return STATUS_ERRNO + EAGAIN;
-
- stat = bus_space_read_1(sc->sc_iot, sc->sc_ioh, CSR_STATUS);
-
- /* release the board */
- bus_space_write_2(sc->sc_iot, sc->sc_ioh, CSR_TAS,
- TAS_TAS | TAS_COMMAND_COMPLETE |
- bus_space_read_2(sc->sc_iot, sc->sc_ioh, CSR_TAS));
- bpp_attention(sc);
-
- /* wait for the TAS bit to clear */
- for (tmo = 1000; tmo != 0; tmo--) {
- tas = bus_space_read_2(sc->sc_iot, sc->sc_ioh, CSR_TAS);
- if (!ISSET(tas, TAS_TAS))
- break;
- delay(100);
- }
-#ifdef BPP_DEBUG
- if (tmo == 0)
- printf("warning: TAS failed to clear\n");
-#endif
-
- return (stat);
-}
-
-/*
- * Interrupt the board.
- */
-void
-bpp_attention(struct bpp_softc *sc)
-{
- bus_space_write_2(sc->sc_iot, sc->sc_ioh, CSR_CONTROL,
- bus_space_read_2(sc->sc_iot, sc->sc_ioh, CSR_CONTROL) |
- CSR_ATTENTION);
-}
-
-/*
- * Reset the board. This will take several seconds.
- */
-int
-bpp_reset(struct bpp_softc *sc)
-{
- uint16_t csr;
- int tmo;
-
- /* reset the board */
- bus_space_write_2(sc->sc_iot, sc->sc_ioh, CSR_CONTROL, CSR_RESET);
- delay(1000);
- bus_space_write_2(sc->sc_iot, sc->sc_ioh, CSR_CONTROL, 0);
-
- /* wait for BUSY to clear in 10s */
- for (tmo = 10000; tmo != 0; tmo--) {
- csr = bus_space_read_2(sc->sc_iot, sc->sc_ioh, CSR_CONTROL);
- if (!ISSET(csr, CSR_BUSY)) {
- return 0;
- }
-
- delay(1000);
- }
-
- return ENXIO;
-}
-
-/*
- * CSR operations
- */
-
-int
-bpp_create_channel(struct bpp_softc *sc, struct bpp_chan *chan, int pri,
- int ipl, int vec)
-{
- struct bpp_channel *channel = chan->ch;
- struct bpp_envelope *envcmd, *envsts;
-
- /*
- * Setup the initial null envelopes.
- */
-
- envcmd = bpp_get_envelope(sc);
- if (envcmd == NULL)
- return STATUS_ERRNO + ENOMEM;
- envsts = bpp_get_envelope(sc);
- if (envsts == NULL)
- return STATUS_ERRNO + ENOMEM;
-
- (*sc->bpp_env_sync)(sc, envcmd, BUS_DMASYNC_PREWRITE);
- (*sc->bpp_env_sync)(sc, envsts, BUS_DMASYNC_PREWRITE);
-
- /*
- * Setup channel header.
- */
-
- memset(channel, 0, sizeof (*channel));
- channel->ch_cmd_head = channel->ch_cmd_tail =
- htobe32((*sc->bpp_env_pa)(sc, envcmd));
- channel->ch_status_head = channel->ch_status_tail =
- htobe32((*sc->bpp_env_pa)(sc, envsts));
- channel->ch_ipl = ipl;
- channel->ch_ivec = vec;
- channel->ch_priority = pri;
- channel->ch_addrmod = ADRM_EXT_S_D;
- channel->ch_buswidth = MEMT_D32;
-
- (*sc->bpp_chan_sync)(sc, channel, BUS_DMASYNC_PREWRITE);
-
- chan->envcmd = envcmd;
- chan->envsts = envsts;
-
- return bpp_csr_command(sc, COMMAND_CHANNEL_CREATE,
- (*sc->bpp_chan_pa)(sc, channel));
-}
-
-/*
- * BPP operations and envelope management
- */
-
-/*
- * Initialize the free list as a set of contiguous envelopes.
- */
-void
-bpp_initialize_envelopes(struct bpp_softc *sc, struct bpp_envelope *env,
- uint cnt)
-{
- sc->sc_env_free = NULL;
- while (cnt-- != 0)
- bpp_put_envelope(sc, env++);
-}
-
-/*
- * Get a new envelope from the free list.
- */
-struct bpp_envelope *
-bpp_get_envelope(struct bpp_softc *sc)
-{
- struct bpp_envelope *env;
-
- env = sc->sc_env_free;
- if (env != NULL) {
- sc->sc_env_free = (struct bpp_envelope *)env->env_link;
- memset(env, 0, sizeof(*env));
- /* env->env_valid = ENVELOPE_INVALID; */
- }
-
- return env;
-}
-
-/*
- * Put an envelope into the free list.
- */
-void
-bpp_put_envelope(struct bpp_softc *sc, struct bpp_envelope *env)
-{
- env->env_link = (uint32_t)sc->sc_env_free;
- sc->sc_env_free = env;
-}
-
-/*
- * Send a command packet, replacing the NULL envelope with the given one,
- * and enqueue it to the command pipe.
- */
-void
-bpp_queue_envelope(struct bpp_softc *sc, struct bpp_chan *chan,
- struct bpp_envelope *tail, paddr_t cmdpa)
-{
- struct bpp_envelope *env;
- struct bpp_channel *channel;
- paddr_t tailpa;
-
- /* tail assumed to be unmodified since bpp_get_envelope(),
- no need to memset() */
- (*sc->bpp_env_sync)(sc, tail, BUS_DMASYNC_PREWRITE);
- tailpa = (*sc->bpp_env_pa)(sc, tail);
-
- /*
- * Update the existing NULL envelope with data.
- */
-
- env = chan->envcmd;
- env->env_link = htobe32(tailpa);
- env->env_pkt = htobe32(cmdpa);
- (*sc->bpp_env_sync)(sc, env, BUS_DMASYNC_PREWRITE); /* paranoia */
- env->env_valid = ENVELOPE_VALID;
- (*sc->bpp_env_sync)(sc, env, BUS_DMASYNC_PREWRITE);
-
- /*
- * Update the channel's command tail pointer to point to the
- * new envelope.
- */
-
- channel = chan->ch;
- channel->ch_cmd_tail = htobe32(tailpa);
- /* really necessary? */
- (*sc->bpp_chan_sync)(sc, channel, BUS_DMASYNC_PREWRITE);
-
- chan->envcmd = tail;
-
- bpp_attention(sc);
-}
-
-/*
- * Dequeue an envelope from the status pipe, and return the command it
- * was carrying. The envelope itself is returned to the free list.
- */
-int
-bpp_dequeue_envelope(struct bpp_softc *sc, struct bpp_chan *chan,
- paddr_t *cmdpa)
-{
- struct bpp_envelope *env;
- struct bpp_channel *channel;
- paddr_t headpa;
-
- /*
- * Look at the head envelope.
- */
-
- env = chan->envsts;
- (*sc->bpp_env_sync)(sc, env, BUS_DMASYNC_POSTREAD);
-
- if (env->env_valid == ENVELOPE_INVALID)
- return EAGAIN;
-
- /*
- * Dequeue the envelope, compute the new head envelope index, and
- * finally release the envelope.
- */
-
- headpa = betoh32(env->env_link);
- if (cmdpa != NULL)
- *cmdpa = betoh32(env->env_pkt);
- chan->envsts = (*sc->bpp_env_va)(sc, headpa);
-
- channel = chan->ch;
- channel->ch_status_head = htobe32(headpa);
- /* really necessary? */
- (*sc->bpp_chan_sync)(sc, channel, BUS_DMASYNC_PREWRITE);
-
- bpp_put_envelope(sc, env);
-
- return 0;
-}
diff --git a/sys/arch/mvme88k/dev/bppvar.h b/sys/arch/mvme88k/dev/bppvar.h
deleted file mode 100644
index ddbfe012598..00000000000
--- a/sys/arch/mvme88k/dev/bppvar.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/* $OpenBSD: bppvar.h,v 1.2 2009/02/14 17:41:42 miod Exp $ */
-
-/*
- * Copyright (c) 2008, 2009 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies. And
- * I won't mind if you keep the disclaimer below.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * Register and structure definitions for MVME boards using the Motorola
- * Buffered Pipe Protocol.
- */
-
-/*
- * Register layout (CSR space)
- */
-
-#define CSR_ADDR 0x00 /* 32 */
-#define CSR_ADDR_MOD 0x04 /* 8 */
-#define CSR_DATA_WIDTH 0x05 /* 8 */
-/* IPC control register */
-#define CSR_CONTROL 0x06 /* 16 */
-#define CSR_STATUS 0x08 /* 8 */
-#define CSR_DIAG 0x09 /* 8 */
-#define CSR_TAS 0x0e /* 16 */
-
-/* CSR bits */
-#define CSR_BUSY 0x8000 /* firmware busy */
-#define CSR_RESET 0x4000 /* reset board */
-#define CSR_ATTENTION 0x2000 /* interrupt firmware */
-#define CSR_INHIBIT_SYSFAIL 0x1000
-
-/* TAS bits */
-#define TAS_TAS 0x8000 /* test and set bit */
-#define TAS_VALID_COMMAND 0x4000
-#define TAS_VALID_STATUS 0x2000
-#define TAS_COMMAND_COMPLETE 0x1000
-#define TAS_COMMAND_MASK 0x0fff
-
-/* TAS commands */
-#define COMMAND_CHANNEL_CREATE 0x001
-#define COMMAND_CHANNEL_DELETE 0x002
-#define COMMAND_DUMP_MEMORY 0x101
-
-/* command status values */
-#define STATUS_OK 0x00
-#define STATUS_INVALID_COMMAND 0x01
-#define STATUS_READ_CHANNEL_HEADER 0x02
-#define STATUS_WRITE_CHANNEL_HEADER 0x03
-#define STATUS_DMA_READ 0x04
-#define STATUS_DMA_WRITE 0x05
-#define STATUS_NO_MORE_CHANNELS 0x06
-#define STATUS_NO_SUCH_CHANNEL 0x07
-/* catastrophic errors start here... */
-#define STATUS_LOCAL_ADDRESS_ERROR 0xaa
-#define STATUS_ACFAIL 0xac
-#define STATUS_LOCAL_BUS_ERROR 0xbb
-#define STATUS_CONFIDENCE_FAILED 0xcc
-#define STATUS_UNEXPECTED_ERROR 0xee
-#define STATUS_ERRNO 0x100 /* not from status reg */
-
-/*
- * BPP Channel header
- */
-
-struct bpp_channel {
- uint32_t ch_cmd_head; /* command pipe head */
- uint32_t ch_cmd_tail; /* command pipe tail */
- uint32_t ch_status_head; /* status pipe head */
- uint32_t ch_status_tail; /* status pipe tail */
- uint8_t ch_ipl; /* channel interrupt level */
- uint8_t ch_ivec; /* channel interrupt vector */
- uint8_t ch_priority; /* channel priority */
-#define BPP_PRIORITY_HIGHEST 0x00
-#define BPP_PRIORITY_LOWEST 0xff
- uint8_t ch_addrmod; /* envelope memory address modifier */
- uint8_t ch_num; /* set by firmware */
- uint8_t ch_valid; /* set by firmware */
- uint8_t ch_buswidth; /* unused */
- uint8_t reserved;
-};
-
-/*
- * BPP Envelope structure
- */
-
-struct bpp_envelope {
- uint32_t env_link; /* next envelope */
- uint32_t env_pkt; /* command packet physical address */
- uint8_t env_valid;
-#define ENVELOPE_INVALID 0x00
-#define ENVELOPE_VALID 0x01 /* any nonzero value will do */
- uint8_t reserved[3];
- /*
- * The following is not part of the envelope as defined by the
- * firmware, but is used to page the envelope to a 68040/88200
- * cache line boundary.
- */
- uint32_t pad;
- /* total size 0x10 bytes */
-};
-
-/*
- * Data bus width
- */
-
-#define MEMT_D16 1
-#define MEMT_D32 2
-
-/*
- * The following defines ought to be in a MI vme header file...
- */
-
-/*
- * VME addressing modes
- */
-
-#define ADRM_STD_S_P 0x3e /* standard supervisory program */
-#define ADRM_STD_S_D 0x3d /* standard supervisory data */
-#define ADRM_STD_N_P 0x3a /* standard normal program */
-#define ADRM_STD_N_D 0x39 /* standard normal data */
-#define ADRM_SHT_S_IO 0x2d /* short supervisory I/O */
-#define ADRM_SHT_N_IO 0x29 /* short normal I/O */
-#define ADRM_EXT_S_P 0x0e /* extended supervisory program */
-#define ADRM_EXT_S_D 0x0d /* extended supervisory data */
-#define ADRM_EXT_N_P 0x0a /* extended normal program */
-#define ADRM_EXT_N_D 0x09 /* extended normal data */
-#define ADRM_EXT_S_BM 0x0f /* extended supervisory block mode */
-#define ADRM_EXT_S_D64 0x0c /* extended supervisory D64 mode */
-
-/*
- * Per channel information
- */
-
-struct bpp_chan {
- struct bpp_channel *ch; /* bpp communication channel */
-
- struct bpp_envelope *envcmd; /* command tail envelope */
- struct bpp_envelope *envsts; /* status head envelope */
-};
-
-/*
- * Device superset
- */
-
-struct bpp_softc {
- struct device sc_dev;
-
- bus_space_tag_t sc_iot; /* CSR registers access */
- bus_space_handle_t sc_ioh;
-
- struct bpp_envelope *sc_env_free; /* head of free envelope list */
-
- /* channel function pointers */
- paddr_t (*bpp_chan_pa)(struct bpp_softc *, struct bpp_channel *);
- void (*bpp_chan_sync)(struct bpp_softc *, struct bpp_channel *, int);
-
- /* envelope function pointers */
- paddr_t (*bpp_env_pa)(struct bpp_softc *, struct bpp_envelope *);
- struct bpp_envelope *(*bpp_env_va)(struct bpp_softc *, paddr_t);
- void (*bpp_env_sync)(struct bpp_softc *, struct bpp_envelope *, int);
-};
-
-void bpp_attach(struct bpp_softc *, bus_space_tag_t, bus_space_handle_t);
-void bpp_attention(struct bpp_softc *);
-int bpp_create_channel(struct bpp_softc *, struct bpp_chan *,
- int, int, int);
-int bpp_dequeue_envelope(struct bpp_softc *, struct bpp_chan *, paddr_t *);
-struct bpp_envelope *
- bpp_get_envelope(struct bpp_softc *);
-void bpp_initialize_envelopes(struct bpp_softc *, struct bpp_envelope *,
- uint);
-void bpp_put_envelope(struct bpp_softc *, struct bpp_envelope *);
-void bpp_queue_envelope(struct bpp_softc *, struct bpp_chan *,
- struct bpp_envelope *, paddr_t);
-int bpp_reset(struct bpp_softc *);
diff --git a/sys/arch/mvme88k/dev/bugio.c b/sys/arch/mvme88k/dev/bugio.c
deleted file mode 100644
index 56d919e5cd1..00000000000
--- a/sys/arch/mvme88k/dev/bugio.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/* $OpenBSD: bugio.c,v 1.21 2013/05/14 20:30:47 miod Exp $ */
-/*
- * Copyright (c) 2006, 2010, Miodrag Vallat.
- * Copyright (c) 1998 Steve Murphree, Jr.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-
-#include <machine/asm_macro.h>
-#include <machine/bugio.h>
-#include <machine/prom.h>
-
-register_t ossr3;
-register_t bugsr3;
-
-#ifdef MULTIPROCESSOR
-#include <sys/lock.h>
-__cpu_simple_lock_t bug_lock = __SIMPLELOCK_UNLOCKED;
-#define BUG_LOCK() __cpu_simple_lock(&bug_lock)
-#define BUG_UNLOCK() __cpu_simple_unlock(&bug_lock)
-#else
-#define BUG_LOCK() do { } while (0)
-#define BUG_UNLOCK() do { } while (0)
-#endif
-
-#define MVMEPROM_CALL(x) \
- __asm__ __volatile__ ("or %%r9,%%r0," __STRING(x) "; tb0 0,%%r0,496" \
- ::: "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", \
- "r9", "r10", "r11", "r12", "r13", "memory")
-
-#define BUGCTXT() \
-{ \
- BUG_LOCK(); \
- psr = get_psr(); \
- set_psr(psr | PSR_IND); /* paranoia */ \
- __asm__ __volatile__ ("ldcr %0, %%cr20" : "=r" (ossr3)); \
- __asm__ __volatile__ ("stcr %0, %%cr20" :: "r"(bugsr3)); \
-}
-
-#define OSCTXT() \
-{ \
- __asm__ __volatile__ ("ldcr %0, %%cr20" : "=r" (bugsr3)); \
- __asm__ __volatile__ ("stcr %0, %%cr20" :: "r"(ossr3)); \
- set_psr(psr); \
- BUG_UNLOCK(); \
-}
-
-void
-buginit()
-{
- __asm__ __volatile__ ("ldcr %0, %%cr20" : "=r" (bugsr3));
-}
-
-char
-buginchr(void)
-{
- u_int psr;
- int ret;
-
-#ifdef DIAGNOSTIC
- if (!cold)
- panic("%s: BUG calls are forbidden at this point", __func__);
-#endif
-
- BUGCTXT();
- MVMEPROM_CALL(MVMEPROM_INCHR);
- __asm__ __volatile__ ("or %0,%%r0,%%r2" : "=r" (ret));
- OSCTXT();
- return ((char)ret & 0xff);
-}
-
-void
-bugoutchr(int c)
-{
- u_int psr;
-
-#ifdef DIAGNOSTIC
- if (!cold)
- panic("%s: BUG calls are forbidden at this point", __func__);
-#endif
-
- BUGCTXT();
- __asm__ __volatile__ ("or %%r2,%%r0,%0" : : "r" (c));
- MVMEPROM_CALL(MVMEPROM_OUTCHR);
- OSCTXT();
-}
-
-void
-bugreturn(void)
-{
- u_int psr;
-
-#ifdef DIAGNOSTIC
- if (!cold)
- panic("%s: BUG calls are forbidden at this point", __func__);
-#endif
-
- BUGCTXT();
- MVMEPROM_CALL(MVMEPROM_EXIT);
- OSCTXT();
-}
-
-void
-bugbrdid(struct mvmeprom_brdid *id)
-{
- u_int psr;
- struct mvmeprom_brdid *ptr;
-
-#ifdef DIAGNOSTIC
- if (!cold)
- panic("%s: BUG calls are forbidden at this point", __func__);
-#endif
-
- BUGCTXT();
- MVMEPROM_CALL(MVMEPROM_GETBRDID);
- __asm__ __volatile__ ("or %0,%%r0,%%r2" : "=r" (ptr));
- OSCTXT();
-
- bcopy(ptr, id, sizeof(struct mvmeprom_brdid));
-}
-
-void
-bugdiskrd(struct mvmeprom_dskio *dio)
-{
- u_int psr;
-
-#ifdef DIAGNOSTIC
- if (!cold)
- panic("%s: BUG calls are forbidden at this point", __func__);
-#endif
-
- BUGCTXT();
- __asm__ __volatile__ ("or %%r2, %%r0, %0" : : "r" (dio));
- MVMEPROM_CALL(MVMEPROM_DSKRD);
- OSCTXT();
-}
-
-#ifdef MULTIPROCESSOR
-
-/*
- * Ask the BUG to start a particular cpu at our provided address.
- */
-int
-spin_cpu(cpuid_t cpu, vaddr_t address)
-{
- u_int psr;
- int ret;
-
-#ifdef DIAGNOSTIC
- if (!cold)
- panic("%s: BUG calls are forbidden at this point", __func__);
-#endif
-
- BUGCTXT();
- __asm__ __volatile__ ("or %%r2, %%r0, %0; or %%r3, %%r0, %1" ::
- "r" (cpu), "r" (address));
- MVMEPROM_CALL(MVMEPROM_FORKMPU);
- __asm__ __volatile__ ("or %0,%%r0,%%r2" : "=r" (ret));
- OSCTXT();
-
- return (ret);
-}
-
-#endif /* MULTIPROCESSOR */
diff --git a/sys/arch/mvme88k/dev/bussw.c b/sys/arch/mvme88k/dev/bussw.c
deleted file mode 100644
index 79b7ef92513..00000000000
--- a/sys/arch/mvme88k/dev/bussw.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/* $OpenBSD: bussw.c,v 1.20 2007/12/13 18:50:10 miod Exp $ */
-/*
- * Copyright (c) 1999 Steve Murphree, Jr.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-#include <sys/systm.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-
-#include <mvme88k/dev/busswreg.h>
-
-struct bussw_softc {
- struct device sc_dev;
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
-};
-
-void bussw_attach(struct device *, struct device *, void *);
-int bussw_match(struct device *, void *, void *);
-
-struct cfattach bussw_ca = {
- sizeof(struct bussw_softc), bussw_match, bussw_attach
-};
-
-struct cfdriver bussw_cd = {
- NULL, "bussw", DV_DULL
-};
-
-int bussw_print(void *, const char *);
-int bussw_scan(struct device *, void *, void *);
-
-int
-bussw_match(parent, vcf, args)
- struct device *parent;
- void *vcf, *args;
-{
- struct confargs *ca = args;
- bus_space_handle_t ioh;
- int rc;
- u_int8_t chipid;
-
- /* Don't match if wrong cpu */
- if (brdtyp != BRD_197)
- return 0;
-
- if (bus_space_map(ca->ca_iot, ca->ca_paddr, BS_SIZE, 0, &ioh) != 0)
- return 0;
- rc = badaddr((vaddr_t)bus_space_vaddr(ca->ca_iot, ioh), 4);
- if (rc == 0) {
- chipid = bus_space_read_1(ca->ca_iot, ioh, BS_CHIPID);
- if (chipid != BUSSWITCH_ID) {
-#ifdef DEBUG
- printf("==> busswitch: wrong chip id %x\n", chipid);
-#endif
- rc = -1;
- }
- }
- bus_space_unmap(ca->ca_iot, ioh, BS_SIZE);
-
- return rc == 0;
-}
-
-void
-bussw_attach(parent, self, args)
- struct device *parent, *self;
- void *args;
-{
- struct confargs *ca = args;
- struct bussw_softc *sc = (struct bussw_softc *)self;
- bus_space_handle_t ioh;
- int i;
-
- if (bus_space_map(ca->ca_iot, ca->ca_paddr, BS_SIZE, 0, &ioh) != 0) {
- printf(": can't map registers!\n");
- return;
- }
-
- sc->sc_iot = ca->ca_iot;
- sc->sc_ioh = ioh;
-
- bus_space_write_1(sc->sc_iot, ioh, BS_VBASE,
- bus_space_read_1(sc->sc_iot, ioh, BS_VBASE) | BS_VECBASE);
-
- /* enable external interrupts */
- bus_space_write_2(sc->sc_iot, ioh, BS_GCSR,
- bus_space_read_2(sc->sc_iot, ioh, BS_GCSR) | BS_GCSR_XIPL);
-
- /* disable write posting */
- for (i = 0; i < 4; i++)
- bus_space_write_1(sc->sc_iot, ioh, BS_PAR + i,
- bus_space_read_1(sc->sc_iot, ioh, BS_PAR + i) & ~BS_PAR_WPEN);
-
- /* enable abort switch */
- bus_space_write_1(sc->sc_iot, ioh, BS_ABORT,
- bus_space_read_1(sc->sc_iot, ioh, BS_ABORT) | BS_ABORT_IEN);
-
- printf(": rev %x\n",
- bus_space_read_1(sc->sc_iot, ioh, BS_CHIPREV));
-
- config_search(bussw_scan, self, args);
-}
-
-int
-bussw_print(args, bus)
- void *args;
- const char *bus;
-{
- struct confargs *ca = args;
-
- if (ca->ca_offset != -1)
- printf(" offset 0x%x", ca->ca_offset);
- if (ca->ca_ipl > 0)
- printf(" ipl %d", ca->ca_ipl);
- return (UNCONF);
-}
-
-int
-bussw_scan(parent, child, args)
- struct device *parent;
- void *child, *args;
-{
- struct cfdata *cf = child;
- struct confargs oca, *ca = args;
-
- bzero(&oca, sizeof oca);
- oca.ca_iot = ca->ca_iot;
- oca.ca_dmat = ca->ca_dmat;
- oca.ca_offset = cf->cf_loc[0];
- oca.ca_ipl = cf->cf_loc[1];
- if (oca.ca_offset != -1) {
- oca.ca_paddr = ca->ca_paddr + oca.ca_offset;
- } else {
- oca.ca_paddr = -1;
- }
- oca.ca_bustype = BUS_BUSSWITCH;
- oca.ca_name = cf->cf_driver->cd_name;
- if ((*cf->cf_attach->ca_match)(parent, cf, &oca) == 0)
- return (0);
- config_attach(parent, cf, &oca, bussw_print);
- return (1);
-}
diff --git a/sys/arch/mvme88k/dev/busswreg.h b/sys/arch/mvme88k/dev/busswreg.h
deleted file mode 100644
index 2354e61bfcf..00000000000
--- a/sys/arch/mvme88k/dev/busswreg.h
+++ /dev/null
@@ -1,207 +0,0 @@
-/* $OpenBSD: busswreg.h,v 1.13 2009/02/14 17:39:51 miod Exp $ */
-
-/*
- * Memory map for BusSwitch chip found in mvme197 boards.
- */
-#ifndef BUSSWREG_H
-#define BUSSWREG_H
-
-#define BS_BASE 0xfff00000
-#define BS_SIZE 0x00000120
-
-#define BS_CHIPID 0x0000
-#define BS_CHIPREV 0x0001
-#define BS_GCSR 0x0002
-#define BS_IODATA 0x0004
-#define BS_IODIR 0x0006
-#define BS_PSAR1 0x0008
-#define BS_PEAR1 0x000a
-#define BS_PSAR2 0x000c
-#define BS_PEAR2 0x000e
-#define BS_PSAR3 0x0010
-#define BS_PEAR3 0x0012
-#define BS_PSAR4 0x0014
-#define BS_PEAR4 0x0016
-#define BS_PTR1 0x0018
-#define BS_PTSR1 0x001a
-#define BS_PTR2 0x001c
-#define BS_PTSR2 0x001e
-#define BS_PTR3 0x0020
-#define BS_PTSR3 0x0022
-#define BS_PTR4 0x0024
-#define BS_PTSR4 0x0026
-#define BS_SSAR1 0x0028
-#define BS_SEAR1 0x002a
-#define BS_SSAR2 0x002c
-#define BS_SEAR2 0x002e
-#define BS_SSAR3 0x0030
-#define BS_SEAR3 0x0032
-#define BS_SSAR4 0x0034
-#define BS_SEAR4 0x0036
-#define BS_STR1 0x0038
-#define BS_STSR1 0x003a
-#define BS_STR2 0x003c
-#define BS_STSR2 0x003e
-#define BS_STR3 0x0040
-#define BS_STSR3 0x0042
-#define BS_STR4 0x0044
-#define BS_STSR4 0x0046
-#define BS_PAR 0x0048
-#define BS_SAR 0x004c
-#define BS_BTIMER 0x0051
-#define BS_PADJUST 0x0052
-#define BS_PCOUNT 0x0053
-#define BS_PAL 0x0054
-#define BS_WPPA 0x0058
-#define BS_WPTPA 0x005c
-#define BS_WPPAT 0x005e
-#define BS_ROMCR 0x0060
-#define BS_TCTRL1 0x0062
-#define BS_TCTRL2 0x0063
-#define BS_LEVEL 0x0064
-#define BS_MASK 0x0065
-#define BS_ISEL0 0x0066 /* do not access on 197LE!!! */
-#define BS_ISEL1 0x0067 /* do not access on 197LE!!! */
-#define BS_ABORT 0x0068
-#define BS_CPINT 0x0069
-#define BS_TINT1 0x006a
-#define BS_TINT2 0x006b
-#define BS_WPINT 0x006c
-#define BS_PALINT 0x006d
-#define BS_XINT 0x006e
-#define BS_VBASE 0x006f
-#define BS_TCOMP1 0x0070
-#define BS_TCOUNT1 0x0074
-#define BS_TCOMP2 0x0078
-#define BS_TCOUNT2 0x007c
-#define BS_GPR 0x0080
-#define BS_XCTAGS 0x0090
-#define BS_XCCR 0x0100
-#define BS_VEC 0x0104
-
-#define BUSSWITCH_ID 0x21 /* value at CHIPID */
-
-/* GCSR bit definitions */
-#define BS_GCSR_APRI0 0x0001 /* Bus Request 0 Priority indicator (CPU0)*/
-#define BS_GCSR_APRI1 0x0002 /* Bus Request 1 Priority indicator (CPU1)*/
-#define BS_GCSR_APRI2 0x0003 /* Bus Request 2 Priority indicator (mc88410)*/
-#define BS_GCSR_AMOD 0x0004 /* Arbitration Mode */
-#define BS_GCSR_BREN 0x0008 /* Bus Request Enable */
-#define BS_GCSR_CPUID 0x0010 /* CPU ID */
-#define BS_GCSR_B410 0x0020 /* BUS410 indicator */
-#define BS_GCSR_INVD 0x0040 /* Invalidate Decoder */
-#define BS_GCSR_USR 0x0080 /* User Access Enable */
-#define BS_GCSR_XIPL 0x0100 /* External IPL Enable */
-#define BS_GCSR_TCPU1 0x0200 /* Test CPU 1 Registers */
-#define BS_GCSR_XCC 0x0400 /* External Cache Controller */
-#define BS_GCSR_INCB 0x0800 /* Increment On Burst */
-#define BS_GCSR_TDPR 0x2000 /* Test Dual Processor Registers */
-#define BS_GCSR_TBB 0x4000 /* Test Bus Busy */
-#define BS_GCSR_POR 0x8000 /* Power On Reset */
-
-/* Processor Attribute Registers bit definitions */
-#define BS_PAR_DEN 0x01 /* Decode Enable */
-#define BS_PAR_WPEN 0x02 /* Write Post Enable */
-
-/* System Attribute Registers bit definitions */
-#define BS_SAR_DEN 0x01 /* Decode Enable */
-#define BS_SAR_INVR 0x04 /* Invalidate On Reads */
-#define BS_SAR_GBL 0x08 /* Global Access */
-
-/* Bus Timer Register bit definitions */
-#define BS_BTIMER_PBT8 0x00 /* Processor Bus Timout, 8 usec */
-#define BS_BTIMER_PBT64 0x01 /* Processor Bus Timout, 64 usec */
-#define BS_BTIMER_PBT256 0x02 /* Processor Bus Timout, 256 usec */
-#define BS_BTIMER_PBTD 0x03 /* Processor Bus Timout, disable */
-#define BS_BTIMER_PBT_MASK 0x03
-#define BS_BTIMER_SBT8 0x00 /* System Bus Timout, 8 usec */
-#define BS_BTIMER_SBT64 0x04 /* System Bus Timout, 64 usec */
-#define BS_BTIMER_SBT256 0x08 /* System Bus Timout, 256 usec */
-#define BS_BTIMER_SBTD 0x0c /* System Bus Timout, disable */
-#define BS_BTIMER_SBT_MASK 0x0c
-
-/* ROM Control Register bit definitions */
-#define BS_ROMCR_WEN0 0x0100
-#define BS_ROMCR_WEN1 0x0200
-#define BS_ROMCR_SGLB 0x0400
-#define BS_ROMCR_ROM0 0x8000
-
-/* External Cache Control Register bit definitions */
-#define BS_XCC_F0 0x00000001
-#define BS_XCC_F1 0x00000002
-#define BS_XCC_FBSY 0x00000004
-#define BS_XCC_DIAG 0x00000008
-
-/* Abort Control Register */
-#define BS_ABORT_ICLR 0x08 /* abort interrupt clear */
-#define BS_ABORT_IEN 0x10 /* abort interrupt enable */
-#define BS_ABORT_INT 0x20 /* abort interrupt received */
-#define BS_ABORT_ABT 0x40 /* abort interrupt asserted */
-
-/* Cross Processor Interrupt Register */
-#define BS_CPI_ICLR 0x08 /* cpi interrupt clear */
-#define BS_CPI_IEN 0x10 /* cpi interrupt enable */
-#define BS_CPI_INT 0x20 /* cpi interrupt received */
-#define BS_CPI_STAT 0x40 /* cpi interrupt status */
-#define BS_CPI_SCPI 0x80 /* send cross proc interrupt */
-
-/* Timer Control Register */
-#define BS_TCTRL_CEN 0x01 /* counter enable */
-#define BS_TCTRL_COC 0x02 /* clear on compare */
-#define BS_TCTRL_COVF 0x04 /* clear overflow counter */
-#define BS_TCTRL_OVF(x) ((x) >> 4) /* overflow counter */
-
-/* Timer Interrupt Register */
-#define BS_TINT_ICLR 0x08 /* timer interrupt clear */
-#define BS_TINT_IEN 0x10 /* timer interrupt enable */
-#define BS_TINT_INT 0x20 /* timer interrupt received */
-#define BS_TINT_LM 0x07 /* timer level mask */
-#define BS_TINT_LEVEL(x) (x & BS_TINT_LM)
-
-/* Write Post Control Register */
-#define BS_WPINT_ICLR 0x08 /* WPINT interrupt clear */
-#define BS_WPINT_IEN 0x10 /* WPINT interrupt enable */
-#define BS_WPINT_INT 0x20 /* WPINT interrupt received */
-#define BS_WPINT_LM 0x07 /* WPINT level mask */
-#define BS_WPINT_LEVEL(x) (x & BS_WPINT_LM)
-
-/* Processor Address Log Interrupt Register */
-#define BS_PALINT_ICLR 0x08 /* PALINT interrupt clear */
-#define BS_PALINT_IEN 0x10 /* PALINT interrupt enable */
-#define BS_PALINT_INT 0x20 /* PALINT interrupt received */
-#define BS_PALINT_PLTY 0x80 /* PALINT polarity */
-#define BS_PALINT_LM 0x07 /* PALINT level mask */
-#define BS_PALINT_LEVEL(x) (x & BS_PALINT_LM)
-
-/* External Interrupt Register */
-#define BS_XINT_ICLR 0x08 /* XINT interrupt clear */
-#define BS_XINT_IEN 0x10 /* XINT interrupt enable */
-#define BS_XINT_INT 0x20 /* XINT interrupt received */
-#define BS_XINT_EL 0x40 /* XINT edge/level */
-#define BS_XINT_PLTY 0x80 /* XINT polarity */
-#define BS_XINT_LM 0x07 /* XINT level mask */
-#define BS_XINT_LEVEL(x) (x & BS_XINT_LM)
-
-/* Vector Base Register (A read upon an interrupt reveals the source) */
-#define BS_VBASE_SRC_TMR1 0x0
-#define BS_VBASE_SRC_TMR2 0x1
-#define BS_VBASE_SRC_WPE 0x2
-#define BS_VBASE_SRC_PAL 0x3
-#define BS_VBASE_SRC_EXT 0x4 /* external interrupt */
-#define BS_VBASE_SRC_SPUR 0x7 /* spurious interrupt */
-
-/*
- * BusSwitch wired interrupt vectors
- */
-
-#define BS_VECBASE 0x40 /* vector base */
-#define BS_NVEC 0x10
-
-#define BS_TMR1IRQ 0x00 /* timer1 */
-#define BS_TMR2IRQ 0x01 /* timer2 */
-#define BS_WPEIRQ 0x02 /* write post error */
-#define BS_PALIRQ 0x03 /* processor address log interrupt */
-#define BS_EXTIRQ 0x04 /* external interrupt */
-#define BS_SPURIRQ 0x07 /* spurious interrupt */
-
-#endif /* BUSSWREG_H */
diff --git a/sys/arch/mvme88k/dev/cl.c b/sys/arch/mvme88k/dev/cl.c
deleted file mode 100644
index 42233a6e7e2..00000000000
--- a/sys/arch/mvme88k/dev/cl.c
+++ /dev/null
@@ -1,1780 +0,0 @@
-/* $OpenBSD: cl.c,v 1.60 2013/10/07 17:53:57 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Dale Rahn. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* DMA mode still does not work!!! */
-
-#include <sys/param.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-#include <sys/uio.h>
-#include <sys/systm.h>
-#include <sys/time.h>
-#include <sys/device.h>
-#include <sys/syslog.h>
-
-#include <machine/autoconf.h>
-#include <machine/conf.h>
-#include <machine/cpu.h>
-#include <machine/psl.h>
-
-#include <dev/cons.h>
-
-#include <mvme88k/dev/clreg.h>
-#include <mvme88k/dev/pcctworeg.h>
-#include <mvme88k/dev/pcctwovar.h>
-
-#ifdef DDB
-#include <ddb/db_var.h>
-#endif
-
-#define splcl() spltty()
-
-/* min timeout 0xa, what is a good value */
-#define CL_TIMEOUT 0x10
-#define CL_FIFO_MAX 0x20
-#define CL_FIFO_CNT 0xc
-#define CL_RX_TIMEOUT 0x10
-
-#define CL_RXDMAINT 0x82
-#define CL_TXDMAINT 0x42
-#define CL_TXMASK 0x47
-#define CL_RXMASK 0x87
-#define CL_TXINTR 0x02
-#define CL_RXINTR 0x02
-
-struct cl_cons {
- bus_space_tag_t cl_iot;
- bus_space_handle_t cl_ioh;
- volatile u_int8_t *cl_rxiack;
- u_int8_t channel;
-} cl_cons;
-
-struct cl_info {
- struct tty *tty;
- u_char cl_swflags;
- u_char cl_softchar;
- u_char cl_consio;
- u_char cl_speed;
- u_char cl_parstop; /* parity, stop bits. */
- u_char cl_rxmode;
- u_char cl_txmode;
- u_char cl_clen;
- u_char cl_parity;
-#if 0
- u_char transmitting;
-#endif
- u_long txcnt;
- u_long rxcnt;
-
- void *rx[2];
- void *rxp[2];
- void *tx[2];
- void *txp[2];
-};
-#define CLCD_PORTS_PER_CHIP 4
-#define CL_BUFSIZE 256
-
-#ifndef DO_MALLOC
-/* four (4) buffers per port */
-char cl_dmabuf[CLCD_PORTS_PER_CHIP * CL_BUFSIZE * 4];
-char cl_dmabuf1[CLCD_PORTS_PER_CHIP * CL_BUFSIZE * 4];
-#endif
-
-struct clsoftc {
- struct device sc_dev;
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
- time_t sc_fotime; /* time of last fifo overrun */
- struct cl_info sc_cl[CLCD_PORTS_PER_CHIP];
- struct intrhand sc_ih_e;
- struct intrhand sc_ih_m;
- struct intrhand sc_ih_t;
- struct intrhand sc_ih_r;
- char sc_errintrname[16 + 4];
- char sc_mxintrname[16 + 3];
- char sc_rxintrname[16 + 3];
- char sc_txintrname[16 + 3];
- struct pcctwosoftc *sc_pcctwo;
-};
-
-const struct {
- u_int speed;
- u_char divisor;
- u_char clock;
- u_char rx_timeout;
-} cl_clocks[] = {
- { 64000, 0x26, 0, 0x01},
- { 56000, 0x2c, 0, 0x01},
- { 38400, 0x40, 0, 0x01},
- { 19200, 0x81, 0, 0x02},
- { 9600, 0x40, 1, 0x04},
- { 7200, 0x56, 1, 0x04},
- { 4800, 0x81, 1, 0x08},
- { 3600, 0xad, 1, 0x08},
- { 2400, 0x40, 2, 0x10},
- { 1200, 0x81, 2, 0x20},
- { 600, 0x40, 3, 0x40},
- { 300, 0x81, 3, 0x80},
- { 150, 0x40, 3, 0x80},
- { 110, 0x58, 4, 0xff},
- { 50, 0xC2, 4, 0xff},
- { 0, 0x00, 0, 0},
-};
-
-#define CL_SAFE_CLOCK 4 /* 9600 entry */
-
-/* prototypes */
-cons_decl(cl);
-int cl_instat(struct clsoftc *sc);
-u_int8_t cl_clkdiv(int speed);
-u_int8_t cl_clknum(int speed);
-u_int8_t cl_clkrxtimeout(int speed);
-void clstart(struct tty *tp);
-void cl_unblock(struct tty *tp);
-int clccparam(struct clsoftc *sc, struct termios *par, int channel);
-
-int clparam(struct tty *tp, struct termios *t);
-int cl_mintr(void *);
-int cl_txintr(void *);
-int cl_rxintr(void *);
-void cl_overflow(struct clsoftc *sc, int channel, long *ptime, char *msg);
-void cl_parity(struct clsoftc *sc, int channel);
-void cl_frame(struct clsoftc *sc, int channel);
-void cl_break( struct clsoftc *sc, int channel);
-int clmctl(dev_t dev, int bits, int how);
-#ifdef DEBUG
-void cl_dumpport(struct clsoftc *, int);
-#endif
-
-int clprobe(struct device *parent, void *self, void *aux);
-void clattach(struct device *parent, struct device *self, void *aux);
-
-void cl_initchannel(struct clsoftc *sc, int channel);
-void clputc(struct clsoftc *sc, int unit, u_char c);
-
-struct cfattach cl_ca = {
- sizeof(struct clsoftc), clprobe, clattach
-};
-
-struct cfdriver cl_cd = {
- NULL, "cl", DV_TTY
-};
-
-#if 0
-#define CLCDBUF 80
-void cloutput(struct tty *tp);
-#endif
-
-#define CL_UNIT(x) (minor(x) >> 2)
-#define CL_CHANNEL(x) (minor(x) & 3)
-
-struct tty *
-cltty(dev)
- dev_t dev;
-{
- int unit, channel;
- struct clsoftc *sc;
-
- unit = CL_UNIT(dev);
- if (unit >= cl_cd.cd_ndevs ||
- (sc = (struct clsoftc *)cl_cd.cd_devs[unit]) == NULL) {
- return NULL;
- }
- channel = CL_CHANNEL(dev);
- return sc->sc_cl[channel].tty;
-}
-
-int
-clprobe(parent, self, aux)
- struct device *parent;
- void *self;
- void *aux;
-{
- struct confargs *ca = aux;
- bus_space_handle_t ioh;
- int rc;
-
- if (brdtyp == BRD_188)
- return 0;
-
- /*
- * We do not accept empty locators here...
- */
- if (ca->ca_paddr == CD2400_BASE_ADDR ||
- (ca->ca_paddr == CD2400_SECONDARY_ADDR && brdtyp == BRD_8120)) {
- if (bus_space_map(ca->ca_iot, ca->ca_paddr, CD2400_SIZE,
- 0, &ioh) != 0)
- return 0;
- rc = badaddr((vaddr_t)bus_space_vaddr(ca->ca_iot, ioh), 1);
- bus_space_unmap(ca->ca_iot, ioh, CD2400_SIZE);
- return rc == 0;
- }
-
- return 0;
-}
-
-void
-clattach(parent, self, aux)
- struct device *parent;
- struct device *self;
- void *aux;
-{
- struct clsoftc *sc = (struct clsoftc *)self;
- struct confargs *ca = aux;
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- int i;
-
- if (ca->ca_ipl < 0)
- ca->ca_ipl = IPL_TTY;
-
- iot = sc->sc_iot = ca->ca_iot;
- if (bus_space_map(iot, ca->ca_paddr, CD2400_SIZE, 0, &ioh) != 0) {
- printf(": can't map registers!\n");
- return;
- }
- sc->sc_ioh = ioh;
- sc->sc_pcctwo = (struct pcctwosoftc *)parent;
-
- if (ca->ca_paddr == CD2400_BASE_ADDR) {
- /*
- * Although we are still running using the BUG routines,
- * this device will be elected as the console after
- * autoconf. Mark it as such.
- */
- sc->sc_cl[0].cl_consio = 1;
- printf(": console");
- } else {
- /* reset chip only if we are not console device */
- /* wait for GFRCR */
- }
- /* allow chip to settle before continuing */
- delay(800);
-
- /* set up global registers */
- bus_space_write_1(iot, ioh, CL_TPR, CL_TIMEOUT);
- bus_space_write_1(iot, ioh, CL_RPILR, 0x03);
- bus_space_write_1(iot, ioh, CL_TPILR, 0x02);
- bus_space_write_1(iot, ioh, CL_MPILR, 0x01);
-
-#ifdef DO_MALLOC
- sc->sc_cl[0].rx[0] = (void *)(dvma_malloc(16 * CL_BUFSIZE));
-#else
- /* XXX */
- if ((vaddr_t)ca->ca_paddr == CD2400_BASE_ADDR)
- sc->sc_cl[0].rx[0] = (void *)(&cl_dmabuf);
- else
- sc->sc_cl[0].rx[0] = (void *)(&cl_dmabuf1);
-#endif
- sc->sc_cl[0].rx[1] = (void *)(((int)sc->sc_cl[0].rx[0]) + CL_BUFSIZE);
- sc->sc_cl[1].rx[0] = (void *)(((int)sc->sc_cl[0].rx[1]) + CL_BUFSIZE);
- sc->sc_cl[1].rx[1] = (void *)(((int)sc->sc_cl[1].rx[0]) + CL_BUFSIZE);
-
- sc->sc_cl[2].rx[0] = (void *)(((int)sc->sc_cl[1].rx[1]) + CL_BUFSIZE);
- sc->sc_cl[2].rx[1] = (void *)(((int)sc->sc_cl[2].rx[0]) + CL_BUFSIZE);
- sc->sc_cl[3].rx[0] = (void *)(((int)sc->sc_cl[2].rx[1]) + CL_BUFSIZE);
- sc->sc_cl[3].rx[1] = (void *)(((int)sc->sc_cl[3].rx[0]) + CL_BUFSIZE);
-
- sc->sc_cl[0].tx[0] = (void *)(((int)sc->sc_cl[3].rx[1]) + CL_BUFSIZE);
- sc->sc_cl[0].tx[1] = (void *)(((int)sc->sc_cl[0].tx[0]) + CL_BUFSIZE);
- sc->sc_cl[1].tx[0] = (void *)(((int)sc->sc_cl[0].tx[1]) + CL_BUFSIZE);
- sc->sc_cl[1].tx[1] = (void *)(((int)sc->sc_cl[1].tx[0]) + CL_BUFSIZE);
-
- sc->sc_cl[2].tx[0] = (void *)(((int)sc->sc_cl[1].tx[1]) + CL_BUFSIZE);
- sc->sc_cl[2].tx[1] = (void *)(((int)sc->sc_cl[2].tx[0]) + CL_BUFSIZE);
- sc->sc_cl[3].tx[0] = (void *)(((int)sc->sc_cl[2].tx[1]) + CL_BUFSIZE);
- sc->sc_cl[3].tx[1] = (void *)(((int)sc->sc_cl[3].tx[0]) + CL_BUFSIZE);
- for (i = 0; i < CLCD_PORTS_PER_CHIP; i++) {
-#if 0
- int j;
-
- for (j = 0; j < 2 ; j++) {
- sc->sc_cl[i].rxp[j] = (void *)kvtop(sc->sc_cl[i].rx[j]);
- printf("cl[%d].rxbuf[%d] %x p %x\n",
- i, j, sc->sc_cl[i].rx[j], sc->sc_cl[i].rxp[j]);
- sc->sc_cl[i].txp[j] = (void *)kvtop(sc->sc_cl[i].tx[j]);
- printf("cl[%d].txbuf[%d] %x p %x\n",
- i, j, sc->sc_cl[i].tx[j], sc->sc_cl[i].txp[j]);
- }
-#endif
-#if 0
- sc->sc_cl[i].cl_rxmode =
- !(!((flags >> (i * CL_FLAG_BIT_PCH)) & 0x01));
- sc->sc_cl[i].cl_txmode =
- !(!((flags >> (i * CL_FLAG_BIT_PCH)) & 0x02));
- sc->sc_cl[i].cl_softchar =
- !(!((flags >> (i * CL_FLAG_BIT_PCH)) & 0x04));
-#endif
- cl_initchannel(sc, i);
- }
-
- /* clear errors */
- bus_space_write_1(sc->sc_pcctwo->sc_iot, sc->sc_pcctwo->sc_ioh,
- PCCTWO_SCCERR, 0x01);
-
- /* enable interrupts */
- sc->sc_ih_e.ih_fn = cl_rxintr;
- sc->sc_ih_e.ih_arg = sc;
- sc->sc_ih_e.ih_wantframe = 0;
- sc->sc_ih_e.ih_ipl = ca->ca_ipl;
-
- sc->sc_ih_m.ih_fn = cl_mintr;
- sc->sc_ih_m.ih_arg = sc;
- sc->sc_ih_m.ih_wantframe = 0;
- sc->sc_ih_m.ih_ipl = ca->ca_ipl;
-
- sc->sc_ih_t.ih_fn = cl_txintr;
- sc->sc_ih_t.ih_arg = sc;
- sc->sc_ih_t.ih_wantframe = 0;
- sc->sc_ih_t.ih_ipl = ca->ca_ipl;
-
- sc->sc_ih_r.ih_fn = cl_rxintr;
- sc->sc_ih_r.ih_arg = sc;
- sc->sc_ih_r.ih_wantframe = 0;
- sc->sc_ih_r.ih_ipl = ca->ca_ipl;
-
- snprintf(sc->sc_errintrname, sizeof sc->sc_errintrname,
- "%s_err", self->dv_xname);
- snprintf(sc->sc_mxintrname, sizeof sc->sc_mxintrname,
- "%s_mx", self->dv_xname);
- snprintf(sc->sc_rxintrname, sizeof sc->sc_rxintrname,
- "%s_rx", self->dv_xname);
- snprintf(sc->sc_txintrname, sizeof sc->sc_txintrname,
- "%s_tx", self->dv_xname);
-
- pcctwointr_establish(PCC2V_SCC_RXE, &sc->sc_ih_e, sc->sc_errintrname);
- pcctwointr_establish(PCC2V_SCC_M, &sc->sc_ih_m, sc->sc_mxintrname);
- pcctwointr_establish(PCC2V_SCC_TX, &sc->sc_ih_t, sc->sc_txintrname);
- pcctwointr_establish(PCC2V_SCC_RX, &sc->sc_ih_r, sc->sc_rxintrname);
-
- bus_space_write_1(sc->sc_pcctwo->sc_iot, sc->sc_pcctwo->sc_ioh,
- PCCTWO_SCCICR, PCC2_IRQ_IEN | (ca->ca_ipl & PCC2_IRQ_IPL));
- bus_space_write_1(sc->sc_pcctwo->sc_iot, sc->sc_pcctwo->sc_ioh,
- PCCTWO_SCCTX, PCC2_IRQ_IEN | (ca->ca_ipl & PCC2_IRQ_IPL));
- bus_space_write_1(sc->sc_pcctwo->sc_iot, sc->sc_pcctwo->sc_ioh,
- PCCTWO_SCCRX, PCC2_IRQ_IEN | (ca->ca_ipl & PCC2_IRQ_IPL));
-
- printf("\n");
-}
-
-void
-cl_initchannel(sc, channel)
- struct clsoftc *sc;
- int channel;
-{
- int s;
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
-
- iot = sc->sc_iot;
- ioh = sc->sc_ioh;
-
- /* set up option registers */
- sc->sc_cl[channel].tty = NULL;
- s = splhigh();
-
- bus_space_write_1(iot, ioh, CL_CAR, channel);
- bus_space_write_1(iot, ioh, CL_LIVR, PCC2_VECT + PCC2V_SCC_RXE);
- bus_space_write_1(iot, ioh, CL_IER, 0);
-
- if (sc->sc_cl[channel].cl_consio == 0) {
- bus_space_write_1(iot, ioh, CL_CMR, 0x02);
- bus_space_write_1(iot, ioh, CL_COR1, 0x17);
- bus_space_write_1(iot, ioh, CL_COR2, 0x00);
- bus_space_write_1(iot, ioh, CL_COR3, 0x02);
- bus_space_write_1(iot, ioh, CL_COR4, 0xec);
- bus_space_write_1(iot, ioh, CL_COR5, 0xec);
- bus_space_write_1(iot, ioh, CL_COR6, 0x00);
- bus_space_write_1(iot, ioh, CL_COR7, 0x00);
- bus_space_write_1(iot, ioh, CL_SCHR1, 0x00);
- bus_space_write_1(iot, ioh, CL_SCHR2, 0x00);
- bus_space_write_1(iot, ioh, CL_SCHR3, 0x00);
- bus_space_write_1(iot, ioh, CL_SCHR4, 0x00);
- bus_space_write_1(iot, ioh, CL_SCRL, 0x00);
- bus_space_write_1(iot, ioh, CL_SCRH, 0x00);
- bus_space_write_1(iot, ioh, CL_LNXT, 0x00);
- bus_space_write_1(iot, ioh, CL_RBPR, 0x40); /* 9600 */
- bus_space_write_1(iot, ioh, CL_RCOR, 0x01);
- bus_space_write_1(iot, ioh, CL_TBPR, 0x40); /* 9600 */
- bus_space_write_1(iot, ioh, CL_TCOR, 0x01 << 5);
- /* console port should be 0x88 already */
- bus_space_write_1(iot, ioh, CL_MSVR_RTS, 0x00);
- bus_space_write_1(iot, ioh, CL_MSVR_DTR, 0x00);
- bus_space_write_1(iot, ioh, CL_RTPRL, CL_RX_TIMEOUT);
- bus_space_write_1(iot, ioh, CL_RTPRH, 0x00);
- }
- bus_space_write_1(iot, ioh, CL_CCR, 0x20);
- while (bus_space_read_1(iot, ioh, CL_CCR) != 0)
- ;
-
- splx(s);
-}
-
-
-int cldefaultrate = TTYDEF_SPEED;
-
-int
-clmctl(dev, bits, how)
- dev_t dev;
- int bits;
- int how;
-{
- struct clsoftc *sc;
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- int s;
-
- /* should only be called with valid device */
- sc = (struct clsoftc *)cl_cd.cd_devs[CL_UNIT(dev)];
- iot = sc->sc_iot;
- ioh = sc->sc_ioh;
-
- /* settings are currently ignored */
- s = splcl();
- switch (how) {
- case DMSET:
- if (bits & TIOCM_RTS)
- bus_space_write_1(iot, ioh, CL_MSVR_RTS, 0x01);
- else
- bus_space_write_1(iot, ioh, CL_MSVR_RTS, 0x00);
- if (bits & TIOCM_DTR)
- bus_space_write_1(iot, ioh, CL_MSVR_DTR, 0x02);
- else
- bus_space_write_1(iot, ioh, CL_MSVR_DTR, 0x00);
- break;
-
- case DMBIC:
- if (bits & TIOCM_RTS)
- bus_space_write_1(iot, ioh, CL_MSVR_RTS, 0x00);
- if (bits & TIOCM_DTR)
- bus_space_write_1(iot, ioh, CL_MSVR_DTR, 0x00);
- break;
-
- case DMBIS:
- if (bits & TIOCM_RTS)
- bus_space_write_1(iot, ioh, CL_MSVR_RTS, 0x01);
- if (bits & TIOCM_DTR)
- bus_space_write_1(iot, ioh, CL_MSVR_DTR, 0x02);
- break;
-
- case DMGET:
- bits = 0;
-
- {
- u_int8_t msvr;
-
- msvr = bus_space_read_1(iot, ioh, CL_MSVR_RTS);
- if (msvr & 0x80)
- bits |= TIOCM_DSR;
- if (msvr & 0x40)
- bits |= TIOCM_CD;
- if (msvr & 0x20)
- bits |= TIOCM_CTS;
- if (msvr & 0x10)
- bits |= TIOCM_DTR;
- if (msvr & 0x02)
- bits |= TIOCM_DTR;
- if (msvr & 0x01)
- bits |= TIOCM_RTS;
- }
- break;
- }
- splx(s);
-#if 0
- bits = 0;
- /* proper defaults? */
- bits |= TIOCM_DTR;
- bits |= TIOCM_RTS;
- bits |= TIOCM_CTS;
- bits |= TIOCM_CD;
- /* bits |= TIOCM_RI; */
- bits |= TIOCM_DSR;
-#endif
-
- return bits;
-}
-
-int
-clopen(dev, flag, mode, p)
- dev_t dev;
- int flag;
- int mode;
- struct proc *p;
-{
- int s, unit, channel;
- struct cl_info *cl;
- struct clsoftc *sc;
- struct tty *tp;
-
- unit = CL_UNIT(dev);
- if (unit >= cl_cd.cd_ndevs ||
- (sc = (struct clsoftc *)cl_cd.cd_devs[unit]) == NULL) {
- return ENODEV;
- }
-
- channel = CL_CHANNEL(dev);
- cl = &sc->sc_cl[channel];
-
- s = splcl();
- if (cl->tty) {
- tp = cl->tty;
- } else {
- tp = cl->tty = ttymalloc(0);
- }
- tp->t_oproc = clstart;
- tp->t_param = clparam;
- tp->t_dev = dev;
-
- if ((tp->t_state & TS_ISOPEN) == 0) {
- tp->t_state |= TS_WOPEN;
- ttychars(tp);
- if (tp->t_ispeed == 0) {
- /*
- * only when cleared do we reset to defaults.
- */
- tp->t_iflag = TTYDEF_IFLAG;
- tp->t_oflag = TTYDEF_OFLAG;
- tp->t_lflag = TTYDEF_LFLAG;
- tp->t_ispeed = tp->t_ospeed = cldefaultrate;
-
- if (sc->sc_cl[channel].cl_consio != 0) {
- /* console is 8N1 */
- tp->t_cflag = (CREAD | CS8 | HUPCL);
- } else {
- tp->t_cflag = TTYDEF_CFLAG;
- }
- }
- /*
- * do these all the time
- */
- if (cl->cl_swflags & TIOCFLAG_CLOCAL)
- tp->t_cflag |= CLOCAL;
- if (cl->cl_swflags & TIOCFLAG_CRTSCTS)
- tp->t_cflag |= CRTSCTS;
- if (cl->cl_swflags & TIOCFLAG_MDMBUF)
- tp->t_cflag |= MDMBUF;
- clparam(tp, &tp->t_termios);
- ttsetwater(tp);
-
- (void)clmctl(dev, TIOCM_DTR | TIOCM_RTS, DMSET);
-#ifdef XXX
- if ((cl->cl_swflags & TIOCFLAG_SOFTCAR) ||
- (clmctl(dev, 0, DMGET) & TIOCM_CD)) {
- tp->t_state |= TS_CARR_ON;
- } else {
- tp->t_state &= ~TS_CARR_ON;
- }
-#endif
- tp->t_state |= TS_CARR_ON;
- {
- u_int8_t save;
-
- save = bus_space_read_1(sc->sc_iot, sc->sc_ioh, CL_CAR);
- bus_space_write_1(sc->sc_iot, sc->sc_ioh, CL_CAR,
- channel);
- bus_space_write_1(sc->sc_iot, sc->sc_ioh, CL_IER, 0x88);
- bus_space_write_1(sc->sc_iot, sc->sc_ioh, CL_CAR,
- save);
- }
- } else if (tp->t_state & TS_XCLUDE && suser(p, 0) != 0) {
- splx(s);
- return EBUSY;
- }
- splx(s);
-
- /*
- * Reset the tty pointer, as there could have been a dialout
- * use of the tty with a dialin open waiting.
- */
- tp->t_dev = dev;
-#ifdef DEBUG
- cl_dumpport(sc, channel);
-#endif
- return (*linesw[tp->t_line].l_open)(dev, tp, p);
-}
-
-int
-clparam(tp, t)
- struct tty *tp;
- struct termios *t;
-{
- int unit, channel;
- struct clsoftc *sc;
- int s;
- dev_t dev;
-
- dev = tp->t_dev;
- unit = CL_UNIT(dev);
- if (unit >= cl_cd.cd_ndevs ||
- (sc = (struct clsoftc *)cl_cd.cd_devs[unit]) == NULL) {
- return ENODEV;
- }
- channel = CL_CHANNEL(dev);
- tp->t_ispeed = t->c_ispeed;
- tp->t_ospeed = t->c_ospeed;
- tp->t_cflag = t->c_cflag;
- clccparam(sc, t, channel);
- s = splcl();
- cl_unblock(tp);
- splx(s);
- return 0;
-}
-
-#if 0
-void
-cloutput(tp)
- struct tty *tp;
-{
- int cc, s, unit, cnt;
- u_char *tptr;
- int channel;
- struct clsoftc *sc;
- dev_t dev;
- u_char cl_obuffer[CLCDBUF+1];
-
- dev = tp->t_dev;
- unit = CL_UNIT(dev);
- if (unit >= cl_cd.cd_ndevs ||
- (sc = (struct clsoftc *)cl_cd.cd_devs[unit]) == NULL) {
- return;
- }
- channel = CL_CHANNEL(dev);
-
- if ((tp->t_state & TS_ISOPEN) == 0)
- return;
-
- s = splcl();
- cc = tp->t_outq.c_cc;
- while (cc > 0) {
-/*XXX*/
- cnt = min (CLCDBUF,cc);
- cnt = q_to_b(&tp->t_outq, cl_obuffer, cnt);
- if (cnt == 0) {
- break;
- }
- for (tptr = cl_obuffer; tptr < &cl_obuffer[cnt]; tptr++) {
- clputc(sc, channel, *tptr);
- }
- cc -= cnt;
- }
- splx(s);
-}
-#endif
-
-int
-clclose(dev, flag, mode, p)
- dev_t dev;
- int flag;
- int mode;
- struct proc *p;
-{
- int unit, channel;
- struct tty *tp;
- struct cl_info *cl;
- struct clsoftc *sc;
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- int s;
-
- unit = CL_UNIT(dev);
- if (unit >= cl_cd.cd_ndevs ||
- (sc = (struct clsoftc *)cl_cd.cd_devs[unit]) == NULL) {
- return ENODEV;
- }
- channel = CL_CHANNEL(dev);
- cl = &sc->sc_cl[channel];
- iot = sc->sc_iot;
- ioh = sc->sc_ioh;
- tp = cl->tty;
- (*linesw[tp->t_line].l_close)(tp, flag, p);
-
- s = splcl();
- bus_space_write_1(iot, ioh, CL_CAR, channel);
- if (cl->cl_consio == 0 && (tp->t_cflag & HUPCL) != 0) {
- bus_space_write_1(iot, ioh, CL_MSVR_RTS, 0x00);
- bus_space_write_1(iot, ioh, CL_MSVR_DTR, 0x00);
- bus_space_write_1(iot, ioh, CL_CCR, 0x05);
- }
-
-
- splx(s);
- ttyclose(tp);
-
-#if 0
- cl->tty = NULL;
-#endif
-#ifdef DEBUG
- cl_dumpport(sc, channel);
-#endif
-
- return 0;
-}
-
-int
-clread(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- int unit, channel;
- struct tty *tp;
- struct cl_info *cl;
- struct clsoftc *sc;
- unit = CL_UNIT(dev);
- if (unit >= cl_cd.cd_ndevs ||
- (sc = (struct clsoftc *)cl_cd.cd_devs[unit]) == NULL) {
- return ENODEV;
- }
- channel = CL_CHANNEL(dev);
- cl = &sc->sc_cl[channel];
- tp = cl->tty;
- if (tp == NULL)
- return ENXIO;
- return (*linesw[tp->t_line].l_read)(tp, uio, flag);
-}
-
-int
-clwrite(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
-{
- int unit, channel;
- struct tty *tp;
- struct cl_info *cl;
- struct clsoftc *sc;
- unit = CL_UNIT(dev);
- if (unit >= cl_cd.cd_ndevs ||
- (sc = (struct clsoftc *)cl_cd.cd_devs[unit]) == NULL) {
- return ENODEV;
- }
- channel = CL_CHANNEL(dev);
- cl = &sc->sc_cl[channel];
- tp = cl->tty;
- if (tp == NULL)
- return ENXIO;
- return (*linesw[tp->t_line].l_write)(tp, uio, flag);
-}
-
-int
-clioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- int error;
- int unit, channel;
- struct tty *tp;
- struct cl_info *cl;
- struct clsoftc *sc;
- unit = CL_UNIT(dev);
- if (unit >= cl_cd.cd_ndevs ||
- (sc = (struct clsoftc *)cl_cd.cd_devs[unit]) == NULL) {
- return ENODEV;
- }
- channel = CL_CHANNEL(dev);
- cl = &sc->sc_cl[channel];
- tp = cl->tty;
- if (tp == NULL)
- return ENXIO;
-
- error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
- if (error >= 0)
- return error;
-
- error = ttioctl(tp, cmd, data, flag, p);
- if (error >= 0)
- return error;
-
- switch (cmd) {
- case TIOCSBRK:
- /* */
- break;
-
- case TIOCCBRK:
- /* */
- break;
-
- case TIOCSDTR:
- (void) clmctl(dev, TIOCM_DTR | TIOCM_RTS, DMBIS);
- break;
-
- case TIOCCDTR:
- (void) clmctl(dev, TIOCM_DTR | TIOCM_RTS, DMBIC);
- break;
-
- case TIOCMSET:
- (void) clmctl(dev, *(int *) data, DMSET);
- break;
-
- case TIOCMBIS:
- (void) clmctl(dev, *(int *) data, DMBIS);
- break;
-
- case TIOCMBIC:
- (void) clmctl(dev, *(int *) data, DMBIC);
- break;
-
- case TIOCMGET:
- *(int *)data = clmctl(dev, 0, DMGET);
- break;
- case TIOCGFLAGS:
- *(int *)data = cl->cl_swflags;
- break;
- case TIOCSFLAGS:
- error = suser(p, 0);
- if (error != 0)
- return EPERM;
-
- cl->cl_swflags = *(int *)data;
- cl->cl_swflags &= /* only allow valid flags */
- (TIOCFLAG_SOFTCAR | TIOCFLAG_CLOCAL | TIOCFLAG_CRTSCTS);
- break;
- default:
- return ENOTTY;
- }
-
- return 0;
-}
-
-int
-clstop(tp, flag)
- struct tty *tp;
- int flag;
-{
- int s;
-
- s = splcl();
- if (tp->t_state & TS_BUSY) {
- if ((tp->t_state & TS_TTSTOP) == 0)
- tp->t_state |= TS_FLUSH;
- }
- splx(s);
- return 0;
-}
-
-void
-clcnprobe(cp)
- struct consdev *cp;
-{
- int maj;
-
- /* bomb if it'a a MVME188 */
- if (brdtyp == BRD_188 || badaddr(CD2400_BASE_ADDR, 1) != 0)
- return;
-
- /* do not attach as console if cl has been disabled */
- if (cl_cd.cd_ndevs == 0 || cl_cd.cd_devs[0] == NULL)
- return;
-
- /* locate the major number */
- for (maj = 0; maj < nchrdev; maj++)
- if (cdevsw[maj].d_open == clopen)
- break;
- if (maj == nchrdev)
- return;
-
- cp->cn_dev = makedev(maj, 0);
- cp->cn_pri = CN_LOWPRI;
-}
-
-void
-clcninit(cp)
- struct consdev *cp;
-{
- struct clsoftc *sc;
-
- sc = (struct clsoftc *)cl_cd.cd_devs[0];
- cl_cons.cl_iot = sc->sc_iot;
- cl_cons.cl_ioh = sc->sc_ioh;
- cl_cons.cl_rxiack = (void *)(sc->sc_pcctwo->sc_base + PCCTWO_SCCRXIACK);
-}
-
-int
-cl_instat(sc)
- struct clsoftc *sc;
-{
- u_int8_t rir;
-
- if (sc == NULL)
- rir = bus_space_read_1(cl_cons.cl_iot, cl_cons.cl_ioh, CL_RIR);
- else
- rir = bus_space_read_1(sc->sc_iot, sc->sc_ioh, CL_RIR);
-
- return (rir & 0x40);
-}
-
-int
-clcngetc(dev)
- dev_t dev;
-{
- u_int8_t val, reoir, licr, data;
- int got_char = 0;
- u_int8_t ier_old;
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
-
- iot = cl_cons.cl_iot;
- ioh = cl_cons.cl_ioh;
-
- bus_space_write_1(iot, ioh, CL_CAR, 0);
- ier_old = bus_space_read_1(iot, ioh, CL_IER);
- if ((ier_old & 0x08) == 0) {
- bus_space_write_1(iot, ioh, CL_IER, 0x08);
- } else
- ier_old = 0xff;
-
- while (got_char == 0) {
- val = bus_space_read_1(iot, ioh, CL_RIR);
- /* if no receive interrupt pending wait */
- if ((val & 0x80) == 0)
- continue;
-
- /* XXX do we need to suck the entire FIFO contents? */
- reoir = *cl_cons.cl_rxiack; /* receive PIACK */
- licr = bus_space_read_1(iot, ioh, CL_LICR);
- /* is the interrupt for us? (port 0) */
- if (((licr >> 2) & 0x3) == 0) {
- (void)bus_space_read_1(iot, ioh, CL_RISRL);
- (void)bus_space_read_1(iot, ioh, CL_RFOC);
- data = bus_space_read_1(iot, ioh, CL_RDR);
- if (ier_old != 0xff)
- bus_space_write_1(iot, ioh, CL_IER, ier_old);
- got_char = 1;
- } else {
- /* read and discard the character */
- data = bus_space_read_1(iot, ioh, CL_RDR);
- }
- bus_space_write_1(iot, ioh, CL_TEOIR, 0x00);
- }
-
- return data;
-}
-
-void
-clcnputc(dev, c)
- dev_t dev;
- u_char c;
-{
- clputc(0, 0, c);
-}
-
-void
-clcnpollc(dev, on)
- dev_t dev;
- int on;
-{
- if (on != 0) {
- /* enable polling */
- } else {
- /* disable polling */
- }
-}
-
-void
-clputc(sc, unit, c)
- struct clsoftc *sc;
- int unit;
- u_char c;
-{
- u_int8_t schar;
- u_int8_t oldchannel;
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- int s;
-
- if (sc == NULL) {
- /* output on console */
- iot = cl_cons.cl_iot;
- ioh = cl_cons.cl_ioh;
- } else {
- iot = sc->sc_iot;
- ioh = sc->sc_ioh;
- }
-
- s = splhigh();
- oldchannel = bus_space_read_1(iot, ioh, CL_CAR);
- bus_space_write_1(iot, ioh, CL_CAR, unit);
- if (unit == 0) {
- schar = bus_space_read_1(iot, ioh, CL_SCHR3);
- /* send special char, number 3 */
- bus_space_write_1(iot, ioh, CL_SCHR3, c);
- bus_space_write_1(iot, ioh, CL_STCR, 0x08 | 3);
- while (bus_space_read_1(iot, ioh, CL_STCR) != 0) {
- /* wait until cl notices the command
- * otherwise it may not notice the character
- * if we send characters too fast.
- */
- }
- DELAY(5);
- bus_space_write_1(iot, ioh, CL_SCHR3, schar);
- } else {
- if (bus_space_read_1(iot, ioh, CL_TFTC) != 0)
- bus_space_write_1(iot, ioh, CL_TDR, c);
- }
- bus_space_write_1(iot, ioh, CL_CAR, oldchannel);
- splx(s);
-}
-
-int
-clccparam(sc, par, channel)
- struct clsoftc *sc;
- struct termios *par;
- int channel;
-{
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- u_int divisor, clk, clen;
- int s, imask, ints;
-
- iot = sc->sc_iot;
- ioh = sc->sc_ioh;
-
- s = splcl();
- bus_space_write_1(iot, ioh, CL_CAR, channel);
- if (par->c_ospeed == 0) {
- /* dont kill the console */
- if (sc->sc_cl[channel].cl_consio == 0) {
- /* disconnect, drop RTS DTR stop receiver */
- bus_space_write_1(iot, ioh, CL_MSVR_RTS, 0x00);
- bus_space_write_1(iot, ioh, CL_MSVR_DTR, 0x00);
- bus_space_write_1(iot, ioh, CL_CCR, 0x05);
- }
- splx(s);
- return 0xff;
- }
-
- bus_space_write_1(iot, ioh, CL_MSVR_RTS, 0x03);
- bus_space_write_1(iot, ioh, CL_MSVR_DTR, 0x03);
-
- divisor = cl_clkdiv(par->c_ospeed);
- clk = cl_clknum(par->c_ospeed);
- bus_space_write_1(iot, ioh, CL_TBPR, divisor);
- bus_space_write_1(iot, ioh, CL_TCOR, clk << 5);
- divisor = cl_clkdiv(par->c_ispeed);
- clk = cl_clknum(par->c_ispeed);
- bus_space_write_1(iot, ioh, CL_RBPR, divisor);
- bus_space_write_1(iot, ioh, CL_RCOR, clk);
- bus_space_write_1(iot, ioh, CL_RTPRL, cl_clkrxtimeout(par->c_ispeed));
- bus_space_write_1(iot, ioh, CL_RTPRH, 0x00);
-
- switch (par->c_cflag & CSIZE) {
- case CS5:
- clen = 4; /* this is the mask for the chip. */
- imask = 0x1F;
- break;
- case CS6:
- clen = 5;
- imask = 0x3F;
- break;
- case CS7:
- clen = 6;
- imask = 0x7F;
- break;
- default:
- clen = 7;
- imask = 0xFF;
- }
-
- bus_space_write_1(iot, ioh, CL_COR3, par->c_cflag & PARENB ? 4 : 2);
-
- {
- u_int8_t cor1;
- if (par->c_cflag & PARENB) {
- if (par->c_cflag & PARODD) {
- cor1 = 0xE0 | clen ; /* odd */
- } else {
- cor1 = 0x40 | clen ; /* even */
- }
- } else {
- cor1 = 0x10 | clen; /* ignore parity */
- }
-
- if (bus_space_read_1(iot, ioh, CL_COR1) != cor1) {
- bus_space_write_1(iot, ioh, CL_COR1, cor1);
- bus_space_write_1(iot, ioh, CL_CCR, 0x20);
- while (bus_space_read_1(iot, ioh, CL_CCR) != 0)
- ;
- }
- }
-
- if (sc->sc_cl[channel].cl_consio == 0 && (par->c_cflag & CREAD) == 0)
- bus_space_write_1(iot, ioh, CL_CCR, 0x08);
- else
- bus_space_write_1(iot, ioh, CL_CCR, 0x0a);
-
- while (bus_space_read_1(iot, ioh, CL_CCR) != 0)
- ;
-
- ints = 0;
-#define SCC_DSR 0x80
-#define SCC_DCD 0x40
-#define SCC_CTS 0x20
- if ((par->c_cflag & CLOCAL) == 0) {
- ints |= SCC_DCD;
- }
- if ((par->c_cflag & CCTS_OFLOW) != 0) {
- ints |= SCC_CTS;
- }
- if ((par->c_cflag & CRTSCTS) != 0) {
- ints |= SCC_CTS;
- }
-#ifdef DONT_LET_HARDWARE
- if ((par->c_cflag & CCTS_IFLOW) != 0) {
- ints |= SCC_DSR;
- }
-#endif
- bus_space_write_1(iot, ioh, CL_COR4, ints | CL_FIFO_CNT);
- bus_space_write_1(iot, ioh, CL_COR5, ints | CL_FIFO_CNT);
-
- splx(s);
-
- return imask;
-}
-
-static int clknum = 0;
-
-u_int8_t
-cl_clkdiv(speed)
- int speed;
-{
- int i;
-
- if (cl_clocks[clknum].speed == speed)
- return cl_clocks[clknum].divisor;
-
- for (i = 0; cl_clocks[i].speed != 0; i++) {
- if (cl_clocks[i].speed == speed) {
- clknum = i;
- return cl_clocks[clknum].divisor;
- }
- }
-
- /* return some sane value if unknown speed */
- return cl_clocks[CL_SAFE_CLOCK].divisor;
-}
-
-u_int8_t
-cl_clknum(speed)
- int speed;
-{
- int i;
-
- if (cl_clocks[clknum].speed == speed)
- return cl_clocks[clknum].clock;
-
- for (i = 0; cl_clocks[i].speed != 0; i++) {
- if (cl_clocks[clknum].speed == speed) {
- clknum = i;
- return cl_clocks[clknum].clock;
- }
- }
-
- /* return some sane value if unknown speed */
- return cl_clocks[CL_SAFE_CLOCK].clock;
-}
-
-u_int8_t
-cl_clkrxtimeout(speed)
- int speed;
-{
- int i;
-
- if (cl_clocks[clknum].speed == speed)
- return cl_clocks[clknum].rx_timeout;
-
- for (i = 0; cl_clocks[i].speed != 0; i++) {
- if (cl_clocks[i].speed == speed) {
- clknum = i;
- return cl_clocks[clknum].rx_timeout;
- }
- }
-
- /* return some sane value if unknown speed */
- return cl_clocks[CL_SAFE_CLOCK].rx_timeout;
-}
-
-void
-cl_unblock(tp)
- struct tty *tp;
-{
- tp->t_state &= ~TS_FLUSH;
- if (tp->t_outq.c_cc != 0)
- clstart(tp);
-}
-
-void
-clstart(tp)
- struct tty *tp;
-{
- dev_t dev;
- struct clsoftc *sc;
- int channel, unit, s;
-#if 0
- int cnt;
- u_int8_t cbuf;
-#endif
-
- dev = tp->t_dev;
- channel = CL_CHANNEL(dev);
-/* hack to test output on non console only */
-#if 0
- if (channel == 0) {
- cloutput(tp);
- return;
- }
-#endif
- unit = CL_UNIT(dev);
- if (unit >= cl_cd.cd_ndevs ||
- (sc = (struct clsoftc *)cl_cd.cd_devs[unit]) == NULL) {
- return;
- }
-
- if ((tp->t_state & TS_ISOPEN) == 0)
- return;
-
- s = splcl();
-#if 0
- if (sc->sc_cl[channel].transmitting == 1) {
- /* i'm busy, go away, I will get to it later. */
- splx(s);
- return;
- }
- cnt = q_to_b(&tp->t_outq, &cbuf, 1);
- if ( cnt != 0 ) {
- sc->sc_cl[channel].transmitting = 1;
- bus_space_write_1(sc->sc_iot, sc->sc_ioh, CL_CAR, channel);
- bus_space_write_1(sc->sc_iot, sc->sc_ioh, CL_TDR, cbuf);
- } else {
- sc->sc_cl[channel].transmitting = 0;
- }
-#else
- if ((tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP | TS_FLUSH)) == 0)
- {
- tp->t_state |= TS_BUSY;
- bus_space_write_1(sc->sc_iot, sc->sc_ioh, CL_CAR, channel);
- bus_space_write_1(sc->sc_iot, sc->sc_ioh, CL_IER,
- bus_space_read_1(sc->sc_iot, sc->sc_ioh, CL_IER) | 0x03);
- }
-#endif
- splx(s);
-}
-
-int
-cl_mintr(arg)
- void *arg;
-{
- struct clsoftc *sc = arg;
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- u_int8_t mir, misr, msvr;
- int channel;
-
- iot = sc->sc_iot;
- ioh = sc->sc_ioh;
-
- mir = bus_space_read_1(iot, ioh, CL_MIR);
- if ((mir & 0x40) == 0) {
- return 0;
- }
-
- channel = mir & 0x03;
- misr = bus_space_read_1(iot, ioh, CL_MISR);
- msvr = bus_space_read_1(iot, ioh, CL_MSVR_RTS);
- if (misr & 0x01) {
- /* timers are not currently used?? */
- log(LOG_WARNING, "cl_mintr: channel %x timer 1 unexpected\n",channel);
- }
- if (misr & 0x02) {
- /* timers are not currently used?? */
- log(LOG_WARNING, "cl_mintr: channel %x timer 2 unexpected\n",channel);
- }
- if (misr & 0x20) {
-#ifdef DEBUG
- log(LOG_WARNING, "cl_mintr: channel %x cts %x\n",channel,
- ((msvr & 0x20) != 0x0)
- );
-#endif
- }
- if (misr & 0x40) {
- struct tty *tp = sc->sc_cl[channel].tty;
-#ifdef DEBUG
- log(LOG_WARNING, "cl_mintr: channel %x cd %x\n",channel,
- ((msvr & 0x40) != 0x0)
- );
-#endif
- (*linesw[tp->t_line].l_modem)(tp, ((msvr & 0x40) != 0x0) );
- }
- if (misr & 0x80) {
-#ifdef DEBUG
- log(LOG_WARNING, "cl_mintr: channel %x dsr %x\n",channel,
- ((msvr & 0x80) != 0x0)
- );
-#endif
- }
- bus_space_write_1(iot, ioh, CL_MEOIR, 0);
- return 1;
-}
-
-int
-cl_txintr(arg)
- void *arg;
-{
- static int empty;
- struct clsoftc *sc = arg;
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- u_int8_t tir, cmr, teoir;
- u_int8_t max;
- int channel;
- struct tty *tp;
- int cnt;
- u_char buffer[CL_FIFO_MAX +1];
-
- iot = sc->sc_iot;
- ioh = sc->sc_ioh;
- tir = bus_space_read_1(iot, ioh, CL_TIR);
- if ((tir & 0x40) == 0) {
- return 0;
- }
-
- channel = tir & 0x03;
- sc->sc_cl[channel].txcnt ++;
-
- cmr = bus_space_read_1(iot, ioh, CL_CMR);
-
- tp = sc->sc_cl[channel].tty;
- if (tp == NULL || (tp->t_state & TS_ISOPEN) == 0) {
- bus_space_write_1(iot, ioh, CL_IER,
- bus_space_read_1(iot, ioh, CL_IER) & ~0x03);
- bus_space_write_1(iot, ioh, CL_TEOIR, 0x08);
- return 1;
- }
-
- switch (cmr & CL_TXMASK) {
- case CL_TXDMAINT:
- {
- u_int8_t dmabsts;
- int nbuf, busy, resid;
- void *pbuffer;
-
- dmabsts = bus_space_read_1(iot, ioh, CL_DMABSTS);
- nbuf = ((dmabsts & 0x8) >> 3) & 0x1;
- busy = ((dmabsts & 0x4) >> 2) & 0x1;
-
- do {
- pbuffer = sc->sc_cl[channel].tx[nbuf];
- resid = tp->t_outq.c_cc;
- cnt = min (CL_BUFSIZE,resid);
- log(LOG_WARNING, "cl_txintr: resid %x cnt %x pbuf %p\n",
- resid, cnt, pbuffer);
- if (cnt != 0) {
- cnt = q_to_b(&tp->t_outq, pbuffer, cnt);
- resid -= cnt;
- if (nbuf == 0) {
- bus_space_write_2(iot, ioh, CL_ATBADRU,
- ((u_long)sc->sc_cl[channel].txp[nbuf]) >> 16);
- bus_space_write_2(iot, ioh, CL_ATBADRL,
- ((u_long) sc->sc_cl[channel].txp[nbuf]) & 0xffff);
- bus_space_write_2(iot, ioh, CL_ATBCNT,
- cnt);
- bus_space_write_1(iot, ioh, CL_ATBSTS,
- 0x43);
- } else {
- bus_space_write_2(iot, ioh, CL_BTBADRU,
- ((u_long)sc->sc_cl[channel].txp[nbuf]) >> 16);
- bus_space_write_2(iot, ioh, CL_BTBADRL,
- ((u_long) sc->sc_cl[channel].txp[nbuf]) & 0xffff);
- bus_space_write_2(iot, ioh, CL_BTBCNT,
- cnt);
- bus_space_write_1(iot, ioh, CL_BTBSTS,
- 0x43);
- }
- teoir = 0x08;
- } else {
- teoir = 0x08;
- if (tp->t_state & TS_BUSY) {
- tp->t_state &= ~(TS_BUSY | TS_FLUSH);
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t) &tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- }
- bus_space_write_1(iot, ioh, CL_IER,
- bus_space_read_1(iot, ioh, CL_IER) & ~0x03);
- }
- nbuf = ~nbuf & 0x1;
- busy--;
- } while (resid != 0 && busy != -1);/* if not busy do other buffer */
- }
- break;
- case CL_TXINTR:
- max = bus_space_read_1(iot, ioh, CL_TFTC);
- cnt = min((int)max,tp->t_outq.c_cc);
- if (cnt != 0) {
- cnt = q_to_b(&tp->t_outq, buffer, cnt);
- empty = 0;
- bus_space_write_multi_1(iot, ioh, CL_TDR, buffer, cnt);
- teoir = 0x00;
- } else {
- if (empty > 5 && ((empty % 20000 )== 0)) {
- log(LOG_WARNING, "cl_txintr to many empty intr %d channel %d\n",
- empty, channel);
- }
- empty++;
- teoir = 0x08;
- if (tp->t_state & TS_BUSY) {
- tp->t_state &= ~(TS_BUSY | TS_FLUSH);
- if (tp->t_state & TS_ASLEEP) {
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t) &tp->t_outq);
- }
- selwakeup(&tp->t_wsel);
- }
- bus_space_write_1(iot, ioh, CL_IER,
- bus_space_read_1(iot, ioh, CL_IER) & ~0x03);
- }
- break;
- default:
- log(LOG_WARNING, "cl_txintr unknown mode %x\n", cmr);
- /* we probably will go to hell quickly now */
- teoir = 0x08;
- }
- bus_space_write_1(iot, ioh, CL_TEOIR, teoir);
- return 1;
-}
-
-int
-cl_rxintr(arg)
- void *arg;
-{
- struct clsoftc *sc = arg;
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- u_int8_t rir, channel, cmr, risrl;
- u_int8_t fifocnt;
- struct tty *tp;
- int i;
- u_int8_t reoir;
- u_char buffer[CL_FIFO_MAX +1];
-#ifdef DDB
- int wantddb = 0;
-#endif
-
- iot = sc->sc_iot;
- ioh = sc->sc_ioh;
-
- rir = bus_space_read_1(iot, ioh, CL_RIR);
- if ((rir & 0x40) == 0x0) {
- return 0;
- }
-
- channel = rir & 0x3;
- cmr = bus_space_read_1(iot, ioh, CL_CMR);
-
- sc->sc_cl[channel].rxcnt ++;
- risrl = bus_space_read_1(iot, ioh, CL_RISRL);
- if (risrl & 0x80) {
- /* timeout, no characters */
- } else
- /* We don't need no stinkin special characters */
- if (risrl & 0x08) {
- cl_overflow(sc, channel, (long *)&sc->sc_fotime, "fifo");
- } else
- if (risrl & 0x04) {
- cl_parity(sc, channel);
- } else
- if (risrl & 0x02) {
- cl_frame(sc, channel);
- } else
- if (risrl & 0x01) {
-#ifdef DDB
- if (sc->sc_cl[channel].cl_consio)
- wantddb = db_console;
-#endif
- cl_break(sc, channel);
- }
- reoir = 0x08;
-
- switch (cmr & CL_RXMASK) {
- case CL_RXDMAINT:
- {
- int nbuf;
- u_int16_t cnt;
- int bufcomplete;
- u_int8_t status, dmabsts;
- u_int8_t risrh;
-
- risrh = bus_space_read_1(iot, ioh, CL_RISRH);
- dmabsts = bus_space_read_1(iot, ioh, CL_DMABSTS);
- nbuf = (risrh & 0x08) ? 1 : 0;
- bufcomplete = (risrh & 0x20) ? 1 : 0;
- if (nbuf == 0) {
- cnt = bus_space_read_2(iot, ioh, CL_ARBCNT);
- status = bus_space_read_1(iot, ioh, CL_ARBSTS);
- } else {
- cnt = bus_space_read_2(iot, ioh, CL_BRBCNT);
- status = bus_space_read_1(iot, ioh, CL_BRBSTS);
- }
-#if USE_BUFFER
- cl_appendbufn(sc, channel, sc->rx[nbuf], cnt);
-#else
- {
- int i;
- u_char *pbuf;
-
- tp = sc->sc_cl[channel].tty;
- pbuf = sc->sc_cl[channel].rx[nbuf];
- /* this should be done at off level */
- {
- u_int16_t rcbadru, rcbadrl;
- u_int8_t arbsts, brbsts;
- u_char *pbufs, *pbufe;
-
- rcbadru = bus_space_read_2(iot, ioh,
- CL_RCBADRU);
- rcbadrl = bus_space_read_2(iot, ioh,
- CL_RCBADRL);
- arbsts = bus_space_read_1(iot, ioh, CL_ARBSTS);
- brbsts = bus_space_read_1(iot, ioh, CL_BRBSTS);
- pbufs = sc->sc_cl[channel].rxp[nbuf];
- pbufe = (u_char *)(((u_long)rcbadru << 16) | (u_long)rcbadrl);
- cnt = pbufe - pbufs;
- }
- reoir = 0x0 | (bufcomplete) ? 0 : 0xd0;
- bus_space_write_1(iot, ioh, CL_REOIR, reoir);
-
- DELAY(10); /* give the chip a moment */
-
- for (i = 0; i < cnt; i++) {
- u_char c;
- c = pbuf[i];
- (*linesw[tp->t_line].l_rint)(c,tp);
- }
- /* this should be done at off level */
- if (nbuf == 0) {
- bus_space_write_2(iot, ioh, CL_ARBCNT,
- CL_BUFSIZE);
- bus_space_write_2(iot, ioh, CL_ARBSTS, 0x01);
- } else {
- bus_space_write_2(iot, ioh, CL_BRBCNT,
- CL_BUFSIZE);
- bus_space_write_2(iot, ioh, CL_BRBSTS, 0x01);
- }
- }
-#endif
- }
- bus_space_write_1(iot, ioh, CL_REOIR, reoir);
- break;
- case CL_RXINTR:
- fifocnt = bus_space_read_1(iot, ioh, CL_RFOC);
- tp = sc->sc_cl[channel].tty;
- bus_space_read_multi_1(iot, ioh, CL_RDR, buffer, fifocnt);
- if (tp == NULL) {
- /* if the channel is not configured,
- * dont send characters upstream.
- * also fix problem with NULL dereference
- */
- reoir = 0x00;
- break;
- }
-
- bus_space_write_1(iot, ioh, CL_REOIR, reoir);
- for (i = 0; i < fifocnt; i++) {
- u_char c;
- c = buffer[i];
-#if USE_BUFFER
- cl_appendbuf(sc, channel, c);
-#else
- /* does any restricitions exist on spl
- * for this call
- */
- (*linesw[tp->t_line].l_rint)(c,tp);
-#endif
- }
- break;
- default:
- log(LOG_WARNING, "cl_rxintr unknown mode %x\n", cmr);
- /* we probably will go to hell quickly now */
- bus_space_write_1(iot, ioh, CL_REOIR, 0x08);
- }
-#ifdef DDB
- if (wantddb != 0)
- Debugger();
-#endif
- return 1;
-}
-
-void
-cl_overflow(sc, channel, ptime, msg)
- struct clsoftc *sc;
- int channel;
- long *ptime;
- char *msg;
-{
- log(LOG_WARNING, "%s[%d]: %s overrun\n", sc->sc_dev.dv_xname,
- channel, msg);
-}
-
-void
-cl_parity(sc, channel)
- struct clsoftc *sc;
- int channel;
-{
- log(LOG_WARNING, "%s[%d]: parity error\n", sc->sc_dev.dv_xname,
- channel);
-}
-
-void
-cl_frame(sc, channel)
- struct clsoftc *sc;
- int channel;
-{
- log(LOG_WARNING, "%s[%d]: frame error\n", sc->sc_dev.dv_xname,
- channel);
-}
-
-void
-cl_break(sc, channel)
- struct clsoftc *sc;
- int channel;
-{
-#ifdef DEBUG
- log(LOG_WARNING, "%s[%d]: break detected\n", sc->sc_dev.dv_xname,
- channel);
-#endif
-}
-
-#ifdef DEBUG
-void
-cl_dumpport(struct clsoftc *sc, int channel)
-{
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
- u_int8_t livr, cmr, cor1, cor2, cor3, cor4, cor5, cor6, cor7,
- schr1, schr2, schr3, schr4, scrl, scrh, lnxt,
- rbpr, rcor, tbpr, tcor, rpilr, rir, tpr, ier, ccr,
- dmabsts, arbsts, brbsts, atbsts, btbsts,
- csr, rts, dtr, rtprl, rtprh;
- u_int16_t rcbadru, rcbadrl, arbadru, arbadrl, arbcnt,
- brbadru, brbadrl, brbcnt;
- u_int16_t tcbadru, tcbadrl, atbadru, atbadrl, atbcnt,
- btbadru, btbadrl, btbcnt;
- int s;
-
- iot = sc->sc_iot;
- ioh = sc->sc_ioh;
-
- s = splcl();
- bus_space_write_1(iot, ioh, CL_CAR, channel);
- livr = bus_space_read_1(iot, ioh, CL_LIVR);
- cmr = bus_space_read_1(iot, ioh, CL_CMR);
- cor1 = bus_space_read_1(iot, ioh, CL_COR1);
- cor2 = bus_space_read_1(iot, ioh, CL_COR2);
- cor3 = bus_space_read_1(iot, ioh, CL_COR3);
- cor4 = bus_space_read_1(iot, ioh, CL_COR4);
- cor5 = bus_space_read_1(iot, ioh, CL_COR5);
- cor6 = bus_space_read_1(iot, ioh, CL_COR6);
- cor7 = bus_space_read_1(iot, ioh, CL_COR7);
- schr1 = bus_space_read_1(iot, ioh, CL_SCHR1);
- schr2 = bus_space_read_1(iot, ioh, CL_SCHR2);
- schr3 = bus_space_read_1(iot, ioh, CL_SCHR3);
- schr4 = bus_space_read_1(iot, ioh, CL_SCHR4);
- scrl = bus_space_read_1(iot, ioh, CL_SCRL);
- scrh = bus_space_read_1(iot, ioh, CL_SCRH);
- lnxt = bus_space_read_1(iot, ioh, CL_LNXT);
- rbpr = bus_space_read_1(iot, ioh, CL_RBPR);
- rcor = bus_space_read_1(iot, ioh, CL_RCOR);
- tbpr = bus_space_read_1(iot, ioh, CL_TBPR);
- rpilr = bus_space_read_1(iot, ioh, CL_RPILR);
- rir = bus_space_read_1(iot, ioh, CL_RIR);
- ier = bus_space_read_1(iot, ioh, CL_IER);
- ccr = bus_space_read_1(iot, ioh, CL_CCR);
- tcor = bus_space_read_1(iot, ioh, CL_TCOR);
- csr = bus_space_read_1(iot, ioh, CL_CSR);
- tpr = bus_space_read_1(iot, ioh, CL_TPR);
- rts = bus_space_read_1(iot, ioh, CL_MSVR_RTS);
- dtr = bus_space_read_1(iot, ioh, CL_MSVR_DTR);
- rtprl = bus_space_read_1(iot, ioh, CL_RTPRL);
- rtprh = bus_space_read_1(iot, ioh, CL_RTPRH);
- dmabsts = bus_space_read_1(iot, ioh, CL_DMABSTS);
- tcbadru = bus_space_read_2(iot, ioh, CL_TCBADRU);
- tcbadrl = bus_space_read_2(iot, ioh, CL_TCBADRL);
- rcbadru = bus_space_read_2(iot, ioh, CL_RCBADRU);
- rcbadrl = bus_space_read_2(iot, ioh, CL_RCBADRL);
- arbadru = bus_space_read_2(iot, ioh, CL_ARBADRU);
- arbadrl = bus_space_read_2(iot, ioh, CL_ARBADRL);
- arbcnt = bus_space_read_2(iot, ioh, CL_ARBCNT);
- arbsts = bus_space_read_1(iot, ioh, CL_ARBSTS);
- brbadru = bus_space_read_2(iot, ioh, CL_BRBADRU);
- brbadrl = bus_space_read_2(iot, ioh, CL_BRBADRL);
- brbcnt = bus_space_read_2(iot, ioh, CL_BRBCNT);
- brbsts = bus_space_read_1(iot, ioh, CL_BRBSTS);
- atbadru = bus_space_read_2(iot, ioh, CL_ATBADRU);
- atbadrl = bus_space_read_2(iot, ioh, CL_ATBADRL);
- atbcnt = bus_space_read_2(iot, ioh, CL_ATBCNT);
- atbsts = bus_space_read_1(iot, ioh, CL_ATBSTS);
- btbadru = bus_space_read_2(iot, ioh, CL_BTBADRU);
- btbadrl = bus_space_read_2(iot, ioh, CL_BTBADRL);
- btbcnt = bus_space_read_2(iot, ioh, CL_BTBCNT);
- btbsts = bus_space_read_1(iot, ioh, CL_BTBSTS);
- splx(s);
-
- printf("{ port %x livr %x cmr %x\n",
- channel,livr, cmr);
- printf("cor1 %x cor2 %x cor3 %x cor4 %x cor5 %x cor6 %x cor7 %x\n",
- cor1, cor2, cor3, cor4, cor5, cor6, cor7);
- printf("schr1 %x schr2 %x schr3 %x schr4 %x\n",
- schr1, schr2, schr3, schr4);
- printf("scrl %x scrh %x lnxt %x\n",
- scrl, scrh, lnxt);
- printf("rbpr %x rcor %x tbpr %x tcor %x\n",
- rbpr, rcor, tbpr, tcor);
- printf("rpilr %x rir %x ier %x ccr %x\n",
- rpilr, rir, ier, ccr);
- printf("tpr %x csr %x rts %x dtr %x\n",
- tpr, csr, rts, dtr);
- printf("rtprl %x rtprh %x\n",
- rtprl, rtprh);
- printf("rxcnt %x txcnt %x\n",
- sc->sc_cl[channel].rxcnt, sc->sc_cl[channel].txcnt);
- printf("dmabsts %x, tcbadru %x, tcbadrl %x, rcbadru %x, rcbadrl %x,\n",
- dmabsts, tcbadru, tcbadrl, rcbadru, rcbadrl );
- printf("arbadru %x, arbadrl %x, arbcnt %x, arbsts %x\n",
- arbadru, arbadrl, arbcnt, arbsts);
- printf("brbadru %x, brbadrl %x, brbcnt %x, brbsts %x\n",
- brbadru, brbadrl, brbcnt, brbsts);
- printf("atbadru %x, atbadrl %x, atbcnt %x, atbsts %x\n",
- atbadru, atbadrl, atbcnt, atbsts);
- printf("btbadru %x, btbadrl %x, btbcnt %x, btbsts %x\n",
- btbadru, btbadrl, btbcnt, btbsts);
- printf("}\n");
-}
-#endif
diff --git a/sys/arch/mvme88k/dev/clreg.h b/sys/arch/mvme88k/dev/clreg.h
deleted file mode 100644
index a3c66c92b18..00000000000
--- a/sys/arch/mvme88k/dev/clreg.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/* $OpenBSD: clreg.h,v 1.6 2004/04/24 19:51:47 miod Exp $ */
-
-/* Copyright (c) 1998 Steve Murphree, Jr.
- * Copyright (c) 1995 Dale Rahn. All rights reserved.
- *
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define CL_COR7 0x0007
-#define CL_LIVR 0x0009
-#define CL_COR1 0x0010
-#define CL_IER 0x0011
-#define CL_STCR 0x0012
-#define CL_CCR 0x0013
-#define CL_COR5 0x0014
-#define CL_COR4 0x0015
-#define CL_COR3 0x0016
-#define CL_COR2 0x0017
-#define CL_COR6 0x0018
-#define CL_DMABSTS 0x0019
-#define CL_CSR 0x001a
-#define CL_CMR 0x001b
-#define CL_SCHR4 0x001c
-#define CL_SCHR3 0x001d
-#define CL_SCHR2 0x001e
-#define CL_SCHR1 0x001f
-#define CL_SCRH 0x0022
-#define CL_SCRL 0x0023
-
-#define CL_RTPR 0x0024
-#define CL_RTPRH 0x0024
-#define CL_RTPRL 0x0025
-
-#define CL_LICR 0x0026
-#define CL_LNXT 0x002e
-#define CL_RFOC 0x0030
-
-#define CL_TCBADRU 0x0038
-#define CL_TCBADRL 0x003a
-#define CL_RCBADRU 0x003c
-#define CL_RCBADRL 0x003e
-#define CL_ARBADRU 0x0040
-#define CL_ARBARDL 0x0042
-#define CL_BRBADRU 0x0044
-#define CL_BRBADRL 0x0046
-#define CL_BRBCNT 0x0048
-#define CL_ARBCNT 0x004a
-
-#define CL_BRBSTS 0x004e
-#define CL_ARBSTS 0x004f
-
-#define CL_ATBADR 0x0050
-#define CL_ATBADRU 0x0050
-#define CL_ATBADRL 0x0052
-#define CL_BTBADR 0x0054
-#define CL_BTBADRU 0x0054
-#define CL_BTBADRL 0x0056
-
-#define CL_BTBCNT 0x0058
-#define CL_ATBCNT 0x005a
-
-#define CL_BTBSTS 0x005e
-#define CL_ATBSTS 0x005f
-
-#define CL_TFTC 0x0080
-#define CL_GFRCR 0x0081
-#define CL_REOIR 0x0084
-#define CL_TEOIR 0x0085
-#define CL_MEOIR 0x0086
-
-#define CL_RISR 0x0088
-#define CL_RISRH 0x0088
-#define CL_RISRL 0x0089
-
-#define CL_TISR 0x008a
-#define CL_MISR 0x008b
-#define CL_BERCNT 0x008e
-#define CL_TCOR 0x00c0
-#define CL_TBPR 0x00c3
-#define CL_RCOR 0x00c8
-#define CL_RBPR 0x00cb
-#define CL_CPSR 0x00d6
-#define CL_TPR 0x00da
-#define CL_MSVR_RTS 0x00de
-#define CL_MSVR_DTR 0x00df
-#define CL_TPILR 0x00e0
-#define CL_RPILR 0x00e1
-#define CL_STK 0x00e2
-#define CL_MPILR 0x00e3
-#define CL_TIR 0x00ec
-#define CL_RIR 0x00ed
-#define CL_CAR 0x00ee
-#define CL_MIR 0x00ef
-#define CL_DMR 0x00f6
-#define CL_RDR 0x00f8
-#define CL_TDR 0x00f8
-
-#define CD2400_SIZE 0x200
-
-/*
- * Cirrus chip base address on the mvme1x7 boards.
- */
-#define CD2400_BASE_ADDR 0xfff45000
-#define CD2400_SECONDARY_ADDR 0xfff45200
diff --git a/sys/arch/mvme88k/dev/dart.c b/sys/arch/mvme88k/dev/dart.c
deleted file mode 100644
index de64ab25596..00000000000
--- a/sys/arch/mvme88k/dev/dart.c
+++ /dev/null
@@ -1,410 +0,0 @@
-/* $OpenBSD: dart.c,v 1.61 2013/09/21 20:05:01 miod Exp $ */
-
-/*
- * Copyright (c) 2013 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-/*
- * Mach Operating System
- * Copyright (c) 1993-1991 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON AND OMRON ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON AND OMRON DISCLAIM ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/board.h>
-#include <machine/conf.h>
-#include <machine/cpu.h>
-
-#include <dev/cons.h>
-
-#include <dev/ic/mc68681reg.h>
-#include <dev/ic/mc68681var.h>
-
-#include <machine/mvme181.h>
-#include <machine/mvme188.h>
-
-struct dartsoftc {
- struct mc68681_softc sc_base;
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
- struct intrhand sc_ih;
-};
-
-int dartmatch(struct device *parent, void *self, void *aux);
-void dartattach(struct device *parent, struct device *self, void *aux);
-
-struct cfattach dart_ca = {
- sizeof(struct dartsoftc), dartmatch, dartattach
-};
-
-/* console, if applicable, will always be on the first port */
-#define CONS_PORT A_PORT
-
-cons_decl(dart);
-int dartintr(void *);
-uint8_t dart_read(void *, uint);
-void dart_write(void *, uint, uint8_t);
-
-/*
- * DUART registers are mapped as the least-significant byte of 32-bit addresses.
- * The MVME188 documentation recommends using 32-bit accesses.
- */
-
-uint8_t
-dart_read(void *v, uint reg)
-{
- struct dartsoftc *sc = v;
-
- return (uint8_t)bus_space_read_4(sc->sc_iot, sc->sc_ioh, reg << 2);
-}
-
-void
-dart_write(void *v, uint reg, uint8_t val)
-{
- struct dartsoftc *sc = v;
-
- bus_space_write_4(sc->sc_iot, sc->sc_ioh, reg << 2, val);
- /*
- * Multiple accesses to the same command register must be delayed,
- * to prevent the chip from misbehaving.
- */
- if (reg == DART_CRA || reg == DART_CRB)
- DELAY(2);
-}
-
-int
-dartmatch(struct device *parent, void *cf, void *aux)
-{
- struct confargs *ca = aux;
- bus_space_handle_t ioh;
- int rc;
-
- /*
- * We do not accept empty locators here...
- */
- switch (brdtyp) {
-#ifdef MVME181
- case BRD_180:
- case BRD_181:
- if (ca->ca_paddr != M181_DUART)
- return 0;
- break;
-#endif
-#ifdef MVME188
- case BRD_188:
- if (ca->ca_paddr != DART_BASE)
- return 0;
- break;
-#endif
- default:
- return 0;
- }
-
- if (bus_space_map(ca->ca_iot, ca->ca_paddr, DART_SIZE << 2, 0, &ioh) !=
- 0)
- return 0;
- rc = badaddr((vaddr_t)bus_space_vaddr(ca->ca_iot, ioh), 4);
- bus_space_unmap(ca->ca_iot, ca->ca_paddr, DART_SIZE << 2);
-
- return rc == 0;
-}
-
-void
-dartattach(struct device *parent, struct device *self, void *aux)
-{
- struct dartsoftc *sc = (struct dartsoftc *)self;
- struct mc68681_softc *msc = &sc->sc_base;
- struct confargs *ca = aux;
- bus_space_handle_t ioh;
-
- if (ca->ca_ipl < 0)
- ca->ca_ipl = IPL_TTY;
-
- sc->sc_iot = ca->ca_iot;
- if (bus_space_map(sc->sc_iot, ca->ca_paddr, DART_SIZE << 2, 0, &ioh) !=
- 0) {
- printf(": can't map registers!\n");
- return;
- }
- sc->sc_ioh = ioh;
-
- /*
- * Although we are still running using the BUG routines,
- * this device will be elected as the console after autoconf.
- * We do not even test since we know we are an MVME181 or
- * an MVME188 and console is always on the first port.
- */
- msc->sc_consport = CONS_PORT;
- msc->sc_sw_reg = &msc->sc_sw_reg_store;
-
- msc->sc_read = dart_read;
- msc->sc_write = dart_write;
-
- /*
- * Interrupt configuration.
- * When running on an AngelFire board, we need to enable the timer
- * interrupt since the timer output is not wired to a specific
- * output port.
- */
-#ifdef MVME181
- if (brdtyp == BRD_180 || brdtyp == BRD_181)
- msc->sc_sw_reg->imr = DART_ISR_CT;
-#endif
-
- /*
- * Input Port configuration.
- *
- * On MVME188, they are as follows:
- * IP0 = port A CTS
- * IP1 = port B CTS
- * IP2 and IP4 = port A DCD
- * IP3 and IP5 = port B DCD
- */
- msc->sc_hw[A_PORT].dcd_ip = 2;
- msc->sc_hw[A_PORT].dcd_active_low = 1;
- msc->sc_hw[B_PORT].dcd_ip = 3;
- msc->sc_hw[B_PORT].dcd_active_low = 1;
- msc->sc_sw_reg->acr |=
- DART_ACR_ISR_IP3_CHANGE_ENABLE | DART_ACR_ISR_IP2_CHANGE_ENABLE;
-
- /*
- * Output Port configuration.
- *
- * On MVME188, they are as follow:
- * OP0 = port A RTS
- * OP1 = port B RTS
- * OP2 = port A DTR
- * OP3 = timer output
- * OP5 = port B DTR
- *
- * On MVME180 and MVME181 boards, the timer output is not wired to
- * OP3. Apparently MVME180 routes port B DTR to OP3, while MVME181
- * is MVME188 compatible.
- */
- msc->sc_hw[A_PORT].dtr_op = 2;
- msc->sc_hw[A_PORT].rts_op = 0;
-#ifdef MVME181
- if (brdtyp == BRD_180)
- msc->sc_hw[B_PORT].dtr_op = 3;
- else
-#endif
- msc->sc_hw[B_PORT].dtr_op = 5;
- msc->sc_hw[B_PORT].rts_op = 1;
-#ifdef MVME181
- if (brdtyp == BRD_180)
- msc->sc_sw_reg->oprs =
- DART_OP_OP3 | DART_OP_OP2 | DART_OP_OP1 | DART_OP_OP0;
- else
-#endif
- msc->sc_sw_reg->oprs =
- DART_OP_OP5 | DART_OP_OP2 | DART_OP_OP1 | DART_OP_OP0;
- msc->sc_sw_reg->opcr = DART_OPCR_OP7 | DART_OPCR_OP6 |
- DART_OPCR_OP5 | DART_OPCR_OP4 | DART_OPCR_OP3 | DART_OPCR_OP2;
-
- /*
- * Clock configuration.
- *
- * MVME181 uses the timer mode, MVME188 uses the counter mode.
- */
-#ifdef MVME181
- if (brdtyp == BRD_180 || brdtyp == BRD_181) {
- extern int m181_clkint; /* XXX */
-
- msc->sc_sw_reg->acr = DART_ACR_CT_TIMER_CLK_16;
- msc->sc_sw_reg->ct = &m181_clkint;
- } else
-#endif
- msc->sc_sw_reg->acr = DART_ACR_CT_COUNTER_CLK_16;
-
- mc68681_common_attach(msc);
-
- /* enable interrupts */
- sc->sc_ih.ih_fn = dartintr;
- sc->sc_ih.ih_arg = sc;
- sc->sc_ih.ih_wantframe = 0;
- sc->sc_ih.ih_ipl = ca->ca_ipl;
-
- platform->intsrc_establish(INTSRC_DUART, &sc->sc_ih, self->dv_xname);
-}
-
-int
-dartintr(void *arg)
-{
- struct mc68681_softc *sc = arg;
- uint8_t isr, imr;
- int rc;
-
- isr = (*sc->sc_read)(sc, DART_ISR);
- imr = sc->sc_sw_reg->imr;
-
- isr &= imr;
- if (isr == 0)
- return 0;
-
- rc = 1;
-
-#ifdef MVME181
- if (isr & DART_ISR_CT) {
- rc = -1; /* needs to be handled by the second
- interrupt handler */
- isr &= ~DART_ISR_CT;
- }
-#endif
- if (isr != 0)
- mc68681_intr(sc, isr);
-
- return rc;
-}
-
-/*
- * Console interface routines.
- * Since we select the actual console after all devices are attached,
- * we can safely pick the appropriate softc and use its information.
- */
-
-extern struct cfdriver dart_cd;
-
-void
-dartcnprobe(struct consdev *cp)
-{
- int maj;
-
- switch (brdtyp) {
-#ifdef MVME181
- case BRD_180:
- case BRD_181:
- break;
-#endif
-#ifdef MVME188
- case BRD_188:
- break;
-#endif
- default:
- return;
- }
-
- /* do not attach as console if dart0 has not attached */
- if (dart_cd.cd_ndevs == 0 || dart_cd.cd_devs[0] == NULL)
- return;
-
- /* locate the major number */
- for (maj = 0; maj < nchrdev; maj++)
- if (cdevsw[maj].d_open == dartopen)
- break;
- if (maj == nchrdev)
- return;
-
- cp->cn_dev = makedev(maj, CONS_PORT);
- cp->cn_pri = CN_LOWPRI;
-}
-
-void
-dartcninit(cp)
- struct consdev *cp;
-{
-}
-
-void
-dartcnputc(dev_t dev, int c)
-{
- struct dartsoftc *sc;
- int s;
-
- sc = (struct dartsoftc *)dart_cd.cd_devs[0];
-
- s = spltty();
-
- /* inhibit interrupts on the chip */
- dart_write(sc, DART_IMR, sc->sc_base.sc_sw_reg->imr & ~DART_ISR_TXA);
- /* make sure transmitter is enabled */
- dart_write(sc, DART_CRA, DART_CR_TX_ENABLE);
-
- while ((dart_read(sc, DART_SRA) & DART_SR_TX_READY) == 0)
- ;
- dart_write(sc, DART_TBA, c);
-
- /* wait for transmitter to empty */
- while ((dart_read(sc, DART_SRA) & DART_SR_TX_EMPTY) == 0)
- ;
-
- /* restore the previous state */
- dart_write(sc, DART_IMR, sc->sc_base.sc_sw_reg->imr);
- dart_write(sc, DART_CRA, sc->sc_base.sc_sw_reg->cr[0]);
-
- splx(s);
-}
-
-int
-dartcngetc(dev_t dev)
-{
- struct dartsoftc *sc;
- uint8_t sr; /* status reg of port a/b */
- u_char c; /* received character */
- int s;
-
- sc = (struct dartsoftc *)dart_cd.cd_devs[0];
-
- s = spltty();
-
- /* enable receiver */
- dart_write(sc, DART_CRA, DART_CR_RX_ENABLE);
-
- for (;;) {
- /* read status reg */
- sr = dart_read(sc, DART_SRA);
-
- /* receiver interrupt handler */
- if (sr & DART_SR_RX_READY) {
- /* read character from port */
- c = dart_read(sc, DART_RBA);
-
- /* check break and error conditions */
- if (sr & DART_SR_BREAK) {
- dart_write(sc, DART_CRA, DART_CR_RESET_BREAK);
- dart_write(sc, DART_CRA, DART_CR_RESET_ERROR);
- } else if (sr & (DART_SR_FRAME | DART_SR_PARITY |
- DART_SR_OVERRUN)) {
- dart_write(sc, DART_CRA, DART_CR_RESET_ERROR);
- } else
- break;
- }
- }
- splx(s);
-
- return (int)c;
-}
diff --git a/sys/arch/mvme88k/dev/ds1216.c b/sys/arch/mvme88k/dev/ds1216.c
deleted file mode 100644
index be648d919ca..00000000000
--- a/sys/arch/mvme88k/dev/ds1216.c
+++ /dev/null
@@ -1,298 +0,0 @@
-/* $OpenBSD: ds1216.c,v 1.2 2013/05/24 16:49:54 miod Exp $ */
-
-/*
- * Copyright (c) 2013 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * AngelFire Dallas DS1216 TOD clock support.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/time.h>
-
-#include <machine/autoconf.h>
-#include <machine/board.h>
-#include <machine/bus.h>
-
-#include <machine/mvme181.h>
-
-#include <mvme88k/mvme88k/clockvar.h>
-
-struct ds1216_softc {
- struct device sc_dev;
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
-};
-
-int ds1216_match(struct device *, void *, void *);
-void ds1216_attach(struct device *, struct device *, void *);
-
-const struct cfattach dsrtc_ca = {
- sizeof(struct ds1216_softc), ds1216_match, ds1216_attach
-};
-
-struct cfdriver dsrtc_cd = {
- NULL, "dsrtc", DV_DULL
-};
-
-void ds1216_write_byte(struct ds1216_softc *, uint8_t);
-uint8_t ds1216_read_byte(struct ds1216_softc *);
-void ds1216_select(struct ds1216_softc *);
-void ds1216_unselect(struct ds1216_softc *);
-
-time_t ds1216_inittodr(void);
-void ds1216_resettodr(void);
-
-/*
- * Register layout. All numerical values are in BCD.
- */
-
-#define DS1216_FRAC 0 /* hundredths of seconds (00-99) */
-#define DS1216_SEC 1 /* seconds (00-59) */
-#define DS1216_MIN 2 /* minutes (00-59) */
-#define DS1216_HOUR 3 /* hour (01-12/00-23) and hour control */
-#define DS1216_HOUR_12 0x80 /* 12 hour mode */
-#define DS1216_HOUR_PM 0x20 /* PM bit in 12 hour mode */
-#define DS1216_HOUR_12_MASK 0x1f /* valid digit bits in 12 hour mode */
-#define DS1216_HOUR_24_MASK 0x3f /* valid digit bits in 24 hour mode */
-#define DS1216_DOW 4 /* day of week (01-07) and controls */
-#define DS1216_STOP 0x20 /* oscillator stop */
-#define DS1216_RESET 0x10 /* reset (active low) */
-#define DS1216_DOW_MASK 0x07 /* valid dow bits */
-#define DS1216_DAY 5 /* day of month (01-31) */
-#define DS1216_MONTH 6 /* month (01-12) */
-#define DS1216_YEAR 7 /* year (00-99) */
-
-#define DS1216_NREGS 8
-
-/*
- * Low-level access routines.
- */
-
-/*
- * Access to the Dallas chip is performed by sending a magic sequence
- * first, bit by bit. Two low-order address bits select whether the
- * TOD registers or the on-chip memory is accessed.
- *
- * After the sequence is sent, it is possible to read or write the TOD
- * register or the on-chip memory, using a similar bit-by-bit operation,
- * as a whole.
- *
- * When the read or write sequence completes, the Dallas chip becomes
- * pass-through again.
- */
-
-#define NCYCLES 64
-
-const uint8_t ds1216_unlock_pattern[NCYCLES / 8] = {
- 0xc5, 0x3a, 0xa3, 0x5c, 0xc5, 0x3a, 0xa3, 0x5c
-};
-
-/*
- * On the MVME181, the Dallas chip is connected to cpu A2 onwards (this is
- * similar to the DART wiring), so the A0 and A2 lines are actually A2 and A4.
- */
-#define A0 ((1 << 0) << 2)
-#define A2 ((1 << 2) << 2)
-#define DQ0 (1 << 0)
-
-/*
- * Write 8 bits. A2 low for writing, data in A0.
- */
-void
-ds1216_write_byte(struct ds1216_softc *sc, uint8_t b)
-{
- uint i;
-
- for (i = 8; i != 0; i--) {
- bus_space_read_1(sc->sc_iot, sc->sc_ioh, b & DQ0 ? A0 : 0);
- b >>= 1;
- }
-}
-
-/*
- * Read 8 bits. A2 high for reading, data in DQ0.
- */
-uint8_t
-ds1216_read_byte(struct ds1216_softc *sc)
-{
- uint8_t b = 0, bit = DQ0;
- uint i;
-
- for (i = 8; i != 0; i--) {
- if (bus_space_read_1(sc->sc_iot, sc->sc_ioh, A2) & DQ0)
- b |= bit;
- bit <<= 1;
- }
-
- return b;
-}
-
-/*
- * Select the Dallas chip: read once with A2 high, then issue the 64-bit
- * unlock sequence on A0 with A2 low.
- */
-void
-ds1216_select(struct ds1216_softc *sc)
-{
- const uint8_t *bsrc = ds1216_unlock_pattern;
- uint8_t b;
- uint i;
-
- bus_space_read_1(sc->sc_iot, sc->sc_ioh, A2);
- for (i = NCYCLES; i != 0; i--) {
- if ((i % 8) == 0)
- b = *bsrc++;
- bus_space_read_1(sc->sc_iot, sc->sc_ioh, b & DQ0 ? A0 : 0);
- b >>= 1;
- }
-}
-
-/*
- * Make sure the Dallas chip is not currently selected by performing enough
- * dummy read cycles to switch it to pass-through mode, if it wasn't already
- * in this state.
- */
-void
-ds1216_unselect(struct ds1216_softc *sc)
-{
- uint i;
-
- for (i = NCYCLES; i != 0; i--) {
- bus_space_read_1(sc->sc_iot, sc->sc_ioh, A2 | A0);
- }
-}
-
-/*
- * Kernel TOD glue.
- */
-
-time_t
-ds1216_inittodr()
-{
- struct ds1216_softc *sc = (struct ds1216_softc *)dsrtc_cd.cd_devs[0];
- struct clock_ymdhms c;
- uint8_t regs[DS1216_NREGS];
- uint i;
-
- ds1216_select(sc);
- for (i = 0; i < DS1216_NREGS; i++)
- regs[i] = ds1216_read_byte(sc);
-
- c.dt_sec = FROMBCD(regs[DS1216_SEC]);
- c.dt_min = FROMBCD(regs[DS1216_MIN]);
- /*
- * BUG should have set up the clock in 24 hour mode. Allow for
- * 12 hour mode, just in case.
- */
- if (ISSET(regs[DS1216_HOUR], DS1216_HOUR_12)) {
- c.dt_hour = FROMBCD(regs[DS1216_HOUR] & DS1216_HOUR_12_MASK);
- if (c.dt_hour == 12)
- c.dt_hour = 0;
- if (ISSET(regs[DS1216_HOUR], DS1216_HOUR_PM))
- c.dt_hour += 12;
- } else
- c.dt_hour = FROMBCD(regs[DS1216_HOUR] & DS1216_HOUR_24_MASK);
- c.dt_day = FROMBCD(regs[DS1216_DAY]);
- c.dt_mon = FROMBCD(regs[DS1216_MONTH]);
- c.dt_year = FROMBCD(regs[DS1216_YEAR]) + 1900;
- /* XXX 2-digit year => Y2070 problem */
- if (c.dt_year < POSIX_BASE_YEAR)
- c.dt_year += 100;
-
- return clock_ymdhms_to_secs(&c);
-}
-
-void
-ds1216_resettodr()
-{
- struct ds1216_softc *sc = (struct ds1216_softc *)dsrtc_cd.cd_devs[0];
- struct clock_ymdhms c;
- uint8_t regs[DS1216_NREGS];
- uint i;
-
- clock_secs_to_ymdhms(time_second, &c);
-
- regs[DS1216_FRAC] = 0;
- regs[DS1216_SEC] = TOBCD(c.dt_sec);
- regs[DS1216_MIN] = TOBCD(c.dt_min);
- regs[DS1216_HOUR] = TOBCD(c.dt_hour);
- regs[DS1216_DOW] = DS1216_RESET | (c.dt_wday + 1);
- regs[DS1216_DAY] = TOBCD(c.dt_day);
- regs[DS1216_MONTH] = TOBCD(c.dt_mon);
- regs[DS1216_YEAR] = TOBCD(c.dt_year % 100);
-
- ds1216_select(sc);
- for (i = 0; i < DS1216_NREGS; i++)
- ds1216_write_byte(sc, regs[i]);
-}
-
-/*
- * Autoconf glue.
- */
-
-int
-ds1216_match(struct device *parent, void *vcf, void *aux)
-{
- struct confargs *ca = (struct confargs *)aux;
-
- switch (brdtyp) {
-#ifdef MVME181
- case BRD_180:
- case BRD_181:
- break;
-#endif
- default:
- return 0;
- }
-
- if (ca->ca_paddr != M181_DSRTC)
- return 0;
-
- /*
- * Can't use badaddr() here - the Dallas chip overlaps the BUG image
- * when selected; therefore access never fails even if the chip
- * were to be missing.
- */
- return 1;
-}
-
-void
-ds1216_attach(struct device *parent, struct device *self, void *aux)
-{
- struct ds1216_softc *sc = (struct ds1216_softc *)self;
- struct confargs *ca = (struct confargs *)aux;
-
- sc->sc_iot = ca->ca_iot;
- if (bus_space_map(ca->ca_iot, ca->ca_paddr, A2 << 1, 0,
- &sc->sc_ioh) != 0) {
- printf(": can't map registers\n");
- return;
- }
-
- printf("\n");
-
- /*
- * Force the chip out of selection. This is unlikely necessary,
- * the BUG is expected to have done this for us.
- */
- ds1216_unselect(sc);
-
- md_inittodr = ds1216_inittodr;
- md_resettodr = ds1216_resettodr;
-}
diff --git a/sys/arch/mvme88k/dev/i82596.h b/sys/arch/mvme88k/dev/i82596.h
deleted file mode 100644
index 4ab2509ec28..00000000000
--- a/sys/arch/mvme88k/dev/i82596.h
+++ /dev/null
@@ -1,307 +0,0 @@
-/* $OpenBSD: i82596.h,v 1.2 2003/06/02 07:06:56 deraadt Exp $ */
-
-/*-
- * Copyright (c) 1995 Theo de Raadt
- * Copyright (c) 1992, University of Vermont and State Agricultural College.
- * Copyright (c) 1992, Garrett A. Wollman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * Vermont and State Agricultural College and Garrett A. Wollman.
- * 4. Neither the name of the University nor the name of the author
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR AUTHOR BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Intel 82596 Ethernet chip
- * Register, bit, and structure definitions.
- *
- * Written by GAW with reference to the Clarkson Packet Driver code for this
- * chip written by Russ Nelson and others.
- *
- * Sun support added by Charles D. Cranor, 25-Oct-94
- *
- * Remade for 82596 in 32 bit mode by Per Fogelstrom.
- */
-
-struct ie_en_addr {
- u_char data[6];
-};
-
-/*
- * This is the master configuration block. It tells the hardware where all
- * the rest of the stuff is.
- */
-struct ie_sys_conf_ptr {
- u_char mbz1[3]; /* must be zero */
- u_char ie_bus_use; /* true if 8-bit only */
- u_char mbz2[4]; /* must be zero */
- u_int ie_iscp_ptr; /* physaddr of ISCP */
-};
-
-/*
- * The tells the hardware where all the rest of the stuff is, too.
- * FIXME: some of these should be re-commented after we figure out their
- * REAL function.
- */
-struct ie_int_sys_conf_ptr {
- u_char mbz1[1]; /* must be zero */
- u_char ie_busy; /* zeroed after init */
- u_short ie_mbz2; /* must be zero */
- u_int ie_base; /* 32-bit physaddr for all vars */
-};
-
-/*
- * This FINALLY tells the hardware what to do and where to put it.
- */
-struct ie_sys_ctl_block {
- u_short ie_status; /* status word */
- u_short ie_command; /* command word */
- u_int ie_command_list; /* 32-pointer to command block list */
- u_int ie_recv_list; /* 32-pointer to receive frame list */
- u_int ie_err_crc; /* CRC errors */
- u_int ie_err_align; /* Alignment errors */
- u_int ie_err_resource; /* Resource errors */
- u_int ie_err_overrun; /* Overrun errors */
- u_int ie_err_coll; /* Receive packets collision errors */
- u_int ie_err_short; /* Short frames recived errors */
- u_short ie_off_timer; /* Bus Throttle OFF timer */
- u_short ie_on_timer; /* Bus Throttle ON timer */
-};
-
-/* Command values */
-#define IE_RU_COMMAND 0x0070 /* mask for RU command */
-#define IE_RU_NOP 0 /* for completeness */
-#define IE_RU_START 0x0010 /* start receive unit command */
-#define IE_RU_ENABLE 0x0020 /* enable receiver command */
-#define IE_RU_DISABLE 0x0030 /* disable receiver command */
-#define IE_RU_ABORT 0x0040 /* abort current receive operation */
-
-#define IE_CU_COMMAND 0x0700 /* mask for CU command */
-#define IE_CU_NOP 0 /* included for completeness */
-#define IE_CU_START 0x0100 /* do-command command */
-#define IE_CU_RESUME 0x0200 /* resume a suspended cmd list */
-#define IE_CU_STOP 0x0300 /* SUSPEND was already taken */
-#define IE_CU_ABORT 0x0400 /* abort current command */
-#define IE_CU_THROTTLE 0x0500 /* load new throttle valuse */
-
-#define IE_ACK_COMMAND 0xf000 /* mask for ACK command */
-#define IE_ACK_CX 0x8000 /* ack IE_ST_DONE */
-#define IE_ACK_FR 0x4000 /* ack IE_ST_RECV */
-#define IE_ACK_CNA 0x2000 /* ack IE_ST_ALLDONE */
-#define IE_ACK_RNR 0x1000 /* ack IE_ST_RNR */
-
-#define IE_ACTION_COMMAND(x) (((x) & IE_CU_COMMAND) == IE_CU_START)
- /* is this command an action command? */
-
-/* Status values */
-#define IE_ST_WHENCE 0xf000 /* mask for cause of interrupt */
-#define IE_ST_DONE 0x8000 /* command with I bit completed */
-#define IE_ST_RECV 0x4000 /* frame received */
-#define IE_ST_ALLDONE 0x2000 /* all commands completed */
-#define IE_ST_RNR 0x1000 /* receive not ready */
-
-#define IE_CU_STATUS 0x700 /* mask for command unit status */
-#define IE_CU_ACTIVE 0x200 /* command unit is active */
-#define IE_CU_SUSPEND 0x100 /* command unit is suspended */
-
-#define IE_RU_STATUS 0x70 /* mask for receiver unit status */
-#define IE_RU_SUSPEND 0x10 /* receiver is suspended */
-#define IE_RU_NOSPACE 0x20 /* receiver has no resources */
-#define IE_RU_READY 0x40 /* reveiver is ready */
-
-/*
- * This is filled in partially by the chip, partially by us.
- */
-struct ie_recv_frame_desc {
- u_short ie_fd_status; /* status for this frame */
- u_short ie_fd_last; /* end of frame list flag */
- u_int ie_fd_next; /* 32-pointer to next RFD */
- u_int ie_fd_buf_desc; /* 32-pointer to list of buffer desc's */
- u_short ie_fd_actual; /* Actual count */
- u_short ie_fd_size; /* Size */
- struct ie_en_addr dest; /* destination ether */
- struct ie_en_addr src; /* source ether */
- u_short ie_length; /* 802 length/Ether type */
- u_short mbz; /* must be zero */
-};
-
-#define IE_FD_LAST 0x8000 /* last rfd in list */
-#define IE_FD_SUSP 0x4000 /* suspend RU after receipt */
-
-#define IE_FD_COMPLETE 0x8000 /* frame is complete */
-#define IE_FD_BUSY 0x4000 /* frame is busy */
-#define IE_FD_OK 0x2000 /* frame is bad */
-#define IE_FD_RNR 0x0200 /* receiver out of resources here */
-#define IE_FD_FLEX 0x0008 /* use flexible buffer scheeme */
-
-/*
- * linked list of buffers...
- */
-struct ie_recv_buf_desc {
- u_short ie_rbd_actual; /* status for this buffer */
- u_short ie_mbz1;
- u_int ie_rbd_next; /* pointer to next RBD */
- u_int ie_rbd_buffer; /* pointer to buffer for this RBD */
- u_short ie_rbd_length; /* length of the buffer */
- u_short mbz; /* must be zero */
-};
-
-#define IE_RBD_LAST 0x8000 /* last buffer */
-#define IE_RBD_USED 0x4000 /* this buffer has data */
-/*
- * All commands share this in common.
- */
-struct ie_cmd_common {
- u_short ie_cmd_status; /* status of this command */
- u_short ie_cmd_cmd; /* command word */
- u_int ie_cmd_link; /* link to next command */
-};
-
-#define IE_STAT_COMPL 0x8000 /* command is completed */
-#define IE_STAT_BUSY 0x4000 /* command is running now */
-#define IE_STAT_OK 0x2000 /* command completed successfully */
-#define IE_STAT_ABORT 0x1000 /* command was aborted */
-
-
-#define IE_CMD_NOP 0x0000 /* NOP */
-#define IE_CMD_IASETUP 0x0001 /* initial address setup */
-#define IE_CMD_CONFIG 0x0002 /* configure command */
-#define IE_CMD_MCAST 0x0003 /* multicast setup command */
-#define IE_CMD_XMIT 0x0004 /* transmit command */
-#define IE_CMD_TDR 0x0005 /* time-domain reflectometer command */
-#define IE_CMD_DUMP 0x0006 /* dump command */
-#define IE_CMD_DIAGNOSE 0x0007 /* diagnostics command */
-
-#define IE_CMD_LAST 0x8000 /* this is the last command in the list */
-#define IE_CMD_SUSPEND 0x4000 /* suspend CU after this command */
-#define IE_CMD_INTR 0x2000 /* post an interrupt after completion */
-#define IE_CMD_FLEX 0x0008 /* use flexible format */
-
-/*
- * This is the command to transmit a frame.
- */
-struct ie_xmit_cmd {
- struct ie_cmd_common com; /* common part */
-#define ie_xmit_status com.ie_cmd_status
-
- u_int ie_xmit_desc; /* pointer to buffer descriptor */
- u_short ie_xmit_count; /* Tcb count field */
- u_short ie_mbz1;
- struct ie_en_addr ie_xmit_addr; /* destination address */
-
- u_short ie_xmit_length; /* 802.3 length/Ether type field */
-};
-
-#define IE_XS_MAXCOLL 0x000f /* number of collisions during transmit */
-#define IE_XS_EXCMAX 0x0020 /* exceeded maximum number of collisions */
-#define IE_XS_SQE 0x0040 /* SQE positive */
-#define IE_XS_DEFERRED 0x0080 /* transmission deferred */
-#define IE_XS_UNDERRUN 0x0100 /* DMA underrun */
-#define IE_XS_LOSTCTS 0x0200 /* Lost CTS */
-#define IE_XS_NOCARRIER 0x0400 /* No Carrier */
-
-/*
- * This is a buffer descriptor for a frame to be transmitted.
- */
-
-struct ie_xmit_buf {
- u_short ie_xmit_flags; /* see below */
- u_short mbz1; /* Must be zero */
- u_int ie_xmit_next; /* pointer to next desc. */
- u_int ie_xmit_buf; /* pointer to the actual buffer */
-};
-
-#define IE_XMIT_LAST 0x8000 /* this TBD is the last one */
-/* The rest of the `flags' word is actually the length. */
-
-/*
- * Multicast setup command.
- */
-
-#define MAXMCAST 250 /* must fit in transmit buffer */
-
-struct ie_mcast_cmd {
- struct ie_cmd_common com; /* common part */
-#define ie_mcast_status com.ie_cmd_status
-
- u_short ie_mcast_bytes; /* size (in bytes) of multicast addresses */
- struct ie_en_addr ie_mcast_addrs[MAXMCAST + 1]; /* space for them */
-};
-
-/*
- * Time Domain Reflectometer command.
- */
-
-struct ie_tdr_cmd {
- struct ie_cmd_common com; /* common part */
-#define ie_tdr_status com.ie_cmd_status
-
- u_short ie_tdr_time; /* error bits and time */
- u_short ie_mbz1;
-};
-
-#define IE_TDR_SUCCESS 0x8000 /* TDR succeeded without error */
-#define IE_TDR_XCVR 0x4000 /* detected a transceiver problem */
-#define IE_TDR_OPEN 0x2000 /* detected an open */
-#define IE_TDR_SHORT 0x1000 /* TDR detected a short */
-#define IE_TDR_TIME 0x07ff /* mask for reflection time */
-
-/*
- * Initial Address Setup command
- */
-struct ie_iasetup_cmd {
- struct ie_cmd_common com;
-#define ie_iasetup_status com.ie_cmd_status
-
- struct ie_en_addr ie_address;
-
- u_short ie_mbz1;
-};
-
-/*
- * Configuration command
- */
-struct ie_config_cmd {
- struct ie_cmd_common com; /* common part */
-#define ie_config_status com.ie_cmd_status
-
- u_char ie_config_count; /* byte count (0x0c) */
- u_char ie_fifo; /* fifo (8) */
- u_char ie_save_bad; /* save bad frames (0x40) */
- u_char ie_addr_len; /* address length (0x2e) (AL-LOC==1) */
- u_char ie_priority; /* priority and backoff (0x0) */
- u_char ie_ifs; /* inter-frame spacing (0x60) */
- u_char ie_slot_low; /* slot time, LSB (0x0) */
- u_char ie_slot_high; /* slot time, MSN, and retries (0xf2) */
- u_char ie_promisc; /* 1 if promiscuous, else 0 */
- u_char ie_crs_cdt; /* CSMA/CD parameters (0x0) */
- u_char ie_min_len; /* min frame length (0x40) */
- u_char ie_junk; /* stuff for 82596 (0xff) */
- u_char ie_dplx;
- u_char ie_miabf;
-};
-
diff --git a/sys/arch/mvme88k/dev/if_ie.c b/sys/arch/mvme88k/dev/if_ie.c
deleted file mode 100644
index 8076cdbc611..00000000000
--- a/sys/arch/mvme88k/dev/if_ie.c
+++ /dev/null
@@ -1,1902 +0,0 @@
-/* $OpenBSD: if_ie.c,v 1.48 2013/11/30 20:24:45 miod Exp $ */
-
-/*-
- * Copyright (c) 1998 Steve Murphree, Jr.
- * Copyright (c) 1995 Theo de Raadt
- * Copyright (c) 1993, 1994, 1995 Charles Hannum.
- * Copyright (c) 1992, 1993, University of Vermont and State
- * Agricultural College.
- * Copyright (c) 1992, 1993, Garrett A. Wollman.
- *
- * Portions:
- * Copyright (c) 1994, 1995, Rafal K. Boni
- * Copyright (c) 1990, 1991, William F. Jolitz
- * Copyright (c) 1990, The Regents of the University of California
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Charles Hannum, by the
- * University of Vermont and State Agricultural College and Garrett A.
- * Wollman, by William F. Jolitz, and by the University of California,
- * Berkeley, Lawrence Berkeley Laboratory, and its contributors.
- * 4. Neither the names of the Universities nor the names of the authors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR AUTHORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Intel 82596 Ethernet chip
- * Register, bit, and structure definitions.
- *
- * Original StarLAN driver written by Garrett Wollman with reference to the
- * Clarkson Packet Driver code for this chip written by Russ Nelson and others.
- *
- * BPF support code taken from hpdev/if_le.c, supplied with tcpdump.
- *
- * 3C507 support is loosely based on code donated to NetBSD by Rafal Boni.
- *
- * Majorly cleaned up and 3C507 code merged by Charles Hannum.
- *
- * Converted to SUN ie driver by Charles D. Cranor,
- * October 1994, January 1995.
- * This sun version based on i386 version 1.30.
- */
-
-extern void *etherbuf;
-extern int etherlen;
-
-/*
-Mode of operation:
-
- We run the 82596 in a standard Ethernet mode. We keep NFRAMES
- received frame descriptors around for the receiver to use, and
- NRXBUF associated receive buffer descriptors, both in a circular
- list. Whenever a frame is received, we rotate both lists as
- necessary. (The 596 treats both lists as a simple queue.) We also
- keep a transmit command around so that packets can be sent off
- quickly.
-
- We configure the adapter in AL-LOC = 1 mode, which means that the
- Ethernet/802.3 MAC header is placed at the beginning of the receive
- buffer rather than being split off into various fields in the RFD.
- This also means that we must include this header in the transmit
- buffer as well.
-
- By convention, all transmit commands, and only transmit commands,
- shall have the I (IE_CMD_INTR) bit set in the command. This way,
- when an interrupt arrives at ieintr(), it is immediately possible
- to tell what precisely caused it. ANY OTHER command-sending
- routines should run at splnet(), and should post an acknowledgement
- to every interrupt they generate.
-
-*/
-
-#include "bpfilter.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/mbuf.h>
-#include <sys/buf.h>
-#include <sys/protosw.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/errno.h>
-#include <sys/syslog.h>
-#include <sys/device.h>
-
-#include <net/if.h>
-#include <net/if_types.h>
-#include <net/if_dl.h>
-#include <net/route.h>
-
-#if NBPFILTER > 0
-#include <net/bpf.h>
-#include <net/bpfdesc.h>
-#endif
-
-#ifdef INET
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-#include <netinet/if_ether.h>
-#endif
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/bus.h>
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-#include <machine/pmap.h>
-
-#include <mvme88k/dev/if_ie.h>
-#include <mvme88k/dev/i82596.h>
-#include <mvme88k/dev/pcctworeg.h>
-#include <mvme88k/dev/pcctwovar.h>
-
-static struct mbuf *last_not_for_us;
-
-#define IED_RINT 0x01
-#define IED_TINT 0x02
-#define IED_RNR 0x04
-#define IED_CNA 0x08
-#define IED_READFRAME 0x10
-#define IED_ALL 0x1f
-
-#define ETHER_MIN_LEN 64
-#define ETHER_MAX_LEN 1518
-#define ETHER_ADDR_LEN 6
-
-#define B_PER_F 3 /* recv buffers per frame */
-#define MXFRAMES 300 /* max number of recv frames */
-#define MXRXBUF (MXFRAMES*B_PER_F) /* number of buffers to allocate */
-#define IE_RBUF_SIZE 256 /* size of each receive buffer;
- MUST BE POWER OF TWO */
-#define NTXBUF 2 /* number of transmit commands */
-#define IE_TBUF_SIZE ETHER_MAX_LEN /* length of transmit buffer */
-
-struct ie_softc {
- struct device sc_dev; /* device structure */
- struct intrhand sc_ih, sc_failih; /* interrupt info */
- char sc_failintrname[16 + 4];
-
- caddr_t sc_iobase; /* KVA of base of 24 bit addr space */
- caddr_t sc_maddr; /* KVA of base of chip's RAM (16bit addr sp.)*/
- u_int sc_msize; /* how much RAM we have/use */
- caddr_t sc_reg; /* KVA of car's register */
- int sc_bustype;
-
- struct arpcom sc_arpcom;/* system arpcom structure */
-
- void (*reset_596)(struct ie_softc *);
- /* card dependent reset function */
- void (*chan_attn)(struct ie_softc *);
- /* card dependent attn function */
- void (*run_596)(struct ie_softc *);
- /* card depenent "go on-line" function */
- void (*memcopy)(const void *, void *, size_t);
- /* card dependent memory copy function */
- void (*memzero)(void *, size_t);
- /* card dependent memory zero function */
- int want_mcsetup; /* mcsetup flag */
- int promisc; /* are we in promisc mode? */
-
- /*
- * pointers to the 3 major control structures
- */
-
- struct ie_sys_conf_ptr *volatile scp;
- struct ie_int_sys_conf_ptr *volatile iscp;
- struct ie_sys_ctl_block *volatile scb;
-
- /*
- * pointer and size of a block of KVA where the buffers
- * are to be allocated from
- */
-
- caddr_t buf_area;
- int buf_area_sz;
-
- /*
- * the actual buffers (recv and xmit)
- */
-
- struct ie_recv_frame_desc *volatile rframes[MXFRAMES];
- struct ie_recv_buf_desc *volatile rbuffs[MXRXBUF];
- char *volatile cbuffs[MXRXBUF];
- int rfhead, rftail, rbhead, rbtail;
-
- struct ie_xmit_cmd *volatile xmit_cmds[NTXBUF];
- struct ie_xmit_buf *volatile xmit_buffs[NTXBUF];
- u_char *xmit_cbuffs[NTXBUF];
- int xmit_busy;
- int xmit_free;
- int xchead, xctail;
-
- struct ie_en_addr mcast_addrs[MAXMCAST + 1];
- int mcast_count;
-
- int nframes; /* number of frames in use */
- int nrxbuf; /* number of recv buffs in use */
-
-#ifdef IEDEBUG
- int sc_debug;
-#endif
- struct pcctwosoftc *sc_pcctwo;
-};
-
-void ie_obreset(struct ie_softc *);
-void ie_obattend(struct ie_softc *);
-void ie_obrun(struct ie_softc *);
-int ie_setupram(struct ie_softc *sc);
-
-void iewatchdog(struct ifnet *);
-int ieintr(void *);
-int iefailintr(void *);
-int ieinit(struct ie_softc *);
-int ieioctl(struct ifnet *, u_long, caddr_t);
-void iestart(struct ifnet *);
-void iereset(struct ie_softc *);
-void ie_readframe(struct ie_softc *, int);
-void ie_drop_packet_buffer(struct ie_softc *);
-int command_and_wait(struct ie_softc *, int,
- void *volatile, int);
-void ierint(struct ie_softc *);
-void ietint(struct ie_softc *);
-int ieget(struct ie_softc *, struct mbuf **,
- struct ether_header *, int *);
-void setup_bufs(struct ie_softc *);
-int mc_setup(struct ie_softc *, void *);
-void mc_reset(struct ie_softc *);
-static __inline int ether_equal(u_char *, u_char *);
-static __inline void ie_ack(struct ie_softc *, u_int);
-static __inline void ie_setup_config(struct ie_config_cmd *volatile,
- int, int);
-static __inline int check_eh(struct ie_softc *, struct ether_header *,
- int *);
-static __inline int ie_buflen(struct ie_softc *, int);
-static __inline int ie_packet_len(struct ie_softc *);
-static __inline void iexmit(struct ie_softc *);
-static __inline caddr_t Align(caddr_t);
-
-void chan_attn_timeout(void *);
-void run_tdr(struct ie_softc *, struct ie_tdr_cmd *);
-void iestop(struct ie_softc *);
-
-#ifdef IEDEBUG
-void print_rbd(struct ie_recv_buf_desc *volatile);
-
-int in_ierint = 0;
-int in_ietint = 0;
-#endif
-
-int iematch(struct device *, void *, void *);
-void ieattach(struct device *, struct device *, void *);
-
-struct cfattach ie_ca = {
- sizeof(struct ie_softc), iematch, ieattach
-};
-
-struct cfdriver ie_cd = {
- NULL, "ie", DV_IFNET
-};
-
-/*
- * address generation macros
- */
-/* Make 32 bit value from swapped data (err counters access) */
-#define MK_32(ptr) ((((u_int)(ptr) >> 16) & 0xffff) | ((u_int)(ptr) << 16))
-
-#define MKADR_32(ptr) \
- ((caddr_t)((((u_int)(ptr) >> 16) & 0xffff) | \
- (((u_int)(ptr) << 16)) + UNCACHED_MEMORY_ADDR))
-
-/* *NOTE* The next macros also converts to physical address! */
-#define ASWAP(ptr) ((((u_int)(ptr) >> 16) & 0x1fff) | ((u_int)(ptr) << 16))
-
-#define SWT_32(to, from) { \
- u_int *t = (u_int *)&to; \
- *t = ((((u_int)from >> 16) & 0x1fff) | ((u_int)from << 16)); \
- }
-/*
- * Here are a few useful functions. We could have done these as macros, but
- * since we have the inline facility, it makes sense to use that instead.
- */
-static inline void
-ie_setup_config(cmd, promiscuous, manchester)
- struct ie_config_cmd *volatile cmd;
- int promiscuous, manchester;
-{
-
- cmd->ie_config_count = 0x0e;
- cmd->ie_fifo = 0xc8;
- cmd->ie_save_bad = 0x40;
- cmd->ie_addr_len = 0x2e;
- cmd->ie_priority = 0;
- cmd->ie_ifs = 0x60;
- cmd->ie_slot_low = 0;
- cmd->ie_slot_high = 0xf2;
- cmd->ie_promisc = !!promiscuous | manchester << 2;
- cmd->ie_crs_cdt = 0;
- cmd->ie_min_len = 64;
- cmd->ie_junk = 0xff;
- cmd->ie_dplx = 0x00;
- cmd->ie_miabf = 0x3f;
-}
-
-static inline void
-ie_ack(sc, mask)
- struct ie_softc *sc;
- u_int mask;
-{
- struct ie_sys_ctl_block *volatile scb = sc->scb;
-
- command_and_wait(sc, scb->ie_status & mask, 0, 0);
-}
-
-int
-iematch(parent, vcf, args)
- struct device *parent;
- void *vcf, *args;
-{
- struct confargs *ca = args;
-
- if (badaddr(ca->ca_paddr, 1)) {
- return(0);
- }
-
- return(1);
-}
-
-/*
- * Deep Magic: reset it, then set SCP address again. Pray.
- */
-void
-ie_obreset(sc)
- struct ie_softc *sc;
-{
- struct ieob *volatile ieo = (struct ieob *) sc->sc_reg;
- volatile int t;
- u_long a;
-
- a = IE_PORT_RESET;
- ieo->porthigh = a & 0xffff;
- t = 0; t = 1;
- ieo->portlow = a >> 16;
- delay(1000);
-
- pmap_extract(pmap_kernel(), (vaddr_t)sc->scp, &a);
- a |= IE_PORT_NEWSCPADDR;
- ieo->porthigh = a & 0xffff;
- t = 0; t = 1;
- ieo->portlow = a >> 16;
- delay(1000);
-}
-
-void
-ie_obattend(sc)
- struct ie_softc *sc;
-{
- struct ieob *volatile ieo = (struct ieob *) sc->sc_reg;
-
- ieo->attn = 1;
-}
-
-void
-ie_obrun(sc)
- struct ie_softc *sc;
-{
-}
-
-void
-ieattach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct ie_softc *sc = (void *) self;
- struct confargs *ca = aux;
- struct ifnet *ifp = &sc->sc_arpcom.ac_if;
- extern void myetheraddr(u_char *); /* should be elsewhere */
- struct ieob *volatile ieo;
- paddr_t pa;
-
- sc->sc_pcctwo = (struct pcctwosoftc *)parent;
- sc->reset_596 = ie_obreset;
- sc->chan_attn = ie_obattend;
- sc->run_596 = ie_obrun;
- sc->memcopy = bcopy;
- sc->memzero = bzero;
- sc->sc_msize = etherlen;
- sc->sc_reg = (void *)ca->ca_paddr;
- ieo = (struct ieob *volatile) sc->sc_reg;
-
- /* get the first available etherbuf */
- sc->sc_maddr = etherbuf; /* maddr = vaddr */
- if (sc->sc_maddr == NULL) {
- printf(": too many ethernet boards\n");
- return;
- } else
- etherbuf = NULL; /* XXX */
-
- if (pmap_extract(pmap_kernel(), (vaddr_t)sc->sc_maddr, &pa) == FALSE) {
- printf(": pmap_extract() failed!\n");
- return;
- }
- sc->sc_iobase = (caddr_t)pa; /* iobase = paddr (24 bit) */
-
- (sc->memzero)(sc->sc_maddr, sc->sc_msize);
- sc->iscp = (struct ie_int_sys_conf_ptr *volatile)
- sc->sc_maddr; /* @@ location zero */
- sc->scb = (struct ie_sys_ctl_block *volatile)
- roundup((int)sc->iscp + sizeof(struct ie_int_sys_conf_ptr), 16);
- sc->scp = (struct ie_sys_conf_ptr *)
- roundup((int)sc->scb + sizeof(struct ie_sys_ctl_block), 16);
-
- sc->scp->ie_bus_use = 0x44;
- pmap_extract(pmap_kernel(), (vaddr_t)sc->iscp, &pa);
- SWT_32(sc->scp->ie_iscp_ptr, pa);
- /*
- * rest of first page is unused (wasted!), rest of ram
- * for buffers
- */
- sc->buf_area = sc->sc_maddr + NBPG;
- sc->buf_area_sz = sc->sc_msize - NBPG;
- myetheraddr(sc->sc_arpcom.ac_enaddr);
-
- if (ie_setupram(sc) == 0) {
- printf(": RAM CONFIG FAILED!\n");
- /* XXX should reclaim resources? */
- return;
- }
- bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ);
- ifp->if_softc = sc;
- ifp->if_start = iestart;
- ifp->if_ioctl = ieioctl;
- ifp->if_watchdog = iewatchdog;
- ifp->if_flags =
- IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS | IFF_MULTICAST;
-
- /* Attach the interface. */
- if_attach(ifp);
- ether_ifattach(ifp);
-
- printf(": address %s\n", ether_sprintf(sc->sc_arpcom.ac_enaddr));
-
- sc->sc_bustype = ca->ca_bustype;
-
- sc->sc_ih.ih_fn = ieintr;
- sc->sc_ih.ih_arg = sc;
- sc->sc_ih.ih_wantframe = 0;
- sc->sc_ih.ih_ipl = ca->ca_ipl;
-
- sc->sc_failih.ih_fn = iefailintr;
- sc->sc_failih.ih_arg = sc;
- sc->sc_failih.ih_wantframe = 0;
- sc->sc_failih.ih_ipl = ca->ca_ipl;
-
- pcctwointr_establish(PCC2V_IE, &sc->sc_ih, self->dv_xname);
- snprintf(sc->sc_failintrname, sizeof sc->sc_failintrname, "%s_err",
- self->dv_xname);
- pcctwointr_establish(PCC2V_IEFAIL, &sc->sc_failih, sc->sc_failintrname);
-
- /* enable device interrupts */
- bus_space_write_1(sc->sc_pcctwo->sc_iot, sc->sc_pcctwo->sc_ioh,
- PCCTWO_IEICR, PCC2_SC_SNOOP | PCC2_IRQ_IEN | PCC2_IRQ_ICLR |
- (ca->ca_ipl & PCC2_IRQ_IPL));
- bus_space_write_1(sc->sc_pcctwo->sc_iot, sc->sc_pcctwo->sc_ioh,
- PCCTWO_IEBERR, PCC2_IRQ_IEN | PCC2_IRQ_ICLR |
- (ca->ca_ipl & PCC2_IRQ_IPL));
-}
-
-/*
- * Device timeout/watchdog routine. Entered if the device neglects to generate
- * an interrupt after a transmit has been started on it.
- */
-void
-iewatchdog(ifp)
- struct ifnet *ifp;
-{
- struct ie_softc *sc = ifp->if_softc;
-
- log(LOG_ERR, "%s: device timeout\n", sc->sc_dev.dv_xname);
- ++sc->sc_arpcom.ac_if.if_oerrors;
-
- iereset(sc);
-}
-
-int
-iefailintr(v)
- void *v;
-{
- struct ie_softc *sc = v;
-
- /* safe: clear irq */
- bus_space_write_1(sc->sc_pcctwo->sc_iot, sc->sc_pcctwo->sc_ioh,
- PCCTWO_IEICR, PCC2_IRQ_ICLR |
- bus_space_read_1(sc->sc_pcctwo->sc_iot, sc->sc_pcctwo->sc_ioh,
- PCCTWO_IEICR));
- /* clear failure */
- bus_space_write_1(sc->sc_pcctwo->sc_iot, sc->sc_pcctwo->sc_ioh,
- PCCTWO_IEBERR, PCC2_IRQ_ICLR |
- bus_space_read_1(sc->sc_pcctwo->sc_iot, sc->sc_pcctwo->sc_ioh,
- PCCTWO_IEBERR));
- /* reset error */
- bus_space_write_1(sc->sc_pcctwo->sc_iot, sc->sc_pcctwo->sc_ioh,
- PCCTWO_IEERR, PCC2_IEERR_SCLR);
-
- iereset(sc);
- return (1);
-}
-
-/*
- * What to do upon receipt of an interrupt.
- */
-int
-ieintr(v)
- void *v;
-{
- struct ie_softc *sc = v;
- u_short status;
-
- status = sc->scb->ie_status;
-
-loop:
- /* Ack interrupts FIRST in case we receive more during the ISR. */
- ie_ack(sc, IE_ST_WHENCE & status);
- /* clear irq */
- bus_space_write_1(sc->sc_pcctwo->sc_iot, sc->sc_pcctwo->sc_ioh,
- PCCTWO_IEICR, PCC2_IRQ_ICLR |
- bus_space_read_1(sc->sc_pcctwo->sc_iot, sc->sc_pcctwo->sc_ioh,
- PCCTWO_IEICR));
-
- if (status & (IE_ST_RECV | IE_ST_RNR)) {
-#ifdef IEDEBUG
- in_ierint++;
- if (sc->sc_debug & IED_RINT)
- printf("%s: rint\n", sc->sc_dev.dv_xname);
-#endif
- ierint(sc);
-#ifdef IEDEBUG
- in_ierint--;
-#endif
- }
-
- if (status & IE_ST_DONE) {
-#ifdef IEDEBUG
- in_ietint++;
- if (sc->sc_debug & IED_TINT)
- printf("%s: tint\n", sc->sc_dev.dv_xname);
-#endif
- ietint(sc);
-#ifdef IEDEBUG
- in_ietint--;
-#endif
- }
-
- if (status & IE_ST_RNR) {
- printf("%s: receiver not ready\n", sc->sc_dev.dv_xname);
- sc->sc_arpcom.ac_if.if_ierrors++;
- iereset(sc);
- }
-
-#ifdef IEDEBUG
- if ((status & IE_ST_ALLDONE) && (sc->sc_debug & IED_CNA))
- printf("%s: cna\n", sc->sc_dev.dv_xname);
-#endif
-
- if ((status = sc->scb->ie_status) & IE_ST_WHENCE)
- goto loop;
-
- return 1;
-}
-
-/*
- * Process a received-frame interrupt.
- */
-void
-ierint(sc)
- struct ie_softc *sc;
-{
- struct ie_sys_ctl_block *volatile scb = sc->scb;
- int i, status;
- static int timesthru = 1024;
-
- i = sc->rfhead;
- for (;;) {
- status = sc->rframes[i]->ie_fd_status;
-
- if ((status & IE_FD_COMPLETE) && (status & IE_FD_OK)) {
- sc->sc_arpcom.ac_if.if_ipackets++;
- if (!--timesthru) {
- sc->sc_arpcom.ac_if.if_ierrors +=
- MK_32(scb->ie_err_crc) +
- MK_32(scb->ie_err_align) +
- MK_32(scb->ie_err_resource) +
- MK_32(scb->ie_err_overrun) +
- MK_32(scb->ie_err_coll) +
- MK_32(scb->ie_err_short);
- scb->ie_err_crc = 0;
- scb->ie_err_align = 0;
- scb->ie_err_resource = 0;
- scb->ie_err_overrun = 0;
- scb->ie_err_coll = 0;
- scb->ie_err_short = 0;
- timesthru = 1024;
- }
- ie_readframe(sc, i);
- } else {
- if ((status & IE_FD_RNR) != 0 &&
- (scb->ie_status & IE_RU_READY) == 0) {
- sc->rframes[0]->ie_fd_buf_desc = ASWAP(sc->rbuffs[0]);
- scb->ie_recv_list = ASWAP(sc->rframes[0]);
- command_and_wait(sc, IE_RU_START, 0, 0);
- }
- break;
- }
- i = (i + 1) % sc->nframes;
- }
-}
-
-/*
- * Process a command-complete interrupt. These are only generated by the
- * transmission of frames. This routine is deceptively simple, since most of
- * the real work is done by iestart().
- */
-void
-ietint(sc)
- struct ie_softc *sc;
-{
- int status;
-
- sc->sc_arpcom.ac_if.if_timer = 0;
- sc->sc_arpcom.ac_if.if_flags &= ~IFF_OACTIVE;
-
- status = sc->xmit_cmds[sc->xctail]->ie_xmit_status;
-
- if (!(status & IE_STAT_COMPL) || (status & IE_STAT_BUSY))
- printf("ietint: command still busy!\n");
-
- if (status & IE_STAT_OK) {
- sc->sc_arpcom.ac_if.if_opackets++;
- sc->sc_arpcom.ac_if.if_collisions += status & IE_XS_MAXCOLL;
- } else if (status & IE_STAT_ABORT) {
- sc->sc_arpcom.ac_if.if_oerrors++;
- } else if (status & IE_XS_NOCARRIER) {
- sc->sc_arpcom.ac_if.if_oerrors++;
- } else if (status & IE_XS_LOSTCTS) {
- sc->sc_arpcom.ac_if.if_oerrors++;
- } else if (status & IE_XS_UNDERRUN) {
- sc->sc_arpcom.ac_if.if_oerrors++;
- } else if (status & IE_XS_EXCMAX) {
- sc->sc_arpcom.ac_if.if_collisions += 16;
- sc->sc_arpcom.ac_if.if_oerrors++;
- }
-
- /*
- * If multicast addresses were added or deleted while transmitting,
- * mc_reset() set the want_mcsetup flag indicating that we should do
- * it.
- */
- if (sc->want_mcsetup) {
- mc_setup(sc, (caddr_t)sc->xmit_cbuffs[sc->xctail]);
- sc->want_mcsetup = 0;
- }
-
- /* Done with the buffer. */
- sc->xmit_free++;
- sc->xmit_busy = 0;
- sc->xctail = (sc->xctail + 1) % NTXBUF;
-
- iestart(&sc->sc_arpcom.ac_if);
-}
-
-/*
- * Compare two Ether/802 addresses for equality, inlined and unrolled for
- * speed. I'd love to have an inline assembler version of this...
- */
-static inline int
-ether_equal(one, two)
- u_char *one, *two;
-{
-
- if (one[0] != two[0] || one[1] != two[1] || one[2] != two[2] ||
- one[3] != two[3] || one[4] != two[4] || one[5] != two[5])
- return 0;
- return 1;
-}
-
-/*
- * Check for a valid address. to_bpf is filled in with one of the following:
- * 0 -> BPF doesn't get this packet
- * 1 -> BPF does get this packet
- * 2 -> BPF does get this packet, but we don't
- * Return value is true if the packet is for us, and false otherwise.
- *
- * This routine is a mess, but it's also critical that it be as fast
- * as possible. It could be made cleaner if we can assume that the
- * only client which will fiddle with IFF_PROMISC is BPF. This is
- * probably a good assumption, but we do not make it here. (Yet.)
- */
-static inline int
-check_eh(sc, eh, to_bpf)
- struct ie_softc *sc;
- struct ether_header *eh;
- int *to_bpf;
-{
- int i;
-
- switch(sc->promisc) {
- case IFF_ALLMULTI:
- /*
- * Receiving all multicasts, but no unicasts except those
- * destined for us.
- */
-#if NBPFILTER > 0
- *to_bpf = (sc->sc_arpcom.ac_if.if_bpf != 0); /* BPF gets this packet if anybody cares */
-#endif
- if (eh->ether_dhost[0] & 1)
- return 1;
- if (ether_equal(eh->ether_dhost, sc->sc_arpcom.ac_enaddr)) return 1;
- return 0;
-
- case IFF_PROMISC:
- /*
- * Receiving all packets. These need to be passed on to BPF.
- */
-#if NBPFILTER > 0
- *to_bpf = (sc->sc_arpcom.ac_if.if_bpf != 0) ||
- (sc->sc_arpcom.ac_if.if_bridgeport != NULL);
-#else
- *to_bpf = (sc->sc_arpcom.ac_if.if_bridgeport != NULL);
-#endif
- /* If for us, accept and hand up to BPF */
- if (ether_equal(eh->ether_dhost, sc->sc_arpcom.ac_enaddr)) return 1;
-
-#if NBPFILTER > 0
- if (*to_bpf && sc->sc_arpcom.ac_if.if_bridgeport == NULL)
- *to_bpf = 2; /* we don't need to see it */
-#endif
-
- /*
- * Not a multicast, so BPF wants to see it but we don't.
- */
- if (!(eh->ether_dhost[0] & 1))
- return 1;
-
- /*
- * If it's one of our multicast groups, accept it and pass it
- * up.
- */
- for (i = 0; i < sc->mcast_count; i++) {
- if (ether_equal(eh->ether_dhost, (u_char *)&sc->mcast_addrs[i])) {
-#if NBPFILTER > 0
- if (*to_bpf)
- *to_bpf = 1;
-#endif
- return 1;
- }
- }
- return 1;
-
- case IFF_ALLMULTI | IFF_PROMISC:
- /*
- * Acting as a multicast router, and BPF running at the same
- * time. Whew! (Hope this is a fast machine...)
- */
-#if NBPFILTER > 0
- *to_bpf = (sc->sc_arpcom.ac_if.if_bpf != 0) ||
- (sc->sc_arpcom.ac_if.if_bridgeport != NULL);
-#else
- *to_bpf = (sc->sc_arpcom.ac_if.if_bridgeport != NULL);
-#endif
- /* We want to see multicasts. */
- if (eh->ether_dhost[0] & 1)
- return 1;
-
- /* We want to see our own packets */
- if (ether_equal(eh->ether_dhost, sc->sc_arpcom.ac_enaddr))
- return 1;
-
- /* Anything else goes to BPF but nothing else. */
-#if NBPFILTER > 0
- if (*to_bpf && sc->sc_arpcom.ac_if.if_bridgeport == NULL)
- *to_bpf = 2;
-#endif
- return 1;
-
- default:
- /*
- * Only accept unicast packets destined for us, or multicasts
- * for groups that we belong to. For now, we assume that the
- * '596 will only return packets that we asked it for. This
- * isn't strictly true (it uses hashing for the multicast
- * filter), but it will do in this case, and we want to get out
- * of here as quickly as possible.
- */
-#if NBPFILTER > 0
- *to_bpf = (sc->sc_arpcom.ac_if.if_bpf != 0);
-#endif
- return 1;
- }
- return 0;
-}
-
-/*
- * We want to isolate the bits that have meaning... This assumes that
- * IE_RBUF_SIZE is an even power of two. If somehow the act_len exceeds
- * the size of the buffer, then we are screwed anyway.
- */
-static inline int
-ie_buflen(sc, head)
- struct ie_softc *sc;
- int head;
-{
-
- return (sc->rbuffs[head]->ie_rbd_actual & (IE_RBUF_SIZE | (IE_RBUF_SIZE - 1)));
-}
-
-static inline int
-ie_packet_len(sc)
- struct ie_softc *sc;
-{
- int i;
- int head = sc->rbhead;
- int acc = 0;
-
- do {
- if (!(sc->rbuffs[sc->rbhead]->ie_rbd_actual & IE_RBD_USED)) {
-#ifdef IEDEBUG
- print_rbd(sc->rbuffs[sc->rbhead]);
-#endif
- log(LOG_ERR, "%s: receive descriptors out of sync at %d\n",
- sc->sc_dev.dv_xname, sc->rbhead);
- iereset(sc);
- return -1;
- }
-
- i = sc->rbuffs[head]->ie_rbd_actual & IE_RBD_LAST;
-
- acc += ie_buflen(sc, head);
- head = (head + 1) % sc->nrxbuf;
- } while (!i);
-
- return acc;
-}
-
-/*
- * Setup all necessary artifacts for an XMIT command, and then pass the XMIT
- * command to the chip to be executed. On the way, if we have a BPF listener
- * also give him a copy.
- */
-inline static void
-iexmit(sc)
- struct ie_softc *sc;
-{
-
-#if NBPFILTER > 0
- /*
- * If BPF is listening on this interface, let it see the packet before
- * we push it on the wire.
- */
- if (sc->sc_arpcom.ac_if.if_bpf)
- bpf_tap(sc->sc_arpcom.ac_if.if_bpf,
- sc->xmit_cbuffs[sc->xctail],
- sc->xmit_buffs[sc->xctail]->ie_xmit_flags,
- BPF_DIRECTION_OUT);
-#endif
-
-#if 0
-printf("iexmit base %x cmd %x bfd %x to %x\n",
-sc->sc_maddr,
-sc->xmit_cmds[sc->xctail],
-sc->xmit_buffs[sc->xctail],
-sc->xmit_cbuffs[sc->xctail]);
-#endif
- sc->xmit_buffs[sc->xctail]->ie_xmit_flags |= IE_XMIT_LAST;
- sc->xmit_buffs[sc->xctail]->ie_xmit_next = 0xffffffff;
- SWT_32(sc->xmit_buffs[sc->xctail]->ie_xmit_buf,
- sc->xmit_cbuffs[sc->xctail]);
-
- sc->xmit_cmds[sc->xctail]->com.ie_cmd_link = 0xffffffff;
- sc->xmit_cmds[sc->xctail]->com.ie_cmd_cmd =
- IE_CMD_XMIT | IE_CMD_INTR | IE_CMD_LAST | IE_CMD_FLEX;
-
- sc->xmit_cmds[sc->xctail]->ie_xmit_status = 0;
- sc->xmit_cmds[sc->xctail]->ie_xmit_desc =
- ASWAP(sc->xmit_buffs[sc->xctail]);
- sc->xmit_cmds[sc->xctail]->ie_xmit_count = 0;
-
- sc->scb->ie_command_list =
- ASWAP(sc->xmit_cmds[sc->xctail]);
- command_and_wait(sc, IE_CU_START, 0, 0);
-
- sc->xmit_busy = 1;
- sc->sc_arpcom.ac_if.if_timer = 5;
-}
-
-/*
- * Read data off the interface, and turn it into an mbuf chain.
- *
- * This code is DRAMATICALLY different from the previous version; this
- * version tries to allocate the entire mbuf chain up front, given the
- * length of the data available. This enables us to allocate mbuf
- * clusters in many situations where before we would have had a long
- * chain of partially-full mbufs. This should help to speed up the
- * operation considerably. (Provided that it works, of course.)
- */
-int
-ieget(sc, mp, ehp, to_bpf)
- struct ie_softc *sc;
- struct mbuf **mp;
- struct ether_header *ehp;
- int *to_bpf;
-{
- struct mbuf *m, *top, **mymp;
- int i;
- int offset;
- int totlen, resid;
- int thismboff;
- int head;
-
- totlen = ie_packet_len(sc);
- if (totlen <= 0)
- return -1;
-
- i = sc->rbhead;
-
- /*
- * Snarf the Ethernet header.
- */
- (sc->memcopy)((caddr_t)sc->cbuffs[i], (caddr_t)ehp, sizeof *ehp);
-
- /*
- * As quickly as possible, check if this packet is for us.
- * If not, don't waste a single cycle copying the rest of the
- * packet in.
- * This is only a consideration when FILTER is defined; i.e., when
- * we are either running BPF or doing multicasting.
- */
- if (!check_eh(sc, ehp, to_bpf)) {
- ie_drop_packet_buffer(sc);
- sc->sc_arpcom.ac_if.if_ierrors--; /* just this case, it's not an error */
- return -1;
- }
- totlen -= (offset = sizeof *ehp);
-
- MGETHDR(*mp, M_DONTWAIT, MT_DATA);
- if (!*mp) {
- ie_drop_packet_buffer(sc);
- return -1;
- }
-
- m = *mp;
- m->m_pkthdr.rcvif = &sc->sc_arpcom.ac_if;
- m->m_len = MHLEN;
- resid = m->m_pkthdr.len = totlen;
- top = 0;
- mymp = &top;
-
- /*
- * This loop goes through and allocates mbufs for all the data we will
- * be copying in. It does not actually do the copying yet.
- */
- do { /* while (resid > 0) */
- /*
- * Try to allocate an mbuf to hold the data that we have. If
- * we already allocated one, just get another one and stick it
- * on the end (eventually). If we don't already have one, try
- * to allocate an mbuf cluster big enough to hold the whole
- * packet, if we think it's reasonable, or a single mbuf which
- * may or may not be big enough.
- * Got that?
- */
- if (top) {
- MGET(m, M_DONTWAIT, MT_DATA);
- if (!m) {
- m_freem(top);
- ie_drop_packet_buffer(sc);
- return -1;
- }
- m->m_len = MLEN;
- }
-
- if (resid >= MINCLSIZE) {
- MCLGET(m, M_DONTWAIT);
- if (m->m_flags & M_EXT)
- m->m_len = min(resid, MCLBYTES);
- } else {
- if (resid < m->m_len) {
- if (!top && resid + max_linkhdr <= m->m_len)
- m->m_data += max_linkhdr;
- m->m_len = resid;
- }
- }
- resid -= m->m_len;
- *mymp = m;
- mymp = &m->m_next;
- } while (resid > 0);
-
- resid = totlen;
- m = top;
- thismboff = 0;
- head = sc->rbhead;
-
- /*
- * Now we take the mbuf chain (hopefully only one mbuf most of the
- * time) and stuff the data into it. There are no possible failures at
- * or after this point.
- */
- while (resid > 0) { /* while there's stuff left */
- int thislen = ie_buflen(sc, head) - offset;
-
- /*
- * If too much data for the current mbuf, then fill the current
- * one up, go to the next one, and try again.
- */
- if (thislen > m->m_len - thismboff) {
- int newlen = m->m_len - thismboff;
- (sc->memcopy)((caddr_t)(sc->cbuffs[head] + offset),
- mtod(m, caddr_t) + thismboff, (u_int)newlen);
- m = m->m_next;
- thismboff = 0; /* new mbuf, so no offset */
- offset += newlen; /* we are now this far
- into the packet */
- resid -= newlen; /* so there is this much
- left to get */
- continue;
- }
-
- /*
- * If there is more than enough space in the mbuf to hold the
- * contents of this buffer, copy everything in, advance
- * pointers and so on.
- */
- if (thislen < m->m_len - thismboff) {
- (sc->memcopy)((caddr_t)(sc->cbuffs[head] + offset),
- mtod(m, caddr_t) + thismboff, (u_int)thislen);
- thismboff += thislen; /* we are this far into the mbuf */
- resid -= thislen; /* and this much is left */
- goto nextbuf;
- }
-
- /*
- * Otherwise, there is exactly enough space to put this
- * buffer's contents into the current mbuf. Do the combination
- * of the above actions.
- */
- (sc->memcopy)((caddr_t)(sc->cbuffs[head] + offset),
- mtod(m, caddr_t) + thismboff, (u_int)thislen);
- m = m->m_next;
- thismboff = 0; /* new mbuf, start at the beginning */
- resid -= thislen; /* and we are this far through */
-
- /*
- * Advance all the pointers. We can get here from either of
- * the last two cases, but never the first.
- */
- nextbuf:
- offset = 0;
- sc->rbuffs[head]->ie_rbd_actual = 0;
- sc->rbuffs[head]->ie_rbd_length |= IE_RBD_LAST;
- sc->rbhead = head = (head + 1) % sc->nrxbuf;
- sc->rbuffs[sc->rbtail]->ie_rbd_length &= ~IE_RBD_LAST;
- sc->rbtail = (sc->rbtail + 1) % sc->nrxbuf;
- }
-
- /*
- * Unless something changed strangely while we were doing the copy, we
- * have now copied everything in from the shared memory.
- * This means that we are done.
- */
- return 0;
-}
-
-/*
- * Read frame NUM from unit UNIT (pre-cached as IE).
- *
- * This routine reads the RFD at NUM, and copies in the buffers from the list
- * of RBD, then rotates the RBD and RFD lists so that the receiver doesn't
- * start complaining. Trailers are DROPPED---there's no point in wasting time
- * on confusing code to deal with them. Hopefully, this machine will never ARP
- * for trailers anyway.
- */
-void
-ie_readframe(sc, num)
- struct ie_softc *sc;
- int num; /* frame number to read */
-{
- int status;
- struct mbuf *m = 0;
- struct ether_header eh;
-#if NBPFILTER > 0
- int bpf_gets_it = 0;
-#endif
-
- status = sc->rframes[num]->ie_fd_status;
-
- /* Immediately advance the RFD list, since we have copied ours now. */
- sc->rframes[num]->ie_fd_status = 0;
- sc->rframes[num]->ie_fd_actual = 0;
- sc->rframes[num]->ie_fd_last |= IE_FD_LAST;
- sc->rframes[sc->rftail]->ie_fd_last &= ~IE_FD_LAST;
- sc->rftail = (sc->rftail + 1) % sc->nframes;
- sc->rfhead = (sc->rfhead + 1) % sc->nframes;
-
- if (status & IE_FD_OK) {
-#if NBPFILTER > 0
- if (ieget(sc, &m, &eh, &bpf_gets_it)) {
-#else
- if (ieget(sc, &m, &eh, 0)) {
-#endif
- sc->sc_arpcom.ac_if.if_ierrors++;
- return;
- }
- }
-
-#ifdef IEDEBUG
- if (sc->sc_debug & IED_READFRAME)
- printf("%s: frame from ether %s type %x\n", sc->sc_dev.dv_xname,
- ether_sprintf(eh.ether_shost), (u_int)eh.ether_type);
-#endif
-
- if (!m)
- return;
-
- if (last_not_for_us) {
- m_freem(last_not_for_us);
- last_not_for_us = 0;
- }
-
-#if NBPFILTER > 0
- /*
- * Check for a BPF filter; if so, hand it up.
- * Note that we have to stick an extra mbuf up front, because bpf_mtap
- * expects to have the ether header at the front.
- * It doesn't matter that this results in an ill-formatted mbuf chain,
- * since BPF just looks at the data. (It doesn't try to free the mbuf,
- * tho' it will make a copy for tcpdump.)
- */
- if (bpf_gets_it) {
- /* Pass it up. */
- bpf_mtap_hdr(sc->sc_arpcom.ac_if.if_bpf, (caddr_t)&eh,
- sizeof(eh), m, BPF_DIRECTION_IN);
- }
- /*
- * A signal passed up from the filtering code indicating that the
- * packet is intended for BPF but not for the protocol machinery.
- * We can save a few cycles by not handing it off to them.
- */
- if (bpf_gets_it == 2) {
- last_not_for_us = m;
- return;
- }
-#endif /* NBPFILTER > 0 */
-
- /*
- * In here there used to be code to check destination addresses upon
- * receipt of a packet. We have deleted that code, and replaced it
- * with code to check the address much earlier in the cycle, before
- * copying the data in; this saves us valuable cycles when operating
- * as a multicast router or when using BPF.
- */
-
- /*
- * Finally pass this packet up to higher layers.
- */
- ether_input(&sc->sc_arpcom.ac_if, &eh, m);
-}
-
-void
-ie_drop_packet_buffer(sc)
- struct ie_softc *sc;
-{
- int i;
-
- do {
- /*
- * This means we are somehow out of sync. So, we reset the
- * adapter.
- */
- if (!(sc->rbuffs[sc->rbhead]->ie_rbd_actual & IE_RBD_USED)) {
-#ifdef IEDEBUG
- print_rbd(sc->rbuffs[sc->rbhead]);
-#endif
- log(LOG_ERR, "%s: receive descriptors out of sync at %d\n",
- sc->sc_dev.dv_xname, sc->rbhead);
- iereset(sc);
- return;
- }
-
- i = sc->rbuffs[sc->rbhead]->ie_rbd_actual & IE_RBD_LAST;
-
- sc->rbuffs[sc->rbhead]->ie_rbd_length |= IE_RBD_LAST;
- sc->rbuffs[sc->rbhead]->ie_rbd_actual = 0;
- sc->rbhead = (sc->rbhead + 1) % sc->nrxbuf;
- sc->rbuffs[sc->rbtail]->ie_rbd_length &= ~IE_RBD_LAST;
- sc->rbtail = (sc->rbtail + 1) % sc->nrxbuf;
- } while (!i);
-}
-
-
-/*
- * Start transmission on an interface.
- */
-void
-iestart(ifp)
- struct ifnet *ifp;
-{
- struct ie_softc *sc = ifp->if_softc;
- struct mbuf *m0, *m;
- u_char *buffer;
- u_short len;
-
- if ((ifp->if_flags & IFF_RUNNING) == 0)
- return;
-
- if (sc->xmit_free == 0) {
- ifp->if_flags |= IFF_OACTIVE;
- if (!sc->xmit_busy)
- iexmit(sc);
- return;
- }
-
- do {
- IF_DEQUEUE(&sc->sc_arpcom.ac_if.if_snd, m);
- if (!m)
- break;
-
- len = 0;
- buffer = sc->xmit_cbuffs[sc->xchead];
-
- for (m0 = m; m && (len +m->m_len) < IE_TBUF_SIZE;
- m = m->m_next) {
- bcopy(mtod(m, caddr_t), buffer, m->m_len);
- buffer += m->m_len;
- len += m->m_len;
- }
- if (m)
- printf("%s: tbuf overflow\n", sc->sc_dev.dv_xname);
-
- m_freem(m0);
-
- if (len < ETHER_MIN_LEN - ETHER_CRC_LEN) {
- bzero(buffer, ETHER_MIN_LEN - ETHER_CRC_LEN - len);
- len = ETHER_MIN_LEN - ETHER_CRC_LEN;
- buffer += ETHER_MIN_LEN - ETHER_CRC_LEN;
- }
-
- sc->xmit_buffs[sc->xchead]->ie_xmit_flags = len;
-
- sc->xmit_free--;
- sc->xchead = (sc->xchead + 1) % NTXBUF;
- } while (sc->xmit_free > 0);
-
- /* If we stuffed any packets into the card's memory, send now. */
- if ((sc->xmit_free < NTXBUF) && (!sc->xmit_busy))
- iexmit(sc);
-
- return;
-}
-
-/*
- * set up IE's ram space
- */
-int
-ie_setupram(sc)
- struct ie_softc *sc;
-{
- struct ie_int_sys_conf_ptr *volatile iscp;
- struct ie_sys_ctl_block *volatile scb;
- int s;
-
- s = splnet();
-
- iscp = sc->iscp;
- (sc->memzero)((char *) iscp, sizeof *iscp);
-
- scb = sc->scb;
- (sc->memzero)((char *) scb, sizeof *scb);
- scb->ie_off_timer = 10;
- scb->ie_on_timer = 10000;
-
- iscp->ie_busy = 1; /* ie_busy == char */
- SWT_32(iscp->ie_base, sc->scb);
-
- (sc->reset_596) (sc);
- (sc->chan_attn) (sc);
-
- delay(100); /* wait a while... */
-
- if (iscp->ie_busy) {
- splx(s);
- return 0;
- }
- /*
- * Acknowledge any interrupts we may have caused...
- */
- ie_ack(sc, IE_ST_WHENCE);
- splx(s);
-
- return 1;
-}
-
-void
-iereset(sc)
- struct ie_softc *sc;
-{
- int s = splnet();
-
- printf("%s: reset\n", sc->sc_dev.dv_xname);
-
- /* Clear OACTIVE in case we're called from watchdog (frozen xmit). */
- sc->sc_arpcom.ac_if.if_flags &= ~(IFF_UP | IFF_OACTIVE);
- ieioctl(&sc->sc_arpcom.ac_if, SIOCSIFFLAGS, 0);
-
- /*
- * Stop i82596 dead in its tracks.
- */
- if (command_and_wait(sc, IE_RU_ABORT | IE_CU_ABORT, 0, 0))
- printf("%s: abort commands timed out\n", sc->sc_dev.dv_xname);
-
- if (command_and_wait(sc, IE_RU_DISABLE | IE_CU_STOP, 0, 0))
- printf("%s: disable commands timed out\n", sc->sc_dev.dv_xname);
-
-#ifdef notdef
- if (!check_ie_present(sc, sc->sc_maddr, sc->sc_msize))
- panic("ie disappeared!");
-#endif
-
- sc->sc_arpcom.ac_if.if_flags |= IFF_UP;
- ieioctl(&sc->sc_arpcom.ac_if, SIOCSIFFLAGS, 0);
-
- splx(s);
-}
-
-#if 0
-/*
- * This is called if we time out.
- */
-static void
-chan_attn_timeout(rock)
- caddr_t rock;
-{
-
- *(int *)rock = 1;
-}
-#endif
-
-/*
- * Send a command to the controller and wait for it to either complete
- * or be accepted, depending on the command. If the command pointer
- * is null, then pretend that the command is not an action command.
- * If the command pointer is not null, and the command is an action
- * command, wait for
- * ((struct ie_cmd_common *volatile)pcmd)->ie_cmd_status & MASK
- * to become true.
- */
-int
-command_and_wait(sc, cmd, pcmd, mask)
- struct ie_softc *sc;
- int cmd;
- void *volatile pcmd;
- int mask;
-{
- struct ie_cmd_common *volatile cc = pcmd;
- struct ie_sys_ctl_block *volatile scb = sc->scb;
- volatile int timedout = 0;
-#if 0
- struct timeout chan_tmo;
- extern int hz;
-#endif
-
- scb->ie_command = (u_short)cmd;
-
- if (IE_ACTION_COMMAND(cmd) && pcmd) {
- (sc->chan_attn)(sc);
-
-#if 0
- /*
- * XXX
- * I don't think this timeout works on suns.
- * we are at splnet() in the loop, and the timeout
- * stuff runs at software spl (so it is masked off?).
- */
-
- /*
- * According to the packet driver, the minimum timeout should
- * be .369 seconds, which we round up to .4.
- */
- timeout_set(&chan_tmo, chan_attn_timeout, (caddr_t)&timedout);
- timeout_add(&chan_tmo, (caddr_t)&timedout, 2 * hz / 5);
-#endif
-
- /*
- * Now spin-lock waiting for status. This is not a very nice
- * thing to do, but I haven't figured out how, or indeed if, we
- * can put the process waiting for action to sleep. (We may
- * be getting called through some other timeout running in the
- * kernel.)
- */
- for (;;)
- if ((cc->ie_cmd_status & mask) || timedout)
- break;
-#if 0
- timeout_del(&chan_tmo);
-#endif
-
- return timedout;
- } else {
- /*
- * Otherwise, just wait for the command to be accepted.
- */
- (sc->chan_attn)(sc);
-
- while (scb->ie_command)
- ; /* XXX spin lock */
-
- return 0;
- }
-}
-
-/*
- * Run the time-domain reflectometer.
- */
-void
-run_tdr(sc, cmd)
- struct ie_softc *sc;
- struct ie_tdr_cmd *cmd;
-{
- int result;
-
- cmd->com.ie_cmd_status = 0;
- cmd->com.ie_cmd_cmd = IE_CMD_TDR | IE_CMD_LAST;
- cmd->com.ie_cmd_link = 0xffffffff;
-
- sc->scb->ie_command_list = ASWAP(cmd);
- cmd->ie_tdr_time = 0;
-
- if (command_and_wait(sc, IE_CU_START, cmd, IE_STAT_COMPL) ||
- !(cmd->com.ie_cmd_status & IE_STAT_OK))
- result = 0x10000; /* XXX */
- else
- result = cmd->ie_tdr_time;
-
- ie_ack(sc, IE_ST_WHENCE);
-
- if (result & IE_TDR_SUCCESS)
- return;
-
- if (result & 0x10000)
- printf("%s: TDR command failed\n", sc->sc_dev.dv_xname);
- else if (result & IE_TDR_XCVR) {
-#ifdef IEDEBUG
- printf("%s: transceiver problem\n", sc->sc_dev.dv_xname);
-#endif
- } else if (result & IE_TDR_OPEN)
- printf("%s: TDR detected an open %d clocks away\n",
- sc->sc_dev.dv_xname, result & IE_TDR_TIME);
- else if (result & IE_TDR_SHORT)
- printf("%s: TDR detected a short %d clocks away\n",
- sc->sc_dev.dv_xname, result & IE_TDR_TIME);
- else
- printf("%s: TDR returned unknown status %x\n",
- sc->sc_dev.dv_xname, result);
-}
-
-#ifdef notdef
-/* ALIGN works on 8 byte boundaries.... but 4 byte boundaries are ok for sun */
-#define _ALLOC(p, n) (bzero(p, n), p += n, p - n)
-#define ALLOC(p, n) _ALLOC(p, ALIGN(n)) /* XXX convert to this? */
-#endif
-
-static inline caddr_t
-Align(ptr)
- caddr_t ptr;
-{
- u_long l = (u_long)ptr;
-
- l = (l + 3) & ~3L;
- return (caddr_t)l;
-}
-
-/*
- * setup_bufs: set up the buffers
- *
- * we have a block of KVA at sc->buf_area which is of size sc->buf_area_sz.
- * this is to be used for the buffers. the chip indexs its control data
- * structures with 16 bit offsets, and it indexes actual buffers with
- * 24 bit addresses. so we should allocate control buffers first so that
- * we don't overflow the 16 bit offset field. The number of transmit
- * buffers is fixed at compile time.
- *
- * note: this function was written to be easy to understand, rather than
- * highly efficient (it isn't in the critical path).
- */
-void
-setup_bufs(sc)
- struct ie_softc *sc;
-{
- caddr_t ptr = sc->buf_area; /* memory pool */
- int n, r;
-
- /*
- * step 0: zero memory and figure out how many recv buffers and
- * frames we can have. XXX CURRENTLY HARDWIRED AT MAX
- */
- (sc->memzero)(ptr, sc->buf_area_sz);
- ptr = Align(ptr); /* set alignment and stick with it */
-
- n = (int)Align((caddr_t)sizeof(struct ie_xmit_cmd)) +
- (int)Align((caddr_t)sizeof(struct ie_xmit_buf)) + IE_TBUF_SIZE;
- n *= NTXBUF; /* n = total size of xmit area */
-
- n = sc->buf_area_sz - n;/* n = free space for recv stuff */
-
- r = (int)Align((caddr_t)sizeof(struct ie_recv_frame_desc)) +
- (((int)Align((caddr_t)sizeof(struct ie_recv_buf_desc)) + IE_RBUF_SIZE) * B_PER_F);
-
- /* r = size of one R frame */
-
- sc->nframes = n / r;
- if (sc->nframes <= 0)
- panic("ie: bogus buffer calc");
- if (sc->nframes > MXFRAMES)
- sc->nframes = MXFRAMES;
-
- sc->nrxbuf = sc->nframes * B_PER_F;
-
-#ifdef IEDEBUG
- printf("IEDEBUG: %d frames %d bufs\n", sc->nframes, sc->nrxbuf);
-#endif
-
- /*
- * step 1a: lay out and zero frame data structures for transmit and recv
- */
- for (n = 0; n < NTXBUF; n++) {
- sc->xmit_cmds[n] = (struct ie_xmit_cmd *volatile)ptr;
- ptr = Align(ptr + sizeof(struct ie_xmit_cmd));
- }
-
- for (n = 0; n < sc->nframes; n++) {
- sc->rframes[n] = (struct ie_recv_frame_desc *volatile)ptr;
- ptr = Align(ptr + sizeof(struct ie_recv_frame_desc));
- }
-
- /*
- * step 1b: link together the recv frames and set EOL on last one
- */
- for (n = 0; n < sc->nframes; n++) {
- sc->rframes[n]->ie_fd_last = IE_FD_FLEX;
- sc->rframes[n]->ie_fd_size = 0;
- sc->rframes[n]->ie_fd_next =
- ASWAP(sc->rframes[(n + 1) % sc->nframes]);
- }
- sc->rframes[sc->nframes - 1]->ie_fd_last |= IE_FD_LAST;
-
- /*
- * step 2a: lay out and zero frame buffer structures for xmit and recv
- */
- for (n = 0; n < NTXBUF; n++) {
- sc->xmit_buffs[n] = (struct ie_xmit_buf *volatile)ptr;
- ptr = Align(ptr + sizeof(struct ie_xmit_buf));
- }
-
- for (n = 0; n < sc->nrxbuf; n++) {
- sc->rbuffs[n] = (struct ie_recv_buf_desc *volatile)ptr;
- ptr = Align(ptr + sizeof(struct ie_recv_buf_desc));
- }
-
- /*
- * step 2b: link together recv bufs and set EOL on last one
- */
- for (n = 0; n < sc->nrxbuf; n++) {
- sc->rbuffs[n]->ie_rbd_next =
- ASWAP(sc->rbuffs[(n + 1) % sc->nrxbuf]);
- }
- sc->rbuffs[sc->nrxbuf - 1]->ie_rbd_length |= IE_RBD_LAST;
-
- /*
- * step 3: allocate the actual data buffers for xmit and recv
- * recv buffer gets linked into recv_buf_desc list here
- */
- for (n = 0; n < NTXBUF; n++) {
- sc->xmit_cbuffs[n] = (u_char *) ptr;
- ptr = Align(ptr + IE_TBUF_SIZE);
- }
-
- /* Pointers to last packet sent and next available transmit buffer. */
- sc->xchead = sc->xctail = 0;
-
- /* Clear transmit-busy flag and set number of free transmit buffers. */
- sc->xmit_busy = 0;
- sc->xmit_free = NTXBUF;
-
- for (n = 0; n < sc->nrxbuf; n++) {
- sc->cbuffs[n] = (char *) ptr; /* XXX why char vs uchar? */
- sc->rbuffs[n]->ie_rbd_length = IE_RBUF_SIZE;
- SWT_32(sc->rbuffs[n]->ie_rbd_buffer, ptr);
- ptr = Align(ptr + IE_RBUF_SIZE);
- }
-
- /*
- * step 4: set the head and tail pointers on receive to keep track of
- * the order in which RFDs and RBDs are used. link in recv frames
- * and buffer into the scb.
- */
-
- sc->rfhead = 0;
- sc->rftail = sc->nframes - 1;
- sc->rbhead = 0;
- sc->rbtail = sc->nrxbuf - 1;
-
- sc->scb->ie_recv_list = ASWAP(sc->rframes[0]);
- sc->rframes[0]->ie_fd_buf_desc = ASWAP(sc->rbuffs[0]);
-
-#ifdef IEDEBUG
- printf("IE_DEBUG: reserved %d bytes\n", ptr - sc->buf_area);
-#endif
-}
-
-/*
- * Run the multicast setup command.
- * Called at splnet().
- */
-int
-mc_setup(sc, ptr)
- struct ie_softc *sc;
- void *ptr;
-{
- struct ie_mcast_cmd *volatile cmd = ptr;
-
- cmd->com.ie_cmd_status = 0;
- cmd->com.ie_cmd_cmd = IE_CMD_MCAST | IE_CMD_LAST;
- cmd->com.ie_cmd_link = 0xffffffff;
-
- (sc->memcopy)((caddr_t)sc->mcast_addrs, (caddr_t)cmd->ie_mcast_addrs,
- sc->mcast_count * sizeof *sc->mcast_addrs);
-
- cmd->ie_mcast_bytes = sc->mcast_count * ETHER_ADDR_LEN; /* grrr... */
-
- sc->scb->ie_command_list = ASWAP(cmd);
- if (command_and_wait(sc, IE_CU_START, cmd, IE_STAT_COMPL) ||
- !(cmd->com.ie_cmd_status & IE_STAT_OK)) {
- printf("%s: multicast address setup command failed\n",
- sc->sc_dev.dv_xname);
- return 0;
- }
- return 1;
-}
-
-/*
- * This routine takes the environment generated by check_ie_present() and adds
- * to it all the other structures we need to operate the adapter. This
- * includes executing the CONFIGURE, IA-SETUP, and MC-SETUP commands, starting
- * the receiver unit, and clearing interrupts.
- *
- * THIS ROUTINE MUST BE CALLED AT splnet() OR HIGHER.
- */
-int
-ieinit(sc)
- struct ie_softc *sc;
-{
- struct ie_sys_ctl_block *volatile scb = sc->scb;
- void *ptr;
-
- ptr = sc->buf_area;
-
- /*
- * Set up bus throttles.
- */
-
- {
- if (command_and_wait(sc, IE_CU_THROTTLE, 0, 0)) {
- printf("%s: throttle set command failed\n",
- sc->sc_dev.dv_xname);
- return 0;
- }
- }
-
- /*
- * Send the configure command first.
- */
-
- {
- struct ie_config_cmd *volatile cmd = ptr;
-
- scb->ie_command_list = ASWAP(cmd);
- cmd->com.ie_cmd_status = 0;
- cmd->com.ie_cmd_cmd = IE_CMD_CONFIG | IE_CMD_LAST;
- cmd->com.ie_cmd_link = 0xffffffff;
-
- ie_setup_config(cmd, sc->promisc, 0);
-
- if (command_and_wait(sc, IE_CU_START, cmd, IE_STAT_COMPL) ||
- !(cmd->com.ie_cmd_status & IE_STAT_OK)) {
- printf("%s: configure command failed\n",
- sc->sc_dev.dv_xname);
- return 0;
- }
- }
-
- /*
- * Now send the Individual Address Setup command.
- */
- {
- struct ie_iasetup_cmd *volatile cmd = ptr;
-
- scb->ie_command_list = ASWAP(cmd);
- cmd->com.ie_cmd_status = 0;
- cmd->com.ie_cmd_cmd = IE_CMD_IASETUP | IE_CMD_LAST;
- cmd->com.ie_cmd_link = 0xffffffff;
-
- (sc->memcopy)(sc->sc_arpcom.ac_enaddr,
- (caddr_t)&cmd->ie_address, sizeof cmd->ie_address);
-
- if (command_and_wait(sc, IE_CU_START, cmd, IE_STAT_COMPL) ||
- !(cmd->com.ie_cmd_status & IE_STAT_OK)) {
- printf("%s: individual address setup command failed\n",
- sc->sc_dev.dv_xname);
- return 0;
- }
- }
-
- /*
- * Now run the time-domain reflectometer.
- */
- run_tdr(sc, ptr);
-
- /*
- * Acknowledge any interrupts we have generated thus far.
- */
- ie_ack(sc, IE_ST_WHENCE);
-
- /*
- * Set up the transmit and recv buffers.
- */
- setup_bufs(sc);
-
- sc->sc_arpcom.ac_if.if_flags |= IFF_RUNNING; /* tell higher levels that we are here */
-
- sc->scb->ie_recv_list = ASWAP(sc->rframes[0]);
- command_and_wait(sc, IE_RU_START, 0, 0);
-
- ie_ack(sc, IE_ST_WHENCE);
-
- if (sc->run_596)
- (sc->run_596)(sc);
-
- return 0;
-}
-
-void
-iestop(sc)
- struct ie_softc *sc;
-{
-
- command_and_wait(sc, IE_RU_DISABLE, 0, 0);
-}
-
-int
-ieioctl(ifp, cmd, data)
- struct ifnet *ifp;
- u_long cmd;
- caddr_t data;
-{
- struct ie_softc *sc = ifp->if_softc;
- struct ifaddr *ifa = (struct ifaddr *)data;
- int s, error = 0;
-
- s = splnet();
-
- switch(cmd) {
- case SIOCSIFADDR:
- ifp->if_flags |= IFF_UP;
-
- switch(ifa->ifa_addr->sa_family) {
-#ifdef INET
- case AF_INET:
- ieinit(sc);
- arp_ifinit(&sc->sc_arpcom, ifa);
- break;
-#endif
- default:
- ieinit(sc);
- break;
- }
- break;
-
- case SIOCSIFFLAGS:
- sc->promisc = ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI);
- if ((ifp->if_flags & IFF_UP) == 0 &&
- (ifp->if_flags & IFF_RUNNING) != 0) {
- /*
- * If interface is marked down and it is running, then
- * stop it.
- */
- iestop(sc);
- ifp->if_flags &= ~IFF_RUNNING;
- } else if ((ifp->if_flags & IFF_UP) != 0 &&
- (ifp->if_flags & IFF_RUNNING) == 0) {
- /*
- * If interface is marked up and it is stopped, then
- * start it.
- */
- ieinit(sc);
- } else {
- /*
- * Reset the interface to pick up changes in any other
- * flags that affect hardware registers.
- */
- iestop(sc);
- ieinit(sc);
- }
-#ifdef IEDEBUG
- if (ifp->if_flags & IFF_DEBUG)
- sc->sc_debug = IED_ALL;
- else
- sc->sc_debug = 0;
-#endif
- break;
-
- default:
- error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data);
- }
-
- if (error == ENETRESET) {
- if (ifp->if_flags & IFF_RUNNING)
- mc_reset(sc);
- error = 0;
- }
-
- splx(s);
- return error;
-}
-
-void
-mc_reset(sc)
- struct ie_softc *sc;
-{
- struct arpcom *ac = &sc->sc_arpcom;
- struct ether_multi *enm;
- struct ether_multistep step;
-
- if (ac->ac_multirangecnt > 0) {
- ac->ac_if.if_flags |= IFF_ALLMULTI;
- ieioctl(&ac->ac_if, SIOCSIFFLAGS, (void *)0);
- goto setflag;
- }
-
- /*
- * Step through the list of addresses.
- */
- sc->mcast_count = 0;
- ETHER_FIRST_MULTI(step, ac, enm);
- while (enm) {
- if (sc->mcast_count >= MAXMCAST) {
- ac->ac_if.if_flags |= IFF_ALLMULTI;
- ieioctl(&ac->ac_if, SIOCSIFFLAGS, (void *)0);
- goto setflag;
- }
-
- bcopy(enm->enm_addrlo, &sc->mcast_addrs[sc->mcast_count], 6);
- sc->mcast_count++;
- ETHER_NEXT_MULTI(step, enm);
- }
-setflag:
- sc->want_mcsetup = 1;
-}
-
-#ifdef IEDEBUG
-void
-print_rbd(rbd)
- struct ie_recv_buf_desc *volatile rbd;
-{
-
- printf("RBD at %08lx:\nactual %04x, next %04x, buffer %08x\n"
- "length %04x, mbz %04x\n", (u_long)rbd, rbd->ie_rbd_actual,
- rbd->ie_rbd_next, rbd->ie_rbd_buffer, rbd->ie_rbd_length,
- rbd->mbz);
-}
-#endif
-
diff --git a/sys/arch/mvme88k/dev/if_ie.h b/sys/arch/mvme88k/dev/if_ie.h
deleted file mode 100644
index b535a0a5ff7..00000000000
--- a/sys/arch/mvme88k/dev/if_ie.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/* $OpenBSD: if_ie.h,v 1.5 2003/10/11 22:08:57 miod Exp $ */
-
-/* Copyright (c) 1998 Steve Murphree, Jr.
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * XXX where else is this from?
- * if_sunie.h
- *
- * sun's ie interface
- */
-
-/*
- * programming notes:
- *
- * the ie chip operates in a 24 bit address space.
- *
- * most ie interfaces appear to be divided into two parts:
- * - generic 586 stuff
- * - board specific
- *
- * generic:
- * the generic stuff of the ie chip is all done with data structures
- * that live in the chip's memory address space. the chip expects
- * its main data structure (the sys conf ptr -- SCP) to be at a
- * address loaded into the chip at init.
- *
- * the SCP points to another structure called the ISCP.
- * the ISCP points to another structure called the SCB.
- * the SCB has a status field, a linked list of "commands", and
- * a linked list of "receive buffers". these are data structures that
- * live in memory, not registers.
- *
- * board:
- * to get the chip to do anything, you first put a command in the
- * command data structure list. then you have to signal "attention"
- * to the chip to get it to look at the command. how you
- * signal attention depends on what board you have... on PC's
- * there is an i/o port number to do this, on sun's there is a
- * register bit you toggle.
- *
- * to get data from the chip you program it to interrupt...
- *
- * the VME boards lives in vme16 space. only 16 and 8 bit accesses
- * are allowed, so functions that copy data must be aware of this.
- *
- * the chip is an intel chip. this means that the byte order
- * on all the "short"s in the chip's data structures is wrong.
- * so, constants described in the intel docs are swapped for the sun.
- * that means that any buffer pointers you give the chip must be
- * swapped to intel format. yuck.
- *
- */
-
-/*
- * PART 1: VME/multibus defs
- */
-#define IEVME_PAGESIZE 1024 /* bytes */
-#define IEVME_PAGSHIFT 10 /* bits */
-#define IEVME_NPAGES 256 /* number of pages on chip */
-#define IEVME_MAPSZ 1024 /* number of entries in the map */
-
-/*
- * PTE for the page map
- */
-#define IEVME_SBORDR 0x8000 /* sun byte order */
-#define IEVME_IBORDR 0x0000 /* intel byte ordr */
-
-#define IEVME_P2MEM 0x2000 /* memory is on P2 */
-#define IEVME_OBMEM 0x0000 /* memory is on board */
-
-#define IEVME_PGMASK 0x0fff /* gives the physical page frame number */
-
-struct ievme {
- u_short pgmap[IEVME_MAPSZ];
- u_short xxx[32]; /* prom */
- u_short status; /* see below for bits */
- u_short xxx2; /* filler */
- u_short pectrl; /* parity control (see below) */
- u_short peaddr; /* low 16 bits of address */
-};
-
-/*
- * status bits
- */
-#define IEVME_RESET 0x8000 /* reset board */
-#define IEVME_ONAIR 0x4000 /* go out of loopback 'on-air' */
-#define IEVME_ATTEN 0x2000 /* attention */
-#define IEVME_IENAB 0x1000 /* interrupt enable */
-#define IEVME_PEINT 0x0800 /* parity error interrupt enable */
-#define IEVME_PERR 0x0200 /* parity error flag */
-#define IEVME_INT 0x0100 /* interrupt flag */
-#define IEVME_P2EN 0x0020 /* enable p2 bus */
-#define IEVME_256K 0x0010 /* 256kb rams */
-#define IEVME_HADDR 0x000f /* mask for bits 17-20 of address */
-
-/*
- * parity control
- */
-#define IEVME_PARACK 0x0100 /* parity error ack */
-#define IEVME_PARSRC 0x0080 /* parity error source */
-#define IEVME_PAREND 0x0040 /* which end of the data got the error */
-#define IEVME_PARADR 0x000f /* mask to get bits 17-20 of parity address */
-
-
-/*
- * PART 2: the on-board interface
- */
-struct ieob {
- u_short porthigh;
- u_short portlow;
- u_long attn;
-};
-#define IE_PORT_NEWSCPADDR 0x00000002
-#define IE_PORT_RESET 0x00000000
-
-#define IEOB_ADBASE 0xff000000 /* KVA base addr of 24 bit address space */
-
-/*
- * PART 3: the 3E board
- */
-
-/*
- * not supported (yet?)
- */
-
diff --git a/sys/arch/mvme88k/dev/if_le.c b/sys/arch/mvme88k/dev/if_le.c
deleted file mode 100644
index 0db823ae7a8..00000000000
--- a/sys/arch/mvme88k/dev/if_le.c
+++ /dev/null
@@ -1,309 +0,0 @@
-/* $OpenBSD: if_le.c,v 1.16 2013/09/24 20:10:48 miod Exp $ */
-
-/*-
- * Copyright (c) 1982, 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)if_le.c 8.2 (Berkeley) 10/30/93
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/mbuf.h>
-#include <sys/syslog.h>
-#include <sys/socket.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-
-#include <net/if.h>
-
-#ifdef INET
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-#endif
-
-#include <net/if_media.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-
-#include <dev/ic/lancereg.h>
-#include <dev/ic/lancevar.h>
-#include <dev/ic/am7990reg.h>
-#include <dev/ic/am7990var.h>
-
-#include <mvme88k/dev/if_lereg.h>
-#include <mvme88k/dev/if_levar.h>
-#include <mvme88k/dev/vme.h>
-
-/* autoconfiguration driver */
-void leattach(struct device *, struct device *, void *);
-int lematch(struct device *, void *, void *);
-
-const struct cfattach le_ca = {
- sizeof(struct le_softc), lematch, leattach
-};
-
-void vlewrcsr(struct lance_softc *, uint16_t, uint16_t);
-uint16_t vlerdcsr(struct lance_softc *, uint16_t);
-void nvram_cmd(struct lance_softc *, uint8_t, uint16_t);
-uint16_t nvram_read(struct lance_softc *, uint8_t);
-void vleetheraddr(struct lance_softc *);
-void vleinit(struct lance_softc *);
-void vlereset(struct lance_softc *);
-int vle_intr(void *);
-
-/* send command to the nvram controller */
-void
-nvram_cmd(struct lance_softc *sc, uint8_t cmd, uint16_t addr)
-{
- struct vlereg1 *reg1 = (struct vlereg1 *)((struct le_softc *)sc)->sc_r1;
- int i;
-
- for (i = 0; i < 8; i++) {
- reg1->ler1_ear = ((cmd | (addr << 1)) >> i);
- CDELAY;
- }
-}
-
-/* read nvram one bit at a time */
-uint16_t
-nvram_read(struct lance_softc *sc, uint8_t nvram_addr)
-{
- uint16_t val = 0, mask = 0x04000;
- uint16_t wbit;
- struct vlereg1 *reg1 = (struct vlereg1 *)((struct le_softc *)sc)->sc_r1;
-
- ((struct le_softc *)sc)->sc_csr = 0x4f;
- ENABLE_NVRAM;
- nvram_cmd(sc, NVRAM_RCL, 0);
- DISABLE_NVRAM;
- CDELAY;
- ENABLE_NVRAM;
- nvram_cmd(sc, NVRAM_READ, nvram_addr);
- for (wbit = 0; wbit < 15; wbit++) {
- if (reg1->ler1_ear & 0x01)
- val |= mask;
- else
- val &= ~mask;
- mask = mask >> 1;
- CDELAY;
- }
- if (reg1->ler1_ear & 0x01)
- val |= 0x8000;
- else
- val &= 0x7fff;
- CDELAY;
- DISABLE_NVRAM;
- return (val);
-}
-
-void
-vleetheraddr(struct lance_softc *sc)
-{
- uint8_t *cp = sc->sc_arpcom.ac_enaddr;
- uint16_t ival[3];
- int i;
-
- for (i = 0; i < 3; i++) {
- ival[i] = nvram_read(sc, i);
- }
- memcpy(cp, &ival[0], 6);
-}
-
-void
-vlewrcsr(struct lance_softc *sc, uint16_t port, uint16_t val)
-{
- struct vlereg1 *ler1 = (struct vlereg1 *)((struct le_softc *)sc)->sc_r1;
-
- ler1->ler1_rap = port;
- ler1->ler1_rdp = val;
-}
-
-uint16_t
-vlerdcsr(struct lance_softc *sc, uint16_t port)
-{
- struct vlereg1 *ler1 = (struct vlereg1 *)((struct le_softc *)sc)->sc_r1;
- uint16_t val;
-
- ler1->ler1_rap = port;
- val = ler1->ler1_rdp;
- return (val);
-}
-
-/* init MVME376, set ipl and vec */
-void
-vleinit(struct lance_softc *sc)
-{
- struct vlereg1 *reg1 = (struct vlereg1 *)((struct le_softc *)sc)->sc_r1;
- uint8_t vec = ((struct le_softc *)sc)->sc_vec;
- uint8_t ipl = ((struct le_softc *)sc)->sc_ipl;
-
- ((struct le_softc *)sc)->sc_csr = 0x4f;
- WRITE_CSR_AND(ipl);
- SET_VEC(vec);
- return;
-}
-
-/* MVME376 hardware reset */
-void
-vlereset(struct lance_softc *sc)
-{
- struct vlereg1 *reg1 = (struct vlereg1 *)((struct le_softc *)sc)->sc_r1;
-
- RESET_HW;
-#ifdef LEDEBUG
- if (sc->sc_debug) {
- printf("%s: hardware reset\n", sc->sc_dev.dv_xname);
- }
-#endif
- SYSFAIL_CL;
-}
-
-int
-vle_intr(void *sc)
-{
- struct le_softc *lesc = (struct le_softc *)sc;
- struct vlereg1 *reg1 = (struct vlereg1 *)lesc->sc_r1;
- int rc;
-
- rc = am7990_intr(sc);
- ENABLE_INTR;
- return (rc);
-}
-
-int
-lematch(struct device *parent, void *vcf, void *args)
-{
- struct confargs *ca = args;
- bus_space_tag_t iot = ca->ca_iot;
- bus_space_handle_t ioh;
- int rc;
-
- if (bus_space_map(iot, ca->ca_paddr, PAGE_SIZE, 0, &ioh) != 0)
- return 0;
- rc = badaddr((vaddr_t)bus_space_vaddr(iot, ioh), 2);
- bus_space_unmap(iot, ioh, PAGE_SIZE);
-
- return rc == 0;
-}
-
-/*
- * Interface exists: make available by filling in network interface
- * record. System will initialize the interface when it is ready
- * to accept packets.
- */
-void
-leattach(struct device *parent, struct device *self, void *aux)
-{
- struct le_softc *lesc = (struct le_softc *)self;
- struct lance_softc *sc = &lesc->sc_am7990.lsc;
- struct confargs *ca = aux;
- paddr_t paddr;
- int card;
- bus_space_tag_t iot = ca->ca_iot;
- bus_space_handle_t ioh, memh;
-
- if (ca->ca_vec < 0) {
- printf(": no more interrupts!\n");
- return;
- }
- if (ca->ca_ipl < 0)
- ca->ca_ipl = IPL_NET;
-
- /*
- * MVME376 uses its own dual-ported RAM for buffers.
- * Its address is set by DIP switches on board. We support the six
- * Motorola address locations; however, the board can be set up at
- * any other address.
- */
- switch (ca->ca_paddr) {
- case 0xffff1200:
- card = 0;
- break;
- case 0xffff1400:
- card = 1;
- break;
- case 0xffff1600:
- card = 2;
- break;
- case 0xffff5400:
- card = 3;
- break;
- case 0xffff5600:
- card = 4;
- break;
- case 0xffffa400:
- card = 5;
- break;
- default:
- printf(": unsupported address\n");
- return;
- }
-
- if (bus_space_map(iot, ca->ca_paddr, PAGE_SIZE, 0, &ioh) != 0) {
- printf(": can't map registers!\n");
- return;
- }
-
- paddr = VLEMEMBASE - (card * VLEMEMSIZE);
- if (bus_space_map(iot, paddr, VLEMEMSIZE, BUS_SPACE_MAP_LINEAR,
- &memh) != 0) {
- printf(": can't map buffers!\n");
- bus_space_unmap(iot, ioh, PAGE_SIZE);
- return;
- }
- lesc->sc_r1 = (void *)bus_space_vaddr(iot, ioh);
- lesc->sc_ipl = ca->ca_ipl;
- lesc->sc_vec = ca->ca_vec;
-
- sc->sc_mem = (void *)bus_space_vaddr(iot, memh);
- sc->sc_memsize = VLEMEMSIZE;
- sc->sc_addr = paddr & 0x00ffffff;
- sc->sc_conf3 = LE_C3_BSWP;
- sc->sc_hwreset = vlereset;
- sc->sc_rdcsr = vlerdcsr;
- sc->sc_wrcsr = vlewrcsr;
- sc->sc_hwinit = vleinit;
- sc->sc_copytodesc = lance_copytobuf_contig;
- sc->sc_copyfromdesc = lance_copyfrombuf_contig;
- sc->sc_copytobuf = lance_copytobuf_contig;
- sc->sc_copyfrombuf = lance_copyfrombuf_contig;
- sc->sc_zerobuf = lance_zerobuf_contig;
-
- /* get Ethernet address */
- vleetheraddr(sc);
-
- am7990_config(&lesc->sc_am7990);
-
- /* connect the interrupt */
- lesc->sc_ih.ih_fn = vle_intr;
- lesc->sc_ih.ih_arg = sc;
- lesc->sc_ih.ih_wantframe = 0;
- lesc->sc_ih.ih_ipl = ca->ca_ipl;
- vmeintr_establish(ca->ca_vec, &lesc->sc_ih, self->dv_xname);
-}
diff --git a/sys/arch/mvme88k/dev/if_lereg.h b/sys/arch/mvme88k/dev/if_lereg.h
deleted file mode 100644
index 60d49c8b08d..00000000000
--- a/sys/arch/mvme88k/dev/if_lereg.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* $OpenBSD: if_lereg.h,v 1.6 2007/05/25 21:27:15 krw Exp $ */
-
-/*-
- * Copyright (c) 1982, 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)if_lereg.h 8.2 (Berkeley) 10/30/93
- */
-
-#define VLEMEMSIZE 0x00040000
-#define VLEMEMBASE 0xfd6c0000
-
-/*
- * LANCE registers for MVME376
- */
-struct vlereg1 {
- volatile u_int16_t ler1_csr; /* board control/status register */
- volatile u_int16_t ler1_vec; /* interrupt vector register */
- volatile u_int16_t ler1_rdp; /* data port */
- volatile u_int16_t ler1_rap; /* register select port */
- volatile u_int16_t ler1_ear; /* ethernet address register */
-};
-
-#define NVRAM_EN 0x0008 /* NVRAM enable bit (active low) */
-#define INTR_EN 0x0010 /* interrupt enable bit (active low) */
-#define PARITYB 0x0020 /* parity error clear bit */
-#define HW_RS 0x0040 /* hardware reset bit (active low) */
-#define SYSFAILB 0x0080 /* SYSFAIL bit */
-
-#define NVRAM_RWEL 0xe0 /* Reset write enable latch */
-#define NVRAM_STO 0x60 /* Store ram to eeprom */
-#define NVRAM_SLP 0xa0 /* Novram into low power mode */
-#define NVRAM_WRITE 0x20 /* Writes word from location x */
-#define NVRAM_SWEL 0xc0 /* Set write enable latch */
-#define NVRAM_RCL 0x40 /* Recall eeprom data into ram */
-#define NVRAM_READ 0x00 /* Reads word from location x */
-
-#define CDELAY delay(10000)
-#define WRITE_CSR_OR(x) \
- do { \
- ((struct le_softc *)sc)->sc_csr |= (x); \
- reg1->ler1_csr = ((struct le_softc *)sc)->sc_csr; \
- } while (0)
-#define WRITE_CSR_AND(x) \
- do { \
- ((struct le_softc *)sc)->sc_csr &= ~(x); \
- reg1->ler1_csr = ((struct le_softc *)sc)->sc_csr; \
- } while (0)
-#define ENABLE_NVRAM WRITE_CSR_AND(NVRAM_EN)
-#define DISABLE_NVRAM WRITE_CSR_OR(NVRAM_EN)
-#define ENABLE_INTR WRITE_CSR_AND(INTR_EN)
-#define DISABLE_INTR WRITE_CSR_OR(INTR_EN)
-#define RESET_HW \
- do { \
- WRITE_CSR_AND(HW_RS); \
- CDELAY; \
- } while (0)
-#define SET_VEC(x) \
- reg1->ler1_vec = (x)
-#define SYSFAIL_CL WRITE_CSR_AND(SYSFAILB)
diff --git a/sys/arch/mvme88k/dev/if_levar.h b/sys/arch/mvme88k/dev/if_levar.h
deleted file mode 100644
index 3c90736903d..00000000000
--- a/sys/arch/mvme88k/dev/if_levar.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* $OpenBSD: if_levar.h,v 1.5 2006/04/26 21:06:08 miod Exp $ */
-/* $NetBSD: if_levar.h,v 1.5 1996/05/07 01:27:32 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell and Rick Macklem.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)if_le.c 8.2 (Berkeley) 11/16/93
- */
-
-/*
- * Ethernet software status per interface.
- *
- * Each interface is referenced by a network interface structure,
- * arpcom.ac_if, which the routing code uses to locate the interface.
- * This structure contains the output queue for the interface, its address, ...
- */
-struct le_softc {
- struct am7990_softc sc_am7990; /* glue to MI code */
- struct intrhand sc_ih; /* interrupt vectoring */
- u_int sc_csr; /* CSR image */
- void *sc_r1; /* LANCE registers */
- u_int sc_ipl;
- u_int sc_vec;
-};
diff --git a/sys/arch/mvme88k/dev/mainbus.c b/sys/arch/mvme88k/dev/mainbus.c
deleted file mode 100644
index 2b1e7e850ea..00000000000
--- a/sys/arch/mvme88k/dev/mainbus.c
+++ /dev/null
@@ -1,334 +0,0 @@
-/* $OpenBSD: mainbus.c,v 1.28 2013/05/17 22:51:59 miod Exp $ */
-/*
- * Copyright (c) 1998 Steve Murphree, Jr.
- * Copyright (c) 2004, Miodrag Vallat.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/reboot.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/disklabel.h>
-#include <sys/extent.h>
-#include <sys/malloc.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/bus.h>
-#include <machine/autoconf.h>
-#include <machine/cmmu.h>
-#include <machine/cpu.h>
-
-#ifdef M88100
-#include <machine/m8820x.h>
-#endif
-#ifdef MVME181
-#include <machine/mvme181.h>
-#endif
-#ifdef MVME187
-#include <machine/mvme187.h>
-#endif
-#ifdef MVME188
-#include <machine/mvme188.h>
-#endif
-#ifdef MVME197
-#include <machine/mvme197.h>
-#endif
-
-void mainbus_attach(struct device *, struct device *, void *);
-int mainbus_match(struct device *, void *, void *);
-int mainbus_print(void *, const char *);
-int mainbus_scan(struct device *, void *, void *);
-
-/*
- * bus_space routines for 1:1 obio mappings
- */
-
-int mainbus_map(bus_addr_t, bus_size_t, int, bus_space_handle_t *);
-void mainbus_unmap(bus_space_handle_t, bus_size_t);
-int mainbus_subregion(bus_space_handle_t, bus_size_t, bus_size_t,
- bus_space_handle_t *);
-void *mainbus_vaddr(bus_space_handle_t);
-
-const struct mvme88k_bus_space_tag mainbus_bustag = {
- mainbus_map,
- mainbus_unmap,
- mainbus_subregion,
- mainbus_vaddr
-};
-
-bus_addr_t bs_obio_start;
-bus_addr_t bs_obio_end;
-struct extent *bs_extent;
-
-/*
- * Obio (internal IO) space is mapped 1:1 (see pmap_bootstrap() for details).
- *
- * However, sram attaches as a child of mainbus, but does not reside in
- * internal IO space. As a result, we have to allow both 1:1 and regular
- * translations, depending upon the address to map.
- */
-
-int
-mainbus_map(bus_addr_t addr, bus_size_t size, int flags,
- bus_space_handle_t *ret)
-{
- vaddr_t map;
-
- map = mapiodev((paddr_t)addr, size);
- if (map == 0)
- return ENOMEM;
-
- *ret = (bus_space_handle_t)map;
- return 0;
-}
-
-void
-mainbus_unmap(bus_space_handle_t handle, bus_size_t size)
-{
- /* XXX what to do for non-obio mappings? */
-}
-
-int
-mainbus_subregion(bus_space_handle_t handle, bus_addr_t offset,
- bus_size_t size, bus_space_handle_t *ret)
-{
- *ret = handle + offset;
- return (0);
-}
-
-void *
-mainbus_vaddr(bus_space_handle_t handle)
-{
- return (void *)handle;
-}
-
-/*
- * Map a range [pa, pa+size) in the given map to a kernel address
- * in iomap space.
- *
- * Note: To be flexible, I did not put a restriction on the alignment
- * of pa. However, it is advisable to have pa page aligned since otherwise,
- * we might have several mappings for a given chunk of the IO page.
- */
-vaddr_t
-mapiodev(paddr_t addr, int _size)
-{
- vaddr_t va, iova, off;
- paddr_t pa, epa;
- psize_t size;
- int s, error;
-
- /* sanity checks */
- if (_size <= 0)
- return 0;
- size = (psize_t)_size;
- epa = addr + size;
- if (epa < addr && epa != 0)
- return 0;
-
- /* check for 1:1 mapping */
- if (addr >= bs_obio_start) {
- if (bs_obio_end == 0 || epa <= bs_obio_end)
- return ((vaddr_t)addr);
- else if (addr <= bs_obio_end)
- /* across obio and non-obio, not supported */
- return 0;
- }
-
- pa = trunc_page(addr);
- off = addr & PGOFSET;
- size = round_page(off + size);
-
- s = splhigh();
- error = extent_alloc_region(bs_extent, atop(pa), atop(size),
- EX_MALLOCOK | (cold ? 0 : EX_WAITSPACE));
- splx(s);
-
- if (error != 0)
- return 0;
-
- va = uvm_km_valloc(kernel_map, size);
- if (va == 0) {
- extent_free(bs_extent, atop(pa), atop(size),
- EX_MALLOCOK | (cold ? 0 : EX_WAITSPACE));
- return 0;
- }
-
- iova = va + off;
- while (size != 0) {
- pmap_enter(pmap_kernel(), va, pa, UVM_PROT_RW,
- UVM_PROT_RW | PMAP_WIRED);
- size -= PAGE_SIZE;
- va += PAGE_SIZE;
- pa += PAGE_SIZE;
- }
- pmap_update(pmap_kernel());
-
- return (iova);
-}
-
-/*
- * Free up the mapping in iomap.
- */
-void
-unmapiodev(vaddr_t va, int _size)
-{
- vaddr_t eva, kva, off;
- vsize_t size;
- paddr_t pa;
- int s, error;
-
- /* sanity checks */
- if (_size <= 0)
- return;
- size = (vsize_t)_size;
- eva = va + size;
- if (eva < va && eva != 0)
- return;
-
- /* check for 1:1 mapping */
- if (va >= bs_obio_start) {
- if (bs_obio_end == 0 || eva <= bs_obio_end)
- return;
- else if (va <= bs_obio_end)
- /* across obio and non-obio, not supported */
- return;
- }
-
- off = va & PGOFSET;
- kva = trunc_page(va);
- size = round_page(off + size);
-
- if (pmap_extract(pmap_kernel(), kva, &pa) == FALSE)
- panic("unmapiodev(%p,%p)", kva, size);
-
- pmap_remove(pmap_kernel(), kva, kva + size);
- pmap_update(pmap_kernel());
- uvm_km_free(kernel_map, kva, size);
-
- s = splhigh();
- error = extent_free(bs_extent, atop(pa), atop(size),
- EX_MALLOCOK | (cold ? 0 : EX_WAITSPACE));
-#ifdef DIAGNOSTIC
- if (error != 0)
- printf("unmapiodev(%p pa %p, %p): extent_free failed\n",
- kva, pa, size);
-#endif
- splx(s);
-}
-
-/*
- * Configuration glue
- */
-
-struct cfattach mainbus_ca = {
- sizeof(struct device), mainbus_match, mainbus_attach
-};
-
-struct cfdriver mainbus_cd = {
- NULL, "mainbus", DV_DULL
-};
-
-int
-mainbus_match(struct device *parent, void *cf, void *args)
-{
- return (1);
-}
-
-int
-mainbus_print(void *args, const char *bus)
-{
- struct confargs *ca = args;
-
- if (ca->ca_paddr != -1)
- printf(" addr 0x%x", ca->ca_paddr);
- return (UNCONF);
-}
-
-int
-mainbus_scan(struct device *parent, void *child, void *args)
-{
- struct cfdata *cf = child;
- struct confargs oca;
-
- bzero(&oca, sizeof oca);
- oca.ca_iot = &mainbus_bustag;
- oca.ca_dmat = 0; /* XXX no need for a meaningful value yet */
- oca.ca_bustype = BUS_MAIN;
- oca.ca_paddr = cf->cf_loc[0];
- oca.ca_ipl = -1;
- oca.ca_name = cf->cf_driver->cd_name;
- if ((*cf->cf_attach->ca_match)(parent, cf, &oca) == 0)
- return (0);
- config_attach(parent, cf, &oca, mainbus_print);
- return (1);
-}
-
-void
-mainbus_attach(struct device *parent, struct device *self, void *args)
-{
- extern char cpu_model[];
-
- printf(": %s\n", cpu_model);
-
- /*
- * Display cpu/mmu details for the main processor.
- */
- cpu_configuration_print(1);
-
- /*
- * Initialize an extent to keep track of I/O mappings.
- */
-#ifdef M88100
- if (CPU_IS88100) {
- switch (brdtyp) {
-#ifdef MVME181
- case BRD_180:
- case BRD_181:
- bs_obio_start = M181_OBIO_START;
- bs_obio_end = 0;
- break;
-#endif
- default:
- bs_obio_start = BATC8_VA; /* hardwired BATC */
- bs_obio_end = 0;
- break;
- }
- }
-#endif
-#ifdef MVME197
- if (CPU_IS88110) {
- bs_obio_start = OBIO197_START;
- bs_obio_end = OBIO197_START + OBIO197_SIZE;
- }
-#endif
- bs_extent = extent_create("bus_space", atop(physmem),
- 1 + atop(0U - PAGE_SIZE), M_DEVBUF, NULL, 0, EX_NOWAIT);
- if (bs_extent == NULL)
- panic("unable to allocate bus_space extent");
-
- (void)config_search(mainbus_scan, self, args);
-}
diff --git a/sys/arch/mvme88k/dev/memc.c b/sys/arch/mvme88k/dev/memc.c
deleted file mode 100644
index 86766fbc531..00000000000
--- a/sys/arch/mvme88k/dev/memc.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/* $OpenBSD: memc.c,v 1.14 2010/06/26 23:24:43 guenther Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * MEMC/MCECC chips
- * these chips are rather similar in appearance except that the MEMC
- * does parity while the MCECC does ECC.
- */
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-#include <sys/uio.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/syslog.h>
-#include <sys/fcntl.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-
-#include <dev/cons.h>
-
-#include <mvme88k/dev/memcreg.h>
-
-struct memcsoftc {
- struct device sc_dev;
- struct memcreg *sc_memc;
- struct intrhand sc_ih;
-};
-
-void memcattach(struct device *, struct device *, void *);
-int memcmatch(struct device *, void *, void *);
-
-struct cfattach memc_ca = {
- sizeof(struct memcsoftc), memcmatch, memcattach
-};
-
-struct cfdriver memc_cd = {
- NULL, "memc", DV_DULL
-};
-
-#if 0
-int memcintr(void *);
-#endif
-
-int
-memcmatch(parent, vcf, args)
- struct device *parent;
- void *vcf, *args;
-{
- struct confargs *ca = args;
- struct memcreg *memc = (struct memcreg *)ca->ca_paddr;
-
- if (badaddr((vaddr_t)memc, 4))
- return (0);
- if (memc->memc_chipid==MEMC_CHIPID || memc->memc_chipid==MCECC_CHIPID)
- return (1);
- return (0);
-}
-
-void
-memcattach(parent, self, args)
- struct device *parent, *self;
- void *args;
-{
- struct confargs *ca = args;
- struct memcsoftc *sc = (struct memcsoftc *)self;
-
- sc->sc_memc = (struct memcreg *)ca->ca_paddr;
-
- printf(": %s rev %d",
- (sc->sc_memc->memc_chipid == MEMC_CHIPID) ? "MEMC040" : "MCECC",
- sc->sc_memc->memc_chiprev);
-
-#if 0
- sc->sc_ih.ih_fn = memcintr;
- sc->sc_ih.ih_arg = 0;
- sc->sc_ih.ih_wantframe = 1;
- sc->sc_ih.ih_ipl = 7;
- mcintr_establish(xxx, &sc->sc_ih, self->dv_xname);
-#endif
-
- switch (sc->sc_memc->memc_chipid) {
- case MEMC_CHIPID:
- break;
- case MCECC_CHIPID:
- break;
- }
-
- printf("\n");
-}
-
-#if 0
-int
-memcintr(eframe)
- void *eframe;
-{
- return (0);
-}
-#endif
diff --git a/sys/arch/mvme88k/dev/memcreg.h b/sys/arch/mvme88k/dev/memcreg.h
deleted file mode 100644
index f62bae75df7..00000000000
--- a/sys/arch/mvme88k/dev/memcreg.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* $OpenBSD: memcreg.h,v 1.3 2003/06/02 07:06:56 deraadt Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * the MEMC's registers are a subset of the MCECC chip
- */
-struct memcreg {
- volatile u_char memc_chipid;
- volatile u_char xx0[3];
- volatile u_char memc_chiprev;
- volatile u_char xx1[3];
- volatile u_char memc_memconf;
-#define MEMC_MEMCONF_MSIZ 0x07
-#define MEMC_MEMCONF_RTOB(x) ((4*1024*1024) << ((x) & MEMC_MEMCONF_MSIZ))
- volatile u_char xx2[3];
- volatile u_char memc_x0;
- volatile u_char xx3[3];
- volatile u_char memc_x1;
- volatile u_char xx4[3];
- volatile u_char memc_baseaddr;
- volatile u_char xx5[3];
- volatile u_char memc_control;
- volatile u_char xx6[3];
- volatile u_char memc_bclk;
- volatile u_char xx7[3];
-
- /* the following registers only exist on the MCECC */
- volatile u_char memc_datactl;
- volatile u_char xx8[3];
- volatile u_char memc_scrubctl;
- volatile u_char xx9[3];
- volatile u_char memc_scrubperh;
- volatile u_char xx10[3];
- volatile u_char memc_scrubperl;
- volatile u_char xx11[3];
- volatile u_char memc_chipprescale;
- volatile u_char xx12[3];
- volatile u_char memc_scrubtime;
- volatile u_char xx13[3];
- volatile u_char memc_scrubprescaleh;
- volatile u_char xx14[3];
- volatile u_char memc_scrubprescalem;
- volatile u_char xx15[3];
- volatile u_char memc_scrubprescalel;
- volatile u_char xx16[3];
- volatile u_char memc_scrubtimeh;
- volatile u_char xx17[3];
- volatile u_char memc_scrubtimel;
- volatile u_char xx18[3];
- volatile u_char memc_scrubaddrhh;
- volatile u_char xx19[3];
- volatile u_char memc_scrubaddrhm;
- volatile u_char xx20[3];
- volatile u_char memc_scrubaddrlm;
- volatile u_char xx21[3];
- volatile u_char memc_scrubaddrll;
- volatile u_char xx22[3];
- volatile u_char memc_errlog;
- volatile u_char xx23[3];
- volatile u_char memc_errloghh;
- volatile u_char xx24[3];
- volatile u_char memc_errloghm;
- volatile u_char xx25[3];
- volatile u_char memc_errloglm;
- volatile u_char xx26[3];
- volatile u_char memc_errlogll;
- volatile u_char xx27[3];
- volatile u_char memc_errsyndrome;
- volatile u_char xx28[3];
- volatile u_char memc_defaults1;
- volatile u_char xx29[3];
- volatile u_char memc_defaults2;
- volatile u_char xx30[3];
-};
-
-#define MEMC_CHIPID 0x80
-#define MCECC_CHIPID 0x81
diff --git a/sys/arch/mvme88k/dev/memdevs.c b/sys/arch/mvme88k/dev/memdevs.c
deleted file mode 100644
index fe6eaa3aa97..00000000000
--- a/sys/arch/mvme88k/dev/memdevs.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* $OpenBSD: memdevs.c,v 1.5 2003/10/05 20:27:48 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/buf.h>
-#include <sys/systm.h>
-#include <sys/uio.h>
-#include <sys/malloc.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-
-#include <mvme88k/dev/memdevs.h>
-
-/*ARGSUSED*/
-int
-memdevrw(base, len, uio, flags)
- caddr_t base;
- int len;
- struct uio *uio;
- int flags;
-{
- vaddr_t v;
- int c;
- struct iovec *iov;
- int error = 0;
-
- while (uio->uio_resid > 0 && error == 0) {
- iov = uio->uio_iov;
- if (iov->iov_len == 0) {
- uio->uio_iov++;
- uio->uio_iovcnt--;
- if (uio->uio_iovcnt < 0)
- panic("memdevrw");
- continue;
- }
-
- v = uio->uio_offset;
- c = min(iov->iov_len, MAXPHYS);
- if (v + c > len)
- c = len - v; /* till end of dev */
- if (c == 0)
- return (0);
- error = uiomove(base + v, c, uio);
- }
- return (error);
-}
diff --git a/sys/arch/mvme88k/dev/memdevs.h b/sys/arch/mvme88k/dev/memdevs.h
deleted file mode 100644
index 92033fd59e7..00000000000
--- a/sys/arch/mvme88k/dev/memdevs.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/* $OpenBSD: memdevs.h,v 1.2 2002/03/14 01:26:39 millert Exp $ */
-
-#ifndef _MVME88K_MEMDEVS_H_
-#define _MVME88K_MEMDEVS_H_
-
-int memdevrw(caddr_t base, int len, struct uio *uio, int flags);
-
-#endif /* _MVME88K_MEMDEVS_H_ */
diff --git a/sys/arch/mvme88k/dev/nvram.c b/sys/arch/mvme88k/dev/nvram.c
deleted file mode 100644
index 41e0310cc1b..00000000000
--- a/sys/arch/mvme88k/dev/nvram.c
+++ /dev/null
@@ -1,494 +0,0 @@
-/* $OpenBSD: nvram.c,v 1.35 2013/05/18 10:21:50 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/ioctl.h>
-#include <sys/time.h>
-#include <sys/uio.h>
-
-#include <machine/autoconf.h>
-#include <machine/bugio.h>
-#include <machine/conf.h>
-#include <machine/cpu.h>
-#include <machine/mioctl.h>
-
-#include <uvm/uvm_param.h>
-
-#include <mvme88k/mvme88k/clockvar.h>
-#include <mvme88k/dev/memdevs.h>
-#include <mvme88k/dev/nvramreg.h>
-
-struct nvramsoftc {
- struct device sc_dev;
- paddr_t sc_base;
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
- bus_addr_t sc_regs;
- size_t sc_len;
-
-#ifdef MVME188
- u_int8_t *sc_nvram;
-#endif
-};
-
-void nvramattach(struct device *, struct device *, void *);
-int nvrammatch(struct device *, void *, void *);
-
-struct cfattach nvram_ca = {
- sizeof(struct nvramsoftc), nvrammatch, nvramattach
-};
-
-struct cfdriver nvram_cd = {
- NULL, "nvram", DV_DULL
-};
-
-time_t chiptotime(struct clock_ymdhms *);
-void timetochip(struct clock_ymdhms *);
-time_t nvram_inittodr(void);
-void nvram_resettodr(void);
-
-int nvram188read(struct nvramsoftc *, struct uio *, int);
-int nvram188write(struct nvramsoftc *, struct uio *, int);
-
-int
-nvrammatch(parent, vcf, args)
- struct device *parent;
- void *vcf, *args;
-{
- struct confargs *ca = args;
- bus_space_handle_t ioh;
- int rc;
-
- if (bus_space_map(ca->ca_iot, ca->ca_paddr, PAGE_SIZE, 0, &ioh) != 0)
- return (0);
- rc = badaddr((vaddr_t)bus_space_vaddr(ca->ca_iot, ioh), 1) == 0;
- bus_space_unmap(ca->ca_iot, ioh, PAGE_SIZE);
- return (rc);
-}
-
-void
-nvramattach(parent, self, args)
- struct device *parent, *self;
- void *args;
-{
- struct confargs *ca = args;
- struct nvramsoftc *sc = (struct nvramsoftc *)self;
- bus_space_handle_t ioh;
- vsize_t maplen;
-
- switch (brdtyp) {
-#ifdef MVME188
- case BRD_188:
- sc->sc_len = MK48T02_SIZE;
- maplen = sc->sc_len * 4;
- sc->sc_regs = M188_NVRAM_TOD_OFF;
- break;
-#endif
- default:
- sc->sc_len = MK48T08_SIZE;
- maplen = sc->sc_len;
- sc->sc_regs = SBC_NVRAM_TOD_OFF;
- break;
- }
-
- sc->sc_iot = ca->ca_iot;
- sc->sc_base = ca->ca_paddr;
-
- if (bus_space_map(sc->sc_iot, sc->sc_base, round_page(maplen),
- BUS_SPACE_MAP_LINEAR, &ioh) != 0) {
- printf(": can't map mem space\n");
- return;
- }
-
- sc->sc_ioh = ioh;
-
- printf(": MK48T0%lu\n", sc->sc_len / 1024);
-
- md_inittodr = nvram_inittodr;
- md_resettodr = nvram_resettodr;
-}
-
-time_t
-chiptotime(struct clock_ymdhms *c)
-{
- c->dt_sec = FROMBCD(c->dt_sec);
- c->dt_min = FROMBCD(c->dt_min);
- c->dt_hour = FROMBCD(c->dt_hour);
- c->dt_day = FROMBCD(c->dt_day);
- c->dt_mon = FROMBCD(c->dt_mon);
- c->dt_year = FROMBCD(c->dt_year) + YEAR0;
- /* XXX 2-digit year => Y2070 problem */
- if (c->dt_year < POSIX_BASE_YEAR)
- c->dt_year += 100;
-
- return clock_ymdhms_to_secs(c);
-}
-
-void
-timetochip(struct clock_ymdhms *c)
-{
- clock_secs_to_ymdhms(time_second, c);
-
- c->dt_sec = TOBCD(c->dt_sec);
- c->dt_min = TOBCD(c->dt_min);
- c->dt_hour = TOBCD(c->dt_hour);
- c->dt_day = TOBCD(c->dt_day);
- c->dt_mon = TOBCD(c->dt_mon);
- c->dt_year = TOBCD(c->dt_year % 100);
-}
-
-time_t
-nvram_inittodr()
-{
- struct nvramsoftc *sc = nvram_cd.cd_devs[0];
- struct clock_ymdhms c;
-
- switch (brdtyp) {
-#ifdef MVME188
- case BRD_188:
- bus_space_write_4(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + (CLK_CSR << 2), CLK_READ |
- bus_space_read_4(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + (CLK_CSR << 2)));
- c.dt_sec = bus_space_read_4(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + (CLK_SEC << 2)) & 0xff;
- c.dt_min = bus_space_read_4(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + (CLK_MIN << 2)) & 0xff;
- c.dt_hour = bus_space_read_4(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + (CLK_HOUR << 2)) & 0xff;
- c.dt_day = bus_space_read_4(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + (CLK_DAY << 2)) & 0xff;
- c.dt_mon = bus_space_read_4(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + (CLK_MONTH << 2)) & 0xff;
- c.dt_year = bus_space_read_4(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + (CLK_YEAR << 2)) & 0xff;
- bus_space_write_4(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + (CLK_CSR << 2),
- bus_space_read_4(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + (CLK_CSR << 2)) & ~CLK_READ);
- break;
-#endif
- default:
- bus_space_write_1(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + CLK_CSR, CLK_READ |
- bus_space_read_1(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + CLK_CSR));
- c.dt_sec = bus_space_read_1(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + CLK_SEC);
- c.dt_min = bus_space_read_1(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + CLK_MIN);
- c.dt_hour = bus_space_read_1(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + CLK_HOUR);
- c.dt_day = bus_space_read_1(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + CLK_DAY);
- c.dt_mon = bus_space_read_1(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + CLK_MONTH);
- c.dt_year = bus_space_read_1(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + CLK_YEAR);
- bus_space_write_1(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + CLK_CSR,
- bus_space_read_1(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + CLK_CSR) & ~CLK_READ);
- }
-
- return chiptotime(&c);
-}
-
-/*
- * Reset the clock based on the current time.
- * Used when the current clock is preposterous, when the time is changed,
- * and when rebooting. Do nothing if the time is not yet known, e.g.,
- * when crashing during autoconfig.
- */
-void
-nvram_resettodr()
-{
- struct nvramsoftc *sc = nvram_cd.cd_devs[0];
- struct clock_ymdhms c;
-
- timetochip(&c);
-
- switch (brdtyp) {
-#ifdef MVME188
- case BRD_188:
- bus_space_write_4(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + (CLK_CSR << 2), CLK_WRITE |
- bus_space_read_4(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + (CLK_CSR << 2)));
- bus_space_write_4(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + (CLK_SEC << 2), c.dt_sec);
- bus_space_write_4(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + (CLK_MIN << 2), c.dt_min);
- bus_space_write_4(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + (CLK_HOUR << 2), c.dt_hour);
- bus_space_write_4(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + (CLK_WDAY << 2), c.dt_wday);
- bus_space_write_4(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + (CLK_DAY << 2), c.dt_day);
- bus_space_write_4(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + (CLK_MONTH << 2), c.dt_mon);
- bus_space_write_4(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + (CLK_YEAR << 2), c.dt_year);
- bus_space_write_4(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + (CLK_CSR << 2),
- bus_space_read_4(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + (CLK_CSR << 2)) & ~CLK_WRITE);
- break;
-#endif
- default:
- bus_space_write_1(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + CLK_CSR, CLK_WRITE |
- bus_space_read_1(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + CLK_CSR));
- bus_space_write_1(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + CLK_SEC, c.dt_sec);
- bus_space_write_1(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + CLK_MIN, c.dt_min);
- bus_space_write_1(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + CLK_HOUR, c.dt_hour);
- bus_space_write_1(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + CLK_WDAY, c.dt_wday);
- bus_space_write_1(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + CLK_DAY, c.dt_day);
- bus_space_write_1(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + CLK_MONTH, c.dt_mon);
- bus_space_write_1(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + CLK_YEAR, c.dt_year);
- bus_space_write_1(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + CLK_CSR,
- bus_space_read_1(sc->sc_iot, sc->sc_ioh,
- sc->sc_regs + CLK_CSR) & ~CLK_WRITE);
- break;
- }
-}
-
-/*ARGSUSED*/
-int
-nvramopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- if (minor(dev) >= nvram_cd.cd_ndevs ||
- nvram_cd.cd_devs[minor(dev)] == NULL)
- return (ENODEV);
-
- return (0);
-}
-
-/*ARGSUSED*/
-int
-nvramclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- /*
- * On MVME188, it might be worth free()ing the NVRAM copy here.
- */
- return (0);
-}
-
-/*ARGSUSED*/
-int
-nvramioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- int unit = minor(dev);
- struct nvramsoftc *sc = (struct nvramsoftc *) nvram_cd.cd_devs[unit];
- int error = 0;
-
- switch (cmd) {
- case MIOCGSIZ:
- *(int *)data = sc->sc_len;
- break;
- default:
- error = ENOTTY;
- break;
- }
- return (error);
-}
-
-/*ARGSUSED*/
-int
-nvramread(dev_t dev, struct uio *uio, int flags)
-{
- int unit = minor(dev);
- struct nvramsoftc *sc = (struct nvramsoftc *)nvram_cd.cd_devs[unit];
-
-#ifdef MVME188
- if (brdtyp == BRD_188)
- return (nvram188read(sc, uio, flags));
-#endif
-
- return (memdevrw(bus_space_vaddr(sc->sc_iot, sc->sc_ioh),
- sc->sc_len, uio, flags));
-}
-
-/*ARGSUSED*/
-int
-nvramwrite(dev_t dev, struct uio *uio, int flags)
-{
- int unit = minor(dev);
- struct nvramsoftc *sc = (struct nvramsoftc *) nvram_cd.cd_devs[unit];
-
-#ifdef MVME188
- if (brdtyp == BRD_188)
- return (nvram188write(sc, uio, flags));
-#endif
-
- return (memdevrw(bus_space_vaddr(sc->sc_iot, sc->sc_ioh),
- sc->sc_len, uio, flags));
-}
-
-paddr_t
-nvrammmap(dev, off, prot)
- dev_t dev;
- off_t off;
- int prot;
-{
- int unit = minor(dev);
- struct nvramsoftc *sc = (struct nvramsoftc *) nvram_cd.cd_devs[unit];
-
- if (minor(dev) != 0)
- return (-1);
-
-#ifdef MVME188
- /* disallow mmap on MVME188 due to non-linear layout */
- if (brdtyp == BRD_188)
- return (-1);
-#endif
-
- /* allow access only in RAM */
- if (off < 0 || off >= round_page(sc->sc_len))
- return (-1);
- return (sc->sc_base + off);
-}
-
-#ifdef MVME188
-
-int read_nvram(struct nvramsoftc *);
-
-/*
- * Build a local copy of the NVRAM contents.
- */
-int
-read_nvram(struct nvramsoftc *sc)
-{
- size_t cnt;
- u_int8_t *dest;
- u_int32_t *src;
-
- if (sc->sc_nvram == NULL) {
- sc->sc_nvram = (u_int8_t *)malloc(sc->sc_len, M_DEVBUF,
- M_WAITOK | M_CANFAIL);
- if (sc->sc_nvram == NULL)
- return (EAGAIN);
- }
-
- dest = sc->sc_nvram;
- src = (u_int32_t *)bus_space_vaddr(sc->sc_iot, sc->sc_ioh);
- cnt = sc->sc_len;
- while (cnt-- != 0)
- *dest++ = (u_int8_t)*src++;
-
- return (0);
-}
-
-/*
- * Specific memdevrw wrappers to cope with the 188 design.
- */
-
-int
-nvram188read(struct nvramsoftc *sc, struct uio *uio, int flags)
-{
- int rc;
-
- /*
- * Get a copy of the NVRAM contents.
- */
- rc = read_nvram(sc);
- if (rc != 0)
- return (rc);
-
- /*
- * Move data from our NVRAM copy to the user.
- */
- return (memdevrw(sc->sc_nvram, sc->sc_len, uio, flags));
-}
-
-int
-nvram188write(struct nvramsoftc *sc, struct uio *uio, int flags)
-{
- size_t cnt;
- u_int8_t *src;
- u_int32_t *dest;
- int rc;
-
- /*
- * Get a copy of the NVRAM contents.
- */
- rc = read_nvram(sc);
- if (rc != 0)
- return (rc);
-
- /*
- * Move data from the user to our NVRAM copy.
- */
- rc = memdevrw(sc->sc_nvram, sc->sc_len, uio, flags);
- if (rc != 0) {
- /* reset NVRAM copy contents */
- read_nvram(sc);
- return (rc);
- }
-
- /*
- * Update the NVRAM. This could be optimized by only working on
- * the areas which have been modified by the user.
- */
- src = sc->sc_nvram;
- dest = (u_int32_t *)bus_space_vaddr(sc->sc_iot, sc->sc_ioh);
- cnt = sc->sc_len;
- while (cnt-- != 0) {
- if ((*dest & 0xff) != *src)
- *dest = (u_int32_t)*src;
- dest++;
- src++;
- }
-
- return (0);
-}
-#endif
diff --git a/sys/arch/mvme88k/dev/nvramreg.h b/sys/arch/mvme88k/dev/nvramreg.h
deleted file mode 100644
index 4816a329d05..00000000000
--- a/sys/arch/mvme88k/dev/nvramreg.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* $OpenBSD: nvramreg.h,v 1.9 2013/05/17 22:38:25 miod Exp $ */
-
-/*
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)clockreg.h 8.1 (Berkeley) 6/11/93
- */
-
-/*
- * mvme1x7 Mostek TOD clock/NVRAM
- */
-
-/*
- * Mostek MK48T08 clock.
- *
- * This chip is 8k in size.
- * The first TOD clock starts at offset 0x1FF8. The following structure
- * describes last 2K of its 8K address space. The first 6K of the NVRAM
- * space is used for various things as follows:
- * 0000-0fff User Area
- * 1000-10ff Networking Area
- * 1100-16f7 Operating System Area
- * 16f8-1ef7 ROM Debugger Area
- * 1ef8-1ff7 Configuration Area (Ethernet address etc)
- * 1ff8-1fff TOD clock
- */
-
-/*
- * On MVME188, these offsets need shifting two bits, as they are 32 bit
- * registers.
- */
-#define CLK_CSR 0 /* control register */
-#define CLK_SEC 1 /* seconds (0..59; BCD) */
-#define CLK_MIN 2 /* minutes (0..59; BCD) */
-#define CLK_HOUR 3 /* hour (0..23; BCD) */
-#define CLK_WDAY 4 /* weekday (1..7) */
-#define CLK_DAY 5 /* day in month (1..31; BCD) */
-#define CLK_MONTH 6 /* month (1..12; BCD) */
-#define CLK_YEAR 7 /* year (0..99; BCD) */
-#define CLK_NREG 8
-
-/* csr bits */
-#define CLK_WRITE 0x80 /* want to write */
-#define CLK_READ 0x40 /* want to read (freeze clock) */
-
-/*
- * Motorola chose the year `1900' as their base count. It has already
- * wrapped by now...
- */
-#define YEAR0 1900
-
-#define SBC_NVRAM_TOD_OFF 0x1ff8 /* offset of tod in NVRAM space */
-#define M188_NVRAM_TOD_OFF 0x1fe0 /* offset of tod in NVRAM space */
-#define MK48T02_SIZE 2 * 1024
-#define MK48T08_SIZE 8 * 1024
diff --git a/sys/arch/mvme88k/dev/osiop_pcctwo.c b/sys/arch/mvme88k/dev/osiop_pcctwo.c
deleted file mode 100644
index 4db82af3cab..00000000000
--- a/sys/arch/mvme88k/dev/osiop_pcctwo.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/* $OpenBSD: osiop_pcctwo.c,v 1.6 2010/11/18 21:13:19 miod Exp $ */
-/*
- * Copyright (c) 2004, Miodrag Vallat.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/disklabel.h>
-
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-
-#include <machine/bus.h>
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-
-#include <machine/bugio.h>
-#include <machine/prom.h>
-
-#include <dev/ic/osiopreg.h>
-#include <dev/ic/osiopvar.h>
-
-#include <mvme88k/dev/pcctworeg.h>
-#include <mvme88k/dev/pcctwovar.h>
-
-void osiop_pcctwo_attach(struct device *, struct device *, void *);
-int osiop_pcctwo_intr(void *);
-int osiop_pcctwo_match(struct device *, void *, void *);
-
-struct osiop_pcctwo_softc {
- struct osiop_softc sc_osiop;
- struct intrhand sc_ih;
-};
-
-struct cfattach osiop_pcctwo_ca = {
- sizeof(struct osiop_pcctwo_softc),
- osiop_pcctwo_match, osiop_pcctwo_attach
-};
-
-int
-osiop_pcctwo_match(struct device *parent, void *cf, void *aux)
-{
- struct confargs *ca = aux;
- bus_space_handle_t ioh;
- int rc;
-
- if (bus_space_map(ca->ca_iot, ca->ca_paddr, OSIOP_NREGS, 0, &ioh) != 0)
- return (0);
- rc = badaddr((vaddr_t)bus_space_vaddr(ca->ca_iot, ioh), 4);
- if (rc == 0) {
- bus_space_unmap(ca->ca_iot, ioh, OSIOP_NREGS);
- return (1);
- }
-
- /*
- * For some reason, if the SCSI hardware is not ``warmed'' by the
- * BUG (netboot or boot from external SCSI controller), badaddr()
- * will always fail, although the hardware is there.
- * Since the BUG will do the right thing, we'll defer a dummy read
- * from the controller and retry.
- */
- if (brdtyp == BRD_187 || brdtyp == BRD_8120 || brdtyp == BRD_197) {
- struct mvmeprom_dskio dio;
- char buf[MVMEPROM_BLOCK_SIZE];
-
-#ifdef DEBUG
- printf("osiop_pcctwo_match: trying to warm up controller\n");
-#endif
- bzero(&dio, sizeof dio);
- dio.pbuffer = buf;
- dio.blk_cnt = 1;
- bugdiskrd(&dio);
-
- rc = badaddr((vaddr_t)bus_space_vaddr(ca->ca_iot, ioh), 4);
- }
-
- bus_space_unmap(ca->ca_iot, ioh, OSIOP_NREGS);
- return (rc == 0);
-}
-
-void
-osiop_pcctwo_attach(struct device *parent, struct device *self, void *aux)
-{
- struct pcctwosoftc *pcctwo = (struct pcctwosoftc *)parent;
- struct osiop_softc *sc = (struct osiop_softc *)self;
- struct osiop_pcctwo_softc *psc = (struct osiop_pcctwo_softc *)self;
- struct confargs *ca = aux;
- int tmp;
- extern int cpuspeed;
-
- sc->sc_bst = ca->ca_iot;
- sc->sc_dmat = ca->ca_dmat;
-
- if (bus_space_map(sc->sc_bst, ca->ca_paddr, OSIOP_NREGS, 0,
- &sc->sc_reg) != 0) {
- printf(": couldn't map I/O ports\n");
- return;
- }
-
- switch (brdtyp) {
-#ifdef MVME197
- case BRD_197:
- sc->sc_clock_freq = cpuspeed;
- break;
-#endif
-#ifdef MVME187
- case BRD_187:
- case BRD_8120:
- sc->sc_clock_freq = cpuspeed * 2;
- break;
-#endif
- default:
- sc->sc_clock_freq = 50; /* wild guess */
- break;
- }
-
- sc->sc_dcntl = OSIOP_DCNTL_EA;
- sc->sc_ctest7 = OSIOP_CTEST7_TT1; /* no snooping */
- sc->sc_dmode = OSIOP_DMODE_BL4; /* burst length = 4 */
- sc->sc_flags = 0;
- sc->sc_id = 7; /* XXX should read from CNFG block in nvram */
-
- tmp = bootpart;
- if (ca->ca_paddr != bootaddr)
- bootpart = -1; /* never match */
-
- osiop_attach(sc);
-
- bootpart = tmp;
-
- psc->sc_ih.ih_fn = osiop_pcctwo_intr;
- psc->sc_ih.ih_arg = sc;
- psc->sc_ih.ih_wantframe = 0;
- psc->sc_ih.ih_ipl = ca->ca_ipl;
-
- /* enable device interrupts */
- pcctwointr_establish(PCC2V_SCSI, &psc->sc_ih, self->dv_xname);
- bus_space_write_1(pcctwo->sc_iot, pcctwo->sc_ioh,
- PCCTWO_SCSIICR, PCC2_IRQ_IEN | (ca->ca_ipl & PCC2_IRQ_IPL));
-}
-
-int
-osiop_pcctwo_intr(void *arg)
-{
- struct osiop_softc *sc = arg;
- u_int8_t istat;
-
- if (sc->sc_flags & OSIOP_INTSOFF)
- return 0;
-
- istat = osiop_read_1(sc, OSIOP_ISTAT);
- if ((istat & (OSIOP_ISTAT_SIP | OSIOP_ISTAT_DIP)) == 0)
- return 0;
-
- /*
- * 53c710 manual recommends reading dstat and sstat0 at least
- * 12 clk cycles apart if reading as bytes (which is what
- * pcc2 permits). Stick in a 1us delay between accessing dstat and
- * sstat0 below.
- *
- * save interrupt status, DMA status, and SCSI status 0
- * (may need to deal with stacked interrupts?)
- */
- sc->sc_istat = istat;
- sc->sc_sstat0 = osiop_read_1(sc, OSIOP_SSTAT0);
- DELAY(25);
- sc->sc_dstat = osiop_read_1(sc, OSIOP_DSTAT);
-
- osiop_intr(sc);
-
- return 1;
-}
diff --git a/sys/arch/mvme88k/dev/pcctwo.c b/sys/arch/mvme88k/dev/pcctwo.c
deleted file mode 100644
index 799c24e18fe..00000000000
--- a/sys/arch/mvme88k/dev/pcctwo.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/* $OpenBSD: pcctwo.c,v 1.30 2010/06/26 23:24:43 guenther Exp $ */
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * VME1x7 PCC2 chip
- */
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-#include <sys/uio.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/syslog.h>
-#include <sys/fcntl.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/cpu.h>
-
-#include <dev/cons.h>
-
-#include <mvme88k/dev/pcctworeg.h>
-#include <mvme88k/dev/pcctwovar.h>
-
-#include "bussw.h"
-
-void pcctwoattach(struct device *, struct device *, void *);
-int pcctwomatch(struct device *, void *, void *);
-
-struct cfattach pcctwo_ca = {
- sizeof(struct pcctwosoftc), pcctwomatch, pcctwoattach
-};
-
-struct cfdriver pcctwo_cd = {
- NULL, "pcctwo", DV_DULL
-};
-
-int pcctwo_print(void *args, const char *bus);
-int pcctwo_scan(struct device *parent, void *child, void *args);
-
-int
-pcctwomatch(parent, vcf, args)
- struct device *parent;
- void *vcf, *args;
-{
- struct confargs *ca = args;
- bus_space_handle_t ioh;
- int rc;
- u_int8_t chipid;
-
- /* Bomb if wrong cpu */
- switch (brdtyp) {
- case BRD_187:
- case BRD_8120:
- case BRD_197:
- break;
- default:
- return 0;
- }
-
- if (bus_space_map(ca->ca_iot, PCC2_BASE, PCC2_SIZE,
- 0, &ioh) != 0)
- return 0;
- rc = badaddr((vaddr_t)bus_space_vaddr(ca->ca_iot, ioh), 4);
- if (rc == 0) {
- chipid = bus_space_read_1(ca->ca_iot, ioh, PCCTWO_CHIPID);
- if (chipid != PCC2_ID) {
-#ifdef DEBUG
- printf("==> pcctwo: wrong chip id %x.\n", chipid);
- rc = -1;
-#endif
- }
- }
- bus_space_unmap(ca->ca_iot, ioh, PCC2_SIZE);
-
- return rc == 0;
-}
-
-void
-pcctwoattach(parent, self, args)
- struct device *parent, *self;
- void *args;
-{
- struct confargs *ca = args;
- struct pcctwosoftc *sc = (struct pcctwosoftc *)self;
- bus_space_handle_t ioh;
- u_int8_t genctl;
-
- sc->sc_base = PCC2_BASE;
-
- if (bus_space_map(ca->ca_iot, sc->sc_base, PCC2_SIZE, 0, &ioh) != 0) {
- printf(": can't map registers!\n");
- return;
- }
-
- sc->sc_iot = ca->ca_iot;
- sc->sc_ioh = ioh;
-
- bus_space_write_1(sc->sc_iot, ioh, PCCTWO_VECBASE, PCC2_VECBASE);
- genctl = bus_space_read_1(sc->sc_iot, ioh, PCCTWO_GENCTL);
-#if NBUSSW > 0
- if (ca->ca_bustype == BUS_BUSSWITCH) {
- /* Make sure the bus is mc68040 compatible */
- genctl |= PCC2_GENCTL_C040;
- }
-#endif
- genctl |= PCC2_GENCTL_IEN; /* global irq enable */
- bus_space_write_1(sc->sc_iot, ioh, PCCTWO_GENCTL, genctl);
-
- printf(": rev %d\n",
- bus_space_read_1(sc->sc_iot, ioh, PCCTWO_CHIPREV));
-
- config_search(pcctwo_scan, self, args);
-}
-
-int
-pcctwo_print(args, bus)
- void *args;
- const char *bus;
-{
- struct confargs *ca = args;
-
- if (ca->ca_offset != -1)
- printf(" offset 0x%x", ca->ca_offset);
- if (ca->ca_ipl > 0)
- printf(" ipl %d", ca->ca_ipl);
- return (UNCONF);
-}
-
-int
-pcctwo_scan(parent, child, args)
- struct device *parent;
- void *child, *args;
-{
- struct cfdata *cf = child;
- struct confargs oca, *ca = args;
-
- bzero(&oca, sizeof oca);
- oca.ca_iot = ca->ca_iot;
- oca.ca_dmat = ca->ca_dmat;
- oca.ca_offset = cf->cf_loc[0];
- oca.ca_ipl = cf->cf_loc[1];
- if (oca.ca_offset != -1) {
- /* offset locator for pcctwo children is relative to segment */
- oca.ca_paddr = ca->ca_paddr + oca.ca_offset;
- } else {
- oca.ca_paddr = -1;
- }
- oca.ca_bustype = BUS_PCCTWO;
- oca.ca_name = cf->cf_driver->cd_name;
- if ((*cf->cf_attach->ca_match)(parent, cf, &oca) == 0)
- return (0);
- config_attach(parent, cf, &oca, pcctwo_print);
- return (1);
-}
-
-/*
- * PCC2 interrupts land in a PCC2_NVEC sized hole starting at PCC2_VECBASE
- */
-int
-pcctwointr_establish(int vec, struct intrhand *ih, const char *name)
-{
-#ifdef DIAGNOSTIC
- if (vec < 0 || vec >= PCC2_NVEC)
- panic("pcctwo_establish: illegal vector 0x%x", vec);
-#endif
-
- return intr_establish(PCC2_VECBASE + vec, ih, name);
-}
diff --git a/sys/arch/mvme88k/dev/pcctworeg.h b/sys/arch/mvme88k/dev/pcctworeg.h
deleted file mode 100644
index 85327ec54db..00000000000
--- a/sys/arch/mvme88k/dev/pcctworeg.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/* $OpenBSD: pcctworeg.h,v 1.9 2009/03/04 19:35:52 miod Exp $ */
-
-/*
- * Memory map for PCC2 chip found in MVME1x7 boards.
- *
- * PCCchip2 control and status register can be accessed as bytes (8 bits),
- * two-bytes (16 bits), or four-bytes (32 bits).
- */
-
-#define PCC2_BASE 0xfff42000
-#define PCC2_SIZE 0x0040
-
-#define PCCTWO_CHIPID 0x0000
-#define PCCTWO_CHIPREV 0x0001
-#define PCCTWO_GENCTL 0x0002
-#define PCCTWO_VECBASE 0x0003
-#define PCCTWO_T1CMP 0x0004
-#define PCCTWO_T1COUNT 0x0008
-#define PCCTWO_T2CMP 0x000c
-#define PCCTWO_T2COUNT 0x0010
-#define PCCTWO_PSCALECNT 0x0014
-#define PCCTWO_PSCALEADJ 0x0015
-#define PCCTWO_T2CTL 0x0016
-#define PCCTWO_T1CTL 0x0017
-#define PCCTWO_GPIO_ICR 0x0018
-#define PCCTWO_GPIO_PCR 0x0019
-#define PCCTWO_T2ICR 0x001a
-#define PCCTWO_T1ICR 0x001b
-#define PCCTWO_SCCERR 0x001c
-#define PCCTWO_SCCICR 0x001d
-#define PCCTWO_SCCTX 0x001e
-#define PCCTWO_SCCRX 0x001f
-#define PCCTWO_SCCMOIACK 0x0023
-#define PCCTWO_SCCTXIACK 0x0025
-#define PCCTWO_SCCRXIACK 0x0027
-#define PCCTWO_IEERR 0x0028
-#define PCCTWO_IEICR 0x002a
-#define PCCTWO_IEBERR 0x002b
-#define PCCTWO_SCSIERR 0x002c
-#define PCCTWO_SCSIICR 0x002f
-#define PCCTWO_PRTICR 0x0030
-#define PCCTWO_PTRFICR 0x0031
-#define PCCTWO_PTRSICR 0x0032
-#define PCCTWO_PTRPICR 0x0033
-#define PCCTWO_PRTBICR 0x0034
-#define PCCTWO_PRTSTATUS 0x0036
-#define PCCTWO_PRTCTL 0x0037
-#define PCCTWO_SPEED 0x0038
-#define PCCTWO_PRTDATA 0x003a
-/* The following registers are not valid on MVME197 */
-#define PCCTWO_IPL 0x003e
-#define PCCTWO_MASK 0x003f
-
-#define PCC2_ID 0x20 /* value at CHIPID */
-
-/* General Control Register */
-#define PCC2_DR0 0x80
-#define PCC2_C040 0x04
-#define PCC2_MIEN 0x02
-#define PCC2_FAST 0x01
-
-/* Top 4 bits of the PCC2 VBR. Will be the top 4 bits of the vector */
-#define PCC2_VECT 0x50
-
-/* Bottom 4 bits of the vector returned during IACK cycle */
-#define PCC2V_PPBUSY 0x00 /* lowest */
-#define PCC2V_PPPE 0x01
-#define PCC2V_PPSELECT 0x02
-#define PCC2V_PPFAULT 0x03
-#define PCC2V_PPACK 0x04
-#define PCC2V_SCSI 0x05
-#define PCC2V_IEFAIL 0x06
-#define PCC2V_IE 0x07
-#define PCC2V_TIMER2 0x08
-#define PCC2V_TIMER1 0x09
-#define PCC2V_GPIO 0x0a
-#define PCC2V_SCC_RXE 0x0c
-#define PCC2V_SCC_M (PCC2V_SCC_RXE + 1)
-#define PCC2V_SCC_TX (PCC2V_SCC_M + 1)
-#define PCC2V_SCC_RX (PCC2V_SCC_TX + 1)
-
-/*
- * Vaddrs for interrupt mask and pri registers
- */
-extern u_int8_t *volatile pcc2intr_mask;
-extern u_int8_t *volatile pcc2intr_ipl;
-
-/*
- * We lock off our interrupt vector at 0x50.
- */
-#define PCC2_VECBASE 0x50
-#define PCC2_NVEC 0x10
-
-#define PCC2_TCTL_CEN 0x01
-#define PCC2_TCTL_COC 0x02
-#define PCC2_TCTL_COVF 0x04
-#define PCC2_TCTL_OVF 0xf0
-#define PCC2_TCTL_OVF_SHIFT 4
-
-#define PCC2_GPIO_PLTY 0x80
-#define PCC2_GPIO_EL 0x40
-
-#define PCC2_GPIOCR_OE 0x2
-#define PCC2_GPIOCR_O 0x1
-
-#define PCC2_SCC_AVEC 0x08
-
-#define PCC2_SC_INHIBIT (0 << 6)
-#define PCC2_SC_SNOOP (1 << 6)
-#define PCC2_SC_INVAL (2 << 6)
-#define PCC2_SC_RESV (3 << 6)
-
-#define pcc2_timer_us2lim(us) (us) /* timer increments in "us" */
-
-#define PCC2_IRQ_IPL 0x07
-#define PCC2_IRQ_ICLR 0x08
-#define PCC2_IRQ_IEN 0x10
-#define PCC2_IRQ_INT 0x20
-
-/* Tick Timer Interrupt Control Register */
-#define PCC2_TTIRQ_INT 0x20
-#define PCC2_TTIRQ_IEN 0x10
-#define PCC2_TTIRQ_ICLR 0x08
-#define PCC2_TTIRQ_IL 0x07 /* mask for IL2-IL0 */
-
-#define PCC2_IEERR_SCLR 0x01
-
-#define PCC2_GENCTL_FAST 0x01
-#define PCC2_GENCTL_IEN 0x02
-#define PCC2_GENCTL_C040 0x03
diff --git a/sys/arch/mvme88k/dev/pcctwovar.h b/sys/arch/mvme88k/dev/pcctwovar.h
deleted file mode 100644
index 70e4a38f17e..00000000000
--- a/sys/arch/mvme88k/dev/pcctwovar.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* $OpenBSD: pcctwovar.h,v 1.2 2004/07/30 19:02:06 miod Exp $ */
-/*
- * Copyright (c) 2004, Miodrag Vallat.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MVME88K_PCCTWOVAR_H_
-#define _MVME88K_PCCTWOVAR_H_
-
-struct pcctwosoftc {
- struct device sc_dev;
-
- paddr_t sc_base;
-
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
-};
-
-int pcctwointr_establish(int, struct intrhand *, const char *);
-
-#endif /* _MVME88K_PCCTWOVAR_H_ */
diff --git a/sys/arch/mvme88k/dev/sram.c b/sys/arch/mvme88k/dev/sram.c
deleted file mode 100644
index 9db441b15bb..00000000000
--- a/sys/arch/mvme88k/dev/sram.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/* $OpenBSD: sram.c,v 1.21 2010/12/26 15:40:59 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/ioctl.h>
-#include <sys/buf.h>
-#include <sys/systm.h>
-#include <sys/uio.h>
-#include <sys/malloc.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/conf.h>
-#include <machine/cpu.h>
-#include <machine/mioctl.h>
-
-#include <mvme88k/dev/memdevs.h>
-
-#include <uvm/uvm_extern.h>
-
-struct sramsoftc {
- struct device sc_dev;
- paddr_t sc_base;
- size_t sc_len;
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
-};
-
-void sramattach(struct device *, struct device *, void *);
-int srammatch(struct device *, void *, void *);
-
-struct cfattach sram_ca = {
- sizeof(struct sramsoftc), srammatch, sramattach
-};
-
-struct cfdriver sram_cd = {
- NULL, "sram", DV_DULL
-};
-
-int
-srammatch(parent, vcf, args)
- struct device *parent;
- void *vcf, *args;
-{
- if (brdtyp != BRD_187 && brdtyp != BRD_8120) /* The only ones... */
- return (0);
-
- return (1);
-}
-
-void
-sramattach(parent, self, args)
- struct device *parent, *self;
- void *args;
-{
- struct confargs *ca = args;
- struct sramsoftc *sc = (struct sramsoftc *)self;
- bus_space_handle_t ioh;
-
- sc->sc_iot = ca->ca_iot;
- sc->sc_base = ca->ca_paddr;
- sc->sc_len = 128 * 1024; /* always 128K */
-
- if (bus_space_map(sc->sc_iot, sc->sc_base, sc->sc_len,
- BUS_SPACE_MAP_LINEAR, &ioh) != 0) {
- printf(": can't map mem space\n");
- return;
- }
-
- sc->sc_ioh = ioh;
-
- printf(": %dKB\n", sc->sc_len / 1024);
-}
-
-/*ARGSUSED*/
-int
-sramopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- if (minor(dev) >= sram_cd.cd_ndevs ||
- sram_cd.cd_devs[minor(dev)] == NULL)
- return (ENODEV);
- return (0);
-}
-
-/*ARGSUSED*/
-int
-sramclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
-
- return (0);
-}
-
-/*ARGSUSED*/
-int
-sramioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- int unit = minor(dev);
- struct sramsoftc *sc = (struct sramsoftc *) sram_cd.cd_devs[unit];
- int error = 0;
-
- switch (cmd) {
- case MIOCGSIZ:
- *(int *)data = sc->sc_len;
- break;
- default:
- error = ENOTTY;
- break;
- }
- return (error);
-}
-
-/*ARGSUSED*/
-int
-sramrw(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- int unit = minor(dev);
- struct sramsoftc *sc = (struct sramsoftc *) sram_cd.cd_devs[unit];
-
- return memdevrw(bus_space_vaddr(sc->sc_iot, sc->sc_ioh),
- sc->sc_len, uio, flags);
-}
-
-paddr_t
-srammmap(dev, off, prot)
- dev_t dev;
- off_t off;
- int prot;
-{
- int unit = minor(dev);
- struct sramsoftc *sc = (struct sramsoftc *) sram_cd.cd_devs[unit];
-
- if (minor(dev) != 0)
- return (-1);
-
- /* allow access only in RAM */
- if (off < 0 || off >= round_page(sc->sc_len))
- return (-1);
- return (sc->sc_base + off);
-}
diff --git a/sys/arch/mvme88k/dev/syscon.c b/sys/arch/mvme88k/dev/syscon.c
deleted file mode 100644
index 27ace053c6b..00000000000
--- a/sys/arch/mvme88k/dev/syscon.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/* $OpenBSD: syscon.c,v 1.31 2013/09/26 19:02:07 miod Exp $ */
-/*
- * Copyright (c) 1999 Steve Murphree, Jr.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * VME188 SYSCON
- */
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/board.h>
-#include <machine/cpu.h>
-
-#include <machine/mvme188.h>
-
-struct sysconsoftc {
- struct device sc_dev;
-
- struct intrhand sc_abih; /* `abort' switch */
- struct intrhand sc_acih; /* `ac fail' */
- struct intrhand sc_sfih; /* `sys fail' */
-};
-
-void sysconattach(struct device *, struct device *, void *);
-int sysconmatch(struct device *, void *, void *);
-
-int syscon_print(void *, const char *);
-int syscon_scan(struct device *, void *, void *);
-int sysconabort(void *);
-int sysconacfail(void *);
-int sysconsysfail(void *);
-
-struct cfattach syscon_ca = {
- sizeof(struct sysconsoftc), sysconmatch, sysconattach
-};
-
-struct cfdriver syscon_cd = {
- NULL, "syscon", DV_DULL
-};
-
-int
-sysconmatch(struct device *parent, void *cf, void *args)
-{
- /* Don't match if wrong cpu */
- if (brdtyp != BRD_188)
- return (0);
-
- return (syscon_cd.cd_ndevs == 0);
-}
-
-void
-sysconattach(struct device *parent, struct device *self, void *args)
-{
- struct sysconsoftc *sc = (struct sysconsoftc *)self;
-
- printf("\n");
-
- /*
- * Clear SYSFAIL if lit.
- */
- *(volatile u_int32_t *)MVME188_UCSR |= UCSR_DRVSFBIT;
- *(volatile u_int32_t *)MVME188_CLRINT = ISTATE_SYSFAIL;
-
- sc->sc_abih.ih_fn = sysconabort;
- sc->sc_abih.ih_arg = 0;
- sc->sc_abih.ih_wantframe = 1;
- sc->sc_abih.ih_ipl = IPL_ABORT;
-
- sc->sc_acih.ih_fn = sysconacfail;
- sc->sc_acih.ih_arg = 0;
- sc->sc_acih.ih_wantframe = 1;
- sc->sc_acih.ih_ipl = IPL_ABORT;
-
- sc->sc_sfih.ih_fn = sysconsysfail;
- sc->sc_sfih.ih_arg = 0;
- sc->sc_sfih.ih_wantframe = 1;
- sc->sc_sfih.ih_ipl = IPL_ABORT;
-
- platform->intsrc_establish(INTSRC_ABORT, &sc->sc_abih, "abort");
- platform->intsrc_establish(INTSRC_ACFAIL, &sc->sc_acih, "acfail");
- platform->intsrc_establish(INTSRC_SYSFAIL, &sc->sc_sfih, "sysfail");
-
- config_search(syscon_scan, self, args);
-}
-
-int
-syscon_scan(struct device *parent, void *child, void *args)
-{
- struct cfdata *cf = child;
- struct confargs oca, *ca = args;
-
- bzero(&oca, sizeof oca);
- oca.ca_iot = ca->ca_iot;
- oca.ca_dmat = ca->ca_dmat;
- oca.ca_offset = cf->cf_loc[0];
- oca.ca_ipl = cf->cf_loc[1];
- if (oca.ca_offset != -1)
- oca.ca_paddr = ca->ca_paddr + oca.ca_offset;
- else
- oca.ca_paddr = -1;
- oca.ca_bustype = BUS_SYSCON;
- oca.ca_name = cf->cf_driver->cd_name;
-
- if ((*cf->cf_attach->ca_match)(parent, cf, &oca) == 0)
- return (0);
-
- config_attach(parent, cf, &oca, syscon_print);
- return (1);
-}
-
-int
-syscon_print(void *args, const char *bus)
-{
- struct confargs *ca = args;
-
- if (ca->ca_offset != -1)
- printf(" offset 0x%x", ca->ca_offset);
- if (ca->ca_ipl > 0)
- printf(" ipl %d", ca->ca_ipl);
- return (UNCONF);
-}
-
-int
-sysconabort(void *eframe)
-{
- *(volatile u_int32_t *)MVME188_CLRINT = ISTATE_ABORT;
- nmihand(eframe);
- return (1);
-}
-
-int
-sysconsysfail(void *eframe)
-{
- *(volatile u_int32_t *)MVME188_CLRINT = ISTATE_SYSFAIL;
- printf("WARNING: SYSFAIL* ASSERTED\n");
- return (1);
-}
-
-int
-sysconacfail(void *eframe)
-{
- *(volatile u_int32_t *)MVME188_CLRINT = ISTATE_ACFAIL;
- printf("WARNING: ACFAIL* ASSERTED\n");
- return (1);
-}
diff --git a/sys/arch/mvme88k/dev/vme.c b/sys/arch/mvme88k/dev/vme.c
deleted file mode 100644
index a306b57fd73..00000000000
--- a/sys/arch/mvme88k/dev/vme.c
+++ /dev/null
@@ -1,426 +0,0 @@
-/* $OpenBSD: vme.c,v 1.52 2013/05/17 22:46:27 miod Exp $ */
-/*
- * Copyright (c) 2004, Miodrag Vallat.
- * Copyright (c) 1999 Steve Murphree, Jr.
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/uio.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-
-#include <machine/autoconf.h>
-#include <machine/board.h>
-#include <machine/cpu.h>
-
-#include <mvme88k/dev/vme.h>
-
-int vmematch(struct device *, void *, void *);
-void vmeattach(struct device *, struct device *, void *);
-
-u_long vme2chip_map(u_long, int);
-int vmeprint(void *, const char *);
-
-int vmebustype;
-unsigned int vmevecbase;
-
-const struct cfattach vme_ca = {
- sizeof(struct device), vmematch, vmeattach
-};
-
-struct cfdriver vme_cd = {
- NULL, "vme", DV_DULL
-};
-
-/*
- * bus_space routines for VME mappings
- */
-
-int vme_map(bus_addr_t, bus_size_t, int, bus_space_handle_t *);
-void vme_unmap(bus_space_handle_t, bus_size_t);
-int vme_subregion(bus_space_handle_t, bus_size_t, bus_size_t,
- bus_space_handle_t *);
-void * vme_vaddr(bus_space_handle_t);
-
-const struct mvme88k_bus_space_tag vme_bustag = {
- vme_map,
- vme_unmap,
- vme_subregion,
- vme_vaddr
-};
-
-/*
- * VME space mapping functions
- */
-
-int
-vme_map(bus_addr_t addr, bus_size_t size, int flags, bus_space_handle_t *ret)
-{
- vaddr_t map;
-
- map = (vaddr_t)mapiodev((paddr_t)addr, size);
- if (map == 0)
- return ENOMEM;
-
- *ret = (bus_space_handle_t)map;
- return 0;
-}
-
-void
-vme_unmap(bus_space_handle_t handle, bus_size_t size)
-{
- unmapiodev((vaddr_t)handle, size);
-}
-
-int
-vme_subregion(bus_space_handle_t handle, bus_addr_t offset, bus_size_t size,
- bus_space_handle_t *ret)
-{
- *ret = handle + offset;
- return (0);
-}
-
-void *
-vme_vaddr(bus_space_handle_t handle)
-{
- return (void *)handle;
-}
-
-/*
- * Extra D16 access functions
- *
- * D16 cards will trigger bus errors on attempting to read or write more
- * than 16 bits on the bus. Given how the m88k processor works, this means
- * basically that all long (D32) accesses must be carefully taken care of.
- *
- * Since the kernels bcopy() and bzero() routines will use 32 bit accesses
- * for performance, here are specific D16-compatible routines. They will
- * also revert to D8 operations if neither of the operands is properly
- * aligned.
- */
-
-void d16_bcopy(const void *, void *, size_t);
-void d16_bzero(void *, size_t);
-
-void
-d16_bcopy(const void *src, void *dst, size_t len)
-{
- if ((vaddr_t)src & 1 || (vaddr_t)dst & 1)
- bus_space_write_region_1(&vme_bustag, 0, (vaddr_t)dst,
- (void *)src, len);
- else {
- bus_space_write_region_2(&vme_bustag, 0, (vaddr_t)dst,
- (void *)src, len / 2);
- if (len & 1)
- bus_space_write_1(&vme_bustag, 0,
- dst + len - 1, *(u_int8_t *)(src + len - 1));
- }
-}
-
-void
-d16_bzero(void *dst, size_t len)
-{
- if ((vaddr_t)dst & 1)
- bus_space_set_region_1(&vme_bustag, 0, (vaddr_t)dst, 0, len);
- else {
- bus_space_set_region_2(&vme_bustag, 0, (vaddr_t)dst, 0, len / 2);
- if (len & 1)
- bus_space_write_1(&vme_bustag, 0, dst + len - 1, 0);
- }
-}
-
-/*
- * Configuration glue
- */
-
-int
-vmematch(struct device *parent, void *cf, void *args)
-{
-#ifdef MVME187
- if (brdtyp == BRD_8120)
- return 0;
-#endif
- return 1;
-}
-
-int
-vmeprint(void *args, const char *bus)
-{
- struct confargs *ca = args;
-
- printf(" addr 0x%x", ca->ca_paddr);
- if (ca->ca_ipl > 0)
- printf(" ipl %d", ca->ca_ipl);
- if (ca->ca_vec >= 0)
- printf(" vec 0x%x", ca->ca_vec);
- return UNCONF;
-}
-
-int
-vmescan(struct device *parent, void *child, void *args, int bustype)
-{
- struct cfdata *cf = child;
- struct confargs oca, *ca = args;
-
- bzero(&oca, sizeof oca);
- oca.ca_iot = &vme_bustag;
- oca.ca_dmat = ca->ca_dmat;
- oca.ca_bustype = bustype;
- oca.ca_paddr = cf->cf_loc[0];
- oca.ca_vec = cf->cf_loc[1];
- oca.ca_ipl = cf->cf_loc[2];
- if (oca.ca_ipl > 0 && oca.ca_vec < 0)
- oca.ca_vec = vme_findvec(-1);
- oca.ca_name = cf->cf_driver->cd_name;
-
- if ((*cf->cf_attach->ca_match)(parent, cf, &oca) == 0)
- return 0;
-
- config_attach(parent, cf, &oca, vmeprint);
- return 1;
-}
-
-void
-vmeattach(struct device *parent, struct device *self, void *args)
-{
- struct confargs *ca = args;
-
- if (platform->is_syscon())
- printf(": system controller");
- printf("\n");
-
- vmevecbase = platform->init_vme(self->dv_xname);
- vmebustype = ca->ca_bustype;
-
- while (config_found(self, args, NULL))
- ;
-}
-
-/* find a VME vector based on what is in NVRAM settings. */
-int
-vme_findvec(int skip)
-{
- return intr_findvec(vmevecbase, 0xff, skip);
-}
-
-/*
- * make local addresses 1G-2G correspond to VME addresses 3G-4G,
- * as D32
- */
-#define VME2_D32STARTPHYS (1*1024*1024*1024UL)
-#define VME2_D32ENDPHYS (2*1024*1024*1024UL)
-#define VME2_D32STARTVME (3*1024*1024*1024UL)
-#define VME2_D32BITSVME (3*1024*1024*1024UL)
-
-/*
- * make local addresses 3G-3.75G correspond to VME addresses 3G-3.75G,
- * as D16
- */
-#define VME2_D16STARTPHYS (3*1024*1024*1024UL)
-#define VME2_D16ENDPHYS (3*1024*1024*1024UL + 768*1024*1024UL)
-#define VME2_A32D16STARTPHYS (0xff000000UL)
-#define VME2_A32D16ENDPHYS (0xff7fffffUL)
-
-/*
- * Returns a physical address mapping for a VME address & length.
- * Note: on some hardware it is not possible to create certain
- * mappings, ie. the MVME147 cannot do 32 bit accesses to VME bus
- * addresses from 0 to physmem.
- */
-paddr_t
-vmepmap(struct device *sc, off_t vmeaddr, int bustype)
-{
- u_int32_t base = (u_int32_t)vmeaddr; /* wrap around 4GB */
-
- switch (bustype) {
- case BUS_VMES: /* D16 VME Transfers */
-#ifdef DEBUG
- printf("base 0x%8llx/0x%8x\n", vmeaddr, base);
-#endif
- base = vme2chip_map(base, 16);
-#ifdef DEBUG
- if (base == 0)
- printf("%s: cannot map pa 0x%x\n", sc->dv_xname, base);
-#endif
- break;
- case BUS_VMEL: /* D32 VME Transfers */
-#ifdef DEBUG
- printf("base 0x%8llx/0x%8x\n", vmeaddr, base);
-#endif
- base = vme2chip_map(base, 32);
-#ifdef DEBUG
- if (base == 0)
- printf("%s: cannot map pa 0x%x\n", sc->dv_xname, base);
-#endif
- break;
- }
-
- return base;
-}
-
-static vaddr_t vmemap(struct device *, off_t);
-static void vmeunmap(paddr_t);
-
-/* if successful, returns the va of a vme bus mapping */
-static __inline__ vaddr_t
-vmemap(struct device *sc, off_t vmeaddr)
-{
- paddr_t pa;
-
- pa = vmepmap(sc, vmeaddr, BUS_VMES);
- if (pa == 0)
- return (0);
- return mapiodev(pa, PAGE_SIZE);
-}
-
-static __inline__ void
-vmeunmap(vaddr_t va)
-{
- unmapiodev(va, PAGE_SIZE);
-}
-
-int
-vmerw(struct device *sc, struct uio *uio, int flags, int bus)
-{
- vaddr_t v;
- size_t c;
- struct iovec *iov;
- paddr_t vme;
- int error = 0;
-
- while (uio->uio_resid > 0 && error == 0) {
- iov = uio->uio_iov;
- if (iov->iov_len == 0) {
- uio->uio_iov++;
- uio->uio_iovcnt--;
- if (uio->uio_iovcnt < 0)
- panic("vmerw");
- continue;
- }
-
- v = uio->uio_offset;
- c = ulmin(iov->iov_len, MAXPHYS);
- if ((v & PGOFSET) + c > PAGE_SIZE) /* max 1 page at a time */
- c = PAGE_SIZE - (v & PGOFSET);
- if (c == 0)
- return 0;
- vme = vmemap(sc, v & ~PGOFSET);
- if (vme == 0)
- return EACCES;
- error = uiomove((void *)vme + (v & PGOFSET), c, uio);
- vmeunmap(vme);
- }
- return error;
-}
-
-/*
- * Currently registered VME interrupt vectors for a given IPL, if they
- * are unique. Used to help the MVME181 and MVME188 interrupt handler when
- * they fail to complete the VME interrupt acknowledge cycle to get the
- * interrupt vector number.
- */
-u_int vmevec_hints[NIPLS] = {
- (u_int)-1, (u_int)-1, (u_int)-1, (u_int)-1,
- (u_int)-1, (u_int)-1, (u_int)-1, (u_int)-1
-};
-
-/*
- * On the VMEbus, only one cpu may be configured to respond to any
- * particular vme ipl. Therefore, it wouldn't make sense to globally
- * enable all the interrupts all the time -- it would not be possible
- * to put two cpu's and one vme card into a single cage. Rather, we
- * enable each vme interrupt only when we are attaching a device that
- * uses it. This makes it easier (though not trivial) to put two cpu
- * cards in one VME cage, and both can have some limited access to vme
- * interrupts (just can't share the same irq).
- * Obviously no check is made to see if another cpu is using that
- * interrupt. If you share you will lose.
- */
-
-int
-vmeintr_establish(int vec, struct intrhand *ih, const char *name)
-{
- int rc;
-
-#ifdef DIAGNOSTIC
- if (ih->ih_ipl < 1 || ih->ih_ipl > 7)
- return EINVAL;
-#endif
-
- if (platform->intsrc_available(INTSRC_VME, ih->ih_ipl) != 0)
- return EINVAL;
-
- if ((rc = intr_establish(vec, ih, name)) != 0)
- return rc;
-
- if (vmevec_hints[ih->ih_ipl] == (u_int)-1)
- vmevec_hints[ih->ih_ipl] = vec;
- else
- vmevec_hints[ih->ih_ipl] = (u_int)-1;
-
- /*
- * Enable VME interrupt source for this level, if necessary.
- */
- platform->intsrc_enable(INTSRC_VME, ih->ih_ipl);
-
- return 0;
-}
-
-/*
- * A32 accesses on the MVME1[6789]x require setting up mappings in
- * the VME2 chip.
- * XXX VME address must be between 2G and 4G
- * XXX We only support D32 at the moment..
- * XXX smurph - This is bogus, get rid of it! Should check vme/syscon for offsets.
- */
-u_long
-vme2chip_map(base, dwidth)
- u_long base;
- int dwidth;
-{
- /*
- * Since we are checking range for one page only, no need to check
- * for address wraparound.
- */
- switch (dwidth) {
- case 16:
- if (base < VME2_D16STARTPHYS ||
- base + PAGE_SIZE > VME2_D16ENDPHYS)
- return 0;
- break;
- case 32:
- if (base < VME2_D32STARTPHYS ||
- base + PAGE_SIZE > VME2_D32ENDPHYS)
- return 0;
- break;
- default:
- return 0;
- }
- return base;
-}
diff --git a/sys/arch/mvme88k/dev/vme.h b/sys/arch/mvme88k/dev/vme.h
deleted file mode 100644
index 74eb07e2584..00000000000
--- a/sys/arch/mvme88k/dev/vme.h
+++ /dev/null
@@ -1,301 +0,0 @@
-/* $OpenBSD: vme.h,v 1.19 2013/05/17 22:46:27 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef __MVME88K_DEV_VME_H__
-#define __MVME88K_DEV_VME_H__
-
-#define VME2_BASE 0xfff40000
-
-#define VME2_SADDR1 0x0000
-#define VME2_SADDR2 0x0004
-#define VME2_SLAVELMOD1 0x0008
-#define VME2_SLAVELMOD2 0x000c
-#define VME2_SLAVECTL 0x0010
-#define VME2_MASTER1 0x0014
-#define VME2_MASTER2 0x0018
-#define VME2_MASTER3 0x001c
-#define VME2_MASTER4 0x0020
-#define VME2_MASTER4MOD 0x0024
-#define VME2_MASTERCTL 0x0028
-#define VME2_GCSRCTL 0x002c
-#define VME2_DMACTL 0x0030
-#define VME2_DMAMODE 0x0034
-#define VME2_DMALADDR 0x0038
-#define VME2_DMAVMEADDR 0x003c
-#define VME2_DMACOUNT 0x0040
-#define VME2_DMATABLE 0x0044
-#define VME2_DMASTAT 0x0048
-#define VME2_TCR 0x004c
-#define VME2_T1CMP 0x0050
-#define VME2_T1COUNT 0x0054
-#define VME2_T2CMP 0x0058
-#define VME2_T2COUNT 0x005c
-#define VME2_TCTL 0x0060
-#define VME2_PRESCALE 0x0064
-#define VME2_IRQSTAT 0x0068
-#define VME2_IRQEN 0x006c
-#define VME2_SETSOFTIRQ 0x0070
-#define VME2_IRQCLR 0x0074
-#define VME2_IRQL1 0x0078
-#define VME2_IRQL2 0x007c
-#define VME2_IRQL3 0x0080
-#define VME2_IRQL4 0x0084
-#define VME2_VBR 0x0088
-#define VME2_MISC 0x008c
-
-#define VME2_GCSR_ID 0x0100
-#define VME2_GCSR_LM_SIG_BSCR 0x0104
-#define VME2_GCSR_0 0x0108
-#define VME2_GCSR_1 0x010c
-#define VME2_GCSR_2 0x0110
-#define VME2_GCSR_3 0x0114
-#define VME2_GCSR_4 0x0118
-#define VME2_GCSR_5 0x011c
-
-#define VME2_SADDR_END 0xffff0000 /* VME address END & START */
-#define VME2_SADDR_START 0x0000ffff
-#define VME2_SADDR_LADDR 0xffff0000 /* local base address */
-#define VME2_SADDR_SIZE(mem) (0x1000 - (mem) >> 16) /* encoding of size */
-
-#define VME2_SLAVE_CHOOSE(bits, num) ((bits) << (16*((num)-1)))
-#define VME2_SLAVECTL_WP 0x00000100 /* write posting */
-#define VME2_SLAVECTL_SNP_NO 0x00000000 /* no snooping */
-#define VME2_SLAVECTL_SNP_SINK 0x00000200 /* sink data */
-#define VME2_SLAVECTL_SNP_INVAL 0x00000400 /* invalidate */
-#define VME2_SLAVECTL_ADDER 0x00000800 /* use adder */
-#define VME2_SLAVECTL_SUP 0x00000080 /* modifier bit */
-#define VME2_SLAVECTL_USR 0x00000040 /* modifier bit */
-#define VME2_SLAVECTL_A32 0x00000020 /* modifier bit */
-#define VME2_SLAVECTL_A24 0x00000010 /* modifier bit */
-#define VME2_SLAVECTL_D64 0x00000008 /* modifier bit */
-#define VME2_SLAVECTL_BLK 0x00000004 /* modifier bit */
-#define VME2_SLAVECTL_PGM 0x00000002 /* modifier bit */
-#define VME2_SLAVECTL_DAT 0x00000001 /* modifier bit */
-
-#define VME2_MASTERCTL_4SHIFT 24
-#define VME2_MASTERCTL_3SHIFT 16
-#define VME2_MASTERCTL_2SHIFT 8
-#define VME2_MASTERCTL_1SHIFT 0
-#define VME2_MASTERCTL_D16 0x80
-#define VME2_MASTERCTL_WP 0x40
-#define VME2_MASTERCTL_AM 0x3f
-#define VME2_MASTERCTL_AM24SB 0x3f /* A24 Supervisory Block Transfer */
-#define VME2_MASTERCTL_AM24SP 0x3e /* A24 Supervisory Program Access */
-#define VME2_MASTERCTL_AM24SD 0x3d /* A24 Supervisory Data Access */
-#define VME2_MASTERCTL_AM24UB 0x3b /* A24 Non-priv. Block Transfer */
-#define VME2_MASTERCTL_AM24UP 0x3a /* A24 Non-priv. Program Access */
-#define VME2_MASTERCTL_AM24UD 0x39 /* A24 Non-priv. Data Access */
-#define VME2_MASTERCTL_AM16S 0x2d /* A16 Supervisory Access */
-#define VME2_MASTERCTL_AM16U 0x29 /* A16 Non-priv. Access */
-#define VME2_MASTERCTL_AM32SB 0x0f /* A32 Supervisory Block Transfer */
-#define VME2_MASTERCTL_AM32SP 0x0e /* A32 Supervisory Program Access */
-#define VME2_MASTERCTL_AM32SD 0x0d /* A32 Supervisory Data Access */
-#define VME2_MASTERCTL_AM32UB 0x0b /* A32 Non-priv. Block Transfer */
-#define VME2_MASTERCTL_AM32UP 0x0a /* A32 Non-priv. Program Access */
-#define VME2_MASTERCTL_AM32UD 0x09 /* A32 Non-priv Data Access */
-
-#define VME2_MASTERCTL_ALL 0xff
-
-#define VME2_GCSRCTL_OFF 0xf0000000
-#define VME2_GCSRCTL_MDEN4 0x00080000
-#define VME2_GCSRCTL_MDEN3 0x00040000
-#define VME2_GCSRCTL_MDEN2 0x00020000
-#define VME2_GCSRCTL_MDEN1 0x00010000
-#define VME2_GCSRCTL_I2EN 0x00008000 /* F decode (A24D16/A32D16) on */
-#define VME2_GCSRCTL_I2WP 0x00004000 /* F decode write post */
-#define VME2_GCSRCTL_I2SU 0x00002000 /* F decode is supervisor */
-#define VME2_GCSRCTL_I2PD 0x00001000 /* F decode is program */
-#define VME2_GCSRCTL_I1EN 0x00000800 /* short decode (A16Dx) on */
-#define VME2_GCSRCTL_I1D16 0x00000400 /* short decode is D16 */
-#define VME2_GCSRCTL_I1WP 0x00000200 /* short decode write post */
-#define VME2_GCSRCTL_I1SU 0x00000100 /* short decode is supervisor */
-#define VME2_GCSRCTL_ROMSIZE 0x000000c0 /* size of ROM */
-#define VME2_GCSRCTL_ROMBSPD 0x00000038 /* speed of ROM */
-#define VME2_GCSRCTL_ROMASPD 0x00000007 /* speed of ROM */
-
-#define VME2_TCR_1MS (1 << 8) /* Watchdog 1 ms */
-#define VME2_TCR_2MS (2 << 8) /* Watchdog 2 ms */
-#define VME2_TCR_4MS (3 << 8) /* Watchdog 4 ms */
-#define VME2_TCR_8MS (4 << 8) /* Watchdog 8 ms */
-#define VME2_TCR_16MS (5 << 8) /* Watchdog 16 ms */
-#define VME2_TCR_32MS (6 << 8) /* Watchdog 32 ms */
-#define VME2_TCR_64MS (7 << 8) /* Watchdog 64 ms */
-#define VME2_TCR_128MS (8 << 8) /* Watchdog 128 ms */
-#define VME2_TCR_256MS (9 << 8) /* Watchdog 256 ms */
-#define VME2_TCR_512MS (10 << 8) /* Watchdog 512 ms */
-#define VME2_TCR_1S (11 << 8) /* Watchdog 1 s */
-#define VME2_TCR_4S (12 << 8) /* Watchdog 4 s */
-#define VME2_TCR_16S (13 << 8) /* Watchdog 16 s */
-#define VME2_TCR_32S (14 << 8) /* Watchdog 32 s */
-#define VME2_TCR_64S (15 << 8) /* Watchdog 64 s */
-
-#define VME2_TCTL1_CEN 0x01
-#define VME2_TCTL1_COC 0x02
-#define VME2_TCTL1_COVF 0x04
-#define VME2_TCTL1_OVF 0xf0
-#define VME2_TCTL2_CEN (0x01 << 8)
-#define VME2_TCTL2_COC (0x02 << 8)
-#define VME2_TCTL2_COVF (0x04 << 8)
-#define VME2_TCTL2_OVF (0xf0 << 8)
-#define VME2_TCTL_WDEN 0x00010000 /* Watchdog Enable */
-#define VME2_TCTL_WDRSE 0x00020000 /* Watchdog Reset Enable */
-#define VME2_TCTL_WDSL 0x00040000 /* local or system reset */
-#define VME2_TCTL_WDBFE 0x00080000 /* Watchdog Board Fail Enable */
-#define VME2_TCTL_WDTO 0x00100000 /* Watchdog Timeout Status */
-#define VME2_TCTL_WDCC 0x00200000 /* Watchdog Clear Counter */
-#define VME2_TCTL_WDCS 0x00400000 /* Watchdog Clear Timeout */
-#define VME2_TCTL_SRST 0x00800000 /* system reset */
-#define VME2_TCTL_RSWE 0x01000000 /* Reset Switch Enable */
-#define VME2_TCTL_BDFLO 0x02000000 /* Assert Board Fail */
-#define VME2_TCTL_CPURS 0x04000000 /* Clear Power-up Reset bit */
-#define VME2_TCTL_PURS 0x08000000 /* Power-up Reset bit */
-#define VME2_TCTL_BDFLI 0x10000000 /* Board Fail Status*/
-#define VME2_TCTL_SYSFAIL 0x20000000 /* light SYSFAIL led */
-#define VME2_TCTL_SCON 0x40000000 /* we are SCON */
-
-#define VME2_IRQ_ACF 0x80000000
-#define VME2_IRQ_AB 0x40000000
-#define VME2_IRQ_SYSF 0x20000000
-#define VME2_IRQ_MWP 0x10000000
-#define VME2_IRQ_PE 0x08000000
-#define VME2_IRQ_V1IE 0x04000000
-#define VME2_IRQ_TIC2 0x02000000
-#define VME2_IRQ_TIC1 0x01000000
-#define VME2_IRQ_VIA 0x00800000
-#define VME2_IRQ_DMA 0x00400000
-#define VME2_IRQ_SIG3 0x00200000
-#define VME2_IRQ_SIG2 0x00100000
-#define VME2_IRQ_SIG1 0x00080000
-#define VME2_IRQ_SIG0 0x00040000
-#define VME2_IRQ_LM1 0x00020000
-#define VME2_IRQ_LM0 0x00010000
-#define VME2_IRQ_SW7 0x00008000
-#define VME2_IRQ_SW6 0x00004000
-#define VME2_IRQ_SW5 0x00002000
-#define VME2_IRQ_SW4 0x00001000
-#define VME2_IRQ_SW3 0x00000800
-#define VME2_IRQ_SW2 0x00000400
-#define VME2_IRQ_SW1 0x00000200
-#define VME2_IRQ_SW0 0x00000100
-#define VME2_IRQ_SW(x) ((1 << (x))) << 8)
-#define VME2_IRQ_SPARE 0x00000080
-#define VME2_IRQ_VME7 0x00000040
-#define VME2_IRQ_VME6 0x00000020
-#define VME2_IRQ_VME5 0x00000010
-#define VME2_IRQ_VME4 0x00000008
-#define VME2_IRQ_VME3 0x00000004
-#define VME2_IRQ_VME2 0x00000002
-#define VME2_IRQ_VME1 0x00000001
-#define VME2_IRQ_VME(x) (1 << ((x) - 1))
-
-#define VME2_IRQL1_ACFSHIFT 28
-#define VME2_IRQL1_ABSHIFT 24
-#define VME2_IRQL1_SYSFSHIFT 20
-#define VME2_IRQL1_WPESHIFT 16
-#define VME2_IRQL1_PESHIFT 12
-#define VME2_IRQL1_V1IESHIFT 8
-#define VME2_IRQL1_TIC2SHIFT 4
-#define VME2_IRQL1_TIC1SHIFT 0
-
-#define VME2_IRQL2_VIASHIFT 28
-#define VME2_IRQL2_DMASHIFT 24
-#define VME2_IRQL2_SIG3SHIFT 20
-#define VME2_IRQL2_SIG2SHIFT 16
-#define VME2_IRQL2_SIG1SHIFT 12
-#define VME2_IRQL2_SIG0SHIFT 8
-#define VME2_IRQL2_LM1SHIFT 4
-#define VME2_IRQL2_LM0SHIFT 0
-
-#define VME2_IRQL3_SW7SHIFT 28
-#define VME2_IRQL3_SW6SHIFT 24
-#define VME2_IRQL3_SW5SHIFT 20
-#define VME2_IRQL3_SW4SHIFT 16
-#define VME2_IRQL3_SW3SHIFT 12
-#define VME2_IRQL3_SW2SHIFT 8
-#define VME2_IRQL3_SW1SHIFT 4
-#define VME2_IRQL3_SW0SHIFT 0
-
-#define VME2_IRQL4_SPARESHIFT 28
-#define VME2_IRQL4_VME7SHIFT 24
-#define VME2_IRQL4_VME6SHIFT 20
-#define VME2_IRQL4_VME5SHIFT 16
-#define VME2_IRQL4_VME4SHIFT 12
-#define VME2_IRQL4_VME3SHIFT 8
-#define VME2_IRQL4_VME2SHIFT 4
-#define VME2_IRQL4_VME1SHIFT 0
-
-#define VME2_SYSFAIL (1 << 22)
-#define VME2_IOCTL1_MIEN (1 << 23)
-#define VME2_VBR_0SHIFT 28
-#define VME2_VBR_1SHIFT 24
-#define VME2_SET_VBR0(x) ((x) << VME2_VBR_0SHIFT)
-#define VME2_SET_VBR1(x) ((x) << VME2_VBR_1SHIFT)
-#define VME2_GET_VBR0(x) ((((x) >> 28) & 0xf) << 4)
-#define VME2_GET_VBR1(x) ((((x) >> 24) & 0xf) << 4)
-#define VME2_VBR_GPOXXXX 0x00ffffff
-
-#define VME2_MISC_MPIRQEN 0x00000080 /* do not set */
-#define VME2_MISC_REVEROM 0x00000040 /* 167: dis eprom. 166: en flash */
-#define VME2_MISC_DISSRAM 0x00000020 /* do not set */
-#define VME2_MISC_DISMST 0x00000010
-#define VME2_MISC_NOELBBSY 0x00000008 /* do not set */
-#define VME2_MISC_DISBSYT 0x00000004 /* do not set */
-#define VME2_MISC_ENINT 0x00000002 /* do not set */
-#define VME2_MISC_DISBGN 0x00000001 /* do not set */
-
-#define VME2_GCSR_LM3 0x8000
-#define VME2_GCSR_LM2 0x4000
-#define VME2_GCSR_LM1 0x2000
-#define VME2_GCSR_LM0 0x1000
-#define VME2_GCSR_SIG3 0x0800
-#define VME2_GCSR_SIG2 0x0400
-#define VME2_GCSR_SIG1 0x0200
-#define VME2_GCSR_SIG0 0x0100
-#define VME2_GCSR_RST 0x0080
-#define VME2_GCSR_ISF 0x0040
-#define VME2_GCSR_BF 0x0020
-#define VME2_GCSR_SCON 0x0010
-#define VME2_GCSR_SF 0x0008
-
-#define VME2_A16D32BASE 0xffff0000UL
-#define VME2_A16D32LEN 0x00010000UL
-#define VME2_A32D16BASE 0xf1000000UL
-#define VME2_A32D16LEN 0x01000000UL
-#define VME2_A16D16BASE 0xffff0000UL
-#define VME2_A16D16LEN 0x00010000UL
-#define VME2_A24D16BASE 0xf0000000UL
-#define VME2_A24D16LEN 0x01000000UL
-#define VME2_A16BASE 0xffff0000UL
-#define VME2_A24BASE 0xff000000UL
-
-paddr_t vmepmap(struct device *sc, off_t vmeaddr, int bustype);
-int vmerw(struct device *sc, struct uio *uio, int flags, int bus);
-int vmeintr_establish(int, struct intrhand *, const char *);
-int vme_findvec(int);
-int vmescan(struct device *, void *, void *, int);
-
-#endif /* __MVME88K_DEV_VME_H__ */
diff --git a/sys/arch/mvme88k/dev/vmel.c b/sys/arch/mvme88k/dev/vmel.c
deleted file mode 100644
index 2516266d254..00000000000
--- a/sys/arch/mvme88k/dev/vmel.c
+++ /dev/null
@@ -1,170 +0,0 @@
-/* $OpenBSD: vmel.c,v 1.20 2011/04/07 15:30:15 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/autoconf.h>
-#include <machine/conf.h>
-#include <machine/cpu.h>
-
-#include <mvme88k/dev/vme.h>
-
-/*
- * The VMEL driver deals with D32 transfers on the VME bus. The number
- * of address bits (A16, A24, A32) is irrelevant since the mapping
- * functions will decide how many address bits are relevant.
- */
-
-void vmelattach(struct device *, struct device *, void *);
-int vmelmatch(struct device *, void *, void *);
-int vmelscan(struct device *, void *, void *);
-
-struct cfattach vmel_ca = {
- sizeof(struct device), vmelmatch, vmelattach
-};
-
-struct cfdriver vmel_cd = {
- NULL, "vmel", DV_DULL
-};
-
-int
-vmelmatch(parent, cf, args)
- struct device *parent;
- void *cf, *args;
-{
- return (1);
-}
-
-int
-vmelscan(parent, child, args)
- struct device *parent;
- void *child, *args;
-{
- return (vmescan(parent, child, args, BUS_VMEL));
-}
-
-void
-vmelattach(parent, self, args)
- struct device *parent, *self;
- void *args;
-{
- printf("\n");
-
- config_search(vmelscan, self, args);
-}
-
-/*ARGSUSED*/
-int
-vmelopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- if (minor(dev) >= vmel_cd.cd_ndevs ||
- vmel_cd.cd_devs[minor(dev)] == NULL)
- return (ENODEV);
- return (0);
-}
-
-/*ARGSUSED*/
-int
-vmelclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
-
- return (0);
-}
-
-/*ARGSUSED*/
-int
-vmelioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- int error = 0;
-
- switch (cmd) {
- default:
- error = ENOTTY;
- break;
- }
- return (error);
-}
-
-int
-vmelread(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- int unit = minor(dev);
- struct device *sc = (struct device *)vmel_cd.cd_devs[unit];
-
- return (vmerw(sc->dv_parent, uio, flags, BUS_VMEL));
-}
-
-int
-vmelwrite(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- int unit = minor(dev);
- struct device *sc = (struct device *)vmel_cd.cd_devs[unit];
-
- return (vmerw(sc->dv_parent, uio, flags, BUS_VMEL));
-}
-
-paddr_t
-vmelmmap(dev, off, prot)
- dev_t dev;
- off_t off;
- int prot;
-{
- int unit = minor(dev);
- struct device *sc = (struct device *)vmel_cd.cd_devs[unit];
- paddr_t pa;
-
- pa = vmepmap(sc->dv_parent, off, BUS_VMEL);
-#ifdef DEBUG
- printf("vmel %llx pa %p\n", off, pa);
-#endif
- if (pa == 0)
- return (-1);
- return (pa);
-}
diff --git a/sys/arch/mvme88k/dev/vmes.c b/sys/arch/mvme88k/dev/vmes.c
deleted file mode 100644
index 431751c911f..00000000000
--- a/sys/arch/mvme88k/dev/vmes.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/* $OpenBSD: vmes.c,v 1.23 2011/04/07 15:30:15 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/device.h>
-
-#include <machine/bus.h>
-#include <machine/autoconf.h>
-#include <machine/conf.h>
-#include <machine/cpu.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <mvme88k/dev/vme.h>
-
-/*
- * The VMES driver deals with D16 transfers on the VME bus. The number
- * of address bits (A16, A24, A32) is irrelevant since the mapping
- * functions will decide how many address bits are relevant.
- */
-
-void vmesattach(struct device *, struct device *, void *);
-int vmesmatch(struct device *, void *, void *);
-int vmesscan(struct device *, void *, void *);
-
-struct cfattach vmes_ca = {
- sizeof(struct device), vmesmatch, vmesattach
-};
-
-struct cfdriver vmes_cd = {
- NULL, "vmes", DV_DULL
-};
-
-/*
- * Configuration glue
- */
-
-int
-vmesmatch(parent, cf, args)
- struct device *parent;
- void *cf, *args;
-{
- return (1);
-}
-
-int
-vmesscan(parent, child, args)
- struct device *parent;
- void *child, *args;
-{
- return (vmescan(parent, child, args, BUS_VMES));
-}
-
-void
-vmesattach(parent, self, args)
- struct device *parent, *self;
- void *args;
-{
- printf("\n");
-
- config_search(vmesscan, self, args);
-}
-
-/*ARGSUSED*/
-int
-vmesopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
- if (minor(dev) >= vmes_cd.cd_ndevs ||
- vmes_cd.cd_devs[minor(dev)] == NULL)
- return (ENODEV);
- return (0);
-}
-
-/*ARGSUSED*/
-int
-vmesclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
-{
-
- return (0);
-}
-
-/*ARGSUSED*/
-int
-vmesioctl(dev, cmd, data, flag, p)
- dev_t dev;
- u_long cmd;
- caddr_t data;
- int flag;
- struct proc *p;
-{
- int error = 0;
-
- switch (cmd) {
- default:
- error = ENOTTY;
- break;
- }
- return (error);
-}
-
-int
-vmesread(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- int unit = minor(dev);
- struct device *sc = (struct device *)vmes_cd.cd_devs[unit];
-
- return (vmerw(sc->dv_parent, uio, flags, BUS_VMES));
-}
-
-int
-vmeswrite(dev, uio, flags)
- dev_t dev;
- struct uio *uio;
- int flags;
-{
- int unit = minor(dev);
- struct device *sc = (struct device *)vmes_cd.cd_devs[unit];
-
- return (vmerw(sc->dv_parent, uio, flags, BUS_VMES));
-}
-
-paddr_t
-vmesmmap(dev, off, prot)
- dev_t dev;
- off_t off;
- int prot;
-{
- int unit = minor(dev);
- struct device *sc = (struct device *)vmes_cd.cd_devs[unit];
- paddr_t pa;
-
- pa = vmepmap(sc->dv_parent, off, BUS_VMES);
-#ifdef DEBUG
- printf("vmes %llx pa %p\n", off, pa);
-#endif
- if (pa == 0)
- return (-1);
- return (pa);
-}
diff --git a/sys/arch/mvme88k/dev/vs.c b/sys/arch/mvme88k/dev/vs.c
deleted file mode 100644
index afbfe6594e0..00000000000
--- a/sys/arch/mvme88k/dev/vs.c
+++ /dev/null
@@ -1,1353 +0,0 @@
-/* $OpenBSD: vs.c,v 1.84 2014/01/18 04:11:07 dlg Exp $ */
-
-/*
- * Copyright (c) 2004, 2009, Miodrag Vallat.
- * Copyright (c) 1999 Steve Murphree, Jr.
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * MVME328S SCSI adaptor driver
- */
-
-/* This card lives in D16 space */
-#define __BUS_SPACE_RESTRICT_D16__
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/disklabel.h>
-#include <sys/buf.h>
-#include <sys/malloc.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-
-#include <machine/autoconf.h>
-#include <machine/cmmu.h>
-#include <machine/cpu.h>
-
-#include <mvme88k/dev/vsreg.h>
-#include <mvme88k/dev/vsvar.h>
-#include <mvme88k/dev/vme.h>
-
-int vsmatch(struct device *, void *, void *);
-void vsattach(struct device *, struct device *, void *);
-void vs_minphys(struct buf *, struct scsi_link *);
-void vs_scsicmd(struct scsi_xfer *);
-
-struct scsi_adapter vs_scsiswitch = {
- vs_scsicmd,
- vs_minphys,
- 0, /* no lun support */
- 0, /* no lun support */
-};
-
-struct cfattach vs_ca = {
- sizeof(struct vs_softc), vsmatch, vsattach,
-};
-
-struct cfdriver vs_cd = {
- NULL, "vs", DV_DULL,
-};
-
-int do_vspoll(struct vs_softc *, struct scsi_xfer *, int);
-void thaw_queue(struct vs_softc *, int);
-void thaw_all_queues(struct vs_softc *);
-int vs_alloc_sg(struct vs_softc *);
-int vs_alloc_wq(struct vs_softc *);
-void vs_build_sg_list(struct vs_softc *, struct vs_cb *, bus_addr_t);
-void vs_chksense(struct vs_cb *, struct scsi_xfer *);
-int vs_eintr(void *);
-int vs_getcqe(struct vs_softc *, bus_addr_t *, bus_addr_t *);
-int vs_identify(struct vs_channel *, int);
-int vs_initialize(struct vs_softc *);
-int vs_intr(struct vs_softc *);
-int vs_load_command(struct vs_softc *, struct vs_cb *, bus_addr_t,
- bus_addr_t, struct scsi_link *, int, struct scsi_generic *, int,
- uint8_t *, int);
-int vs_nintr(void *);
-void vs_poll(struct vs_softc *, struct vs_cb *);
-void vs_print_addr(struct vs_softc *, struct scsi_xfer *);
-struct vs_cb *vs_find_queue(struct scsi_link *, struct vs_softc *);
-void vs_reset(struct vs_softc *, int);
-void vs_resync(struct vs_softc *);
-void vs_scsidone(struct vs_softc *, struct vs_cb *);
-int vs_unit_value(int, int, int);
-
-static __inline__ void vs_free(struct vs_softc *, struct vs_cb *);
-static __inline__ void vs_clear_return_info(struct vs_softc *);
-
-int
-vsmatch(struct device *device, void *cf, void *args)
-{
- struct confargs *ca = args;
- bus_space_tag_t iot = ca->ca_iot;
- bus_space_handle_t ioh;
- int rc;
- u_int16_t id;
-
- if (bus_space_map(iot, ca->ca_paddr, S_SHORTIO, 0, &ioh) != 0)
- return 0;
- rc = badaddr((vaddr_t)bus_space_vaddr(iot, ioh) + sh_CSS + CSB_TYPE, 2);
- if (rc == 0) {
- id = bus_space_read_2(iot, ioh, sh_CSS + CSB_TYPE);
- if (id != JAGUAR && id != COUGAR)
- rc = 1;
- /*
- * Note that this will reject Cougar boards configured with
- * less than 2KB of short I/O memory.
- * Is it worth checking for a Cougar signature at lower
- * addresses, knowing that we can't really work unless
- * the board is jumped to enable the whole 2KB?
- */
- }
- bus_space_unmap(iot, ioh, S_SHORTIO);
-
- return rc == 0;
-}
-
-void
-vsattach(struct device *parent, struct device *self, void *args)
-{
- struct vs_softc *sc = (struct vs_softc *)self;
- struct vs_channel *vc;
- struct confargs *ca = args;
- struct scsi_link *sc_link;
- struct scsibus_attach_args saa;
- int evec, bus;
- int tmp;
-
- /* get the next available vector for the error interrupt */
- evec = vme_findvec(ca->ca_vec);
-
- if (ca->ca_vec < 0 || evec < 0) {
- printf(": no more interrupts!\n");
- return;
- }
- if (ca->ca_ipl < 0)
- ca->ca_ipl = IPL_BIO;
-
- printf(" vec 0x%x: ", evec);
-
- sc->sc_dmat = ca->ca_dmat;
- sc->sc_iot = ca->ca_iot;
- if (bus_space_map(sc->sc_iot, ca->ca_paddr, S_SHORTIO, 0,
- &sc->sc_ioh) != 0) {
- printf("can't map registers!\n");
- return;
- }
-
- sc->sc_bid = csb_read(2, CSB_TYPE);
- sc->sc_ipl = ca->ca_ipl;
- sc->sc_nvec = ca->ca_vec;
- sc->sc_evec = evec;
-
- if (vs_initialize(sc))
- return;
-
- sc->sc_ih_n.ih_fn = vs_nintr;
- sc->sc_ih_n.ih_arg = sc;
- sc->sc_ih_n.ih_wantframe = 0;
- sc->sc_ih_n.ih_ipl = ca->ca_ipl;
-
- sc->sc_ih_e.ih_fn = vs_eintr;
- sc->sc_ih_e.ih_arg = sc;
- sc->sc_ih_e.ih_wantframe = 0;
- sc->sc_ih_e.ih_ipl = ca->ca_ipl;
-
- vmeintr_establish(sc->sc_nvec, &sc->sc_ih_n, self->dv_xname);
- snprintf(sc->sc_intrname_e, sizeof sc->sc_intrname_e,
- "%s_err", self->dv_xname);
- vmeintr_establish(sc->sc_evec, &sc->sc_ih_e, sc->sc_intrname_e);
-
- /*
- * Attach all scsi units on us, watching for boot device
- * (see device_register).
- */
- tmp = bootpart;
- if (ca->ca_paddr != bootaddr)
- bootpart = -1; /* invalid flag to device_register */
-
- for (bus = 0; bus < 2; bus++) {
- vc = &sc->sc_channel[bus];
- if (vc->vc_id < 0)
- continue;
-
- sc_link = &vc->vc_link;
- sc_link->adapter = &vs_scsiswitch;
- sc_link->adapter_buswidth = vc->vc_width;
- sc_link->adapter_softc = sc;
- sc_link->adapter_target = vc->vc_id;
- if (sc->sc_bid != JAGUAR)
- sc_link->luns = 1; /* not enough queues */
- sc_link->openings = 1;
- if (bus != 0)
- sc_link->flags = SDEV_2NDBUS;
-
- printf("%s: channel %d", sc->sc_dev.dv_xname, bus);
- switch (vc->vc_type) {
- case VCT_SE:
- printf(", single-ended");
- break;
- case VCT_DIFFERENTIAL:
- printf(", differential");
- break;
- }
- printf("\n");
-
- if (vc->vc_width == 0) {
- printf("%s: daughterboard disabled, "
- "not enough on-board memory\n",
- sc->sc_dev.dv_xname);
- continue;
- }
-
- bzero(&saa, sizeof(saa));
- saa.saa_sc_link = &vc->vc_link;
-
- bootbus = bus;
- config_found(self, &saa, scsiprint);
- }
-
- bootpart = tmp; /* restore old values */
- bootbus = 0;
-}
-
-void
-vs_minphys(struct buf *bp, struct scsi_link *sl)
-{
- if (bp->b_bcount > ptoa(MAX_SG_ELEMENTS))
- bp->b_bcount = ptoa(MAX_SG_ELEMENTS);
- minphys(bp);
-}
-
-void
-vs_print_addr(struct vs_softc *sc, struct scsi_xfer *xs)
-{
- if (xs == NULL)
- printf("%s: ", sc->sc_dev.dv_xname);
- else {
- sc_print_addr(xs->sc_link);
-
- /* print bus number too if appropriate */
- if (sc->sc_channel[1].vc_width >= 0)
- printf("(channel %d) ",
- !!(xs->sc_link->flags & SDEV_2NDBUS));
- }
-}
-
-int
-do_vspoll(struct vs_softc *sc, struct scsi_xfer *xs, int canreset)
-{
- int to;
- int crsw, bus;
-
- if (xs != NULL) {
- bus = !!(xs->sc_link->flags & SDEV_2NDBUS);
- to = xs->timeout;
- if (to == 0)
- to = 2000;
- } else {
- bus = -1;
- to = 2000;
- }
-
- while (((crsw = CRSW) & (M_CRSW_CRBV | M_CRSW_CC)) == 0) {
- if (to-- <= 0) {
- vs_print_addr(sc, xs);
- printf("command timeout, crsw 0x%x\n", crsw);
-
- if (canreset) {
- vs_reset(sc, bus);
- vs_resync(sc);
- }
- return 1;
- }
- delay(1000);
- }
-#ifdef VS_DEBUG
- printf("%s: crsw %04x to %d/%d\n",
- __func__, crsw, to, xs ? xs->timeout : 2000);
-#endif
- return 0;
-}
-
-void
-vs_poll(struct vs_softc *sc, struct vs_cb *cb)
-{
- struct scsi_xfer *xs;
- int s;
- int rc;
-
- xs = cb->cb_xs;
- rc = do_vspoll(sc, xs, 1);
-
- s = splbio();
- if (rc != 0) {
- xs->error = XS_SELTIMEOUT;
- xs->status = -1;
-#ifdef VS_DEBUG
- printf("%s: polled command timed out\n", __func__);
-#endif
- vs_free(sc, cb);
- scsi_done(xs);
- } else
- vs_scsidone(sc, cb);
- splx(s);
-
- if (CRSW & M_CRSW_ER)
- CRB_CLR_ER;
- CRB_CLR_DONE;
-
- vs_clear_return_info(sc);
-}
-
-void
-thaw_queue(struct vs_softc *sc, int target)
-{
- THAW(target);
-
- /* loop until thawed */
- while (THAW_REG & M_THAW_TWQE)
- ;
-}
-
-void
-thaw_all_queues(struct vs_softc *sc)
-{
- int i;
-
- for (i = 1; i <= sc->sc_nwq; i++)
- thaw_queue(sc, i);
-}
-
-void
-vs_scsidone(struct vs_softc *sc, struct vs_cb *cb)
-{
- struct scsi_xfer *xs = cb->cb_xs;
- u_int32_t len;
- int error;
-
- len = vs_read(4, sh_RET_IOPB + IOPB_LENGTH);
- xs->resid = xs->datalen - len;
-
- error = vs_read(2, sh_RET_IOPB + IOPB_STATUS);
-#ifdef VS_DEBUG
- printf("%s: queue %d, len %u (resid %d) error %d\n",
- __func__, cb->cb_q, len, xs->resid, error);
- if (error != 0)
- printf("%s: last select %d %d, phase %02x %02x\n",
- __func__, csb_read(1, CSB_LPDS), csb_read(1, CSB_LSDS),
- csb_read(1, CSB_PPS), csb_read(1, CSB_SPS));
-#endif
- if ((error & 0xff) == SCSI_SELECTION_TO) {
- xs->error = XS_SELTIMEOUT;
- xs->status = -1;
- } else {
- if (xs->flags & (SCSI_DATA_IN | SCSI_DATA_OUT)) {
- bus_dmamap_sync(sc->sc_dmat, cb->cb_dmamap, 0,
- cb->cb_dmalen, (xs->flags & SCSI_DATA_IN) ?
- BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
- bus_dmamap_unload(sc->sc_dmat, cb->cb_dmamap);
- }
-
- xs->status = error >> 8;
- }
-
- while (xs->status == SCSI_CHECK) {
- vs_chksense(cb, xs);
- }
-
- vs_free(sc, cb);
- scsi_done(xs);
-}
-
-void
-vs_scsicmd(struct scsi_xfer *xs)
-{
- struct scsi_link *slp = xs->sc_link;
- struct vs_softc *sc = slp->adapter_softc;
- int flags;
- bus_addr_t cqep, iopb;
- struct vs_cb *cb;
- int s;
- int rc;
-
- flags = xs->flags;
- if (flags & SCSI_POLL) {
- cb = sc->sc_cb;
- cqep = sh_MCE;
- iopb = sh_MCE_IOPB;
-
-#ifdef VS_DEBUG
- if (mce_read(2, CQE_QECR) & M_QECR_GO)
- printf("%s: master command queue busy\n",
- sc->sc_dev.dv_xname);
-#endif
- /* Wait until we can use the command queue entry. */
- while (mce_read(2, CQE_QECR) & M_QECR_GO)
- ;
-#ifdef VS_DEBUG
- if (cb->cb_xs != NULL) {
- printf("%s: master command not idle\n",
- sc->sc_dev.dv_xname);
- xs->error = XS_BUSY;
- scsi_done(xs);
- return;
- }
-#endif
- s = splbio();
- } else {
- s = splbio();
- cb = vs_find_queue(slp, sc);
- if (cb == NULL) {
- splx(s);
-#ifdef VS_DEBUG
- printf("%s: queue for target %d is busy\n",
- sc->sc_dev.dv_xname, slp->target);
-#endif
- xs->error = XS_NO_CCB;
- scsi_done(xs);
- return;
- }
- if (vs_getcqe(sc, &cqep, &iopb)) {
- /* XXX shouldn't happen since our queue is ready */
- splx(s);
-#ifdef VS_DEBUG
- printf("%s: no free CQEs\n", sc->sc_dev.dv_xname);
-#endif
- xs->error = XS_NO_CCB;
- s = splbio();
- scsi_done(xs);
- splx(s);
- return;
- }
- }
-
-#ifdef VS_DEBUG
- printf("%s: sending SCSI command %02x (length %d) on queue %d\n",
- __func__, xs->cmd->opcode, xs->cmdlen, cb->cb_q);
-#endif
- rc = vs_load_command(sc, cb, cqep, iopb, slp, xs->flags,
- xs->cmd, xs->cmdlen, xs->data, xs->datalen);
- if (rc != 0) {
- printf("%s: unable to load DMA map: error %d\n",
- sc->sc_dev.dv_xname, rc);
- xs->error = XS_DRIVER_STUFFUP;
- scsi_done(xs);
- splx(s);
- return;
- }
-
- vs_write(1, cqep + CQE_WORK_QUEUE, cb->cb_q);
-
- cb->cb_xs = xs;
- splx(s);
-
- vs_write(4, cqep + CQE_CTAG, (u_int32_t)cb);
-
- if (crb_read(2, CRB_CRSW) & M_CRSW_AQ)
- vs_write(2, cqep + CQE_QECR, M_QECR_AA | M_QECR_GO);
- else
- vs_write(2, cqep + CQE_QECR, M_QECR_GO);
-
- if (flags & SCSI_POLL) {
- /* poll for the command to complete */
- vs_poll(sc, cb);
- }
-}
-
-int
-vs_load_command(struct vs_softc *sc, struct vs_cb *cb, bus_addr_t cqep,
- bus_addr_t iopb, struct scsi_link *slp, int flags,
- struct scsi_generic *cmd, int cmdlen, uint8_t *data, int datalen)
-{
- unsigned int iopb_len;
- int option;
- int rc;
-
- /*
- * We should only provide the iopb len if the controller is not
- * able to compute it from the SCSI command group.
- * Note that Jaguar has no knowledge of group 2.
- */
- switch ((cmd->opcode) >> 5) {
- case 0:
- case 1:
- case 5:
- iopb_len = 0;
- break;
- case 2:
- if (sc->sc_bid == COUGAR)
- iopb_len = 0;
- else
- /* FALLTHROUGH */
- default:
- iopb_len = IOPB_SHORT_SIZE + ((cmdlen + 1) >> 1);
- break;
- }
-
- vs_bzero(iopb, IOPB_LONG_SIZE);
- bus_space_write_region_1(sc->sc_iot, sc->sc_ioh, iopb + IOPB_SCSI_DATA,
- (u_int8_t *)cmd, cmdlen);
- vs_write(2, iopb + IOPB_CMD, IOPB_PASSTHROUGH);
- vs_write(2, iopb + IOPB_UNIT,
- vs_unit_value(slp->flags & SDEV_2NDBUS, slp->target, slp->lun));
-#ifdef VS_DEBUG
- printf("%s: target %d lun %d encoded as %04x\n",
- __func__, slp->target, slp->lun, (u_int)
- vs_unit_value(slp->flags & SDEV_2NDBUS, slp->target, slp->lun));
-#endif
- vs_write(1, iopb + IOPB_NVCT, sc->sc_nvec);
- vs_write(1, iopb + IOPB_EVCT, sc->sc_evec);
-
- /*
- * Setup DMA map for data transfer
- */
- if (flags & (SCSI_DATA_IN | SCSI_DATA_OUT)) {
- cb->cb_dmalen = (bus_size_t)datalen;
- rc = bus_dmamap_load(sc->sc_dmat, cb->cb_dmamap,
- data, cb->cb_dmalen, NULL,
- BUS_DMA_NOWAIT | BUS_DMA_STREAMING |
- ((flags & SCSI_DATA_IN) ? BUS_DMA_READ : BUS_DMA_WRITE));
- if (rc != 0)
- return rc;
-
- bus_dmamap_sync(sc->sc_dmat, cb->cb_dmamap, 0,
- cb->cb_dmalen, (flags & SCSI_DATA_IN) ?
- BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
- }
-
- option = 0;
- if (flags & SCSI_DATA_OUT)
- option |= M_OPT_DIR;
- if (slp->adapter_buswidth > 8)
- option |= M_OPT_GO_WIDE;
-
- if (flags & SCSI_POLL) {
- vs_write(2, iopb + IOPB_OPTION, option);
- vs_write(2, iopb + IOPB_LEVEL, 0);
- } else {
- vs_write(2, iopb + IOPB_OPTION, option | M_OPT_IE);
- vs_write(2, iopb + IOPB_LEVEL, sc->sc_ipl);
- }
- vs_write(2, iopb + IOPB_ADDR, ADDR_MOD);
-
- if (flags & (SCSI_DATA_IN | SCSI_DATA_OUT))
- vs_build_sg_list(sc, cb, iopb);
-
- vs_bzero(cqep, CQE_SIZE);
- vs_write(2, cqep + CQE_IOPB_ADDR, iopb);
- vs_write(1, cqep + CQE_IOPB_LENGTH, iopb_len);
- /* CQE_WORK_QUEUE to be filled by the caller */
-
- return 0;
-}
-
-void
-vs_chksense(struct vs_cb *cb, struct scsi_xfer *xs)
-{
- struct scsi_link *slp = xs->sc_link;
- struct vs_softc *sc = slp->adapter_softc;
- struct scsi_sense ss;
- int rc;
- int s;
-
-#ifdef VS_DEBUG
- printf("%s: target %d\n", slp->target);
-#endif
- /* ack and clear the error */
- if (CRSW & M_CRSW_ER)
- CRB_CLR_ER;
- CRB_CLR_DONE;
- xs->status = 0;
-
- /* Wait until we can use the command queue entry. */
- while (mce_read(2, CQE_QECR) & M_QECR_GO)
- ;
-
- bzero(&ss, sizeof ss);
- ss.opcode = REQUEST_SENSE;
- ss.byte2 = slp->lun << 5;
- ss.length = sizeof(xs->sense);
-
-#ifdef VS_DEBUG
- printf("%s: sending SCSI command %02x (length %d) on queue %d\n",
- __func__, ss.opcode, sizeof ss, 0);
-#endif
- rc = vs_load_command(sc, cb, sh_MCE, sh_MCE_IOPB, slp,
- SCSI_DATA_IN | SCSI_POLL,
- (struct scsi_generic *)&ss, sizeof ss, (uint8_t *)&xs->sense,
- sizeof(xs->sense));
- if (rc != 0) {
- printf("%s: unable to load DMA map: error %d\n",
- sc->sc_dev.dv_xname, rc);
- xs->error = XS_DRIVER_STUFFUP;
- xs->status = 0;
- return;
- }
-
- mce_write(1, CQE_WORK_QUEUE, 0);
- mce_write(2, CQE_QECR, M_QECR_GO);
-
- /* poll for the command to complete */
- s = splbio();
- do_vspoll(sc, xs, 1);
- xs->status = vs_read(2, sh_RET_IOPB + IOPB_STATUS) >> 8;
- splx(s);
-}
-
-int
-vs_getcqe(struct vs_softc *sc, bus_addr_t *cqep, bus_addr_t *iopbp)
-{
- bus_addr_t cqe, iopb;
- int qhdp;
-
- qhdp = mcsb_read(2, MCSB_QHDP);
- cqe = sh_CQE(qhdp);
- iopb = sh_IOPB(qhdp);
-
- if (vs_read(2, cqe + CQE_QECR) & M_QECR_GO) {
- /* queue still in use, should never happen */
- return EAGAIN;
- }
-
- if (++qhdp == NUM_CQE)
- qhdp = 0;
- mcsb_write(2, MCSB_QHDP, qhdp);
-
- vs_bzero(cqe, CQE_SIZE);
- *cqep = cqe;
- *iopbp = iopb;
- return (0);
-}
-
-int
-vs_identify(struct vs_channel *vc, int cid)
-{
- vc->vc_width = 0;
- vc->vc_type = VCT_UNKNOWN;
-
- if (vc->vc_id < 0)
- return (0);
-
- switch (cid) {
- case 0x00:
- vc->vc_width = 8;
- vc->vc_type = VCT_SE;
- break;
- case 0x01:
- vc->vc_width = 8;
- vc->vc_type = VCT_DIFFERENTIAL;
- break;
- case 0x02:
- vc->vc_width = 16;
- vc->vc_type = VCT_SE;
- break;
- case 0x03:
- case 0x0e:
- vc->vc_width = 16;
- vc->vc_type = VCT_DIFFERENTIAL;
- break;
- default:
- vc->vc_id = -1;
- return (0);
- }
-
- return (vc->vc_width - 1);
-}
-
-int
-vs_initialize(struct vs_softc *sc)
-{
- int i, msr, id, rc;
- u_int targets;
-
- /*
- * Reset the board, and wait for it to get ready.
- * The reset signal is applied for 70 usec, and the board status
- * is not tested until 100 usec after the reset signal has been
- * cleared, per the manual (MVME328/D1) pages 4-6 and 4-9.
- */
-
- mcsb_write(2, MCSB_MCR, M_MCR_RES | M_MCR_SFEN);
- delay(70);
- mcsb_write(2, MCSB_MCR, M_MCR_SFEN);
-
- delay(100);
- i = 0;
- for (;;) {
- msr = mcsb_read(2, MCSB_MSR);
- if ((msr & (M_MSR_BOK | M_MSR_CNA)) == M_MSR_BOK)
- break;
- if (++i > 5000) {
- printf("board reset failed, status %x\n", msr);
- return 1;
- }
- delay(1000);
- }
-
- /* describe the board */
- switch (sc->sc_bid) {
- default:
- case JAGUAR:
- printf("Jaguar");
- break;
- case COUGAR:
- id = csb_read(1, CSB_EXTID);
- switch (id) {
- case 0x00:
- printf("Cougar");
- break;
- case 0x02:
- printf("Cougar II");
- break;
- default:
- printf("unknown Cougar version %02x", id);
- break;
- }
- break;
- }
-
- /* initialize channels id */
- sc->sc_channel[0].vc_id = csb_read(1, CSB_PID);
- sc->sc_channel[1].vc_id = -1;
- switch (id = csb_read(1, CSB_DBID)) {
- case DBID_SCSI2:
- case DBID_SCSI:
- sc->sc_channel[1].vc_id = csb_read(1, CSB_SID);
- break;
- case DBID_PRINTER:
- printf(", printer port");
- break;
- case DBID_NONE:
- break;
- default:
- printf(", unknown daughterboard id %x", id);
- break;
- }
-
- printf("\n");
-
- /*
- * On cougar boards, find how many work queues we can use,
- * and whether we are on wide or narrow buses.
- */
- switch (sc->sc_bid) {
- case COUGAR:
- sc->sc_nwq = csb_read(2, CSB_NWQ);
- /*
- * Despite what the documentation says, this value is not
- * always provided. If it is invalid, decide on the number
- * of available work queues from the memory size, as the
- * firmware does.
- */
-#ifdef VS_DEBUG
- printf("%s: controller reports %d work queues\n",
- __func__, sc->sc_nwq);
-#endif
- if (sc->sc_nwq != 0x0f && sc->sc_nwq != 0xff) {
- if (csb_read(2, CSB_BSIZE) >= 0x0100)
- sc->sc_nwq = 0xff; /* >= 256KB, 255 WQ */
- else
- sc->sc_nwq = 0x0f; /* < 256KB, 15 WQ */
- }
-#ifdef VS_DEBUG
- printf("%s: driver deducts %d work queues\n",
- __func__, sc->sc_nwq);
-#endif
- if (sc->sc_nwq > NUM_WQ)
- sc->sc_nwq = NUM_WQ;
-
- targets = vs_identify(&sc->sc_channel[0],
- csb_read(1, CSB_PFECID));
- targets += vs_identify(&sc->sc_channel[1],
- csb_read(1, CSB_SFECID));
-
- if (sc->sc_nwq > targets)
- sc->sc_nwq = targets;
- else {
- /*
- * We can't drive the daughter board if there is not
- * enough on-board memory for all the work queues.
- * XXX This might work by moving everything off-board?
- */
- if (sc->sc_nwq < targets)
- sc->sc_channel[1].vc_width = 0;
- }
- break;
- default:
- case JAGUAR:
- sc->sc_nwq = JAGUAR_MAX_WQ;
- sc->sc_channel[0].vc_width = sc->sc_channel[1].vc_width = 8;
- break;
- }
-
- CRB_CLR_DONE;
- mcsb_write(2, MCSB_QHDP, 0);
-
- vs_bzero(sh_CIB, CIB_SIZE);
- cib_write(2, CIB_NCQE, NUM_CQE);
- cib_write(2, CIB_BURST, 0);
- cib_write(2, CIB_NVECT, (sc->sc_ipl << 8) | sc->sc_nvec);
- cib_write(2, CIB_EVECT, (sc->sc_ipl << 8) | sc->sc_evec);
- cib_write(2, CIB_PID, 0x08); /* use default */
- cib_write(2, CIB_SID, 0x08); /* use default */
- cib_write(2, CIB_CRBO, sh_CRB);
- cib_write(4, CIB_SELECT, SELECTION_TIMEOUT);
- cib_write(4, CIB_WQTIMO, 4);
- cib_write(4, CIB_VMETIMO, 0 /* VME_BUS_TIMEOUT */);
- cib_write(2, CIB_ERR_FLGS, M_ERRFLGS_RIN | M_ERRFLGS_RSE);
- cib_write(2, CIB_SBRIV, (sc->sc_ipl << 8) | sc->sc_evec);
- cib_write(1, CIB_SOF0, 0x15);
- cib_write(1, CIB_SRATE0, 100 / 4);
- cib_write(1, CIB_SOF1, 0);
- cib_write(1, CIB_SRATE1, 0);
-
- vs_bzero(sh_MCE_IOPB, IOPB_LONG_SIZE);
- mce_iopb_write(2, IOPB_CMD, CNTR_INIT);
- mce_iopb_write(2, IOPB_OPTION, 0);
- mce_iopb_write(1, IOPB_NVCT, sc->sc_nvec);
- mce_iopb_write(1, IOPB_EVCT, sc->sc_evec);
- mce_iopb_write(2, IOPB_LEVEL, 0 /* sc->sc_ipl */);
- mce_iopb_write(2, IOPB_ADDR, SHIO_MOD);
- mce_iopb_write(4, IOPB_BUFF, sh_CIB);
- mce_iopb_write(4, IOPB_LENGTH, CIB_SIZE);
-
- vs_bzero(sh_MCE, CQE_SIZE);
- mce_write(2, CQE_IOPB_ADDR, sh_MCE_IOPB);
- mce_write(1, CQE_IOPB_LENGTH, 0);
- mce_write(1, CQE_WORK_QUEUE, 0);
- mce_write(2, CQE_QECR, M_QECR_GO);
-
- /* poll for the command to complete */
- do_vspoll(sc, NULL, 1);
-
- if ((rc = vs_alloc_sg(sc)) != 0)
- return rc;
-
- if ((rc = vs_alloc_wq(sc)) != 0)
- return rc;
-
- /* initialize work queues */
-#ifdef VS_DEBUG
- printf("%s: initializing %d work queues\n",
- __func__, sc->sc_nwq);
-#endif
-
- for (i = 1; i <= sc->sc_nwq; i++) {
- /* Wait until we can use the command queue entry. */
- while (mce_read(2, CQE_QECR) & M_QECR_GO)
- ;
-
- vs_bzero(sh_MCE_IOPB, IOPB_LONG_SIZE);
- mce_iopb_write(2, WQCF_CMD, CNTR_INIT_WORKQ);
- mce_iopb_write(2, WQCF_OPTION, 0);
- mce_iopb_write(1, WQCF_NVCT, sc->sc_nvec);
- mce_iopb_write(1, WQCF_EVCT, sc->sc_evec);
- mce_iopb_write(2, WQCF_ILVL, 0 /* sc->sc_ipl */);
- mce_iopb_write(2, WQCF_WORKQ, i);
- mce_iopb_write(2, WQCF_WOPT, M_WOPT_FE | M_WOPT_IWQ);
- if (sc->sc_bid == JAGUAR)
- mce_iopb_write(2, WQCF_SLOTS, JAGUAR_MAX_Q_SIZ);
- mce_iopb_write(4, WQCF_CMDTO, 4); /* 1 second */
- if (sc->sc_bid != JAGUAR)
- mce_iopb_write(2, WQCF_UNIT,
- vs_unit_value(i > sc->sc_channel[0].vc_width,
- i - sc->sc_channel[0].vc_width, 0));
-
- vs_bzero(sh_MCE, CQE_SIZE);
- mce_write(2, CQE_IOPB_ADDR, sh_MCE_IOPB);
- mce_write(1, CQE_IOPB_LENGTH, 0);
- mce_write(1, CQE_WORK_QUEUE, 0);
- mce_write(2, CQE_QECR, M_QECR_GO);
-
- /* poll for the command to complete */
- do_vspoll(sc, NULL, 1);
- if (CRSW & M_CRSW_ER) {
- printf("%s: work queue %d initialization error 0x%x\n",
- sc->sc_dev.dv_xname, i,
- vs_read(2, sh_RET_IOPB + IOPB_STATUS));
- return ENXIO;
- }
- CRB_CLR_DONE;
- }
-
- /* start queue mode */
- mcsb_write(2, MCSB_MCR, mcsb_read(2, MCSB_MCR) | M_MCR_SQM);
-
- /* reset all SCSI buses */
- vs_reset(sc, -1);
- /* sync all devices */
- vs_resync(sc);
-
- return 0;
-}
-
-/*
- * Allocate memory for the scatter/gather lists.
- *
- * Since vs_minphys() makes sure we won't need more than flat lists of
- * up to MAX_SG_ELEMENTS entries, we need to allocate storage for one
- * such list per work queue.
- */
-int
-vs_alloc_sg(struct vs_softc *sc)
-{
- size_t sglen;
- int nseg;
- int rc;
-
- sglen = (sc->sc_nwq + 1) * MAX_SG_ELEMENTS * sizeof(struct vs_sg_entry);
- sglen = round_page(sglen);
-
- rc = bus_dmamem_alloc(sc->sc_dmat, sglen, 0, 0,
- &sc->sc_sgseg, 1, &nseg, BUS_DMA_NOWAIT);
- if (rc != 0) {
- printf("%s: unable to allocate s/g memory: error %d\n",
- sc->sc_dev.dv_xname, rc);
- goto fail1;
- }
- rc = bus_dmamem_map(sc->sc_dmat, &sc->sc_sgseg, nseg, sglen,
- (caddr_t *)&sc->sc_sgva, BUS_DMA_NOWAIT | BUS_DMA_COHERENT);
- if (rc != 0) {
- printf("%s: unable to map s/g memory: error %d\n",
- sc->sc_dev.dv_xname, rc);
- goto fail2;
- }
- rc = bus_dmamap_create(sc->sc_dmat, sglen, 1, sglen, 0,
- BUS_DMA_NOWAIT /* | BUS_DMA_ALLOCNOW */, &sc->sc_sgmap);
- if (rc != 0) {
- printf("%s: unable to create s/g dma map: error %d\n",
- sc->sc_dev.dv_xname, rc);
- goto fail3;
- }
- rc = bus_dmamap_load(sc->sc_dmat, sc->sc_sgmap, sc->sc_sgva,
- sglen, NULL, BUS_DMA_NOWAIT);
- if (rc != 0) {
- printf("%s: unable to load s/g dma map: error %d\n",
- sc->sc_dev.dv_xname, rc);
- goto fail4;
- }
-
- return 0;
-
-fail4:
- bus_dmamap_destroy(sc->sc_dmat, sc->sc_sgmap);
-fail3:
- bus_dmamem_unmap(sc->sc_dmat, (caddr_t)sc->sc_sgva, PAGE_SIZE);
-fail2:
- bus_dmamem_free(sc->sc_dmat, &sc->sc_sgseg, 1);
-fail1:
- return rc;
-}
-
-/*
- * Allocate one command block per work qeue.
- */
-int
-vs_alloc_wq(struct vs_softc *sc)
-{
- struct vs_cb *cb;
- u_int i;
- int rc;
-
- sc->sc_cb = malloc((sc->sc_nwq + 1) * sizeof(struct vs_cb), M_DEVBUF,
- M_ZERO | M_NOWAIT);
- if (sc->sc_cb == NULL) {
- printf("%s: unable to allocate %d work queues\n",
- sc->sc_dev.dv_xname, sc->sc_nwq);
- return ENOMEM;
- }
-
- for (i = 0, cb = sc->sc_cb; i <= sc->sc_nwq; i++, cb++) {
- cb->cb_q = i;
-
- rc = bus_dmamap_create(sc->sc_dmat, ptoa(MAX_SG_ELEMENTS),
- MAX_SG_ELEMENTS, MAX_SG_ELEMENT_SIZE, 0,
- BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, &cb->cb_dmamap);
- if (rc != 0) {
- printf("%s: unable to create dma map for queue %d"
- ": error %d\n",
- sc->sc_dev.dv_xname, i, rc);
- goto fail;
- }
- }
-
- return 0;
-
-fail:
- while (i != 0) {
- i--; cb--;
- bus_dmamap_destroy(sc->sc_dmat, cb->cb_dmamap);
- }
- free(sc->sc_cb, M_DEVBUF);
- sc->sc_cb = NULL;
-
- return rc;
-}
-
-void
-vs_resync(struct vs_softc *sc)
-{
- struct vs_channel *vc;
- int bus, target;
-
- for (bus = 0; bus < 2; bus++) {
- vc = &sc->sc_channel[bus];
- if (vc->vc_id < 0 || vc->vc_width == 0)
- break;
-
- for (target = 0; target < vc->vc_width; target++) {
- if (target == vc->vc_id)
- continue;
-
- /* Wait until we can use the command queue entry. */
- while (mce_read(2, CQE_QECR) & M_QECR_GO)
- ;
-
- vs_bzero(sh_MCE_IOPB, IOPB_SHORT_SIZE);
- mce_iopb_write(2, DRCF_CMD, CNTR_DEV_REINIT);
- mce_iopb_write(2, DRCF_OPTION, 0); /* prefer polling */
- mce_iopb_write(1, DRCF_NVCT, sc->sc_nvec);
- mce_iopb_write(1, DRCF_EVCT, sc->sc_evec);
- mce_iopb_write(2, DRCF_ILVL, 0);
- mce_iopb_write(2, DRCF_UNIT,
- vs_unit_value(bus, target, 0));
-
- vs_bzero(sh_MCE, CQE_SIZE);
- mce_write(2, CQE_IOPB_ADDR, sh_MCE_IOPB);
- mce_write(1, CQE_IOPB_LENGTH, 0);
- mce_write(1, CQE_WORK_QUEUE, 0);
- mce_write(2, CQE_QECR, M_QECR_GO);
-
- /* poll for the command to complete */
- do_vspoll(sc, NULL, 0);
- if (CRSW & M_CRSW_ER)
- CRB_CLR_ER;
- CRB_CLR_DONE;
- }
- }
-}
-
-void
-vs_reset(struct vs_softc *sc, int bus)
-{
- int b, s;
-
- s = splbio();
-
- for (b = 0; b < 2; b++) {
- if (bus >= 0 && b != bus)
- continue;
-
- /* Wait until we can use the command queue entry. */
- while (mce_read(2, CQE_QECR) & M_QECR_GO)
- ;
-
- vs_bzero(sh_MCE_IOPB, IOPB_SHORT_SIZE);
- mce_iopb_write(2, SRCF_CMD, IOPB_RESET);
- mce_iopb_write(2, SRCF_OPTION, 0); /* prefer polling */
- mce_iopb_write(1, SRCF_NVCT, sc->sc_nvec);
- mce_iopb_write(1, SRCF_EVCT, sc->sc_evec);
- mce_iopb_write(2, SRCF_ILVL, 0);
- mce_iopb_write(2, SRCF_BUSID, b << 15);
-
- vs_bzero(sh_MCE, CQE_SIZE);
- mce_write(2, CQE_IOPB_ADDR, sh_MCE_IOPB);
- mce_write(1, CQE_IOPB_LENGTH, 0);
- mce_write(1, CQE_WORK_QUEUE, 0);
- mce_write(2, CQE_QECR, M_QECR_GO);
-
- /* poll for the command to complete */
- for (;;) {
- do_vspoll(sc, NULL, 0);
- /* ack & clear scsi error condition cause by reset */
- if (CRSW & M_CRSW_ER) {
- CRB_CLR_DONE;
- vs_write(2, sh_RET_IOPB + IOPB_STATUS, 0);
- break;
- }
- CRB_CLR_DONE;
- }
- }
-
- thaw_all_queues(sc);
-
- splx(s);
-}
-
-/* free a cb and thaw its queue; invoked at splbio */
-static __inline__ void
-vs_free(struct vs_softc *sc, struct vs_cb *cb)
-{
- if (cb->cb_q != 0)
- thaw_queue(sc, cb->cb_q);
- cb->cb_xs = NULL;
-}
-
-/* normal interrupt routine */
-int
-vs_nintr(void *vsc)
-{
- struct vs_softc *sc = (struct vs_softc *)vsc;
- struct vs_cb *cb;
- int s;
-
-#if 0 /* bogus! */
- if ((CRSW & CONTROLLER_ERROR) == CONTROLLER_ERROR)
- return vs_eintr(sc);
-#endif
-
- /* Got a valid interrupt on this device */
- s = splbio();
- cb = (struct vs_cb *)crb_read(4, CRB_CTAG);
-
- /*
- * If this is a controller error, there won't be a cb
- * pointer in the CTAG field. Bad things happen if you try
- * to point to address 0. But then, we should have caught
- * the controller error above.
- */
- if (cb != NULL) {
-#ifdef VS_DEBUG
- printf("%s: interrupt for queue %d\n", __func__, cb->cb_q);
-#endif
- vs_scsidone(sc, cb);
- } else {
-#ifdef VS_DEBUG
- printf("%s: normal interrupt but no related command???\n",
- __func__);
-#endif
- }
-
- /* ack the interrupt */
- if (CRSW & M_CRSW_ER)
- CRB_CLR_ER;
- CRB_CLR_DONE;
-
- vs_clear_return_info(sc);
- splx(s);
-
- return 1;
-}
-
-/* error interrupts */
-int
-vs_eintr(void *vsc)
-{
- struct vs_softc *sc = (struct vs_softc *)vsc;
- struct vs_cb *cb;
- struct scsi_xfer *xs;
- int crsw, ecode;
- int s;
-
- /* Got a valid interrupt on this device */
- s = splbio();
-
- crsw = vs_read(2, sh_CEVSB + CEVSB_CRSW);
- ecode = vs_read(1, sh_CEVSB + CEVSB_ERROR);
- cb = (struct vs_cb *)crb_read(4, CRB_CTAG);
- xs = cb != NULL ? cb->cb_xs : NULL;
-
-#ifdef VS_DEBUG
- printf("%s: error interrupt, crsw %04x, error %d, queue %d\n",
- __func__, (u_int)crsw, ecode, cb ? cb->cb_q : -1);
-#endif
- vs_print_addr(sc, xs);
-
- if (crsw & M_CRSW_RST) {
- printf("bus reset\n");
- } else {
- switch (ecode) {
- case CEVSB_ERR_TYPE:
- printf("IOPB type error\n");
- break;
- case CEVSB_ERR_TO:
- printf("timeout\n");
- break;
- case CEVSB_ERR_TR:
- printf("reconnect error\n");
- break;
- case CEVSB_ERR_OF:
- printf("overflow\n");
- break;
- case CEVSB_ERR_BD:
- printf("bad direction\n");
- break;
- case CEVSB_ERR_NR:
- printf("non-recoverable error\n");
- break;
- case CEVSB_ERR_PANIC:
- printf("board panic\n");
- break;
- default:
- printf("unexpected error %x\n", ecode);
- break;
- }
- }
-
- if (xs != NULL) {
- xs->error = XS_SELTIMEOUT;
- xs->status = -1;
- scsi_done(xs);
- }
-
- if (CRSW & M_CRSW_ER)
- CRB_CLR_ER;
- CRB_CLR_DONE;
-
- thaw_all_queues(sc);
- vs_clear_return_info(sc);
- splx(s);
-
- return 1;
-}
-
-static void
-vs_clear_return_info(struct vs_softc *sc)
-{
- vs_bzero(sh_RET_IOPB, CRB_SIZE + IOPB_LONG_SIZE);
-}
-
-/*
- * Choose the first available work queue (invoked at splbio).
- * We used a simple round-robin mechanism which is faster than rescanning
- * from the beginning if we have more than one target on the bus.
- */
-struct vs_cb *
-vs_find_queue(struct scsi_link *sl, struct vs_softc *sc)
-{
- struct vs_cb *cb;
- u_int q;
-
- /*
- * Map the target number (0-7/15) to the 1-7/15 range, target 0
- * picks the host adapter target number (since host adapter
- * commands are issued on queue #0).
- */
- q = sl->target;
- if (q == 0)
- q = sl->adapter_target;
- if (sl->flags & SDEV_2NDBUS)
- q += sc->sc_channel[0].vc_width - 1; /* map to 8-14 or 16-30 */
-
- if ((cb = sc->sc_cb + q)->cb_xs == NULL)
- return (cb);
-
- return (NULL);
-}
-
-/*
- * Encode a specific target.
- */
-int
-vs_unit_value(int bus, int tgt, int lun)
-{
- int unit = 0;
-
- if (bus != 0)
- unit |= M_UNIT_BUS; /* secondary bus */
-
- if (tgt > 7 || lun > 7) {
- /* extended addressing (for Cougar II-Wide only) */
- unit |= M_UNIT_EXT;
- unit |= (lun & 0x3f) << 8;
- unit |= (tgt & 0x0f) << 0;
- } else {
- unit |= lun << 3;
- unit |= tgt << 0;
- }
-
- return (unit);
-}
-
-/*
- * Build the scatter/gather list for the given control block and update
- * its IOPB.
- */
-void
-vs_build_sg_list(struct vs_softc *sc, struct vs_cb *cb, bus_addr_t iopb)
-{
- struct vs_sg_entry *sgentry;
- int segno;
- bus_dma_segment_t *seg = cb->cb_dmamap->dm_segs;
- bus_size_t sgoffs;
- bus_size_t len;
-
- /*
- * No need to build a scatter/gather chain if there is only
- * one contiguous physical area.
- */
- if (cb->cb_dmamap->dm_nsegs == 1) {
- vs_write(4, iopb + IOPB_BUFF, seg->ds_addr);
- vs_write(4, iopb + IOPB_LENGTH, cb->cb_dmalen);
- return;
- }
-
- /*
- * Otherwise, we need to build the flat s/g list.
- */
-
- sgentry = sc->sc_sgva + cb->cb_q * MAX_SG_ELEMENTS;
- sgoffs = (vaddr_t)sgentry - (vaddr_t)sc->sc_sgva;
-
- len = cb->cb_dmalen;
- for (segno = 0; segno < cb->cb_dmamap->dm_nsegs; seg++, segno++) {
- if (seg->ds_len > len) {
- sgentry->count.bytes = htobe16(len);
- len = 0;
- } else {
- sgentry->count.bytes = htobe16(seg->ds_len);
- len -= seg->ds_len;
- }
- sgentry->pa_high = htobe16(seg->ds_addr >> 16);
- sgentry->pa_low = htobe16(seg->ds_addr & 0xffff);
- sgentry->addr = htobe16(ADDR_MOD);
- sgentry++;
- }
-
- bus_dmamap_sync(sc->sc_dmat, sc->sc_sgmap, sgoffs,
- cb->cb_dmamap->dm_nsegs * sizeof(struct vs_sg_entry),
- BUS_DMASYNC_PREWRITE);
-
- vs_write(2, iopb + IOPB_OPTION,
- vs_read(2, iopb + IOPB_OPTION) | M_OPT_SG);
- vs_write(2, iopb + IOPB_ADDR,
- vs_read(2, iopb + IOPB_ADDR) | M_ADR_SG_LINK);
- vs_write(4, iopb + IOPB_BUFF,
- sc->sc_sgmap->dm_segs[0].ds_addr + sgoffs);
- vs_write(4, iopb + IOPB_LENGTH, cb->cb_dmamap->dm_nsegs);
- vs_write(4, iopb + IOPB_SGTTL, cb->cb_dmalen);
-}
diff --git a/sys/arch/mvme88k/dev/vsbic.c b/sys/arch/mvme88k/dev/vsbic.c
deleted file mode 100644
index e9b8826cff0..00000000000
--- a/sys/arch/mvme88k/dev/vsbic.c
+++ /dev/null
@@ -1,1626 +0,0 @@
-/* $OpenBSD: vsbic.c,v 1.9 2011/07/17 22:46:47 matthew Exp $ */
-
-/*
- * Copyright (c) 2008, 2009 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies. And
- * I won't mind if you keep the disclaimer below.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * MVME327A SCSI and floppy controller driver
- *
- * This driver is currently limited to the SCSI part of the board, which
- * is messy enough already.
- */
-
-/* This card lives in an A24/D16 world, but is A32/D32 capable */
-#define __BUS_SPACE_RESTRICT_D16__
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/buf.h>
-#include <sys/malloc.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/autoconf.h>
-#include <machine/bus.h>
-#include <machine/cpu.h>
-
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-#include <scsi/scsi_message.h>
-
-#include <mvme88k/dev/vme.h>
-#include <mvme88k/dev/bppvar.h>
-
-/*
- * Channel packet structure
- */
-
-struct vsbic_pkt {
- /* Command fields, read by firmware */
- uint8_t cmd_cmd;
- uint8_t cmd_cmd_ctrl;
- uint8_t cmd_device;
-#define VSBIC_DEVICE_FLOPPY 0x01
-#define VSBIC_DEVICE_SCSI 0x05
-#define VSBIC_DEVICE_HOST 0x0f
- uint8_t cmd_unit;
-#define VSBIC_UNIT(tgt,lun) (((tgt) << 4) | (lun))
- uint16_t reserved;
- uint8_t cmd_addrmod;
- uint8_t cmd_buswidth;
- uint32_t cmd_addr1;
- uint32_t cmd_addr2;
-#define cmd_link cmd_addr2 /* used for free pkt linking */
- uint32_t cmd_xfer_count;
- uint16_t cmd_sg_count;
- uint16_t cmd_parm1;
- uint16_t cmd_parm2;
- uint16_t cmd_parm3;
-
- /* Status fields, written by firmware */
- uint8_t sts_error;
- uint8_t sts_recovered; /* error recovered by fw */
- uint16_t sts_status;
-#define sts_sense sts_status
- uint8_t sts_retries; /* # of retries performed */
- uint8_t reserved2;
- uint16_t sts_addr_high; /* not aligned... */
- uint16_t sts_addr_low;
- uint16_t sts_xfer_high; /* not aligned... */
- uint16_t sts_xfer_low;
- uint16_t sts_parm1;
- uint16_t sts_parm2;
- uint16_t sts_parm3;
- /* total size 0x30 bytes */
-};
-
-/*
- * Command values (cmd_cmd)
- */
-
-#define CMD_BPP_TEST 0x00
-#define CMD_READ 0x01
-#define CMD_WRITE 0x02
-#define CMD_READ_DESCRIPTOR 0x03
-#define CMD_WRITE_DESCRIPTOR 0x04
-#define CMD_FORMAT 0x05
-#define CMD_FIX_BAD_SPOT 0x06
-#define CMD_INQUIRY 0x09
-#define CMD_READ_STATUS 0x10
-#define CMD_LOAD_UNLOAD_RETENSION 0x11
-#define CMD_WRITE_FILEMARK 0x12
-#define CMD_REWIND 0x13
-#define CMD_ERASE 0x14
-#define CMD_SPACE 0x15
-#define CMD_ENABLE_TARGET 0x20
-#define CMD_DISABLE_TARGET 0x21
-#define CMD_RESERVE_UNIT 0x22
-#define CMD_RELEASE_UNIT 0x23
-#define CMD_RESET 0x25
-#define CMD_SCSI 0x26
-#define CMD_SELF_TEST 0x27
-#define CMD_TARGET_WAIT 0x28
-#define CMD_TARGET_EXECUTE 0x29
-#define CMD_DOWNLOAD 0x2a
-#define CMD_SET_SCSI_ADDRESS 0x2b
-#define CMD_OPEN 0x2d
-
-/*
- * Error values (sts_error, sts_status)
- */
-
-#define ERR_OK 0x00
-/* command parameter errors */
-#define ERR_BAD_DESCRIPTOR 0x01
-#define ERR_BAD_COMMAND 0x02
-#define ERR_UNIMPLEMENTED_COMMAND 0x03
-#define ERR_BAD_DRIVE 0x04
-#define ERR_BAD_LOGICAL_ADDRESS 0x05
-#define ERR_BAD_SG_TABLE 0x06
-#define ERR_UNIMPLEMENTED_DEVICE 0x07
-#define ERR_UNIT_NOT_INITIALIZED 0x08
-/* media errors */
-#define ERR_NO_ID 0x10
-#define ERR_SEEK 0x11
-#define ERR_RELOCATED_TRACK 0x12
-#define ERR_BAD_ID 0x13
-#define ERR_DATA_SYNC_FAULT 0x14
-#define ERR_ECC 0x15
-#define ERR_RECORD_NOT_FOUND 0x16
-#define ERR_MEDIA 0x17
-/* drive errors */
-#define ERR_DRIVE_FAULT 0x20
-#define ERR_WRITE_PROTECTED_MEDIA 0x21
-#define ERR_MOTOR_OFF 0x22
-#define ERR_DOOR_OPEN 0x23
-#define ERR_DRIVE_NOT_READY 0x24
-#define ERR_DRIVE_BUSY 0x25
-/* VME DMA errors */
-#define ERR_BUS 0x30
-#define ERR_ALIGNMENT 0x31
-#define ERR_BUS_TIMEOUT 0x32
-#define ERR_INVALID_XFER_COUNT 0x33
-/* disk format error */
-#define ERR_NOT_ENOUGH_ALTERNATES 0x40
-#define ERR_FORMAT_FAILED 0x41
-#define ERR_VERIFY 0x42
-#define ERR_BAD_FORMAT_PARAMETERS 0x43
-#define ERR_CANNOT_FIX_BAD_SPOT 0x44
-#define ERR_TOO_MANY_DEFECTS 0x45
-/* MVME327A specific errors */
-#define ERR_SCSI 0x80 /* additional status available*/
-#define ERR_INDETERMINATE_MEDIA 0x81 /* no additional status */
-#define ERR_INDETERMINATE_HARDWARE 0x82
-#define ERR_BLANK_CHECK 0x83
-#define ERR_INCOMPLETE_EXTENDED_MESSAGE 0x84
-#define ERR_INVALID_RESELECTION 0x85
-#define ERR_NO_STATUS_RETURNED 0x86
-#define ERR_MESSAGE_OUT_NOT_TRANSFERRED 0x87
-#define ERR_MESSAGE_IN_NOT_RECEIVED 0x88
-#define ERR_INCOMPLETE_DATA_READ 0x89
-#define ERR_INCOMPLETE_DATA_WRITE 0x8a
-#define ERR_INCORRECT_CDB_SIZE 0x8b
-#define ERR_UNDEFINED_SCSI_PHASE 0x8c
-#define ERR_SELECT_TIMEOUT 0x8d
-#define ERR_BUS_RESET 0x8e
-#define ERR_INVALID_MESSAGE_RECEIVED 0x8f
-#define ERR_COMMAND_NOT_RECEIVED 0x90
-#define ERR_UNEXPECTED_STATUS_PHASE 0x91
-#define ERR_SCSI_SCRIPT_MISMATCH 0x92
-#define ERR_UNEXPECTED_DISCONNECT 0x93
-#define ERR_REQUEST_SENSE_FAILED 0x94
-#define ERR_NO_WRITE_DESCRIPTOR 0x95
-#define ERR_INCOMPLETE_DATA_TRANSFER 0x96
-#define ERR_OUT_OF_LOCAL_RESOURCES 0x97
-#define ERR_LOCAL_MEMORY_RESOURCES_LOST 0x98
-#define ERR_CHANNEL_RESERVED 0x99
-#define ERR_DEVICE_RESERVED 0x9a
-#define ERR_ALREADY_ENABLED 0x9b
-#define ERR_TARGET_NOT_ENABLED 0x9c
-#define ERR_UNSUPPORTED_CONTROLLER_TYPE 0x9d
-#define ERR_UNSUPPORTED_DEVICE_TYPE 0x9e
-#define ERR_BLOCK_SIZE_MISMATCH 0x9f
-#define ERR_INVALID_CYL_IN_DEFECT_LIST 0xa0
-#define ERR_INVALID_HEAD_IN_DEFECT_LIST 0xa1
-#define ERR_BLOCK_SIZE_MISMATCH_NF 0xa2 /* non fatal */
-#define ERR_SCSI_ID_UNCHANGED 0xa3
-#define ERR_SCSI_ID_CHANGED 0xa4
-#define ERR_NO_TARGET_ENABLE 0xa5
-#define ERR_CANNOT_DO_D32 0xa6
-#define ERR_CANNOT_DO_DMA 0xa7
-#define ERR_INVALID_BLOCK_SIZE 0xa8
-#define ERR_SPT_MISMATCH 0xa9
-#define ERR_HEAD_MISMATCH 0xaa
-#define ERR_CYL_MISMATCH 0xab
-#define ERR_INVALID_FLOPPY_PARAMETERS 0xac
-#define ERR_ALREADY_RESERVED 0xad
-#define ERR_WAS_NOT_RESERVED 0xae
-#define ERR_INVALID_SECTOR_NUMBER 0xaf
-#define ERR_SELFTEST_FAILED 0xcc
-
-/*
- * SCSI specific command packet
- */
-
-struct vsbic_scsi {
- uint32_t link;
- uint16_t ctrl;
-#define SCSI_CTRL_DMA 0x8000 /* allow DMA operation */
-#define SCSI_CTRL_SYNC 0x4000 /* synchronous phase */
-#define SCSI_CTRL_PAR 0x2000 /* enable parity checking */
-#define SCSI_CTRL_SCHK 0x1000 /* manual status checking */
-#define SCSI_CTRL_D32 0x0800 /* use D32 mode for data transfer */
-#define SCSI_CTRL_BYTESWAP 0x0400 /* byteswap D16 words */
-#define SCSI_CTRL_SG 0x0200 /* use scatter/gather transfer list */
-#define SCSI_CTRL_LINK 0x0100 /* linked scsi command */
-#define SCSI_CTRL_NO_ATN 0x0080 /* do not assert ATN during select */
- uint8_t cmdlen;
- uint8_t reserved;
- uint8_t cdb[12];
- uint32_t datalen;
- uint32_t dataptr;
- uint8_t status;
- uint8_t initiator;
- uint8_t msgin_flag;
- uint8_t msgout_flag;
-#define SCSI_MSG_INTERNAL 0x00 /* bytes in structure */
-#define SCSI_MSG_EXTERNAL 0xff /* bytes pointed to by ptr */
- uint16_t msgin_len;
- uint16_t msgin_ptr_high; /* not aligned... */
- uint16_t msgin_ptr_low;
- uint8_t msgin[6];
- uint16_t msgout_len;
- uint16_t msgout_ptr_high; /* not aligned... */
- uint16_t msgout_ptr_low;
- uint8_t msgout[6];
- uint8_t script[8]; /* script phases */
-#define SCRIPT_DATA_OUT 0x00
-#define SCRIPT_DATA_IN 0x01
-#define SCRIPT_COMMAND 0x02
-#define SCRIPT_STATUS 0x03
-#define SCRIPT_MSG_OUT 0x06
-#define SCRIPT_MSG_IN 0x07
-#define SCRIPT_END 0x08
-#define SCRIPT_END_LINKED 0x09
- /* total size 0x40 bytes */
-};
-
-/*
- * Scatter/gather list element
- */
-
-struct vsbic_sg {
- uint32_t addr;
- uint32_t size;
-};
-
-#define VSBIC_MAXSG (MAXPHYS / PAGE_SIZE)
-
-/*
- * Complete SCSI command structure: packet, SCSI specific structure, S/G list.
- * Nothing needs them to be contiguous but it will make our life simpler
- * this way.
- */
-struct vsbic_cmd {
- struct vsbic_pkt pkt;
- struct vsbic_scsi scsi;
- struct vsbic_sg sg[VSBIC_MAXSG];
-};
-
-/*
- * The host firmware addresses the VME bus with A23 set to 1, and uses
- * an extension address register to provide the top 9 bits of the A32
- * address. We thus need to make sure that none of the structures we
- * share with the firmware cross a 8MB boundary.
- */
-
-#define VSBIC_MEM_BOUNDARY (1 << 23)
-
-/*
- * A note on resource usage:
- *
- * - this driver uses 9 channels; one per SCSI target, one for polled
- * commands (which does not cause interrupts); and a 9th one to issue
- * reset commands when necessary, with a higher priority than the other
- * channels.
- *
- * - for each target channel, there numopenings commands (packet, scsi
- * specific packet and s/g list) allocated.
- * - for the polling channel, there is only one command.
- * - for the reset channel, there is one command (packet) per target.
- *
- * - for each channel, there are as many envelopes as possible commands
- * on the channel, plus two (one NULL envelope per pipe) per channel.
- */
-
-#define VSBIC_NUMOPENINGS 2
-#define VSBIC_NTARGETS 7
-#define VSBIC_NCHANNELS (VSBIC_NTARGETS + 2)
-
-#define VSBIC_TARGET_CHANNEL(sc,tgt) (tgt) /* 0..7 */
-#define VSBIC_RESET_CHANNEL(sc) (sc->sc_id) /* within 0..7 */
-#define VSBIC_POLLING_CHANNEL(sc) (8)
-
-#define VSBIC_NPACKETS \
- ((VSBIC_NTARGETS * VSBIC_NUMOPENINGS) + VSBIC_NTARGETS + 1)
-#define VSBIC_NENVELOPES (VSBIC_NPACKETS + 2 * VSBIC_NCHANNELS)
-
-#define VSBIC_NCCBS (VSBIC_NTARGETS * VSBIC_NUMOPENINGS)
-
-/*
- * Per command information
- */
-struct vsbic_ccb {
- struct vsbic_ccb *ccb_next;
- struct vsbic_cmd *ccb_cmd; /* associated command */
-
- struct scsi_xfer *ccb_xs; /* associated request */
-
- int ccb_xsflags; /* copy of ccb_xs->flags */
- int ccb_flags;
-#define CCBF_SENSE 0x01 /* request sense sent */
-
- bus_dmamap_t ccb_dmamap; /* DMA map for data transfer */
- bus_size_t ccb_dmalen;
-};
-
-struct vsbic_softc {
- struct bpp_softc sc_bpp;
- bus_dma_tag_t sc_dmat;
-
- struct scsi_link sc_link;
- uint sc_id; /* host adapter ID */
-
- int sc_vec; /* interrupt vector */
- int sc_ipl; /* interrupt level */
- struct intrhand sc_ih;
-
- bus_dmamap_t sc_chanmap; /* channel pool */
- bus_dma_segment_t sc_chanseg;
-#define sc_chanpa sc_chanseg.ds_addr
- vaddr_t sc_chanva;
-
- bus_dmamap_t sc_envmap; /* envelope pool */
- bus_dma_segment_t sc_envseg;
-#define sc_envpa sc_envseg.ds_addr
- vaddr_t sc_envva;
-
- bus_dmamap_t sc_cmdmap; /* packet pool */
- bus_dma_segment_t sc_cmdseg;
-#define sc_cmdpa sc_cmdseg.ds_addr
- vaddr_t sc_cmdva;
-
- struct vsbic_cmd *sc_cmd_free; /* head of free cmd list */
- struct vsbic_ccb *sc_ccb_free; /* head of free ccb list */
- struct vsbic_ccb *sc_ccb_active; /* head of active ccb list */
-
- /* bpp channel array */
- struct bpp_chan sc_chan[VSBIC_NCHANNELS];
-};
-
-#define DEVNAME(sc) ((sc)->sc_bpp.sc_dev.dv_xname)
-
-void vsbic_activate_ccb(struct vsbic_softc *, struct vsbic_ccb *,
- struct vsbic_cmd *);
-int vsbic_alloc_physical(struct vsbic_softc *, bus_dmamap_t *,
- bus_dma_segment_t *, vaddr_t *, bus_size_t, const char *);
-void vsbic_attach(struct device *, struct device *, void *);
-int vsbic_channel_intr(struct vsbic_softc *, struct bpp_chan *);
-paddr_t vsbic_chan_pa(struct bpp_softc *, struct bpp_channel *);
-void vsbic_chan_sync(struct bpp_softc *, struct bpp_channel *, int);
-struct vsbic_ccb *
- vsbic_cmd_ccb(struct vsbic_softc *, struct vsbic_cmd *);
-int vsbic_create_ccbs(struct vsbic_softc *, uint);
-int vsbic_create_channels(struct vsbic_softc *, uint);
-int vsbic_create_cmds(struct vsbic_softc *, uint);
-struct vsbic_cmd *
- vsbic_dequeue_cmd(struct vsbic_softc *, struct bpp_chan *);
-paddr_t vsbic_env_pa(struct bpp_softc *, struct bpp_envelope *);
-void vsbic_env_sync(struct bpp_softc *, struct bpp_envelope *, int);
-struct bpp_envelope *
- vsbic_env_va(struct bpp_softc *, paddr_t);
-void vsbic_free_ccb(struct vsbic_softc *, struct vsbic_ccb *);
-struct vsbic_ccb *
- vsbic_get_ccb(struct vsbic_softc *);
-struct vsbic_cmd *
- vsbic_get_cmd(struct vsbic_softc *);
-int vsbic_intr(void *);
-int vsbic_load_command(struct vsbic_softc *, struct vsbic_ccb *,
- struct vsbic_cmd *, struct scsi_link *, struct scsi_generic *, int,
- uint8_t *, int);
-int vsbic_match(struct device *, void *, void *);
-void vsbic_poll(struct vsbic_softc *, struct vsbic_ccb *);
-void vsbic_put_cmd(struct vsbic_softc *, struct vsbic_cmd *);
-void vsbic_queue_cmd(struct vsbic_softc *, struct bpp_chan *,
- struct bpp_envelope *, struct vsbic_cmd *);
-int vsbic_request_sense(struct vsbic_softc *, struct vsbic_ccb *);
-void vsbic_reset_command(struct vsbic_softc *, struct vsbic_cmd *,
- struct scsi_link *);
-void vsbic_scsicmd(struct scsi_xfer *);
-int vsbic_scsireset(struct vsbic_softc *, struct scsi_xfer *);
-void vsbic_timeout(void *);
-void vsbic_wrapup(struct vsbic_softc *, struct vsbic_ccb *);
-
-const struct cfattach vsbic_ca = {
- sizeof(struct vsbic_softc), vsbic_match, vsbic_attach
-};
-
-struct cfdriver vsbic_cd = {
- NULL, "vsbic", DV_DULL
-};
-
-struct scsi_adapter vsbic_swtch = {
- vsbic_scsicmd,
- scsi_minphys
-};
-
-#define MVME327_CSR_ID 0xff
-#define MVME327_CSR_SIZE 0x100
-
-int
-vsbic_match(struct device *device, void *cf, void *args)
-{
- struct confargs *ca = args;
- bus_space_tag_t iot = ca->ca_iot;
- bus_space_handle_t ioh;
- int rc;
- uint8_t id;
-
- if (bus_space_map(iot, ca->ca_paddr, MVME327_CSR_SIZE, 0, &ioh) != 0)
- return 0;
-
- rc = badaddr((vaddr_t)bus_space_vaddr(iot, ioh) + MVME327_CSR_ID, 1);
- if (rc == 0) {
- /* Check the SCSI ID is sane */
- id = bus_space_read_1(iot, ioh, MVME327_CSR_ID);
- if (id & ~0x07)
- rc = 1;
- }
- bus_space_unmap(iot, ioh, MVME327_CSR_SIZE);
-
- return (rc == 0);
-}
-
-void
-vsbic_attach(struct device *parent, struct device *self, void *args)
-{
- struct confargs *ca = args;
- struct vsbic_softc *sc = (struct vsbic_softc *)self;
- struct bpp_softc *bsc = &sc->sc_bpp;
- struct scsibus_attach_args saa;
- bus_space_handle_t ioh;
- int tmp;
-
- if (ca->ca_ipl < IPL_BIO)
- ca->ca_ipl = IPL_BIO;
-
- printf("\n");
-
- if (bus_space_map(ca->ca_iot, ca->ca_paddr, MVME327_CSR_SIZE,
- BUS_SPACE_MAP_LINEAR, &ioh) != 0) {
- printf("%s: can't map registers!\n", DEVNAME(sc));
- return;
- }
-
- bpp_attach(bsc, ca->ca_iot, ioh);
- sc->sc_ipl = ca->ca_ipl;
- sc->sc_vec = ca->ca_vec;
- sc->sc_dmat = ca->ca_dmat;
-
- /*
- * Setup envelope and channel memory utility functions.
- *
- * Since the MVME327 shares no memory with the host cpu, all the
- * resources will be allocated in physical memory, and will need
- * explicit cache operations.
- */
- bsc->bpp_chan_pa = vsbic_chan_pa;
- bsc->bpp_chan_sync = vsbic_chan_sync;
- bsc->bpp_env_pa = vsbic_env_pa;
- bsc->bpp_env_va = vsbic_env_va;
- bsc->bpp_env_sync = vsbic_env_sync;
-
- sc->sc_id = bus_space_read_1(bsc->sc_iot, bsc->sc_ioh, MVME327_CSR_ID);
-
- if (bpp_reset(bsc) != 0) {
- printf("%s: reset failed\n", DEVNAME(sc));
- return;
- }
-
- sc->sc_ih.ih_fn = vsbic_intr;
- sc->sc_ih.ih_arg = sc;
- sc->sc_ih.ih_wantframe = 0;
- sc->sc_ih.ih_ipl = ca->ca_ipl;
-
- /*
- * Allocate memory for the channel headers, envelopes and packets.
- */
-
- if (vsbic_alloc_physical(sc, &sc->sc_envmap, &sc->sc_envseg,
- &sc->sc_envva, VSBIC_NENVELOPES * sizeof(struct bpp_envelope),
- "envelope") != 0)
- return;
-
- bpp_initialize_envelopes(bsc, (struct bpp_envelope *)sc->sc_envva,
- VSBIC_NENVELOPES);
-
- if (vsbic_create_cmds(sc, VSBIC_NPACKETS) != STATUS_OK) {
- /* XXX free resources */
- return;
- }
-
- if (vsbic_create_ccbs(sc, VSBIC_NCCBS) != 0) {
- /* XXX free resources */
- return;
- }
-
- if (vsbic_create_channels(sc, VSBIC_NCHANNELS) != STATUS_OK) {
- /* XXX free resources */
- return;
- }
-
- vmeintr_establish(sc->sc_vec, &sc->sc_ih, DEVNAME(sc));
-
- sc->sc_link.adapter = &vsbic_swtch;
- sc->sc_link.adapter_buswidth = 8;
- sc->sc_link.adapter_softc = sc;
- sc->sc_link.adapter_target = sc->sc_id;
- sc->sc_link.openings = VSBIC_NUMOPENINGS;
-
- bzero(&saa, sizeof saa);
- saa.saa_sc_link = &sc->sc_link;
-
- tmp = bootpart;
- if (ca->ca_paddr != bootaddr)
- bootpart = -1;
- config_found(self, &saa, scsiprint);
- bootpart = tmp;
-}
-
-/*
- * Various simple routines to get the addresses of the various structures
- * shared with the MVME327, as well as to copyback caches.
- */
-
-paddr_t
-vsbic_chan_pa(struct bpp_softc *bsc, struct bpp_channel *va)
-{
- struct vsbic_softc *sc = (struct vsbic_softc *)bsc;
- paddr_t pa = sc->sc_chanpa + ((vaddr_t)va - sc->sc_chanva);
-
-#ifdef VSBIC_DEBUG
- printf("chan: va %p -> pa %p\n", va, pa);
-#endif
-
- return pa;
-}
-
-void
-vsbic_chan_sync(struct bpp_softc *bsc, struct bpp_channel *va, int fl)
-{
- struct vsbic_softc *sc = (struct vsbic_softc *)bsc;
-
- bus_dmamap_sync(sc->sc_dmat, sc->sc_chanmap,
- (vaddr_t)va - sc->sc_chanva, sizeof(struct bpp_channel), fl);
-}
-
-paddr_t
-vsbic_env_pa(struct bpp_softc *bsc, struct bpp_envelope *va)
-{
- struct vsbic_softc *sc = (struct vsbic_softc *)bsc;
- paddr_t pa = sc->sc_envpa + ((vaddr_t)va - sc->sc_envva);
-
-#ifdef VSBIC_DEBUG
- printf("env: va %p -> pa %p\n", va, pa);
-#endif
-
- return pa;
-}
-
-struct bpp_envelope *
-vsbic_env_va(struct bpp_softc *bsc, paddr_t pa)
-{
- struct vsbic_softc *sc = (struct vsbic_softc *)bsc;
- vaddr_t va = sc->sc_envva + (pa - sc->sc_envpa);
-
-#ifdef VSBIC_DEBUG
- printf("env: pa %p -> va %p\n", pa, va);
-#endif
-
- return (struct bpp_envelope *)va;
-}
-
-void
-vsbic_env_sync(struct bpp_softc *bsc, struct bpp_envelope *va, int fl)
-{
- struct vsbic_softc *sc = (struct vsbic_softc *)bsc;
-
- bus_dmamap_sync(sc->sc_dmat, sc->sc_envmap,
- (vaddr_t)va - sc->sc_envva, sizeof(struct bpp_envelope), fl);
-}
-
-static inline
-paddr_t vsbic_cmd_pa(struct vsbic_softc *sc, struct vsbic_cmd *va)
-{
- return sc->sc_cmdpa + ((vaddr_t)va - sc->sc_cmdva);
-}
-
-static inline
-struct vsbic_cmd *vsbic_cmd_va(struct vsbic_softc *sc, paddr_t pa)
-{
- return (struct vsbic_cmd *)(sc->sc_cmdva + (pa - sc->sc_cmdpa));
-}
-
-static inline
-void vsbic_cmd_sync(struct vsbic_softc *sc, struct vsbic_cmd *va, int fl)
-{
- bus_dmamap_sync(sc->sc_dmat, sc->sc_cmdmap,
- (vaddr_t)va - sc->sc_cmdva, sizeof(struct vsbic_cmd), fl);
-}
-
-/*
- * Allocate contiguous physical memory, not crossing 8 MB boundaries.
- */
-int
-vsbic_alloc_physical(struct vsbic_softc *sc, bus_dmamap_t *dmamap,
- bus_dma_segment_t *dmaseg, vaddr_t *va, bus_size_t len, const char *what)
-{
- int nseg;
- int rc;
-
- len = round_page(len);
-
- rc = bus_dmamem_alloc(sc->sc_dmat, len, 0, 0, dmaseg, 1, &nseg,
- BUS_DMA_NOWAIT);
- if (rc != 0) {
- printf("%s: unable to allocate %s memory: error %d\n",
- DEVNAME(sc), what, rc);
- goto fail1;
- }
-
- rc = bus_dmamem_map(sc->sc_dmat, dmaseg, nseg, len,
- (caddr_t *)va, BUS_DMA_NOWAIT | BUS_DMA_COHERENT);
- if (rc != 0) {
- printf("%s: unable to map %s memory: error %d\n",
- DEVNAME(sc), what, rc);
- goto fail2;
- }
-
- rc = bus_dmamap_create(sc->sc_dmat, len, 1, len, VSBIC_MEM_BOUNDARY,
- BUS_DMA_NOWAIT /* | BUS_DMA_ALLOCNOW */, dmamap);
- if (rc != 0) {
- printf("%s: unable to create %s dma map: error %d\n",
- DEVNAME(sc), what, rc);
- goto fail3;
- }
-
- rc = bus_dmamap_load(sc->sc_dmat, *dmamap, (void *)*va, len, NULL,
- BUS_DMA_NOWAIT);
- if (rc != 0) {
- printf("%s: unable to load %s dma map: error %d\n",
- DEVNAME(sc), what, rc);
- goto fail4;
- }
-
- return 0;
-
-fail4:
- bus_dmamap_destroy(sc->sc_dmat, *dmamap);
-fail3:
- bus_dmamem_unmap(sc->sc_dmat, (caddr_t)*va, PAGE_SIZE);
-fail2:
- bus_dmamem_free(sc->sc_dmat, dmaseg, 1);
-fail1:
- return rc;
-}
-
-/*
- * CSR operations
- */
-
-int
-vsbic_create_channels(struct vsbic_softc *sc, uint cnt)
-{
- struct bpp_softc *bsc = &sc->sc_bpp;
- struct bpp_chan *chan;
- struct bpp_channel *channel;
- int priority, ipl, vec;
- uint i;
- int rc;
-
- rc = vsbic_alloc_physical(sc, &sc->sc_chanmap, &sc->sc_chanseg,
- &sc->sc_chanva, cnt * sizeof(struct bpp_channel), "channel");
- if (rc != 0)
- return STATUS_ERRNO + rc;
-
- chan = sc->sc_chan;
- channel = (struct bpp_channel *)sc->sc_chanva;
- for (i = 0; i < cnt; i++, chan++, channel++) {
- chan->ch = channel;
-
- if (i == VSBIC_RESET_CHANNEL(sc))
- priority = BPP_PRIORITY_HIGHEST + 0x20;
- else
- priority = BPP_PRIORITY_HIGHEST + 0x40;
- if (i == VSBIC_POLLING_CHANNEL(sc)) {
- ipl = 0;
- vec = 0;
- } else {
- ipl = sc->sc_ipl;
- vec = sc->sc_vec;
- }
- rc = bpp_create_channel(bsc, chan, priority, ipl, vec);
-
- if (rc != STATUS_OK) {
- printf("%s: error creating channel for target %d: %x\n",
- DEVNAME(sc), i, rc);
- return rc;
- }
- }
-
- return STATUS_OK;
-}
-
-/*
- * Command (packet) management
- */
-
-/*
- * Create a set of commands, and put them on a free list.
- */
-int
-vsbic_create_cmds(struct vsbic_softc *sc, uint cnt)
-{
- struct vsbic_cmd *cmd;
- int rc;
-
- rc = vsbic_alloc_physical(sc, &sc->sc_cmdmap, &sc->sc_cmdseg,
- &sc->sc_cmdva, cnt * sizeof(struct vsbic_cmd), "packet");
- if (rc != 0)
- return STATUS_ERRNO + rc;
-
- sc->sc_cmd_free = NULL;
- cmd = (struct vsbic_cmd *)sc->sc_cmdva;
- while (cnt-- != 0)
- vsbic_put_cmd(sc, cmd++);
-
- return STATUS_OK;
-}
-
-/*
- * Get a new command from the free list.
- */
-struct vsbic_cmd *
-vsbic_get_cmd(struct vsbic_softc *sc)
-{
- struct vsbic_cmd *cmd;
-
- cmd = sc->sc_cmd_free;
- if (cmd != NULL) {
- sc->sc_cmd_free = (struct vsbic_cmd *)cmd->pkt.cmd_link;
- memset(cmd, 0, sizeof(*cmd));
- }
-
- return cmd;
-}
-
-/*
- * Put a command into the free list.
- */
-void
-vsbic_put_cmd(struct vsbic_softc *sc, struct vsbic_cmd *cmd)
-{
- cmd->pkt.cmd_link = (uint32_t)sc->sc_cmd_free;
- sc->sc_cmd_free = cmd;
-}
-
-/*
- * Dequeue an envelope from the status pipe, and return the command it
- * was carrying. The envelope itself is returned to the free list.
- */
-struct vsbic_cmd *
-vsbic_dequeue_cmd(struct vsbic_softc *sc, struct bpp_chan *chan)
-{
- struct bpp_softc *bsc = &sc->sc_bpp;
- struct vsbic_cmd *cmd;
- paddr_t cmdpa;
-
- if (bpp_dequeue_envelope(bsc, chan, &cmdpa) != 0)
- return NULL;
-
- cmd = vsbic_cmd_va(sc, cmdpa);
- vsbic_cmd_sync(sc, cmd, BUS_DMASYNC_POSTREAD);
-
-#ifdef VSBIC_DEBUG
- printf("%s: %s() -> %p\n", DEVNAME(sc), __func__, cmd);
-#endif
- return cmd;
-}
-
-/*
- * Send a command packet.
- */
-void
-vsbic_queue_cmd(struct vsbic_softc *sc, struct bpp_chan *chan,
- struct bpp_envelope *tail, struct vsbic_cmd *cmd)
-{
- struct bpp_softc *bsc = &sc->sc_bpp;
- paddr_t cmdpa;
-
- vsbic_cmd_sync(sc, cmd, BUS_DMASYNC_PREWRITE);
- cmdpa = vsbic_cmd_pa(sc, cmd);
-
-#ifdef VSBIC_DEBUG
- printf("%s: %s(%p)\n", DEVNAME(sc), __func__, cmd);
-#endif
-
- bpp_queue_envelope(bsc, chan, tail, cmdpa);
-}
-
-/*
- * CCB management
- */
-
-/*
- * Create a set of ccb, and put them on a free list.
- */
-int
-vsbic_create_ccbs(struct vsbic_softc *sc, uint cnt)
-{
- struct vsbic_ccb *ccb;
- int rc;
-
- ccb = (struct vsbic_ccb *)malloc(cnt * sizeof(struct vsbic_ccb),
- M_DEVBUF, M_ZERO | M_NOWAIT);
- if (ccb == NULL) {
- printf("%s: unable to allocate CCB memory\n", DEVNAME(sc));
- return ENOMEM;
- }
-
- sc->sc_ccb_free = NULL;
- sc->sc_ccb_active = NULL;
- while (cnt-- != 0) {
- /*
- * Create a DMA map for data transfers.
- */
- rc = bus_dmamap_create(sc->sc_dmat, MAXPHYS, VSBIC_MAXSG,
- MAXPHYS, VSBIC_MEM_BOUNDARY,
- BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW, &ccb->ccb_dmamap);
- if (rc != 0) {
- printf("%s: unable to create CCB data dma map"
- ": error %d\n", DEVNAME(sc), rc);
- return rc;
- }
-
- vsbic_free_ccb(sc, ccb++);
- }
-
- return 0;
-}
-
-/*
- * Get a new ccb from the free list.
- */
-struct vsbic_ccb *
-vsbic_get_ccb(struct vsbic_softc *sc)
-{
- struct vsbic_ccb *ccb;
-
- ccb = sc->sc_ccb_free;
- if (ccb != NULL) {
- sc->sc_ccb_free = ccb->ccb_next;
- ccb->ccb_next = NULL;
- ccb->ccb_cmd = NULL;
- ccb->ccb_xs = NULL;
- ccb->ccb_flags = 0;
- }
-
- return ccb;
-}
-
-/*
- * Put a ccb into the free list.
- */
-void
-vsbic_free_ccb(struct vsbic_softc *sc, struct vsbic_ccb *ccb)
-{
- ccb->ccb_next = sc->sc_ccb_free;
- sc->sc_ccb_free = ccb;
-}
-
-/*
- * Retrieve the active ccb associated to a command, and remove it from
- * the active list.
- * Since there won't be many currently active commands, storing them
- * in a list is acceptable.
- */
-struct vsbic_ccb *
-vsbic_cmd_ccb(struct vsbic_softc *sc, struct vsbic_cmd *cmd)
-{
- struct vsbic_ccb *ccb, *prev;
-
- for (prev = NULL, ccb = sc->sc_ccb_active; ccb != NULL;
- prev = ccb, ccb = ccb->ccb_next) {
- if (ccb->ccb_cmd == cmd) {
- if (prev == NULL)
- sc->sc_ccb_active = ccb->ccb_next;
- else
- prev->ccb_next = ccb->ccb_next;
- break;
- }
- }
-
- return ccb;
-}
-
-/*
- * Put a ccb into the active list.
- */
-void
-vsbic_activate_ccb(struct vsbic_softc *sc, struct vsbic_ccb *ccb,
- struct vsbic_cmd *cmd)
-{
- struct vsbic_ccb *tmp;
-
- ccb->ccb_cmd = cmd;
-
- /* insert at end of list */
- if (sc->sc_ccb_active == NULL)
- sc->sc_ccb_active = ccb;
- else {
- for (tmp = sc->sc_ccb_active; tmp->ccb_next != NULL;
- tmp = tmp->ccb_next)
- ;
- tmp->ccb_next = ccb;
- }
-}
-
-/*
- * SCSI Layer Interface
- */
-
-/*
- * Setup a command packet according to the SCSI command to send
- */
-int
-vsbic_load_command(struct vsbic_softc *sc, struct vsbic_ccb *ccb,
- struct vsbic_cmd *c, struct scsi_link *sl, struct scsi_generic *cmd,
- int cmdlen, uint8_t *data, int datalen)
-{
- bus_dma_segment_t *seg;
- struct vsbic_sg *sgelem;
- int nsegs, segno;
- uint ctrl;
- uint8_t *msgout;
- uint8_t *script;
- int rc;
-
-#ifdef VSBIC_DEBUG
- printf("%s: command %02x len %d data %d tgt %d:%d\n",
- DEVNAME(sc), cmd->opcode, cmdlen, datalen,
- sl->target, sl->lun);
-#endif
-
- /*
- * Setup DMA map for data transfer.
- */
-
- if (ISSET(ccb->ccb_xsflags, SCSI_DATA_IN | SCSI_DATA_OUT)) {
- ccb->ccb_dmalen = (bus_size_t)datalen;
- rc = bus_dmamap_load(sc->sc_dmat, ccb->ccb_dmamap, data,
- ccb->ccb_dmalen, NULL, BUS_DMA_STREAMING |
- (ISSET(ccb->ccb_xsflags,SCSI_NOSLEEP) ?
- BUS_DMA_NOWAIT : BUS_DMA_WAITOK) |
- (ISSET(ccb->ccb_xsflags, SCSI_DATA_IN) ?
- BUS_DMA_READ : BUS_DMA_WRITE));
- if (rc != 0)
- return rc;
-
- bus_dmamap_sync(sc->sc_dmat, ccb->ccb_dmamap, 0,
- ccb->ccb_dmalen, ISSET(ccb->ccb_xsflags, SCSI_DATA_IN) ?
- BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
-
- nsegs = ccb->ccb_dmamap->dm_nsegs;
- } else
- nsegs = 0;
-
- /*
- * Setup command packet.
- */
-
- if (cmd->opcode == INQUIRY && nsegs == 1)
- c->pkt.cmd_cmd = CMD_INQUIRY;
- else
- c->pkt.cmd_cmd = CMD_SCSI;
- c->pkt.cmd_device = VSBIC_DEVICE_SCSI;
- c->pkt.cmd_unit = VSBIC_UNIT(sl->target, sl->lun);
- c->pkt.cmd_addrmod = ADRM_EXT_S_D;
- c->pkt.cmd_buswidth = MEMT_D32;
-
- if (c->pkt.cmd_cmd == CMD_INQUIRY) {
- c->pkt.cmd_cmd_ctrl = 0;
- seg = ccb->ccb_dmamap->dm_segs;
- c->pkt.cmd_addr2 = htobe32(seg->ds_addr);
- c->pkt.cmd_sg_count = 0;
- c->pkt.cmd_parm2 = htobe16(datalen >> 16);
- c->pkt.cmd_parm3 = htobe16(datalen & 0xffff);
- } else {
- c->pkt.cmd_addr1 = htobe32(vsbic_cmd_pa(sc, c) +
- offsetof(struct vsbic_cmd, scsi));
-
- /*
- * Setup SCSI specific packet.
- */
-
- ctrl = SCSI_CTRL_PAR | SCSI_CTRL_SCHK;
- if (nsegs != 0) {
- ctrl |= SCSI_CTRL_D32;
- /* manual recommands PIO for small transfers */
- if (datalen > 0x100)
- ctrl |= SCSI_CTRL_DMA;
- }
- if (cmd->opcode == REQUEST_SENSE)
- ctrl |= SCSI_CTRL_NO_ATN;
- c->scsi.cmdlen = cmdlen;
- memcpy(c->scsi.cdb, cmd, cmdlen);
- c->scsi.datalen = htobe32(datalen);
- c->scsi.msgin_flag = SCSI_MSG_INTERNAL;
- c->scsi.msgout_flag = SCSI_MSG_INTERNAL;
-
- /*
- * Setup scatter/gather information.
- */
-
- if (nsegs != 0) {
- seg = ccb->ccb_dmamap->dm_segs;
- if (nsegs == 1) {
- c->scsi.dataptr = htobe32(seg->ds_addr);
- } else {
- sgelem = c->sg;
- ctrl |= SCSI_CTRL_SG;
- for (segno = 0; segno < nsegs; seg++, segno++) {
- sgelem->addr = htobe32(seg->ds_addr);
- sgelem->size = htobe32(seg->ds_len);
- sgelem++;
- }
- c->pkt.cmd_sg_count = htobe16(nsegs);
- c->scsi.dataptr = htobe32(vsbic_cmd_pa(sc, c) +
- offsetof(struct vsbic_cmd, sg));
- }
- c->pkt.cmd_addr2 = c->scsi.dataptr;
- }
-
- c->scsi.ctrl = ctrl;
-
- /*
- * Setup SCSI ``script'' - really the list of phases to expect,
- * as well as the message bytes to send during the message out
- * phase if necessary.
- *
- * Since this driver doesn't support synchronous transfers yet,
- * this is really easy to build.
- */
-
- msgout = c->scsi.msgout;
- script = c->scsi.script;
-
- /* always message out unless the command is request sense */
- if (cmd->opcode != REQUEST_SENSE) {
- *script++ = SCRIPT_MSG_OUT;
- *msgout++ = MSG_IDENTIFY(sl->lun, 1);
- }
- *script++ = SCRIPT_COMMAND;
- if (ISSET(ccb->ccb_xsflags, SCSI_DATA_IN))
- *script++ = SCRIPT_DATA_IN;
- else if (ISSET(ccb->ccb_xsflags, SCSI_DATA_OUT))
- *script++ = SCRIPT_DATA_OUT;
- *script++ = SCRIPT_STATUS;
- *script++ = SCRIPT_MSG_IN;
- *script++ = SCRIPT_END;
-
- c->scsi.msgout_len = msgout - c->scsi.msgout;
- }
-
- return 0;
-}
-
-/*
- * Setup a reset command
- */
-void
-vsbic_reset_command(struct vsbic_softc *sc, struct vsbic_cmd *cmd,
- struct scsi_link *sl)
-{
- cmd->pkt.cmd_cmd = CMD_RESET;
- cmd->pkt.cmd_device = VSBIC_DEVICE_SCSI;
- if (sl != NULL) {
- /* the lun is ignored for reset commands */
- cmd->pkt.cmd_unit = VSBIC_UNIT(sl->target, 0 /* sl->lun */);
- } else {
- /* reset whole bus */
- cmd->pkt.cmd_unit = VSBIC_UNIT(8, 0);
- }
-}
-
-/*
- * Try and send a command to the board.
- */
-void
-vsbic_scsicmd(struct scsi_xfer *xs)
-{
- struct scsi_link *sl = xs->sc_link;
- struct vsbic_softc *sc = (struct vsbic_softc *)sl->adapter_softc;
- struct bpp_softc *bsc = &sc->sc_bpp;
- struct vsbic_ccb *ccb;
- struct bpp_envelope *env;
- struct vsbic_cmd *cmd;
- uint ch;
- int rc;
- int s;
-
- s = splbio();
-
-#ifdef DIAGNOSTIC
- /*
- * We shouldn't receive commands on the host adapter ID, this
- * channel is reserved for reset commands.
- */
- if (sl->target == sc->sc_id) {
- xs->error = XS_DRIVER_STUFFUP;
- scsi_done(xs);
- splx(s);
- return;
- }
-#endif
-
- /*
- * CDB larger than 12 bytes are not supported, as well as
- * odd-sized data transfers.
- * Sense data borrowed from gdt(4).
- */
- if (xs->cmdlen > 12 ||
- (ISSET(xs->flags, SCSI_DATA_IN | SCSI_DATA_OUT) &&
- (xs->datalen & 1) != 0)) {
-#ifdef VSBIC_DEBUG
- printf("%s: can't issue command, cdb len %d data len %x\n",
- DEVNAME(sc), xs->cmdlen, xs->datalen);
-#endif
- memset(&xs->sense, 0, sizeof(xs->sense));
- xs->sense.error_code = SSD_ERRCODE_VALID | SSD_ERRCODE_CURRENT;
- xs->sense.flags = SKEY_ILLEGAL_REQUEST;
- /* 0x20 illcmd, 0x24 illfield */
- xs->sense.add_sense_code = xs->cmdlen > 12 ? 0x20 : 0x24;
- xs->error = XS_SENSE;
- scsi_done(xs);
- splx(s);
- return;
- }
-
- /*
- * Get a CCB, an envelope and a command packet.
- */
-
- ccb = vsbic_get_ccb(sc);
- if (ccb == NULL) {
-#ifdef VSBIC_DEBUG
- printf("%s: no free CCB\n", DEVNAME(sc));
-#endif
- xs->error = XS_NO_CCB;
- scsi_done(xs);
- splx(s);
- }
-
- env = bpp_get_envelope(bsc);
- if (env == NULL) {
-#ifdef VSBIC_DEBUG
- printf("%s: no free envelope\n", DEVNAME(sc));
-#endif
- vsbic_free_ccb(sc, ccb);
- xs->error = XS_NO_CCB;
- scsi_done(xs);
- splx(s);
- return;
- }
- cmd = vsbic_get_cmd(sc);
- if (cmd == NULL) {
-#ifdef VSBIC_DEBUG
- printf("%s: no free command\n", DEVNAME(sc));
-#endif
- bpp_put_envelope(bsc, env);
- vsbic_free_ccb(sc, ccb);
- xs->error = XS_NO_CCB;
- scsi_done(xs);
- splx(s);
- return;
- }
-
- ccb->ccb_xs = xs;
- ccb->ccb_xsflags = xs->flags;
- timeout_set(&xs->stimeout, vsbic_timeout, ccb);
-
- /*
- * Build command script.
- */
-
- rc = vsbic_load_command(sc, ccb, cmd, sl, xs->cmd, xs->cmdlen,
- xs->data, xs->datalen);
- if (rc != 0) {
- printf("%s: unable to load DMA map: error %d\n",
- DEVNAME(sc), rc);
- vsbic_put_cmd(sc, cmd);
- bpp_put_envelope(bsc, env);
- vsbic_free_ccb(sc, ccb);
- xs->error = XS_DRIVER_STUFFUP;
- scsi_done(xs);
- splx(s);
- return;
- }
-
- /*
- * Send the command to the hardware.
- */
-
- vsbic_activate_ccb(sc, ccb, cmd);
- if (ISSET(xs->flags, SCSI_POLL))
- ch = VSBIC_POLLING_CHANNEL(sc);
- else
- ch = VSBIC_TARGET_CHANNEL(sc, sl->target);
- vsbic_queue_cmd(sc, &sc->sc_chan[ch], env, cmd);
-
- if (ISSET(xs->flags, SCSI_POLL)) {
- splx(s);
- vsbic_poll(sc, ccb);
- } else {
- timeout_add_msec(&xs->stimeout, xs->timeout);
- splx(s);
- }
-}
-
-/*
- * Send a request sense command. Invoked at splbio().
- */
-int
-vsbic_request_sense(struct vsbic_softc *sc, struct vsbic_ccb *ccb)
-{
- struct bpp_softc *bsc = &sc->sc_bpp;
- struct scsi_xfer *xs = ccb->ccb_xs;
- struct scsi_link *sl = xs->sc_link;
- struct bpp_envelope *env;
- struct vsbic_cmd *cmd;
- struct scsi_sense ss;
- int rc;
-
- env = bpp_get_envelope(bsc);
- if (env == NULL) {
-#ifdef VSBIC_DEBUG
- printf("%s: no free envelope\n", DEVNAME(sc));
-#endif
- return EAGAIN;
- }
- cmd = vsbic_get_cmd(sc);
- if (cmd == NULL) {
-#ifdef VSBIC_DEBUG
- printf("%s: no free command\n", DEVNAME(sc));
-#endif
- bpp_put_envelope(bsc, env);
- return EAGAIN;
- }
-
- memset(&ss, 0, sizeof ss);
- ss.opcode = REQUEST_SENSE;
- ss.byte2 = sl->lun << 5;
- ss.length = sizeof(xs->sense);
-
- ccb->ccb_xsflags = (ccb->ccb_xsflags & SCSI_NOSLEEP) |
- SCSI_DATA_IN | SCSI_POLL;
- rc = vsbic_load_command(sc, ccb, cmd, sl,
- (struct scsi_generic *)&ss, sizeof ss,
- (uint8_t *)&xs->sense, sizeof(xs->sense));
- if (rc != 0) {
- vsbic_put_cmd(sc, cmd);
- bpp_put_envelope(bsc, env);
- return rc;
- }
-
- vsbic_activate_ccb(sc, ccb, cmd);
- vsbic_queue_cmd(sc, &sc->sc_chan[VSBIC_POLLING_CHANNEL(sc)], env, cmd);
- if (xs->timeout > 1000)
- xs->timeout = 1000;
- vsbic_poll(sc, ccb);
-
- return 0;
-}
-
-/*
- * Reset a target. Invoked at splbio().
- */
-int
-vsbic_scsireset(struct vsbic_softc *sc, struct scsi_xfer *xs)
-{
- struct bpp_softc *bsc = &sc->sc_bpp;
- struct bpp_chan *chan;
- struct scsi_link *sl;
- struct bpp_envelope *env;
- struct vsbic_cmd *cmd;
-
- /*
- * Get an envelope and a command packet.
- */
-
- env = bpp_get_envelope(bsc);
- if (env == NULL) {
-#ifdef VSBIC_DEBUG
- printf("%s: no free envelope\n", DEVNAME(sc));
-#endif
- return EAGAIN;
- }
- cmd = vsbic_get_cmd(sc);
- if (cmd == NULL) {
-#ifdef VSBIC_DEBUG
- printf("%s: no free command\n", DEVNAME(sc));
-#endif
- bpp_put_envelope(bsc, env);
- return EAGAIN;
- }
-
- if (xs == NULL)
- sl = NULL;
- else
- sl = xs->sc_link;
-
- vsbic_reset_command(sc, cmd, sl);
-
- chan = &sc->sc_chan[VSBIC_RESET_CHANNEL(sc)];
- vsbic_queue_cmd(sc, chan, env, cmd);
-
- return 0;
-}
-
-/*
- * Wrapup task after a command has completed (or failed).
- */
-void
-vsbic_wrapup(struct vsbic_softc *sc, struct vsbic_ccb *ccb)
-{
- struct scsi_xfer *xs = ccb->ccb_xs;
-
- timeout_del(&xs->stimeout);
-
- if (xs->error == XS_NOERROR) {
- switch (xs->status) {
- case SCSI_OK:
- xs->error = XS_NOERROR;
- break;
- case SCSI_CHECK:
- /*
- * Send a request sense command. If we can't, or
- * it fails, don't insist and fail the command.
- */
- if (!ISSET(ccb->ccb_flags, CCBF_SENSE)) {
- SET(ccb->ccb_flags, CCBF_SENSE);
- xs->error = XS_SENSE;
- if (vsbic_request_sense(sc, ccb) == 0)
- return;
- }
- xs->error = XS_DRIVER_STUFFUP;
- break;
- default:
- xs->error = XS_DRIVER_STUFFUP;
- break;
- }
- }
-
- vsbic_free_ccb(sc, ccb);
- scsi_done(xs);
-}
-
-
-/*
- * Polled command operation.
- */
-
-void
-vsbic_poll(struct vsbic_softc *sc, struct vsbic_ccb *ccb)
-{
- struct bpp_chan *chan = &sc->sc_chan[VSBIC_POLLING_CHANNEL(sc)];
- struct scsi_xfer *xs = ccb->ccb_xs;
- int s;
- int tmo;
-
- tmo = ccb->ccb_xs->timeout;
- s = splbio();
- for (;;) {
- if (vsbic_channel_intr(sc, chan) != 0)
- if (ISSET(xs->flags, ITSDONE))
- break;
-
- /*
- * It is safe to lower spl while waiting, since the polling
- * channel never interrupts, and thus we do not risk
- * vsbic_intr() processing this request behind our back.
- */
- splx(s);
- delay(1000);
- tmo--;
- s = splbio();
- if (tmo == 0)
- break;
- }
-
- if (tmo == 0) {
- vsbic_timeout(ccb);
- if (!ISSET(xs->flags, ITSDONE)) {
- /*
- * We have sent a reset command. Poll for its
- * completion.
- */
- chan = &sc->sc_chan[VSBIC_RESET_CHANNEL(sc)];
- for (;;) {
- if (vsbic_channel_intr(sc, chan) != 0)
- if (ISSET(xs->flags, ITSDONE))
- break;
-
- delay(10000); /* 10ms */
- }
- }
- }
-
- /*
- * vsbic_intr() does not invoke vsbic_wrapup for polled
- * commands, since we need the scsi_xfer to remain valid
- * after the commands completes.
- */
- vsbic_wrapup(sc, ccb);
-
- splx(s);
-}
-
-void
-vsbic_timeout(void *v)
-{
- struct vsbic_ccb *ccb = (struct vsbic_ccb *)v;
- struct scsi_xfer *xs = ccb->ccb_xs;
- struct scsi_link *sl = xs->sc_link;
- struct vsbic_softc *sc = (struct vsbic_softc *)sl->adapter_softc;
- int s;
-
- sc_print_addr(sl);
- printf("SCSI command 0x%x timeout\n", xs->cmd->opcode);
-
- s = splbio();
-
- if (vsbic_scsireset(sc, xs) != 0) {
- sc_print_addr(sl);
- printf("unable to reset SCSI bus\n");
-
- xs->error = XS_TIMEOUT;
- xs->status = SCSI_TERMINATED;
- if (ISSET(ccb->ccb_xsflags, SCSI_POLL)) {
- SET(xs->flags, ITSDONE);
- /* caller will invoke vsbic_wrapup() later */
- } else
- vsbic_wrapup(sc, ccb);
-
- /*
- * This is very likely to hose at least this device,
- * until another SCSI bus reset is tried, since the
- * command will never complete...
- *
- * We could remember this situation and issue a bus
- * reset as soon as an envelope is available, but
- * the initial envelope number computation is supposed
- * to prevent this from occuring.
- */
- }
-
- /*
- * If we have been able to send the reset command, make
- * sure we are forcing an error condition, to report the
- * correct error.
- */
- xs->error = XS_TIMEOUT;
- xs->status = SCSI_TERMINATED;
-
- splx(s);
-}
-
-/*
- * Interrupt Handler
- */
-
-int
-vsbic_intr(void *arg)
-{
- struct vsbic_softc *sc = arg;
- struct bpp_chan *chan;
- uint ch;
-
- splassert(IPL_BIO);
-
- /*
- * There is no easy way to know which channel caused the interrupt
- * (unless we register as many different interrupts as channels...),
- * so check all of them.
- *
- * This means that we will sometimes dequeue commands before
- * receiving their channel interrupts... therefore, we always
- * claim the interrupt for the kernel not to be confused.
- */
-
- /*
- * Check the reset channel first, then check all real target channels.
- */
-
- chan = &sc->sc_chan[VSBIC_RESET_CHANNEL(sc)];
- (void)vsbic_channel_intr(sc, chan);
-
- for (ch = 0; ch < 8; ch++) {
- if (ch == VSBIC_RESET_CHANNEL(sc))
- continue;
- chan = &sc->sc_chan[ch];
- (void)vsbic_channel_intr(sc, chan);
- }
-
- return 1;
-}
-
-int
-vsbic_channel_intr(struct vsbic_softc *sc, struct bpp_chan *chan)
-{
- struct vsbic_cmd *cmd;
- struct vsbic_ccb *ccb;
- struct scsi_xfer *xs;
- uint32_t xferlen;
- uint error, status;
-
- cmd = vsbic_dequeue_cmd(sc, chan);
- if (cmd == NULL)
- return 0;
-
- /* retrieve associated ccb, if any */
- ccb = vsbic_cmd_ccb(sc, cmd);
-
- xferlen = (betoh16(cmd->pkt.sts_xfer_high) << 16) |
- betoh16(cmd->pkt.sts_xfer_low);
- error = cmd->pkt.sts_error;
- status = betoh16(cmd->pkt.sts_status);
-
-#ifdef VSBIC_DEBUG
- printf("channel %d: cmd %p ccb %p xfer %x error %02x\n",
- chan->ch->ch_num, cmd, ccb, xferlen, error);
- printf(" status %04x sts %02x parm3 %x",
- status, cmd->scsi.status, cmd->pkt.sts_parm3);
- if (error == ERR_OK && cmd->pkt.sts_recovered != ERR_OK)
- printf(" recovered error %02x tries %d",
- cmd->pkt.sts_recovered, cmd->pkt.sts_retries);
- printf("\n");
-#endif
-
- if (ccb != NULL) {
- xs = ccb->ccb_xs;
-
- if (ISSET(ccb->ccb_xsflags, SCSI_DATA_IN | SCSI_DATA_OUT)) {
- if (!ISSET(ccb->ccb_flags, CCBF_SENSE))
- xs->resid = xs->datalen - xferlen;
- bus_dmamap_sync(sc->sc_dmat, ccb->ccb_dmamap, 0,
- ccb->ccb_dmalen,
- ISSET(ccb->ccb_xsflags, SCSI_DATA_IN) ?
- BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
- bus_dmamap_unload(sc->sc_dmat, ccb->ccb_dmamap);
- }
-
- if (xs->error == XS_NOERROR) {
- switch (error) {
- case ERR_SELECT_TIMEOUT:
- xs->error = XS_SELTIMEOUT;
- break;
- case ERR_BUS_RESET:
- xs->error = XS_RESET;
- break;
- case ERR_REQUEST_SENSE_FAILED:
- xs->error = XS_SHORTSENSE;
- break;
- case ERR_INVALID_XFER_COUNT:
- if (status == ERR_INCOMPLETE_DATA_TRANSFER)
- xs->error = XS_NOERROR;
- else
- xs->error = XS_DRIVER_STUFFUP;
- break;
- case ERR_OK:
- xs->error = XS_NOERROR;
- xs->status = cmd->scsi.status;
- break;
- default:
- xs->error = XS_DRIVER_STUFFUP;
- break;
- }
- }
- }
-
- vsbic_put_cmd(sc, cmd);
-
- if (ccb != NULL) {
- if (ISSET(ccb->ccb_xsflags, SCSI_POLL)) {
- SET(xs->flags, ITSDONE);
- /* caller will invoke vsbic_wrapup() later */
- } else
- vsbic_wrapup(sc, ccb);
- }
-
- return 1;
-}
diff --git a/sys/arch/mvme88k/dev/vsreg.h b/sys/arch/mvme88k/dev/vsreg.h
deleted file mode 100644
index 57bc800a19c..00000000000
--- a/sys/arch/mvme88k/dev/vsreg.h
+++ /dev/null
@@ -1,439 +0,0 @@
-/* $OpenBSD: vsreg.h,v 1.15 2008/01/01 22:54:28 miod Exp $ */
-/*
- * Copyright (c) 2004, Miodrag Vallat.
- * Copyright (c) 1999 Steve Murphree, Jr.
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from source contributed by Mark Bellon.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _MVME328_REG_H_
-#define _MVME328_REG_H_
-
-/*
- * JAGUAR specific device limits
- */
-
-#define JAGUAR_MIN_Q_SIZ 2
-#define JAGUAR_MAX_CTLR_CMDS 80 /* Interphase says so */
-#define JAGUAR_MAX_Q_SIZ (JAGUAR_MAX_CTLR_CMDS / JAGUAR_MAX_WQ)
-#define JAGUAR_MAX_WQ (2 * 7)
-
-/*
- * COUGAR specific device limits
- */
-
-#define COUGAR_MIN_Q_SIZ 2
-#define COUGAR_CMDS_PER_256K 42 /* Interphase says so */
-
-/*
- * Structures
- */
-
-#define NUM_CQE 10
-#define NUM_IOPB NUM_CQE
-#define NUM_WQ (2 * 15)
-
-/*
- * Master Control Status Block (MCSB)
- */
-
-#define MCSB_MSR 0x000000 /* master status register */
-#define M_MSR_QFC 0x0004 /* queue flush complete */
-#define M_MSR_BOK 0x0002 /* board OK */
-#define M_MSR_CNA 0x0001 /* controller not available */
-#define MCSB_MCR 0x000002 /* master control register */
-#define M_MCR_SFEN 0x2000 /* sysfail enable */
-#define M_MCR_RES 0x1000 /* reset controller */
-#define M_MCR_FLQ 0x0800 /* flush queue */
-#define M_MCR_FLQR 0x0004 /* flush queue and report */
-#define M_MCR_SQM 0x0001 /* start queue mode */
-#define MCSB_IQAR 0x000004 /* interrupt on queue avail */
-#define M_IQAR_IQEA 0x8000 /* interrupt on queue entry avail */
-#define M_IQAR_IQEH 0x4000 /* interrupt on queue half empty */
-#define M_IQAR_ILVL 0x0700 /* interrupt lvl on queue available */
-#define M_IQAR_IVCT 0x00ff /* interrupt vector on queue avail */
-#define MCSB_QHDP 0x000006 /* queue head pointer */
-#define MCSB_THAW 0x000008 /* thaw work queue */
-#define M_THAW_TWQN 0xff00 /* thaw work queue number */
-#define M_THAW_TWQE 0x0001 /* thaw work queue enable */
-#define MCSB_SIZE 0x000010
-
-/*
- * Host Semaphore Block (HSB)
- */
-
-#define HSB_INITQ 0x000000 /* init MCE flag */
-#define HSB_WORKQ 0x000002 /* work queue number */
-#define HSB_MAGIC 0x000004 /* magic word */
-#define HSB_SIZE 0x000008
-
-/*
- * Controller Initialization Block (CIB)
- */
-
-#define CIB_NCQE 0x000000 /* number of CQE */
-#define CIB_BURST 0x000002 /* DMA burst count */
-#define CIB_NVECT 0x000004 /* normal completion vector */
-#define CIB_EVECT 0x000006 /* error completion vector */
-#define M_VECT_ILVL 0x0700 /* Interrupt Level mask */
-#define M_VECT_IVCT 0x00ff /* Interrupt Vector mask */
-#define CIB_PID 0x000008 /* primary scsi bus id */
-#define CIB_SID 0x00000a /* secondary scsi bus id */
-#define M_PSID_DFT 0x0008 /* default ID enable */
-#define M_PSID_ID 0x0007 /* primary/secondary SCSI ID */
-#define CIB_CRBO 0x00000c /* CRB offset */
-#define CIB_SELECT 0x00000e /* selection timeout in ms */
-#define CIB_WQTIMO 0x000012 /* work queue timeout in 256ms */
-#define CIB_VMETIMO 0x000016 /* VME timeout in 32ms */
-#define CIB_OBMT 0x00001e /* offboard CRB mtype/xfer type/ad mod */
-#define CIB_OBADDR 0x000020 /* host mem address for offboard CRB */
-#define CIB_ERR_FLGS 0x000024 /* error recovery flags */
-#define M_ERRFLGS_FOSR 0x0001 /* Freeze on SCSI bus reset */
-#define M_ERRFLGS_RIN 0x0002 /* SCSI bus reset interrupt */
-#define M_ERRFLGS_RSE 0x0004 /* Report COUGAR SCSI errors */
-#define CIB_SBRIV 0x00002a /* scsi bus reset interrupt vector */
-#define CIB_SOF0 0x00002c /* synchronous offset (bus 0) */
-#define CIB_SRATE0 0x00002d /* sync negotiation rate (bus 0) */
-#define CIB_SOF1 0x00002e /* synchronous offset (bus 0) */
-#define CIB_SRATE1 0x00002f /* sync negotiation rate (bus 0) */
-#define CIB_SIZE 0x000030
-
-/*
- * Command Queue Entry (CQE)
- */
-
-#define CQE_QECR 0x000000 /* queue entry control reg */
-#define M_QECR_IOPB 0x0f00 /* IOPB type (must be zero) */
-#define M_QECR_HPC 0x0004 /* High Priority command */
-#define M_QECR_AA 0x0002 /* abort acknowledge */
-#define M_QECR_GO 0x0001 /* Go/Busy */
-#define CQE_IOPB_ADDR 0x000002 /* IOPB address */
-#define CQE_CTAG 0x000004 /* command tag */
-#define CQE_IOPB_LENGTH 0x000008 /* IOPB length */
-#define CQE_WORK_QUEUE 0x000009 /* work queue number */
-#define CQE_SIZE 0x00000c
-
-/*
- * Command Response Block (CRB)
- */
-
-#define CRB_CRSW 0x000000 /* status word */
-#define M_CRSW_SE 0x0800 /* SCSI error (COUGAR) */
-#define M_CRSW_RST 0x0400 /* SCSI Bus reset (COUGAR) */
-#define M_CRSW_SC 0x0080 /* status change */
-#define M_CRSW_CQA 0x0040 /* Command queue entry available */
-#define M_CRSW_QMS 0x0020 /* queue mode started */
-#define M_CRSW_AQ 0x0010 /* abort queue */
-#define M_CRSW_EX 0x0008 /* exception */
-#define M_CRSW_ER 0x0004 /* error */
-#define M_CRSW_CC 0x0002 /* command complete */
-#define M_CRSW_CRBV 0x0001 /* cmd response block valid/clear */
-#define CRB_CTAG 0x000004 /* command tag */
-#define CRB_IOPB_LENGTH 0x000008 /* IOPB length */
-#define CRB_WORK_QUEUE 0x000009 /* work queue number */
-#define CRB_SIZE 0x00000c
-
-/*
- * Controller Error Vector Status Block (CEVSB)
- * This is a variation of the CRB, _but larger_.
- */
-
-#define CONTROLLER_ERROR 0x0085
-#define NR_SCSI_ERROR 0x0885
-
-#define CEVSB_CRSW 0x000000 /* status word */
-#define CEVSB_TYPE 0x000002 /* IOPB type */
-#define CEVSB_CTAG 0x000004 /* command tag */
-#define CEVSB_IOPB_LENGTH 0x000008 /* IOPB length */
-#define CEVSB_WORK_QUEUE 0x000009 /* work queue number */
-#define CEVSB_ERROR 0x00000d /* error code */
-#define CEVSB_ERR_TYPE 0xc0 /* IOPB type error */
-#define CEVSB_ERR_TO 0xc1 /* IOPB timeout error */
-#define CEVSB_ERR_TR 0x82 /* Target Reconnect, no IOPB */
-#define CEVSB_ERR_OF 0x83 /* Overflow */
-#define CEVSB_ERR_BD 0x84 /* Bad direction */
-#define CEVSB_ERR_NR 0x86 /* Non-Recoverabl Error */
-#define CEVSB_ERR_PANIC 0xff /* Board Painc!!! */
-#define CEVSB_AUXERR 0x00000e /* cougar error code */
-#define CEVSB_SIZE 0x000010
-
-/*
- * Configuration Status Block (CSB)
- */
-
-#define CSB_TYPE 0x000000 /* board ID */
-#define COUGAR 0x4220
-#define JAGUAR 0x0000
-#define CSB_EXTID 0x000002 /* cougar extended ID */
-#define CSB_PCODE 0x000003 /* product code */
-#define CSB_PVAR 0x000009 /* product variation */
-#define CSB_FREV 0x00000d /* firmware revision level */
-#define CSB_FDATE 0x000012 /* firmware release date */
-#define CSB_SSIZE 0x00001a /* system memory size in KB */
-#define CSB_BSIZE 0x00001c /* buffer memory size in KB */
-#define CSB_NWQ 0x00001e /* number of work queues (C) */
-#define CSB_PFECID 0x000020 /* primary bus FEC id */
-#define CSB_SFECID 0x000021 /* secondary bus FEC id */
-#define CSB_PID 0x000022 /* primary bus id */
-#define CSB_SID 0x000023 /* secondary bus id */
-#define CSB_LPDS 0x000024 /* last primary device selected */
-#define CSB_LSDS 0x000025 /* last secondary device selected */
-#define CSB_PPS 0x000026 /* primary phase sense */
-#define CSB_SPS 0x000027 /* secondary phase sense */
-#define CSB_DBID 0x000029 /* daughter board id */
-#define DBID_SCSI2 0x02 /* modern SCSI ??? */
-#define DBID_PRINTER 0x04 /* printer daughter board */
-#define DBID_SCSI 0x06 /* SCSI daugter board */
-#define DBID_NONE 0x07 /* no daughter board */
-#define CSB_SDS 0x00002b /* software DIP switch */
-#define CSB_FWQR 0x00002e /* frozen work queues register */
-#define CSB_SIZE 0x000078
-
-/*
- * IOPB Format (IOPB)
- */
-
-#define IOPB_CMD 0x000000 /* command code */
-#define IOPB_OPTION 0x000002 /* option word */
-#define M_OPT_HEAD_TAG 0x3000 /* head of queue command queue tag */
-#define M_OPT_ORDERED_TAG 0x2000 /* order command queue tag */
-#define M_OPT_SIMPLE_TAG 0x1000 /* simple command queue tag */
-#define M_OPT_GO_WIDE 0x0800 /* use WIDE transfers */
-#define M_OPT_DIR 0x0100 /* VME direction bit */
-#define M_OPT_SG_BLOCK 0x0008 /* scatter/gather in 512 byte blocks */
-#define M_OPT_SS 0x0004 /* Suppress synchronous transfer */
-#define M_OPT_SG 0x0002 /* scatter/gather bit */
-#define M_OPT_IE 0x0001 /* Interrupt enable */
-#define IOPB_STATUS 0x000004 /* return status word */
-#define IOPB_NVCT 0x000008 /* normal completion vector */
-#define IOPB_EVCT 0x000009 /* error completion vector */
-#define IOPB_LEVEL 0x00000a /* interrupt level */
-#define IOPB_ADDR 0x00000e /* address type and modifier */
-#define M_ADR_TRANS 0x0c00 /* transfer type */
-#define M_ADR_MEMT 0x0300 /* memory type */
-#define M_ADR_MOD 0x00ff /* VME address modifier */
-#define M_ADR_SG_LINK 0x8000 /* Scatter/Gather Link bit */
-#define IOPB_BUFF 0x000010 /* buffer address */
-#define IOPB_LENGTH 0x000014 /* max transfer length */
-#define IOPB_SGTTL 0x000018 /* S/G total transfer length */
-#define IOPB_UNIT 0x00001e /* unit address on scsi bus */
-#define M_UNIT_EXT_LUN 0xff00 /* Extended Address */
-#define M_UNIT_EXT 0x0080 /* Extended Address Enable */
-#define M_UNIT_BUS 0x0040 /* SCSI Bus Selection */
-#define M_UNIT_LUN 0x0038 /* Logical Unit Number */
-#define M_UNIT_ID 0x0007 /* SCSI Device ID */
-#define IOPB_SCSI_DATA 0x000020 /* SCSI words for passthrough */
-#define IOPB_SHORT_SIZE 0x000020
-#define IOPB_LONG_SIZE 0x000040
-
-/*
- * Initialize Work Queue Command Format (WQCF)
- * This is a specific case of IOPB.
- */
-
-#define WQCF_CMD 0x000000 /* command code */
-#define M_WOPT_IWQ 0x8000 /* initialize work queue */
-#define M_WOPT_PE 0x0008 /* parity check enable */
-#define M_WOPT_FE 0x0004 /* freeze on error enable */
-#define M_WOPT_TM 0x0002 /* target mode enable */
-#define M_WOPT_AE 0x0001 /* abort enable */
-#define WQCF_OPTION 0x000002 /* option word */
-#define WQCF_STATUS 0x000004 /* return status word */
-#define WQCF_NVCT 0x000008 /* normal completion vector */
-#define WQCF_EVCT 0x000009 /* error completion vector */
-#define WQCF_ILVL 0x00000a /* interrupt level */
-#define WQCF_WORKQ 0x00001c /* work queue number */
-#define WQCF_WOPT 0x00001e /* work queue options */
-#define WQCF_SLOTS 0x000020 /* # of slots in work queues */
-#define WQCF_UNIT 0x000022 /* unit address (C) */
-#define WQCF_CMDTO 0x000024 /* command timeout */
-
-/*
- * SCSI Reset Command Format (SRCF)
- * This is a specific case of IOPB.
- */
-
-#define SRCF_CMD 0x000000 /* command code */
-#define SRCF_OPTION 0x000002 /* option word */
-#define SRCF_STATUS 0x000004 /* return status word */
-#define SRCF_NVCT 0x000008 /* normal completion vector */
-#define SRCF_EVCT 0x000009 /* error completion vector */
-#define SRCF_ILVL 0x00000a /* interrupt level */
-#define SRCF_BUSID 0x00001c /* scsi bus id to reset */
-
-/*
- * Device Reinitialize Command Format (DRCF)
- * This is a specific case of IOPB.
- */
-
-#define DRCF_CMD 0x000000 /* command code */
-#define DRCF_OPTION 0x000002 /* option word */
-#define DRCF_STATUS 0x000004 /* return status word */
-#define DRCF_NVCT 0x000008 /* normal completion vector */
-#define DRCF_EVCT 0x000009 /* error completion vector */
-#define DRCF_ILVL 0x00000a /* interrupt level */
-#define DRCF_UNIT 0x00001e /* unit address */
-
-/*
- * Short I/O memory layout
- */
-
-#define S_SHORTIO 0x000800
-
-#define sh_MCSB (0)
-#define sh_MCE (sh_MCSB + MCSB_SIZE)
-#define sh_CQE(x) (sh_MCE + CQE_SIZE + CQE_SIZE * (x))
-#define sh_IOPB(x) (sh_CQE(NUM_CQE) + IOPB_LONG_SIZE * (x))
-#define sh_MCE_IOPB (sh_IOPB(NUM_IOPB))
-#define sh_CIB (sh_MCE_IOPB + IOPB_LONG_SIZE)
-
-#define sh_CSS (S_SHORTIO - CSB_SIZE)
-#define sh_RET_IOPB (sh_CSS - IOPB_LONG_SIZE)
-#define sh_CRB (sh_RET_IOPB - CRB_SIZE)
-#define sh_CEVSB sh_CRB
-#define sh_HSB (sh_CRB - HSB_SIZE)
-
-#if (sh_CIB + CIB_SIZE > sh_HSB)
-#error invalid memory layout
-#endif
-
-#define SELECTION_TIMEOUT 250 /* milliseconds */
-#define VME_BUS_TIMEOUT 15 /* units of 30ms */
-#define M328_INFINITE_TIMEOUT 0 /* wait forever */
-
-/*
- * IOPB command codes
- */
-
-#define IOPB_PASSTHROUGH 0x20 /* SCSI passthrough commands */
-#define IOPB_PASSTHROUGH_EXT 0x21 /* SCSI passthrough extended */
-#define IOPB_RESET 0x22 /* reset bus */
-
-#define CNTR_DIAG 0x40 /* perform diagnostics */
-#define CNTR_INIT 0x41 /* initialize controller */
-#define CNTR_INIT_WORKQ 0x42 /* initialize work queue */
-#define CNTR_DUMP_INIT 0x43 /* dump initialization parameters */
-#define CNTR_DUMP_WORDQ 0x44 /* dump work queue parameters */
-#define CNTR_CANCEL_IOPB 0x48 /* cancel command tag */
-#define CNTR_FLUSH_WORKQ 0x49 /* flush work queue */
-#define CNTR_DEV_REINIT 0x4c /* reinitialize device */
-#define CNTR_ISSUE_ABORT 0x4e /* abort has been issued */
-#define CNTR_DOWNLOAD_FIRMWARE 0x4f /* download firmware (COUGAR) */
-
-/*
- * Memory types
- */
-
-#define MEMT_16BIT 1 /* 16 bit memory type */
-#define MEMT_32BIT 2 /* 32 bit memory type */
-#define MEMT_SHIO 3 /* short I/O memory type */
-#define MEMTYPE MEMT_32BIT
-
-/*
- * Transfer types
- */
-
-#define TT_NORMAL 0 /* normal mode transfers */
-#define TT_BLOCK 1 /* block mode transfers */
-#define TT_DISABLE_INC_ADDR 2 /* disable incrementing addresses */
-#define TT_D64 3 /* D64 mode transfers */
-
-/*
- * Error codes
- */
-
-#define MACSI_GOOD_STATUS 0x00
-#define MACSI_QUEUE_FULL 0x01
-#define MACSI_CMD_CODE_ERR 0x04
-#define MACSI_QUEUE_NUMBER_ERR 0x05
-
-#define RESET_BUS_STATUS 0x11 /* SCSI bus reset IOPB forced this */
-#define NO_SECONDARY_PORT 0x12 /* second SCSI bus not available */
-#define SCSI_DEVICE_IS_RESET 0x14
-#define CMD_ABORT_BY_RESET 0x15
-
-#define VME_BUS_ERROR 0x20
-#define VME_BUS_ACC_TIMEOUT 0x21
-#define VME_BUS_BAD_ADDR 0x23
-#define VME_BUS_BAD_MEM_TYPE 0x24
-#define VME_BUS_BAD_COUNT 0x25
-#define VME_BUS_FETCH_ERROR 0x26
-#define VME_BUS_FETCH_TIMEOUT 0x27
-#define VME_BUS_POST_ERROR 0x28
-#define VME_BUS_POST_TIMEOUT 0x29
-#define VME_BUS_BAD_FETCH_ADDR 0x2a
-#define VME_BUS_BAD_POST_ADDR 0x2b
-#define VME_BUS_SG_FETCH 0x2c
-#define VME_BUS_SG_TIMEOUT 0x2d
-#define VME_BUS_SG_COUNT 0x2e
-
-#define SCSI_SELECTION_TO 0x30
-#define SCSI_DISCONNECT_TIMEOUT 0x31
-#define SCSI_ABNORMAL_SEQ 0x32
-#define SCSI_DISCONNECT_ERR 0x33
-#define SCSI_XFER_EXCEPTION 0x34
-#define SCSI_PARITY_ERROR 0x35
-
-#define DEVICE_NO_IOPB 0x82
-#define IOPB_CTLR_EXH 0x83
-#define IOPB_DIR_ERROR 0x84
-#define COUGAR_ERROR 0x86
-#define MACSI_INCORRECT_HW 0x90
-#define MACSI_ILGL_IOPB_VAL 0x92
-#define MACSI_ILLEGAL_IMAGE 0x9c
-#define IOPB_TYPE_ERR 0xc0 /* IOPB type not 0 */
-#define IOPB_TIMEOUT 0xc1
-
-#define COUGAR_PANIC 0xff
-
-#define MACSI_INVALID_TIMEOUT 0x843
-
-/*
- * VME addressing modes
- */
-
-#define ADRM_STD_S_P 0x3e /* standard supervisory program */
-#define ADRM_STD_S_D 0x3d /* standard supervisory data */
-#define ADRM_STD_N_P 0x3a /* standard normal program */
-#define ADRM_STD_N_D 0x39 /* standard normal data */
-#define ADRM_SHT_S_IO 0x2d /* short supervisory I/O */
-#define ADRM_SHT_N_IO 0x29 /* short normal I/O */
-#define ADRM_EXT_S_P 0x0e /* extended supervisory program */
-#define ADRM_EXT_S_D 0x0d /* extended supervisory data */
-#define ADRM_EXT_N_P 0x0a /* extended normal program */
-#define ADRM_EXT_N_D 0x09 /* extended normal data */
-#define ADRM_EXT_S_BM 0x0f /* extended supervisory block mode */
-#define ADRM_EXT_S_D64 0x0c /* extended supervisory D64 mode */
-
-#define ADDR_MOD ((TT_NORMAL << 10) | (MEMTYPE << 8) | ADRM_EXT_S_D)
-#define BLOCK_MOD ((TT_BLOCK << 10) | (MEMTYPE << 8) | ADRM_EXT_S_BM)
-#define D64_MOD ((TT_D64 << 10) | (MEMTYPE << 8) | ADRM_EXT_S_D64)
-#define SHIO_MOD ((TT_NORMAL << 10) | (MEMT_SHIO << 8) | ADRM_SHT_N_IO)
-
-#endif /* _MVME328_REG_H_ */
diff --git a/sys/arch/mvme88k/dev/vsvar.h b/sys/arch/mvme88k/dev/vsvar.h
deleted file mode 100644
index eb3787ad639..00000000000
--- a/sys/arch/mvme88k/dev/vsvar.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/* $OpenBSD: vsvar.h,v 1.21 2009/02/01 00:44:36 miod Exp $ */
-/*
- * Copyright (c) 2004, 2009, Miodrag Vallat.
- * Copyright (c) 1999 Steve Murphree, Jr.
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#ifndef _VSVAR_H_
-#define _VSVAR_H_
-
-/*
- * Scatter/gather structures
- *
- * Each s/g element is 8 bytes long; a s/g list is limited to 64
- * entries. To afford larger lists, it is possible to use ``link''
- * entries, which can add up to 64 new entries (and contain link
- * entries themselves, too), by setting the M_ADR_SG_LINK bit in
- * the address modifier field.
- *
- * To keep things simple, this driver will use only use a flat list
- * of up to 64 entries, thereby limiting the maximum transfer to
- * 64 pages (worst case situation).
- */
-
-#define MAX_SG_ELEMENTS 64
-
-struct vs_sg_entry {
- union {
- uint16_t bytes; /* entry byte count */
- struct {
- uint8_t gather; /* count of linked entries */
- uint8_t reserved;
- } link;
- } count;
- uint16_t pa_high; /* 32-bit address field split... */
- uint16_t pa_low; /* ... due to alignment */
- uint16_t addr; /* address type and modifier */
-};
-
-/* largest power of two for the bytes field */
-#define MAX_SG_ELEMENT_SIZE (1U << 15)
-
-/*
- * Command control block
- */
-struct vs_cb {
- struct scsi_xfer *cb_xs; /* current command */
- u_int cb_q; /* controller queue it's in */
-
- bus_dmamap_t cb_dmamap;
- bus_size_t cb_dmalen;
-};
-
-/*
- * Per-channel information
- */
-struct vs_channel {
- int vc_id; /* host id */
- int vc_width; /* number of targets */
- int vc_type; /* channel type */
-#define VCT_UNKNOWN 0
-#define VCT_SE 1
-#define VCT_DIFFERENTIAL 2
- struct scsi_link vc_link;
-};
-
-struct vs_softc {
- struct device sc_dev;
-
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
- bus_dma_tag_t sc_dmat;
-
- int sc_bid; /* board id */
- struct vs_channel sc_channel[2];
-
- struct intrhand sc_ih_n; /* normal interrupt handler */
- int sc_nvec;
- struct intrhand sc_ih_e; /* error interrupt handler */
- int sc_evec;
- char sc_intrname_e[16 + 4];
- int sc_ipl;
-
- u_int sc_nwq; /* number of work queues */
- struct vs_cb *sc_cb;
-
- bus_dmamap_t sc_sgmap;
- bus_dma_segment_t sc_sgseg;
- struct vs_sg_entry *sc_sgva;
-};
-
-/* Access macros */
-
-#define vs_read(w,o) \
- bus_space_read_##w (sc->sc_iot, sc->sc_ioh, (o))
-#define vs_write(w,o,v) \
- bus_space_write_##w (sc->sc_iot, sc->sc_ioh, (o), (v))
-#define vs_bzero(o,s) \
- bus_space_set_region_2(sc->sc_iot, sc->sc_ioh, (o), 0, (s) / 2)
-
-#define cib_read(w,o) vs_read(w, sh_CIB + (o))
-#define cib_write(w,o,v) vs_write(w, sh_CIB + (o), (v))
-#define crb_read(w,o) vs_read(w, sh_CRB + (o))
-#define crb_write(w,o,v) vs_write(w, sh_CRB + (o), (v))
-#define csb_read(w,o) vs_read(w, sh_CSS + (o))
-#define mce_read(w,o) vs_read(w, sh_MCE + (o))
-#define mce_write(w,o,v) vs_write(w, sh_MCE + (o), (v))
-#define mce_iopb_read(w,o) vs_read(w, sh_MCE_IOPB + (o))
-#define mce_iopb_write(w,o,v) vs_write(w, sh_MCE_IOPB + (o), (v))
-#define mcsb_read(w,o) vs_read(w, sh_MCSB + (o))
-#define mcsb_write(w,o,v) vs_write(w, sh_MCSB + (o), (v))
-
-#define CRSW crb_read(2, CRB_CRSW)
-#define CRB_CLR_DONE crb_write(2, CRB_CRSW, 0)
-#define CRB_CLR_ER crb_write(2, CRB_CRSW, CRSW & ~M_CRSW_ER)
-
-#define THAW_REG mcsb_read(2, MCSB_THAW)
-#define THAW(x) \
- do { \
- mcsb_write(1, MCSB_THAW, (x)); \
- mcsb_write(1, MCSB_THAW + 1, M_THAW_TWQE); \
- } while (0)
-
-#endif /* _M328VAR_H */
diff --git a/sys/arch/mvme88k/dev/vx.c b/sys/arch/mvme88k/dev/vx.c
deleted file mode 100644
index 406b67abfd4..00000000000
--- a/sys/arch/mvme88k/dev/vx.c
+++ /dev/null
@@ -1,1523 +0,0 @@
-/* $OpenBSD: vx.c,v 1.43 2011/04/07 15:30:15 miod Exp $ */
-/*
- * Copyright (c) 1999 Steve Murphree, Jr.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* This card lives in D16 space */
-#define __BUS_SPACE_RESTRICT_D16__
-
-#include <sys/param.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-#include <sys/uio.h>
-#include <sys/systm.h>
-#include <sys/time.h>
-#include <sys/device.h>
-#include <sys/syslog.h>
-
-#include <machine/autoconf.h>
-#include <machine/conf.h>
-#include <machine/cpu.h>
-#include <machine/psl.h>
-
-#include <dev/cons.h>
-
-#include <mvme88k/dev/vme.h>
-#include <mvme88k/dev/vxreg.h>
-
-#define splvx() spltty()
-
-struct vx_info {
- struct tty *tty;
- u_char vx_swflags;
- int vx_linestatus;
- int open;
- int waiting;
- u_char vx_speed;
- u_char read_pending;
- struct wring *wringp;
- struct rring *rringp;
-};
-
-struct vxsoftc {
- struct device sc_dev;
- struct vx_info sc_info[NVXPORTS];
- struct vxreg *vx_reg;
- vaddr_t board_vaddr;
- struct channel *channel;
- char channel_number;
- struct packet sc_bppwait_pkt;
- void *sc_bppwait_pktp;
- struct intrhand sc_ih;
- int sc_vec;
- struct envelope *elist_head, *elist_tail;
- struct packet *plist_head, *plist_tail;
-};
-
-int vxmatch(struct device *, void *, void *);
-void vxattach(struct device *, struct device *, void *);
-
-struct cfattach vx_ca = {
- sizeof(struct vxsoftc), vxmatch, vxattach
-};
-
-struct cfdriver vx_cd = {
- NULL, "vx", DV_TTY
-};
-
-int bpp_send(struct vxsoftc *, void *, int);
-void ccode(struct vxsoftc *, int, char);
-int create_channels(struct vxsoftc *);
-void create_free_queue(struct vxsoftc *);
-short dtr_ctl(struct vxsoftc *, int, int);
-int env_isvalid(struct envelope *);
-struct envelope *find_status_packet(struct vxsoftc *, struct packet *);
-short flush_ctl(struct vxsoftc *, int, int);
-struct envelope *get_cmd_tail(struct vxsoftc *);
-void *get_free_envelope(struct vxsoftc *);
-void *get_free_packet(struct vxsoftc *);
-struct envelope *get_next_envelope(struct vxsoftc *, struct envelope *);
-struct packet *get_packet(struct vxsoftc *, struct envelope *);
-struct envelope *get_status_head(struct vxsoftc *);
-void put_free_envelope(struct vxsoftc *, void *);
-void put_free_packet(struct vxsoftc *, void *);
-void read_chars(struct vxsoftc *, int);
-void read_wakeup(struct vxsoftc *, int);
-short rts_ctl(struct vxsoftc *, int, int);
-void set_status_head(struct vxsoftc *, void *);
-void vx_break(struct vxsoftc *, int);
-int vx_ccparam(struct vxsoftc *, struct termios *, int);
-int vx_event(struct vxsoftc *, struct packet *);
-void vx_frame(struct vxsoftc *, int);
-int vx_init(struct vxsoftc *);
-int vx_intr(void *);
-int vx_mctl(dev_t, int, int);
-void vx_overflow(struct vxsoftc *, int, long *, u_char *);
-int vx_param(struct tty *, struct termios *);
-int vx_poll(struct vxsoftc *, struct packet *);
-void vxputc(struct vxsoftc *, int, u_char);
-int vx_sintr(struct vxsoftc *);
-void vxstart(struct tty *tp);
-u_short vxtspeed(int);
-void vx_unblock(struct tty *);
-
-/* flags for bpp_send() */
-#define NOWAIT 0
-#define WAIT 1
-
-#define VX_UNIT(x) (minor(x) / NVXPORTS)
-#define VX_PORT(x) (minor(x) % NVXPORTS)
-
-/*
- * Convert dual-ported physical addresse to host virtual address, and the
- * opposite.
- */
-#define VIRTUAL(addr) (((addr) & 0xffff) + sc->board_vaddr)
-#define PHYSICAL(addr) \
- (((addr - sc->board_vaddr) & 0xffff) | LOCAL_DPMEM_ADDRESS)
-
-#if 0
-#define LO(x) (u_short)((unsigned long)x & 0x0000FFFF)
-#define HI(x) (u_short)((unsigned long)x >> 16)
-#else
-#define LO(x) (u_short)(x)
-#define HI(x) (LOCAL_DPMEM_ADDRESS >> 16)
-#endif
-
-struct tty *
-vxtty(dev_t dev)
-{
- int unit, port;
- struct vxsoftc *sc;
-
- unit = VX_UNIT(dev);
- if (unit >= vx_cd.cd_ndevs ||
- (sc = (struct vxsoftc *)vx_cd.cd_devs[unit]) == NULL) {
- return (NULL);
- }
- port = VX_PORT(dev);
- return sc->sc_info[port].tty;
-}
-
-int
-vxmatch(struct device *parent, void *self, void *aux)
-{
- struct vxreg *vx_reg;
- struct confargs *ca = aux;
- bus_space_tag_t iot = ca->ca_iot;
- bus_space_handle_t ioh;
- int rc;
-
- if (bus_space_map(iot, ca->ca_paddr, 0x10000, 0, &ioh) != 0)
- return 0;
- vx_reg = (struct vxreg *)bus_space_vaddr(iot, ioh);
- rc = badaddr((vaddr_t)&vx_reg->ipc_cr, 1);
- bus_space_unmap(iot, ioh, 0x10000);
-
- return rc == 0;
-}
-
-void
-vxattach(struct device *parent, struct device *self, void *aux)
-{
- struct vxsoftc *sc = (struct vxsoftc *)self;
- struct confargs *ca = aux;
- bus_space_tag_t iot = ca->ca_iot;
- bus_space_handle_t ioh;
-
- if (ca->ca_vec < 0) {
- printf(": no more interrupts!\n");
- return;
- }
- if (ca->ca_ipl < 0)
- ca->ca_ipl = IPL_TTY;
-
- if (bus_space_map(iot, ca->ca_paddr, 0x10000, 0, &ioh) != 0) {
- printf(": can't map registers!\n");
- return;
- }
-
- /* set up dual port memory and registers and init */
- sc->board_vaddr = (vaddr_t)bus_space_vaddr(iot, ioh);
- sc->vx_reg = (struct vxreg *)sc->board_vaddr;
- sc->channel = (struct channel *)(sc->board_vaddr + 0x0100);
- sc->sc_vec = ca->ca_vec;
-
- printf("\n");
-
- if (create_channels(sc) != 0) {
- printf("%s: failed to create channel %d\n",
- sc->sc_dev.dv_xname, sc->channel->channel_number);
- return;
- }
- if (vx_init(sc) != 0) {
- printf("%s: failed to initialize\n", sc->sc_dev.dv_xname);
- return;
- }
-
- /* enable interrupts */
- sc->sc_ih.ih_fn = vx_intr;
- sc->sc_ih.ih_arg = sc;
- sc->sc_ih.ih_wantframe = 0;
- sc->sc_ih.ih_ipl = IPL_TTY;
-
- vmeintr_establish(ca->ca_vec, &sc->sc_ih, self->dv_xname);
-}
-
-short
-dtr_ctl(struct vxsoftc *sc, int port, int on)
-{
- struct packet pkt;
-
- bzero(&pkt, sizeof(struct packet));
- pkt.command = CMD_IOCTL;
- pkt.ioctl_cmd_l = IOCTL_TCXONC;
- pkt.command_pipe_number = sc->channel_number;
- pkt.status_pipe_number = sc->channel_number;
- pkt.device_number = port;
- if (on) {
- pkt.ioctl_arg_l = 6; /* assert DTR */
- } else {
- pkt.ioctl_arg_l = 7; /* negate DTR */
- }
-
- return bpp_send(sc, &pkt, WAIT);
-}
-
-short
-rts_ctl(struct vxsoftc *sc, int port, int on)
-{
- struct packet pkt;
-
- bzero(&pkt, sizeof(struct packet));
- pkt.command = CMD_IOCTL;
- pkt.ioctl_cmd_l = IOCTL_TCXONC;
- pkt.command_pipe_number = sc->channel_number;
- pkt.status_pipe_number = sc->channel_number;
- pkt.device_number = port;
- if (on) {
- pkt.ioctl_arg_l = 4; /* assert RTS */
- } else {
- pkt.ioctl_arg_l = 5; /* negate RTS */
- }
-
- return bpp_send(sc, &pkt, WAIT);
-}
-
-#if 0
-short
-flush_ctl(struct vxsoftc *sc, int port, int which)
-{
- struct packet pkt;
-
- bzero(&pkt, sizeof(struct packet));
- pkt.command = CMD_IOCTL;
- pkt.ioctl_cmd_l = IOCTL_TCFLSH;
- pkt.command_pipe_number = sc->channel_number;
- pkt.status_pipe_number = sc->channel_number;
- pkt.device_number = port;
- pkt.ioctl_arg_l = which; /* 0=input, 1=output, 2=both */
-
- return bpp_send(sc, &pkt, WAIT);
-}
-#endif
-
-int
-vx_mctl(dev_t dev, int bits, int how)
-{
- int s, unit, port;
- struct vxsoftc *sc;
- struct vx_info *vxt;
- u_char msvr;
-
- unit = VX_UNIT(dev);
- port = VX_PORT(dev);
- sc = (struct vxsoftc *)vx_cd.cd_devs[unit];
- vxt = &sc->sc_info[port];
-
- s = splvx();
- switch (how) {
- case DMSET:
- if (bits & TIOCM_RTS) {
- rts_ctl(sc, port, 1);
- vxt->vx_linestatus |= TIOCM_RTS;
- } else {
- rts_ctl(sc, port, 0);
- vxt->vx_linestatus &= ~TIOCM_RTS;
- }
- if (bits & TIOCM_DTR) {
- dtr_ctl(sc, port, 1);
- vxt->vx_linestatus |= TIOCM_DTR;
- } else {
- dtr_ctl(sc, port, 0);
- vxt->vx_linestatus &= ~TIOCM_DTR;
- }
- break;
- case DMBIC:
- if (bits & TIOCM_RTS) {
- rts_ctl(sc, port, 0);
- vxt->vx_linestatus &= ~TIOCM_RTS;
- }
- if (bits & TIOCM_DTR) {
- dtr_ctl(sc, port, 0);
- vxt->vx_linestatus &= ~TIOCM_DTR;
- }
- break;
-
- case DMBIS:
- if (bits & TIOCM_RTS) {
- rts_ctl(sc, port, 1);
- vxt->vx_linestatus |= TIOCM_RTS;
- }
- if (bits & TIOCM_DTR) {
- dtr_ctl(sc, port, 1);
- vxt->vx_linestatus |= TIOCM_DTR;
- }
- break;
-
- case DMGET:
- bits = 0;
- msvr = vxt->vx_linestatus;
- if (msvr & TIOCM_DSR) {
- bits |= TIOCM_DSR;
- }
- if (msvr & TIOCM_CD) {
- bits |= TIOCM_CD;
- }
- if (msvr & TIOCM_CTS) {
- bits |= TIOCM_CTS;
- }
- if (msvr & TIOCM_DTR) {
- bits |= TIOCM_DTR;
- }
- if (msvr & TIOCM_RTS) {
- bits |= TIOCM_RTS;
- }
- break;
- }
-
- splx(s);
-
-#if 0
- bits = 0;
- bits |= TIOCM_DTR;
- bits |= TIOCM_RTS;
- bits |= TIOCM_CTS;
- bits |= TIOCM_CD;
- bits |= TIOCM_DSR;
-#endif
- return (bits);
-}
-
-int
-vxopen(dev_t dev, int flag, int mode, struct proc *p)
-{
- int s, unit, port, error;
- struct vx_info *vxt;
- struct vxsoftc *sc;
- struct tty *tp;
- struct packet opkt;
- u_short code;
-
- unit = VX_UNIT(dev);
- port = VX_PORT(dev);
- if (unit >= vx_cd.cd_ndevs ||
- (sc = (struct vxsoftc *) vx_cd.cd_devs[unit]) == NULL) {
- return (ENODEV);
- }
- vxt = &sc->sc_info[port];
-
-#if 0
- flush_ctl(sc, port, 2);
-#endif
-
- bzero(&opkt, sizeof(struct packet));
- opkt.command_pipe_number = sc->channel_number;
- opkt.status_pipe_number = sc->channel_number;
- opkt.command = CMD_OPEN;
- opkt.device_number = port;
-
- if ((error = bpp_send(sc, &opkt, WAIT)) != 0) {
-#ifdef DEBUG_VXT
- printf("unit %d, port %d, ", unit, port);
- printf("error = %d\n", error);
-#endif
- return (ENXIO);
- }
-
- code = opkt.event_code;
-
- s = splvx();
- if (vxt->tty) {
- tp = vxt->tty;
- } else {
- tp = vxt->tty = ttymalloc(0);
- }
-
- /* set line status */
- tp->t_state |= TS_CARR_ON;
- if (code & E_DCD) {
- tp->t_state |= TS_CARR_ON;
- vxt->vx_linestatus |= TIOCM_CD;
- }
- if (code & E_DSR) {
- vxt->vx_linestatus |= TIOCM_DSR;
- }
- if (code & E_CTS) {
- vxt->vx_linestatus |= TIOCM_CTS;
- }
-
- tp->t_oproc = vxstart;
- tp->t_param = vx_param;
- tp->t_dev = dev;
-
- if ((tp->t_state & TS_ISOPEN) == 0) {
- tp->t_state |= TS_WOPEN;
- ttychars(tp);
- if (tp->t_ispeed == 0) {
- /*
- * only when cleared do we reset to defaults.
- */
- tp->t_iflag = TTYDEF_IFLAG;
- tp->t_oflag = TTYDEF_OFLAG;
- tp->t_lflag = TTYDEF_LFLAG;
- tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
- tp->t_cflag = TTYDEF_CFLAG;
- }
- /*
- * do these all the time
- */
- if (vxt->vx_swflags & TIOCFLAG_CLOCAL)
- tp->t_cflag |= CLOCAL;
- if (vxt->vx_swflags & TIOCFLAG_CRTSCTS)
- tp->t_cflag |= CRTSCTS;
- if (vxt->vx_swflags & TIOCFLAG_MDMBUF)
- tp->t_cflag |= MDMBUF;
- vx_param(tp, &tp->t_termios);
- ttsetwater(tp);
-
- (void)vx_mctl(dev, TIOCM_DTR | TIOCM_RTS, DMSET);
-
- tp->t_state |= TS_CARR_ON;
- } else if (tp->t_state & TS_XCLUDE && suser(p, 0) != 0) {
- splx(s);
- return (EBUSY);
- }
-
- /*
- * Reset the tty pointer, as there could have been a dialout
- * use of the tty with a dialin open waiting.
- */
- tp->t_dev = dev;
- vxt->open = 1;
- splx(s);
- return (*linesw[tp->t_line].l_open)(dev, tp, p);
-}
-
-int
-vx_param(struct tty *tp, struct termios *t)
-{
- int unit, port;
- struct vxsoftc *sc;
- dev_t dev;
-
- dev = tp->t_dev;
- unit = VX_UNIT(dev);
- if (unit >= vx_cd.cd_ndevs ||
- (sc = (struct vxsoftc *) vx_cd.cd_devs[unit]) == NULL) {
- return (ENODEV);
- }
- port = VX_PORT(dev);
- tp->t_ispeed = t->c_ispeed;
- tp->t_ospeed = t->c_ospeed;
- tp->t_cflag = t->c_cflag;
- vx_ccparam(sc, t, port);
- vx_unblock(tp);
- return 0;
-}
-
-int
-vxclose(dev_t dev, int flag, int mode, struct proc *p)
-{
- int unit, port;
- struct tty *tp;
- struct vx_info *vxt;
- struct vxsoftc *sc;
- int s;
- struct packet cpkt;
-
- unit = VX_UNIT(dev);
- if (unit >= vx_cd.cd_ndevs ||
- (sc = (struct vxsoftc *) vx_cd.cd_devs[unit]) == NULL) {
- return (ENODEV);
- }
- port = VX_PORT(dev);
- vxt = &sc->sc_info[port];
-#if 0
- flush_ctl(sc, port, 2); /* flush both input and output */
-#endif
-
- tp = vxt->tty;
- (*linesw[tp->t_line].l_close)(tp, flag, p);
-
- s = splvx();
-
- if ((tp->t_cflag & HUPCL) != 0) {
- rts_ctl(sc, port, 0);
- dtr_ctl(sc, port, 0);
- }
-
- bzero(&cpkt, sizeof(struct packet));
- cpkt.command_pipe_number = sc->channel_number;
- cpkt.status_pipe_number = sc->channel_number;
- cpkt.command = CMD_CLOSE;
- cpkt.device_number = port;
- bpp_send(sc, &cpkt, NOWAIT);
-
- vxt->open = 0;
- splx(s);
- ttyclose(tp);
-
- return (0);
-}
-
-void
-read_wakeup(struct vxsoftc *sc, int port)
-{
- struct packet rwp;
- struct vx_info *volatile vxt;
-
- vxt = &sc->sc_info[port];
- /*
- * If we already have a read_wakeup paket
- * for this port, do nothing.
- */
- if (vxt->read_pending != 0)
- return;
- else
- vxt->read_pending = 1;
-
- bzero(&rwp, sizeof(struct packet));
- rwp.command_pipe_number = sc->channel_number;
- rwp.status_pipe_number = sc->channel_number;
- rwp.command = CMD_READW;
- rwp.device_number = port;
-
- /*
- * Do not wait. Characters will be transferred
- * to (*linesw[tp->t_line].l_rint)(c, tp); by
- * vx_intr() (IPC will notify via interrupt)
- */
- bpp_send(sc, &rwp, NOWAIT);
-}
-
-int
-vxread(dev_t dev, struct uio *uio, int flag)
-{
- int unit, port;
- struct tty *tp;
- struct vx_info *volatile vxt;
- struct vxsoftc *volatile sc;
-
- unit = VX_UNIT(dev);
- if (unit >= vx_cd.cd_ndevs ||
- (sc = (struct vxsoftc *) vx_cd.cd_devs[unit]) == NULL) {
- return (ENODEV);
- }
- port = VX_PORT(dev);
- vxt = &sc->sc_info[port];
- tp = vxt->tty;
- if (!tp)
- return ENXIO;
- return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
-}
-
-int
-vxwrite(dev_t dev, struct uio *uio, int flag)
-{
- int unit, port;
- struct tty *tp;
- struct vx_info *vxt;
- struct vxsoftc *sc;
- struct wring *wp;
- struct packet wwp;
- u_short get, put;
-
- unit = VX_UNIT(dev);
- if (unit >= vx_cd.cd_ndevs ||
- (sc = (struct vxsoftc *) vx_cd.cd_devs[unit]) == NULL) {
- return (ENODEV);
- }
- port = VX_PORT(dev);
- vxt = &sc->sc_info[port];
- tp = vxt->tty;
- if (!tp)
- return ENXIO;
-
- wp = sc->sc_info[port].wringp;
- get = wp->get;
- put = wp->put;
- if ((put + 1) == get) {
- bzero(&wwp, sizeof(struct packet));
- wwp.command_pipe_number = sc->channel_number;
- wwp.status_pipe_number = sc->channel_number;
- wwp.command = CMD_WRITEW;
- wwp.device_number = port;
- if (bpp_send(sc, &wwp, WAIT))
- return (ENXIO);
- }
-
- return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
-}
-
-int
-vxioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
-{
- int error;
- int unit, port;
- struct tty *tp;
- struct vx_info *vxt;
- struct vxsoftc *sc;
-
- unit = VX_UNIT(dev);
- if (unit >= vx_cd.cd_ndevs ||
- (sc = (struct vxsoftc *) vx_cd.cd_devs[unit]) == NULL) {
- return (ENODEV);
- }
- port = VX_PORT(dev);
- vxt = &sc->sc_info[port];
- tp = vxt->tty;
- if (!tp)
- return ENXIO;
-
- error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
- if (error >= 0)
- return (error);
-
- error = ttioctl(tp, cmd, data, flag, p);
- if (error >= 0)
- return (error);
-
- switch (cmd) {
- case TIOCSBRK:
- /* */
- break;
-
- case TIOCCBRK:
- /* */
- break;
-
- case TIOCSDTR:
- vx_mctl(dev, TIOCM_DTR | TIOCM_RTS, DMBIS);
- break;
-
- case TIOCCDTR:
- vx_mctl(dev, TIOCM_DTR | TIOCM_RTS, DMBIC);
- break;
-
- case TIOCMSET:
- vx_mctl(dev, *(int *)data, DMSET);
- break;
-
- case TIOCMBIS:
- vx_mctl(dev, *(int *)data, DMBIS);
- break;
-
- case TIOCMBIC:
- vx_mctl(dev, *(int *)data, DMBIC);
- break;
-
- case TIOCMGET:
- *(int *)data = vx_mctl(dev, 0, DMGET);
- break;
-
- case TIOCGFLAGS:
- *(int *)data = vxt->vx_swflags;
- break;
-
- case TIOCSFLAGS:
- error = suser(p, 0);
- if (error != 0)
- return (EPERM);
-
- vxt->vx_swflags = *(int *)data;
- vxt->vx_swflags &= /* only allow valid flags */
- (TIOCFLAG_SOFTCAR | TIOCFLAG_CLOCAL | TIOCFLAG_CRTSCTS);
- break;
-
- default:
- return (ENOTTY);
- }
-
- return 0;
-}
-
-int
-vxstop(struct tty *tp, int flag)
-{
- int s;
-
- s = splvx();
- if (tp->t_state & TS_BUSY) {
- if ((tp->t_state & TS_TTSTOP) == 0)
- tp->t_state |= TS_FLUSH;
- }
- splx(s);
- return 0;
-}
-
-void
-vxputc(struct vxsoftc *sc, int port, u_char c)
-{
- struct wring *wp;
-
- wp = sc->sc_info[port].wringp;
- wp->data[wp->put++ & (WRING_BUF_SIZE - 1)] = c;
- wp->put &= (WRING_BUF_SIZE - 1);
-}
-
-u_short
-vxtspeed(int speed)
-{
- switch (speed) {
- case B0:
- return VB0;
- case B50:
- return VB50;
- case B75:
- return VB75;
- case B110:
- return VB110;
- case B134:
- return VB134;
- case B150:
- return VB150;
- case B200:
- return VB200;
- case B300:
- return VB300;
- case B600:
- return VB600;
- case B1200:
- return VB1200;
- case B1800:
- return VB1800;
- case B2400:
- return VB2400;
- case B4800:
- return VB4800;
- case B9600:
- return VB9600;
- case B19200:
- return VB19200;
- case B38400:
- return VB38400;
- default:
- return VB9600;
- }
-}
-
-int
-vx_ccparam(struct vxsoftc *sc, struct termios *par, int port)
-{
- int imask = 0, s;
- int cflag;
- struct packet pkt;
-
- if (par->c_ospeed == 0) {
- s = splvx();
- /* disconnect, drop RTS DTR stop receiver */
- rts_ctl(sc, port, 0);
- dtr_ctl(sc, port, 0);
- splx(s);
- return (0xff);
- }
-
- bzero(&pkt, sizeof(struct packet));
- pkt.command = CMD_IOCTL;
- pkt.ioctl_cmd_l = IOCTL_TCGETA;
- pkt.command_pipe_number = sc->channel_number;
- pkt.status_pipe_number = sc->channel_number;
- pkt.device_number = port;
- if (bpp_send(sc, &pkt, WAIT))
- return 0xff;
-
- cflag = pkt.pb.tio.c_cflag;
- cflag |= vxtspeed(par->c_ospeed);
-
- switch (par->c_cflag & CSIZE) {
- case CS5:
- cflag |= VCS5;
- imask = 0x1F;
- break;
- case CS6:
- cflag |= VCS6;
- imask = 0x3F;
- break;
- case CS7:
- cflag |= VCS7;
- imask = 0x7F;
- break;
- default:
- cflag |= VCS8;
- imask = 0xFF;
- }
-
- if (par->c_cflag & PARENB) cflag |= VPARENB;
- else cflag &= ~VPARENB;
- if (par->c_cflag & PARODD) cflag |= VPARODD;
- else cflag &= ~VPARODD;
- if (par->c_cflag & CREAD) cflag |= VCREAD;
- else cflag &= ~VCREAD;
- if (par->c_cflag & CLOCAL) cflag |= VCLOCAL;
- else cflag &= ~VCLOCAL;
- if (par->c_cflag & HUPCL) cflag |= VHUPCL;
- else cflag &= ~VHUPCL;
-
- pkt.command = CMD_IOCTL;
- pkt.ioctl_cmd_l = IOCTL_TCSETA;
- pkt.command_pipe_number = sc->channel_number;
- pkt.status_pipe_number = sc->channel_number;
- pkt.device_number = port;
- pkt.pb.tio.c_cflag = cflag;
- if (bpp_send(sc, &pkt, WAIT))
- return 0xff;
-
- return imask;
-}
-
-void
-vx_unblock(struct tty *tp)
-{
- tp->t_state &= ~TS_FLUSH;
- if (tp->t_outq.c_cc != 0)
- vxstart(tp);
-}
-
-void
-vxstart(struct tty *tp)
-{
- dev_t dev;
- struct vxsoftc *sc;
- struct wring *wp;
- int cc, port, unit, s, cnt, i;
- u_short get, put;
- char buffer[256];
-
- dev = tp->t_dev;
- port = VX_PORT(dev);
- unit = VX_UNIT(dev);
- if (unit >= vx_cd.cd_ndevs ||
- (sc = (struct vxsoftc *) vx_cd.cd_devs[unit]) == NULL) {
- return;
- }
-
- if ((tp->t_state & TS_ISOPEN) == 0)
- return;
-
- s = splvx();
- if ((tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP | TS_FLUSH)) == 0) {
- tp->t_state |= TS_BUSY;
- wp = sc->sc_info[port].wringp;
- get = wp->get;
- put = wp->put;
- cc = tp->t_outq.c_cc;
- while (cc > 0) {
- cnt = min(sizeof buffer, cc);
- cnt = q_to_b(&tp->t_outq, buffer, cnt);
- buffer[cnt] = 0;
- for (i = 0; i < cnt; i++) {
- vxputc(sc, port, buffer[i]);
- }
- cc -= cnt;
- }
- tp->t_state &= ~TS_BUSY;
- }
- splx(s);
-}
-
-void
-read_chars(struct vxsoftc *sc, int port)
-{
- /*
- * This routine is called by vx_intr() when there are
- * characters in the read ring. It will process one
- * cooked line, put the chars in the line disipline ring,
- * and then return. The characters may then
- * be read by vxread.
- */
- struct vx_info *vxt;
- struct rring *rp;
- struct tty *tp;
- u_short get, put;
- int frame_count, i, open;
- char c;
-
- vxt = &sc->sc_info[port];
- tp = vxt->tty;
- rp = vxt->rringp;
- open = vxt->open;
- get = rp->get;
- put = rp->put;
-#ifdef DEBUG_VXT
- printf("read_chars() get=%d, put=%d ", get, put);
- printf("open = %d ring at 0x%x\n", open, rp);
-#endif
- while (get != put) {
- frame_count = rp->data[rp->get++ & (RRING_BUF_SIZE - 1)];
- rp->get &= (RRING_BUF_SIZE - 1);
- for (i = 0; i < frame_count; i++) {
- c = rp->data[rp->get++ & (RRING_BUF_SIZE - 1)];
- rp->get &= (RRING_BUF_SIZE - 1);
- if (open)
- (*linesw[tp->t_line].l_rint)(c, tp);
- }
- c = rp->data[rp->get++ & (RRING_BUF_SIZE - 1)];
- rp->get &= (RRING_BUF_SIZE - 1);
- if (!(c & DELIMITER)) {
- vx_frame(sc, port);
- break;
- } else {
- break;
- }
- get = rp->get;
- put = rp->put;
- }
- vxt->read_pending = 0;
- read_wakeup(sc, port);
-}
-
-void
-ccode(struct vxsoftc *sc, int port, char c)
-{
- struct vx_info *vxt;
- struct tty *tp;
-
- vxt = &sc->sc_info[port];
- tp = vxt->tty;
- (*linesw[tp->t_line].l_rint)(c, tp);
-}
-
-int
-vx_intr(void *arg)
-{
- struct vxsoftc *sc = arg;
- struct envelope *envp, *next_envp;
- struct packet *pktp, pkt;
- int valid;
- short cmd;
- u_char port;
-
- while (env_isvalid(get_status_head(sc))) {
- pktp = get_packet(sc, get_status_head(sc));
- valid = env_isvalid(get_status_head(sc));
- cmd = pktp->command;
- port = pktp->device_number;
- /*
- * If we are waiting on this packet, store the info
- * so bpp_send can process the packet
- */
- if (sc->sc_bppwait_pktp == pktp)
- d16_bcopy(pktp, &sc->sc_bppwait_pkt, sizeof(struct packet));
-
- d16_bcopy(pktp, &pkt, sizeof(struct packet));
- next_envp = get_next_envelope(sc, get_status_head(sc));
- envp = get_status_head(sc);
- /* return envelope and packet to the free queues */
- put_free_envelope(sc, envp);
- put_free_packet(sc, pktp);
- /* mark new status pipe head pointer */
- set_status_head(sc, next_envp);
- /* if it was valid, process packet */
- switch (cmd) {
- case CMD_READW:
-#ifdef DEBUG_VXT
- printf("READW Packet\n");
-#endif
- read_chars(sc, port);
- break;
- case CMD_WRITEW:
-#ifdef DEBUG_VXT
- printf("WRITEW Packet\n"); /* Still don't know XXXsmurph */
-#endif
- break;
- case CMD_EVENT:
-#ifdef DEBUG_VXT
- printf("EVENT Packet\n");
-#endif
- vx_event(sc, &pkt);
- break;
- case CMD_PROCESSED:
-#ifdef DEBUG_VXT
- printf("CMD_PROCESSED Packet\n");
-#endif
- break;
- default:
-#ifdef DEBUG_VXT
- printf("Other packet 0x%x\n", cmd);
-#endif
- break;
- }
- }
- return 1;
-}
-
-int
-vx_event(struct vxsoftc *sc, struct packet *evntp)
-{
- u_short code = evntp->event_code;
- struct packet evnt;
- struct vx_info *vxt;
-
- vxt = &sc->sc_info[evntp->device_number];
-
- if (code & E_INTR) {
- ccode(sc, evntp->device_number, CINTR);
- }
- if (code & E_QUIT) {
- ccode(sc, evntp->device_number, CQUIT);
- }
- if (code & E_HUP) {
- rts_ctl(sc, evntp->device_number, 0);
- dtr_ctl(sc, evntp->device_number, 0);
- }
- if (code & E_DCD) {
- vxt->vx_linestatus |= TIOCM_CD;
- }
- if (code & E_DSR) {
- vxt->vx_linestatus |= TIOCM_DSR;
- }
- if (code & E_CTS) {
- vxt->vx_linestatus |= TIOCM_CTS;
- }
- if (code & E_LOST_DCD) {
- vxt->vx_linestatus &= ~TIOCM_CD;
- }
- if (code & E_LOST_DSR) {
- vxt->vx_linestatus &= ~TIOCM_DSR;
- }
- if (code & E_LOST_CTS) {
- vxt->vx_linestatus &= ~TIOCM_CTS;
- }
- if (code & E_PR_FAULT) {
- /* do something... */
- }
- if (code & E_PR_POUT) {
- /* do something... */
- }
- if (code & E_PR_SELECT) {
- /* do something... */
- }
- if (code & E_SWITCH) {
- /* do something... */
- }
- if (code & E_BREAK) {
- vx_break(sc, evntp->device_number);
- }
-
- /* send an event packet back to the device */
- bzero(&evnt, sizeof(struct packet));
- evnt.command = CMD_EVENT;
- evnt.device_number = evntp->device_number;
- evnt.command_pipe_number = sc->channel_number;
- /* return status on same channel */
- evnt.status_pipe_number = sc->channel_number;
- /* send packet to the firmware */
- bpp_send(sc, &evnt, NOWAIT);
-
- return 1;
-}
-
-void
-vx_overflow(struct vxsoftc *sc, int port, long *ptime, u_char *msg)
-{
- log(LOG_WARNING, "%s port %d: overrun\n",
- sc->sc_dev.dv_xname, port);
-}
-
-void
-vx_frame(struct vxsoftc *sc, int port)
-{
- log(LOG_WARNING, "%s port %d: frame error\n",
- sc->sc_dev.dv_xname, port);
-}
-
-void
-vx_break(struct vxsoftc *sc, int port)
-{
- /*
- * No need to check for a ddb break, as the console can never be on
- * this hardware.
- */
- log(LOG_WARNING, "%s port %d: break detected\n",
- sc->sc_dev.dv_xname, port);
-}
-
-/*
- * Initialization and Buffered Pipe Protocol (BPP) code
- */
-
-void
-create_free_queue(struct vxsoftc *sc)
-{
- int i;
- struct envelope *envp, env;
- struct packet *pktp, pkt;
-
- envp = (struct envelope *)VIRTUAL(ENVELOPE_AREA);
- sc->elist_head = envp;
- for (i = 1; i <= NENVELOPES; i++) {
- bzero(&env, sizeof(struct envelope));
- if (i == NENVELOPES)
- env.link = 0;
- else
- env.link = ENVELOPE_AREA + i * sizeof(struct envelope);
- env.packet_ptr = 0;
- env.valid_flag = 0;
- d16_bcopy(&env, envp, sizeof(struct envelope));
- envp++;
- }
- sc->elist_tail = --envp;
-
- pktp = (struct packet *)VIRTUAL(PACKET_AREA);
- sc->plist_head = pktp;
- for (i = 1; i <= NPACKETS; i++) {
- bzero(&pkt, sizeof(struct packet));
- if (i == NPACKETS)
- pkt.link = 0;
- else
- pkt.link = PACKET_AREA + i * sizeof(struct packet);
- d16_bcopy(&pkt, pktp, sizeof(struct packet));
- pktp++;
- }
- sc->plist_tail = --pktp;
-}
-
-void *
-get_free_envelope(struct vxsoftc *sc)
-{
- struct envelope *envp;
- paddr_t link;
-
- envp = sc->elist_head;
- /* pick envelope next pointer from the envelope itself */
- d16_bcopy((const void *)&envp->link, &link, sizeof link);
- sc->elist_head = (struct envelope *)VIRTUAL(link);
- d16_bzero(envp, sizeof(struct envelope));
-
- return envp;
-}
-
-void
-put_free_envelope(struct vxsoftc *sc, void *ep)
-{
- struct envelope *envp = (struct envelope *)ep;
- u_long link;
-
-#if 0
- d16_bzero(envp, sizeof(struct envelope));
-#endif
- /* put envelope next pointer in the envelope itself */
- link = PHYSICAL((vaddr_t)envp);
- d16_bzero((void *)&envp->link, sizeof envp->link);
- d16_bcopy(&link, (void *)&sc->elist_tail->link, sizeof link);
-
- sc->elist_tail = envp;
-}
-
-void *
-get_free_packet(struct vxsoftc *sc)
-{
- struct packet *pktp;
- paddr_t link;
-
- pktp = sc->plist_head;
- /* pick packet next pointer from the packet itself */
- d16_bcopy((const void *)&pktp->link, &link, sizeof link);
- sc->plist_head = (struct packet *)VIRTUAL(link);
- d16_bzero(pktp, sizeof(struct packet));
-
- return pktp;
-}
-
-void
-put_free_packet(struct vxsoftc *sc, void *pp)
-{
- struct packet *pktp = (struct packet *)pp;
- u_long link;
-
-#if 0
- d16_bzero(pktp, sizeof(struct packet));
-#endif
- pktp->command = CMD_PROCESSED;
- /* put packet next pointer in the packet itself */
- link = PHYSICAL((vaddr_t)pktp);
- d16_bzero((void *)&pktp->link, sizeof pktp->link);
- d16_bcopy(&link, (void *)&sc->plist_tail->link, sizeof link);
-
- sc->plist_tail = pktp;
-}
-
-/*
- * This is the nitty gritty. All the rest if this code
- * was hell to come by. Getting this right from the
- * Moto manual took *time*!
- */
-int
-create_channels(struct vxsoftc *sc)
-{
- u_long envp;
- u_short status;
- u_short tas;
- struct vxreg *ipc_csr = sc->vx_reg;
-
- /* wait for busy bit to clear */
- while ((ipc_csr->ipc_cr & IPC_CR_BUSY))
- ;
-
- create_free_queue(sc);
-
- /* set up channel header. we only want one */
- tas = ipc_csr->ipc_tas;
- while (!(tas & IPC_TAS_VALID_STATUS)) {
- envp = PHYSICAL((vaddr_t)get_free_envelope(sc));
- sc->channel->command_pipe_head_ptr_h = HI(envp);
- sc->channel->command_pipe_head_ptr_l = LO(envp);
- sc->channel->command_pipe_tail_ptr_h =
- sc->channel->command_pipe_head_ptr_h;
- sc->channel->command_pipe_tail_ptr_l =
- sc->channel->command_pipe_head_ptr_l;
- envp = PHYSICAL((vaddr_t)get_free_envelope(sc));
- sc->channel->status_pipe_head_ptr_h = HI(envp);
- sc->channel->status_pipe_head_ptr_l = LO(envp);
- sc->channel->status_pipe_tail_ptr_h =
- sc->channel->status_pipe_head_ptr_h;
- sc->channel->status_pipe_tail_ptr_l =
- sc->channel->status_pipe_head_ptr_l;
- sc->channel->interrupt_level = IPL_TTY;
- sc->channel->interrupt_vec = sc->sc_vec;
- sc->channel->channel_priority = 0;
- sc->channel->channel_number = 0;
- sc->channel->valid = 1;
- sc->channel->address_modifier = 0x8d; /* A32/D16 supervisor data access */
- sc->channel->datasize = 0; /* 32 bit data mode */
-
- /* loop until TAS bit is zero */
- while ((ipc_csr->ipc_tas & IPC_TAS_TAS))
- ;
- ipc_csr->ipc_tas |= IPC_TAS_TAS;
- /* load address of channel header */
- ipc_csr->ipc_addrh = HI(CHANNEL_H);
- ipc_csr->ipc_addrl = LO(CHANNEL_H);
- /* load address modifier reg (supervisor data access) */
- ipc_csr->ipc_amr = 0x8d;
- /* load tas with create channel command */
- ipc_csr->ipc_tas |= IPC_CSR_CREATE;
- /* set vaild command bit */
- ipc_csr->ipc_tas |= IPC_TAS_VALID_CMD;
- /* notify IPC of the CSR command */
- ipc_csr->ipc_cr |= IPC_CR_ATTEN;
-
- /* loop until IPC sets valid status bit */
- delay(5000);
- tas = ipc_csr->ipc_tas;
- }
-
- /* save the status */
- status = ipc_csr->ipc_sr;
- /* set COMMAND COMPLETE bit */
- ipc_csr->ipc_tas |= IPC_TAS_COMPLETE;
- /* notify IPC that we are through */
- ipc_csr->ipc_cr |= IPC_CR_ATTEN;
- /* check and see if the channel was created */
- if (status == 0 && sc->channel->valid) {
- sc->channel_number = sc->channel->channel_number;
-#ifdef DEBUG_VXT
- printf("%s: created channel %d\n", sc->sc_dev.dv_xname,
- sc->channel->channel_number);
-#endif
- return 0;
- } else {
- switch (status) {
- case 0x0000:
- printf("%s: channel not valid\n",
- sc->sc_dev.dv_xname);
- break;
- case 0xFFFF:
- printf("%s: invalid CSR command\n",
- sc->sc_dev.dv_xname);
- break;
- case 0xC000:
- printf("%s: could not read channel structure\n",
- sc->sc_dev.dv_xname);
- break;
- case 0x8000:
- printf("%s: could not write channel structure\n",
- sc->sc_dev.dv_xname);
- break;
- default:
- printf("%s: unknown IPC CSR command error 0x%x\n",
- sc->sc_dev.dv_xname, status);
- break;
- }
- return 1;
- }
-}
-
-struct envelope *
-get_next_envelope(struct vxsoftc *sc, struct envelope *thisenv)
-{
- paddr_t ptr;
-
- d16_bcopy((const void*)&thisenv->link, &ptr, sizeof ptr);
-
- return (struct envelope *)VIRTUAL(ptr);
-}
-
-int
-env_isvalid(struct envelope *thisenv)
-{
- return (int)thisenv->valid_flag;
-}
-
-struct envelope *
-get_cmd_tail(struct vxsoftc *sc)
-{
- paddr_t retaddr;
-
- retaddr = sc->channel->command_pipe_tail_ptr_h << 16;
- retaddr += sc->channel->command_pipe_tail_ptr_l;
- return (struct envelope *)VIRTUAL(retaddr);
-}
-
-struct envelope *
-get_status_head(struct vxsoftc *sc)
-{
- paddr_t retaddr;
-
- retaddr = sc->channel->status_pipe_head_ptr_h << 16;
- retaddr += sc->channel->status_pipe_head_ptr_l;
- return (struct envelope *)VIRTUAL(retaddr);
-}
-
-void
-set_status_head(struct vxsoftc *sc, void *envp)
-{
- paddr_t ptr;
-
- ptr = PHYSICAL((vaddr_t)envp);
- sc->channel->status_pipe_head_ptr_h = HI(ptr);
- sc->channel->status_pipe_head_ptr_l = LO(ptr);
-}
-
-struct packet *
-get_packet(struct vxsoftc *sc, struct envelope *thisenv)
-{
- paddr_t baseaddr;
-
- if (thisenv == NULL)
- return NULL;
-
- /*
- * packet ptr returned on status pipe is only last two bytes
- * so we must supply the full address based on the board address.
- * This also works for all envelopes because every address is an
- * offset to the board address.
- */
- d16_bcopy((const void *)&thisenv->packet_ptr, &baseaddr, sizeof baseaddr);
- return (struct packet *)VIRTUAL(baseaddr);
-}
-
-/*
- * Send a command via BPP
- */
-int
-bpp_send(struct vxsoftc *sc, void *pkt, int wait_flag)
-{
- struct envelope *envp;
- struct packet *pktp;
- paddr_t ptr;
- int tmo;
-
- /* load up packet in dual port mem */
- pktp = get_free_packet(sc);
- d16_bcopy(pkt, pktp, sizeof(struct packet));
-
- envp = get_cmd_tail(sc);
- ptr = PHYSICAL((vaddr_t)get_free_envelope(sc)); /* put a NULL env on the tail */
- sc->channel->command_pipe_tail_ptr_h = HI(ptr);
- sc->channel->command_pipe_tail_ptr_l = LO(ptr);
- d16_bcopy(&ptr, (void *)&envp->link, sizeof envp->link);
- ptr = PHYSICAL((vaddr_t)pktp);
- d16_bcopy(&ptr, (void *)&envp->packet_ptr, sizeof envp->packet_ptr);
- envp->valid_flag = 1;
-
- sc->vx_reg->ipc_cr |= IPC_CR_ATTEN;
-
- /* wait for a packet to return */
- if (wait_flag == NOWAIT)
- return 0;
-
- tmo = 0;
- while (pktp->command != CMD_PROCESSED) {
-#ifdef DEBUG_VXT
- printf("Polling for packet 0x%x in envelope 0x%x...\n", pktp, envp);
-#endif
- vx_intr(sc);
- if (++tmo > 20) {
- printf("%s: bpp_send pkt %x env %x timed out %d\n",
- sc->sc_dev.dv_xname, pktp, envp, pktp->command);
- return ETIMEDOUT;
- }
- delay(5000);
- }
- d16_bcopy(pktp, pkt, sizeof(struct packet));
- return pktp->error_l;
-}
-
-/*
- * BPP commands
- */
-
-int
-vx_init(struct vxsoftc *sc)
-{
- int i;
- int error;
- struct init_info *infp, inf;
- paddr_t wringp, rringp;
- struct packet init;
- struct packet evnt;
-
- /* init wait queue */
- d16_bzero(&sc->sc_bppwait_pkt, sizeof(struct packet));
- sc->sc_bppwait_pktp = NULL;
- /* set up init_info array */
- wringp = WRING_AREA;
- rringp = RRING_AREA;
- infp = (struct init_info *)VIRTUAL(INIT_INFO_AREA);
-
- for (i = 0; i < NVXPORTS; i++) {
- bzero(&inf, sizeof(struct init_info));
- inf.write_ring_ptr_h = HI(wringp);
- inf.write_ring_ptr_l = LO(wringp);
- sc->sc_info[i].wringp = (struct wring *)VIRTUAL(wringp);
- inf.read_ring_ptr_h = HI(rringp);
- inf.read_ring_ptr_l = LO(rringp);
- sc->sc_info[i].rringp = (struct rring *)VIRTUAL(rringp);
-#ifdef DEBUG_VXT
- printf("write at 0x%8x, read at 0x%8x\n", wringp, rringp);
-#endif
- inf.write_ring_size = WRING_DATA_SIZE;
- inf.read_ring_size = RRING_DATA_SIZE;
- inf.def_termio.c_iflag = VBRKINT;
- inf.def_termio.c_oflag = 0;
- inf.def_termio.c_cflag = (VB9600 | VCS8);
-
- inf.def_termio.c_lflag = VISIG; /* enable signal processing */
- inf.def_termio.c_line = 1; /* raw line discipline */
- inf.def_termio.c_cc[0] = CINTR;
- inf.def_termio.c_cc[1] = CQUIT;
- inf.def_termio.c_cc[2] = CERASE;
- inf.def_termio.c_cc[3] = CKILL;
- inf.def_termio.c_cc[4] = CEOF;
- inf.def_termio.c_cc[5] = CEOL;
- d16_bcopy(&inf, infp, sizeof(struct init_info));
- wringp += sizeof(struct wring);
- rringp += sizeof(struct rring);
- infp++;
- }
-
- /* set up init_packet */
- bzero(&init, sizeof(struct packet));
- init.command = CMD_INIT;
- init.command_pipe_number = sc->channel_number;
- /* return status on the same channel */
- init.status_pipe_number = sc->channel_number;
- init.interrupt_level = IPL_TTY;
- init.interrupt_vec = sc->sc_vec;
- init.init_info_ptr_h = HI(INIT_INFO_AREA);
- init.init_info_ptr_l = LO(INIT_INFO_AREA);
-
- /* send packet to the firmware and wait for completion */
- if ((error = bpp_send(sc, &init, WAIT)) != 0)
- return error;
-
- /* send one event packet to each device */
- for (i = 0; i < NVXPORTS; i++) {
- bzero(&evnt, sizeof(struct packet));
- evnt.command = CMD_EVENT;
- evnt.device_number = i;
- evnt.command_pipe_number = sc->channel_number;
- /* return status on same channel */
- evnt.status_pipe_number = sc->channel_number;
- /* send packet to the firmware */
- bpp_send(sc, &evnt, NOWAIT);
- }
-
- return 0;
-}
diff --git a/sys/arch/mvme88k/dev/vxreg.h b/sys/arch/mvme88k/dev/vxreg.h
deleted file mode 100644
index a5216b63454..00000000000
--- a/sys/arch/mvme88k/dev/vxreg.h
+++ /dev/null
@@ -1,414 +0,0 @@
-/* $OpenBSD: vxreg.h,v 1.9 2006/02/06 17:19:31 jmc Exp $ */
-
-/*
- * Copyright (c) 1999 Steve Murphree, Jr. All rights reserved.
- *
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Dale Rahn.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* IPC - Intelligent Peripheral Controller */
-
-struct vxreg {
-/*0x0*/volatile u_short ipc_addrh; /* IPC addr reg, most significant */
-/*0x2*/volatile u_short ipc_addrl; /* IPC addr reg, least significant */
-/*0x4*/volatile u_char ipc_amr; /* IPC address modifier reg */
-/*0x5*/volatile u_char unused1;
-/*0x6*/volatile u_short ipc_cr; /* IPC control reg */
-/*0x8*/volatile u_short ipc_sr; /* IPC status reg */
-/*0xA*/volatile u_char ipc_mdbp; /* IPC model data byte pointer */
-/*0xB*/volatile u_char reserved3;
-/*0xC*/volatile u_char ipc_avrp; /* IPC abort vector reg pointer */
-/*0xD*/volatile u_char unused2;
-/*0xE*/volatile u_short ipc_tas; /* IPC test and set reg */
-};
-
-#define IPC_CR_SYSFI 0x1000 /* inhibit sysfail */
-#define IPC_CR_ATTEN 0x2000 /* attention bit */
-#define IPC_CR_RESET 0x4000 /* reset bit */
-#define IPC_CR_BUSY 0x8000 /* busy bit */
-
-#define IPC_SR_BUSERROR 0x4000 /* bus error */
-#define IPC_SR_ERROR 0x8000 /* general error */
-#define IPC_SR_INVAL 0xFFFF /* invalid command */
-
-#define IPC_TAS_COMPLETE 0x1000
-#define IPC_TAS_VALID_STATUS 0x2000
-#define IPC_TAS_VALID_CMD 0x4000
-#define IPC_TAS_TAS 0x8000
-
-#define IPC_CSR_CREATE 0x0001
-#define IPC_CSR_DELETE 0x0002
-
-#define CSW_OFFSET 0x0010
-
-#define CMD_INIT 0x0000
-#define CMD_READW 0x0001
-#define CMD_WRITEW 0x0002
-#define CMD_OPEN 0x0003
-#define CMD_IOCTL 0x0004
-#define CMD_CLOSE 0x0005
-#define CMD_EVENT 0x0006
-#define CMD_PROCESSED 0x00FF
-
-#define IOCTL_LDOPEN 0x4400
-#define IOCTL_LDCLOSE 0x4401
-#define IOCTL_LDCHG 0x4402
-#define IOCTL_LDGETT 0x4408
-#define IOCTL_LDSETT 0x4409
-#define IOCTL_TCGETA 0x5401 /* get dev termio struct */
-#define IOCTL_TCSETA 0x5402 /* set dev termio struct */
-#define IOCTL_TCSETAW 0x5403 /* set dev termio struct - wait */
-#define IOCTL_TCSETAF 0x5404 /* set dev termio struct - wait - flush */
-#define IOCTL_TCSBRK 0x5405 /* transmit a break seq */
-#define IOCTL_TCXONC 0x5406 /* sus or res, xon or xoff, RTS or DTR */
-#define IOCTL_TCFLSH 0x5407 /* Flush */
-#define IOCTL_TCSETHW 0x5440 /* enable/disable HW handshake */
-#define IOCTL_TCGETHW 0x5441 /* get current HW handshake info */
-#define IOCTL_TCGETDL 0x5442 /* get daownloadable addr and mem size */
-#define IOCTL_TCDLOAD 0x5443 /* download code/data to mem */
-#define IOCTL_TCLINE 0x5444 /* copy line discipline */
-#define IOCTL_TCEXEC 0x5445 /* exec code in local mem */
-#define IOCTL_TCGETVR 0x5446 /* get version and revison of firmware */
-#define IOCTL_TCGETDF 0x5447 /* get default termio struct */
-#define IOCTL_TCSETDF 0x5448 /* set default termio struct */
-#define IOCTL_TCGETSYM 0x5449 /* get firmware symbol table */
-#define IOCTL_TCWHAT 0x544A /* get all SCSI IDs of FW files */
-#define IOCTL_TIOGETP 0x7408 /* get devs curr termio struct by sgttyb */
-#define IOCTL_TIOSETP 0x7409 /* set devs curr termio struct by sgttyb */
-
-#define IPC_EIO 5 /* I/O error */
-#define IPC_ENXIO 6 /* no such device or address */
-#define IPC_ENOMEM 12 /* not enough space */
-#define IPC_EEXIST 17 /* device or address exists */
-#define IPC_EINVAL 22 /* invalid caommand argument */
-
-/*
- * Index into c_cc[VNCC];
- */
-#define VVINTR 0 /* ISIG */
-#define VVQUIT 1 /* ISIG */
-#define VVERASE 2 /* ICANON */
-#define VVKILL 3 /* ICANON */
-#define VVEOF 4 /* ICANON */
-#define VVEOL 5 /* ICANON */
-#define VVSWTCH 6
-
-/*
- * Input flags - software input processing
- */
-#define VIGNBRK 0000001 /* ignore BREAK condition */
-#define VBRKINT 0000002 /* map BREAK to SIGINTR */
-#define VIGNPAR 0000004 /* ignore (discard) parity errors */
-#define VPARMRK 0000010 /* mark parity and framing errors */
-#define VINPCK 0000020 /* enable checking of parity errors */
-#define VISTRIP 0000040 /* strip 8th bit off chars */
-#define VINLCR 0000100 /* map NL into CR */
-#define VIGNCR 0000200 /* ignore CR */
-#define VICRNL 0000400 /* map CR to NL (ala CRMOD) */
-#define VIUCLC 0001000 /* translate upper to lower case */
-#define VIXON 0002000 /* enable output flow control */
-#define VIXANY 0004000 /* any char will restart after stop */
-#define VIXOFF 0010000 /* enable input flow control */
-
-/*
- * Output flags - software output processing
- */
-#define VOPOST 0000001 /* enable following output processing */
-#define VOLCUC 0000002 /* translate lower case to upper case */
-#define VONLCR 0000004 /* map NL to CR-NL (ala CRMOD) */
-#define VOCRNL 0000010 /* map CR to NL */
-#define VONOCR 0000020 /* No CR output at column 0 */
-#define VONLRET 0000040 /* NL performs the CR function */
-#define VOFILL 0000100
-#define VOFDEL 0000200
-#define VOXTABS 0014000 /* expand tabs to spaces */
-
-/*
- * Control flags - hardware control of terminal
- */
-
-#define VCBAUD 0000017 /* baud rate */
-#define VB0 0000000 /* hang up */
-#define VB50 0000001
-#define VB75 0000002
-#define VB110 0000003
-#define VB134 0000004
-#define VB150 0000005
-#define VB200 0000006
-#define VB300 0000007
-#define VB600 0000010
-#define VB1200 0000011
-#define VB1800 0000012
-#define VB2400 0000013
-#define VB4800 0000014
-#define VB9600 0000015
-#define VB19200 0000016
-#define VB38400 0000017
-#define VEXTA 0000016
-#define VEXTB 0000017
-#define VCSIZE 0000060 /* character size mask */
-#define VCS5 0000000 /* 5 bits (pseudo) */
-#define VCS6 0000020 /* 6 bits */
-#define VCS7 0000040 /* 7 bits */
-#define VCS8 0000060 /* 8 bits */
-#define VCSTOPB 0000100 /* send 2 stop bits */
-#define VCREAD 0000200 /* enable receiver */
-#define VPARENB 0000400 /* parity enable */
-#define VPARODD 0001000 /* odd parity, else even */
-#define VHUPCL 0002000 /* hang up on last close */
-#define VCLOCAL 0004000 /* ignore modem status lines */
-
-/*
- * "Local" flags - dumping ground for other state
- *
- * Warning: some flags in this structure begin with
- * the letter "I" and look like they belong in the
- * input flag.
- */
-
-#define VISIG 0000001 /* enable signals INTR, QUIT, [D]SUSP */
-#define VICANON 0000002 /* canonicalize input lines */
-#define VXCASE 0000004 /* canonical upper/lower case */
-#define VECHO 0000010 /* enable echoing */
-#define VECHOE 0000020 /* visually erase chars */
-#define VECHOK 0000040 /* echo NL after line kill */
-#define VECHONL 0000100 /* echo NL even if ECHO is off */
-#define VNOFLSH 0000200 /* don't flush after interrupt */
-
-
-#define VNCC 9 /* 18 bytes */
-struct termio {
- volatile unsigned short c_iflag;
- volatile unsigned short c_oflag;
- volatile unsigned short c_cflag;
- volatile unsigned short c_lflag;
- volatile char c_line;
- volatile unsigned char c_cc[VNCC];
-};
-
-struct vx_sgttyb { /* 6 bytes */
- volatile char sg_ispeed;
- volatile char sg_ospeed;
- volatile char sg_erase;
- volatile char sg_kill;
- volatile short sg_flags;
-};
-
-struct termcb { /* 6 bytes */
- volatile char st_flgs;
- volatile char st_termt;
- volatile char st_crow;
- volatile char st_ccol;
- volatile char st_vrow;
- volatile char st_lrow;
-};
-
-struct ctdesc {
- unsigned short csw,
- resv;
- unsigned long magic,
- lcnt,
- fatal,
- error,
- faddr,
- expdata,
- readdata;
-};
-
-struct dl_info { /* 18 bytes */
- volatile unsigned long host_addr;
- volatile unsigned long ipc_addr;
- volatile unsigned long count;
- volatile unsigned long extra_long;
- volatile unsigned short extra_short;
-};
-
-struct packet { /* 68 bytes */
- volatile u_long link; /* was eyecatcher */
- volatile u_char command_pipe_number;
- volatile u_char status_pipe_number;
- volatile char filler0[4];
- volatile short command;
- volatile char filler1[1];
- volatile char command_dependent;
- volatile char filler2[1];
- volatile char interrupt_level; /* init only */
- volatile u_char device_number;
- volatile char filler3[1];
- volatile u_short ioctl_cmd_h;
- volatile u_short ioctl_cmd_l;
-#define init_info_ptr_h ioctl_cmd_h
-#define init_info_ptr_l ioctl_cmd_l
- volatile u_short ioctl_arg_h;
- volatile u_short ioctl_arg_l;
- volatile u_short ioctl_mode_h;
- volatile u_short ioctl_mode_l;
-#define interrupt_vec ioctl_mode_l
- volatile char filler4[6];
- volatile u_short error_h;
- volatile u_short error_l;
- volatile short event_code;
- volatile char filler5[6];
- union {
- struct termio tio;
- struct termcb tcb;
- struct vx_sgttyb sgt;
- struct dl_info dl;
- long param;
- } pb;
- short reserved; /* for alignment */
-} packet;
-
-struct envelope { /* 12 bytes */
- volatile u_long link;
- volatile u_long packet_ptr;
- volatile char valid_flag;
- volatile char reserved1;
- volatile char reserved[2];
-};
-
-struct channel { /* 24 bytes */
- volatile u_short command_pipe_head_ptr_h;
- volatile u_short command_pipe_head_ptr_l;
- volatile u_short command_pipe_tail_ptr_h;
- volatile u_short command_pipe_tail_ptr_l;
- volatile u_short status_pipe_head_ptr_h;
- volatile u_short status_pipe_head_ptr_l;
- volatile u_short status_pipe_tail_ptr_h;
- volatile u_short status_pipe_tail_ptr_l;
- volatile char interrupt_level;
- volatile char interrupt_vec;
- volatile char channel_priority;
- volatile char address_modifier;
- volatile char channel_number;
- volatile char valid;
- volatile char datasize;
- volatile char reserved;
-};
-
-#define WRING_DATA_SIZE 4096 /* for a total struct size of 4104 (4K + 6 + 2 bytes) */
-#define WRING_BUF_SIZE WRING_DATA_SIZE
-struct wring {
- volatile unsigned short reserved;
- volatile unsigned short put;
- volatile unsigned short get;
- volatile char data[WRING_BUF_SIZE];
- char res[2]; /* for alignment */
-};
-
-#define RRING_DATA_SIZE 2048 /* for a total struct size of 2054 (2K + 6 + 2 bytes) */
-#define RRING_BUF_SIZE RRING_DATA_SIZE
-struct rring {
- volatile unsigned short reserved;
- volatile unsigned short put;
- volatile unsigned short get;
- volatile char data[RRING_BUF_SIZE];
- char res[2]; /* for alignment */
-};
-
-#define EOFRAME 0xA
-#define DELIMITER 0x1
-
-struct init_info { /* 88 bytes */
- volatile u_short write_ring_ptr_h;
- volatile u_short write_ring_ptr_l;
- volatile u_short read_ring_ptr_h;
- volatile u_short read_ring_ptr_l;
- volatile unsigned short write_ring_size;
- volatile unsigned short read_ring_size;
- volatile struct termio def_termio;
- volatile unsigned short reserved1;
- volatile unsigned short reserved2;
- volatile unsigned short reserved3;
- volatile unsigned short reserved4;
- volatile char init_data[56];
-};
-
-/* IPC event codes */
-#define E_INTR 0x0001
-#define E_QUIT 0x0002
-#define E_HUP 0x0004
-#define E_DCD 0x0008
-#define E_DSR 0x0010
-#define E_CTS 0x0020
-#define E_LOST_DCD 0x0040
-#define E_LOST_DSR 0x0080
-#define E_LOST_CTS 0x0100
-#define E_PR_FAULT 0x0200
-#define E_PR_POUT 0x0400
-#define E_PR_SELECT 0x0800
-#define E_SWITCH 0x4000
-#define E_BREAK 0x8000
-
-/*
- * All structures must reside in dual port user memory.
- * ($FFxx0100 to $FFxxFFF0)
- * All structures must be word aligned (see byte counts above)
- *
- * +--------------------------------+
- * | IPC Control/Status Register | $FFxx0000
- * | (16 bytes) |
- * |--------------------------------|
- * | Confidence Test Descriptor | $FFxx0010
- * | (32 bytes) |
- * |--------------------------------|
- * | Dump Area | $FFxx0030
- * | (208 bytes) |
- * |--------------------------------|
- * | | $FFxx0100
- * | |
- * : User Space :
- * : :
- * : (65,264 bytes) :
- * | |
- * | |
- * |--------------------------------|
- * | Interrupt Vector Registers | $FFxxFFF0
- * | (16 bytes) |
- * +--------------------------------+
- */
-
-#define NVXPORTS 9
-
-#define NENVELOPES 30
-#define NPACKETS NENVELOPES
-#define USER_AREA (0x0100)
-#define CHANNEL_H (0x0100)
-#define ENVELOPE_AREA (CHANNEL_H + sizeof(struct channel))
-#define ENVELOPE_AREA_SIZE (NENVELOPES * sizeof(struct envelope))
-#define PACKET_AREA (ENVELOPE_AREA + ENVELOPE_AREA_SIZE)
-#define PACKET_AREA_SIZE (NPACKETS * sizeof(struct packet))
-#define INIT_INFO_AREA (PACKET_AREA + PACKET_AREA_SIZE)
-#define INIT_INFO_AREA_SIZE (NVXPORTS * sizeof(struct init_info))
-#define WRING_AREA roundup(INIT_INFO_AREA + INIT_INFO_AREA_SIZE, 8)
-#define WRING_AREA_SIZE (NVXPORTS * sizeof(struct wring))
-#define RRING_AREA (WRING_AREA + WRING_AREA_SIZE)
-#define RRING_AREA_SIZE (NVXPORTS * sizeof(struct rring))
-#define USER_AREA_SIZE (RRING_AREA + RRING_AREA_SIZE - USER_AREA)
-
-/* Hardware's view of the dual ported memory */
-#define LOCAL_DPMEM_ADDRESS 0x00f30000
diff --git a/sys/arch/mvme88k/include/_float.h b/sys/arch/mvme88k/include/_float.h
deleted file mode 100644
index 795b116b305..00000000000
--- a/sys/arch/mvme88k/include/_float.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: _float.h,v 1.1 2012/06/26 16:12:44 deraadt Exp $ */
-
-#include <m88k/_float.h>
diff --git a/sys/arch/mvme88k/include/_types.h b/sys/arch/mvme88k/include/_types.h
deleted file mode 100644
index 196e5d6c031..00000000000
--- a/sys/arch/mvme88k/include/_types.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: _types.h,v 1.5 2012/11/05 19:39:34 miod Exp $ */
-
-/* public domain */
-#include <m88k/_types.h>
diff --git a/sys/arch/mvme88k/include/asm.h b/sys/arch/mvme88k/include/asm.h
deleted file mode 100644
index bb6e6218c04..00000000000
--- a/sys/arch/mvme88k/include/asm.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: asm.h,v 1.28 2004/04/26 14:31:11 miod Exp $ */
-/* public domain */
-#include <m88k/asm.h>
diff --git a/sys/arch/mvme88k/include/asm_macro.h b/sys/arch/mvme88k/include/asm_macro.h
deleted file mode 100644
index ec130cae311..00000000000
--- a/sys/arch/mvme88k/include/asm_macro.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: asm_macro.h,v 1.25 2004/04/26 14:31:11 miod Exp $ */
-/* public domain */
-#include <m88k/asm_macro.h>
diff --git a/sys/arch/mvme88k/include/atomic.h b/sys/arch/mvme88k/include/atomic.h
deleted file mode 100644
index 751ea9a18ff..00000000000
--- a/sys/arch/mvme88k/include/atomic.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/* $OpenBSD: atomic.h,v 1.3 2011/03/23 16:54:36 pirofti Exp $ */
-
-/* Public Domain */
-
-#ifndef _MACHINE_ATOMIC_H_
-#define _MACHINE_ATOMIC_H_
-
-#include <m88k/atomic.h>
-
-#endif /* _MACHINE_ATOMIC_H_ */
diff --git a/sys/arch/mvme88k/include/autoconf.h b/sys/arch/mvme88k/include/autoconf.h
deleted file mode 100644
index 88a84b3b21c..00000000000
--- a/sys/arch/mvme88k/include/autoconf.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* $OpenBSD: autoconf.h,v 1.19 2013/05/17 22:51:59 miod Exp $ */
-/*
- * Copyright (c) 1999, Steve Murphree, Jr.
- * Copyright (c) 1996 Nivas Madhur
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Nivas Madhur.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-/*
- * Autoconfiguration information.
- */
-
-#ifndef _MACHINE_AUTOCONF_H_
-#define _MACHINE_AUTOCONF_H_
-
-#include <machine/bus.h>
-
-struct confargs {
- bus_space_tag_t ca_iot;
- bus_dma_tag_t ca_dmat;
- int ca_bustype; /* bus type */
- paddr_t ca_paddr; /* physical address */
- int ca_offset; /* offset from parent */
- int ca_ipl; /* interrupt level */
- int ca_vec; /* mandatory interrupt vector */
- const char *ca_name; /* device name */
-};
-
-#define BUS_MAIN 0
-#define BUS_ANGELFIRE 1
-#define BUS_SYSCON 2
-#define BUS_PCCTWO 3
-#define BUS_VMES 4
-#define BUS_VMEL 5
-#define BUS_BUSSWITCH 6
-
-/* the following are from the prom/bootblocks */
-extern paddr_t bootaddr; /* PA of boot device */
-extern int bootpart; /* boot partition (disk) */
-extern int bootbus; /* scsi bus (disk) */
-
-vaddr_t mapiodev(paddr_t pa, int size);
-void unmapiodev(vaddr_t kva, int size);
-
-#endif
diff --git a/sys/arch/mvme88k/include/board.h b/sys/arch/mvme88k/include/board.h
deleted file mode 100644
index 941e15176de..00000000000
--- a/sys/arch/mvme88k/include/board.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/* $OpenBSD: board.h,v 1.22 2013/05/17 22:46:27 miod Exp $ */
-/*
- * Copyright (c) 2013, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_BOARD_H_
-#define _MACHINE_BOARD_H_
-
-#if !defined(_LOCORE)
-
-struct cmmu_p;
-struct intrhand;
-struct mvmeprom_brdid;
-struct pmap_table;
-
-struct board {
- void (*bootstrap)(void);
- vaddr_t (*memsize)(void);
- int (*cpuspeed)(const struct mvmeprom_brdid *);
- void (*reboot)(int);
- int (*is_syscon)(void);
-
- void (*intr)(struct trapframe *);
- int (*nmi)(struct trapframe *); /* 88110 */
- void (*nmi_wrapup)(struct trapframe *); /* 88110 */
-
- u_int (*getipl)(void);
- u_int (*setipl)(u_int);
- u_int (*raiseipl)(u_int);
-
- int (*intsrc_available)(u_int, int);
- void (*intsrc_enable)(u_int, int);
- void (*intsrc_disable)(u_int, int);
- int (*intsrc_establish)(u_int, struct intrhand *,
- const char *);
- void (*intsrc_disestablish)(u_int, struct intrhand *);
-
- void (*init_clocks)(void);
- void (*delay)(int);
-
- u_int (*init_vme)(const char *);
-
-#ifdef MULTIPROCESSOR
- void (*send_ipi)(int, cpuid_t);
- void (*smp_setup)(struct cpu_info *);
-#endif
-
- const struct pmap_table *ptable;
- const struct cmmu_p *cmmu;
-};
-
-#define BOARD_PROTOS(b) \
-void m##b##_bootstrap(void); \
-vaddr_t m##b##_memsize(void); \
-int m##b##_cpuspeed(const struct mvmeprom_brdid *); \
-void m##b##_reboot(int); \
-int m##b##_is_syscon(void); \
-void m##b##_intr(struct trapframe *); \
-int m##b##_nmi(struct trapframe *); \
-void m##b##_nmi_wrapup(struct trapframe *); \
-u_int m##b##_getipl(void); \
-u_int m##b##_setipl(u_int); \
-u_int m##b##_raiseipl(u_int); \
-int m##b##_intsrc_available(u_int, int); \
-void m##b##_intsrc_enable(u_int, int); \
-void m##b##_intsrc_disable(u_int, int); \
-int m##b##_intsrc_establish(u_int, struct intrhand *, const char *); \
-void m##b##_intsrc_disestablish(u_int, struct intrhand *); \
-void m##b##_init_clocks(void); \
-u_int m##b##_init_vme(const char *); \
-void m##b##_delay(int); \
-void m##b##_send_ipi(int, cpuid_t); \
-void m##b##_smp_setup(struct cpu_info *)
-
-BOARD_PROTOS(181);
-BOARD_PROTOS(187);
-BOARD_PROTOS(188);
-BOARD_PROTOS(197);
-BOARD_PROTOS(1x7);
-
-extern const struct board board_mvme181;
-extern const struct board board_mvme187;
-extern const struct board board_mvme188;
-extern const struct board board_mvme197le;
-extern const struct board board_mvme197spdp;
-
-extern const struct board *platform;
-
-#define md_interrupt_func(f) platform->intr(f)
-#define md_nmi_func(f) platform->nmi(f)
-#define md_nmi_wrapup_func(f) platform->nmi_wrapup(f)
-
-#endif /* _LOCORE */
-#endif /* _MACHINE_BOARD_H_ */
diff --git a/sys/arch/mvme88k/include/bug.h b/sys/arch/mvme88k/include/bug.h
deleted file mode 100644
index 265ad5fae22..00000000000
--- a/sys/arch/mvme88k/include/bug.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/* $OpenBSD: bug.h,v 1.9 2002/03/14 01:26:39 millert Exp $ */
-
-#ifndef _MACHINE_BUG_H_
-#define _MACHINE_BUG_H_
-
-struct bugenv {
- int clun;
- int dlun;
- int ipl;
- int ctlr;
- int (*entry)(void);
- int cfgblk;
- char *argstart;
- char *argend;
-};
-
-#endif /* _MACHINE_BUG_H_ */
diff --git a/sys/arch/mvme88k/include/bugio.h b/sys/arch/mvme88k/include/bugio.h
deleted file mode 100644
index 06e93d478c8..00000000000
--- a/sys/arch/mvme88k/include/bugio.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* $OpenBSD: bugio.h,v 1.18 2013/05/14 20:30:47 miod Exp $ */
-
-#ifndef _MACHINE_BUGIO_H_
-#define _MACHINE_BUGIO_H_
-
-#include <machine/prom.h>
-
-void buginit(void);
-char buginchr(void);
-void bugoutchr(int);
-void bugreturn(void);
-void bugbrdid(struct mvmeprom_brdid *);
-void bugdiskrd(struct mvmeprom_dskio *);
-int spin_cpu(cpuid_t, vaddr_t);
-
-#endif /* _MACHINE_BUGIO_H_ */
diff --git a/sys/arch/mvme88k/include/bus.h b/sys/arch/mvme88k/include/bus.h
deleted file mode 100644
index 13c1d6dcdbc..00000000000
--- a/sys/arch/mvme88k/include/bus.h
+++ /dev/null
@@ -1,811 +0,0 @@
-/* $OpenBSD: bus.h,v 1.12 2012/12/03 07:00:11 jsg Exp $ */
-/*
- * Copyright (c) 2004, Miodrag Vallat.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Simple mvme88k bus_space and bus_dma implementation.
- *
- * Currently, we only need specific handling for 32 bit read/writes in D16
- * space, and this choice is made at compile time. As a result, all the
- * implementation can go through macros or inline functions, except for
- * the management functions.
- */
-
-#ifndef _MACHINE_BUS_H_
-#define _MACHINE_BUS_H_
-
-#include <machine/asm_macro.h>
-
-typedef u_long bus_addr_t;
-typedef u_long bus_size_t;
-
-typedef u_long bus_space_handle_t;
-
-struct mvme88k_bus_space_tag {
- int (*bs_map)(bus_addr_t, bus_size_t, int, bus_space_handle_t *);
- void (*bs_unmap)(bus_space_handle_t, bus_size_t);
- int (*bs_subregion)(bus_space_handle_t, bus_size_t, bus_size_t,
- bus_space_handle_t *);
- void * (*bs_vaddr)(bus_space_handle_t);
- /* alloc, free not implemented yet */
-};
-
-typedef const struct mvme88k_bus_space_tag *bus_space_tag_t;
-
-#define BUS_SPACE_BARRIER_READ 0x01
-#define BUS_SPACE_BARRIER_WRITE 0x02
-
-#define BUS_SPACE_MAP_CACHEABLE 0x01
-#define BUS_SPACE_MAP_LINEAR 0x02
-#define BUS_SPACE_MAP_PREFETCHABLE 0x04
-
-/*
- * General bus_space function set
- */
-
-#define bus_space_map(t,a,s,f,r) ((t)->bs_map(a,s,f,r))
-#define bus_space_unmap(t,h,s) ((t)->bs_unmap(h,s))
-#define bus_space_subregion(t,h,o,s,r) ((t)->bs_subregion(h,o,s,r))
-#define bus_space_vaddr(t,h) ((t)->bs_vaddr(h))
-
-static void bus_space_barrier(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, bus_size_t, int);
-
-static __inline__ void
-bus_space_barrier(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, bus_size_t size, int flags)
-{
- flush_pipeline(); /* overkill? */
-}
-
-/*
- * Read/Write/Region functions for D8 and D16 access.
- * Most of these are straightforward and assume that everything is properly
- * aligned.
- */
-
-#define bus_space_read_1(tag, handle, offset) \
- ((void)(tag), *(volatile u_int8_t *)((handle) + (offset)))
-#define bus_space_read_2(tag, handle, offset) \
- ((void)(tag), *(volatile u_int16_t *)((handle) + (offset)))
-
-static void bus_space_read_multi_1(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_read_multi_1(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- *dest++ = bus_space_read_1(tag, 0, offset);
-}
-
-static void bus_space_read_multi_2(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int16_t *, size_t);
-
-static __inline__ void
-bus_space_read_multi_2(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int16_t *dest, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- *dest++ = bus_space_read_2(tag, 0, offset);
-}
-
-static void bus_space_read_raw_multi_2(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_read_raw_multi_2(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t size)
-{
- offset += handle;
- size >>= 1;
- while ((int)--size >= 0) {
- *(u_int16_t *)dest =
- bus_space_read_2(tag, 0, offset);
- dest += 2;
- }
-}
-
-static void bus_space_read_region_1(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- *dest++ = bus_space_read_1(tag, 0, offset++);
-}
-
-static void bus_space_read_region_2(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int16_t *, size_t);
-
-static __inline__ void
-bus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int16_t *dest, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0) {
- *dest++ = bus_space_read_2(tag, 0, offset);
- offset += 2;
- }
-}
-
-static void bus_space_read_raw_region_2(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_read_raw_region_2(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t size)
-{
- size >>= 1;
- offset += handle;
- while ((int)--size >= 0) {
- *(u_int16_t *)dest = bus_space_read_2(tag, 0, offset);
- offset += 2;
- dest += 2;
- }
-}
-
-#define bus_space_write_1(tag, handle, offset, value) \
- ((void)(tag), *(volatile u_int8_t *)((handle) + (offset)) = (value))
-#define bus_space_write_2(tag, handle, offset, value) \
- ((void)(tag), *(volatile u_int16_t *)((handle) + (offset)) = (value))
-
-static void bus_space_write_multi_1(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_write_multi_1(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- bus_space_write_1(tag, 0, offset, *dest++);
-}
-
-static void bus_space_write_multi_2(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int16_t *, size_t);
-
-static __inline__ void
-bus_space_write_multi_2(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int16_t *dest, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- bus_space_write_2(tag, 0, offset, *dest++);
-}
-
-static void bus_space_write_raw_multi_2(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_write_raw_multi_2(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t size)
-{
- offset += handle;
- size >>= 1;
- while ((int)--size >= 0) {
- bus_space_write_2(tag, 0, offset, *(u_int16_t *)dest);
- dest += 2;
- }
-}
-
-static void bus_space_set_multi_1(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t, size_t);
-
-static __inline__ void
-bus_space_set_multi_1(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t value, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- bus_space_write_1(tag, 0, offset, value);
-}
-
-static void bus_space_set_multi_2(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int16_t, size_t);
-
-static __inline__ void
-bus_space_set_multi_2(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int16_t value, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- bus_space_write_2(tag, 0, offset, value);
-}
-
-static void bus_space_write_region_1(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_write_region_1(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- bus_space_write_1(tag, 0, offset++, *dest++);
-}
-
-static void bus_space_write_region_2(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int16_t *, size_t);
-
-static __inline__ void
-bus_space_write_region_2(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int16_t *dest, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0) {
- bus_space_write_2(tag, 0, offset, *dest++);
- offset += 2;
- }
-}
-
-static void bus_space_write_raw_region_2(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_write_raw_region_2(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t size)
-{
- offset += handle;
- size >>= 1;
- while ((int)--size >= 0) {
- bus_space_write_2(tag, 0, offset, *(u_int16_t *)dest);
- offset += 2;
- dest += 2;
- }
-}
-
-static void bus_space_set_region_1(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t, size_t);
-
-static __inline__ void
-bus_space_set_region_1(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t value, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- bus_space_write_1(tag, 0, offset++, value);
-}
-
-static void bus_space_set_region_2(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int16_t, size_t);
-
-static __inline__ void
-bus_space_set_region_2(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int16_t value, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0) {
- bus_space_write_2(tag, 0, offset, value);
- offset += 2;
- }
-}
-
-static void bus_space_copy_1(bus_space_tag_t, bus_space_handle_t, bus_addr_t,
- bus_space_handle_t, bus_addr_t, bus_size_t);
-
-static __inline__ void
-bus_space_copy_1(bus_space_tag_t tag, bus_space_handle_t h1, bus_addr_t o1,
- bus_space_handle_t h2, bus_addr_t o2, bus_size_t count)
-{
- o1 += h1;
- o2 += h2;
- while ((int)--count >= 0) {
- *(volatile u_int8_t *)o1 = *(volatile u_int8_t *)o2;
- o1++;
- o2++;
- }
-}
-
-static void bus_space_copy_2(bus_space_tag_t, bus_space_handle_t, bus_addr_t,
- bus_space_handle_t, bus_addr_t, bus_size_t);
-
-static __inline__ void
-bus_space_copy_2(bus_space_tag_t tag, bus_space_handle_t h1, bus_addr_t o1,
- bus_space_handle_t h2, bus_addr_t o2, bus_size_t count)
-{
- o1 += h1;
- o2 += h2;
- while ((int)--count >= 0) {
- *(volatile u_int16_t *)o1 = *(volatile u_int16_t *)o2;
- o1 += 2;
- o2 += 2;
- }
-}
-
-/*
- * Unrestricted D32 access
- */
-
-#ifndef __BUS_SPACE_RESTRICT_D16__
-
-#define bus_space_read_4(tag, handle, offset) \
- ((void)(tag), *(volatile u_int32_t *)((handle) + (offset)))
-
-static void bus_space_read_multi_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int32_t *, size_t);
-
-static __inline__ void
-bus_space_read_multi_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int32_t *dest, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- *dest++ = bus_space_read_4(tag, 0, offset);
-}
-
-static void bus_space_read_raw_multi_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_read_raw_multi_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t size)
-{
- offset += handle;
- size >>= 2;
- while ((int)--size >= 0) {
- *(u_int32_t *)dest =
- bus_space_read_4(tag, 0, offset);
- dest += 4;
- }
-}
-
-static void bus_space_read_region_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int32_t *, size_t);
-
-static __inline__ void
-bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int32_t *dest, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0) {
- *dest++ = bus_space_read_4(tag, 0, offset);
- offset += 4;
- }
-}
-
-static void bus_space_read_raw_region_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_read_raw_region_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t size)
-{
- size >>= 2;
- offset += handle;
- while ((int)--size >= 0) {
- *(u_int32_t *)dest = bus_space_read_4(tag, 0, offset);
- offset += 4;
- dest += 4;
- }
-}
-
-#define bus_space_write_4(tag, handle, offset, value) \
- ((void)(tag), *(volatile u_int32_t *)((handle) + (offset)) = (value))
-
-static void bus_space_write_multi_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int32_t *, size_t);
-
-static __inline__ void
-bus_space_write_multi_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int32_t *dest, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- bus_space_write_4(tag, 0, offset, *dest++);
-}
-
-static void bus_space_write_raw_multi_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_write_raw_multi_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t size)
-{
- offset += handle;
- size >>= 2;
- while ((int)--size >= 0) {
- bus_space_write_4(tag, 0, offset, *(u_int32_t *)dest);
- dest += 4;
- }
-}
-
-static void bus_space_set_multi_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int32_t, size_t);
-
-static __inline__ void
-bus_space_set_multi_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int32_t value, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- bus_space_write_4(tag, 0, offset, value);
-}
-
-static void bus_space_write_region_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int32_t *, size_t);
-
-static __inline__ void
-bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int32_t *dest, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0) {
- bus_space_write_4(tag, 0, offset, *dest++);
- offset += 4;
- }
-}
-
-static void bus_space_write_raw_region_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_write_raw_region_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t size)
-{
- offset += handle;
- size >>= 2;
- while ((int)--size >= 0) {
- bus_space_write_4(tag, 0, offset, *(u_int32_t *)dest);
- offset += 4;
- dest += 4;
- }
-}
-
-static void bus_space_set_region_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int32_t, size_t);
-
-static __inline__ void
-bus_space_set_region_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int32_t value, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0) {
- bus_space_write_4(tag, 0, offset, value);
- offset += 4;
- }
-}
-
-static void bus_space_copy_4(bus_space_tag_t, bus_space_handle_t, bus_addr_t,
- bus_space_handle_t, bus_addr_t, bus_size_t);
-
-static __inline__ void
-bus_space_copy_4(bus_space_tag_t tag, bus_space_handle_t h1, bus_addr_t o1,
- bus_space_handle_t h2, bus_addr_t o2, bus_size_t count)
-{
- o1 += h1;
- o2 += h2;
- while ((int)--count >= 0) {
- *(volatile u_int32_t *)o1 = *(volatile u_int32_t *)o2;
- o1 += 4;
- o2 += 4;
- }
-}
-
-#else /* __BUS_SPACE_RESTRICT_D16__ */
-
-/*
- * Restricted D32 access - done through two adjacent D16 access.
- *
- * The speed of the basic read and write routines is critical.
- * This implementation uses a temporary variable on stack, and does
- * two 16 bit load&store sequences. Since the stack is in Dcache, this
- * is faster and spills fewer register than a register-only sequence
- * (which would need to ld.h into two distinct registers, then extu
- * the second one into itself, and or both in the result register).
- */
-
-static u_int32_t d16_read_4(vaddr_t);
-static void d16_write_4(vaddr_t, u_int32_t);
-
-static __inline__ u_int32_t
-d16_read_4(vaddr_t va)
-{
- u_int32_t tmp;
-
- *(u_int16_t *)&tmp = *(volatile u_int16_t *)va;
- *(u_int16_t *)((vaddr_t)&tmp + 2) = *(volatile u_int16_t *)(va + 2);
-
- return tmp;
-}
-
-static __inline__ void
-d16_write_4(vaddr_t va, u_int32_t value)
-{
- u_int32_t tmp = value;
-
- *(volatile u_int16_t *)va = *(u_int16_t *)&tmp;
- *(volatile u_int16_t *)(va + 2) = *(u_int16_t *)((vaddr_t)&tmp + 2);
-}
-
-#define bus_space_read_4(tag, handle, offset) \
- ((void)(tag), d16_read_4((handle) + (offset)))
-
-static void bus_space_read_multi_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int32_t *, size_t);
-
-static __inline__ void
-bus_space_read_multi_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int32_t *dest, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- *dest++ = bus_space_read_4(tag, 0, offset);
-}
-
-static void bus_space_read_raw_multi_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_read_raw_multi_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t size)
-{
- offset += handle;
- size >>= 1;
- while ((int)--size >= 0) {
- *(u_int16_t *)dest = bus_space_read_2(tag, 0, offset);
- dest += 2;
- }
-}
-
-static void bus_space_read_region_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int32_t *, size_t);
-
-static __inline__ void
-bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int32_t *__dest, size_t count)
-{
- u_int16_t *dest = (u_int16_t *)__dest;
-
- offset += handle;
- count <<= 1;
- while ((int)--count >= 0) {
- *dest++ = bus_space_read_2(tag, 0, offset);
- offset += 2;
- }
-}
-
-static void bus_space_read_raw_region_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_read_raw_region_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t size)
-{
- size >>= 1;
- offset += handle;
- while ((int)--size >= 0) {
- *(u_int16_t *)dest = bus_space_read_2(tag, 0, offset);
- offset += 2;
- dest += 2;
- }
-}
-
-#define bus_space_write_4(tag, handle, offset, value) \
- ((void)(tag), d16_write_4((handle) + (offset), (value)))
-
-static void bus_space_write_multi_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int32_t *, size_t);
-
-static __inline__ void
-bus_space_write_multi_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int32_t *dest, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- bus_space_write_4(tag, 0, offset, *dest++);
-}
-
-static void bus_space_write_raw_multi_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_write_raw_multi_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t size)
-{
- offset += handle;
- size >>= 1;
- while ((int)--size >= 0) {
- bus_space_write_2(tag, 0, offset, *(u_int16_t *)dest);
- dest += 2;
- }
-}
-
-static void bus_space_set_multi_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int32_t, size_t);
-
-static __inline__ void
-bus_space_set_multi_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int32_t value, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0)
- bus_space_write_4(tag, 0, offset, value);
-}
-
-static void bus_space_write_region_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int32_t *, size_t);
-
-static __inline__ void
-bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int32_t *__dest, size_t count)
-{
- u_int16_t *dest = (u_int16_t *)__dest;
-
- offset += handle;
- count <<= 1;
- while ((int)--count >= 0) {
- bus_space_write_2(tag, 0, offset, *dest++);
- offset += 2;
- }
-}
-
-static void bus_space_write_raw_region_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int8_t *, size_t);
-
-static __inline__ void
-bus_space_write_raw_region_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int8_t *dest, size_t size)
-{
- offset += handle;
- size >>= 1;
- while ((int)--size >= 0) {
- bus_space_write_2(tag, 0, offset, *(u_int16_t *)dest);
- offset += 2;
- dest += 2;
- }
-}
-
-static void bus_space_set_region_4(bus_space_tag_t, bus_space_handle_t,
- bus_addr_t, u_int32_t, size_t);
-
-static __inline__ void
-bus_space_set_region_4(bus_space_tag_t tag, bus_space_handle_t handle,
- bus_addr_t offset, u_int32_t value, size_t count)
-{
- offset += handle;
- while ((int)--count >= 0) {
- bus_space_write_4(tag, 0, offset, value);
- offset += 4;
- }
-}
-
-static void bus_space_copy_4(bus_space_tag_t, bus_space_handle_t, bus_addr_t,
- bus_space_handle_t, bus_addr_t, bus_size_t);
-
-static __inline__ void
-bus_space_copy_4(bus_space_tag_t tag, bus_space_handle_t h1, bus_addr_t o1,
- bus_space_handle_t h2, bus_addr_t o2, bus_size_t count)
-{
- o1 += h1;
- o2 += h2;
- count <<= 1;
- while ((int)--count >= 0) {
- *(volatile u_int16_t *)o1 = *(volatile u_int16_t *)o2;
- o1 += 2;
- o2 += 2;
- }
-}
-
-#endif /* __BUS_SPACE_RESTRICT_D16__ */
-
-/*
- * Extra D16 access functions (see vme.c)
- */
-
-void d16_bcopy(const void *, void *, size_t);
-void d16_bzero(void *, size_t);
-
-/*
- * Bus DMA implementation
- */
-
-#define BUS_DMA_WAITOK 0x000 /* safe to sleep (pseudo-flag) */
-#define BUS_DMA_NOWAIT 0x001 /* not safe to sleep */
-#define BUS_DMA_ALLOCNOW 0x002 /* perform resource allocation now */
-#define BUS_DMA_COHERENT 0x004 /* hint: map memory DMA coherent */
-#define BUS_DMA_BUS1 0x010 /* placeholders for bus functions... */
-#define BUS_DMA_BUS2 0x020
-#define BUS_DMA_BUS3 0x040
-#define BUS_DMA_BUS4 0x080
-#define BUS_DMA_READ 0x100 /* mapping is device -> memory only */
-#define BUS_DMA_WRITE 0x200 /* mapping is memory -> device only */
-#define BUS_DMA_STREAMING 0x400 /* hint: sequential, unidirectional */
-#define BUS_DMA_ZERO 0x800 /* zero memory in dmamem_alloc */
-
-#define BUS_DMASYNC_PREREAD 0x01
-#define BUS_DMASYNC_POSTREAD 0x02
-#define BUS_DMASYNC_PREWRITE 0x04
-#define BUS_DMASYNC_POSTWRITE 0x08
-
-typedef u_int32_t bus_dma_tag_t; /* ignored, really */
-
-/*
- * bus_dma_segment_t
- *
- * Describes a single contiguous DMA transaction. Values
- * are suitable for programming into DMA registers.
- */
-struct m88k_bus_dma_segment {
- bus_addr_t ds_addr; /* DMA address */
- bus_size_t ds_len; /* length of transfer */
-};
-typedef struct m88k_bus_dma_segment bus_dma_segment_t;
-
-/*
- * bus_dmamap_t
- *
- * Describes a DMA mapping.
- */
-struct m88k_bus_dmamap {
- bus_size_t _dm_size; /* largest DMA transfer mappable */
- int _dm_segcnt; /* number of segs this map can map */
- bus_size_t _dm_maxsegsz; /* largest possible segment */
- bus_size_t _dm_boundary; /* don't cross this */
-
- bus_size_t dm_mapsize; /* size of the mapping */
- int dm_nsegs; /* # valid segments in mapping */
- bus_dma_segment_t dm_segs[1]; /* segments; variable length */
-};
-typedef struct m88k_bus_dmamap *bus_dmamap_t;
-
-struct mbuf;
-struct proc;
-struct uio;
-
-int bus_dmamap_create(bus_dma_tag_t, bus_size_t, int, bus_size_t,
- bus_size_t, int, bus_dmamap_t *);
-void bus_dmamap_destroy(bus_dma_tag_t, bus_dmamap_t);
-int bus_dmamap_load(bus_dma_tag_t, bus_dmamap_t, void *,
- bus_size_t, struct proc *, int);
-int bus_dmamap_load_mbuf(bus_dma_tag_t, bus_dmamap_t,
- struct mbuf *, int);
-int bus_dmamap_load_uio(bus_dma_tag_t, bus_dmamap_t,
- struct uio *, int);
-int bus_dmamap_load_raw(bus_dma_tag_t, bus_dmamap_t, bus_dma_segment_t *,
- int, bus_size_t, int);
-void bus_dmamap_unload(bus_dma_tag_t, bus_dmamap_t);
-void bus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_addr_t,
- bus_size_t, int);
-
-int bus_dmamem_alloc(bus_dma_tag_t tag, bus_size_t size,
- bus_size_t alignment, bus_size_t boundary,
- bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags);
-void bus_dmamem_free(bus_dma_tag_t tag, bus_dma_segment_t *segs,
- int nsegs);
-int bus_dmamem_map(bus_dma_tag_t tag, bus_dma_segment_t *segs,
- int nsegs, size_t size, caddr_t *kvap, int flags);
-void bus_dmamem_unmap(bus_dma_tag_t tag, caddr_t kva,
- size_t size);
-paddr_t bus_dmamem_mmap(bus_dma_tag_t tag, bus_dma_segment_t *segs,
- int nsegs, off_t off, int prot, int flags);
-
-#endif /* _MACHINE_BUS_H_ */
diff --git a/sys/arch/mvme88k/include/cdefs.h b/sys/arch/mvme88k/include/cdefs.h
deleted file mode 100644
index 56a6abacdae..00000000000
--- a/sys/arch/mvme88k/include/cdefs.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: cdefs.h,v 1.13 2005/11/24 20:46:47 deraadt Exp $ */
-/* public domain */
-
-#include <m88k/cdefs.h>
diff --git a/sys/arch/mvme88k/include/cmmu.h b/sys/arch/mvme88k/include/cmmu.h
deleted file mode 100644
index 9628f7d9fb7..00000000000
--- a/sys/arch/mvme88k/include/cmmu.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: cmmu.h,v 1.20 2004/04/26 14:31:11 miod Exp $ */
-/* public domain */
-#include <m88k/cmmu.h>
diff --git a/sys/arch/mvme88k/include/conf.h b/sys/arch/mvme88k/include/conf.h
deleted file mode 100644
index 10862f35f9d..00000000000
--- a/sys/arch/mvme88k/include/conf.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* $OpenBSD: conf.h,v 1.4 2006/04/27 20:13:44 miod Exp $ */
-/*
- * Copyright (c) 2002, Miodrag Vallat.
- * All rights reserved.
- *
- * Permission to redistribute, use, copy, and modify this software
- * is hereby granted without fee, provided that the following
- * conditions are met:
- *
- * 1. This entire notice is included in all source code copies of any
- * software which is or includes a copy or modification of this
- * software.
- * 2. The name of the author may not be used to endorse or promote
- * products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/conf.h>
-
-#define mmread mmrw
-#define mmwrite mmrw
-cdev_decl(mm);
-
-cdev_decl(vmel);
-cdev_decl(vmes);
-
-cdev_decl(nvram);
-
-#define sramread sramrw
-#define sramwrite sramrw
-cdev_decl(sram);
-
-cdev_decl(bugtty);
-cdev_decl(cl);
-cdev_decl(dart);
-cdev_decl(vx);
diff --git a/sys/arch/mvme88k/include/cpu.h b/sys/arch/mvme88k/include/cpu.h
deleted file mode 100644
index 5ede70aacd1..00000000000
--- a/sys/arch/mvme88k/include/cpu.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* $OpenBSD: cpu.h,v 1.47 2013/05/17 22:46:27 miod Exp $ */
-/*
- * Copyright (c) 1996 Nivas Madhur
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#ifndef _MACHINE_CPU_H_
-#define _MACHINE_CPU_H_
-
-#include <m88k/cpu.h>
-
-#ifdef _KERNEL
-
-extern int cpuspeed;
-
-__dead void doboot(void);
-void nmihand(void *);
-
-/* M88100 PFSR machine-dependent code snippets */
-extern u_int32_t pfsr_save_single[];
-extern u_int32_t pfsr_save_188_straight[];
-extern u_int32_t pfsr_save_188_double[];
-extern u_int32_t pfsr_save_188_quad[];
-
-#endif /* _KERNEL */
-
-#endif
diff --git a/sys/arch/mvme88k/include/db_machdep.h b/sys/arch/mvme88k/include/db_machdep.h
deleted file mode 100644
index fb5a0db9d61..00000000000
--- a/sys/arch/mvme88k/include/db_machdep.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* $OpenBSD: db_machdep.h,v 1.30 2005/10/24 19:28:29 miod Exp $ */
-/* public domain */
-#include <m88k/db_machdep.h>
-
-#ifdef DDB
-
-void m88k_db_prom_cmd(db_expr_t, int, db_expr_t, char *);
-
-#define EXTRA_MACHDEP_COMMANDS \
- { "prom", m88k_db_prom_cmd, 0, NULL },
-
-#endif
diff --git a/sys/arch/mvme88k/include/disklabel.h b/sys/arch/mvme88k/include/disklabel.h
deleted file mode 100644
index bbce10c66a6..00000000000
--- a/sys/arch/mvme88k/include/disklabel.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/* $OpenBSD: disklabel.h,v 1.15 2011/03/23 16:54:36 pirofti Exp $ */
-
-/*
- * Copyright (c) 1996 Nivas Madhur
- * Copyright (c) 1995 Dale Rahn.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_DISKLABEL_H_
-#define _MACHINE_DISKLABEL_H_
-
-#define LABELSECTOR 0 /* sector containing label */
-#define LABELOFFSET 0 /* offset of label in sector */
-#define MAXPARTITIONS 16 /* number of partitions */
-
-/*
- * Note: this structure is exactly 512 bytes in size. If you move fields
- * around, make sure the various members are properly aligned and the
- * compiler won't do any additional padding.
- */
-struct mvmedisklabel {
- /* VID */
- u_char vid_id[4];
- u_char vid_0[16];
- u_int vid_oss;
- u_short vid_osl;
- u_char vid_1[4];
- u_short vid_osa_u;
- u_short vid_osa_l;
- u_char version;
- u_char vid_2[1];
- u_short checksum; /* 2 */
- u_short partitions;
- u_char vid_vd[16];
- u_long bbsize;
- u_long magic1; /* 4 */
- u_short type; /* 2 */
- u_short subtype; /* 2 */
- u_char packname[16]; /* 16 */
- u_long flags; /* 4 */
- u_long drivedata[5]; /* 4 */
- u_long spare[5]; /* 4 */
-
- u_long secpercyl; /* 4 */
- u_long secperunit; /* 4 */
- u_long headswitch; /* 4 */
-
- u_char vid_3[4];
- u_int vid_cas;
- u_char vid_cal;
- u_char vid_4_0[3];
- u_char vid_4[64];
- u_char vid_4_1[28];
- u_long sbsize;
- u_char vid_mot[8];
-
- /* CFG */
- u_char cfg_0[4];
- u_short cfg_atm;
- u_short cfg_prm;
- u_short cfg_atw;
- u_short cfg_rec;
-
- u_short sparespertrack;
- u_short sparespercyl;
- u_long acylinders;
- u_short rpm;
- u_short cylskew;
-
- u_char cfg_spt;
- u_char cfg_hds;
- u_short cfg_trk;
- u_char cfg_ilv;
- u_char cfg_sof;
- u_short cfg_psm;
- u_short cfg_shd;
- u_char cfg_2[2];
- u_short cfg_pcom;
- u_char cfg_3;
- u_char cfg_ssr;
- u_short cfg_rwcc;
- u_short cfg_ecc;
- u_short cfg_eatm;
- u_short cfg_eprm;
- u_short cfg_eatw;
- u_char cfg_gpb1;
- u_char cfg_gpb2;
- u_char cfg_gpb3;
- u_char cfg_gpb4;
- u_char cfg_ssc;
- u_char cfg_runit;
- u_short cfg_rsvc1;
- u_short cfg_rsvc2;
- u_long magic2;
- u_char cfg_4[192];
-};
-
-#endif /* _MACHINE_DISKLABEL_H_ */
diff --git a/sys/arch/mvme88k/include/endian.h b/sys/arch/mvme88k/include/endian.h
deleted file mode 100644
index 8dbb9e379f5..00000000000
--- a/sys/arch/mvme88k/include/endian.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: endian.h,v 1.15 2004/04/26 14:31:11 miod Exp $ */
-/* public domain */
-#include <m88k/endian.h>
diff --git a/sys/arch/mvme88k/include/exec.h b/sys/arch/mvme88k/include/exec.h
deleted file mode 100644
index 7581662701b..00000000000
--- a/sys/arch/mvme88k/include/exec.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: exec.h,v 1.13 2004/04/26 14:31:11 miod Exp $ */
-/* public domain */
-#include <m88k/exec.h>
diff --git a/sys/arch/mvme88k/include/fenv.h b/sys/arch/mvme88k/include/fenv.h
deleted file mode 100644
index b18bcdccfc2..00000000000
--- a/sys/arch/mvme88k/include/fenv.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: fenv.h,v 1.2 2013/06/01 21:20:54 jasper Exp $ */
-/* public domain */
-#include <m88k/fenv.h>
diff --git a/sys/arch/mvme88k/include/fpu.h b/sys/arch/mvme88k/include/fpu.h
deleted file mode 100644
index 8493e1b3c62..00000000000
--- a/sys/arch/mvme88k/include/fpu.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: fpu.h,v 1.1 2007/12/08 18:39:50 miod Exp $ */
-/* public domain */
-#include <m88k/fpu.h>
diff --git a/sys/arch/mvme88k/include/frame.h b/sys/arch/mvme88k/include/frame.h
deleted file mode 100644
index f06ca59033d..00000000000
--- a/sys/arch/mvme88k/include/frame.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: frame.h,v 1.11 2007/01/13 22:00:56 miod Exp $ */
-/* public domain */
-#include <m88k/frame.h>
diff --git a/sys/arch/mvme88k/include/ieee.h b/sys/arch/mvme88k/include/ieee.h
deleted file mode 100644
index 070fa657f95..00000000000
--- a/sys/arch/mvme88k/include/ieee.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: ieee.h,v 1.7 2004/04/26 14:31:11 miod Exp $ */
-/* public domain */
-#include <m88k/ieee.h>
diff --git a/sys/arch/mvme88k/include/ieeefp.h b/sys/arch/mvme88k/include/ieeefp.h
deleted file mode 100644
index ced865e1507..00000000000
--- a/sys/arch/mvme88k/include/ieeefp.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: ieeefp.h,v 1.6 2004/04/26 14:31:11 miod Exp $ */
-/* public domain */
-#include <m88k/ieeefp.h>
diff --git a/sys/arch/mvme88k/include/intr.h b/sys/arch/mvme88k/include/intr.h
deleted file mode 100644
index 2ffdc01be83..00000000000
--- a/sys/arch/mvme88k/include/intr.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/* $OpenBSD: intr.h,v 1.24 2013/06/16 14:49:49 kettenis Exp $ */
-/*
- * Copyright (C) 2000 Steve Murphree, Jr.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * Copyright (c) 1996 Nivas Madhur
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_INTR_H_
-#define _MACHINE_INTR_H_
-
-/*
- * IPL levels.
- * We use 6 as IPL_HIGH so that abort can be programmed at 7 so that
- * it is always possible to break into the system unless interrupts
- * are disabled.
- */
-
-#define IPL_NONE 0
-#define IPL_SOFTINT 1
-#define IPL_BIO 2
-#define IPL_NET 3
-#define IPL_TTY 5
-#define IPL_VM 5
-#define IPL_CLOCK 5
-#define IPL_STATCLOCK 5
-#define IPL_SCHED 5
-#define IPL_HIGH 6
-#define IPL_NMI 7
-#define IPL_ABORT 7
-
-#define NIPLS 8
-
-#define IPL_MPSAFE 0 /* no "mpsafe" interrupts */
-
-#if defined(_KERNEL) && !defined(_LOCORE)
-
-#include <sys/evcount.h>
-
-struct intrhand {
- SLIST_ENTRY(intrhand) ih_link;
- int (*ih_fn)(void *);
- void *ih_arg;
- int ih_ipl;
- int ih_wantframe;
- struct evcount ih_count;
-};
-
-int intr_establish(int, struct intrhand *, const char *);
-int intr_findvec(int, int, int);
-
-/*
- * There are 256 possible VME interrupt vectors on a mvme88k platform
- * (although some systems use VME vectors for onboard devices).
- * Use either vmeintr_establish() or intr_establish() to register a handler
- * for the given vector. Vector number is used to index into the
- * intr_handlers[] table.
- */
-#define NVMEINTR 256
-typedef SLIST_HEAD(, intrhand) intrhand_t;
-extern intrhand_t intr_handlers[NVMEINTR];
-
-/*
- * Currently registered VME interrupt vectors for a given IPL, if they
- * are unique. Used to help the MVME181 and MVME188 interrupt handlers when
- * they fail to complete the VME interrupt acknowledge cycle to get the
- * interrupt vector number.
- */
-extern u_int vmevec_hints[NIPLS];
-
-/* Interrupt masks (MVME181, MVME188) */
-extern u_int32_t int_mask_val[NIPLS];
-
-/*
- * Logical values for non-VME interrupt sources on boards with dedicated
- * interrupt controllers (MVME181, MVME188). Not all sources may be available
- * on a given board.
- */
-
-#define INTSRC_ABORT 1 /* abort button */
-#define INTSRC_ACFAIL 2 /* AC failure */
-#define INTSRC_SYSFAIL 3 /* system failure */
-#define INTSRC_PARERR 4 /* memory parity error */
-#define INTSRC_CIO 5 /* Z8536 */
-#define INTSRC_DTIMER 6 /* MC68692 timer interrupt */
-#define INTSRC_DUART 7 /* MC68692 serial interrupt */
-#define INTSRC_VME 8 /* up to seven VME interrupt levels */
-
-#endif /* _KERNEL && !_LOCORE */
-
-#include <m88k/intr.h>
-
-#endif /* _MACHINE_INTR_H_ */
diff --git a/sys/arch/mvme88k/include/kcore.h b/sys/arch/mvme88k/include/kcore.h
deleted file mode 100644
index 3ba95570ea1..00000000000
--- a/sys/arch/mvme88k/include/kcore.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: kcore.h,v 1.4 2004/04/26 14:31:11 miod Exp $ */
-/* public domain */
-#include <m88k/kcore.h>
diff --git a/sys/arch/mvme88k/include/limits.h b/sys/arch/mvme88k/include/limits.h
deleted file mode 100644
index bcbdfdd27a0..00000000000
--- a/sys/arch/mvme88k/include/limits.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: limits.h,v 1.14 2004/04/26 14:31:11 miod Exp $ */
-/* public domain */
-#include <m88k/limits.h>
diff --git a/sys/arch/mvme88k/include/loadfile_machdep.h b/sys/arch/mvme88k/include/loadfile_machdep.h
deleted file mode 100644
index 101235faf50..00000000000
--- a/sys/arch/mvme88k/include/loadfile_machdep.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* $OpenBSD: loadfile_machdep.h,v 1.3 2013/10/17 11:54:01 miod Exp $ */
-
-/*-
- * Copyright (c) 1999 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Christos Zoulas.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define BOOT_ELF
-
-#define LOAD_KERNEL LOAD_ALL
-#define COUNT_KERNEL COUNT_ALL
-
-#define LOADADDR(a) (((u_long)(a)) + offset)
-#define ALIGNENTRY(a) ((u_long)(a) & ~0x0fff)
-#define READ(f, b, c) read((f), (void *)LOADADDR(b), (c))
-#define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c))
-#define BZERO(d, c) memset((void *)LOADADDR(d), 0, (c))
-#define WARN(a) (void)(printf a, \
- printf((errno ? ": %s\n" : "\n"), \
- strerror(errno)))
-#define PROGRESS(a) (void) printf a
-#define ALLOC(a) alloc(a)
-#define FREE(a, b) free(a, b)
diff --git a/sys/arch/mvme88k/include/lock.h b/sys/arch/mvme88k/include/lock.h
deleted file mode 100644
index a1cceb2c9f8..00000000000
--- a/sys/arch/mvme88k/include/lock.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: lock.h,v 1.1 2005/12/03 19:04:06 miod Exp $ */
-/* public domain */
-#include <m88k/lock.h>
diff --git a/sys/arch/mvme88k/include/m88100.h b/sys/arch/mvme88k/include/m88100.h
deleted file mode 100644
index fe5f385f0c7..00000000000
--- a/sys/arch/mvme88k/include/m88100.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: m88100.h,v 1.13 2004/04/26 14:31:11 miod Exp $ */
-/* public domain */
-#include <m88k/m88100.h>
diff --git a/sys/arch/mvme88k/include/m88110.h b/sys/arch/mvme88k/include/m88110.h
deleted file mode 100644
index b3bac27a831..00000000000
--- a/sys/arch/mvme88k/include/m88110.h
+++ /dev/null
@@ -1,216 +0,0 @@
-/* $OpenBSD: m88110.h,v 1.25 2011/10/25 18:38:06 miod Exp $ */
-
-#ifndef _MACHINE_M88110_H_
-#define _MACHINE_M88110_H_
-
-/*
- * 88110 CMMU definitions
- */
-
-#define CMMU_ICMD_INV_ITIC 0x001 /* Invalidate Inst Cache & TIC */
-#define CMMU_ICMD_INV_TIC 0x002 /* Invalidate TIC */
-#define CMMU_ICMD_INV_LINE 0x005 /* Invalidate Inst Cache Line */
-#define CMMU_ICMD_PRB_SUPR 0x008 /* MMU Probe Supervisor */
-#define CMMU_ICMD_PRB_USER 0x009 /* MMU Probe User */
-#define CMMU_ICMD_INV_SATC 0x00a /* Invalidate All Supervisor ATCs */
-#define CMMU_ICMD_INV_UATC 0x00b /* Invalidate All User ATCs */
-
-#define CMMU_ICTL_DID 0x8000 /* Double instruction disable */
-#define CMMU_ICTL_PREN 0x4000 /* Branch Prediction Enable */
-#define CMMU_ICTL_FRZ0 0x0100 /* Inst Cache Freeze Bank 0 */
-#define CMMU_ICTL_FRZ1 0x0080 /* Inst Cache Freeze Bank 1 */
-#define CMMU_ICTL_HTEN 0x0040 /* Hardware Table Search Enable */
-#define CMMU_ICTL_MEN 0x0020 /* Inst MMU Enable */
-#define CMMU_ICTL_BEN 0x0004 /* TIC Cache Enable */
-#define CMMU_ICTL_CEN 0x0001 /* Inst Cache Enable */
-
-#define CMMU_ISR_TBE 0x200000 /* Table Search Bus Error */
-#define CMMU_ISR_SI 0x100000 /* Segment Fault*/
-#define CMMU_ISR_PI 0x080000 /* Page Fault */
-#define CMMU_ISR_SP 0x040000 /* Supervisor Protection Violation */
-#define CMMU_ISR_PH 0x000800 /* PATC Hit */
-#define CMMU_ISR_BH 0x000400 /* BATC Hit */
-#define CMMU_ISR_SU 0x000200 /* Supervisor Bit */
-#define CMMU_ISR_BE 0x000001 /* Bus Error */
-
-#define CMMU_DCMD_WB_PG 0x000 /* Flush Data Cache Page (sync) */
-#define CMMU_DCMD_INV_ALL 0x001 /* Invalidate Data Cache All */
-#define CMMU_DCMD_WB_ALL 0x002 /* Flush Data Cache All (sync) */
-#define CMMU_DCMD_WBINV_ALL 0x003 /* Flush Data Cache All (sync + inv) */
-#define CMMU_DCMD_WBINV_PG 0x004 /* Flush Data Cache Page (sync + inv) */
-#define CMMU_DCMD_INV_LINE 0x005 /* Invalidate Data Cache Line */
-#define CMMU_DCMD_WB_LINE 0x006 /* Flush Data Cache Line (sync) */
-#define CMMU_DCMD_WBINV_LINE 0x007 /* Flush Data Cache Line (sync + inv) */
-#define CMMU_DCMD_PRB_SUPR 0x008 /* MMU Probe Supervisor */
-#define CMMU_DCMD_PRB_USER 0x009 /* MMU Probe User */
-#define CMMU_DCMD_INV_SATC 0x00a /* Invalidate All Supervisor ATCs */
-#define CMMU_DCMD_INV_UATC 0x00b /* Invalidate All User ATCs */
-
-#define CMMU_DCTL_RSVD7 0x40000 /* Reserved */
-#define CMMU_DCTL_RSVD6 0x20000 /* Reserved */
-#define CMMU_DCTL_RSVD5 0x10000 /* Reserved */
-#define CMMU_DCTL_RSVD4 0x8000 /* Reserved */
-#define CMMU_DCTL_RSVD3 0x4000 /* Reserved */
-#define CMMU_DCTL_XMEM 0x2000 /* store -> load sequence */
-#define CMMU_DCTL_DEN 0x1000 /* Decoupled Cache Access Enable */
-#define CMMU_DCTL_FWT 0x0800 /* Force Write Through */
-#define CMMU_DCTL_BPEN1 0x0400 /* Break Point Enable 1 */
-#define CMMU_DCTL_BPEN0 0x0200 /* Break Point Enable 0 */
-#define CMMU_DCTL_FRZ0 0x0100 /* Data Cache Freeze Bank 0 */
-#define CMMU_DCTL_FRZ1 0x0080 /* Data Cache Freeze Bank 1 */
-#define CMMU_DCTL_HTEN 0x0040 /* Hardware Table Search Enable */
-#define CMMU_DCTL_MEN 0x0020 /* Data MMU Enable */
-#define CMMU_DCTL_RSVD2 0x0010 /* Reserved */
-#define CMMU_DCTL_ADS 0x0008 /* Allocate Disable */
-#define CMMU_DCTL_RSVD1 0x0004 /* Reserved */
-#define CMMU_DCTL_SEN 0x0002 /* Data Cache Snoop Enable */
-#define CMMU_DCTL_CEN 0x0001 /* Data Cache Enable */
-
-#define CMMU_DSR_TBE 0x200000 /* Table Search Bus Error */
-#define CMMU_DSR_SI 0x100000 /* Segment Fault */
-#define CMMU_DSR_PI 0x080000 /* Page Fault */
-#define CMMU_DSR_SP 0x040000 /* Supervisor Protection Violation */
-#define CMMU_DSR_WE 0x020000 /* Write Protection Violation */
-#define CMMU_DSR_BPE 0x010000 /* Break Point Exception */
-#define CMMU_DSR_PH 0x000800 /* PATC Hit */
-#define CMMU_DSR_BH 0x000400 /* BATC Hit */
-#define CMMU_DSR_SU 0x000200 /* Supervisor Bit */
-#define CMMU_DSR_RW 0x000100 /* Read Bit */
-#define CMMU_DSR_CP 0x000004 /* Copyback Error */
-#define CMMU_DSR_WA 0x000002 /* Write-Allocate Bus Error */
-#define CMMU_DSR_BE 0x000001 /* Bus Error */
-
-/* definitions for use of the BATC */
-#define BATC_512K (0x00 << BATC_BLKSHIFT)
-#define BATC_1M (0x01 << BATC_BLKSHIFT)
-#define BATC_2M (0x03 << BATC_BLKSHIFT)
-#define BATC_4M (0x07 << BATC_BLKSHIFT)
-#define BATC_8M (0x0f << BATC_BLKSHIFT)
-#define BATC_16M (0x1f << BATC_BLKSHIFT)
-#define BATC_32M (0x3f << BATC_BLKSHIFT)
-#define BATC_64M (0x7f << BATC_BLKSHIFT)
-
-/*
- * PATC fields
- */
-
-#define PATC_VA_MASK 0xfffff000
-#define PATC_SO 0x00000001
-
-/*
- * Cache line information
- */
-#define MC88110_CACHE_SHIFT 5
-#define MC88110_CACHE_LINE (1 << MC88110_CACHE_SHIFT)
-
-#ifndef _LOCORE
-
-void set_icmd(uint32_t);
-void set_ictl(uint32_t);
-void set_isar(uint32_t);
-void set_isap(uint32_t);
-void set_iuap(uint32_t);
-void set_iir(uint32_t);
-void set_ibp(uint32_t);
-void set_ippu(uint32_t);
-void set_ippl(uint32_t);
-void set_isr(uint32_t);
-void set_dcmd(uint32_t);
-void set_dctl(uint32_t);
-void set_dsar(uint32_t);
-void set_dsap(uint32_t);
-void set_duap(uint32_t);
-void set_dir(uint32_t);
-void set_dbp(uint32_t);
-void set_dppu(uint32_t);
-void set_dppl(uint32_t);
-void set_dsr(uint32_t);
-
-uint32_t get_dctl(void);
-uint32_t get_dsr(void);
-uint32_t get_ictl(void);
-uint32_t get_isr(void);
-
-/*
- * The following inlines expect their address to be line-aligned for line
- * operations, and page aligned for page operations.
- */
-
-static __inline__ void
-mc88110_wb_data_line(paddr_t x)
-{
- set_dsar(x);
- set_dcmd(CMMU_DCMD_WB_LINE);
-}
-
-static __inline__ void
-mc88110_wb_data_page(paddr_t x)
-{
- set_dsar(x);
- set_dcmd(CMMU_DCMD_WB_PG);
-}
-
-static __inline__ void
-mc88110_wb_data(void)
-{
- set_dcmd(CMMU_DCMD_WB_ALL);
-}
-
-static __inline__ void
-mc88110_inval_data_line(paddr_t x)
-{
- set_dsar(x);
- set_dcmd(CMMU_DCMD_INV_LINE);
-}
-
-static __inline__ void
-mc88110_inval_data(void)
-{
- set_dcmd(CMMU_DCMD_INV_ALL);
-}
-
-static __inline__ void
-mc88110_wbinv_data_line(paddr_t x)
-{
- set_dsar(x);
- set_dcmd(CMMU_DCMD_WBINV_LINE);
-}
-
-static __inline__ void
-mc88110_wbinv_data_page(paddr_t x)
-{
- set_dsar(x);
- set_dcmd(CMMU_DCMD_WBINV_PG);
-}
-
-static __inline__ void
-mc88110_wbinv_data(void)
-{
- set_dcmd(CMMU_DCMD_WBINV_ALL);
-}
-
-static __inline__ void
-mc88110_inval_inst_line(paddr_t x)
-{
- set_isar(x);
- set_icmd(CMMU_ICMD_INV_LINE);
-}
-
-static __inline__ void
-mc88110_inval_inst(void)
-{
- set_icmd(CMMU_ICMD_INV_ITIC);
-}
-
-/* skip one instruction */
-static __inline__ void
-m88110_skip_insn(struct trapframe *frame)
-{
- if (frame->tf_exip & 1)
- frame->tf_exip = frame->tf_enip;
- else
- frame->tf_exip += 4;
-}
-
-#endif /* _LOCORE */
-#endif /* _MACHINE_M88110_H_ */
diff --git a/sys/arch/mvme88k/include/m8820x.h b/sys/arch/mvme88k/include/m8820x.h
deleted file mode 100644
index ad1e6269cec..00000000000
--- a/sys/arch/mvme88k/include/m8820x.h
+++ /dev/null
@@ -1,73 +0,0 @@
-#ifndef _MACHINE_M8820X_H_
-#define _MACHINE_M8820X_H_
-/* $OpenBSD: m8820x.h,v 1.17 2013/11/26 20:33:13 deraadt Exp $ */
-/*
- * Copyright (c) 2004, Miodrag Vallat.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-/*
- * Mach Operating System
- * Copyright (c) 1993-1992 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- */
-
-/*
- * Code features to enable
- */
-
-#ifdef MVME188
-#define M88200_HAS_SPLIT_ADDRESS
-#endif
-
-/*
- * Address masks for MVME188 CMMU configs
- */
-
-#define CMMU_SRAM (1U << 31)
-#define CMMU_A12_MASK (1U << 12)
-#define CMMU_A14_MASK (1U << 14)
-#define CMMU_SRAM_MASK ((1U << 31) | (1U << 30))
-
-#include <m88k/m8820x.h>
-
-#endif /* _MACHINE_M8820X_H_ */
diff --git a/sys/arch/mvme88k/include/m88410.h b/sys/arch/mvme88k/include/m88410.h
deleted file mode 100644
index f52b544c270..00000000000
--- a/sys/arch/mvme88k/include/m88410.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* $OpenBSD: m88410.h,v 1.15 2013/02/17 18:10:01 miod Exp $ */
-/*
- * Copyright (c) 2001 Steve Murphree, Jr.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Steve Murphree.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#ifndef _MACHINE_M88410_H_
-#define _MACHINE_M88410_H_
-
-#ifdef _KERNEL
-
-/*
- * MC88410 External Cache Controller definitions.
- * This is only available on MVME197 SP, DP and QP models.
- */
-
-#include <mvme88k/dev/busswreg.h>
-
-void mc88410_inv(void);
-void mc88410_wb(void);
-void mc88410_wbinv(void);
-void mc88410_wb_page(paddr_t);
-
-static __inline__ int
-mc88410_present(void)
-{
- return (*(volatile u_int16_t *)(BS_BASE + BS_GCSR)) & BS_GCSR_B410;
-}
-
-#endif /* _KERNEL */
-
-#endif /* _MACHINE_M88410_H_ */
diff --git a/sys/arch/mvme88k/include/mioctl.h b/sys/arch/mvme88k/include/mioctl.h
deleted file mode 100644
index e83be7d628a..00000000000
--- a/sys/arch/mvme88k/include/mioctl.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* $OpenBSD: mioctl.h,v 1.2 2003/06/02 07:06:56 deraadt Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define MIOCGSIZ _IOR('m', 1, int)
diff --git a/sys/arch/mvme88k/include/mmu.h b/sys/arch/mvme88k/include/mmu.h
deleted file mode 100644
index 819109fd2f8..00000000000
--- a/sys/arch/mvme88k/include/mmu.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: mmu.h,v 1.27 2004/04/26 14:31:11 miod Exp $ */
-/* public domain */
-#include <m88k/mmu.h>
diff --git a/sys/arch/mvme88k/include/mplock.h b/sys/arch/mvme88k/include/mplock.h
deleted file mode 100644
index a4e5204c65c..00000000000
--- a/sys/arch/mvme88k/include/mplock.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: mplock.h,v 1.2 2007/12/02 21:20:17 miod Exp $ */
-/* public domain */
-#include <m88k/mplock.h>
diff --git a/sys/arch/mvme88k/include/mutex.h b/sys/arch/mvme88k/include/mutex.h
deleted file mode 100644
index 3c2e77df19b..00000000000
--- a/sys/arch/mvme88k/include/mutex.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: mutex.h,v 1.1 2005/12/03 19:01:15 miod Exp $ */
-/* public domain */
-#include <m88k/mutex.h>
diff --git a/sys/arch/mvme88k/include/mvme181.h b/sys/arch/mvme88k/include/mvme181.h
deleted file mode 100644
index d8140eb1c3d..00000000000
--- a/sys/arch/mvme88k/include/mvme181.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* $OpenBSD: mvme181.h,v 1.2 2013/05/23 21:20:12 miod Exp $ */
-
-/*
- * Copyright (c) 2013 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef _MACHINE_MVME181_H_
-#define _MACHINE_MVME181_H_
-
-#define M181_OBIO_START 0xffe00000
-
-#define M181_CMMU_I 0xfff7e000 /* Instruction CMMU address */
-#define M181_CMMU_D 0xfff7f000 /* Data CMMU address */
-
-#define M181_SSR 0xffe10000 /* system status register */
-#define M181_SCR 0xffe20000 /* system control register */
-#define M181_CPEI 0xffe30000 /* clear parity error interrupt */
-#define M181_VMEVEC 0xffe80000 /* VME vector register */
-#define M181_CLRABRT 0xffee0000 /* clear abort interrupt */
-
-#define M181_DUART 0xffe40000 /* base address of DUART chip */
-#define M181_DSRTC 0xff810000 /* base address of TODclock */
-
-/*
- * Control and Status Register interrupt bits - 180 only has the lower 8 bits
- */
-
-#define M181_IRQ_VME4_180 0x0010
-#define M181_IRQ_PARITY 0x0020 /* 181 only */
-#define M181_IRQ_DUART 0x0040
-#define M181_IRQ_ABORT 0x0080
-#define M181_IRQ_VME1 0x0200
-#define M181_IRQ_VME2 0x0400
-#define M181_IRQ_VME3 0x0800
-#define M181_IRQ_VME4 0x1000
-#define M181_IRQ_VME5 0x2000
-#define M181_IRQ_VME6 0x4000
-#define M181_IRQ_VME7 0x8000
-
-/*
- * System Status register bits (not interrupt bits)
- */
-
-#define M181_SYSCON 0x0004 /* S3-1 switch closed */
-#define M181_BOARDMODE 0x0100 /* S3-6 switch closed */
-
-#endif /* _MACHINE_MVME181_H_ */
diff --git a/sys/arch/mvme88k/include/mvme187.h b/sys/arch/mvme88k/include/mvme187.h
deleted file mode 100644
index cb351584093..00000000000
--- a/sys/arch/mvme88k/include/mvme187.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* $OpenBSD: mvme187.h,v 1.11 2013/05/17 22:46:27 miod Exp $ */
-/*
- * Copyright (c) 1996 Nivas Madhur
- * Copyright (c) 1999 Steve Murphree, Jr.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Nivas Madhur.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-/*
- * Mach Operating System
- * Copyright (c) 1991 Carnegie Mellon University
- * Copyright (c) 1991 OMRON Corporation
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- */
-#ifndef _MACHINE_MVME187_H_
-#define _MACHINE_MVME187_H_
-
-#define BUG187_START 0xff800000 /* start of BUG PROM */
-#define BUG187_SIZE 0x00400000 /* size of BUG PROM */
-#define SRAM_START 0xffe00000 /* start of sram used by bug */
-#define SRAM_SIZE 0x00020000 /* size of sram */
-#define OBIO187_START 0xfff40000 /* start of local IO */
-#define OBIO187_SIZE 0x000b0000 /* size of obio space */
-
-#define SBC_CMMU_I 0xfff77000 /* Single Board Computer code CMMU */
-#define SBC_CMMU_D 0xfff7f000 /* Single Board Computer data CMMU */
-
-#define M187_ILEVEL 0xfff4203e /* interrupt priority level */
-#define M187_IMASK 0xfff4203f /* interrupt mask level */
-#define M187_ISRC 0x00000000 /* interrupt mask src (NULL) */
-#define M187_IACK 0xfffe0000 /* interrupt ACK base */
-
-#define MEM_CTLR 0xfff43000 /* MEMC040 mem controller */
-
-#endif /* _MACHINE_MVME187_H_ */
diff --git a/sys/arch/mvme88k/include/mvme188.h b/sys/arch/mvme88k/include/mvme188.h
deleted file mode 100644
index 7a7985cfd7a..00000000000
--- a/sys/arch/mvme88k/include/mvme188.h
+++ /dev/null
@@ -1,218 +0,0 @@
-/* $OpenBSD: mvme188.h,v 1.35 2013/05/17 22:46:27 miod Exp $ */
-/*
- * Copyright (c) 1999 Steve Murphree, Jr.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Steve Murphree, Jr.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-/*
- * Mach Operating System
- * Copyright (c) 1991 Carnegie Mellon University
- * Copyright (c) 1991 OMRON Corporation
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- */
-
-#ifndef _MACHINE_MVME188_H_
-#define _MACHINE_MVME188_H_
-
-#define MVME188_EPROM 0xffc00000
-#define MVME188_EPROM_SIZE 0x00080000
-#define MVME188_SRAM 0xffe00000
-#define MVME188_SRAM_SIZE 0x00020000
-#define MVME188_UTILITY 0xfff00000
-#define MVME188_UTILITY_SIZE 0x00090000
-
-/*
- * MVME188 declarations for hardware level device registers and such.
- */
-
-/* per-processor interrupt enable registers */
-#define MVME188_IENBASE 0xfff84000
-#define MVME188_IEN0 0xfff84004 /* interrupt enable CPU 0 */
-#define MVME188_IEN1 0xfff84008 /* interrupt enable CPU 1 */
-#define MVME188_IEN2 0xfff84010 /* interrupt enable CPU 2 */
-#define MVME188_IEN3 0xfff84020 /* interrupt enable CPU 3 */
-#define MVME188_IENALL 0xfff8403c /* simultaneous write */
-#define MVME188_IEN(cpu) (MVME188_IENBASE + (4 << (cpu)))
-
-#define MVME188_IST 0xfff84040 /* interrupt status register */
-
-#define MVME188_SETSWI 0xfff84080 /* generate soft interrupt */
-#define MVME188_CLRSWI 0xfff84084 /* reset soft interrupt */
-#define MVME188_ISTATE 0xfff84088 /* HW interrupt status */
-#define MVME188_CLRINT 0xfff8408c /* reset HW interrupt */
-
-#define MVME188_VIRQLV 0xfff85000
-#define MVME188_VIACK1V 0xfff85004
-#define MVME188_VIACK2V 0xfff85008
-#define MVME188_VIACK3V 0xfff8500c
-#define MVME188_VIACK4V 0xfff85010
-#define MVME188_VIACK5V 0xfff85014
-#define MVME188_VIACK6V 0xfff85018
-#define MVME188_VIACK7V 0xfff8501c
-#define MVME188_VIRQV 0xfff85020
-#define M188_IVEC 0x40 /* vector returned upon MVME188 int */
-
-#define MVME188_GLOBAL0 0xfff86001 /* global control and status regs */
-#define MVME188_GLOBAL1 0xfff86003
-#define M188_LRST 0x80
-#define M188_SYSCON 0x40
-#define MVME188_BRDID 0xfff86005
-#define MVME188_CGCSR0 0xfff86007
-#define MVME188_CGCSR1 0xfff86009
-#define MVME188_CGCSR2 0xfff8600b
-#define MVME188_CGCSR3 0xfff8600d
-#define MVME188_CGCSR4 0xfff8600f
-#define MVME188_UCSR 0xfff87000 /* utility control and status reg */
-#define MVME188_BASAD 0xfff87004 /* base address reg */
-#define MVME188_GLBRES 0xfff8700c /* global reset reg */
-
-#define MVME188_CCSR 0xfff88000 /* CPU board control status reg */
-#define MVME188_ERROR 0xfff88004 /* Mbus fault reg */
-#define MVME188_PCNFA 0xfff88008 /* Pbus A decoder reg */
-#define MVME188_PCNFB 0xfff8800c /* Pbus B decoder reg */
-#define MVME188_EXTAD 0xfff88010 /* A24 master A24-A31 addr reg */
-#define MVME188_WHOAMI 0xfff88018 /* whoami reg */
-#define MVME188_WMAD 0xfff88020 /* write mbus addr decoder reg */
-#define MVME188_RMAD 0xfff88024 /* read mbus addr decoder reg */
-#define MVME188_WVAD 0xfff88028 /* write vmebus addr decoder reg */
-#define MVME188_RVAD 0xfff8802c /* read vmebus adds decoder reg */
-
-/*
- * IEN and IST register bits
- * Refer to MVME188 RISC Microcomputer User's Manual, table 4.3
- */
-
-#define IRQ_ABORT 0x80000000 /* 31 */
-#define IRQ_ACF 0x40000000 /* 30 */
-#define IRQ_ARBTO 0x20000000 /* 29 */
-#define IRQ_DTI 0x10000000 /* 28 */
-#define IRQ_SWI7 0x08000000 /* 27 */
-#define IRQ_SWI6 0x04000000 /* 26 */
-#define IRQ_SWI5 0x02000000 /* 25 */
-#define IRQ_SWI4 0x01000000 /* 24 */
-#define IRQ_VME7 0x00800000 /* 23 */
-#define IRQ_CIOI 0x00200000 /* 21 */
-#define IRQ_SF 0x00100000 /* 20 */
-#define IRQ_VME6 0x00080000 /* 19 */
-#define IRQ_DI 0x00020000 /* 17 */
-#define IRQ_SIGHPI 0x00010000 /* 16 */
-#define IRQ_VME5 0x00004000 /* 14 */
-#define IRQ_VME4 0x00001000 /* 12 */
-#define IRQ_VME3 0x00000400 /* 10 */
-#define IRQ_LMI 0x00000100 /* 08 */
-#define IRQ_SIGLPI 0x00000080 /* 07 */
-#define IRQ_VME2 0x00000040 /* 06 */
-#define IRQ_VME1 0x00000010 /* 04 */
-#define IRQ_SWI3 0x00000008 /* 03 */
-#define IRQ_SWI2 0x00000004 /* 02 */
-#define IRQ_SWI1 0x00000002 /* 01 */
-#define IRQ_SWI0 0x00000001 /* 00 */
-
-#define IST_STRING "\20" \
- "\40ABRT\37ACF\36ARBTO\35DTI\34SWI7\33SWI6\32SWI5\31SWI4" \
- "\30IRQ7\26CIOI\25SF\24IRQ6\22DI\21SIGHPI" \
- "\17IRQ5\15IRQ4\13IRQ3\11LMI" \
- "\10SIGLPI\7IRQ2\5IRQ1\4SWI3\3SWI2\2SWI1\1SWI0"
-
-/* IPI bits (see below) */
-#define CLOCK_IPI_MASK (IRQ_SWI7 | IRQ_SWI6 | IRQ_SWI5 | IRQ_SWI4)
-#define IPI_MASK (IRQ_SWI3 | IRQ_SWI2 | IRQ_SWI1 | IRQ_SWI0)
-
-#define ISR_GET_CURRENT_MASK(cpu) \
- (*(volatile u_int *)MVME188_IST & int_mask_reg[cpu])
-
-/*
- * Software interrupts 0 to 3, and 4 to 7, are used to deliver IPIs to cpu0-3.
- * We use two bits because we want clock ipis to be maskable.
- * We rely on the fact that the control bits for these interrupts are
- * the same in the interrupt registers and the set/clear SWI registers.
- */
-/* values for SETSWI and CLRSWI registers */
-#define SWI_IPI_BIT(cpuid) (0x01 << (cpuid))
-#define SWI_CLOCK_IPI_BIT(cpuid) (0x10 << (cpuid))
-/* values for IEN and IST registers */
-#define SWI_IPI_MASK(cpuid) (IRQ_SWI0 << (cpuid))
-#define SWI_CLOCK_IPI_MASK(cpuid) (IRQ_SWI4 << (cpuid))
-
-/*
- * ISTATE and CLRINT register bits
- */
-
-#define ISTATE_ABORT 0x04
-#define ISTATE_ACFAIL 0x02
-#define ISTATE_SYSFAIL 0x01
-
-/*
- * UCSR register bits
- */
-
-#define UCSR_PWRUPBIT 0x00004000 /* powerup indicator */
-#define UCSR_DRVSFBIT 0x00002000 /* Board system fail */
-#define UCSR_BRIRQBIT 0x00001000 /* drives VME IRQ1 broadcast int */
-#define UCSR_ROBINBIT 0x00000800 /* sel round robin VME arbiter mode */
-#define UCSR_BRLVBITS 0x00000600 /* VME bus request level 0-3 */
-#define UCSR_RNEVERBIT 0x00000100 /* VME bus never release once req'd */
-#define UCSR_RONRBIT 0x00000080 /* VME bus req release on no request */
-#define UCSR_RWDBIT 0x00000040 /* VME bus request release when done */
-#define UCSR_EARBTOBIT 0x00000020 /* enable VME arbiter bus timeout */
-#define VTOSELBITS 0x00000018 /* VMEbus timeout select bits */
-#define VTO32US 0x00 /* 32 usec */
-#define VTO64US 0x01 /* 64 usec */
-#define VTO128US 0x10 /* 128 usec */
-#define VTODISABLE 0x18 /* disabled */
-
-/* these are the various Z8536 CIO counter/timer registers */
-#define CIO_BASE 0xfff83000
-#define CIO_PORTC 0xfff83000
-#define CIO_PORTB 0xfff83004
-#define CIO_PORTA 0xfff83008
-#define CIO_CTRL 0xfff8300c
-
-#define DART_BASE 0xfff82000
-
-/*
- * HYPERmodule CMMU addresses
- */
-
-#define VME_CMMU_I0 0xfff7e000
-#define VME_CMMU_I1 0xfff7d000
-#define VME_CMMU_I2 0xfff7b000
-#define VME_CMMU_I3 0xfff77000
-#define VME_CMMU_D0 0xfff6f000
-#define VME_CMMU_D1 0xfff5f000
-#define VME_CMMU_D2 0xfff3f000
-#define VME_CMMU_D3 0xfff7f000
-
-#endif /* _MACHINE_MVME188_H_ */
diff --git a/sys/arch/mvme88k/include/mvme197.h b/sys/arch/mvme88k/include/mvme197.h
deleted file mode 100644
index ae6c5ab6787..00000000000
--- a/sys/arch/mvme88k/include/mvme197.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* $OpenBSD: mvme197.h,v 1.12 2011/03/23 16:54:36 pirofti Exp $ */
-/*
- * Copyright (c) 1996 Nivas Madhur
- * Copyright (c) 1999 Steve Murphree, Jr.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Nivas Madhur.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-/*
- * Mach Operating System
- * Copyright (c) 1991 Carnegie Mellon University
- * Copyright (c) 1991 OMRON Corporation
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- */
-#ifndef _MACHINE_MVME197_H_
-#define _MACHINE_MVME197_H_
-
-#define ECDM_BASE 0xfff01100 /* not what the doc says... */
-
-#define FLASH_START 0xff800000 /* start of flash memory area */
-#define FLASH_SIZE 0x00400000
-#define BUG197_START 0xfff80000 /* start of BUG PROM (in OBIO) */
-#define BUG197_SIZE 0x00040000
-#define OBIO197_START 0xfff00000 /* start of local IO */
-#define OBIO197_SIZE 0x000d0000 /* size of obio space */
-
-#define M197_ILEVEL 0xfff00064 /* interrupt priority level */
-#define M197_IMASK 0xfff00065 /* interrupt mask level */
-#define M197_ISRC 0xfff0006f /* interrupt SRC */
-#define M197_IACK 0xfff00100 /* interrupt ACK base */
-
-#ifdef _KERNEL
-void m197_broadcast_complex_ipi(int, u_int32_t, u_int32_t);
-void m197_send_complex_ipi(int, cpuid_t, u_int32_t, u_int32_t);
-void m197_send_ipi(int, cpuid_t);
-#endif
-
-#endif /* _MACHINE_MVME197_H_ */
diff --git a/sys/arch/mvme88k/include/param.h b/sys/arch/mvme88k/include/param.h
deleted file mode 100644
index 4f049bfc509..00000000000
--- a/sys/arch/mvme88k/include/param.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* $OpenBSD: param.h,v 1.43 2013/11/02 23:06:18 miod Exp $ */
-
-/*
- * Copyright (c) 1999 Steve Murphree, Jr.
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _MACHINE_PARAM_H_
-#define _MACHINE_PARAM_H_
-
-#define _MACHINE mvme88k
-#define MACHINE "mvme88k"
-
-#include <m88k/param.h>
-
-/*
- * The Bug uses the bottom 64KB. The kernel will allocate PTEs to map this
- * space, but the kernel must be linked with a start address past these 64KB.
- */
-#define KERNBASE 0x00000000 /* start of kernel virtual */
-#define KERNTEXTOFF 0x00080000 /* start of kernel text */
-
-#if defined(_KERNEL) || defined(_STANDALONE)
-#if !defined(_LOCORE)
-extern int brdtyp;
-#endif
-
-/*
- * Values for the brdtyp variable.
- */
-#define BRD_180 0x180
-#define BRD_181 0x181
-#define BRD_187 0x187
-#define BRD_188 0x188
-#define BRD_197 0x197
-#define BRD_8120 0x8120
-
-#endif /* _KERNEL || _STANDALONE */
-
-#endif /* _MACHINE_PARAM_H_ */
diff --git a/sys/arch/mvme88k/include/pcb.h b/sys/arch/mvme88k/include/pcb.h
deleted file mode 100644
index 8cf38671aca..00000000000
--- a/sys/arch/mvme88k/include/pcb.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: pcb.h,v 1.15 2004/04/26 14:31:11 miod Exp $ */
-/* public domain */
-#include <m88k/pcb.h>
diff --git a/sys/arch/mvme88k/include/pmap.h b/sys/arch/mvme88k/include/pmap.h
deleted file mode 100644
index dfd79a91c1d..00000000000
--- a/sys/arch/mvme88k/include/pmap.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: pmap.h,v 1.37 2010/12/31 21:38:08 miod Exp $ */
-/* public domain */
-#include <m88k/pmap.h>
diff --git a/sys/arch/mvme88k/include/pmap_table.h b/sys/arch/mvme88k/include/pmap_table.h
deleted file mode 100644
index 327226180d3..00000000000
--- a/sys/arch/mvme88k/include/pmap_table.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: pmap_table.h,v 1.11 2004/07/25 11:06:42 miod Exp $ */
-/* public domain */
-#include <m88k/pmap_table.h>
diff --git a/sys/arch/mvme88k/include/proc.h b/sys/arch/mvme88k/include/proc.h
deleted file mode 100644
index 910c7313af5..00000000000
--- a/sys/arch/mvme88k/include/proc.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: proc.h,v 1.13 2004/04/26 14:31:11 miod Exp $ */
-/* public domain */
-#include <m88k/proc.h>
diff --git a/sys/arch/mvme88k/include/profile.h b/sys/arch/mvme88k/include/profile.h
deleted file mode 100644
index ca0038ffaac..00000000000
--- a/sys/arch/mvme88k/include/profile.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: profile.h,v 1.15 2004/04/29 06:25:36 miod Exp $ */
-/* public domain */
-#include <m88k/profile.h>
diff --git a/sys/arch/mvme88k/include/prom.h b/sys/arch/mvme88k/include/prom.h
deleted file mode 100644
index d18c790749b..00000000000
--- a/sys/arch/mvme88k/include/prom.h
+++ /dev/null
@@ -1,218 +0,0 @@
-/* $OpenBSD: prom.h,v 1.21 2013/05/14 20:30:47 miod Exp $ */
-/*
- * Copyright (c) 1998 Steve Murphree, Jr.
- * Copyright (c) 1996 Nivas Madhur
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _MACHINE_PROM_H_
-#define _MACHINE_PROM_H_
-
-/* BUG trap vector */
-#define MVMEPROM_VECTOR 496
-
-#define MVMEPROM_INCHR 0x00
-#define MVMEPROM_INSTAT 0x01
-#define MVMEPROM_INLN 0x02
-#define MVMEPROM_READSTR 0x03
-#define MVMEPROM_READLN 0x04
-#define MVMEPROM_DSKRD 0x10
-#define MVMEPROM_DSKWR 0x11
-#define MVMEPROM_DSKCFIG 0x12
-#define MVMEPROM_DSKFMT 0x14
-#define MVMEPROM_DSKCTRL 0x15
-#define MVMEPROM_NETCFIG 0x1a
-#define MVMEPROM_NETFOPEN 0x1b
-#define MVMEPROM_NETFREAD 0x1c
-#define MVMEPROM_NETCTRL 0x1d
-#define MVMEPROM_OUTCHR 0x20
-#define MVMEPROM_OUTSTR 0x21
-#define MVMEPROM_OUTSTRCRLF 0x22
-#define MVMEPROM_WRITE 0x23
-#define MVMEPROM_WRITELN 0x24
-#define MVMEPROM_OUTCRLF 0x26 /* not implemented on MVME181? */
-#define MVMEPROM_DELAY 0x43
-#define MVMEPROM_RTC_RD 0x53
-#define MVMEPROM_EXIT 0x63
-#define MVMEPROM_GETBRDID 0x70
-#define MVMEPROM_ENVIRON 0x71
-#define MVMEPROM_FORKMPU 0x100
-
-#define NETCFIG_READ 1
-#define NETCFIG_WRITE 2
-#define NETCFIG_STORE 4
-
-#define NETCTRLCMD_INITIALIZE 0
-#define NETCTRLCMD_GETETHER 1
-#define NETCTRLCMD_XMIT 2
-#define NETCTRLCMD_RECV 3
-#define NETCTRLCMD_FLUSH 4
-#define NETCTRLCMD_RESET 5
-
-#define ENVIRONCMD_WRITE 1
-#define ENVIRONCMD_READ 2
-#define ENVIRONTYPE_EOL 0
-#define ENVIRONTYPE_START 1
-#define ENVIRONTYPE_DISKBOOT 2
-#define ENVIRONTYPE_ROMBOOT 3
-#define ENVIRONTYPE_NETBOOT 4
-#define ENVIRONTYPE_MEMSIZE 5
-
-#define FORKMPU_NOT_IDLE -1
-#define FORKMPU_BAD_ADDRESS -2
-#define FORKMPU_NO_MPU -3
-
-#ifndef LOCORE
-struct mvmeprom_netcfig {
- u_char ctrl;
- u_char dev;
- u_short status;
- u_long ncp_addr;
- u_long dcp_addr;
- u_long flags;
-};
-
-struct mvmeprom_ncp {
- u_long magic;
-#define NETCFIG_MAGIC 0x12301983
- u_long node_memory_address;
- u_long boot_load_address;
- u_long boot_start_address;
- u_long boot_start_delay;
- u_long boot_length;
- u_long boot_offset;
- u_long trace_buffer_address;
- u_long client_ip;
- u_long server_ip;
- u_long subnet_mask;
- u_long broadcast_mask;
- u_long gateway_ip;
- u_char bootp_retry;
- u_char tftp_retry;
- char rarp_control;
- char update_control;
- char filename[64];
- char commandline[64];
-};
-
-struct mvmeprom_netctrl {
- u_char ctrl;
- u_char dev;
- u_short status;
- u_long cmd;
- u_long addr;
- u_long len;
- u_long flags;
-};
-
-struct mvmeprom_netfopen {
- u_char ctrl;
- u_char dev;
- u_short status;
- char filename[64];
-};
-
-struct mvmeprom_netfread {
- u_char ctrl;
- u_char dev;
- u_short status;
- u_long addr;
- u_short bytes;
- u_short blk;
- u_long timeout;
-};
-
-struct prom_environ_hdr {
- u_char type;
- u_char len;
-};
-
-struct mvmeprom_brdid {
- u_long eye_catcher;
- u_char rev;
- u_char month;
- u_char day;
- u_char year;
- u_short size;
- u_short rsv1;
- u_short model;
- u_char suffix[2];
- u_short options;
- u_char family;
- u_char cpu;
- u_short ctrlun;
- u_short devlun;
- u_short devtype;
- u_short devnum;
- u_long bug;
- u_char version[4];
- u_char serial[12]; /* SBC serial number */
- u_char id[16]; /* SBC id */
- u_char pwa[16]; /* printed wiring assembly number */
- u_char speed[4]; /* cpu speed */
- u_char etheraddr[6]; /* mac address, all zero if no ether */
- u_char fill[2];
- u_char scsiid[2]; /* local SCSI id */
- u_char sysid[8]; /* system id - nothing on mvme187 */
- u_char brd1_pwb[8]; /* memory board 1 pwb */
- u_char brd1_serial[8]; /* memory board 1 serial */
- u_char brd2_pwb[8]; /* memory board 2 pwb */
- u_char brd2_serial[8]; /* memory board 2 serial */
- u_char reserved[153];
- u_char cksum[1];
-};
-
-struct mvmeprom_time {
- u_char year_BCD;
- u_char month_BCD;
- u_char day_BCD;
- u_char wday_BCD;
- u_char hour_BCD;
- u_char min_BCD;
- u_char sec_BCD;
- u_char cal_BCD;
-};
-
-struct mvmeprom_dskio {
- u_char ctrl_lun;
- u_char dev_lun;
- u_short status;
- void *pbuffer;
- u_long blk_num;
- u_short blk_cnt;
- u_char flag;
-#define BUG_FILE_MARK 0x80
-#define IGNORE_FILENUM 0x02
-#define END_OF_FILE 0x01
- u_char addr_mod;
-};
-#define MVMEPROM_BLOCK_SIZE 256
-
-#endif /* _LOCORE */
-
-#ifndef RB_NOSYM
-#define RB_NOSYM 0x4000
-#endif
-#endif /* _MACHINE_PROM_H_ */
diff --git a/sys/arch/mvme88k/include/psl.h b/sys/arch/mvme88k/include/psl.h
deleted file mode 100644
index 03f15339aac..00000000000
--- a/sys/arch/mvme88k/include/psl.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: psl.h,v 1.16 2004/04/26 14:31:11 miod Exp $ */
-/* public domain */
-#include <m88k/psl.h>
diff --git a/sys/arch/mvme88k/include/ptrace.h b/sys/arch/mvme88k/include/ptrace.h
deleted file mode 100644
index f318109f264..00000000000
--- a/sys/arch/mvme88k/include/ptrace.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: ptrace.h,v 1.12 2004/04/26 14:31:11 miod Exp $ */
-/* public domain */
-#include <m88k/ptrace.h>
diff --git a/sys/arch/mvme88k/include/reg.h b/sys/arch/mvme88k/include/reg.h
deleted file mode 100644
index 491bed27782..00000000000
--- a/sys/arch/mvme88k/include/reg.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: reg.h,v 1.16 2004/04/26 14:31:11 miod Exp $ */
-/* public domain */
-#include <m88k/reg.h>
diff --git a/sys/arch/mvme88k/include/reloc.h b/sys/arch/mvme88k/include/reloc.h
deleted file mode 100644
index 689cda8e0ca..00000000000
--- a/sys/arch/mvme88k/include/reloc.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: reloc.h,v 1.1 2013/01/05 11:20:56 miod Exp $ */
-/* public domain */
-#include <m88k/reloc.h>
diff --git a/sys/arch/mvme88k/include/setjmp.h b/sys/arch/mvme88k/include/setjmp.h
deleted file mode 100644
index e3834ebb05a..00000000000
--- a/sys/arch/mvme88k/include/setjmp.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: setjmp.h,v 1.9 2004/04/26 14:31:11 miod Exp $ */
-/* public domain */
-#include <m88k/setjmp.h>
diff --git a/sys/arch/mvme88k/include/signal.h b/sys/arch/mvme88k/include/signal.h
deleted file mode 100644
index 016c5a31574..00000000000
--- a/sys/arch/mvme88k/include/signal.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: signal.h,v 1.14 2004/04/26 14:31:11 miod Exp $ */
-/* public domain */
-#include <m88k/signal.h>
diff --git a/sys/arch/mvme88k/include/spinlock.h b/sys/arch/mvme88k/include/spinlock.h
deleted file mode 100644
index 4686657622e..00000000000
--- a/sys/arch/mvme88k/include/spinlock.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: spinlock.h,v 1.3 2004/04/26 14:31:11 miod Exp $ */
-/* public domain */
-#include <m88k/spinlock.h>
diff --git a/sys/arch/mvme88k/include/stdarg.h b/sys/arch/mvme88k/include/stdarg.h
deleted file mode 100644
index 14940e14a9d..00000000000
--- a/sys/arch/mvme88k/include/stdarg.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: stdarg.h,v 1.8 2004/04/26 14:31:11 miod Exp $ */
-/* public domain */
-#include <m88k/stdarg.h>
diff --git a/sys/arch/mvme88k/include/tcb.h b/sys/arch/mvme88k/include/tcb.h
deleted file mode 100644
index 9b8af0732f6..00000000000
--- a/sys/arch/mvme88k/include/tcb.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: tcb.h,v 1.2 2013/06/01 21:20:54 jasper Exp $ */
-/* public domain */
-#include <m88k/tcb.h>
diff --git a/sys/arch/mvme88k/include/trap.h b/sys/arch/mvme88k/include/trap.h
deleted file mode 100644
index b8490824bfa..00000000000
--- a/sys/arch/mvme88k/include/trap.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: trap.h,v 1.25 2013/05/17 22:46:28 miod Exp $ */
-/* public domain */
-#include <machine/board.h> /* md_interrupt_func */
-#include <m88k/trap.h>
diff --git a/sys/arch/mvme88k/include/varargs.h b/sys/arch/mvme88k/include/varargs.h
deleted file mode 100644
index 330ab175540..00000000000
--- a/sys/arch/mvme88k/include/varargs.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* $OpenBSD: varargs.h,v 1.9 2004/04/26 14:31:11 miod Exp $ */
-/* public domain */
-#include <m88k/varargs.h>
diff --git a/sys/arch/mvme88k/include/vmparam.h b/sys/arch/mvme88k/include/vmparam.h
deleted file mode 100644
index 4641c603e43..00000000000
--- a/sys/arch/mvme88k/include/vmparam.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* $OpenBSD: vmparam.h,v 1.28 2010/12/31 21:38:08 miod Exp $ */
-/* public domain */
-
-/*
- * Physical memory is mapped 1:1 at the bottom of the supervisor address
- * space. Kernel virtual memory space starts from the end of physical memory,
- * up to the on-board devices appearing all over the last 8MB of address space.
- */
-#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)0x00000000)
-#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)0xff800000)
-
-#include <m88k/vmparam.h>
diff --git a/sys/arch/mvme88k/mvme88k/autoconf.c b/sys/arch/mvme88k/mvme88k/autoconf.c
deleted file mode 100644
index 161bc540c31..00000000000
--- a/sys/arch/mvme88k/mvme88k/autoconf.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/* $OpenBSD: autoconf.c,v 1.49 2013/11/02 23:10:30 miod Exp $ */
-/*
- * Copyright (c) 1998 Steve Murphree, Jr.
- * Copyright (c) 1996 Nivas Madhur
- * Copyright (c) 1994 Christian E. Hopps
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Christian E. Hopps.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/reboot.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/disklabel.h>
-#include <sys/kernel.h>
-
-#include <uvm/uvm.h>
-
-#include <machine/asm_macro.h> /* enable/disable interrupts */
-#include <machine/autoconf.h>
-#include <machine/bugio.h>
-#include <machine/cpu.h>
-#include <machine/vmparam.h>
-
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-
-#include <dev/cons.h>
-
-/*
- * The following several variables are related to
- * the configuration process, and are used in initializing
- * the machine.
- */
-
-void dumpconf(void);
-int get_target(int *, int *, int *);
-
-int cold = 1; /* 1 if still booting */
-
-paddr_t bootaddr;
-int bootpart, bootbus;
-struct device *bootdv; /* set by device drivers (if found) */
-
-/*
- * called at boot time, configure all devices on the system.
- */
-void
-cpu_configure()
-{
- extern void cpu_hatch_secondary_processors(void *);
- softintr_init();
-
- if (config_rootfound("mainbus", "mainbus") == 0)
- panic("no mainbus found");
-
-
- /*
- * Finally switch to the real console driver,
- * and say goodbye to the BUG!
- */
- cn_tab = NULL;
- cninit();
-
-#ifdef MULTIPROCESSOR
- /*
- * Spin up the other processors, but do not give them work to
- * do yet.
- */
- cpu_hatch_secondary_processors(NULL);
-#endif
-
- /* NO BUG CALLS FROM NOW ON */
-
- /*
- * Switch to our final trap vectors, and unmap the BUG data area.
- */
- set_vbr(kernel_vbr);
- pmap_unmap_firmware();
-
- cold = 0;
-
- /*
- * Turn external interrupts on.
- */
- set_psr(get_psr() & ~PSR_IND);
- spl0();
-}
-
-void
-diskconf(void)
-{
- printf("boot device: %s\n",
- (bootdv) ? bootdv->dv_xname : "<unknown>");
-
- setroot(bootdv, bootpart, RB_USERREQ);
- dumpconf();
-}
-
-void
-device_register(struct device *dev, void *aux)
-{
- if (bootpart == -1) /* ignore flag from controller driver? */
- return;
-
- /*
- * scsi: sd,cd
- */
- if (strcmp("cd", dev->dv_cfdata->cf_driver->cd_name) == 0 ||
- strcmp("sd", dev->dv_cfdata->cf_driver->cd_name) == 0) {
- struct scsi_attach_args *sa = aux;
- int target, bus, lun;
-
- if (get_target(&target, &bus, &lun) != 0)
- return;
-
- /* make sure we are on the expected scsibus */
- if (bootbus != bus)
- return;
-
- if (sa->sa_sc_link->target == target &&
- sa->sa_sc_link->lun == lun) {
- bootdv = dev;
- return;
- }
- }
-
- /*
- * ethernet: ie,le
- */
- else if (strcmp("ie", dev->dv_cfdata->cf_driver->cd_name) == 0 ||
- strcmp("le", dev->dv_cfdata->cf_driver->cd_name) == 0) {
- struct confargs *ca = aux;
-
- if (ca->ca_paddr == bootaddr) {
- bootdv = dev;
- return;
- }
- }
-}
-
-/*
- * Returns the ID of the SCSI disk based on Motorola's CLUN/DLUN stuff
- * bootdev == CLUN << 8 | DLUN.
- * This handles SBC SCSI and MVME32[78].
- */
-int
-get_target(int *target, int *bus, int *lun)
-{
- extern int bootdev;
-
- switch (bootdev >> 8) {
- /* built-in controller */
- case 0x00:
- /* MVME327 */
- case 0x02:
- case 0x03:
- *bus = 0;
- *target = (bootdev & 0x70) >> 4;
- *lun = (bootdev & 0x07);
- return (0);
- /* MVME328 */
- case 0x06:
- case 0x07:
- case 0x16:
- case 0x17:
- case 0x18:
- case 0x19:
- *bus = (bootdev & 0x40) >> 6;
- *target = (bootdev & 0x38) >> 3;
- *lun = (bootdev & 0x07);
- return (0);
- default:
- return (ENODEV);
- }
-}
-
-struct nam2blk nam2blk[] = {
- { "sd", 4 },
- { "cd", 6 },
- { "rd", 7 },
- { "vnd", 8 },
- { NULL, -1 }
-};
diff --git a/sys/arch/mvme88k/mvme88k/bus_dma.c b/sys/arch/mvme88k/mvme88k/bus_dma.c
deleted file mode 100644
index ca9bff72645..00000000000
--- a/sys/arch/mvme88k/mvme88k/bus_dma.c
+++ /dev/null
@@ -1,684 +0,0 @@
-/* $OpenBSD: bus_dma.c,v 1.18 2011/10/09 17:08:22 miod Exp $ */
-/* $NetBSD: bus_dma.c,v 1.2 2001/06/10 02:31:25 briggs Exp $ */
-
-/*-
- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
- * NASA Ames Research Center.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/proc.h>
-#include <sys/extent.h>
-#include <sys/buf.h>
-#include <sys/device.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/mount.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/bus.h>
-#include <machine/cmmu.h>
-#include <machine/intr.h>
-
-int _bus_dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *,
- bus_size_t, struct proc *, int, paddr_t *, int *, int);
-
-int _bus_dmamem_alloc_range(bus_dma_tag_t, bus_size_t, bus_size_t,
- bus_size_t, bus_dma_segment_t *, int, int *, int, paddr_t, paddr_t);
-
-/*
- * Common function for DMA map creation. May be called by bus-specific
- * DMA map creation functions.
- */
-int
-bus_dmamap_create(t, size, nsegments, maxsegsz, boundary, flags, dmamp)
- bus_dma_tag_t t;
- bus_size_t size;
- int nsegments;
- bus_size_t maxsegsz;
- bus_size_t boundary;
- int flags;
- bus_dmamap_t *dmamp;
-{
- struct m88k_bus_dmamap *map;
- void *mapstore;
- size_t mapsize;
-
- /*
- * Allocate and initialize the DMA map. The end of the map
- * is a variable-sized array of segments, so we allocate enough
- * room for them in one shot.
- *
- * Note we don't preserve the WAITOK or NOWAIT flags. Preservation
- * of ALLOCNOW notifies others that we've reserved these resources,
- * and they are not to be freed.
- *
- * The bus_dmamap_t includes one bus_dma_segment_t, hence
- * the (nsegments - 1).
- */
- mapsize = sizeof(struct m88k_bus_dmamap) +
- (sizeof(bus_dma_segment_t) * (nsegments - 1));
- if ((mapstore = malloc(mapsize, M_DEVBUF, (flags & BUS_DMA_NOWAIT) ?
- (M_NOWAIT | M_ZERO) : (M_WAITOK | M_ZERO))) == NULL)
- return (ENOMEM);
-
- map = (struct m88k_bus_dmamap *)mapstore;
- map->_dm_size = size;
- map->_dm_segcnt = nsegments;
- map->_dm_maxsegsz = maxsegsz;
- map->_dm_boundary = boundary;
- map->dm_mapsize = 0; /* no valid mappings */
- map->dm_nsegs = 0;
-
- *dmamp = map;
- return (0);
-}
-
-/*
- * Common function for DMA map destruction. May be called by bus-specific
- * DMA map destruction functions.
- */
-void
-bus_dmamap_destroy(t, map)
- bus_dma_tag_t t;
- bus_dmamap_t map;
-{
-
- free(map, M_DEVBUF);
-}
-
-/*
- * Utility function to load a linear buffer. lastaddrp holds state
- * between invocations (for multiple-buffer loads). segp contains
- * the starting segment on entrance, and the ending segment on exit.
- * first indicates if this is the first invocation of this function.
- */
-int
-_bus_dmamap_load_buffer(t, map, buf, buflen, p, flags, lastaddrp, segp, first)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- void *buf;
- bus_size_t buflen;
- struct proc *p;
- int flags;
- paddr_t *lastaddrp;
- int *segp;
- int first;
-{
- bus_size_t sgsize;
- bus_addr_t curaddr, lastaddr, baddr, bmask;
- vaddr_t vaddr = (vaddr_t)buf;
- int seg;
- pmap_t pmap;
-
- if (p != NULL)
- pmap = vm_map_pmap(&p->p_vmspace->vm_map);
- else
- pmap = pmap_kernel();
-
- lastaddr = *lastaddrp;
- bmask = ~(map->_dm_boundary - 1);
-
- for (seg = *segp; buflen > 0 ; ) {
- /*
- * Get the physical address for this segment.
- */
- if (pmap_extract(pmap, vaddr, (paddr_t *)&curaddr) == FALSE)
- return (EINVAL);
-
- /*
- * Compute the segment size, and adjust counts.
- */
- sgsize = PAGE_SIZE - ((u_long)vaddr & PGOFSET);
- if (buflen < sgsize)
- sgsize = buflen;
-
- /*
- * Make sure we don't cross any boundaries.
- */
- if (map->_dm_boundary > 0) {
- baddr = (curaddr + map->_dm_boundary) & bmask;
- if (sgsize > (baddr - curaddr))
- sgsize = (baddr - curaddr);
- }
-
- /*
- * Insert chunk into a segment, coalescing with
- * the previous segment if possible.
- */
- if (first) {
- map->dm_segs[seg].ds_addr = curaddr;
- map->dm_segs[seg].ds_len = sgsize;
- first = 0;
- } else {
- if (curaddr == lastaddr &&
- (map->dm_segs[seg].ds_len + sgsize) <=
- map->_dm_maxsegsz &&
- (map->_dm_boundary == 0 ||
- (map->dm_segs[seg].ds_addr & bmask) ==
- (curaddr & bmask)))
- map->dm_segs[seg].ds_len += sgsize;
- else {
- if (++seg >= map->_dm_segcnt)
- break;
- map->dm_segs[seg].ds_addr = curaddr;
- map->dm_segs[seg].ds_len = sgsize;
- }
- }
-
- lastaddr = curaddr + sgsize;
- vaddr += sgsize;
- buflen -= sgsize;
- }
-
- *segp = seg;
- *lastaddrp = lastaddr;
-
- /*
- * Did we fit?
- */
- if (buflen != 0)
- return (EFBIG); /* XXX better return value here? */
-
- return (0);
-}
-
-/*
- * Common function for loading a DMA map with a linear buffer. May
- * be called by bus-specific DMA map load functions.
- */
-int
-bus_dmamap_load(t, map, buf, buflen, p, flags)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- void *buf;
- bus_size_t buflen;
- struct proc *p;
- int flags;
-{
- paddr_t lastaddr;
- int seg, error;
-
- /*
- * Make sure that on error condition we return "no valid mappings".
- */
- map->dm_mapsize = 0;
- map->dm_nsegs = 0;
-
- if (buflen > map->_dm_size)
- return (EINVAL);
-
- seg = 0;
- error = _bus_dmamap_load_buffer(t, map, buf, buflen, p, flags,
- &lastaddr, &seg, 1);
- if (error == 0) {
- map->dm_mapsize = buflen;
- map->dm_nsegs = seg + 1;
- }
- return (error);
-}
-
-/*
- * Like _bus_dmamap_load(), but for mbufs.
- */
-int
-bus_dmamap_load_mbuf(t, map, m0, flags)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- struct mbuf *m0;
- int flags;
-{
- paddr_t lastaddr;
- int seg, error, first;
- struct mbuf *m;
-
- /*
- * Make sure that on error condition we return "no valid mappings."
- */
- map->dm_mapsize = 0;
- map->dm_nsegs = 0;
-
-#ifdef DIAGNOSTIC
- if ((m0->m_flags & M_PKTHDR) == 0)
- panic("bus_dmamap_load_mbuf: no packet header");
-#endif
-
- if (m0->m_pkthdr.len > map->_dm_size)
- return (EINVAL);
-
- first = 1;
- seg = 0;
- error = 0;
- for (m = m0; m != NULL && error == 0; m = m->m_next) {
- if (m->m_len == 0)
- continue;
- error = _bus_dmamap_load_buffer(t, map, m->m_data, m->m_len,
- NULL, flags, &lastaddr, &seg, first);
- first = 0;
- }
- if (error == 0) {
- map->dm_mapsize = m0->m_pkthdr.len;
- map->dm_nsegs = seg + 1;
- }
- return (error);
-}
-
-/*
- * Like _bus_dmamap_load(), but for uios.
- */
-int
-bus_dmamap_load_uio(t, map, uio, flags)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- struct uio *uio;
- int flags;
-{
- paddr_t lastaddr;
- int seg, i, error, first;
- bus_size_t minlen, resid;
- struct proc *p = NULL;
- struct iovec *iov;
- caddr_t addr;
-
- /*
- * Make sure that on error condition we return "no valid mappings."
- */
- map->dm_mapsize = 0;
- map->dm_nsegs = 0;
-
- resid = uio->uio_resid;
- iov = uio->uio_iov;
-
- if (resid > map->_dm_size)
- return (EINVAL);
-
- if (uio->uio_segflg == UIO_USERSPACE) {
- p = uio->uio_procp;
-#ifdef DIAGNOSTIC
- if (p == NULL)
- panic("bus_dmamap_load_uio: USERSPACE but no proc");
-#endif
- }
-
- first = 1;
- seg = 0;
- error = 0;
- for (i = 0; i < uio->uio_iovcnt && resid != 0 && error == 0; i++) {
- /*
- * Now at the first iovec to load. Load each iovec
- * until we have exhausted the residual count.
- */
- minlen = resid < iov[i].iov_len ? resid : iov[i].iov_len;
- addr = (caddr_t)iov[i].iov_base;
-
- error = _bus_dmamap_load_buffer(t, map, addr, minlen,
- p, flags, &lastaddr, &seg, first);
- first = 0;
-
- resid -= minlen;
- }
- if (error == 0) {
- map->dm_mapsize = uio->uio_resid;
- map->dm_nsegs = seg + 1;
- }
- return (error);
-}
-
-/*
- * Like bus_dmamap_load(), but for raw memory allocated with
- * bus_dmamem_alloc().
- */
-int
-bus_dmamap_load_raw(t, map, segs, nsegs, size, flags)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- bus_dma_segment_t *segs;
- int nsegs;
- bus_size_t size;
- int flags;
-{
- if (nsegs > map->_dm_segcnt || size > map->_dm_size)
- return (EINVAL);
-
- /*
- * Make sure we don't cross any boundaries.
- */
- if (map->_dm_boundary) {
- bus_addr_t bmask = ~(map->_dm_boundary - 1);
- int i;
-
- for (i = 0; i < nsegs; i++) {
- if (segs[i].ds_len > map->_dm_maxsegsz)
- return (EINVAL);
- if ((segs[i].ds_addr & bmask) !=
- ((segs[i].ds_addr + segs[i].ds_len - 1) & bmask))
- return (EINVAL);
- }
- }
-
- bcopy(segs, map->dm_segs, nsegs * sizeof(*segs));
- map->dm_nsegs = nsegs;
- return (0);
-}
-
-/*
- * Common function for unloading a DMA map. May be called by
- * chipset-specific DMA map unload functions.
- */
-void
-bus_dmamap_unload(t, map)
- bus_dma_tag_t t;
- bus_dmamap_t map;
-{
-
- /*
- * No resources to free; just mark the mappings as
- * invalid.
- */
- map->dm_mapsize = 0;
- map->dm_nsegs = 0;
-}
-
-/*
- * Common function for DMA map synchronization. May be called
- * by chipset-specific DMA map synchronization functions.
- */
-
-void
-bus_dmamap_sync(t, map, offset, len, op)
- bus_dma_tag_t t;
- bus_dmamap_t map;
- bus_addr_t offset;
- bus_size_t len;
- int op;
-{
- u_int nsegs;
- bus_dma_segment_t *seg;
-
- if (op & BUS_DMASYNC_PREREAD)
- op = DMA_CACHE_SYNC_INVAL;
- else if (op & BUS_DMASYNC_PREWRITE)
- op = DMA_CACHE_SYNC;
- else if (op & BUS_DMASYNC_POSTREAD)
- op = DMA_CACHE_INV;
- else
- return;
-
- nsegs = map->dm_nsegs;
- seg = map->dm_segs;
- while (nsegs != 0 && len != 0) {
- if (offset >= seg->ds_len) {
- offset -= seg->ds_len;
- } else {
- bus_addr_t addr;
- bus_size_t sublen;
-
- addr = seg->ds_addr + offset;
- sublen = seg->ds_len - offset;
- if (sublen > len)
- sublen = len;
-
- dma_cachectl(addr, sublen, op);
-
- offset = 0;
- len -= sublen;
- }
- seg++;
- nsegs--;
- }
-}
-
-/*
- * Common function for DMA-safe memory allocation. May be called
- * by bus-specific DMA memory allocation functions.
- */
-int
-bus_dmamem_alloc(t, size, alignment, boundary, segs, nsegs, rsegs, flags)
- bus_dma_tag_t t;
- bus_size_t size, alignment, boundary;
- bus_dma_segment_t *segs;
- int nsegs;
- int *rsegs;
- int flags;
-{
- return _bus_dmamem_alloc_range(t, size, alignment, boundary, segs,
- nsegs, rsegs, flags, 0, -1);
-}
-
-/*
- * Common function for freeing DMA-safe memory. May be called by
- * bus-specific DMA memory free functions.
- */
-void
-bus_dmamem_free(t, segs, nsegs)
- bus_dma_tag_t t;
- bus_dma_segment_t *segs;
- int nsegs;
-{
- struct vm_page *m;
- bus_addr_t addr;
- struct pglist mlist;
- int curseg;
-
- /*
- * Build a list of pages to free back to the VM system.
- */
- TAILQ_INIT(&mlist);
- for (curseg = 0; curseg < nsegs; curseg++) {
- for (addr = segs[curseg].ds_addr;
- addr < (segs[curseg].ds_addr + segs[curseg].ds_len);
- addr += PAGE_SIZE) {
- m = PHYS_TO_VM_PAGE(addr);
- TAILQ_INSERT_TAIL(&mlist, m, pageq);
- }
- }
-
- uvm_pglistfree(&mlist);
-}
-
-/*
- * Common function for mapping DMA-safe memory. May be called by
- * bus-specific DMA memory map functions.
- */
-int
-bus_dmamem_map(t, segs, nsegs, size, kvap, flags)
- bus_dma_tag_t t;
- bus_dma_segment_t *segs;
- int nsegs;
- size_t size;
- caddr_t *kvap;
- int flags;
-{
- vaddr_t va, sva;
- size_t ssize;
- bus_addr_t addr;
- int curseg, error;
-
- size = round_page(size);
-
- va = uvm_km_valloc(kernel_map, size);
-
- if (va == 0)
- return (ENOMEM);
-
- *kvap = (caddr_t)va;
-
- sva = va;
- ssize = size;
- for (curseg = 0; curseg < nsegs; curseg++) {
- for (addr = segs[curseg].ds_addr;
- addr < (segs[curseg].ds_addr + segs[curseg].ds_len);
- addr += PAGE_SIZE, va += PAGE_SIZE, size -= PAGE_SIZE) {
- if (size == 0)
- panic("bus_dmamem_map: size botch");
- error = pmap_enter(pmap_kernel(), va, addr,
- VM_PROT_READ | VM_PROT_WRITE, VM_PROT_READ |
- VM_PROT_WRITE | PMAP_WIRED | PMAP_CANFAIL);
- if (error) {
- pmap_update(pmap_kernel());
- uvm_km_free(kernel_map, sva, ssize);
- return (error);
- }
- if (flags & BUS_DMA_COHERENT)
- pmap_page_uncache(addr);
- }
- }
- pmap_update(pmap_kernel());
-
- return (0);
-}
-
-/*
- * Common function for unmapping DMA-safe memory. May be called by
- * bus-specific DMA memory unmapping functions.
- */
-void
-bus_dmamem_unmap(t, kva, size)
- bus_dma_tag_t t;
- caddr_t kva;
- size_t size;
-{
-
-#ifdef DIAGNOSTIC
- if ((u_long)kva & PGOFSET)
- panic("bus_dmamem_unmap");
-#endif
-
- size = round_page(size);
- uvm_km_free(kernel_map, (vaddr_t)kva, size);
-}
-
-/*
- * Common function for mmap(2)'ing DMA-safe memory. May be called by
- * bus-specific DMA mmap(2)'ing functions.
- */
-paddr_t
-bus_dmamem_mmap(t, segs, nsegs, off, prot, flags)
- bus_dma_tag_t t;
- bus_dma_segment_t *segs;
- int nsegs;
- off_t off;
- int prot, flags;
-{
- int i;
-
- for (i = 0; i < nsegs; i++) {
-#ifdef DIAGNOSTIC
- if (off & PGOFSET)
- panic("bus_dmamem_mmap: offset unaligned");
- if (segs[i].ds_addr & PGOFSET)
- panic("bus_dmamem_mmap: segment unaligned");
- if (segs[i].ds_len & PGOFSET)
- panic("bus_dmamem_mmap: segment size not multiple"
- " of page size");
-#endif
- if (off >= segs[i].ds_len) {
- off -= segs[i].ds_len;
- continue;
- }
-
- return (segs[i].ds_addr + off);
- }
-
- /* Page not found. */
- return (-1);
-}
-
-/*
- * Allocate physical memory from the given physical address range.
- * Called by DMA-safe memory allocation methods.
- */
-int
-_bus_dmamem_alloc_range(t, size, alignment, boundary, segs, nsegs, rsegs,
- flags, low, high)
- bus_dma_tag_t t;
- bus_size_t size, alignment, boundary;
- bus_dma_segment_t *segs;
- int nsegs;
- int *rsegs;
- int flags;
- paddr_t low;
- paddr_t high;
-{
- paddr_t curaddr, lastaddr;
- struct vm_page *m;
- struct pglist mlist;
- int curseg, error, plaflag;
-
- /* Always round the size. */
- size = round_page(size);
-
- /*
- * Allocate pages from the VM system.
- */
- plaflag = flags & BUS_DMA_NOWAIT ? UVM_PLA_NOWAIT : UVM_PLA_WAITOK;
- if (flags & BUS_DMA_ZERO)
- plaflag |= UVM_PLA_ZERO;
-
- TAILQ_INIT(&mlist);
- error = uvm_pglistalloc(size, low, high, alignment, boundary,
- &mlist, nsegs, plaflag);
- if (error)
- return (error);
-
- /*
- * Compute the location, size, and number of segments actually
- * returned by the VM code.
- */
- m = TAILQ_FIRST(&mlist);
- curseg = 0;
- lastaddr = segs[curseg].ds_addr = VM_PAGE_TO_PHYS(m);
- segs[curseg].ds_len = PAGE_SIZE;
- m = TAILQ_NEXT(m, pageq);
-
- for (; m != TAILQ_END(&mlist); m = TAILQ_NEXT(m, pageq)) {
- curaddr = VM_PAGE_TO_PHYS(m);
-#ifdef DIAGNOSTIC
- if (curaddr < low || curaddr >= high) {
- panic("_bus_dmamem_alloc_range: uvm_pglistalloc "
- "returned non-sensical address 0x%lx\n", curaddr);
- }
-#endif
- if (curaddr == (lastaddr + PAGE_SIZE))
- segs[curseg].ds_len += PAGE_SIZE;
- else {
- curseg++;
- segs[curseg].ds_addr = curaddr;
- segs[curseg].ds_len = PAGE_SIZE;
- }
- lastaddr = curaddr;
- }
-
- *rsegs = curseg + 1;
-
- return (0);
-}
diff --git a/sys/arch/mvme88k/mvme88k/clock.c b/sys/arch/mvme88k/mvme88k/clock.c
deleted file mode 100644
index a7cc6849119..00000000000
--- a/sys/arch/mvme88k/mvme88k/clock.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/* $OpenBSD: clock.c,v 1.5 2013/05/17 22:38:25 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
-#include <sys/time.h>
-#include <sys/timetc.h>
-
-#include <mvme88k/mvme88k/clockvar.h>
-
-time_t (*md_inittodr)(void);
-void (*md_resettodr)(void);
-
-/*
- * Set up the system's time, given a `reasonable' time value.
- */
-
-void
-inittodr(time_t base)
-{
- int badbase = 0, waszero = base == 0;
- struct timespec ts;
-
- ts.tv_sec = ts.tv_nsec = 0;
-
- if (base < 43 * SECYR) {
- /*
- * If base is 0, assume filesystem time is just unknown
- * in stead of preposterous. Don't bark.
- */
- if (base != 0)
- printf("WARNING: preposterous time in file system\n");
- /* not going to use it anyway, if the chip is readable */
- base = 43 * SECYR;
- badbase = 1;
- }
-
- if (md_inittodr != NULL)
- ts.tv_sec = (*md_inittodr)();
-
- if (ts.tv_sec == 0) {
- printf("WARNING: bad date in nvram");
- /*
- * Believe the time in the file system for lack of
- * anything better, resetting the clock.
- */
- ts.tv_sec = base;
- if (!badbase)
- resettodr();
- } else {
- int deltat = ts.tv_sec - base;
-
- if (deltat < 0)
- deltat = -deltat;
- if (waszero || deltat < 2 * SECDAY)
- goto done;
- printf("WARNING: clock %s %d days",
- ts.tv_sec < base ? "lost" : "gained", deltat / SECDAY);
- }
- printf(" -- CHECK AND RESET THE DATE!\n");
-done:
- tc_setclock(&ts);
-}
-
-/*
- * Reset the clock based on the current time.
- * Used when the current clock is preposterous, when the time is changed,
- * and when rebooting. Do nothing if the time is not yet known, e.g.,
- * when crashing during autoconfig.
- */
-void
-resettodr()
-{
- if (time_second == 0)
- return;
-
- if (md_resettodr != NULL)
- (*md_resettodr)();
-}
diff --git a/sys/arch/mvme88k/mvme88k/clockvar.h b/sys/arch/mvme88k/mvme88k/clockvar.h
deleted file mode 100644
index 77cb7e541cb..00000000000
--- a/sys/arch/mvme88k/mvme88k/clockvar.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* $OpenBSD: clockvar.h,v 1.4 2013/05/17 22:38:25 miod Exp $ */
-/*
- * Copyright (c) 1999 Steve Murphree, Jr.
- * Copyright (c) 1995 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- * Copyright (c) 1995 Nivas Madhur
- * Copyright (c) 1994 Gordon W. Ross
- * Copyright (c) 1993 Adam Glass
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)clock.c 8.1 (Berkeley) 6/11/93
- */
-
-extern struct intrhand clock_ih;
-extern struct intrhand statclock_ih;
-
-extern int statvar;
-extern int statmin;
-
-void dumb_delay(int);
-extern u_int dumb_delay_const;
-void m1x7_delay(int);
-void m1x7_init_clocks(void);
-
-extern time_t (*md_inittodr)(void);
-extern void (*md_resettodr)(void);
diff --git a/sys/arch/mvme88k/mvme88k/conf.c b/sys/arch/mvme88k/mvme88k/conf.c
deleted file mode 100644
index c20bfc92fc9..00000000000
--- a/sys/arch/mvme88k/mvme88k/conf.c
+++ /dev/null
@@ -1,295 +0,0 @@
-/* $OpenBSD: conf.c,v 1.48 2013/06/03 17:33:58 tedu Exp $ */
-
-/*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)conf.c 7.9 (Berkeley) 5/28/91
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#include <sys/vnode.h>
-
-#include <machine/conf.h>
-
-#include "bio.h"
-#include "pty.h"
-#include "bpfilter.h"
-#include "tun.h"
-#include "vnd.h"
-#include "rd.h"
-#include "cd.h"
-#include "ch.h"
-#include "sd.h"
-#include "st.h"
-#include "uk.h"
-
-#include "ksyms.h"
-
-#include "sram.h"
-#include "nvram.h"
-#include "vmel.h"
-#include "vmes.h"
-#include "dart.h"
-#include "cl.h"
-#include "vx.h"
-
-#ifdef notyet
-#include "xd.h"
-bdev_decl(xd);
-cdev_decl(xd);
-#endif /* notyet */
-
-#ifdef notyet
-#include "flash.h"
-cdev_decl(flash);
-#endif /* notyet */
-
-/* open, close, write, ioctl */
-#define cdev_lp_init(c,n) { \
- dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
- dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) enodev, \
- 0, seltrue, (dev_type_mmap((*))) enodev }
-
-/* open, close, ioctl, mmap, ioctl */
-#define cdev_mdev_init(c,n) { \
- dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
- dev_init(c,n,write), dev_init(c,n,ioctl), \
- (dev_type_stop((*))) enodev, 0, (dev_type_poll((*))) enodev, \
- dev_init(c,n,mmap) }
-
-#if notyet
-#include "lp.h"
-cdev_decl(lp);
-#include "lptwo.h"
-cdev_decl(lptwo);
-#endif /* notyet */
-
-#include "pf.h"
-
-#include "systrace.h"
-
-#include "vscsi.h"
-#include "pppx.h"
-#include "fuse.h"
-
-struct bdevsw bdevsw[] =
-{
- bdev_notdef(), /* 0 */
- bdev_notdef(), /* 1 */
- bdev_notdef(), /* 2 */
- bdev_swap_init(1,sw), /* 3: swap pseudo-device */
- bdev_disk_init(NSD,sd), /* 4: SCSI disk */
- bdev_tape_init(NST,st), /* 5: SCSI tape */
- bdev_disk_init(NCD,cd), /* 6: SCSI CD-ROM */
- bdev_disk_init(NRD,rd), /* 7: ramdisk */
- bdev_disk_init(NVND,vnd), /* 8: vnode disk driver */
- bdev_notdef(), /* 9: was: concatenated disk driver */
-#if notyet
- bdev_disk_init(NXD,xd), /* 10: XD disk */
-#else
- bdev_notdef(), /* 10 */
-#endif /* notyet */
- bdev_notdef(), /* 11 */
- bdev_notdef(), /* 12 */
- bdev_lkm_dummy(), /* 13 */
- bdev_lkm_dummy(), /* 14 */
- bdev_lkm_dummy(), /* 15 */
- bdev_lkm_dummy(), /* 16 */
- bdev_lkm_dummy(), /* 17 */
- bdev_lkm_dummy(), /* 18 */
-};
-int nblkdev = nitems(bdevsw);
-
-struct cdevsw cdevsw[] =
-{
- cdev_cn_init(1,cn), /* 0: virtual console */
- cdev_ctty_init(1,ctty), /* 1: controlling terminal */
- cdev_mm_init(1,mm), /* 2: /dev/{null,mem,kmem,...} */
- cdev_notdef(), /* 3 was /dev/drum */
- cdev_tty_init(NPTY,pts), /* 4: pseudo-tty slave */
- cdev_ptc_init(NPTY,ptc), /* 5: pseudo-tty master */
- cdev_log_init(1,log), /* 6: /dev/klog */
- cdev_mdev_init(NSRAM,sram), /* 7: /dev/sramX */
- cdev_disk_init(NSD,sd), /* 8: SCSI disk */
- cdev_disk_init(NCD,cd), /* 9: SCSI CD-ROM */
- cdev_mdev_init(NNVRAM,nvram), /* 10: /dev/nvramX */
-#ifdef notyet
- cdev_mdev_init(NFLASH,flash), /* 11: /dev/flashX */
-#else
- cdev_notdef(), /* 11: */
-#endif /* notyet */
- cdev_tty_init(NDART,dart), /* 12: MVME188 serial (tty[a-b]) */
- cdev_tty_init(NCL,cl), /* 13: CL-CD1400 serial (tty0[0-3]) */
- cdev_notdef(), /* 14 */
- cdev_tty_init(NVX,vx), /* 15: MVME332XT serial/lpt ttyv[0-7][a-i] */
- cdev_notdef(), /* 16 */
- cdev_notdef(), /* 17: was: concatenated disk */
- cdev_disk_init(NRD,rd), /* 18: ramdisk disk */
- cdev_disk_init(NVND,vnd), /* 19: vnode disk */
- cdev_tape_init(NST,st), /* 20: SCSI tape */
- cdev_fd_init(1,filedesc), /* 21: file descriptor pseudo-dev */
- cdev_bpf_init(NBPFILTER,bpf), /* 22: berkeley packet filter */
- cdev_tun_init(NTUN,tun), /* 23: network tunnel */
- cdev_lkm_init(NLKM,lkm), /* 24: loadable module driver */
- cdev_notdef(), /* 25 */
-#ifdef notyet
- cdev_disk_init(NXD,xd), /* 26: XD disk */
-#else
- cdev_notdef(), /* 26: XD disk */
-#endif /* notyet */
- cdev_notdef(), /* 27 */
-#ifdef notyet
- cdev_lp_init(NLP,lp), /* 28: lp */
- cdev_lp_init(NLPTWO,lptwo), /* 29: lptwo */
-#else
- cdev_notdef(), /* 28: lp */
- cdev_notdef(), /* 29: lptwo */
-#endif /* notyet */
- cdev_notdef(), /* 30 */
- cdev_mdev_init(NVMEL,vmel), /* 31: /dev/vmelX */
- cdev_mdev_init(NVMES,vmes), /* 32: /dev/vmesX */
- cdev_lkm_dummy(), /* 33 */
- cdev_lkm_dummy(), /* 34 */
- cdev_lkm_dummy(), /* 35 */
- cdev_lkm_dummy(), /* 36 */
- cdev_lkm_dummy(), /* 37 */
- cdev_lkm_dummy(), /* 38 */
- cdev_pf_init(NPF,pf), /* 39: packet filter */
- cdev_random_init(1,random), /* 40: random data source */
- cdev_uk_init(NUK,uk), /* 41 */
- cdev_notdef(), /* 42 */
- cdev_ksyms_init(NKSYMS,ksyms), /* 43: Kernel symbols device */
- cdev_ch_init(NCH,ch), /* 44: SCSI autochanger */
- cdev_fuse_init(NFUSE,fuse), /* 45: fuse */
- cdev_notdef(), /* 46 */
- cdev_notdef(), /* 47 */
- cdev_notdef(), /* 48 */
- cdev_bio_init(NBIO,bio), /* 49: ioctl tunnel */
- cdev_systrace_init(NSYSTRACE,systrace), /* 50 system call tracing */
- cdev_notdef(), /* 51 */
- cdev_ptm_init(NPTY,ptm), /* 52: pseudo-tty ptm device */
- cdev_vscsi_init(NVSCSI,vscsi), /* 53: vscsi */
- cdev_disk_init(1,diskmap), /* 54: disk mapper */
- cdev_pppx_init(NPPPX,pppx), /* 55: pppx */
-};
-int nchrdev = nitems(cdevsw);
-
-int mem_no = 2; /* major device number of memory special file */
-
-/*
- * Swapdev is a fake device implemented
- * in sw.c used only internally to get to swstrategy.
- * It cannot be provided to the users, because the
- * swstrategy routine munches the b_dev and b_blkno entries
- * before calling the appropriate driver. This would horribly
- * confuse, e.g. the hashing routines. Instead, /dev/drum is
- * provided as a character (raw) device.
- */
-dev_t swapdev = makedev(3, 0);
-
-/*
- * Returns true if dev is /dev/mem or /dev/kmem.
- */
-int
-iskmemdev(dev)
- dev_t dev;
-{
-
- return (major(dev) == mem_no && minor(dev) < 2);
-}
-
-/*
- * Returns true if dev is /dev/zero.
- */
-int
-iszerodev(dev)
- dev_t dev;
-{
-
- return (major(dev) == mem_no && minor(dev) == 12);
-}
-
-dev_t
-getnulldev()
-{
- return makedev(mem_no, 2);
-}
-
-int chrtoblktbl[] = {
- /* XXXX This needs to be dynamic for LKMs. */
- /*VCHR*/ /*VBLK*/
- /* 0 */ NODEV,
- /* 1 */ NODEV,
- /* 2 */ NODEV,
- /* 3 */ NODEV,
- /* 4 */ NODEV,
- /* 5 */ NODEV,
- /* 6 */ NODEV,
- /* 7 */ NODEV,
- /* 8 */ 4, /* sd */
- /* 9 */ 6, /* cd */
- /* 10 */ NODEV,
- /* 11 */ NODEV,
- /* 12 */ NODEV,
- /* 13 */ NODEV,
- /* 14 */ NODEV,
- /* 15 */ NODEV,
- /* 16 */ NODEV,
- /* 17 */ NODEV,
- /* 18 */ 7, /* rd */
- /* 19 */ 8, /* vnd */
- /* 20 */ 5, /* st */
- /* 21 */ NODEV,
- /* 22 */ NODEV,
- /* 23 */ NODEV,
- /* 24 */ NODEV,
- /* 25 */ NODEV,
- /* 26 */ 10, /* xd */
-};
-int nchrtoblktbl = nitems(chrtoblktbl);
-
-#include <dev/cons.h>
-
-#define clcnpollc nullcnpollc
-cons_decl(cl);
-#define dartcnpollc nullcnpollc
-cons_decl(dart);
-
-struct consdev constab[] = {
-#if NDART > 0
- cons_init(dart),
-#endif
-#if NCL > 0
- cons_init(cl),
-#endif
- { 0 },
-};
diff --git a/sys/arch/mvme88k/mvme88k/db_machdep.c b/sys/arch/mvme88k/mvme88k/db_machdep.c
deleted file mode 100644
index 44109a94373..00000000000
--- a/sys/arch/mvme88k/mvme88k/db_machdep.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* $OpenBSD: db_machdep.c,v 1.2 2006/05/08 14:36:10 miod Exp $ */
-/*
- * Mach Operating System
- * Copyright (c) 1993-1991 Carnegie Mellon University
- * Copyright (c) 1991 OMRON Corporation
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON AND OMRON ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON AND OMRON DISCLAIM ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-/*
- * mvme88k-specific interface to ddb debugger
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/proc.h>
-
-#include <machine/cpu.h>
-#include <machine/db_machdep.h> /* local ddb stuff */
-
-void
-m88k_db_prom_cmd(addr, have_addr, count, modif)
- db_expr_t addr;
- int have_addr;
- db_expr_t count;
- char *modif;
-{
- doboot();
-}
diff --git a/sys/arch/mvme88k/mvme88k/disksubr.c b/sys/arch/mvme88k/mvme88k/disksubr.c
deleted file mode 100644
index ccda86a9303..00000000000
--- a/sys/arch/mvme88k/mvme88k/disksubr.c
+++ /dev/null
@@ -1,254 +0,0 @@
-/* $OpenBSD: disksubr.c,v 1.69 2011/10/21 13:08:01 miod Exp $ */
-/*
- * Copyright (c) 1998 Steve Murphree, Jr.
- * Copyright (c) 1995 Dale Rahn.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/buf.h>
-#include <sys/disklabel.h>
-#include <sys/disk.h>
-
-void bsdtocpulabel(struct disklabel *, struct mvmedisklabel *);
-int cputobsdlabel(struct disklabel *, struct mvmedisklabel *);
-
-/*
- * Attempt to read a disk label from a device
- * using the indicated strategy routine.
- * The label must be partly set up before this:
- * secpercyl and anything required in the strategy routine
- * (e.g., sector size) must be filled in before calling us.
- */
-int
-readdisklabel(dev_t dev, void (*strat)(struct buf *),
- struct disklabel *lp, int spoofonly)
-{
- struct buf *bp = NULL;
- int error;
-
- if ((error = initdisklabel(lp)))
- goto done;
-
- /* get a buffer and initialize it */
- bp = geteblk((int)lp->d_secsize);
- bp->b_dev = dev;
-
- /* don't read the on-disk label if we are in spoofed-only mode */
- if (spoofonly)
- goto done;
-
- bp->b_blkno = LABELSECTOR;
- bp->b_bcount = lp->d_secsize;
- CLR(bp->b_flags, B_READ | B_WRITE | B_DONE);
- SET(bp->b_flags, B_BUSY | B_READ | B_RAW);
- (*strat)(bp);
- if (biowait(bp)) {
- error = bp->b_error;
- goto done;
- }
-
- error = cputobsdlabel(lp, (struct mvmedisklabel *)bp->b_data);
- if (error == 0)
- goto done;
-
-#if defined(CD9660)
- error = iso_disklabelspoof(dev, strat, lp);
- if (error == 0)
- goto done;
-#endif
-#if defined(UDF)
- error = udf_disklabelspoof(dev, strat, lp);
- if (error == 0)
- goto done;
-#endif
-
-done:
- if (bp) {
- bp->b_flags |= B_INVAL;
- brelse(bp);
- }
- disk_change = 1;
- return (error);
-}
-
-/*
- * Write disk label back to device after modification.
- */
-int
-writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp)
-{
- struct buf *bp = NULL;
- int error;
-
- /* get a buffer and initialize it */
- bp = geteblk((int)lp->d_secsize);
- bp->b_dev = dev;
-
- /* Read it in, slap the new label in, and write it back out */
- bp->b_blkno = LABELSECTOR;
- bp->b_bcount = lp->d_secsize;
- CLR(bp->b_flags, B_READ | B_WRITE | B_DONE);
- SET(bp->b_flags, B_BUSY | B_READ | B_RAW);
- (*strat)(bp);
- if ((error = biowait(bp)) != 0)
- goto done;
-
- bsdtocpulabel(lp, (struct mvmedisklabel *)bp->b_data);
-
- CLR(bp->b_flags, B_READ | B_WRITE | B_DONE);
- SET(bp->b_flags, B_BUSY | B_WRITE | B_RAW);
- (*strat)(bp);
- error = biowait(bp);
-
-done:
- if (bp) {
- bp->b_flags |= B_INVAL;
- brelse(bp);
- }
- disk_change = 1;
- return (error);
-}
-
-void
-bsdtocpulabel(struct disklabel *lp, struct mvmedisklabel *clp)
-{
- char *tmot = "MOTOROLA", *id = "M88K", *mot;
- int i;
- u_short osa_u, osa_l, osl;
- u_int oss;
-
- /* preserve existing VID boot code information */
- osa_u = clp->vid_osa_u;
- osa_l = clp->vid_osa_l;
- osl = clp->vid_osl;
- oss = clp->vid_oss;
- bzero(clp, sizeof(*clp));
- clp->vid_osa_u = osa_u;
- clp->vid_osa_l = osa_l;
- clp->vid_osl = osl;
- clp->vid_oss = oss;
- clp->vid_cas = clp->vid_cal = 1;
-
- clp->magic1 = lp->d_magic;
- clp->type = lp->d_type;
- clp->subtype = lp->d_subtype;
- strncpy(clp->vid_vd, lp->d_typename, 16);
- strncpy(clp->packname, lp->d_packname, 16);
- clp->cfg_psm = lp->d_secsize;
- clp->cfg_spt = lp->d_nsectors;
- clp->cfg_trk = lp->d_ncylinders; /* trk is really num of cyl! */
- clp->cfg_hds = lp->d_ntracks;
-
- clp->secpercyl = lp->d_secpercyl;
- clp->secperunit = DL_GETDSIZE(lp);
- clp->acylinders = lp->d_acylinders;
-
- clp->cfg_ilv = 1;
- clp->cfg_sof = 1;
- clp->cylskew = 1;
- clp->headswitch = 0;
- clp->cfg_ssr = 0;
- clp->flags = lp->d_flags;
- for (i = 0; i < NDDATA; i++)
- clp->drivedata[i] = lp->d_drivedata[i];
- for (i = 0; i < NSPARE; i++)
- clp->spare[i] = lp->d_spare[i];
-
- clp->magic2 = lp->d_magic2;
- clp->checksum = lp->d_checksum;
- clp->partitions = lp->d_npartitions;
- clp->bbsize = lp->d_bbsize;
- clp->sbsize = lp->d_sbsize;
- clp->checksum = lp->d_checksum;
- bcopy(&lp->d_partitions[0], clp->vid_4, sizeof(struct partition) * 4);
- bcopy(&lp->d_partitions[4], clp->cfg_4, sizeof(struct partition) * 12);
- clp->version = 2;
- bcopy(&lp->d_uid, clp->vid_4_1, sizeof(lp->d_uid));
-
- /* Put "MOTOROLA" in the VID. This makes it a valid boot disk. */
- for (mot = clp->vid_mot, i = 0; i < 8; i++)
- *mot++ = *tmot++;
-
- /* put volume id in the VID */
- for (mot = clp->vid_id, i = 0; i < 4; i++)
- *mot++ = *id++;
-}
-
-int
-cputobsdlabel(struct disklabel *lp, struct mvmedisklabel *clp)
-{
- int i;
-
- if (clp->magic1 != DISKMAGIC || clp->magic2 != DISKMAGIC)
- return (EINVAL); /* no disk label */
-
- lp->d_magic = clp->magic1;
- lp->d_type = clp->type;
- lp->d_subtype = clp->subtype;
- strncpy(lp->d_typename, clp->vid_vd, sizeof lp->d_typename);
- strncpy(lp->d_packname, clp->packname, sizeof lp->d_packname);
- lp->d_secsize = clp->cfg_psm;
- lp->d_nsectors = clp->cfg_spt;
- lp->d_ncylinders = clp->cfg_trk; /* trk is really num of cyl! */
- lp->d_ntracks = clp->cfg_hds;
-
- lp->d_secpercyl = clp->secpercyl;
- if (DL_GETDSIZE(lp) == 0)
- DL_SETDSIZE(lp, clp->secperunit);
- lp->d_acylinders = clp->acylinders;
- lp->d_flags = clp->flags;
- for (i = 0; i < NDDATA; i++)
- lp->d_drivedata[i] = clp->drivedata[i];
- for (i = 0; i < NSPARE; i++)
- lp->d_spare[i] = clp->spare[i];
-
- lp->d_magic2 = clp->magic2;
- lp->d_npartitions = clp->partitions;
- lp->d_bbsize = clp->bbsize;
- lp->d_sbsize = clp->sbsize;
-
- bcopy(clp->vid_4, &lp->d_partitions[0], sizeof(struct partition) * 4);
- bcopy(clp->cfg_4, &lp->d_partitions[4], sizeof(struct partition) * 12);
- bcopy(clp->vid_4_1, &lp->d_uid, sizeof(lp->d_uid));
-
- if (clp->version < 2) {
- struct __partitionv0 *v0pp = (struct __partitionv0 *)lp->d_partitions;
- struct partition *pp = lp->d_partitions;
-
- for (i = 0; i < lp->d_npartitions; i++, pp++, v0pp++) {
- pp->p_fragblock = DISKLABELV1_FFS_FRAGBLOCK(v0pp->
- p_fsize, v0pp->p_frag);
- pp->p_offseth = 0;
- pp->p_sizeh = 0;
- }
- }
-
- lp->d_version = 1;
- lp->d_checksum = 0;
- lp->d_checksum = dkcksum(lp);
- return (0);
-}
diff --git a/sys/arch/mvme88k/mvme88k/eh.S b/sys/arch/mvme88k/mvme88k/eh.S
deleted file mode 100644
index a67f651b1c6..00000000000
--- a/sys/arch/mvme88k/mvme88k/eh.S
+++ /dev/null
@@ -1,172 +0,0 @@
-/* $OpenBSD: eh.S,v 1.70 2013/05/17 22:51:59 miod Exp $ */
-/*
- * Copyright (c) 2006, Miodrag Vallat
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <machine/m8820x.h>
-
-/*
- * Save Pbus fault status register from data and inst CMMU.
- *
- * Handlers are invoked with TMP, TMP2 and TMP3 available, and TMP contains
- * curcpu().
- */
-
-#define PFSR_SAVE \
- NOP; /* will be changed to br.n pfsr_handler + 4*/ \
- NOP /* will be changed to first instruction of pfsr_handler */
-
-#include <m88k/m88k/eh_common.S>
-
-#if defined(MVME181) || defined(MVME187)
-/*
- * Single-processor with 2 CMMU version (MVME181, MVME187, MVME8120)
- */
-
-ENTRY(pfsr_save_single)
- ld TMP2, TMP, CI_PFSR_I0
- ld TMP3, TMP2, %r0
- st TMP3, %r31, EF_IPFSR
- ld TMP2, TMP, CI_PFSR_D0
- ld TMP3, TMP2, %r0
- br.n _ASM_LABEL(pfsr_done)
- st TMP3, %r31, EF_DPFSR
-#endif
-
-#ifdef MVME188
-/*
- * MVME188 versions
- */
-
-#include <machine/mvme188.h>
-
-ENTRY(pfsr_save_188_quad)
- /*
- * We're in configuration 2 (1 CPU, 8 CMMU).
- *
- * Reading the MVME188 error register could tell us which
- * CMMU faulted, but it's easier to check every one until
- * we find the first fault.
- *
- * If two or more CMMU faulted simultaneously, restarting from
- * the trap will fault again, and we'll handle the remaining
- * exceptions here.
- *
- * However, to be sure we don't get fooled with already-processed
- * exceptions, we have to reset the fault status registers
- * after reading them.
- *
- * XXX It will probably be worth changing this so that we can
- * handle a bunch of CMMU faults at once in trap.c.
- */
- or.u TMP, %r0, %hi16(VME_CMMU_I0)
- ld TMP2, TMP, %lo16(VME_CMMU_I0) + CMMU_PFSR * 4
- extu TMP3, TMP2, 3<16>
- bcnd.n ne0, TMP3, 1f
- st %r0, TMP, %lo16(VME_CMMU_I0) + CMMU_PFSR * 4
- or.u TMP, %r0, %hi16(VME_CMMU_I1)
- ld TMP2, TMP, %lo16(VME_CMMU_I1) + CMMU_PFSR * 4
- extu TMP3, TMP2, 3<16>
- bcnd.n ne0, TMP3, 1f
- st %r0, TMP, %lo16(VME_CMMU_I1) + CMMU_PFSR * 4
- or.u TMP, %r0, %hi16(VME_CMMU_I2)
- ld TMP2, TMP, %lo16(VME_CMMU_I2) + CMMU_PFSR * 4
- extu TMP3, TMP2, 3<16>
- bcnd.n ne0, TMP3, 1f
- st %r0, TMP, %lo16(VME_CMMU_I2) + CMMU_PFSR * 4
- or.u TMP, %r0, %hi16(VME_CMMU_I3)
- ld TMP2, TMP, %lo16(VME_CMMU_I3) + CMMU_PFSR * 4
- st %r0, TMP, %lo16(VME_CMMU_I3) + CMMU_PFSR * 4
-1:
- st TMP2, %r31, EF_IPFSR
-
- or.u TMP, %r0, %hi16(VME_CMMU_D0)
- ld TMP2, TMP, %lo16(VME_CMMU_D0) + CMMU_PFSR * 4
- extu TMP3, TMP2, 3<16>
- bcnd.n ne0, TMP3, 2f
- st %r0, TMP, %lo16(VME_CMMU_D0) + CMMU_PFSR * 4
- or.u TMP, %r0, %hi16(VME_CMMU_D1)
- ld TMP2, TMP, %lo16(VME_CMMU_D1) + CMMU_PFSR * 4
- extu TMP3, TMP2, 3<16>
- bcnd.n ne0, TMP3, 2f
- st %r0, TMP, %lo16(VME_CMMU_D1) + CMMU_PFSR * 4
- or.u TMP, %r0, %hi16(VME_CMMU_D2)
- ld TMP2, TMP, %lo16(VME_CMMU_D2) + CMMU_PFSR * 4
- extu TMP3, TMP2, 3<16>
- bcnd.n ne0, TMP3, 2f
- st %r0, TMP, %lo16(VME_CMMU_D2) + CMMU_PFSR * 4
- or.u TMP, %r0, %hi16(VME_CMMU_D3)
- ld TMP2, TMP, %lo16(VME_CMMU_D3) + CMMU_PFSR * 4
- st %r0, TMP, %lo16(VME_CMMU_D3) + CMMU_PFSR * 4
-2:
- br.n _ASM_LABEL(pfsr_done)
- st TMP2, %r31, EF_DPFSR
-
-ENTRY(pfsr_save_188_double)
- /*
- * 4 CMMUs per CPU. Almost as simple as the 2 CMMUs per CPU
- * situation...
- *
- * However, to be sure we don't get fooled with already-processed
- * exceptions, we have to reset the fault status registers
- * after reading them.
- */
- ld TMP2, TMP, CI_PFSR_I0
- ld TMP3, TMP2, %r0
- extu TMP3, TMP3, 3<16>
- bcnd ne0, TMP3, 1f
- st %r0, TMP2, %r0
- ld TMP2, TMP, CI_PFSR_I1
-1:
- ld TMP3, TMP2, %r0
- st %r0, TMP2, %r0
- st TMP3, %r31, EF_IPFSR
-
- ld TMP2, TMP, CI_PFSR_D0
- ld TMP3, TMP2, %r0
- extu TMP3, TMP3, 3<16>
- bcnd ne0, TMP3, 2f
- st %r0, TMP2, %r0
- ld TMP2, TMP, CI_PFSR_D1
-2:
- ld TMP3, TMP2, %r0
- st %r0, TMP2, %r0
- br.n _ASM_LABEL(pfsr_done)
- st TMP3, %r31, EF_DPFSR
-
-ENTRY(pfsr_save_188_straight)
- /*
- * We have the simple 2 CMMUs per CPU mapping. Pick our couple;
- * no need to reset fault status registers in this case.
- * This is similar to the 187/8120 code.
- */
- ld TMP2, TMP, CI_PFSR_I0
- ld TMP3, TMP2, %r0
- st TMP3, %r31, EF_IPFSR
- ld TMP2, TMP, CI_PFSR_D0
- ld TMP3, TMP2, %r0
- br.n _ASM_LABEL(pfsr_done)
- st TMP3, %r31, EF_DPFSR
-
-#endif /* MVME188 */
diff --git a/sys/arch/mvme88k/mvme88k/genassym.cf b/sys/arch/mvme88k/mvme88k/genassym.cf
deleted file mode 100644
index 730cf74b2db..00000000000
--- a/sys/arch/mvme88k/mvme88k/genassym.cf
+++ /dev/null
@@ -1 +0,0 @@
-# $OpenBSD: genassym.cf,v 1.12 2010/04/26 22:11:38 deraadt Exp $
diff --git a/sys/arch/mvme88k/mvme88k/locore.S b/sys/arch/mvme88k/mvme88k/locore.S
deleted file mode 100644
index 0cb41b1b059..00000000000
--- a/sys/arch/mvme88k/mvme88k/locore.S
+++ /dev/null
@@ -1,330 +0,0 @@
-/* $OpenBSD: locore.S,v 1.72 2013/05/17 22:46:28 miod Exp $ */
-/*
- * Copyright (c) 2005, Miodrag Vallat.
- * Copyright (c) 1998 Steve Murphree, Jr.
- * Copyright (c) 1996 Nivas Madhur
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Nivas Madhur.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-/*
- * Mach Operating System
- * Copyright (c) 1993-1991 Carnegie Mellon University
- * Copyright (c) 1991 OMRON Corporation
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON AND OMRON ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON AND OMRON DISCLAIM ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include "assym.h"
-#include "ksyms.h"
-
-#include <machine/asm.h>
-#include <machine/m88100.h>
-#include <machine/param.h>
-#include <machine/psl.h>
-#include <machine/trap.h>
-#include <machine/vmparam.h>
-
-/*
- * The memory looks like:
- * 0x00000 - 0x01000 trap vectors
- * 0x01000 - 0x10000 first 64k used by BUG
- * 0x10000 == start Boot loader jumps here. (for now, this can
- * handle only NMAGIC - screwy linker)
- */
- .text
-
-GLOBAL(kernelstart)
-GLOBAL(kernel_text)
-ASGLOBAL(__start)
- /*
- * A few identical jump instructions to make sure the pipeline is
- * in a good state. Probably overkill, but it's cheap.
- */
- br _ASM_LABEL(main_start)
- br _ASM_LABEL(main_start)
- br _ASM_LABEL(main_start)
- br _ASM_LABEL(main_start)
-
- /*
- * Room for the kernel (post-autoconf) VBR page.
- * Note this page is in kernel text, in order to be write-protected
- * by pmap_bootstrap().
- */
-#ifdef __ELF__
- .space PAGE_SIZE - 4 * 4
-#else
- .space PAGE_SIZE - 4 * 4 - 0x20
-#endif
-
-#ifdef M88100
- /*
- * The 88100 may execute the first instruction of the next trap
- * handler, as documented in its Errata. Processing trap #511
- * would then fall into the next page, unless the address computation
- * wraps, or software traps are exempt from the issue - the Errata
- * does not provide more detail.
- * Although the MVME BUG does not add an extra NOP after its VBR page,
- * it is cheap to add an extra NOP for safety.
- */
- NOP
-#endif
-
- /*
- * Startup code for main processor.
- */
-ASLOCAL(main_start)
- /*
- * Save the arguments passed by the boot loader
- * r2 boot flags
- * r3 boot controller physical address
- * r4 esym (if applicable)
- * r5 start of miniroot (unused)
- * r6 end of miniroot (unused)
- * r7 ((Clun << 8) | Dlun): encoded bootdev
- * r8 board type (0x187, 0x188, 0x197)
- */
-/*
- * (*entry)(flag, bugargs.ctrl_addr, cp, kernel.smini,kernel.emini,
- * bootdev, brdtyp);
- */
- or.u %r13, %r0, %hi16(_C_LABEL(boothowto))
- st %r2, %r13, %lo16(_C_LABEL(boothowto))
- or.u %r13, %r0, %hi16(_C_LABEL(bootaddr))
- st %r3, %r13, %lo16(_C_LABEL(bootaddr))
- or.u %r13, %r0, %hi16(_C_LABEL(first_addr))
- st %r4, %r13, %lo16(_C_LABEL(first_addr))
-#if defined(DDB) || NKSYMS > 0
- or.u %r13, %r0, %hi16(_C_LABEL(esym))
- st %r4, %r13, %lo16(_C_LABEL(esym))
-#endif
- or.u %r13, %r0, %hi16(_C_LABEL(bootdev))
- st %r7, %r13, %lo16(_C_LABEL(bootdev))
- or.u %r13, %r0, %hi16(_C_LABEL(brdtyp))
- st %r8, %r13, %lo16(_C_LABEL(brdtyp))
-
- /* set cputyp */
- ldcr %r1, PID
- extu %r8, %r1, 8<8>
- or.u %r13, %r0, %hi16(_C_LABEL(cputyp))
-
- bsr.n _ASM_LABEL(setup_psr)
- st %r8, %r13, %lo16(_C_LABEL(cputyp))
-
-#ifdef MULTIPROCESSOR
- /*
- * Have curcpu() point at the dummy cpuinfo structure,
- * and initialize cr17.
- * This is necessary for early spl*() usage, as well as
- * mutex diagnostic code.
- */
- or.u %r11, %r0, %hi16(_C_LABEL(dummy_cpu))
- or %r11, %r11, %lo16(_C_LABEL(dummy_cpu))
- stcr %r11, CPU
-
- /*
- * MVME BUG idles all secondary MPUs upon startup, so at this point
- * we do not have to compete with them.
- */
-#endif /* MULTIPROCESSOR */
-
- /* Switch to startup stack */
- or.u %r31, %r0, %hi16(_ASM_LABEL(initstack_end))
- or %r31, %r31, %lo16(_ASM_LABEL(initstack_end))
-
- /* ...and to our exception vectors */
-#ifdef M88110
-#ifdef M88100
- cmp %r2, %r8, CPU_88110
- bb1 ne, %r2, 1f /* if it's a 'mc88110, use different vectors */
-#endif
- or.u %r3, %r0, %hi16(_C_LABEL(m88110_vector_list))
- br.n 2f
- or %r3, %r3, %lo16(_C_LABEL(m88110_vector_list))
-1:
-#endif /* M88110 */
-#ifdef M88100
- or.u %r3, %r0, %hi16(_C_LABEL(vector_list))
- or %r3, %r3, %lo16(_C_LABEL(vector_list))
-#endif /* M88100 */
-2:
- bsr.n _C_LABEL(mvme88k_vector_init)
- ldcr %r2, VBR
-
-#ifdef MULTIPROCESSOR
- bsr _C_LABEL(atomic_init)
-#endif
-
- /*
- * mvme_bootstrap(), among other things, clears proc0's u area.
- * We are still using the interrupt stack here, thus we are not
- * affected...
- */
- bsr _C_LABEL(mvme_bootstrap)
-
- /*
- * ...and we can switch to the u area stack now.
- */
- ldcr %r10, CPU
- ld %r2, %r10, CI_CURPCB
-
- /* call main() - no arguments although main() still defines one */
- bsr.n _C_LABEL(main)
- addu %r31, %r2, USPACE
-
-#ifdef MULTIPROCESSOR
-
- /*
- * Startup code for secondary processors.
- * Some of these initializations are very close to main_start; refer
- * to the comments there for details.
- */
-GLOBAL(secondary_start)
- or.u %r31, %r0, %hi16(_ASM_LABEL(slavestack_end))
- bsr.n _ASM_LABEL(setup_psr)
- or %r31, %r31, %lo16(_ASM_LABEL(slavestack_end))
-
- or.u %r3, %r0, %hi16(_C_LABEL(kernel_vbr))
- ld %r2, %r3, %lo16(_C_LABEL(kernel_vbr))
- stcr %r2, VBR
- FLUSH_PIPELINE
-
- /*
- * Have curcpu() point at the dummy cpuinfo structure,
- * and initialize cr17.
- * This is necessary for early spl*() usage, as well as
- * mutex diagnostic code.
- */
- or.u %r11, %r0, %hi16(_C_LABEL(dummy_cpu))
- or %r11, %r11, %lo16(_C_LABEL(dummy_cpu))
- st %r0, %r11, CI_FLAGS /* reset CIF_PRIMARY */
- stcr %r11, CPU
-
- /*
- * While holding the cpu_mutex, the secondary cpu can use the slavestack
- * to call secondary_pre_main() to determine its cpu number.
- * After that, however, it should allocate its own stack and switch
- * to it.
- */
-
- bsr _C_LABEL(secondary_pre_main) /* set cpu number */
-
- ldcr %r1, CPU
- st %r2, %r1, CI_CURPCB /* save stack as curpcb for traps */
-
- bsr.n _C_LABEL(secondary_main)
- addu %r31, %r2, USPACE /* switch to startup stack */
-
-#endif /* MULTIPROCESSOR */
-
-/*
- * Reset code trampoline.
- */
-GLOBAL(doboot)
- /*
- * Switch to interrupt stack and call _doboot to take care of
- * going to BUG. Need to do this since _doboot turns off the
- * the MMU and we need to be on a 1-to-1 mapped stack so that
- * further calls don't get data access exceptions.
- */
- or.u %r31, %r0, %hi16(_ASM_LABEL(initstack_end))
- bsr.n _C_LABEL(_doboot)
- or %r31, %r31, %lo16(_ASM_LABEL(initstack_end))
- /*NOTREACHED*/
-
-/*
- * void dumb_delay(int us)
- *
- * The processor loops (busy waits) for the given number of microseconds:
- * Thus, delay(1000000) will delay for one second.
- * (originally from Mach 2.5)
- */
-GLOBAL(dumb_delay)
- bcnd eq0, %r2, 2f
- or.u %r3, %r0, %hi16(_C_LABEL(dumb_delay_const))
- ld %r3, %r3, %lo16(_C_LABEL(dumb_delay_const))
- mul %r4, %r2, %r3
- subu %r4, %r4, 4 /* overhead of these instructions */
-
- /* now loop for the given number of cycles */
-1:
- bcnd.n gt0, %r4, 1b
- subu %r4, %r4, 2 /* two cycles per iteration */
-2:
- jmp %r1
-
-/*****************************************************************************/
-
- .data
- .balign PAGE_SIZE
-GLOBAL(kernel_sdt) /* SDT (segment descriptor table */
- .space 0x2000 /* 8K - 4K phys, 4K virt*/
-
- .balign PAGE_SIZE
-ASGLOBAL(initstack)
- .space USPACE
-ASGLOBAL(initstack_end)
-
-#ifdef MULTIPROCESSOR
- .space PAGE_SIZE /* 4K, small, interim stack */
-ASLOCAL(slavestack_end)
-#endif
-
-/*
- * Process 0's u.
- * Should be page aligned.
- */
- .balign PAGE_SIZE
-ASLOCAL(u0)
- .space USPACE
-
-GLOBAL(proc0paddr)
- .word _ASM_LABEL(u0) /* KVA of proc0 uarea */
-
-#if defined(DDB) || NKSYMS > 0
-GLOBAL(esym)
- .word 0
-#endif /* DDB || NKSYMS > 0 */
diff --git a/sys/arch/mvme88k/mvme88k/m181_machdep.c b/sys/arch/mvme88k/mvme88k/m181_machdep.c
deleted file mode 100644
index a37bcabec15..00000000000
--- a/sys/arch/mvme88k/mvme88k/m181_machdep.c
+++ /dev/null
@@ -1,756 +0,0 @@
-/* $OpenBSD: m181_machdep.c,v 1.3 2013/06/11 21:06:31 miod Exp $ */
-
-/*
- * Copyright (c) 2013 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * MVME180 ``AngelFire'' and MVME181 ``AngelFire-2'' support routines.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/timetc.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/asm_macro.h>
-#include <machine/board.h>
-#include <machine/mmu.h>
-#include <machine/cmmu.h>
-#include <machine/cpu.h>
-#include <machine/pmap_table.h>
-#include <machine/trap.h>
-
-#include <machine/m88100.h>
-#include <machine/m8820x.h>
-#include <machine/mvme181.h>
-
-#include <mvme88k/mvme88k/clockvar.h>
-#include <dev/ic/mc68681reg.h>
-
-const struct pmap_table m181_pmap_table[] = {
- { M181_SSR, PAGE_SIZE, UVM_PROT_RW, CACHE_INH },
- { M181_SCR, PAGE_SIZE, UVM_PROT_RW, CACHE_INH },
- { M181_CPEI, PAGE_SIZE, UVM_PROT_RW, CACHE_INH },
- { M181_DUART, PAGE_SIZE, UVM_PROT_RW, CACHE_INH },
- { M181_VMEVEC, PAGE_SIZE, UVM_PROT_RW, CACHE_INH },
- { M181_CLRABRT, PAGE_SIZE, UVM_PROT_RW, CACHE_INH },
- { 0, 0xffffffff, 0, 0 },
-};
-
-const struct board board_mvme181 = {
- .bootstrap = m181_bootstrap,
- .memsize = m181_memsize,
- .cpuspeed = m181_cpuspeed,
- .reboot = m181_reboot,
- .is_syscon = m181_is_syscon,
- .intr = m181_intr,
- .nmi = NULL,
- .nmi_wrapup = NULL,
- .getipl = m181_getipl,
- .setipl = m181_setipl,
- .raiseipl = m181_raiseipl,
- .intsrc_available = m181_intsrc_available,
- .intsrc_enable = m181_intsrc_enable,
- .intsrc_disable = m181_intsrc_disable,
- .intsrc_establish = m181_intsrc_establish,
- .intsrc_disestablish = m181_intsrc_disestablish,
- .init_clocks = m181_init_clocks,
- .delay = dumb_delay,
- .init_vme = m181_init_vme,
-#ifdef MULTIPROCESSOR
- .send_ipi = NULL,
- .smp_setup = m88100_smp_setup,
-#endif
- .ptable = m181_pmap_table,
- .cmmu = &cmmu8820x
-};
-
-u_int m181_safe_level(u_int, u_int);
-
-u_int m181_curspl = IPL_HIGH;
-
-/*
- * The AngelFire interrupt controller has up to 16 interrupt sources.
- * We fold this model in the 8-level spl model this port uses, enforcing
- * priorities manually with the interrupt masks.
- */
-
-intrhand_t angelfire_intr_handlers[INTSRC_VME];
-
-u_int32_t m181_int_mask, m181_int_sticky;
-
-/*
- * Early initialization.
- */
-void
-m181_bootstrap()
-{
- int i;
-
- /*
- * Initialize interrupt controller masks.
- */
-
- m181_int_mask = M181_IRQ_DUART | M181_IRQ_ABORT;
- if (brdtyp == BRD_180)
- m181_int_mask |= M181_IRQ_VME4_180;
- else
- m181_int_mask |= M181_IRQ_PARITY | M181_IRQ_VME1 |
- M181_IRQ_VME2 | M181_IRQ_VME3 | M181_IRQ_VME4 |
- M181_IRQ_VME5 | M181_IRQ_VME6 | M181_IRQ_VME7;
-
- m181_int_sticky = *(volatile uint32_t *)M181_SSR &
- (M181_SYSCON | M181_BOARDMODE);
-
- *(u_int32_t *)M181_SCR = m181_int_sticky;
-
- for (i = 0; i < INTSRC_VME; i++)
- SLIST_INIT(&angelfire_intr_handlers[i]);
-}
-
-/*
- * Figure out how much memory is available.
- *
- * AngelFire boards always have 8MB onboard; MVME224 and/or MVME236 boards
- * may be used. SVR3/m88k officially only supports up to two MVME224 boards
- * and up to four MVME236 boards, which would allow for up to 2x8 + 4x16MB
- * extra memory.
- *
- * However, Motorola eventually produced 16MB and 32MB MVME224A boards, and
- * the MVME224 documentation says up to five MVME224 boards may be present
- * in the same chassis, when using them in VSB configuration (which hints
- * that more than five may be possible, in VME configuration).
- *
- * The real limiting factor, is the location of the CSR register in VME
- * A16 (short I/O) space. MVME224 boards use a fixed assignment, depending
- * upon their base address in VME address space; while MVME236 gives full
- * control of the 14 higher bits.
- *
- * Add to this, that the on-board memory may be configured to answer to a
- * different base address than zero, and you have a nightmare, with no
- * chance to be able to figure out which memory boards are available by
- * looking for their CSR registers.
- *
- * Better fall back to the good old `try and find memory until we fault or
- * whatever we hit does not have memory properties' logic. If one ever sets
- * up a noncontiguous memory layout, only the lower part will be found.
- */
-vaddr_t
-m181_memsize()
-{
-#define M181_ONBOARD_SIZE (8 * 1024 * 1024)
-#define M181_MEMORY_LIMIT (128 * 1024 * 1024) /* got more? call me */
-#define M181_SAFE_STRIDE (64 * 1024) /* conservative... 1MB could work */
-#define M181_MEMORY_PATTERN 0x55aac33c
- paddr_t pa;
- uint32_t r1, r2;
-
- for (pa = M181_ONBOARD_SIZE; pa <= M181_MEMORY_LIMIT;
- pa += M181_SAFE_STRIDE) {
- /* memory ought to be accessible at any size */
- if (badaddr(pa, 8) != 0 || badaddr(pa, 4) != 0 ||
- badaddr(pa, 2) != 0 || badaddr(pa, 1) != 0)
- break;
-
- /* what gets written to memory ought to be read back */
- r1 = *(volatile uint32_t *)pa;
- *(volatile uint32_t *)pa = M181_MEMORY_PATTERN;
- r2 = *(volatile uint32_t *)pa;
- if (r2 != M181_MEMORY_PATTERN)
- break;
-
- /* and all bits should be writeable as either 1 or 0 */
- *(volatile uint32_t *)pa = ~M181_MEMORY_PATTERN;
- r2 = *(volatile uint32_t *)pa;
- if (r2 != ~M181_MEMORY_PATTERN)
- break;
-
- *(volatile uint32_t *)pa = r1;
- r2 = *(volatile uint32_t *)pa;
- if (r2 != r1)
- break;
- }
- return pa;
-}
-
-/*
- * Reboot the system.
- * AngelFire boards can't reboot themselves (even the BUG won't).
- */
-void
-m181_reboot(int howto)
-{
- printf("Reboot not available on MVME%x. "
- "Please manually reset the board.\n", brdtyp);
-}
-
-/*
- * Return whether we are the VME bus system controller.
- */
-int
-m181_is_syscon()
-{
- return ISSET(*(volatile uint32_t *)M181_SSR, M181_SYSCON);
-}
-
-/*
- * Return the next ipl >= ``curlevel'' at which we can reenable interrupts
- * while keeping ``mask'' masked.
- */
-u_int
-m181_safe_level(u_int mask, u_int curlevel)
-{
- int i;
-
- for (i = curlevel; i < NIPLS; i++)
- if ((int_mask_val[i] & mask) == 0)
- return i;
-
- return NIPLS - 1;
-}
-
-/*
- * Provide the interrupt source for a given interrupt status bit.
- */
-const u_int m181_vec[16] = {
- 0,
- 0,
- 0,
- 0,
- INTSRC_VME, /* MVME180 VME4 */
- INTSRC_PARERR,
- INTSRC_DUART,
- INTSRC_ABORT,
- 0,
- INTSRC_VME, /* VME1 */
- INTSRC_VME, /* VME2 */
- INTSRC_VME, /* VME3 */
- INTSRC_VME, /* VME4 */
- INTSRC_VME, /* VME5 */
- INTSRC_VME, /* VME6 */
- INTSRC_VME /* VME7 */
-};
-
-/*
- * Device interrupt handler for MVME181
- */
-void
-m181_intr(struct trapframe *eframe)
-{
- u_int32_t cur_mask, ign_mask;
- u_int level, vmelevel, old_spl;
- struct intrhand *intr;
- intrhand_t *list;
- int ret, intbit;
- vaddr_t ivec;
- u_int intsrc, vec;
- int unmasked = 0;
- int warn;
-#ifdef DIAGNOSTIC
- static int problems = 0;
-#endif
-
- cur_mask = *(volatile u_int32_t *)M181_SSR & m181_int_mask;
- ign_mask = 0;
- old_spl = eframe->tf_mask;
-
- if (cur_mask == 0) {
- /*
- * Spurious interrupts - may be caused by debug output clearing
- * DUART interrupts.
- */
- flush_pipeline();
- goto out;
- }
-
-#ifdef MULTIPROCESSOR
- if (old_spl < IPL_SCHED)
- __mp_lock(&kernel_lock);
-#endif
-
- uvmexp.intrs++;
-
- for (;;) {
- level = m181_safe_level(cur_mask, old_spl);
- m181_setipl(level);
-
- if (unmasked == 0) {
- set_psr(get_psr() & ~PSR_IND);
- unmasked = 1;
- }
-
- /* find the first bit set in the current mask */
- warn = 0;
- intbit = ff1(cur_mask);
- intsrc = m181_vec[intbit];
-
- if (intsrc == 0)
- panic("%s: unexpected interrupt source (bit %d), "
- "level %d, mask 0x%04x",
- __func__, intbit, level, cur_mask);
-
- if (intsrc == INTSRC_VME) {
- if (intbit < 8)
- vmelevel = 4; /* MVME180, level 4 */
- else
- vmelevel = intbit & 7;
- ivec = M181_VMEVEC + (vmelevel << 1);
- vec = *(volatile uint16_t *)ivec;
- if (vec & 0xff00) {
- /*
- * Vector number is wrong. This is likely
- * a bus error or timeout reading the VME
- * interrupt vector. In either case, we
- * can't service the interrupt correctly.
- *
- * As a cheap bandaid, if only one VME
- * interrupt is registered with this IPL,
- * we can reasonably safely assume that
- * this is our vector. (this probably loses
- * bigtime on the 180)
- */
- vec = vmevec_hints[vmelevel];
- if (vec == (u_int)-1) {
- printf("%s: invalid VME "
- "interrupt vector %04x, "
- "level %d, mask %04x\n",
- __func__, ivec, vmelevel, cur_mask);
- ign_mask |= 1 << intbit;
- continue;
- }
- }
- list = &intr_handlers[vec];
- } else {
- list = &angelfire_intr_handlers[intsrc];
- }
-
- if (SLIST_EMPTY(list)) {
- warn = 1;
- } else {
- /*
- * Walk through all interrupt handlers in the chain
- * for the given vector, calling each handler in
- * turn, until some handler returns a nonzero value.
- */
- ret = 0;
- SLIST_FOREACH(intr, list, ih_link) {
- if (intr->ih_wantframe != 0)
- ret = (*intr->ih_fn)((void *)eframe);
- else
- ret = (*intr->ih_fn)(intr->ih_arg);
- if (ret > 0) {
- intr->ih_count.ec_count++;
- break;
- }
- }
- if (ret == 0)
- warn = 2;
- }
-
- if (warn != 0) {
- ign_mask |= 1 << intbit;
-
- if (intsrc == INTSRC_VME)
- printf("%s: %s VME interrupt, "
- "level %d, vec 0x%x, mask %04x\n",
- __func__,
- warn == 1 ? "spurious" : "unclaimed",
- level, vec, cur_mask);
- else
- printf("%s: %s interrupt, "
- "level %d, bit %d, mask %04x\n",
- __func__,
- warn == 1 ? "spurious" : "unclaimed",
- level, intbit, cur_mask);
- }
-
- /*
- * Read updated pending interrupt mask.
- */
- cur_mask = *(volatile u_int32_t *)M181_SSR & m181_int_mask;
- if ((cur_mask & ~ign_mask) == 0)
- break;
- }
-
-#ifdef DIAGNOSTIC
- if (ign_mask != 0) {
- if (++problems >= 10)
- panic("%s: broken interrupt behaviour", __func__);
- } else
- problems = 0;
-#endif
-
-#ifdef MULTIPROCESSOR
- if (old_spl < IPL_SCHED)
- __mp_unlock(&kernel_lock);
-#endif
-
-out:
- /*
- * Process any remaining data access exceptions before
- * returning to assembler.
- */
- if (eframe->tf_dmt0 & DMT_VALID)
- m88100_trap(T_DATAFLT, eframe);
-
- /*
- * Disable interrupts before returning to assembler, the spl will
- * be restored later.
- */
- set_psr(get_psr() | PSR_IND);
-}
-
-u_int
-m181_getipl(void)
-{
- return m181_curspl;
-}
-
-u_int
-m181_setipl(u_int level)
-{
- u_int curspl, psr;
-
- psr = get_psr();
- set_psr(psr | PSR_IND);
-
- curspl = m181_curspl;
-
- m181_curspl = level;
- *(u_int32_t *)M181_SCR = int_mask_val[level] | m181_int_sticky;
-
- set_psr(psr);
- return curspl;
-}
-
-u_int
-m181_raiseipl(u_int level)
-{
- u_int curspl, psr;
-
- psr = get_psr();
- set_psr(psr | PSR_IND);
-
- curspl = m181_curspl;
- if (curspl < level) {
- m181_curspl = level;
- *(u_int32_t *)M181_SCR = int_mask_val[level] | m181_int_sticky;
- }
-
- set_psr(psr);
- return curspl;
-}
-
-/* Interrupt masks per logical interrupt source */
-const u_int32_t m181_intsrc[] = {
- 0,
- M181_IRQ_ABORT,
- 0,
- 0,
- M181_IRQ_PARITY,
- 0,
- 0,
- M181_IRQ_DUART,
-
- M181_IRQ_VME1,
- M181_IRQ_VME2,
- M181_IRQ_VME3,
- M181_IRQ_VME4,
- M181_IRQ_VME5,
- M181_IRQ_VME6,
- M181_IRQ_VME7
-};
-
-int
-m181_intsrc_available(u_int intsrc, int ipl)
-{
- if (intsrc == INTSRC_VME) {
-#if 0 /* unwise */
- /*
- * The original AngelFire board apparently only allows
- * VME interrupts at level 4.
- */
- if (brdtyp == BRD_180 && ipl != 4)
- return EINVAL;
-#endif
- return 0;
- }
-
- if (m181_intsrc[intsrc] == 0)
- return ENXIO;
-
- return 0;
-}
-
-void
-m181_intsrc_enable(u_int intsrc, int ipl)
-{
- u_int32_t psr;
- u_int32_t intmask;
- int i;
-
- if (intsrc == INTSRC_VME) {
- /*
- * The original AngelFire board apparently only allows
- * VME interrupts at level 4.
- */
- if (brdtyp == BRD_180)
- intmask = M181_IRQ_VME4_180;
- else
- intmask = m181_intsrc[INTSRC_VME + (ipl - 1)];
- } else
- intmask = m181_intsrc[intsrc];
-
- psr = get_psr();
- set_psr(psr | PSR_IND);
-
- for (i = IPL_NONE; i < ipl; i++)
- int_mask_val[i] |= intmask;
-
- setipl(getipl());
- set_psr(psr);
-}
-
-void
-m181_intsrc_disable(u_int intsrc, int ipl)
-{
- u_int32_t psr;
- u_int32_t intmask;
- int i;
-
- if (intsrc == INTSRC_VME) {
- /*
- * The original AngelFire board apparently only allows
- * VME interrupts at level 4.
- */
- if (brdtyp == BRD_180)
- intmask = M181_IRQ_VME4_180;
- else
- intmask = m181_intsrc[INTSRC_VME + (ipl - 1)];
- } else
- intmask = m181_intsrc[intsrc];
-
- psr = get_psr();
- set_psr(psr | PSR_IND);
-
- for (i = 0; i < NIPLS; i++)
- int_mask_val[i] &= ~intmask;
-
- setipl(getipl());
- set_psr(psr);
-}
-
-int
-m181_intsrc_establish(u_int intsrc, struct intrhand *ih, const char *name)
-{
- intrhand_t *list;
-
-#ifdef DIAGNOSTIC
- if (intsrc == INTSRC_VME)
- return EINVAL;
-#endif
-
- /*
- * Unlike MVME188, timer interrupts from the duart chip are not
- * received on a separate input.
- */
- if (intsrc == INTSRC_DTIMER)
- intsrc = INTSRC_DUART;
-
- list = &angelfire_intr_handlers[intsrc];
- if (!SLIST_EMPTY(list) && intsrc != INTSRC_DUART) {
-#ifdef DIAGNOSTIC
- printf("%s: interrupt source %u already registered\n",
- __func__, intsrc);
-#endif
- return EINVAL;
- }
-
- if (m181_intsrc_available(intsrc, ih->ih_ipl) != 0)
- return EINVAL;
-
- evcount_attach(&ih->ih_count, name, &ih->ih_ipl);
- SLIST_INSERT_HEAD(list, ih, ih_link);
- m181_intsrc_enable(intsrc, ih->ih_ipl);
-
- return 0;
-}
-
-void
-m181_intsrc_disestablish(u_int intsrc, struct intrhand *ih)
-{
- intrhand_t *list;
-
-#ifdef DIAGNOSTIC
- if (intsrc == INTSRC_VME)
- return;
-#endif
-
- /*
- * Unlike MVME188, timer interrupts from the duart chip are not
- * received on a separate input.
- */
- if (intsrc == INTSRC_DTIMER)
- intsrc = INTSRC_DUART;
-
- list = &angelfire_intr_handlers[intsrc];
- evcount_detach(&ih->ih_count);
- SLIST_REMOVE(list, ih, intrhand, ih_link);
-
- if (SLIST_EMPTY(list))
- m181_intsrc_disable(intsrc, ih->ih_ipl);
-}
-
-/*
- * Clock routines
- */
-
-/*
- * Notes on the MVME181 clock usage:
- *
- * We have only one timer source, the two counter/timers in the DUART
- * (MC68681/MC68692), which share the DUART serial interrupt.
- */
-
-#define DART_REG(x) ((volatile uint8_t *)(M181_DUART | ((x) << 2) | 0x03))
-
-u_int m181_get_tc(struct timecounter *);
-int m181_clockintr(void *);
-int m181_clkint;
-
-struct timecounter m181_timecounter = {
- .tc_get_timecount = m181_get_tc,
- .tc_counter_mask = 0xffffffff,
- .tc_frequency = 100,
- .tc_name = "duart",
- .tc_quality = 0
-};
-
-u_int
-m181_get_tc(struct timecounter *tc)
-{
- return (u_int)clock_ih.ih_count.ec_count;
-}
-
-void
-m181_init_clocks(void)
-{
- u_int32_t psr;
-
- psr = get_psr();
- set_psr(psr | PSR_IND);
-
-#ifdef DIAGNOSTIC
- if (1000000 % hz) {
- printf("cannot get %d Hz clock; using 100 Hz\n", hz);
- hz = 100;
- }
-#endif
- tick = 1000000 / hz;
-
- stathz = profhz = 0;
-
- /* the DART clock runs at 3.6864 MHz, CT#1 will run in PCLK/16 mode. */
- m181_clkint = (3686400 / 16) / hz;
- /* in timer mode, interrupts occur every second cycle */
- m181_clkint >>= 1;
-
- /* clear the counter/timer output OP3 while we program the DART */
- *DART_REG(DART_OPCR) = DART_OPCR_OP3;
- /* do the stop counter/timer command */
- (void)*DART_REG(DART_CTSTOP);
- /* set counter/timer to timer mode, PCLK/16 */
- *DART_REG(DART_ACR) = DART_ACR_BRG_SET_2 | DART_ACR_CT_TIMER_CLK_16;
- *DART_REG(DART_CTUR) = m181_clkint >> 8;
- *DART_REG(DART_CTLR) = m181_clkint & 0xff;
- /* give the start counter/timer command */
- (void)*DART_REG(DART_CTSTART);
-
- clock_ih.ih_fn = m181_clockintr;
- clock_ih.ih_arg = 0;
- clock_ih.ih_wantframe = 1;
- clock_ih.ih_ipl = IPL_CLOCK;
- m181_intsrc_establish(INTSRC_DTIMER, &clock_ih, "clock");
-
- tc_init(&m181_timecounter);
-}
-
-int
-m181_clockintr(void *eframe)
-{
- u_int8_t isr;
-
- isr = *DART_REG(DART_ISR);
- if ((isr & DART_ISR_CT) == 0)
- return 0;
-
- /* acknowledge and clear interrupt */
- (void)*DART_REG(DART_CTSTOP);
-
- hardclock(eframe);
-
- return 1;
-}
-
-/*
- * Return the processor speed in MHz.
- * Since there is no easy way to figure out this information, we'll simply
- * spin for a known amount of time incrementing a counter and deduct the
- * processor speed.
- */
-int
-m181_cpuspeed(const struct mvmeprom_brdid *brdid)
-{
- static int af_cpuspeed = 0;
- u_int cycles, clkspan;
-
- if (af_cpuspeed == 0) {
- cycles = 0;
- clkspan = (3686400 / 16) / 100;
-
- *DART_REG(DART_OPCR) = DART_OPCR_OP3;
- (void)*DART_REG(DART_CTSTOP);
- *DART_REG(DART_ACR) =
- DART_ACR_BRG_SET_2 | DART_ACR_CT_COUNTER_CLK_16;
- *DART_REG(DART_CTUR) = clkspan >> 8;
- *DART_REG(DART_CTLR) = clkspan & 0xff;
- (void)*DART_REG(DART_CTSTART);
-
- do {
- cycles++;
- } while ((*DART_REG(DART_ISR) & DART_ISR_CT) == 0);
- (void)*DART_REG(DART_CTSTOP);
-
- if (cycles < 10000) /* observed ~9220 @20MHz */
- af_cpuspeed = 20;
- else
- af_cpuspeed = 25;
- }
-
- return af_cpuspeed;
-}
-
-/*
- * Setup VME bus access and return the lower interrupt number usable by VME
- * boards.
- */
-u_int
-m181_init_vme(const char *devname)
-{
- return 0; /* all vectors available */
-}
diff --git a/sys/arch/mvme88k/mvme88k/m187_machdep.c b/sys/arch/mvme88k/mvme88k/m187_machdep.c
deleted file mode 100644
index 0adf94bc31a..00000000000
--- a/sys/arch/mvme88k/mvme88k/m187_machdep.c
+++ /dev/null
@@ -1,271 +0,0 @@
-/* $OpenBSD: m187_machdep.c,v 1.24 2013/05/17 22:46:28 miod Exp $ */
-/*
- * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
- * Copyright (c) 1996 Nivas Madhur
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Nivas Madhur.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-/*
- * Mach Operating System
- * Copyright (c) 1993-1991 Carnegie Mellon University
- * Copyright (c) 1991 OMRON Corporation
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/errno.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/asm_macro.h>
-#include <machine/board.h>
-#include <machine/cmmu.h>
-#include <machine/cpu.h>
-#include <machine/pmap_table.h>
-#include <machine/reg.h>
-#include <machine/trap.h>
-
-#include <machine/m88100.h>
-#include <machine/m8820x.h>
-#include <machine/mvme187.h>
-
-#include <mvme88k/dev/memcreg.h>
-#include <mvme88k/dev/pcctworeg.h>
-#include <mvme88k/mvme88k/clockvar.h>
-
-const struct pmap_table m187_pmap_table[] = {
- { BUG187_START, BUG187_SIZE, UVM_PROT_RW, CACHE_INH },
-#if 0 /* mapped by the hardcoded BATC entries */
- { OBIO187_START, OBIO187_SIZE, UVM_PROT_RW, CACHE_INH },
-#endif
- { 0, 0xffffffff, 0, 0 },
-};
-
-const struct board board_mvme187 = {
- .bootstrap = m187_bootstrap,
- .memsize = m187_memsize,
- .cpuspeed = m187_cpuspeed,
- .reboot = m1x7_reboot,
- .is_syscon = m1x7_is_syscon,
- .intr = m187_intr,
- .nmi = NULL,
- .nmi_wrapup = NULL,
- .getipl = m187_getipl,
- .setipl = m187_setipl,
- .raiseipl = m187_raiseipl,
- .intsrc_available = m1x7_intsrc_available,
- .intsrc_enable = m1x7_intsrc_enable,
- .intsrc_disable = NULL,
- .intsrc_establish = NULL,
- .intsrc_disestablish = NULL,
- .init_clocks = m1x7_init_clocks,
- .delay = m1x7_delay,
- .init_vme = m1x7_init_vme,
-#ifdef MULTIPROCESSOR
- .send_ipi = NULL,
- .smp_setup = m88100_smp_setup,
-#endif
- .ptable = m187_pmap_table,
- .cmmu = &cmmu8820x
-};
-
-void
-m187_bootstrap()
-{
-}
-
-/*
- * Figure out how much memory is available, by querying the memory controllers.
- */
-vaddr_t
-m187_memsize()
-{
- struct memcreg *memc;
- vaddr_t x;
-
- memc = (struct memcreg *)MEM_CTLR;
- x = MEMC_MEMCONF_RTOB(memc->memc_memconf);
-
- memc = (struct memcreg *)(MEM_CTLR + 0x100);
- if (!badaddr((vaddr_t)&memc->memc_memconf, 1))
- x += MEMC_MEMCONF_RTOB(memc->memc_memconf);
-
- return x;
-}
-
-/*
- * Return the processor speed in MHz.
- */
-int
-m187_cpuspeed(const struct mvmeprom_brdid *brdid)
-{
- /*
- * Find out the processor speed, from the PCC2 prescaler
- * adjust register.
- */
- return 256 - *(volatile u_int8_t *)(PCC2_BASE + PCCTWO_PSCALEADJ);
-}
-
-/*
- * Device interrupt handler for MVME187
- */
-void
-m187_intr(struct trapframe *eframe)
-{
- int level;
- struct intrhand *intr;
- intrhand_t *list;
- int ret;
- vaddr_t ivec;
- u_int8_t vec;
-
- level = *(u_int8_t *)M187_ILEVEL & 0x07;
-
- /* generate IACK and get the vector */
- ivec = M187_IACK + (level << 2) + 0x03;
- vec = *(volatile u_int8_t *)ivec;
-
-#ifdef MULTIPROCESSOR
- if (eframe->tf_mask < IPL_SCHED)
- __mp_lock(&kernel_lock);
-#endif
-
- uvmexp.intrs++;
-
- /* block interrupts at level or lower */
- m187_setipl(level);
- flush_pipeline();
- set_psr(get_psr() & ~PSR_IND);
-
- list = &intr_handlers[vec];
- if (SLIST_EMPTY(list)) {
- /* increment intr counter */
- printf("Spurious interrupt (level %x and vec %x)\n",
- level, vec);
- } else {
-#ifdef DEBUG
- intr = SLIST_FIRST(list);
- if (intr->ih_ipl != level) {
- panic("Handler ipl %x not the same as level %x. "
- "vec = 0x%x",
- intr->ih_ipl, level, vec);
- }
-#endif
-
- /*
- * Walk through all interrupt handlers in the chain for the
- * given vector, calling each handler in turn, till some handler
- * returns a value != 0.
- */
-
- ret = 0;
- SLIST_FOREACH(intr, list, ih_link) {
- if (intr->ih_wantframe != 0)
- ret = (*intr->ih_fn)((void *)eframe);
- else
- ret = (*intr->ih_fn)(intr->ih_arg);
- if (ret != 0) {
- intr->ih_count.ec_count++;
- break;
- }
- }
-
- if (ret == 0) {
- printf("Unclaimed interrupt (level %x and vec %x)\n",
- level, vec);
- }
- }
-
- /*
- * process any remaining data access exceptions before
- * returning to assembler
- */
- if (eframe->tf_dmt0 & DMT_VALID)
- m88100_trap(T_DATAFLT, eframe);
-
- /*
- * Disable interrupts before returning to assembler, the spl will
- * be restored later.
- */
- set_psr(get_psr() | PSR_IND);
-
-#ifdef MULTIPROCESSOR
- if (eframe->tf_mask < IPL_SCHED)
- __mp_unlock(&kernel_lock);
-#endif
-}
-
-u_int
-m187_getipl(void)
-{
- return *(u_int8_t *)M187_IMASK & 0x07;
-}
-
-u_int
-m187_setipl(u_int level)
-{
- u_int curspl, psr;
-
- psr = get_psr();
- set_psr(psr | PSR_IND);
- curspl = *(u_int8_t *)M187_IMASK & 0x07;
- *(u_int8_t *)M187_IMASK = level;
- /*
- * We do not flush the pipeline here, because interrupts are disabled,
- * and set_psr() will synchronize the pipeline.
- */
- set_psr(psr);
- return curspl;
-}
-
-u_int
-m187_raiseipl(u_int level)
-{
- u_int curspl, psr;
-
- psr = get_psr();
- set_psr(psr | PSR_IND);
- curspl = *(u_int8_t *)M187_IMASK & 0x07;
- if (curspl < level)
- *(u_int8_t *)M187_IMASK = level;
- /*
- * We do not flush the pipeline here, because interrupts are disabled,
- * and set_psr() will synchronize the pipeline.
- */
- set_psr(psr);
- return curspl;
-}
diff --git a/sys/arch/mvme88k/mvme88k/m188_machdep.c b/sys/arch/mvme88k/mvme88k/m188_machdep.c
deleted file mode 100644
index 9100550e81b..00000000000
--- a/sys/arch/mvme88k/mvme88k/m188_machdep.c
+++ /dev/null
@@ -1,1257 +0,0 @@
-/* $OpenBSD: m188_machdep.c,v 1.57 2013/06/11 21:06:31 miod Exp $ */
-/*
- * Copyright (c) 2009, 2013 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-/*
- * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
- * Copyright (c) 1996 Nivas Madhur
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Nivas Madhur.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-/*
- * Copyright (c) 1999 Steve Murphree, Jr.
- * Copyright (c) 1995 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- * Copyright (c) 1995 Nivas Madhur
- * Copyright (c) 1994 Gordon W. Ross
- * Copyright (c) 1993 Adam Glass
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)clock.c 8.1 (Berkeley) 6/11/93
- */
-/*
- * Mach Operating System
- * Copyright (c) 1993-1991 Carnegie Mellon University
- * Copyright (c) 1991 OMRON Corporation
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- */
-
-/*
- * MVME188 support routines
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/errno.h>
-#include <sys/timetc.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/asm_macro.h>
-#include <machine/board.h>
-#include <machine/cmmu.h>
-#include <machine/cpu.h>
-#include <machine/pmap_table.h>
-#include <machine/prom.h>
-#include <machine/reg.h>
-#include <machine/trap.h>
-
-#include <machine/m88100.h>
-#include <machine/m8820x.h>
-#include <machine/mvme188.h>
-
-#include <mvme88k/mvme88k/clockvar.h>
-#include <dev/ic/mc68681reg.h>
-#include <dev/ic/z8536reg.h>
-
-#ifdef MULTIPROCESSOR
-#include <machine/db_machdep.h>
-#endif
-
-const struct pmap_table m188_pmap_table[] = {
- { MVME188_EPROM, MVME188_EPROM_SIZE, UVM_PROT_RW, CACHE_INH },
-#if 0 /* mapped by the hardcoded BATC entries */
- { MVME188_UTILITY, MVME188_UTILITY_SIZE, UVM_PROT_RW, CACHE_INH },
-#endif
- { 0, 0xffffffff, 0, 0 },
-};
-
-const struct board board_mvme188 = {
- .bootstrap = m188_bootstrap,
- .memsize = m188_memsize,
- .cpuspeed = m188_cpuspeed,
- .reboot = m188_reboot,
- .is_syscon = m188_is_syscon,
- .intr = m188_intr,
- .nmi = NULL,
- .nmi_wrapup = NULL,
- .getipl = m188_getipl,
- .setipl = m188_setipl,
- .raiseipl = m188_raiseipl,
- .intsrc_available = m188_intsrc_available,
- .intsrc_enable = m188_intsrc_enable,
- .intsrc_disable = m188_intsrc_disable,
- .intsrc_establish = m188_intsrc_establish,
- .intsrc_disestablish = m188_intsrc_disestablish,
- .init_clocks = m188_init_clocks,
- .delay = dumb_delay,
- .init_vme = m188_init_vme,
-#ifdef MULTIPROCESSOR
- .send_ipi = m188_send_ipi,
- .smp_setup = m88100_smp_setup,
-#endif
- .ptable = m188_pmap_table,
- .cmmu = &cmmu8820x
-};
-
-u_int m188_safe_level(u_int, u_int);
-
-void m188_clock_ipi_handler(struct trapframe *);
-void m188_ipi_handler(struct trapframe *);
-void m188_send_ipi(int, cpuid_t);
-
-/*
- * Copy of the interrupt enable register for each CPU.
- */
-u_int32_t int_mask_reg[] = { 0, 0, 0, 0 };
-
-u_int m188_curspl[] = { IPL_HIGH, IPL_HIGH, IPL_HIGH, IPL_HIGH };
-
-#ifdef MULTIPROCESSOR
-/*
- * Interrupts allowed on secondary processors.
- */
-#define SLAVE_MASK 0
-#endif
-
-/*
- * The MVME188 interrupt arbiter has 25 orthogonal interrupt sources.
- * We fold this model in the 8-level spl model this port uses, enforcing
- * priorities manually with the interrupt masks.
- */
-
-intrhand_t syscon_intr_handlers[INTSRC_VME];
-
-void
-m188_bootstrap()
-{
- int i;
-
- /* clear and disable all interrupts */
- *(volatile u_int32_t *)MVME188_IENALL = 0;
-
- for (i = 0; i < INTSRC_VME; i++)
- SLIST_INIT(&syscon_intr_handlers[i]);
-}
-
-/*
- * Figure out how much memory is available, by querying the MBus registers.
- *
- * For every 4MB segment, ask the MBus address decoder which device claimed
- * the range. Since memory is packed at low addresses, we will hit all memory
- * boards in order until reaching either a VME space or a non-claimed space.
- *
- * As a safety measure, we never check for more than 512MB - the 188 can
- * only have up to 4 memory boards, which theoretically can not be larger
- * than 128MB, and I am not aware of third-party larger memory boards.
- */
-vaddr_t
-m188_memsize()
-{
- u_int pgnum;
- int32_t rmad;
-
-#define MVME188_MAX_MEMORY ((4 * 128) / 4) /* 4 128MB boards */
- for (pgnum = 0; pgnum < MVME188_MAX_MEMORY; pgnum++) {
- *(volatile int32_t *)MVME188_RMAD = (pgnum << 22);
- rmad = *(volatile int32_t *)MVME188_RMAD;
-
- if (rmad & 0x04) /* not a memory board */
- break;
- }
-
- return (pgnum << 22);
-}
-
-/*
- * Return the processor speed in MHz.
- */
-int
-m188_cpuspeed(const struct mvmeprom_brdid *brdid)
-{
- int speed;
- int i;
- u_int c;
-
- /*
- * If BUG version prior to 5.x, there is no CNFG block and speed
- * can be found in the environment.
- * XXX We don't process ENV data yet - assume 20MHz in this case.
- */
- if ((u_int)brdid->rev < 0x50) {
- return 20;
- }
-
- speed = 0;
- for (i = 0; i < 4; i++) {
- c = (u_int)brdid->speed[i];
- if (c == ' ')
- c = '0';
- else if (c > '9' || c < '0') {
- speed = 0;
- break;
- }
- speed = speed * 10 + (c - '0');
- }
- speed = speed / 100;
-
- if (speed == 20 || speed == 25)
- return speed;
-
- /*
- * If we end up here, the board information block is damaged and
- * we can't trust it.
- * Suppose we are running at the most common speed for our board,
- * and hope for the best (this really only affects osiop, which
- * doesn't exist on 188).
- */
- printf("WARNING: Board Configuration Data invalid, "
- "replace NVRAM and restore values\n");
-
- return 25;
-}
-
-/*
- * Reboot the system.
- */
-void
-m188_reboot(int howto)
-{
- volatile int cnt;
-
- /* clear and disable all interrupts */
- *(volatile u_int32_t *)MVME188_IENALL = 0;
-
- if ((*(volatile u_int8_t *)MVME188_GLOBAL1) & M188_SYSCON) {
- /* Force a complete VMEbus reset */
- *(volatile u_int32_t *)MVME188_GLBRES = 1;
- } else {
- /* Force only a local reset */
- *(volatile u_int8_t *)MVME188_GLOBAL1 |= M188_LRST;
- }
-
- *(volatile u_int32_t *)MVME188_UCSR |= 0x2000; /* clear SYSFAIL */
- for (cnt = 0; cnt < 5*1024*1024; cnt++)
- ;
- *(volatile u_int32_t *)MVME188_UCSR |= 0x2000; /* clear SYSFAIL */
-
- printf("Reset failed\n");
-}
-
-/*
- * Return whether we are the VME bus system controller.
- */
-int
-m188_is_syscon()
-{
- return ISSET(*(volatile u_int8_t *)MVME188_GLOBAL1, M188_SYSCON);
-}
-
-/*
- * Return the next ipl >= ``curlevel'' at which we can reenable interrupts
- * while keeping ``mask'' masked.
- */
-u_int
-m188_safe_level(u_int mask, u_int curlevel)
-{
- int i;
-
-#ifdef MULTIPROCESSOR
- if (mask & CLOCK_IPI_MASK)
- curlevel = max(IPL_CLOCK, curlevel);
- mask &= ~(IPI_MASK | CLOCK_IPI_MASK);
-#endif
- for (i = curlevel; i < NIPLS; i++)
- if ((int_mask_val[i] & mask) == 0)
- return (i);
-
- return (NIPLS - 1);
-}
-
-/*
- * Provide the interrupt source for a give interrupt status bit.
- */
-const u_int m188_vec[32] = {
- 0, /* SWI0 */
- 0, /* SWI1 */
- 0, /* SWI2 */
- 0, /* SWI3 */
- INTSRC_VME, /* VME1 */
- 0,
- INTSRC_VME, /* VME2 */
- 0, /* SIGLPI */
- 0, /* LMI */
- 0,
- INTSRC_VME, /* VME3 */
- 0,
- INTSRC_VME, /* VME4 */
- 0,
- INTSRC_VME, /* VME5 */
- 0,
- 0, /* SIGHPI */
- INTSRC_DUART, /* DI */
- 0,
- INTSRC_VME, /* VME6 */
- INTSRC_SYSFAIL, /* SF */
- INTSRC_CIO, /* CIOI */
- 0,
- INTSRC_VME, /* VME7 */
- 0, /* SWI4 */
- 0, /* SWI5 */
- 0, /* SWI6 */
- 0, /* SWI7 */
- INTSRC_DTIMER, /* DTI */
- 0, /* ARBTO */
- INTSRC_ACFAIL, /* ACF */
- INTSRC_ABORT /* ABORT */
-};
-
-/*
- * Device interrupt handler for MVME188
- */
-
-#define VME_VECTOR_MASK 0x1ff /* mask into VIACK register */
-#define VME_BERR_MASK 0x100 /* timeout during VME IACK cycle */
-
-void
-m188_intr(struct trapframe *eframe)
-{
-#ifdef MULTIPROCESSOR
- struct cpu_info *ci = curcpu();
- u_int cpu = ci->ci_cpuid;
-#else
- u_int cpu = cpu_number();
-#endif
- u_int32_t cur_mask, ign_mask;
- u_int level, old_spl;
- struct intrhand *intr;
- intrhand_t *list;
- int ret, intbit;
- vaddr_t ivec;
- u_int intsrc, vec;
- int unmasked = 0;
- int warn;
-#ifdef DIAGNOSTIC
- static int problems = 0;
-#endif
-
- cur_mask = ISR_GET_CURRENT_MASK(cpu);
- ign_mask = 0;
- old_spl = eframe->tf_mask;
-
- if (cur_mask == 0) {
- /*
- * Spurious interrupts - may be caused by debug output clearing
- * DUART interrupts.
- */
-#ifdef MULTIPROCESSOR
- if (cpu != master_cpu) {
- if (++problems >= 10) {
- printf("cpu%d: interrupt pin won't clear, "
- "disabling processor\n", cpu);
- cpu_emergency_disable();
- /* NOTREACHED */
- }
- }
-#endif
- flush_pipeline();
- goto out;
- }
-
- uvmexp.intrs++;
-
-#ifdef MULTIPROCESSOR
- /*
- * Handle unmaskable IPIs immediately, so that we can reenable
- * interrupts before further processing. We rely on the interrupt
- * mask to make sure that if we get an IPI, it's really for us
- * and no other processor.
- */
- if (cur_mask & IPI_MASK) {
- m188_ipi_handler(eframe);
- cur_mask &= ~IPI_MASK;
- if (cur_mask == 0)
- goto out;
- }
-#endif
-
-#ifdef MULTIPROCESSOR
- if (old_spl < IPL_SCHED)
- __mp_lock(&kernel_lock);
-#endif
-
- /*
- * We want to service all interrupts marked in the IST register
- * They are all valid because the mask would have prevented them
- * from being generated otherwise. We will service them in order of
- * priority.
- */
- do {
- level = m188_safe_level(cur_mask, old_spl);
- m188_setipl(level);
-
- if (unmasked == 0) {
- set_psr(get_psr() & ~PSR_IND);
- unmasked = 1;
- }
-
-#ifdef MULTIPROCESSOR
- /*
- * Handle pending maskable IPIs first.
- */
- if (cur_mask & CLOCK_IPI_MASK) {
- m188_clock_ipi_handler(eframe);
- cur_mask &= ~CLOCK_IPI_MASK;
- if (cur_mask == 0)
- break;
- }
-#endif
-
- /* find the first bit set in the current mask */
- warn = 0;
- intbit = ff1(cur_mask);
- intsrc = m188_vec[intbit];
-
- if (intsrc == 0)
- panic("%s: unexpected interrupt source (bit %d), "
- "level %d, mask 0x%b",
- __func__, intbit, level, cur_mask, IST_STRING);
-
- if (intsrc == INTSRC_VME) {
- ivec = MVME188_VIRQLV + (level << 2);
- vec = *(volatile u_int32_t *)ivec & VME_VECTOR_MASK;
- if (vec & VME_BERR_MASK) {
- /*
- * If only one VME interrupt is registered
- * with this IPL, we can reasonably safely
- * assume that this is our vector.
- */
- vec = vmevec_hints[level];
- if (vec == (u_int)-1) {
- printf("%s: timeout getting VME "
- "interrupt vector, "
- "level %d, mask 0x%b\n",
- __func__, level,
- cur_mask, IST_STRING);
- ign_mask |= 1 << intbit;
- continue;
- }
- }
- list = &intr_handlers[vec];
- } else {
- list = &syscon_intr_handlers[intsrc];
- }
-
- if (SLIST_EMPTY(list)) {
- warn = 1;
- } else {
- /*
- * Walk through all interrupt handlers in the chain
- * for the given vector, calling each handler in turn,
- * till some handler returns a value != 0.
- */
- ret = 0;
- SLIST_FOREACH(intr, list, ih_link) {
- if (intr->ih_wantframe != 0)
- ret = (*intr->ih_fn)((void *)eframe);
- else
- ret = (*intr->ih_fn)(intr->ih_arg);
- if (ret != 0) {
- intr->ih_count.ec_count++;
- break;
- }
- }
- if (ret == 0)
- warn = 2;
- }
-
- if (warn != 0) {
- ign_mask |= 1 << intbit;
-
- if (intsrc == INTSRC_VME)
- printf("%s: %s VME interrupt, "
- "level %d, vec 0x%x, mask 0x%b\n",
- __func__,
- warn == 1 ? "spurious" : "unclaimed",
- level, vec, cur_mask, IST_STRING);
- else
- printf("%s: %s interrupt, "
- "level %d, bit %d, mask 0x%b\n",
- __func__,
- warn == 1 ? "spurious" : "unclaimed",
- level, intbit, cur_mask, IST_STRING);
- }
- } while (((cur_mask = ISR_GET_CURRENT_MASK(cpu)) & ~ign_mask &
- ~IPI_MASK) != 0);
-
-#ifdef DIAGNOSTIC
- if (ign_mask != 0) {
- if (++problems >= 10)
- panic("%s: broken interrupt behaviour", __func__);
- } else
- problems = 0;
-#endif
-
-#ifdef MULTIPROCESSOR
- if (old_spl < IPL_SCHED)
- __mp_unlock(&kernel_lock);
-#endif
-
-out:
- /*
- * process any remaining data access exceptions before
- * returning to assembler
- */
- if (eframe->tf_dmt0 & DMT_VALID)
- m88100_trap(T_DATAFLT, eframe);
-
- /*
- * Disable interrupts before returning to assembler, the spl will
- * be restored later.
- */
- set_psr(get_psr() | PSR_IND);
-}
-
-u_int
-m188_getipl(void)
-{
- return m188_curspl[cpu_number()];
-}
-
-u_int
-m188_setipl(u_int level)
-{
- u_int curspl, mask, psr;
-#ifdef MULTIPROCESSOR
- struct cpu_info *ci = curcpu();
- int cpu = ci->ci_cpuid;
-#else
- int cpu = cpu_number();
-#endif
-
- psr = get_psr();
- set_psr(psr | PSR_IND);
-
- curspl = m188_curspl[cpu];
-
- mask = int_mask_val[level];
-#ifdef MULTIPROCESSOR
- if (cpu != master_cpu)
- mask &= SLAVE_MASK;
- mask |= SWI_IPI_MASK(cpu);
- if (level < IPL_CLOCK)
- mask |= SWI_CLOCK_IPI_MASK(cpu);
-#endif
-
- m188_curspl[cpu] = level;
- *(u_int32_t *)MVME188_IEN(cpu) = int_mask_reg[cpu] = mask;
- /*
- * We do not flush the pipeline here, because interrupts are disabled,
- * and set_psr() will synchronize the pipeline.
- */
- set_psr(psr);
-
- return curspl;
-}
-
-u_int
-m188_raiseipl(u_int level)
-{
- u_int mask, curspl, psr;
-#ifdef MULTIPROCESSOR
- struct cpu_info *ci = curcpu();
- int cpu = ci->ci_cpuid;
-#else
- int cpu = cpu_number();
-#endif
-
- psr = get_psr();
- set_psr(psr | PSR_IND);
-
- curspl = m188_curspl[cpu];
- if (curspl < level) {
- mask = int_mask_val[level];
-#ifdef MULTIPROCESSOR
- if (cpu != master_cpu)
- mask &= SLAVE_MASK;
- mask |= SWI_IPI_MASK(cpu);
- if (level < IPL_CLOCK)
- mask |= SWI_CLOCK_IPI_MASK(cpu);
-#endif
-
- m188_curspl[cpu] = level;
- *(u_int32_t *)MVME188_IEN(cpu) = int_mask_reg[cpu] = mask;
- }
- /*
- * We do not flush the pipeline here, because interrupts are disabled,
- * and set_psr() will synchronize the pipeline.
- */
- set_psr(psr);
-
- return curspl;
-}
-
-#ifdef MULTIPROCESSOR
-
-void
-m188_send_ipi(int ipi, cpuid_t cpu)
-{
- struct cpu_info *ci = &m88k_cpus[cpu];
- u_int32_t bits = 0;
-
- if (ci->ci_ipi & ipi)
- return;
-
- atomic_setbits_int(&ci->ci_ipi, ipi);
- if (ipi & ~(CI_IPI_HARDCLOCK | CI_IPI_STATCLOCK))
- bits |= SWI_IPI_BIT(cpu);
- if (ipi & (CI_IPI_HARDCLOCK | CI_IPI_STATCLOCK))
- bits |= SWI_CLOCK_IPI_BIT(cpu);
- *(volatile u_int32_t *)MVME188_SETSWI = bits;
-}
-
-/*
- * Process inter-processor interrupts.
- */
-
-/*
- * Unmaskable IPIs - those are processed with interrupts disabled,
- * and no lock held.
- */
-void
-m188_ipi_handler(struct trapframe *eframe)
-{
- struct cpu_info *ci = curcpu();
- int ipi = ci->ci_ipi & (CI_IPI_DDB | CI_IPI_NOTIFY);
-
- *(volatile u_int32_t *)MVME188_CLRSWI = SWI_IPI_BIT(ci->ci_cpuid);
- atomic_clearbits_int(&ci->ci_ipi, ipi);
-
- if (ipi & CI_IPI_DDB) {
-#ifdef DDB
- /*
- * Another processor has entered DDB. Spin on the ddb lock
- * until it is done.
- */
- extern struct __mp_lock ddb_mp_lock;
-
- __mp_lock(&ddb_mp_lock);
- __mp_unlock(&ddb_mp_lock);
-
- /*
- * If ddb is hoping to us, it's our turn to enter ddb now.
- */
- if (ci->ci_cpuid == ddb_mp_nextcpu)
- Debugger();
-#endif
- }
- if (ipi & CI_IPI_NOTIFY) {
- /* nothing to do */
- }
-}
-
-/*
- * Maskable IPIs
- */
-void
-m188_clock_ipi_handler(struct trapframe *eframe)
-{
- struct cpu_info *ci = curcpu();
- int ipi = ci->ci_ipi & (CI_IPI_HARDCLOCK | CI_IPI_STATCLOCK);
-
- /* clear clock ipi interrupt */
- *(volatile u_int32_t *)MVME188_CLRSWI = SWI_CLOCK_IPI_BIT(ci->ci_cpuid);
- atomic_clearbits_int(&ci->ci_ipi, ipi);
-
- if (ipi & CI_IPI_HARDCLOCK)
- hardclock((struct clockframe *)eframe);
- if (ipi & CI_IPI_STATCLOCK)
- statclock((struct clockframe *)eframe);
-}
-
-#endif
-
-/* Interrupt masks per logical interrupt source */
-const u_int32_t m188_intsrc[] = {
- 0,
- IRQ_ABORT,
- IRQ_ACF,
- IRQ_SF,
- 0,
- IRQ_CIOI,
- IRQ_DTI,
- IRQ_DI,
-
- IRQ_VME1,
- IRQ_VME2,
- IRQ_VME3,
- IRQ_VME4,
- IRQ_VME5,
- IRQ_VME6,
- IRQ_VME7
-};
-
-int
-m188_intsrc_available(u_int intsrc, int ipl)
-{
- if (intsrc == INTSRC_VME)
- return 0;
-
- if (m188_intsrc[intsrc] == 0)
- return ENXIO;
-
- return 0;
-}
-
-void
-m188_intsrc_enable(u_int intsrc, int ipl)
-{
- u_int32_t psr;
- u_int32_t intmask;
- int i;
-
- if (intsrc == INTSRC_VME)
- intmask = m188_intsrc[INTSRC_VME + (ipl - 1)];
- else
- intmask = m188_intsrc[intsrc];
-
- psr = get_psr();
- set_psr(psr | PSR_IND);
-
- for (i = IPL_NONE; i < ipl; i++)
- int_mask_val[i] |= intmask;
-
- setipl(getipl());
- set_psr(psr);
-}
-
-void
-m188_intsrc_disable(u_int intsrc, int ipl)
-{
- u_int32_t psr;
- u_int32_t intmask;
- int i;
-
- if (intsrc == INTSRC_VME)
- intmask = m188_intsrc[INTSRC_VME + (ipl - 1)];
- else
- intmask = m188_intsrc[intsrc];
-
- psr = get_psr();
- set_psr(psr | PSR_IND);
-
- for (i = 0; i < NIPLS; i++)
- int_mask_val[i] &= ~intmask;
-
- setipl(getipl());
- set_psr(psr);
-}
-
-int
-m188_intsrc_establish(u_int intsrc, struct intrhand *ih, const char *name)
-{
- intrhand_t *list;
-
-#ifdef DIAGNOSTIC
- if (intsrc == INTSRC_VME)
- return EINVAL;
-#endif
-
- list = &syscon_intr_handlers[intsrc];
- if (!SLIST_EMPTY(list)) {
-#ifdef DIAGNOSTIC
- printf("%s: interrupt source %u already registered\n",
- __func__, intsrc);
-#endif
- return EINVAL;
- }
-
- if (m188_intsrc_available(intsrc, ih->ih_ipl) != 0)
- return EINVAL;
-
- evcount_attach(&ih->ih_count, name, &ih->ih_ipl);
- SLIST_INSERT_HEAD(list, ih, ih_link);
- m188_intsrc_enable(intsrc, ih->ih_ipl);
-
- return 0;
-}
-
-void
-m188_intsrc_disestablish(u_int intsrc, struct intrhand *ih)
-{
- intrhand_t *list;
-
-#ifdef DIAGNOSTIC
- if (intsrc == INTSRC_VME)
- return;
-#endif
-
- list = &syscon_intr_handlers[intsrc];
- evcount_detach(&ih->ih_count);
- SLIST_REMOVE(list, ih, intrhand, ih_link);
-
- m188_intsrc_disable(intsrc, ih->ih_ipl);
-}
-
-/*
- * Clock routines
- */
-
-/*
- * Notes on the MVME188 clock usage:
- *
- * We have two sources for timers:
- * - two counter/timers in the DUART (MC68681/MC68692)
- * - three counter/timers in the Zilog Z8536
- *
- * However:
- * - Z8536 CT#3 is reserved as a watchdog device; and its input is
- * user-controllable with jumpers on the SYSCON board, so we can't
- * really use it.
- * - When using the Z8536 in timer mode, it _seems_ like it resets at
- * 0xffff instead of the initial count value...
- * - Despite having per-counter programmable interrupt vectors, the
- * SYSCON logic forces fixed vectors for the DUART and the Z8536 timer
- * interrupts.
- * - The DUART timers keep counting down from 0xffff even after
- * interrupting, and need to be manually stopped, then restarted, to
- * resume counting down the initial count value.
- *
- * Also, while the Z8536 has a very reliable 4MHz clock source, the
- * 3.6864MHz clock source of the DUART timers does not seem to be precise
- * enough (and is apparently slowed down when there are four processors).
- *
- * As a result, clock is run on a Z8536 counter, kept in counter mode and
- * retriggered every interrupt, while statclock is run on a DUART counter,
- * but in practice runs at an average 96Hz instead of the expected 100Hz.
- *
- * It should be possible to run statclock on the Z8536 counter #2, but
- * this would make interrupt handling more tricky, in the case both
- * counters interrupt at the same time...
- */
-
-#define DART_REG(x) ((volatile uint8_t *)(DART_BASE | ((x) << 2) | 0x03))
-
-void m188_cio_init(u_int);
-u_int read_cio(int);
-void write_cio(int, u_int);
-
-int m188_clockintr(void *);
-int m188_calibrateintr(void *);
-int m188_statintr(void *);
-u_int m188_cio_get_timecount(struct timecounter *);
-
-volatile int m188_calibrate_phase = 0;
-
-uint32_t cio_step;
-uint32_t cio_refcnt;
-uint32_t cio_lastcnt;
-
-struct mutex cio_mutex = MUTEX_INITIALIZER(IPL_CLOCK);
-
-struct timecounter m188_cio_timecounter = {
- m188_cio_get_timecount,
- NULL,
- 0xffffffff,
- 0,
- "cio",
- 0,
- NULL
-};
-
-void
-m188_init_clocks(void)
-{
- int statint, minint;
- u_int iter, divisor;
- u_int32_t psr;
-
- psr = get_psr();
- set_psr(psr | PSR_IND);
-
-#ifdef DIAGNOSTIC
- if (1000000 % hz) {
- printf("cannot get %d Hz clock; using 100 Hz\n", hz);
- hz = 100;
- }
-#endif
- tick = 1000000 / hz;
-
- m188_cio_init(tick);
-
- if (stathz == 0)
- stathz = hz;
-#ifdef DIAGNOSTIC
- if (1000000 % stathz) {
- printf("cannot get %d Hz statclock; using 100 Hz\n", stathz);
- stathz = 100;
- }
-#endif
- profhz = stathz; /* always */
-
- /*
- * The DUART runs at 3.6864 MHz, CT#1 will run in PCLK/16 mode.
- */
- statint = (3686400 / 16) / stathz;
- minint = statint / 2 + 100;
- while (statvar > minint)
- statvar >>= 1;
- statmin = statint - (statvar >> 1);
-
- /* clear the counter/timer output OP3 while we program the DART */
- *DART_REG(DART_OPCR) = DART_OPCR_OP3;
- /* do the stop counter/timer command */
- (void)*DART_REG(DART_CTSTOP);
- /* set counter/timer to counter mode, PCLK/16 */
- *DART_REG(DART_ACR) = DART_ACR_CT_COUNTER_CLK_16 | DART_ACR_BRG_SET_1;
- *DART_REG(DART_CTUR) = statint >> 8;
- *DART_REG(DART_CTLR) = statint & 0xff;
- /* give the start counter/timer command */
- (void)*DART_REG(DART_CTSTART);
- /* set the counter/timer output OP3 */
- *DART_REG(DART_OPCR) = DART_OPCR_CT_OUTPUT;
-
- statclock_ih.ih_fn = m188_statintr;
- statclock_ih.ih_arg = 0;
- statclock_ih.ih_wantframe = 1;
- statclock_ih.ih_ipl = IPL_STATCLOCK;
- platform->intsrc_establish(INTSRC_DTIMER, &statclock_ih, "stat");
-
- /*
- * Calibrate delay const.
- */
- clock_ih.ih_fn = m188_calibrateintr;
- clock_ih.ih_arg = 0;
- clock_ih.ih_wantframe = 1;
- clock_ih.ih_ipl = IPL_CLOCK;
- platform->intsrc_establish(INTSRC_CIO, &clock_ih, "clock");
-
- dumb_delay_const = 1;
- set_psr(psr);
- while (m188_calibrate_phase == 0)
- ;
-
- iter = 0;
- while (m188_calibrate_phase == 1) {
- delay(10000);
- iter++;
- }
-
- divisor = 1000000 / 10000;
- dumb_delay_const = (iter * hz + divisor - 1) / divisor;
-
- set_psr(psr | PSR_IND);
-
- platform->intsrc_disestablish(INTSRC_CIO, &clock_ih);
- clock_ih.ih_fn = m188_clockintr;
- platform->intsrc_establish(INTSRC_CIO, &clock_ih, "clock");
-
- set_psr(psr);
-
- tc_init(&m188_cio_timecounter);
-}
-
-int
-m188_calibrateintr(void *eframe)
-{
- /* no need to grab the mutex, only one processor is running for now */
- /* ack the interrupt */
- write_cio(ZCIO_CT1CS, ZCIO_CTCS_GCB | ZCIO_CTCS_C_IP);
-
- m188_calibrate_phase++;
-
- return (1);
-}
-
-int
-m188_clockintr(void *eframe)
-{
- mtx_enter(&cio_mutex);
- /* ack the interrupt */
- write_cio(ZCIO_CT1CS, ZCIO_CTCS_GCB | ZCIO_CTCS_C_IP);
- cio_refcnt += cio_step;
- mtx_leave(&cio_mutex);
-
- hardclock(eframe);
-
-#ifdef MULTIPROCESSOR
- /*
- * Send an IPI to all other processors, so they can get their
- * own ticks.
- */
- m88k_broadcast_ipi(CI_IPI_HARDCLOCK);
-#endif
-
- return (1);
-}
-
-int
-m188_statintr(void *eframe)
-{
- u_long newint, r, var;
-
- /* stop counter and acknowledge interrupt */
- (void)*DART_REG(DART_CTSTOP);
- (void)*DART_REG(DART_ISR);
-
- /*
- * Compute new randomized interval. The intervals are
- * uniformly distributed on
- * [statint - statvar / 2, statint + statvar / 2],
- * and therefore have mean statint, giving a stathz
- * frequency clock.
- */
- var = statvar;
- do {
- r = random() & (var - 1);
- } while (r == 0);
- newint = statmin + r;
-
- /* setup new value and restart counter */
- *DART_REG(DART_CTUR) = newint >> 8;
- *DART_REG(DART_CTLR) = newint & 0xff;
- (void)*DART_REG(DART_CTSTART);
-
- statclock((struct clockframe *)eframe);
-
-#ifdef MULTIPROCESSOR
- /*
- * Send an IPI to all other processors as well.
- */
- m88k_broadcast_ipi(CI_IPI_STATCLOCK);
-#endif
-
- return (1);
-}
-
-/* Write CIO register */
-void
-write_cio(int reg, u_int val)
-{
- volatile int i;
- volatile u_int32_t *cio_ctrl = (volatile u_int32_t *)CIO_CTRL;
-
- i = *cio_ctrl; /* goto state 1 */
- *cio_ctrl = 0; /* take CIO out of RESET */
- i = *cio_ctrl; /* reset CIO state machine */
-
- *cio_ctrl = (reg & 0xff); /* select register */
- *cio_ctrl = (val & 0xff); /* write the value */
-}
-
-/* Read CIO register */
-u_int
-read_cio(int reg)
-{
- int c;
- volatile int i;
- volatile u_int32_t *cio_ctrl = (volatile u_int32_t *)CIO_CTRL;
-
- /* select register */
- *cio_ctrl = (reg & 0xff);
- /* delay for a short time to allow 8536 to settle */
- for (i = 0; i < 100; i++)
- ;
- /* read the value */
- c = *cio_ctrl;
- return (c & 0xff);
-}
-
-/*
- * Initialize the CTC (8536)
- * Only the counter/timers are used - the IO ports are un-comitted.
- */
-void
-m188_cio_init(u_int period)
-{
- volatile int i;
-
- /* Start by forcing chip into known state */
- read_cio(ZCIO_MIC);
- write_cio(ZCIO_MIC, ZCIO_MIC_RESET); /* Reset the CTC */
- for (i = 0; i < 1000; i++) /* Loop to delay */
- ;
-
- /* Clear reset and start init seq. */
- write_cio(ZCIO_MIC, 0x00);
-
- /* Wait for chip to come ready */
- while ((read_cio(ZCIO_MIC) & ZCIO_MIC_RJA) == 0)
- ;
-
- /* Initialize the 8536 for real */
- write_cio(ZCIO_MIC,
- ZCIO_MIC_MIE /* | ZCIO_MIC_NV */ | ZCIO_MIC_RJA | ZCIO_MIC_DLC);
- write_cio(ZCIO_CT1MD, ZCIO_CTMD_CSC); /* Continuous count */
- write_cio(ZCIO_PBDIR, 0xff); /* set port B to input */
-
- period <<= 1; /* CT#1 runs at PCLK/2, hence 2MHz */
- write_cio(ZCIO_CT1TCM, period >> 8);
- write_cio(ZCIO_CT1TCL, period);
- /* enable counter #1 */
- write_cio(ZCIO_MCC, ZCIO_MCC_CT1E | ZCIO_MCC_PBE);
- write_cio(ZCIO_CT1CS, ZCIO_CTCS_GCB | ZCIO_CTCS_TCB | ZCIO_CTCS_S_IE);
-
- cio_step = period;
- m188_cio_timecounter.tc_frequency = (u_int64_t)cio_step * hz;
-}
-
-u_int
-m188_cio_get_timecount(struct timecounter *tc)
-{
- u_int cmsb, clsb, counter, curcnt;
-
- /*
- * The CIO counter is free running, but by setting the
- * RCC bit in its control register, we can read a frozen
- * value of the counter.
- * The counter will automatically unfreeze after reading
- * its LSB.
- */
-
- mtx_enter(&cio_mutex);
- write_cio(ZCIO_CT1CS, ZCIO_CTCS_GCB | ZCIO_CTCS_RCC);
- cmsb = read_cio(ZCIO_CT1CCM);
- clsb = read_cio(ZCIO_CT1CCL);
- curcnt = cio_refcnt;
-
- counter = (cmsb << 8) | clsb;
-#if 0 /* this will never happen unless the period itself is 65536 */
- if (counter == 0)
- counter = 65536;
-#endif
-
- /*
- * The counter counts down from its initialization value to 1.
- */
- counter = cio_step - counter;
-
- curcnt += counter;
- if (curcnt < cio_lastcnt)
- curcnt += cio_step;
-
- cio_lastcnt = curcnt;
- mtx_leave(&cio_mutex);
- return curcnt;
-}
-
-/*
- * Setup VME bus access and return the lower interrupt number usable by VME
- * boards.
- */
-u_int
-m188_init_vme(const char *devname)
-{
- u_int32_t ucsr;
-
- /*
- * Force a reasonable timeout for VME data transfers.
- * We can not disable this, this would cause autoconf to hang
- * on the first missing device we'll probe.
- */
- ucsr = *(volatile u_int32_t*)MVME188_UCSR;
- ucsr = (ucsr & ~VTOSELBITS) | VTO128US;
- *(volatile u_int32_t *)MVME188_UCSR = ucsr;
-
- return 0; /* all vectors available */
-}
diff --git a/sys/arch/mvme88k/mvme88k/m197_machdep.c b/sys/arch/mvme88k/mvme88k/m197_machdep.c
deleted file mode 100644
index c9757504e54..00000000000
--- a/sys/arch/mvme88k/mvme88k/m197_machdep.c
+++ /dev/null
@@ -1,809 +0,0 @@
-/* $OpenBSD: m197_machdep.c,v 1.49 2014/01/21 23:54:48 jsg Exp $ */
-
-/*
- * Copyright (c) 2009 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-/*
- * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
- * Copyright (c) 1996 Nivas Madhur
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Nivas Madhur.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-/*
- * Mach Operating System
- * Copyright (c) 1993-1991 Carnegie Mellon University
- * Copyright (c) 1991 OMRON Corporation
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/errno.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/asm_macro.h>
-#include <machine/board.h>
-#include <machine/bugio.h>
-#include <machine/cmmu.h>
-#include <machine/cpu.h>
-#include <machine/pmap_table.h>
-#include <machine/reg.h>
-#include <machine/trap.h>
-
-#include <machine/m88410.h>
-#include <machine/mvme197.h>
-
-#include <mvme88k/dev/busswreg.h>
-#include <mvme88k/mvme88k/clockvar.h>
-
-#ifdef MULTIPROCESSOR
-#include <machine/db_machdep.h>
-#endif
-
-extern const struct cmmu_p cmmu88110;
-extern const struct cmmu_p cmmu88410;
-
-const struct pmap_table m197_pmap_table[] = {
- /* We need flash 1:1 mapped to access the 88410 chip underneath */
- { FLASH_START, FLASH_SIZE, UVM_PROT_RW, CACHE_INH },
- { OBIO197_START, OBIO197_SIZE, UVM_PROT_RW, CACHE_INH },
- /* No need to mention BUG here - it is contained inside OBIO */
- { 0, 0xffffffff, 0, 0 },
-};
-
-extern void m1x7_reboot(int);
-
-const struct board board_mvme197le = {
- .bootstrap = m197_bootstrap,
- .memsize = m197_memsize,
- .cpuspeed = m197_cpuspeed,
- .reboot = m1x7_reboot,
- .is_syscon = m1x7_is_syscon,
- .intr = m197_intr,
- .nmi = m197_nmi,
- .nmi_wrapup = m197_nmi_wrapup,
- .getipl = m197_getipl,
- .setipl = m197_setipl,
- .raiseipl = m197_raiseipl,
- .intsrc_available = m1x7_intsrc_available,
- .intsrc_enable = m1x7_intsrc_enable,
- .intsrc_disable = NULL,
- .intsrc_establish = NULL,
- .intsrc_disestablish = NULL,
- .init_clocks = m1x7_init_clocks,
- .delay = m1x7_delay,
- .init_vme = m1x7_init_vme,
-#ifdef MULTIPROCESSOR
- .send_ipi = m197_send_ipi,
- .smp_setup = m197_smp_setup,
-#endif
- .ptable = m197_pmap_table,
- .cmmu = &cmmu88110
-};
-
-void m197spdp_bootstrap(void);
-
-const struct board board_mvme197spdp = {
- .bootstrap = m197spdp_bootstrap,
- .memsize = m197_memsize,
- .cpuspeed = m197_cpuspeed,
- .reboot = m1x7_reboot,
- .is_syscon = m1x7_is_syscon,
- .intr = m197_intr,
- .nmi = m197_nmi,
- .nmi_wrapup = m197_nmi_wrapup,
- .getipl = m197_getipl,
- .setipl = m197_setipl,
- .raiseipl = m197_raiseipl,
- .intsrc_available = m1x7_intsrc_available,
- .intsrc_enable = m1x7_intsrc_enable,
- .intsrc_disable = NULL,
- .intsrc_establish = NULL,
- .intsrc_disestablish = NULL,
- .init_clocks = m1x7_init_clocks,
-#ifdef MULTIPROCESSOR
- .delay = m197_delay,
-#else
- .delay = m1x7_delay,
-#endif
- .init_vme = m1x7_init_vme,
-#ifdef MULTIPROCESSOR
- .send_ipi = m197_send_ipi,
- .smp_setup = m197_smp_setup,
-#endif
- .ptable = m197_pmap_table,
- .cmmu = &cmmu88410
-};
-
-int m197_ipi_handler(struct trapframe *);
-uint32_t m197_mp_atomic_begin(__cpu_simple_lock_t *, uint *);
-void m197_mp_atomic_end(uint32_t, __cpu_simple_lock_t *, uint);
-void m197_soft_ipi(void);
-
-void
-m197_bootstrap()
-{
- u_int8_t version, btimer, pbt;
-
- /*
- * Kernels running without snooping enabled (i.e. without
- * CACHE_GLOBAL set in the apr in pmap.c) need increased processor
- * bus timeout limits, or the instruction cache might not be able
- * to fill or answer fast enough. It does not hurt to increase
- * them unconditionnaly, though.
- *
- * Do this as soon as possible (i.e. now...), since this is
- * especially critical on 40MHz boards, while some 50MHz boards can
- * run without this timeout change... but better be safe than sorry.
- *
- * Boot blocks do this for us now, but again, better stay on the
- * safe side. Be sure to update the boot blocks code if the logic
- * below changes.
- */
- version = *(volatile u_int8_t *)(BS_BASE + BS_CHIPREV);
- btimer = *(volatile u_int8_t *)(BS_BASE + BS_BTIMER);
- pbt = btimer & BS_BTIMER_PBT_MASK;
- btimer &= ~BS_BTIMER_PBT_MASK;
-
- /* XXX PBT256 might only be necessary for busswitch rev1? */
- if (m197_cpuspeed(NULL) < 50 || version <= 0x01) {
- if (pbt < BS_BTIMER_PBT256)
- pbt = BS_BTIMER_PBT256;
- } else {
- if (pbt < BS_BTIMER_PBT64)
- pbt = BS_BTIMER_PBT64;
- }
-
- *(volatile u_int8_t *)(BS_BASE + BS_BTIMER) = btimer | pbt;
-}
-
-void
-m197spdp_bootstrap()
-{
- u_int16_t cpu;
-
- /*
- * Make sure all interrupts (levels 1 to 7) get routed to the boot cpu.
- *
- * We only need to write to one ISEL registers, this will set the
- * correct value in the other one, since we set all the active bits.
- */
- cpu = *(u_int16_t *)(BS_BASE + BS_GCSR) & BS_GCSR_CPUID;
- *(u_int8_t *)(BS_BASE + (cpu ? BS_ISEL1 : BS_ISEL0)) = 0xfe;
-
- m197_bootstrap();
-}
-
-/*
- * Figure out how much real memory is available.
- *
- * This relies on the fact that the BUG will configure the BusSwitch
- * system translation decoders to allow access to the whole memory
- * from address zero.
- *
- * If the BUG is not configured correctly wrt to the real amount of
- * memory in the system, this will return incorrect values, but we do
- * not care if you can't configure your system correctly.
- */
-vaddr_t
-m197_memsize()
-{
- int i;
- u_int8_t sar;
- u_int16_t ssar, sear;
- struct mvmeprom_brdid brdid;
-
- /*
- * MVME197LE 01-W3869B0[12][EF] boards shipped with a broken DCAM2
- * chip, which can only address 32MB of memory. Unfortunately, 02[EF]
- * were fitted with 64MB...
- * Note that we can't decide on letter < F since this would match
- * post-Z boards (AA, AB, etc).
- *
- * If the CNFG memory has been lost, you're on your own...
- */
- bzero(&brdid, sizeof(brdid));
- bugbrdid(&brdid);
- if (bcmp(brdid.pwa, "01-W3869B02", 11) == 0) {
- if (brdid.pwa[11] == 'E' || brdid.pwa[11] == 'F')
- return (32 * 1024 * 1024);
- }
-
- for (i = 0; i < 4; i++) {
- sar = *(u_int8_t *)(BS_BASE + BS_SAR + i);
- if (!ISSET(sar, BS_SAR_DEN))
- continue;
-
- ssar = *(u_int16_t *)(BS_BASE + BS_SSAR1 + i * 4);
- sear = *(u_int16_t *)(BS_BASE + BS_SEAR1 + i * 4);
-
- if (ssar != 0)
- continue;
-
- return ((sear + 1) << 16);
- }
-
- /*
- * If no decoder was enabled, how could we run so far?
- * Return a ``safe'' 32MB.
- */
- return (32 * 1024 * 1024);
-}
-
-/*
- * Return the processor speed in MHz.
- */
-int
-m197_cpuspeed(const struct mvmeprom_brdid *brdid)
-{
- /*
- * Find out the processor speed, from the BusSwitch prescaler
- * adjust register.
- */
- return 256 - *(volatile u_int8_t *)(BS_BASE + BS_PADJUST);
-}
-
-/*
- * Device interrupt handler for MVME197
- */
-void
-m197_intr(struct trapframe *eframe)
-{
- u_int32_t psr;
- int level;
- struct intrhand *intr;
- intrhand_t *list;
- int ret;
- vaddr_t ivec;
- u_int8_t vec;
-
-#ifdef MULTIPROCESSOR
- if (eframe->tf_mask < IPL_SCHED)
- __mp_lock(&kernel_lock);
-#endif
-
- uvmexp.intrs++;
-
- level = *(u_int8_t *)M197_ILEVEL & 0x07;
- /* generate IACK and get the vector */
- ivec = M197_IACK + (level << 2) + 0x03;
- vec = *(volatile u_int8_t *)ivec;
-
- /* block interrupts at level or lower */
- m197_setipl(level);
- psr = get_psr();
- set_psr(psr & ~PSR_IND);
-
- list = &intr_handlers[vec];
- if (SLIST_EMPTY(list))
- printf("Spurious interrupt (level %x and vec %x)\n",
- level, vec);
-
- /*
- * Walk through all interrupt handlers in the chain for the
- * given vector, calling each handler in turn, till some handler
- * returns a value != 0.
- */
-
- ret = 0;
- SLIST_FOREACH(intr, list, ih_link) {
- if (intr->ih_wantframe != 0)
- ret = (*intr->ih_fn)((void *)eframe);
- else
- ret = (*intr->ih_fn)(intr->ih_arg);
- if (ret != 0) {
- intr->ih_count.ec_count++;
- break;
- }
- }
-
- if (ret == 0) {
- printf("Unclaimed interrupt (level %x and vec %x)\n",
- level, vec);
- }
-
-#if 0
- /*
- * Disable interrupts before returning to assembler,
- * the spl will be restored later.
- */
- set_psr(psr | PSR_IND);
-#endif
-
-#ifdef MULTIPROCESSOR
- if (eframe->tf_mask < IPL_SCHED)
- __mp_unlock(&kernel_lock);
-#endif
-}
-
-/*
- * NMI handler. Invoked with interrupts disabled.
- * Returns nonzero if NMI have been reenabled, and the exception handler
- * is allowed to run soft interrupts and AST; nonzero otherwise.
- */
-int
-m197_nmi(struct trapframe *eframe)
-{
- u_int8_t abort;
- int rc;
-
- /*
- * Non-maskable interrupts are either the abort switch (on
- * cpu0 only) or IPIs (on any cpu). We check for IPI first.
- */
-#ifdef MULTIPROCESSOR
- if ((*(volatile u_int8_t *)(BS_BASE + BS_CPINT)) & BS_CPI_INT) {
- /* disable further NMI for now */
- *(volatile u_int8_t *)(BS_BASE + BS_CPINT) = 0;
-
- rc = m197_ipi_handler(eframe);
-
- /* acknowledge */
- *(volatile u_int8_t *)(BS_BASE + BS_CPINT) = BS_CPI_ICLR;
-
- if (rc != 0)
- m197_nmi_wrapup(eframe);
- } else
-#endif
- rc = 1;
-
- if (CPU_IS_PRIMARY(curcpu())) {
- abort = *(u_int8_t *)(BS_BASE + BS_ABORT);
- if (abort & BS_ABORT_INT) {
- *(u_int8_t *)(BS_BASE + BS_ABORT) =
- (abort & ~BS_ABORT_IEN) | BS_ABORT_ICLR;
- nmihand(eframe);
- *(u_int8_t *)(BS_BASE + BS_ABORT) |= BS_ABORT_IEN;
- }
- }
-
- return rc;
-}
-
-void
-m197_nmi_wrapup(struct trapframe *eframe)
-{
-#ifdef MULTIPROCESSOR
- /* reenable IPIs */
- *(volatile u_int8_t *)(BS_BASE + BS_CPINT) = BS_CPI_IEN;
-#endif
-}
-
-u_int
-m197_getipl(void)
-{
- return *(u_int8_t *)M197_IMASK & 0x07;
-}
-
-u_int
-m197_setipl(u_int level)
-{
- u_int curspl, psr;
-
- psr = get_psr();
- set_psr(psr | PSR_IND);
- curspl = *(u_int8_t *)M197_IMASK & 0x07;
- *(u_int8_t *)M197_IMASK = level;
- /*
- * We do not flush the pipeline here, because interrupts are disabled,
- * and set_psr() will synchronize the pipeline.
- */
- set_psr(psr);
- return curspl;
-}
-
-u_int
-m197_raiseipl(u_int level)
-{
- u_int curspl, psr;
-
- psr = get_psr();
- set_psr(psr | PSR_IND);
- curspl = *(u_int8_t *)M197_IMASK & 0x07;
- if (curspl < level)
- *(u_int8_t *)M197_IMASK = level;
- /*
- * We do not flush the pipeline here, because interrupts are disabled,
- * and set_psr() will synchronize the pipeline.
- */
- set_psr(psr);
- return curspl;
-}
-
-#ifdef MULTIPROCESSOR
-
-/*
- * IPIs groups.
- *
- * There are three sorts of IPI on MVME197:
- *
- * - synchronous IPIs: TLB and cache operations
- *
- * Those require immediate attention from the other processor, and the
- * sender will wait for completion before resuming normal operations.
- * This is done for so-called complex IPIs (those which take arguments),
- * so that it isn't necessary to maintain a list of pending IPI work.
- * However it is better to make tlb updates synchronous as well.
- *
- * Handling of synchronous exceptions makes sure they can not be
- * interrupted by another NMI; upon returning from the exception,
- * the interrupted processor will not attempt to run soft interrupts
- * and will not check for AST.
- *
- * - asynchronous fast IPIs: notify, ddb
- *
- * Notify is just a trick to get the other processor to check for
- * AST, it is processed almost immediately, but since it may cause
- * preemption, the sender can not really wait for completion.
- * As for DDB, waiting would interfere with ddb's logic.
- *
- * - asynchronous slow IPIs: clock
- *
- * These may take a long time to execute. They cause the processor
- * to self-inflict itself a soft interrupt, to make sure we won't
- * run clock operations if it was running at splclock or higher when
- * the IPI was received.
- */
-
-#define CI_IPI_CLOCK \
- (CI_IPI_HARDCLOCK | CI_IPI_STATCLOCK)
-#define CI_IPI_SYNCHRONOUS \
- (CI_IPI_TLB_FLUSH_KERNEL | CI_IPI_TLB_FLUSH_USER | \
- CI_IPI_CACHE_FLUSH | CI_IPI_ICACHE_FLUSH | CI_IPI_DMA_CACHECTL)
-
-void
-m197_send_ipi(int ipi, cpuid_t cpu)
-{
- struct cpu_info *ci = &m88k_cpus[cpu];
-
- KASSERT((ipi & CI_IPI_SYNCHRONOUS) == 0);
-
- if ((ci->ci_flags & CIF_ALIVE) == 0)
- return; /* XXX not ready yet */
-
- if (ci->ci_ddb_state == CI_DDB_PAUSE)
- return; /* XXX skirting deadlock */
-
- atomic_setbits_int(&ci->ci_ipi, ipi);
- *(volatile u_int8_t *)(BS_BASE + BS_CPINT) |= BS_CPI_SCPI;
-}
-
-void
-m197_send_complex_ipi(int ipi, cpuid_t cpu, u_int32_t arg1, u_int32_t arg2)
-{
- struct cpu_info *ci = &m88k_cpus[cpu];
- uint32_t psr;
- int wait;
-
- if ((ci->ci_flags & CIF_ALIVE) == 0)
- return; /* XXX not ready yet */
-
- if (ci->ci_ddb_state == CI_DDB_PAUSE)
- return; /* XXX skirting deadlock */
-
- psr = get_psr();
- set_psr(psr | PSR_IND);
-
- /*
- * Wait for the other processor to be ready to accept an IPI.
- */
- for (wait = 1000000; wait != 0; wait--) {
- if (!ISSET(*(volatile u_int8_t *)(BS_BASE + BS_CPINT),
- BS_CPI_STAT))
- break;
- }
- if (wait == 0)
- panic("couldn't send complex ipi %x to cpu %d: busy",
- ipi, cpu);
-
-#ifdef DEBUG
- if (ci->ci_ipi != 0)
- printf("%s: cpu %d ipi %x did not clear during wait\n",
- __func__, ci->ci_cpuid, ci->ci_ipi);
-#endif
-
- /*
- * In addition to the ipi bit itself, we need to set up ipi arguments.
- * Note that we do not need to protect against another processor
- * trying to send another complex IPI, since we know there are only
- * two processors on the board. This is also why we do not use atomic
- * operations on ci_ipi there, since we know from the loop above that
- * the other process is done doing any IPI work.
- */
- ci->ci_ipi_arg1 = arg1;
- ci->ci_ipi_arg2 = arg2;
- ci->ci_ipi |= ipi;
-
- *(volatile u_int8_t *)(BS_BASE + BS_CPINT) |= BS_CPI_SCPI;
-
- /*
- * Wait for the other processor to complete ipi processing.
- */
- for (wait = 1000000; wait != 0; wait--) {
- if (!ISSET(*(volatile u_int8_t *)(BS_BASE + BS_CPINT),
- BS_CPI_STAT))
- break;
- }
- if (wait == 0)
- panic("couldn't send complex ipi %x to cpu %d: no ack",
- ipi, cpu);
-
-#ifdef DEBUG
- /*
- * If there are any simple IPIs pending, trigger them now.
- * There really shouldn't any, since we have waited for all
- * asynchronous ipi processing to complete before sending this
- * one.
- */
- if (ci->ci_ipi != 0) {
- printf("%s: cpu %d ipi %x did not clear after completion\n",
- __func__, ci->ci_cpuid, ci->ci_ipi);
- *(volatile u_int8_t *)(BS_BASE + BS_CPINT) |= BS_CPI_SCPI;
- }
-#endif
-
- set_psr(psr);
-}
-void
-m197_broadcast_complex_ipi(int ipi, u_int32_t arg1, u_int32_t arg2)
-{
- /*
- * This relies upon the fact that we only have two processors,
- * and their cpuid are 0 and 1.
- */
- m197_send_complex_ipi(ipi, 1 - curcpu()->ci_cpuid, arg1, arg2);
-}
-
-int
-m197_ipi_handler(struct trapframe *eframe)
-{
- struct cpu_info *ci = curcpu();
- int ipi;
- u_int32_t arg1, arg2;
-
- if ((ipi = atomic_clear_int(&ci->ci_ipi)) == 0)
- return 1;
-
- /*
- * Synchronous IPIs. There can only be one pending at the same time,
- * sending processor will wait for us to have processed the current
- * one before sending a new one.
- * We process them ASAP, ignoring any other pending ipi - sender will
- * take care of resending an ipi if necessary.
- */
- if (ipi & CI_IPI_SYNCHRONOUS) {
- /* no need to use atomic ops, the other cpu waits */
- /* leave asynchronous ipi pending */
- ci->ci_ipi = ipi & ~CI_IPI_SYNCHRONOUS;
-
- arg1 = ci->ci_ipi_arg1;
- arg2 = ci->ci_ipi_arg2;
-
- if (ipi & CI_IPI_TLB_FLUSH_KERNEL) {
- cmmu_tlbis(ci->ci_cpuid, arg1, arg2);
- }
- else if (ipi & CI_IPI_TLB_FLUSH_USER) {
- cmmu_tlbiu(ci->ci_cpuid, arg1, arg2);
- }
- else if (ipi & CI_IPI_CACHE_FLUSH) {
- cmmu_cache_wbinv(ci->ci_cpuid, arg1, arg2);
- }
- else if (ipi & CI_IPI_ICACHE_FLUSH) {
- cmmu_icache_inv(ci->ci_cpuid, arg1, arg2);
- }
- else if (ipi & CI_IPI_DMA_CACHECTL) {
- dma_cachectl_local(arg1, arg2, DMA_CACHE_INV);
- }
-
- return 0;
- }
-
- /*
- * Asynchronous IPIs. We can have as many bits set as possible.
- */
-
- if (ipi & CI_IPI_CLOCK) {
- /*
- * Even if the current spl level would allow it, we can
- * not run the clock handlers from there because we would
- * need to grab the kernel lock, which might already
- * held by the other processor.
- *
- * Instead, schedule a soft interrupt. But remember the
- * important fields from the exception frame first, so
- * that a valid clockframe can be reconstructed from the
- * soft interrupt handler (which can not get an exception
- * frame).
- */
- if (ipi & CI_IPI_HARDCLOCK) {
- ci->ci_h_sxip = eframe->tf_sxip;
- ci->ci_h_epsr = eframe->tf_epsr;
- }
- if (ipi & CI_IPI_STATCLOCK) {
- ci->ci_s_sxip = eframe->tf_sxip;
- ci->ci_s_epsr = eframe->tf_epsr;
- }
-
- /* inflict ourselves a soft ipi */
- ci->ci_softipi_cb = m197_soft_ipi;
- }
-
- if (ipi & CI_IPI_DDB) {
-#ifdef DDB
- /*
- * Another processor has entered DDB. Spin on the ddb lock
- * until it is done.
- */
- extern struct __mp_lock ddb_mp_lock;
-
- ci->ci_ddb_state = CI_DDB_PAUSE;
-
- __mp_lock(&ddb_mp_lock);
- __mp_unlock(&ddb_mp_lock);
-
- ci->ci_ddb_state = CI_DDB_RUNNING;
-
- /*
- * If ddb is hoping to us, it's our turn to enter ddb now.
- */
- if (ci->ci_cpuid == ddb_mp_nextcpu)
- Debugger();
-#endif
- }
- if (ipi & CI_IPI_NOTIFY) {
- /* nothing to do! */
- }
-
- return 1;
-}
-
-/*
- * Maskable IPIs.
- *
- * These IPIs are received as non maskable, but are not processed in
- * the NMI handler; instead, they are processed from the soft interrupt
- * handler.
- *
- * XXX This is grossly suboptimal.
- */
-void
-m197_soft_ipi()
-{
- struct cpu_info *ci = curcpu();
- struct trapframe faketf;
- int s;
-
- __mp_lock(&kernel_lock);
- s = splclock();
-
- if (ci->ci_h_sxip != 0) {
- faketf.tf_cpu = ci;
- faketf.tf_sxip = ci->ci_h_sxip;
- faketf.tf_epsr = ci->ci_h_epsr;
- ci->ci_h_sxip = 0;
- hardclock((struct clockframe *)&faketf);
- }
-
- if (ci->ci_s_sxip != 0) {
- faketf.tf_cpu = ci;
- faketf.tf_sxip = ci->ci_s_sxip;
- faketf.tf_epsr = ci->ci_s_epsr;
- ci->ci_s_sxip = 0;
- statclock((struct clockframe *)&faketf);
- }
-
- splx(s);
- __mp_unlock(&kernel_lock);
-}
-
-/*
- * Special version of delay() for MP kernels.
- * Processors need to use different timers, so we'll use the two
- * BusSwitch timers for this purpose.
- */
-void
-m197_delay(int us)
-{
- if (CPU_IS_PRIMARY(curcpu())) {
- *(volatile u_int32_t *)(BS_BASE + BS_TCOMP1) = 0xffffffff;
- *(volatile u_int32_t *)(BS_BASE + BS_TCOUNT1) = 0;
- *(volatile u_int8_t *)(BS_BASE + BS_TCTRL1) |= BS_TCTRL_CEN;
-
- while ((*(volatile u_int32_t *)(BS_BASE + BS_TCOUNT1)) <
- (u_int32_t)us)
- ;
- *(volatile u_int8_t *)(BS_BASE + BS_TCTRL1) &= ~BS_TCTRL_CEN;
- } else {
- *(volatile u_int32_t *)(BS_BASE + BS_TCOMP2) = 0xffffffff;
- *(volatile u_int32_t *)(BS_BASE + BS_TCOUNT2) = 0;
- *(volatile u_int8_t *)(BS_BASE + BS_TCTRL2) |= BS_TCTRL_CEN;
-
- while ((*(volatile u_int32_t *)(BS_BASE + BS_TCOUNT2)) <
- (u_int32_t)us)
- ;
- *(volatile u_int8_t *)(BS_BASE + BS_TCTRL2) &= ~BS_TCTRL_CEN;
- }
-}
-
-void
-m197_smp_setup(struct cpu_info *ci)
-{
- /*
- * Setup function pointers for mplock operation.
- */
- ci->ci_mp_atomic_begin = m197_mp_atomic_begin;
- ci->ci_mp_atomic_end = m197_mp_atomic_end;
-}
-
-uint32_t
-m197_mp_atomic_begin(__cpu_simple_lock_t *lock, uint *csr)
-{
- uint32_t psr;
-
- psr = get_psr();
- set_psr(psr | PSR_IND);
-
- *csr = *(volatile uint8_t *)(BS_BASE + BS_CPINT);
- *(volatile uint8_t *)(BS_BASE + BS_CPINT) = 0;
-
- __cpu_simple_lock(lock);
-
- return psr;
-}
-
-void
-m197_mp_atomic_end(uint32_t psr, __cpu_simple_lock_t *lock, uint csr)
-{
- __cpu_simple_unlock(lock);
-
- *(volatile uint8_t *)(BS_BASE + BS_CPINT) = csr & BS_CPI_IEN;
-
- set_psr(psr);
-}
-#endif /* MULTIPROCESSOR */
diff --git a/sys/arch/mvme88k/mvme88k/m1x7_machdep.c b/sys/arch/mvme88k/mvme88k/m1x7_machdep.c
deleted file mode 100644
index e4e297c03fe..00000000000
--- a/sys/arch/mvme88k/mvme88k/m1x7_machdep.c
+++ /dev/null
@@ -1,488 +0,0 @@
-/* $OpenBSD: m1x7_machdep.c,v 1.11 2013/05/17 22:46:28 miod Exp $ */
-/*
- * Copyright (c) 2009, 2013 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-/*
- * Copyright (c) 1999 Steve Murphree, Jr.
- * Copyright (c) 1995 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- * Copyright (c) 1995 Nivas Madhur
- * Copyright (c) 1994 Gordon W. Ross
- * Copyright (c) 1993 Adam Glass
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)clock.c 8.1 (Berkeley) 6/11/93
- */
-
-/*
- * PCC 2 interval and statistic clocks driver, and reboot routine.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/kernel.h>
-#include <sys/mutex.h>
-#include <sys/timetc.h>
-
-#include <machine/board.h>
-#include <machine/bus.h>
-
-#include <mvme88k/dev/pcctwovar.h>
-#include <mvme88k/dev/pcctworeg.h>
-#include <mvme88k/dev/vme.h>
-
-#include <mvme88k/mvme88k/clockvar.h>
-
-int m1x7_clockintr(void *);
-int m1x7_statintr(void *);
-u_int pcc_get_timecount(struct timecounter *);
-
-uint32_t pcc_refcnt;
-struct mutex pcc_mutex = MUTEX_INITIALIZER(IPL_CLOCK);
-
-struct timecounter pcc_timecounter = {
- pcc_get_timecount,
- NULL,
- 0xffffffff,
- 1000000, /* 1MHz */
- "pcctwo",
- 0,
- NULL
-};
-
-#define PROF_RESET (IPL_CLOCK | PCC2_IRQ_IEN | PCC2_IRQ_ICLR)
-#define STAT_RESET (IPL_STATCLOCK | PCC2_IRQ_IEN | PCC2_IRQ_ICLR)
-
-void
-m1x7_init_clocks(void)
-{
- int statint, minint;
-
-#ifdef DIAGNOSTIC
- if (1000000 % hz) {
- printf("cannot get %d Hz clock; using 100 Hz\n", hz);
- hz = 100;
- }
-#endif
- tick = 1000000 / hz;
-
- /* profclock */
- *(volatile u_int8_t *)(PCC2_BASE + PCCTWO_T1CTL) = 0;
- *(volatile u_int32_t *)(PCC2_BASE + PCCTWO_T1CMP) =
- pcc2_timer_us2lim(tick);
- *(volatile u_int32_t *)(PCC2_BASE + PCCTWO_T1COUNT) = 0;
- *(volatile u_int8_t *)(PCC2_BASE + PCCTWO_T1CTL) =
- PCC2_TCTL_CEN | PCC2_TCTL_COC | PCC2_TCTL_COVF;
- *(volatile u_int8_t *)(PCC2_BASE + PCCTWO_T1ICR) = PROF_RESET;
-
- if (stathz == 0)
- stathz = hz;
-#ifdef DIAGNOSTIC
- if (1000000 % stathz) {
- printf("cannot get %d Hz statclock; using 100 Hz\n", stathz);
- stathz = 100;
- }
-#endif
- profhz = stathz; /* always */
-
- statint = 1000000 / stathz;
- minint = statint / 2 + 100;
- while (statvar > minint)
- statvar >>= 1;
-
- /* statclock */
- *(volatile u_int8_t *)(PCC2_BASE + PCCTWO_T2CTL) = 0;
- *(volatile u_int32_t *)(PCC2_BASE + PCCTWO_T2CMP) =
- pcc2_timer_us2lim(statint);
- *(volatile u_int32_t *)(PCC2_BASE + PCCTWO_T2COUNT) = 0;
- *(volatile u_int8_t *)(PCC2_BASE + PCCTWO_T2CTL) =
- PCC2_TCTL_CEN | PCC2_TCTL_COC | PCC2_TCTL_COVF;
- *(volatile u_int8_t *)(PCC2_BASE + PCCTWO_T2ICR) = STAT_RESET;
-
- statmin = statint - (statvar >> 1);
-
- clock_ih.ih_fn = m1x7_clockintr;
- clock_ih.ih_arg = 0;
- clock_ih.ih_wantframe = 1;
- clock_ih.ih_ipl = IPL_CLOCK;
- pcctwointr_establish(PCC2V_TIMER1, &clock_ih, "clock");
-
- statclock_ih.ih_fn = m1x7_statintr;
- statclock_ih.ih_arg = 0;
- statclock_ih.ih_wantframe = 1;
- statclock_ih.ih_ipl = IPL_STATCLOCK;
- pcctwointr_establish(PCC2V_TIMER2, &statclock_ih, "stat");
-
- tc_init(&pcc_timecounter);
-}
-
-/*
- * clockintr: ack intr and call hardclock
- */
-int
-m1x7_clockintr(void *eframe)
-{
- uint oflow;
- uint32_t t1, t2;
- uint8_t c;
-
- /*
- * Since we can not freeze the counter while reading the count
- * and overflow registers, read them a second time; if the
- * counter has wrapped, pick the second reading.
- */
- mtx_enter(&pcc_mutex);
- t1 = *(volatile uint32_t *)(PCC2_BASE + PCCTWO_T1COUNT);
- c = *(volatile u_int8_t *)(PCC2_BASE + PCCTWO_T1CTL);
- t2 = *(volatile uint32_t *)(PCC2_BASE + PCCTWO_T1COUNT);
- if (t2 < t1)
- c = *(volatile u_int8_t *)(PCC2_BASE + PCCTWO_T1CTL);
- *(volatile u_int8_t *)(PCC2_BASE + PCCTWO_T1CTL) =
- PCC2_TCTL_CEN | PCC2_TCTL_COC | PCC2_TCTL_COVF;
- *(volatile u_int8_t *)(PCC2_BASE + PCCTWO_T1ICR) = PROF_RESET;
- oflow = c >> PCC2_TCTL_OVF_SHIFT;
- pcc_refcnt += oflow * tick;
- mtx_leave(&pcc_mutex);
-
- while (oflow-- != 0) {
- hardclock(eframe);
-
-#ifdef MULTIPROCESSOR
- /*
- * Send an IPI to all other processors, so they can get their
- * own ticks.
- */
- m88k_broadcast_ipi(CI_IPI_HARDCLOCK);
-#endif
- }
-
- return (1);
-}
-
-u_int
-pcc_get_timecount(struct timecounter *tc)
-{
- uint32_t tcr1, tcr2;
- uint8_t tctl;
- uint cnt, oflow;
-
- mtx_enter(&pcc_mutex);
- tcr1 = *(volatile u_int32_t *)(PCC2_BASE + PCCTWO_T1COUNT);
- tctl = *(volatile u_int8_t *)(PCC2_BASE + PCCTWO_T1CTL);
- /*
- * Since we can not freeze the counter while reading the count
- * and overflow registers, read it a second time; if it the
- * counter has wrapped, pick the second reading.
- */
- tcr2 = *(volatile u_int32_t *)(PCC2_BASE + PCCTWO_T1COUNT);
- if (tcr2 < tcr1) {
- tcr1 = tcr2;
- tctl = *(volatile u_int8_t *)(PCC2_BASE + PCCTWO_T1CTL);
- }
- cnt = pcc_refcnt;
- mtx_leave(&pcc_mutex);
-
- oflow = tctl >> PCC2_TCTL_OVF_SHIFT;
- while (oflow-- != 0)
- cnt += pcc2_timer_us2lim(tick);
- return cnt + tcr1;
-}
-
-int
-m1x7_statintr(void *eframe)
-{
- u_long newint, r, var;
-
- *(volatile u_int8_t *)(PCC2_BASE + PCCTWO_T2ICR) = STAT_RESET;
-
- /*
- * Compute new randomized interval. The intervals are uniformly
- * distributed on [statint - statvar / 2, statint + statvar / 2],
- * and therefore have mean statint, giving a stathz frequency clock.
- */
- var = statvar;
- do {
- r = random() & (var - 1);
- } while (r == 0);
- newint = statmin + r;
-
- *(volatile u_int8_t *)(PCC2_BASE + PCCTWO_T2CTL) = 0;
- *(volatile u_int32_t *)(PCC2_BASE + PCCTWO_T2CMP) =
- pcc2_timer_us2lim(newint);
- *(volatile u_int32_t *)(PCC2_BASE + PCCTWO_T2COUNT) = 0;
- *(volatile u_int8_t *)(PCC2_BASE + PCCTWO_T2ICR) = STAT_RESET;
- *(volatile u_int8_t *)(PCC2_BASE + PCCTWO_T2CTL) =
- PCC2_TCTL_CEN | PCC2_TCTL_COC;
-
- statclock((struct clockframe *)eframe);
-
-#ifdef MULTIPROCESSOR
- /*
- * Send an IPI to all other processors as well.
- */
- m88k_broadcast_ipi(CI_IPI_STATCLOCK);
-#endif
-
- return (1);
-}
-
-void
-m1x7_delay(int us)
-{
- /*
- * On MVME187 and MVME197, use the VMEchip for the delay clock.
- */
- *(volatile u_int32_t *)(VME2_BASE + VME2_T1CMP) = 0xffffffff;
- *(volatile u_int32_t *)(VME2_BASE + VME2_T1COUNT) = 0;
- *(volatile u_int32_t *)(VME2_BASE + VME2_TCTL) |= VME2_TCTL1_CEN;
-
- while ((*(volatile u_int32_t *)(VME2_BASE + VME2_T1COUNT)) <
- (u_int32_t)us)
- ;
- *(volatile u_int32_t *)(VME2_BASE + VME2_TCTL) &= ~VME2_TCTL1_CEN;
-}
-
-/*
- * Reboot the system.
- */
-void
-m1x7_reboot(int howto)
-{
-#ifdef MVME197
- int i;
-#endif
-
- /*
- * Try hitting the SRST bit in VMEChip2 to reset the system.
- */
- if (*(volatile u_int32_t *)(VME2_BASE + VME2_TCTL) & VME2_TCTL_SCON)
- *(volatile u_int32_t *)(VME2_BASE + VME2_TCTL) |=
- VME2_TCTL_SRST;
-
-#ifdef MVME197
- /*
- * MVME197LE Errata #7:
- * ``When asserting the RST bit in the VMEchip2 GCSR, the pulse
- * generated is too short for the BusSwitch1 to recognize
- * properly.''
- */
- for (i = 0x20000000; i != 0; i--)
-#endif
- *(volatile u_int32_t *)(VME2_BASE + VME2_GCSR_LM_SIG_BSCR) |=
- VME2_GCSR_RST;
-}
-
-/*
- * Return whether we are the VME bus system controller.
- */
-int
-m1x7_is_syscon()
-{
- return ISSET(*(volatile u_int32_t *)(VME2_BASE + VME2_TCTL),
- VME2_TCTL_SCON);
-}
-
-int vme2abort(void *);
-struct intrhand vme2_abih;
-
-/*
- * Setup VME bus access and return the lower interrupt number usable by VME
- * boards.
- */
-u_int
-m1x7_init_vme(const char *devname)
-{
- u_int32_t vbr, ctl, irqen, master, master4mod;
- u_int vecbase;
-
- vbr = *(volatile u_int32_t *)(VME2_BASE + VME2_VBR);
- vecbase = VME2_GET_VBR1(vbr) + 0x10;
- /* Sanity check that the BUG is set up right */
- if (vecbase >= 0x100) {
- panic("Correct the VME Vector Base Register values "
- "in the BUG settings.\n"
- "Suggested values are 0x60 for VME Vec0 and "
- "0x70 for VME Vec1.");
- }
-
- /* turn off SYSFAIL LED */
- *(volatile u_int32_t *)(VME2_BASE + VME2_TCTL) &= ~VME2_TCTL_SYSFAIL;
-
- /*
- * Display the VMEChip2 decoder status.
- */
- printf("%s: using BUG parameters\n", devname);
- ctl = *(volatile u_int32_t *)(VME2_BASE + VME2_GCSRCTL);
- if (ctl & VME2_GCSRCTL_MDEN1) {
- master = *(volatile u_int32_t *)(VME2_BASE + VME2_MASTER1);
- printf("%s: 1phys 0x%08lx-0x%08lx to VME 0x%08lx-0x%08lx\n",
- devname, master << 16, master & 0xffff0000,
- master << 16, master & 0xffff0000);
- }
- if (ctl & VME2_GCSRCTL_MDEN2) {
- master = *(volatile u_int32_t *)(VME2_BASE + VME2_MASTER2);
- printf("%s: 2phys 0x%08lx-0x%08lx to VME 0x%08lx-0x%08lx\n",
- devname, master << 16, master & 0xffff0000,
- master << 16, master & 0xffff0000);
- }
- if (ctl & VME2_GCSRCTL_MDEN3) {
- master = *(volatile u_int32_t *)(VME2_BASE + VME2_MASTER3);
- printf("%s: 3phys 0x%08lx-0x%08lx to VME 0x%08lx-0x%08lx\n",
- devname, master << 16, master & 0xffff0000,
- master << 16, master & 0xffff0000);
- }
- if (ctl & VME2_GCSRCTL_MDEN4) {
- master = *(volatile u_int32_t *)(VME2_BASE + VME2_MASTER4);
- master4mod =
- *(volatile u_int32_t *)(VME2_BASE + VME2_MASTER4MOD);
- printf("%s: 4phys 0x%08lx-0x%08lx to VME 0x%08lx-0x%08lx\n",
- devname, master << 16, master & 0xffff0000,
- (master << 16) + (master4mod << 16),
- (master & 0xffff0000) + (master4mod & 0xffff0000));
- }
-
- /*
- * Map the VME irq levels to the cpu levels 1:1.
- * This is rather inflexible, but much easier.
- */
- *(volatile u_int32_t *)(VME2_BASE + VME2_IRQL4) =
- (7 << VME2_IRQL4_VME7SHIFT) | (6 << VME2_IRQL4_VME6SHIFT) |
- (5 << VME2_IRQL4_VME5SHIFT) | (4 << VME2_IRQL4_VME4SHIFT) |
- (3 << VME2_IRQL4_VME3SHIFT) | (2 << VME2_IRQL4_VME2SHIFT) |
- (1 << VME2_IRQL4_VME1SHIFT);
- printf("%s: vme to cpu irq level 1:1\n", devname);
-
- /* Enable the reset switch */
- *(volatile u_int32_t *)(VME2_BASE + VME2_TCTL) |= VME2_TCTL_RSWE;
- /* Set Watchdog timeout to about 1 minute */
- *(volatile u_int32_t *)(VME2_BASE + VME2_TCR) |= VME2_TCR_64S;
- /* Enable VMEChip2 Interrupts */
- *(volatile u_int32_t *)(VME2_BASE + VME2_VBR) |= VME2_IOCTL1_MIEN;
-
- /*
- * Map the Software VME irq levels to the cpu level 7.
- */
- *(volatile u_int32_t *)(VME2_BASE + VME2_IRQL3) =
- (7 << VME2_IRQL3_SW7SHIFT) | (7 << VME2_IRQL3_SW6SHIFT) |
- (7 << VME2_IRQL3_SW5SHIFT) | (7 << VME2_IRQL3_SW4SHIFT) |
- (7 << VME2_IRQL3_SW3SHIFT) | (7 << VME2_IRQL3_SW2SHIFT) |
- (7 << VME2_IRQL3_SW1SHIFT);
-
- /*
- * Register abort interrupt handler.
- */
- vme2_abih.ih_fn = vme2abort;
- vme2_abih.ih_arg = 0;
- vme2_abih.ih_wantframe = 1;
- vme2_abih.ih_ipl = IPL_NMI;
- intr_establish(0x6e, &vme2_abih, devname);
-
- irqen = *(volatile u_int32_t *)(VME2_BASE + VME2_IRQEN);
- irqen |= VME2_IRQ_AB;
-
- /*
- * Enable ACFAIL interrupt, but disable Timer 1 interrupt - we
- * prefer it without for delay().
- */
- irqen = (irqen | VME2_IRQ_ACF) & ~VME2_IRQ_TIC1;
- *(volatile u_int32_t *)(VME2_BASE + VME2_IRQEN) = irqen;
-
- return vecbase;
-}
-
-int
-m1x7_intsrc_available(u_int intsrc, int ipl)
-{
- if (intsrc != INTSRC_VME)
- return ENXIO; /* should never happen anyway */
-
- return 0;
-}
-
-void
-m1x7_intsrc_enable(u_int intsrc, int ipl)
-{
- *(volatile u_int32_t *)(VME2_BASE + VME2_IRQEN) |=
- VME2_IRQ_VME(ipl);
-}
-
-int
-vme2abort(void *frame)
-{
- if ((*(volatile u_int32_t *)(VME2_BASE + VME2_IRQSTAT) &
- VME2_IRQ_AB) == 0)
- return 0;
-
- *(volatile u_int32_t *)(VME2_BASE + VME2_IRQCLR) = VME2_IRQ_AB;
- nmihand(frame);
-
- return 1;
-}
diff --git a/sys/arch/mvme88k/mvme88k/m88110.c b/sys/arch/mvme88k/mvme88k/m88110.c
deleted file mode 100644
index ac6a3c09552..00000000000
--- a/sys/arch/mvme88k/mvme88k/m88110.c
+++ /dev/null
@@ -1,1206 +0,0 @@
-/* $OpenBSD: m88110.c,v 1.83 2013/11/16 18:45:20 miod Exp $ */
-
-/*
- * Copyright (c) 2010, 2011, Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-/*
- * Copyright (c) 1998 Steve Murphree, Jr.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Nivas Madhur.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-/*
- * Mach Operating System
- * Copyright (c) 1993-1991 Carnegie Mellon University
- * Copyright (c) 1991 OMRON Corporation
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON AND OMRON ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON AND OMRON DISCLAIM ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/asm_macro.h>
-#include <machine/bugio.h>
-#include <machine/cmmu.h>
-#include <machine/cpu.h>
-#include <machine/lock.h>
-#include <machine/m88110.h>
-#include <machine/m88410.h>
-#include <machine/psl.h>
-
-#include <mvme88k/dev/busswreg.h>
-#include <machine/mvme197.h>
-
-extern void m88110_zeropage(vaddr_t);
-extern void m88110_copypage(vaddr_t, vaddr_t);
-
-cpuid_t m88110_init(void);
-cpuid_t m88410_init(void);
-void m88110_batc_setup(cpuid_t, apr_t);
-void m88110_setup_board_config(void);
-void m88410_setup_board_config(void);
-void m88110_cpu_configuration_print(int);
-void m88410_cpu_configuration_print(int);
-void m88110_shutdown(void);
-cpuid_t m88110_cpu_number(void);
-apr_t m88110_apr_cmode(void);
-apr_t m88410_apr_cmode(void);
-apr_t m88110_pte_cmode(void);
-void m88110_set_sapr(apr_t);
-void m88110_set_uapr(apr_t);
-void m88110_tlbis(cpuid_t, vaddr_t, pt_entry_t);
-void m88110_tlbiu(cpuid_t, vaddr_t, pt_entry_t);
-void m88110_tlbia(cpuid_t);
-void m88110_cache_wbinv(cpuid_t, paddr_t, psize_t);
-void m88410_cache_wbinv(cpuid_t, paddr_t, psize_t);
-void m88110_dcache_wb(cpuid_t, paddr_t, psize_t);
-void m88410_dcache_wb(cpuid_t, paddr_t, psize_t);
-void m88110_icache_inv(cpuid_t, paddr_t, psize_t);
-void m88410_icache_inv(cpuid_t, paddr_t, psize_t);
-void m88110_dma_cachectl(paddr_t, psize_t, int);
-void m88110_dma_cachectl_local(paddr_t, psize_t, int);
-void m88410_dma_cachectl(paddr_t, psize_t, int);
-void m88410_dma_cachectl_local(paddr_t, psize_t, int);
-void m88110_initialize_cpu(cpuid_t);
-void m88410_initialize_cpu(cpuid_t);
-
-/*
- * This is the function table for the MC88110 built-in CMMUs without
- * external 88410.
- */
-const struct cmmu_p cmmu88110 = {
- m88110_init,
- m88110_batc_setup,
- m88110_setup_board_config,
- m88110_cpu_configuration_print,
- m88110_shutdown,
- m88110_cpu_number,
- m88110_apr_cmode,
- m88110_pte_cmode,
- m88110_set_sapr,
- m88110_set_uapr,
- m88110_tlbis,
- m88110_tlbiu,
- m88110_tlbia,
- m88110_cache_wbinv,
- m88110_dcache_wb,
- m88110_icache_inv,
- m88110_dma_cachectl,
-#ifdef MULTIPROCESSOR
- m88110_dma_cachectl_local,
- m88110_initialize_cpu,
-#endif
-};
-
-/*
- * This is the function table for the MC88110 built-in CMMUs with
- * external 88410.
- */
-const struct cmmu_p cmmu88410 = {
- m88410_init,
- m88110_batc_setup,
- m88410_setup_board_config,
- m88410_cpu_configuration_print,
- m88110_shutdown,
- m88110_cpu_number,
- m88410_apr_cmode,
- m88110_pte_cmode,
- m88110_set_sapr,
- m88110_set_uapr,
- m88110_tlbis,
- m88110_tlbiu,
- m88110_tlbia,
- m88410_cache_wbinv,
- m88410_dcache_wb,
- m88410_icache_inv,
- m88410_dma_cachectl,
-#ifdef MULTIPROCESSOR
- m88410_dma_cachectl_local,
- m88410_initialize_cpu,
-#endif
-};
-
-size_t mc88410_linesz[2] = { 5, 5 }; /* log2 of L2 cache line size */
-size_t mc88410_cachesz[2] = { 256, 256 }; /* L2 cache size in KB */
-
-static inline
-void m88110_dbatc_set(uint, batc_t);
-static inline
-void m88110_ibatc_set(uint, batc_t);
-void m88110_patc_clear(void);
-
-void m88110_cmmu_wb_locked(paddr_t, psize_t);
-void m88110_cmmu_wbinv_locked(paddr_t, psize_t);
-void m88110_cmmu_inv_locked(paddr_t, psize_t);
-
-static inline
-void
-m88110_dbatc_set(uint batno, batc_t val)
-{
- set_dir(batno);
- set_dbp(val);
-}
-
-static inline
-void
-m88110_ibatc_set(uint batno, batc_t val)
-{
- set_iir(batno);
- set_ibp(val);
-}
-
-void
-m88110_patc_clear(void)
-{
- uint patcno;
-
- for (patcno = 0; patcno < 32; patcno++) {
- set_dir(patcno << 5);
- set_dppu(0);
- set_dppl(0);
-
- set_iir(patcno << 5);
- set_ippu(0);
- set_ippl(0);
- }
-}
-
-void
-m88110_setup_board_config(void)
-{
- ncpusfound = 1;
-}
-
-void
-m88410_setup_board_config(void)
-{
- struct mvmeprom_brdid brdid;
-
- /*
- * MVME197SP are 01-W3815B04, while MVME197DP are 01-W3815B03.
- * If the CNFG memory has been lost and the board is a 197SP,
- * we'll just fail to spin up the non-existing second processor.
- */
- bzero(&brdid, sizeof(brdid));
- bugbrdid(&brdid);
- if (bcmp(brdid.pwa, "01-W3815B04", 11) == 0)
- ncpusfound = 1;
- else
- ncpusfound = 2;
-}
-
-/*
- * Should only be called after the calling cpus knows its cpu
- * number and master/slave status. Should be called first
- * by the master, before the slaves are started.
- */
-void
-m88110_cpu_configuration_print(int master)
-{
- int pid = get_cpu_pid();
- int proctype = (pid & PID_ARN) >> ARN_SHIFT;
- int procvers = (pid & PID_VN) >> VN_SHIFT;
- int cpu = cpu_number();
-
- printf("cpu%d: ", cpu);
- switch (proctype) {
- default:
- printf("unknown model arch 0x%x version 0x%x",
- proctype, procvers);
- break;
- case ARN_88110:
- printf("M88110 version 0x%x, 8K I/D caches (32b/l)", procvers);
- break;
- }
- printf("\n");
-}
-
-void
-m88410_cpu_configuration_print(int master)
-{
- int cpu = cpu_number();
-
- m88110_cpu_configuration_print(master);
- printf("cpu%d: external M88410 %dK cache controller (%db/l)\n",
- cpu, mc88410_cachesz[cpu], 1 << mc88410_linesz[cpu]);
-
-#ifdef MULTIPROCESSOR
- /*
- * Mark us as allowing IPIs now.
- */
- *(volatile u_int8_t *)(BS_BASE + BS_CPINT) = BS_CPI_ICLR | BS_CPI_IEN;
-#endif
-}
-
-/*
- * CMMU initialization routine
- */
-cpuid_t
-m88110_init(void)
-{
- cpuid_t cpu;
-
- cpu = m88110_cpu_number();
- m88110_initialize_cpu(cpu);
- return (cpu);
-}
-
-cpuid_t
-m88410_init(void)
-{
- cpuid_t cpu;
-
- cpu = m88110_cpu_number();
- m88410_initialize_cpu(cpu);
- return (cpu);
-}
-
-void
-m88110_batc_setup(cpuid_t cpu, apr_t cmode)
-{
- paddr_t s_text, e_text, s_data, e_data, e_rodata;
- uint batcno;
- batc_t batc, proto;
- extern caddr_t kernelstart;
- extern caddr_t etext;
- extern caddr_t erodata;
- extern caddr_t end;
-
- proto = BATC_SO | BATC_V;
- if (cmode & CACHE_WT)
- proto |= BATC_WT;
- if (cmode & CACHE_INH)
- proto |= BATC_INH;
-
- s_text = round_batc((paddr_t)&kernelstart);
- s_data = e_text = round_batc((paddr_t)&etext);
- e_rodata = round_batc((paddr_t)&erodata);
-#if 0 /* not until pmap makes sure kvm starts on a BATC boundary */
- e_data = round_batc((paddr_t)&end);
-#else
- e_data = trunc_batc((paddr_t)&end);
-#endif
-
- /* map s_text..e_text with IBATC */
- batcno = 0;
- while (s_text != e_text) {
- batc = (s_text >> BATC_BLKSHIFT) << BATC_VSHIFT;
- batc |= (s_text >> BATC_BLKSHIFT) << BATC_PSHIFT;
- batc |= proto;
-#ifdef DEBUG
- printf("cpu%d ibat%d %p(%08x)\n", cpu, batcno, s_text, batc);
-#endif
- global_ibatc[batcno] = batc;
- s_text += BATC_BLKBYTES;
- if (++batcno == BATC_MAX)
- break;
- }
-
- /* map e_text..e_data with DBATC */
- if (cmode & CACHE_GLOBAL)
- proto |= BATC_GLOBAL;
- batcno = 0;
- while (s_data != e_data) {
- batc = (s_data >> BATC_BLKSHIFT) << BATC_VSHIFT;
- batc |= (s_data >> BATC_BLKSHIFT) << BATC_PSHIFT;
- batc |= proto;
- if (s_data < e_rodata)
- batc |= BATC_PROT;
-#if defined(MULTIPROCESSOR) /* XXX */
- else
- break;
-#endif
-#ifdef DEBUG
- printf("cpu%d dbat%d %p(%08x)\n", cpu, batcno, s_data, batc);
-#endif
- global_dbatc[batcno] = batc;
- s_data += BATC_BLKBYTES;
- if (++batcno == BATC_MAX)
- break;
- }
-
- for (batcno = 0; batcno < BATC_MAX; batcno++) {
- m88110_dbatc_set(batcno, global_dbatc[batcno]);
- m88110_ibatc_set(batcno, global_ibatc[batcno]);
- }
-}
-
-cpuid_t
-m88110_cpu_number(void)
-{
- u_int16_t gcsr;
-
- gcsr = *(volatile u_int16_t *)(BS_BASE + BS_GCSR);
-
- return ((gcsr & BS_GCSR_CPUID) != 0 ? 1 : 0);
-}
-
-void
-m88110_initialize_cpu(cpuid_t cpu)
-{
- struct cpu_info *ci;
- u_int ictl, dctl;
- int i;
-#ifdef i_know_what_i_am_doing
- int procvers = (get_cpu_pid() & PID_VN) >> VN_SHIFT;
-#endif
-
- ci = &m88k_cpus[cpu];
-
- /* clear BATCs */
- for (i = 0; i < 8; i++) {
- set_dir(i);
- set_dbp(0);
- set_iir(i);
- set_ibp(0);
- }
-
- /* clear PATCs */
- m88110_patc_clear();
-
- ictl = BATC_512K | CMMU_ICTL_DID | CMMU_ICTL_CEN | CMMU_ICTL_BEN;
-
- /*
- * 88110 errata #10 (4.2) or #2 (5.1.1):
- * ``Under some circumstances, the 88110 may incorrectly latch data
- * as it comes from the bus.
- * [...]
- * It is the data matching mechanism that may give corrupt data to
- * the register files.
- * Suggested fix: Set the Data Matching Disable bit (bit 2) of the
- * DCTL. This bit is not documented in the user's manual. This bit
- * is only present for debug purposes and its functionality should
- * not be depended upon long term.''
- *
- * 88110 errata #5 (5.1.1):
- * ``Setting the xmem bit in the dctl register to perform st/ld
- * xmems can cause the cpu to hang if a st instruction follows the
- * xmem.
- * Work-Around: do not set the xmem bit in dctl, or separate st
- * from xmem instructions.''
- */
- dctl = BATC_512K | CMMU_DCTL_CEN | CMMU_DCTL_ADS;
- dctl |= CMMU_DCTL_RSVD1; /* Data Matching Disable */
-
- /*
- * 88110 rev 4.2 errata #1:
- * ``Under certain conditions involving exceptions, with branch
- * prediction enabled, the CPU may hang.
- * Suggested fix: Clear the PREN bit of the ICTL. This will
- * disable branch prediction.''
- *
- * ...but this errata becomes...
- *
- * 88110 rev 5.1 errata #1:
- * ``Under certain conditions involving exceptions, with branch
- * prediction enabled and decoupled loads/stores enabled, load
- * instructions may complete incorrectly or stores may execute
- * to the wrong. address.
- * Suggested fix: Clear the PREN bit of the ICTL or the DEN bit
- * of the DCTL.''
- *
- * Unfortunately, while it would be nice to be able to enable
- * branch prediction on later models (which gives better
- * performance than data cache decoupling), the CPU hang can
- * still occur after hitting several SFU instructions in a row,
- * something crashme is good at producing.
- */
-#ifdef i_know_what_i_am_doing
- if (procvers >= 0xf) /* > 0xb ? */
- ictl |= CMMU_ICTL_PREN;
- else
-#endif
- dctl |= CMMU_DCTL_DEN;
-
- mc88110_inval_inst(); /* clear instruction cache & TIC */
- mc88110_inval_data(); /* clear data cache */
-
- set_ictl(ictl);
- set_dctl(dctl);
-
- set_isr(0);
- set_dsr(0);
-
- ci->ci_zeropage = m88110_zeropage;
- ci->ci_copypage = m88110_copypage;
-}
-
-void
-m88410_initialize_cpu(cpuid_t cpu)
-{
- u_int dctl;
- uint32_t tcr1, tcr2;
- uint clkspeed, lines, linelog;
-
- m88110_initialize_cpu(cpu);
- dctl = get_dctl();
- dctl |= CMMU_DCTL_SEN;
- set_dctl(dctl);
-
- /*
- * There does not seem to be an easy way to figure out the size of
- * the secondary cache. According to the 197SP/DP documentation,
- * the L2 configuration is always 256KB and 32 bytes per line.
- * However, the 88410 documentation mentions 512KB and 1MB as
- * possible configurations, and there might have been some late
- * 197SP/DP models fitted with more than 256KB of L2.
- *
- * Timing the invalidate operation is good enough to let us know
- * how many cache lines are available (it will take two clock
- * cycles per line), and the ECDM configuration register will tell
- * us the cache line size.
- */
-
- /* enable BusSwitch timer1 */
- *(volatile uint8_t *)(BS_BASE + BS_TINT1) = 0;
- *(volatile uint8_t *)(BS_BASE + BS_TCTRL1) =
- BS_TCTRL_CEN | BS_TCTRL_COVF;
- *(volatile uint32_t *)(BS_BASE + BS_TCOMP1) = 0xffffffff;
-
- CMMU_LOCK;
- tcr1 = *(volatile uint32_t *)(BS_BASE + BS_TCOUNT1);
- mc88410_inv(); /* clear external data cache */
- tcr2 = *(volatile uint32_t *)(BS_BASE + BS_TCOUNT1);
- CMMU_UNLOCK;
-
- mc88410_linesz[cpu] = *(volatile uint8_t *)(ECDM_BASE) & 0x40 ? 6 : 5;
- clkspeed = 256 - *(volatile uint8_t *)(BS_BASE + BS_PADJUST);
- lines = ((tcr2 - tcr1) * clkspeed) >> 1;
- for (linelog = 16; linelog != 12; linelog--)
- if ((lines >> linelog) != 0) {
- mc88410_cachesz[cpu] =
- 1 << (linelog + mc88410_linesz[cpu] - 10);
- break;
- }
-}
-
-/*
- * Just before poweroff or reset....
- */
-void
-m88110_shutdown(void)
-{
-}
-
-apr_t
-m88110_apr_cmode(void)
-{
- return CACHE_DFL;
-}
-
-apr_t
-m88410_apr_cmode(void)
-{
- return CACHE_WT;
-}
-
-apr_t
-m88110_pte_cmode(void)
-{
- return CACHE_WT;
-}
-
-void
-m88110_set_sapr(apr_t ap)
-{
- u_int ictl, dctl;
-
- set_icmd(CMMU_ICMD_INV_SATC);
- set_dcmd(CMMU_DCMD_INV_SATC);
-
- ictl = get_ictl();
- dctl = get_dctl();
-
- set_isap(ap);
- set_dsap(ap);
-
- m88110_patc_clear();
-
- set_icmd(CMMU_ICMD_INV_UATC);
- set_icmd(CMMU_ICMD_INV_SATC);
- set_dcmd(CMMU_DCMD_INV_UATC);
- set_dcmd(CMMU_DCMD_INV_SATC);
-
- /* Enable translation */
- ictl |= CMMU_ICTL_MEN | CMMU_ICTL_HTEN;
- dctl |= CMMU_DCTL_MEN | CMMU_DCTL_HTEN;
- set_ictl(ictl);
- set_dctl(dctl);
-}
-
-void
-m88110_set_uapr(apr_t ap)
-{
- set_iuap(ap);
- set_duap(ap);
-
- set_icmd(CMMU_ICMD_INV_UATC);
- set_dcmd(CMMU_DCMD_INV_UATC);
-
- /* We need to at least invalidate the TIC, as it is va-addressed */
- set_icmd(CMMU_ICMD_INV_TIC);
-}
-
-/*
- * Functions that invalidate or update TLB entries.
- */
-
-void
-m88110_tlbis(cpuid_t cpu, vaddr_t va, pt_entry_t pte)
-{
- uint32_t psr, isr, dsr;
-
-#ifdef MULTIPROCESSOR
- struct cpu_info *ci = curcpu();
-
- if (cpu != ci->ci_cpuid) {
- m197_send_complex_ipi(CI_IPI_TLB_FLUSH_KERNEL, cpu, va, pte);
- return;
- }
-#endif
-
- psr = get_psr();
- set_psr(psr | PSR_IND);
-
- /*
- * Probe for an existing TLB entry for the given page, in both
- * ITLB and DTLB.
- */
-
- set_isar(va);
- set_dsar(va);
- set_icmd(CMMU_ICMD_PRB_SUPR);
- set_dcmd(CMMU_DCMD_PRB_SUPR);
- isr = get_isr();
- dsr = get_dsr();
-
- /*
- * Update entries with the new PTE, if found.
- */
-
- if (isr & CMMU_ISR_PH) {
- set_ippu((va & PATC_VA_MASK) | PATC_SO);
- set_ippl(pte);
- }
- if (dsr & CMMU_DSR_PH) {
- set_dppu((va & PATC_VA_MASK) | PATC_SO);
- set_dppl(pte);
- }
-
- set_psr(psr);
-}
-
-void
-m88110_tlbiu(cpuid_t cpu, vaddr_t va, pt_entry_t pte)
-{
- u_int32_t psr, isr, dsr;
-#ifdef MULTIPROCESSOR
- struct cpu_info *ci = curcpu();
-
- if (cpu != ci->ci_cpuid) {
- m197_send_complex_ipi(CI_IPI_TLB_FLUSH_USER, cpu, va, pte);
- return;
- }
-#endif
-
- psr = get_psr();
- set_psr(psr | PSR_IND);
-
- /*
- * Probe for an existing TLB entry for the given page, in both
- * ITLB and DTLB.
- */
-
- set_isar(va);
- set_dsar(va);
- set_icmd(CMMU_ICMD_PRB_USER);
- set_dcmd(CMMU_DCMD_PRB_USER);
- isr = get_isr();
- dsr = get_dsr();
-
- /*
- * Update entries with the new PTE, if found.
- */
-
- if (isr & CMMU_ISR_PH) {
- set_ippu(va & PATC_VA_MASK);
- set_ippl(pte);
- }
- if (dsr & CMMU_DSR_PH) {
- set_dppu(va & PATC_VA_MASK);
- set_dppl(pte);
- }
-
- set_psr(psr);
-}
-
-void
-m88110_tlbia(cpuid_t cpu)
-{
- u_int32_t psr;
-
- psr = get_psr();
- set_psr(psr | PSR_IND);
- /* always invoked on the current processor, no need to check */
- set_icmd(CMMU_ICMD_INV_UATC);
- set_dcmd(CMMU_DCMD_INV_UATC);
- set_psr(psr);
-}
-
-/*
- * Functions that invalidate caches.
- */
-
-/*
- * 88110 general information #22:
- * ``Issuing a command to flush and invalidate the data cache while the
- * dcache is disabled (CEN = 0 in dctl) will cause problems. Do not
- * flush a disabled data cache. In general, there is no reason to
- * perform this operation with the cache disabled, since it may be
- * incoherent with the proper state of memory. Before 5.0 the flush
- * command was treated like a nop when the cache was disabled. This
- * is no longer the case.''
- *
- * Since we always enable the data cache, and no cmmu cache operation
- * will occur before we do, it is not necessary to pay attention to this.
- */
-
-#ifdef MULTIPROCESSOR
-/*
- * 88110 rev 4.2 errata #17:
- * ``A copyback initiated by a flush page/line with invalidate command,
- * which is retried on the external bus, and is preceded by a snoop
- * copyback before the retry cycle occurs, can be incorrectly marked
- * as invalid, and not copied back to memory.
- * Suggested fix: Use flush page/line followed by flush page/line with
- * invalidate to avoid this condition.''
- *
- * This really only matters to us when running a MULTIPROCESSOR kernel
- * (otherwise there is no snooping happening), and given the intrusive
- * changes it requires, we define a specific symbol to enable the suggested
- * workaround.
- */
-#define ENABLE_88110_ERRATA_17
-#endif
-
-#define trunc_cache_line(a) ((a) & ~(MC88110_CACHE_LINE - 1))
-#define round_cache_line(a) trunc_cache_line((a) + MC88110_CACHE_LINE - 1)
-
-/*
- * invalidate I$, writeback and invalidate D$
- */
-
-void
-m88110_cache_wbinv(cpuid_t cpu, paddr_t pa, psize_t size)
-{
- u_int32_t psr;
- psize_t count;
-
- size = round_cache_line(pa + size) - trunc_cache_line(pa);
- pa = trunc_cache_line(pa);
-
- psr = get_psr();
- set_psr(psr | PSR_IND);
-
- mc88110_inval_inst();
- while (size != 0) {
- if ((pa & PAGE_MASK) == 0 && size >= PAGE_SIZE) {
-#ifdef ENABLE_88110_ERRATA_17
- mc88110_wb_data_page(pa);
-#endif
- mc88110_wbinv_data_page(pa);
- count = PAGE_SIZE;
- } else {
-#ifdef ENABLE_88110_ERRATA_17
- mc88110_wb_data_line(pa);
-#endif
- mc88110_wbinv_data_line(pa);
- count = MC88110_CACHE_LINE;
- }
- pa += count;
- size -= count;
- }
-
- set_psr(psr);
-}
-
-void
-m88410_cache_wbinv(cpuid_t cpu, paddr_t pa, psize_t size)
-{
- u_int32_t psr;
- psize_t count;
-#ifdef MULTIPROCESSOR
- struct cpu_info *ci = curcpu();
-
- if (cpu != ci->ci_cpuid) {
- m197_send_complex_ipi(CI_IPI_CACHE_FLUSH, cpu, pa, size);
- return;
- }
-#endif
-
- size = round_cache_line(pa + size) - trunc_cache_line(pa);
- pa = trunc_cache_line(pa);
-
- psr = get_psr();
- set_psr(psr | PSR_IND);
-
- mc88110_inval_inst();
- while (size != 0) {
- if ((pa & PAGE_MASK) == 0 && size >= PAGE_SIZE) {
-#ifdef ENABLE_88110_ERRATA_17
- mc88110_wb_data_page(pa);
-#endif
- mc88110_wbinv_data_page(pa);
- count = PAGE_SIZE;
- } else {
-#ifdef ENABLE_88110_ERRATA_17
- mc88110_wb_data_line(pa);
-#endif
- mc88110_wbinv_data_line(pa);
- count = MC88110_CACHE_LINE;
- }
- pa += count;
- size -= count;
- }
-
- CMMU_LOCK;
- mc88410_wb();
- CMMU_UNLOCK;
-
- set_psr(psr);
-}
-
-/*
- * writeback D$
- */
-
-void
-m88110_dcache_wb(cpuid_t cpu, paddr_t pa, psize_t size)
-{
- u_int32_t psr;
- psize_t count;
-
- size = round_cache_line(pa + size) - trunc_cache_line(pa);
- pa = trunc_cache_line(pa);
-
- psr = get_psr();
- set_psr(psr | PSR_IND);
-
- while (size != 0) {
- if ((pa & PAGE_MASK) == 0 && size >= PAGE_SIZE) {
- mc88110_wb_data_page(pa);
- count = PAGE_SIZE;
- } else {
- mc88110_wb_data_line(pa);
- count = MC88110_CACHE_LINE;
- }
- pa += count;
- size -= count;
- }
-
- set_psr(psr);
-}
-
-void
-m88410_dcache_wb(cpuid_t cpu, paddr_t pa, psize_t size)
-{
- u_int32_t psr;
- psize_t count;
-#ifdef MULTIPROCESSOR
- struct cpu_info *ci = curcpu();
-
- if (cpu != ci->ci_cpuid) {
- m197_send_complex_ipi(CI_IPI_CACHE_FLUSH, cpu, pa, size);
- return;
- }
-#endif
-
- size = round_cache_line(pa + size) - trunc_cache_line(pa);
- pa = trunc_cache_line(pa);
-
- psr = get_psr();
- set_psr(psr | PSR_IND);
-
- while (size != 0) {
- if ((pa & PAGE_MASK) == 0 && size >= PAGE_SIZE) {
- mc88110_wb_data_page(pa);
- count = PAGE_SIZE;
- } else {
- mc88110_wb_data_line(pa);
- count = MC88110_CACHE_LINE;
- }
- pa += count;
- size -= count;
- }
-
- CMMU_LOCK;
- mc88410_wb();
- CMMU_UNLOCK;
-
- set_psr(psr);
-}
-
-/*
- * invalidate I$
- */
-
-void
-m88110_icache_inv(cpuid_t cpu, paddr_t pa, psize_t size)
-{
- /* atomic so no psr games */
- mc88110_inval_inst();
-}
-
-void
-m88410_icache_inv(cpuid_t cpu, paddr_t pa, psize_t size)
-{
- u_int32_t psr;
-#ifdef MULTIPROCESSOR
- struct cpu_info *ci = curcpu();
-
- if (cpu != ci->ci_cpuid) {
- m197_send_complex_ipi(CI_IPI_ICACHE_FLUSH, cpu, pa, size);
- return;
- }
-#endif
-
- psr = get_psr();
- set_psr(psr | PSR_IND);
-
- mc88110_inval_inst();
- CMMU_LOCK;
- mc88410_wb();
- CMMU_UNLOCK;
-
- set_psr(psr);
-}
-
-/*
- * writeback D$
- */
-void
-m88110_cmmu_wb_locked(paddr_t pa, psize_t size)
-{
- if (size <= MC88110_CACHE_LINE)
- mc88110_wb_data_line(pa);
- else
- mc88110_wb_data_page(pa);
-}
-
-/*
- * writeback and invalidate D$
- */
-void
-m88110_cmmu_wbinv_locked(paddr_t pa, psize_t size)
-{
- if (size <= MC88110_CACHE_LINE) {
-#ifdef ENABLE_88110_ERRATA_17
- mc88110_wb_data_line(pa);
-#endif
- mc88110_wbinv_data_line(pa);
- } else {
-#ifdef ENABLE_88110_ERRATA_17
- mc88110_wb_data_page(pa);
-#endif
- mc88110_wbinv_data_page(pa);
- }
-}
-
-/*
- * invalidate D$
- */
-void
-m88110_cmmu_inv_locked(paddr_t pa, psize_t size)
-{
- /*
- * I'd love to do this...
-
- if (size <= MC88110_CACHE_LINE)
- mc88110_inval_data_line(pa);
- else
- mc88110_inval_data_page(pa);
-
- * ... but there is no mc88110_inval_data_page(). Callers know
- * this and always do this line-by-line.
- */
- mc88110_inval_data_line(pa);
-}
-
-/*
- * High level cache handling functions (used by bus_dma).
- */
-
-#ifdef MULTIPROCESSOR
-void
-m88110_dma_cachectl_local(paddr_t _pa, psize_t _size, int op)
-{
- /* Obviously nothing to do. */
-}
-#endif
-
-void
-m88110_dma_cachectl(paddr_t _pa, psize_t _size, int op)
-{
- u_int32_t psr;
- paddr_t pa;
- psize_t size, count;
- void (*flusher)(paddr_t, psize_t);
- uint8_t lines[2 * MC88110_CACHE_LINE];
- paddr_t pa1, pa2;
- psize_t sz1, sz2;
-
- pa = trunc_cache_line(_pa);
- size = round_cache_line(_pa + _size) - pa;
- sz1 = sz2 = 0;
-
- switch (op) {
- case DMA_CACHE_SYNC:
- flusher = m88110_cmmu_wb_locked;
- break;
- case DMA_CACHE_SYNC_INVAL:
- flusher = m88110_cmmu_wbinv_locked;
- break;
- default:
- case DMA_CACHE_INV:
- pa1 = pa;
- sz1 = _pa - pa1;
- pa2 = _pa + _size;
- sz2 = pa + size - pa2;
- flusher = m88110_cmmu_inv_locked;
- break;
- }
-
- psr = get_psr();
- set_psr(psr | PSR_IND);
-
- if (op != DMA_CACHE_SYNC)
- mc88110_inval_inst();
- if (flusher == m88110_cmmu_inv_locked) {
- /*
- * Preserve the data from the incomplete cache lines about
- * to be invalidated, if necessary.
- */
- if (sz1 != 0)
- bcopy((void *)pa1, lines, sz1);
- if (sz2 != 0)
- bcopy((void *)pa2, lines + MC88110_CACHE_LINE, sz2);
-
- while (size != 0) {
- count = MC88110_CACHE_LINE;
- (*flusher)(pa, count);
- pa += count;
- size -= count;
- }
-
- /*
- * Restore data from the incomplete cache lines having
- * been invalidated, if necessary.
- */
- if (sz1 != 0)
- bcopy(lines, (void *)pa1, sz1);
- if (sz2 != 0)
- bcopy(lines + MC88110_CACHE_LINE, (void *)pa2, sz2);
- if (sz1 != 0)
- m88110_cmmu_wbinv_locked(pa1, MC88110_CACHE_LINE);
- if (sz2 != 0) {
- pa2 = trunc_cache_line(pa2);
- m88110_cmmu_wbinv_locked(pa2, MC88110_CACHE_LINE);
- }
- } else {
- while (size != 0) {
- count = (pa & PAGE_MASK) == 0 && size >= PAGE_SIZE ?
- PAGE_SIZE : MC88110_CACHE_LINE;
- (*flusher)(pa, count);
- pa += count;
- size -= count;
- }
- }
-
- set_psr(psr);
-}
-
-void
-m88410_dma_cachectl_local(paddr_t _pa, psize_t _size, int op)
-{
- u_int32_t psr;
- paddr_t pa;
- psize_t size, count;
- void (*flusher)(paddr_t, psize_t);
- uint8_t lines[2 * MC88110_CACHE_LINE];
- paddr_t pa1, pa2;
- psize_t sz1, sz2;
-
- pa = trunc_cache_line(_pa);
- size = round_cache_line(_pa + _size) - pa;
- sz1 = sz2 = 0;
-
- switch (op) {
- case DMA_CACHE_SYNC:
- flusher = m88110_cmmu_wb_locked;
- break;
- case DMA_CACHE_SYNC_INVAL:
- flusher = m88110_cmmu_wbinv_locked;
- break;
- default:
- case DMA_CACHE_INV:
- pa1 = pa;
- sz1 = _pa - pa1;
- pa2 = _pa + _size;
- sz2 = pa + size - pa2;
- flusher = m88110_cmmu_inv_locked;
- break;
- }
-
- psr = get_psr();
- set_psr(psr | PSR_IND);
-
- if (op != DMA_CACHE_SYNC)
- mc88110_inval_inst();
- if (flusher == m88110_cmmu_inv_locked) {
- /*
- * Preserve the data from the incomplete cache lines about
- * to be invalidated, if necessary.
- */
- if (sz1 != 0)
- bcopy((void *)pa1, lines, sz1);
- if (sz2 != 0)
- bcopy((void *)pa2, lines + MC88110_CACHE_LINE, sz2);
-
- while (size != 0) {
- count = MC88110_CACHE_LINE;
- (*flusher)(pa, count);
- pa += count;
- size -= count;
- }
-
- /*
- * Restore data from the incomplete cache lines having
- * been invalidated, if necessary.
- */
- if (sz1 != 0)
- bcopy(lines, (void *)pa1, sz1);
- if (sz2 != 0)
- bcopy(lines + MC88110_CACHE_LINE, (void *)pa2, sz2);
- if (sz1 != 0)
- m88110_cmmu_wbinv_locked(pa1, MC88110_CACHE_LINE);
- if (sz2 != 0) {
- pa2 = trunc_cache_line(pa2);
- m88110_cmmu_wbinv_locked(pa2, MC88110_CACHE_LINE);
- }
- } else {
- while (size != 0) {
- count = (pa & PAGE_MASK) == 0 && size >= PAGE_SIZE ?
- PAGE_SIZE : MC88110_CACHE_LINE;
- (*flusher)(pa, count);
- pa += count;
- size -= count;
- }
- }
-
-
- CMMU_LOCK;
- if (op == DMA_CACHE_SYNC) {
- /*
- * Enlarge the range to integral pages, to match the
- * 88410 operation granularity.
- */
- pa = trunc_page(_pa);
- size = trunc_page(_pa + _size) - pa;
-
- while (size != 0) {
- mc88410_wb_page(pa);
- pa += PAGE_SIZE;
- size -= PAGE_SIZE;
- }
- } else {
- mc88410_wbinv();
- }
- CMMU_UNLOCK;
-
- set_psr(psr);
-}
-
-void
-m88410_dma_cachectl(paddr_t _pa, psize_t _size, int op)
-{
-#ifdef MULTIPROCESSOR
- paddr_t pa;
- psize_t size;
-#endif
-
- m88410_dma_cachectl_local(_pa, _size, op);
-#ifdef MULTIPROCESSOR
- /*
- * Since snooping is enabled, all we need is to propagate invalidate
- * requests if necessary.
- *
- * Note that we round the range to integral cache lines, in order
- * to avoid trying to preserve incomplete lines - this has already
- * been done by the cachectl_local() call above, and as long as one
- * cpu has the correct data in its cache, it's not lost.
- */
- if (op != DMA_CACHE_SYNC) {
- pa = trunc_cache_line(_pa);
- size = round_cache_line(_pa + _size) - pa;
- m197_broadcast_complex_ipi(CI_IPI_DMA_CACHECTL, pa, size);
- }
-#endif
-}
diff --git a/sys/arch/mvme88k/mvme88k/m8820x.c b/sys/arch/mvme88k/mvme88k/m8820x.c
deleted file mode 100644
index 3a3fdfdf6f3..00000000000
--- a/sys/arch/mvme88k/mvme88k/m8820x.c
+++ /dev/null
@@ -1,326 +0,0 @@
-/* $OpenBSD: m8820x.c,v 1.53 2013/05/17 22:51:59 miod Exp $ */
-/*
- * Copyright (c) 2004, Miodrag Vallat.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/asm_macro.h>
-#include <machine/cpu.h>
-
-#include <machine/cmmu.h>
-#include <machine/m8820x.h>
-#ifdef MVME181
-#include <machine/mvme181.h>
-#endif
-#ifdef MVME187
-#include <machine/mvme187.h>
-#endif
-#ifdef MVME188
-#include <machine/mvme188.h>
-#endif
-
-#ifdef MVME188
-/*
- * There are 6 possible MVME188 HYPERmodule configurations:
- * - config 0: 4 CPUs, 8 CMMUs
- * - config 1: 2 CPUs, 8 CMMUs
- * - config 2: 1 CPUs, 8 CMMUs
- * - config 5: 2 CPUs, 4 CMMUs
- * - config 6: 1 CPU, 4 CMMUs
- * - config A: 1 CPU, 2 CMMUs (similar in operation to MVME187)
- * which can exist either with MC88200 or MC88204 CMMUs.
- */
-const struct board_config {
- int ncpus;
- int ncmmus;
- u_int32_t *pfsr;
-} bd_config[16] = {
- { 4, 8, pfsr_save_188_straight }, /* 4P128 - 4P512 */
- { 2, 8, pfsr_save_188_double }, /* 2P128 - 2P512 */
- { 1, 8, pfsr_save_188_quad }, /* 1P128 - 1P512 */
- { 0, 0, NULL },
- { 0, 0, NULL },
- { 2, 4, pfsr_save_188_straight }, /* 2P64 - 2P256 */
- { 1, 4, pfsr_save_188_double }, /* 1P64 - 1P256 */
- { 0, 0, NULL },
- { 0, 0, NULL },
- { 0, 0, NULL },
- { 1, 2, pfsr_save_188_straight }, /* 1P32 - 1P128 */
- { 0, 0, NULL },
- { 0, 0, NULL },
- { 0, 0, NULL },
- { 0, 0, NULL },
- { 0, 0, NULL }
-};
-#endif
-
-/*
- * This routine sets up the CPU/CMMU configuration.
- */
-void
-m8820x_setup_board_config()
-{
- extern u_int32_t pfsr_save[];
- int num;
- u_int32_t *m8820x_pfsr;
-#ifdef MVME188
- u_int32_t whoami;
- int vme188_config;
- struct m8820x_cmmu *cmmu;
- int cmmu_num;
-#endif
-
- switch (brdtyp) {
-#ifdef MVME181
- case BRD_180:
- case BRD_181:
-#ifdef MVME188
- /* There is no WHOAMI reg on MVME181 - fake it... */
- vme188_config = 0x0a;
-#endif
- m8820x_cmmu[0].cmmu_regs = (void *)M181_CMMU_I;
- m8820x_cmmu[1].cmmu_regs = (void *)M181_CMMU_D;
- ncpusfound = 1;
- max_cmmus = 2;
- cmmu_shift = 1;
- m8820x_pfsr = pfsr_save_single;
- break;
-#endif /* MVME181 */
-#ifdef MVME187
- case BRD_187:
- case BRD_8120:
-#ifdef MVME188
- /* There is no WHOAMI reg on MVME187 - fake it... */
- vme188_config = 0x0a;
-#endif
- m8820x_cmmu[0].cmmu_regs = (void *)SBC_CMMU_I;
- m8820x_cmmu[1].cmmu_regs = (void *)SBC_CMMU_D;
- ncpusfound = 1;
- max_cmmus = 2;
- cmmu_shift = 1;
- m8820x_pfsr = pfsr_save_single;
- break;
-#endif /* MVME187 */
-#ifdef MVME188
- case BRD_188:
- whoami = *(volatile u_int32_t *)MVME188_WHOAMI;
- vme188_config = (whoami & 0xf0) >> 4;
- m8820x_cmmu[0].cmmu_regs = (void *)VME_CMMU_I0;
- m8820x_cmmu[1].cmmu_regs = (void *)VME_CMMU_D0;
- m8820x_cmmu[2].cmmu_regs = (void *)VME_CMMU_I1;
- m8820x_cmmu[3].cmmu_regs = (void *)VME_CMMU_D1;
- m8820x_cmmu[4].cmmu_regs = (void *)VME_CMMU_I2;
- m8820x_cmmu[5].cmmu_regs = (void *)VME_CMMU_D2;
- m8820x_cmmu[6].cmmu_regs = (void *)VME_CMMU_I3;
- m8820x_cmmu[7].cmmu_regs = (void *)VME_CMMU_D3;
- ncpusfound = bd_config[vme188_config].ncpus;
- max_cmmus = bd_config[vme188_config].ncmmus;
- m8820x_pfsr = bd_config[vme188_config].pfsr;
- cmmu_shift = ff1(max_cmmus / ncpusfound);
- break;
-#endif /* MVME188 */
- }
-
-#ifdef MVME188
- if (bd_config[vme188_config].ncpus != 0) {
- /* 181 and 187 have a fixed configuration, don't print it */
- if (brdtyp == BRD_188) {
- printf("MVME188 board configuration #%X "
- "(%d CPUs %d CMMUs)\n",
- vme188_config, ncpusfound, max_cmmus);
- }
- } else {
- panic("unrecognized MVME%x board configuration #%X",
- brdtyp, vme188_config);
- }
-#endif
-
- /*
- * Patch the exception handling code to invoke the correct pfsr
- * analysis chunk.
- */
- pfsr_save[0] = 0xc4000000 |
- (((vaddr_t)m8820x_pfsr + 4 - (vaddr_t)pfsr_save) >> 2);
- pfsr_save[1] = m8820x_pfsr[0];
-
-#ifdef DEBUG
- /*
- * Check CMMU type
- */
- for (cmmu_num = 0; cmmu_num < max_cmmus; cmmu_num++) {
- volatile u_int32_t *cr = m8820x_cmmu[cmmu_num].cmmu_regs;
- if (badaddr((vaddr_t)cr, 4) == 0) {
- int type;
-
- type = CMMU_TYPE(cr[CMMU_IDR]);
- if (type != M88200_ID && type != M88204_ID) {
- printf("WARNING: non M8820x circuit found "
- "at CMMU address %p\n", cr);
- continue; /* will probably die quickly */
- }
- }
- }
-#endif
-
- /*
- * Now that we know which CMMUs are there, report every association
- */
- for (num = 0; num < ncpusfound; num++) {
- int type;
-
- type = CMMU_TYPE(m8820x_cmmu[num << cmmu_shift].
- cmmu_regs[CMMU_IDR]);
-
- printf("CPU%d is associated to %d MC8820%c CMMUs\n",
- num, 1 << cmmu_shift, type == M88204_ID ? '4' : '0');
- }
-
-
-#ifdef MVME188
- /*
- * Systems with more than 2 CMMUs per CPU use programmable split
- * schemes, through PCNFA (for code CMMUs) and PCNFB (for data CMMUs)
- * configuration registers.
- *
- * The following schemes are available:
- * - split on A12 address bit (A14 for 88204)
- * - split on supervisor/user access
- * - split on SRAM/non-SRAM addresses, with either supervisor-only or
- * all access to SRAM.
- *
- * Configuration 6, with 4 CMMUs par CPU, also allows a split on A14
- * address bit (A16 for 88204).
- *
- * Setup the default A12/A14 scheme here. We should theoretically only
- * set the PCNFA and PCNFB on configurations 1, 2 and 6, since the
- * other ones do not have P bus decoders.
- * However, is it safe to write them anyways - the values will be
- * discarded. Just don't do this on a 187...
- */
- if (brdtyp == BRD_188) {
- *(volatile u_int32_t *)MVME188_PCNFA = 0;
- *(volatile u_int32_t *)MVME188_PCNFB = 0;
- }
-
- /*
- * Now set up addressing limits
- */
- for (cmmu_num = 0, cmmu = m8820x_cmmu; cmmu_num < max_cmmus;
- cmmu_num++, cmmu++) {
- num = cmmu_num >> 1; /* CPU view of the CMMU */
-
- switch (cmmu_shift) {
- case 3:
- /*
- * A14 split (configuration 2 only).
- * CMMU numbers 0 and 1 match on A14 set,
- * 2 and 3 on A14 clear
- */
- cmmu->cmmu_addr |= (num < 2 ? CMMU_A14_MASK : 0);
- cmmu->cmmu_addr_mask |= CMMU_A14_MASK;
- /* FALLTHROUGH */
-
- case 2:
- /*
- * A12 split.
- * CMMU numbers 0 and 2 match on A12 set,
- * 1 and 3 on A12 clear.
- */
- cmmu->cmmu_addr |= (num & 1 ? 0 : CMMU_A12_MASK);
- cmmu->cmmu_addr_mask |= CMMU_A12_MASK;
- break;
-
- case 1:
- /*
- * We don't need to set up anything for the hardwired
- * configurations.
- */
- cmmu->cmmu_addr = 0;
- cmmu->cmmu_addr_mask = 0;
- break;
- }
-
- /*
- * If these CMMUs are 88204, these splitting address lines
- * need to be shifted two bits.
- */
- if (CMMU_TYPE(cmmu->cmmu_regs[CMMU_IDR]) == M88204_ID) {
- cmmu->cmmu_addr <<= 2;
- cmmu->cmmu_addr_mask <<= 2;
- }
- }
-#endif
-}
-
-/*
- * Find out the CPU number from accessing CMMU.
- * On MVME181 and MVME187, there is only one CPU, so this is trivial.
- * On MVME188, we access the WHOAMI register, which is in data space;
- * its value will let us know which data CMMU has been used to perform
- * the read, and we can reliably compute the CPU number from it.
- */
-cpuid_t
-m8820x_cpu_number()
-{
-#ifdef MVME188
- u_int32_t whoami;
- cpuid_t cpu;
-#endif
-
-#if defined(MVME181) || defined(MVME187)
-#ifdef MVME188
- if (brdtyp != BRD_188)
-#endif
- return 0;
-#endif
-
-#ifdef MVME188
- whoami = *(volatile u_int32_t *)MVME188_WHOAMI;
- switch ((whoami & 0xf0) >> 4) {
- /* 2 CMMU per CPU multiprocessor modules */
- case 0:
- case 5:
- for (cpu = 0; cpu < 4; cpu++)
- if (whoami & (1 << cpu))
- return cpu;
- break;
- /* 4 CMMU per CPU dual processor modules */
- case 1:
- for (cpu = 0; cpu < 4; cpu++)
- if (whoami & (1 << cpu))
- return cpu >> 1;
- break;
- /* single processor modules */
- case 2:
- case 6:
- case 0x0a:
- return 0;
- }
- panic("can't figure out cpu number from whoami register %x", whoami);
-#endif
-}
diff --git a/sys/arch/mvme88k/mvme88k/m88410.c b/sys/arch/mvme88k/mvme88k/m88410.c
deleted file mode 100644
index cd4de705ecd..00000000000
--- a/sys/arch/mvme88k/mvme88k/m88410.c
+++ /dev/null
@@ -1,202 +0,0 @@
-/* $OpenBSD: m88410.c,v 1.7 2013/02/17 18:10:01 miod Exp $ */
-/*
- * Copyright (c) 2001 Steve Murphree, Jr.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Steve Murphree.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-
-#include <machine/asm_macro.h>
-#include <machine/m88410.h>
-
-#include <mvme88k/dev/busswreg.h>
-
-/*
- * MVME197-specific 88410 operation.
- *
- * 88410 commands are sent by writing a 64-bit word to a specific address.
- * Since the 88410 is not normally mapped and shares its address range
- * with the flash memory, it is necessary to program the busswitch chip
- * before the 88410 command can be sent.
- */
-
-/*
- * Writeback physical page number (specified in the low 20 bits of the
- * address).
- */
-#define XCC_WB_PAGE 0x01
-/*
- * Writeback the whole cache.
- */
-#define XCC_WB_ALL 0x02
-/*
- * Invalidate the whole cache.
- */
-#define XCC_INV_ALL 0x03
-
-/*
- * Base address of the 88410 when mapped.
- */
-#define XCC_ADDR 0xff800000
-
-void
-mc88410_wb_page(paddr_t physaddr)
-{
- paddr_t xccaddr = XCC_ADDR | (physaddr >> PGSHIFT);
- u_int psr;
- u_int16_t bs_gcsr, bs_romcr;
-
- bs_gcsr = *(volatile u_int16_t *)(BS_BASE + BS_GCSR);
- bs_romcr = *(volatile u_int16_t *)(BS_BASE + BS_ROMCR);
-
- /*
- * Since the page number is unlikely to be a multiple of 4, we need
- * to mask misaligned exceptions.
- */
- set_psr((psr = get_psr()) | PSR_MXM);
-
- /* clear WEN0 and WEN1 in ROMCR (disables writes to FLASH) */
- *(volatile u_int16_t *)(BS_BASE + BS_ROMCR) =
- bs_romcr & ~(BS_ROMCR_WEN0 | BS_ROMCR_WEN1);
-
- /* set XCC bit in GCSR (0xff8xxxxx now decodes to mc88410) */
- *(volatile u_int16_t *)(BS_BASE + BS_GCSR) = bs_gcsr | BS_GCSR_XCC;
-
- /* send command */
- *(volatile uint64_t *)xccaddr = (uint64_t)XCC_WB_PAGE << 32;
-
- /* spin until the operation is complete */
- while ((*(volatile u_int32_t *)(BS_BASE + BS_XCCR) & BS_XCC_FBSY) != 0)
- ;
-
- /* restore PSR and friends */
- set_psr(psr);
- *(volatile u_int16_t *)(BS_BASE + BS_GCSR) = bs_gcsr;
- *(volatile u_int16_t *)(BS_BASE + BS_ROMCR) = bs_romcr;
-}
-
-void
-mc88410_wb(void)
-{
- u_int16_t bs_gcsr, bs_romcr;
-
- bs_gcsr = *(volatile u_int16_t *)(BS_BASE + BS_GCSR);
- bs_romcr = *(volatile u_int16_t *)(BS_BASE + BS_ROMCR);
-
- /* clear WEN0 and WEN1 in ROMCR (disables writes to FLASH) */
- *(volatile u_int16_t *)(BS_BASE + BS_ROMCR) =
- bs_romcr & ~(BS_ROMCR_WEN0 | BS_ROMCR_WEN1);
-
- /* set XCC bit in GCSR (0xFF8xxxxx now decodes to mc88410) */
- *(volatile u_int16_t *)(BS_BASE + BS_GCSR) = bs_gcsr | BS_GCSR_XCC;
-
- /* send command */
- *(volatile uint64_t *)XCC_ADDR = (uint64_t)XCC_WB_ALL << 32;
-
- /* spin until the operation is complete */
- while ((*(volatile u_int32_t *)(BS_BASE + BS_XCCR) & BS_XCC_FBSY) != 0)
- ;
-
- *(volatile u_int16_t *)(BS_BASE + BS_GCSR) = bs_gcsr;
- *(volatile u_int16_t *)(BS_BASE + BS_ROMCR) = bs_romcr;
-}
-
-void
-mc88410_inv(void)
-{
- u_int16_t bs_gcsr, bs_romcr;
-
- bs_gcsr = *(volatile u_int16_t *)(BS_BASE + BS_GCSR);
- bs_romcr = *(volatile u_int16_t *)(BS_BASE + BS_ROMCR);
-
- /* clear WEN0 and WEN1 in ROMCR (disables writes to FLASH) */
- *(volatile u_int16_t *)(BS_BASE + BS_ROMCR) =
- bs_romcr & ~(BS_ROMCR_WEN0 | BS_ROMCR_WEN1);
-
- /* set XCC bit in GCSR (0xFF8xxxxx now decodes to mc88410) */
- *(volatile u_int16_t *)(BS_BASE + BS_GCSR) = bs_gcsr | BS_GCSR_XCC;
-
- /* send command */
- *(volatile uint64_t *)XCC_ADDR = (uint64_t)XCC_INV_ALL << 32;
-
- /*
- * The 88410 will not let the 88110 access it until the
- * invalidate all operation is complete. Simply force a read
- * access which will spin as long as necessary.
- */
- (void)*(volatile u_int32_t *)(BS_BASE + BS_XCCR);
-
- /* just in case it didn't, spin until the operation is complete */
- while ((*(volatile u_int32_t *)(BS_BASE + BS_XCCR) & BS_XCC_FBSY) != 0)
- ;
-
- *(volatile u_int16_t *)(BS_BASE + BS_GCSR) = bs_gcsr;
- *(volatile u_int16_t *)(BS_BASE + BS_ROMCR) = bs_romcr;
-}
-
-void
-mc88410_wbinv(void)
-{
- u_int16_t bs_gcsr, bs_romcr;
-
- bs_gcsr = *(volatile u_int16_t *)(BS_BASE + BS_GCSR);
- bs_romcr = *(volatile u_int16_t *)(BS_BASE + BS_ROMCR);
-
- /* clear WEN0 and WEN1 in ROMCR (disables writes to FLASH) */
- *(volatile u_int16_t *)(BS_BASE + BS_ROMCR) =
- bs_romcr & ~(BS_ROMCR_WEN0 | BS_ROMCR_WEN1);
-
- /* set XCC bit in GCSR (0xFF8xxxxx now decodes to mc88410) */
- *(volatile u_int16_t *)(BS_BASE + BS_GCSR) = bs_gcsr | BS_GCSR_XCC;
-
- /* send wb command */
- *(volatile uint64_t *)XCC_ADDR = (uint64_t)XCC_WB_ALL << 32;
-
- /* spin until the operation is complete */
- while ((*(volatile u_int32_t *)(BS_BASE + BS_XCCR) & BS_XCC_FBSY) != 0)
- ;
-
- /* send inv command */
- *(volatile uint64_t *)XCC_ADDR = (uint64_t)XCC_INV_ALL << 32;
-
- /*
- * The 88410 will not let the 88110 access it until the
- * invalidate all operation is complete. Simply force a read
- * access which will spin as long as necessary.
- */
- (void)*(volatile u_int32_t *)(BS_BASE + BS_XCCR);
-
- /* just in case it didn't, spin until the operation is complete */
- while ((*(volatile u_int32_t *)(BS_BASE + BS_XCCR) & BS_XCC_FBSY) != 0)
- ;
-
- *(volatile u_int16_t *)(BS_BASE + BS_GCSR) = bs_gcsr;
- *(volatile u_int16_t *)(BS_BASE + BS_ROMCR) = bs_romcr;
-}
diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c
deleted file mode 100644
index 018cef9a92a..00000000000
--- a/sys/arch/mvme88k/mvme88k/machdep.c
+++ /dev/null
@@ -1,1080 +0,0 @@
-/* $OpenBSD: machdep.c,v 1.260 2014/03/13 03:52:55 dlg Exp $ */
-/*
- * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
- * Copyright (c) 1996 Nivas Madhur
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Nivas Madhur.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-/*
- * Mach Operating System
- * Copyright (c) 1993-1991 Carnegie Mellon University
- * Copyright (c) 1991 OMRON Corporation
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/user.h>
-#include <sys/buf.h>
-#include <sys/reboot.h>
-#include <sys/conf.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-#include <sys/mount.h>
-#include <sys/msgbuf.h>
-#include <sys/syscallargs.h>
-#include <sys/exec.h>
-#include <sys/sysctl.h>
-#include <sys/errno.h>
-#include <sys/extent.h>
-#include <sys/core.h>
-#include <sys/kcore.h>
-#include <dev/rndvar.h>
-
-#include <uvm/uvm.h>
-
-#include <machine/asm.h>
-#include <machine/asm_macro.h>
-#include <machine/board.h>
-#include <machine/bug.h>
-#include <machine/bugio.h>
-#include <machine/cmmu.h>
-#include <machine/cpu.h>
-#include <machine/kcore.h>
-#include <machine/reg.h>
-#ifdef M88100
-#include <machine/m88100.h>
-#endif
-#ifdef MVME197
-#include <machine/m88410.h>
-#endif
-
-#include <mvme88k/mvme88k/clockvar.h>
-
-#include <dev/cons.h>
-
-#include <net/if.h>
-
-#include "ksyms.h"
-#if DDB
-#include <machine/db_machdep.h>
-#include <ddb/db_extern.h>
-#include <ddb/db_interface.h>
-#include <ddb/db_var.h>
-#endif /* DDB */
-
-/*
- * Dummy routines and data to be able to handle unexpected situations and
- * at least report them, until enough of the kernel is initialized.
- */
-static u_int
-dummy_func(void)
-{
- return 0;
-}
-static const struct board dummy_board = {
- .getipl = (u_int (*)(void))dummy_func,
- .setipl = (u_int (*)(u_int))dummy_func,
- .raiseipl = (u_int (*)(u_int))dummy_func
-};
-#ifdef MULTIPROCESSOR
-struct cpu_info dummy_cpu = {
- .ci_flags = CIF_ALIVE | CIF_PRIMARY,
- .ci_cpuid = 0,
- .ci_mp_atomic_begin =
- (uint32_t (*)(__cpu_simple_lock_t *, uint*))dummy_func,
- .ci_mp_atomic_end =
- (void (*)(uint32_t, __cpu_simple_lock_t *, uint))dummy_func
-};
-#endif
-
-void consinit(void);
-void cpu_hatch_secondary_processors(void *);
-void dumpconf(void);
-void dumpsys(void);
-void identifycpu(void);
-void mvme_bootstrap(void);
-void mvme88k_vector_init(uint32_t *, uint32_t *);
-void myetheraddr(u_char *);
-void savectx(struct pcb *);
-void secondary_main(void);
-vaddr_t secondary_pre_main(void);
-void _doboot(void);
-
-extern int kernelstart;
-register_t kernel_vbr;
-intrhand_t intr_handlers[NVMEINTR];
-
-const struct board *platform = &dummy_board;
-
-int physmem; /* available physical memory, in pages */
-
-struct vm_map *exec_map = NULL;
-struct vm_map *phys_map = NULL;
-
-#ifdef MULTIPROCESSOR
-__cpu_simple_lock_t cpu_hatch_mutex;
-__cpu_simple_lock_t cpu_boot_mutex = __SIMPLELOCK_LOCKED;
-#endif
-
-/*
- * 32 or 34 bit physical address bus depending upon the CPU flavor.
- * 32 bit DMA.
- */
-struct uvm_constraint_range dma_constraint = { 0x0, 0xffffffffUL};
-struct uvm_constraint_range *uvm_md_constraints[] = { NULL };
-
-/*
- * Info for CTL_HW
- */
-char machine[] = MACHINE; /* cpu "architecture" */
-char cpu_model[120];
-
-int bootdev; /* set in locore.S */
-int cputyp; /* set in locore.S */
-int brdtyp; /* set in locore.S */
-int cpuspeed = 25; /* safe guess */
-u_int dumb_delay_const = 25;
-
-vaddr_t first_addr;
-vaddr_t last_addr;
-
-extern struct user *proc0paddr;
-
-struct intrhand clock_ih;
-struct intrhand statclock_ih;
-
-/*
- * Statistics clock interval and variance, in usec. Variance must be a
- * power of two. Since this gives us an even number, not an odd number,
- * we discard one case and compensate. That is, a variance of 4096 would
- * give us offsets in [0..4095]. Instead, we take offsets in [1..4095].
- * This is symmetric about the point 2048, or statvar/2, and thus averages
- * to that value (assuming uniform random numbers).
- */
-int statvar = 8192;
-int statmin; /* statclock interval - 1/2*variance */
-
-#if defined (MVME187) || defined (MVME197)
-#define ETHERPAGES 16
-void *etherbuf = NULL;
-int etherlen;
-#endif
-
-#if defined(MVME181) || defined(MVME188)
-/*
- * Interrupt masks, one per IPL level.
- */
-u_int32_t int_mask_val[NIPLS];
-#endif
-
-/*
- * This is to fake out the console routines, while booting.
- */
-cons_decl(boot);
-#define bootcnpollc nullcnpollc
-
-struct consdev bootcons = {
- NULL,
- NULL,
- bootcngetc,
- bootcnputc,
- bootcnpollc,
- NULL,
- makedev(14, 0),
- CN_LOWPRI,
-};
-
-/*
- * Early console initialization: called early on from main, before vm init.
- * We want to stick to the BUG routines for now, and we'll switch to the
- * real console in cpu_startup().
- */
-void
-consinit()
-{
- cn_tab = &bootcons;
-
-#if defined(DDB)
- db_machine_init();
- ddb_init();
- if (boothowto & RB_KDB)
- Debugger();
-#endif
-}
-
-void
-identifycpu()
-{
- struct mvmeprom_brdid brdid;
- char suffix[4];
- u_int i;
-
- bzero(&brdid, sizeof(brdid));
- bugbrdid(&brdid);
-
- cpuspeed = platform->cpuspeed(&brdid);
-
- i = 0;
- if (brdid.suffix[0] >= ' ' && brdid.suffix[0] < 0x7f) {
- if (brdid.suffix[0] != '-')
- suffix[i++] = '-';
- suffix[i++] = brdid.suffix[0];
- }
- if (brdid.suffix[1] >= ' ' && brdid.suffix[1] < 0x7f)
- suffix[i++] = brdid.suffix[1];
- suffix[i++] = '\0';
-
- snprintf(cpu_model, sizeof cpu_model,
- "Motorola MVME%x%s, %dMHz", brdtyp, suffix, cpuspeed);
-}
-
-void
-cpu_initclocks()
-{
- platform->init_clocks();
-}
-
-void
-setstatclockrate(int newhz)
-{
- /* function stub */
-}
-
-void
-cpu_startup()
-{
- int i;
- vaddr_t minaddr, maxaddr;
-
- /*
- * Good {morning,afternoon,evening,night}.
- */
- printf(version);
- identifycpu();
- printf("real mem = %u (%uMB)\n", ptoa(physmem),
- ptoa(physmem)/1024/1024);
-
- /*
- * Allocate a submap for exec arguments. This map effectively
- * limits the number of processes exec'ing at any time.
- */
- minaddr = vm_map_min(kernel_map);
- exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
- 16 * NCARGS, VM_MAP_PAGEABLE, FALSE, NULL);
-
- /*
- * Allocate map for physio.
- */
- phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
- VM_PHYS_SIZE, 0, FALSE, NULL);
-
- printf("avail mem = %lu (%luMB)\n", ptoa(uvmexp.free),
- ptoa(uvmexp.free)/1024/1024);
-
- /*
- * Set up buffers, so they can be used to read disk labels.
- */
- bufinit();
-
- /*
- * Set up interrupt handlers.
- */
- for (i = 0; i < NVMEINTR; i++)
- SLIST_INIT(&intr_handlers[i]);
-
- /*
- * Configure the system.
- */
- if (boothowto & RB_CONFIG) {
-#ifdef BOOT_CONFIG
- user_config();
-#else
- printf("kernel does not support -c; continuing..\n");
-#endif
- }
-}
-
-__dead void
-_doboot()
-{
- cold = 0;
- cmmu_shutdown();
- set_vbr(0); /* restore BUG VBR */
- bugreturn();
- /*NOTREACHED*/
- for (;;); /* appease gcc */
-}
-
-__dead void
-boot(howto)
- int howto;
-{
- struct device *mainbus;
-
- /* take a snapshot before clobbering any registers */
- if (curproc && curproc->p_addr)
- savectx(curpcb);
-
- /* If system is cold, just halt. */
- if (cold) {
- /* (Unless the user explicitly asked for reboot.) */
- if ((howto & RB_USERREQ) == 0)
- howto |= RB_HALT;
- goto haltsys;
- }
-
- boothowto = howto;
- if ((howto & RB_NOSYNC) == 0) {
- vfs_shutdown();
- /*
- * If we've been adjusting the clock, the todr
- * will be out of synch; adjust it now unless
- * the system was sitting in ddb.
- */
- if ((howto & RB_TIMEBAD) == 0)
- resettodr();
- else
- printf("WARNING: not updating battery clock\n");
- }
- if_downall();
-
- uvm_shutdown();
- splhigh(); /* Disable interrupts. */
-
- /* If rebooting and a dump is requested, do it. */
- if (howto & RB_DUMP)
- dumpsys();
-
-haltsys:
- doshutdownhooks();
- mainbus = device_mainbus();
- if (mainbus != NULL)
- config_suspend(mainbus, DVACT_POWERDOWN);
-
- if (howto & RB_HALT) {
- printf("System halted. Press any key to reboot...\n\n");
- cnpollc(1);
- cngetc();
- cnpollc(0);
- }
-
- if (platform->reboot != NULL)
- platform->reboot(howto);
-
- doboot(); /* will invoke _doboot on a 1:1 mapped stack */
- /*NOTREACHED*/
-}
-
-unsigned dumpmag = 0x8fca0101; /* magic number for savecore */
-int dumpsize = 0; /* also for savecore */
-long dumplo = 0;
-cpu_kcore_hdr_t cpu_kcore_hdr;
-
-/*
- * This is called by configure to set dumplo and dumpsize.
- * Dumps always skip the first PAGE_SIZE of disk space
- * in case there might be a disk label stored there.
- * If there is extra space, put dump at the end to
- * reduce the chance that swapping trashes it.
- */
-void
-dumpconf(void)
-{
- int nblks; /* size of dump area */
-
- if (dumpdev == NODEV ||
- (nblks = (bdevsw[major(dumpdev)].d_psize)(dumpdev)) == 0)
- return;
- if (nblks <= ctod(1))
- return;
-
- dumpsize = physmem;
-
- /* mvme88k only uses a single segment. */
- cpu_kcore_hdr.ram_segs[0].start = 0;
- cpu_kcore_hdr.ram_segs[0].size = ptoa(physmem);
- cpu_kcore_hdr.cputype = cputyp;
-
- /*
- * Don't dump on the first block
- * in case the dump device includes a disk label.
- */
- if (dumplo < ctod(1))
- dumplo = ctod(1);
-
- /* Put dump at end of partition, and make it fit. */
- if (dumpsize + 1 > dtoc(nblks - dumplo))
- dumpsize = dtoc(nblks - dumplo) - 1;
- if (dumplo < nblks - ctod(dumpsize) - 1)
- dumplo = nblks - ctod(dumpsize) - 1;
-}
-
-/*
- * Doadump comes here after turning off memory management and
- * getting on the dump stack, either when called above, or by
- * the auto-restart code.
- */
-void
-dumpsys()
-{
- int maj;
- int psize;
- daddr_t blkno; /* current block to write */
- /* dump routine */
- int (*dump)(dev_t, daddr_t, caddr_t, size_t);
- int pg; /* page being dumped */
- paddr_t maddr; /* PA being dumped */
- int error; /* error code from (*dump)() */
- kcore_seg_t *kseg_p;
- cpu_kcore_hdr_t *chdr_p;
- char dump_hdr[dbtob(1)]; /* XXX assume hdr fits in 1 block */
-
- extern int msgbufmapped;
-
- msgbufmapped = 0;
-
- /* Make sure dump device is valid. */
- if (dumpdev == NODEV)
- return;
- if (dumpsize == 0) {
- dumpconf();
- if (dumpsize == 0)
- return;
- }
- maj = major(dumpdev);
- if (dumplo < 0) {
- printf("\ndump to dev %u,%u not possible\n", maj,
- minor(dumpdev));
- return;
- }
- dump = bdevsw[maj].d_dump;
- blkno = dumplo;
-
- printf("\ndumping to dev %u,%u offset %ld\n", maj,
- minor(dumpdev), dumplo);
-
-#ifdef UVM_SWAP_ENCRYPT
- uvm_swap_finicrypt_all();
-#endif
-
- /* Setup the dump header */
- kseg_p = (kcore_seg_t *)dump_hdr;
- chdr_p = (cpu_kcore_hdr_t *)&dump_hdr[ALIGN(sizeof(*kseg_p))];
- bzero(dump_hdr, sizeof(dump_hdr));
-
- CORE_SETMAGIC(*kseg_p, KCORE_MAGIC, MID_MACHINE, CORE_CPU);
- kseg_p->c_size = dbtob(1) - ALIGN(sizeof(*kseg_p));
- *chdr_p = cpu_kcore_hdr;
-
- printf("dump ");
- psize = (*bdevsw[maj].d_psize)(dumpdev);
- if (psize == -1) {
- printf("area unavailable\n");
- return;
- }
-
- /* Dump the header. */
- error = (*dump)(dumpdev, blkno++, (caddr_t)dump_hdr, dbtob(1));
- if (error != 0)
- goto abort;
-
- maddr = (paddr_t)0;
- for (pg = 0; pg < dumpsize; pg++) {
-#define NPGMB (1024 * 1024 / PAGE_SIZE)
- /* print out how many MBs we have dumped */
- if (pg != 0 && (pg % NPGMB) == 0)
- printf("%d ", pg / NPGMB);
-#undef NPGMB
- error = (*dump)(dumpdev, blkno, (caddr_t)maddr, PAGE_SIZE);
- if (error == 0) {
- maddr += PAGE_SIZE;
- blkno += btodb(PAGE_SIZE);
- } else
- break;
- }
-abort:
- switch (error) {
- case 0:
- printf("succeeded\n");
- break;
-
- case ENXIO:
- printf("device bad\n");
- break;
-
- case EFAULT:
- printf("device not ready\n");
- break;
-
- case EINVAL:
- printf("area improper\n");
- break;
-
- case EIO:
- printf("i/o error\n");
- break;
-
- case EINTR:
- printf("aborted from console\n");
- break;
-
- default:
- printf("error %d\n", error);
- break;
- }
-}
-
-#ifdef MULTIPROCESSOR
-
-/*
- * Secondary CPU early initialization routine.
- * Determine CPU number and set it, then allocate the startup stack.
- *
- * Running on a minimal stack here, with interrupts disabled; do nothing fancy.
- */
-vaddr_t
-secondary_pre_main()
-{
- struct cpu_info *ci;
- vaddr_t init_stack;
-
- /*
- * Invoke the CMMU initialization routine as early as possible,
- * so that we do not risk any memory writes to be lost during
- * cache setup.
- */
- cmmu_initialize_cpu(cmmu_cpu_number());
-
- /*
- * Now initialize your cpu_info structure.
- */
- set_cpu_number(cmmu_cpu_number());
- ci = curcpu();
- ci->ci_curproc = &proc0;
- platform->smp_setup(ci);
-
- splhigh();
-
- /*
- * Enable MMU on this processor.
- */
- pmap_bootstrap_cpu(ci->ci_cpuid);
-
- /*
- * Allocate UPAGES contiguous pages for the startup stack.
- */
- init_stack = uvm_km_zalloc(kernel_map, USPACE);
- if (init_stack == (vaddr_t)NULL) {
- printf("cpu%d: unable to allocate startup stack\n",
- ci->ci_cpuid);
- __cpu_simple_unlock(&cpu_hatch_mutex);
- for (;;) ;
- }
-
- return (init_stack);
-}
-
-/*
- * Further secondary CPU initialization.
- *
- * We are now running on our startup stack, with proper page tables.
- * There is nothing to do but display some details about the CPU and its CMMUs.
- */
-void
-secondary_main()
-{
- struct cpu_info *ci = curcpu();
- int s;
-
- cpu_configuration_print(0);
- ncpus++;
-
- sched_init_cpu(ci);
- nanouptime(&ci->ci_schedstate.spc_runtime);
- ci->ci_curproc = NULL;
- ci->ci_randseed = (arc4random() & 0x7fffffff) + 1;
-
- __cpu_simple_unlock(&cpu_hatch_mutex);
-
- /* wait for cpu_boot_secondary_processors() */
- __cpu_simple_lock(&cpu_boot_mutex);
- __cpu_simple_unlock(&cpu_boot_mutex);
-
- spl0();
- SCHED_LOCK(s);
- set_psr(get_psr() & ~PSR_IND);
-
- SET(ci->ci_flags, CIF_ALIVE);
-
- cpu_switchto(NULL, sched_chooseproc());
-}
-
-#endif /* MULTIPROCESSOR */
-
-/*
- * Search for the first available interrupt vector in the range start, end.
- * This should really only be used by VME devices.
- */
-int
-intr_findvec(int start, int end, int skip)
-{
- int vec;
-
-#ifdef DEBUG
- if (start < 0 || end >= NVMEINTR || start > end)
- panic("intr_findvec(%d,%d): bad parameters", start, end);
-#endif
-
- for (vec = start; vec <= end; vec++) {
- if (vec == skip)
- continue;
- if (SLIST_EMPTY(&intr_handlers[vec]))
- return vec;
- }
-#ifdef DIAGNOSTIC
- printf("intr_findvec(%d,%d,%d): no vector available\n",
- start, end, skip);
-#endif
- return -1;
-}
-
-/*
- * Try to insert ih in the list of handlers for vector vec.
- */
-int
-intr_establish(int vec, struct intrhand *ih, const char *name)
-{
- struct intrhand *intr;
- intrhand_t *list;
-
- list = &intr_handlers[vec];
- if (!SLIST_EMPTY(list)) {
- intr = SLIST_FIRST(list);
- if (intr->ih_ipl != ih->ih_ipl) {
-#ifdef DIAGNOSTIC
- panic("intr_establish: there are other handlers with "
- "vec (0x%x) at ipl %x, but you want it at %x",
- vec, intr->ih_ipl, ih->ih_ipl);
-#endif /* DIAGNOSTIC */
- return EINVAL;
- }
- }
-
- evcount_attach(&ih->ih_count, name, &ih->ih_ipl);
- SLIST_INSERT_HEAD(list, ih, ih_link);
-
- return 0;
-}
-
-void
-nmihand(void *frame)
-{
-#ifdef DDB
- printf("Abort switch pressed\n");
- if (db_console) {
- /*
- * We can't use Debugger() here, as we are coming from an
- * exception handler, and can't assume anything about the
- * state we are in. Invoke the post-trap ddb entry directly.
- */
- extern void m88k_db_trap(int, struct trapframe *);
- m88k_db_trap(T_KDB_ENTRY, (struct trapframe *)frame);
- }
-#endif
-}
-
-int
-sys_sysarch(p, v, retval)
- struct proc *p;
- void *v;
- register_t *retval;
-{
-#if 0
- struct sys_sysarch_args /* {
- syscallarg(int) op;
- syscallarg(char *) parm;
- } */ *uap = v;
-#endif
-
- return (ENOSYS);
-}
-
-/*
- * machine dependent system variables.
- */
-
-int
-cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
- int *name;
- u_int namelen;
- void *oldp;
- size_t *oldlenp;
- void *newp;
- size_t newlen;
- struct proc *p;
-{
- dev_t consdev;
-
- /* all sysctl names are this level are terminal */
- if (namelen != 1)
- return (ENOTDIR); /* overloaded */
-
- switch (name[0]) {
- case CPU_CONSDEV:
- if (cn_tab != NULL)
- consdev = cn_tab->cn_dev;
- else
- consdev = NODEV;
- return (sysctl_rdstruct(oldp, oldlenp, newp, &consdev,
- sizeof consdev));
- case CPU_CPUTYPE:
- return (sysctl_rdint(oldp, oldlenp, newp, cputyp));
- default:
- return (EOPNOTSUPP);
- }
- /*NOTREACHED*/
-}
-
-void
-myetheraddr(cp)
- u_char *cp;
-{
- struct mvmeprom_brdid brdid;
-
- bugbrdid(&brdid);
- bcopy(&brdid.etheraddr, cp, 6);
-}
-
-void
-mvme88k_vector_init(uint32_t *bugvbr, uint32_t *vectors)
-{
- extern vaddr_t vector_init(uint32_t *, uint32_t *, int); /* gross */
- unsigned long bugvec[32];
- uint i;
-
- /*
- * Set up bootstrap vectors, overwriting the existing BUG vbr
- * page. This allows us to keep the BUG system call vectors.
- */
-
- for (i = 0; i < 16 * 2; i++)
- bugvec[i] = bugvbr[MVMEPROM_VECTOR * 2 + i];
- vector_init(bugvbr, vectors, 1);
- for (i = 0; i < 16 * 2; i++)
- bugvbr[MVMEPROM_VECTOR * 2 + i] = bugvec[i];
-
- /*
- * Set up final vectors.
- */
-
- kernel_vbr = trunc_page((vaddr_t)&kernelstart);
- vector_init((uint32_t *)kernel_vbr, vectors, 0);
-}
-
-/*
- * Called from locore.S during boot,
- * this is the first C code that's run.
- */
-void
-mvme_bootstrap()
-{
- extern struct consdev *cn_tab;
- struct mvmeprom_brdid brdid;
- extern vaddr_t avail_start;
- extern vaddr_t avail_end;
-#ifndef MULTIPROCESSOR
- cpuid_t master_cpu;
-#endif
-
- buginit();
- bugbrdid(&brdid);
- brdtyp = brdid.model;
-
- /*
- * Use the BUG as console for now. After autoconf, we'll switch to
- * real hardware.
- */
- cn_tab = &bootcons;
-
- /*
- * Set up interrupt and fp exception handlers based on the machine.
- */
- switch (brdtyp) {
-#ifdef MVME181
- case BRD_180:
- case BRD_181:
- platform = &board_mvme181;
- break;
-#endif
-#ifdef MVME187
- case BRD_187:
- case BRD_8120:
- platform = &board_mvme187;
- break;
-#endif
-#ifdef MVME188
- case BRD_188:
- platform = &board_mvme188;
- break;
-#endif
-#ifdef MVME197
- case BRD_197:
- if (mc88410_present())
- platform = &board_mvme197spdp;
- else
- platform = &board_mvme197le;
- break;
-#endif
- default:
- panic("Sorry, this kernel does not support MVME%x", brdtyp);
- }
-
- platform->bootstrap();
-
- uvmexp.pagesize = PAGE_SIZE;
- uvm_setpagesize();
- first_addr = round_page(first_addr);
- last_addr = platform->memsize();
- physmem = atop(last_addr);
-
- cmmu = platform->cmmu;
- setup_board_config();
- master_cpu = cmmu_init();
- set_cpu_number(master_cpu);
-#ifdef MULTIPROCESSOR
- platform->smp_setup(curcpu());
-#endif
- SET(curcpu()->ci_flags, CIF_ALIVE | CIF_PRIMARY);
-
-#ifdef M88100
- if (CPU_IS88100) {
- m88100_apply_patches();
- }
-#endif
-
- /*
- * Now that set_cpu_number() set us with a valid cpu_info pointer,
- * we need to initialize p_addr and curpcb before autoconf, for the
- * fault handler to behave properly [except for badaddr() faults,
- * which can be taken care of without a valid curcpu()].
- */
- proc0.p_addr = proc0paddr;
- curproc = &proc0;
- curpcb = &proc0paddr->u_pcb;
-
- avail_start = first_addr; /* first page of memory after kernel image */
- avail_end = last_addr; /* last page of memory */
-
-#ifdef DEBUG
- printf("MVME%x boot: memory from 0x%x to 0x%x\n",
- brdtyp, avail_start, avail_end);
-#endif
- /*
- * Tell the VM system about available physical memory.
- *
- * The mvme88k boards only have one contiguous area, although BUG
- * could be set up to configure a non-contiguous scheme; also, we
- * might want to register ECC memory separately later on...
- */
- uvm_page_physload(atop(avail_start), atop(avail_end),
- atop(avail_start), atop(avail_end), 0);
-
- /*
- * Initialize message buffer.
- */
- initmsgbuf((caddr_t)pmap_steal_memory(MSGBUFSIZE, NULL, NULL),
- MSGBUFSIZE);
-
- pmap_bootstrap(0, 0x10000); /* BUG needs 64KB */
-
-#if defined (MVME187) || defined (MVME197)
- /*
- * Get ethernet buffer - need ETHERPAGES pages physically contiguous.
- * XXX need to fix ie(4) to support non-1:1 mapped buffers
- */
- if (brdtyp == BRD_187 || brdtyp == BRD_8120 || brdtyp == BRD_197) {
- etherlen = ETHERPAGES * PAGE_SIZE;
- etherbuf = (void *)uvm_pageboot_alloc(etherlen);
- pmap_cache_ctrl((paddr_t)etherbuf, (paddr_t)etherbuf + etherlen,
- CACHE_INH);
- }
-#endif /* defined (MVME187) || defined (MVME197) */
-
- /* Initialize the "u-area" pages. */
- bzero((caddr_t)curpcb, USPACE);
-#ifdef DEBUG
- printf("leaving mvme_bootstrap()\n");
-#endif
-}
-
-#ifdef MULTIPROCESSOR
-void
-cpu_hatch_secondary_processors(void *unused)
-{
- struct cpu_info *ci = curcpu();
- cpuid_t cpu;
- int rc;
- extern void secondary_start(void);
-
- switch (brdtyp) {
-#if defined(MVME188) || defined(MVME197)
-#ifdef MVME188
- case BRD_188:
-#endif
-#ifdef MVME197
- case BRD_197:
-#endif
- for (cpu = 0; cpu < ncpusfound; cpu++) {
- if (cpu != ci->ci_cpuid) {
- __cpu_simple_lock(&cpu_hatch_mutex);
- rc = spin_cpu(cpu, (vaddr_t)secondary_start);
- switch (rc) {
- case 0:
- __cpu_simple_lock(&cpu_hatch_mutex);
- break;
- default:
- printf("cpu%d: spin_cpu error %d\n",
- cpu, rc);
- /* FALLTHROUGH */
- case FORKMPU_NO_MPU:
- break;
- }
- __cpu_simple_unlock(&cpu_hatch_mutex);
- }
- }
- break;
-#endif
- default:
- break;
- }
-}
-
-void
-cpu_boot_secondary_processors()
-{
- __cpu_simple_unlock(&cpu_boot_mutex);
-}
-#endif
-
-/*
- * Boot console routines:
- * Enables printing of boot messages before consinit().
- */
-void
-bootcnprobe(cp)
- struct consdev *cp;
-{
- cp->cn_dev = makedev(14, 0);
- cp->cn_pri = CN_LOWPRI;
-}
-
-void
-bootcninit(cp)
- struct consdev *cp;
-{
- /* Nothing to do */
-}
-
-int
-bootcngetc(dev)
- dev_t dev;
-{
- return (buginchr());
-}
-
-void
-bootcnputc(dev, c)
- dev_t dev;
- int c;
-{
- bugoutchr(c);
-}
-
-int
-getipl(void)
-{
- return (int)platform->getipl();
-}
-
-int
-setipl(int level)
-{
- return (int)platform->setipl((u_int)level);
-}
-
-int
-raiseipl(int level)
-{
- return (int)platform->raiseipl((u_int)level);
-}
-
-#ifdef MULTIPROCESSOR
-
-void
-m88k_send_ipi(int ipi, cpuid_t cpu)
-{
- struct cpu_info *ci;
-
- ci = &m88k_cpus[cpu];
- if (ISSET(ci->ci_flags, CIF_ALIVE))
- platform->send_ipi(ipi, cpu);
-}
-
-void
-m88k_broadcast_ipi(int ipi)
-{
- struct cpu_info *us = curcpu();
- struct cpu_info *ci;
- CPU_INFO_ITERATOR cii;
-
- CPU_INFO_FOREACH(cii, ci) {
- if (ci == us)
- continue;
-
- if (ISSET(ci->ci_flags, CIF_ALIVE))
- platform->send_ipi(ipi, ci->ci_cpuid);
- }
-}
-
-#endif
-
-void
-delay(int us)
-{
- platform->delay(us);
-}
diff --git a/sys/arch/mvme88k/mvme88k/pmap_table.c b/sys/arch/mvme88k/mvme88k/pmap_table.c
deleted file mode 100644
index 63c714853cc..00000000000
--- a/sys/arch/mvme88k/mvme88k/pmap_table.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* $OpenBSD: pmap_table.c,v 1.26 2013/05/17 22:46:28 miod Exp $ */
-
-/*
- * Mach Operating System
- * Copyright (c) 1993-1992 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <machine/board.h>
-#include <machine/pmap_table.h>
-
-const struct pmap_table *
-pmap_table_build()
-{
- return platform->ptable;
-}
diff --git a/sys/arch/mvme88k/stand/Makefile b/sys/arch/mvme88k/stand/Makefile
deleted file mode 100644
index ee09f5e15c1..00000000000
--- a/sys/arch/mvme88k/stand/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# $OpenBSD: Makefile,v 1.8 2013/05/12 10:43:45 miod Exp $
-
-.if ${MACHINE} == "mvme88k"
-SUBDIR= bugcrt libbug libsa libz
-SUBDIR+= bootxx bootsd wrtvid bootst
-SUBDIR+= netboot sboot tftpboot
-.endif
-
-SUBDIR+=installboot
-
-.include <bsd.subdir.mk>
diff --git a/sys/arch/mvme88k/stand/Makefile.inc b/sys/arch/mvme88k/stand/Makefile.inc
deleted file mode 100644
index d5fd9d07fd0..00000000000
--- a/sys/arch/mvme88k/stand/Makefile.inc
+++ /dev/null
@@ -1,13 +0,0 @@
-# $OpenBSD: Makefile.inc,v 1.13 2013/04/18 20:43:16 miod Exp $
-
-MDEC_DIR?=/usr/mdec
-CFLAGS+=-Wall -Werror -fno-stack-protector -mmemcpy
-CFLAGS+=-fno-builtin-printf -fno-builtin-putchar -fno-builtin-vprintf
-CFLAGS+=-DHEAP_START=${HEAP_START}
-
-# Load addresses for first and second stage bootstraps
-STAGE1_RELOC= 0x00680000
-STAGE2_RELOC= 0x00780000
-
-# Base of the heap (ethernet buffers will be allocated below it)
-HEAP_START= 0x00700000
diff --git a/sys/arch/mvme88k/stand/bootsd/Makefile b/sys/arch/mvme88k/stand/bootsd/Makefile
deleted file mode 100644
index 243d4e1622b..00000000000
--- a/sys/arch/mvme88k/stand/bootsd/Makefile
+++ /dev/null
@@ -1,37 +0,0 @@
-# from: @(#)Makefile 8.1 (Berkeley) 6/10/93
-# $OpenBSD: Makefile,v 1.18 2013/01/16 20:45:09 miod Exp $
-
-S= ${.CURDIR}/../../../..
-DEFS=
-INCPATH=-I${.CURDIR} -I${.CURDIR}/../libsa -I${.CURDIR}/../libbug \
- -I${.CURDIR}/../../include -I${S} -I${S}/lib/libsa
-CFLAGS+=${INCPATH} ${DEFS} ${COPTS}
-LDFLAGS=-N -T ${S}/arch/mvme88k/stand/ld.script -Ttext ${STAGE2_RELOC}
-LDFLAGS+= -warn-common
-NOPIE=
-CLEANFILES+=bootsd
-
-.include "${S}/arch/mvme88k/stand/bugcrt/Makefile.inc"
-.include "${S}/arch/mvme88k/stand/libbug/Makefile.inc"
-.include "${S}/arch/mvme88k/stand/libsa/Makefile.inc"
-.include "${S}/arch/mvme88k/stand/libz/Makefile.inc"
-
-SRCS= boot.c conf.c version.c
-
-LIBS= ${LIBSA} ${LIBBUG} ${LIBZ}
-
-OBJS= ${SRCS:N*.h:R:S/$/.o/g}
-
-BOOTS= bootsd
-ALL= ${BOOTS}
-
-all: ${ALL}
-
-bootsd: ${STAGE2_CRT} ${OBJS} ${LIBS}
- ${LD} ${LDFLAGS} -o $@ \
- ${STAGE2_CRT} ${OBJS} ${LIBS} `${CC} -print-libgcc-file-name`
-
-install:
- install ${INSTALL_STRIP} -c -m 555 -g bin -o bin ${BOOTS} ${DESTDIR}${MDEC_DIR}
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/mvme88k/stand/bootsd/boot.c b/sys/arch/mvme88k/stand/bootsd/boot.c
deleted file mode 100644
index b30181874d5..00000000000
--- a/sys/arch/mvme88k/stand/bootsd/boot.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/* $OpenBSD: boot.c,v 1.10 2014/02/20 20:34:27 miod Exp $ */
-/* $NetBSD: boot.c,v 1.2 1995/09/23 03:42:52 gwr Exp $ */
-
-/*-
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)boot.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-#include <sys/stat.h>
-#define _KERNEL
-#include <sys/fcntl.h>
-#undef _KERNEL
-
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-
-int loadrandom(const char *, char *, size_t);
-
-int debug;
-int errno;
-extern const char *version;
-extern char rnddata[BOOTRANDOM_MAX];
-char line[80];
-
-int
-main()
-{
- char *cp, *file;
- int flag, ret;
- int ask = 0;
- int rnd_loaded = 0;
-
- printf(">> OpenBSD/mvme88k bootsd [%s]\n", version);
-
- ret = parse_args(&file, &flag);
-
- for (;;) {
- if (ask) {
- printf("boot: ");
- gets(line);
- if (line[0]) {
- bugargs.arg_start = line;
- cp = line;
- while (cp < (line + sizeof(line) -1) && *cp)
- cp++;
- bugargs.arg_end = cp;
- ret = parse_args(&file, &flag);
- }
- }
- if (ret) {
- printf("boot: -q returning to MVME-Bug\n");
- break;
- }
-
- if (rnd_loaded == 0)
- rnd_loaded = loadrandom(BOOTRANDOM, rnddata,
- sizeof(rnddata));
-
- exec_mvme(file, flag);
- printf("boot: %s: %s\n", file, strerror(errno));
- ask = 1;
- }
- return (0);
-}
-
-int
-loadrandom(const char *name, char *buf, size_t buflen)
-{
- struct stat sb;
- int fd;
- int rc = 0;
-
- fd = open(name, O_RDONLY);
- if (fd == -1) {
- if (errno != EPERM)
- printf("cannot open %s: %s\n", name, strerror(errno));
- return 0;
- }
- if (fstat(fd, &sb) == -1 || sb.st_uid != 0 || !S_ISREG(sb.st_mode) ||
- (sb.st_mode & (S_IWOTH|S_IROTH)))
- goto fail;
- (void) read(fd, buf, buflen);
- rc = 1;
-fail:
- close(fd);
- return rc;
-}
diff --git a/sys/arch/mvme88k/stand/bootsd/conf.c b/sys/arch/mvme88k/stand/bootsd/conf.c
deleted file mode 100644
index 1ed7dfb91ee..00000000000
--- a/sys/arch/mvme88k/stand/bootsd/conf.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/* $OpenBSD: conf.c,v 1.2 1998/08/22 08:57:29 smurph Exp $ */
-
-#include <sys/types.h>
-#include <machine/prom.h>
-
-#include <stand.h>
-#include <ufs.h>
-#include "libsa.h"
-
-struct fs_ops file_system[] = {
- { ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat },
-};
-int nfsys = sizeof(file_system)/sizeof(struct fs_ops);
-
-struct devsw devsw[] = {
- { "bugsc", bugscstrategy, bugscopen, bugscclose, bugscioctl },
-};
-int ndevs = (sizeof(devsw)/sizeof(devsw[0]));
-
-
diff --git a/sys/arch/mvme88k/stand/bootsd/version.c b/sys/arch/mvme88k/stand/bootsd/version.c
deleted file mode 100644
index 233644e4f6e..00000000000
--- a/sys/arch/mvme88k/stand/bootsd/version.c
+++ /dev/null
@@ -1,12 +0,0 @@
-/* $OpenBSD: version.c,v 1.9 2014/02/20 20:34:27 miod Exp $ */
-
-/*
- * 1.9 /etc/random.seed support
- * 1.8 ELF toolchain
- * 1.7 compiled with gcc 3.3.5
- * 1.6 allocation area changed to fix netboot buffers overwriting stack
- * 1.5 rewritten crt code, self-relocatable
- * 1.4 kernel loaded with loadfile, a.out and ELF formats
- * 1.3 rewritten startup code and general cleanup
- */
-const char *version = "1.9";
diff --git a/sys/arch/mvme88k/stand/bootst/Makefile b/sys/arch/mvme88k/stand/bootst/Makefile
deleted file mode 100644
index e4475fb9464..00000000000
--- a/sys/arch/mvme88k/stand/bootst/Makefile
+++ /dev/null
@@ -1,41 +0,0 @@
-# from: @(#)Makefile 8.1 (Berkeley) 6/10/93
-# $OpenBSD: Makefile,v 1.18 2013/11/06 19:37:06 miod Exp $
-
-S= ${.CURDIR}/../../../..
-DEFS= -DSTANDALONE -DCOMPAT_NOLABEL
-INCPATH=-I${.CURDIR} -I${.CURDIR}/../libsa -I${.CURDIR}/../libbug \
- -I${.CURDIR}/../../include -I${S} -I${S}/lib/libsa
-CFLAGS+=${INCPATH} ${DEFS} ${COPTS}
-LDFLAGS=-N -T ${S}/arch/mvme88k/stand/ld.script -Ttext ${STAGE2_RELOC}
-LDFLAGS+= -warn-common
-NOPIE=
-CLEANFILES+=stboot bootst bootst.bug
-
-.include "${S}/arch/mvme88k/stand/wrtvid/Makefile.inc"
-.include "${S}/arch/mvme88k/stand/bugcrt/Makefile.inc"
-.include "${S}/arch/mvme88k/stand/libbug/Makefile.inc"
-.include "${S}/arch/mvme88k/stand/libsa/Makefile.inc"
-.include "${S}/arch/mvme88k/stand/libz/Makefile.inc"
-
-SRCS= boot.c conf.c dev_tape.c rawfs.c version.c
-
-LIBS= ${LIBSA} ${LIBBUG} ${LIBZ}
-
-OBJS= ${SRCS:N*.h:R:S/$/.o/g}
-
-BOOTS= bootst stboot
-ALL= ${BOOTS}
-
-all: ${ALL}
-
-bootst.bug: ${STAGE1_CRT} ${OBJS} ${LIBS}
- ${LD} ${LDFLAGS} -o $@ \
- ${STAGE1_CRT} ${OBJS} ${LIBS} `${CC} -print-libgcc-file-name`
-
-bootst stboot: bootst.bug ${WRTVID}
- ${WRTVID} bootst.bug
-
-install:
- install -c -m 555 -g bin -o bin ${BOOTS} ${DESTDIR}${MDEC_DIR}
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/mvme88k/stand/bootst/boot.c b/sys/arch/mvme88k/stand/bootst/boot.c
deleted file mode 100644
index 8f24cd335da..00000000000
--- a/sys/arch/mvme88k/stand/bootst/boot.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* $OpenBSD: boot.c,v 1.6 2013/04/14 19:05:19 miod Exp $ */
-/*-
- * Changes Copyright (c) 1998 steve Murphree, Jr.
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)boot.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-
-extern const char *version;
-extern int errno;
-
-int main()
-{
- char line[80];
- char *filename;
- int bflag = 0;
- printf(">> OpenBSD/mvme88k tapeboot [%s]\n", version);
-
- *bugargs.arg_end = 0; /* ensure */
- parse_args(&filename, &bflag);
- filename = "2"; /* override */
-
- if (bflag & RB_ASKNAME) {
- printf("tapeboot: segment? [%s] ", filename);
- gets(line);
- if (line[0])
- filename = line;
- }
-
- exec_mvme(filename, bflag | RB_NOSYM);
-
- printf("tapeboot: %s: %s\n", filename, strerror(errno));
- return(0);
-}
diff --git a/sys/arch/mvme88k/stand/bootst/conf.c b/sys/arch/mvme88k/stand/bootst/conf.c
deleted file mode 100644
index 3fa22dd788e..00000000000
--- a/sys/arch/mvme88k/stand/bootst/conf.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/* $OpenBSD: conf.c,v 1.1 1998/12/15 06:09:51 smurph Exp $ */
-
-#include <stand.h>
-#include <rawfs.h>
-#include <dev_tape.h>
-
-struct fs_ops file_system[] = {
- {
- rawfs_open, rawfs_close, rawfs_read,
- rawfs_write, rawfs_seek, rawfs_stat,
- },
-};
-int nfsys = sizeof(file_system) / sizeof(file_system[0]);
-
-struct devsw devsw[] = {
- { "tape", tape_strategy, tape_open, tape_close, tape_ioctl },
-};
-int ndevs = sizeof(devsw) / sizeof(devsw[0]);
-
diff --git a/sys/arch/mvme88k/stand/bootst/dev_tape.c b/sys/arch/mvme88k/stand/bootst/dev_tape.c
deleted file mode 100644
index d6e9c3debc4..00000000000
--- a/sys/arch/mvme88k/stand/bootst/dev_tape.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/* $OpenBSD: dev_tape.c,v 1.4 2011/03/13 00:13:53 deraadt Exp $ */
-
-/*
- * Copyright (c) 1993 Paul Kranenburg
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Paul Kranenburg.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * This module implements a "raw device" interface suitable for
- * use by the stand-alone I/O library UFS file-system code, and
- * possibly for direct access (i.e. boot from tape).
- */
-
-#include <sys/types.h>
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-
-
-
-struct mvmeprom_dskio tape_ioreq;
-
-/*
- * This is a special version of devopen() for tape boot.
- * In this version, the file name is a numeric string of
- * one digit, which is passed to the device open so it
- * can open the appropriate tape segment.
- */
-int
-devopen(f, fname, file)
- struct open_file *f;
- const char *fname; /* normally "1" */
- char **file;
-{
- struct devsw *dp;
- int errorno;
-
- *file = (char *)fname;
- dp = &devsw[0];
- f->f_dev = dp;
-
- /* The following will call tape_open() */
- errorno = dp->dv_open(f, fname);
- return (errorno);
-}
-
-int
-tape_open(f, fname)
- struct open_file *f;
- char *fname; /* partition number, i.e. "1" */
-{
- int part;
- struct mvmeprom_dskio *ti;
-
- /*
- * Set the tape segment number to the one indicated
- * by the single digit fname passed in above.
- */
- if ((fname[0] < '0') && (fname[0] > '9')) {
- return ENOENT;
- }
- part = fname[0] - '0';
- fname = NULL;
-
- /*
- * Setup our part of the saioreq.
- * (determines what gets opened)
- */
- ti = &tape_ioreq;
- bzero((caddr_t)ti, sizeof(*ti));
-
- ti->ctrl_lun = bugargs.ctrl_lun;
- ti->dev_lun = bugargs.dev_lun;
- ti->status = 0;
- ti->pbuffer = NULL;
- ti->blk_num = part;
- ti->blk_cnt = 0;
- ti->flag = 0;
- ti->addr_mod = 0;
-
- f->f_devdata = ti;
-
- return (0);
-}
-
-int
-tape_close(f)
- struct open_file *f;
-{
- struct mvmeprom_dskio *ti;
-
-
- ti = f->f_devdata;
- f->f_devdata = NULL;
- return 0;
-}
-
-#define MVMEPROM_SCALE (512/MVMEPROM_BLOCK_SIZE)
-
-int
-tape_strategy(devdata, flag, dblk, size, buf, rsize)
- void *devdata;
- int flag;
- daddr32_t dblk;
- u_int size;
- char *buf;
- u_int *rsize;
-{
- struct mvmeprom_dskio *ti;
- int ret;
-
- ti = devdata;
-
- if (flag != F_READ)
- return(EROFS);
-
- ti->status = 0;
- ti->pbuffer = buf;
- /* don't change block #, set in open */
- ti->blk_cnt = size / (512 / MVMEPROM_SCALE);
-
- ret = mvmeprom_diskrd(ti);
-
- if (ret != 0)
- return (EIO);
-
- *rsize = (ti->blk_cnt / MVMEPROM_SCALE) * 512;
- ti->flag |= IGNORE_FILENUM; /* ignore next time */
-
- return (0);
-}
-
-int
-tape_ioctl()
-{
- return EIO;
-}
-
diff --git a/sys/arch/mvme88k/stand/bootst/dev_tape.h b/sys/arch/mvme88k/stand/bootst/dev_tape.h
deleted file mode 100644
index 84f01ab7897..00000000000
--- a/sys/arch/mvme88k/stand/bootst/dev_tape.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* $OpenBSD: dev_tape.h,v 1.3 2011/03/13 00:13:53 deraadt Exp $ */
-
-int tape_open(struct open_file *, ...);
-int tape_close(struct open_file *);
-int tape_strategy(void *, int, daddr32_t, size_t, void *, size_t *);
-int tape_ioctl();
-
diff --git a/sys/arch/mvme88k/stand/bootst/rawfs.c b/sys/arch/mvme88k/stand/bootst/rawfs.c
deleted file mode 100644
index eef045b19c2..00000000000
--- a/sys/arch/mvme88k/stand/bootst/rawfs.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/* $OpenBSD: rawfs.c,v 1.6 2013/04/14 19:05:19 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Gordon W. Ross
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- * 4. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Gordon W. Ross
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Raw file system - for stream devices like tapes.
- * No random access, only sequential read allowed.
- * This exists only to allow upper level code to be
- * shielded from the fact that the device must be
- * read only with whole block position and size.
- */
-
-#include <sys/param.h>
-#include <stand.h>
-#include <rawfs.h>
-
-/*
- * Must be a multiple of MVMEPROM_BLOCK_SIZE, and at least as large as
- * Z_BUFSIZE from libsa cread.c to be able to correctly emulate forward
- * seek.
- */
-#define RAWFS_BSIZE 4096
-
-/*
- * In-core open file.
- */
-struct cfile {
- off_t fs_bufpos; /* file position of fs_buf */
- int fs_len; /* amount left in f_buf */
- char * fs_ptr; /* read pointer into f_buf */
- char fs_buf[RAWFS_BSIZE];
-};
-
-static int rawfs_get_block(struct open_file *);
-static off_t rawfs_get_pos(struct cfile *);
-
-int
-rawfs_open(char *path, struct open_file *f)
-{
- struct cfile *fs;
-
- /*
- * The actual PROM driver has already been opened.
- * Just allocate the I/O buffer, etc.
- */
- fs = alloc(sizeof(struct cfile));
- fs->fs_bufpos = 0;
- fs->fs_len = 0;
- fs->fs_ptr = NULL; /* nothing read yet */
-
- f->f_fsdata = fs;
- return (0);
-}
-
-int
-rawfs_close(struct open_file *f)
-{
- struct cfile *fs;
-
- fs = (struct cfile *) f->f_fsdata;
- f->f_fsdata = NULL;
-
- if (fs != NULL)
- free(fs, sizeof(*fs));
-
- return (0);
-}
-
-int
-rawfs_read(struct open_file *f, void *start, size_t size, size_t *resid)
-{
- struct cfile *fs = (struct cfile *)f->f_fsdata;
- char *addr = start;
- int error = 0;
- size_t csize;
-
- while (size != 0) {
- if (fs->fs_len == 0)
- if ((error = rawfs_get_block(f)) != 0)
- break;
-
- if (fs->fs_len <= 0)
- break; /* EOF */
-
- csize = size;
- if (csize > fs->fs_len)
- csize = fs->fs_len;
-
- bcopy(fs->fs_ptr, addr, csize);
- fs->fs_ptr += csize;
- fs->fs_len -= csize;
- addr += csize;
- size -= csize;
- }
- if (resid)
- *resid = size;
- return (error);
-}
-
-int
-rawfs_write(struct open_file *f, void *start, size_t size, size_t *resid)
-{
- return (EROFS);
-}
-
-off_t
-rawfs_seek(struct open_file *f, off_t offset, int where)
-{
- struct cfile *fs = (struct cfile *)f->f_fsdata;
- off_t oldpos, basepos;
- int error;
-
- oldpos = rawfs_get_pos(fs);
- switch (where) {
- case SEEK_SET:
- break;
- case SEEK_CUR:
- offset += oldpos;
- break;
- default:
- case SEEK_END:
- return -1;
- }
-
- basepos = (offset / RAWFS_BSIZE) * RAWFS_BSIZE;
- offset %= RAWFS_BSIZE;
-
- /* backward seek are not possible */
- if (basepos < fs->fs_bufpos) {
- errno = EIO;
- return -1;
- }
-
- if (basepos == fs->fs_bufpos) {
- /* if we seek before the first read... */
- if (fs->fs_ptr == NULL) {
- if ((error = rawfs_get_block(f)) != 0) {
- errno = error;
- return -1;
- }
- }
- /* rewind to start of the buffer */
- fs->fs_len += (fs->fs_ptr - fs->fs_buf);
- fs->fs_ptr = fs->fs_buf;
- } else {
- while (basepos != fs->fs_bufpos)
- if ((error = rawfs_get_block(f)) != 0) {
- errno = error;
- return -1;
- }
- }
- /* now move forward within the buffer */
- if (offset > fs->fs_len)
- offset = fs->fs_len; /* EOF */
- fs->fs_len -= offset;
- fs->fs_ptr += offset;
-
- return rawfs_get_pos(fs);
-}
-
-int
-rawfs_stat(struct open_file *f, struct stat *sb)
-{
- return (EFTYPE);
-}
-
-/*
- * Read a block from the underlying stream device
- * (In our case, a tape drive.)
- */
-static int
-rawfs_get_block(struct open_file *f)
-{
- struct cfile *fs;
- int error;
- size_t len;
- off_t readpos;
-
- fs = (struct cfile *)f->f_fsdata;
-
- twiddle();
- if (fs->fs_ptr != NULL)
- readpos = fs->fs_bufpos + RAWFS_BSIZE;
- else
- readpos = fs->fs_bufpos; /* first read */
- error = f->f_dev->dv_strategy(f->f_devdata, F_READ,
- readpos / DEV_BSIZE, RAWFS_BSIZE, fs->fs_buf, &len);
-
- if (error == 0) {
- fs->fs_ptr = fs->fs_buf;
- fs->fs_len = len;
- fs->fs_bufpos = readpos;
- }
-
- return (error);
-}
-
-static off_t
-rawfs_get_pos(struct cfile *fs)
-{
- return fs->fs_bufpos + (fs->fs_ptr - fs->fs_buf);
-}
diff --git a/sys/arch/mvme88k/stand/bootst/rawfs.h b/sys/arch/mvme88k/stand/bootst/rawfs.h
deleted file mode 100644
index 837bfd67cf9..00000000000
--- a/sys/arch/mvme88k/stand/bootst/rawfs.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* $OpenBSD: rawfs.h,v 1.3 2006/01/16 18:03:54 deraadt Exp $ */
-
-/*
- * Raw file system - for stream devices like tapes.
- * No random access, only sequential read allowed.
- */
-
-int rawfs_open(char *path, struct open_file *f);
-int rawfs_close(struct open_file *f);
-int rawfs_read(struct open_file *f, void *buf,
- size_t size, size_t *resid);
-int rawfs_write(struct open_file *f, void *buf,
- size_t size, size_t *resid);
-off_t rawfs_seek(struct open_file *f, off_t offset, int where);
-int rawfs_stat(struct open_file *f, struct stat *sb);
diff --git a/sys/arch/mvme88k/stand/bootst/version.c b/sys/arch/mvme88k/stand/bootst/version.c
deleted file mode 100644
index 8033c9a1562..00000000000
--- a/sys/arch/mvme88k/stand/bootst/version.c
+++ /dev/null
@@ -1,12 +0,0 @@
-/* $OpenBSD: version.c,v 1.9 2013/04/14 19:05:19 miod Exp $ */
-
-/*
- * 1.9 do not load kernel symbols to avoid seeking backwards
- * 1.8 ELF toolchain
- * 1.7 compiled with gcc 3.3.5
- * 1.6 allocation area changed to fix netboot buffers overwriting stack
- * 1.5 rewritten crt code
- * 1.4 kernel loaded with loadfile, a.out and ELF formats
- * 1.3 rewritten startup code and general cleanup
- */
-const char *version = "1.9";
diff --git a/sys/arch/mvme88k/stand/bootxx/Makefile b/sys/arch/mvme88k/stand/bootxx/Makefile
deleted file mode 100644
index 8e753d40557..00000000000
--- a/sys/arch/mvme88k/stand/bootxx/Makefile
+++ /dev/null
@@ -1,36 +0,0 @@
-# from: @(#)Makefile 8.1 (Berkeley) 6/10/93
-# $OpenBSD: Makefile,v 1.17 2013/01/16 20:45:09 miod Exp $
-
-S= ${.CURDIR}/../../../..
-DEFS=-DSTAGE2_RELOC=${STAGE2_RELOC}
-INCPATH=-I${.CURDIR} -I${.CURDIR}/../libsa -I${.CURDIR}/../libbug \
- -I${.CURDIR}/../../include -I${S} -I${S}/lib/libsa
-CFLAGS+=${INCPATH} ${DEFS} ${COPTS}
-LDFLAGS=-S -N -T ${S}/arch/mvme88k/stand/ld.script -Ttext ${STAGE1_RELOC}
-LDFLAGS+= -warn-common
-NOPIE=
-CLEANFILES+=bootxx
-
-.include "${S}/arch/mvme88k/stand/bugcrt/Makefile.inc"
-.include "${S}/arch/mvme88k/stand/libbug/Makefile.inc"
-.include "${S}/arch/mvme88k/stand/libsa/Makefile.inc"
-.include "${S}/arch/mvme88k/stand/libz/Makefile.inc"
-
-SRCS= bootxx.c conf.c
-
-LIBS= ${LIBSA} ${LIBBUG} ${LIBZ}
-
-OBJS= ${SRCS:N*.h:R:S/$/.o/g}
-
-BOOTS= bootxx
-ALL= ${BOOTS}
-
-all: ${ALL}
-
-bootxx: ${STAGE1_CRT} ${OBJS} ${LIBS}
- ${LD} ${LDFLAGS} -o $@ ${STAGE1_CRT} ${OBJS} ${LIBS}
-
-install:
- install -c -m 555 -g bin -o bin ${BOOTS} ${DESTDIR}${MDEC_DIR}
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/mvme88k/stand/bootxx/bootxx.c b/sys/arch/mvme88k/stand/bootxx/bootxx.c
deleted file mode 100644
index 10f1f7e9a48..00000000000
--- a/sys/arch/mvme88k/stand/bootxx/bootxx.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/* $OpenBSD: bootxx.c,v 1.9 2011/03/13 00:13:53 deraadt Exp $ */
-
-/*
- * Copyright (c) 1994 Paul Kranenburg
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Paul Kranenburg.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * This is a generic "first-stage" boot program.
- *
- * Note that this program has absolutely no filesystem knowledge!
- *
- * Instead, this uses a table of disk block numbers that are
- * filled in by the installboot program such that this program
- * can load the "second-stage" boot program.
- */
-
-#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/exec.h>
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-
-/*
- * Boot device is derived from ROM provided information.
- */
-
-/* This determines the largest boot program we can load. */
-#define MAXBLOCKNUM 64
-
-/*
- * These three names are known by installboot.
- * The block_table contains starting block numbers,
- * in terms of 512-byte blocks. Each non-zero value
- * will result in a read of block_size bytes.
- */
-size_t block_size = 512; /* default */
-int block_count = MAXBLOCKNUM; /* length of table */
-daddr32_t block_table[MAXBLOCKNUM] = { 0 };
-
-void bugexec(void (*)());
-int copyboot(struct open_file *, char *);
-
-int
-main()
-{
- struct open_file f;
- char *addr;
- int error;
-
- board_setup();
-
-#ifdef DEBUG
- printf("boot device: ctrl=%d, dev=%d\n",
- bugargs.ctrl_lun, bugargs.dev_lun);
-#endif
-
- f.f_flags = F_RAW;
- if (devopen(&f, 0, &addr)) {
- printf("bootxx: open failed\n");
- _rtt();
- }
-
- addr = (char *)STAGE2_RELOC;
- error = copyboot(&f, addr);
- f.f_dev->dv_close(&f);
- if (!error) {
- bugexec((void (*)())addr + 8);
- }
- /* copyboot had a problem... */
- _rtt();
- return (0);
-}
-
-int
-copyboot(struct open_file *fp, char *addr)
-{
- size_t n;
- int i, blknum;
- struct exec *x;
-
- addr -= sizeof(struct exec); /* assume OMAGIC, verify below */
- x = (struct exec *)addr;
-
- if (!block_count) {
- printf("bootxx: no data!?!\n");
- return -1;
- }
-
- for (i = 0; i < block_count; i++) {
-
- if ((blknum = block_table[i]) == 0)
- break;
-
-#ifdef DEBUG
- printf("bootxx: read block # %d = %d\n", i, blknum);
-#endif
- if ((fp->f_dev->dv_strategy)(fp->f_devdata, F_READ,
- blknum, block_size, addr, &n)) {
- printf("bootxx: read failed\n");
- return -1;
- }
- if (n != block_size) {
- printf("bootxx: short read\n");
- return -1;
- }
- addr += block_size;
- }
-
- if (N_GETMAGIC(*x) != OMAGIC) {
- printf("bootxx: secondary bootstrap isn't in OMAGIC format\n");
- return(-1);
- }
-
- return 0;
-}
-
-void
-bugexec(void (*addr)())
-{
- (*addr)(bugargs.dev_lun, bugargs.ctrl_lun, bugargs.flags,
- bugargs.ctrl_addr, (u_int)addr, bugargs.conf_blk,
- bugargs.arg_start, bugargs.arg_end);
-
- printf("bugexec: %p returned!\n", addr);
-
- _rtt();
-}
diff --git a/sys/arch/mvme88k/stand/bootxx/conf.c b/sys/arch/mvme88k/stand/bootxx/conf.c
deleted file mode 100644
index c4545664577..00000000000
--- a/sys/arch/mvme88k/stand/bootxx/conf.c
+++ /dev/null
@@ -1,14 +0,0 @@
-/* $OpenBSD: conf.c,v 1.1 1998/08/22 08:27:08 smurph Exp $ */
-
-#include <sys/types.h>
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-
-struct devsw devsw[] = {
- { "bugsc", bugscstrategy, bugscopen, bugscclose, bugscioctl },
-};
-int ndevs = (sizeof(devsw)/sizeof(devsw[0]));
-
-int debug;
diff --git a/sys/arch/mvme88k/stand/bugcrt/Makefile b/sys/arch/mvme88k/stand/bugcrt/Makefile
deleted file mode 100644
index e8821d2a538..00000000000
--- a/sys/arch/mvme88k/stand/bugcrt/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-# $OpenBSD: Makefile,v 1.15 2013/05/12 10:43:45 miod Exp $
-
-S=${.CURDIR}/../../../..
-
-CFLAGS+=-I${.CURDIR}/../../include -I${.CURDIR}/../libbug -I${S}/lib/libsa
-STAGE1_CFLAGS= -DLOAD_FROM_VID
-STAGE2_CFLAGS= -DLOAD_FROM_BOOTXX
-NETBOOT_CFLAGS= -DNETBOOT
-SREC_CFLAGS= -DSREC
-SRCS=crt0.S
-OBJS=stage1crt.o stage2crt.o netcrt.o sreccrt.o
-NOPIE=
-
-all: ${OBJS}
-
-stage1crt.o: crt0.S
- ${CC} ${CFLAGS} ${STAGE1_CFLAGS} -c ${.CURDIR}/crt0.S -o ${.TARGET}
-
-stage2crt.o: crt0.S
- ${CC} ${CFLAGS} ${STAGE2_CFLAGS} -c ${.CURDIR}/crt0.S -o ${.TARGET}
-
-netcrt.o: crt0.S
- ${CC} ${CFLAGS} ${NETBOOT_CFLAGS} -c ${.CURDIR}/crt0.S -o ${.TARGET}
-
-sreccrt.o: crt0.S
- ${CC} ${CFLAGS} ${SREC_CFLAGS} -c ${.CURDIR}/crt0.S -o ${.TARGET}
-
-install:
-
-lint tags:
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/mvme88k/stand/bugcrt/Makefile.inc b/sys/arch/mvme88k/stand/bugcrt/Makefile.inc
deleted file mode 100644
index 87a1d85ba90..00000000000
--- a/sys/arch/mvme88k/stand/bugcrt/Makefile.inc
+++ /dev/null
@@ -1,29 +0,0 @@
-# $OpenBSD: Makefile.inc,v 1.7 2013/05/12 10:43:45 miod Exp $
-
-BUG_CRT_DIR=${S}/arch/mvme88k/stand/bugcrt
-
-BUGCRT_DIR!= cd ${BUG_CRT_DIR}; \
- printf "xxx:\n\techo \$${.OBJDIR}\n" | ${MAKE} -r -s -f - xxx
-
-STAGE1_CRT=${BUGCRT_DIR}/stage1crt.o
-STAGE2_CRT=${BUGCRT_DIR}/stage2crt.o
-NETBOOT_CRT=${BUGCRT_DIR}/netcrt.o
-SREC_CRT=${BUGCRT_DIR}/sreccrt.o
-
-$(STAGE1_CRT): .NOTMAIN __always_make_bugcrt
- @echo making sure stage1crt.o is up to date...
- @(cd ${BUG_CRT_DIR}; ${MAKE} stage1crt.o)
-
-$(STAGE2_CRT): .NOTMAIN __always_make_bugcrt
- @echo making sure stage2crt.o is up to date...
- @(cd ${BUG_CRT_DIR}; ${MAKE} stage2crt.o)
-
-$(NETBOOT_CRT): .NOTMAIN __always_make_bugcrt
- @echo making sure netcrt.o is up to date...
- @(cd ${BUG_CRT_DIR}; ${MAKE} netcrt.o)
-
-$(SREC_CRT): .NOTMAIN __always_make_bugcrt
- @echo making sure sreccrt.o is up to date...
- @(cd ${BUG_CRT_DIR}; ${MAKE} sreccrt.o)
-
-__always_make_bugcrt: .NOTMAIN
diff --git a/sys/arch/mvme88k/stand/bugcrt/crt0.S b/sys/arch/mvme88k/stand/bugcrt/crt0.S
deleted file mode 100644
index ccf04144fd1..00000000000
--- a/sys/arch/mvme88k/stand/bugcrt/crt0.S
+++ /dev/null
@@ -1,214 +0,0 @@
-/* $OpenBSD: crt0.S,v 1.3 2013/05/12 10:43:45 miod Exp $ */
-
-/*
- * Copyright (c) 2008 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#define _KERNEL
-#define _LOCORE
-#include <machine/asm.h>
-
- .text
-
-ASGLOBAL(__start)
-#ifdef LOAD_FROM_VID
- /*
- * Binaries loaded *from disk* by the BUG start with two special words.
- *
- * The first word contains the initial stack address, and the second
- * word contains the initial instruction pointer.
- *
- * If the initial instruction pointer is below the address the file was
- * loaded at (which is found in the VID block or in the NIOT settings),
- * it is interpreted as an offset within the loaded image.
- *
- * Note that installboot() will program the entry point address in the
- * VID block, which needs to point to these magic words, therefore we
- * set the bootxx entry point here.
- */
- .long _ASM_LABEL(__start)
- .long _ASM_LABEL(real_start) - _ASM_LABEL(__start)
-
-#endif /* LOAD_FROM_VID */
-
-#ifdef LOAD_FROM_BOOTXX
- /*
- * bootxx runs the second-stage binary at its entry + 8, in case
- * it contains the special two words.
- */
- NOP
- NOP
-#endif
-
-#ifdef SREC
- /*
- * Get the address of real_start in %r6, as if we had been loaded
- * as a regular boot block.
- */
- bsr.n _ASM_LABEL(real_start)
- or %r6, %r0, %r1
-#endif
-
-ASLOCAL(real_start)
- /*
- * Registers on entry, unless loaded from S-Records:
- * r2 boot device lun
- * r3 boot controller lun
- * r4 cold/warm boot mode (`IPL\01')
- * r5 boot controller address
- * r6 entry point of loaded program (i.e. address of __start)
- * r7 disk boot: address of media configuration block, zero if none
- * net boot: boot information packet address
- * r8 start of command line (loaded file if netboot)
- * r9 end of command line
- * r10 net boot: start of optional argument
- * r11 net boot: end of optional argument
- * r12 net boot: bit 0 set if autoboot
- * r31 stack, as setup above
- */
-
-#if defined(LOAD_FROM_BOOTXX) || defined(NETBOOT) || defined(SREC)
-
- /*
- * We first relocate ourselves to our preferred address.
- * This helps netbooting if the NIOT address (defaulting to
- * 001f0000) does not match ours, or if we are loaded by an
- * old stage1 at the wrong address.
- */
-
- or.u %r20, %r0, %hi16(_ASM_LABEL(real_start))
- or %r20, %r20, %lo16(_ASM_LABEL(real_start))
- cmp %r21, %r6, %r20
- bb1 eq, %r21, reloc_done
-
- or.u %r22, %r0, %hi16(_C_LABEL(end))
- or %r22, %r22, %lo16(_C_LABEL(end))
-
- bb1.n lt, %r21, reloc_down
- or %r25, %r0, %r6
-
- /*
- * Relocate from r25 to r20, moving up
- */
-reloc_up:
- ld %r24, %r25, %r0
- st %r24, %r20, %r0
- add %r20, %r20, 4
- cmp %r21, %r20, %r22
- bb1.n ne, %r21, reloc_up
- add %r25, %r25, 4
- br reloc_done
-
- /*
- * Relocate from r25 to r20, moving down
- */
-reloc_down:
- subu %r26, %r22, %r20 /* end - __start */
- addu %r25, %r25, %r26
-1:
- subu %r25, %r25, 4
- ld %r24, %r25, %r0
- subu %r22, %r22, 4
- st %r24, %r22, %r0
- cmp %r21, %r20, %r22
- bb1 ne, %r21, 1b
-
-reloc_done:
- or.u %r20, %r0, %hi16(_ASM_LABEL(__start_relocated))
- or %r20, %r20, %lo16(_ASM_LABEL(__start_relocated))
- jmp.n %r20
- or %r6, %r20, %r0 /* for stack initialization below */
-
-ASLOCAL(__start_relocated)
-
-#endif /* LOAD_FROM_BOOTXX || NETBOOT || SREC */
-
- /*
- * Clear BSS.
- */
- or.u %r20, %r0, %hi16(_C_LABEL(edata))
- or %r20, %r20, %lo16(_C_LABEL(edata))
- or.u %r22, %r0, %hi16(_C_LABEL(end))
- or %r22, %r22, %lo16(_C_LABEL(end))
-1: st %r0, %r20, %r0
- add %r20, %r20, 4
- cmp %r21, %r20, %r22
- bb1 ne, %r21, 1b
-
- /*
- * Setup our stack - it might not have been set up correctly.
- * We'll use the memory below text as stack, aligned to 0x10
- * bytes.
- */
- clr %r31, %r6, 4<0>
-
-#ifndef SREC
-
- /*
- * Save our arguments so that all registers are available to
- * C code.
- */
- or.u %r20, %r0, %hi16(_C_LABEL(bugargs))
- or %r20, %r20, %lo16(_C_LABEL(bugargs))
-
- st %r2, %r20, 0x00 /* dev_lun */
- st %r3, %r20, 0x04 /* ctrl_lun */
- st %r4, %r20, 0x08 /* flags */
- st %r5, %r20, 0x0c /* ctrl_addr */
- st %r6, %r20, 0x10 /* entry */
- st %r7, %r20, 0x14 /* conf_blk */
-#ifdef NETBOOT
- st %r10, %r20, 0x18 /* arg_start */
- st %r11, %r20, 0x1c /* arg_end */
-#else
- st %r8, %r20, 0x18 /* arg_start */
- st %r9, %r20, 0x1c /* arg_end */
-#endif /* NETBOOT */
-
- /*
- * NUL-terminate arg_end, if it is not.
- */
-#ifdef NETBOOT
- st.b %r0, %r11, %r0
-#else
- st.b %r0, %r9, %r0
-#endif
-
-#endif /* !SREC */
-
- /*
- * PSR when booted from the BUG has SFU1..SFU7 disabled.
- * Enable SFU1 (the FPU) for the C code to be able to use it
- * if necessary.
- */
- ldcr %r20, PSR
- clr %r20, %r20, 1<PSR_FPU_DISABLE_BIT>
- stcr %r20, PSR
- NOP
-
- bsr _C_LABEL(main)
- bsr _C_LABEL(_rtt)
-1: br 1b
-
- .data
-GLOBAL(bugargs)
- .space 4 /* dev_lun */
- .space 4 /* ctrl_lun */
- .space 4 /* flags */
- .space 4 /* ctrl_addr */
- .space 4 /* entry */
- .space 4 /* conf_blk */
- .space 4 /* arg_start */
- .space 4 /* arg_end */
diff --git a/sys/arch/mvme88k/stand/installboot/Makefile b/sys/arch/mvme88k/stand/installboot/Makefile
deleted file mode 100644
index 814b5406adf..00000000000
--- a/sys/arch/mvme88k/stand/installboot/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-# $OpenBSD: Makefile,v 1.8 2014/02/07 10:13:00 miod Exp $
-
-MAN= installboot.8
-MANSUBDIR=mvme88k
-
-.if ${MACHINE} == "mvme88k"
-SRCS= installboot.c nlist.c
-PROG= installboot
-BINDIR=/usr/mdec
-DPADD=${LIBUTIL}
-LDADD=-lutil
-# Need this to work in the miniroot
-LDSTATIC=-static
-.else
-NOPROG=
-.endif
-
-.include <bsd.prog.mk>
-
diff --git a/sys/arch/mvme88k/stand/installboot/installboot.8 b/sys/arch/mvme88k/stand/installboot/installboot.8
deleted file mode 100644
index 925b8cd147c..00000000000
--- a/sys/arch/mvme88k/stand/installboot/installboot.8
+++ /dev/null
@@ -1,82 +0,0 @@
-.\" $OpenBSD: installboot.8,v 1.15 2013/09/29 21:30:49 jmc Exp $
-.\"
-.\" Copyright (c) 1994 Paul Kranenburg
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by Paul Kranenburg.
-.\" 4. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.\"
-.Dd $Mdocdate: September 29 2013 $
-.Dt INSTALLBOOT 8 mvme88k
-.Os
-.Sh NAME
-.Nm installboot
-.Nd install a bootstrap on an FFS disk
-.Sh SYNOPSIS
-.Nm installboot
-.Op Fl nv
-.Ar boot
-.Ar bootxx
-.Ar rawdev
-.Sh DESCRIPTION
-.Nm installboot
-is used to install a "first-stage" boot program into the boot area
-of an FFS disk partition, and initialize the table of block numbers the
-.Ar bootxx
-program uses to load the second-stage boot program.
-.Pp
-The options are as follows:
-.Bl -tag -width flag
-.It Fl n
-Do not actually write anything on the disk.
-.It Fl v
-Be verbose, printing out the block numbers that
-.Ar bootxx
-will use to load
-.Ar boot .
-.El
-.Pp
-The arguments are:
-.Bl -tag -width bootxx
-.It Ar boot
-The name of the second-stage boot program in the file system
-where the first-stage boot program is to be installed.
-.It Ar bootxx
-The name of the prototype file for the first stage boot program.
-.It Ar rawdev
-The name of the raw device in which the first-stage boot program
-is to be installed.
-This should correspond to the block device on which the file system containing
-.Ar boot
-is mounted.
-.El
-.Sh EXAMPLES
-.Bd -literal
-# cp /usr/mdec/bootsd /boot
-# /usr/mdec/installboot /boot /usr/mdec/bootxx /dev/rsd0a
-.Ed
-.Sh SEE ALSO
-.Xr disklabel 8 ,
-.Xr init 8
diff --git a/sys/arch/mvme88k/stand/installboot/installboot.c b/sys/arch/mvme88k/stand/installboot/installboot.c
deleted file mode 100644
index ffa7bac8aaa..00000000000
--- a/sys/arch/mvme88k/stand/installboot/installboot.c
+++ /dev/null
@@ -1,476 +0,0 @@
-/* $OpenBSD: installboot.c,v 1.15 2013/09/29 21:30:50 jmc Exp $ */
-/* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */
-
-/*
- * Copyright (c) 1994 Paul Kranenburg
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Paul Kranenburg.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/mount.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-#include <sys/disklabel.h>
-#include <ufs/ufs/dinode.h>
-#include <ufs/ufs/dir.h>
-#include <ufs/ffs/fs.h>
-#include <err.h>
-#include <a.out.h>
-#include <fcntl.h>
-#include <nlist.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <util.h>
-
-int verbose, nowrite, hflag;
-char *boot, *proto, *dev;
-char cdev[80];
-
-struct nlist nl[] = {
-#define X_BLOCK_SIZE 0
- { { "_block_size" } },
-#define X_BLOCK_COUNT 1
- { { "_block_count" } },
-#define X_BLOCK_TABLE 2
- { { "_block_table" } },
- { { NULL } }
-};
-
-int *block_size_p; /* block size var. in prototype image */
-int *block_count_p; /* block count var. in prototype image */
-daddr32_t *block_table; /* block number array in prototype image */
-int maxblocknum; /* size of this array */
-
-
-char *loadprotoblocks(char *, long *);
-int loadblocknums(char *, int);
-static void devread(int, void *, daddr32_t, size_t, char *);
-static void usage(void);
-int main(int, char *[]);
-static void vid_to_disklabel(char *, char *);
-
-
-static void
-usage()
-{
- fprintf(stderr,
- "usage: installboot [-nv] boot bootxx rawdev\n");
- exit(1);
-}
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- int c;
- int devfd;
- char *protostore;
- long protosize;
-
- while ((c = getopt(argc, argv, "vnh")) != -1) {
- switch (c) {
- case 'h':
- /* Don't strip a.out header */
- hflag = 1;
- break;
- case 'n':
- /* Do not actually write the bootblock to disk */
- nowrite = 1;
- break;
- case 'v':
- /* Chat */
- verbose = 1;
- break;
- default:
- usage();
- }
- }
-
- if (argc - optind < 3) {
- usage();
- }
-
- boot = argv[optind];
- proto = argv[optind + 1];
- dev = argv[optind + 2];
- strlcpy(cdev, dev, sizeof cdev);
- cdev[strlen(cdev)-1] = 'c';
-
- if (verbose) {
- printf("boot: %s\n", boot);
- printf("proto: %s\n", proto);
- printf("device: %s\n", dev);
- printf("cdevice: %s\n", cdev);
- }
-
- /* Insert VID into disklabel */
- vid_to_disklabel(cdev, proto);
-
- /* Load proto blocks into core */
- if ((protostore = loadprotoblocks(proto, &protosize)) == NULL)
- exit(1);
-
- /* XXX - Paranoia: Make sure size is aligned! */
- if (protosize & (DEV_BSIZE - 1))
- err(1, "proto bootblock bad size=%ld", protosize);
-
- /* Open and check raw disk device */
- if ((devfd = open(dev, O_RDONLY, 0)) < 0)
- err(1, "open: %s", dev);
-
- /* Extract and load block numbers */
- if (loadblocknums(boot, devfd) != 0)
- exit(1);
-
- (void)close(devfd);
-
- if (nowrite)
- return 0;
-
- /* Write patched proto bootblocks into the superblock */
- if (protosize > SBSIZE - DEV_BSIZE)
- errx(1, "proto bootblocks too big");
-
- if ((devfd = open(cdev, O_RDWR, 0)) < 0)
- err(1, "open: %s", dev);
-
- if (lseek(devfd, DEV_BSIZE, SEEK_SET) != DEV_BSIZE)
- err(1, "lseek bootstrap");
-
- /* Sync filesystems (to clean in-memory superblock?) */
- sync();
-
- if (write(devfd, protostore, protosize) != protosize)
- err(1, "write bootstrap");
- (void)close(devfd);
- return 0;
-}
-
-char *
-loadprotoblocks(fname, size)
- char *fname;
- long *size;
-{
- int fd;
- size_t tdsize; /* text+data size */
- size_t bbsize; /* boot block size (block aligned) */
- char *bp;
- struct nlist *nlp;
- struct exec eh;
- long off;
-
- fd = -1;
- bp = NULL;
-
- /* Locate block number array in proto file */
- if (nlist(fname, nl) != 0) {
- warnx("nlist: %s: symbols not found", fname);
- return NULL;
- }
- /* Validate symbol types (global data). */
- for (nlp = nl; nlp->n_un.n_name; nlp++) {
- if (nlp->n_type != (N_DATA | N_EXT)) {
- warnx("nlist: %s: wrong type", nlp->n_un.n_name);
- return NULL;
- }
- }
-
- if ((fd = open(fname, O_RDONLY)) < 0) {
- warn("open: %s", fname);
- return NULL;
- }
- if (read(fd, &eh, sizeof(eh)) != sizeof(eh)) {
- warn("read: %s", fname);
- goto bad;
- }
- if (N_GETMAGIC(eh) != OMAGIC) {
- warn("bad magic: 0x%x", eh.a_midmag);
- goto bad;
- }
- /*
- * We have to include the exec header in the beginning of
- * the buffer, and leave extra space at the end in case
- * the actual write to disk wants to skip the header.
- */
- tdsize = eh.a_text + eh.a_data;
- bbsize = tdsize + sizeof(eh);
- bbsize = roundup(bbsize, DEV_BSIZE);
-
- /*
- * Allocate extra space here because the caller may copy
- * the boot block starting at the end of the exec header.
- * This prevents reading beyond the end of the buffer.
- */
- if ((bp = calloc(bbsize + sizeof(eh), 1)) == NULL) {
- warnx("malloc: %s: no memory", fname);
- goto bad;
- }
- /* Copy the exec header and read the rest of the file. */
- memcpy(bp, &eh, sizeof(eh));
- if (read(fd, bp+sizeof(eh), tdsize) != tdsize) {
- warn("read: %s", fname);
- goto bad;
- }
-
- *size = bbsize; /* aligned to DEV_BSIZE */
-
- /* Calculate the symbols' locations within the proto file */
- off = N_DATOFF(eh) - N_DATADDR(eh) - (eh.a_entry - N_TXTADDR(eh));
- block_size_p = (int *) (bp + nl[X_BLOCK_SIZE ].n_value + off);
- block_count_p = (int *) (bp + nl[X_BLOCK_COUNT].n_value + off);
- block_table = (daddr32_t *) (bp + nl[X_BLOCK_TABLE].n_value + off);
- maxblocknum = *block_count_p;
-
- if (verbose) {
- printf("%s: entry point %#x\n", fname, eh.a_entry);
- printf("proto bootblock size %ld\n", *size);
- printf("room for %d filesystem blocks at %#lx\n",
- maxblocknum, nl[X_BLOCK_TABLE].n_value);
- }
-
- close(fd);
- if (!hflag)
- bp += sizeof(struct exec);
- return bp;
-
- bad:
- if (bp)
- free(bp);
- if (fd >= 0)
- close(fd);
- return NULL;
-}
-
-static void
-devread(fd, buf, blk, size, msg)
- int fd;
- void *buf;
- daddr32_t blk;
- size_t size;
- char *msg;
-{
- if (lseek(fd, dbtob(blk), SEEK_SET) != dbtob(blk))
- err(1, "%s: devread: lseek", msg);
-
- if (read(fd, buf, size) != size)
- err(1, "%s: devread: read", msg);
-}
-
-static char sblock[SBSIZE];
-
-int
-loadblocknums(boot, devfd)
-char *boot;
-int devfd;
-{
- int i, fd;
- struct stat statbuf;
- struct statfs statfsbuf;
- struct fs *fs;
- char *buf;
- daddr32_t blk, *ap;
- struct ufs1_dinode *ip;
- int ndb;
-
- /*
- * Open 2nd-level boot program and record the block numbers
- * it occupies on the filesystem represented by `devfd'.
- */
-
- /* Make sure the (probably new) boot file is on disk. */
- sync(); sleep(1);
-
- if ((fd = open(boot, O_RDONLY)) < 0)
- err(1, "open: %s", boot);
-
- if (fstatfs(fd, &statfsbuf) != 0)
- err(1, "statfs: %s", boot);
-
- if (strncmp(statfsbuf.f_fstypename, "ffs", MFSNAMELEN) &&
- strncmp(statfsbuf.f_fstypename, "ufs", MFSNAMELEN) ) {
- errx(1, "%s: must be on an FFS filesystem", boot);
- }
-
- if (fsync(fd) != 0)
- err(1, "fsync: %s", boot);
-
- if (fstat(fd, &statbuf) != 0)
- err(1, "fstat: %s", boot);
-
- close(fd);
-
- /* Read superblock */
- devread(devfd, sblock, SBLOCK, SBSIZE, "superblock");
- fs = (struct fs *)sblock;
-
- /* Sanity-check super-block. */
-
- if (fs->fs_magic != FS_MAGIC)
- errx(1, "Bad magic number in superblock");
-
- if (fs->fs_inopb <= 0)
- err(1, "Bad inopb=%d in superblock", fs->fs_inopb);
-
- /* Read inode */
- if ((buf = malloc(fs->fs_bsize)) == NULL)
- errx(1, "No memory for filesystem block");
-
- blk = fsbtodb(fs, ino_to_fsba(fs, statbuf.st_ino));
- devread(devfd, buf, blk, fs->fs_bsize, "inode");
- ip = (struct ufs1_dinode *)(buf) + ino_to_fsbo(fs, statbuf.st_ino);
-
- /*
- * Have the inode. Figure out how many blocks we need.
- */
- ndb = howmany(ip->di_size, fs->fs_bsize);
- if (ndb > maxblocknum)
- errx(1, "Too many blocks");
- *block_count_p = ndb;
- *block_size_p = fs->fs_bsize;
- if (verbose)
- printf("Will load %d blocks of size %d each.\n",
- ndb, fs->fs_bsize);
-
- /*
- * Get the block numbers; we don't handle fragments
- */
- ap = ip->di_db;
- for (i = 0; i < NDADDR && *ap && ndb; i++, ap++, ndb--) {
- blk = fsbtodb(fs, *ap);
- if (verbose)
- printf("%d: %d\n", i, blk);
- block_table[i] = blk;
- }
- if (ndb == 0)
- return 0;
-
- /*
- * Just one level of indirections; there isn't much room
- * for more in the 1st-level bootblocks anyway.
- */
- blk = fsbtodb(fs, ip->di_ib[0]);
- devread(devfd, buf, blk, fs->fs_bsize, "indirect block");
- ap = (daddr32_t *)buf;
- for (; i < NINDIR(fs) && *ap && ndb; i++, ap++, ndb--) {
- blk = fsbtodb(fs, *ap);
- if (verbose)
- printf("%d: %d\n", i, blk);
- block_table[i] = blk;
- }
-
- return 0;
-}
-
-static void
-vid_to_disklabel(dkname, bootproto)
-char *dkname;
-char *bootproto;
-{
- char *specname;
- int exe_file, f;
- struct mvmedisklabel *pcpul;
- struct stat sb;
- unsigned int exe_addr;
-
- pcpul = (struct mvmedisklabel *)malloc(sizeof(struct mvmedisklabel));
- bzero(pcpul, sizeof(struct mvmedisklabel));
-
- if (verbose)
- printf("modifying vid.\n");
-
- exe_file = open(bootproto, O_RDONLY, 0444);
- if (exe_file == -1) {
- perror(bootproto);
- exit(2);
- }
-
- f = opendev(dkname, O_RDWR, OPENDEV_PART, &specname);
-
- if (lseek(f, 0, SEEK_SET) < 0 ||
- read(f, pcpul, sizeof(struct mvmedisklabel))
- < sizeof(struct mvmedisklabel))
- err(4, "%s", specname);
-
-
- pcpul->version = 1;
- memcpy(pcpul->vid_id, "M88K", sizeof pcpul->vid_id);
-
- if (fstat(exe_file, &sb) == -1)
- err(1, "fstat: %s", bootproto);
- if (sb.st_size < 0x20)
- errx(1, "%s is too small", bootproto);
-
- /* size in 256 byte blocks round up after a.out header removed */
-
- pcpul->vid_oss = 2;
- pcpul->vid_osl = (((sb.st_size -0x20) +511) / 512) *2;
-
- lseek(exe_file, 0x14, SEEK_SET);
- read(exe_file, &exe_addr, 4);
-
- /* check this, it may not work in both endian. */
- /* No, it doesn't. Use a big endian machine for now. SPM */
-
- {
- union {
- struct s {
- unsigned short s1;
- unsigned short s2;
- } s;
- unsigned long l;
- } a;
- a.l = exe_addr;
- pcpul->vid_osa_u = a.s.s1;
- pcpul->vid_osa_l = a.s.s2;
-
- }
- pcpul->vid_cas = 1;
- pcpul->vid_cal = 1;
-
- /* do not want to write past end of structure, not null terminated */
-
- strncpy(pcpul->vid_mot, "MOTOROLA", 8);
-
- pcpul->cfg_rec = 0x100;
- pcpul->cfg_psm = 0x200;
-
- if (!nowrite) {
- if (lseek(f, 0, SEEK_SET) < 0 ||
- write(f, pcpul, sizeof(struct mvmedisklabel))
- < sizeof(struct mvmedisklabel))
- err(4, "%s", specname);
- }
- free(pcpul);
-
- close(exe_file);
- close(f);
-
-}
diff --git a/sys/arch/mvme88k/stand/installboot/nlist.c b/sys/arch/mvme88k/stand/installboot/nlist.c
deleted file mode 100644
index 2b403232b70..00000000000
--- a/sys/arch/mvme88k/stand/installboot/nlist.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/* $OpenBSD: nlist.c,v 1.1 2014/02/07 10:13:00 miod Exp $ */
-/*
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <a.out.h> /* pulls in nlist.h */
-
-#define ISLAST(p) (p->n_un.n_name == 0 || p->n_un.n_name[0] == 0)
-
-int
-__aout_fdnlist(int fd, struct nlist *list)
-{
- struct nlist *p, *s;
- char *strtab;
- off_t symoff, stroff;
- u_long symsize;
- int nent, cc;
- int strsize, usemalloc = 0;
- struct nlist nbuf[1024];
- struct exec exec;
-
- if (pread(fd, &exec, sizeof(exec), (off_t)0) != sizeof(exec) ||
- N_BADMAG(exec) || exec.a_syms == 0)
- return (-1);
-
- stroff = N_STROFF(exec);
- symoff = N_SYMOFF(exec);
- symsize = exec.a_syms;
-
- /* Read in the size of the string table. */
- if (pread(fd, (void *)&strsize, sizeof(strsize), stroff) !=
- sizeof(strsize))
- return (-1);
- else
- stroff += sizeof(strsize);
-
- /*
- * Read in the string table. We try mmap, but that will fail
- * for /dev/ksyms so fall back on malloc. Since OpenBSD's malloc(3)
- * returns memory to the system on free this does not cause bloat.
- */
- strsize -= sizeof(strsize);
- strtab = mmap(NULL, (size_t)strsize, PROT_READ, MAP_SHARED|MAP_FILE,
- fd, stroff);
- if (strtab == MAP_FAILED) {
- usemalloc = 1;
- if ((strtab = (char *)malloc(strsize)) == NULL)
- return (-1);
- errno = EIO;
- if (pread(fd, strtab, strsize, stroff) != strsize) {
- nent = -1;
- goto aout_done;
- }
- }
-
- /*
- * clean out any left-over information for all valid entries.
- * Type and value defined to be 0 if not found; historical
- * versions cleared other and desc as well. Also figure out
- * the largest string length so don't read any more of the
- * string table than we have to.
- *
- * XXX clearing anything other than n_type and n_value violates
- * the semantics given in the man page.
- */
- nent = 0;
- for (p = list; !ISLAST(p); ++p) {
- p->n_type = 0;
- p->n_other = 0;
- p->n_desc = 0;
- p->n_value = 0;
- ++nent;
- }
-
- while (symsize > 0) {
- cc = MIN(symsize, sizeof(nbuf));
- if (pread(fd, nbuf, cc, symoff) != cc)
- break;
- symsize -= cc;
- symoff += cc;
- for (s = nbuf; cc > 0; ++s, cc -= sizeof(*s)) {
- char *sname = strtab + s->n_un.n_strx - sizeof(int);
-
- if (s->n_un.n_strx == 0 || (s->n_type & N_STAB) != 0)
- continue;
- for (p = list; !ISLAST(p); p++) {
- char *pname = p->n_un.n_name;
-
- if (*sname != '_' && *pname == '_')
- pname++;
- if (!strcmp(sname, pname)) {
- p->n_value = s->n_value;
- p->n_type = s->n_type;
- p->n_desc = s->n_desc;
- p->n_other = s->n_other;
- if (--nent <= 0)
- break;
- }
- }
- }
- }
-aout_done:
- if (usemalloc)
- free(strtab);
- else
- munmap(strtab, strsize);
- return (nent);
-}
-
-int
-nlist(const char *name, struct nlist *list)
-{
- int fd, n;
-
- fd = open(name, O_RDONLY, 0);
- if (fd < 0)
- return (-1);
- n = __aout_fdnlist(fd, list);
- (void)close(fd);
- return (n);
-}
diff --git a/sys/arch/mvme88k/stand/ld.script b/sys/arch/mvme88k/stand/ld.script
deleted file mode 100644
index c13faa21b14..00000000000
--- a/sys/arch/mvme88k/stand/ld.script
+++ /dev/null
@@ -1,46 +0,0 @@
-/* $OpenBSD: ld.script,v 1.1 2013/01/05 11:20:56 miod Exp $ */
-
-/*
- * Copyright (c) 2012 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-OUTPUT_FORMAT("a.out-m88k-openbsd")
-OUTPUT_ARCH(m88k)
-ENTRY(__start)
-SECTIONS
-{
- .text :
- {
- *(.text)
- *(.rodata*)
- PROVIDE(etext = .);
- }
- . = ALIGN(0x10);
- .data :
- {
- *(.data)
- PROVIDE(edata = .);
- }
- . = ALIGN(0x10);
- .bss :
- {
- *(.bss)
- }
- PROVIDE(end = .);
- /DISCARD/ :
- {
- *(.debug*)
- }
-}
diff --git a/sys/arch/mvme88k/stand/libbug/Makefile b/sys/arch/mvme88k/stand/libbug/Makefile
deleted file mode 100644
index ff258e6f209..00000000000
--- a/sys/arch/mvme88k/stand/libbug/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-# $OpenBSD: Makefile,v 1.10 2013/05/14 20:30:47 miod Exp $
-
-LIB=bug
-
-NOPIC=
-NOPROFILE=
-NOPIE=
-
-S=${.CURDIR}/../../../..
-DIR_SA=$S/lib/libsa
-
-CFLAGS+=-I${.CURDIR}/../../include -I${DIR_SA}
-
-SRCS= delay.c diskrd.c diskwr.c getbrdid.c inchr.c instat.c \
- netcfig.c netctrl.c netfopen.c netfread.c outstr.c putchar.c \
- return.c rtc_rd.c
-
-install:
-
-.include <bsd.lib.mk>
diff --git a/sys/arch/mvme88k/stand/libbug/Makefile.inc b/sys/arch/mvme88k/stand/libbug/Makefile.inc
deleted file mode 100644
index 90276eebe90..00000000000
--- a/sys/arch/mvme88k/stand/libbug/Makefile.inc
+++ /dev/null
@@ -1,14 +0,0 @@
-# $OpenBSD: Makefile.inc,v 1.2 1998/08/22 07:39:52 smurph Exp $
-
-LIB_BUG_DIR=${S}/arch/mvme88k/stand/libbug
-
-LIBBUG_DIR!= cd ${LIB_BUG_DIR}; \
- printf "xxx:\n\techo \$${.OBJDIR}\n" | ${MAKE} -r -s -f - xxx
-
-LIBBUG=${LIBBUG_DIR}/libbug.a
-
-$(LIBBUG): .NOTMAIN __always_make_libbug
- @echo making sure the libbug is up to date...
- @(cd ${LIB_BUG_DIR}; ${MAKE})
-
-__always_make_libbug: .NOTMAIN
diff --git a/sys/arch/mvme88k/stand/libbug/delay.c b/sys/arch/mvme88k/stand/libbug/delay.c
deleted file mode 100644
index b99b7f1b597..00000000000
--- a/sys/arch/mvme88k/stand/libbug/delay.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/* $OpenBSD: delay.c,v 1.4 2013/01/05 11:20:56 miod Exp $ */
-
-/*
- * bug routines -- assumes that the necessary sections of memory
- * are preserved.
- */
-#include <sys/types.h>
-#include <machine/prom.h>
-#include "prom.h"
-
-/* BUG - timing routine */
-void
-mvmeprom_delay(msec)
- int msec;
-{
- asm volatile ("or %%r2,%%r0,%0": : "r" (msec));
- MVMEPROM_CALL(MVMEPROM_DELAY);
-}
diff --git a/sys/arch/mvme88k/stand/libbug/diskrd.c b/sys/arch/mvme88k/stand/libbug/diskrd.c
deleted file mode 100644
index 78beb1c6a80..00000000000
--- a/sys/arch/mvme88k/stand/libbug/diskrd.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* $OpenBSD: diskrd.c,v 1.5 2013/01/05 11:20:56 miod Exp $ */
-
-/*
- * bug routines -- assumes that the necessary sections of memory
- * are preserved.
- */
-#include <sys/types.h>
-#include <machine/prom.h>
-#include "prom.h"
-
-/* returns 0: success, nonzero: error */
-int
-mvmeprom_diskrd(arg)
- struct mvmeprom_dskio *arg;
-{
- int ret;
-
- asm volatile ("or %%r2,%%r0,%0": : "r" (arg));
- MVMEPROM_CALL(MVMEPROM_DSKRD);
- asm volatile ("or %0,%%r0,%%r2" : "=r" (ret));
- return ((ret & 0x8));
-}
diff --git a/sys/arch/mvme88k/stand/libbug/diskwr.c b/sys/arch/mvme88k/stand/libbug/diskwr.c
deleted file mode 100644
index 4c3016439e9..00000000000
--- a/sys/arch/mvme88k/stand/libbug/diskwr.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* $OpenBSD: diskwr.c,v 1.4 2013/01/05 11:20:56 miod Exp $ */
-
-/*
- * bug routines -- assumes that the necessary sections of memory
- * are preserved.
- */
-#include <sys/types.h>
-#include <machine/prom.h>
-#include "prom.h"
-
-/* returns 0: success, nonzero: error */
-int
-mvmeprom_diskwr(arg)
- struct mvmeprom_dskio *arg;
-{
- int ret;
-
- asm volatile ("or %%r2,%%r0,%0": : "r" (arg) );
- MVMEPROM_CALL(MVMEPROM_DSKWR);
- asm volatile ("or %0,%%r0,%%r2" : "=r" (ret));
- return (!(ret & 0x4));
-}
diff --git a/sys/arch/mvme88k/stand/libbug/getbrdid.c b/sys/arch/mvme88k/stand/libbug/getbrdid.c
deleted file mode 100644
index c1417f489d7..00000000000
--- a/sys/arch/mvme88k/stand/libbug/getbrdid.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/* $OpenBSD: getbrdid.c,v 1.4 2013/01/05 11:20:56 miod Exp $ */
-
-/*
- * bug routines -- assumes that the necessary sections of memory
- * are preserved.
- */
-#include <sys/types.h>
-#include <machine/prom.h>
-#include "prom.h"
-
-/* BUG - query board routines */
-struct mvmeprom_brdid *
-mvmeprom_brdid()
-{
- struct mvmeprom_brdid *id;
-
- MVMEPROM_CALL(MVMEPROM_GETBRDID);
- asm volatile ("or %0,%%r0,%%r2": "=r" (id):);
- return (id);
-}
diff --git a/sys/arch/mvme88k/stand/libbug/inchr.c b/sys/arch/mvme88k/stand/libbug/inchr.c
deleted file mode 100644
index 2e34a9ce6fc..00000000000
--- a/sys/arch/mvme88k/stand/libbug/inchr.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* $OpenBSD: inchr.c,v 1.3 2013/01/05 11:20:56 miod Exp $ */
-
-/*
- * bug routines -- assumes that the necessary sections of memory
- * are preserved.
- */
-#include <sys/types.h>
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "prom.h"
-
-/* returns 0 if no characters ready to read */
-int
-getchar()
-{
- int ret;
-
- MVMEPROM_CALL(MVMEPROM_INCHR);
- asm volatile ("or %0,%%r0,%%r2" : "=r" (ret));
- return ret;
-}
diff --git a/sys/arch/mvme88k/stand/libbug/instat.c b/sys/arch/mvme88k/stand/libbug/instat.c
deleted file mode 100644
index 3b547b3c377..00000000000
--- a/sys/arch/mvme88k/stand/libbug/instat.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/* $OpenBSD: instat.c,v 1.4 2013/01/05 11:20:56 miod Exp $ */
-
-/*
- * bug routines -- assumes that the necessary sections of memory
- * are preserved.
- */
-#include <sys/types.h>
-#include <machine/prom.h>
-#include "prom.h"
-
-/* returns 0 if no characters ready to read */
-int
-mvmeprom_instat()
-{
- short ret;
-
- MVMEPROM_CALL(MVMEPROM_INSTAT);
- asm volatile ("or %0,%%r0,%%r2" : "=r" (ret));
- return (!(ret & 0x4));
-}
diff --git a/sys/arch/mvme88k/stand/libbug/libbug.h b/sys/arch/mvme88k/stand/libbug/libbug.h
deleted file mode 100644
index a63828794e1..00000000000
--- a/sys/arch/mvme88k/stand/libbug/libbug.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* $OpenBSD: libbug.h,v 1.7 2012/11/25 14:10:47 miod Exp $ */
-
-/*
- * prototypes and such. note that get/put char are in stand.h
- */
-
-void mvmeprom_delay(int);
-int mvmeprom_diskrd(struct mvmeprom_dskio *);
-int mvmeprom_diskwr(struct mvmeprom_dskio *);
-struct mvmeprom_brdid *mvmeprom_brdid(void);
-int mvmeprom_netcfig(struct mvmeprom_netcfig *);
-int mvmeprom_netctrl(struct mvmeprom_netctrl *);
-int mvmeprom_netfopen(struct mvmeprom_netfopen *);
-int mvmeprom_netfread(struct mvmeprom_netfread *);
-void mvmeprom_outln(char *, char *);
-void mvmeprom_outstr(char *, char *);
-void mvmeprom_rtc_rd(struct mvmeprom_time *);
-
-/*
- * bugcrt stuff
- */
-
-struct mvmeprom_args {
- u_int dev_lun;
- u_int ctrl_lun;
- u_int flags;
- u_int ctrl_addr;
- u_int entry;
- u_int conf_blk;
- char *arg_start;
- char *arg_end;
-};
-
-extern struct mvmeprom_args bugargs;
diff --git a/sys/arch/mvme88k/stand/libbug/netcfig.c b/sys/arch/mvme88k/stand/libbug/netcfig.c
deleted file mode 100644
index 0b159dcf22f..00000000000
--- a/sys/arch/mvme88k/stand/libbug/netcfig.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/* $OpenBSD: netcfig.c,v 1.2 2013/01/05 11:20:56 miod Exp $ */
-/* public domain */
-
-#include <sys/types.h>
-#include <machine/prom.h>
-
-#include "prom.h"
-
-int
-mvmeprom_netcfig(struct mvmeprom_netcfig *cfg)
-{
- asm volatile ("or %%r2,%%r0,%0": : "r" (cfg));
- MVMEPROM_CALL(MVMEPROM_NETCFIG);
- return cfg->status;
-}
diff --git a/sys/arch/mvme88k/stand/libbug/netctrl.c b/sys/arch/mvme88k/stand/libbug/netctrl.c
deleted file mode 100644
index 13c91180480..00000000000
--- a/sys/arch/mvme88k/stand/libbug/netctrl.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/* $OpenBSD: netctrl.c,v 1.2 2013/01/05 11:20:56 miod Exp $ */
-/* public domain */
-
-#include <sys/types.h>
-#include <machine/prom.h>
-
-#include "prom.h"
-
-int
-mvmeprom_netctrl(struct mvmeprom_netctrl *ctrl)
-{
- asm volatile ("or %%r2,%%r0,%0": : "r" (ctrl));
- MVMEPROM_CALL(MVMEPROM_NETCTRL);
- return ctrl->status;
-}
diff --git a/sys/arch/mvme88k/stand/libbug/netfopen.c b/sys/arch/mvme88k/stand/libbug/netfopen.c
deleted file mode 100644
index bda6cbf721d..00000000000
--- a/sys/arch/mvme88k/stand/libbug/netfopen.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/* $OpenBSD: netfopen.c,v 1.2 2013/01/05 11:20:56 miod Exp $ */
-
-/*
- * bug routines -- assumes that the necessary sections of memory
- * are preserved.
- */
-#include <sys/types.h>
-#include <machine/prom.h>
-
-#include "prom.h"
-
-/* returns 0: success, nonzero: error */
-int
-mvmeprom_netfopen(arg)
- struct mvmeprom_netfopen *arg;
-{
- asm volatile ("or %%r2,%%r0,%0": : "r" (arg));
- MVMEPROM_CALL(MVMEPROM_NETFOPEN);
- return (arg->status);
-}
diff --git a/sys/arch/mvme88k/stand/libbug/netfread.c b/sys/arch/mvme88k/stand/libbug/netfread.c
deleted file mode 100644
index 453dc39d183..00000000000
--- a/sys/arch/mvme88k/stand/libbug/netfread.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/* $OpenBSD: netfread.c,v 1.2 2013/01/05 11:20:56 miod Exp $ */
-
-/*
- * bug routines -- assumes that the necessary sections of memory
- * are preserved.
- */
-#include <sys/types.h>
-#include <machine/prom.h>
-
-#include "prom.h"
-
-/* returns 0: success, nonzero: error */
-int
-mvmeprom_netfread(arg)
- struct mvmeprom_netfread *arg;
-{
- asm volatile ("or %%r2,%%r0,%0": : "r" (arg));
- MVMEPROM_CALL(MVMEPROM_NETFREAD);
- return (arg->status);
-}
diff --git a/sys/arch/mvme88k/stand/libbug/outstr.c b/sys/arch/mvme88k/stand/libbug/outstr.c
deleted file mode 100644
index d69bf5c6bcb..00000000000
--- a/sys/arch/mvme88k/stand/libbug/outstr.c
+++ /dev/null
@@ -1,18 +0,0 @@
-/* $OpenBSD: outstr.c,v 1.4 2013/01/05 11:20:56 miod Exp $ */
-
-/*
- * bug routines -- assumes that the necessary sections of memory
- * are preserved.
- */
-#include <sys/types.h>
-#include <machine/prom.h>
-#include "prom.h"
-
-void
-mvmeprom_outstr(start, end)
- char *start, *end;
-{
- asm volatile ("or %%r2,%%r0,%0": : "r" (start));
- asm volatile ("or %%r3,%%r0,%0": : "r" (end));
- MVMEPROM_CALL(MVMEPROM_OUTSTR);
-}
diff --git a/sys/arch/mvme88k/stand/libbug/prom.h b/sys/arch/mvme88k/stand/libbug/prom.h
deleted file mode 100644
index 9bff50af7be..00000000000
--- a/sys/arch/mvme88k/stand/libbug/prom.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* $OpenBSD: prom.h,v 1.6 2013/01/05 11:20:56 miod Exp $ */
-/*
- * Copyright (c) 2006, 2010, Miodrag Vallat.
- * Copyright (c) 1998 Steve Murphree, Jr.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#define MVMEPROM_CALL(x) \
- __asm__ __volatile__ ("or %%r9,%%r0," __STRING(x) "; tb0 0,%%r0,496" \
- ::: "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", \
- "r9", "r10", "r11", "r12", "r13", "memory")
diff --git a/sys/arch/mvme88k/stand/libbug/putchar.c b/sys/arch/mvme88k/stand/libbug/putchar.c
deleted file mode 100644
index 17159158863..00000000000
--- a/sys/arch/mvme88k/stand/libbug/putchar.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/* $OpenBSD: putchar.c,v 1.5 2013/01/05 11:20:56 miod Exp $ */
-
-/*
- * putchar: easier to do this with outstr than to add more macros to
- * handle byte passing on the stack
- */
-
-#include <sys/types.h>
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "prom.h"
-
-void
-putchar(c)
- int c;
-{
- char ca;
- ca = (char)c & 0xFF;
- if (ca == '\n')
- putchar('\r');
- asm volatile ("or %%r2,%%r0,%0" : : "r" (ca));
- MVMEPROM_CALL(MVMEPROM_OUTCHR);
-}
diff --git a/sys/arch/mvme88k/stand/libbug/return.c b/sys/arch/mvme88k/stand/libbug/return.c
deleted file mode 100644
index 113dd3e2186..00000000000
--- a/sys/arch/mvme88k/stand/libbug/return.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/* $OpenBSD: return.c,v 1.4 2006/05/16 22:51:30 miod Exp $ */
-
-/*
- * bug routines -- assumes that the necessary sections of memory
- * are preserved.
- */
-#include <sys/types.h>
-#include <machine/prom.h>
-#include "stand.h"
-#include "prom.h"
-
-/* BUG - return to bug routine */
-__dead void
-_rtt()
-{
- MVMEPROM_CALL(MVMEPROM_EXIT);
- printf("_rtt: exit failed. spinning...");
- while (1) ;
- /*NOTREACHED*/
-}
diff --git a/sys/arch/mvme88k/stand/libbug/rtc_rd.c b/sys/arch/mvme88k/stand/libbug/rtc_rd.c
deleted file mode 100644
index 50a23f17c38..00000000000
--- a/sys/arch/mvme88k/stand/libbug/rtc_rd.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* $OpenBSD: rtc_rd.c,v 1.4 2013/01/05 11:20:56 miod Exp $ */
-
-/*
- * bug routines -- assumes that the necessary sections of memory
- * are preserved.
- */
-#include <sys/types.h>
-#include <machine/prom.h>
-#include "prom.h"
-
-void
-mvmeprom_rtc_rd(ptime)
- struct mvmeprom_time *ptime;
-{
- asm volatile ("or %%r2,%%r0,%0": : "r" (ptime));
- MVMEPROM_CALL(MVMEPROM_RTC_RD);
-}
diff --git a/sys/arch/mvme88k/stand/libsa/Makefile b/sys/arch/mvme88k/stand/libsa/Makefile
deleted file mode 100644
index f8a5c6f44ef..00000000000
--- a/sys/arch/mvme88k/stand/libsa/Makefile
+++ /dev/null
@@ -1,50 +0,0 @@
-# $OpenBSD: Makefile,v 1.15 2013/05/12 10:43:45 miod Exp $
-
-LIB=sa
-
-NOPIC=nopic
-NOPROFILE=noprofile
-NOPIE=
-
-# Logically src/sys
-S=${.CURDIR}/../../../..
-
-SRCS= board.c bugdev.c clock.c exec_mvme.c fault.c parse_args.c setjmp.S
-
-.PATH: ${S}/lib/libsa
-SRCS+= alloc.c memcpy.c exit.c getfile.c gets.c globals.c \
- printf.c strerror.c memset.c memcmp.c strncpy.c strcmp.c strlen.c \
- strlcpy.c strlcat.c snprintf.c strchr.c \
- close.c closeall.c dev.c dkcksum.c \
- lseek.c open.c nullfs.c read.c fstat.c \
- ufs.c cread.c
-SRCS+= arp.c ether.c in_cksum.c net.c rpc.c nfs.c \
- rarp.c bootparam.c
-SRCS+= loadfile.c
-
-.PATH: ${S}/lib/libkern/arch/m88k ${S}/lib/libkern
-SRCS+= ashrdi3.c bzero.c __main.c
-
-# DBG= -DDEBUG -DNETIF_DEBUG -DNFS_DEBUG -DRPC_DEBUG \
-# -DNET_DEBUG -DRARP_DEBUG -DETHER_DEBUG
-
-#DEFS= -DCOMPAT_UFS
-DEFS= -D__INTERNAL_LIBSA_CREAD -D_STANDALONE
-#DEFS+=-DNETIF_DEBUG
-INCL= -I${.CURDIR} -I${.CURDIR}/../libbug -I${S}/lib/libsa -I${S} -I.
-CFLAGS+= ${XCFLAGS} ${COPTS} ${DEFS} ${DBG} ${INCL}
-
-all: libsa.a
-
-install:
-
-.include <bsd.lib.mk>
-
-.if !make(obj)
-.BEGIN:
- @([ -h dev ] || ln -s ${.CURDIR}/../../../${MACHINE}/dev dev)
- @([ -h machine ] || ln -s ${.CURDIR}/../../../${MACHINE}/include machine)
- @([ -h m88k ] || ln -s ${.CURDIR}/../../../m88k/include m88k)
-.NOPATH: dev machine m88k
-CLEANFILES+= dev machine m88k
-.endif
diff --git a/sys/arch/mvme88k/stand/libsa/Makefile.inc b/sys/arch/mvme88k/stand/libsa/Makefile.inc
deleted file mode 100644
index 9b6b6a2521f..00000000000
--- a/sys/arch/mvme88k/stand/libsa/Makefile.inc
+++ /dev/null
@@ -1,14 +0,0 @@
-# $OpenBSD: Makefile.inc,v 1.3 2006/05/16 22:51:30 miod Exp $
-
-LIB_SA_DIR=${S}/arch/mvme88k/stand/libsa
-
-LIBSA_DIR!= cd ${LIB_SA_DIR}; \
- printf "xxx:\n\techo \$${.OBJDIR}\n" | ${MAKE} -r -s -f - xxx
-
-LIBSA=${LIBSA_DIR}/libsa.a
-
-$(LIBSA): .NOTMAIN __always_make_libsa
- @echo making sure the libsa is up to date...
- @(cd ${LIB_SA_DIR}; ${MAKE} "XCFLAGS=${CFLAGS}")
-
-__always_make_libsa: .NOTMAIN
diff --git a/sys/arch/mvme88k/stand/libsa/board.c b/sys/arch/mvme88k/stand/libsa/board.c
deleted file mode 100644
index d5033994492..00000000000
--- a/sys/arch/mvme88k/stand/libsa/board.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/* $OpenBSD: board.c,v 1.1 2008/09/19 20:18:03 miod Exp $ */
-
-/*
- * Copyright (c) 2008 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/param.h>
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-
-#include <dev/busswreg.h>
-
-void
-board_setup()
-{
- int board;
- u_int8_t cpuspeed, version, btimer, pbt;
-
- board = mvmeprom_brdid()->model;
-
- switch (board) {
- case BRD_197:
- /*
- * The following is similar to what m197_bootstrap()
- * in mvme88k/m197_machdep.c does.
- * Please refer to the comments in there for details.
- */
- cpuspeed = 256 - *(volatile u_int8_t *)(BS_BASE + BS_PADJUST);
- version = *(volatile u_int8_t *)(BS_BASE + BS_CHIPREV);
- btimer = *(volatile u_int8_t *)(BS_BASE + BS_BTIMER);
- pbt = btimer & BS_BTIMER_PBT_MASK;
- btimer = (btimer & ~BS_BTIMER_PBT_MASK);
-
- if (cpuspeed < 50 || version <= 0x01) {
- if (pbt < BS_BTIMER_PBT256)
- pbt = BS_BTIMER_PBT256;
- } else {
- if (pbt < BS_BTIMER_PBT64)
- pbt = BS_BTIMER_PBT64;
- }
-
- *(volatile u_int8_t *)(BS_BASE + BS_BTIMER) = btimer | pbt;
-
- break;
- }
-}
diff --git a/sys/arch/mvme88k/stand/libsa/bugdev.c b/sys/arch/mvme88k/stand/libsa/bugdev.c
deleted file mode 100644
index adb9751794b..00000000000
--- a/sys/arch/mvme88k/stand/libsa/bugdev.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/* $OpenBSD: bugdev.c,v 1.9 2013/11/05 00:51:58 krw Exp $ */
-
-/*
- * Copyright (c) 1993 Paul Kranenburg
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Paul Kranenburg.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/disklabel.h>
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-
-void cputobsdlabel(struct disklabel *lp, struct mvmedisklabel *clp);
-
-struct bugsc_softc {
- int fd; /* Prom file descriptor */
- int poff; /* Partition offset */
- int psize; /* Partition size */
- short ctrl;
- short dev;
-} bugsc_softc[1];
-
-int
-devopen(f, fname, file)
- struct open_file *f;
- const char *fname;
- char **file;
-{
- register struct bugsc_softc *pp = &bugsc_softc[0];
- size_t i;
- int error, pn = 0;
- char *dev, *cp;
- static char iobuf[MAXBSIZE];
- struct disklabel sdlabel;
-
- dev = bugargs.arg_start;
-
- /*
- * Extract partition # from boot device string.
- */
- for (cp = dev; *cp; cp++) /* void */;
- while (*cp != '/' && cp > dev) {
- if (*cp == ':')
- pn = *(cp+1) - 'a';
- --cp;
- }
-
- pp->fd = bugscopen(f);
-
- if (pp->fd < 0) {
- printf("Can't open device `%s'\n", dev);
- return (ENXIO);
- }
- error = bugscstrategy(pp, F_READ, LABELSECTOR, DEV_BSIZE, iobuf, &i);
- if (error)
- return (error);
- if (i != DEV_BSIZE)
- return (EINVAL);
-
- cputobsdlabel(&sdlabel, (struct mvmedisklabel *)iobuf);
- pp->poff = sdlabel.d_partitions[pn].p_offset;
- pp->psize = sdlabel.d_partitions[pn].p_size;
-
- f->f_dev = devsw;
- f->f_devdata = (void *)pp;
- *file = (char *)fname;
- return (0);
-}
-
-/* silly block scale factor */
-#define BUG_BLOCK_SIZE 256
-#define BUG_SCALE (512/BUG_BLOCK_SIZE)
-int
-bugscstrategy(devdata, func, dblk, size, buf, rsize)
- void *devdata;
- int func;
- daddr32_t dblk;
- size_t size;
- void *buf;
- size_t *rsize;
-{
- struct mvmeprom_dskio dio;
- register struct bugsc_softc *pp = (struct bugsc_softc *)devdata;
- daddr32_t blk = dblk + pp->poff;
-
- twiddle();
-
- dio.ctrl_lun = pp->ctrl;
- dio.dev_lun = pp->dev;
- dio.status = 0;
- dio.pbuffer = buf;
- dio.blk_num = blk * BUG_SCALE;
- dio.blk_cnt = size / BUG_BLOCK_SIZE; /* assumed size in bytes */
- dio.flag = 0;
- dio.addr_mod = 0;
-#ifdef DEBUG
- printf("bugscstrategy: size=%d blk=%d buf=%x\n", size, blk, buf);
- printf("ctrl %d dev %d\n", dio.ctrl_lun, dio.dev_lun);
-#endif
- mvmeprom_diskrd(&dio);
-
- *rsize = dio.blk_cnt * BUG_BLOCK_SIZE;
-#ifdef DEBUG
-printf("rsize %d status %x\n", *rsize, dio.status);
-#endif
-
- if (dio.status)
- return (EIO);
- return (0);
-}
-
-int
-bugscopen(f)
- struct open_file *f;
-{
-#ifdef DEBUG
- printf("bugscopen:\n");
-#endif
-
- f->f_devdata = (void *)bugsc_softc;
- bugsc_softc[0].ctrl = (short)bugargs.ctrl_lun;
- bugsc_softc[0].dev = (short)bugargs.dev_lun;
-#ifdef DEBUG
- printf("using mvmebug ctrl %d dev %d\n",
- bugsc_softc[0].ctrl, bugsc_softc[0].dev);
-#endif
- return (0);
-}
-
-int
-bugscclose(f)
- struct open_file *f;
-{
- return (EIO);
-}
-
-int
-bugscioctl(f, cmd, data)
- struct open_file *f;
- u_long cmd;
- void *data;
-{
- return (EIO);
-}
-
-void
-cputobsdlabel(lp, clp)
- struct disklabel *lp;
- struct mvmedisklabel *clp;
-{
- int i;
-
- lp->d_magic = clp->magic1;
- lp->d_type = clp->type;
- lp->d_subtype = clp->subtype;
- bcopy(clp->vid_vd, lp->d_typename, 16);
- bcopy(clp->packname, lp->d_packname, 16);
- lp->d_secsize = clp->cfg_psm;
- lp->d_nsectors = clp->cfg_spt;
- lp->d_ncylinders = clp->cfg_trk; /* trk is really num of cyl! */
- lp->d_ntracks = clp->cfg_hds;
-
- lp->d_secpercyl = clp->secpercyl;
- DL_SETDSIZE(lp, clp->secperunit);
- lp->d_acylinders = clp->acylinders;
- lp->d_flags = clp->flags;
- for (i = 0; i < NDDATA; i++)
- lp->d_drivedata[i] = clp->drivedata[i];
- for (i = 0; i < NSPARE; i++)
- lp->d_spare[i] = clp->spare[i];
- lp->d_magic2 = clp->magic2;
- lp->d_checksum = clp->checksum;
- lp->d_npartitions = clp->partitions;
- lp->d_bbsize = clp->bbsize;
- lp->d_sbsize = clp->sbsize;
- bcopy(clp->vid_4, &(lp->d_partitions[0]),sizeof (struct partition) * 4);
- bcopy(clp->cfg_4, &(lp->d_partitions[4]), sizeof (struct partition)
- * ((MAXPARTITIONS < 16) ? (MAXPARTITIONS - 4) : 12));
-}
diff --git a/sys/arch/mvme88k/stand/libsa/clock.c b/sys/arch/mvme88k/stand/libsa/clock.c
deleted file mode 100644
index 3aa678f3a49..00000000000
--- a/sys/arch/mvme88k/stand/libsa/clock.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* $OpenBSD: clock.c,v 1.5 2008/03/31 22:11:37 miod Exp $ */
-
-
-#include <sys/types.h>
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-
-#define LEAPYEAR(y) (((y) & 3) == 0)
-#define YEAR0 68
-
-/*
- * This code is defunct after 2068.
- * Will Unix still be here then??
- */
-const short dayyr[12] =
-{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
-
-static u_long
-chiptotime(sec, min, hour, day, mon, year)
- register int sec, min, hour, day, mon, year;
-{
- register int days, yr;
-
- sec = FROMBCD(sec);
- min = FROMBCD(min);
- hour = FROMBCD(hour);
- day = FROMBCD(day);
- mon = FROMBCD(mon);
- year = FROMBCD(year) + YEAR0;
- if (year < 70)
- year = 70;
-
- /* simple sanity checks */
- if (year < 70 || mon < 1 || mon > 12 || day < 1 || day > 31)
- return (0);
- days = 0;
- for (yr = 70; yr < year; yr++)
- days += LEAPYEAR(yr) ? 366 : 365;
- days += dayyr[mon - 1] + day - 1;
- if (LEAPYEAR(yr) && mon > 2)
- days++;
- /* now have days since Jan 1, 1970; the rest is easy... */
- return (days * SECDAY + hour * 3600 + min * 60 + sec);
-}
-
-time_t
-getsecs()
-{
- struct mvmeprom_time m;
-
- mvmeprom_rtc_rd(&m);
- return (chiptotime(m.sec_BCD, m.min_BCD, m.hour_BCD, m.day_BCD,
- m.month_BCD, m.year_BCD));
-}
diff --git a/sys/arch/mvme88k/stand/libsa/exec_mvme.c b/sys/arch/mvme88k/stand/libsa/exec_mvme.c
deleted file mode 100644
index d480018f953..00000000000
--- a/sys/arch/mvme88k/stand/libsa/exec_mvme.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/* $OpenBSD: exec_mvme.c,v 1.16 2014/02/20 20:34:27 miod Exp $ */
-
-
-/*-
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)boot.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-
-#include <lib/libsa/loadfile.h>
-
-char rnddata[BOOTRANDOM_MAX]; /* set by bootsd only */
-
-/*ARGSUSED*/
-void
-exec_mvme(file, flag)
- char *file;
- int flag;
-{
- u_long marks[MARK_MAX];
- int options;
- int rc;
- void (*entry)(int, int, int, int, int, int, int);
- int bootdev;
- struct mvmeprom_brdid *id;
-
- id = mvmeprom_brdid();
- options = LOAD_KERNEL | COUNT_KERNEL;
- if ((flag & RB_NOSYM) != 0)
- options &= ~(LOAD_SYM | COUNT_SYM);
-
- marks[MARK_START] = 0;
- rc = loadfile(file, marks, options);
- if (rc != 0)
- return;
-
- printf("Start @ 0x%lx\n", marks[MARK_START]);
- printf("Controller Address 0x%x\n", bugargs.ctrl_addr);
- if (flag & RB_HALT)
- _rtt();
-
- bootdev = (bugargs.ctrl_lun << 8) | (bugargs.dev_lun & 0xFF);
- entry = (void(*)(int, int, int, int, int, int, int))marks[MARK_START];
- (*entry)(flag, bugargs.ctrl_addr, marks[MARK_END], marks[MARK_SYM],
- 0, bootdev, id->model);
-
- printf("exec: kernel returned!\n");
- return;
-}
diff --git a/sys/arch/mvme88k/stand/libsa/fault.c b/sys/arch/mvme88k/stand/libsa/fault.c
deleted file mode 100644
index 9b12d96752a..00000000000
--- a/sys/arch/mvme88k/stand/libsa/fault.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/* $OpenBSD: fault.c,v 1.1 2013/05/12 10:43:45 miod Exp $ */
-
-/*
- * Copyright (c) 2013 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * Standalone code to recover from faults. Allows for hardware detection.
- */
-
-#include <sys/param.h>
-
-#include <machine/asm.h>
-#include <machine/asm_macro.h>
-#include <machine/prom.h>
-#include <machine/psl.h>
-
-#include "stand.h"
-#include "libsa.h"
-
-typedef struct label_t {
- long val[19];
-} label_t;
-
-extern int setjmp(label_t *);
-extern void longjmp(label_t *);
-
-static label_t badaddr_jmpbuf;
-static uint32_t badaddr_psr;
-
-static uint32_t bug_vbr;
-static uint32_t vector_page[512 * 2] __attribute__ ((__aligned__(0x1000)));
-
-static __inline__ uint32_t
-get_vbr()
-{
- uint32_t vbr;
- __asm__ __volatile__ ("ldcr %0, %%cr7" : "=r"(vbr));
- return vbr;
-}
-
-static __inline__ void
-set_vbr(uint32_t vbr)
-{
- __asm__ __volatile__ ("stcr %0, %%cr7" :: "r"(vbr));
-}
-
-/*
- * This is an horribly crude logic to recover from data access exceptions
- * by longjmp'ing back to badaddr(). We should theoretically at least use
- * an `rte' somewhere to unfreeze the scoreboard. But since we restore a
- * PSR with interrupts disabled, this turns out to be safe.
- */
-static void
-libsa_fault_handler(void)
-{
- set_psr(badaddr_psr | PSR_IND); /* undo SFRZ */
- flush_pipeline();
-
- longjmp(&badaddr_jmpbuf);
- /* NOTREACHED */
-}
-
-static __inline__ uint32_t
-br(uint32_t delta)
-{
- return 0xc0000000 | (((int32_t)delta >> 2) & 0x03ffffff);
-}
-
-static void
-libsa_fault_init()
-{
- int vec;
- uint32_t *insn;
- uint32_t br_insn;
-
- bug_vbr = get_vbr();
-
- insn = vector_page;
- br_insn = br(bug_vbr - (uint32_t)&vector_page - 4);
- for (vec = 512; vec != 0; vec--) {
- *insn++ = 0xf4005800; /* nop */
- *insn++ = br_insn; /* br into bug vbr page */
- }
-
- /* override data access exception */
- vector_page[3 * 2 + 1] =
- br((uint32_t)&libsa_fault_handler -
- (uint32_t)&vector_page[3 * 2 + 1]);
-}
-
-int
-badaddr(void *addr, int len)
-{
- int rc;
-
- if (vector_page[0] == 0)
- libsa_fault_init();
-
- badaddr_psr = get_psr();
- set_psr(badaddr_psr | PSR_IND);
-
- set_vbr((uint32_t)&vector_page);
-
- if (setjmp(&badaddr_jmpbuf) == 0) {
- switch (len) {
- case 1:
- (void)*(volatile uint8_t *)addr;
- rc = 0;
- break;
- case 2:
- if ((uint32_t)addr & 1)
- rc = 1;
- else {
- (void)*(volatile uint16_t *)addr;
- rc = 0;
- }
- break;
- case 4:
- if ((uint32_t)addr & 3)
- rc = 1;
- else {
- (void)*(volatile uint32_t *)addr;
- rc = 0;
- }
- break;
- default:
- rc = 1;
- break;
- }
- } else {
- rc = 1;
- }
-
- set_vbr(bug_vbr);
- flush_pipeline();
- set_psr(badaddr_psr);
-
- return rc;
-}
diff --git a/sys/arch/mvme88k/stand/libsa/libsa.h b/sys/arch/mvme88k/stand/libsa/libsa.h
deleted file mode 100644
index 660afccb761..00000000000
--- a/sys/arch/mvme88k/stand/libsa/libsa.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* $OpenBSD: libsa.h,v 1.7 2013/05/12 10:43:45 miod Exp $ */
-
-/*
- * libsa prototypes
- */
-
-#include "libbug.h"
-
-/* board.c */
-void board_setup(void);
-
-/* bugdev.c */
-int bugscopen(struct open_file *, ...);
-int bugscclose(struct open_file *);
-int bugscioctl(struct open_file *, u_long, void *);
-int bugscstrategy(void *, int, daddr32_t, size_t, void *, size_t *);
-
-/* exec_mvme.c */
-void exec_mvme(char *, int);
-
-/* fault.c */
-int badaddr(void *, int);
-
-/* parse_args.c */
-int parse_args(char **, int *);
-
diff --git a/sys/arch/mvme88k/stand/libsa/parse_args.c b/sys/arch/mvme88k/stand/libsa/parse_args.c
deleted file mode 100644
index 31db44136b2..00000000000
--- a/sys/arch/mvme88k/stand/libsa/parse_args.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/* $OpenBSD: parse_args.c,v 1.6 2008/03/23 17:05:41 deraadt Exp $ */
-
-/*-
- * Copyright (c) 1995 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-#include <machine/prom.h>
-#include <a.out.h>
-
-#include "stand.h"
-#include "libsa.h"
-
-#define KERNEL_NAME "bsd"
-
-struct flags {
- char c;
- short bit;
-} bf[] = {
- { 'a', RB_ASKNAME }, /* ask root */
- { 'b', RB_HALT },
- { 'c', RB_CONFIG },
- { 'd', RB_KDB },
- { 'm', RB_MINIROOT },
- { 's', RB_SINGLE },
- { 'y', RB_NOSYM },
-};
-
-int
-parse_args(filep, flagp)
- char **filep;
- int *flagp;
-{
- char *name = KERNEL_NAME, *ptr;
- int i, howto = 0;
- char c;
-
- if (bugargs.arg_start != bugargs.arg_end) {
- ptr = bugargs.arg_start;
- while ((c = *ptr) != '\0') {
- while (c == ' ')
- c = *++ptr;
- if (c == '\0')
- return (0);
- if (c != '-') {
- name = ptr;
- while ((c = *++ptr) && c != ' ')
- ;
- if (c)
- *ptr++ = 0;
- continue;
- }
- while ((c = *++ptr) && c != ' ') {
- if (c == 'q')
- return (1);
- for (i = 0; i < sizeof(bf)/sizeof(bf[0]); i++)
- if (bf[i].c == c) {
- howto |= bf[i].bit;
- }
- }
- }
- }
- *flagp = howto;
- *filep = name;
- return (0);
-}
diff --git a/sys/arch/mvme88k/stand/libsa/setjmp.S b/sys/arch/mvme88k/stand/libsa/setjmp.S
deleted file mode 100644
index 30f19dd1d9e..00000000000
--- a/sys/arch/mvme88k/stand/libsa/setjmp.S
+++ /dev/null
@@ -1,79 +0,0 @@
-/* $OpenBSD: setjmp.S,v 1.1 2013/05/12 10:43:45 miod Exp $ */
-/*
- * Mach Operating System
- * Copyright (c) 1993-1992 Carnegie Mellon University
- * Copyright (c) 1991 OMRON Corporation
- * Copyright (c) 1996 Nivas Madhur
- * Copyright (c) 1998 Steve Murphree, Jr.
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON AND OMRON ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON AND OMRON DISCLAIM ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include <machine/asm.h>
-
-/* int setjmp(label_t *); */
-ENTRY(setjmp)
- st %r1, %r2, 0
- st %r14, %r2, 4
- st %r15, %r2, 2*4
- st %r16, %r2, 3*4
- st %r17, %r2, 4*4
- st %r18, %r2, 5*4
- st %r19, %r2, 6*4
- st %r20, %r2, 7*4
- st %r21, %r2, 8*4
- st %r22, %r2, 9*4
- st %r23, %r2, 10*4
- st %r24, %r2, 11*4
- st %r25, %r2, 12*4
- st %r26, %r2, 13*4
- st %r27, %r2, 14*4
- st %r28, %r2, 15*4
- st %r29, %r2, 16*4
- st %r30, %r2, 17*4
- st %r31, %r2, 18*4
- jmp.n %r1
- or %r2, %r0, %r0
-
-/* void longjmp(label_t*); */
-ENTRY(longjmp)
- ld %r1, %r2, 0
- ld %r14, %r2, 4
- ld %r15, %r2, 2*4
- ld %r16, %r2, 3*4
- ld %r17, %r2, 4*4
- ld %r18, %r2, 5*4
- ld %r19, %r2, 6*4
- ld %r20, %r2, 7*4
- ld %r21, %r2, 8*4
- ld %r22, %r2, 9*4
- ld %r23, %r2, 10*4
- ld %r24, %r2, 11*4
- ld %r25, %r2, 12*4
- ld %r26, %r2, 13*4
- ld %r27, %r2, 14*4
- ld %r28, %r2, 15*4
- ld %r29, %r2, 16*4
- ld %r30, %r2, 17*4
- ld %r31, %r2, 18*4
- jmp.n %r1
- or %r2, %r0, 1
diff --git a/sys/arch/mvme88k/stand/libz/Makefile b/sys/arch/mvme88k/stand/libz/Makefile
deleted file mode 100644
index 58559723b2a..00000000000
--- a/sys/arch/mvme88k/stand/libz/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2012/08/21 14:46:19 pascal Exp $
-
-S=${.CURDIR}/../../../..
-ZDST=${.OBJDIR}
-NOPIE=
-
-.PATH: ${S}/lib/libz
-
-.include "${S}/lib/libz/Makefile"
diff --git a/sys/arch/mvme88k/stand/libz/Makefile.inc b/sys/arch/mvme88k/stand/libz/Makefile.inc
deleted file mode 100644
index fd445224998..00000000000
--- a/sys/arch/mvme88k/stand/libz/Makefile.inc
+++ /dev/null
@@ -1,14 +0,0 @@
-# $OpenBSD: Makefile.inc,v 1.1 1998/08/22 06:39:14 smurph Exp $
-
-LIB_Z_DIR=${S}/arch/mvme88k/stand/libz
-
-LIBZ_DIR!= cd ${LIB_Z_DIR}; \
- printf "xxx:\n\techo \$${.OBJDIR}\n" | ${MAKE} -r -s -f - xxx
-
-LIBZ=${LIBZ_DIR}/libz.a
-
-$(LIBZ): .NOTMAIN __always_make_libz
- @echo making sure the libz is up to date...
- @(cd ${LIB_Z_DIR}; ${MAKE} "XCFLAGS=${CFLAGS}")
-
-__always_make_libz: .NOTMAIN
diff --git a/sys/arch/mvme88k/stand/netboot/Makefile b/sys/arch/mvme88k/stand/netboot/Makefile
deleted file mode 100644
index f7093d132af..00000000000
--- a/sys/arch/mvme88k/stand/netboot/Makefile
+++ /dev/null
@@ -1,42 +0,0 @@
-# $OpenBSD: Makefile,v 1.21 2013/11/06 19:37:06 miod Exp $
-
-STRIP?= strip
-
-S= ${.CURDIR}/../../../..
-DEFS= -DSUN_BOOTPARAMS
-#-DNETIF_DEBUG
-INCPATH=-I${.CURDIR} -I${.CURDIR}/../libsa -I${.CURDIR}/../libbug \
- -I${S} -I${S}/lib/libsa
-CFLAGS+=${DEFS} ${INCPATH} ${COPTS}
-CLEANFILES+=netboot netboot.bin
-
-.include "${S}/arch/mvme88k/stand/bugcrt/Makefile.inc"
-.include "${S}/arch/mvme88k/stand/libbug/Makefile.inc"
-.include "${S}/arch/mvme88k/stand/libsa/Makefile.inc"
-.include "${S}/arch/mvme88k/stand/libz/Makefile.inc"
-
-SRCS= boot.c devices.c version.c
-SRCS+= conf.c dev_net.c devopen.c netif.c
-SRCS+= if_ie.c
-SRCS+= if_le.c
-OBJS= ${SRCS:S/.c/.o/g}
-LIBS= ${LIBSA} ${LIBBUG} ${LIBZ}
-LDFLAGS=-N -T ${S}/arch/mvme88k/stand/ld.script -Ttext ${STAGE2_RELOC}
-LDFLAGS+= -warn-common
-NOPIE=
-
-all: netboot.bin
-
-netboot: ${NETBOOT_CRT} ${OBJS} ${LIBS}
- ${LD} ${LDFLAGS} -o $@ \
- ${NETBOOT_CRT} ${OBJS} ${LIBS} `${CC} -print-libgcc-file-name`
-
-netboot.bin: netboot
- ${STRIP} netboot
- dd ibs=32 skip=1 if=netboot of=$@
-
-install:
- ${INSTALL} ${INSTALL_COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
- netboot.bin ${DESTDIR}${MDEC_DIR}/netboot
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/mvme88k/stand/netboot/boot.c b/sys/arch/mvme88k/stand/netboot/boot.c
deleted file mode 100644
index a5b1bb2f033..00000000000
--- a/sys/arch/mvme88k/stand/netboot/boot.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/* $OpenBSD: boot.c,v 1.11 2013/05/12 10:43:45 miod Exp $ */
-
-/*-
- * Copyright (c) 1995 Theo de Raadt
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)boot.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-
-#include "config.h"
-
-extern const char *version;
-char line[128];
-
-int
-main()
-{
- char *cp, *file;
- int ask = 0, howto, ret;
-
- board_setup();
-
- printf("\n>> OpenBSD/mvme88k netboot [%s]\n", version);
-
- if (probe_ethernet() == 0) {
- printf("Sorry, this Ethernet device is supported by the BUG"
- " but not by the OpenBSD\n"
- "boot blocks yet. Consider trying to netboot `tftpboot'"
- " instead.\n");
- return 1;
- }
-
- ret = parse_args(&file, &howto);
-
- for (;;) {
- if (ask) {
- printf("boot: ");
- gets(line);
- if (line[0]) {
- bugargs.arg_start = line;
- cp = line;
- while (cp < (line + sizeof(line) - 1) && *cp)
- cp++;
- bugargs.arg_end = cp;
- ret = parse_args(&file, &howto);
-
- if (ret) {
- printf("returning to BUG\n");
- break;
- }
- }
- }
- exec_mvme(file, howto);
- printf("boot: %s: %s\n", file, strerror(errno));
- ask = 1;
- }
- return 0;
-}
diff --git a/sys/arch/mvme88k/stand/netboot/conf.c b/sys/arch/mvme88k/stand/netboot/conf.c
deleted file mode 100644
index d5794736801..00000000000
--- a/sys/arch/mvme88k/stand/netboot/conf.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* $OpenBSD: conf.c,v 1.4 2013/05/12 10:43:45 miod Exp $ */
-
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-
-#include <stand.h>
-#include <nfs.h>
-#include <dev_net.h>
-
-struct fs_ops file_system[] = {
- { nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat },
-};
-int nfsys = sizeof(file_system) / sizeof(file_system[0]);
-
-struct devsw devsw[] = {
- { "net", net_strategy, net_open, net_close, net_ioctl },
-};
-int ndevs = sizeof(devsw) / sizeof(devsw[0]);
-
-
-/* XXX */
-int netif_debug;
-int debug;
-int errno;
diff --git a/sys/arch/mvme88k/stand/netboot/config.h b/sys/arch/mvme88k/stand/netboot/config.h
deleted file mode 100644
index 6d3e9d6d3c0..00000000000
--- a/sys/arch/mvme88k/stand/netboot/config.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* $OpenBSD: config.h,v 1.4 2013/05/12 10:43:45 miod Exp $ */
-
-/*
- * Copyright (c) 2013 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/* MVME187/MVME197 on-board */
-
-struct ie_configuration {
- int clun;
- u_int phys_addr;
- u_char eaddr[6];
-};
-
-extern struct ie_configuration ie_config[];
-extern int nie_config;
-
-#define INTEL_REG_ADDR 0xfff46000
-
-/* MVME376 */
-
-struct le_configuration {
- int clun;
- u_int phys_addr; /* registers */
- u_int buf_addr; /* buffers if off-memory */
- u_int buf_size; /* buffer memory size */
- u_char eaddr[6];
-};
-
-extern struct le_configuration le_config[];
-extern int nle_config;
-
-extern int probe_ethernet(void);
-extern void display_ethernet(void);
diff --git a/sys/arch/mvme88k/stand/netboot/dev_net.c b/sys/arch/mvme88k/stand/netboot/dev_net.c
deleted file mode 100644
index 0bb308d74e2..00000000000
--- a/sys/arch/mvme88k/stand/netboot/dev_net.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/* $OpenBSD: dev_net.c,v 1.6 2013/05/12 10:43:45 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Gordon W. Ross
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- * 4. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Gordon W. Ross
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * This module implements a "raw device" interface suitable for
- * use by the stand-alone I/O library NFS code. This interface
- * does not support any "block" access, and exists only for the
- * purpose of initializing the network interface, getting boot
- * parameters, and performing the NFS mount.
- *
- * At open time, this does:
- *
- * find interface - netif_open()
- * RARP for IP address - rarp_getipaddress()
- * RPC/bootparams - callrpc(d, RPC_BOOTPARAMS, ...)
- * RPC/mountd - nfs_mount(sock, ip, path)
- *
- * the root file handle from mountd is saved in a global
- * for use by the NFS open code (NFS/lookup).
- */
-
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#include <netinet/in.h>
-#include <netinet/if_ether.h>
-#include <netinet/in_systm.h>
-
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-#include "net.h"
-#include "netif.h"
-#include "config.h"
-#include "bootparam.h"
-#include "nfs.h"
-
-extern int nfs_root_node[]; /* XXX - get from nfs_mount() */
-
-int netdev_sock = -1;
-static int open_count;
-
-int net_mountroot(struct open_file *, char *);
-
-/*
- * Called by devopen after it sets f->f_dev to our devsw entry.
- * This opens the low-level device and sets f->f_devdata.
- */
-int
-net_open(f, devname)
- struct open_file *f;
- char *devname; /* Device part of file name (or NULL). */
-{
- int error = 0;
-
- /* On first open, do netif open, mount, etc. */
- if (open_count == 0) {
- /* Find network interface. */
- if ((netdev_sock = netif_open(devname)) < 0)
- return (error=ENXIO);
- if ((error = net_mountroot(f, devname)) != 0)
- return (error);
- }
- open_count++;
- f->f_devdata = nfs_root_node;
- return (error);
-}
-
-int
-net_close(f)
- struct open_file *f;
-{
- /* On last close, do netif close, etc. */
- if (open_count > 0)
- if (--open_count == 0)
- netif_close(netdev_sock);
- f->f_devdata = NULL;
- return (0);
-}
-
-int
-net_ioctl()
-{
- return EIO;
-}
-
-int
-net_strategy()
-{
- return EIO;
-}
-
-int
-net_mountroot(f, devname)
- struct open_file *f;
- char *devname; /* Device part of file name (or NULL). */
-{
- int error;
-
-#ifdef DEBUG
- printf("net_mountroot: %s\n", devname);
-#endif
-
- /*
- * Get info for NFS boot: our IP address, our hostname,
- * server IP address, and our root path on the server.
- * There are two ways to do this: The old, Sun way,
- * and the more modern, BOOTP way. (RFC951, RFC1048)
- */
-
-#ifdef SUN_BOOTPARAMS
- /* Get boot info using RARP and Sun bootparams. */
-
- /* Get our IP address. (rarp.c) */
- if (rarp_getipaddress(netdev_sock) == -1)
- return (EIO);
- printf("boot: client IP address: %s\n", intoa(myip.s_addr));
-
- /* Get our hostname, server IP address. */
- if (bp_whoami(netdev_sock))
- return (EIO);
- printf("boot: client name: %s\n", hostname);
-
- /* Get the root pathname. */
- if (bp_getfile(netdev_sock, "root", &rootip, rootpath))
- return (EIO);
-
-#else
-
- /* Get boot info using BOOTP way. (RFC951, RFC1048) */
- bootp(netdev_sock);
-
- printf("Using IP address: %s\n", intoa(myip.s_addr));
-
- printf("myip: %s (%s)", hostname, intoa(myip));
- if (gateip)
- printf(", gateip: %s", intoa(gateip));
-#if 0
- if (mask)
- printf(", mask: %s", intoa(mask));
-#endif
- printf("\n");
-
-#endif
-
- printf("root addr=%s path=%s\n", intoa(rootip.s_addr), rootpath);
-
- /* Get the NFS file handle (mount). */
- error = nfs_mount(netdev_sock, rootip, rootpath);
-
- return (error);
-}
diff --git a/sys/arch/mvme88k/stand/netboot/dev_net.h b/sys/arch/mvme88k/stand/netboot/dev_net.h
deleted file mode 100644
index cd7b475a52a..00000000000
--- a/sys/arch/mvme88k/stand/netboot/dev_net.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* $OpenBSD: dev_net.h,v 1.3 2002/03/14 01:26:40 millert Exp $ */
-
-int net_open(struct open_file *, ...);
-int net_close(struct open_file *);
-int net_ioctl();
-int net_strategy();
-
diff --git a/sys/arch/mvme88k/stand/netboot/devices.c b/sys/arch/mvme88k/stand/netboot/devices.c
deleted file mode 100644
index 3646c7405ec..00000000000
--- a/sys/arch/mvme88k/stand/netboot/devices.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/* $OpenBSD: devices.c,v 1.1 2013/05/12 10:43:45 miod Exp $ */
-
-/*
- * Copyright (c) 2013 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/param.h>
-#include <sys/types.h>
-
-#include <netinet/in.h>
-
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-#include "netif.h"
-#include "config.h"
-
-#include "if_lereg.h"
-
-/*
- * For netboot, we only intend to use the interface we have been booted from;
- * although we carry the list of all BUG-recognized Ethernet devices for which
- * we have drivers, we will select the appropriate instance from the BUG
- * arguments.
- */
-
-struct ie_configuration ie_config[] = {
- { .clun = 0x00, .phys_addr = INTEL_REG_ADDR }
-};
-int nie_config = sizeof(ie_config) / sizeof(ie_config[0]);
-
-#define VLE(u,a) \
- { .clun = 0x02 + (u), .phys_addr = (a), \
- .buf_addr = VLEMEMBASE - (u) * VLEMEMSIZE, .buf_size = VLEMEMSIZE }
-struct le_configuration le_config[] = {
- VLE(0, 0xffff1200),
- VLE(1, 0xffff1400),
- VLE(2, 0xffff1600),
- VLE(3, 0xffff5400),
- VLE(4, 0xffff5600),
- VLE(5, 0xffffa400)
-};
-
-int nle_config = sizeof(le_config) / sizeof(le_config[0]);
-
-extern struct netif_driver le_driver;
-extern struct netif_driver ie_driver;
-
-struct netif_driver *netif_drivers[] = {
- &ie_driver,
- &le_driver,
-};
-int n_netif_drivers = sizeof(netif_drivers) / sizeof(netif_drivers[0]);
-
-static struct netif_stats bugif_stats;
-static struct netif_dif bugif_dif = {
- .dif_unit = 0,
- .dif_nsel = 1,
- .dif_stats = &bugif_stats
-};
-
-int
-probe_ethernet()
-{
- int n;
-
- for (n = 0; n < nie_config; n++)
- if (ie_config[n].clun == bugargs.ctrl_lun) {
- bcopy(mvmeprom_brdid()->etheraddr,
- ie_config[n].eaddr, 6);
- ie_driver.netif_nifs = 1;
- ie_driver.netif_ifs = &bugif_dif;
- break;
- }
-
- for (n = 0; n < nle_config; n++)
- if (le_config[n].clun == bugargs.ctrl_lun) {
- le_read_etheraddr(le_config[n].phys_addr,
- le_config[n].eaddr);
- le_driver.netif_nifs = 1;
- le_driver.netif_ifs = &bugif_dif;
- break;
- }
-
- return ie_driver.netif_nifs + le_driver.netif_nifs;
-}
diff --git a/sys/arch/mvme88k/stand/netboot/devopen.c b/sys/arch/mvme88k/stand/netboot/devopen.c
deleted file mode 100644
index 36e38fee4b1..00000000000
--- a/sys/arch/mvme88k/stand/netboot/devopen.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* $OpenBSD: devopen.c,v 1.3 2006/05/16 22:52:09 miod Exp $ */
-
-#include <sys/param.h>
-#include <stand.h>
-
-/*
- * Open the device named by the combined device/file name
- * given as the "fname" arg, something like: "sd()bsd"
- *
- * However, Sun PROMs don't really let you choose which
- * device you will talk to. You can only open the device
- * that was used to load the boot program. Therefore, we
- * do not accept a "device" part in the "fname" string.
- * Pass the PROM device name to open in case it needs it.
- */
-int
-devopen(f, fname, file)
- struct open_file *f;
- const char *fname;
- char **file;
-{
- struct devsw *dp;
- int error;
-
- *file = (char *)fname;
- dp = &devsw[0];
- f->f_dev = dp;
- error = (*dp->dv_open)(f, NULL);
-
- return (error);
-}
diff --git a/sys/arch/mvme88k/stand/netboot/i82586.h b/sys/arch/mvme88k/stand/netboot/i82586.h
deleted file mode 100644
index 6210d97e80f..00000000000
--- a/sys/arch/mvme88k/stand/netboot/i82586.h
+++ /dev/null
@@ -1,306 +0,0 @@
-/* $OpenBSD: i82586.h,v 1.2 1998/08/22 08:37:58 smurph Exp $ */
-
-/*-
- * Copyright (c) 1995 Theo de Raadt
- * Copyright (c) 1992, University of Vermont and State Agricultural College.
- * Copyright (c) 1992, Garrett A. Wollman.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * Vermont and State Agricultural College and Garrett A. Wollman.
- * 4. Neither the name of the University nor the name of the author
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR AUTHOR BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Intel 82586 Ethernet chip
- * Register, bit, and structure definitions.
- *
- * Written by GAW with reference to the Clarkson Packet Driver code for this
- * chip written by Russ Nelson and others.
- */
-
-struct ie_en_addr {
- u_char data[6];
-};
-/*
- * the only actual IE registers.
- */
-struct iereg {
- u_short ie_porthigh;
- u_short ie_portlow;
- u_long ie_attention;
-};
-#define IE_PORT_NEWSCP 0x00000002
-#define IE_PORT_RESET 0x00000000
-
-/*
- * This is the master configuration block. It tells the hardware where
- * all the rest of the stuff is.
- */
-struct ie_scp {
- u_char mbz1[3]; /* must be zero */
- u_char scp_sysbus; /* true if 8-bit only */
- u_char mbz2[4]; /* must be zero */
- u_short scp_iscp_low; /* 24-bit physaddr of ISCP */
- u_char mbz3[1];
- u_char scp_iscp_high; /* the rest of the physaddr.. */
-};
-/*
- * The tells the hardware where all the rest of the stuff is, too.
- * FIXME: some of these should be re-commented after we figure out their
- * REAL function.
- */
-struct ie_iscp {
- u_char mbz1[1];
- u_char iscp_busy; /* zeroed after init */
- u_short iscp_scboffset; /* 16-bit physaddr of next struct */
- u_short iscp_base_low; /* 24-bit physaddr for all 16-bit vars */
- u_char mbz2[1];
- u_char iscp_base_high; /* rest of physaddr ... */
-};
-/*
- * This FINALLY tells the hardware what to do and where to put it.
- */
-struct ie_scb {
- u_short ie_status; /* status word */
- u_short ie_command; /* command word */
- u_short ie_command_list;/* 16-pointer to command block list */
- u_short ie_recv_list; /* 16-pointer to receive frame list */
- u_short ie_err_crc; /* CRC errors */
- u_short ie_err_align; /* Alignment errors */
- u_short ie_err_resource;/* Resource errors */
- u_short ie_err_overrun; /* Overrun errors */
-};
-/* Command values */
-#define IE_RU_COMMAND 0x0070 /* mask for RU command */
-#define IE_RU_NOP 0 /* for completeness */
-#define IE_RU_START 0x0010 /* start receive unit command */
-#define IE_RU_ENABLE 0x0020 /* enable receiver command */
-#define IE_RU_DISABLE 0x0030 /* disable receiver command */
-#define IE_RU_ABORT 0x0040 /* abort current receive operation */
-
-#define IE_CU_COMMAND 0x0700 /* mask for CU command */
-#define IE_CU_NOP 0 /* included for completeness */
-#define IE_CU_START 0x0100 /* do-command command */
-#define IE_CU_RESUME 0x0200 /* resume a suspended cmd list */
-#define IE_CU_STOP 0x0300 /* SUSPEND was already taken */
-#define IE_CU_ABORT 0x0400 /* abort current command */
-
-#define IE_ACK_COMMAND 0xf000 /* mask for ACK command */
-#define IE_ACK_CX 0x8000 /* ack IE_ST_DONE */
-#define IE_ACK_FR 0x4000 /* ack IE_ST_RECV */
-#define IE_ACK_CNA 0x2000 /* ack IE_ST_ALLDONE */
-#define IE_ACK_RNR 0x1000 /* ack IE_ST_RNR */
-
-#define IE_ACTION_COMMAND(x) (((x) & IE_CU_COMMAND) == IE_CU_START)
- /* is this command an action command? */
-
-/* Status values */
-#define IE_ST_WHENCE 0xf000 /* mask for cause of interrupt */
-#define IE_ST_DONE 0x8000 /* command with I bit completed */
-#define IE_ST_RECV 0x4000 /* frame received */
-#define IE_ST_ALLDONE 0x2000 /* all commands completed */
-#define IE_ST_RNR 0x1000 /* receive not ready */
-
-#define IE_CU_STATUS 0x700 /* mask for command unit status */
-#define IE_CU_ACTIVE 0x200 /* command unit is active */
-#define IE_CU_SUSPEND 0x100 /* command unit is suspended */
-
-#define IE_RU_STATUS 0x70 /* mask for receiver unit status */
-#define IE_RU_SUSPEND 0x10 /* receiver is suspended */
-#define IE_RU_NOSPACE 0x20 /* receiver has no resources */
-#define IE_RU_READY 0x40 /* receiver is ready */
-
-/*
- * This is filled in partially by the chip, partially by us.
- */
-struct ie_recv_frame_desc {
- u_short ie_fd_status; /* status for this frame */
- u_short ie_fd_last; /* end of frame list flag */
- u_short ie_fd_next; /* 16-pointer to next RFD */
- u_short ie_fd_buf_desc; /* 16-pointer to list of buffer desc's */
- struct ie_en_addr dest; /* destination ether */
- struct ie_en_addr src; /* source ether */
- u_short ie_length; /* 802 length/Ether type */
- u_short mbz; /* must be zero */
-};
-#define IE_FD_LAST 0x8000 /* last rfd in list */
-#define IE_FD_SUSP 0x4000 /* suspend RU after receipt */
-
-#define IE_FD_COMPLETE 0x8000 /* frame is complete */
-#define IE_FD_BUSY 0x4000 /* frame is busy */
-#define IE_FD_OK 0x2000 /* frame is bad */
-#define IE_FD_RNR 0x0200 /* receiver out of resources here */
-
-/*
- * linked list of buffers...
- */
-struct ie_recv_buf_desc {
- u_short ie_rbd_actual; /* status for this buffer */
- u_short ie_rbd_next; /* 16-pointer to next RBD */
- u_short ie_rbd_buffer_low; /* 24-pointer to buffer for this RBD */
- u_short ie_rbd_buffer_high; /* 24-pointer to buffer for this RBD */
- u_short ie_rbd_length; /* length of the buffer */
- u_short mbz; /* must be zero */
-};
-#define IE_RBD_LAST 0x8000 /* last buffer */
-#define IE_RBD_USED 0x4000 /* this buffer has data */
-/*
- * All commands share this in common.
- */
-struct ie_cmd_common {
- u_short ie_cmd_status; /* status of this command */
- u_short ie_cmd_cmd; /* command word */
- u_short ie_cmd_link; /* link to next command */
-};
-#define IE_STAT_COMPL 0x8000 /* command is completed */
-#define IE_STAT_BUSY 0x4000 /* command is running now */
-#define IE_STAT_OK 0x2000 /* command completed successfully */
-#define IE_STAT_ABORT 0x1000 /* command was aborted */
-
-
-#define IE_CMD_NOP 0x0000 /* NOP */
-#define IE_CMD_IASETUP 0x0001 /* initial address setup */
-#define IE_CMD_CONFIG 0x0002 /* configure command */
-#define IE_CMD_MCAST 0x0003 /* multicast setup command */
-#define IE_CMD_XMIT 0x0004 /* transmit command */
-#define IE_CMD_TDR 0x0005 /* time-domain reflectometer command */
-#define IE_CMD_DUMP 0x0006 /* dump command */
-#define IE_CMD_DIAGNOSE 0x0007 /* diagnostics command */
-
-#define IE_CMD_LAST 0x8000 /* this is the last command in the list */
-#define IE_CMD_SUSPEND 0x4000 /* suspend CU after this command */
-#define IE_CMD_INTR 0x2000 /* post an interrupt after completion */
-
-/*
- * This is the command to transmit a frame.
- */
-struct ie_xmit_cmd {
- struct ie_cmd_common com; /* common part */
-#define ie_xmit_status com.ie_cmd_status
-
- u_short ie_xmit_desc; /* 16-pointer to buffer descriptor */
- struct ie_en_addr ie_xmit_addr; /* destination address */
-
- u_short ie_xmit_length; /* 802.3 length/Ether type field */
-};
-#define IE_XS_MAXCOLL 0x000f /* number of collisions during transmit */
-#define IE_XS_EXCMAX 0x0020 /* exceeded maximum number of collisions */
-#define IE_XS_SQE 0x0040 /* SQE positive */
-#define IE_XS_DEFERRED 0x0080 /* transmission deferred */
-#define IE_XS_UNDERRUN 0x0100 /* DMA underrun */
-#define IE_XS_LOSTCTS 0x0200 /* Lost CTS */
-#define IE_XS_NOCARRIER 0x0400 /* No Carrier */
-
-/*
- * This is a buffer descriptor for a frame to be transmitted.
- */
-
-struct ie_xmit_buf {
- u_short ie_xmit_flags; /* see below */
- u_short ie_xmit_next; /* 16-pointer to next desc. */
- u_short ie_xmit_buf_low;/* 24-pointer to the actual buffer */
- u_short ie_xmit_buf_high; /* 24-pointer to the actual buffer */
-};
-#define IE_XMIT_LAST 0x8000 /* this TBD is the last one */
-/* The rest of the `flags' word is actually the length. */
-
-/*
- * Multicast setup command.
- */
-
-#define MAXMCAST 250 /* must fit in transmit buffer */
-
-struct ie_mcast_cmd {
- struct ie_cmd_common com; /* common part */
-#define ie_mcast_status com.ie_cmd_status
-
- u_short ie_mcast_bytes; /* size (in bytes) of multicast addresses */
- struct ie_en_addr ie_mcast_addrs[MAXMCAST + 1]; /* space for them */
-};
-/*
- * Time Domain Reflectometer command.
- */
-
-struct ie_tdr_cmd {
- struct ie_cmd_common com; /* common part */
-#define ie_tdr_status com.ie_cmd_status
-
- u_short ie_tdr_time; /* error bits and time */
-};
-#define IE_TDR_SUCCESS 0x8000 /* TDR succeeded without error */
-#define IE_TDR_XCVR 0x4000 /* detected a transceiver problem */
-#define IE_TDR_OPEN 0x2000 /* detected an open */
-#define IE_TDR_SHORT 0x1000 /* TDR detected a short */
-#define IE_TDR_TIME 0x07ff /* mask for reflection time */
-
-/*
- * Initial Address Setup command
- */
-struct ie_iasetup_cmd {
- struct ie_cmd_common com;
-#define ie_iasetup_status com.ie_cmd_status
-
- struct ie_en_addr ie_address;
-};
-/*
- * Configuration command
- */
-struct ie_config_cmd {
- struct ie_cmd_common com; /* common part */
-#define ie_config_status com.ie_cmd_status
-
- u_char ie_config_count;/* byte count (0x0c) */
- u_char ie_fifo; /* fifo (8) */
- u_char ie_save_bad; /* save bad frames (0x40) */
- u_char ie_addr_len; /* address length (0x2e) (AL-LOC == 1) */
- u_char ie_priority; /* priority and backoff (0x0) */
- u_char ie_ifs; /* inter-frame spacing (0x60) */
- u_char ie_slot_low; /* slot time, LSB (0x0) */
- u_char ie_slot_high; /* slot time, MSN, and retries (0xf2) */
- u_char ie_promisc; /* 1 if promiscuous, else 0 */
- u_char ie_crs_cdt; /* CSMA/CD parameters (0x0) */
- u_char ie_min_len; /* min frame length (0x40) */
- u_char ie_junk; /* stuff for 82596 (0xff) */
-};
-
-struct iemem {
- volatile struct ie_scp im_scp;
- u_char xx1[4];
- volatile struct ie_iscp im_iscp;
-
- volatile struct ie_scb im_scb;
- volatile struct ie_config_cmd im_cc;
- volatile struct ie_iasetup_cmd im_ic;
- volatile struct ie_recv_frame_desc im_rfd[NRXBUF];
- volatile struct ie_recv_buf_desc im_rbd[NRXBUF];
- volatile struct ie_xmit_cmd im_xc[NTXBUF];
- volatile struct ie_xmit_buf im_xd[NTXBUF];
- volatile u_char im_rxbuf[NRXBUF * IE_RBUF_SIZE];
- volatile u_char im_txbuf[NTXBUF * ETHER_MAX_LEN];
-
-};
diff --git a/sys/arch/mvme88k/stand/netboot/if_ie.c b/sys/arch/mvme88k/stand/netboot/if_ie.c
deleted file mode 100644
index 70816e16fa9..00000000000
--- a/sys/arch/mvme88k/stand/netboot/if_ie.c
+++ /dev/null
@@ -1,433 +0,0 @@
-/* $OpenBSD: if_ie.c,v 1.11 2013/05/12 21:00:56 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/types.h>
-
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-
-#define ETHER_MIN_LEN 64
-#define ETHER_MAX_LEN 1518
-#define ETHER_CRC_LEN 4
-
-#define NTXBUF 1
-#define NRXBUF 16
-#define IE_RBUF_SIZE ETHER_MAX_LEN
-
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-#include "netif.h"
-#include "config.h"
-#include "net.h"
-
-#include "i82586.h"
-
-int ie_debug = 0;
-
-void ie_stop(struct netif *);
-void ie_end(struct netif *);
-int ie_get(struct iodesc *, void *, size_t, time_t);
-void ie_init(struct iodesc *, void *);
-int ie_match(struct netif *, void *);
-int ie_poll(struct iodesc *, void *, int);
-int ie_probe(struct netif *, void *);
-int ie_put(struct iodesc *, void *, size_t);
-void ie_reset(struct netif *, u_char *);
-
-struct netif_driver ie_driver = {
- "ie", /* netif_bname */
- ie_match, /* match */
- ie_probe, /* probe */
- ie_init, /* init */
- ie_get, /* get */
- ie_put, /* put */
- ie_end, /* end */
- NULL, /* netif_ifs - will be filled later */
- 0, /* netif_nifs - will be filled later */
-};
-
-struct {
- struct iereg *sc_reg; /* IE registers */
- struct iemem *sc_mem; /* RAM */
-} ie_softc;
-
-int
-ie_match(struct netif *nif, void *machdep_hint)
-{
- const char *name = machdep_hint;
-
- if (name == NULL) {
- if (ie_config[nif->nif_unit].clun == bugargs.ctrl_lun ||
- (int)bugargs.ctrl_lun < 0)
- return 1;
- } else {
- if (bcmp(ie_driver.netif_bname, name, 2) == 0) {
- if (nif->nif_unit == name[2] - '0')
- return 1;
- }
- }
-
- return 0;
-}
-
-int
-ie_probe(struct netif *nif, void *machdep_hint)
-{
- return 0;
-}
-
-void
-ieack(volatile struct iereg *ier, struct iemem *iem)
-{
- /* ack the `interrupt' */
- iem->im_scb.ie_command = iem->im_scb.ie_status & IE_ST_WHENCE;
- ier->ie_attention = 1; /* chan attention! */
- while (iem->im_scb.ie_command)
- ;
-}
-
-void
-ie_reset(struct netif *nif, u_char *myea)
-{
- volatile struct iereg *ier = ie_softc.sc_reg;
- struct iemem *iem = ie_softc.sc_mem;
- int timo = 10000, i;
- volatile int t;
- u_int a;
-
- if (ie_debug)
- printf("ie%d: ie_reset called\n", nif->nif_unit);
-
- /*printf("ier %x iem %x\n", ier, iem);*/
-
- *(u_char *)0xfff4202a = 0x40;
-
- bzero(iem, sizeof(*iem));
- iem->im_scp.scp_sysbus = 0;
- iem->im_scp.scp_iscp_low = (int) &iem->im_iscp & 0xffff;
- iem->im_scp.scp_iscp_high = (int) &iem->im_iscp >> 16;
-
- iem->im_iscp.iscp_scboffset = (int) &iem->im_scb - (int) iem;
- iem->im_iscp.iscp_busy = 1;
- iem->im_iscp.iscp_base_low = (int) iem & 0xffff;
- iem->im_iscp.iscp_base_high = (int) iem >> 16;
-
- /*
- * completely and utterly unlike what i expected, the
- * "write" order is:
- * 1st: d15-d0 -> high address
- * 2nd: d31-d16 -> low address
- */
-
- /* reset chip */
- a = IE_PORT_RESET;
- ier->ie_porthigh = a & 0xffff;
- t = 0;
- t = 1;
- ier->ie_portlow = a >> 16;
- for (t = timo; t--;)
- ;
-
- /* set new SCP pointer */
- a = (int) &iem->im_scp | IE_PORT_NEWSCP;
- ier->ie_porthigh = a & 0xffff;
- t = 0;
- t = 1;
- ier->ie_portlow = a >> 16;
- for (t = timo; t--;)
- ;
-
- ier->ie_attention = 1; /* chan attention! */
- for (t = timo * 10; t--;)
- ;
-
- /* send CONFIGURE command */
- iem->im_scb.ie_command = IE_CU_START;
- iem->im_scb.ie_command_list = (int) &iem->im_cc - (int) iem;
- iem->im_cc.com.ie_cmd_status = 0;
- iem->im_cc.com.ie_cmd_cmd = IE_CMD_CONFIG | IE_CMD_LAST;
- iem->im_cc.com.ie_cmd_link = 0xffff;
- iem->im_cc.ie_config_count = 0x0c;
- iem->im_cc.ie_fifo = 8;
- iem->im_cc.ie_save_bad = 0x40;
- iem->im_cc.ie_addr_len = 0x2e;
- iem->im_cc.ie_priority = 0;
- iem->im_cc.ie_ifs = 0x60;
- iem->im_cc.ie_slot_low = 0;
- iem->im_cc.ie_slot_high = 0xf2;
- iem->im_cc.ie_promisc = 0;
- iem->im_cc.ie_crs_cdt = 0;
- iem->im_cc.ie_min_len = 64;
- iem->im_cc.ie_junk = 0xff;
-
- ier->ie_attention = 1; /* chan attention! */
- for (t = timo * 10; t--;)
- ;
-
- ieack(ier, iem);
-
- /*printf("ic %x\n", &iem->im_ic);*/
- /* send IASETUP command */
- iem->im_scb.ie_command = IE_CU_START;
- iem->im_scb.ie_command_list = (int) &iem->im_ic - (int) iem;
- iem->im_ic.com.ie_cmd_status = 0;
- iem->im_ic.com.ie_cmd_cmd = IE_CMD_IASETUP | IE_CMD_LAST;
- iem->im_ic.com.ie_cmd_link = 0xffff;
- bcopy(myea, (void *)&iem->im_ic.ie_address, sizeof iem->im_ic.ie_address);
-
- ier->ie_attention = 1; /* chan attention! */
- for (t = timo * 10; t--;)
- ;
-
- ieack(ier, iem);
-
- /* setup buffers */
-
- for (i = 0; i < NRXBUF; i++) {
- iem->im_rfd[i].ie_fd_next = (int) &iem->im_rfd[(i+1) % NRXBUF] -
- (int) iem;
- iem->im_rbd[i].ie_rbd_next = (int) &iem->im_rbd[(i+1) % NRXBUF] -
- (int) iem;
- a = (int) &iem->im_rxbuf[i * IE_RBUF_SIZE];
- iem->im_rbd[i].ie_rbd_buffer_low = a & 0xffff;
- iem->im_rbd[i].ie_rbd_buffer_high = a >> 16;
- iem->im_rbd[i].ie_rbd_length = IE_RBUF_SIZE;
- }
- iem->im_rfd[NRXBUF-1].ie_fd_last |= IE_FD_LAST;
- iem->im_rbd[NRXBUF-1].ie_rbd_length |= IE_RBD_LAST;
- iem->im_rfd[0].ie_fd_buf_desc = (int) &iem->im_rbd[0] - (int) iem;
-
- /*printf("rfd[0] %x rbd[0] %x buf[0] %x\n", &iem->im_rfd, &iem->im_rbd,
- &iem->im_rxbuf);*/
-
- /* send receiver start command */
- iem->im_scb.ie_command = IE_RU_START;
- iem->im_scb.ie_command_list = 0;
- iem->im_scb.ie_recv_list = (int) &iem->im_rfd[0] - (int) iem;
- ier->ie_attention = 1; /* chan attention! */
- while (iem->im_scb.ie_command)
- ;
-
- ieack(ier, iem);
-}
-
-int
-ie_poll(struct iodesc *desc, void *pkt, int len)
-{
- volatile struct iereg *ier = ie_softc.sc_reg;
- struct iemem *iem = ie_softc.sc_mem;
- static int slot;
- int length = 0;
- u_short status;
-
- status = iem->im_rfd[slot].ie_fd_status;
- if (status & IE_FD_BUSY)
- return (0);
-
- /* printf("slot %d: %x\n", slot, status); */
- if ((status & (IE_FD_COMPLETE | IE_FD_OK)) ==
- (IE_FD_COMPLETE | IE_FD_OK)) {
- if (status & IE_FD_OK) {
- length = iem->im_rbd[slot].ie_rbd_actual & 0x3fff;
- if (length > len)
- length = len;
- bcopy((void *)&iem->im_rxbuf[slot * IE_RBUF_SIZE],
- pkt, length);
-
- iem->im_rfd[slot].ie_fd_status = 0;
- iem->im_rfd[slot].ie_fd_last |= IE_FD_LAST;
- iem->im_rfd[(slot+NRXBUF-1)%NRXBUF].ie_fd_last &=
- ~IE_FD_LAST;
- iem->im_rbd[slot].ie_rbd_actual = 0;
- iem->im_rbd[slot].ie_rbd_length |= IE_RBD_LAST;
- iem->im_rbd[(slot+NRXBUF-1)%NRXBUF].ie_rbd_length &=
- ~IE_RBD_LAST;
- /*printf("S%d\n", slot);*/
-
- } else {
- printf("shit\n");
- }
- slot++;
- /* should move descriptor onto end of queue... */
- }
- if ((iem->im_scb.ie_status & IE_RU_READY) == 0) {
- printf("RR\n");
-
- for (slot = 0; slot < NRXBUF; slot++) {
- iem->im_rbd[slot].ie_rbd_length &= ~IE_RBD_LAST;
- iem->im_rfd[slot].ie_fd_last &= ~IE_FD_LAST;
- }
- iem->im_rbd[NRXBUF-1].ie_rbd_length |= IE_RBD_LAST;
- iem->im_rfd[NRXBUF-1].ie_fd_last |= IE_FD_LAST;
-
- iem->im_rfd[0].ie_fd_buf_desc = (int)&iem->im_rbd[0] - (int)iem;
-
- iem->im_scb.ie_command = IE_RU_START;
- iem->im_scb.ie_command_list = 0;
- iem->im_scb.ie_recv_list = (int)&iem->im_rfd[0] - (int)iem;
- ier->ie_attention = 1; /* chan attention! */
- while (iem->im_scb.ie_command)
- ;
- slot = 0;
- }
- slot = slot % NRXBUF;
- return (length);
-}
-
-int
-ie_put(struct iodesc *desc, void *pkt, size_t len)
-{
- volatile struct iereg *ier = ie_softc.sc_reg;
- struct iemem *iem = ie_softc.sc_mem;
- u_char *p = pkt;
- u_int a;
- int xx = 0;
-
- /* send transmit command */
-
- while (iem->im_scb.ie_command)
- ;
-
- /* copy data */
- bcopy(p, (void *)&iem->im_txbuf[xx], len);
-
- if (len < ETHER_MIN_LEN - ETHER_CRC_LEN) {
- bzero((char *)&iem->im_txbuf[xx] + len,
- ETHER_MIN_LEN - ETHER_CRC_LEN - len);
- len = ETHER_MIN_LEN - ETHER_CRC_LEN;
- }
-
- /* build transmit descriptor */
- iem->im_xd[xx].ie_xmit_flags = len | IE_XMIT_LAST;
- iem->im_xd[xx].ie_xmit_next = 0xffff;
- a = (int) &iem->im_txbuf[xx];
- iem->im_xd[xx].ie_xmit_buf_low = a & 0xffff;
- iem->im_xd[xx].ie_xmit_buf_high = a >> 16;
-
- /* transmit command */
- iem->im_xc[xx].com.ie_cmd_status = 0;
- iem->im_xc[xx].com.ie_cmd_cmd = IE_CMD_XMIT | IE_CMD_LAST;
- iem->im_xc[xx].com.ie_cmd_link = 0xffff;
- iem->im_xc[xx].ie_xmit_desc = (int) &iem->im_xd[xx] - (int) iem;
- iem->im_xc[xx].ie_xmit_length = len;
- bcopy(p, (void *)&iem->im_xc[xx].ie_xmit_addr,
- sizeof iem->im_xc[xx].ie_xmit_addr);
-
- iem->im_scb.ie_command = IE_CU_START;
- iem->im_scb.ie_command_list = (int) &iem->im_xc[xx] - (int) iem;
-
- ier->ie_attention = 1; /* chan attention! */
-
- if (ie_debug) {
- printf("ie%d: send %ld to %x:%x:%x:%x:%x:%x\n",
- desc->io_netif->nif_unit, len,
- p[0], p[1], p[2], p[3], p[4], p[5]);
- }
- return (len);
-}
-
-int
-ie_get(struct iodesc *desc, void *pkt, size_t len, time_t timeout)
-{
- time_t t;
- int cc;
-
- t = getsecs();
- cc = 0;
- while (((getsecs() - t) < timeout) && !cc) {
- cc = ie_poll(desc, pkt, len);
- }
- return (cc);
-}
-/*
- * init ie device. return 0 on failure, 1 if ok.
- */
-void
-ie_init(struct iodesc *desc, void *machdep_hint)
-{
- struct netif *nif = desc->io_netif;
-
- if (ie_debug)
- printf("ie%d: ie_init called\n", nif->nif_unit);
- bcopy(ie_config[nif->nif_unit].eaddr, desc->myea, 6);
- bzero(&ie_softc, sizeof(ie_softc));
- ie_softc.sc_reg = (struct iereg *) ie_config[nif->nif_unit].phys_addr;
- /* use 64KB below HEAP as buffers */
- ie_softc.sc_mem = (struct iemem *)(HEAP_START - 0x10000);
- ie_reset(nif, desc->myea);
-#if 0
- printf("device: %s%d attached to %s\n", nif->nif_driver->netif_bname,
- nif->nif_unit, ether_sprintf(desc->myea));
-#endif
- bugargs.ctrl_lun = ie_config[nif->nif_unit].clun;
- bugargs.dev_lun = 0;
- bugargs.ctrl_addr = ie_config[nif->nif_unit].phys_addr;
-}
-
-void
-ie_stop(struct netif *nif)
-{
- volatile struct iereg *ier = ie_softc.sc_reg;
- struct iemem *iem = ie_softc.sc_mem;
- int timo = 10000;
- volatile int t;
- u_int a;
-
- iem->im_iscp.iscp_busy = 1;
- /* reset chip */
- a = IE_PORT_RESET;
- ier->ie_porthigh = a & 0xffff;
- t = 0;
- t = 1;
- ier->ie_portlow = a >> 16;
- for (t = timo; t--;)
- ;
-
- /* reset chip again */
- a = IE_PORT_RESET;
- ier->ie_porthigh = a & 0xffff;
- t = 0;
- t = 1;
- ier->ie_portlow = a >> 16;
- for (t = timo; t--;)
- ;
-
- /*printf("status %x busy %x\n", iem->im_scb.ie_status,
- iem->im_iscp.iscp_busy);*/
-}
-
-void
-ie_end(struct netif *nif)
-{
- if (ie_debug)
- printf("ie%d: ie_end called\n", nif->nif_unit);
-
- ie_stop(nif);
-}
diff --git a/sys/arch/mvme88k/stand/netboot/if_le.c b/sys/arch/mvme88k/stand/netboot/if_le.c
deleted file mode 100644
index c52e85cdd11..00000000000
--- a/sys/arch/mvme88k/stand/netboot/if_le.c
+++ /dev/null
@@ -1,533 +0,0 @@
-/* $OpenBSD: if_le.c,v 1.9 2013/05/12 21:00:56 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1993 Adam Glass
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Adam Glass.
- * 4. The name of the Author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-/*-
- * Copyright (c) 1982, 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)if_le.c 8.2 (Berkeley) 10/30/93
- */
-
-#include <sys/param.h>
-#include <sys/types.h>
-
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-#include "netif.h"
-#include "config.h"
-
-#include "if_lereg.h"
-
-int le_debug = 0;
-
-void le_wrcsr(u_int16_t, u_int16_t);
-u_int16_t le_rdcsr(u_int16_t);
-void le_end(struct netif *);
-void le_error(struct netif *, const char *, u_int16_t);
-int le_get(struct iodesc *, void *, size_t, time_t);
-void le_init(struct iodesc *, void *);
-int le_match(struct netif *, void *);
-int le_poll(struct iodesc *, void *, int);
-int le_probe(struct netif *, void *);
-int le_put(struct iodesc *, void *, size_t);
-void le_reset(struct netif *, u_char *);
-
-struct netif_driver le_driver = {
- "le", /* netif_bname */
- le_match, /* match */
- le_probe, /* probe */
- le_init, /* init */
- le_get, /* get */
- le_put, /* put */
- le_end, /* end */
- NULL, /* netif_ifs - will be filled later */
- 0, /* netif_nifs - will be filled later */
-};
-
-struct {
- struct lereg1 *sc_r1; /* LANCE registers */
- struct vlereg1 *sc_vr1; /* MVME376 registers */
- struct lereg2 *sc_r2; /* RAM */
- int next_rmd;
- int next_tmd;
-} le_softc;
-
-int
-le_match(struct netif *nif, void *machdep_hint)
-{
- const char *name = machdep_hint;
-
- if (name == NULL) {
- if (le_config[nif->nif_unit].clun == bugargs.ctrl_lun ||
- (int)bugargs.ctrl_lun < 0)
- return 1;
- } else {
- if (bcmp(le_driver.netif_bname, name, 2) == 0) {
- if (nif->nif_unit == name[2] - '0')
- return 1;
- }
- }
-
- return 0;
-}
-
-int
-le_probe(struct netif *nif, void *machdep_hint)
-{
- return 0;
-}
-
-void
-le_wrcsr(u_int16_t port, u_int16_t val)
-{
- if (le_softc.sc_r1 != NULL) {
- le_softc.sc_r1->ler1_rap = port;
- le_softc.sc_r1->ler1_rdp = val;
- } else {
- le_softc.sc_vr1->ler1_rap = port;
- le_softc.sc_vr1->ler1_rdp = val;
- }
-}
-
-u_int16_t
-le_rdcsr(u_int16_t port)
-{
- u_int16_t val;
-
- if (le_softc.sc_r1 != NULL) {
- le_softc.sc_r1->ler1_rap = port;
- val = le_softc.sc_r1->ler1_rdp;
- } else {
- le_softc.sc_vr1->ler1_rap = port;
- val = le_softc.sc_vr1->ler1_rdp;
- }
- return (val);
-}
-
-void
-le_error(struct netif *nif, const char *str, u_int16_t stat)
-{
- struct netif_driver *drv = nif->nif_driver;
-
- if (stat & LE_C0_BABL)
- panic("le%d: been babbling, found by '%s'", nif->nif_unit, str);
- if (stat & LE_C0_CERR) {
- drv->netif_ifs[nif->nif_unit].dif_stats->collision_error++;
- le_wrcsr(LE_CSR0, LE_C0_CERR);
- }
- if (stat & LE_C0_MISS) {
- drv->netif_ifs[nif->nif_unit].dif_stats->missed++;
- le_wrcsr(LE_CSR0, LE_C0_MISS);
- }
- if (stat & LE_C0_MERR) {
- panic("le%d: memory error in '%s'", nif->nif_unit, str);
- }
-}
-
-void
-le_reset(struct netif *nif, u_char *myea)
-{
- struct lereg2 *ler2 = le_softc.sc_r2;
- unsigned int a;
- int timo = 100000, i;
- u_int16_t stat;
-
- if (le_debug)
- printf("le%d: le_reset called\n", nif->nif_unit);
-
- if (le_softc.sc_vr1 != NULL) {
- le_softc.sc_vr1->ler1_csr = 0;
- CDELAY;
- le_softc.sc_vr1->ler1_csr = HW_RS | 0x0f;
- }
- le_wrcsr(LE_CSR0, LE_C0_STOP);
-
- bzero(ler2, sizeof(*ler2));
-
- ler2->ler2_mode = LE_MODE_NORMAL;
- ler2->ler2_padr[0] = myea[1];
- ler2->ler2_padr[1] = myea[0];
- ler2->ler2_padr[2] = myea[3];
- ler2->ler2_padr[3] = myea[2];
- ler2->ler2_padr[4] = myea[5];
- ler2->ler2_padr[5] = myea[4];
-
- ler2->ler2_ladrf0 = 0;
- ler2->ler2_ladrf1 = 0;
-
- a = (u_int)ler2->ler2_rmd;
- ler2->ler2_rlen = LE_RLEN | LE_ADDR_HIGH(a);
- ler2->ler2_rdra = LE_ADDR_LOW(a);
-
- a = (u_int)ler2->ler2_tmd;
- ler2->ler2_tlen = LE_TLEN | LE_ADDR_HIGH(a);
- ler2->ler2_tdra = LE_ADDR_LOW(a);
-
- a = (u_int)ler2;
- le_wrcsr(LE_CSR1, LE_ADDR_LOW(a));
- le_wrcsr(LE_CSR2, LE_ADDR_HIGH(a));
-
- for (i = 0; i < LERBUF; i++) {
- a = (u_int)&ler2->ler2_rbuf[i];
- ler2->ler2_rmd[i].rmd0 = LE_ADDR_LOW(a);
- ler2->ler2_rmd[i].rmd1_bits = LE_R1_OWN;
- ler2->ler2_rmd[i].rmd1_hadr = LE_ADDR_HIGH(a);
- ler2->ler2_rmd[i].rmd2 = -LEMTU;
- ler2->ler2_rmd[i].rmd3 = 0;
- }
- for (i = 0; i < LETBUF; i++) {
- a = (u_int)&ler2->ler2_tbuf[i];
- ler2->ler2_tmd[i].tmd0 = LE_ADDR_LOW(a);
- ler2->ler2_tmd[i].tmd1_bits = 0;
- ler2->ler2_tmd[i].tmd1_hadr = LE_ADDR_HIGH(a);
- ler2->ler2_tmd[i].tmd2 = 0;
- ler2->ler2_tmd[i].tmd3 = 0;
- }
-
- le_wrcsr(LE_CSR3, LE_C3_BSWP);
-
- le_wrcsr(LE_CSR0, LE_C0_INIT);
- do {
- stat = le_rdcsr(LE_CSR0);
- if (--timo == 0) {
- printf("le%d: init timeout, stat = 0x%x\n",
- nif->nif_unit, stat);
- break;
- }
- } while ((stat & LE_C0_IDON) == 0);
-
- le_wrcsr(LE_CSR0, LE_C0_IDON);
- le_softc.next_rmd = 0;
- le_softc.next_tmd = 0;
- le_wrcsr(LE_CSR0, LE_C0_STRT);
-}
-
-int
-le_poll(struct iodesc *desc, void *pkt, int len)
-{
- struct netif *nif = desc->io_netif;
- struct lereg2 *ler2 = le_softc.sc_r2;
- unsigned int a;
- int length;
- struct lermd *rmd;
- u_int16_t stat;
-
- stat = le_rdcsr(LE_CSR0);
- if ((stat & LE_C0_RINT) != 0)
- le_wrcsr(LE_CSR0, LE_C0_RINT);
- rmd = &ler2->ler2_rmd[le_softc.next_rmd];
- if (rmd->rmd1_bits & LE_R1_OWN) {
- return (0);
- }
- if (stat & LE_C0_ERR)
- le_error(nif, "le_poll", stat);
- if (rmd->rmd1_bits & LE_R1_ERR) {
- printf("le%d_poll: rmd status 0x%x\n",
- nif->nif_unit, rmd->rmd1_bits);
- length = 0;
- goto cleanup;
- }
- if ((rmd->rmd1_bits & (LE_R1_STP | LE_R1_ENP)) !=
- (LE_R1_STP | LE_R1_ENP))
- panic("le_poll: chained packet");
-
- length = rmd->rmd3;
- if (length >= LEMTU) {
- length = 0;
- panic("csr0 when bad things happen: %x", stat);
- goto cleanup;
- }
- if (!length)
- goto cleanup;
- length -= 4;
- if (length > 0) {
-
- /*
- * if buffer is smaller than the packet truncate it.
- * (is this wise?)
- */
- if (length > len)
- length = len;
-
- bcopy((void *)&ler2->ler2_rbuf[le_softc.next_rmd], pkt, length);
- }
-cleanup:
- a = (u_int)&ler2->ler2_rbuf[le_softc.next_rmd];
- rmd->rmd0 = LE_ADDR_LOW(a);
- rmd->rmd1_hadr = LE_ADDR_HIGH(a);
- rmd->rmd2 = -LEMTU;
- le_softc.next_rmd =
- (le_softc.next_rmd == (LERBUF - 1)) ? 0 : (le_softc.next_rmd + 1);
- rmd->rmd1_bits = LE_R1_OWN;
- return length;
-}
-
-int
-le_put(struct iodesc *desc, void *pkt, size_t len)
-{
- struct netif *nif = desc->io_netif;
- struct netif_driver *drv = nif->nif_driver;
- volatile struct lereg2 *ler2 = le_softc.sc_r2;
- volatile struct letmd *tmd;
- int timo = 100000;
- unsigned int a;
- u_int16_t stat;
-
- stat = le_rdcsr(LE_CSR0);
- if (stat & LE_C0_ERR)
- le_error(nif, "le_put(way before xmit)", stat);
- tmd = &ler2->ler2_tmd[le_softc.next_tmd];
- while (tmd->tmd1_bits & LE_T1_OWN) {
- printf("le%d: output buffer busy\n", nif->nif_unit);
- }
- bcopy(pkt, (void *)ler2->ler2_tbuf[le_softc.next_tmd], len);
- if (len < 64)
- tmd->tmd2 = -64;
- else
- tmd->tmd2 = -len;
- tmd->tmd3 = 0;
- stat = le_rdcsr(LE_CSR0);
- if (stat & LE_C0_ERR)
- le_error(nif, "le_put(before xmit)", stat);
- tmd->tmd1_bits = LE_T1_STP | LE_T1_ENP | LE_T1_OWN;
- a = (u_int)&ler2->ler2_tbuf[le_softc.next_tmd];
- tmd->tmd0 = LE_ADDR_LOW(a);
- tmd->tmd1_hadr = LE_ADDR_HIGH(a);
- le_wrcsr(LE_CSR0, LE_C0_TDMD);
- stat = le_rdcsr(LE_CSR0);
- if (stat & LE_C0_ERR)
- le_error(nif, "le_put(after xmit)", stat);
- do {
- stat = le_rdcsr(LE_CSR0);
- if (--timo == 0) {
- printf("le%d: transmit timeout, stat = 0x%x\n",
- nif->nif_unit, stat);
- if (stat & LE_C0_ERR)
- le_error(nif, "le_put(timeout)", stat);
- break;
- }
- } while ((stat & LE_C0_TINT) == 0);
- le_wrcsr(LE_CSR0, LE_C0_TINT);
- stat = le_rdcsr(LE_CSR0);
- if (stat & LE_C0_ERR) {
- if ((stat &
- (LE_C0_BABL | LE_C0_CERR | LE_C0_MISS | LE_C0_MERR)) !=
- LE_C0_CERR)
- printf("le_put: xmit error, buf %d\n",
- le_softc.next_tmd);
- le_error(nif, "le_put(xmit error)", stat);
- }
- le_softc.next_tmd = 0;
-/* (le_softc.next_tmd == (LETBUF - 1)) ? 0 : le_softc.next_tmd + 1;*/
- if (tmd->tmd1_bits & LE_T1_DEF)
- drv->netif_ifs[nif->nif_unit].dif_stats->deferred++;
- if (tmd->tmd1_bits & LE_T1_ONE)
- drv->netif_ifs[nif->nif_unit].dif_stats->collisions++;
- if (tmd->tmd1_bits & LE_T1_MORE)
- drv->netif_ifs[nif->nif_unit].dif_stats->collisions += 2;
- if (tmd->tmd1_bits & LE_T1_ERR) {
- printf("le%d: transmit error, error = 0x%x\n",
- nif->nif_unit, tmd->tmd3);
- return -1;
- }
- if (le_debug) {
- printf("le%d: le_put() successful: sent %d\n",
- nif->nif_unit, len);
- printf("le%d: le_put(): tmd1_bits: %x tmd3: %x\n",
- nif->nif_unit,
- (unsigned int) tmd->tmd1_bits,
- (unsigned int) tmd->tmd3);
- }
- return len;
-}
-
-int
-le_get(struct iodesc *desc, void *pkt, size_t len, time_t timeout)
-{
- time_t t;
- int cc;
-
- t = getsecs();
- cc = 0;
- while (((getsecs() - t) < timeout) && !cc) {
- cc = le_poll(desc, pkt, len);
- }
- return cc;
-}
-/*
- * init le device. return 0 on failure, 1 if ok.
- */
-void
-le_init(struct iodesc *desc, void *machdep_hint)
-{
- struct netif *nif = desc->io_netif;
-
- if (le_debug)
- printf("le%d: le_init called\n", nif->nif_unit);
- bcopy(le_config[nif->nif_unit].eaddr, desc->myea, 6);
- bzero(&le_softc, sizeof(le_softc));
- /* no on-board le on mvme88k */
- le_softc.sc_r1 = NULL;
- le_softc.sc_vr1 = (struct vlereg1 *)le_config[nif->nif_unit].phys_addr;
- if (le_config[nif->nif_unit].buf_size != 0) {
- le_softc.sc_r2 =
- (struct lereg2 *)le_config[nif->nif_unit].buf_addr;
- } else {
- le_softc.sc_r2 = (struct lereg2 *)(HEAP_START - LEMEMSIZE);
- }
- le_reset(nif, desc->myea);
-#if 0
- printf("device: %s%d attached to %s\n", nif->nif_driver->netif_bname,
- nif->nif_unit, ether_sprintf(desc->myea));
-#endif
- bugargs.ctrl_lun = le_config[nif->nif_unit].clun;
- bugargs.dev_lun = 0;
- bugargs.ctrl_addr = le_config[nif->nif_unit].phys_addr;
-}
-
-void
-le_end(struct netif *nif)
-{
- if (le_debug)
- printf("le%d: le_end called\n", nif->nif_unit);
- le_wrcsr(LE_CSR0, LE_C0_STOP);
-}
-
-void nvram_cmd(struct vlereg1 *, u_char, u_short);
-u_int16_t nvram_read(struct vlereg1 *, u_char);
-
-/* send command to the nvram controller */
-void
-nvram_cmd(struct vlereg1 *reg1, u_char cmd, u_short addr)
-{
- int i;
-
- for (i = 0; i < 8; i++) {
- reg1->ler1_ear = ((cmd | (addr << 1)) >> i);
- CDELAY;
- }
-}
-
-/* read nvram one bit at a time */
-u_int16_t
-nvram_read(struct vlereg1 *reg1, u_char nvram_addr)
-{
- u_short val = 0, mask = 0x04000;
- u_int16_t wbit;
-
- ENABLE_NVRAM(reg1->ler1_csr);
- nvram_cmd(reg1, NVRAM_RCL, 0);
- DISABLE_NVRAM(reg1->ler1_csr);
- CDELAY;
- ENABLE_NVRAM(reg1->ler1_csr);
- nvram_cmd(reg1, NVRAM_READ, nvram_addr);
- for (wbit = 0; wbit < 15; wbit++) {
- if (reg1->ler1_ear & 0x01)
- val |= mask;
- else
- val &= ~mask;
- mask = mask >> 1;
- CDELAY;
- }
- if (reg1->ler1_ear & 0x01)
- val |= 0x8000;
- else
- val &= 0x7fff;
- CDELAY;
- DISABLE_NVRAM(reg1->ler1_csr);
- return (val);
-}
-
-void
-le_read_etheraddr(u_int phys_addr, u_char *enaddr)
-{
- struct vlereg1 *reg1 = (struct vlereg1 *)phys_addr;
- u_int16_t ival[3];
- int i;
-
- for (i = 0; i < 3; i++) {
- ival[i] = nvram_read(reg1, i);
- }
- memcpy(enaddr, &ival[0], 6);
-}
diff --git a/sys/arch/mvme88k/stand/netboot/if_lereg.h b/sys/arch/mvme88k/stand/netboot/if_lereg.h
deleted file mode 100644
index c624c123e0e..00000000000
--- a/sys/arch/mvme88k/stand/netboot/if_lereg.h
+++ /dev/null
@@ -1,206 +0,0 @@
-/* $OpenBSD: if_lereg.h,v 1.6 2013/05/12 10:43:45 miod Exp $ */
-
-/*-
- * Copyright (c) 1982, 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)if_lereg.h 8.2 (Berkeley) 10/30/93
- */
-
-#define LEMTU 1518
-#define LEMINSIZE 60 /* should be 64 if mode DTCR is set */
-#define LERBUF 8
-#define LERBUFLOG2 3
-#define LE_RLEN (LERBUFLOG2 << 13)
-#define LETBUF 1
-#define LETBUFLOG2 0
-#define LE_TLEN (LETBUFLOG2 << 13)
-
-#define LEMEMSIZE 0x4000 /* memory needed to fulfill above settings */
-
-/* Local Area Network Controller for Ethernet (LANCE) registers */
-struct lereg1 {
- volatile u_int16_t ler1_rdp; /* data port */
- volatile u_int16_t ler1_rap; /* address port */
-};
-
-/* register addresses */
-#define LE_CSR0 0 /* Control and status register */
-#define LE_CSR1 1 /* low address of init block */
-#define LE_CSR2 2 /* high address of init block */
-#define LE_CSR3 3 /* Bus master and control */
-
-/* Control and status register 0 (csr0) */
-#define LE_C0_ERR 0x8000 /* error summary */
-#define LE_C0_BABL 0x4000 /* transmitter timeout error */
-#define LE_C0_CERR 0x2000 /* collision */
-#define LE_C0_MISS 0x1000 /* missed a packet */
-#define LE_C0_MERR 0x0800 /* memory error */
-#define LE_C0_RINT 0x0400 /* receiver interrupt */
-#define LE_C0_TINT 0x0200 /* transmitter interrupt */
-#define LE_C0_IDON 0x0100 /* initialization done */
-#define LE_C0_INTR 0x0080 /* interrupt condition */
-#define LE_C0_INEA 0x0040 /* interrupt enable */
-#define LE_C0_RXON 0x0020 /* receiver on */
-#define LE_C0_TXON 0x0010 /* transmitter on */
-#define LE_C0_TDMD 0x0008 /* transmit demand */
-#define LE_C0_STOP 0x0004 /* disable all external activity */
-#define LE_C0_STRT 0x0002 /* enable external activity */
-#define LE_C0_INIT 0x0001 /* begin initialization */
-
-#define LE_C0_BITS \
- "\20\20ERR\17BABL\16CERR\15MISS\14MERR\13RINT\
-\12TINT\11IDON\10INTR\07INEA\06RXON\05TXON\04TDMD\03STOP\02STRT\01INIT"
-
-/* Control and status register 3 (csr3) */
-#define LE_C3_BSWP 0x4 /* byte swap */
-#define LE_C3_ACON 0x2 /* ALE control, eh? */
-#define LE_C3_BCON 0x1 /* byte control */
-/*
- * Current size is 13,758 bytes with 8 x 1518 receive buffers and
- * 1 x 1518 transmit buffer.
- */
-struct lereg2 {
- /* initialization block */
- volatile u_short ler2_mode; /* mode */
- volatile u_char ler2_padr[6]; /* physical address */
-#ifdef new_code
- volatile u_short ler2_ladrf[4]; /* logical address filter */
-#else
- volatile u_long ler2_ladrf0; /* logical address filter */
- volatile u_long ler2_ladrf1; /* logical address filter */
-#endif
- volatile u_short ler2_rdra; /* receive descriptor addr */
- volatile u_short ler2_rlen; /* rda high and ring size */
- volatile u_short ler2_tdra; /* transmit descriptor addr */
- volatile u_short ler2_tlen; /* tda high and ring size */
- /* receive message descriptors. bits/hadr are byte order dependent. */
- struct lermd {
- volatile u_short rmd0; /* low address of packet */
- volatile u_char rmd1_bits; /* descriptor bits */
- volatile u_char rmd1_hadr; /* high address of packet */
- volatile short rmd2; /* buffer byte count */
- volatile u_short rmd3; /* message byte count */
- } ler2_rmd[LERBUF];
- /* transmit message descriptors */
- struct letmd {
- volatile u_short tmd0; /* low address of packet */
- volatile u_char tmd1_bits; /* descriptor bits */
- volatile u_char tmd1_hadr; /* high address of packet */
- volatile short tmd2; /* buffer byte count */
- volatile u_short tmd3; /* transmit error bits */
- } ler2_tmd[LETBUF];
- volatile char ler2_rbuf[LERBUF][LEMTU];
- volatile char ler2_tbuf[LETBUF][LEMTU];
-};
-/* Initialzation block (mode) */
-#define LE_MODE_PROM 0x8000 /* promiscuous mode */
-/* 0x7f80 reserved, must be zero */
-#define LE_MODE_INTL 0x0040 /* internal loopback */
-#define LE_MODE_DRTY 0x0020 /* disable retry */
-#define LE_MODE_COLL 0x0010 /* force a collision */
-#define LE_MODE_DTCR 0x0008 /* disable transmit CRC */
-#define LE_MODE_LOOP 0x0004 /* loopback mode */
-#define LE_MODE_DTX 0x0002 /* disable transmitter */
-#define LE_MODE_DRX 0x0001 /* disable receiver */
-#define LE_MODE_NORMAL 0 /* none of the above */
-
-
-/* Receive message descriptor 1 (rmd1_bits) */
-#define LE_R1_OWN 0x80 /* LANCE owns the packet */
-#define LE_R1_ERR 0x40 /* error summary */
-#define LE_R1_FRAM 0x20 /* framing error */
-#define LE_R1_OFLO 0x10 /* overflow error */
-#define LE_R1_CRC 0x08 /* CRC error */
-#define LE_R1_BUFF 0x04 /* buffer error */
-#define LE_R1_STP 0x02 /* start of packet */
-#define LE_R1_ENP 0x01 /* end of packet */
-
-#define LE_R1_BITS \
- "\20\10OWN\7ERR\6FRAM\5OFLO\4CRC\3BUFF\2STP\1ENP"
-
-/* Transmit message descriptor 1 (tmd1_bits) */
-#define LE_T1_OWN 0x80 /* LANCE owns the packet */
-#define LE_T1_ERR 0x40 /* error summary */
-#define LE_T1_MORE 0x10 /* multiple collisions */
-#define LE_T1_ONE 0x08 /* single collision */
-#define LE_T1_DEF 0x04 /* defferred transmit */
-#define LE_T1_STP 0x02 /* start of packet */
-#define LE_T1_ENP 0x01 /* end of packet */
-
-#define LE_T1_BITS \
- "\20\10OWN\7ERR\6RES\5MORE\4ONE\3DEF\2STP\1ENP"
-
-/* Transmit message descriptor 3 (tmd3) */
-#define LE_T3_BUFF 0x8000 /* buffer error */
-#define LE_T3_UFLO 0x4000 /* underflow error */
-#define LE_T3_LCOL 0x1000 /* late collision */
-#define LE_T3_LCAR 0x0800 /* loss of carrier */
-#define LE_T3_RTRY 0x0400 /* retry error */
-#define LE_T3_TDR_MASK 0x03ff /* time domain reflectometry counter */
-
-#define LE_XMD2_ONES 0xf000
-
-#define LE_T3_BITS \
- "\20\20BUFF\17UFLO\16RES\15LCOL\14LCAR\13RTRY"
-
-#define LE_ADDR_LOW(x) ((x) & 0xffff)
-#define LE_ADDR_HIGH(x) (((x) >> 16) & 0x00ff)
-
-#define VLEMEMSIZE 0x00040000
-#define VLEMEMBASE 0xfd6c0000
-
-/*
- * LANCE registers for MVME376
- */
-struct vlereg1 {
- volatile u_int16_t ler1_csr; /* board control/status register */
- volatile u_int16_t ler1_vec; /* interrupt vector register */
- volatile u_int16_t ler1_rdp; /* data port */
- volatile u_int16_t ler1_rap; /* register select port */
- volatile u_int16_t ler1_ear; /* ethernet address register */
-};
-
-#define NVRAM_EN 0x0008 /* NVRAM enable bit (active low) */
-#define INTR_EN 0x0010 /* interrupt enable bit (active low) */
-#define PARITYB 0x0020 /* parity error clear bit */
-#define HW_RS 0x0040 /* hardware reset bit (active low) */
-#define SYSFAILB 0x0080 /* SYSFAIL bit */
-
-#define NVRAM_RWEL 0xe0 /* Reset write enable latch */
-#define NVRAM_STO 0x60 /* Store ram to eeprom */
-#define NVRAM_SLP 0xa0 /* Novram into low power mode */
-#define NVRAM_WRITE 0x20 /* Writes word from location x */
-#define NVRAM_SWEL 0xc0 /* Set write enable latch */
-#define NVRAM_RCL 0x40 /* Recall eeprom data into ram */
-#define NVRAM_READ 0x00 /* Reads word from location x */
-
-#define CDELAY mvmeprom_delay(10)
-#define ENABLE_NVRAM(csr) (csr) = (HW_RS | 0x0f) & ~(NVRAM_EN)
-#define DISABLE_NVRAM(csr) (csr) = (HW_RS | 0x0f) | (NVRAM_EN)
-
-void le_read_etheraddr(u_int, u_char *);
diff --git a/sys/arch/mvme88k/stand/netboot/netif.c b/sys/arch/mvme88k/stand/netboot/netif.c
deleted file mode 100644
index f53aacae987..00000000000
--- a/sys/arch/mvme88k/stand/netboot/netif.c
+++ /dev/null
@@ -1,299 +0,0 @@
-/* $OpenBSD: netif.c,v 1.1 2013/05/12 10:43:45 miod Exp $ */
-/* $NetBSD: netif.c,v 1.7 1996/10/13 02:29:03 christos Exp $ */
-
-/*
- * This is a copy of sys/lib/libsa/netif.c, with the `used' and `sel'
- * gets-in-the-way-of-getting-things-done logic removed, and nif_select()
- * returning an error instead of panicing if it can't find a proper
- * interface.
- */
-
-/*
- * Copyright (c) 1993 Adam Glass
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Adam Glass.
- * 4. The name of the Author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/mount.h>
-
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-
-#include "stand.h"
-#include "net.h"
-#include "netif.h"
-
-struct iodesc sockets[SOPEN_MAX];
-#ifdef NETIF_DEBUG
-int netif_debug = 0;
-#endif
-
-/*
- * netif_init:
- *
- * initialize the generic network interface layer
- */
-
-void
-netif_init(void)
-{
-#ifdef NETIF_DEBUG
- if (netif_debug)
- printf("netif_init: called\n");
-#endif
-}
-
-static int
-netif_match(struct netif *nif, void *machdep_hint)
-{
- struct netif_driver *drv = nif->nif_driver;
-
-#if 0
- if (netif_debug)
- printf("%s%d: netif_match\n", drv->netif_bname, nif->nif_unit);
-#endif
- return drv->netif_match(nif, machdep_hint);
-}
-
-struct netif *
-netif_select(void *machdep_hint)
-{
- int d, u, unit_done;
- struct netif_driver *drv;
- struct netif cur_if;
- static struct netif best_if;
- int best_val;
- int val;
-
- best_val = 0;
- best_if.nif_driver = NULL;
-
-#ifdef NETIF_DEBUG
- if (netif_debug)
- printf("netif_select: %d interfaces\n", n_netif_drivers);
-#endif
-
- for (d = 0; d < n_netif_drivers; d++) {
- cur_if.nif_driver = netif_drivers[d];
- drv = cur_if.nif_driver;
-
- for (u = 0; u < drv->netif_nifs; u++) {
- cur_if.nif_unit = u;
- unit_done = 0;
-
-#ifdef NETIF_DEBUG
- if (netif_debug)
- printf("\t%s%d:", drv->netif_bname,
- cur_if.nif_unit);
-#endif
-
- val = netif_match(&cur_if, machdep_hint);
-#ifdef NETIF_DEBUG
- if (netif_debug)
- printf(" %d\n", val);
-#endif
- if (val > best_val) {
- best_val = val;
- best_if = cur_if;
- }
- }
- }
-
- if (best_if.nif_driver == NULL)
- return NULL;
-
-#ifdef NETIF_DEBUG
- if (netif_debug)
- printf("netif_select: %s%d wins\n",
- best_if.nif_driver->netif_bname,
- best_if.nif_unit);
-#endif
- return &best_if;
-}
-
-int
-netif_probe(struct netif *nif, void *machdep_hint)
-{
- struct netif_driver *drv = nif->nif_driver;
-
-#ifdef NETIF_DEBUG
- if (netif_debug)
- printf("%s%d: netif_probe\n", drv->netif_bname, nif->nif_unit);
-#endif
- return drv->netif_probe(nif, machdep_hint);
-}
-
-void
-netif_attach(struct netif *nif, struct iodesc *desc, void *machdep_hint)
-{
- struct netif_driver *drv = nif->nif_driver;
-
-#ifdef NETIF_DEBUG
- if (netif_debug)
- printf("%s%d: netif_attach\n", drv->netif_bname, nif->nif_unit);
-#endif
- desc->io_netif = nif;
-#ifdef PARANOID
- if (drv->netif_init == NULL)
- panic("%s%d: no netif_init support", drv->netif_bname,
- nif->nif_unit);
-#endif
- drv->netif_init(desc, machdep_hint);
- bzero(drv->netif_ifs[nif->nif_unit].dif_stats,
- sizeof(struct netif_stats));
-}
-
-void
-netif_detach(struct netif *nif)
-{
- struct netif_driver *drv = nif->nif_driver;
-
-#ifdef NETIF_DEBUG
- if (netif_debug)
- printf("%s%d: netif_detach\n", drv->netif_bname, nif->nif_unit);
-#endif
-#ifdef PARANOID
- if (drv->netif_end == NULL)
- panic("%s%d: no netif_end support", drv->netif_bname,
- nif->nif_unit);
-#endif
- drv->netif_end(nif);
-}
-
-ssize_t
-netif_get(struct iodesc *desc, void *pkt, size_t len, time_t timo)
-{
-#ifdef NETIF_DEBUG
- struct netif *nif = desc->io_netif;
-#endif
- struct netif_driver *drv = desc->io_netif->nif_driver;
- ssize_t rv;
-
-#ifdef NETIF_DEBUG
- if (netif_debug)
- printf("%s%d: netif_get\n", drv->netif_bname, nif->nif_unit);
-#endif
-#ifdef PARANOID
- if (drv->netif_get == NULL)
- panic("%s%d: no netif_get support", drv->netif_bname,
- nif->nif_unit);
-#endif
- rv = drv->netif_get(desc, pkt, len, timo);
-#ifdef NETIF_DEBUG
- if (netif_debug)
- printf("%s%d: netif_get returning %d\n", drv->netif_bname,
- nif->nif_unit, rv);
-#endif
- return rv;
-}
-
-ssize_t
-netif_put(struct iodesc *desc, void *pkt, size_t len)
-{
-#ifdef NETIF_DEBUG
- struct netif *nif = desc->io_netif;
-#endif
- struct netif_driver *drv = desc->io_netif->nif_driver;
- ssize_t rv;
-
-#ifdef NETIF_DEBUG
- if (netif_debug)
- printf("%s%d: netif_put\n", drv->netif_bname, nif->nif_unit);
-#endif
-#ifdef PARANOID
- if (drv->netif_put == NULL)
- panic("%s%d: no netif_put support", drv->netif_bname,
- nif->nif_unit);
-#endif
- rv = drv->netif_put(desc, pkt, len);
-#ifdef NETIF_DEBUG
- if (netif_debug)
- printf("%s%d: netif_put returning %d\n", drv->netif_bname,
- nif->nif_unit, rv);
-#endif
- return rv;
-}
-
-struct iodesc *
-socktodesc(sock)
- int sock;
-{
- if (sock >= SOPEN_MAX) {
- errno = EBADF;
- return (NULL);
- }
- return (&sockets[sock]);
-}
-
-int
-netif_open(void *machdep_hint)
-{
- int fd;
- struct iodesc *s;
- struct netif *nif;
-
- /* find a free socket */
- for (fd = 0, s = sockets; fd < SOPEN_MAX; fd++, s++)
- if (s->io_netif == (struct netif *)0)
- goto fnd;
- errno = EMFILE;
- return (-1);
-
-fnd:
- bzero(s, sizeof(*s));
- netif_init();
- nif = netif_select(machdep_hint);
- if (!nif) {
- errno = ENXIO;
- return (-1);
- }
- if (netif_probe(nif, machdep_hint)) {
- printf("netboot: couldn't probe %s%d\n",
- nif->nif_driver->netif_bname, nif->nif_unit);
- errno = EINVAL;
- return(-1);
- }
- netif_attach(nif, s, machdep_hint);
-
- return(fd);
-}
-
-int
-netif_close(int sock)
-{
- if (sock >= SOPEN_MAX) {
- errno = EBADF;
- return(-1);
- }
- netif_detach(sockets[sock].io_netif);
- sockets[sock].io_netif = (struct netif *)0;
-
- return(0);
-}
diff --git a/sys/arch/mvme88k/stand/netboot/version.c b/sys/arch/mvme88k/stand/netboot/version.c
deleted file mode 100644
index 329ae45af81..00000000000
--- a/sys/arch/mvme88k/stand/netboot/version.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/* $OpenBSD: version.c,v 1.10 2013/05/12 10:43:45 miod Exp $ */
-
-/*
- * 1.10 MVME376 support
- * 1.9 ELF toolchain
- * 1.8 compiled with gcc 3.3.5
- * 1.7 allocation area changed to fix netboot buffers overwriting stack
- * 1.6 perform MVME197 busswitch initialization
- * 1.5 rewritten crt code, self-relocatable
- * 1.4 kernel loaded with loadfile, a.out and ELF formats
- * 1.3 rewritten startup code and general cleanup
- */
-const char *version = "1.10";
diff --git a/sys/arch/mvme88k/stand/prtvid/Makefile b/sys/arch/mvme88k/stand/prtvid/Makefile
deleted file mode 100644
index cc586e89c83..00000000000
--- a/sys/arch/mvme88k/stand/prtvid/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# $OpenBSD: Makefile,v 1.4 2012/08/21 14:46:19 pascal Exp $
-PROG= prtvid
-NOMAN=
-NOPIE=
-
-install:
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/mvme88k/stand/prtvid/prtvid.c b/sys/arch/mvme88k/stand/prtvid/prtvid.c
deleted file mode 100644
index 065d278a411..00000000000
--- a/sys/arch/mvme88k/stand/prtvid/prtvid.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/* $OpenBSD: prtvid.c,v 1.5 2006/05/18 06:11:15 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Dale Rahn <drahn@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "vid.h"
-
-void swabcfg(struct cfg *);
-void swabvid(struct vid *);
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- struct vid *pvid;
- struct cfg *pcfg;
-
- pvid = (struct vid *) malloc(sizeof (struct vid));
-
- fread(pvid, sizeof(struct vid), 1, stdin);
-
- if (BYTE_ORDER != BIG_ENDIAN)
- swabvid(pvid);
-
- printf("vid_id %s %lx\n", pvid->vid_id,
- (char *)&(pvid->vid_id[4]) - (char *)pvid);
- printf("vid_oss %x %lx\n", pvid->vid_oss,
- (char *)&(pvid->vid_oss) - (char *)pvid);
- printf("vid_osl %x %lx\n", pvid->vid_osl,
- (char *)&(pvid->vid_osl) - (char *)pvid);
- printf("vid_osa_u %x %lx\n", pvid->vid_osa_u,
- (char *)&(pvid->vid_osa_u) - (char *)pvid);
- printf("vid_osa_l %x %lx\n", pvid->vid_osa_l,
- (char *)&(pvid->vid_osa_l) - (char *)pvid);
- printf("vid_vd %s %lx\n", pvid->vid_vd,
- (char *)&(pvid->vid_vd) - (char *)pvid);
- printf("vid_cas %x %lx\n", pvid->vid_cas,
- (char *)&(pvid->vid_cas) - (char *)pvid);
- printf("vid_cal %x %lx\n", pvid->vid_cal,
- (char *)&(pvid->vid_cal) - (char *)pvid);
- printf("vid_moto %s %lx\n", pvid->vid_mot,
- (char *)&(pvid->vid_mot[0]) - (char *)pvid);
-
- free(pvid);
-
- pcfg = (struct cfg *) malloc(sizeof(struct cfg));
-
- fread(pcfg, sizeof(struct cfg), 1, stdin);
-
- if (BYTE_ORDER != BIG_ENDIAN)
- swabcfg(pcfg);
-
- printf("cfg_atm %x %lx\n", pcfg->cfg_atm,
- (char *)&(pcfg->cfg_atm) - (char *)(pcfg));
- printf("cfg_prm %x %lx\n", pcfg->cfg_prm,
- (char *)&(pcfg->cfg_prm) - (char *)(pcfg));
- printf("cfg_atw %x %lx\n", pcfg->cfg_atw,
- (char *)&(pcfg->cfg_atw) - (char *)(pcfg));
- printf("cfg_rec %x %lx\n",(int)pcfg->cfg_rec,
- (char *)&(pcfg->cfg_rec) - (char *)(pcfg));
- printf("cfg_spt %x %lx\n", pcfg->cfg_spt,
- (char *)&(pcfg->cfg_spt) - (char *)(pcfg));
- printf("cfg_hds %x %lx\n", pcfg->cfg_hds,
- (char *)&(pcfg->cfg_hds) - (char *)(pcfg));
- printf("cfg_trk %x %lx\n", pcfg->cfg_trk,
- (char *)&(pcfg->cfg_trk) - (char *)(pcfg));
- printf("cfg_ilv %x %lx\n", pcfg->cfg_ilv,
- (char *)&(pcfg->cfg_ilv) - (char *)(pcfg));
- printf("cfg_sof %x %lx\n", pcfg->cfg_sof,
- (char *)&(pcfg->cfg_sof) - (char *)(pcfg));
- printf("cfg_psm %x %lx\n", pcfg->cfg_psm,
- (char *)&(pcfg->cfg_psm) - (char *)(pcfg));
- printf("cfg_shd %x %lx\n", pcfg->cfg_shd,
- (char *)&(pcfg->cfg_shd) - (char *)(pcfg));
- printf("cfg_pcom %x %lx\n", pcfg->cfg_pcom,
- (char *)&(pcfg->cfg_pcom) - (char *)(pcfg));
- printf("cfg_ssr %x %lx\n", pcfg->cfg_ssr,
- (char *)&(pcfg->cfg_ssr) - (char *)(pcfg));
- printf("cfg_rwcc %x %lx\n", pcfg->cfg_rwcc,
- (char *)&(pcfg->cfg_rwcc) - (char *)(pcfg));
- printf("cfg_ecc %x %lx\n", pcfg->cfg_ecc,
- (char *)&(pcfg->cfg_ecc) - (char *)(pcfg));
- printf("cfg_eatm %x %lx\n", pcfg->cfg_eatm,
- (char *)&(pcfg->cfg_eatm) - (char *)(pcfg));
- printf("cfg_eprm %x %lx\n", pcfg->cfg_eprm,
- (char *)&(pcfg->cfg_eprm) - (char *)(pcfg));
- printf("cfg_eatw %x %lx\n", pcfg->cfg_eatw,
- (char *)&(pcfg->cfg_eatw) - (char *)(pcfg));
- printf("cfg_gpb1 %x %lx\n", pcfg->cfg_gpb1,
- (char *)&(pcfg->cfg_gpb1) - (char *)(pcfg));
- printf("cfg_gpb2 %x %lx\n", pcfg->cfg_gpb2,
- (char *)&(pcfg->cfg_gpb2) - (char *)(pcfg));
- printf("cfg_gpb3 %x %lx\n", pcfg->cfg_gpb3,
- (char *)&(pcfg->cfg_gpb3) - (char *)(pcfg));
- printf("cfg_gpb4 %x %lx\n", pcfg->cfg_gpb4,
- (char *)&(pcfg->cfg_gpb4) - (char *)(pcfg));
- printf("cfg_ssc %x %lx\n", pcfg->cfg_ssc,
- (char *)&(pcfg->cfg_ssc) - (char *)(pcfg));
- printf("cfg_runit %x %lx\n", pcfg->cfg_runit,
- (char *)&(pcfg->cfg_runit) - (char *)(pcfg));
- printf("cfg_rsvc1 %x %lx\n", pcfg->cfg_rsvc1,
- (char *)&(pcfg->cfg_rsvc1) - (char *)(pcfg));
- printf("cfg_rsvc2 %x %lx\n", pcfg->cfg_rsvc2,
- (char *)&(pcfg->cfg_rsvc2) - (char *)(pcfg));
-
- return (0);
-}
-
-void
-swabvid(pvid)
- struct vid *pvid;
-{
- swap32(pvid->vid_oss);
- swap16(pvid->vid_osl);
- swap16(pvid->vid_osa_u);
- swap16(pvid->vid_osa_l);
- swap32(pvid->vid_cas);
-}
-
-void
-swabcfg(pcfg)
- struct cfg *pcfg;
-{
- printf("swapping cfg\n");
-
- swap16(pcfg->cfg_atm);
- swap16(pcfg->cfg_prm);
- swap16(pcfg->cfg_atm);
- swap16(pcfg->cfg_rec);
- swap16(pcfg->cfg_trk);
- swap16(pcfg->cfg_psm);
- swap16(pcfg->cfg_shd);
- swap16(pcfg->cfg_pcom);
- swap16(pcfg->cfg_rwcc);
- swap16(pcfg->cfg_ecc);
- swap16(pcfg->cfg_eatm);
- swap16(pcfg->cfg_eprm);
- swap16(pcfg->cfg_eatw);
- swap16(pcfg->cfg_rsvc1);
- swap16(pcfg->cfg_rsvc2);
-}
diff --git a/sys/arch/mvme88k/stand/prtvid/vid.h b/sys/arch/mvme88k/stand/prtvid/vid.h
deleted file mode 100644
index 2695805766f..00000000000
--- a/sys/arch/mvme88k/stand/prtvid/vid.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* $OpenBSD: vid.h,v 1.1 2006/05/18 06:10:07 miod Exp $ */
-
-#ifndef __MACHINE_VID_H__
-#define __MACHINE_VID_H__
-
-#define START_BLOCK 1
-#define LOADER_SIZE 2
-#define LOADER_ADDRESS 0x1F0000
-
-#ifndef _LOCORE
-struct vid {
- unsigned char vid_id[4];
- unsigned char vid_0[16];
- unsigned int vid_oss;
- unsigned short vid_osl;
- unsigned char vid_1[4];
- unsigned short vid_osa_u;
- unsigned short vid_osa_l;
- unsigned char vid_2[4];
- unsigned char vid_vd[20];
- unsigned char vid_3[86];
- unsigned int vid_cas;
- unsigned char vid_cal;
- unsigned char vid_4[99];
- unsigned char vid_mot[8];
-};
-struct cfg {
-
- unsigned char cfg_0[4];
- unsigned short cfg_atm;
- unsigned short cfg_prm;
- unsigned short cfg_atw;
- unsigned short cfg_rec;
- unsigned char cfg_1[12];
- unsigned char cfg_spt;
- unsigned char cfg_hds;
- unsigned short cfg_trk;
- unsigned char cfg_ilv;
- unsigned char cfg_sof;
- unsigned short cfg_psm;
- unsigned short cfg_shd;
- unsigned char cfg_2[2];
- unsigned short cfg_pcom;
- unsigned char cfg_3;
- unsigned char cfg_ssr;
- unsigned short cfg_rwcc;
- unsigned short cfg_ecc;
- unsigned short cfg_eatm;
- unsigned short cfg_eprm;
- unsigned short cfg_eatw;
- unsigned char cfg_gpb1;
- unsigned char cfg_gpb2;
- unsigned char cfg_gpb3;
- unsigned char cfg_gpb4;
- unsigned char cfg_ssc;
- unsigned char cfg_runit;
- unsigned short cfg_rsvc1;
- unsigned short cfg_rsvc2;
- unsigned char cfg_4[196];
-};
-#endif
-#endif /* __MACHINE_VID_H__ */
diff --git a/sys/arch/mvme88k/stand/sboot/Makefile b/sys/arch/mvme88k/stand/sboot/Makefile
deleted file mode 100644
index 466ced86e6a..00000000000
--- a/sys/arch/mvme88k/stand/sboot/Makefile
+++ /dev/null
@@ -1,43 +0,0 @@
-# $OpenBSD: Makefile,v 1.8 2013/05/12 10:43:45 miod Exp $
-
-S= ${.CURDIR}/../../../..
-DEFS= -DSUN_BOOTPARAMS -D_STANDALONE
-INCPATH=-I${.CURDIR} -I${.CURDIR}/../libsa -I${.CURDIR}/../libbug \
- -I${S} -I${S}/lib/libsa -I${.CURDIR}/../netboot
-CFLAGS+=${DEFS} ${INCPATH} ${COPTS}
-
-.include "${S}/arch/mvme88k/stand/bugcrt/Makefile.inc"
-.include "${S}/arch/mvme88k/stand/libbug/Makefile.inc"
-.include "${S}/arch/mvme88k/stand/libsa/Makefile.inc"
-.include "${S}/arch/mvme88k/stand/libz/Makefile.inc"
-
-OBJCOPY?= objcopy
-
-SRCS= sboot.c devices.c devopen.c version.c
-
-.PATH: ${S}/arch/mvme88k/stand/netboot
-
-SRCS+= conf.c dev_net.c netif.c
-SRCS+= if_ie.c
-SRCS+= if_le.c
-
-OBJS= ${SRCS:S/.c/.o/g}
-LIBS= ${LIBSA} ${LIBBUG} ${LIBZ}
-LDFLAGS= -N -T ${S}/arch/mvme88k/stand/ld.script -Ttext ${STAGE1_RELOC}
-LDFLAGS+= -warn-common
-NOPIE=
-
-CLEANFILES+=sboot.tmp sboot
-
-all: sboot
-
-sboot: ${SREC_CRT} ${OBJS} ${LIBS}
- ${LD} ${LDFLAGS} -Ttext ${STAGE1_RELOC} ${SREC_CRT} ${OBJS} -o $@.tmp \
- ${LIBS} `${CC} -print-libgcc-file-name`
- ${OBJCOPY} -S -O srec $@.tmp $@
-
-install:
- ${INSTALL} ${INSTALL_COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
- sboot ${DESTDIR}${MDEC_DIR}/sboot
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/mvme88k/stand/sboot/devices.c b/sys/arch/mvme88k/stand/sboot/devices.c
deleted file mode 100644
index 9b0cd1364db..00000000000
--- a/sys/arch/mvme88k/stand/sboot/devices.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/* $OpenBSD: devices.c,v 1.1 2013/05/12 10:43:45 miod Exp $ */
-
-/*
- * Copyright (c) 2013 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/param.h>
-#include <sys/types.h>
-
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-#include "net.h"
-#include "netif.h"
-#include "config.h"
-
-#include "if_lereg.h"
-
-/*
- * For sboot, we can't assume anything about BUG network support, and
- * need to build the list of available devices ourselves.
- */
-
-static uint32_t vle_addr[] = {
- 0xffff1200,
- 0xffff1400,
- 0xffff1600,
- 0xffff5400,
- 0xffff5600,
- 0xffffa400
-};
-
-struct ie_configuration ie_config[1];
-int nie_config;
-
-struct le_configuration le_config[0 + sizeof(vle_addr) / sizeof(vle_addr[0])];
-int nle_config;
-
-extern struct netif_driver le_driver;
-extern struct netif_driver ie_driver;
-
-struct netif_driver *netif_drivers[] = {
- &ie_driver,
- &le_driver,
-};
-int n_netif_drivers = sizeof(netif_drivers) / sizeof(netif_drivers[0]);
-
-#define MAXIFACES ((sizeof(ie_config) / sizeof(ie_config[0])) + \
- (sizeof(le_config) / sizeof(le_config[0])))
-
-static struct netif_stats if_stats[MAXIFACES];
-static struct netif_dif if_dif[MAXIFACES];
-
-static void
-add_if(struct netif_driver *drv)
-{
- static struct netif_stats *stats = if_stats;
- static struct netif_dif *dif = if_dif;
-
- dif->dif_unit = drv->netif_nifs;
- dif->dif_nsel = 1;
- dif->dif_stats = stats;
-
- if (drv->netif_nifs == 0)
- drv->netif_ifs = dif;
- drv->netif_nifs++;
-
- stats++;
- dif++;
-}
-
-/*
- * Figure out what devices are available.
- */
-int
-probe_ethernet()
-{
- struct mvmeprom_brdid *brdid;
- uint n;
-
- brdid = mvmeprom_brdid();
-
- /* On-board Ethernet */
- switch (brdid->model) {
- case BRD_187:
- case BRD_197:
- case BRD_8120:
- ie_config[nie_config].clun = 0;
- ie_config[nie_config].phys_addr = INTEL_REG_ADDR;
- bcopy(brdid->etheraddr, ie_config[nie_config].eaddr, 6);
- add_if(&ie_driver);
- nie_config++;
- break;
- }
-
- /* MVME376 */
- for (n = 0; n < sizeof(vle_addr) / sizeof(vle_addr[0]); n++) {
- if (badaddr((void *)vle_addr[n], 2) == 0) {
- le_config[nle_config].clun = 2 + n;
- le_config[nle_config].phys_addr = vle_addr[n];
- le_config[nle_config].buf_addr =
- VLEMEMBASE - n * VLEMEMSIZE;
- le_config[nle_config].buf_size = VLEMEMSIZE;
- le_read_etheraddr(vle_addr[n],
- le_config[nle_config].eaddr);
- add_if(&le_driver);
- nle_config++;
- }
- }
-
- return nie_config + nle_config;
-}
-
-/*
- * Mimic the NIOT;H BUG command (except for `P-Address' field), adding our
- * own driver names.
- */
-void
-display_ethernet()
-{
- struct mvmeprom_brdid *brdid;
- int i;
-
- brdid = mvmeprom_brdid();
-
- printf("Network Controllers/Nodes Supported\n");
- printf("Driver CLUN DLUN Name Address Ethernet Address\n");
-
- for (i = 0; i < nie_config; i++) {
- printf("ie%d %x 0 VME%x",
- i, ie_config[i].clun, brdid->model);
- /* @#$%! MVME8120 - and I don't even have one to test (miod) */
- if (brdid->model < 0x1000)
- printf(" ");
- printf(" $%x %s\n",
- ie_config[i].phys_addr, ether_sprintf(ie_config[i].eaddr));
- }
-
- for (i = 0; i < nle_config; i++) {
- printf("le%d %x 0 VME376 $%x %s\n",
- i, le_config[i].clun, le_config[i].phys_addr,
- ether_sprintf(le_config[i].eaddr));
- }
-}
diff --git a/sys/arch/mvme88k/stand/sboot/devopen.c b/sys/arch/mvme88k/stand/sboot/devopen.c
deleted file mode 100644
index e2fa4aa60a4..00000000000
--- a/sys/arch/mvme88k/stand/sboot/devopen.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* $OpenBSD: devopen.c,v 1.1 2013/05/12 10:43:45 miod Exp $ */
-
-/*
- * Copyright (c) 2013 Miodrag Vallat.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-
-#include <sys/param.h>
-#include <sys/types.h>
-
-#include <netinet/in.h>
-
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-#include "netif.h"
-#include "config.h"
-
-/*
- * A replacement for libsa devopen() to recognize an Ethernet interface
- * name, followed by a digit and a colon, as an optional prefix.
- */
-int
-devopen(struct open_file *f, const char *fname, char **file)
-{
- struct devsw *dp;
- const char *prefix;
- char *colon;
-
- prefix = NULL;
- *file = (char *)fname;
-
- colon = strchr(fname, ':');
- if (colon != NULL) {
- int i;
-
- for (i = 0; i < n_netif_drivers; i++) {
- struct netif_driver *drv = netif_drivers[i];
-
- /* out of lazyness, only allow one digit for the
- interface number */
- if (colon != fname + strlen(drv->netif_bname) + 1)
- continue;
- if (bcmp(fname, drv->netif_bname,
- strlen(drv->netif_bname)) != 0)
- continue;
-
- prefix = fname;
- *file = colon + 1;
- }
- }
-
- dp = &devsw[0];
- f->f_dev = dp;
- return (*dp->dv_open)(f, prefix);
-}
diff --git a/sys/arch/mvme88k/stand/sboot/sboot.c b/sys/arch/mvme88k/stand/sboot/sboot.c
deleted file mode 100644
index c4fcfc8bd92..00000000000
--- a/sys/arch/mvme88k/stand/sboot/sboot.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/* $OpenBSD: sboot.c,v 1.7 2013/05/12 21:00:56 miod Exp $ */
-
-/*
- * Copyright (c) 1995 Theo de Raadt
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Copyright (c) 1995 Charles D. Cranor and Seth Widoff
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Charles D. Cranor
- * and Seth Widoff.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-
-#include "config.h"
-
-extern const char *version;
-char line[128];
-
-int
-main()
-{
- int howto, ret;
- char *cp, *file;
-
- board_setup();
-
- printf("\n>> OpenBSD/mvme88k sboot [%s]\n", version);
-
- if (probe_ethernet() == 0) {
- printf("Sorry, no supported Ethernet device found\n");
- return 1;
- }
-
- /*
- * Display Ethernet devices.
- */
- display_ethernet();
-
- howto = 0;
- bugargs.ctrl_lun = -1;
-
- for (;;) {
- printf("boot: ");
- gets(line);
- if (line[0]) {
- bugargs.arg_start = line;
- cp = line;
- while (cp < (line + sizeof(line) - 1) && *cp)
- cp++;
- bugargs.arg_end = cp;
- ret = parse_args(&file, &howto);
-
- if (ret) {
- printf("returning to BUG\n");
- break;
- }
- exec_mvme(file, howto);
- printf("boot: %s: %s\n", file, strerror(errno));
- }
- }
- return 0;
-}
diff --git a/sys/arch/mvme88k/stand/sboot/version.c b/sys/arch/mvme88k/stand/sboot/version.c
deleted file mode 100644
index b48e3c2e71b..00000000000
--- a/sys/arch/mvme88k/stand/sboot/version.c
+++ /dev/null
@@ -1,6 +0,0 @@
-/* $OpenBSD: version.c,v 1.1 2013/05/12 10:43:45 miod Exp $ */
-
-/*
- * 1.1 Initial release
- */
-const char *version = "1.1";
diff --git a/sys/arch/mvme88k/stand/tftpboot/Makefile b/sys/arch/mvme88k/stand/tftpboot/Makefile
deleted file mode 100644
index bafeee7ec1c..00000000000
--- a/sys/arch/mvme88k/stand/tftpboot/Makefile
+++ /dev/null
@@ -1,39 +0,0 @@
-# $OpenBSD: Makefile,v 1.9 2013/11/06 19:37:06 miod Exp $
-
-STRIP?= strip
-
-S= ${.CURDIR}/../../../..
-DEFS=
-#DEFS+=-DNETIF_DEBUG
-INCPATH=-I${.CURDIR} -I${.CURDIR}/../libsa -I${.CURDIR}/../libbug \
- -I${S} -I${S}/lib/libsa
-CFLAGS+=${DEFS} ${INCPATH} ${COPTS}
-CLEANFILES+=tftpboot tftpboot.bin
-
-.include "${S}/arch/mvme88k/stand/bugcrt/Makefile.inc"
-.include "${S}/arch/mvme88k/stand/libbug/Makefile.inc"
-.include "${S}/arch/mvme88k/stand/libsa/Makefile.inc"
-.include "${S}/arch/mvme88k/stand/libz/Makefile.inc"
-
-SRCS= boot.c conf.c version.c tftpfs.c netdev.c
-OBJS= ${SRCS:S/.c/.o/g}
-LIBS= ${LIBSA} ${LIBBUG} ${LIBZ}
-LDFLAGS=-N -T ${S}/arch/mvme88k/stand/ld.script -Ttext ${STAGE2_RELOC}
-LDFLAGS+= -warn-common
-NOPIE=
-
-all: tftpboot.bin
-
-tftpboot: ${NETBOOT_CRT} ${OBJS} ${LIBS}
- ${LD} ${LDFLAGS} -o $@ \
- ${NETBOOT_CRT} ${OBJS} ${LIBS} `${CC} -print-libgcc-file-name`
-
-tftpboot.bin: tftpboot
- ${STRIP} tftpboot
- dd ibs=32 skip=1 if=tftpboot of=$@
-
-install:
- ${INSTALL} ${INSTALL_COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
- tftpboot.bin ${DESTDIR}${MDEC_DIR}/tftpboot
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/mvme88k/stand/tftpboot/boot.c b/sys/arch/mvme88k/stand/tftpboot/boot.c
deleted file mode 100644
index 06aa5b221c9..00000000000
--- a/sys/arch/mvme88k/stand/tftpboot/boot.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* $OpenBSD: boot.c,v 1.5 2013/01/05 11:20:56 miod Exp $ */
-/* $NetBSD: boot.c,v 1.2 1995/09/23 03:42:52 gwr Exp $ */
-
-/*-
- * Copyright (c) 1982, 1986, 1990, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)boot.c 8.1 (Berkeley) 6/10/93
- */
-
-#include <sys/param.h>
-#include <sys/reboot.h>
-
-#include <machine/prom.h>
-
-#include "stand.h"
-#include "libsa.h"
-
-extern const char *version;
-char line[80];
-
-int
-main()
-{
- char *cp, *file;
- int flag, ret;
- int ask = 0;
-
- board_setup();
-
- printf("\n>> OpenBSD/mvme88k tftpboot [%s]\n", version);
-
- ret = parse_args(&file, &flag);
- for (;;) {
- if (ask) {
- printf("boot: ");
- gets(line);
- if (line[0]) {
- bugargs.arg_start = line;
- cp = line;
- while (cp < (line + sizeof(line) -1) && *cp)
- cp++;
- bugargs.arg_end = cp;
- ret = parse_args(&file, &flag);
- }
- }
- if (ret) {
- printf("boot: -q returning to MVME-Bug\n");
- break;
- }
- exec_mvme(file, flag);
- printf("boot: %s: %s\n", file, strerror(errno));
- ask = 1;
- }
- return (0);
-}
diff --git a/sys/arch/mvme88k/stand/tftpboot/conf.c b/sys/arch/mvme88k/stand/tftpboot/conf.c
deleted file mode 100644
index e1b26c65e08..00000000000
--- a/sys/arch/mvme88k/stand/tftpboot/conf.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* $OpenBSD: conf.c,v 1.1 2004/01/26 19:48:34 miod Exp $ */
-
-#include <sys/types.h>
-#include <machine/prom.h>
-
-#include <stand.h>
-#include "tftpfs.h"
-#include "netdev.h"
-#include "libsa.h"
-
-struct fs_ops file_system[] = {
- { tftpfs_open, tftpfs_close, tftpfs_read, tftpfs_write, tftpfs_seek, tftpfs_stat },
-};
-
-int nfsys = sizeof(file_system) / sizeof(file_system[0]);
-
-struct devsw devsw[] = {
- { "net", net_strategy, net_open, net_close, net_ioctl },
-};
-
-int ndevs = (sizeof(devsw)/sizeof(devsw[0]));
-
diff --git a/sys/arch/mvme88k/stand/tftpboot/netdev.c b/sys/arch/mvme88k/stand/tftpboot/netdev.c
deleted file mode 100644
index 50020b0aa88..00000000000
--- a/sys/arch/mvme88k/stand/tftpboot/netdev.c
+++ /dev/null
@@ -1,201 +0,0 @@
-/* $OpenBSD: netdev.c,v 1.4 2012/11/25 14:10:47 miod Exp $ */
-
-/*
- * Copyright (c) 1993 Paul Kranenburg
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Paul Kranenburg.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <machine/prom.h>
-#include <string.h>
-
-#include "stand.h"
-#include "tftpfs.h"
-
-#include "libsa.h"
-
-struct bugdev_softc {
- short clun;
- short dlun;
-} bugdev_softc[1];
-
-int
-devopen(f, fname, file)
- struct open_file *f;
- const char *fname;
- char **file;
-{
- struct bugdev_softc *pp = &bugdev_softc[0];
-
- pp->clun = (short)bugargs.ctrl_lun;
- pp->dlun = (short)bugargs.dev_lun;
-
- f->f_devdata = (void *)pp;
- f->f_dev = &devsw[0];
- *file = (char *)fname;
- return (0);
-}
-
-#define NFR_TIMEOUT 5
-
-int
-net_strategy(devdata, func, nblk, size, buf, rsize)
- void *devdata;
- int func;
- daddr32_t nblk;
- size_t size;
- void *buf;
- size_t *rsize;
-{
- struct bugdev_softc *pp = (struct bugdev_softc *)devdata;
- struct mvmeprom_netfread nfr;
- int attempts;
-
- for (attempts = 0; attempts < 10; attempts++) {
- nfr.ctrl = pp->clun;
- nfr.dev = pp->dlun;
- nfr.status = 0;
- nfr.addr = (u_long)buf;
- nfr.bytes = 0;
- nfr.blk = nblk;
- nfr.timeout = NFR_TIMEOUT;
- mvmeprom_netfread(&nfr);
-
- if (rsize) {
- *rsize = nfr.bytes;
- }
-
- if (nfr.status == 0)
- return (0);
- }
-
- return (EIO);
-}
-
-int
-net_open(struct open_file *f, ...)
-{
- va_list ap;
- struct mvmeprom_netcfig ncfg;
- struct mvmeprom_netfopen nfo;
- struct mvmeprom_ncp ncp;
-#if 0
- struct mvmeprom_netctrl nctrl;
-#endif
- struct bugdev_softc *pp = (struct bugdev_softc *)f->f_devdata;
- char *filename;
- const char *failure = NULL;
-
- va_start(ap, f);
- filename = va_arg(ap, char *);
- va_end(ap);
-
- /*
- * It seems that, after loading tftpboot from the network, the BUG
- * will reset its current network settings before giving us control
- * of the system. This causes any network parameter not stored in
- * the NIOT area to be lost. However, unless we force the `always
- * send a reverse arp request' setting is set, the BUG will `believe'
- * it doesn't need to send any (because it had to in order to load
- * this code), and will fail to connect to the tftp server.
- *
- * Unfortunately, updating the in-memory network configuration to
- * force reverse arp requests to be sent always doesn't work, even
- * after issueing a `reset device' command.
- *
- * The best we can do is recognize this situation, warn the user
- * and return to the BUG.
- */
-
- bzero(&ncp, sizeof ncp);
- ncfg.ctrl = pp->clun;
- ncfg.dev = pp->dlun;
- ncfg.ncp_addr = (u_long)&ncp;
- ncfg.flags = NETCFIG_READ;
- if (mvmeprom_netcfig(&ncfg) == 0 && ncp.magic == NETCFIG_MAGIC) {
- if (ncp.rarp_control != 'A' && ncp.client_ip == 0) {
-#if 0
- ncp.rarp_control = 'A';
- ncp.update_control = 'Y';
-
- bzero(&ncp, sizeof ncp);
- ncfg.ctrl = pp->clun;
- ncfg.dev = pp->dlun;
- ncfg.ncp_addr = (u_long)&ncp;
- ncfg.flags = NETCFIG_WRITE;
-
- if (mvmeprom_netcfig(&ncfg) == 0) {
- bzero(&nctrl, sizeof nctrl);
- nctrl.ctrl = pp->clun;
- nctrl.dev = pp->dlun;
- nctrl.cmd = NETCTRLCMD_RESET;
- if (mvmeprom_netctrl(&nctrl) != 0)
- failure = "reset network interface";
- } else
- failure = "update NIOT configuration";
-#else
- printf("Invalid network configuration\n"
- "Please update the NIOT parameters and set\n"
- "``BOOTP/RARP Request Control: Always/When-Needed (A/W)'' to `A'\n");
- _rtt();
-#endif
- }
- } else
- failure = "read NIOT configuration";
-
- if (failure != NULL)
- printf("failed to %s (0x%x), "
- "hope RARP is set to `A'lways\n", failure, ncfg.status);
-
- nfo.ctrl = pp->clun;
- nfo.dev = pp->dlun;
- nfo.status = 0;
- strlcpy(nfo.filename, filename, sizeof nfo.filename);
- mvmeprom_netfopen(&nfo);
-
-#ifdef DEBUG
- printf("tftp open(%s): 0x%x\n", filename, nfo.status);
-#endif
- return (nfo.status);
-}
-
-int
-net_close(f)
- struct open_file *f;
-{
- return (0);
-}
-
-int
-net_ioctl(f, cmd, data)
- struct open_file *f;
- u_long cmd;
- void *data;
-{
- return (EIO);
-}
diff --git a/sys/arch/mvme88k/stand/tftpboot/netdev.h b/sys/arch/mvme88k/stand/tftpboot/netdev.h
deleted file mode 100644
index 261f99adc09..00000000000
--- a/sys/arch/mvme88k/stand/tftpboot/netdev.h
+++ /dev/null
@@ -1,6 +0,0 @@
-/* $OpenBSD: netdev.h,v 1.2 2011/03/13 00:13:53 deraadt Exp $ */
-
-int net_open(struct open_file *, ...);
-int net_close(struct open_file *);
-int net_ioctl(struct open_file *, u_long, void *);
-int net_strategy(void *, int, daddr32_t, size_t, void *, size_t *);
diff --git a/sys/arch/mvme88k/stand/tftpboot/tftpfs.c b/sys/arch/mvme88k/stand/tftpboot/tftpfs.c
deleted file mode 100644
index af0d1ae41e5..00000000000
--- a/sys/arch/mvme88k/stand/tftpboot/tftpfs.c
+++ /dev/null
@@ -1,289 +0,0 @@
-/* $OpenBSD: tftpfs.c,v 1.5 2011/03/13 00:13:53 deraadt Exp $ */
-
-/*-
- * Copyright (c) 2001 Steve Murphree, Jr.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by TooLs GmbH.
- * 4. The name of TooLs GmbH may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * TFTP file system.
- */
-
-#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-#include <ufs/ffs/fs.h>
-#include <lib/libkern/libkern.h>
-
-#include "stand.h"
-#include "tftpfs.h"
-
-/*
- * In-core open file.
- */
-struct tftp_file {
- char filename[128];
- off_t f_seekp; /* seek pointer */
- char *f_buf; /* buffer for data block */
- off_t f_off; /* index into buffer for data block */
- daddr32_t f_buf_blkno; /* block number of data block */
- size_t f_buf_size;
-};
-
-#define TFTP_BLOCK_SHIFT 9
-#define TFTP_BLOCK_SIZE (1<<TFTP_BLOCK_SHIFT) /* 512 by tftp convention */
-#define TFTP_BLOCK_NO(x) ((x >> TFTP_BLOCK_SHIFT) + 1)
-#define TFTP_BLOCK_OFF(x) (x % TFTP_BLOCK_SIZE)
-
-static int tftp_read_file(struct open_file *, char **, size_t *);
-
-/*
- * Read a portion of a file into an internal buffer. Return
- * the location in the buffer and the amount in the buffer.
- */
-
-char tftp_buf[TFTP_BLOCK_SIZE]; /* static */
-struct tftp_file tftp_ctrl;
-
-static int
-tftp_read_file(f, buf_p, size_p)
- struct open_file *f;
- char **buf_p; /* out */
- size_t *size_p; /* out */
-{
- register struct tftp_file *fp = (struct tftp_file *)f->f_fsdata;
- long off;
- register daddr32_t file_block;
- size_t block_size;
- int i, rc;
-
- off = TFTP_BLOCK_OFF(fp->f_seekp);
- file_block = TFTP_BLOCK_NO(fp->f_seekp);
- block_size = TFTP_BLOCK_SIZE;
-
- if (file_block == fp->f_buf_blkno + 1) {
- /*
- * Normal, incremental block transfer.
- */
- rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
- file_block, block_size, fp->f_buf, &fp->f_buf_size);
- if (rc)
- return (rc);
- if (!(file_block % 4)) /* twiddle every 4 blocks */
- twiddle();
- fp->f_buf_blkno = file_block;
- } else if (file_block > fp->f_buf_blkno + 1) {
- /*
- * Read ahead to the requested block; If we need
- * those we skipped, see below.
- */
- for (i = (fp->f_buf_blkno + 1); i <= file_block; i++) {
- rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
- i, block_size, fp->f_buf, &fp->f_buf_size);
- if (rc)
- return (rc);
- }
- fp->f_buf_blkno = file_block;
- } else if (file_block < fp->f_buf_blkno) {
- /*
- * Uh oh... We can't rewind. Reopen the file
- * and start again.
- */
- char filename[64];
- strlcpy(filename, fp->filename, sizeof filename);
- tftpfs_close(f);
- tftpfs_open(filename, f);
- /* restore f_seekp reset by tftpfs_open() */
- fp->f_seekp = (file_block - 1) * TFTP_BLOCK_SIZE + off;
- for (i = 1; i <= file_block; i++) {
- rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
- i, block_size, fp->f_buf, &fp->f_buf_size);
- if (rc)
- return (rc);
- }
- fp->f_buf_blkno = file_block;
- }
-
- /*
- * Return address of byte in buffer corresponding to
- * offset, and size of remainder of buffer after that
- * byte.
- */
- *buf_p = fp->f_buf + off;
- *size_p = fp->f_buf_size - off;
-
- /*
- * But truncate buffer at end of file.
- */
- if (fp->f_buf_size > block_size){
- twiddle();
- return(EIO);
- }
-
-
- return (0);
-}
-
-/*
- * Open a file.
- */
-int
-tftpfs_open(path, f)
- char *path;
- struct open_file *f;
-{
- struct tftp_file *fp;
- int rc = 0;
-
- /* locate file system specific data structure and zero it.*/
- fp = &tftp_ctrl;
- bzero(fp, sizeof(struct tftp_file));
- f->f_fsdata = (void *)fp;
- fp->f_seekp = 0;
- fp->f_buf = tftp_buf;
- bzero(fp->f_buf, TFTP_BLOCK_SIZE);
- fp->f_buf_size = 0;
-
- strlcpy(fp->filename, path, sizeof fp->filename);
-
- if (f->f_dev->dv_open == NULL) {
- panic("No device open()!");
- }
- twiddle();
- rc = (f->f_dev->dv_open)(f, path);
- return (rc);
-}
-
-int
-tftpfs_close(f)
- struct open_file *f;
-{
- register struct tftp_file *fp = (struct tftp_file *)f->f_fsdata;
-
- fp->f_buf = (void *)0;
- f->f_fsdata = (void *)0;
- (f->f_dev->dv_close)(f);
- return (0);
-}
-
-/*
- * Copy a portion of a file into kernel memory.
- * Cross block boundaries when necessary.
- */
-int
-tftpfs_read(f, start, size, resid)
- struct open_file *f;
- void *start;
- size_t size;
- size_t *resid; /* out */
-{
- register struct tftp_file *fp = (struct tftp_file *)f->f_fsdata;
- register size_t csize;
- char *buf;
- size_t buf_size;
- int rc = 0;
- register char *addr = start;
-
- while (size != 0) {
- rc = tftp_read_file(f, &buf, &buf_size);
- if (rc)
- break;
-
- csize = size;
- if (csize > buf_size)
- csize = buf_size;
-
- bcopy(buf, addr, csize);
-
- fp->f_seekp += csize;
- addr += csize;
- size -= csize;
- }
- if (resid)
- *resid = size;
- return (rc);
-}
-
-/*
- * Not implemented.
- */
-int
-tftpfs_write(f, start, size, resid)
- struct open_file *f;
- void *start;
- size_t size;
- size_t *resid; /* out */
-{
-
- return (EROFS);
-}
-
-/*
- * We only see forward. We can't rewind.
- */
-off_t
-tftpfs_seek(f, offset, where)
- struct open_file *f;
- off_t offset;
- int where;
-{
- register struct tftp_file *fp = (struct tftp_file *)f->f_fsdata;
-
- switch (where) {
- case SEEK_SET:
- fp->f_seekp = offset;
- break;
- case SEEK_CUR:
- fp->f_seekp += offset;
- break;
- case SEEK_END:
- errno = EIO;
- return (-1);
- break;
- default:
- return (-1);
- }
- return (fp->f_seekp);
-}
-
-int
-tftpfs_stat(f, sb)
- struct open_file *f;
- struct stat *sb;
-{
- return EIO;
-}
-
-#ifndef NO_READDIR
-int
-tftpfs_readdir (struct open_file *f, char *name)
-{
- return EIO;
-}
-#endif
-
diff --git a/sys/arch/mvme88k/stand/tftpboot/tftpfs.h b/sys/arch/mvme88k/stand/tftpboot/tftpfs.h
deleted file mode 100644
index 956a3c379ed..00000000000
--- a/sys/arch/mvme88k/stand/tftpboot/tftpfs.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* $OpenBSD: tftpfs.h,v 1.1 2004/01/26 19:48:34 miod Exp $ */
-
-/*-
- * Copyright (c) 2001 Steve Murphree, Jr.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by TooLs GmbH.
- * 4. The name of TooLs GmbH may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-int tftpfs_open(char *path, struct open_file *f);
-int tftpfs_close(struct open_file *f);
-int tftpfs_read(struct open_file *f, void *buf,
- size_t size, size_t *resid);
-int tftpfs_write(struct open_file *f, void *buf,
- size_t size, size_t *resid);
-off_t tftpfs_seek(struct open_file *f, off_t offset, int where);
-int tftpfs_stat(struct open_file *f, struct stat *sb);
-#ifndef NO_READDIR
-int tftpfs_readdir(struct open_file *f, char *name);
-#endif
diff --git a/sys/arch/mvme88k/stand/tftpboot/version.c b/sys/arch/mvme88k/stand/tftpboot/version.c
deleted file mode 100644
index 95b42a596e6..00000000000
--- a/sys/arch/mvme88k/stand/tftpboot/version.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/* $OpenBSD: version.c,v 1.9 2013/01/05 11:20:56 miod Exp $ */
-
-/*
- * 1.9 ELF toolchain
- * 1.8 compiled with gcc 3.3.5
- * 1.7 recognize non-working NIOT configuration and ask the user to
- * correct it instead of failing to boot silently
- * tftp server
- * 1.6 allocation area changed to fix netboot buffers overwriting stack
- * 1.5 perform MVME197 busswitch initialization
- * 1.4 rewritten crt code, self-relocatable
- * 1.3 kernel loaded with loadfile, a.out and ELF formats
- * 1.2 rewritten startup code and general cleanup
- * 1.1 initial revision
- */
-const char *version = "1.9";
diff --git a/sys/arch/mvme88k/stand/wrtvid/Makefile b/sys/arch/mvme88k/stand/wrtvid/Makefile
deleted file mode 100644
index 0aaaf4b10c1..00000000000
--- a/sys/arch/mvme88k/stand/wrtvid/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# $OpenBSD: Makefile,v 1.4 2012/08/21 14:46:19 pascal Exp $
-PROG= wrtvid
-NOMAN=
-NOPIE=
-
-install:
-
-.include <bsd.prog.mk>
diff --git a/sys/arch/mvme88k/stand/wrtvid/Makefile.inc b/sys/arch/mvme88k/stand/wrtvid/Makefile.inc
deleted file mode 100644
index 20aa0a562c0..00000000000
--- a/sys/arch/mvme88k/stand/wrtvid/Makefile.inc
+++ /dev/null
@@ -1,13 +0,0 @@
-# $OpenBSD: Makefile.inc,v 1.2 1998/08/22 08:52:55 smurph Exp $
-WRTVID_BASE_DIR=${S}/arch/mvme88k/stand/wrtvid
-
-WRTVID_DIR!= cd ${WRTVID_BASE_DIR}; \
- printf "xxx:\n\techo \$${.OBJDIR}\n" | ${MAKE} -r -s -f - xxx
-
-WRTVID=${WRTVID_DIR}/wrtvid
-
-$(WRTVID): .NOTMAIN __always_make_WRTVID
- @echo making sure the wrtvid is up to date...
- @(cd ${WRTVID_BASE_DIR}; ${MAKE})
-
-__always_make_WRTVID: .NOTMAIN
diff --git a/sys/arch/mvme88k/stand/wrtvid/wrtvid.c b/sys/arch/mvme88k/stand/wrtvid/wrtvid.c
deleted file mode 100644
index 8b9ab146bfc..00000000000
--- a/sys/arch/mvme88k/stand/wrtvid/wrtvid.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/* $OpenBSD: wrtvid.c,v 1.8 2014/02/23 12:30:15 jsg Exp $ */
-
-/*
- * Copyright (c) 1995 Dale Rahn <drahn@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/disklabel.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-void copy_exe(int, int);
-void swabcfg(struct mvmedisklabel *);
-void swabvid(struct mvmedisklabel *);
-
-int
-main(argc, argv)
- int argc;
- char **argv;
-{
- struct mvmedisklabel *pcpul;
- struct stat stat;
- int exe_file;
- int tape_vid;
- int tape_exe;
- unsigned int exe_addr;
- char *filename;
- char fileext[256];
-
- if (argc == 1)
- filename = "a.out";
- else
- filename = argv[1];
-
- exe_file = open(filename, O_RDONLY,0444);
- if (exe_file == -1) {
- perror(filename);
- exit(2);
- }
- snprintf(fileext, sizeof fileext, "%c%cboot", filename[4], filename[5]);
- tape_vid = open(fileext, O_WRONLY|O_CREAT|O_TRUNC, 0644);
- snprintf(fileext, sizeof fileext, "boot%c%c", filename[4], filename[5]);
- tape_exe = open(fileext, O_WRONLY|O_CREAT|O_TRUNC,0644);
-
- pcpul = (struct mvmedisklabel *)malloc(sizeof(struct mvmedisklabel));
- bzero(pcpul, sizeof(struct mvmedisklabel));
-
- pcpul->version = 1;
- memcpy(pcpul->vid_id, "M88K", sizeof pcpul->vid_id);
-
- fstat(exe_file, &stat);
- /* size in 256 byte blocks round up after a.out header removed */
-
- if (filename[5] == 't' ) {
- pcpul->vid_oss = 1;
- }else {
- pcpul->vid_oss = 2;
- }
- pcpul->vid_osl = (((stat.st_size -0x20) +511) / 512) *2;
-
- lseek(exe_file, 0x14, SEEK_SET);
- read(exe_file, &exe_addr, 4);
-
- /* check this, it may not work in both endian. */
- /* No, it doesn't. Use a big endian machine for now. SPM */
-
- {
- union {
- struct s {
- unsigned short s1;
- unsigned short s2;
- } s;
- unsigned long l;
- } a;
- a.l = exe_addr;
- pcpul->vid_osa_u = a.s.s1;
- pcpul->vid_osa_l = a.s.s2;
-
- }
- pcpul->vid_cas = 1;
- pcpul->vid_cal = 1;
- /* do not want to write past end of structure, not null terminated */
- strncpy(pcpul->vid_mot, "MOTOROLA", 8);
-
- if (BYTE_ORDER != BIG_ENDIAN)
- swabvid(pcpul);
-
- pcpul->cfg_rec = 0x100;
- pcpul->cfg_psm = 0x200;
-
- if (BYTE_ORDER != BIG_ENDIAN)
- swabcfg(pcpul);
-
- write(tape_vid, pcpul, sizeof(struct mvmedisklabel));
-
- free(pcpul);
-
- copy_exe(exe_file, tape_exe);
- close(exe_file);
- close(tape_vid);
- close(tape_exe);
- return (0);
-}
-
-#define BUF_SIZ 512
-void
-copy_exe(exe_file, tape_exe)
- int exe_file, tape_exe;
-{
- char buf[BUF_SIZ];
- int cnt = 0;
-
- lseek (exe_file, 0x20, SEEK_SET);
- while (BUF_SIZ == (cnt = read(exe_file, buf, BUF_SIZ))) {
- write(tape_exe, buf, cnt);
- }
- bzero(&buf[cnt], BUF_SIZ-cnt);
- write(tape_exe, buf, BUF_SIZ);
-}
-
-void
-swabvid(pcpul)
- struct mvmedisklabel *pcpul;
-{
- swap32(pcpul->vid_oss);
- swap16(pcpul->vid_osl);
-#if 0
- swap16(pcpul->vid_osa_u);
- swap16(pcpul->vid_osa_l);
-#endif
- swap32(pcpul->vid_cas);
-}
-
-void
-swabcfg(pcpul)
- struct mvmedisklabel *pcpul;
-{
- swap16(pcpul->cfg_atm);
- swap16(pcpul->cfg_prm);
- swap16(pcpul->cfg_atm);
- swap16(pcpul->cfg_rec);
- swap16(pcpul->cfg_trk);
- swap16(pcpul->cfg_psm);
- swap16(pcpul->cfg_shd);
- swap16(pcpul->cfg_pcom);
- swap16(pcpul->cfg_rwcc);
- swap16(pcpul->cfg_ecc);
- swap16(pcpul->cfg_eatm);
- swap16(pcpul->cfg_eprm);
- swap16(pcpul->cfg_eatw);
- swap16(pcpul->cfg_rsvc1);
- swap16(pcpul->cfg_rsvc2);
-}
diff --git a/sys/conf/files b/sys/conf/files
index 15c1b856778..1abaf83fbaf 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1,4 +1,4 @@
-# $OpenBSD: files,v 1.568 2014/03/08 14:34:12 mpi Exp $
+# $OpenBSD: files,v 1.569 2014/03/18 22:36:37 miod Exp $
# $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
@@ -362,8 +362,8 @@ file dev/ic/lpt.c lpt & (lpt_isa | lpt_localbus |
# STI (hp graphics)
device sti: wsemuldisplaydev
-file dev/ic/sti.c sti & (sti_dio | sti_gedoens |
- sti_pci | sti_sgc) needs-flag
+file dev/ic/sti.c sti & (sti_gedoens |
+ sti_pci) needs-flag
# Initio ULTRA WIDE/ULTRA2 WIDE SCSI Controllers
device iha: scsi
diff --git a/sys/dev/ic/sti.c b/sys/dev/ic/sti.c
index c17653f2a73..4ed26f9ad5d 100644
--- a/sys/dev/ic/sti.c
+++ b/sys/dev/ic/sti.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sti.c,v 1.69 2014/02/20 11:13:44 kettenis Exp $ */
+/* $OpenBSD: sti.c,v 1.70 2014/03/18 22:36:37 miod Exp $ */
/*
* Copyright (c) 2000-2003 Michael Shalayeff
@@ -1331,46 +1331,3 @@ sti_unpack_attr(void *v, long attr, int *fg, int *bg, int *ul)
if (ul != NULL)
*ul = 0;
}
-
-#if NSTI_DIO > 0 || NSTI_SGC > 0
-
-/*
- * Early console support. Only used on hp300.
- */
-
-int
-sti_cnattach(struct sti_rom *rom, struct sti_screen *scr, bus_space_tag_t memt,
- bus_addr_t *bases, u_int codebase)
-{
- bus_space_handle_t romh;
- u_int romend;
- int error;
- long defattr;
-
- if ((error = bus_space_map(memt, bases[0], PAGE_SIZE, 0, &romh)) != 0)
- return (error);
-
- /*
- * Compute real PROM size
- */
- romend = sti_rom_size(memt, romh);
-
- bus_space_unmap(memt, romh, PAGE_SIZE);
-
- if ((error = bus_space_map(memt, bases[0], romend, 0, &romh)) != 0)
- return (error);
-
- bases[0] = romh;
- if (sti_rom_setup(rom, memt, memt, romh, bases, codebase) != 0)
- panic(__func__);
- scr->scr_rom = rom;
- if (sti_screen_setup(scr, STI_CLEARSCR) != 0)
- panic(__func__);
-
- sti_alloc_attr(scr, 0, 0, 0, &defattr);
- wsdisplay_cnattach(&scr->scr_wsd, scr, 0, 0, defattr);
-
- return (0);
-}
-
-#endif /* NSTI_SGC > 0 */
diff --git a/sys/dev/isa/isavar.h b/sys/dev/isa/isavar.h
index 06cab5eee01..ae0cb642f24 100644
--- a/sys/dev/isa/isavar.h
+++ b/sys/dev/isa/isavar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: isavar.h,v 1.57 2011/07/08 08:26:41 jsg Exp $ */
+/* $OpenBSD: isavar.h,v 1.58 2014/03/18 22:36:37 miod Exp $ */
/* $NetBSD: isavar.h,v 1.26 1997/06/06 23:43:57 thorpej Exp $ */
/*-
@@ -117,8 +117,6 @@ struct isabus_attach_args;
#if defined(__alpha__)
#include <alpha/isa/isa_machdep.h>
-#elif defined(__hp300__)
-#include <hp300/dev/isa_machdep.h>
#elif defined(__i386__)
#include <i386/isa/isa_machdep.h>
#elif defined(__powerpc__)
diff --git a/sys/kern/Makefile b/sys/kern/Makefile
index e40a720bac5..d907fbf555e 100644
--- a/sys/kern/Makefile
+++ b/sys/kern/Makefile
@@ -1,10 +1,10 @@
-# $OpenBSD: Makefile,v 1.36 2013/09/04 14:58:51 patrick Exp $
+# $OpenBSD: Makefile,v 1.37 2014/03/18 22:36:37 miod Exp $
# Makefile for kernel tags files, init_sysent, etc.
-ARCH= alpha amd64 armish armv7 aviion hp300 \
+ARCH= alpha amd64 armish armv7 aviion \
hppa hppa64 i386 landisk loongson \
- luna88k macppc mvme68k mvme88k sgi socppc \
+ luna88k macppc sgi socppc \
solbourne sparc sparc64 vax zaurus
all:
diff --git a/sys/lib/libkern/arch/m68k/DEFS.h b/sys/lib/libkern/arch/m68k/DEFS.h
deleted file mode 100644
index 5665586dff1..00000000000
--- a/sys/lib/libkern/arch/m68k/DEFS.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $OpenBSD: DEFS.h,v 1.2 1997/11/07 15:57:00 niklas Exp $ */
-/* $NetBSD: DEFS.h,v 1.2 1994/10/26 06:39:21 cgd Exp $ */
-
-#include <machine/asm.h>
diff --git a/sys/lib/libkern/arch/m68k/SYS.h b/sys/lib/libkern/arch/m68k/SYS.h
deleted file mode 100644
index 53dcaa91d90..00000000000
--- a/sys/lib/libkern/arch/m68k/SYS.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* $OpenBSD: SYS.h,v 1.3 2003/06/02 23:28:08 millert Exp $ */
-/* $NetBSD: SYS.h,v 1.2 1994/10/26 06:39:23 cgd Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)SYS.h 5.5 (Berkeley) 5/7/91
- */
-
-#include <sys/syscall.h>
-#include <machine/asm.h>
-
-#ifdef __STDC__
-
-#ifdef PIC
-/* With PIC code, we can't pass the error to cerror in d0,
- because the jump might go via the binder. */
-#define SYSCALL(x) .even; err: movl d0,sp@-; jra cerror; ENTRY(x); \
- movl \#SYS_ ## x,d0; trap \#0; jcs err
-#else /* !PIC */
-#define SYSCALL(x) .even; err: jra cerror; ENTRY(x); \
- movl \#SYS_ ## x,d0; trap \#0; jcs err
-#endif /* !PIC */
-
-#define RSYSCALL(x) SYSCALL(x); rts
-#define PSEUDO(x,y) ENTRY(x); movl \#SYS_ ## y,d0; trap \#0; rts
-
-#else /* !__STDC__ */
-
-#ifdef PIC
-/* With PIC code, we can't pass the error to cerror in d0,
- because the jump might go via the binder. */
-#define SYSCALL(x) .even; err: movl d0,sp@-; jra cerror; ENTRY(x); \
- movl #SYS_/**/x,d0; trap #0; jcs err
-#else /* !PIC */
-#define SYSCALL(x) .even; err: jra cerror; ENTRY(x); \
- movl #SYS_/**/x,d0; trap #0; jcs err
-#endif /* !PIC */
-
-#define RSYSCALL(x) SYSCALL(x); rts
-#define PSEUDO(x,y) ENTRY(x); movl #SYS_/**/y,d0; trap #0; rts
-
-#endif /* !__STDC__ */
-
-#define ASMSTR .asciz
-
- .globl cerror
diff --git a/sys/lib/libkern/arch/m68k/bcmp.S b/sys/lib/libkern/arch/m68k/bcmp.S
deleted file mode 100644
index 4c2f2b4ebb1..00000000000
--- a/sys/lib/libkern/arch/m68k/bcmp.S
+++ /dev/null
@@ -1,83 +0,0 @@
-/* $OpenBSD: bcmp.S,v 1.5 2013/02/02 13:32:06 miod Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* bcmp(s1, s2, n) */
-
-#include "DEFS.h"
-
-/*
- * This is probably not the best we can do, but it is still 2-10 times
- * faster than the C version in the portable gen directory.
- *
- * Things that might help:
- * - longword align when possible (only on the 68020)
- * - use nested DBcc instructions or use one and limit size to 64K
- */
-ENTRY(bcmp)
- movl %sp@(4),%a0 | string 1
- movl %sp@(8),%a1 | string 2
- movl %sp@(12),%d0 | length
- beq bcdone | if zero, nothing to do
- movl %a0,%d1
- btst #0,%d1 | string 1 address odd?
- beq bceven | no, skip alignment
- cmpmb %a0@+,%a1@+ | yes, compare a byte
- bne bcnoteq | not equal, return non-zero
- subql #1,%d0 | adjust count
- beq bcdone | count 0, reutrn zero
-bceven:
- movl %a1,%d1
- btst #0,%d1 | string 2 address odd?
- bne bcbloop | yes, no hope for alignment, compare bytes
- movl %d0,%d1 | no, both even
- lsrl #2,%d1 | convert count to longword count
- beq bcbloop | count 0, skip longword loop
-bclloop:
- cmpml %a0@+,%a1@+ | compare a longword
- bne bcnoteq | not equal, return non-zero
- subql #1,%d1 | adjust count
- bne bclloop | still more, keep comparing
- andl #3,%d0 | what remains
- beq bcdone | nothing, all done
-bcbloop:
- cmpmb %a0@+,%a1@+ | compare a byte
- bne bcnoteq | not equal, return non-zero
- subql #1,%d0 | adjust count
- bne bcbloop | still more, keep going
- rts
-bcnoteq:
- moveq #1,%d0
-bcdone:
- rts
diff --git a/sys/lib/libkern/arch/m68k/bcopy.S b/sys/lib/libkern/arch/m68k/bcopy.S
deleted file mode 100644
index 38afdda4544..00000000000
--- a/sys/lib/libkern/arch/m68k/bcopy.S
+++ /dev/null
@@ -1 +0,0 @@
-/* Implemented in memmove.S */
diff --git a/sys/lib/libkern/arch/m68k/bzero.S b/sys/lib/libkern/arch/m68k/bzero.S
deleted file mode 100644
index b61d55ff2a1..00000000000
--- a/sys/lib/libkern/arch/m68k/bzero.S
+++ /dev/null
@@ -1,72 +0,0 @@
-/* $OpenBSD: bzero.S,v 1.5 2013/02/02 13:32:06 miod Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "DEFS.h"
-
-/*
- * This is probably not the best we can do, but it is still much
- * faster than the C version in the portable gen directory.
- *
- * Things that might help:
- * - unroll the longword loop (might not be good for a 68020)
- * - longword, as opposed to word, align when possible (only on the 68020)
- * - use nested DBcc instructions or use one and limit size to 64K
- */
-ENTRY(bzero)
- movl %sp@(4),%a0 | destination
- movl %sp@(8),%d0 | count
- beq bzdone | nothing to do
- movl %a0,%d1
- btst #0,%d1 | address odd?
- beq bzeven | no, skip alignment
- clrb %a0@+ | yes, clear a byte
- subql #1,%d0 | adjust count
- beq bzdone | if zero, all done
-bzeven:
- movl %d0,%d1
- lsrl #2,%d1 | convert to longword count
- beq bzbloop | no longwords, skip loop
-bzlloop:
- clrl %a0@+ | clear a longword
- subql #1,%d1 | adjust count
- bne bzlloop | still more, keep going
- andl #3,%d0 | what remains
- beq bzdone | nothing, all done
-bzbloop:
- clrb %a0@+ | clear a byte
- subql #1,%d0 | adjust count
- bne bzbloop | still more, keep going
-bzdone:
- rts
diff --git a/sys/lib/libkern/arch/m68k/ffs.S b/sys/lib/libkern/arch/m68k/ffs.S
deleted file mode 100644
index cca620e30f9..00000000000
--- a/sys/lib/libkern/arch/m68k/ffs.S
+++ /dev/null
@@ -1,48 +0,0 @@
-/* $OpenBSD: ffs.S,v 1.5 2013/02/02 13:32:06 miod Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* bit = ffs(value) */
-
-#include "DEFS.h"
-
-ENTRY(ffs)
- movl %sp@(4),%d0
- movl %d0,%d1
- negl %d0
- andl %d0,%d1
- movql #32,%d0
- bfffo %d1{#0:#32},%d1
- subl %d1,%d0
- rts
diff --git a/sys/lib/libkern/arch/m68k/htonl.S b/sys/lib/libkern/arch/m68k/htonl.S
deleted file mode 100644
index d13088cd286..00000000000
--- a/sys/lib/libkern/arch/m68k/htonl.S
+++ /dev/null
@@ -1,45 +0,0 @@
-/* $OpenBSD: htonl.S,v 1.5 2013/02/02 13:32:06 miod Exp $ */
-/* $NetBSD: htonl.S,v 1.2 1994/10/26 06:39:27 cgd Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* netorder = htonl(hostorder) */
-
-#include "DEFS.h"
-
-ALTENTRY(ntohl, _htonl)
-ALTENTRY(bswap32, _htonl)
-ENTRY(htonl)
- movl %sp@(4),%d0
- rts
diff --git a/sys/lib/libkern/arch/m68k/htons.S b/sys/lib/libkern/arch/m68k/htons.S
deleted file mode 100644
index 6fd535f8e74..00000000000
--- a/sys/lib/libkern/arch/m68k/htons.S
+++ /dev/null
@@ -1,46 +0,0 @@
-/* $OpenBSD: htons.S,v 1.5 2013/02/02 13:32:06 miod Exp $ */
-/* $NetBSD: htons.S,v 1.2 1994/10/26 06:39:27 cgd Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* hostorder = htons(netorder) */
-
-#include "DEFS.h"
-
-ALTENTRY(ntohs, _htons)
-ALTENTRY(bswap16, _htons)
-ENTRY(htons)
- clrl %d0
- movw %sp@(6),%d0
- rts
diff --git a/sys/lib/libkern/arch/m68k/memcmp.S b/sys/lib/libkern/arch/m68k/memcmp.S
deleted file mode 100644
index e9d032cc426..00000000000
--- a/sys/lib/libkern/arch/m68k/memcmp.S
+++ /dev/null
@@ -1,92 +0,0 @@
-/* $OpenBSD: memcmp.S,v 1.4 2013/02/02 13:32:06 miod Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "DEFS.h"
-
-/* memcmp(s1, s2, n) */
-
-/*
- * This is probably not the best we can do, but it is still 2-10 times
- * faster than the C version in the portable gen directory.
- *
- * Things that might help:
- * - longword align when possible (only on the 68020)
- * - use nested DBcc instructions or use one and limit size to 64K
- */
-ENTRY(memcmp)
- movl %sp@(4),%a0 | string 1
- movl %sp@(8),%a1 | string 2
- movl %sp@(12),%d0 | length
- beq bcdone | if zero, nothing to do
- movl %a0,%d1
- btst #0,%d1 | string 1 address odd?
- beq bceven | no, skip alignment
- cmpmb %a0@+,%a1@+ | yes, compare a byte
- bne bcnoteq | not equal, return non-zero
- subql #1,%d0 | adjust count
- beq bcdone | count 0, reutrn zero
-bceven:
- movl %a1,%d1
- btst #0,%d1 | string 2 address odd?
- bne bcbloop | yes, no hope for alignment, compare bytes
- movl %d0,%d1 | no, both even
- lsrl #2,%d1 | convert count to longword count
- beq bcbloop | count 0, skip longword loop
-bclloop:
- cmpml %a0@+,%a1@+ | compare a longword
- bne bcnoteql | not equal, return non-zero
- subql #1,%d1 | adjust count
- bne bclloop | still more, keep comparing
- andl #3,%d0 | what remains
- beq bcdone | nothing, all done
-bcbloop:
- cmpmb %a0@+,%a1@+ | compare a byte
- bne bcnoteq | not equal, return non-zero
- subql #1,%d0 | adjust count
- bne bcbloop | still more, keep going
- rts
-bcnoteql:
- subql #4,%a0
- subql #4,%a1
- movl #4,%d0
- jra bcbloop
-bcnoteq:
- clrl %d0
- clrl %d1
- movb %a0@-,%d0
- movb %a1@-,%d1
- subl %d1,%d0
-bcdone:
- rts
diff --git a/sys/lib/libkern/arch/m68k/memcpy.S b/sys/lib/libkern/arch/m68k/memcpy.S
deleted file mode 100644
index 38afdda4544..00000000000
--- a/sys/lib/libkern/arch/m68k/memcpy.S
+++ /dev/null
@@ -1 +0,0 @@
-/* Implemented in memmove.S */
diff --git a/sys/lib/libkern/arch/m68k/memmove.S b/sys/lib/libkern/arch/m68k/memmove.S
deleted file mode 100644
index a6992690957..00000000000
--- a/sys/lib/libkern/arch/m68k/memmove.S
+++ /dev/null
@@ -1,132 +0,0 @@
-/* $OpenBSD: memmove.S,v 1.4 2013/06/17 17:50:07 jj Exp $ */
-/* $NetBSD: bcopy.s,v 1.1 1997/03/17 19:44:33 gwr Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * This is based on: src/lib/libc/arch/m68k/string/bcopy.S
- * identified as: @(#)bcopy.s 5.1 (Berkeley) 5/12/90
- */
-
-#include <machine/asm.h>
-
- .file "memmove.S"
- .text
-
-/*
- * bcopy(from, to, len)
- * memmove(to, from, len): swap args and fall into bcopy
- * memcpy(to, from, len): swap args, and fall into forward bcopy
- *
- */
-ENTRY(memcpy)
- movl %sp@(12),%d0 | get count
- jeq Lbccpyexit | if zero, return
- movl %sp@(8), %a0 | src address
- movl %sp@(4), %a1 | dest address
- jra Lbcdocopyf | copy forward
-ENTRY(memmove)
- movl %sp@(12),%d0 | get count
- jeq Lbccpyexit | if zero, return
- movl %sp@(8), %a0 | src address
- movl %sp@(4), %a1 | dest address
- jra Lbcdocopy | jump into bcopy
-ENTRY(bcopy)
- movl %sp@(12),%d0 | get count
- jeq Lbccpyexit | if zero, return
- movl %sp@(4),%a0 | src address
- movl %sp@(8),%a1 | dest address
-Lbcdocopy:
- cmpl %a1,%a0 | src before dest?
- jlt Lbccpyback | yes, copy backwards (avoids overlap)
-Lbcdocopyf:
- movl %a0,%d1
- btst #0,%d1 | src address odd?
- jeq Lbccfeven | no, go check dest
- movb %a0@+,%a1@+ | yes, copy a byte
- subql #1,%d0 | update count
- jeq Lbccpyexit | exit if done
-Lbccfeven:
- movl %a1,%d1
- btst #0,%d1 | dest address odd?
- jne Lbccfbyte | yes, must copy by bytes
- movl %d0,%d1 | no, get count
- lsrl #2,%d1 | convert to longwords
- jeq Lbccfbyte | no longwords, copy bytes
-Lbccflloop:
- movl %a0@+,%a1@+ | copy longwords
- subql #1,%d1 | decrement counter
- jne Lbccflloop | til done
- andl #3,%d0 | get remaining count
- jeq Lbccpyexit | done if none
-Lbccfbyte:
-Lbccfbloop:
- movb %a0@+,%a1@+ | copy bytes
- subql #1,%d0 | decrement counter
- jne Lbccfbloop | til done
-Lbccpyexit:
- movl %sp@(4),%d0 | dest address
- moveal %d0,%a0
- rts
-Lbccpyback:
- addl %d0,%a0 | add count to src
- addl %d0,%a1 | add count to dest
- movl %a0,%d1
- btst #0,%d1 | src address odd?
- jeq Lbccbeven | no, go check dest
- movb %a0@-,%a1@- | yes, copy a byte
- subql #1,%d0 | update count
- jeq Lbccpyexit | exit if done
-Lbccbeven:
- movl %a1,%d1
- btst #0,%d1 | dest address odd?
- jne Lbccbbyte | yes, must copy by bytes
- movl %d0,%d1 | no, get count
- lsrl #2,%d1 | convert to longwords
- jeq Lbccbbyte | no longwords, copy bytes
-Lbccblloop:
- movl %a0@-,%a1@- | copy longwords
- subql #1,%d1 | decrement counter
- jne Lbccblloop | til done
- andl #3,%d0 | get remaining count
- jeq Lbccpyexit | done if none
-Lbccbbyte:
-Lbccbbloop:
- movb %a0@-,%a1@- | copy bytes
- subql #1,%d0 | decrement counter
- jne Lbccbbloop | til done
- movl %sp@(4),%d0 | dest address
- moveal %d0,%a0
- rts
-
diff --git a/sys/lib/libkern/arch/m68k/memset.S b/sys/lib/libkern/arch/m68k/memset.S
deleted file mode 100644
index 75b4b38d352..00000000000
--- a/sys/lib/libkern/arch/m68k/memset.S
+++ /dev/null
@@ -1,103 +0,0 @@
-/* $OpenBSD: memset.S,v 1.4 2013/02/02 13:32:06 miod Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "DEFS.h"
-
-/*
- * This is probably not the best we can do, but it is still much
- * faster than the C version in the portable gen directory.
- *
- * Things that might help:
- * - unroll the longword loop (might not be good for a 68020)
- * - longword, as opposed to word, align when possible (only on the 68020)
- * - use nested DBcc instructions or use one and limit size to 64K
- */
-ENTRY(memset)
- movl %d2,%sp@-
- movl %sp@(8),%a0 | destination
- movl %sp@(16),%d0 | count
- beq bzdone | nothing to do
- movb %sp@(15),%d2 | character
- movl %a0,%d1
- btst #0,%d1 | address odd?
- beq bzeven | no, skip alignment
- movb %d2,%a0@+ | set one byte
- subql #1,%d0 | adjust count
- beq bzdone | if zero, all done
-bzeven:
- cmpl #15,%d0
- ble bzbloop | too small to be worthwhile
- clrl %d1 | replicate byte to fill longword
- movb %d2,%d1
- movl %d1,%d2
- lsll #8,%d1
- orl %d1,%d2
- lsll #8,%d1
- orl %d1,%d2
- lsll #8,%d1
- orl %d1,%d2
- movl %d0,%d1 | convert to longword count
- lsrl #2,%d1
-#ifdef DEBUG
- moveml #0xffff,%sp@-
- movl %d2,%sp@-
- movl %d1,%sp@-
- movl %d0,%sp@-
- movl %a0,%sp@-
- movl #foo,%sp@-
- jsr _C_LABEL(printf)
- addl #20,%sp
- moveml %sp@+,#0xffff
-#endif
-bzlloop:
- movl %d2,%a0@+ | set one longword
- subql #1,%d1 | adjust count
- bne bzlloop | still more, keep going
- andl #3,%d0 | what remains
- beq bzdone | nothing, all done
-bzbloop:
- movb %d2,%a0@+ | set one byte
- subql #1,%d0 | adjust count
- bne bzbloop | still more, keep going
-bzdone:
- movl %sp@(8),%d0 | return destination
- movl %sp@+,%d2
- rts
-
-#ifdef DEBUG
- .globl _printf
-foo:
- .asciz "a0=%08x d0=%08x d1=%08x d2=%08x\n"
-#endif
diff --git a/sys/lib/libkern/arch/m68k/scanc.S b/sys/lib/libkern/arch/m68k/scanc.S
deleted file mode 100644
index 7f3dfeeb713..00000000000
--- a/sys/lib/libkern/arch/m68k/scanc.S
+++ /dev/null
@@ -1,64 +0,0 @@
-/* $OpenBSD: scanc.S,v 1.4 2013/02/02 13:32:06 miod Exp $ */
-/* $NetBSD: scanc.S,v 1.2 1994/10/26 06:39:31 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1980, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: locore.s 1.58 91/04/22
- * @(#)locore.s 7.11 (Berkeley) 5/9/91
- */
-
-#include "DEFS.h"
-
-/*
- * Emulate fancy VAX string operations:
- * scanc(count, startc, table, mask)
- */
-ENTRY(scanc)
- movl %sp@(4),%d0 | get length
- jeq Lscdone | nothing to do, return
- movl %sp@(8),%a0 | start of scan
- movl %sp@(12),%a1 | table to compare with
- movb %sp@(19),%d1 | and mask to use
- movw %d2,%sp@- | need a scratch register
- clrw %d2 | clear it out
- subqw #1,%d0 | adjust for dbra
-Lscloop:
- movb %a0@+,%d2 | get character
- movb %a1@(0,%d2:w),%d2 | get table entry
- andb %d1,%d2 | mask it
- dbne %d0,Lscloop | keep going til no more or non-zero
- addqw #1,%d0 | overshot by one
- movw %sp@+,%d2 | restore scratch
-Lscdone:
- rts
diff --git a/sys/lib/libkern/arch/m68k/skpc.S b/sys/lib/libkern/arch/m68k/skpc.S
deleted file mode 100644
index f932807b473..00000000000
--- a/sys/lib/libkern/arch/m68k/skpc.S
+++ /dev/null
@@ -1,58 +0,0 @@
-/* $OpenBSD: skpc.S,v 1.4 2013/02/02 13:32:06 miod Exp $ */
-/* $NetBSD: skpc.S,v 1.2 1994/10/26 06:39:32 cgd Exp $ */
-
-/*
- * Copyright (c) 1988 University of Utah.
- * Copyright (c) 1980, 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * from: Utah Hdr: locore.s 1.58 91/04/22
- * @(#)locore.s 7.11 (Berkeley) 5/9/91
- */
-
-#include "DEFS.h"
-
-/*
- * Emulate fancy VAX string operations:
- * skpc(mask, count, startc)
- */
-ENTRY(skpc)
- movl %sp@(8),%d0 | get length
- jeq Lskdone | nothing to do, return
- movb %sp@(7),%d1 | mask to use
- movl %sp@(12),%a0 | where to start
- subqw #1,%d0 | adjust for dbcc
-Lskloop:
- cmpb %a0@+,%d1 | compare with mask
- dbne %d0,Lskloop | keep going til no more or zero
- addqw #1,%d0 | overshot by one
-Lskdone:
- rts
diff --git a/sys/lib/libkern/arch/m68k/strcmp.S b/sys/lib/libkern/arch/m68k/strcmp.S
deleted file mode 100644
index 758470f448f..00000000000
--- a/sys/lib/libkern/arch/m68k/strcmp.S
+++ /dev/null
@@ -1,58 +0,0 @@
-/* $OpenBSD: strcmp.S,v 1.5 2013/02/02 13:32:06 miod Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "DEFS.h"
-
-/*
- * NOTE: this guy returns result compatible with the VAX assembly version.
- * The C version on the portable gen directory returns different results
- * (different signs!) when comparing chars with the high bit on. Who is
- * right??
- */
-ENTRY(strcmp)
- movl %sp@(4),%a0 | a0 = string1
- movl %sp@(8),%a1 | a1 = string2
-scloop:
- movb %a0@+,%d0 | get *string1
- cmpb %a1@+,%d0 | compare a byte
- bne scexit | not equal, break out
- tstb %d0 | at end of string1?
- bne scloop | no, keep going
- moveq #0,%d0 | strings are equal
- rts
-scexit:
- subb %a1@-,%d0 | *string1 - *string2
- extbl %d0
- rts
diff --git a/sys/lib/libkern/arch/m68k/strlen.S b/sys/lib/libkern/arch/m68k/strlen.S
deleted file mode 100644
index 7afc6449ca1..00000000000
--- a/sys/lib/libkern/arch/m68k/strlen.S
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "DEFS.h"
-
-ENTRY(strlen)
- moveq #-1,%d0
- movl %sp@(4),%a0 | string
-slloop:
- addql #1,%d0 | increment count
- tstb %a0@+ | null?
- bne slloop | no, keep going
- rts
diff --git a/sys/lib/libkern/arch/m68k/strncmp.S b/sys/lib/libkern/arch/m68k/strncmp.S
deleted file mode 100644
index ee7727a7916..00000000000
--- a/sys/lib/libkern/arch/m68k/strncmp.S
+++ /dev/null
@@ -1,63 +0,0 @@
-/* $OpenBSD: strncmp.S,v 1.5 2013/02/02 13:32:06 miod Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "DEFS.h"
-
-/*
- * NOTE: this guy returns result compatible with the VAX assembly version.
- * The C version on the portable gen directory returns different results
- * (different signs!) when comparing chars with the high bit on. Who is
- * right??
- */
-ENTRY(strncmp)
- movl %sp@(12),%d1 | count
- beq scdone | nothing to do
- movl %sp@(4),%a0 | a0 = string1
- movl %sp@(8),%a1 | a1 = string2
-scloop:
- movb %a0@+,%d0 | get *string1
- cmpb %a1@+,%d0 | compare a byte
- bne scexit | not equal, break out
- tstb %d0 | at end of string1?
- beq scdone | yes, all done
- subql #1,%d1 | no, adjust count
- bne scloop | more to do, keep going
-scdone:
- moveq #0,%d0 | strings are equal
- rts
-scexit:
- subb %a1@-,%d0 | *string1 - *string2
- extbl %d0
- rts
diff --git a/sys/lib/libkern/arch/m68k/strncpy.S b/sys/lib/libkern/arch/m68k/strncpy.S
deleted file mode 100644
index d9d9363024c..00000000000
--- a/sys/lib/libkern/arch/m68k/strncpy.S
+++ /dev/null
@@ -1,55 +0,0 @@
-/* $OpenBSD: strncpy.S,v 1.5 2013/02/02 13:32:06 miod Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * the Systems Programming Group of the University of Utah Computer
- * Science Department.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "DEFS.h"
-
-ENTRY(strncpy)
- movl %sp@(4),%d0 | return value is toaddr
- movl %sp@(12),%d1 | count
- beq scdone | nothing to do
- movl %sp@(8),%a0 | a0 = fromaddr
- movl %d0,%a1 | a1 = toaddr
-scloop:
- movb %a0@+,%a1@+ | copy a byte
- beq scploop | copied null, go pad if necessary
- subql #1,%d1 | adjust count
- bne scloop | more room, keep going
-scdone:
- rts
-scploop:
- subql #1,%d1 | adjust count
- beq scdone | no more room, all done
- clrb %a1@+ | clear a byte
- jra scploop | keep going